@emailmaker/emailmaker 1.3.4 → 1.3.8

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 (73) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +20 -0
  3. package/emailmaker-core.091c986b.js +874 -0
  4. package/emailmaker-esm.js +53 -39
  5. package/{emailmaker-po.87ebe001.js → emailmaker-po.091c986b.js} +1 -1
  6. package/emailmaker.d.ts +95 -5
  7. package/emailmaker.js +54 -40
  8. package/iframe/.vite/manifest.json +4 -4
  9. package/iframe/css/sandbox-dark.css +2 -9
  10. package/iframe/css/sandbox-light.css +2 -9
  11. package/iframe/css/sandbox.css +13 -23
  12. package/iframe/{iframe-eblock.87ebe001.html → iframe-eblock.091c986b.html} +2 -2
  13. package/iframe/{iframe.87ebe001.html → iframe.091c986b.html} +2 -2
  14. package/iframe/js/elMarkupHelper.DoIAMao4.js +279 -0
  15. package/iframe/js/{iframe-eblock.body.87ebe001.js → iframe-eblock.body.091c986b.js} +1 -1
  16. package/iframe/js/iframe-eblock.js +2 -2
  17. package/iframe/js/iframe.body.091c986b.js +129 -0
  18. package/iframe/js/iframe.js +2 -2
  19. package/package.json +1 -1
  20. package/runtime/react/index.js +1 -1
  21. package/static/core/166a67bd.js +1 -0
  22. package/static/core/1a65ef0f.js +1 -0
  23. package/static/core/{4cdd6e6c.js → 1c67ab93.js} +1 -1
  24. package/static/core/{27599903.js → 1d004581.js} +1 -1
  25. package/static/core/{79e13595.js → 220d7d31.js} +1 -1
  26. package/static/core/{afb0d556.js → 2da7d310.js} +2 -2
  27. package/static/core/322d3e9f.js +1 -0
  28. package/static/core/{d8175c7f.js → 34756b09.js} +1 -1
  29. package/static/core/36f3f772.js +1 -0
  30. package/static/core/3b9931cd.js +1 -0
  31. package/static/core/{312fb954.js → 3bff2ae6.js} +1 -1
  32. package/static/core/{5afad425.js → 454350da.js} +1 -1
  33. package/static/core/{4797d4f7.js → 4852c0de.js} +6 -6
  34. package/static/core/{75a2537a.js → 5272f5b2.js} +1 -1
  35. package/static/core/{76163cc7.js → 5f176d0a.js} +1 -1
  36. package/static/core/674e22a5.js +1 -0
  37. package/static/core/{27986c36.js → 6ce85877.js} +1 -1
  38. package/static/core/7b8fbc31.js +1 -0
  39. package/static/core/{5ebf9f1e.js → 867b1e0a.js} +1 -1
  40. package/static/core/89b1052c.js +1 -0
  41. package/static/core/{81c0d133.js → 8b8c93f4.js} +1 -1
  42. package/static/core/8e97c82c.js +163 -0
  43. package/static/core/8eea6488.js +1 -0
  44. package/static/core/9a4cfb0a.js +1 -0
  45. package/static/core/{81a16991.js → 9d388494.js} +1 -1
  46. package/static/core/{2269bf04.js → 9e1370a6.js} +1 -1
  47. package/static/core/{9a7e933e.js → a59d579e.js} +1 -1
  48. package/static/core/{87c47034.js → a6abc393.js} +2 -2
  49. package/static/core/aa33047a.js +1 -0
  50. package/static/core/abde5a43.js +2 -0
  51. package/static/core/{d833a29f.js → b69579c4.js} +1 -1
  52. package/static/core/{489390a3.js → bcc4db3e.js} +1 -1
  53. package/static/core/{78916fed.js → c0b0ceff.js} +3 -3
  54. package/static/core/c5edcfc7.js +1 -0
  55. package/static/core/{122c5ed9.js → c9d5118c.js} +1 -1
  56. package/static/core/{81cc5690.js → caf9f1a6.js} +1 -1
  57. package/static/core/{7601732d.js → d241119a.js} +1 -1
  58. package/static/core/d4c10a7e.js +10 -0
  59. package/static/core/d517188a.js +1 -0
  60. package/static/core/db92581b.js +19 -0
  61. package/static/core/{a15ab3fe.js → de0d3c9a.js} +1 -1
  62. package/static/core/{8cebeef2.js → e995a70d.js} +1 -1
  63. package/static/core/ee26ef3d.js +1 -0
  64. package/static/core/f399000c.js +1 -0
  65. package/static/core/{67cc6cb2.js → f875f388.js} +1 -1
  66. package/static/esm/{9610f2de.js → 95cbf920.js} +1 -1
  67. package/static/umd-runtime/{runtime.BHEKxbjr.js → runtime.CV4WRxRc.js} +1 -1
  68. package/vendor/@emailmaker/ui-kit/package.json +1 -1
  69. package/emailmaker-core.87ebe001.js +0 -859
  70. package/iframe/js/elMarkupHelper.CO37NCd9.js +0 -278
  71. package/iframe/js/iframe.body.87ebe001.js +0 -129
  72. package/static/core/32e15918.js +0 -1
  73. package/static/core/b8941eda.js +0 -28
@@ -0,0 +1,19 @@
1
+ (function(){try{if(typeof document<"u"){var r=".blocks-app .form-editor-calendar-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-calendar-panel .panel-form__body.form-editor-calendar-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-calendar-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-calendar-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-calendar-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-calendar.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-calendar__label-with-info{align-items:center;gap:6px;display:inline-flex}.blocks-app .form-editor-calendar__info-icon{color:var(--em-colorTextSecondary);cursor:help;display:inline-flex}.blocks-app .form-editor-calendar__section-divider{margin:16px 0 20px}.blocks-app .form-editor-calendar__more-btn{margin-bottom:12px}.blocks-app .form-editor-calendar__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-calendar__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-calendar__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-calendar__bg-preview{align-items:center;gap:12px;margin-top:4px;padding-top:12px;display:flex}.blocks-app .form-editor-calendar__bg-chip{border-radius:calc(var(--em-borderRadius) * 1px);border:1px solid var(--em-colorBorderSecondary);justify-content:center;align-items:center;min-width:40px;height:36px;padding:0 10px;line-height:1;display:inline-flex}.blocks-app .form-editor-calendar__bg-chip--active{box-shadow:0 0 0 1px var(--em-colorPrimaryBg)}.blocks-app .form-editor-calendar__full-width{width:100%}.blocks-app .form-editor-calendar__typography-stack{flex-direction:column;gap:16px;display:flex}.blocks-app .form-editor-calendar .form-border-radius-inputs,.blocks-app .form-editor-calendar .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-checkbox-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-checkbox-panel .panel-form__body.form-editor-checkbox-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-checkbox-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-checkbox-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-checkbox-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-checkbox.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-checkbox__label-with-info{align-items:center;gap:6px;display:inline-flex}.blocks-app .form-editor-checkbox__info-icon{color:var(--em-colorTextSecondary);cursor:help;display:inline-flex}.blocks-app .form-editor-checkbox__default-radios.em-radio.ant-radio-group,.blocks-app .form-editor-checkbox__shape-radios.em-radio.ant-radio-group{flex-wrap:wrap;align-items:center;gap:8px 24px;display:flex}.blocks-app .form-editor-checkbox__icon-toggle-group.em-radio.ant-radio-group{flex-wrap:nowrap;gap:6px;display:flex}.blocks-app .form-editor-checkbox__icon-toggle-group .ant-radio-button-wrapper{justify-content:center;align-items:center;min-width:32px;padding-inline:10px;line-height:1;display:inline-flex}.blocks-app .form-editor-checkbox__inner-section-divider{margin:12px 0 16px}.blocks-app .form-editor-checkbox__align-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-checkbox__align-block{margin-top:16px}.blocks-app .form-editor-checkbox__align-columns{flex-wrap:wrap;align-items:flex-start;gap:16px 24px;display:flex}.blocks-app .form-editor-checkbox__align-column{flex:140px;min-width:108px}.blocks-app .form-editor-checkbox__section-divider{margin:16px 0 20px}.blocks-app .form-editor-checkbox__more-btn{margin-bottom:12px}.blocks-app .form-editor-checkbox__bg-preview{flex-direction:column;gap:8px;margin-top:4px;padding-top:8px;display:flex}.blocks-app .form-editor-checkbox__preview-panel{border:1px solid var(--em-colorBorderSecondary);border-radius:calc(var(--em-borderRadius) * 1px);box-sizing:border-box;flex-direction:column;gap:6px;padding:10px;display:flex}.blocks-app .form-editor-checkbox__preview-row{box-sizing:border-box;align-items:center;gap:10px;min-height:28px;padding:4px 0;display:flex}.blocks-app .form-editor-checkbox__preview-checkbox{box-sizing:border-box;border-style:solid;border-width:2px;flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex}.blocks-app .form-editor-checkbox__preview-checkbox--round{border-radius:50%}.blocks-app .form-editor-checkbox__preview-checkbox--square{border-radius:2px}.blocks-app .form-editor-checkbox__preview-label{color:var(--em-colorText);font-size:12px;line-height:1.3}.blocks-app .form-editor-checkbox__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-checkbox__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-checkbox__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-checkbox__full-width{width:100%}.blocks-app .form-editor-checkbox__micro-label{color:var(--em-colorTextSecondary);margin-bottom:0;font-size:12px;line-height:1.2;display:block}.blocks-app .form-editor-checkbox .form-border-radius-inputs,.blocks-app .form-editor-checkbox .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-dropdown-list-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-dropdown-list-panel .panel-form__body.form-editor-dropdown-list-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-dropdown-list-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-dropdown-list-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-dropdown-list-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-dropdown.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-dropdown__section-divider{margin:16px 0 20px}.blocks-app .form-editor-dropdown__more-btn{margin-bottom:12px}.blocks-app .form-editor-dropdown__bg-preview{flex-direction:column;gap:8px;margin-top:4px;padding-top:8px;display:flex}.blocks-app .form-editor-dropdown__trigger-mock{border:1px solid var(--em-colorBorderSecondary);border-radius:calc(var(--em-borderRadius) * 1px);box-sizing:border-box;justify-content:space-between;align-items:center;gap:8px;min-height:32px;padding:4px 11px;display:flex}.blocks-app .form-editor-dropdown__trigger-mock-text{min-width:0;color:var(--em-colorTextQuaternary,var(--em-colorTextSecondary));text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:12px;line-height:1.3;overflow:hidden}.blocks-app .form-editor-dropdown__trigger-mock-arrow{flex-shrink:0;align-items:center;line-height:0;display:inline-flex}.blocks-app .form-editor-dropdown__list-mock{border:1px solid var(--em-colorBorderSecondary);border-radius:calc(var(--em-borderRadius) * 1px);box-sizing:border-box;flex-direction:column;gap:4px;padding:8px 10px;display:flex}.blocks-app .form-editor-dropdown__list-mock-item{color:var(--em-colorText);font-size:12px;line-height:1.4}.blocks-app .form-editor-dropdown__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-dropdown__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-dropdown__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-dropdown__full-width{width:100%}.blocks-app .form-editor-dropdown .form-border-radius-inputs,.blocks-app .form-editor-dropdown .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-input-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-input-panel .panel-form__body.form-editor-input-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-input-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-input-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-input-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-input.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-input__icon-toggle-group.em-radio.ant-radio-group{flex-wrap:nowrap;gap:6px;display:flex}.blocks-app .form-editor-input__icon-toggle-group .ant-radio-button-wrapper{justify-content:center;align-items:center;min-width:32px;padding-inline:10px;line-height:1;display:inline-flex}.blocks-app .form-editor-input__align-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-input__align-columns{flex-wrap:wrap;align-items:flex-start;gap:16px 24px;display:flex}.blocks-app .form-editor-input__align-column{flex:140px;min-width:108px}.blocks-app .form-editor-input__section-divider{margin:16px 0 20px}.blocks-app .form-editor-input__more-btn{margin-bottom:12px}.blocks-app .form-editor-input__bg-preview{margin-top:4px;padding-top:8px}.blocks-app .form-editor-input__preview-panel{border:1px solid var(--em-colorBorderSecondary);border-radius:calc(var(--em-borderRadius) * 1px);box-sizing:border-box;padding:10px}.blocks-app .form-editor-input__preview-input{border-radius:calc(var(--em-borderRadius) * 1px);box-sizing:border-box;text-align:left;border-style:solid;border-width:1px;width:100%;min-height:32px;padding:6px 11px;font-size:14px;line-height:1.4}.blocks-app .form-editor-input__preview-placeholder-bit{opacity:.65}.blocks-app .form-editor-input__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-input__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-input__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-input__full-width{width:100%}.blocks-app .form-editor-input .form-border-radius-inputs,.blocks-app .form-editor-input .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-input__padding-row{flex-wrap:wrap;align-items:flex-start;gap:8px;width:100%;display:flex}.blocks-app .form-editor-input__padding-field.ant-form-item{flex:120px;min-width:100px;max-width:calc(50% - 4px);margin-bottom:0}.blocks-app .form-editor-input__padding-link-btn{flex:0 0 32px;justify-content:center;align-items:center;width:32px;height:32px;padding:0;display:inline-flex}.blocks-app .form-editor-input__advanced-block{flex-direction:column;gap:8px;width:100%;display:flex}.blocks-app .form-editor-input__advanced-block+.form-editor-input__advanced-block{margin-top:16px}.blocks-app .form-editor-input__advanced-switch-row{align-items:center;gap:12px;width:100%;padding:6px 0;display:flex}.blocks-app .form-editor-input__advanced-switch-label{color:var(--em-colorText);flex:auto;min-width:0;margin:0;font-size:14px;line-height:1.3}.blocks-app .form-editor-input__advanced-description{margin:0;font-size:12px;line-height:1.35;display:block}.blocks-app .form-editor-input__visibility-row{flex-wrap:wrap;align-items:center;gap:12px 16px;width:100%;display:flex}.blocks-app .form-editor-input__visibility-form-item.ant-form-item,.blocks-app .form-editor-input__direction-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-input__visibility-segment.ant-radio-group,.blocks-app .form-editor-input__visibility-amp.ant-radio-group{flex-wrap:wrap;gap:6px;display:flex}.blocks-app .form-editor-input__visibility-segment .ant-radio-button-wrapper,.blocks-app .form-editor-input__visibility-amp .ant-radio-button-wrapper{justify-content:center;align-items:center;display:inline-flex}.blocks-app .form-editor-radio-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-radio-panel .panel-form__body.form-editor-radio-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-radio-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-radio-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-radio-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-radio.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-radio__default-radios.em-radio.ant-radio-group,.blocks-app .form-editor-radio__shape-radios.em-radio.ant-radio-group{flex-wrap:wrap;align-items:center;gap:8px 24px;display:flex}.blocks-app .form-editor-radio__icon-toggle-group.em-radio.ant-radio-group{flex-wrap:nowrap;gap:6px;display:flex}.blocks-app .form-editor-radio__icon-toggle-group .ant-radio-button-wrapper{justify-content:center;align-items:center;min-width:32px;padding-inline:10px;line-height:1;display:inline-flex}.blocks-app .form-editor-radio__inner-section-divider{margin:12px 0 16px}.blocks-app .form-editor-radio__position-block,.blocks-app .form-editor-radio__layout-form-item.ant-form-item,.blocks-app .form-editor-radio__align-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-radio__align-block{margin-top:16px}.blocks-app .form-editor-radio__section-divider{margin:16px 0 20px}.blocks-app .form-editor-radio__more-btn{margin-bottom:12px}.blocks-app .form-editor-radio__bg-preview{flex-direction:column;gap:8px;margin-top:4px;padding-top:8px;display:flex}.blocks-app .form-editor-radio__preview-panel{border:1px solid var(--em-colorBorderSecondary);border-radius:calc(var(--em-borderRadius) * 1px);box-sizing:border-box;flex-direction:column;gap:6px;padding:10px;display:flex}.blocks-app .form-editor-radio__preview-row{border-radius:calc(var(--em-borderRadius) * 1px);box-sizing:border-box;align-items:center;gap:10px;min-height:28px;padding:4px 8px;display:flex}.blocks-app .form-editor-radio__preview-dot{border:2px solid var(--em-colorBorderSecondary);box-sizing:border-box;border-radius:50%;flex-shrink:0;width:14px;height:14px}.blocks-app .form-editor-radio__preview-dot--selected{border-style:solid}.blocks-app .form-editor-radio__preview-label{color:var(--em-colorText);font-size:12px;line-height:1.3}.blocks-app .form-editor-radio__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-radio__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-radio__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-radio__full-width{width:100%}.blocks-app .form-editor-radio__micro-label{color:var(--em-colorTextSecondary);margin-bottom:0;font-size:12px;line-height:1.2;display:block}.blocks-app .form-editor-radio .form-border-radius-inputs,.blocks-app .form-editor-radio .em-form-border-inputs{margin-top:4px}",o=window.__emailmaker_styles__||(window.__emailmaker_styles__={sheets:{},order:[]}),t=r;if(!o.sheets[t]){var i=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(i=new CSSStyleSheet,i.replaceSync(r))}catch{i=null}if(i){if(!o.host||!o.host.isConnected||!o.host.sheet){var e=document.createElement("style");e.setAttribute("data-emailmaker","true"),document.head.appendChild(e),o.host=e}for(var d=o.host.sheet,a=0;a<i.cssRules.length;a++)try{d.insertRule(i.cssRules[a].cssText,d.cssRules.length)}catch{}(o.texts||(o.texts=[])).push(r),(o.listeners||[]).forEach(function(p){try{p(r)}catch{}})}else{var e=document.createElement("style");e.setAttribute("data-emailmaker","true"),e.appendChild(document.createTextNode(r)),document.head.appendChild(e)}o.sheets[t]=!0,o.order.push(t)}}}catch(p){console.error("vite-plugin-css-injected-by-js",p)}})();
2
+ __emailmaker__.define("static/core/4423e721.js",["require","exports","module","static/core/5dc34752.js","static/core/c948c45f.js","static/core/652a482d.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./5dc34752.js"),r=B("./c948c45f.js"),u=B("./652a482d.js");let d=B("react");d=J.__toESM(d);let e=B("react/jsx-runtime"),i=B("__delivery__/libs"),Q=B("classnames");Q=J.__toESM(Q);var S=J.__toESM(r.require_prop_types()),h="calendar_",ee=`${h}borderRadiusAll`,N=`${h}borderRadiusTopLeft`,y=`${h}borderRadiusTopRight`,L=`${h}borderRadiusBottomLeft`,w=`${h}borderRadiusBottomRight`,ne="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",he=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function ie({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:he,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}ie.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function xe(){const t=i.ui_kit$Form.useWatch("inactiveDateBg"),l=i.ui_kit$Form.useWatch("activeDateBg"),a=i.ui_kit$Form.useWatch("inactiveColor"),o=i.ui_kit$Form.useWatch("activeColor"),c=i.ui_kit$Form.useWatch("inactiveFontFamily"),_=i.ui_kit$Form.useWatch("activeFontFamily"),m=i.ui_kit$Form.useWatch("inactiveFontSize"),$=i.ui_kit$Form.useWatch("activeFontSize"),b=i.ui_kit$Form.useWatch("inactiveTextStrong"),g=i.ui_kit$Form.useWatch("activeTextStrong");return(0,e.jsxs)("div",{className:"form-editor-calendar__bg-preview","aria-hidden":!0,children:[(0,e.jsx)("span",{className:"form-editor-calendar__bg-chip",style:{background:t,color:a,fontFamily:c,fontSize:m,fontWeight:b?700:400},children:"31"}),(0,e.jsx)("span",{className:"form-editor-calendar__bg-chip form-editor-calendar__bg-chip--active",style:{background:l,color:o,fontFamily:_,fontSize:$,fontWeight:g?700:400},children:"15"})]})}var ke=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>({placeholder:"",valueMode:void 0,dateFormat:"24h",required:!1,inactiveDateBg:"#ffffff",activeDateBg:"#01bca6",inactiveFontFamily:ne,inactiveFontSize:19,inactiveLineHeight:24,inactiveColor:"#333333",inactiveTextStrong:!1,inactiveTextItalic:!1,inactiveTextStrikethrough:!1,inactiveTextUnderline:!1,activeFontFamily:ne,activeFontSize:19,activeLineHeight:24,activeColor:"#ffffff",activeTextStrong:!0,activeTextItalic:!1,activeTextStrikethrough:!1,activeTextUnderline:!1,[`${h}borderPosition`]:`${h}borderAll`,[`${h}borderAll`]:{width:1,style:"solid",color:"#ffffff"},[`${h}borderTop`]:{...u.NULL_BORDER},[`${h}borderBottom`]:{...u.NULL_BORDER},[`${h}borderRight`]:{...u.NULL_BORDER},[`${h}borderLeft`]:{...u.NULL_BORDER},[ee]:5,[N]:null,[y]:null,[L]:null,[w]:null}),[]),g=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),v=(0,d.useCallback)(()=>{const n=o.getFieldsValue(!0);if(m){const j=n[ee]??0;o.setFieldsValue({[N]:j,[y]:j,[L]:j,[w]:j})}else{const j=n[N];j===n[y]&&j===n[L]&&j===n[w]?o.setFieldsValue({[ee]:j}):o.setFieldsValue({[N]:null,[y]:null,[L]:null,[w]:null})}$(j=>!j)},[o,m]),R=[{value:"24h",label:t("24 hours")},{value:"12h",label:t("12 hours")},{value:"DDMMYYYY",label:"DD.MM.YYYY"},{value:"YYYYMMDD",label:"YYYY-MM-DD"}],C=[{value:"empty",label:t("Enter value")},{value:"today",label:t("Today")},{value:"custom",label:t("Custom")}],T=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),s=(0,e.jsx)("div",{className:"form-editor-calendar-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-calendar",autoComplete:"off",initialValues:b,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"valueMode",label:(0,e.jsxs)("span",{className:"form-editor-calendar__label-with-info",children:[t("Value"),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Default or bound value for the field"),children:(0,e.jsx)("span",{className:"form-editor-calendar__info-icon",children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"InfoCircleOutlined",component:i.icons$InfoCircleOutlined,size:16})})})]}),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-calendar__full-width",placeholder:t("Enter value"),options:C,allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"dateFormat",label:t("Date format"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-calendar__full-width",options:R})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-calendar__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-calendar__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(n=>!n),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-calendar__expanded",children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Background"),children:(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:20,className:"form-editor-calendar__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"inactiveDateBg",label:t("Inactive date background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"activeDateBg",label:t("Active date background color")}),(0,e.jsx)(xe,{})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Input field text"),children:(0,e.jsxs)("div",{className:"form-editor-calendar__typography-stack",children:[(0,e.jsx)(ie,{namePrefix:"inactive",microLabel:t("Inactive date font")}),(0,e.jsx)(ie,{namePrefix:"active",microLabel:t("Active date font")})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:h,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:v,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:h})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-calendar-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:g,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:T,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-calendar-panel__title",children:t("Calendar")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-calendar-panel__body",padding:{horizontal:0,vertical:0},children:s})]})},x="checkbox_",te=`${x}borderRadiusAll`,O=`${x}borderRadiusTopLeft`,E=`${x}borderRadiusTopRight`,A=`${x}borderRadiusBottomLeft`,P=`${x}borderRadiusBottomRight`,fe="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",ae=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function se({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:ae,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}se.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function $e(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("markerShape"),a=i.ui_kit$Form.useWatch("appearanceBackground"),o=i.ui_kit$Form.useWatch("appearanceStrokeColor"),c=i.ui_kit$Form.useWatch("appearanceCheckColor"),_=i.ui_kit$Form.useWatch("useCustomCheckIcon"),m=(0,Q.default)("form-editor-checkbox__preview-checkbox",l==="round"&&"form-editor-checkbox__preview-checkbox--round",l==="square"&&"form-editor-checkbox__preview-checkbox--square");return(0,e.jsx)("div",{className:"form-editor-checkbox__bg-preview","aria-hidden":!0,children:(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-panel",children:[(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-row",children:[(0,e.jsx)("span",{className:m,style:{borderColor:o,background:c},children:!_&&(0,e.jsx)(i.ui_kit$EmIcons,{icon:"CheckOutlined",component:i.icons$CheckOutlined,size:10,style:{color:"#ffffff"}})}),(0,e.jsx)("span",{className:"form-editor-checkbox__preview-label",children:t("Checked")})]}),(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-row",children:[(0,e.jsx)("span",{className:m,style:{borderColor:o,background:a}}),(0,e.jsx)("span",{className:"form-editor-checkbox__preview-label",children:t("Unchecked")})]})]})})}function be(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("useCustomCheckIcon");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"markerShape",label:t("Marker shape"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__shape-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"round",children:t("Round")}),(0,e.jsx)(i.ui_kit$Radio,{value:"square",children:t("Square")})]})}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-checkbox__inner-section-divider"}),(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:16,className:"form-editor-checkbox__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceBackground",label:t("Background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceStrokeColor",label:t("Stroke color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceCheckColor",label:t("Checked fill color")})]}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"useCustomCheckIcon",label:t("Use custom icon for checked state")}),l&&(0,e.jsx)(i.ui_kit$Form.Item,{name:"customCheckIconUrl",label:t("Checked icon URL"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:"https://",allowClear:!0})}),(0,e.jsx)($e,{})]})}function ge(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Position in cell"),children:(0,e.jsxs)("div",{className:"form-editor-checkbox__align-columns",children:[(0,e.jsxs)("div",{className:"form-editor-checkbox__align-column",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label",children:t("Horizontal alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignHorizontal",className:"form-editor-checkbox__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"left",title:t("Align left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignLeftOutlined",component:i.icons$AlignLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"center",title:t("Align center"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignCenterOutlined",component:i.icons$AlignCenterOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"right",title:t("Align right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignRightOutlined",component:i.icons$AlignRightOutlined,size:16,strokeWidth:l})})]})})]}),(0,e.jsxs)("div",{className:"form-editor-checkbox__align-column",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label",children:t("Vertical alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignVertical",className:"form-editor-checkbox__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"top",title:t("Align top"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalTop",component:i.icons$AlignVerticalTop,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"middle",title:t("Align middle"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalCenter",component:i.icons$AlignVerticalCenter,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"bottom",title:t("Align bottom"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalBottom",component:i.icons$AlignVerticalBottom,size:16,strokeWidth:l})})]})})]})]})})}function je(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("showHelperText")?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"helperText",label:t("Helper text"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Tooltip or hint text"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"validationErrorText",label:t("Validation error message"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Message when validation fails"),allowClear:!0})})]}):null}var Fe=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({fieldHeading:"",boundValue:void 0,checkboxLabel:"",required:!1,defaultState:"disabled",showHelperText:!1,helperText:"",validationErrorText:"",alignHorizontal:"left",alignVertical:"top",markerShape:"square",appearanceBackground:"#ffffff",appearanceStrokeColor:"#d9d9d9",appearanceCheckColor:"#01bca6",useCustomCheckIcon:!1,customCheckIconUrl:"",labelTextFontFamily:fe,labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${x}borderPosition`]:`${x}borderAll`,[`${x}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${x}borderTop`]:{...u.NULL_BORDER},[`${x}borderBottom`]:{...u.NULL_BORDER},[`${x}borderRight`]:{...u.NULL_BORDER},[`${x}borderLeft`]:{...u.NULL_BORDER},[te]:5,[O]:null,[E]:null,[A]:null,[P]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[te]??0;o.setFieldsValue({[O]:n,[E]:n,[A]:n,[P]:n})}else{const n=s[O];n===s[E]&&n===s[A]&&n===s[P]?o.setFieldsValue({[te]:n}):o.setFieldsValue({[O]:null,[E]:null,[A]:null,[P]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-checkbox-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-checkbox",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldHeading",label:t("Field heading"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Title shown above the control"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"boundValue",label:(0,e.jsxs)("span",{className:"form-editor-checkbox__label-with-info",children:[t("Value"),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Stored or bound value for this field"),children:(0,e.jsx)("span",{className:"form-editor-checkbox__info-icon",children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"InfoCircleOutlined",component:i.icons$InfoCircleOutlined,size:12})})})]}),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-checkbox__full-width",placeholder:t("Enter value"),options:b,allowClear:!0,getPopupContainer:ae})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"checkboxLabel",label:t("Label next to checkbox"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text beside the box"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"defaultState",label:t("Default value"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__default-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"enabled",children:t("Enabled")}),(0,e.jsx)(i.ui_kit$Radio,{value:"disabled",children:t("Disabled")})]})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showHelperText",label:t("Helper text / tooltip")}),(0,e.jsx)(je,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-checkbox__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-checkbox__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-checkbox__expanded",children:[(0,e.jsx)(ge,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Appearance"),children:(0,e.jsx)(be,{})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Label text style"),children:(0,e.jsx)(se,{namePrefix:"labelText",microLabel:t("Caption next to checkbox")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:x,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:x})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-checkbox-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-checkbox-panel__title",children:t("Checkbox")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-checkbox-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},k="dropdown_",oe=`${k}borderRadiusAll`,D=`${k}borderRadiusTopLeft`,V=`${k}borderRadiusTopRight`,z=`${k}borderRadiusBottomLeft`,W=`${k}borderRadiusBottomRight`,ve="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",ce=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function de({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:ce,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}de.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function Re(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("triggerBackground"),a=i.ui_kit$Form.useWatch("listPanelBackground"),o=i.ui_kit$Form.useWatch("arrowColor");return(0,e.jsxs)("div",{className:"form-editor-dropdown__bg-preview","aria-hidden":!0,children:[(0,e.jsxs)("div",{className:"form-editor-dropdown__trigger-mock",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-dropdown__trigger-mock-text",children:t("Text visible at the start")}),(0,e.jsx)("span",{className:"form-editor-dropdown__trigger-mock-arrow",style:{color:o},children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DownOutlined",component:i.icons$DownOutlined,size:14})})]}),(0,e.jsxs)("div",{className:"form-editor-dropdown__list-mock",style:{background:a},children:[(0,e.jsxs)("span",{className:"form-editor-dropdown__list-mock-item",children:[t("Value")," 1"]}),(0,e.jsxs)("span",{className:"form-editor-dropdown__list-mock-item",children:[t("Value")," 2"]})]})]})}var Ce=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",options:[{title:"",boundValue:void 0},{title:"",boundValue:void 0}],allowMultiple:!1,required:!1,triggerBackground:"#ffffff",listPanelBackground:"#ffffff",arrowColor:"rgba(0, 0, 0, 0.45)",listTextFontFamily:ve,listTextFontSize:14,listTextLineHeight:22,listTextColor:"#333333",listTextStrong:!1,listTextItalic:!1,listTextStrikethrough:!1,listTextUnderline:!1,[`${k}borderPosition`]:`${k}borderAll`,[`${k}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${k}borderTop`]:{...u.NULL_BORDER},[`${k}borderBottom`]:{...u.NULL_BORDER},[`${k}borderRight`]:{...u.NULL_BORDER},[`${k}borderLeft`]:{...u.NULL_BORDER},[oe]:5,[D]:null,[V]:null,[z]:null,[W]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[oe]??0;o.setFieldsValue({[D]:n,[V]:n,[z]:n,[W]:n})}else{const n=s[D];n===s[V]&&n===s[z]&&n===s[W]?o.setFieldsValue({[oe]:n}):o.setFieldsValue({[D]:null,[V]:null,[z]:null,[W]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-dropdown-list-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-dropdown",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormOptionsList,{name:"options",boundValueOptions:b,getPopupContainer:ce,labels:{itemTitle:s=>`${t("Value")} ${s}`,headingLabel:t("Heading"),valueLabel:t("Value"),valueTooltip:t("Stored or bound value for this option"),addLabel:t("Add value"),removeTooltip:t("Remove"),headingPlaceholder:t("Enter heading"),valuePlaceholder:t("Enter value")}}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"allowMultiple",label:t("Allow multiple selection")}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-dropdown__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-dropdown__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-dropdown__expanded",children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Background"),children:(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:20,className:"form-editor-dropdown__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"triggerBackground",label:t("Closed field background")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"listPanelBackground",label:t("List panel background")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"arrowColor",label:t("Arrow color")}),(0,e.jsx)(Re,{})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("List text style"),children:(0,e.jsx)(de,{namePrefix:"listText",microLabel:t("List item appearance")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:k,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:k})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-dropdown-list-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-dropdown-list-panel__title",children:t("Dropdown list")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-dropdown-list-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},F={TEXT:"text",EMAIL:"email",PHONE:"phone",NAME:"name",URL:"url",PASSWORD:"password"},p="inputField_",le=`${p}borderRadiusAll`,U=`${p}borderRadiusTopLeft`,H=`${p}borderRadiusTopRight`,M=`${p}borderRadiusBottomLeft`,q=`${p}borderRadiusBottomRight`,ue="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",G=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function me({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:G,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}function Te(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("fieldBackground"),a=i.ui_kit$Form.useWatch(`${p}borderAll`),o=i.ui_kit$Form.useWatch("placeholderTextColor"),c=i.ui_kit$Form.useWatch("inputValueTextColor"),_=a?.color??"#d9d9d9";return(0,e.jsx)("div",{className:"form-editor-input__bg-preview","aria-hidden":!0,children:(0,e.jsx)("div",{className:"form-editor-input__preview-panel",children:(0,e.jsxs)("div",{className:"form-editor-input__preview-input",style:{background:l,borderColor:_,color:c},children:[(0,e.jsx)("span",{className:"form-editor-input__preview-placeholder-bit",style:{color:o},children:t("Placeholder")}),(0,e.jsx)("span",{children:" · "}),(0,e.jsx)("span",{children:t("Value")})]})})})}function Se(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useFormInstance(),a=(0,d.useCallback)(()=>{const o=l.getFieldValue("paddingHorizontal");o!=null&&o!==""&&l.setFieldValue("fieldMinHeight",o)},[l]);return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Internal padding"),children:(0,e.jsxs)("div",{className:"form-editor-input__padding-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"paddingHorizontal",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:"0",prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnWidthOutlined",component:i.icons$ColumnWidthOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMinHeight",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:t("Height"),prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnHeightOutlined",component:i.icons$ColumnHeightOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Apply horizontal padding to height"),children:(0,e.jsx)(i.ui_kit$Button,{type:"default",className:"form-editor-input__padding-link-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"BorderOuterOutlined",component:i.icons$BorderOuterOutlined,size:16}),onClick:a})})]})})}function Be(){const{__:t}=r.useI18n();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("Field state appearance")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customStylesForStates",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Use your own styles instead of defaults for states such as error, focus, and success.")})]}),(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("High contrast mode")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"highContrastMode",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Improves visibility by automatically tuning the form for accessibility. Turn off to restore the previous look.")})]})]})}function Ie(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility"),children:(0,e.jsxs)("div",{className:"form-editor-input__visibility-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldVisibility",className:"form-editor-input__visibility-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-segment",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"desktop",title:t("Desktop"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DesktopOutlined",component:i.icons$DesktopOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"mobile",title:t("Mobile"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MobileOutlined",component:i.icons$MobileOutlined,size:16,strokeWidth:l})})]})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldDirection",className:"form-editor-input__direction-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"ltr",title:t("Left to right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowLeftOutlined",component:i.icons$ArrowLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"rtl",title:t("Right to left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowRightOutlined",component:i.icons$ArrowRightOutlined,size:16,strokeWidth:l})})]})})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility in AMP"),children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"ampVisibility",className:"form-editor-input__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-amp",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"amp",children:"AMP"}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"html",children:"HTML"})]})})})]})}function Ne(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("limitLength")?(0,e.jsx)(i.ui_kit$Form.Item,{name:"maxLength",label:t("Maximum length"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:1,max:9999,placeholder:t("Characters"),addonAfter:t("chars")})}):null}function ye(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("inputType"),a=(0,d.useMemo)(()=>[{value:"minLength8",label:t("Minimum length 8 characters")},{value:"lowercase",label:t("Lowercase letters (a-z)")},{value:"uppercase",label:t("Uppercase letters (A-Z)")},{value:"digits",label:t("Digits (0-9)")},{value:"special",label:t("Special characters")}],[t]),o=(0,d.useMemo)(()=>[{value:"https",label:"HTTPS"},{value:"http",label:"HTTP"},{value:"mailto",label:"mailto:"},{value:"ftp",label:"FTP"}],[]);return l?(0,e.jsxs)(e.Fragment,{children:[l===F.TEXT&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"limitLength",label:t("Character limit")}),(0,e.jsx)(Ne,{})]}),l===F.PHONE&&(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"countryCodeSelector",label:t("Country selector (flag+code)")}),l===F.URL&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"urlAutoPrependProtocol",label:t("Auto-prepend protocol on blur")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"allowedProtocols",label:t("Allowed protocols"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose allowed protocols"),options:o,getPopupContainer:G,allowClear:!0})})]}),l===F.PASSWORD&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showPasswordEye",label:t("Show eye icon")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"passwordComplexityRules",label:t("Complexity rules"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose complexity rules"),options:a,getPopupContainer:G,allowClear:!0})})]})]}):null}var Le=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:F.TEXT,label:t("Text")},{value:F.EMAIL,label:t("Email")},{value:F.PHONE,label:t("Phone number")},{value:F.NAME,label:t("Name")},{value:F.URL,label:t("URL")},{value:F.PASSWORD,label:t("Password")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",required:!1,limitLength:!1,maxLength:100,hintText:"",countryCodeSelector:!1,urlAutoPrependProtocol:!1,allowedProtocols:[],showPasswordEye:!1,passwordComplexityRules:[],paddingHorizontal:16,customStylesForStates:!1,highContrastMode:!1,fieldVisibility:"always",fieldDirection:"ltr",ampVisibility:"always",fieldBackground:"#ffffff",inputValueTextFontFamily:ue,inputValueTextFontSize:14,inputValueTextLineHeight:22,inputValueTextColor:"#333333",inputValueTextStrong:!1,inputValueTextItalic:!1,inputValueTextStrikethrough:!1,inputValueTextUnderline:!1,placeholderTextFontFamily:ue,placeholderTextFontSize:14,placeholderTextLineHeight:22,placeholderTextColor:"rgba(0, 0, 0, 0.25)",placeholderTextStrong:!1,placeholderTextItalic:!1,placeholderTextStrikethrough:!1,placeholderTextUnderline:!1,[`${p}borderPosition`]:`${p}borderAll`,[`${p}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${p}borderTop`]:{...u.NULL_BORDER},[`${p}borderBottom`]:{...u.NULL_BORDER},[`${p}borderRight`]:{...u.NULL_BORDER},[`${p}borderLeft`]:{...u.NULL_BORDER},[le]:5,[U]:null,[H]:null,[M]:null,[q]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[le]??0;o.setFieldsValue({[U]:n,[H]:n,[M]:n,[q]:n})}else{const n=s[U];n===s[H]&&n===s[M]&&n===s[q]?o.setFieldsValue({[le]:n}):o.setFieldsValue({[U]:null,[H]:null,[M]:null,[q]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-input-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-input",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"inputType",label:t("Type"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-input__full-width",placeholder:t("Choose input type"),options:b,allowClear:!0,getPopupContainer:G})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Field required")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"hintText",label:t("Hint text"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Come up with a hint"),allowClear:!0})}),(0,e.jsx)(ye,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-input__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-input__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-input__expanded",children:[(0,e.jsx)(Se,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Size"),collapsible:!0,defaultOpen:!1,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMaxWidth",label:t("Max width"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:2e3,placeholder:t("Not set"),addonAfter:"px"})})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Background"),children:(0,e.jsx)(i.ui_kit$FormColorField,{name:"fieldBackground",label:t("Background color")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Input field text"),children:(0,e.jsx)(me,{namePrefix:"inputValueText",microLabel:t("Font")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Placeholder text"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(me,{namePrefix:"placeholderText",microLabel:t("Font")})}),(0,e.jsx)(Te,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:p,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:p})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Accessibility"),children:(0,e.jsx)(Be,{})}),(0,e.jsx)(Ie,{})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-input-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-input-panel__title",children:t("Input")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-input-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},f="radio_",re=`${f}borderRadiusAll`,Y=`${f}borderRadiusTopLeft`,X=`${f}borderRadiusTopRight`,K=`${f}borderRadiusBottomLeft`,Z=`${f}borderRadiusBottomRight`,we="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",pe=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function _e({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:pe,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}_e.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function Oe(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("appearanceBackground"),a=i.ui_kit$Form.useWatch("appearanceStrokeColor"),o=i.ui_kit$Form.useWatch("appearanceDotColor");return(0,e.jsx)("div",{className:"form-editor-radio__bg-preview","aria-hidden":!0,children:(0,e.jsxs)("div",{className:"form-editor-radio__preview-panel",children:[(0,e.jsxs)("div",{className:"form-editor-radio__preview-row",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-radio__preview-dot form-editor-radio__preview-dot--selected",style:{borderColor:a,background:o}}),(0,e.jsxs)("span",{className:"form-editor-radio__preview-label",children:[t("Value")," 1"]})]}),(0,e.jsxs)("div",{className:"form-editor-radio__preview-row",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-radio__preview-dot",style:{borderColor:a,background:"transparent"}}),(0,e.jsxs)("span",{className:"form-editor-radio__preview-label",children:[t("Value")," 2"]})]})]})})}function Ee(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("markerShape");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"markerShape",label:t("Marker shape"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__shape-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"round",children:t("Round")}),(0,e.jsx)(i.ui_kit$Radio,{value:"custom",children:t("Custom icon")})]})}),l==="custom"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"customIconUrl",label:t("Icon URL"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:"https://",allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customIconAlt",label:t("Icon description"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Accessibility text"),allowClear:!0})})]}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-radio__inner-section-divider"}),(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:16,className:"form-editor-radio__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceBackground",label:t("Background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceStrokeColor",label:t("Stroke color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceDotColor",label:t("Dot color")})]}),(0,e.jsx)(Oe,{})]})}function Ae(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Position in cell"),children:[(0,e.jsxs)(i.ui_kit$Row,{gutter:[12,16],className:"form-editor-radio__position-block",children:[(0,e.jsxs)(i.ui_kit$Col,{xs:24,sm:10,md:9,children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Layout")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"radioLayout",className:"form-editor-radio__layout-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"horizontal",title:t("Horizontal"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MenuOutlined",component:i.icons$MenuOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"vertical",title:t("Vertical"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Column",component:i.icons$Column,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"grid",title:t("Grid"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Grid01Icon",component:i.icons$Grid01Icon,size:16,strokeWidth:l})})]})})]}),(0,e.jsx)(i.ui_kit$Col,{xs:24,sm:14,md:15,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"radioOptionGap",label:t("Spacing"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:120,placeholder:t("Spacing"),addonAfter:"px"})})})]}),(0,e.jsxs)("div",{className:"form-editor-radio__align-block",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Horizontal alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignHorizontal",className:"form-editor-radio__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"left",title:t("Align left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignLeftOutlined",component:i.icons$AlignLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"center",title:t("Align center"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignCenterOutlined",component:i.icons$AlignCenterOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"right",title:t("Align right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignRightOutlined",component:i.icons$AlignRightOutlined,size:16,strokeWidth:l})})]})})]}),(0,e.jsxs)("div",{className:"form-editor-radio__align-block",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Vertical alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignVertical",className:"form-editor-radio__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"top",title:t("Align top"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalTop",component:i.icons$AlignVerticalTop,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"middle",title:t("Align middle"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalCenter",component:i.icons$AlignVerticalCenter,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"bottom",title:t("Align bottom"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalBottom",component:i.icons$AlignVerticalBottom,size:16,strokeWidth:l})})]})})]})]})}var Pe=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",options:[{title:"",boundValue:void 0},{title:"",boundValue:void 0}],allowShuffle:!1,required:!1,defaultState:"enabled",radioLayout:"vertical",radioOptionGap:20,alignHorizontal:"left",alignVertical:"top",markerShape:"round",customIconUrl:"",customIconAlt:"",appearanceBackground:"#ffffff",appearanceStrokeColor:"#01bca6",appearanceDotColor:"#01bca6",labelTextFontFamily:we,labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${f}borderPosition`]:`${f}borderAll`,[`${f}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${f}borderTop`]:{...u.NULL_BORDER},[`${f}borderBottom`]:{...u.NULL_BORDER},[`${f}borderRight`]:{...u.NULL_BORDER},[`${f}borderLeft`]:{...u.NULL_BORDER},[re]:5,[Y]:null,[X]:null,[K]:null,[Z]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[re]??0;o.setFieldsValue({[Y]:n,[X]:n,[K]:n,[Z]:n})}else{const n=s[Y];n===s[X]&&n===s[K]&&n===s[Z]?o.setFieldsValue({[re]:n}):o.setFieldsValue({[Y]:null,[X]:null,[K]:null,[Z]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-radio-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-radio",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormOptionsList,{name:"options",boundValueOptions:b,getPopupContainer:pe,labels:{itemTitle:s=>`${t("Value")} ${s}`,headingLabel:t("Heading"),valueLabel:t("Value"),valueTooltip:t("Stored or bound value for this option"),addLabel:t("Add value"),removeTooltip:t("Remove"),headingPlaceholder:t("Enter heading"),valuePlaceholder:t("Enter value")}}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"allowShuffle",label:t("Shuffle options")}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"defaultState",label:t("Default value"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__default-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"enabled",children:t("Enabled")}),(0,e.jsx)(i.ui_kit$Radio,{value:"disabled",children:t("Disabled")})]})}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-radio__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-radio__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-radio__expanded",children:[(0,e.jsx)(Ae,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Appearance"),children:(0,e.jsx)(Ee,{})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Label text style"),children:(0,e.jsx)(_e,{namePrefix:"labelText",microLabel:t("Caption next to options")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:f,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:f})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-radio-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-radio-panel__title",children:t("Radio button")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-radio-panel__body",padding:{horizontal:0,vertical:0},children:T})]})};I.FormEditorCalendarPanel=ke,I.FormEditorCheckboxPanel=Fe,I.FormEditorDropdownListPanel=Ce,I.FormEditorInputPanel=Le,I.FormEditorRadioPanel=Pe});
3
+
4
+ __emailmaker__.define("static/core/2d94d780.js",["require","exports","module","static/core/5dc34752.js","static/core/c948c45f.js","static/core/e4c1aab3.js","vite/preload-helper"],function(h,I,B){const D=h("./5dc34752.js"),n=h("./c948c45f.js"),p=h("./e4c1aab3.js");let R=h("vite/preload-helper");var b=D.__exportAll({IMPORT_UPLOAD_CONCURRENCY:()=>15,createDocumentProcessor:()=>W,createFileProcessor:()=>T,createImportFileNamer:()=>_,ensureFileExtension:()=>$,extractUploadResult:()=>F,fetchFileData:()=>U,getExt:()=>C,handleUploadResult:()=>j,importEmail:()=>L,importHtml:()=>x,importZip:()=>P,splitFileName:()=>M,uploadFile:()=>n.uploadFile});function C(e){const t=e.split(".");return t[t.length-1].toLowerCase()}function M(e){const t=e.split(".");return t[t.length-1].toLowerCase()}var w="index.html";function H(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function _(){const e=new Map;return(t,r)=>{const s=r.toLowerCase(),a=e.get(s);if(a===void 0)return e.set(s,t),r;if(a===t)return r;const i=r.lastIndexOf("."),l=`-${H(t)}`;return i>0?`${r.slice(0,i)}${l}${r.slice(i)}`:`${r}${l}`}}function E(e,t){return e.find(r=>r.toLowerCase().endsWith(t))}async function P(e,t,r){const s=await n.readZip(e),a=Object.keys(s),i=s[w]&&w||E(a,w)||E(a,".html")||E(a,".htm");if(i){const l=i.split("/"),d=document.location.pathname.split("/"),u=document.location.origin+d.slice(0,d.length-l.length).join("/")+"/",f=n.zipEntryToText(s[i]),{html:N,hasBrowserExtensionArtifacts:m}=n.prepareEmailHtmlForEditor(f),g=l.slice(0,l.length-1).join("/"),v=_();return{html:await p.changeHtml(N,async c=>{const y=c.document;await p.replaceImagesInDocument(y,async o=>{o=o.replace("\\","/"),o.startsWith(".")&&(o=o.substring(1)),o.startsWith("/")&&(o=o.substring(1)),o.startsWith(u)&&(o=o.substring(u.length)),g&&!o.match("^(ht|f)tp(s?)://")&&(o=`${g}/${o}`);const A=s[o];return A?t(n.zipEntryToBlob(A),o):t(o,v(o,p.getFileNameWithExt(o)))}),r&&r(c)}),hasBrowserExtensionArtifacts:m,sourceHtml:f}}}async function x(e,t,r){const{html:s,hasBrowserExtensionArtifacts:a}=n.prepareEmailHtmlForEditor(e),i=_();return{html:await p.changeHtml(s,async l=>{const d=l.document;await p.replaceImagesInDocument(d,async u=>(u=u.replace("\\","/"),t(u,i(u,p.getFileNameWithExt(u))))),r&&r(l)}),hasBrowserExtensionArtifacts:a,sourceHtml:e}}async function L(e,t,r){if(e)switch(C(e.name)){case"zip":return P(e,t,r);case"eml":{const s=await e.arrayBuffer(),{default:a}=await(0,R.__vitePreload)(async()=>{const{default:l}=await Promise.resolve().then(()=>h("./43a8b244.js"));return{default:l}},void 0,{}.url),i=(await a.parse(s)).html??void 0;if(typeof i>"u")throw new Error("Eml does not contain text/html");return x(i,t,r)}default:return x(await e.text(),t,r)}}async function U(e,t){if(typeof e!="string")return e;try{const r=await t({url:n.normalizeUrl(e)});return r?.data,r?.data||null}catch{return null}}async function $(e,t){if(!e||typeof e!="string")return`default.${await n.getMimeExtension(t)||"bin"}`;if(e.split(".").length<2){const r=await n.getMimeExtension(t);if(r)return`${e}.${r}`}return e}function F(e){if(e&&typeof e=="object"&&!Array.isArray(e)&&"code"in e&&"message"in e&&e.data){if(e.data.status===400)return{file_url:null,error:{code:e.code,message:e.message,status:e.data.status}};if(e.data.file_url)return{file_url:e.data.file_url,error:null}}if(Array.isArray(e)&&e.length>0){const t=e[0];if(t&&typeof t=="object"){if("code"in t&&"message"in t&&t.data?.status===400)return{file_url:null,error:{code:t.code,message:t.message,status:t.data.status}};if("file_url"in t&&t.file_url)return{file_url:t.file_url,error:null}}}if(e&&typeof e=="object"&&!Array.isArray(e)&&0 in e){if(e.data?.status===400)return{file_url:null,error:{status:e.data.status}};if(e[0]?.file_url)return{file_url:e[0].file_url,error:null}}return{file_url:null,error:null}}function j(e,t){if(!e||e.error)return typeof t=="string"?t:"";const r=F(e.data);return r.error?typeof t=="string"?t:"":r.file_url?r.file_url:typeof t=="string"?t:""}var z=15;function O(e){let t=0;const r=[],s=()=>{t--,r.shift()?.()};return async a=>{t>=e&&await new Promise(i=>r.push(i)),t++;try{return await a()}finally{s()}}}var T=(e,t,r,s,a)=>{const{maxSizeMB:i,maxWidthOrHeight:l}=n.resolveImageCompressionLimits(a),d=n.getBrowserImageCompressionLibUrl(),u=O(15);return(f,N)=>u(async()=>{try{const m=await U(f,e);if(!m)return typeof f=="string"?f:"";const g=await $(N,m.type),v=m.type?.trim()||n.inferImageMimeFromFileName(g)||"";let c=new File([m],g.toLowerCase(),{type:v});if(n.isAllowedImageUploadFile(c)){const y=c.type?.trim()||n.inferImageMimeFromFileName(c.name)||m.type||"";try{c=await n.prepareImageForUpload(c,{maxSizeMB:i,maxWidthOrHeight:l,mimeType:y||m.type,fileName:c.name,libURL:d,enableCompression:n.shouldEnableImageCompression(a,y),convertSvgToPng:!0})}catch{}}return j(await t({user_id:r.id,folder:s.id,file:c}),f)}catch{return typeof f=="string"?f:""}})},W=e=>t=>{const r=t.document;r.title=(r.querySelector("title")?.textContent??"").replace(/\s+/g," ").trim()||p.getFileNameAndExt(e.name)[0]};Object.defineProperty(I,"extractUploadResult",{enumerable:!0,get:function(){return F}}),Object.defineProperty(I,"import_exports",{enumerable:!0,get:function(){return b}})});
5
+
6
+ __emailmaker__.define("static/core/652a482d.js",["require","exports","module","static/core/5dc34752.js","static/core/c948c45f.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./5dc34752.js"),r=t("./c948c45f.js");let o=t("react");o=i.__toESM(o);let l=t("react/jsx-runtime"),d=t("__delivery__/libs");function n(){return r.usePlanFeatureGate("google_fonts").isLocked?void 0:r.loadGFonts}var u=c=>{const{form:g,namePrefix:I="",typeOfForm:s="desktop"}=c,E=r.useSelector(r.selectEmailSettings).usedColors;return(0,l.jsx)(d.ui_kit$FormBorderInputs,{form:g,namePrefix:I,typeOfForm:s,usedColors:E})},b={paddingTop:"top",paddingLeft:"left",paddingRight:"right",paddingBottom:"bottom",mobilePaddingTop:"top",mobilePaddingLeft:"left",mobilePaddingRight:"right",mobilePaddingBottom:"bottom"},m={borderRadiusAll:"all",borderRadiusTopLeft:"topLeft",borderRadiusBottomLeft:"bottomLeft",borderRadiusTopRight:"topRight",borderRadiusBottomRight:"bottomRight"},a={mobileBorderRadiusAll:"all",mobileBorderRadiusTopLeft:"topLeft",mobileBorderRadiusBottomLeft:"bottomLeft",mobileBorderRadiusTopRight:"topRight",mobileBorderRadiusBottomRight:"bottomRight"},R={all:"borderAll",top:"borderTop",right:"borderRight",bottom:"borderBottom",left:"borderLeft"},O={all:"mobileBorderAll",top:"mobileBorderTop",right:"mobileBorderRight",bottom:"mobileBorderBottom",left:"mobileBorderLeft"},_={width:null,style:null,color:null},B={borderAll:"all",borderTop:"top",borderRight:"right",borderBottom:"bottom",borderLeft:"left"},f={mobileBorderAll:"all",mobileBorderTop:"top",mobileBorderRight:"right",mobileBorderBottom:"bottom",mobileBorderLeft:"left"};Object.defineProperty(e,"BORDER_POSITIONS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"MOBILE_BORDER_POSITIONS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"MOBILE_BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"MOBILE_REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NULL_BORDER",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"PADDING_POSITION",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"SelectedElementFormBorder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"useGoogleFontsLoader",{enumerable:!0,get:function(){return n}})});
7
+
8
+ (function(){try{if(typeof document<"u"){var t='.blocks-app .upload-bg-image{margin-bottom:calc(var(--em-formItemMarginBottomXS) * 1px)}.blocks-app .upload-bg-image__inner-wrap{border:calc(var(--em-borderWidth) * 1px) solid var(--em-colorFillSecondaryDarken);border-radius:calc(var(--em-borderRadius) * 1px);cursor:pointer;background-color:var(--em-colorBgContainer);justify-content:space-between;align-items:center;transition:all .2s linear .2s;display:flex}.blocks-app .upload-bg-image__inner-wrap:hover{border-color:var(--em-borderColorHover)}.blocks-app .upload-bg-image__uploader{width:calc((var(--em-formControlHeight) - var(--em-borderWidth) * 2 + 1) * 1px);height:calc((var(--em-formControlHeight) - var(--em-borderWidth) * 2) * 1px);border-radius:calc(var(--em-borderRadius) * .8px);border:none;border-right:1px solid var(--em-colorFillSecondaryDarken);flex-shrink:0;margin-right:10px;overflow:hidden}.blocks-app .upload-bg-image__uploader-content{background:0 0;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;font-size:11px;display:flex}.blocks-app .upload-bg-image__uploader-content-inner{width:inherit;height:inherit;position:relative}.blocks-app .upload-bg-image__uploader-img-wrap{width:inherit;height:inherit;z-index:1;border:none;position:absolute;overflow:hidden}.blocks-app .upload-bg-image__uploader-img-wrap:after{opacity:0;content:"";transition:opacity .3s;position:absolute;inset:0}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-img-wrap:after{opacity:1}.blocks-app .upload-bg-image .upload-bg-image__empty{border-top:2px solid var(--em-colorError);z-index:2;width:27px;position:absolute;top:16px;left:3px;transform:rotate(-45deg)}.blocks-app .upload-bg-image .inputGroup{flex-direction:column;width:100%;display:flex}.blocks-app .upload-bg-image .image-size{color:var(--em-colorTextTertiary);padding-right:15px;font-size:12px}.blocks-app .upload-bg-image .image-empty-text,.blocks-app .upload-bg-image .image-size-splitter{color:var(--em-colorTextQuaternary)}.blocks-app .upload-bg-image__edit,.blocks-app .upload-bg-image__edit-menu{color:var(--em-colorLink);right:calc((var(--em-borderWidth) + 2) * 1px);padding:6px;line-height:1;position:absolute}.blocks-app .upload-bg-image__edit{right:calc((var(--em-borderWidth) + 32) * 1px);position:absolute}.blocks-app .upload-bg-image__uploader-icons-wrap{z-index:2;width:inherit;height:inherit;opacity:1;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload{z-index:1;width:inherit;height:inherit;opacity:.8;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap-upload{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload .upload-bg-image__uploader-content:empty{background-color:var(--em-colorFillSecondary);border-radius:calc(var(--em-borderRadius) * 1px)}.blocks-app .upload-bg-image__uploader-link,.blocks-app .upload-bg-image__uploader-link:hover{color:#fff}.blocks-app .upload-bg-image__uploader-icon{color:#fff;margin:0 3px;font-size:14px}.blocks-app .upload-bg-image__uploader-img{object-fit:cover;width:100%;height:100%;display:block!important}.blocks-app .upload-bg-image__uploader-img-placeholder{width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader-icon-btn{cursor:pointer;background:0 0;border:0;margin:0;padding:0}.blocks-app .upload-bg-image__input{border-color:var(--em-colorFillSecondaryDarken)}.blocks-app .upload-bg-image__uploader .ant-upload-select{cursor:pointer;width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader .ant-upload-select .ant-upload{width:100%;height:100%;display:block}.dark .blocks-app .upload-bg-image__uploader{border-right:1px solid var(--em-colorBorder)}.blocks-app .countdown-color .color-picker-input__picker-holder{z-index:auto;left:auto;right:-10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form_busy{position:relative}.blocks-app .selected-image-form__loader{z-index:5;background-color:color-mix(in srgb, var(--em-colorBgContainer) 60%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);box-shadow:28px 0 0 0 color-mix(in srgb, var(--em-colorBgContainer) 60%, transparent), -28px 0 0 0 color-mix(in srgb, var(--em-colorBgContainer) 60%, transparent);position:absolute;inset:0}.blocks-app .selected-image-form__loader-body{flex-direction:column;justify-content:center;align-items:center;gap:16px;height:100%;display:flex;position:absolute;top:0;left:0;right:0}.blocks-app .selected-image-form__loader-title{color:var(--em-colorTextSecondary);text-align:center;padding:0 24px;font-size:13px}.blocks-app .selected-text-common-form__border-radio{position:relative}.blocks-app .selected-text-common-form__border-radio:after{content:"·";border:3px solid var(--em-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}.blocks-app .selected-text-common-form__border-col{margin-top:22px;margin-bottom:10px}@media (width<=1840px){.blocks-app .selected-text-common-form__border-col{margin-top:0}}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-text-common-form__padding-input{max-width:46px;margin-bottom:0}.blocks-app .selected-text-common-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-text-common-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-text-common-form__button--active,.blocks-app .selected-text-common-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-text-common-form__br-input{margin-bottom:10px}.blocks-app .selected-text-common-form__tooltip{margin-left:4px}.blocks-app .selected-text-common-form__icon-radius{width:16px;height:100%}.blocks-app .selected-text-common-form__block{margin-bottom:24px}.blocks-app .selected-text-common-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-text-common-form__format-toolbar{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:4px;display:flex}.blocks-app .selected-text-common-form__format-toolbar .ant-form-item{margin-bottom:0}.blocks-app .ant-app .bullet-type .ant-select-selector{padding-left:5px}.blocks-app .selected_text_common_form_mobile .ant-form-item{margin:0}.blocks-app .selected_text_common_form_mobile .ant-input-number-affix-wrapper{padding-inline-start:7px}.blocks-app .selected_text_common_form_mobile .ant-select-single:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .selected_text_common_form_mobile .ant-input-number-group .ant-input-number-group-addon{padding:0 7px}.blocks-app .selected_text_common_form_mobile .ant-input-number .ant-input-number-handler-wrap{width:16px}.blocks-app .selected_text_common_form_mobile .ant-select .ant-select-arrow{inset-inline-end:7px;font-size:10px!important}.blocks-app .selected_text_common_form_mobile .ant-divider-vertical{height:46px;top:0}.blocks-app .selected_text_common_form_mobile .selected_text_common_form_mobile__group{padding:6px 0}.blocks-app .selected_text_common_form_mobile .selected-td-form__button{background:var(--em-colorFillSecondary);width:34px;height:34px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-btn-default:not(:disabled,.ant-btn-disabled,.email-pane__content-col .selected-td-form__button--active):hover{background:var(--em-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active{background:var(--em-colorPrimaryBg);color:var(--em-colorPrimary);border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active:hover{background:var(--em-colorPrimaryBgHover)!important;color:var(--em-colorPrimaryTextHover)!important}.blocks-app .selected_text_common_form_mobile .color-picker-input{width:34px;height:34px}.blocks-app .selected_text_common_form_mobile .color-picker-input .ant-input-affix-wrapper{display:none}.blocks-app .selected_text_common_form_mobile .color-picker-input__control-wrap .ant-color-picker-trigger{border:1px solid var(--em-colorFillSecondaryDarken);width:34px;height:34px;top:0;left:0}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper{background:var(--em-colorFillSecondary);height:34px;padding:0 9px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):hover{color:inherit;background:var(--em-colorFillSecondaryDarken)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--em-colorPrimaryBg);color:var(--em-colorPrimary)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--em-colorPrimaryBgHover);color:var(--em-colorPrimaryTextHover)}.blocks-app .selected_text_common_form_mobile .codemode-textalign-dropdown{background-color:var(--em-colorBgContainer);border-radius:calc(var(--em-borderRadius) * 1px);box-shadow:var(--em-boxShadowSecondary);padding:6px}.blocks-app .mobile-background-image-field .upload-bg-image{margin-bottom:0}.blocks-app .selected_element_vindent_values{font-size:12px}.blocks-app .selected_element_vindent_values span{cursor:pointer;margin-right:10px}.blocks-app .selected_element_vindent_values span:hover{color:#40a9ff}.blocks-app .selected-td-form__border-side-wrapper{display:inline-flex;position:relative}.blocks-app .selected-td-form__border-side-wrapper label{border-radius:calc(var(--em-borderRadius) * 1px)}.blocks-app .selected-td-form__border-side-wrapper:hover .selected-td-form__border-side-clear{opacity:1}.blocks-app .selected-td-form__border-side-clear{z-index:1;opacity:0;cursor:pointer;color:var(--em-colorTextSecondary);background-color:var(--em-colorBgLayout);border-radius:50%;width:20px;height:20px;transition:opacity .15s;position:absolute;top:-6px;right:-4px}.blocks-app .selected-td-form__border-side-clear:hover{color:var(--em-colorError)}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--em-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-td-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-td-form__button--active,.blocks-app .selected-td-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-td-form__tooltip{margin-left:4px}.blocks-app .selected-td-form__icon-radius{flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex}.blocks-app .selected-td-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-td-form__border-radio{position:relative}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--em-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;left:2px;right:auto}.blocks-app .selected-td-form__border-col{margin-top:0;margin-bottom:0}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input{max-width:50px;margin-bottom:0}.blocks-app .selected-td-form__padding-input input{padding:4px 8px}.blocks-app .selected-td-form__br-input{margin-bottom:10px}.blocks-app .selected-td-form__tooltip{vertical-align:baseline;margin-left:4px}.blocks-app .selected-td-form__icon-radius{width:16px;height:100%}.blocks-app .selected-td-form__block{margin-bottom:24px}.blocks-app .carousel__slide{background-color:var(--em-colorFillQuaternary);border-radius:calc(var(--em-borderRadius) * 1px);margin-bottom:calc(var(--em-formItemMarginBottomXS) * 1px);border:calc(var(--em-borderWidth) * 1px) solid var(--em-colorFillSecondaryDarken);padding:10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form__add-title{margin-top:-15px;margin-bottom:30px}.blocks-app .selected-image-form__add-title span{cursor:pointer}.blocks-app .selected-image-form__add-title span:hover{color:#40a9ff}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-social-form{box-sizing:border-box;min-width:0;padding:0 0 16px}.blocks-app .selected-social-form .selected-social-form__form{padding:0 0 8px}.blocks-app .selected-social-form .selected-social-form__align-block{margin-bottom:16px}.blocks-app .selected-social-form .selected-social-form__align-block .ant-form-item,.blocks-app .selected-social-form .selected-social-form__section{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__section--bordered{border-top:1px solid var(--em-colorBorderSecondary,#f0f0f0);margin-top:16px;padding-top:16px}.blocks-app .selected-social-form .selected-social-form__section-title{color:var(--em-colorText,#000000e0);margin:0 0 16px;font-size:14px;font-weight:400;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__field-row{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__field-icon{color:var(--em-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__input-full{width:100%}.blocks-app .selected-social-form .selected-social-form__items{flex-direction:column;gap:6px;margin-bottom:6px;display:flex}.blocks-app .selected-social-form .selected-social-form__card{border:1px solid var(--em-colorBorderSecondary,#f0f0f0);background:var(--em-colorFillTertiary,#f8f8f8);border-radius:6px;padding:12px;transition:border-color .15s,box-shadow .15s,opacity .15s}.blocks-app .selected-social-form .selected-social-form__card--dragging{opacity:.72}.blocks-app .selected-social-form .selected-social-form__card--drag-over{border-color:var(--em-colorPrimary);box-shadow:0 0 0 1px var(--em-colorPrimary)}.blocks-app .selected-social-form .selected-social-form__card-head{justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-main{flex:auto;align-items:center;gap:8px;min-width:0;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle{width:24px;height:24px;color:var(--em-colorTextSecondary,#8c8c8c);cursor:grab;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:hover{color:var(--em-colorText,#000000e0);background:var(--em-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:active{cursor:grabbing}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:focus-visible{outline:2px solid var(--em-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle .anticon{font-size:14px;transform:rotate(90deg)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn{box-sizing:border-box;aspect-ratio:1;width:24px;min-width:24px;max-width:24px;height:24px;min-height:24px;max-height:24px;color:var(--em-colorTextSecondary,#8c8c8c);background:0 0;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;padding:0;line-height:1;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn .anticon{justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn svg{width:18px;height:18px;display:block}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:hover{color:var(--em-colorText,#000000e0);background:var(--em-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:focus-visible{outline:2px solid var(--em-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-title{min-width:0;color:var(--em-colorText,#000000e0);flex:auto;font-size:14px;font-weight:300;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row{margin-bottom:8px}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row:last-child{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row{width:100%;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-col .ant-form-item{max-width:none;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-form-item-control-input-content,.blocks-app .selected-social-form .selected-social-form__meta-block{width:100%}.blocks-app .selected-social-form .selected-social-form__meta-toggle-row{flex-wrap:wrap;align-items:center;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields.is-hidden,.blocks-app .selected-social-form .selected-social-form__card-field.is-hidden{display:none}.blocks-app .selected-social-form .selected-social-form__meta-fields{flex-direction:column;gap:6px;width:100%;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item-control-input-content{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-row{align-items:flex-start;gap:8px;width:100%;margin-bottom:8px;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-field{flex:auto;min-width:0;margin-bottom:0!important}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn{box-sizing:border-box;width:calc(var(--em-formControlHeight) * 1px);min-width:calc(var(--em-formControlHeight) * 1px);max-width:calc(var(--em-formControlHeight) * 1px);height:calc(var(--em-formControlHeight) * 1px);min-height:calc(var(--em-formControlHeight) * 1px);max-height:calc(var(--em-formControlHeight) * 1px);line-height:calc((var(--em-formControlHeight) - 2) * 1px);color:var(--em-colorTextSecondary,#8c8c8c);border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon{justify-content:center;align-items:center;width:100%;height:100%;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon svg{display:block}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:hover{color:var(--em-colorText,#000000e0);background:var(--em-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:focus-visible{outline:2px solid var(--em-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__platform-select{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-select.ant-select-single .ant-select-selector .ant-select-selection-item{align-self:center;align-items:center;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow{color:var(--em-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow svg{width:16px;height:16px}.blocks-app .selected-social-form .selected-social-form__platform-option{align-items:center;gap:4px;min-width:0;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-option img{flex-shrink:0;width:30px;height:30px;margin-left:-6px;display:block}.blocks-app .selected-social-form .selected-social-form__platform-option-text{white-space:nowrap;text-overflow:ellipsis;line-height:1.2;overflow:hidden}.blocks-app .selected-social-form .selected-social-form__add-bar{background:var(--em-colorFillTertiary,#f8f8f8);height:32px;color:var(--em-colorText,#000000e0);border-radius:6px;justify-content:center;align-items:center;gap:8px;margin-top:0;padding:8px 12px;font-size:14px;font-weight:300;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__add-bar:not(:disabled):hover{background:var(--em-colorFillSecondary,#f0f0f0);color:var(--em-colorText,#000000e0)}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option{align-items:center}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option-content{align-items:center;min-height:0;line-height:1.2;display:flex}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option{gap:0}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option img{width:30px;height:30px;margin-left:-6px}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-suffix{flex-shrink:0;align-items:center;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden){color:var(--em-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) .anticon{vertical-align:0;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) svg{width:16px;height:16px;display:block}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden):hover{color:var(--em-colorText,#000000e0)}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field{margin-bottom:8px}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:0}.blocks-app .email-pane .selected-social-form form.selected-social-form__form.element-controls,.blocks-app .email-pane .email-pane__collapse-wrapper.mobile-properties .selected-social-form form.selected-social-form__form.element-controls{height:auto;max-height:none}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-header{padding:20px 0;font-size:14px}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{padding-left:0;padding-right:0}.blocks-app .ant-collapse.hidden-props .ant-alert{margin-bottom:24px}.blocks-app .selected_form-mobile-props{padding:24px 14px 0 24px}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content.selected-element-panel__hidden{visibility:hidden;opacity:0;height:0}.blocks-app .email-properties__collapse-panel .selected-element-panel-content{height:100%}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content{width:auto;box-shadow:var(--em-boxShadowSecondary);border-radius:calc(var(--em-borderRadius) * 1px);border:none;margin:0;padding:0 6px;transition:opacity .2s;position:absolute;top:-60px;left:50%;transform:translate(-50%)}.blocks-app .em-analytics__email-tab-properties,.blocks-app .em-analytics__email-tab-history{z-index:999;position:absolute}.blocks-app .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .em-analytics__email-tab-history .email-pane__collapse-wrapper{z-index:999;box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #0000000f}.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-history .email-pane__collapse-wrapper{box-shadow:none}.blocks-app .selected-element-panel{height:100%;overflow:visible}.blocks-app .selected-element-panel button.selected-element-panel__extra-btn,.blocks-app .selected-element-panel__extra-btn button{height:24px;padding:0 7px}.blocks-app .selected-element-panel-content{position:relative}.blocks-app .selected-element-panel-content.column-settings-show_onecol{padding-top:75px}.blocks-app .selected-element-panel__columns-settings{z-index:1;width:100%;position:relative}.blocks-app .selected-element-panel__columns-settings__header{justify-content:space-between;align-items:center;gap:12px;margin-bottom:15px;display:flex}.blocks-app .selected-element-panel__columns-settings__header-title{color:var(--em-colorText);font-size:14px;line-height:1.5}.blocks-app .selected-element-panel__columns-settings__title{white-space:nowrap;text-overflow:ellipsis;margin-bottom:20px;font-size:16px;font-weight:500;line-height:20px;overflow:hidden}.blocks-app .selected-element-panel__columns-settings__links{white-space:nowrap;justify-content:flex-end;align-items:center;gap:8px;margin-left:auto;font-size:14px;display:flex}.blocks-app .selected-element-panel__columns-settings__links span{color:var(--em-colorLink);cursor:pointer}.blocks-app .selected-element-panel__columns-settings__links span:hover{color:#40a9ff}.blocks-app .selected-element-panel__columns-settings__links__add{align-items:center;gap:4px;display:inline-flex}.blocks-app .selected-element-panel__columns-settings__links__add.noactive,.blocks-app .selected-element-panel__columns-settings__links__add.noactive span{color:#00000073;cursor:not-allowed}.blocks-app .selected-element-panel__columns-settings__controls{align-items:center;gap:8px;display:flex}.blocks-app .selected-element-panel__columns-settings__controls__column{align-items:center;min-width:40px;display:flex;position:relative}.blocks-app .selected-element-panel__columns-settings__controls__column:first-child .selected-element-panel__columns-settings__controls__divider{visibility:hidden}.blocks-app .selected-element-panel__columns-settings__controls__column__remove,.blocks-app .selected-element-panel__columns-settings__controls__column__copy,.blocks-app .selected-element-panel__columns-settings__controls__column__swap{text-align:center;box-sizing:border-box;cursor:pointer;z-index:1;color:#000000d9;background-color:#fff;border:none;border-radius:50%;justify-content:center;align-items:center;width:25px;height:25px;padding:0;font-size:14px;display:none;position:absolute;left:-10px;box-shadow:0 0 7px -2px #00000059}.blocks-app .selected-element-panel__columns-settings__controls__column__remove{top:-11px}.blocks-app .selected-element-panel__columns-settings__controls__column__copy{color:#000000a6;top:20px}.blocks-app .selected-element-panel__columns-settings__controls__column__swap{color:#000000a6;top:10px;left:-16px}.blocks-app .selected-element-panel__columns-settings__controls__column__remove:hover,.blocks-app .selected-element-panel__columns-settings__controls__column__copy:hover,.blocks-app .selected-element-panel__columns-settings__controls__column__swap:hover{box-shadow:0 0 7px -2px #000000b3}.blocks-app .selected-element-panel__columns-settings__controls:hover .selected-element-panel__columns-settings__controls__column__swap,:is(.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__remove,.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__copy){display:flex}.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__swap{display:none}.blocks-app .selected-element-panel__columns-settings__controls__field{text-align:center;border-radius:6px;width:100%;height:45px}.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number{background:0 0;border:none}.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number .ant-input-number-input{text-align:center;height:43px}.blocks-app .selected-element-panel__columns-settings__controls__divider{cursor:w-resize}.blocks-app .selected-element-panel__columns-settings__divider-wrapper{display:none}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider-wrapper{display:block;position:relative}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider{width:calc(100% + 80px);height:20px;margin:24px -40px 0;position:absolute;bottom:-20px}.blocks-app .selected-element-panel__content_abs{border:1px solid var(--em-colorBorder);z-index:100;background-color:var(--em-colorBgContainer);border-top:none;border-radius:0 0 8px 8px;width:100%;max-width:1400px;min-height:15px;margin-bottom:15px;transition:all .5s;display:flex;position:sticky;top:0;left:0}.blocks-app .selected-element-panel__mobile-switch{background-color:var(--em-colorPrimary)}.blocks-app .selected-element-panel__mobile-switch.ant-switch-checked{background-color:var(--em-colorInfo)}.blocks-app #selected_element_form_desktop_props .ant-alert-info .ant-alert-title{color:var(--em-colorInfoText)}.blocks-app .ant-app .selected_form-mobile-switch{margin-bottom:20px;font-size:16px;font-weight:500}.blocks-app .ant-app .selected_form-mobile-props{--em-colorPrimaryBorder:var(--em-colorInfo);--em-controlOutline:var(--em-colorInfoBgHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-focused,.blocks-app .ant-app .selected_form-mobile-props .ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper-focused{border-color:var(--em-colorInfo);box-shadow:0 0 0 calc(var(--em-controlOutlineWidth) * 1px) var(--em-controlOutline)!important}:is(.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper>.ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-space-compact:has(>.ant-input-number):focus-within>.ant-input-number,.blocks-app .ant-app .selected_form-mobile-props .input-select:focus-within .ant-input-affix-wrapper){box-shadow:none!important}.blocks-app .ant-app .selected_form-mobile-props .ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:var(--em-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-select-item-option-selected:not(.ant-select-item-option-disabled){background-color:#edd3ed}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within{box-shadow:var(--em-colorInfoBg) 0 0 0 2px!important}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child),.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-group-addon:last-child,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within>.ant-input-number:first-child{border-color:var(--em-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child){border-right-color:var(--em-colorFillSecondaryDarken)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-open .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-focused .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper:hover,.blocks-app .ant-app .selected_form-mobile-props .ant-collapse>.ant-collapse-item>.ant-collapse-header:hover{color:var(--em-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-btn-background-ghost.ant-btn-primary{color:var(--em-colorInfo);border-color:var(--em-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):first-child,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled),.blocks-app .ant-app .selected_form-mobile-props .selected-td-form__button--active{background-color:var(--em-colorInfoBg)!important;color:var(--em-colorInfoText)!important}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):before,.blocks-app .ant-app .selected_form-mobile-props .ant-switch-checked{background-color:var(--em-colorInfoTextActive)}.blocks-app .ant-app .selected_form-mobile-props .ant-switch.ant-switch-checked:hover:not(.ant-switch-disabled){background-color:var(--em-colorInfoHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-up-inner,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-down-inner{color:var(--em-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info{background-color:var(--em-colorInfoBg);border:none}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info .ant-alert-title{color:var(--em-colorInfoText)}.blocks-app .selected-element-panel__extra-btn-container{position:absolute;top:13px;right:50px}.blocks-app .selected-element-panel__extra-btn-container .ant-btn-text:disabled{color:var(--em-colorTextQuaternary)}.blocks-app .email-properties__collapse .ant-tabs-content>.ant-tabs-tabpane{height:100%}.blocks-app .ant-app .columns-presets{width:100%;margin-bottom:calc(var(--em-formItemMarginBottomMD) * 1px);align-items:center;gap:7px;display:flex}.blocks-app .ant-app .columns-presets .ant-btn{flex:1;min-width:0;padding:7px 9px;line-height:1!important}.blocks-app .email-pane__collapse-wrapper .ant-modal-close{width:24px;height:24px;font-size:16px}.blocks-app .email-pane__collapse-wrapper .ant-modal-close .anticon{line-height:0}.blocks-app .groups-management__group-select label{width:100%}.blocks-app .groups-management__group-select label:after{display:none}.blocks-app .groups-management__group_menu{border-color:var(--em-colorFillSecondaryDarken)}.blocks-app .annotations-preview{z-index:1100;pointer-events:auto;background:#fff;border-radius:8px;width:300px;padding:16px;position:absolute;top:0;box-shadow:0 4px 12px #00000026}.blocks-app .annotations-preview--popover{opacity:1;z-index:1;pointer-events:auto;width:420px;max-height:calc(100vh - 48px);position:absolute;top:0;left:-15px;overflow:hidden;transform:translate(-100%)}.blocks-app .annotations-preview__content{pointer-events:none}.blocks-app .annotations-preview__type{color:#202124;margin-bottom:10px;font-size:13px;font-weight:600}.blocks-app .annotations-preview__footer{pointer-events:auto;justify-content:space-between;align-items:center;gap:8px;margin-top:12px;display:flex}.blocks-app .annotations-preview__apply-wrap{margin-left:auto;display:inline-flex}.blocks-app .email-pane__col-wrapper_reverse .annotations-preview--popover{left:auto;right:-15px;transform:translate(100%)}.blocks-app .preview-skeleton{background:linear-gradient(90deg,#f1f3f4 25%,#e8eaed 50%,#f1f3f4 75%) 0 0/200% 100%;border-radius:4px;flex-shrink:0;animation:1.4s ease-in-out infinite preview-skeleton-shimmer;display:block}.blocks-app .preview-skeleton--circle{border-radius:50%}.blocks-app .preview-skeleton--block{border-radius:0}@keyframes preview-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.blocks-app .product-carousel-preview__header{margin-bottom:12px}.blocks-app .product-carousel-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .product-carousel-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .product-carousel-preview__logo-skeleton{border:none}.blocks-app .product-carousel-preview__subject-skeleton{flex:1;min-width:0;max-width:220px}.blocks-app .product-carousel-preview__header-text{flex:1;min-width:0}.blocks-app .product-carousel-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .product-carousel-preview__header-row--subject{align-items:flex-start;margin-top:2px}.blocks-app .product-carousel-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .product-carousel-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .product-carousel-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:13px;line-height:18px;overflow:hidden}.blocks-app .product-carousel-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .product-carousel-preview__carousel{gap:8px;margin:0 -2px;padding-bottom:4px;display:flex;overflow-x:auto}.blocks-app .product-carousel-preview__carousel::-webkit-scrollbar{display:none}.blocks-app .product-carousel-preview__carousel{-ms-overflow-style:none;scrollbar-width:none}.blocks-app .product-carousel-preview__card{background:#fff;border:1px solid #dadce0;border-radius:8px;flex:0 0 128px;width:128px;overflow:hidden}.blocks-app .product-carousel-preview__card-image{aspect-ratio:1;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .product-carousel-preview__card-image-skeleton{aspect-ratio:1;width:100%}.blocks-app .product-carousel-preview__card-body{padding:8px}.blocks-app .product-carousel-preview__card-headline{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-height:32px;font-size:12px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .product-carousel-preview__card-headline-skeleton{flex-direction:column;gap:4px;min-height:32px;display:flex}.blocks-app .product-carousel-preview__card-prices{flex-wrap:wrap;align-items:baseline;gap:6px;margin-top:6px;display:flex}.blocks-app .product-carousel-preview__card-sale-price{color:#202124;font-size:13px;font-weight:600;line-height:16px}.blocks-app .product-carousel-preview__card-original-price{color:#5f6368;font-size:12px;line-height:16px;text-decoration:line-through}.blocks-app .single-image-preview__header{margin-bottom:10px}.blocks-app .single-image-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .single-image-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .single-image-preview__logo-skeleton{border:none}.blocks-app .single-image-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .single-image-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .single-image-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .single-image-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .single-image-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .single-image-preview__subject-skeleton{max-width:100%}.blocks-app .single-image-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .single-image-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .single-image-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .single-image-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .single-image-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .single-image-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .single-image-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .single-image-preview__promo-skeleton{flex-shrink:0}.blocks-app .single-image-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .single-image-preview__card{background:#fff;border:1px solid #dadce0;border-radius:10px;width:calc(100% - 76px);max-width:100%;margin-left:52px;margin-right:24px;overflow:hidden}.blocks-app .single-image-preview__card-image{aspect-ratio:1.91;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .single-image-preview__card-image-skeleton{aspect-ratio:1.91;width:100%}.blocks-app .single-image-preview__card-body{padding:10px 12px 12px}.blocks-app .single-image-preview__card-description{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:14px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .single-image-preview__card-description-skeleton{flex-direction:column;gap:6px;min-height:34px;display:flex}.blocks-app .deal-annotation-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .deal-annotation-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .deal-annotation-preview__logo-skeleton{border:none}.blocks-app .deal-annotation-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .deal-annotation-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .deal-annotation-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .deal-annotation-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .deal-annotation-preview__subject-skeleton{max-width:100%}.blocks-app .deal-annotation-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .deal-annotation-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .deal-annotation-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .deal-annotation-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .deal-annotation-preview__promo-skeleton{flex-shrink:0}.blocks-app .deal-annotation-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .deal-card-preview{background:#f1f3f4;border-radius:12px;flex-direction:column;gap:12px;padding:16px;display:flex}.blocks-app .deal-card-preview__sender{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__headline{color:#202124;word-break:break-word;font-size:22px;font-weight:400;line-height:28px}.blocks-app .deal-card-preview__headline-skeleton{max-width:100%}.blocks-app .deal-card-preview__details{align-items:flex-start;gap:24px;display:flex}.blocks-app .deal-card-preview__expires{align-items:flex-start;gap:8px;min-width:0;display:flex}.blocks-app .deal-card-preview__clock-icon{color:#5f6368;flex-shrink:0;margin-top:1px}.blocks-app .deal-card-preview__code{min-width:0}.blocks-app .deal-card-preview__detail-text{flex-direction:column;gap:2px;min-width:0;display:flex}.blocks-app .deal-card-preview__detail-label{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__detail-value{color:#5f6368;word-break:break-word;font-size:12px;font-weight:400;line-height:16px}.blocks-app .deal-card-preview__detail-skeleton{margin-top:1px}.blocks-app .deal-card-preview__actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.blocks-app .deal-card-preview__button{color:#001d35;white-space:nowrap;background:#c2e7ff;border-radius:999px;justify-content:center;align-items:center;padding:8px 16px;font-size:13px;font-weight:500;line-height:16px;display:inline-flex}.blocks-app .annotations-panel .selected-social-form__section-title{align-items:baseline;gap:6px;display:flex}.blocks-app .annotations-panel__docs-hint{color:var(--em-colorTextSecondary,#8c8c8c);margin-top:16px;font-size:12px;font-weight:300;line-height:1.4}.blocks-app .annotations-panel__section-hint{color:var(--em-colorTextSecondary,#8c8c8c);font-size:12px;font-weight:300}.blocks-app .annotations-panel__field-tooltip-wrap{width:100%;margin-bottom:8px;display:block}.blocks-app .annotations-panel__cards-section{margin-top:16px}.blocks-app .email-pane__content-col .selected-social-form.annotations-panel .selected-social-form__form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:8px}.blocks-app .email-settings{height:100%;display:flex}.blocks-app .email-settings__collapse{flex-direction:column;width:100%;height:100%;min-height:0;max-height:100%;display:flex;overflow:hidden}.blocks-app .email-settings__collapse.ant-collapse{border:0}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content-holder{flex:1;min-height:0;overflow:hidden auto}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content,.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-tabpane-active{overflow:visible}.blocks-app .email-settings__collapse-panel:last-child.ant-collapse-item-active{padding-bottom:12px}.blocks-app .email-settings__collapse-panel.ant-collapse-item{min-height:50px;overflow:hidden}.blocks-app .email-settings__collapse-panel-content{width:100%}.blocks-app .email-settings .ant-collapse-body{padding:0 2px 0 12px;overflow:hidden}.blocks-app #content_appearance_panel_form button.ant-btn:not(.ant-btn-primary):hover{border-color:#d9d9d9}.blocks-app .section-title-bull{color:var(--em-colorTextQuaternary)}.blocks-app .appearance-panel__content-styles{flex-direction:column;height:100%;min-height:0;display:flex}.blocks-app .appearance-panel__content-styles.ant-tabs{height:100%;min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel,.blocks-app .appearance-panel__content-styles .element-controls{min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel{flex-direction:column;flex:1;display:flex}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder{overflow:hidden auto}.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active{overflow:visible}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(auto-fit,322px);padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card__select-role{cursor:pointer;height:300px}.blocks-app .modal-select-role .element-card__select-role img{cursor:pointer;background-color:#fff;width:100%}.blocks-app .modal-select-role .element-card__select-role .ant-card-body{height:50px}.blocks-app .modal-select-role__title-wrapper{display:inline-block}.blocks-app .ai-response-paragraph{margin-bottom:16px}.blocks-app .em-analytics__email-tab-discuss{overflow:auto!important}.blocks-app .discuss-ai-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content-holder,.blocks-app .discuss-ai-wrapper .ant-tabs-content,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .discuss-ai-wrapper .discuss-main{min-height:0}.blocks-app .ant-tabs-content .discuss-ai{background-color:#fafafa;border:1px solid #f1ebeb;border-radius:8px;margin:0 0 20px;padding:24px 36px 0}.dark .blocks-app .ant-tabs-content .discuss-ai{background-color:#181818;border-color:#262626}.blocks-app .discuss-main{margin:0}.blocks-app .discuss-main__form{position:relative}.blocks-app .discuss-main__buttons{justify-content:space-between;display:flex}.blocks-app .discuss-main>.comment-list{margin-bottom:16px}.blocks-app .discuss-main>form{padding-bottom:20px}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;transition:all .3s cubic-bezier(.645,.045,.355,1)}.blocks-app .discuss-main .replyEditMode{opacity:.5}.blocks-app .modal-select-role{max-height:1400px}.blocks-app .modal-select-role .element-card.element-card_select-role .ant-card-cover{border:none;height:auto}.blocks-app .modal-select-role .element-card .ant-card-body{height:auto}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(3,260px);width:auto;padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card_select-role{cursor:pointer}.blocks-app .modal-select-role .element-card_select-role img,.blocks-app .modal-select-role .element-card__no-img{background-color:#fff}@media (width<=1200px){.blocks-app .modal-select-role__cards-grid{grid-template-columns:repeat(4,240px);width:auto}.blocks-app .modal-select-role .element-card__title{font-size:15px}}.blocks-app .ant-comment .ant-comment-avatar{cursor:auto}.blocks-app .ant-comment .ant-comment-avatar .anticon-robot{background:var(--em-colorInfo)}.blocks-app .ant-comment .ant-comment-avatar .anticon-user{background:var(--em-colorPrimary)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-robot{background:var(--em-colorInfo)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-user{background:var(--em-colorPrimary)}.blocks-app .ant-comment.ai-comment .ai-guide__example{border-left:1px solid #3b91ff;padding-left:15px;font-style:italic}.blocks-app .ant-comment.ai-comment .ai-guide__example strong{font-weight:500}.blocks-app .ant-comment-content-detail{margin-top:16px;margin-left:-30px}.blocks-app .ant-comment-content-detail p{white-space:normal;margin:16px 0;line-height:1.4}.blocks-app .ant-comment-content-detail ul{margin:16px 0}.blocks-app .ant-comment-content-detail .buttons-variants{white-space:normal;margin-left:0;padding-left:0}.blocks-app body.dark .ant-comment-content-detail .buttons-variants .ant-btn-default:hover{background:#e6f7ff}.blocks-app .ant-comment-content-detail .buttons-variants li{white-space:normal;margin-bottom:4px}.blocks-app .ant-comment-content-detail .buttons-variants .ant-btn.ant-btn-sm{text-align:left;height:auto;padding:4px 7px;line-height:1.4}.blocks-app .ant-comment-content-detail .ai-response-variant{margin:15px 0}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy{cursor:pointer;background-color:#1890ff33;border-radius:4px;margin:4px 0;padding:3px 8px;line-height:1.4;transition:all .3s;display:block}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#000}.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#fff}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{background-color:#1890ff55}.blocks-app .limit-upgrade-modal.ant-modal{max-width:calc(100vw - 24px)}.blocks-app .limit-upgrade-modal .ant-modal-content{border-radius:16px;padding:0;overflow:hidden;box-shadow:0 12px 24px -4px #191d3a14}.blocks-app .limit-upgrade-modal .ant-modal-header{display:none}.blocks-app .limit-upgrade-modal .ant-modal-content .ant-modal-body{padding:0}.blocks-app .limit-upgrade-modal__wrap{background:var(--em-colorBgContainer);flex-direction:column;align-items:center;width:400px;max-width:100%;display:flex}.blocks-app .limit-upgrade-modal__header{z-index:1;box-sizing:border-box;justify-content:flex-end;align-items:center;display:flex;position:absolute;top:20px;right:20px}.blocks-app .limit-upgrade-modal__close{background:var(--em-colorBgContainer);width:34px;height:34px;color:var(--em-colorTextSecondary);cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;margin:0;padding:0;transition:background .15s,color .15s;display:flex}.blocks-app .limit-upgrade-modal__close:hover{background:var(--em-colorFillTertiary);color:var(--em-colorText)}.blocks-app .limit-upgrade-modal__close .anticon{font-size:16px}.blocks-app .limit-upgrade-modal__body{box-sizing:border-box;flex-direction:column;align-items:center;gap:16px;width:100%;padding:44px 40px 24px;display:flex}.blocks-app .limit-upgrade-modal__title{text-align:center;max-width:320px;color:var(--em-colorText);margin:0;font-size:18px;font-weight:400;line-height:130%}.blocks-app .limit-upgrade-modal__subtitle{text-align:center;max-width:320px;color:var(--em-colorTextSecondary);margin:0;font-size:14px;font-weight:100;line-height:120%}.blocks-app .limit-upgrade-modal__limits-row{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;width:100%;max-width:320px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle{box-sizing:border-box;border:1px solid var(--em-colorText);width:34px;height:34px;color:var(--em-colorText);border-radius:32px;flex:none;justify-content:center;align-items:center;padding:8px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle .anticon{font-size:18px}.blocks-app .limit-upgrade-modal__icon-circle svg{flex-shrink:0;width:18px;height:18px;display:block}.blocks-app .limit-upgrade-modal__limit-old{color:#f85243;flex-shrink:0;font-size:40px;font-weight:100;line-height:100%}.blocks-app .limit-upgrade-modal__arrow-btn{color:#fff;background:#8946fb;border-radius:38px;flex:none;justify-content:center;align-items:center;width:34px;height:34px;display:flex}.blocks-app .limit-upgrade-modal__arrow-icon{font-size:16px;transform:rotate(45deg)}.blocks-app .limit-upgrade-modal__limit-new{color:#7ed846;flex-shrink:0;font-size:40px;font-weight:400;line-height:100%}.blocks-app .limit-upgrade-modal__limit-new--infinity{font-size:36px;line-height:40px}.blocks-app .limit-upgrade-modal__divider{border:none;border-top:1px solid var(--em-colorBorderSecondary);width:100%;height:0;margin:0}.blocks-app .limit-upgrade-modal__footer{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;width:100%;padding:16px 0;display:flex}.blocks-app .limit-upgrade-modal__footer--dual{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;padding:16px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary{min-width:147px;height:32px;box-shadow:none;background:#2884ff;border-color:#2884ff;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary:hover{background:#1a75f0;border-color:#1a75f0}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default{border-color:var(--em-colorBorder);min-width:147px;height:32px;color:var(--em-colorText);box-shadow:none;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default:hover{color:#2884ff;border-color:#2884ff}.blocks-app .optimise-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content-holder,.blocks-app .optimise-wrapper .ant-tabs-content,.blocks-app .optimise-wrapper .ant-tabs-tabpane,.blocks-app .optimise-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .optimise{background:0 0;border:none;min-height:0}.blocks-app .optimise.ant-collapse>.ant-collapse-item:last-child{border-bottom:none!important}.blocks-app .optimise .ant-list-item-meta-title{-webkit-user-select:text;user-select:text}.blocks-app .optimise__summary{justify-content:space-between;width:100%;display:flex}.blocks-app .optimise__summary>div:not(:last-child){margin-right:10px}.blocks-app .optimise__summary h4{line-height:1}.blocks-app .optimise .ant-divider.ant-divider-horizontal{border-top:1px solid var(--em-colorBorderSecondary);background:linear-gradient(180deg, var(--em-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -25px}.blocks-app .optimise.ant-collapse>.ant-collapse-item{border-bottom:1px solid var(--em-colorBorderSecondary)}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-header{padding:12px 0 12px 24px}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-panel{border-top:none}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-body{padding:24px 14px 12px 24px;overflow-y:hidden;padding-top:0!important;padding-right:24px!important}.blocks-app .optimise .valid{white-space:nowrap;color:var(--em-colorSuccessText)}.blocks-app .optimise .error{white-space:nowrap;color:var(--em-colorErrorText)}.blocks-app .optimise .warning{white-space:nowrap;color:var(--em-colorWarningText)}.blocks-app .optimise__title-wrapper{justify-content:space-between;align-items:flex-start;width:100%;display:flex}.blocks-app .optimise__title-wrapper h5{width:70%}.blocks-app .optimise__link{-webkit-user-select:text;user-select:text}.blocks-app .optimise__link:hover{color:var(--em-colorLinkHover)!important}.blocks-app .email-pane .optimise .ant-collapse-panel{height:calc(100% - 184px)}.blocks-app .optimise__image-item .image-item__meta_fail .ant-list-item-meta-avatar{background:linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 0, transparent 75%, var(--em-colorBorder) 0), linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 0, transparent 75%, var(--em-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px;border-radius:6px}.blocks-app .optimise__image-item .image-item__meta.ant-list-item-meta{align-items:stretch}.blocks-app .optimise__image-item .image-item__image{cursor:pointer;object-fit:contain;border-radius:calc(var(--em-borderRadius) * 1px);background:linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 0, transparent 75%, var(--em-colorBorder) 0), linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 0, transparent 75%, var(--em-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px}.blocks-app .optimise__image-item .image-item__image+.ant-image-mask{border-radius:calc(var(--em-borderRadius) * 1px)}.blocks-app .optimise__image-item .image-item__image_fail{height:92px!important}.blocks-app .optimise .ant-list .ant-list-item .ant-list-item-meta .ant-list-item-meta-avatar{margin-inline-end:12px}.blocks-app .optimise .warnings{color:var(--em-colorWarningText)}.blocks-app .optimise .errors{color:var(--em-colorErrorText)}.blocks-app .optimise .valid{color:var(--em-colorSuccessText)}.blocks-app .optimise__button.warnings{border-color:var(--em-colorWarningBorder);background:var(--em-colorWarningBg)}.blocks-app .optimise__button.warnings:not(.ant-tag-checkable-checked):hover{border-color:var(--em-colorWarningBorderHover);color:var(--em-colorWarningTextHover);background:var(--em-colorWarningBgHover)}.blocks-app .optimise__button.warnings_active{color:#fff;background-color:var(--em-colorWarningActive);border-color:var(--em-colorWarningActive)}.blocks-app .optimise__button.errors{border-color:var(--em-colorErrorBorder);background:var(--em-colorErrorBg)}.blocks-app .optimise__button.errors:not(.ant-tag-checkable-checked):hover{border-color:var(--em-colorErrorBorderHover);color:var(--em-colorErrorTextHover);background:var(--em-colorErrorBgHover)}.blocks-app .optimise__button.errors_active{color:#fff;background-color:var(--em-colorErrorActive);border-color:var(--em-colorErrorActive)}.blocks-app .optimise__button.valid{border-color:var(--em-colorSuccessBorder);background:var(--em-colorSuccessBg)}.blocks-app .optimise__button.valid:not(.ant-tag-checkable-checked):hover{border-color:var(--em-colorSuccessBorderHover);color:var(--em-colorSuccessTextHover);background:var(--em-colorSuccessBgHover)}.blocks-app .optimise__button.valid_active{color:#fff;background-color:var(--em-colorSuccessActive);border-color:var(--em-colorSuccessActive)}.blocks-app .optimise .ant-alert-info{width:100%;margin-top:5px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__divider-no-margin.selected-td-form__divider{margin-top:0;margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-col.optimise__col-align-right{text-align:right}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-24{margin-bottom:24px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-16{margin-bottom:16px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-14{margin-bottom:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-12{margin-bottom:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-8{margin-bottom:8px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__link-blue.ant-typography{color:#177ddc;text-decoration:underline}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-image.optimise__image-auto-height{height:auto}.blocks-app .ant-app .email-pane .ant-tabs .optimise__text-clickable.ant-typography{cursor:pointer}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title.ant-typography{margin:0;font-size:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title-space.ant-space{flex-wrap:wrap}.blocks-app .ant-app .email-pane .ant-tabs .optimise__alert-custom.ant-alert{width:100%;padding:14px 14px 10px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-title.ant-typography{margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-label{font-size:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-title.ant-typography{margin:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-value{margin-right:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-text.ant-typography{margin-right:12px;font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-score.ant-typography{font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-description{margin-left:12px}.blocks-app .img-preview{background-color:var(--em-colorBgContainer);border-radius:calc(var(--em-borderRadiusXL) * 1px);box-shadow:var(--em-boxShadow);opacity:0;border:1px solid #fff;max-width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .img-preview-content{border:1px solid var(--em-colorBorderSecondary);border-radius:calc(var(--em-borderRadiusLG) * 1px);background:linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 25%, transparent 75%, var(--em-colorBorder) 75%), linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 25%, transparent 75%, var(--em-colorBorder) 75%);background-position:0 0,4px 4px;background-size:8px 8px;overflow:hidden}.blocks-app .img-preview-content table{border-collapse:initial}.dark .blocks-app .img-preview{border-color:#4f4f4f}.blocks-app .indexing-tray{z-index:4010;width:360px;max-width:calc(100vw - 40px);position:fixed;bottom:20px;right:20px}.blocks-app .indexing-tray__card{box-shadow:0 6px 16px #0000001f}.blocks-app .indexing-tray__title{font-size:14px;margin:0!important}.blocks-app .blocks-search{height:100%;min-height:0;overflow:visible}.blocks-app .blocks-search .ant-select-clear{right:30px}.blocks-app .blocks-search form{z-index:1;width:85%;padding:16px 0 0 24px;position:absolute;top:0;left:0}.blocks-app .blocks-search__form{display:none}.blocks-app .blocks-search__form.is_search{display:block}.blocks-app .blocks-search__divider-wrapper{z-index:1;margin-top:12px;position:relative}.blocks-app .blocks-search__divider{pointer-events:none;width:auto;height:20px;margin:24px 0 0;position:absolute;bottom:-20px;left:-24px;right:-13px}.blocks-app .blocks-search__type-wrapper{min-width:35%;min-height:0;padding:20px 24px 14px 0;overflow-y:auto}.blocks-app .blocks-search__type-wrapper ul{padding:0}.blocks-app .blocks-search__type-wrapper li{cursor:pointer;color:var(--em-colorTextSecondary);text-align:left;margin-bottom:12px;line-height:1.2;list-style:none}.blocks-app .blocks-search__type-wrapper li.active{color:var(--em-colorLink)}.blocks-app .blocks-search__type-wrapper li:hover{color:var(--em-colorLinkHover)}.blocks-app .blocks-search__result-wrapper{height:100%;min-height:0;margin-left:0;margin-right:0;padding-left:24px;display:flex;position:relative}.blocks-app .blocks-search__result-wrapper:after{content:"";background:linear-gradient(180deg, var(--em-colorBgContainerDisabled), transparent 40%);z-index:1;width:100%;height:20px;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-wrapper.is_search:after{top:72px}.dark .blocks-app .blocks-search__result-wrapper:after{background:linear-gradient(180deg, var(--em-colorBgBase) -100%, transparent 50%)}.blocks-app .blocks-search__result-wrapper.is_search{flex:auto;min-width:0;margin-left:0;margin-right:0;padding-top:20px;padding-left:0;padding-right:6px;display:block;position:static;overflow:hidden auto}.blocks-app .blocks-search__blocks-wrapper{min-width:65%;min-height:0;padding-top:20px;padding-left:10px;padding-right:14px;overflow-y:scroll}.blocks-app .blocks-search__result-holder{opacity:0}.blocks-app .blocks-search__blocks-wrapper{overflow-anchor:none}.blocks-app .blocks-search__blocks-wrapper.is_search{box-sizing:border-box;width:100%;min-width:0;padding-top:0;padding-left:4px;padding-right:0}.blocks-app .blocks-search__result{margin-bottom:14px}.blocks-app .ant-dropdown .ant-dropdown-menu .blocks-search__result__menu-item{padding:9px}.blocks-app .blocks-search__result-header{z-index:2;justify-content:space-between;padding:4px 10px;font-size:13px;display:none;position:relative;box-shadow:0 5px 20px #00000012}.blocks-app .blocks-search__result-global-mark{z-index:10;pointer-events:none;position:absolute;top:1px;right:1px}.blocks-app .blocks-search__result-body{background:var(--em-colorBgElevated);border:1px solid var(--em-colorBorder);border-radius:calc(var(--em-borderRadiusSM) * 1px);text-align:center;cursor:grab;background-color:var(--em-controlTmpOutline);min-height:13px;padding:0;transition:border-color .3s cubic-bezier(.645,.045,.355,1),background-color .3s cubic-bezier(.645,.045,.355,1),box-shadow .3s cubic-bezier(.645,.045,.355,1);position:relative;overflow:hidden}.blocks-app .blocks-search__result-body:hover{border-color:var(--em-colorTextDisabled);cursor:grab!important}.blocks-app .blocks-search__result-body:active{cursor:grabbing}.blocks-app .blocks-search__result-body:not([data-preview-measured]){min-height:180px}.blocks-app .blocks-search__result-body:after{content:"";z-index:1;width:100%;height:100%;display:block;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-html{transform-origin:0 0;text-align:left;min-width:660px;height:100%;overflow-x:visible}.blocks-app .blocks-search__result-body:not([data-preview-measured]) .blocks-search__result-html{min-height:1px}.blocks-app .blocks-search .em-dragging-element .blocks-search__result-body{background-color:var(--em-controlTmpOutline)}.blocks-app .blocks-search .em-ghost-element{border-radius:calc(var(--em-borderRadiusXL) * 1px);overflow:hidden;background-color:var(--em-colorBgContainer)!important}.blocks-app .email-pane .ant-tabs .blocks-search__result-divider.ant-divider-horizontal{width:100%;margin-left:0;margin-right:0}.blocks-app .blocks-search.is_search{display:flex}.blocks-app .blocks-search.is_search .blocks-search__type-wrapper{min-width:33%;padding-left:24px;padding-right:0}.blocks-app .block-search__preview{background-color:var(--em-colorBgContainer);border-radius:calc(var(--em-borderRadiusXL) * 1px);box-shadow:var(--em-boxShadow);opacity:0;border:1px solid #fff;width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .block-search__preview-title{color:var(--em-colorTextSecondary);padding:8px 15px;font-size:14px}.blocks-app .block-search__preview-content{border:1px solid var(--em-colorBorderSecondary);border-radius:calc(var(--em-borderRadiusLG) * 1px);overflow:hidden}.blocks-app .block-search__preview-content table{border-collapse:initial}.dark .blocks-app .block-search__preview{border-color:#4f4f4f}.blocks-app .email-pane__col-wrapper_reverse .block-search__preview{left:auto;right:-15px;transform:translate(99%)}.blocks-app .block-global-badge{color:var(--em-colorTextSecondary);pointer-events:auto;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .block-global-badge svg{display:block}.blocks-app .block-global-badge--tile{box-sizing:border-box;background-color:#ffffffb8;border-radius:6px;width:24px;min-width:24px;height:24px;min-height:24px;padding:0;box-shadow:0 1px 2px #0000001a}.blocks-app .block-global-badge--tile svg{flex-shrink:0}.blocks-app body.dark .block-global-badge--tile,.dark .blocks-app .block-global-badge--tile{color:#ffffffe0;background-color:#0000008c;box-shadow:0 1px 3px #00000059}.blocks-app .discuss-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-content-holder,.blocks-app .discuss-wrapper .ant-tabs-content,.blocks-app .discuss-wrapper .ant-tabs-tabpane,.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{overflow:hidden}.blocks-app .discuss-wrapper .discuss-main{flex-direction:column;height:100%;min-height:0;display:flex;position:relative;overflow:hidden}.blocks-app .discuss-main>.comment-list{flex:auto;min-height:0;margin-bottom:24px;overflow:hidden auto}.blocks-app .discuss-main>form{flex-shrink:0}.blocks-app .discuss-main .ant-comment-content{flex:1;min-width:0}.blocks-app .discuss-main .ant-comment-content-author{flex-wrap:wrap;align-items:baseline;gap:8px;margin-bottom:4px;display:flex}.blocks-app .discuss-main .ant-comment .ant-comment-content-author-name{color:var(--em-colorTextBase);font-weight:500;transition:color .3s;font-size:14px!important;line-height:1.4!important}.blocks-app .discuss-main .ant-comment-content-author-time{color:var(--em-colorTextSecondary);white-space:nowrap;font-size:12px;line-height:1.4}.blocks-app .discuss-main .comment-item-noavatar .ant-comment-content-detail{margin-left:0}.blocks-app .discuss-main .ant-comment-content-detail p{white-space:normal;color:var(--em-colorText);margin:0 0 16px;line-height:1.4}.blocks-app .discuss-main .ant-comment-content-detail :not(.ant-btn,.buttons-variants,.buttons-variants *){-webkit-user-select:text;user-select:text}.blocks-app .discuss-main .ant-dropdown-trigger{z-index:1;color:var(--em-colorText);margin:-36px 0 -1px -24px;padding:36px 0 1px 24px;position:relative}.blocks-app .discuss-main .ant-comment-nested .ant-dropdown-trigger{margin-left:-18px;padding-left:18px}.blocks-app .discuss-main .ant-comment-inner{transition:all .5s}.blocks-app .discuss-main .ant-comment.active>.ant-comment-inner{background:#efdbff}.blocks-app .discuss-main .targetted-comment-item>.ant-comment-inner{background:var(--em-colorInfoBg);cursor:pointer}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;margin-top:6px;transition:all .3s cubic-bezier(.645,.045,.355,1);display:none}.blocks-app .discuss-main .ant-form-item-control-input-content{margin-left:2px}.blocks-app .discuss-main .ant-tooltip-container{text-align:center}.blocks-app .discuss-main .ant-comment-content:hover .ant-comment-actions{opacity:1}.blocks-app .discuss-main .replyEditMode{opacity:.5;display:none}.blocks-app .discuss-main .icon-target{font-size:16px;transform:translateY(5%)}.blocks-app .discuss-main .comment-icon-target{border-radius:8px;margin-left:5px;padding:0 8px 2px}.blocks-app .discuss-main .comment-icon-target:hover{cursor:pointer}.blocks-app .discuss-main .ant-btn.ant-btn-primary.button-target.button-target_choose{background:var(--em-colorInfo)}.blocks-app .discuss-main .ant-space button{margin-right:0}.blocks-app .anticon-history{transform:scaleX(-1)}.blocks-app .history-panel{border-right:1px solid var(--em-colorBorder);flex-direction:column;justify-content:space-between;height:100%;display:flex;box-shadow:-12px 0 48px 16px #00000008,-9px 0 28px #0000000d,-6px 0 16px -8px #00000014}.blocks-app .history-panel__sider{z-index:11;background:var(--em-colorBgContainer);height:100%;position:absolute;top:0;bottom:0;left:80px}.blocks-app .history-panel__list-header,.blocks-app .history-panel__header{justify-content:space-between;align-items:center;padding:0 24px 9px;font-weight:500;display:flex}.blocks-app .history-panel__list-header :last-child{min-width:60px}.blocks-app .history-panel__header{padding-left:24px;padding-right:24px}.blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--em-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--em-colorBorderSecondary);content:"";z-index:1;background-position:0 -2px;background-repeat:no-repeat;border-bottom:none;height:20px;position:absolute;inset:30px 0 -20px}.dark .blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--em-colorBgBase), transparent 40%)}.blocks-app .history-panel__header-title{font-size:14px;font-style:normal;line-height:24px}.blocks-app body.dark .history-panel__header-title{color:#fff}.blocks-app .history-panel__header-close{color:#00000073;margin-right:-16px}.blocks-app body.dark .history-panel__header-close{color:#fff}.blocks-app .history-panel__list{height:100%;margin:10px -24px 0}.blocks-app .history-panel__list .ant-list-header{border:none;margin-bottom:5px;padding:0;font-weight:500}.blocks-app .history-panel__list .ant-spin-nested-loading,.blocks-app .history-panel__list .ant-spin-container{height:100%}.blocks-app .history-panel__list .ant-list-items{height:calc(100% - 30px);overflow:auto}.blocks-app .history-panel__list .ant-list-item{cursor:pointer;border:none;padding:9px 24px}.blocks-app .history-panel__list .ant-list-item:hover{background-color:var(--em-colorFillQuaternary)}.blocks-app .history-panel__list .ant-btn.ant-btn-sm{--ant-btn-border-width:0;height:22px;line-height:1;padding:0!important}.blocks-app .history-panel .ant-list-item{padding:9px 0}.blocks-app .history-panel__list-date,.blocks-app .history-panel__list-header .history-panel__list-date{min-width:130px}.blocks-app .history-panel__list-author{white-space:nowrap;text-overflow:ellipsis;flex:1;overflow:hidden}.blocks-app .history-panel__restore{opacity:0;visibility:hidden}.blocks-app .history-panel__item_active{background-color:var(--em-colorFillSecondary)}.blocks-app body.dark .history-panel__item_active{background:#111b26}.blocks-app .history-panel__item_active .history-panel__restore{opacity:1;visibility:visible}.blocks-app .ant-layout-sider.history-panel__sider .ant-layout-sider-children{opacity:1;width:500px;height:100%;transition:opacity .5s;position:absolute;right:0}.blocks-app .ant-layout-sider-collapsed.history-panel__sider .ant-layout-sider-children{opacity:0}.blocks-app .add-new-block-modal__save-btn .ant-btn-icon .anticon{font-size:22px;line-height:0}.blocks-app .add-new-block-modal__save-btn .ant-btn-icon .anticon svg{width:22px;height:22px}.blocks-app .modal-footer{justify-content:flex-end;padding:8px 0;display:flex}.blocks-app .modal-spinner{justify-content:center;align-items:center;height:108px;display:flex}',e=window.__emailmaker_styles__||(window.__emailmaker_styles__={sheets:{},order:[]}),p=t;if(!e.sheets[p]){var a=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(a=new CSSStyleSheet,a.replaceSync(t))}catch{a=null}if(a){if(!e.host||!e.host.isConnected||!e.host.sheet){var o=document.createElement("style");o.setAttribute("data-emailmaker","true"),document.head.appendChild(o),e.host=o}for(var i=e.host.sheet,r=0;r<a.cssRules.length;r++)try{i.insertRule(a.cssRules[r].cssText,i.cssRules.length)}catch{}(e.texts||(e.texts=[])).push(t),(e.listeners||[]).forEach(function(l){try{l(t)}catch{}})}else{var o=document.createElement("style");o.setAttribute("data-emailmaker","true"),o.appendChild(document.createTextNode(t)),document.head.appendChild(o)}e.sheets[p]=!0,e.order.push(p)}}}catch(l){console.error("vite-plugin-css-injected-by-js",l)}})();
9
+ __emailmaker__.define("static/core/db92581b.js",["require","exports","module","static/core/5dc34752.js","static/core/ee980948.js","static/core/c948c45f.js","static/core/e4c1aab3.js","static/core/2d94d780.js","static/core/652a482d.js","static/core/674e22a5.js","static/core/d4c10a7e.js","static/core/322d3e9f.js","static/core/f399000c.js","static/core/36f3f772.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(po,_o,ep){const ao=po("./5dc34752.js"),To=po("./ee980948.js"),r=po("./c948c45f.js"),li=po("./e4c1aab3.js"),Qa=po("./2d94d780.js"),H=po("./652a482d.js"),Xo=po("./674e22a5.js"),Ke=po("./d4c10a7e.js"),si=po("./322d3e9f.js"),jt=po("./f399000c.js"),Sr=po("./36f3f772.js");let a=po("react");a=ao.__toESM(a);let o=po("react/jsx-runtime"),t=po("__delivery__/libs"),Za=po("react-dom"),It=po("vite/preload-helper"),Ue=po("classnames");Ue=ao.__toESM(Ue);let rt=po("dayjs");rt=ao.__toESM(rt);var f=ao.__toESM(r.require_prop_types());async function Tr(e){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(e);try{return{width:i.width,height:i.height}}finally{i.close?.()}}catch{}return new Promise((i,l)=>{const s=URL.createObjectURL(e),n=new Image;n.onload=()=>{URL.revokeObjectURL(s);const d=n.naturalWidth||n.width,c=n.naturalHeight||n.height;d>0&&c>0?i({width:d,height:c}):l(new Error("Could not read image dimensions"))},n.onerror=()=>{URL.revokeObjectURL(s),l(new Error("Could not decode image"))},n.src=s})}async function Rr(e,i){if(!e||typeof e.findFileByUrl!="function")return null;const l=await e.findFileByUrl(i);if(!l)return null;const s=typeof e.getFileById=="function"&&l.id&&await e.getFileById(l.id)||l,n=s.url||i,d=s.thumbnailUrl||s.thumbnail||n||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(s):"")||"";return d?{file:s,previewUrl:d}:null}function mt(e){if(!e)return!1;try{return new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").pathname.includes("/static/media/")}catch{return!1}}function yr(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useProjectData(),s=r.useEditorProjectId(),n=l?.id!==void 0?String(l.id):s||"",d=r.useEventEmitter(To.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(To.events.PROXY_URL_EVENT_ID);return(0,a.useCallback)(async(p,g)=>Xo.fetchEditorImageBlobByUrl(p,{appConfig:e,isStandalone:i,fireFileProxy:b=>d.fire({url:b,project:n}),fireProxyUrl:b=>c.fire({url:b,project:n})},g),[e,n,i,d,c])}var wr=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),ai=({onChange:e,value:i,validateStatus:l,placeholder:s,disabled:n,name:d,elementSettings:c,imageInfo:p,previewReloadSignal:g,onRemotePreviewValidate:b})=>{const _=r.useCurrentUser(),h=r.useProjectData(),m=r.useAppConfig(),T=r.useIsStandalone(),{__:E}=r.useI18n();r.useSendPostMessage();const x=r.useSendPostMessageEx(),{openImagePicker:R}=r.useImagePicker(),j=r.useStorageProvider(),N=r.useRestClient(),B=h?.id!==void 0?String(h?.id):"",v=_?.id!=="0"?String(_.id):"",{dataProvider:$}=(0,a.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:j,projectId:B,restApi:N,i18n:{__:E},pathPostfix:v,appConfig:m,isStandalone:T}),[m,T,B,N,j,v,E]),U=yr(),[I]=r.useLazyGetImageInfoQuery(),[L,P]=(0,a.useState)({width:"",height:"",size:""}),[z,le]=(0,a.useState)(!1),[C,re]=(0,a.useState)(0),[ce,fe]=(0,a.useState)(""),Be=(0,a.useRef)(""),se=(0,a.useRef)(g?.counter||0),he=Xo.useImageBlobResolver(),Pe=(0,a.useRef)(""),pe=(0,a.useRef)(""),[De,Oe]=(0,a.useState)(0),Ce=r.usePlanFeatureGate("image_editor"),ge=()=>{Pe.current&&(URL.revokeObjectURL(Pe.current),Pe.current="")};(0,a.useEffect)(()=>{if(!i){P({width:"",height:"",size:"",format:""}),Be.current="",fe(""),ge();return}if(i.startsWith("data:")||i.startsWith("blob:")){ge(),Be.current=i,fe(i),P({width:"",height:"",size:"",format:""});return}const V=r.stripEmVersionFromUrlString(i);pe.current=V;const M=Xo.canonicalImageUrlKey(V),Y=new AbortController;let X=!1;const oe=async Te=>{ge();const Se=De?r.appendEmVersionForPreviewReload(Te):Te;Be.current=Se,fe(Se);try{const{data:te}=await I(V);return X||!te?!1:(P({width:te?.width,height:te?.height,size:te?.fileSize!=null?(te.fileSize/1024).toFixed(0):"",format:Xo.normalizeImageFormatForDisplay(te?.format)}),!0)}catch{return!1}},me=async()=>{const Te=await he.resolve(M,Y.signal,U);if(X)return;const{width:Se,height:te}=await Tr(Te);if(X)return;ge();const D=URL.createObjectURL(Te);Pe.current=D,Be.current=D,fe(D),P({width:Se,height:te,size:(Te.size/1024).toFixed(0),format:Xo.normalizeImageFormatForDisplay(Te.type)})};return(async()=>{try{if(!T){const Te=await Rr($,V);if(Te?.previewUrl&&await oe(Te.previewUrl))return}await me()}catch{X||(ge(),Be.current="",fe(""),P({width:"",height:"",size:"",format:""}))}})(),()=>{X=!0,Y.abort()}},[i,$,U,I,T,he,De]);const _e=(0,a.useCallback)(()=>{const V=pe.current;V&&he.abandonKey(Xo.canonicalImageUrlKey(V)),Oe(Date.now())},[he]);(0,a.useEffect)(()=>{!g?.counter||g.name!==d||g.counter!==se.current&&(se.current=g.counter,_e())},[d,g,_e]),(0,a.useEffect)(()=>()=>ge(),[]);const Q=!!i&&!mt(r.stripEmVersionFromUrlString(String(i))),K=async(V=null)=>{const M=d.startsWith("src"),Y=V||(M?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),X=r.stripEmVersionFromUrlString(i||""),oe=await R({kind:M?"img":"background",currentUrl:mt(X)?"":X,entryModal:Y});if(!oe?.url)return;const me=X===r.stripEmVersionFromUrlString(oe.url);(!me||oe.url!==i)&&e(oe.url),oe.meta?.mode==="save"&&me&&(_e(),M&&x(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(oe.url)}))},q=[{label:E("Upload"),key:"Upload",onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];m.imageCenterStockEnabled&&q.push({label:E("Stock"),key:"Stock",onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),m.imageCenterGifEnabled&&q.push({label:E("GIF"),key:"GIF",onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),m.elementAIimageEnabled&&q.push({label:E("AI"),key:"AI",onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const Z=()=>{le(!1)};return(0,o.jsxs)("div",{className:(0,Ue.default)("upload-bg-image",{"upload-bg-image_disabled":n}),children:[i?(0,o.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:V=>{V.target?.closest(".upload-bg-image__edit")||V.target?.closest(".upload-bg-image__edit-menu")||V.target?.closest(".upload-bg-image__menu")||V.target?.closest(".inputGroup")||K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>m.imagePathDropdownEnabled?(0,o.jsx)("div",{className:"inputGroup",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:20,strokeWidth:m.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:s,name:d,disabled:n,className:"upload-bg-image__input"})}):(0,o.jsx)(o.Fragment,{}),classNames:{root:"upload-bg-image__dropdown-overlay"},styles:{root:{top:32,marginTop:"8px",width:347,left:0}},trigger:["hover"],placement:"bottom",getPopupContainer:V=>V.closest(".upload-bg-image__inner-wrap"),children:(0,o.jsxs)("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content",children:(0,o.jsxs)("div",{className:"upload-bg-image__uploader-content-inner",children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-wrap",children:ce?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:ce,alt:"",onLoad:()=>{b&&wr(r.stripEmVersionFromUrlString(i||""))&&b("success")},onError:()=>{const V=pe.current,M=r.stripEmVersionFromUrlString(ce||""),Y=r.stripEmVersionFromUrlString(V||"");if(V&&M!==Y){Be.current=V,fe(V);return}b&&wr(Y)&&b("error")}}):(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-placeholder","aria-hidden":!0})}),(0,o.jsx)("div",{className:"upload-bg-image__uploader-icons-wrap",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content"})})]})})}),L.width&&L.height?(0,o.jsxs)("div",{className:"image-size",children:[L.width," × ",L.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+p.renderedWidth+" × "+p.renderedHeight,(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsxs)("span",{children:[L.size," ",E("kB")]}),L.format&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsx)("span",{className:"image-size-format",children:L.format})]})]}):(0,o.jsx)(t.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:s})]})}),(0,o.jsx)("div",{style:{flexGrow:1}}),L.format!=="gif"&&m.imageCenterEditorEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:E("Edit"),children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,o.jsx)(r.EmIcons,{icon:"Edit",component:t.icons$Edit,size:16,strokeWidth:m.iconStrokeWidth,onClick:()=>{Ce.isLocked&&Q?(le(!0),re(r.FEATURE_UPSELL_SLIDE.image_editor)):K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_EDIT:r.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT)}})})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:q},classNames:{root:"upload-bg-image__menu"},children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,o.jsx)(r.EmIcons,{size:16,strokeWidth:m.iconStrokeWidth,icon:"SyncOutlined",component:t.icons$SyncOutlined,onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):E("Upload")})},"Actions")]}):(0,o.jsx)(t.ui_kit$Button,{type:"default",block:!0,onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:16,strokeWidth:m.iconStrokeWidth}),children:E("Add image")}),z&&(0,o.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:Z,initialSlide:C})]})};ai.propTypes={};var en=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),on=(e,i,l)=>i||(l?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),jr=e=>Array.isArray(e)?e.join("_"):e,Ao=({form:e,label:i,name:l,watchPath:s,disabled:n=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:p}=(0,t.ui_kit$useToken)(),[g,b]=(0,a.useState)("success"),_=(0,a.useMemo)(()=>({marginBottom:p.formItemMarginBottomXS}),[p.formItemMarginBottomXS]),h=t.ui_kit$Form.useWatch(on(l,s,d),e);return(0,a.useEffect)(()=>{if(!h){b("");return}if(typeof h=="string"&&(h.startsWith("data:")||h.startsWith("blob:"))){b("success");return}if(en(h)){b("validating");return}b("success")},[h]),(0,o.jsx)(t.ui_kit$Form.Item,{name:l,validateStatus:g,style:_,children:(0,o.jsx)(ai,{validateStatus:g,placeholder:i,name:jr(l),disabled:n,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[jr(l).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:b})})};Ao.propTypes={label:f.default.string.isRequired,name:f.default.oneOfType([f.default.string,f.default.arrayOf(f.default.oneOfType([f.default.string,f.default.number]))]).isRequired,watchPath:f.default.arrayOf(f.default.oneOfType([f.default.string,f.default.number])),tooltipTitle:f.default.string,disabled:f.default.bool,previewReloadSignal:f.default.shape({name:f.default.string,counter:f.default.number}),form:f.default.shape({getFieldValue:f.default.func.isRequired}).isRequired},Ao.defaulProps={disabled:!1,previewReloadSignal:null};var Ro=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:l,elementSettings:s,namePrefix:n="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=d==="mobile",g=p?"mobileBorderRadius":"borderRadius",b=p?"mobileBorderRadiusAll":"borderRadiusAll",_=p?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",h=p?"mobileBorderRadiusTopRight":"borderRadiusTopRight",m=p?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",T=p?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",E=p?H.MOBILE_BORDER_RADIUS_POSITION:H.BORDER_RADIUS_POSITION,x=()=>{const R=e.getFieldsValue(!0);let j;i?(e.setFieldsValue({[_]:R[b]||null,[T]:R[b]||null,[h]:R[b]||null,[m]:R[b]||null}),j={[g]:{[E[_]]:R[b]||0,[E[T]]:R[b]||0,[E[h]]:R[b]||0,[E[m]]:R[b]||0}}):R[_]===R[T]&&R[_]===R[h]&&R[_]===R[m]?(e.setFieldsValue({[b]:R[_]}),j={[g]:{[E[b]]:R[_]}}):(e.setFieldsValue({[_]:null,[T]:null,[h]:null,[m]:null}),j={[g]:{[E[b]]:0,[E[_]]:0,[E[T]]:0,[E[h]]:0,[E[m]]:0}});const N=p?{mobileBorderRadius:{all:R.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${n}${g}`]:{...s[`${n}${g}`],...j[`${n}${g}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:N}),l(B=>!B)};return(0,o.jsx)(t.ui_kit$FormBorderRadiusInputs,{namePrefix:n,typeOfForm:d,oneBorderRadiusValue:i,onToggle:x,borderRadiusIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};Ro.displayName="SelectedElementFormBorderRadius";var tn="em-mob-text_align-",rn=({value:e,onChange:i,onSync:l,fieldName:s,...n})=>{const d=(typeof e=="object"?e?.value:e)??"",c=p=>{const g={classNamePrefix:tn,value:p};i?.(g),l?.({[s]:g})};return(0,o.jsx)(t.ui_kit$FormAlignControl,{value:d,onChange:c,...n})},Do=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",tooltipTitle:n,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),g=d==="mobile",b=g?"mobileAlign":s;if(g){const _=h=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:h})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:b,children:(0,o.jsx)(rn,{fieldName:b,onSync:_,disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:n})})}return(0,o.jsx)(t.ui_kit$Form.Item,{name:b,children:(0,o.jsx)(t.ui_kit$FormAlignControl,{disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:n})})},Oo=({form:e,elementSettings:i,tooltipTitle:l,disabled:s=!1,isNewIconType:n=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),g=d==="mobile",b=g?"mobileVerticalAlign":"valign",_=h=>{e.setFieldsValue({[b]:h}),g||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[b]:h}})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:b,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{...!g&&{value:i.valign,onChange:_},disabled:s,isNewIconType:n,strokeWidth:p.iconStrokeWidth})})},ln=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],sn=({form:e,elementSettings:i,enableSwitch:l,usedColors:s,withoutShadowLabel:n})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[p,g]=(0,a.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),b=t.ui_kit$Form.useWatch(ln,e);(0,a.useEffect)(()=>{if(!b)return;const[h,m,T,E,x,R]=b;(h===0||h===void 0||h===null)&&(m===0||m===void 0||m===null)&&(T===0||T===void 0||T===null)&&(E===0||E===void 0||E===null)&&(x===""||x===void 0||x===null)&&(R===!1||R===void 0)||g(!1)},[b]);const _=()=>{g(h=>!h),e.setFieldsValue({mobileBoxShadowHOffset:p?"":0,mobileBoxShadowVOffset:p?"":0,mobileBoxShadowBlurRadius:p?"":0,mobileBoxShadowSpreadRadius:p?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:p?null:0,vOffset:p?null:0,blurRadius:p?null:0,spreadRadius:p?null:0,color:null,inset:!1}}})};return(0,o.jsxs)(o.Fragment,{children:[l&&(0,o.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,o.jsx)(t.ui_kit$Switch,{id:"without-shadow",label:n,labelSize:"small",size:"small",checked:p,onChange:_})}),(0,o.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:s})]})},jo=({typeOfForm:e="desktop",form:i,elementSettings:l,enableSwitch:s=!0})=>{const{__:n}=r.useI18n(),d=r.useSelector(r.selectEmailSettings).usedColors;return e==="mobile"&&i&&l?(0,o.jsx)(sn,{form:i,elementSettings:l,enableSwitch:s,usedColors:d,withoutShadowLabel:n("Without shadow")}):(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};jo.displayName="SelectedElementFormBoxShadow";var Io=({form:e,elementSettings:i,directionControl:l})=>{const{__:s}=r.useI18n();return(0,o.jsx)(t.ui_kit$FormDisplayControl,{directionControl:l,className:"selected-element-form-show",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"show",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$Radio.Group,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Radio.Button,{value:"all",children:s("Both")}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Desktop"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"desktop",children:(0,o.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:t.icons$DesktopOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Mobile"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"mobile",children:(0,o.jsx)(r.EmIcons,{icon:"MobileOutlined",component:t.icons$MobileOutlined})})})]})})})})},ni=({form:e,elementSettings:i,handleChangeValues:l})=>{const{__:s}=r.useI18n(),n=(0,a.useRef)(),{token:d}=(0,t.ui_kit$useToken)(),[c,p]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),[_,h]=(0,a.useState)(!1),[m,T]=(0,a.useState)(!1),[E,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let P=new URL("https://emailmaker.ru/?"+i.countdown);p(P.searchParams.get("font1").endsWith("-b")||P.searchParams.get("font1").endsWith("-bi")),b(P.searchParams.get("font1").endsWith("-i")||P.searchParams.get("font1").endsWith("-bi")),h(P.searchParams.get("font2").endsWith("-b")||P.searchParams.get("font2").endsWith("-bi")),T(P.searchParams.get("font2").endsWith("-i")||P.searchParams.get("font2").endsWith("-bi")),x(P.searchParams.get("tp")==="true")},[i]);const R=[{value:"-12",label:s("-12:00 Apia")},{value:"-11",label:s("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:s("-10:00 Honolulu, Anchorage")},{value:"-9",label:s("-9:00 Anchorage, Yukon")},{value:"-8",label:s("-8:00 Los Angeles, Vancouver")},{value:"-7",label:s("-7:00 Denver, Phoenix")},{value:"-6",label:s("-6:00 Mexico City, Guadalajara")},{value:"-5",label:s("-5:00 New York, Toronto, Havana")},{value:"-4",label:s("-4:00 Caracas, Santo Domingo")},{value:"-3",label:s("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:s("-2:00 South Georgia, Saint Helena")},{value:"-1",label:s("-1:00 Azores, Cape Verde")},{value:"0",label:s("+0:00 London, Lisbon, Dublin")},{value:"1",label:s("+1:00 Paris, Berlin, Rome")},{value:"2",label:s("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:s("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:s("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:s("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:s("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:s("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:s("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:s("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:s("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:s("+11:00 Honiara, Nuku'alofa, Apia")}],j=[{value:"20",label:s("20 s")},{value:"40",label:s("40 s")},{value:"60",label:s("60 s")}],N=[{value:"arial",label:"Arial"},{value:"courier-new",label:"Courier New"},{value:"georgia",label:"Georgia"},{value:"helvetica",label:"Helvetica"},{value:"tahoma",label:"Tahoma"},{value:"times-new-roman",label:"Times New Roman"},{value:"trebuchet-ms",label:"Trebuchet MS"},{value:"verdana",label:"Verdana"},{value:"open-sans",label:"Open Sans"},{value:"roboto",label:"Roboto"}],B=P=>P&&P<(0,rt.default)().endOf("day")-864e5,v=P=>{x(P)},$=()=>{const P=!c;e.setFieldValue("countdownNumbersStrong",P),l({countdownNumbersStrong:P}),p(P)},U=()=>{const P=!g;e.setFieldValue("countdownNumbersItalic",P),l({countdownNumbersItalic:P}),b(P)},I=()=>{const P=!_;e.setFieldValue("countdownLabelsStrong",P),l({countdownLabelsStrong:P}),h(P)},L=()=>{const P=!m;e.setFieldValue("countdownLabelsItalic",P),l({countdownLabelsItalic:P}),T(P)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("End time"),name:"countdownTime",children:(0,o.jsx)(t.ui_kit$DatePicker,{ref:n,format:"DD.MM.YYYY HH:mm",disabledDate:B,showTime:!0,placement:"bottomRight",getPopupContainer:P=>{const z=P?.closest(".blocks-app");return z||(P?.ownerDocument?.body??document.body)},allowClear:!1,allowEmpty:!1})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Time zone"),name:"countdownTimeZone",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:s("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:R.map(P=>(0,o.jsx)(t.ui_kit$Select.Option,{value:P.value,children:P.label},P.value))})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Background color"),name:"countdownBackgroundColor",className:"countdown-color",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:s("Background color"),usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29},children:(0,o.jsx)(t.ui_kit$Switch,{id:"countdownTransparency",label:s("Transparency"),labelSize:"small",size:"small",onChange:v})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Countdown font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:N})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:12,placeholder:s("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:$,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":g}),onClick:U,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Time units font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:N})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:8,placeholder:s("Font size"),addonAfter:"px",prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_}),onClick:I,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":m}),onClick:L,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Language"),name:"countdownLanguage",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:[{value:"ru_RU",label:"Русский"},{value:"en_US",label:"English"},{value:"uk_UA",label:"Українська"},{value:"pt_BR",label:"Português"},{value:"fr-CA",label:"Français"},{value:"de_DE",label:"Deutsch"},{value:"pl_PL",label:"Polski"},{value:"es_ES",label:"Español"},{value:"tr_TR",label:"Türkçe"},{value:"lt_LT",label:"Lietuvių kalba"},{value:"lv_LV",label:"Latviešu valoda"},{value:"et_EE",label:"Eesti keel"},{value:"hu_HU",label:"Magyar"},{value:"el_GR",label:"Ελληνικά"},{value:"it_IT",label:"Italiano"}]})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Duration"),name:"countdownDuration",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:j})})})]})]})};ni.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var di=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("URL of the video clip."),placement:"right",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:["video","source"],className:"selected-image-form__alt",children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:l("Video URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"VideoCameraOutlined",component:t.icons$VideoCameraOutlined})})})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Play button"),name:["video","playButton"],style:{width:"100%",marginBottom:s.formItemMarginBottomMD+4},children:(0,o.jsxs)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:[(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_red",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined,style:{color:"#FF0000"}})," ",l("Youtube Red")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_black",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined})," ",l("Youtube Black")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_white",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined,style:{color:"#aaa"}})," ",l("Youtube White")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"vimeo",children:[(0,o.jsx)(r.EmIcons,{icon:"Vimeo",component:t.icons$Vimeo})," ",l("Vimeo")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"white_circle",children:[(0,o.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:t.icons$PlayCircleOutlined,style:{color:"#aaa"}})," ",l("White circle")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"black_circle",children:[(0,o.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:t.icons$PlayCircleOutlined})," ",l("Black circle")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"white_circle_outlined",children:[(0,o.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:t.icons$RightCircleOutlined,style:{color:"#aaa"}})," ",l("White circle outlined")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"black_circle_outlined",children:[(0,o.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:t.icons$RightCircleOutlined})," ",l("Black circle outlined")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"none",children:[" ",l("Without button")]})]})})]})};di.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var an={marginBottom:10},vo=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:an,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ampShow",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$Radio.Group,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Radio.Button,{value:"all",children:e("Both")}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:e("AMP"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"amp",children:"AMP"})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:e("HTML"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"html",children:"HTML"})})]})})})})})},{Option:ci}=t.ui_kit$Select,{mobileBorderRadiusAll:nn,mobileBorderRadiusTopLeft:ui,mobileBorderRadiusBottomLeft:mi,mobileBorderRadiusTopRight:pi,mobileBorderRadiusBottomRight:hi,borderRadiusBottomRight:bi,borderRadiusTopRight:gi,borderRadiusBottomLeft:fi,borderRadiusTopLeft:_i,alt:dn,src:cn,title:un,link:lt,borderRadiusAll:Ir,imgReplacer:mn,expanded:pn}={link:"link",borderRadiusBottomRight:"borderRadiusBottomRight",borderRadiusTopRight:"borderRadiusTopRight",borderRadiusBottomLeft:"borderRadiusBottomLeft",borderRadiusTopLeft:"borderRadiusTopLeft",mobileBorderRadiusAll:"mobileBorderRadiusAll",mobileBorderRadiusTopLeft:"mobileBorderRadiusTopLeft",mobileBorderRadiusBottomLeft:"mobileBorderRadiusBottomLeft",mobileBorderRadiusTopRight:"mobileBorderRadiusTopRight",mobileBorderRadiusBottomRight:"mobileBorderRadiusBottomRight",alt:"alt",imgReplacer:"imgReplacer",src:"src",title:"title",borderRadiusAll:"borderRadiusAll",expanded:"expanded"},Ko=({linkProtocol:e})=>{switch(e){case"https://":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});case"mailto:":return(0,o.jsx)(r.EmIcons,{icon:"MailOutlined",component:t.icons$MailOutlined});case"tel:":return(0,o.jsx)(r.EmIcons,{icon:"PhoneOutlined",component:t.icons$PhoneOutlined});case"sms:":return(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined});case"ftp://":return(0,o.jsx)(r.EmIcons,{icon:"FileOutlined",component:t.icons$FileOutlined});case"#":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});default:return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined})}},hn=e=>[{value:"https://",label:e("Site")},{value:"mailto:",label:e("E-mail")},{value:"tel:",label:e("Phone")},{value:"sms:",label:e("SMS")},{value:"ftp://",label:e("File")},{value:"#",label:e("Anchor")},{value:"",label:e("Other")}],qo=({handleLinkProtocolsChange:e,linkProtocol:i,__:l})=>{const s=a.default.useMemo(()=>hn(l),[l]);return(0,o.jsx)(t.ui_kit$Select,{style:{width:90,textAlign:"left"},value:i,onChange:e,options:s,popupMatchSelectWidth:!1,listHeight:320})},Jo=({show:e,__:i,style:l,className:s})=>{const n=a.default.useMemo(()=>({marginBottom:8,...l}),[l]);return e?(0,o.jsx)(t.ui_kit$Alert,{className:s,title:i("Anchor links do not work in Outlook, Gmail, and several other email clients."),type:"warning",showIcon:!0,style:n}):null},xi=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),bn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,gn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function Qo(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const l=i.match(bn);if(l)i=l[2];else{const s=i.match(gn);s&&(i=s[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var vt=(e,i="https://")=>e?e.startsWith("https://")||e.startsWith("http://")?"https://":e.startsWith("mailto:")?"mailto:":e.startsWith("tel:")?"tel:":e.startsWith("sms:")?"sms:":e.startsWith("ftp://")?"ftp://":xi(e)?"#":"":i,Vo=(e,i)=>{const l=vt(e,"");return i(l),l},vr=e=>{if(!e||!e.startsWith("mailto:"))return{subject:"",body:"",baseEmail:e||""};try{const i=new URL(e),l=e.split("?")[0];return{subject:i.searchParams.get("subject")||"",body:i.searchParams.get("body")||"",baseEmail:l}}catch{return{subject:"",body:"",baseEmail:e.split("?")[0]}}},ki=(e,i,l)=>{if(!e||!e.startsWith("mailto:"))return e;const s=e.split("?")[0],n=[];return i&&n.push(`subject=${encodeURIComponent(i)}`),l&&n.push(`body=${encodeURIComponent(l)}`),n.length>0?`${s}?${n.join("&")}`:s},u=e=>e||(e===0?"0":""),bo=e=>e&&e!=="auto"?e:e===0?"0":"",Cr=(e,i)=>{if(typeof e=="object"&&e!==null&&"value"in e){if(e.value)return e.value;if(e.value==="")return""}return typeof e=="string"&&e?e:i||""};function Ei(e){const i={...e,link:e.link==null?"https://":e.link,borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),mobileBorderRadiusAll:u(e.mobileBorderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft!==null?e.mobileBorderRadius?.topLeft:e.mobileBorderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft!==null?e.mobileBorderRadius?.bottomLeft:e.mobileBorderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight!==null?e.mobileBorderRadius?.topRight:e.mobileBorderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight!==null?e.mobileBorderRadius?.bottomRight:e.mobileBorderRadius?.all),show:e.show?e.show:"all",altSrc:e.src};if(e.video&&(i.videoPlayButton=e.video.playButton??"youtube_red",i.videoSource=e.video.source??""),e.carouselImages?.length>0){const l={};e.carouselImages?.map((s,n)=>(Object.keys(s).forEach(d=>{l[d+"_"+n]=s[d]}),!0)),i.images=l}if(e.sections?.length>0){const l=[];e.sections?.map((s,n)=>(l.push({[`expanded_${n}`]:s.expanded}),!0)),i.sections=l}return i}function Pr(e,i,l){const s=l.hasOwnProperty("images"),n=l.hasOwnProperty("sections"),d=Object.keys(s?l.images:n?l.sections:l)[0],c=s?l.images:n?l.sections:l;let p={};const g=i.getFieldsValue(!0);switch(d.split("_")[0]){case un:case cn:case dn:case mn:if(s){const _=[...e.carouselImages];_[d.split("_")[1]][d.split("_")[0]]=c[d],p={carouselImages:_}}else p=c;break;case pn:if(n){const _=[...e.sections];_[d.split("_")[1]][d.split("_")[0]]=c[d],p={sections:_}}break;case lt:let b=Qo(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(p.carouselImages=e.carouselImages,s?(i.setFieldValue(["images",[lt+"_"+d.split("_")[1]]],b),p.carouselImages[d.split("_")[1]].link=b,p.link="",i.setFieldValue(lt,"")):(e.carouselImages.forEach((_,h)=>{i.setFieldValue(["images",lt+"_"+h],b),p.carouselImages[h].link=b,p.link=b}),i.setFieldValue(lt,b))):(i.setFieldValue(lt,b),p.link=b);break;case Ir:p={borderRadius:{...e.borderRadius,[H.BORDER_RADIUS_POSITION[_i]]:g[_i],[H.BORDER_RADIUS_POSITION[fi]]:g[fi],[H.BORDER_RADIUS_POSITION[gi]]:g[gi],[H.BORDER_RADIUS_POSITION[bi]]:g[bi],[H.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case _i:case fi:case gi:case bi:p={borderRadius:{...e.borderRadius,[H.BORDER_RADIUS_POSITION[Ir]]:null,[H.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case nn:case ui:case mi:case pi:case hi:p={mobileBorderRadius:{...e.mobileBorderRadius,[H.MOBILE_BORDER_RADIUS_POSITION[ui]]:g[ui],[H.MOBILE_BORDER_RADIUS_POSITION[mi]]:g[mi],[H.MOBILE_BORDER_RADIUS_POSITION[pi]]:g[pi],[H.MOBILE_BORDER_RADIUS_POSITION[hi]]:g[hi],[H.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[d]+"-"}};break;default:p=c}return{...e,...p}}var No=(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(ci,{value:"px",children:"px"}),(0,o.jsx)(ci,{value:"%",children:"%"})]}),fn=(0,o.jsx)(t.ui_kit$Select,{className:"select-after",children:(0,o.jsx)(ci,{value:"px",children:"px"})}),Ar=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,hasLink:g,hasAlt:b,hasTitle:_,isOpenSrcReplacer:h,mergeTagItems:m,mergeMenuOpen:T,setMergeMenuOpen:E,cascaderRef:x,linkInputRef:R,linkButtonRef:j,altInputRef:N,altButtonRef:B,titleInputRef:v,titleButtonRef:$,srcReplacerInputRef:U,srcReplacerButtonRef:I,linkProtocol:L,handleLinkProtocolsChange:P,linkButtonHandler:z,linkInputHandler:le,altButtonHandler:C,altInputHandler:re,titleButtonHandler:ce,titleInputHandler:fe,srcReplacerButtonHandler:Be,srcInputHandler:se,handleSelect:he,onChange:Pe,filter:pe,renderSearchOption:De,handleChangeValues:Oe,toggleShowBorderHandler:Ce,toggleShowBorderRadiusHandler:ge,toggleShowBoxShadowHandler:_e})=>{const{__:Q}=r.useI18n(),{token:K}=(0,t.ui_kit$useToken)(),q=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Do,{form:e,elementSettings:i,imgParent:!0})}),q.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Oo,{form:e,elementSettings:i})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ni,{form:e,elementSettings:i,handleChangeValues:Oe}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),q.mergeTagsShow&&m&&(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:T?"none":"inline-flex"},onClick:()=>E(!0),children:Q("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:x,classNames:{popup:{root:"merge-tags"}},options:m,placeholder:Q("Start typing the title"),showSearch:{filter:pe,render:De},spellCheck:"false",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),onChange:Pe,style:{display:T?"block":"none"},open:T,onKeyDown:Z=>{Z.key==="Escape"&&E(!1)}})]})}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(di,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(Ao,{form:e,label:Q("Image path"),name:"src",placeholder:Q("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!b&&!g&&!_&&!h?K.formItemMarginBottomMD+4:K.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:b||Q("Alternative text"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:C,ref:B,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),q.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:_||Q("Tooltip text"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),onClick:ce,ref:$,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:g||Q("Hyperlink URL"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!g}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:z,ref:j})}),q.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:Q("Image replacer"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":h}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Be,ref:I})})]}),(!!g||!!b||!!_||!!h)&&(0,o.jsxs)("div",{style:{marginBottom:K.formItemMarginBottomMD+4},children:[!!g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Jo,{show:L==="#",__:Q,style:{marginBottom:K.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:K.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(qo,{linkProtocol:L,handleLinkProtocolsChange:P,__:Q}),placeholder:Q("Hyperlink URL"),allowClear:!0,ref:R,onChange:le,onSelect:he,prefix:(0,o.jsx)(Ko,{linkProtocol:L})})})})]}),!!b&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:K.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:re,ref:N,onSelect:he})})}),q.formFieldImageTitleEnabled&&!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:K.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:fe,ref:v,onSelect:he})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:K.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:Q("Image src")}),onChange:se,ref:U,onSelect:he})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:q.formImageFieldHeightEnabled,showMinMax:!1,gutter:K.marginSM,rowStyle:{marginBottom:q.formImageFieldHeightEnabled?4:24},labels:{width:Q("Width"),height:Q("Height"),minWidth:Q("Minimum width"),maxWidth:Q("Maximum width")}})}),q.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Borders"),collapsible:!0,open:s,onToggle:Ce,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),q.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Border radius"),collapsible:!0,open:n,onToggle:ge,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,elementSettings:i})}),q.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Box shadow"),collapsible:!0,open:d,onToggle:_e,dividerTop:!0,children:(0,o.jsx)(jo,{})}),q.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),q.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};Ar.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,hasLink:f.default.string,hasAlt:f.default.string,hasTitle:f.default.string,isOpenSrcReplacer:f.default.oneOfType([f.default.bool,f.default.number]),mergeTagItems:f.default.array,mergeMenuOpen:f.default.bool,setMergeMenuOpen:f.default.func,cascaderRef:f.default.object,linkInputRef:f.default.object,linkButtonRef:f.default.object,altInputRef:f.default.object,altButtonRef:f.default.object,titleInputRef:f.default.object,titleButtonRef:f.default.object,srcReplacerInputRef:f.default.object,srcReplacerButtonRef:f.default.object,linkProtocol:f.default.string,handleLinkProtocolsChange:f.default.func,linkButtonHandler:f.default.func,linkInputHandler:f.default.func,altButtonHandler:f.default.func,altInputHandler:f.default.func,titleButtonHandler:f.default.func,titleInputHandler:f.default.func,srcReplacerButtonHandler:f.default.func,srcInputHandler:f.default.func,handleSelect:f.default.func,onChange:f.default.func,filter:f.default.func,renderSearchOption:f.default.func,handleChangeValues:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func};var Ho=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,a.useRef)(),[g,b]=(0,a.useState)(l[i]?.value==="auto"),{token:_}=(0,t.ui_kit$useToken)(),[h,m]=(0,a.useState)(""),T=x=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),b(R=>!R),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:g?null:"auto",dim:""}}})},E=x=>{b(!1),m(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:n,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:_.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,max:h,placeholder:d("Width"),onChange:E,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:No})})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:T})]})};Ho.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var Zo=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,a.useRef)(),[g,b]=(0,a.useState)(l.mobileHeight?.value==="auto"),{token:_}=(0,t.ui_kit$useToken)(),h=T=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),b(E=>!E),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:g?null:"auto",dim:""}}})},m=T=>{b(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:n,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:_.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,placeholder:d("Height"),onChange:m,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-height",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:h})]})};Zo.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var Nr=({form:e,elementSettings:i,handleChangeValues:l,boxShadow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:b,hasLink:_,hasAlt:h,hasTitle:m,linkInputRef:T,linkButtonRef:E,altInputRef:x,altButtonRef:R,titleInputRef:j,titleButtonRef:N,linkInputHandler:B,altButtonHandler:v,altInputHandler:$,titleButtonHandler:U,titleInputHandler:I,linkButtonHandler:L,toggleShowMobileBorderHandler:P,toggleShowMobileBorderRadiusHandler:z,toggleShowMobileBoxShadowHandler:le,toggleShowMobileSizeHandler:C})=>{const{__:re}=r.useI18n(),{token:ce}=(0,t.ui_kit$useToken)(),fe=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:30,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Do,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),fe.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Oo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ni,{form:e,elementSettings:i,handleChangeValues:l}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(di,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(Ao,{form:e,label:re("Image path"),name:"src",placeholder:re("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!h&&!_&&!m?ce.formItemMarginBottomMD+4:ce.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:h||re("Alternative text"),placement:"bottom",getPopupContainer:Be=>Be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!h}),onClick:v,ref:R,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),fe.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:m||re("Tooltip text"),placement:"bottom",getPopupContainer:Be=>Be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!m}),onClick:U,ref:N,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:_||re("Hyperlink URL"),placement:"bottom",getPopupContainer:Be=>Be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:L,ref:E})})]}),(!!_||!!h||!!m)&&(0,o.jsxs)("div",{style:{marginBottom:ce.formItemMarginBottomMD+4},children:[!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:re("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:T,allowClear:!0,placeholder:re("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onChange:B})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:re("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:re("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:$,ref:x})})}),fe.formFieldImageTitleEnabled&&!!m&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:re("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:re("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:I,ref:j})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:re("Size"),collapsible:!0,open:p,onToggle:C,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:24},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Ho,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:re("Width")})}),fe.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Zo,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:re("Height")})})]})}),fe.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("Borders"),collapsible:!0,open:n,onToggle:P,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),fe.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("Border radius"),collapsible:!0,open:d,onToggle:z,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:g,setOneBorderRadiusValue:b,elementSettings:i,typeOfForm:"mobile"})}),fe.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("Box shadow"),collapsible:!0,open:c,onToggle:le,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),fe.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),fe.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};Nr.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,handleChangeValues:f.default.func,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,hasLink:f.default.string,hasAlt:f.default.string,hasTitle:f.default.string,linkInputRef:f.default.object,linkButtonRef:f.default.object,altInputRef:f.default.object,altButtonRef:f.default.object,titleInputRef:f.default.object,titleButtonRef:f.default.object,linkInputHandler:f.default.func,altButtonHandler:f.default.func,altInputHandler:f.default.func,titleButtonHandler:f.default.func,titleInputHandler:f.default.func,linkButtonHandler:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func};var _n=e=>typeof e=="object"&&e!==null?e.path:void 0;function Lo(){const e=(0,a.useRef)(!1),i=(0,a.useRef)(null),l=(0,a.useCallback)(n=>{e.current=!n},[]),s=(0,a.useCallback)((n,d)=>{const c=JSON.stringify(_n(n)??null);return i.current!==c&&(i.current=c,e.current=!1),d?e.current:(e.current=!1,!1)},[]);return(0,a.useMemo)(()=>({markBorderToggled:l,isStaleBorderSnapshot:s}),[l,s])}function st(e){const i=(0,a.useRef)(null),l=(0,a.useRef)(e);return l.current=e,{remember:(0,a.useCallback)(s=>{i.current=s},[]),fillFields:(0,a.useCallback)((s,n)=>{l.current!==i.current&&s.setFieldsValue(n)},[])}}var Lr=2e3;function Or(e,{ordered:i=!1}={}){const l=(0,a.useRef)([]),s=(0,a.useRef)(new WeakMap),n=(0,a.useRef)(e);return n.current=e,{remember:(0,a.useCallback)(d=>{const c=Date.now(),p=l.current.filter(g=>c-g.at<Lr);p.push({key:JSON.stringify(n.current(d)),at:c}),l.current=p.slice(-10),i&&d&&typeof d=="object"&&s.current.set(d,!1)},[i]),isOwnEcho:(0,a.useCallback)(d=>{if(!d)return!1;const c=Date.now(),p=JSON.stringify(n.current(d)),g=l.current.filter(h=>c-h.at<Lr);if(!i)return g.some(h=>h.key===p);const b=s.current.get(d);if(b!==void 0)return b;const _=g.findIndex(h=>h.key===p);return _>=0&&(l.current=g.slice(_)),s.current.set(d,_>=0),_>=0},[i]),forget:(0,a.useCallback)(()=>{l.current=[],s.current=new WeakMap},[])}}var xn=1e3,kn=2e4,$r="https://useblocks.io/app/",En=["activateSection","changeKey","parent","path","nextElem","prevElem"];function Bi(e){if(Array.isArray(e))return e.map(Bi);if(e&&typeof e=="object"){const i=e;return Object.fromEntries(Object.keys(i).sort().map(l=>[l,Bi(i[l])]))}return e}function Bn(e){const i={...e};return En.forEach(l=>delete i[l]),Bi(i)}var Fr=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=Lo(),n=Lo();let d=r.useDispatch();const c=r.useAppConfig(),p=r.useEditorProjectId(),g=r.useNotification(),b=r.useSendPostMessage(),_=r.useSendPostMessageEx(),{openImagePicker:h}=r.useImagePicker(),m=r.useSelector(r.selectEmailViewType),T=r.useSelector(r.selectMobileViewActive),E=r.useCurrentUser(),x=r.useSelector(r.selectIsCodeMode),R=r.useSelector(r.selectCodeModeDirection),[j]=r.useUploadImageMutation(),[N,B]=r.useSendShortLinkMutation(),[v,$]=(0,a.useState)({name:"",counter:0}),U=(0,a.useRef)(null),I=(0,a.useRef)(null),L=(0,a.useRef)(null),P=(0,a.useRef)(null),z=(0,a.useRef)(null),le=(0,a.useRef)(null),C=(0,a.useRef)(null),re=(0,a.useRef)(null),ce=(0,a.useRef)(null),[fe,Be]=(0,a.useState)({}),[se,he]=(0,a.useState)(!0),[Pe,pe]=(0,a.useState)(!0),[De,Oe]=(0,a.useState)(""),[Ce,ge]=(0,a.useState)(""),[_e,Q]=(0,a.useState)(""),[K,q]=(0,a.useState)(!1),[Z,V]=(0,a.useState)(!1),[M,Y]=(0,a.useState)(!1),[X,oe]=(0,a.useState)(!1),[me,Te]=(0,a.useState)(!1),[Se,te]=(0,a.useState)(!1),[D,ie]=(0,a.useState)(!1),[ye,W]=(0,a.useState)(!1),[Re,$e]=(0,a.useState)("https://"),Ae=(0,a.useRef)(!1),We=(0,a.useRef)(),Ve=e,Ge=(0,a.useRef)(Ve);Ge.current=Ve;const de=(0,a.useCallback)(()=>l.getFieldsValue(!0).video,[l]),[je,G]=(0,a.useState)(),[be,Le]=(0,a.useState)(!1),[He,Je]=(0,a.useState)(null),[Ze,so]=(0,a.useState)({start:0,end:0}),[O,ae]=(0,a.useState)(!1),[w,y]=(0,a.useState)(!1),[ue,Ie]=(0,a.useState)(!1),[Ye,Qe]=(0,a.useState)(!1),co=(0,a.useRef)(void 0),ro=(0,a.useRef)(null),uo=(0,a.useRef)(null),ko=Ye||ue||ye;(0,a.useEffect)(()=>()=>clearTimeout(co.current),[]);const Bo=(0,a.useRef)(null);(0,a.useEffect)(()=>{const A=Bo.current,Ne=A?.firstElementChild??null;if(!ko||!A||!Ne)return;const xe=[];for(let eo=A.parentElement;eo;eo=eo.parentElement)getComputedStyle(eo).overflowY!=="visible"&&xe.push(eo);let ke=0,Me="";const Xe=()=>{const eo=A.getBoundingClientRect(),go=A.offsetHeight>0?eo.height/A.offsetHeight:1;let fo=Math.max(eo.top,0),io=Math.min(eo.bottom,window.innerHeight);xe.forEach(Yo=>{const ut=Yo.getBoundingClientRect();fo=Math.max(fo,ut.top),io=Math.min(io,ut.bottom)});const mo=(fo-eo.top)/(go||1),So=Math.max(io-fo,0)/(go||1),wo=`${Math.round(mo)}/${Math.round(So)}`;wo!==Me&&(Me=wo,Ne.style.top=`${mo}px`,Ne.style.height=`${So}px`),ke=requestAnimationFrame(Xe)};return Xe(),()=>cancelAnimationFrame(ke)},[ko]);const F=()=>{const A=ro.current;uo.current=A?.isConnected&&typeof A.selectionStart=="number"?{element:A,start:A.selectionStart,end:A.selectionEnd??A.selectionStart}:null},J=x&&R!=="bottom",we=r.useElementEntityKind();(0,a.useEffect)(()=>{be&&ce.current&&ce.current.focus()},[be]);const ze=(A,Ne)=>{const xe=document.getElementById(Ne);if(xe){const ke=Ne.substring(Ne.indexOf("selected_image_form_")+20),Me=xe.value?.substring(0,Ze.start),Xe=xe.value?.substring(Ze.end);b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[ke]:Me+A+Xe}}),l.setFieldValue(ke,Me+A+Xe),xe.focus(),setTimeout(()=>{xe.selectionStart=Ze.start,xe.selectionEnd=Ze.start+A.length},400),ae(!0)}},Ee=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{Ee?.items?.length&&G(r.mapMargeTags(Ee.items))},[Ee,G]);const S=(A,Ne)=>{if(Le(!1),A){const xe=Ee.syntax.length>1?je.findIndex(Me=>Me.key===Ne[0].key):0,ke=Ee.syntax[xe].replace("%value%",A[A.length-1]);He?.getAttribute("id")==="selected_image_form_title"||He?.getAttribute("id")==="selected_image_form_alt"||He?.getAttribute("id")==="selected_image_form_link"||He?.getAttribute("id")==="selected_image_form_imgReplacer"?ze(ke,He?.getAttribute("id")):(l.setFieldValue("imgReplacer",ke),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:ke}}))}},ee=(A,Ne)=>Ne.some(xe=>xe.label.toLowerCase().indexOf(A.toLowerCase())>-1),k=(A,Ne)=>{const xe=Ne.map((ke,Me)=>{const Xe=ke.label.split(new RegExp(`(${A})`,"gi"));return(0,o.jsxs)("span",{children:[Me!==0&&(0,o.jsx)("span",{children:" / "}),Xe.map((eo,go)=>eo.toLowerCase()===A.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:eo},go):eo)]},ke.value)});return(0,o.jsx)("div",{title:Ne.map(ke=>ke.label).join(" / "),children:xe})},ne=r.useRootElement();(0,a.useEffect)(()=>{const A=({target:ke})=>{ke.closest('[id="merge_tags_wrapper"]')||(ro.current=ke,Je(ke))},Ne=({target:ke})=>{!ke.closest(".merge-tags")&&!ke.closest("#merge_tags_button")&&Le(!1)},xe=new To.Disposable;return xe.addDisposable(r.addWindowListenerFromShadow(ne,"focusin",A)),xe.addDisposable(r.addWindowListenerFromShadow(ne,"click",Ne)),()=>{xe.dispose()}},[ne]);const ve=({target:A})=>{if(A&&!O){const{selectionStart:Ne,selectionEnd:xe}=A;so({start:Ne,end:xe})}ae(!1)},qe=e.border,Fe=e.mobileBorder,Eo=Object.keys(qe).find(A=>qe[A]?.width||qe[A]?.style||qe[A]?.color),Mo=Object.keys(Fe).find(A=>Fe[A]?.width||Fe[A]?.style||Fe[A]?.color),ho=A=>A&&(A?.width||A?.style||A?.color)?A:"",{remember:$a,fillFields:Fa}=st(e),{remember:Ma,isOwnEcho:Da,forget:Va}=Or(Bn,{ordered:!0}),Ha=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{if(e){const A=e.path;A!==Ha.current&&(Ha.current=A,Va());const Ne=Da(e)?()=>{}:Fa;e.src!==We.current&&(We.current=e.src,Ae.current=!1);const xe=e.boxShadow;if(Be(xe),e.link&&$e(vt(e.link,"https://")),Ne(l,{...e,link:e.link==null?"https://":e.link,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:ho(e.mobileBorder.all)||!(ho(e.mobileBorder.top)||ho(e.mobileBorder.bottom)||ho(e.mobileBorder.right)||ho(e.mobileBorder.left))&&ho(e.border.all),mobileBorderTop:ho(e.mobileBorder.top)||!ho(e.mobileBorder.all)&&ho(e.border.top),mobileBorderBottom:ho(e.mobileBorder.bottom)||!ho(e.mobileBorder.all)&&ho(e.border.bottom),mobileBorderRight:ho(e.mobileBorder.right)||!ho(e.mobileBorder.all)&&ho(e.border.right),mobileBorderLeft:ho(e.mobileBorder.left)||!ho(e.mobileBorder.all)&&ho(e.border.left),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:bo(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:bo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:bo(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:bo(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius.all)||u(e.borderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color||e.boxShadow?.color),mobileAlign:u(e.mobileAlign?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),show:e.show?e.show:"all",altSrc:e.src,video:{source:"",playButton:"youtube_red",...Ve.video}}),e.countdown){let Xe=new URL("https://emailmaker.ru/?"+e.countdown),eo=Xe.searchParams.get("font1"),go=!1,fo=!1;eo.endsWith("-b")?(eo=eo.substring(0,eo.length-2),go=!0):eo.endsWith("-i")?(eo=eo.substring(0,eo.length-2),fo=!0):eo.endsWith("-bi")&&(eo=eo.substring(0,eo.length-3),go=!0,fo=!0);let io=Xe.searchParams.get("font2"),mo=!1,So=!1;io.endsWith("-b")?(io=io.substring(0,io.length-2),mo=!0):io.endsWith("-i")?(io=io.substring(0,io.length-2),So=!0):io.endsWith("-bi")&&(io=io.substring(0,io.length-3),mo=!0,So=!0),Ne(l,{countdownTime:(0,rt.default)(new Date(Date.parse(Xe.searchParams.get("time"))+Xe.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:Xe.searchParams.get("frames")||20,countdownTimeZone:Xe.searchParams.get("timezone"),countdownLanguage:Xe.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+Xe.searchParams.get("bg"),countdownTransparency:Xe.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:eo,countdownNumbersFontSize:Xe.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+Xe.searchParams.get("color1"),countdownLabelsFont:io,countdownLabelsFontSize:Xe.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+Xe.searchParams.get("color2"),countdownNumbersStrong:go,countdownNumbersItalic:fo,countdownLabelsStrong:mo,countdownLabelsItalic:So})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?he(!1):he(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?pe(!1):pe(!0);const ke=s.isStaleBorderSnapshot(e,!!Eo),Me=n.isStaleBorderSnapshot(e,!!Mo);ke&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Me||ke&&!Mo)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),q(Xe=>Eo&&!ke?!0:Xe),V(Xe=>Eo&&!ke||Mo&&!Me?!0:Xe),Y(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),oe(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Te(!!e.boxShadow),te(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ie(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?Oe(e.link):Oe(Ae.current?"...":""),ge(e.alt),Q(e.title),y(e.imgReplacer?.length)}},[l,e,Fa,Da,Va,Ve,Eo,Mo,s,n]),(0,a.useEffect)(()=>{if(ko)return;const A=uo.current;uo.current=null,!(!A||!A.element.isConnected||A.element.disabled)&&ro.current===A.element&&(A.element.focus(),A.element.setSelectionRange(A.start,A.end))},[ko]);const xr=async(A,Ne,xe)=>{const ke={};ke.user_id=E.id,ke.folder=A,Ne&&(Ne=await r.prepareImageForEditorUpload(Ne,c),ke.file=Ne),xe&&(ke.page_url=xe);const Me=await j(ke);if(Me.error)g.fromError("IMAGE_UPLOAD_ERROR",Ne,Me.error,!0);else{const Xe=Qa.extractUploadResult(Me.data);if(Xe.error)return;if(Xe.file_url)return Xe.file_url}},Ua=(A,Ne)=>new Promise((xe,ke)=>{const Me=new Image,Xe=new Image;Me.crossOrigin="Anonymous",Xe.crossOrigin="Anonymous";let eo=Ne?2:1;const go=()=>{clearTimeout(io),ke(new Error("video preview images are not loaded"))},fo=()=>{eo-=1,eo===0&&(clearTimeout(io),xe({frame:Me,button:Ne?Xe:null}))},io=setTimeout(go,kn);Me.onload=fo,Me.onerror=go,Me.src=A,Ne&&(Xe.onload=fo,Xe.onerror=go,Xe.src=Ne)}),za=(A,Ne,xe,ke)=>{const Me=document.createElement("canvas"),Xe=Me.getContext("2d");if(Me.width=A.width,Me.height=A.height,Xe.clearRect(0,0,Me.width,Me.height),Xe.drawImage(A,0,0,A.width,A.height),!Ne)return Me;const eo=Math.min(Me.width,Me.height);let go;if(A.height>A.width)go=.3;else{const ut=A.width/A.height;go=Math.min(ke,.3+(ut-1)/(xe-1)*.1)}const fo=eo*go,io=Ne.width/Ne.height;let mo,So;io>=1?(mo=fo,So=fo/io):(So=fo,mo=fo*io);const wo=(Me.width-mo)/2,Yo=(Me.height-So)/2;return Xe.drawImage(Ne,wo,Yo,mo,So),Me},Wa=A=>new Promise(Ne=>{A.toBlob(xe=>Ne(xe?new File([xe],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),Dm=async A=>{const Ne=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!A||!Ne||Ne==="none"||ue)){F(),Ie(!0);try{const{frame:xe,button:ke}=await Ua(A,`${$r}${Ne}.png`),Me=await Wa(za(xe,ke,2,.4)),Xe=Me&&await xr(p,Me);if(!Xe)return;b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ge.current.type,settings:{src:Xe}}),Rt({...Ge.current,src:Xe,video:de()||Ge.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{l.setFieldValue("src",Xe)},100)}catch{}finally{Ie(!1)}}},Vm=async()=>{const A=de(),Ne=A?.source,xe=A?.playButton;if(!Ne)return;const ke=()=>de()?.source!==Ne;F(),Qe(!0);try{const Me=await xr("tmp",null,Ne);if(!Me||ke())return;const{frame:Xe,button:eo}=await Ua(Me,xe&&xe!=="none"?`${$r}${xe}.png`:null);if(ke())return;const go=await Wa(za(Xe,eo,2.5,.35)),fo=go&&await xr(p,go);fo&&!ke()&&Er(fo)}catch{}finally{Qe(!1)}},kr=A=>{clearTimeout(co.current),co.current=setTimeout(()=>{A()},xn)},Hm=()=>{const A=l.getFieldsValue(!0);let Ne=new URL("https://cdt3.emcdn.ru/rndt?"+e.countdown),xe=A.countdownNumbersFont;A.countdownNumbersStrong&&A.countdownNumbersItalic?xe+="-bi":A.countdownNumbersStrong?xe+="-b":A.countdownNumbersItalic&&(xe+="-i");let ke=A.countdownLabelsFont;A.countdownLabelsStrong&&A.countdownLabelsItalic?ke+="-bi":A.countdownLabelsStrong?ke+="-b":A.countdownLabelsItalic&&(ke+="-i"),Ne.searchParams.set("time",new Date(A.countdownTime.$d-A.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Ne.searchParams.set("bg",A.countdownBackgroundColor.substring(1)||"#FFFFFF"),Ne.searchParams.set("tp",!!A.countdownTransparency),Ne.searchParams.set("font1",xe),Ne.searchParams.set("size1",A.countdownNumbersFontSize*2||12),Ne.searchParams.set("color1",A.countdownNumbersColor.substring(1)||"#000000"),Ne.searchParams.set("font2",ke),Ne.searchParams.set("size2",A.countdownLabelsFontSize*2||8),Ne.searchParams.set("color2",A.countdownLabelsColor.substring(1)||"#959595"),Ne.searchParams.set("spacing",Math.round(A.countdownNumbersFontSize*.4)||5),Ne.searchParams.set("locale",A.countdownLanguage.replace("_","-")),Ne.searchParams.set("timezone",A.countdownTimeZone),Ne.searchParams.set("frames",A.countdownDuration),N({link:JSON.stringify({target:Ne.href})}),F(),W(!0)},Rt=(0,a.useCallback)(A=>{$a(A),Ma(A),d(we==="email"?r.setElementSettings$1(A):r.setElementSettings(A))},[d,we,$a,Ma]),Er=(0,a.useCallback)((A,Ne)=>{const xe=Ge.current,ke=r.stripEmVersionFromUrlString(xe.src||"")===r.stripEmVersionFromUrlString(A||"");(!ke||A!==xe.src)&&(b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:xe.type,settings:{src:A}}),Rt({...xe,src:A,...xe.type==="video"?{video:de()||xe.video}:{},activateSection:null,changeKey:"src"}),l.setFieldValue("src",A)),Ne?.mode==="save"&&ke&&($(Me=>({name:"src",counter:Me.counter+1})),_(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(A)}))},[l,de,Rt,b,_]),yt=(0,a.useCallback)(async A=>{const Ne=e.src||"",xe=r.stripEmVersionFromUrlString(Ne),ke=await h({kind:"img",currentUrl:mt(xe)?"":xe,entryModal:A});ke?.url&&Er(ke.url,ke.meta)},[Er,e.src,h]),Br=(A,...Ne)=>{const xe=l.getFieldsValue(!0),ke=Object.keys(A)[0];let Me;switch(ke){case"link":let Xe=Qo(A[ke]);Xe!==A[ke]&&l.setFieldValue("link",Xe),Me={link:Xe};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Me={boxShadow:{hOffset:xe.boxShadowHOffset,vOffset:xe.boxShadowVOffset,blurRadius:xe.boxShadowBlurRadius,spreadRadius:xe.boxShadowSpreadRadius,color:xe.boxShadowColor,inset:xe.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":xe.borderPosition==="borderAll"?(Me={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...xe.borderAll}}},l.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):xe.borderAll?.width||xe.borderAll?.style||xe.borderAll?.color?(Me={border:{all:null,left:xe.borderAll,right:xe.borderAll,top:xe.borderAll,bottom:xe.borderAll,[H.REVERSE_BORDER_POSITIONS[ke]]:{...xe[ke],...A[ke]}}},l.setFieldsValue({borderAll:null,borderLeft:xe.borderAll,borderRight:xe.borderAll,borderTop:xe.borderAll,borderBottom:xe.borderAll,[ke]:{...xe[ke],...A[ke]}})):(Me={border:{all:null,left:xe.borderLeft,right:xe.borderRight,top:xe.borderTop,bottom:xe.borderBottom,[H.REVERSE_BORDER_POSITIONS[ke]]:{...xe[ke],...A[ke]}}},l.setFieldsValue({border:Me.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(xe.mobileBorderPosition==="mobileBorderAll")Me={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...xe.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[ke]+"-"}}},l.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const io=H.MOBILE_REVERSE_BORDER_POSITIONS[ke],mo={...xe[ke],...A[ke]},So=!mo?.width&&!mo?.style&&!mo?.color;if(xe.mobileBorder?.all?.width||xe.mobileBorder?.all?.style||xe.mobileBorder?.all?.color){const wo=xe.mobileBorderAll;Me={mobileBorder:{all:null,left:wo,right:wo,top:wo,bottom:wo,[io]:So?null:{...mo,classNamePrefix:"em-mob-border_"+io+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:wo,mobileBorderRight:wo,mobileBorderTop:wo,mobileBorderBottom:wo,[ke]:mo})}else{const wo=e.mobileBorder||{},Yo=ut=>{const wt=wo[ut];return wt&&(wt?.width||wt?.style||wt?.color)?wt:null};Me={mobileBorder:{all:null,left:io==="left"?So?null:{...mo,classNamePrefix:"em-mob-border_left-"}:Yo("left"),right:io==="right"?So?null:{...mo,classNamePrefix:"em-mob-border_right-"}:Yo("right"),top:io==="top"?So?null:{...mo,classNamePrefix:"em-mob-border_top-"}:Yo("top"),bottom:io==="bottom"?So?null:{...mo,classNamePrefix:"em-mob-border_bottom-"}:Yo("bottom")}},l.setFieldsValue({[ke]:mo})}}break;case"width":Me={[ke]:{value:A[ke],dim:xe.widthDim}};break;case"widthDim":Me={width:{value:xe.width,dim:A[ke]}};break;case"height":Me={[ke]:{value:A[ke],dim:xe.heightDim}};break;case"heightDim":Me={height:{value:xe.height,dim:A[ke]}};break;case"borderRadiusAll":Me={borderRadius:{[H.BORDER_RADIUS_POSITION[ke]]:+A[ke]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Me={borderRadius:{topLeft:xe.borderRadiusTopLeft,bottomLeft:xe.borderRadiusBottomLeft,topRight:xe.borderRadiusTopRight,bottomRight:xe.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[ke]]:+A[ke]}};break;case"mobileWidth":Me={[ke]:{classNamePrefix:"em-mob-width-",value:A[ke],dim:xe.mobileWidthDim}};break;case"mobileWidthDim":Me={mobileWidth:{classNamePrefix:"em-mob-width-",value:xe.mobileWidth||100,dim:A[ke]}};break;case"mobileHeight":Me={[ke]:{classNamePrefix:"em-mob-height-",value:A[ke],dim:xe.mobileHeightDim}};break;case"mobileHeightDim":Me={mobileHeight:{classNamePrefix:"em-mob-height-",value:xe.mobileHeight,dim:A[ke]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Me={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[ke]]:A[ke],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[ke]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Me={mobileBoxShadow:{hOffset:xe.mobileBoxShadowHOffset,vOffset:xe.mobileBoxShadowVOffset,blurRadius:xe.mobileBoxShadowBlurRadius,spreadRadius:xe.mobileBoxShadowSpreadRadius,color:xe.mobileBoxShadowColor,inset:xe.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Me={[ke]:{classNamePrefix:"em-mob-text_align-",value:A[ke]}};break;case"mobileVerticalAlign":Me={[ke]:{classNamePrefix:"em-mob-vertical_align-",value:A[ke]}};break;case"countdownTime":case"countdownTimeZone":case"countdownBackgroundColor":case"countdownNumbersFont":case"countdownNumbersFontSize":case"countdownNumbersColor":case"countdownLabelsFont":case"countdownLabelsFontSize":case"countdownLabelsColor":case"countdownLanguage":case"countdownDuration":case"countdownTransparency":case"countdownNumbersStrong":case"countdownNumbersItalic":case"countdownLabelsStrong":case"countdownLabelsItalic":kr(Hm);break;case"video":{const io={...e.video,...xe.video,...A.video},mo=io.source??xe.link;kr(Vm),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:io,link:mo}}),Rt({...e,video:io,link:mo,activateSection:null,changeKey:"video"});break}case"src":const eo=A[ke],go=e.src,fo=xe.video?.playButton||e.video?.playButton;if(e.type==="video"&&fo&&fo!=="none"&&!ue&&eo&&(!go||eo!==go)){kr(()=>Dm(eo));return}Me=A;break;default:Me=A}ke!=="borderPosition"&&ke!=="mobileBorderPosition"&&ke.indexOf("countdown")===-1&&ke!=="video"&&(b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Me}),ke!=="video"&&ke.indexOf("countdown")===-1&&ke!=="mobileBorderRadiusAll"&&ke!=="mobileBorderRadiusTopLeft"&&ke!=="mobileBorderRadiusTopRight"&&ke!=="mobileBorderRadiusBottomLeft"&&ke!=="mobileBorderRadiusBottomRight"&&Rt({...e,...Me,mobileBorderRadius:{...e.mobileBorderRadius,...Me?.mobileBorderRadius},activateSection:null,changeKey:ke}))};(0,a.useEffect)(()=>{B.isError&&(g.error(B),W(!1))},[B]),(0,a.useEffect)(()=>{if(B.isSuccess&&ye){if(B.data.data?.status===400)g.error({title:B.data.code,description:B.data.message});else{let A=new URL(B.data.target),Ne={countdown:{link:B.data.link,params:A.search.substring(1)}};b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ne})}W(!1)}},[B,ye,e,g,b]);const Um=A=>{A.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(Um),r.useImageControlRequest(e.src,A=>{A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?yt(r.MODALS.UPLOAD_IMAGE_MODAL_AI):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?yt(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?yt(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?yt(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&yt(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const zm=()=>{const A=l.getFieldsValue(!0);s.markBorderToggled(!K),setTimeout(()=>{q(Ne=>!Ne),K?(A.borderAll=H.NULL_BORDER,A.borderTop=H.NULL_BORDER,A.borderBottom=H.NULL_BORDER,A.borderRight=H.NULL_BORDER,A.borderLeft=H.NULL_BORDER):A.borderAll={width:1,color:"#E5E5E5",style:"solid"},b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:A.borderAll.color,style:A.borderAll.style,width:A.borderAll.width}}}})})},Wm=()=>{const A=l.getFieldsValue(!0);n.markBorderToggled(!Z),setTimeout(()=>{V(Ne=>!Ne),Z?(A.mobileBorderAll=H.NULL_BORDER,A.mobileBorderTop=H.NULL_BORDER,A.mobileBorderBottom=H.NULL_BORDER,A.mobileBorderRight=H.NULL_BORDER,A.mobileBorderLeft=H.NULL_BORDER):A.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:A.mobileBorderAll.color,style:A.mobileBorderAll.style,width:A.mobileBorderAll.width}}}})})},Gm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{Y(Ne=>!Ne),M?(A.borderRadiusAll=0,he(!0)):A.borderRadiusAll=5,b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:A.borderRadiusAll}}})})},Ym=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{oe(Ne=>!Ne),X?(A.mobileBorderRadiusAll=null,pe(!0)):A.mobileBorderRadiusAll=5,b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:A.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Xm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{Te(Ne=>!Ne),me?(A.boxShadowInset=!1,A.boxShadowHOffset=null,A.boxShadowVOffset=null,A.boxShadowBlurRadius=null,A.boxShadowSpreadRadius=null,A.boxShadowColor=""):(A.boxShadowInset=!1,A.boxShadowHOffset=5,A.boxShadowVOffset=5,A.boxShadowBlurRadius=10,A.boxShadowSpreadRadius=-5,A.boxShadowColor="#000000"),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:A.boxShadowBlurRadius,color:A.boxShadowColor,hOffset:A.boxShadowHOffset,inset:A.boxShadowInset,spreadRadius:A.boxShadowSpreadRadius,vOffset:A.boxShadowVOffset}}})})},Km=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{te(Ne=>!Ne),Se?(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=null,A.mobileBoxShadowVOffset=null,A.mobileBoxShadowBlurRadius=null,A.mobileBoxShadowSpreadRadius=null,A.mobileBoxShadowColor=""):(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=5,A.mobileBoxShadowVOffset=5,A.mobileBoxShadowBlurRadius=10,A.mobileBoxShadowSpreadRadius=-5,A.mobileBoxShadowColor="#000000"),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:A.mobileBoxShadowBlurRadius,color:A.mobileBoxShadowColor,hOffset:A.mobileBoxShadowHOffset,inset:A.mobileBoxShadowInset,spreadRadius:A.mobileBoxShadowSpreadRadius,vOffset:A.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},qm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{ie(Ne=>!Ne),D&&(A.mobileWidth="",A.mobileHeight="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},Ga=()=>{De?(Ae.current=!1,Oe(""),l.setFieldValue("link",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Ae.current=!0,Oe(U.current&&U.current.input.value?U.current.input.value:"..."),setTimeout(()=>{U.current.focus()}))},Ya=A=>{A.target.value===""?Oe("..."):(I.current.classList.add("selected-td-form__button--active"),Oe(A.target.value)),Vo(A.target.value,$e)},Xa=()=>{const A=l.getFieldsValue(!0);Ce?(ge(""),A.alt="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(ge(L.current&&L.current.input.value?L.current.input.value:"..."),setTimeout(()=>{L.current.focus()}))},Ka=A=>{A.target.value===""?ge("..."):(P.current.classList.add("selected-td-form__button--active"),ge(A.target.value))},qa=()=>{const A=l.getFieldsValue(!0);_e?(Q(""),A.title="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(Q(z.current&&z.current.input.value?z.current.input.value:"..."),setTimeout(()=>{z.current.focus()}))},Jm=()=>{y(!w),w?(l.setFieldValue("imgReplacer",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>C.current.focus())},Qm=A=>{A.target.value!==""&&re.current.classList.add("selected-td-form__button--active")},Ja=A=>{A.target.value===""?Q("..."):(le.current.classList.add("selected-td-form__button--active"),Q(A.target.value))},Zm=A=>{l.setFieldValue("link",A!=="mergetag"?A:""),$e(A)};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[Eo]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[Mo]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"left",mobileVerticalAlign:"",link:"https://",imgReplacer:"",countdownNumbersStrong:!1,countdownNumbersItalic:!1,countdownLabelsStrong:!1,countdownLabelsItalic:!1,video:{source:"",playButton:"youtube_red"}},onValuesChange:Br,autoComplete:"off",disabled:ko,className:ko?"element-controls selected-image-form_busy":"element-controls",children:[ko&&(0,o.jsx)("div",{className:"selected-image-form__loader",ref:Bo,children:(0,o.jsxs)("div",{className:"selected-image-form__loader-body",children:[(0,o.jsx)(t.ui_kit$Spin,{size:"large"}),(0,o.jsx)("div",{className:"selected-image-form__loader-title",children:Ve.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!J&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),m==="mobile"&&T.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Nr,{form:l,elementSettings:e,handleChangeValues:Br,boxShadow:fe,mobileBordersShow:Z,mobileBorderRadiusShow:X,mobileBoxShadowShow:Se,mobileSizeShow:D,oneMobileBorderRadiusValue:Pe,setOneMobileBorderRadiusValue:pe,hasLink:De,hasAlt:Ce,hasTitle:_e,linkInputRef:U,linkButtonRef:I,altInputRef:L,altButtonRef:P,titleInputRef:z,titleButtonRef:le,linkInputHandler:Ya,altButtonHandler:Xa,altInputHandler:Ka,titleButtonHandler:qa,titleInputHandler:Ja,linkButtonHandler:Ga,toggleShowMobileBorderHandler:Wm,toggleShowMobileBorderRadiusHandler:Ym,toggleShowMobileBoxShadowHandler:Km,toggleShowMobileSizeHandler:qm})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Ar,{form:l,elementSettings:e,boxShadow:fe,bordersShow:K,borderRadiusShow:M,boxShadowShow:me,oneBorderRadiusValue:se,setOneBorderRadiusValue:he,hasLink:De,hasAlt:Ce,hasTitle:_e,isOpenSrcReplacer:w,mergeTagItems:je,mergeMenuOpen:be,setMergeMenuOpen:Le,cascaderRef:ce,linkInputRef:U,linkButtonRef:I,altInputRef:L,altButtonRef:P,titleInputRef:z,titleButtonRef:le,srcReplacerInputRef:C,srcReplacerButtonRef:re,linkProtocol:Re,handleLinkProtocolsChange:Zm,linkButtonHandler:Ga,linkInputHandler:Ya,altButtonHandler:Xa,altInputHandler:Ka,titleButtonHandler:qa,titleInputHandler:Ja,srcReplacerButtonHandler:Jm,srcInputHandler:Qm,handleSelect:ve,onChange:S,filter:ee,renderSearchOption:k,handleChangeValues:Br,toggleShowBorderHandler:zm,toggleShowBorderRadiusHandler:Gm,toggleShowBoxShadowHandler:Xm})})]})};Fr.propTypes={elementSettings:f.default.object.isRequired};var Mr=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})},et=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",setAlignStateHandle:n=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),p=r.useSendPostMessage(),g=r.useAppConfig(),[b,_]=(0,a.useState)(null);(0,a.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&_(!0)},[]);const h=j=>{n(j),e.setFieldsValue({[s]:j}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[s]:j}})},m=d?{alignLeft:c("Text align left ( ⌘+Shift+L )"),alignCenter:c("Text align center ( ⌘+Shift+E )"),alignRight:c("Text align right ( ⌘+Shift+R )"),alignJustify:c("Text align justify ( ⌘+Shift+J )")}:void 0,T=d?{alignLeft:c("Text align left ( Ctrl+Shift+L )"),alignCenter:c("Text align center ( Ctrl+Shift+E )"),alignRight:c("Text align right ( Ctrl+Shift+R )"),alignJustify:c("Text align justify ( Ctrl+Shift+J )")}:void 0,E=d?b?m:T:void 0,x=i[s],R=typeof x=="string"?x:"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:s,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{value:R,onChange:h,disabled:l&&!i.parent,strokeWidth:g?.iconStrokeWidth,labels:E})})},to=({form:e,elementSettings:i,name:l,icon:s,tooltipTitle:n=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:p}=r.useI18n(),g=e.getFieldValue(l),b=r.useSendPostMessage(),[_,h]=(0,a.useState)(i[l]);(0,a.useEffect)(()=>{i[l]!==e.getFieldValue(l)&&(e.setFieldValue(l,i[l]),h(i[l]))},[i,e,l]),(0,a.useEffect)(()=>{_!==g&&h(g)},[g,_,l]);const m=()=>{const T={[l]:!_};e.setFieldValue(l,!_),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:T}),l==="textSuperscript"?e.setFieldValue("textSubscript",!1):l==="textSubscript"&&e.setFieldValue("textSuperscript",!1),h(E=>!E)};return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:d?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:n||p(l.substring(4)),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_&&!c}),onClick:m,children:s})}):(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_&&!c}),onClick:m,children:s})})};to.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string,imgParent:f.default.bool};var Sn=["email","block"];function Tn(e){const i=r.getMessageService(e).getTarget(),l=r.getCanvasService(e);Sn.map(s=>l?.peek(s)?.element).find(s=>!!i&&s?.contentWindow===i)?.focus({preventScroll:!0})}var Dr=()=>{const{__:e}=r.useI18n();return[{symbol:"•",code:"&bull;",description:e("Bullet")},{symbol:"+",code:"&plus;",description:e("Plus")},{symbol:"»",code:"&raquo;",description:e("Double quotation")},{symbol:"×",code:"&times;",description:e("Cross")},{symbol:"–",code:"&mdash;",description:e("Dash")},{symbol:"›",code:"&rsaquo;",description:e("Single quotation")},{symbol:"→",code:"&rarr;",description:e("Arrow")},{symbol:"⇒",code:"&rArr;",description:e("Double arrow")},{symbol:"►",code:"&blacktriangleright;",description:e("Pointer")},{symbol:"−",code:"&minus;",description:e("Minus")},{symbol:"∗",code:"&lowast;",description:e("Star")},{symbol:"♦",code:"&diams;",description:e("Diamond")}]},Rn=(e,i="#c6c3c3",l={},s)=>{const{symbolSize:n="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:p={whiteSpace:"normal",lineHeight:"1.2"}}=l;return e.map(g=>({value:g.code,label:(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("span",{style:{color:i||"#c6c3c3",marginRight:d,marginBottom:c,fontSize:n,lineHeight:"0.7",width:n,textAlign:"center",...p},children:g.symbol}),(0,o.jsx)("span",{style:p,children:g.description})]})}))},pt=({form:e,fillFields:i,elementSettings:l,showAddParagraph:s=!0,isButton:n=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:p,isBulletFontColorChecked:g=!1,setIsBulletFontColorChecked:b=()=>{},showTopDivider:_=!0})=>{const{__:h}=r.useI18n(),m=H.useGoogleFontsLoader(),{token:T}=(0,t.ui_kit$useToken)(),E=r.useNotification(),x=r.useSendPostMessage(),R=r.useContainer(),j=r.useAppConfig(),N=(0,a.useRef)(),B=(0,a.useRef)(null),v=(0,a.useRef)(null),$=(0,a.useRef)(null),U=(0,a.useRef)(!1),I=l,[L,P]=(0,a.useState)(!!I.textReplacer?.length),[z,le]=(0,a.useState)(!!I.textAnchor?.length),[C,re]=(0,a.useState)(null),[ce,fe]=(0,a.useState)({start:0,end:0}),[Be,se]=(0,a.useState)(!1),[he,Pe]=(0,a.useState)([]),[pe,De]=(0,a.useState)(I.list?.bulletsColor),[Oe,Ce]=(0,a.useState)(l);l!==Oe&&(Ce(l),De(I.list?.bulletsColor),P(!!I.textReplacer?.length),le(!!I.textAnchor?.length));const[ge,_e]=(0,a.useState)(!1),[Q,K]=(0,a.useState)(!1),q=(0,a.useRef)(null),Z=(0,a.useRef)(""),V=Dr(),M=(0,a.useMemo)(()=>V,[]),Y={textColor:t.ui_kit$Form.useWatch("textColor",e),textLink:t.ui_kit$Form.useWatch("textLink",e),linkHref:t.ui_kit$Form.useWatch("linkHref",e),listUL:t.ui_kit$Form.useWatch("listUL",e),listOL:t.ui_kit$Form.useWatch("listOL",e)};(0,a.useEffect)(()=>{n&&l?.textColor!==void 0&&e.setFieldValue("textColor",l.textColor)},[n,l?.textColor,e]);let X=null;(0,a.useEffect)(()=>{if(Y?.textColor&&g){const y=e.getFieldValue("textColor");x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{ColorBullets:y}})}},[Y?.textColor]),(0,a.useEffect)(()=>{const y=e.getFieldValue("textLink");typeof l.linkHref=="string"&&_e(!0),q&&!y&&(_e(!1),e.setFieldsValue({linkHref:null})),q.current=y||null},[Y?.textLink,Y?.linkHref,l.linkHref,e]),(0,a.useEffect)(()=>{const y=e.getFieldValue("listUL"),ue=e.getFieldValue("listOL");y&&Z.current!=="listUL"?(e.setFieldValue("listOL",!1),Z.current="listUL"):ue&&Z.current!=="listOL"&&(e.setFieldValue("listUL",!1),Z.current="listOL"),!y&&!ue&&(Z.current="")},[Y?.listUL,Y?.listOL,e]);const oe=y=>{y.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&re(null)};r.useListenPostMessage(oe);const[me,Te]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Te(!0)},[]);const Se=(0,a.useRef)(null);function te(y){const ue=y.key.toLowerCase();let Ie=!1;return((X==="control"||X==="meta")&&(ue==="a"||ue==="A")||(X==="a"||X==="A")&&(ue==="control"||ue==="meta"))&&(Ie=!0),X=ue,ue!=="control"&&ue!=="a"&&ue!=="A"&&ue!=="meta"&&(X=null),Ie}const D=y=>{x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:y,locale:"ru_RU"}),E.success({title:h("It`s done!")})},ie=[{key:"1",label:h("This element"),onClick:()=>D("typograf")},{key:"2",label:h("The whole email"),onClick:()=>D("typograf_all")}],[ye,W]=(0,a.useState)(),[Re,$e]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const y=Rn(M,pe,{});Pe(y)},[M,pe]),(0,a.useEffect)(()=>{const y=l.linkHref||l.href;y&&Vo(y,c);const ue=l.linkHref||l.href,Ie=ue&&xi(ue)?ue.slice(1):ue||"https://";(i??((Ye,Qe)=>Ye.setFieldsValue(Qe)))(e,{linkHref:Ie})},[e,l,c,i]);const Ae=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{Ae?.items?.length&&W(r.mapMargeTags(Ae.items))},[Ae,W]);const We=y=>{e.setFieldValue("linkHref",y!=="mergetag"?y:""),c(y)},Ve=(y,ue)=>{if($e(!1),y){const Ie=Ae.syntax.length>1?ye.findIndex(Qe=>Qe.key===ue[0].key):0,Ye=Ae.syntax[Ie].replace("%value%",y[y.length-1]);if(C?.getAttribute("id")==="selected_button_form_href"||C?.getAttribute("id")==="selected_text_form_linkHref"||C?.getAttribute("id")==="selected_text_form_textReplacer")Le(Ye,C?.getAttribute("id"));else{e.setFieldValue("textReplacer",Ye);const Qe=Date.now();x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${Ye}~~${Qe}`}}),R&&setTimeout(()=>Tn(R))}}},Ge=(y,ue)=>ue.some(Ie=>Ie.label.toLowerCase().indexOf(y.toLowerCase())>-1),de=(y,ue)=>{const Ie=ue.map((Ye,Qe)=>{const co=Ye.label.split(new RegExp(`(${y})`,"gi"));return(0,o.jsxs)("span",{children:[Qe!==0&&(0,o.jsx)("span",{children:" / "}),co.map((ro,uo)=>ro.toLowerCase()===y.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:ro},uo):ro)]},Ye.value)});return(0,o.jsx)("div",{title:ue.map(Ye=>Ye.label).join(" / "),children:Ie})};(0,a.useEffect)(()=>{Re&&Se.current&&Se.current.focus()},[Re]);const je=r.useRootElement();(0,a.useEffect)(()=>{const y=({target:Ye})=>{Ye.closest('[id="merge_tags_wrapper"]')||re(Ye)},ue=({target:Ye})=>{!Ye.closest(".merge-tags")&&!Ye.closest("#merge_tags_button")&&$e(!1)},Ie=new To.Disposable;return Ie.addDisposable(r.addWindowListenerFromShadow(je,"focusin",y)),Ie.addDisposable(r.addWindowListenerFromShadow(je,"click",ue)),()=>{Ie.dispose()}},[je]);const G=(0,a.useCallback)(()=>{const y=window.getSelection();y&&y.toString().length>0&&(U.current=!0)},[]),be=(0,a.useCallback)(({target:y})=>{if(y&&!Be){const{selectionStart:ue,selectionEnd:Ie}=y;fe(Ye=>Ye?.start===ue&&Ye?.end===Ie?Ye:{start:ue,end:Ie})}se(!1)},[Be]);(0,a.useEffect)(()=>be({target:p?.target}),[p,be]);const Le=(y,ue)=>{const Ie=document.getElementById(ue);if(Ie){const Ye=Ie.value?.substring(0,ce.start),Qe=Ie.value?.substring(ce.end),co=ue.substring(ue.lastIndexOf("_")+1);x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[co]:Ye+y+Qe}}),e.setFieldValue(co,Ye+y+Qe),Ie.focus(),setTimeout(()=>{Ie.selectionStart=ce.start,Ie.selectionEnd=ce.start+y.length},400),se(!0)}},He=()=>{P(!L),L?(e.setFieldValue("textReplacer",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:""}})):setTimeout(()=>B.current.focus())},Je=y=>{y.target.value!==""&&v.current?.classList.add("selected-td-form__button--active")},Ze=(y="unknown")=>{le(!z),z?(e.setFieldValue("textAnchor",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textAnchor:""}})):setTimeout(()=>$.current?.focus())},so=y=>{const ue=y.target,Ie=ue.value,Ye=ue.selectionStart,Qe=te(y);if(U.current&&Ye===0&&x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${Ie}~`}}),U.current=Qe,Ye===0&&y.key===" "){y.preventDefault();return}if(y.key===" "){if(Ye!==Ie.length){y.preventDefault();return}Ie.endsWith(" ")&&y.preventDefault()}},O=y=>{De(y),g&&b(!1)},ae=n?j.formButtonFieldInsertImageEnabled:j.formTextFieldTypografEnabled,w=j.formTextFieldTypografEnabled&&!n;return(0,o.jsxs)(o.Fragment,{children:[s&&!l.showOnMobile&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,gutter:20,children:(0,o.jsx)(et,{form:e,elementSettings:l,name:"textAlign"})})})}),ae||w||j.mergeTagsShow&&ye?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:_,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[ae&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Col,{span:w?12:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:T.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>D("add_img"),style:{width:"100%"},children:h("Add image")})})})}),w&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:T.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:ie},trigger:["hover"],placement:"bottom",getPopupContainer:y=>y.closest(".selected-element-panel"),children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:()=>D("typograf"),style:{width:"100%"},children:h("Typography")})})})})}),j.mergeTagsShow&&ye&&(0,o.jsxs)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:T.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:Re?"none":"inline-flex"},onClick:()=>$e(!0),children:h("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:Se,classNames:{popup:{root:"merge-tags"}},options:ye,placeholder:h("Start typing the title"),showSearch:{filter:Ge,render:de},spellCheck:"false",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),onChange:Ve,style:{display:Re?"block":"none",width:"100%"},open:Re,onKeyDown:y=>{y.key==="Escape"&&$e(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:_||ae||w,bodyStyle:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text font"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:m,getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper")})})}),!l.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:h("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:h("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[n&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)("div",{className:"selected-text-common-form__format-toolbar",children:[(0,o.jsx)(to,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:h(me?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(to,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:h(me?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(to,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:h(me?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(to,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(me?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text color"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:h("Please set the font color")}],className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Color"),usedColors:l.usedColors})})})})]}),!n&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:h(me?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:h(me?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:h(me?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(to,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(me?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"listUL",tooltipTitle:h("Unordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnorderedListOutlined",component:t.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:be})}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"listOL",tooltipTitle:h("Ordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"OrderedListOutlined",component:t.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:be})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"textSuperscript",tooltipTitle:h("Text superscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Superscript",component:t.icons$Superscript})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(to,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:h("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,className:(0,Ue.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof l.linkHref=="string"}),elementSettings:l,name:"textLink",forceInactive:!!l.textAnchor,tooltipTitle:h("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:be})}),l?.list?.isList&&j.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Text replacer"),placement:"bottom",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":L}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:He,ref:v})})}),(!l?.list?.isList||s&&l?.list?.isList)&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("More options"),placement:"bottom",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":Q||z}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>K(!Q)})})})]})]}),!n&&Q&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[!l?.list?.isList&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(to,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(me?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(to,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:h("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),j.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Text replacer"),placement:"bottom",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":L}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:He,ref:v})})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Anchor"),placement:"bottom",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":z}),icon:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:y=>{y.preventDefault(),Ze("mouseDown")}})})})]}),s&&typeof l.linkHref=="string"&&ge&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Jo,{show:d==="#",__:h,style:{marginBottom:T.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h(d==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:d==="mailto:"?T.formItemMarginBottomXS:""},children:(0,o.jsx)(t.ui_kit$Input,{ref:N,addonBefore:(0,o.jsx)(qo,{linkProtocol:d,handleLinkProtocolsChange:We,__:h}),allowClear:!0,placeholder:h(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:l?.isNewLink,onSelect:be,prefix:(0,o.jsx)(Ko,{linkProtocol:d})})})}),d==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:T.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("Subject"),onSelect:be})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:T.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:h("Body"),onSelect:be})})]})]}),s&&z&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Anchor name"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textAnchor",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("Anchor name"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:h("Anchor"),"aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:$,onSelect:be,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||le(!1)}})})}),!n&&L&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:h("Text")}),onChange:Je,onKeyDown:so,onDoubleClick:G,ref:B,onSelect:be})})})]})}),!n&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text color"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:h("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Color"),usedColors:l.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text background"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:h("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Background color"),usedColors:l.usedColors})})})})]})]}),!n&&l?.list?.isList&&(0,o.jsxs)(t.ui_kit$FormSection,{title:h("List settings"),dividerTop:!0,children:[l?.list?.listType==="OL"&&(0,o.jsx)(t.ui_kit$Row,{children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:m,getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:[10],children:l?.list?.listType==="UL"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets type"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,o.jsx)(t.ui_kit$Select,{size:"medium",placeholder:h("Bullets type"),onClick:y=>y.stopPropagation(),options:he})})})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ColorBullets",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Bullets color"),usedColors:l.usedColors,disabled:g,onChange:O,externalValue:g?Y?.textColor:void 0})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:l?.list?.bulletFontSize,placeholder:h("Bullets size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),l?.list?.listType==="OL"&&(0,o.jsxs)(t.ui_kit$Row,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"BulletTextStrong",tooltipTitle:h(me?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"BulletTextItalic",tooltipTitle:h(me?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"BulletTextStrikethrough",tooltipTitle:h(me?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:l,name:"BulletTextUnderline",tooltipTitle:h(me?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Between list items"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:h("Between list items"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Between bullets and text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:h("Between bullets and text"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Si=({form:e,elementSettings:i,showAddParagraph:l=!0,isButton:s=!1})=>{const{__:n}=r.useI18n(),d=H.useGoogleFontsLoader(),c=r.useSendPostMessage(),p=r.useDispatch(),g=r.useElementEntityKind(),b=r.useAppConfig(),[_,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&h(!0)},[]);const m=N=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:N,locale:"ru_RU"})},[T,E]=(0,a.useState)(i.textAlign),[x,R]=(0,a.useState)(i.linkHref),j=N=>E(N);return(0,a.useEffect)(()=>{E(i.textAlign),R(i.linkHref)},[i]),(0,o.jsx)("div",{className:"selected_text_common_form_mobile",children:(0,o.jsxs)(t.ui_kit$Space,{size:"8",separator:(0,o.jsx)(t.ui_kit$Divider,{orientation:"vertical"}),children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)("div",{style:{width:190},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Text font"),placement:"bottom",zIndex:1,getPopupContainer:N=>N.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:N=>N.closest(".selected_text_common_form_mobile")})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:n("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:n("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(to,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:n(_?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(to,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:n(_?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(to,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:n(_?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(to,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:n(_?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-td-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Text color"),placement:"bottom",zIndex:1,getPopupContainer:N=>N.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:n("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:n("Color"),usedColors:i.usedColors,getPopupContainer:N=>N.closest(".selected_text_common_form_mobile")})})}),!s&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Text background"),placement:"bottom",zIndex:1,getPopupContainer:N=>N.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:n("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:n("Background color"),usedColors:i.usedColors})})})})]}),l&&(0,o.jsx)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:(0,o.jsxs)(o.Fragment,{children:[typeof x=="string"?(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:n("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),autoFocus:i?.isNewLink})})}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:520,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:N=>N.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)("div",{children:(0,o.jsx)(to,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:i,name:"textLink",icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),showTooltip:!1})})}):(0,o.jsx)(to,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:n("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(et,{form:e,elementSettings:i,name:"textAlign",setAlignStateHandle:j}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:615,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:N=>N.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)(t.ui_kit$Button,{icon:T==="right"?(0,o.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:t.icons$AlignRightOutlined,size:18,strokeWidth:b.iconStrokeWidth}):T==="center"?(0,o.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:t.icons$AlignCenterOutlined,size:18,strokeWidth:b.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:t.icons$AlignLeftOutlined,size:18,strokeWidth:b.iconStrokeWidth}),className:"selected-td-form__button"})})]})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[l&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Add paragraph"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Paragraph",component:t.icons$Paragraph}),onClick:()=>m("add_p"),className:"selected-td-form__button"})}),(!s||b.formButtonFieldInsertImageEnabled)&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Add inline image"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"ImageAdd",component:t.icons$ImageAdd,size:16,strokeWidth:b.iconStrokeWidth}),onClick:()=>m("add_img"),className:"selected-td-form__button"})})}),!s&&(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),className:"selected-td-form__button"}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),p(r.resetToLastActiveSettingsTab()),setTimeout(()=>{p(g==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},Ct=({elementSettings:e,imgParent:i=!1,name:l="mobileAlign"})=>{const{__:s}=r.useI18n(),n=r.useAppConfig();return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{disabled:i&&!e.parent,strokeWidth:n?.iconStrokeWidth,labels:{alignLeft:s("Text align left"),alignCenter:s("Text align center"),alignRight:s("Text align right"),alignJustify:s("Text align justify")}})})};Ct.propTypes={elementSettings:f.default.object.isRequired,imgParent:f.default.bool,name:f.default.string};var yn=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useDispatch(),s=r.useSendPostMessage(),[n]=t.ui_kit$Form.useForm(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),b=p&&g!=="bottom",[_,h]=(0,a.useState)("https://"),[m,T]=(0,a.useState)(!1),E=Dr(),x=(0,a.useMemo)(()=>E,[]),R=r.useElementEntityKind(),{remember:j,fillFields:N}=st(e),B=(0,a.useCallback)($=>{j($),l(R==="email"?r.setElementSettings$1($):r.setElementSettings($))},[l,R,j]);(0,a.useEffect)(()=>{if(e){const{subject:$,body:U,baseEmail:I}=vr(e.linkHref),L=e.linkHref,P=typeof L=="string"&&xi(L),z=typeof L=="string"&&L.startsWith("mailto:")?I:P?L.slice(1):typeof L=="string"?L:"https://";h(vt(L||"","https://")),N(n,{...e,lineHeight:u(e.lineHeight),linkHref:z,subject:$,body:U,mobileFontSize:u(e.mobileFontSize?.value||e.fontSize),mobileFontSizeDim:e.mobileFontSize?.dim||e.fontSizeDim,mobileLineHeight:u(e.mobileLineHeight?.value??e.lineHeight),mobileLineHeightDim:e.mobileLineHeight?.dim||e.lineHeightDim,mobileTextAlign:Cr(e.mobileTextAlign,e.textAlign),SpacingBetweenBulletsAndText:e?.list?.betweenRowCell,SpacingBetweenParagraphs:e?.list?.betweenParagraphs,BulletsSize:e?.list?.bulletFontSize,ColorBullets:e?.list?.bulletsColor,BulletTextStrong:e?.list?.bulletFontBold,BulletTextItalic:e?.list?.bulletFontItalic,CheckboxColor:m,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:x.find(le=>le.symbol===e?.list?.bulletType)?.code??x[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[n,e]);const v=$=>{const U=n.getFieldsValue(!0),I=Object.keys($)[0];let L;switch(I){case"mobileFontSize":L={[I]:{classNamePrefix:"em-mob-font_size-",value:$[I],dim:U.mobileFontSizeDim}};break;case"mobileLineHeight":L={[I]:{classNamePrefix:"em-mob-line_height-",value:$[I],dim:U.mobileLineHeightDim}};break;case"mobileTextAlign":L={[I]:{classNamePrefix:"em-mob-text_align-",value:$[I]}};break;case"linkHref":let P=Qo($[I]);if(P!==$[I]&&n.setFieldValue("linkHref",P),_==="#"&&P&&!P.startsWith("#")&&(P="#"+P),P.startsWith("mailto:")){const le=n.getFieldValue("subject"),C=n.getFieldValue("body");L={[I]:ki(P,le,C)}}else L={[I]:P};Vo(P,h);break;case"subject":case"body":const z=n.getFieldValue("linkHref")||"";if(z.substring(0,7)==="mailto:"){const le=z.split("?")[0],C=I==="subject"?$[I]:n.getFieldValue("subject"),re=I==="body"?$[I]:n.getFieldValue("body"),ce=[];C&&ce.push(`subject=${encodeURIComponent(C)}`),re&&ce.push(`body=${encodeURIComponent(re)}`),L={linkHref:ce.length>0?`${le}?${ce.join("&")}`:le}}else return;break;default:L=$}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:L}),B({...e,list:{...e.list,bulletsColor:n.getFieldValue("ColorBullets"),bulletFontFamily:n.getFieldValue("BulletsFontFamily"),bulletFontSize:n.getFieldValue("BulletsSize"),betweenParagraphs:n.getFieldValue("SpacingBetweenParagraphs"),betweenRowCell:n.getFieldValue("SpacingBetweenBulletsAndText"),bulletType:x.find(P=>P.code===n.getFieldValue("BulletType"))?.symbol??x[0].symbol},...L,activateSection:null,changeKey:I})};return(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:v,className:"element-controls",initialValues:{textAlign:"left",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textColor:"",textBackgroundColor:"",textLink:!1,textReplacer:"",textAnchor:"",subject:"",body:"",SpacingBetweenBulletsAndText:0,SpacingBetweenParagraphs:0,BulletsSize:0,ColorBullets:"",BulletTextStrong:!1,BulletTextItalic:!1,CheckboxColor:!1,BulletsFontFamily:"",BulletTextUnderline:!1,BulletTextStrikethrough:!1,BulletType:"",textSuperscript:!1,textSubscript:!1,listOL:!1,listUL:!1},children:[!b&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(d==="mobile"&&!b&&c.styles)&&(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:b?(0,o.jsx)(Si,{form:n,elementSettings:e}):(0,o.jsx)(pt,{form:n,fillFields:N,elementSettings:e,linkProtocol:_,setLinkProtocol:h,isBulletFontColorChecked:m,setIsBulletFontColorChecked:T})}),!b&&(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none"},children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Ct,{form:n,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,o.jsx)(pt,{form:n,fillFields:N,elementSettings:e,linkProtocol:_,setLinkProtocol:h}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Mr,{})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})]})]})]})},Ti=(e,i)=>{const{__:l}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{title:l("During export, the element is converted into an image."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$Switch,{id:"convert-in-image",label:l("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})})},"exportAsPicture")},Vr={marginBottom:10},Hr={position:"relative",top:2};function wn(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var ot=({form:e,showRounding:i=!1,showBackground:l=!1})=>{const{__:s}=r.useI18n(),n=wn(t.ui_kit$Form.useWatch("backgroundImage",e));return(0,o.jsxs)(o.Fragment,{children:[i&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds bulletproof VML markup so the button keeps rounded corners in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookRounding",valuePropName:"checked",className:"form-item-margin-xs",style:Vr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-rounding",label:s("Rounded corners in Outlook (VML)"),size:"small",labelStyle:Hr})})},"outlookRounding"),l&&n&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds VML markup so the background image is visible in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookBackground",valuePropName:"checked",className:"form-item-margin-xs",style:Vr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-background",label:s("Background image in Outlook (VML)"),size:"small",labelStyle:Hr})})},"outlookBackground")]})};ot.propTypes={form:f.default.object,showRounding:f.default.bool,showBackground:f.default.bool};var Ur=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,backgroundSizeOptions:b,sizeShow:_,modificationShow:h,oneBorderRadiusValue:m,setOneBorderRadiusValue:T,toggleShowBorderHandler:E,toggleShowBorderRadiusHandler:x,toggleShowBoxShadowHandler:R,toggleShowSizeHandler:j,toggleShowBackgroundHandler:N,toggleShowModificationHandler:B})=>{const{__:v}=r.useI18n(),$=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Do,{form:e,elementSettings:i,tooltipTitle:v("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:v("Size"),collapsible:!0,open:_,onToggle:j,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:No,minWidthDimensionSelect:No,maxWidthDimensionSelect:No,rowStyle:{marginBottom:4},labels:{width:v("Width"),height:v("Height"),minWidth:v("Minimum width"),maxWidth:v("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:v("Background"),collapsible:!0,open:c,onToggle:N,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:$.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:p,usedColors:i.usedColors,colorPlaceholder:v("Background color"),horizontalPositionPlaceholder:v("Horizontal position"),horizontalPositionTooltip:v("Horizontal position"),verticalPositionPlaceholder:v("Vertical position"),verticalPositionTooltip:v("Vertical position"),backgroundRepeatTooltip:v("Background image repeat"),backgroundSizeTooltip:v("Background image size"),selectPlaceholder:v("Please choose"),backgroundRepeatOptions:g,backgroundSizeOptions:b,imageUploadSlot:$.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Ao,{form:e,label:v("Background image"),name:"backgroundImage",tooltipTitle:v("Background image"),placeholder:v("Background image link/route")}):void 0}),(0,o.jsx)(ot,{form:e,showBackground:!0})]}),$.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Borders"),collapsible:!0,open:s,onToggle:E,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),$.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Border radius"),collapsible:!0,open:n,onToggle:x,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:m,setOneBorderRadiusValue:T,elementSettings:i})}),$.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Box shadow"),collapsible:!0,open:d,onToggle:R,dividerTop:!0,children:(0,o.jsx)(jo,{})}),$.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Export settings"),collapsible:!0,open:h,onToggle:B,dividerTop:!0,children:(0,o.jsx)(Ti,{form:e,elementSettings:i})}),$.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),$.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};Ur.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,backgroundSizeOptions:f.default.array,sizeShow:f.default.bool,modificationShow:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func};var zr=({form:e,elementSettings:i,label:l})=>{const{__:s}=r.useI18n();(0,a.useRef)();const[n,d]=(0,a.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,t.ui_kit$useToken)(),p=r.useSendPostMessage(),g=_=>{e.setFieldsValue({mobileBackgroundColor:""}),d(h=>!h),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:n?"":"none"}}})},b=_=>{d(!1)};return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(t.ui_kit$Tooltip,{trigger:["hover"],title:s("Background color"),placement:"left",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundColor",style:{marginBottom:c.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{onChange:b,placeholder:l,usedColors:i.usedColors})}),(0,o.jsx)(t.ui_kit$Switch,{id:"without-background-color",label:s("Without background color"),labelSize:"small",size:"small",checked:n,onChange:g})]})})};zr.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired};var Pt={horizontal:[{value:"left",label:"left"},{value:"center",label:"center"},{value:"right",label:"right"}],vertical:[{value:"top",label:"top"},{value:"center",label:"center"},{value:"bottom",label:"bottom"}]},Ri={mobileBackgroundColor:"em-mob-background_color-",mobileBackgroundImage:"em-mob-background_image-",mobileBackgroundPositionX:"em-mob-background_position_x-",mobileBackgroundPositionY:"em-mob-background_position_y-",mobileBackgroundRepeat:"em-mob-background_repeat-",mobileBackgroundSize:"em-mob-background_size-"},at="none",jn=/^(https?:)?\/\//i,In=/^(\d*\.?\d+)(%|px)$/;function vn(e){return e in Ri}function Wr(e){return jn.test(e.trim())}function yi(e,i){const l=Ri[e],s=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?s&&s!==at&&!Wr(s)?null:{[e]:[{classNamePrefix:l,value:s,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:l,value:s||at}}:{[e]:{classNamePrefix:l,value:s}}}function ht(e){const[i]=Object.keys(e??{});return!i||!vn(i)?null:yi(i,e[i])}function Gr(){return Object.keys(Ri).reduce((e,i)=>({...e,...yi(i,"")}),{})}function Yr(e){const i=(e??"").trim(),l=i.match(In);return l?{position:l[1],unit:l[2]}:{position:i,unit:"px"}}function Xr(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Uo(e){const i=e??{},l=i.customTable??i;return{type:i.type,usedColors:i.usedColors,mobileBackgroundColor:l.mobileBackgroundColor,mobileBackgroundImage:l.mobileBackgroundImage,mobileBackgroundPositionX:l.mobileBackgroundPositionX,mobileBackgroundPositionY:l.mobileBackgroundPositionY,mobileBackgroundRepeat:l.mobileBackgroundRepeat,mobileBackgroundSize:l.mobileBackgroundSize}}function bt(e){const i=e??{},l=i.customTable??i,s=l.backgroundSize??"";return{image:l.backgroundImage?.[0]?.value??"",positionX:l.backgroundPositionX??"",positionY:l.backgroundPositionY??"",repeat:l.backgroundRepeat??"",size:s==="auto"?"":s}}function tt(e){const i=Uo(e),l=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:l===at?"":l,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||at,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function At(e){const i=Uo(e),l=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!l&&l!==at||!!i.mobileBackgroundSize?.value}function Cn(e,i){return e===at?!1:!!e||!!i}function Nt(e,i,l){e.setFieldsValue({...tt({}),mobileBackgroundColor:""}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Uo(i).type,settings:Gr()})}var Pn=/^\d*\.?\d+$/,An={bottom:"auto"},Kr={marginBottom:0},Nn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),Ln=(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),On=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,qr=({value:e,onChange:i,inheritedValue:l,options:s,placeholder:n,prefix:d})=>{const c=e||l,[p,g]=(0,a.useState)(()=>Yr(c));(0,a.useEffect)(()=>{g(m=>Xr(m.position,m.unit)===c?m:Yr(c))},[c]);const b=(0,a.useCallback)((m,T)=>{g({position:m,unit:T});const E=s.some(x=>x.value===m);(m===""||E||Pn.test(m))&&i?.(Xr(m,T))},[i,s]),_=(0,a.useCallback)(m=>b(m,p.unit),[b,p.unit]),h=(0,a.useCallback)(m=>b(p.position,m),[b,p.position]);return(0,o.jsx)(t.ui_kit$InputSelect,{options:s,position:p.position,setPosition:_,unit:p.unit,setUnit:h,placeholder:n,prefix:d,dropdownStyle:An,tooltipTitle:n,getTooltipPopupContainer:On})},$n=({desktopPositionX:e,desktopPositionY:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)(),n=s.formItemMarginBottomXS,d=(0,a.useMemo)(()=>({marginBottom:n}),[n]);return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:d,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionX",style:Kr,children:(0,o.jsx)(qr,{inheritedValue:e,options:Pt.horizontal,placeholder:l("Horizontal position"),prefix:Nn})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:Kr,children:(0,o.jsx)(qr,{inheritedValue:i,options:Pt.vertical,placeholder:l("Vertical position"),prefix:Ln})})})]})},Jr=["hover"],Qr=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,Zr=({value:e,emptyValue:i,inheritedValue:l,...s})=>{const n=!!e&&e!==i,d=s.options.some(c=>c.value===l)?l:i;return(0,o.jsx)(t.ui_kit$Select,{...s,value:n?e:d})},Fn=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:l,desktopSize:s,backgroundRepeatOptions:n,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),g=p.formItemMarginBottomXS,b=(0,a.useMemo)(()=>({marginBottom:g}),[g]),_=(0,a.useMemo)(()=>({marginBottom:(g??0)*1.5}),[g]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)($n,{desktopPositionX:e,desktopPositionY:i}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:_,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Jr,title:c("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:b,children:(0,o.jsx)(Zr,{emptyValue:"none",inheritedValue:l,options:n,placeholder:c("Please choose"),getPopupContainer:Qr})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Jr,title:c("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:b,children:(0,o.jsx)(Zr,{emptyValue:"",inheritedValue:s,options:d,placeholder:c("Please choose"),getPopupContainer:Qr})})})})]})]})},Mn=ai,Dn=({value:e,inheritedImage:i,...l})=>(0,o.jsx)(Mn,{...l,value:e||i}),Vn=e=>/^https?:\/\//i.test(e.trim()),Hn=({form:e,name:i="mobileBackgroundImage",placeholder:l="",disabled:s=!1,elementSettings:n,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:p})=>{const{__:g}=r.useI18n(),{token:b}=(0,t.ui_kit$useToken)(),_=t.ui_kit$Form.useWatch(i,e),[h,m]=(0,a.useState)(""),T=_||d,E=b.formItemMarginBottomXS??0,x=(0,a.useMemo)(()=>({marginBottom:E/2}),[E]);(0,a.useEffect)(()=>{if(!T){m("");return}m(Vn(T)?"validating":"success")},[T]);const R=!!_&&!Wr(_),j=R?"error":h;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:j,help:R?g("Enter a URL starting with http:// or https://"):void 0,style:x,children:(0,o.jsx)(Dn,{inheritedImage:d,validateStatus:j,placeholder:l,name:i,disabled:s,elementSettings:n,imageInfo:n,onRemotePreviewValidate:m})}),(0,o.jsx)(t.ui_kit$Switch,{label:g("Without image"),labelSize:"small",size:"small",checked:c,onChange:p})]})},Un={image:"",positionX:"",positionY:"",repeat:"",size:""},gt=({elementSettings:e,imageEnabled:i=!1,desktopBackground:l=Un})=>{const{__:s}=r.useI18n(),{token:n}=(0,t.ui_kit$useToken)(),d=t.ui_kit$Form.useFormInstance(),c=n.formItemMarginBottomMD,p=r.useSendPostMessage(),g=e.mobileBackgroundImage?.[0]?.value,[b,_]=(0,a.useState)(g==="none"),h=t.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,a.useEffect)(()=>{_(g==="none")},[g]),(0,a.useEffect)(()=>{h&&_(!1)},[h]);const m=(0,a.useCallback)(v=>{_(v),d.setFieldsValue({mobileBackgroundImage:""}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:yi("mobileBackgroundImage",v?"none":"")})},[e.type,d,p]),T=(0,a.useMemo)(()=>[{label:s("Not defined"),value:"none"},{label:s("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:s("Repeat background (repeat)"),value:"repeat"},{label:s("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:s("Repeat background vertically (repeat-y)"),value:"repeat-y"}],[s]),E=(0,a.useMemo)(()=>[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],[s]),x=Cn(b?"none":h,l.image),R=(0,a.useMemo)(()=>({marginBottom:x?c:0}),[c,x]),j=(0,a.useMemo)(()=>(0,o.jsx)("div",{style:R,children:(0,o.jsx)(zr,{form:d,elementSettings:e,label:s("Background color")})}),[s,e,d,R]),N=(0,a.useMemo)(()=>(0,o.jsx)("div",{style:R,children:(0,o.jsx)(Hn,{form:d,placeholder:s("Background image"),elementSettings:e,inheritedImage:b?"":l.image,isImageNone:b,onImageNoneChange:m})}),[s,l.image,e,d,m,b,R]),B=(0,a.useMemo)(()=>(0,o.jsx)(Fn,{desktopPositionX:l.positionX,desktopPositionY:l.positionY,desktopRepeat:l.repeat,desktopSize:l.size,backgroundRepeatOptions:T,backgroundSizeOptions:E}),[T,E,l.positionX,l.positionY,l.repeat,l.size]);return(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:j,imageEnabled:i,backgroundImageEmpty:!x,imageUploadSlot:N,imageControlsSlot:B,usedColors:e.usedColors})},el=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:b,toggleShowMobileBorderHandler:_,toggleShowMobileBorderRadiusHandler:h,toggleShowMobileBoxShadowHandler:m,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:E})=>{const{__:x}=r.useI18n(),{token:R}=(0,t.ui_kit$useToken)(),j=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Do,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Size"),collapsible:!0,open:c,onToggle:T,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:x("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:R.formItemMarginBottomMD+4},children:(0,o.jsx)(Ho,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Background"),collapsible:!0,open:p,onToggle:E,dividerTop:!0,children:(0,o.jsx)(gt,{elementSettings:Uo(i),imageEnabled:j.formTableFieldBackgroundImageEnabled,desktopBackground:bt(i)})}),j.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Borders"),collapsible:!0,open:s,onToggle:_,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),j.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Border radius"),collapsible:!0,open:n,onToggle:h,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:g,setOneBorderRadiusValue:b,elementSettings:i})}),j.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Box shadow"),collapsible:!0,open:d,onToggle:m,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),j.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),j.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};el.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,mobileBoxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func};var ol=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Lo(),d=Lo(),c=r.useDispatch(),p=r.useElementEntityKind(),[g,b]=(0,a.useState)({}),[_,h]=(0,a.useState)(!0),[m,T]=(0,a.useState)({}),[E,x]=(0,a.useState)(!0),R=r.useSelector(r.selectEmailViewType),j=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[N,B]=(0,a.useState)(e.backgroundImage[0].value===""),v=r.useSelector(r.selectIsCodeMode),$=r.useSelector(r.selectCodeModeDirection),U=v&&$!=="bottom",[I,L]=(0,a.useState)(!1),[P,z]=(0,a.useState)(!1),[le,C]=(0,a.useState)(!1),[re,ce]=(0,a.useState)(!1),[fe,Be]=(0,a.useState)(!1),[se,he]=(0,a.useState)(!1),[Pe,pe]=(0,a.useState)(!1),[De,Oe]=(0,a.useState)(!1),[Ce,ge]=(0,a.useState)(!1),[_e,Q]=(0,a.useState)(!1),[K,q]=(0,a.useState)(!1),Z=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],V=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],M=G=>G&&(G?.width||G?.style||G?.color)?G:"",Y=e.border,X=e.mobileBorder,oe=Object.keys(Y).find(G=>Y[G]?.width||Y[G]?.style||Y[G]?.color),me=Object.keys(X).find(G=>X[G]?.width||X[G]?.style||X[G]?.color),{remember:Te,fillFields:Se}=st(e);(0,a.useEffect)(()=>{if(e){const G=e.boxShadow,be=e.mobileBoxShadow;b(G),T(be),Se(s,{...e,width:e.width?.value,widthDim:e.width?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:bo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:M(e.mobileBorder.all)||!(M(e.mobileBorder.top)||M(e.mobileBorder.bottom)||M(e.mobileBorder.right)||M(e.mobileBorder.left))&&M(e.border.all),mobileBorderTop:M(e.mobileBorder.top)||!M(e.mobileBorder.all)&&M(e.border.top),mobileBorderBottom:M(e.mobileBorder.bottom)||!M(e.mobileBorder.all)&&M(e.border.bottom),mobileBorderRight:M(e.mobileBorder.right)||!M(e.mobileBorder.all)&&M(e.border.right),mobileBorderLeft:M(e.mobileBorder.left)||!M(e.mobileBorder.all)&&M(e.border.left),mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...tt(e),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?h(!1):h(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?x(!1):x(!0),B(e.backgroundImage[0].value==="");const Le=n.isStaleBorderSnapshot(e,!!oe),He=d.isStaleBorderSnapshot(e,!!me);Le&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(He||Le&&!me)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),L(Je=>oe&&!Le?!0:Je),z(Je=>oe&&!Le||me&&!He?!0:Je),C(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ce(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),Be(!!e.boxShadow),he(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),pe(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Oe(!!e.mobileWidth.value),ge(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(At(e)),q(!!e.exportAsPicture)}},[s,e,oe,me,n,d,Se]);const te=(0,a.useCallback)(G=>{Te(G),c(p==="email"?r.setElementSettings$1(G):r.setElementSettings(G))},[c,p,Te]),D=G=>{const be=s.getFieldsValue(!0),Le=Object.keys(G)[0];let He;switch(Le){case"exportAsPicture":He={exportAsPicture:be.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":He={boxShadow:{hOffset:be.boxShadowHOffset,vOffset:be.boxShadowVOffset,blurRadius:be.boxShadowBlurRadius,spreadRadius:be.boxShadowSpreadRadius,color:be.boxShadowColor,inset:be.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":be.borderPosition==="borderAll"?(He={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...be.borderAll}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):be.borderAll?.width||be.borderAll?.style||be.borderAll?.color?(He={border:{all:null,left:be.borderAll,right:be.borderAll,top:be.borderAll,bottom:be.borderAll,[H.REVERSE_BORDER_POSITIONS[Le]]:{...be[Le],...G[Le]}}},s.setFieldsValue({borderAll:null,borderLeft:be.borderAll,borderRight:be.borderAll,borderTop:be.borderAll,borderBottom:be.borderAll,[Le]:{...be[Le],...G[Le]}})):(He={border:{all:null,left:be.borderLeft,right:be.borderRight,top:be.borderTop,bottom:be.borderBottom,[H.REVERSE_BORDER_POSITIONS[Le]]:{...be[Le],...G[Le]}}},s.setFieldsValue({border:He.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(be.mobileBorderPosition==="mobileBorderAll")He={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...be.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[Le]+"-"}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const Je=H.MOBILE_REVERSE_BORDER_POSITIONS[Le],Ze={...be[Le],...G[Le]},so=!Ze?.width&&!Ze?.style&&!Ze?.color;if(be.mobileBorder?.all?.width||be.mobileBorder?.all?.style||be.mobileBorder?.all?.color){const O=be.mobileBorderAll;He={mobileBorder:{all:null,left:O,right:O,top:O,bottom:O,[Je]:so?null:{...Ze,classNamePrefix:"em-mob-border_"+Je+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:O,mobileBorderRight:O,mobileBorderTop:O,mobileBorderBottom:O,[Le]:Ze})}else{const O=e.mobileBorder||{},ae=w=>{const y=O[w];return y&&(y?.width||y?.style||y?.color)?y:null};He={mobileBorder:{all:null,left:Je==="left"?so?null:{...Ze,classNamePrefix:"em-mob-border_left-"}:ae("left"),right:Je==="right"?so?null:{...Ze,classNamePrefix:"em-mob-border_right-"}:ae("right"),top:Je==="top"?so?null:{...Ze,classNamePrefix:"em-mob-border_top-"}:ae("top"),bottom:Je==="bottom"?so?null:{...Ze,classNamePrefix:"em-mob-border_bottom-"}:ae("bottom")}},s.setFieldsValue({[Le]:Ze})}}break;case"width":He={[Le]:{value:G[Le],dim:be.widthDim}};break;case"widthDim":He={width:{value:be.width,dim:G[Le]}};break;case"maxWidth":He={[Le]:{value:G[Le],dim:be.maxWidthDim}};break;case"maxWidthDim":He={maxWidth:{value:be.maxWidth,dim:G[Le]}};break;case"minWidth":He={[Le]:{value:G[Le],dim:be.minWidthDim}};break;case"minWidthDim":He={minWidth:{value:be.minWidth,dim:G[Le]}};break;case"backgroundImage":B(G[Le]===""),He={[Le]:[{...e.backgroundImage[0],value:G[Le]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":He={borderRadius:{[H.BORDER_RADIUS_POSITION[Le]]:+G[Le]}};break;case"mobileWidth":He={[Le]:{classNamePrefix:"em-mob-width-",value:G[Le],dim:be.mobileWidthDim}};break;case"mobileWidthDim":He={mobileWidth:{classNamePrefix:"em-mob-width-",value:be.mobileWidth||100,dim:G[Le]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":He={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[Le]]:G[Le],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[Le]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":He={mobileBoxShadow:{hOffset:be.mobileBoxShadowHOffset,vOffset:be.mobileBoxShadowVOffset,blurRadius:be.mobileBoxShadowBlurRadius,spreadRadius:be.mobileBoxShadowSpreadRadius,color:be.mobileBoxShadowColor,inset:be.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(He=ht(G),!He)return;break;case"mobileAlign":He={[Le]:{classNamePrefix:"em-mob-table_align-",value:G[Le]}};break;default:He=G}Le!=="borderPosition"&&Le!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:He}),Le!=="mobileBorderRadiusAll"&&Le!=="mobileBorderRadiusTopLeft"&&Le!=="mobileBorderRadiusTopRight"&&Le!=="mobileBorderRadiusBottomLeft"&&Le!=="mobileBorderRadiusBottomRight"&&te({...e,...He,mobileBorderRadius:{...e.mobileBorderRadius,...He?.mobileBorderRadius},activateSection:null,changeKey:Le}))},ie=()=>{const G=s.getFieldsValue(!0);n.markBorderToggled(!I),setTimeout(()=>{L(be=>!be),I?(G.borderAll=H.NULL_BORDER,G.borderTop=H.NULL_BORDER,G.borderBottom=H.NULL_BORDER,G.borderRight=H.NULL_BORDER,G.borderLeft=H.NULL_BORDER):G.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:G.borderAll.color,style:G.borderAll.style,width:G.borderAll.width}}}})})},ye=()=>{const G=s.getFieldsValue(!0);d.markBorderToggled(!P),setTimeout(()=>{z(be=>!be),P?(G.mobileBorderAll=H.NULL_BORDER,G.mobileBorderTop=H.NULL_BORDER,G.mobileBorderBottom=H.NULL_BORDER,G.mobileBorderRight=H.NULL_BORDER,G.mobileBorderLeft=H.NULL_BORDER):G.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:G.mobileBorderAll.color,style:G.mobileBorderAll.style,width:G.mobileBorderAll.width}}}})})},W=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{C(be=>!be),le?(G.borderRadiusAll=0,h(!0)):G.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:G.borderRadiusAll}}})})},Re=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{ce(be=>!be),re?(G.mobileBorderRadiusAll=null,x(!0)):G.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:G.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},$e=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{Be(be=>!be),fe?(G.boxShadowInset=!1,G.boxShadowHOffset=null,G.boxShadowVOffset=null,G.boxShadowBlurRadius=null,G.boxShadowSpreadRadius=null,G.boxShadowColor=""):(G.boxShadowInset=!1,G.boxShadowHOffset=5,G.boxShadowVOffset=5,G.boxShadowBlurRadius=10,G.boxShadowSpreadRadius=-5,G.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:G.boxShadowBlurRadius,color:G.boxShadowColor,hOffset:G.boxShadowHOffset,inset:G.boxShadowInset,spreadRadius:G.boxShadowSpreadRadius,vOffset:G.boxShadowVOffset}}})})},Ae=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{he(be=>!be),se?(G.mobileBoxShadowInset=!1,G.mobileBoxShadowHOffset=null,G.mobileBoxShadowVOffset=null,G.mobileBoxShadowBlurRadius=null,G.mobileBoxShadowSpreadRadius=null,G.mobileBoxShadowColor=""):(G.mobileBoxShadowInset=!1,G.mobileBoxShadowHOffset=5,G.mobileBoxShadowVOffset=5,G.mobileBoxShadowBlurRadius=10,G.mobileBoxShadowSpreadRadius=-5,G.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:G.mobileBoxShadowBlurRadius,color:G.mobileBoxShadowColor,hOffset:G.mobileBoxShadowHOffset,inset:G.mobileBoxShadowInset,spreadRadius:G.mobileBoxShadowSpreadRadius,vOffset:G.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},We=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{pe(be=>!be),Pe&&(G.width="",G.minWidth="",G.maxWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},minWidth:{value:null,dim:"px"},maxWidth:{value:null,dim:"px"}}}))})},Ve=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{Oe(be=>!be),De&&(G.mobileWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},Ge=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{ge(be=>!be),Ce?(G.backgroundColor="",G.backgroundImage="",G.backgroundPositionX="",G.backgroundPositionY="",G.backgroundRepeat="none",G.backgroundSize="",B(!0)):(G.backgroundColor="#E5E5E5",G.backgroundSize="",G.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:G.backgroundColor,backgroundImage:[{type:"url",value:G.backgroundImage}],backgroundPositionX:G.backgroundPositionX,backgroundPositionY:G.backgroundPositionY,backgroundRepeat:G.backgroundRepeat,backgroundSize:G.backgroundSize}})})},de=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{Q(be=>!be),_e?G.mobileBackgroundColor="":G.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:G.mobileBackgroundColor}}}),_e&&Nt(s,e,l)})},je=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{q(be=>!be),K&&(G.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_table_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:H.BORDER_POSITIONS[oe]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[me]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:D,autoComplete:"off",className:"element-controls",children:[!U&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),R==="mobile"&&j.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(el,{form:s,elementSettings:e,mobileBoxShadow:m,mobileBordersShow:P,mobileBorderRadiusShow:re,mobileBoxShadowShow:se,mobileSizeShow:De,mobileBackgroundShow:_e,oneMobileBorderRadiusValue:E,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:ye,toggleShowMobileBorderRadiusHandler:Re,toggleShowMobileBoxShadowHandler:Ae,toggleShowMobileSizeHandler:Ve,toggleShowMobileBackgroundHandler:de})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Ur,{form:s,elementSettings:e,boxShadow:g,bordersShow:I,borderRadiusShow:le,boxShadowShow:fe,backgroundShow:Ce,backgroundImageEmpty:N,backgroundRepeatOptions:Z,backgroundSizeOptions:V,sizeShow:Pe,modificationShow:K,oneBorderRadiusValue:_,setOneBorderRadiusValue:h,toggleShowBorderHandler:ie,toggleShowBorderRadiusHandler:W,toggleShowBoxShadowHandler:$e,toggleShowSizeHandler:We,toggleShowBackgroundHandler:Ge,toggleShowModificationHandler:je})})]})};ol.propTypes={elementSettings:f.default.object.isRequired};var tl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=r.useAppConfig(),d=r.useSelector(r.selectIsCodeMode),c=r.useSelector(r.selectCodeModeDirection),[p,g]=(0,a.useState)({}),[b,_]=(0,a.useState)("https://"),h=({target:E})=>{const{selectionStart:x,selectionEnd:R}=E;E&&g({target:E,selection:{start:x,end:R}})};(0,a.useEffect)(()=>{if(e){let E="",x="",R=e.href==null?"https://":e.href;if(R&&R.substring(0,7)==="mailto:"){const j=new URL(e.href);E=j.searchParams.get("subject")||"",x=j.searchParams.get("body")||"",R=e.href.split("?")[0],_("mailto:")}else e.href&&(e.href.substring(0,8)==="https://"||e.href.substring(0,7)==="http://"?_("https://"):e.href.substring(0,4)==="tel:"?_("tel:"):e.href.substring(0,4)==="sms:"?_("sms:"):e.href.substring(0,6)==="ftp://"?_("ftp://"):_(""));s.setFieldsValue({...e,href:R,subject:E,body:x})}},[s,e]);const m=E=>{const x=Object.keys(E)[0];let R=E;if(x==="href"){const j=Qo(E[x]);if(j!==E[x]&&s.setFieldValue("href",j),j.substring(0,7)==="mailto:"){const N=s.getFieldValue("subject"),B=s.getFieldValue("body"),v=[];N&&v.push(`subject=${encodeURIComponent(N)}`),B&&v.push(`body=${encodeURIComponent(B)}`),R={href:v.length>0?`${j}?${v.join("&")}`:j}}else R={href:j}}if(x==="subject"||x==="body"){const j=s.getFieldValue("href")||"";if(j.substring(0,7)==="mailto:"){const N=j.split("?")[0],B=x==="subject"?E[x]:s.getFieldValue("subject"),v=x==="body"?E[x]:s.getFieldValue("body"),$=[];B&&$.push(`subject=${encodeURIComponent(B)}`),v&&$.push(`body=${encodeURIComponent(v)}`),R={href:$.length>0?`${N}?${$.join("&")}`:N}}else return}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:R})},T=E=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:E})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:m,autoComplete:"off",className:"element-controls",children:!d||c==="bottom"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onSelect:h})})}),n.formLinkFieldInsertImageEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:i("Actions with the chosen text"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"PicLeftOutlined",component:t.icons$PicLeftOutlined}),onClick:()=>T("add_img"),children:i("Add inline image")})})}),(0,o.jsx)(pt,{form:s,elementSettings:e,showAddParagraph:!1,linkTarget:p,linkProtocol:b,setLinkProtocol:_})]}):(0,o.jsx)(Si,{form:s,elementSettings:e,showAddParagraph:!1})})};tl.propTypes={elementSettings:f.default.object.isRequired};var il=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:14,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"height",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:e("Indent height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})};il.propTypes={};var rl=({form:e,elementSettings:i})=>(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Zo,{form:e,name:"mobileHeight",elementSettings:i})})});rl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var ll=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useDispatch(),n=r.useSendPostMessage(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),b=p&&g!=="bottom",_=r.useElementEntityKind(),{remember:h,fillFields:m}=st(e);(0,a.useEffect)(()=>{e&&m(l,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:bo(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[l,e,m]);const T=(0,a.useCallback)(x=>{h(x),s(_==="email"?r.setElementSettings$1(x):r.setElementSettings(x))},[s,_,h]),E=x=>{const R=l.getFieldsValue(!0),j=Object.keys(x)[0];let N;switch(j){case"height":N={[j]:{value:x[j],dim:R.heightDim}};break;case"heightDim":N={height:{value:R.height,dim:x[j]}};break;case"mobileHeight":N={[j]:{classNamePrefix:"em-mob-height-",value:x[j],dim:R.mobileHeightDim}};break;case"mobileHeightDim":N={mobileHeight:{classNamePrefix:"em-mob-height-",value:R.mobileHeight,dim:x[j]}};break;default:N=x}n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:N}),T({...e,...N,activateSection:null,changeKey:j})};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:E,autoComplete:"off",children:[!b&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),d==="mobile"&&c.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none",marginBottom:10},children:(0,o.jsx)(rl,{form:l,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{display:d==="mobile"&&c.styles?"none":"block"},children:(0,o.jsx)(il,{})})]})};ll.propTypes={elementSettings:f.default.object.isRequired};var Lt=({form:e,elementSettings:i,typeOfForm:l="desktop"})=>{const s=r.useSendPostMessage(),n=l==="mobile",d=n?"mobileDirection":"direction",c=g=>{e.setFieldsValue({[d]:g}),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[d]:g}})},p=n?i.mobileDirection?.value??"":i.direction??"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:d,className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$FormDirectionControl,{value:p,onChange:c})})},Ot=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,wi=({form:e,backgroundImageEmpty:i,appConfig:l,token:s,elementSettings:n,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:p}=r.useI18n(),[g,b]=(0,a.useState)(""),[_,h]=(0,a.useState)("px"),[m,T]=(0,a.useState)(""),[E,x]=(0,a.useState)("px"),R=[{label:p("Not defined"),value:""},{label:p("Contain"),value:"contain"},{label:p("Cover"),value:"cover"}],j=v=>{if(!v||typeof v!="string")return{value:"",unit:"px"};v=v.trim();const $=v.match(/^(\d*\.?\d+)(%|px)$/);return $?{value:$[1],unit:$[2]}:{value:v,unit:"px"}};(0,a.useEffect)(()=>{const v=e.getFieldValue("backgroundPositionX"),$=e.getFieldValue("backgroundPositionY"),U=j(v),I=j($);b(String(U.value)),h(U.unit),T(String(I.value)),x(I.unit)},[e]);const N=(v,$)=>{b(String(v)),h($),c&&c({backgroundPositionX:{position:v,unit:$}})},B=(v,$)=>{T(String(v)),x($),c&&c({backgroundPositionY:{position:v,unit:$}})};return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background color"),placement:"bottom",getPopupContainer:Ot,children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:p("Background color"),usedColors:n.usedColors,placement:"bottomLeft"})})})})}),l.formCellFieldBackgroundImageEnabled&&(0,o.jsxs)(t.ui_kit$Col,{span:i?12:24,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image"),placement:"bottom",getPopupContainer:Ot,children:(0,o.jsx)("div",{children:(0,o.jsx)(Ao,{form:e,label:p("Background image"),name:"backgroundImage",tooltipTitle:p("Background image"),placeholder:p("Background image link/route")})})}),!i&&(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:s.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Pt.horizontal,position:g,setPosition:v=>N(v,_),unit:_,setUnit:v=>N(g,v),placeholder:p("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Horizontal position"),getTooltipPopupContainer:Ot})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Pt.vertical,position:m,setPosition:v=>B(v,E),unit:E,setUnit:v=>B(m,v),placeholder:p("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Vertical position"),getTooltipPopupContainer:Ot})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:d,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:R,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},zn=({form:e,elementSettings:i,__:l,appConfig:s})=>{const n=H.useGoogleFontsLoader(),[d,c]=(0,a.useState)(null);return(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,o.jsxs)("div",{style:{marginBottom:"-15px"},children:[s.formTextFieldTypografEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text font"),placement:"bottom",zIndex:1,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:n,getPopupContainer:p=>p.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:l("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:l("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:l("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:l("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]})]})},sl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,sizeShow:b,maxWidthValue:_,modificationShow:h,paddingsExt:m,oneBorderRadiusValue:T,setOneBorderRadiusValue:E,elementListShow:x,togglePaddingHandler:R,toggleShowBorderHandler:j,toggleShowBorderRadiusHandler:N,toggleShowBoxShadowHandler:B,toggleShowSizeHandler:v,toggleShowBackgroundHandler:$,toggleShowModificationHandler:U,handleChangeValues:I})=>{const{__:L}=r.useI18n(),{token:P}=(0,t.ui_kit$useToken)(),z=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(et,{form:e,elementSettings:i})}),z.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Oo,{form:e,elementSettings:i})})]}),z.formCellFieldPaddingsEnabled&&(0,o.jsxs)(o.Fragment,{children:[x&&(0,o.jsx)("div",{style:{marginTop:"15px"},children:(0,o.jsx)(zn,{form:e,elementSettings:i,appConfig:z,__:L})}),(0,o.jsx)(t.ui_kit$FormSection,{title:L("Padding"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:m,onToggleExtended:R,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:L("Horizontal padding"),vertical:L("Vertical padding"),left:L("Left padding"),right:L("Right padding"),top:L("Top padding"),bottom:L("Bottom padding"),individual:L("Individual padding")}})})]}),i.type!=="group"&&z.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("Size"),collapsible:!0,open:b,onToggle:v,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:_,dimensionSelect:No,rowStyle:{paddingBottom:4},labels:{width:L("Width"),height:L("Height"),minWidth:L("Minimum width"),maxWidth:L("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:L("Background"),collapsible:!0,open:c,onToggle:$,dividerTop:!0,children:[(0,o.jsx)(wi,{form:e,backgroundImageEmpty:p,appConfig:z,token:P,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:I}),(0,o.jsx)(ot,{form:e,showBackground:!0})]}),z.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("Borders"),collapsible:!0,open:s,onToggle:j,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),z.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("Border radius"),collapsible:!0,open:n,onToggle:N,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:T,setOneBorderRadiusValue:E,elementSettings:i})}),z.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("Box shadow"),collapsible:!0,open:d,onToggle:B,dividerTop:!0,children:(0,o.jsx)(jo,{})}),z.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,o.jsxs)(t.ui_kit$FormSection,{title:L("Settings"),collapsible:!0,open:h,onToggle:U,dividerTop:!0,children:[i.type==="structure"&&(0,o.jsx)(t.ui_kit$Tooltip,{title:L("The block will change its colors to contrasting colors. You can change them in the Content Styles section."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$Switch,{id:"contrast-colors",label:L("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,o.jsx)(Ti,{form:e,elementSettings:i})]}),z.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:L(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Lt,{elementSettings:i,form:e}):void 0})}),z.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};sl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,sizeShow:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),modificationShow:f.default.bool,paddingsExt:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,elementListShow:f.default.bool,togglePaddingHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func,handleChangeValues:f.default.func};var $t=({form:e,elementSettings:i,mobilePaddingsExt:l,setMobilePaddingsExt:s,rowStyle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=()=>{s(b=>!b);const g=e.getFieldsValue(!0);l||(g.mobilePaddingLeftRight=g.mobilePaddingLeft,g.mobilePaddingTopBottom=g.mobilePaddingTop,g.mobilePaddingRight=g.mobilePaddingLeft,g.mobilePaddingBottom=g.mobilePaddingTop,c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:g.mobilePaddingTop!==""?g.mobilePaddingTop:null,bottom:g.mobilePaddingTopBottom!==""?g.mobilePaddingTopBottom:null,left:g.mobilePaddingLeft!==""?g.mobilePaddingLeft:null,right:g.mobilePaddingRight!==""?g.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,o.jsx)(t.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:l,onToggleExtended:p,showHorizontal:!0,gutter:10,rowStyle:n,labels:{horizontal:d("Horizontal padding"),vertical:d("Vertical padding"),left:d("Left padding"),right:d("Right padding"),top:d("Top padding"),bottom:d("Bottom padding"),individual:d("Individual padding")}})};$t.propTypes={form:f.default.shape({getFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,mobilePaddingsExt:f.default.bool.isRequired,setMobilePaddingsExt:f.default.func.isRequired,rowStyle:f.default.object};var al=({form:e,elementSettings:i,boxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:g,mobilePaddingsExt:b,setMobilePaddingsExt:_,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:m,toggleShowMobileBorderHandler:T,toggleShowMobileBorderRadiusHandler:E,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:R,toggleShowMobileBackgroundHandler:j,toggleShowMobilePaddingHandler:N})=>{const{__:B}=r.useI18n(),v=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Do,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),v.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Oo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),v.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Padding"),collapsible:!0,open:g,onToggle:N,dividerTop:!0,children:(0,o.jsx)($t,{form:e,elementSettings:i,mobilePaddingsExt:b,setMobilePaddingsExt:_,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&v.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Size"),collapsible:!0,open:c,onToggle:R,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(Ho,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(Zo,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:p,onToggle:j,dividerTop:!0,children:(0,o.jsx)(gt,{elementSettings:Uo(i),imageEnabled:v.formCellFieldBackgroundImageEnabled,desktopBackground:bt(i)})}),v.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:s,onToggle:T,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),v.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:n,onToggle:E,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:m,elementSettings:i,typeOfForm:"mobile"})}),v.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),v.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:B(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Lt,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),v.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};al.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};var nl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=Lo(),c=Lo(),[p,g]=(0,a.useState)(""),[b,_]=(0,a.useState)({}),[h,m]=(0,a.useState)(!0),[T,E]=(0,a.useState)(!0),x=r.useSelector(r.selectEmailViewType),R=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[j,N]=(0,a.useState)(e.backgroundImage[0].value===""),B=r.useSelector(r.selectIsCodeMode),v=r.useSelector(r.selectCodeModeDirection),$=B&&v!=="bottom",[U,I]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),[z,le]=(0,a.useState)(!1),[C,re]=(0,a.useState)(!1),[ce,fe]=(0,a.useState)(!1),[Be,se]=(0,a.useState)(!1),[he,Pe]=(0,a.useState)(!1),[pe,De]=(0,a.useState)(!1),[Oe,Ce]=(0,a.useState)(!1),[ge,_e]=(0,a.useState)(!1),[Q,K]=(0,a.useState)(!1),[q,Z]=(0,a.useState)(!1),[V,M]=(0,a.useState)(!1),[Y,X]=(0,a.useState)(!1),[oe,me]=(0,a.useState)(!1),Te=r.useElementEntityKind(),Se=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],te=e.border,D=e.mobileBorder,ie=Object.keys(te).find(w=>te[w]?.width||te[w]?.style||te[w]?.color),ye=Object.keys(D).find(w=>D[w]?.width||D[w]?.style||D[w]?.color),W=w=>w&&(w?.width||w?.style||w?.color)?w:"",{remember:Re,fillFields:$e}=st(e);(0,a.useEffect)(()=>{if(e){const w=e.boxShadow;_(w),$e(n,{...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",isContrastBlock:e.isContrastBlock,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:W(e.mobileBorder.all)||!(W(e.mobileBorder.top)||W(e.mobileBorder.bottom)||W(e.mobileBorder.right)||W(e.mobileBorder.left))&&W(e.border.all),mobileBorderTop:W(e.mobileBorder.top)||!W(e.mobileBorder.all)&&W(e.border.top),mobileBorderBottom:W(e.mobileBorder.bottom)||!W(e.mobileBorder.all)&&W(e.border.bottom),mobileBorderRight:W(e.mobileBorder.right)||!W(e.mobileBorder.all)&&W(e.border.right),mobileBorderLeft:W(e.mobileBorder.left)||!W(e.mobileBorder.all)&&W(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:bo(e.mobileWidth?.value)||bo(e.width?.value),mobileWidthDim:bo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:bo(e.mobileHeight?.value)||bo(e.height?.value),mobileHeightDim:bo(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(e.mobileAlign?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...tt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right)||u(e.padding?.left)||u(e.padding?.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?m(!1):m(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?E(!1):E(!0),N(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?I(!1):I(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)||!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?P(!1):P(!0);const y=d.isStaleBorderSnapshot(e,!!ie),ue=c.isStaleBorderSnapshot(e,!!ye);y&&n.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(ue||y&&!ye)&&n.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),le(Ie=>ie&&!y?!0:Ie),re(Ie=>ie&&!y||ye&&!ue?!0:Ie),fe(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),se(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Pe(!!e.boxShadow),De(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),Ce(!!e.width.value&&e.type!=="column"||!!e.height.value),_e(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),K(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Z(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),At(e)&&Z(!0),M(!!e.exportAsPicture||!!e.isContrastBlock),X(!!e.mobilePadding.all||e.mobilePadding.all===0||!!e.mobilePadding.top||e.mobilePadding.top===0||!!e.mobilePadding.bottom||e.mobilePadding.bottom===0||!!e.mobilePadding.left||e.mobilePadding.left===0||!!e.mobilePadding.right||e.mobilePadding.right===0||!!e.padding.all||e.padding.all===0||!!e.padding.top||e.padding.top===0||!!e.padding.bottom||e.padding.bottom===0||!!e.padding.left||e.padding.left===0||!!e.padding.right||e.padding.right===0),e.elementName==="List"?me(!0):me(!1)}},[n,e,ie,ye,d,c,$e]);const Ae=(0,a.useCallback)(w=>{Re(w),s(Te==="email"?r.setElementSettings$1(w):r.setElementSettings(w))},[s,Te,Re]),We=w=>{const y=n.getFieldsValue(!0),ue=Object.keys(w)[0];let Ie;switch(g(n.getFieldsValue(!0).widthDim==="%"?100:""),ue){case"exportAsPicture":Ie={exportAsPicture:y.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ie={boxShadow:{hOffset:y.boxShadowHOffset,vOffset:y.boxShadowVOffset,blurRadius:y.boxShadowBlurRadius,spreadRadius:y.boxShadowSpreadRadius,color:y.boxShadowColor,inset:y.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":y.borderPosition==="borderAll"?(Ie={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...y.borderAll}}},n.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):y.borderAll?.width||y.borderAll?.style||y.borderAll?.color?(Ie={border:{all:null,left:y.borderAll,right:y.borderAll,top:y.borderAll,bottom:y.borderAll,[H.REVERSE_BORDER_POSITIONS[ue]]:{...y[ue],...w[ue]}}},n.setFieldsValue({borderAll:null,borderLeft:y.borderAll,borderRight:y.borderAll,borderTop:y.borderAll,borderBottom:y.borderAll,[ue]:{...y[ue],...w[ue]}})):(Ie={border:{all:null,left:y.borderLeft,right:y.borderRight,top:y.borderTop,bottom:y.borderBottom,[H.REVERSE_BORDER_POSITIONS[ue]]:{...y[ue],...w[ue]}}},n.setFieldsValue({border:Ie.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(y.mobileBorderPosition==="mobileBorderAll")Ie={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...y.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[ue]+"-"}}},n.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const Ye=H.MOBILE_REVERSE_BORDER_POSITIONS[ue],Qe={...y[ue],...w[ue]},co=!Qe?.width&&!Qe?.style&&!Qe?.color;if(y.mobileBorder?.all?.width||y.mobileBorder?.all?.style||y.mobileBorder?.all?.color){const ro=y.mobileBorderAll;Ie={mobileBorder:{all:null,left:ro,right:ro,top:ro,bottom:ro,[Ye]:co?null:{...Qe,classNamePrefix:"em-mob-border_"+Ye+"-"}}},n.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:ro,mobileBorderRight:ro,mobileBorderTop:ro,mobileBorderBottom:ro,[ue]:Qe})}else{const ro=e.mobileBorder||{},uo=ko=>{const Bo=ro[ko];return Bo&&(Bo?.width||Bo?.style||Bo?.color)?Bo:null};Ie={mobileBorder:{all:null,left:Ye==="left"?co?null:{...Qe,classNamePrefix:"em-mob-border_left-"}:uo("left"),right:Ye==="right"?co?null:{...Qe,classNamePrefix:"em-mob-border_right-"}:uo("right"),top:Ye==="top"?co?null:{...Qe,classNamePrefix:"em-mob-border_top-"}:uo("top"),bottom:Ye==="bottom"?co?null:{...Qe,classNamePrefix:"em-mob-border_bottom-"}:uo("bottom")}},n.setFieldsValue({[ue]:Qe})}}break;case"width":Ie={[ue]:{value:w[ue],dim:y.widthDim}};break;case"height":Ie={[ue]:{value:w[ue],dim:y.heightDim}};break;case"widthDim":Ie={width:{value:y.width,dim:w[ue]}};break;case"heightDim":Ie={height:{value:y.height,dim:w[ue]}};break;case"backgroundImage":N(w[ue]===""),Ie={[ue]:[{...e.backgroundImage[0],value:w[ue]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Ie={padding:{left:y.paddingLeft,right:y.paddingRight,top:y.paddingTop,bottom:y.paddingBottom,[H.PADDING_POSITION[ue]]:+w[ue]}};break;case"paddingTopBottom":Ie={padding:{left:y.paddingLeft,right:y.paddingRight,top:+w[ue],bottom:+w[ue]}},y.paddingTop=y.paddingBottom=+w[ue];break;case"paddingLeftRight":Ie={padding:{top:y.paddingTop,bottom:y.paddingBottom,left:+w[ue],right:+w[ue]}},y.paddingLeft=y.paddingRight=+w[ue];break;case"borderRadiusAll":Ie={borderRadius:{[H.BORDER_RADIUS_POSITION[ue]]:+w[ue]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ie={borderRadius:{topLeft:y.borderRadiusTopLeft,bottomLeft:y.borderRadiusBottomLeft,topRight:y.borderRadiusTopRight,bottomRight:y.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[ue]]:+w[ue]}};break;case"mobileWidth":Ie={[ue]:{classNamePrefix:"em-mob-width-",value:w[ue],dim:y.mobileWidthDim}};break;case"mobileWidthDim":Ie={mobileWidth:{classNamePrefix:"em-mob-width-",value:y.mobileWidth||100,dim:w[ue]}};break;case"mobileHeight":Ie={[ue]:{classNamePrefix:"em-mob-height-",value:w[ue],dim:y.mobileHeightDim}};break;case"mobileHeightDim":Ie={mobileHeight:{classNamePrefix:"em-mob-height-",value:y.mobileHeight,dim:w[ue]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ie={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[ue]]:w[ue],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[ue]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ie={mobileBoxShadow:{hOffset:y.mobileBoxShadowHOffset,vOffset:y.mobileBoxShadowVOffset,blurRadius:y.mobileBoxShadowBlurRadius,spreadRadius:y.mobileBoxShadowSpreadRadius,color:y.mobileBoxShadowColor,inset:y.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Ie={[ue]:{classNamePrefix:"em-mob-text_align-",value:w[ue]}};break;case"mobileVerticalAlign":Ie={[ue]:{classNamePrefix:"em-mob-vertical_align-",value:w[ue]}};break;case"mobileDirection":Ie={[ue]:{classNamePrefix:"em-mob-direction-",value:w[ue]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ie=ht(w),!Ie)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Ie={mobilePadding:{all:null,top:y.mobilePaddingTop!==""?y.mobilePaddingTop:null,right:y.mobilePaddingRight!==""?y.mobilePaddingRight:null,bottom:y.mobilePaddingBottom!==""?y.mobilePaddingBottom:null,left:y.mobilePaddingLeft!==""?y.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":y.mobilePaddingTop=y.mobilePaddingBottom=w[ue],Ie={mobilePadding:{all:null,top:y.mobilePaddingTop!==""?y.mobilePaddingTop:null,right:y.mobilePaddingRight!==""?y.mobilePaddingRight:null,bottom:y.mobilePaddingBottom!==""?y.mobilePaddingBottom:null,left:y.mobilePaddingLeft!==""?y.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":y.mobilePaddingLeft=y.mobilePaddingRight=w[ue],Ie={mobilePadding:{all:null,top:y.mobilePaddingTop!==""?y.mobilePaddingTop:null,right:y.mobilePaddingRight!==""?y.mobilePaddingRight:null,bottom:y.mobilePaddingBottom!==""?y.mobilePaddingBottom:null,left:y.mobilePaddingLeft!==""?y.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":Ie={[ue]:isNaN(parseFloat(w[ue].position))?w[ue].position:w[ue].position+w[ue].unit};break;default:Ie=w}ue!=="borderPosition"&&ue!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ie}),ue!=="mobileBorderRadiusAll"&&ue!=="mobileBorderRadiusTopLeft"&&ue!=="mobileBorderRadiusTopRight"&&ue!=="mobileBorderRadiusBottomLeft"&&ue!=="mobileBorderRadiusBottomRight"&&Ae({...e,...Ie,mobileBorderRadius:{...e.mobileBorderRadius,...Ie?.mobileBorderRadius},activateSection:null,changeKey:ue}))},Ve=()=>{I(y=>!y);const w=n.getFieldsValue(!0);U||(w.paddingLeftRight=w.paddingLeft,w.paddingTopBottom=w.paddingTop,w.paddingRight=w.paddingLeft,w.paddingBottom=w.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:w.paddingTopBottom,bottom:w.paddingTopBottom,left:w.paddingLeftRight,right:w.paddingLeftRight}}}))},Ge=()=>{const w=n.getFieldsValue(!0);d.markBorderToggled(!z),setTimeout(()=>{le(y=>!y),z?(w.borderAll=H.NULL_BORDER,w.borderTop=H.NULL_BORDER,w.borderBottom=H.NULL_BORDER,w.borderRight=H.NULL_BORDER,w.borderLeft=H.NULL_BORDER):w.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:w.borderAll.color,style:w.borderAll.style,width:w.borderAll.width}}}})})},de=()=>{const w=n.getFieldsValue(!0);c.markBorderToggled(!C),setTimeout(()=>{re(y=>!y),C?(w.mobileBorderAll=H.NULL_BORDER,w.mobileBorderTop=H.NULL_BORDER,w.mobileBorderBottom=H.NULL_BORDER,w.mobileBorderRight=H.NULL_BORDER,w.mobileBorderLeft=H.NULL_BORDER):w.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:w.mobileBorderAll.color,style:w.mobileBorderAll.style,width:w.mobileBorderAll.width}}}})})},je=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{fe(y=>!y),ce?(w.borderRadiusAll=0,m(!0)):w.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:w.borderRadiusAll}}})})},G=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{se(y=>!y),Be?(w.mobileBorderRadiusAll=null,E(!0)):w.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:w.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},be=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{Pe(y=>!y),he?(w.boxShadowInset=!1,w.boxShadowHOffset=null,w.boxShadowVOffset=null,w.boxShadowBlurRadius=null,w.boxShadowSpreadRadius=null,w.boxShadowColor=""):(w.boxShadowInset=!1,w.boxShadowHOffset=5,w.boxShadowVOffset=5,w.boxShadowBlurRadius=10,w.boxShadowSpreadRadius=-5,w.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:w.boxShadowBlurRadius,color:w.boxShadowColor,hOffset:w.boxShadowHOffset,inset:w.boxShadowInset,spreadRadius:w.boxShadowSpreadRadius,vOffset:w.boxShadowVOffset}}})})},Le=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{De(y=>!y),pe?(w.mobileBoxShadowInset=!1,w.mobileBoxShadowHOffset=null,w.mobileBoxShadowVOffset=null,w.mobileBoxShadowBlurRadius=null,w.mobileBoxShadowSpreadRadius=null,w.mobileBoxShadowColor=""):(w.mobileBoxShadowInset=!1,w.mobileBoxShadowHOffset=5,w.mobileBoxShadowVOffset=5,w.mobileBoxShadowBlurRadius=10,w.mobileBoxShadowSpreadRadius=-5,w.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:w.mobileBoxShadowBlurRadius,color:w.mobileBoxShadowColor,hOffset:w.mobileBoxShadowHOffset,inset:w.mobileBoxShadowInset,spreadRadius:w.mobileBoxShadowSpreadRadius,vOffset:w.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},He=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{Ce(y=>!y),Oe&&(w.width="",w.height="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},Je=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{_e(y=>!y),ge&&(w.mobileWidth="",w.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},Ze=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{K(y=>!y),Q?(w.backgroundColor="",w.backgroundImage="",w.backgroundPositionX="",w.backgroundPositionY="",w.backgroundRepeat="none",w.backgroundSize="",N(!0)):(w.backgroundColor="#E5E5E5",w.backgroundSize="",w.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:w.backgroundColor,backgroundImage:[{type:"url",value:w.backgroundImage}],backgroundPositionX:w.backgroundPositionX,backgroundPositionY:w.backgroundPositionY,backgroundRepeat:w.backgroundRepeat,backgroundSize:w.backgroundSize}})})},so=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{Z(y=>!y),q?w.mobileBackgroundColor="":w.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:w.mobileBackgroundColor}}}),q&&Nt(n,e,l)})},O=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{M(y=>!y),V&&(w.exportAsPicture=!1,w.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},ae=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{X(y=>!y),Y&&(w.mobilePaddingLeftRight="",w.mobilePaddingLeft="",w.mobilePaddingRight="",w.mobilePaddingTopBottom="",w.mobilePaddingTop="",w.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsx)(t.ui_kit$Form,{form:n,layout:"vertical",name:"selected_td_form",initialValues:{horizontalPosition:"",horizontalUnit:"px",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",show:"all",borderPosition:H.BORDER_POSITIONS[ie]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[ye]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",boxShadowInset:"",boxShadowHOffset:"",boxShadowVOffset:"",boxShadowBlurRadius:"",boxShadowSpreadRadius:"",boxShadowColor:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1},onValuesChange:We,autoComplete:"off",className:"element-controls",children:x==="mobile"&&R.styles?(0,o.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:x==="mobile"&&R.styles?"flex":"none"},children:[(0,o.jsx)("div",{className:"selected_form-mobile-props-header",children:!$&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})})}),(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(al,{form:n,elementSettings:e,boxShadow:b,mobileBordersShow:C,mobileBorderRadiusShow:Be,mobileBoxShadowShow:pe,mobileSizeShow:ge,mobileBackgroundShow:q,mobilePaddingShow:Y,mobilePaddingsExt:L,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:T,setOneMobileBorderRadiusValue:E,toggleShowMobileBorderHandler:de,toggleShowMobileBorderRadiusHandler:G,toggleShowMobileBoxShadowHandler:Le,toggleShowMobileSizeHandler:Je,toggleShowMobileBackgroundHandler:so,toggleShowMobilePaddingHandler:ae})})]}):(0,o.jsxs)(o.Fragment,{children:[!$&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(sl,{form:n,elementSettings:e,boxShadow:b,bordersShow:z,borderRadiusShow:ce,boxShadowShow:he,backgroundShow:Q,backgroundImageEmpty:j,backgroundRepeatOptions:Se,sizeShow:Oe,maxWidthValue:p,modificationShow:V,paddingsExt:U,oneBorderRadiusValue:h,setOneBorderRadiusValue:m,elementListShow:oe,togglePaddingHandler:Ve,toggleShowBorderHandler:Ge,toggleShowBorderRadiusHandler:je,toggleShowBoxShadowHandler:be,toggleShowSizeHandler:He,toggleShowBackgroundHandler:Ze,toggleShowModificationHandler:O,handleChangeValues:We})})]})})};nl.propTypes={elementSettings:f.default.object.isRequired};var dl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,sizeShow:b,maxWidthValue:_,modificationShow:h,paddingShow:m,paddingsExt:T,oneBorderRadiusValue:E,setOneBorderRadiusValue:x,togglePaddingHandler:R,toggleShowPaddingHandler:j,toggleShowBorderHandler:N,toggleShowBorderRadiusHandler:B,toggleShowBoxShadowHandler:v,toggleShowSizeHandler:$,toggleShowBackgroundHandler:U,toggleShowModificationHandler:I,handleChangeValues:L})=>{const{__:P}=r.useI18n(),{token:z}=(0,t.ui_kit$useToken)(),le=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:P("Appearance on mobile devices"),type:"info"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(et,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Oo,{form:e,elementSettings:i})})]}),le.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Padding"),collapsible:!0,open:m,onToggle:j,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:T,onToggleExtended:R,labels:{horizontal:P("Horizontal padding"),vertical:P("Vertical padding"),left:P("Left padding"),right:P("Right padding"),top:P("Top padding"),bottom:P("Bottom padding"),individual:P("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:P("Size"),collapsible:!0,open:b,onToggle:$,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:_,dimensionSelect:No,showMinMax:!0,minWidthDimensionSelect:No,maxWidthDimensionSelect:No,labels:{width:P("Width"),height:P("Height"),minWidth:P("Minimum width"),maxWidth:P("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:P("Background"),collapsible:!0,open:c,onToggle:U,dividerTop:!0,children:[(0,o.jsx)(wi,{form:e,backgroundImageEmpty:p,appConfig:le,token:z,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:L}),(0,o.jsx)(ot,{form:e,showBackground:!0})]}),le.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Borders"),collapsible:!0,open:s,onToggle:N,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),le.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Border radius"),collapsible:!0,open:n,onToggle:B,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:E,setOneBorderRadiusValue:x,elementSettings:i})}),le.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Box shadow"),collapsible:!0,open:d,onToggle:v,dividerTop:!0,children:(0,o.jsx)(jo,{})}),le.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Export settings"),collapsible:!0,open:h,onToggle:I,dividerTop:!0,children:(0,o.jsx)(Ti,{form:e,elementSettings:i})}),le.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Lt,{elementSettings:i,form:e})})}),le.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};dl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,sizeShow:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),modificationShow:f.default.bool,paddingShow:f.default.bool,paddingsExt:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,togglePaddingHandler:f.default.func,toggleShowPaddingHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func,handleChangeValues:f.default.func};var cl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:g,mobilePaddingsExt:b,setMobilePaddingsExt:_,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:m,toggleShowMobileBorderHandler:T,toggleShowMobileBorderRadiusHandler:E,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:R,toggleShowMobileBackgroundHandler:j,toggleShowMobilePaddingHandler:N})=>{const{__:B}=r.useI18n(),{token:v}=(0,t.ui_kit$useToken)(),$=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Ct,{form:e,elementSettings:i,imgParent:!0})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Oo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),$.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Padding"),collapsible:!0,open:g,onToggle:N,dividerTop:!0,children:(0,o.jsx)($t,{form:e,elementSettings:i,mobilePaddingsExt:b,setMobilePaddingsExt:_})}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Size"),collapsible:!0,open:c,onToggle:R,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:v.formItemMarginBottomXS*2},children:(0,o.jsx)(Ho,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:v.formItemMarginBottomXS},children:(0,o.jsx)(Zo,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:p,onToggle:j,dividerTop:!0,children:(0,o.jsx)(gt,{elementSettings:Uo(i),imageEnabled:$.formDivFieldBackgroundImageEnabled,desktopBackground:bt(i)})}),$.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:s,onToggle:T,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),$.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:n,onToggle:E,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:m,elementSettings:i})}),$.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),$.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Lt,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),$.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};cl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,mobileBoxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};var ul=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Lo(),d=Lo(),[c,p]=(0,a.useState)({}),[g,b]=(0,a.useState)(!0),[_,h]=(0,a.useState)({}),[m,T]=(0,a.useState)(!0),E=r.useSelector(r.selectEmailViewType),x=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[R,j]=(0,a.useState)(e.backgroundImage[0].value===""),N=r.useSelector(r.selectIsCodeMode),B=r.useSelector(r.selectCodeModeDirection),v=N&&B!=="bottom",[$,U]=(0,a.useState)(!1),[I,L]=(0,a.useState)(!1),[P,z]=(0,a.useState)(!1),[le,C]=(0,a.useState)(!1),[re,ce]=(0,a.useState)(!1),[fe,Be]=(0,a.useState)(!1),[se,he]=(0,a.useState)(!1),[Pe,pe]=(0,a.useState)(!1),[De,Oe]=(0,a.useState)(!1),[Ce,ge]=(0,a.useState)(!1),[_e,Q]=(0,a.useState)(!1),[K,q]=(0,a.useState)(!1),[Z,V]=(0,a.useState)(!1),[M,Y]=(0,a.useState)(!1),[X,oe]=(0,a.useState)(!1),[me,Te]=(0,a.useState)(""),Se=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}];i("Not defined"),i("Contain"),i("Cover");const te=e.border,D=e.mobileBorder,ie=Object.keys(te).find(O=>te[O]?.width||te[O]?.style||te[O]?.color),ye=Object.keys(D).find(O=>D[O]?.width||D[O]?.style||D[O]?.color),W=O=>O&&(O?.width||O?.style||O?.color)?O:"";(0,a.useEffect)(()=>{if(e){const O=e.boxShadow,ae=e.mobileBoxShadow;p(O),h(ae),s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:W(e.mobileBorder.all)||!(W(e.mobileBorder.top)||W(e.mobileBorder.bottom)||W(e.mobileBorder.right)||W(e.mobileBorder.left))&&W(e.border.all),mobileBorderTop:W(e.mobileBorder.top)||!W(e.mobileBorder.all)&&W(e.border.top),mobileBorderBottom:W(e.mobileBorder.bottom)||!W(e.mobileBorder.all)&&W(e.border.bottom),mobileBorderRight:W(e.mobileBorder.right)||!W(e.mobileBorder.all)&&W(e.border.right),mobileBorderLeft:W(e.mobileBorder.left)||!W(e.mobileBorder.all)&&W(e.border.left),paddingTop:u(e.padding.all)||u(e.padding.top),paddingLeft:u(e.padding.all)||u(e.padding.left),paddingRight:u(e.padding.all)||u(e.padding.right),paddingBottom:u(e.padding.all)||u(e.padding.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:bo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:bo(e.mobileHeight?.value),mobileHeightDim:e.mobileHeight?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileAlign:u(e.mobileAlign?.value),mobileVerticalAlign:u(e.mobileVerticalAlign?.value),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...tt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?b(!1):b(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?T(!1):T(!0),j(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?U(!1):U(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)?L(!1):L(!0);const w=n.isStaleBorderSnapshot(e,!!ie),y=d.isStaleBorderSnapshot(e,!!ye);w&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(y||w&&!ye)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),z(ue=>ie&&!w?!0:ue),C(ue=>ie&&!w||ye&&!y?!0:ue),ce(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Be(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),he(!!e.boxShadow),pe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),Oe(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),ge(!!e.mobileWidth.value||!!e.mobileHeight.value),Q(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),q(At(e)),V(!!e.exportAsPicture),Y(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),oe(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[s,e,ie,ye,n,d]);const Re=O=>{const ae=s.getFieldsValue(!0),w=Object.keys(O)[0];let y;switch(Te(s.getFieldsValue(!0).widthDim==="%"?100:""),w){case"exportAsPicture":y={exportAsPicture:ae.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":y={boxShadow:{hOffset:ae.boxShadowHOffset,vOffset:ae.boxShadowVOffset,blurRadius:ae.boxShadowBlurRadius,spreadRadius:ae.boxShadowSpreadRadius,color:ae.boxShadowColor,inset:ae.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ae.borderPosition==="borderAll"?(y={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...ae.borderAll}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):ae.borderAll?.width||ae.borderAll?.style||ae.borderAll?.color?(y={border:{all:null,left:ae.borderAll,right:ae.borderAll,top:ae.borderAll,bottom:ae.borderAll,[H.REVERSE_BORDER_POSITIONS[w]]:{...ae[w],...O[w]}}},s.setFieldsValue({borderAll:null,borderLeft:ae.borderAll,borderRight:ae.borderAll,borderTop:ae.borderAll,borderBottom:ae.borderAll,[w]:{...ae[w],...O[w]}})):(y={border:{all:null,left:ae.borderLeft,right:ae.borderRight,top:ae.borderTop,bottom:ae.borderBottom,[H.REVERSE_BORDER_POSITIONS[w]]:{...ae[w],...O[w]}}},s.setFieldsValue({border:y.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ae.mobileBorderPosition==="mobileBorderAll")y={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...ae.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[w]+"-"}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const ue=H.MOBILE_REVERSE_BORDER_POSITIONS[w],Ie={...ae[w],...O[w]},Ye=!Ie?.width&&!Ie?.style&&!Ie?.color;if(ae.mobileBorder?.all?.width||ae.mobileBorder?.all?.style||ae.mobileBorder?.all?.color){const Qe=ae.mobileBorderAll;y={mobileBorder:{all:null,left:Qe,right:Qe,top:Qe,bottom:Qe,[ue]:Ye?null:{...Ie,classNamePrefix:"em-mob-border_"+ue+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Qe,mobileBorderRight:Qe,mobileBorderTop:Qe,mobileBorderBottom:Qe,[w]:Ie})}else{const Qe=e.mobileBorder||{},co=ro=>{const uo=Qe[ro];return uo&&(uo?.width||uo?.style||uo?.color)?uo:null};y={mobileBorder:{all:null,left:ue==="left"?Ye?null:{...Ie,classNamePrefix:"em-mob-border_left-"}:co("left"),right:ue==="right"?Ye?null:{...Ie,classNamePrefix:"em-mob-border_right-"}:co("right"),top:ue==="top"?Ye?null:{...Ie,classNamePrefix:"em-mob-border_top-"}:co("top"),bottom:ue==="bottom"?Ye?null:{...Ie,classNamePrefix:"em-mob-border_bottom-"}:co("bottom")}},s.setFieldsValue({[w]:Ie})}}break;case"width":y={[w]:{value:O[w],dim:ae.widthDim}};break;case"height":y={[w]:{value:O[w],dim:ae.heightDim}};break;case"widthDim":y={width:{value:ae.width,dim:O[w]}};break;case"heightDim":y={height:{value:ae.height,dim:O[w]}};break;case"maxWidth":y={[w]:{value:O[w],dim:ae.maxWidthDim}};break;case"maxWidthDim":y={maxWidth:{value:ae.maxWidth,dim:O[w]}};break;case"minWidth":y={[w]:{value:O[w],dim:ae.minWidthDim}};break;case"minWidthDim":y={minWidth:{value:ae.minWidth,dim:O[w]}};break;case"backgroundImage":j(O[w]===""),y={[w]:[{...e.backgroundImage[0],value:O[w]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":y={padding:{[H.PADDING_POSITION[w]]:+O[w]}};break;case"paddingTopBottom":y={padding:{top:+O[w],bottom:+O[w]}},ae.paddingTop=ae.paddingBottom=+O[w];break;case"paddingLeftRight":y={padding:{left:+O[w],right:+O[w]}},ae.paddingLeft=ae.paddingRight=+O[w];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":y={borderRadius:{[H.BORDER_RADIUS_POSITION[w]]:+O[w]}};break;case"mobileWidth":y={[w]:{classNamePrefix:"em-mob-width-",value:O[w],dim:ae.mobileWidthDim}};break;case"mobileWidthDim":y={mobileWidth:{classNamePrefix:"em-mob-width-",value:ae.mobileWidth||100,dim:O[w]}};break;case"mobileHeight":y={[w]:{classNamePrefix:"em-mob-height-",value:O[w],dim:ae.mobileHeightDim}};break;case"mobileHeightDim":y={mobileHeight:{classNamePrefix:"em-mob-height-",value:ae.mobileHeight,dim:O[w]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":y={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[w]]:O[w],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[w]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":y={mobileBoxShadow:{hOffset:ae.mobileBoxShadowHOffset,vOffset:ae.mobileBoxShadowVOffset,blurRadius:ae.mobileBoxShadowBlurRadius,spreadRadius:ae.mobileBoxShadowSpreadRadius,color:ae.mobileBoxShadowColor,inset:ae.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":y={[w]:{classNamePrefix:"em-mob-text_align-",value:O[w]}};break;case"mobileVerticalAlign":y={[w]:{classNamePrefix:"em-mob-vertical_align-",value:O[w]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(y=ht(O),!y)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":y={mobilePadding:{all:null,top:ae.mobilePaddingTop!==""?ae.mobilePaddingTop:null,right:ae.mobilePaddingRight!==""?ae.mobilePaddingRight:null,bottom:ae.mobilePaddingBottom!==""?ae.mobilePaddingBottom:null,left:ae.mobilePaddingLeft!==""?ae.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":ae.mobilePaddingTop=ae.mobilePaddingBottom=O[w],y={mobilePadding:{all:null,top:ae.mobilePaddingTop!==""?ae.mobilePaddingTop:null,right:ae.mobilePaddingRight!==""?ae.mobilePaddingRight:null,bottom:ae.mobilePaddingBottom!==""?ae.mobilePaddingBottom:null,left:ae.mobilePaddingLeft!==""?ae.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":ae.mobilePaddingLeft=ae.mobilePaddingRight=O[w],y={mobilePadding:{all:null,top:ae.mobilePaddingTop!==""?ae.mobilePaddingTop:null,right:ae.mobilePaddingRight!==""?ae.mobilePaddingRight:null,bottom:ae.mobilePaddingBottom!==""?ae.mobilePaddingBottom:null,left:ae.mobilePaddingLeft!==""?ae.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":y={[w]:{classNamePrefix:"em-mob-direction-",value:O[w]}};break;case"backgroundPositionX":case"backgroundPositionY":y={[w]:isNaN(parseFloat(O[w].position))?O[w].position:O[w].position+O[w].unit};break;default:y=O}w!=="borderPosition"&&w!=="mobileBorderPosition"&&l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:y})},$e=()=>{U(ae=>!ae);const O=s.getFieldsValue(!0);$||(O.paddingLeftRight=O.paddingLeft,O.paddingTopBottom=O.paddingTop,O.paddingRight=O.paddingLeft,O.paddingBottom=O.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:O.paddingTopBottom,bottom:O.paddingTopBottom,left:O.paddingLeftRight,right:O.paddingLeftRight}}}))},Ae=()=>{const O=s.getFieldsValue(!0);n.markBorderToggled(!P),setTimeout(()=>{z(ae=>!ae),P?(O.borderAll=H.NULL_BORDER,O.borderTop=H.NULL_BORDER,O.borderBottom=H.NULL_BORDER,O.borderRight=H.NULL_BORDER,O.borderLeft=H.NULL_BORDER):O.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:O.borderAll.color,style:O.borderAll.style,width:O.borderAll.width}}}})})},We=()=>{const O=s.getFieldsValue(!0);d.markBorderToggled(!le),setTimeout(()=>{C(ae=>!ae),le?(O.mobileBorderAll=H.NULL_BORDER,O.mobileBorderTop=H.NULL_BORDER,O.mobileBorderBottom=H.NULL_BORDER,O.mobileBorderRight=H.NULL_BORDER,O.mobileBorderLeft=H.NULL_BORDER):O.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:O.mobileBorderAll.color,style:O.mobileBorderAll.style,width:O.mobileBorderAll.width}}}})})},Ve=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{ce(ae=>!ae),re?(O.borderRadiusAll=0,b(!0)):O.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:O.borderRadiusAll}}})})},Ge=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Be(ae=>!ae),fe?(O.mobileBorderRadiusAll=null,T(!0)):O.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:O.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},de=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{he(ae=>!ae),se?(O.boxShadowInset=!1,O.boxShadowHOffset=null,O.boxShadowVOffset=null,O.boxShadowBlurRadius=null,O.boxShadowSpreadRadius=null,O.boxShadowColor=""):(O.boxShadowInset=!1,O.boxShadowHOffset=5,O.boxShadowVOffset=5,O.boxShadowBlurRadius=10,O.boxShadowSpreadRadius=-5,O.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:O.boxShadowBlurRadius,color:O.boxShadowColor,hOffset:O.boxShadowHOffset,inset:O.boxShadowInset,spreadRadius:O.boxShadowSpreadRadius,vOffset:O.boxShadowVOffset}}})})},je=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{pe(ae=>!ae),Pe?(O.mobileBoxShadowInset=!1,O.mobileBoxShadowHOffset=null,O.mobileBoxShadowVOffset=null,O.mobileBoxShadowBlurRadius=null,O.mobileBoxShadowSpreadRadius=null,O.mobileBoxShadowColor=""):(O.mobileBoxShadowInset=!1,O.mobileBoxShadowHOffset=5,O.mobileBoxShadowVOffset=5,O.mobileBoxShadowBlurRadius=10,O.mobileBoxShadowSpreadRadius=-5,O.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:O.mobileBoxShadowBlurRadius,color:O.mobileBoxShadowColor,hOffset:O.mobileBoxShadowHOffset,inset:O.mobileBoxShadowInset,spreadRadius:O.mobileBoxShadowSpreadRadius,vOffset:O.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},G=()=>{setTimeout(()=>{Oe(O=>!O)})},be=()=>{setTimeout(()=>{ge(O=>!O)})},Le=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Q(ae=>!ae),_e?(O.backgroundColor="",O.backgroundImage="",O.backgroundPositionX="",O.backgroundPositionY="",O.backgroundRepeat="none",O.backgroundSize="",j(!0)):(O.backgroundColor="#E5E5E5",O.backgroundSize="",O.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:O.backgroundColor,backgroundImage:[{type:"url",value:O.backgroundImage}],backgroundPositionX:O.backgroundPositionX,backgroundPositionY:O.backgroundPositionY,backgroundRepeat:O.backgroundRepeat,backgroundSize:O.backgroundSize}})})},He=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{q(ae=>!ae),K?O.mobileBackgroundColor="":O.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:O.mobileBackgroundColor}}}),K&&Nt(s,e,l)})},Je=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{V(ae=>!ae),Z&&(O.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},Ze=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Y(ae=>!ae),M&&(O.paddingLeftRight="",O.paddingLeft="",O.paddingRight="",O.paddingTopBottom="",O.paddingTop="",O.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},so=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{oe(ae=>!ae),X&&(O.mobilePaddingLeftRight="",O.mobilePaddingLeft="",O.mobilePaddingRight="",O.mobilePaddingTopBottom="",O.mobilePaddingTop="",O.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_div_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[ie]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[ye]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:""},onValuesChange:Re,autoComplete:"off",className:"element-controls",children:[!v&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),E==="mobile"&&x.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(cl,{form:s,elementSettings:e,mobileBoxShadow:_,mobileBordersShow:le,mobileBorderRadiusShow:fe,mobileBoxShadowShow:Pe,mobileSizeShow:Ce,mobileBackgroundShow:K,mobilePaddingShow:X,mobilePaddingsExt:I,setMobilePaddingsExt:L,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:T,toggleShowMobileBorderHandler:We,toggleShowMobileBorderRadiusHandler:Ge,toggleShowMobileBoxShadowHandler:je,toggleShowMobileSizeHandler:be,toggleShowMobileBackgroundHandler:He,toggleShowMobilePaddingHandler:so})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(dl,{form:s,elementSettings:e,boxShadow:c,bordersShow:P,borderRadiusShow:re,boxShadowShow:se,backgroundShow:_e,backgroundImageEmpty:R,backgroundRepeatOptions:Se,sizeShow:De,maxWidthValue:me,modificationShow:Z,paddingShow:M,paddingsExt:$,oneBorderRadiusValue:g,setOneBorderRadiusValue:b,togglePaddingHandler:$e,toggleShowPaddingHandler:Ze,toggleShowBorderHandler:Ae,toggleShowBorderRadiusHandler:Ve,toggleShowBoxShadowHandler:de,toggleShowSizeHandler:G,toggleShowBackgroundHandler:Le,toggleShowModificationHandler:Je,handleChangeValues:Re})})]})};ul.propTypes={elementSettings:f.default.object.isRequired};var ml=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Float block width"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Float block width"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:No})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Column gap"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Column gap"),prefix:(0,o.jsx)(r.EmIcons,{icon:"SplitCellsOutlined",component:t.icons$SplitCellsOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:fn})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Vertical alignment"),dividerTop:!0,children:(0,o.jsx)(Oo,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};ml.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var pl=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Ho,{form:e,name:"mobileWidth",elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Alignments"),dividerTop:!0,children:(0,o.jsx)(Oo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};pl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var ji=0,hl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=r.useSelector(r.selectEmailViewType),d=r.useSelector(r.selectMobileViewActive),c=r.useSelector(r.selectIsCodeMode),p=r.useSelector(r.selectCodeModeDirection),g=c&&p!=="bottom";(0,a.useEffect)(()=>{e&&(s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,gap:e.gap?.value,gapDim:e.gap?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,show:e.show?e.show:"all",mobileWidth:bo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:bo(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),ji=e.width.value+e.gap.value)},[s,e]);const b=_=>{const h=s.getFieldsValue(!0),m=Object.keys(_)[0];let T;switch(m){case"width":ji=_[m]+h.gap,T={[m]:{value:_[m],dim:h.widthDim},gap:{value:h.gap}};break;case"widthDim":T={width:{value:h.width,dim:_[m]},gap:{value:h.gap}};break;case"gap":h.width=ji-_[m],T={[m]:{value:_[m],dim:"px"}};break;case"mobileWidth":T={[m]:{classNamePrefix:"em-mob-width-",value:_[m],dim:h.mobileWidthDim}};break;case"mobileWidthDim":T={mobileWidth:{classNamePrefix:"em-mob-width-",value:h.mobileWidth||100,dim:_[m]}};break;case"mobileContentWidth":T={[m]:{classNamePrefix:"em-mob-width-",value:_[m],dim:h.mobileContentWidthDim}};break;case"mobileContentWidthDim":T={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:_[m]}};break;case"mobileVerticalAlign":T={[m]:{classNamePrefix:"em-mob-vertical_align-",value:_[m]}};break;default:T=_}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:T})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:b,autoComplete:"off",className:"element-controls",children:[!g&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),n==="mobile"&&d.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:n==="mobile"&&d.styles?"block":"none"},children:(0,o.jsx)(pl,{form:s,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ml,{form:s,elementSettings:e})})]})};hl.propTypes={elementSettings:f.default.object.isRequired};var bl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,bordersShow:n,borderRadiusShow:d,boxShadowShow:c,backgroundShow:p,backgroundImageEmpty:g,backgroundRepeatOptions:b,paddingShow:_,paddingsExt:h,maxWidthValue:m,oneBorderRadiusValue:T,setOneBorderRadiusValue:E,linkProtocol:x,linkTarget:R,isOpenTextReplacer:j,textReplacerButtonRef:N,textReplacerInputRef:B,handleLinkProtocolsChange:v,handleSelect:$,textReplacerInputHandler:U,handleTextReplacerKeyDown:I,srcButtonHandler:L,togglePaddingHandler:P,toggleShowPaddingHandler:z,toggleShowBackgroundHandler:le,toggleShowBorderHandler:C,toggleShowBorderRadiusHandler:re,toggleShowBoxShadowHandler:ce,setLinkProtocol:fe,handleChangeValues:Be})=>{const{__:se}=r.useI18n(),{token:he}=(0,t.ui_kit$useToken)(),Pe=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:se("Appearance on mobile devices"),type:"info"}),(0,o.jsxs)("div",{className:"selected_form-props-wrapper",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Do,{form:e,elementSettings:l})}),Pe.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(et,{form:e,name:"textAlign",elementSettings:l})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(Jo,{show:x==="#",__:se,style:{marginBottom:he.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:se("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:Pe.formButtonFieldReplacerEnabled?he.formItemMarginBottomXS:he.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(qo,{linkProtocol:x,handleLinkProtocolsChange:v,__:se}),placeholder:se("Hyperlink URL"),allowClear:!0,onSelect:$,prefix:(0,o.jsx)(Ko,{linkProtocol:x})})})}),x==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:he.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:se("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:he.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:se("Body")})})]}),Pe.formButtonFieldReplacerEnabled&&(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:se("Text replacer"),placement:"bottom",getPopupContainer:pe=>pe.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":j}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:L,ref:N})})}),(0,o.jsx)(t.ui_kit$Col,{span:21,children:j&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:se("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:se("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:se("Text")}),onChange:U,onKeyDown:I,ref:B,onSelect:$})})})})]})}),Pe.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Padding"),collapsible:!0,open:_,onToggle:z,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:P,gutter:he.marginSM,labels:{horizontal:se("Horizontal padding"),vertical:se("Vertical padding"),left:se("Left padding"),right:se("Right padding"),top:se("Top padding"),bottom:se("Bottom padding"),individual:se("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:se("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:m,dimensionSelect:No,gutter:he.marginSM,labels:{width:se("Width"),height:se("Height"),minWidth:se("Minimum width"),maxWidth:se("Maximum width")}})}),(0,o.jsx)(pt,{form:e,fillFields:i,elementSettings:l,showAddParagraph:!1,isButton:!0,setLinkProtocol:fe,linkProtocol:x,linkTarget:R}),(0,o.jsxs)(t.ui_kit$FormSection,{title:se("Background"),collapsible:!0,open:p,onToggle:le,dividerTop:!0,children:[(0,o.jsx)(wi,{form:e,backgroundImageEmpty:g,appConfig:Pe,token:he,elementSettings:l,backgroundRepeatOptions:b,handleChangeValues:Be}),(0,o.jsx)(ot,{form:e,showBackground:!0})]}),Pe.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Borders"),collapsible:!0,open:n,onToggle:C,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:l})}),Pe.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:se("Border radius"),collapsible:!0,open:d,onToggle:re,dividerTop:!0,children:[(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:T,setOneBorderRadiusValue:E,elementSettings:l}),(0,o.jsx)(ot,{form:e,showRounding:!0})]}),Pe.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Box shadow"),collapsible:!0,open:c,onToggle:ce,dividerTop:!0,children:(0,o.jsx)(jo,{})}),Pe.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:l,form:e})}),Pe.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})]})};bl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,paddingShow:f.default.bool,paddingsExt:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,linkProtocol:f.default.string,linkTarget:f.default.object,isOpenTextReplacer:f.default.bool,textReplacerButtonRef:f.default.object,textReplacerInputRef:f.default.object,handleLinkProtocolsChange:f.default.func,handleSelect:f.default.func,textReplacerInputHandler:f.default.func,handleTextReplacerKeyDown:f.default.func,srcButtonHandler:f.default.func,togglePaddingHandler:f.default.func,toggleShowPaddingHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,setLinkProtocol:f.default.func,handleChangeValues:f.default.func};var gl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,mobileBackgroundShow:g,mobilePaddingShow:b,mobilePaddingsExt:_,setMobilePaddingsExt:h,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:T,linkProtocol:E,handleLinkProtocolsChange:x,setLinkProtocol:R,toggleShowMobileBorderHandler:j,toggleShowMobileBorderRadiusHandler:N,toggleShowMobileBoxShadowHandler:B,toggleShowMobileSizeHandler:v,toggleShowMobileBackgroundHandler:$,toggleShowMobilePaddingHandler:U})=>{const{__:I}=r.useI18n(),{token:L}=(0,t.ui_kit$useToken)(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Do,{form:e,elementSettings:l,imgParent:!0,typeOfForm:"mobile"})}),P.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Ct,{form:e,name:"mobileTextAlign",elementSettings:l,imgParent:!0})})]}),!!l.showOnMobile&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(Jo,{show:E==="#",__:I,style:{marginBottom:L.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:I("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:E==="mailto:"?L.formItemMarginBottomXS:L.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(qo,{linkProtocol:E,handleLinkProtocolsChange:x,__:I}),placeholder:I("Hyperlink URL"),allowClear:!0,prefix:(0,o.jsx)(Ko,{linkProtocol:E})})})}),E==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:I("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:L.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:I("Body")})})]})]}),!!l.showOnMobile&&(0,o.jsx)(pt,{form:e,fillFields:i,elementSettings:l,setLinkProtocol:R,linkProtocol:E,showAddParagraph:!1,isButton:!0}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Mr,{})})}),P.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Padding"),collapsible:!0,open:b,onToggle:U,dividerTop:!0,children:(0,o.jsx)($t,{form:e,elementSettings:l,mobilePaddingsExt:_,setMobilePaddingsExt:h})}),(0,o.jsx)(t.ui_kit$FormSection,{title:I("Size"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,bodyStyle:{paddingBottom:L.formItemMarginBottomMD},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:I("Width"),placement:"bottom",children:(0,o.jsx)(Ho,{form:e,name:"mobileWidth",elementSettings:l})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:I("Height"),placement:"bottom",children:(0,o.jsx)(Zo,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:I("Background"),collapsible:!0,open:g,onToggle:$,dividerTop:!0,bodyStyle:{paddingBottom:L.formItemMarginBottomMD},children:(0,o.jsx)(gt,{elementSettings:Uo(l),imageEnabled:P.formButtonFieldBackgroundImageEnabled,desktopBackground:bt(l)})}),P.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Borders"),collapsible:!0,open:n,onToggle:j,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Border radius"),collapsible:!0,open:d,onToggle:N,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:m,setOneBorderRadiusValue:T,elementSettings:l,typeOfForm:"mobile"})}),P.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Box shadow"),collapsible:!0,open:c,onToggle:B,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),P.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})}),P.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(vo,{})})]})};gl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,linkProtocol:f.default.string,handleLinkProtocolsChange:f.default.func,setLinkProtocol:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};var Wn=Object.freeze({}),fl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Lo(),d=Lo(),c=r.useDispatch(),[p,g]=(0,a.useState)({}),[b,_]=(0,a.useState)(!0),[h,m]=(0,a.useState)(!0),T=r.useSelector(r.selectEmailViewType),E=r.useSelector(r.selectMobileViewActive),[x,R]=(0,a.useState)(e.backgroundImage?.[0].value===""),j=r.useSelector(r.selectIsCodeMode),N=r.useSelector(r.selectCodeModeDirection),B=j&&N!=="bottom",v=(0,a.useRef)(null),$=(0,a.useRef)(null),[U,I]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),[z,le]=(0,a.useState)(!1),[C,re]=(0,a.useState)(!1),[ce,fe]=(0,a.useState)(!1),[Be,se]=(0,a.useState)(!1),[he,Pe]=(0,a.useState)(!1),[pe,De]=(0,a.useState)(!1),[Oe,Ce]=(0,a.useState)(!1),[ge,_e]=(0,a.useState)(!1),[Q,K]=(0,a.useState)(!1),[q,Z]=(0,a.useState)(!1),[V,M]=(0,a.useState)(!1),[Y,X]=(0,a.useState)(""),[oe,me]=(0,a.useState)("https://"),[Te,Se]=(0,a.useState)({}),te=e,[D,ie]=(0,a.useState)(!!te.textReplacer?.length),[ye,W]=(0,a.useState)(e);e!==ye&&(W(e),ie(!!te.textReplacer?.length));const Re=r.useElementEntityKind(),$e=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],Ae=e.border,We=e.mobileBorder,Ve=Object.keys(Ae).find(F=>Ae[F]?.width||Ae[F]?.style||Ae[F]?.color),Ge=Object.keys(We).find(F=>We[F]?.width||We[F]?.style||We[F]?.color),de=F=>F&&(F?.width||F?.style||F?.color)?F:"",{remember:je,fillFields:G}=st(e);(0,a.useEffect)(()=>{if(e){const F=e.boxShadow||Wn,J=e.mobilePadding||{},we=e.mobileAlign||{};g(F);let ze="",Ee="",S=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const ne=vr(e.href);ze=ne.subject,Ee=ne.body,S=ne.baseEmail}Vo(e.href,me)}G(s,{...e,href:S,subject:ze,body:Ee,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,backgroundImage:e.backgroundImage?.[0].value,show:e.show?e.show:"all",textAlign:e.textAlign,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:de(e.mobileBorder.all)||!(de(e.mobileBorder.top)||de(e.mobileBorder.bottom)||de(e.mobileBorder.right)||de(e.mobileBorder.left))&&de(e.border.all),mobileBorderTop:de(e.mobileBorder.top)||!de(e.mobileBorder.all)&&de(e.border.top),mobileBorderBottom:de(e.mobileBorder.bottom)||!de(e.mobileBorder.all)&&de(e.border.bottom),mobileBorderRight:de(e.mobileBorder.right)||!de(e.mobileBorder.all)&&de(e.border.right),mobileBorderLeft:de(e.mobileBorder.left)||!de(e.mobileBorder.all)&&de(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:bo(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:bo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:bo(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:bo(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(we?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...tt(e),mobilePaddingTop:u(J.all)||u(J.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(J.all)||u(J.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(J.all)||u(J.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(J.all)||u(J.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(J.top)||u(J.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(J.left)||u(J.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Cr(e.mobileTextAlign,e.textAlign),exportAsPicture:e?.exportAsPicture,mobileFontSize:u(e.mobileFontSize?.value||e.fontSize)}),!u(e.borderRadius?.all)&&(u(e.borderRadius?.topLeft)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.topRight)||u(e.borderRadius?.bottomRight))?_(!1):_(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?m(!1):m(!0),R(e.backgroundImage?.[0].value===""),!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?I(!1):I(!0),!u(J.all)&&(u(J.top)||u(J.right)||u(J.bottom)||u(J.left))&&(J.top!==J.bottom||J.right!==J.left)||!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?P(!1):P(!0);const ee=n.isStaleBorderSnapshot(e,!!Ve),k=d.isStaleBorderSnapshot(e,!!Ge);ee&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(k||ee&&!Ge)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),le(ne=>Ve&&!ee?!0:ne),re(ne=>Ve&&!ee||Ge&&!k?!0:ne),fe(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),se(!!e.mobileBorderRadius?.all||!!e.mobileBorderRadius?.topLeft||!!e.mobileBorderRadius?.bottomLeft||!!e.mobileBorderRadius?.topRight||!!e.mobileBorderRadius?.bottomRight||!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),Pe(!!e.boxShadow),De(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),Ce(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),_e(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),K(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),At(e)&&K(!0),Z(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),M(!!e.mobilePadding?.all||!!e.mobilePadding?.top||!!e.mobilePadding?.bottom||!!e.mobilePadding?.left||!!e.mobilePadding?.right||!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right)}},[s,e,B,Ve,Ge,n,d,G]);const be=(0,a.useCallback)(F=>{je(F),c(Re==="email"?r.setElementSettings$1(F):r.setElementSettings(F))},[c,Re,je]),Le=F=>{const J=s.getFieldsValue(!0),we=Object.keys(F)[0];let ze;switch(X(s.getFieldsValue(!0).widthDim==="%"?100:""),we){case"exportAsPicture":ze={exportAsPicture:J.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":ze={boxShadow:{hOffset:J.boxShadowHOffset,vOffset:J.boxShadowVOffset,blurRadius:J.boxShadowBlurRadius,spreadRadius:J.boxShadowSpreadRadius,color:J.boxShadowColor,inset:J.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":J.borderPosition==="borderAll"?(ze={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...J.borderAll}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):J.borderAll?.width||J.borderAll?.style||J.borderAll?.color?(ze={border:{all:null,left:J.borderAll,right:J.borderAll,top:J.borderAll,bottom:J.borderAll,[H.REVERSE_BORDER_POSITIONS[we]]:{...J[we],...F[we]}}},s.setFieldsValue({borderAll:null,borderLeft:J.borderAll,borderRight:J.borderAll,borderTop:J.borderAll,borderBottom:J.borderAll,[we]:{...J[we],...F[we]}})):(ze={border:{all:null,left:J.borderLeft,right:J.borderRight,top:J.borderTop,bottom:J.borderBottom,[H.REVERSE_BORDER_POSITIONS[we]]:{...J[we],...F[we]}}},s.setFieldsValue({border:ze.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(J.mobileBorderPosition==="mobileBorderAll")ze={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...J.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[we]+"-"}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const ee=H.MOBILE_REVERSE_BORDER_POSITIONS[we],k={...J[we],...F[we]},ne=!k?.width&&!k?.style&&!k?.color;if(J.mobileBorder?.all?.width||J.mobileBorder?.all?.style||J.mobileBorder?.all?.color){const ve=J.mobileBorderAll;ze={mobileBorder:{all:null,left:ve,right:ve,top:ve,bottom:ve,[ee]:ne?null:{...k,classNamePrefix:"em-mob-border_"+ee+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:ve,mobileBorderRight:ve,mobileBorderTop:ve,mobileBorderBottom:ve,[we]:k})}else{const ve=e.mobileBorder||{},qe=Fe=>{const Eo=ve[Fe];return Eo&&(Eo?.width||Eo?.style||Eo?.color)?Eo:null};ze={mobileBorder:{all:null,left:ee==="left"?ne?null:{...k,classNamePrefix:"em-mob-border_left-"}:qe("left"),right:ee==="right"?ne?null:{...k,classNamePrefix:"em-mob-border_right-"}:qe("right"),top:ee==="top"?ne?null:{...k,classNamePrefix:"em-mob-border_top-"}:qe("top"),bottom:ee==="bottom"?ne?null:{...k,classNamePrefix:"em-mob-border_bottom-"}:qe("bottom")}},s.setFieldsValue({[we]:k})}}break;case"width":ze={[we]:{value:F[we],dim:J.widthDim}};break;case"height":ze={[we]:{value:F[we],dim:J.heightDim}};break;case"widthDim":ze={width:{value:J.width,dim:F[we]}};break;case"heightDim":ze={height:{value:J.height,dim:F[we]}};break;case"backgroundImage":R(F[we]===""),ze={[we]:[{...e.backgroundImage[0],value:F[we]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":ze={padding:{left:J.paddingLeft,right:J.paddingRight,top:J.paddingTop,bottom:J.paddingBottom,[H.PADDING_POSITION[we]]:+F[we]}};break;case"paddingTopBottom":ze={padding:{left:J.paddingLeft,right:J.paddingRight,top:+F[we],bottom:+F[we]}},J.paddingTop=J.paddingBottom=+F[we];break;case"paddingLeftRight":ze={padding:{top:J.paddingTop,bottom:J.paddingBottom,left:+F[we],right:+F[we]}},J.paddingLeft=J.paddingRight=+F[we];break;case"borderRadiusAll":ze={borderRadius:{[H.BORDER_RADIUS_POSITION[we]]:+F[we]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":ze={borderRadius:{topLeft:J.borderRadiusTopLeft,bottomLeft:J.borderRadiusBottomLeft,topRight:J.borderRadiusTopRight,bottomRight:J.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[we]]:+F[we]}};break;case"mobileWidth":ze={[we]:{classNamePrefix:"em-mob-width-",value:F[we],dim:J.mobileWidthDim}};break;case"mobileWidthDim":ze={mobileWidth:{classNamePrefix:"em-mob-width-",value:J.mobileWidth||100,dim:F[we]}};break;case"mobileHeight":ze={[we]:{classNamePrefix:"em-mob-height-",value:F[we],dim:J.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:F[we],dim:J.mobileHeightDim}};break;case"mobileHeightDim":ze={mobileHeight:{classNamePrefix:"em-mob-height-",value:J.mobileHeight,dim:F[we]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":ze={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[we]]:F[we],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[we]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":ze={mobileBoxShadow:{hOffset:J.mobileBoxShadowHOffset,vOffset:J.mobileBoxShadowVOffset,blurRadius:J.mobileBoxShadowBlurRadius,spreadRadius:J.mobileBoxShadowSpreadRadius,color:J.mobileBoxShadowColor,inset:J.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":ze={[we]:{classNamePrefix:"em-mob-table_align-",value:F[we]}};break;case"mobileTextAlign":ze={[we]:{classNamePrefix:"em-mob-text_align-",value:F[we]}};break;case"mobileVerticalAlign":ze={[we]:{classNamePrefix:"em-mob-vertical_align-",value:F[we]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(ze=ht(F),!ze)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":ze={mobilePadding:{all:null,top:J.mobilePaddingTop!==""?J.mobilePaddingTop:null,right:J.mobilePaddingRight!==""?J.mobilePaddingRight:null,bottom:J.mobilePaddingBottom!==""?J.mobilePaddingBottom:null,left:J.mobilePaddingLeft!==""?J.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":J.mobilePaddingTop=J.mobilePaddingBottom=F[we],ze={mobilePadding:{all:null,top:J.mobilePaddingTop!==""?J.mobilePaddingTop:null,right:J.mobilePaddingRight!==""?J.mobilePaddingRight:null,bottom:J.mobilePaddingBottom!==""?J.mobilePaddingBottom:null,left:J.mobilePaddingLeft!==""?J.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":J.mobilePaddingLeft=J.mobilePaddingRight=F[we],ze={mobilePadding:{all:null,top:J.mobilePaddingTop!==""?J.mobilePaddingTop:null,right:J.mobilePaddingRight!==""?J.mobilePaddingRight:null,bottom:J.mobilePaddingBottom!==""?J.mobilePaddingBottom:null,left:J.mobilePaddingLeft!==""?J.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":ze={[we]:{classNamePrefix:"em-mob-font_size-",value:F[we],dim:J.mobileFontSizeDim}};break;case"href":let Ee=Qo(F[we]);Ee!==F[we]&&(s.setFieldValue("href",Ee),J.href=Ee),Ee.startsWith("mailto:")?ze={[we]:ki(Ee,J.subject,J.body)}:ze={[we]:Ee},Vo(F[we],me);break;case"subject":case"body":const S=J.href||"";if(S.startsWith("mailto:")){const ee=we==="subject"?F[we]:J.subject,k=we==="body"?F[we]:J.body;ze={href:ki(S,ee,k)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":ze={[we]:isNaN(parseFloat(F[we].position))?F[we].position:F[we].position+F[we].unit};break;default:ze=F}we!=="borderPosition"&&we!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze}),we!=="mobileBorderRadiusAll"&&we!=="mobileBorderRadiusTopLeft"&&we!=="mobileBorderRadiusTopRight"&&we!=="mobileBorderRadiusBottomLeft"&&we!=="mobileBorderRadiusBottomRight"&&be({...e,...ze,mobileBorderRadius:{...e.mobileBorderRadius,...ze?.mobileBorderRadius},activateSection:null,changeKey:we}))},He=()=>{I(J=>!J);const F=s.getFieldsValue(!0);U||(F.paddingLeftRight=F.paddingLeft,F.paddingTopBottom=F.paddingTop,F.paddingRight=F.paddingLeft,F.paddingBottom=F.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:F.paddingTopBottom,bottom:F.paddingTopBottom,left:F.paddingLeftRight,right:F.paddingLeftRight}}}))},Je=()=>{const F=s.getFieldsValue(!0);n.markBorderToggled(!z),setTimeout(()=>{le(J=>!J),z?(F.borderAll=H.NULL_BORDER,F.borderTop=H.NULL_BORDER,F.borderBottom=H.NULL_BORDER,F.borderRight=H.NULL_BORDER,F.borderLeft=H.NULL_BORDER):F.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:F.borderAll.color,style:F.borderAll.style,width:F.borderAll.width}}}})})},Ze=()=>{const F=s.getFieldsValue(!0);d.markBorderToggled(!C),setTimeout(()=>{re(J=>!J),C?(F.mobileBorderAll=H.NULL_BORDER,F.mobileBorderTop=H.NULL_BORDER,F.mobileBorderBottom=H.NULL_BORDER,F.mobileBorderRight=H.NULL_BORDER,F.mobileBorderLeft=H.NULL_BORDER):F.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:F.mobileBorderAll.color,style:F.mobileBorderAll.style,width:F.mobileBorderAll.width}}}})})},so=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{fe(J=>!J),ce?(F.borderRadiusAll=0,_(!0)):F.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:F.borderRadiusAll}}})})},O=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{se(J=>!J),Be?(F.mobileBorderRadiusAll=null,m(!0)):F.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:F.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ae=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Pe(J=>!J),he?(F.boxShadowInset=!1,F.boxShadowHOffset=null,F.boxShadowVOffset=null,F.boxShadowBlurRadius=null,F.boxShadowSpreadRadius=null,F.boxShadowColor=""):(F.boxShadowInset=!1,F.boxShadowHOffset=5,F.boxShadowVOffset=5,F.boxShadowBlurRadius=10,F.boxShadowSpreadRadius=-5,F.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:F.boxShadowBlurRadius,color:F.boxShadowColor,hOffset:F.boxShadowHOffset,inset:F.boxShadowInset,spreadRadius:F.boxShadowSpreadRadius,vOffset:F.boxShadowVOffset}}})})},w=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{De(J=>!J),pe?(F.mobileBoxShadowInset=!1,F.mobileBoxShadowHOffset=null,F.mobileBoxShadowVOffset=null,F.mobileBoxShadowBlurRadius=null,F.mobileBoxShadowSpreadRadius=null,F.mobileBoxShadowColor=""):(F.mobileBoxShadowInset=!1,F.mobileBoxShadowHOffset=5,F.mobileBoxShadowVOffset=5,F.mobileBoxShadowBlurRadius=10,F.mobileBoxShadowSpreadRadius=-5,F.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:F.mobileBoxShadowBlurRadius,color:F.mobileBoxShadowColor,hOffset:F.mobileBoxShadowHOffset,inset:F.mobileBoxShadowInset,spreadRadius:F.mobileBoxShadowSpreadRadius,vOffset:F.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},y=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Ce(J=>!J),Oe&&(F.mobileWidth="",F.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},ue=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{_e(J=>!J),ge?(F.backgroundColor="",F.backgroundImage="",F.backgroundPositionX="",F.backgroundPositionY="",F.backgroundRepeat="none",F.backgroundSize="",R(!0)):(F.backgroundColor="#E5E5E5",F.backgroundSize="",F.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:F.backgroundColor,backgroundImage:[{type:"url",value:F.backgroundImage}],backgroundPositionX:F.backgroundPositionX,backgroundPositionY:F.backgroundPositionY,backgroundRepeat:F.backgroundRepeat,backgroundSize:F.backgroundSize}})})},Ie=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{K(J=>!J),Q?F.mobileBackgroundColor="":F.mobileBackgroundColor=e.commonStyles.buttons.backgroundColor||"#1C52DC",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:F.mobileBackgroundColor}}}),Q&&Nt(s,e,l)})},Ye=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Z(J=>!J),q&&(F.paddingLeftRight="",F.paddingLeft="",F.paddingRight="",F.paddingTopBottom="",F.paddingTop="",F.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Qe=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{M(J=>!J),V&&(F.mobilePaddingLeftRight="",F.mobilePaddingLeft="",F.mobilePaddingRight="",F.mobilePaddingTopBottom="",F.mobilePaddingTop="",F.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})},co=F=>{s.setFieldValue("href",F!=="mergetag"?F:""),me(F)},ro=(0,a.useCallback)(({target:F})=>{if(!F)return;const{selectionStart:J,selectionEnd:we}=F;Se(ze=>ze.target===F&&ze.selection?.start===J&&ze.selection?.end===we?ze:{target:F,selection:{start:J,end:we}})},[]),uo=F=>{F.target.value!==""&&$.current.classList.add("selected-td-form__button--active")},ko=()=>{ie(!D),D?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>v.current.focus())},Bo=F=>{const J=F.target,we=J.value,ze=J.selectionStart;if(ze===0&&F.key===" "){F.preventDefault();return}if(F.key===" "){if(ze!==we.length){F.preventDefault();return}we.endsWith(" ")&&F.preventDefault()}};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_button_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[Ve]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[Ge]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",href:"https://",subject:"",body:""},onValuesChange:Le,autoComplete:"off",className:"element-controls",children:[!B&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),B?(0,o.jsx)(Si,{form:s,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,o.jsx)(o.Fragment,{children:T==="mobile"&&E.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(gl,{form:s,fillFields:G,elementSettings:e,boxShadow:p,mobileBordersShow:C,mobileBorderRadiusShow:Be,mobileBoxShadowShow:pe,mobileSizeShow:Oe,mobileBackgroundShow:Q,mobilePaddingShow:V,mobilePaddingsExt:L,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:m,linkProtocol:oe,handleLinkProtocolsChange:co,setLinkProtocol:me,toggleShowMobileBorderHandler:Ze,toggleShowMobileBorderRadiusHandler:O,toggleShowMobileBoxShadowHandler:w,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:Ie,toggleShowMobilePaddingHandler:Qe})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(bl,{form:s,fillFields:G,elementSettings:e,boxShadow:p,bordersShow:z,borderRadiusShow:ce,boxShadowShow:he,backgroundShow:ge,backgroundImageEmpty:x,backgroundRepeatOptions:$e,paddingShow:q,paddingsExt:U,maxWidthValue:Y,oneBorderRadiusValue:b,setOneBorderRadiusValue:_,linkProtocol:oe,linkTarget:Te,isOpenTextReplacer:D,textReplacerButtonRef:$,textReplacerInputRef:v,handleLinkProtocolsChange:co,handleSelect:ro,textReplacerInputHandler:uo,handleTextReplacerKeyDown:Bo,srcButtonHandler:ko,togglePaddingHandler:He,toggleShowPaddingHandler:Ye,toggleShowBackgroundHandler:ue,toggleShowBorderHandler:Je,toggleShowBorderRadiusHandler:so,toggleShowBoxShadowHandler:ae,setLinkProtocol:me,handleChangeValues:Le})})})]})};fl.propTypes={elementSettings:f.default.object.isRequired};var _l=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useSendPostMessage();(0,a.useEffect)(()=>{e&&l.setFieldsValue({...e})},[l,e]);const n=d=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:d})};return(0,o.jsx)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_variable_form",initialValues:{value:""},onValuesChange:n,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Variable value"),name:"value",tooltip:{title:i("Type the output parameters of your platform. E.g., ")+"${Recipient.FirstName}",icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},style:{marginBottom:35},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:4,placeholder:i("Variable value")})})})};_l.propTypes={elementSettings:f.default.object.isRequired};function Gn(e,i){const l=`selected_${e}_form_images_`,s=i.startsWith(l)?l:`selected_${e}_form_`;return i.startsWith(s)?i.slice(s.length):i}function Yn(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function Xn(e,i,l){return(e??[]).map((s,n)=>n===i.index?{...s,[i.key]:l}:s)}function xl(e){return(e??[]).map((i,l)=>({...i,slideIndex:l}))}var kl=({elementSettings:e,setElementSettings:i,postfix:l="",form:s,handleSelect:n,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),g=r.useAppConfig(),b=r.useSendPostMessage(),_="src"+l,h="title"+l,m="alt"+l,T="link"+l,E="imgReplacer"+l,x=(0,a.useRef)(null),R=(0,a.useRef)(null),j=(0,a.useRef)(null),N=(0,a.useRef)(null),B=(0,a.useRef)(null),v=(0,a.useRef)(null),$=(0,a.useRef)(null),U=(0,a.useRef)(null),[I,L]=(0,a.useState)(""),[P,z]=(0,a.useState)(""),[le,C]=(0,a.useState)(""),[re,ce]=(0,a.useState)(!1),[fe,Be]=(0,a.useState)("https://"),se=(0,a.useRef)(!1),he=(0,a.useRef)(l);(0,a.useEffect)(()=>{l!==he.current&&(he.current=l,se.current=!1),z(e.images?.[m]),C(e.images?.[h]);const Z=e.images?.[T];L(Z||(se.current?"...":""))},[e,m,h,T,l]);const Pe=()=>{I?(se.current=!1,L(""),s.setFieldValue(T,""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[T]:""}})):(se.current=!0,L(x.current&&x.current.input.value?x.current.input.value:"..."),setTimeout(()=>{x.current.focus()}))},pe=Z=>{Z.target.value===""?L("..."):(R.current.classList.add("selected-td-form__button--active"),L(Z.target.value));const V=Z.target.value;Vo(V,Be)},De=()=>{P?(z(""),s.setFieldValue("alt",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[m]:""}})):(z(j.current&&j.current.input.value?j.current.input.value:"..."),setTimeout(()=>{j.current.focus()}))},Oe=Z=>{Z.target.value===""?z("..."):(N.current.classList.add("selected-td-form__button--active"),z(Z.target.value))},Ce=()=>{le?(C(!1),s.setFieldValue("title",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(C(B.current&&B.current.input.value?B.current.input.value:"..."),setTimeout(()=>{B.current.focus()}))},ge=()=>{ce(!re),re?(s.setFieldValue(E,""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[E]:""}})):setTimeout(()=>$.current.focus())},_e=Z=>{Z.target.value!==""&&U.current.classList.add("selected-td-form__button--active")},Q=Z=>{Z.target.value===""?C("..."):(v.current.classList.add("selected-td-form__button--active"),C(Z.target.value))},K=Z=>{s.setFieldValue("LinkName",Z!=="mergetag"?Z:""),Be(Z)},q=Z=>{const V=s.getFieldsValue(!0),M=+l.substring(1),Y=Object.keys(V?.images).reduce((oe,me)=>(me.includes(l)||(oe[me]=V[me]),oe),{}),X=e.carouselImages?.filter((oe,me)=>me!==M);i(oe=>({...oe,settings:{...oe.settings,carouselImages:xl(X)}})),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:X}}),s.setFieldsValue({images:Y})};return(0,o.jsxs)(o.Fragment,{children:[(e.type==="img"||e.type==="video"||e.type==="carousel")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(Ao,{form:s,label:c("Image path"),name:_,placeholder:c("Image path"),elementSettings:e,previewReloadSignal:d,tooltipTitle:""})}),(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:P||c("Alternative text"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!P}),onClick:De,ref:N,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),g.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:le||c("Tooltip text"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!le}),onClick:Ce,ref:v,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:I||c("Hyperlink URL"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!I}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:Pe,ref:R})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":re}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ge,ref:U})})]}),(0,o.jsx)(t.ui_kit$Space,{size:8,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:q,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!I||!!P||!!le||!!re)&&(0,o.jsxs)("div",{children:[!!I&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Jo,{show:fe==="#",__:c,style:{marginBottom:p.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:T,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(qo,{linkProtocol:fe,handleLinkProtocolsChange:K,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:x,onChange:pe,onSelect:n,prefix:(0,o.jsx)(Ko,{linkProtocol:fe})})})})]}),!!P&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:m,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Oe,ref:j,onSelect:n})})}),g.formFieldImageTitleEnabled&&!!le&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:Q,ref:B,onSelect:n})})}),!!re&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:E,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:_e,ref:$,onSelect:n})})})]})]})};kl.propTypes={};var El=({form:e,elementSettings:i,formFields:l,setElementSettings:s,borderRadiusShow:n,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:p,mergeTagItems:g,mergeMenuOpen:b,setMergeMenuOpen:_,cascaderRef:h,handleLinkProtocolsChange:m,handleSelect:T,onChange:E,filter:x,renderSearchOption:R,toggleShowBorderRadiusHandler:j,setNewSlide:N})=>{const{__:B}=r.useI18n(),{token:v}=(0,t.ui_kit$useToken)(),$=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Jo,{show:p==="#",__:B,style:{marginBottom:v.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:B("Link for all slides"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(qo,{linkProtocol:p,handleLinkProtocolsChange:m,__:B}),placeholder:B("Link for all slides"),allowClear:!0,onSelect:T,prefix:(0,o.jsx)(Ko,{linkProtocol:p})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),$.mergeTagsShow&&g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:v.formItemMarginBottomMD,marginTop:v.formItemMarginBottomMD},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:b?"none":"inline-flex"},onClick:()=>_(!0),children:B("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:h,classNames:{popup:{root:"merge-tags"}},options:g,placeholder:B("Start typing the title"),showSearch:{filter:x,render:R},spellCheck:"false",getPopupContainer:U=>U.closest(".email-pane__collapse-wrapper"),onChange:E,style:{display:b?"block":"none"},open:b,onKeyDown:U=>{U.key==="Escape"&&_(!1)}})]})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$Form.List,{name:"images",initialValue:l?.images,children:()=>(0,o.jsx)("div",{style:{paddingTop:v.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((U,I)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)(kl,{elementSettings:l,setElementSettings:s,postfix:"_"+I,form:e,handleSelect:T})},I))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:v.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{id:"add_slide_button",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),style:{width:"100%"},onClick:()=>N(),children:B("Add slide")})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginTop:v.formItemMarginBottomMD-10},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:v.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Loop",label:B("Loop"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:v.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Autoplay",label:B("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),$.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:n,onToggle:j,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};El.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,formFields:f.default.object,setElementSettings:f.default.func,borderRadiusShow:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,linkProtocol:f.default.string,mergeTagItems:f.default.array,mergeMenuOpen:f.default.bool,setMergeMenuOpen:f.default.func,cascaderRef:f.default.object,handleLinkProtocolsChange:f.default.func,handleSelect:f.default.func,onChange:f.default.func,filter:f.default.func,renderSearchOption:f.default.func,toggleShowBorderRadiusHandler:f.default.func,setNewSlide:f.default.func};var Bl=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("p",{children:e("No properties to edit.")})})};Bl.propTypes={};var Kn={loop:!1,autoplay:!1,borderRadiusAll:0,borderRadiusTopLeft:0,borderRadiusBottomLeft:0,borderRadiusTopRight:0,borderRadiusBottomRight:0,link:"https://",images:{},src_0:"",renderedHeight_0:0,renderedWidth_0:0,imgReplacer_0:"",title_0:"",alt_0:""};function qn(e){const i={...Ei(e)};return delete i.parent,delete i.path,delete i.nextElem,delete i.prevElem,i}var Sl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm();let s=r.useDispatch();r.useAppConfig();const n=r.useSendPostMessage(),d=r.useSendPostMessageEx(),{openImagePicker:c}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),[b,_]=(0,a.useState)(!0),[h,m]=(0,a.useState)(!0),[T,E]=(0,a.useState)(!1),[x,R]=(0,a.useState)(!1),[j,N]=(0,a.useState)("https://"),[B,v]=(0,a.useState)(l?.getFieldsValue(!0)),[$,U]=(0,a.useState)(e),{remember:I,isOwnEcho:L}=Or(qn),[P,z]=(0,a.useState)(e);e!==P&&(z(e),L(e?.settings)||U(e));const[le,C]=(0,a.useState)({name:"",counter:0}),[re,ce]=(0,a.useState)(null),[fe,Be]=(0,a.useState)(),[se,he]=(0,a.useState)(!1),[Pe,pe]=(0,a.useState)(!1),[De,Oe]=(0,a.useState)({start:0,end:0}),Ce=(0,a.useRef)(null),ge=`selected_${$.type}_form_link`,_e=r.useSelector(r.selectIsCodeMode),Q=r.useSelector(r.selectCodeModeDirection),K=_e&&Q!=="bottom";(0,a.useEffect)(()=>{se&&Ce.current&&Ce.current.focus()},[se]);const q=(W,Re)=>{const $e=document.getElementById(Re);if($e){const Ae=$,We=Gn(Ae.type,Re),Ve=Yn(We),Ge=$e.value?.substring(0,De.start),de=$e.value?.substring(De.end);let je={[We]:Ge+W+de};Ve?je={carouselImages:Xn(Ae.settings?.carouselImages,Ve,Ge+W+de)}:$.type===r.ELEMENT_TYPES.CAROUSEL&&ge===Re&&(je={[We]:Ge+W+de,carouselImages:[...$.settings?.carouselImages.map(G=>({...G,link:Ge+W+de}))||[]]}),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,...je}}),U(G=>({...G,settings:{...G.settings,...je}})),l.setFieldValue(We,Ge+W+de),$e.focus(),setTimeout(()=>{$e.selectionStart=De.start,$e.selectionEnd=De.start+W.length},400),pe(!0)}},Z=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{Z?.items?.length&&Be(r.mapMargeTags(Z.items))},[Z,Be]);const V=(W,Re)=>{if(he(!1),W){const $e=Z.syntax.length>1?fe.findIndex(Ve=>Ve.key===Re[0].key):0,Ae=Z.syntax[$e].replace("%value%",W[W.length-1]),We=`selected_${$.type}_form${$.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Ve=>re?.getAttribute("id").includes(`${We}_${Ve}`))||re?.getAttribute("id").includes(ge)?q(Ae,re?.getAttribute("id")):(l.setFieldValue("imgReplacer",Ae),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,imgReplacer:Ae}}),U(Ve=>({...Ve,settings:{...Ve.settings,imgReplacer:Ae}})))}},M=r.useRootElement();(0,a.useEffect)(()=>{const W=({target:Ae})=>{Ae.closest('[id="merge_tags_wrapper"]')||ce(Ae)},Re=({target:Ae})=>{!Ae.closest(".merge-tags")&&!Ae.closest("#merge_tags_button")&&he(!1)},$e=new To.Disposable;return $e.addDisposable(r.addWindowListenerFromShadow(M,"focusin",W)),$e.addDisposable(r.addWindowListenerFromShadow(M,"click",Re)),()=>{$e.dispose()}},[M]);const Y=(W,Re)=>Re.some($e=>$e.label.toLowerCase().indexOf(W.toLowerCase())>-1),X=(W,Re)=>{const $e=Re.map((Ae,We)=>{const Ve=Ae.label.split(new RegExp(`(${W})`,"gi"));return(0,o.jsxs)("span",{children:[We!==0&&(0,o.jsx)("span",{children:" / "}),Ve.map((Ge,de)=>Ge.toLowerCase()===W.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Ge},de):Ge)]},Ae.value)});return(0,o.jsx)("div",{title:Re.map(Ae=>Ae.label).join(" / "),children:$e})};(0,a.useEffect)(()=>{const W=l?.getFieldsValue(!0);v(W)},[l]);const oe=({target:W})=>{if(W&&!Pe){const{selectionStart:Re,selectionEnd:$e}=W;Oe({start:Re,end:$e})}pe(!1)};(0,a.useEffect)(()=>{if($.settings){const W=$.settings,Re=Ei(W);l?.setFieldsValue(Re),v(Re),W.link&&N(vt(W.link,"https://")),u(W.borderRadius?.all)||(u(W.borderRadius?.topLeft)||u(W.borderRadius?.bottomLeft)||u(W.borderRadius?.topRight)||u(W.borderRadius?.bottomRight)?_(!1):u(W.borderRadius?.all)||_(!0)),u(W.mobileBorderRadius?.topLeft)||u(W.mobileBorderRadius?.bottomLeft)||u(W.mobileBorderRadius?.topRight)||u(W.mobileBorderRadius?.bottomRight)?m(!1):m(!0),E(!!W.borderRadius?.all||!!W.borderRadius?.topLeft||!!W.borderRadius?.bottomLeft||!!W.borderRadius?.topRight||!!W.borderRadius?.bottomRight),R(!!W.mobileBorderRadius?.all||!!W.mobileBorderRadius?.topLeft||!!W.mobileBorderRadius?.bottomLeft||!!W.mobileBorderRadius?.topRight||!!W.mobileBorderRadius?.bottomRight)}},[l,$]);const me=W=>{const Re=Pr($.settings,l,W);n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:Re.caption,settings:Re}),I({...$.settings,...Re}),U($e=>({...$e,settings:{...$e.settings,...Re}}))},Te=(W,Re)=>{const $e=r.stripEmVersionFromUrlString($.settings?.src||"")===r.stripEmVersionFromUrlString(W||"");(!$e||W!==$.settings?.src)&&me({src:W}),Re?.mode==="save"&&$e&&(C(Ae=>({name:"src",counter:Ae.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(W)}))},Se=async W=>{const Re=$.settings?.src||"",$e=r.stripEmVersionFromUrlString(Re),Ae=await c({kind:"img",currentUrl:mt($e)?"":$e,entryModal:W});Ae?.url&&Te(Ae.url,Ae.meta)},te=W=>{const Re=W.data.operation;Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Se(r.MODALS.UPLOAD_IMAGE_MODAL_AI):Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Se(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Se(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Se(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Se(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Re===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage(te);const D=()=>{setTimeout(()=>{E(W=>!W),l.setFieldValue("borderRadiusAll",T?0:5),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,borderRadius:{all:T?"":5}}}),U(W=>({...W,settings:{...W.settings,borderRadius:{all:T?null:5}}}))})},ie=W=>{l.setFieldValue("link",W!=="mergetag"?W:""),N(W)},ye=()=>{const{width:W,height:Re,renderedWidth:$e,renderedHeight:Ae}=$?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},We={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:W.value,dim:"px"},height:{value:Re.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:$e,renderedHeight:Ae,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},Ve=[...$?.settings?.carouselImages,We];n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,carouselImages:Ve}});const Ge=xl(Ve);U(de=>({...de,settings:{...de.settings,carouselImages:Ge}}))};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:Kn,onValuesChange:me,autoComplete:"off",className:"element-controls",children:[!K&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),p==="mobile"&&g.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(Bl,{})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(El,{form:l,elementSettings:$,formFields:B,setElementSettings:U,borderRadiusShow:T,oneBorderRadiusValue:b,setOneBorderRadiusValue:_,linkProtocol:j,mergeTagItems:fe,mergeMenuOpen:se,setMergeMenuOpen:he,cascaderRef:Ce,handleLinkProtocolsChange:ie,handleSelect:oe,onChange:V,filter:Y,renderSearchOption:X,toggleShowBorderRadiusHandler:D,setNewSlide:ye})})]})};Sl.propTypes={};var Jn={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Tl=({elementSettings:e})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),[s]=t.ui_kit$Form.useForm(),n=r.useSendPostMessage(),d=r.useAppConfig(),[c,p]=(0,a.useState)(e),[g,b]=(0,a.useState)(e);e!==g&&(b(e),p(e)),(0,a.useEffect)(()=>{if(c.settings){const T=c.settings,E=Ei(T);s?.setFieldsValue(E)}},[s,c]);const _=T=>{const E=Pr(c.settings,s,T);n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:E.caption,settings:E}),p(x=>({...x,settings:{...x.settings,...E}}))},h=()=>{p(T=>({...T,sections:c?.settings?.sections.push({expanded:!1})})),n({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_ADD_SECTION,settings:{section:i("Section title"),text:i("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")}})},m=T=>{p(E=>({...E,settings:{...E.settings,sections:c.settings.sections?.filter((x,R)=>R!==T)}})),n({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:T}})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Jn,onValuesChange:_,autoComplete:"off",className:"element-controls",children:(0,o.jsxs)("div",{id:"selected_element_form_desktop_props",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:15,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"expandSingleSection",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"ExpandSingleSection",label:i("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:9,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"animate",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"Animate",label:i("Animate"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsx)(t.ui_kit$Form.List,{name:"sections",children:()=>(0,o.jsx)("div",{style:{paddingTop:l.formItemMarginBottomMD+4},children:c?.settings?.sections?.map((T,E)=>(0,o.jsxs)(t.ui_kit$Row,{gutter:24,children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsxs)(t.ui_kit$Space,{size:10,align:"baseline",children:[(0,o.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(E+1)}),(0,o.jsx)(t.ui_kit$Form.Item,{name:`expanded_${E}`,valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:`expanded_${E}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,o.jsx)(t.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,o.jsx)(t.ui_kit$Button,{type:"text",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>m(E)})})]},`expanded_${E}`))})}),(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:l.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:d.iconStrokeWidth}),onClick:()=>h(),children:i(" Add section")})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};Tl.propTypes={};var{Text:Qn}=t.ui_kit$Typography,Zn="em",Rl="text/plain",ed=(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),od=(0,o.jsx)("span",{className:"addon-text-content",children:"Title"});function Po(e){return e.closest(".email-pane__collapse-wrapper")}function Ft({form:e,name:i,placeholder:l,usedColors:s,onColorChange:n}){const d=t.ui_kit$Form.useWatch(i,e);return(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l,usedColors:s,value:typeof d=="string"?d:"",onChange:c=>n(i,c)})}var td=/^[a-z][a-z0-9+.-]*:/i;function yl(e){const i=Qo(typeof e=="string"?e:String(e??""));return i?td.test(i)?i:`https://${i}`:""}function id(e){const i=typeof e=="string"?e.trim():String(e??"").trim();if(!i)return"";if(/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(i))return i;try{return new URL(i,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href}catch{return i}}function rd(e){const i=yl(e);if(!i)return!1;try{const l=new URL(i);return!(l.protocol!=="http:"&&l.protocol!=="https:"||!l.hostname)}catch{return!1}}async function wl(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&mt(e)){try{const l=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,s=await fetch(l);if(s.ok){const n=await s.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((d,c)=>{const p=new FileReader;p.onload=()=>d(p.result),p.onerror=c,p.readAsDataURL(n)})}}}catch{}return{entryModal:r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function ld(){const e=r.useSelector(r.selectEditorThemeColor$1),[i,l]=(0,a.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,a.useEffect)(()=>{const s=()=>l(document.body.classList.contains("dark"));s();const n=new MutationObserver(s);return n.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function sd(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function Mt(e,i,l){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(l??"").trim()}}function jl(e){const i=e?.settings||{};return JSON.stringify({type:e?.type??null,caption:e?.caption??null,parent:e?.parent??i.parent??null,path:i.path??null,blockIndex:i.blockIndex??null})}function Il(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(s=>s.customIcon?"":String(s?.itemBorderColor??"").trim()),l=i[0];return i.every(s=>s===l)?l:""}function Dt(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return s||l}function ad(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return!s||l&&s===l?"":s}function nd(e,i,l){const s=String(e??"").trim(),n=String(i??"").trim(),d=String(l??"").trim();return d&&(!s||d!==s)?d:n}function dd(e,i){return(e||[]).map(l=>({...l,itemBorderColor:l.customIcon?"":i}))}function cd(e,i,l){return(e||[]).map(s=>({...s,buttonBgColor:s.customIcon?"":nd(i,l,s.buttonBgColor)}))}function ud(e,i){if(e==null)return;const l=(s,n)=>{if(!n||!Object.prototype.hasOwnProperty.call(n,"platform"))return;const d=n.platform;d==null||d===""||i(s,d)};if(Array.isArray(e))e.forEach((s,n)=>{l(n,s)});else if(typeof e=="object")for(const s of Object.keys(e)){const n=Number.parseInt(s,10);Number.isNaN(n)||l(n,e[s])}}function vl({__:e,form:i,fieldName:l,pushSettingsToIframe:s,onMetaActiveChange:n}){const{token:d}=(0,t.ui_kit$useToken)(),c=t.ui_kit$Form.useWatch(["items",l],i),p=c&&typeof c=="object"?c:{},g=typeof p.alt=="string"?p.alt:"",b=typeof p.title=="string"?p.title:"",[_,h]=(0,a.useState)(!1),[m,T]=(0,a.useState)(!1),E=(0,a.useRef)(null),x=(0,a.useRef)(null),R=(0,a.useMemo)(()=>({clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,a.useEffect)(()=>{g.trim()&&h(!0)},[g]);const j=!!(g.trim()||_),N=!!(b.trim()||m),B=j||N;(0,a.useLayoutEffect)(()=>{n(l,{alt:j,title:N})},[j,l,n,N]);const v=(0,a.useMemo)(()=>({marginBottom:B?d.formItemMarginBottomXS:0}),[B,d.formItemMarginBottomXS]),$=(0,a.useMemo)(()=>[l,"alt"],[l]),U=(0,a.useMemo)(()=>[l,"title"],[l]),I=B?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",L=j?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",P=N?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",z=(0,a.useMemo)(()=>g.trim()?g.trim():e("Alternative text"),[e,g]),le=(0,a.useMemo)(()=>b.trim()?b.trim():e("Tooltip text"),[e,b]),C=(0,a.useMemo)(()=>(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":j}),[j]),re=(0,a.useMemo)(()=>(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":N}),[N]),ce=(0,a.useCallback)(se=>{setTimeout(()=>{const he=se.current;if(he){if(typeof he.focus=="function"){he.focus();return}he.input&&typeof he.input.focus=="function"&&he.input.focus()}},0)},[]),fe=(0,a.useCallback)(()=>{j?(h(!1),g.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(h(!0),ce(E))},[j,g,l,ce,i,s]),Be=(0,a.useCallback)(()=>{if(N)n(l,{title:!1}),T(!1),b.trim()&&(i.setFieldValue(["items",l,"title"],""),setTimeout(()=>s(),0));else{T(!0),n(l,{title:!0});const se=g.trim();i.setFieldValue(["items",l,"title"],se),setTimeout(()=>s(),0),ce(x)}},[g,l,ce,i,n,s,N,b]);return(0,o.jsxs)("div",{className:"selected-social-form__meta-block",children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected-social-form__meta-toggle-row",style:v,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:z,placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:C,onClick:fe,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:le,placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:re,onClick:Be,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:I,children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:$,className:L,children:(0,o.jsx)(t.ui_kit$Input,{ref:E,placeholder:e("Alternative text"),allowClear:R,prefix:ed})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:U,className:P,children:(0,o.jsx)(t.ui_kit$Input,{ref:x,placeholder:e("Social network name"),allowClear:R,prefix:od})})]})]})}vl.propTypes={__:f.default.func.isRequired,form:f.default.object.isRequired,fieldName:f.default.oneOfType([f.default.number,f.default.string]).isRequired,pushSettingsToIframe:f.default.func.isRequired,onMetaActiveChange:f.default.func.isRequired};function md(e,i){if(!Array.isArray(e)||e.length===0)return i;let l=null;for(const s of e){const n=s.iconWidth;if(n==null||Number.isNaN(n)||n<=0)return i;if(l===null)l=n;else if(n!==l)return i}return l??i}function pd(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=sd(e),l=String(e?.hostCellBgForIconLuminance??"").trim(),s=md(e.items,e.iconSize??40),n=typeof e.buttonBorderWidth=="number"&&!Number.isNaN(e.buttonBorderWidth)?e.buttonBorderWidth:0,d=e.bgEnabled&&e.bgColor?String(e.bgColor).trim():"";return{align:e.align??"center",iconSize:s,borderRadius:e.borderRadius??0,gap:e.gap??8,globalBgColor:d,globalItemBorderColor:Il(e.items),buttonBorderWidth:n,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const p=!!c.customIcon,g=p?"":Dt(d,c.buttonBgColor),b=c.platform&&!p?r.getSocialIconForBlockCell(c.platform,Mt(i,g,l)):null;return{...c,customIcon:p,title:String(c.title??"").trim(),...b?{iconSrc:b}:{},iconWidth:null,iconHeight:null,buttonBgColor:g,itemBorderColor:p?"":String(c.itemBorderColor??"").trim()}}):[]}}var Cl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useAppConfig(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=r.useSendPostMessageEx(),{openImagePicker:p}=r.useImagePicker(),[g,b]=(0,a.useState)(e),[_,h]=(0,a.useState)(null),[m,T]=(0,a.useState)(null),E=(0,a.useRef)(null),x=(0,a.useRef)(null),R=(0,a.useRef)(null),j=(0,a.useRef)(jl(e)),N=r.useSelector(r.selectEmailSettings),B=(0,a.useRef)(null),v=(0,a.useRef)(!1),$=(0,a.useRef)(""),U=(0,a.useRef)({}),I=ld(),L=N?.usedColors??[],P=t.ui_kit$Form.useWatch("items",n)||[],z=(0,a.useCallback)(()=>{B.current&&(document.removeEventListener("dragover",B.current,!0),B.current=null)},[]),le=(0,a.useCallback)(()=>{if(B.current)return;const D=ie=>{ie.preventDefault(),ie.dataTransfer&&(ie.dataTransfer.dropEffect="move")};document.addEventListener("dragover",D,!0),B.current=D},[]),C=(0,a.useMemo)(()=>r.getSocialPresetsForBrand(Zn).filter(D=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[D.id]),[]),re=(0,a.useMemo)(()=>C.map(D=>({value:D.id,label:(0,o.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,o.jsx)("img",{src:r.getSocialIcon(D.id,I),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(D.labelMsgid)})]})})),[i,C,I]),ce=(0,a.useCallback)((D,ie)=>{U.current={...U.current,[D]:{...U.current[D],...ie}}},[]);(0,a.useEffect)(()=>{const D=jl(e);j.current!==D&&(j.current=D,U.current={},b(e))},[e]);const fe=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(g?.settings){if(fe.current){fe.current=!1;return}const D=g.settings;$.current=D.bgEnabled&&D.bgColor?String(D.bgColor).trim():"",n.setFieldsValue(pd(g.settings))}},[g,n]),(0,a.useEffect)(()=>()=>z(),[z]);const Be=(0,a.useCallback)(()=>{const D=n.getFieldsValue(!0),ie=g.settings||{},ye=String(ie.hostCellBgForIconLuminance??"").trim(),W=(D.globalBgColor||"").trim(),Re=typeof D.iconSize=="number"&&!Number.isNaN(D.iconSize)?D.iconSize:ie.iconSize??40,$e=typeof D.borderRadius=="number"&&!Number.isNaN(D.borderRadius)?D.borderRadius:ie.borderRadius??0,Ae=typeof D.gap=="number"&&!Number.isNaN(D.gap)?D.gap:ie.gap??8,We={blockBgEnabled:!!W,blockBgColor:W},Ve=(D.globalItemBorderColor||"").trim();let Ge=typeof D.buttonBorderWidth=="number"&&!Number.isNaN(D.buttonBorderWidth)?D.buttonBorderWidth:0;Ge=Math.max(0,Math.min(24,Math.round(Ge)));const de={...ie,type:"social",align:D.align??ie.align??"center",iconSize:Re,borderRadius:$e,gap:Ae,bgEnabled:!!W,bgColor:W,hostCellBgForIconLuminance:ye,borderWidth:typeof ie.borderWidth=="number"?ie.borderWidth:0,borderColor:typeof ie.borderColor=="string"?ie.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Ge,showLabel:D.showLabel,items:(D.items||[]).filter(Boolean).map((je,G)=>{const be=!!je.customIcon,Le=U.current[G]||{},He=be?"":ad(W,(je.buttonBgColor||"").trim()),Je=typeof je.href=="string"?yl(je.href):je.href,Ze=be?"":Dt(W,He),so=!be&&je.platform?r.getSocialIconForBlockCell(je.platform,Mt(We,Ze,ye)):null,O=be?"":Ve||String(je.itemBorderColor??"").trim(),ae=id(be?je.iconSrc||"":so||je.iconSrc||"");return{...je,customIcon:be,href:Je,iconSrc:ae,iconWidth:null,iconHeight:null,buttonBgColor:He,itemBorderColor:O,title:Le.title?String(je.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:g.caption,settings:de}),$.current=W,fe.current=!0,b(je=>({...je,settings:de}))},[g.caption,g.settings,n,d]),se=(0,a.useCallback)(D=>{if(D==null||D==="")return-1;const ie=r.stripEmVersionFromUrlString(String(D));return(n.getFieldValue("items")||[]).findIndex(ye=>r.stripEmVersionFromUrlString(ye&&ye.iconSrc||"")===ie)},[n]),he=(0,a.useCallback)((D,ie,ye,W)=>{const Re=[...n.getFieldValue("items")||[]];if(D<0||D>=Re.length)return;const $e=r.stripEmVersionFromUrlString(String(W||""))===r.stripEmVersionFromUrlString(String(ie||""));(!$e||ie!==Re[D]?.iconSrc)&&(Re[D]={...Re[D],iconSrc:ie,customIcon:!0,buttonBgColor:"",itemBorderColor:""},n.setFieldValue("items",Re),setTimeout(()=>Be(),0)),ye?.mode==="save"&&$e&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(ie)})},[n,Be,c]),Pe=(0,a.useCallback)(async(D,ie)=>{const ye=r.stripEmVersionFromUrlString(String(ie||"")),W=se(ie);if(W<0)return;const Re=(n.getFieldValue("items")||[])[W]?.iconSrc,{entryModal:$e,currentUrl:Ae,imageDataUrl:We}=await wl(ye,D),Ve=await p({kind:"img",currentUrl:Ae,entryModal:$e,imageDataUrl:We});Ve?.url&&he(W,Ve.url,Ve.meta,Re)},[he,se,n,p]),pe=(0,a.useCallback)(async D=>{const ie=(n.getFieldValue("items")||[])[D];if(!ie)return;const{entryModal:ye,currentUrl:W,imageDataUrl:Re}=await wl(r.stripEmVersionFromUrlString(String(ie.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),$e=ie.iconSrc,Ae=await p({kind:"img",currentUrl:W,entryModal:ye,imageDataUrl:Re});Ae?.url&&he(D,Ae.url,Ae.meta,$e)},[he,n,p]),De=(0,a.useCallback)(D=>{const ie=parseInt(D.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(ie)||pe(ie)},[pe]),Oe=(0,a.useCallback)(D=>{const ie=D.data?.operation,ye=D.data?.src;ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Pe(r.MODALS.UPLOAD_IMAGE_MODAL_AI,ye):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Pe(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,ye):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Pe(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,ye):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Pe(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,ye):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Pe(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,ye):ie===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,Pe]);r.useListenPostMessage(Oe);const Ce=(0,a.useCallback)(()=>{const D=n.getFieldValue("items")||[],ie=C[0],ye=(n.getFieldValue("globalItemBorderColor")||"").trim(),W=(n.getFieldValue("globalBgColor")||"").trim();if(!ie)n.setFieldsValue({items:[...D,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:W,itemBorderColor:ye}]});else{const Re=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),$e=Dt(W,W),Ae=r.getSocialIconForBlockCell(ie.id,Mt({blockBgEnabled:!!W,blockBgColor:W},$e,Re)),We=i(ie.labelMsgid);n.setFieldsValue({items:[...D,{platform:ie.id,customIcon:!1,href:"",alt:We,title:"",iconSrc:Ae,iconWidth:null,iconHeight:null,buttonBgColor:W,itemBorderColor:ye}]})}setTimeout(()=>Be(),0)},[i,g?.settings?.hostCellBgForIconLuminance,n,C,Be]),ge=(0,a.useCallback)((D,ie)=>{D.dataTransfer.setData(Rl,String(ie)),D.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(ie)),D.dataTransfer.effectAllowed="move",E.current=ie,h(ie),le()},[le]),_e=(0,a.useCallback)(()=>{z(),E.current=null,h(null),T(null)},[z]),Q=(0,a.useCallback)((D,ie,ye)=>{if(ye<2)return;D.preventDefault(),D.dataTransfer.dropEffect="move";const W=E.current;W!==null&&W!==ie&&T(ie)},[]),K=(0,a.useCallback)((D,ie)=>{D.currentTarget.contains(D.relatedTarget)||T(ye=>ye===ie?null:ye)},[]),q=(0,a.useCallback)((D,ie,ye)=>{D.preventDefault(),T(null);const W=D.dataTransfer.getData(Rl),Re=parseInt(W,10);if(Number.isNaN(Re)||Re===ie){z();return}ye(Re,ie),z(),setTimeout(()=>Be(),0)},[z,Be]),Z=(0,a.useCallback)(D=>{const ie=D.currentTarget,ye=parseInt(ie.dataset.itemIndex??"",10);Number.isNaN(ye)||ge(D,ye)},[ge]),V=(0,a.useCallback)(D=>{const ie=D.currentTarget,ye=parseInt(ie.dataset.itemIndex??"",10),W=parseInt(ie.dataset.listLength??"",10);Number.isNaN(ye)||Number.isNaN(W)||W<2||(D.preventDefault(),D.dataTransfer&&(D.dataTransfer.dropEffect="move"))},[]),M=(0,a.useCallback)(D=>{const ie=D.currentTarget,ye=parseInt(ie.dataset.itemIndex??"",10),W=parseInt(ie.dataset.listLength??"",10);Number.isNaN(ye)||Number.isNaN(W)||Q(D,ye,W)},[Q]),Y=(0,a.useCallback)(D=>{const ie=parseInt(D.currentTarget.dataset.itemIndex??"",10);Number.isNaN(ie)||K(D,ie)},[K]),X=(0,a.useCallback)(D=>{const ie=parseInt(D.currentTarget.dataset.itemIndex??"",10),ye=x.current;Number.isNaN(ie)||typeof ye!="function"||q(D,ie,ye)},[q]),oe=(0,a.useCallback)(D=>{D.stopPropagation();const ie=parseInt(D.currentTarget.dataset.fieldName??"",10),ye=R.current;Number.isNaN(ie)||typeof ye!="function"||(ye(ie),queueMicrotask(Be))},[Be]),me=(0,a.useCallback)((D,ie)=>{const ye=C.find(de=>de.id===ie);if(!ye)return;const W=i(ye.labelMsgid),Re=U.current[D]||{},$e=String(n.getFieldValue(["items",D,"alt"])??"").trim();(Re.alt||$e)&&n.setFieldValue(["items",D,"alt"],W),Re.title&&n.setFieldValue(["items",D,"title"],W);const Ae=(n.getFieldValue("globalBgColor")||"").trim(),We=Dt(Ae,(n.getFieldValue(["items",D,"buttonBgColor"])||"").trim()),Ve=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Ge=r.getSocialIconForBlockCell(ie,Mt({blockBgEnabled:!!Ae,blockBgColor:Ae},We,Ve));Ge&&(n.setFieldValue(["items",D,"customIcon"],!1),n.setFieldValue(["items",D,"iconSrc"],Ge))},[i,g?.settings?.hostCellBgForIconLuminance,n,C]),Te=(0,a.useCallback)(D=>{if(Object.prototype.hasOwnProperty.call(D,"globalItemBorderColor")){if(!v.current){const ie=String(D.globalItemBorderColor??"").trim(),ye=n.getFieldValue("items")||[];n.setFieldsValue({items:dd(ye,ie)})}}else if(Object.prototype.hasOwnProperty.call(D,"globalBgColor")){const ie=$.current,ye=String(D.globalBgColor??"").trim(),W=n.getFieldValue("items")||[];n.setFieldsValue({items:cd(W,ie,ye)})}else if(D?.items!=null){const ie=n.getFieldValue("items")||[],ye=Il(ie);ye!==(n.getFieldValue("globalItemBorderColor")||"").trim()&&(v.current=!0,n.setFieldValue("globalItemBorderColor",ye),queueMicrotask(()=>{v.current=!1}));const W=g.settings?.items||[];ie.forEach((Re,$e)=>{const Ae=Re?.platform,We=W[$e]?.platform;Ae&&Ae!==We&&me($e,Ae)})}ud(D?.items,me),Be()},[g.settings?.items,n,Be,me]),Se=(0,a.useCallback)((D,ie)=>{if(n.setFieldValue(D,ie),Array.isArray(D)&&D[0]==="items"){Te({items:{[D[1]]:{[D[2]]:ie}}});return}Te({[D]:ie})},[n,Te]),te=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"selected-social-form__section",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:i("General settings")}),(0,o.jsx)("div",{className:"selected-social-form__align-block",children:(0,o.jsx)(Do,{form:n,elementSettings:{...g,type:r.ELEMENT_TYPES.SOCIAL}})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button size"),placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"iconSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:16,max:64,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",placeholder:i("Button size"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Corner radius"),placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"borderRadius",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:i("Corner radius"),className:"selected-social-form__input-full"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Spacing"),placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingLeftRight",component:t.icons$PaddingLeftRight}),addonAfter:"px",placeholder:i("Spacing"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,o.jsx)(Ft,{form:n,name:"globalBgColor",placeholder:i("Background color"),usedColors:L,onColorChange:Se})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border"),placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:24,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderOuterOutlined",component:t.icons$BorderOuterOutlined}),addonAfter:"px",placeholder:i("Border"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,o.jsx)(Ft,{form:n,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:L,onColorChange:Se})})})})]})]}),(0,o.jsxs)("div",{className:"selected-social-form__section selected-social-form__section--bordered",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:i("Social buttons")}),(0,o.jsx)(t.ui_kit$Form.List,{name:"items",children:(D,{remove:ie,move:ye})=>(x.current=ye,R.current=ie,(0,o.jsx)("div",{className:"selected-social-form__items",children:D.map((W,Re)=>{const $e=!!(P[Re]?.customIcon??P[W.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,Ue.default)("selected-social-form__card",_===Re&&"selected-social-form__card--dragging",m===Re&&_!==Re&&"selected-social-form__card--drag-over"),"data-item-index":Re,"data-list-length":D.length,onDragEnterCapture:V,onDragOverCapture:M,onDragLeave:Y,onDropCapture:X,children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head-main",children:[D.length>1?(0,o.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":Re,onDragStart:Z,onDragEnd:_e,role:"button",tabIndex:0,"aria-label":i("Drag to reorder"),children:(0,o.jsx)(r.EmIcons,{icon:"HolderOutlined",component:t.icons$HolderOutlined})}):null,(0,o.jsxs)(Qn,{className:"selected-social-form__card-title",children:[i("Button")," ",Re+1]})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":W.name,onClick:oe})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"iconSrc"],hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"customIcon"],valuePropName:"checked",hidden:!0,children:(0,o.jsx)(t.ui_kit$Checkbox,{})}),(0,o.jsxs)("div",{className:"selected-social-form__platform-row",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:re,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,o.jsx)(r.EmIcons,{icon:"ChevronDownCustom",component:t.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":Re,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:De})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Ae,We)=>{const Ve=typeof We=="string"?We.trim():String(We??"").trim();if(Ve&&!rd(Ve))throw new Error(i("Please enter the correct URL."))}}],children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,className:"selected-social-form__field-icon"}),placeholder:i("Enter link"),allowClear:{clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}})}),$e?null:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Ft,{form:n,name:["items",W.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:L,onColorChange:Se})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Ft,{form:n,name:["items",W.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:L,onColorChange:Se})})})})]}),(0,o.jsx)(vl,{__:i,form:n,fieldName:W.name,pushSettingsToIframe:Be,onMetaActiveChange:ce})]},W.key)})}))}),(0,o.jsx)(t.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,o.jsx)(r.EmIcons,{icon:"PlusSquareOutlined",component:t.icons$PlusSquareOutlined}),onClick:Ce,children:i("Add button")})]})]});return(0,o.jsx)("div",{className:"selected-social-form",children:(0,o.jsx)(t.ui_kit$Form,{form:n,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:Te,autoComplete:"off",children:(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:te})})})};Cl.propTypes={elementSettings:f.default.shape({settings:f.default.object,type:f.default.string,caption:f.default.string})};var ft=["borderAll","borderTop","borderRight","borderBottom","borderLeft"],Pl=["all","top","right","bottom","left"],Ii={width:1,style:"solid",color:"#E5E5E5"},Al=["All","TopLeft","TopRight","BottomRight","BottomLeft"],oo=e=>u(e),Co=e=>e!==""&&e!==null&&e!==void 0;function _t(e,i=""){return typeof e=="number"?String(e):typeof e=="string"&&e?e:i}function Vt(e){return Co(e?.width)||!!e?.style||!!e?.color}function Nl(e){const i=ft.find(l=>e[l]?.style);return i?e[i]:null}function vi(e){return Nl(e)??Ii}function Ci(e,i){const l=Pl.find(n=>Vt(i[n]))??"all",s=Vt(i[l])?i[l]:Nl(e)??{};return{mobileBorderPosition:l,mobileBorderWidth:s.width??"",mobileBorderColor:s.color??"",mobileBorderStyle:s.style??""}}var hd=e=>oo(e?.replace(/px$/,""));function Ll(e,i){return Object.fromEntries(["LeftRight","TopBottom","Left","Right","Top","Bottom"].map(l=>{const s=`${i}padding${l}`;return[s,hd(e[s])]}))}function bd(e){return{borderRadiusAll:oo(e.all),borderRadiusTopLeft:oo(e.topLeft),borderRadiusTopRight:oo(e.topRight),borderRadiusBottomRight:oo(e.bottomRight),borderRadiusBottomLeft:oo(e.bottomLeft)}}function gd(e){const i=l=>oo(l!==null?l:e.all);return{mobileBorderRadiusAll:oo(e.all),mobileBorderRadiusTopLeft:i(e.topLeft),mobileBorderRadiusTopRight:i(e.topRight),mobileBorderRadiusBottomRight:i(e.bottomRight),mobileBorderRadiusBottomLeft:i(e.bottomLeft)}}function Ol(e,i){return{[`${i}Inset`]:oo(e?.inset)||!1,[`${i}HOffset`]:oo(e?.hOffset),[`${i}VOffset`]:oo(e?.vOffset),[`${i}BlurRadius`]:oo(e?.blurRadius),[`${i}SpreadRadius`]:oo(e?.spreadRadius),[`${i}Color`]:oo(e?.color)}}function $l(e,i){return Object.fromEntries(ft.map(l=>[`${i}${l}`,e[`${i}${l}`]]))}function fd(e){return{fontFamily:oo(e.fontFamily),fontSize:oo(e.fontSize),lineHeight:oo(e.lineHeight),textStrong:oo(e.textStrong),textItalic:oo(e.textItalic),textStrikethrough:oo(e.textStrikethrough),textUnderline:oo(e.textUnderline),textLink:oo(e.textLink),linkHref:oo(e.linkHref),linkTarget:oo(e.linkTarget),textColor:oo(e.textColor),textBackgroundColor:oo(e.textBackgroundColor),textAlign:oo(e.textAlign),valign:oo(e.textValign)}}function Fl(e){const i=e.customTable,l=i.mobileBackgroundColor;return{show:e.show||"all",outlookBackground:e.outlookBackground,...tt(e),mobileBackgroundColor:oo(l?.value!=="none"?l?.value:""),...Ll(i,""),...Ll(i,"cell_"),backgroundColor:oo(i.backgroundColor),backgroundImage:oo(i.backgroundImage?.[0]?.value),backgroundPositionX:oo(i.backgroundPositionX),backgroundPositionY:oo(i.backgroundPositionY),backgroundRepeat:oo(i.backgroundRepeat),backgroundSize:oo(i.backgroundSize),...$l(i,""),borderPosition:i.borderPosition||"borderAll",...$l(i,"cell_"),cell_borderPosition:i.cell_borderPosition||"cell_borderAll",cellBackgroundColor:oo(i.cellBackgroundColor),...bd(i.borderRadius),...Ol(i.boxShadow,"boxShadow"),...Ol(i.mobileBoxShadow,"mobileBoxShadow"),mobileWidth:bo(i.mobileWidth?.value),mobileWidthDim:i.mobileWidth?.dim,mobileHeight:bo(i.mobileHeight?.value),mobileHeightDim:i.mobileHeight?.dim,...gd(i.mobileBorderRadius),...Ci(i,i.mobileBorder),...fd(i)}}function Ml(e,i){return Al.some(l=>Number(e[`${i}Radius${l}`])>0)}function Dl(e,i){return["Color","HOffset","VOffset"].some(l=>Co(e[`${i}${l}`]))}function _d(e){const i=e.mobileBackgroundRepeat;return["mobileBackgroundColor","mobileBackgroundImage","mobileBackgroundPositionX","mobileBackgroundPositionY"].some(l=>Co(e[l]))||Co(i)&&i!=="none"||Co(e.mobileBackgroundSize)}function Vl(e,i,l,s){switch(e){case"border":return ft.some(n=>!!i[`${s?"cell_":""}${n}`]?.style);case"background":return s?Co(i.cellBackgroundColor):Co(i.backgroundColor)||Co(i.backgroundImage);case"borderRadius":return Ml(i,"border");case"boxShadow":return Dl(i,"boxShadow");case"mobileSize":return Co(i.mobileWidth)||Co(i.mobileHeight);case"mobileBackground":return _d(i);case"mobileBorder":return Pl.some(n=>Vt(l[n]));case"mobileBorderRadius":return Ml(i,"mobileBorder");case"mobileBoxShadow":return Dl(i,"mobileBoxShadow");default:return!1}}var Hl=["background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function Ul(e,i,l){const s={padding:!0,cellPadding:!0,background:!1,border:!1,borderRadius:!1,boxShadow:!1,mobileSize:!1,mobileBackground:!1,mobileBorder:!1,mobileBorderRadius:!1,mobileBoxShadow:!1};return Hl.forEach(n=>{s[n]=Vl(n,e,i,l)}),s}function xd(e,i){const l={...e};return Hl.forEach(s=>{l[s]=e[s]||i[s]}),l}function Ht(e,i){const l=i==="mobile"?"mobileBorderRadius":"borderRadius",[s,...n]=Al.map(d=>e[`${l}${d}`]);return!!s||!n.some(d=>!!d)}var kd=["borderRadius","mobileWidth","mobileHeight","mobileBoxShadow","mobileBorder","mobileBorderRadius"],Ed=["textStrong","textItalic","textStrikethrough","textUnderline","textLink","linkHref","textAlign"];function zl(e,i){return Object.fromEntries(i.map(l=>[l,e[l]]))}function Bd(e){return{...e,...zl(e.customTable,kd)}}function Sd(e){return{...e,...zl(e.customTable,Ed),valign:e.customTable.textValign}}var Ut={hOffset:5,vOffset:5,blurRadius:10,spreadRadius:-5,color:"#000000",inset:!1},zt={hOffset:null,vOffset:null,blurRadius:null,spreadRadius:null,inset:!1},Wt=5,Gt="#E5E5E5",Wl="em-mob-box_shadow-",Gl="em-mob-border_radius_all-",Td={width:"",style:"",color:""},Rd=["LeftRight","TopBottom","Left","Right","Top","Bottom"],Yl=["All","TopLeft","TopRight","BottomRight","BottomLeft"],yd=["backgroundColor","backgroundImage","backgroundPositionX","backgroundPositionY","backgroundRepeat","backgroundSize"];function Yt(e,i){return{[`${e}Inset`]:i.inset??!1,[`${e}HOffset`]:i.hOffset??null,[`${e}VOffset`]:i.vOffset??null,[`${e}BlurRadius`]:i.blurRadius??null,[`${e}SpreadRadius`]:i.spreadRadius??null,[`${e}Color`]:i.color??""}}var xt=(e,i="")=>Object.fromEntries(e.map(l=>[l,i])),wd={padding:{off:()=>({fields:xt(Rd.map(e=>`padding${e}`)),settings:{padding:{all:0}}})},background:{on:({prefix:e})=>{const i=e?"cellBackgroundColor":"backgroundColor";return{fields:{[i]:Gt},settings:{[i]:Gt}}},off:({prefix:e})=>e?{fields:{cellBackgroundColor:""},settings:{cellBackgroundColor:""}}:{fields:xt(yd),backgroundImageEmpty:!0,settings:{backgroundColor:"",backgroundImage:[{type:"url",value:""}],backgroundRepeat:"",backgroundSize:""}}},border:{on:({prefix:e})=>({fields:{[`${e}borderPosition`]:`${e}borderAll`,[`${e}borderAll`]:Ii},settings:{[`${e}borderAll`]:Ii}}),off:({prefix:e})=>({fields:xt(ft.map(i=>`${e}${i}`),Td),settings:{[`${e}borderAll`]:{style:""}}})},borderRadius:{on:()=>({fields:{borderRadiusAll:Wt},settings:{borderRadius:{all:Wt}},uniformRadius:"desktop"}),off:()=>({fields:xt(Yl.map(e=>`borderRadius${e}`)),settings:{borderRadius:{all:0}},uniformRadius:"desktop"})},boxShadow:{on:()=>({fields:Yt("boxShadow",Ut),settings:{boxShadow:Ut}}),off:()=>({fields:Yt("boxShadow",zt),settings:{boxShadow:{...zt,color:""}}})},mobileSize:{off:({fields:e})=>({fields:{mobileWidth:"",mobileHeight:""},settings:{mobileWidth:{value:null,dim:_t(e.mobileWidthDim,"px"),classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}})},mobileBackground:{on:()=>({fields:{mobileBackgroundColor:Gt},settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:Gt}}}),off:()=>({fields:{...tt({}),mobileBackgroundColor:""},settings:Gr()})},mobileBorder:{on:({settings:e})=>{const i={...vi(e.customTable),classNamePrefix:"em-mob-border_all-"},l={...r.RESET_BORDER_PARAMS,all:i};return{fields:Ci(e.customTable,l),settings:{mobileBorder:{all:i}},mobileBorders:l}},off:({settings:e})=>({fields:Ci(e.customTable,r.RESET_BORDER_PARAMS),settings:{mobileBorder:r.RESET_BORDER_PARAMS},mobileBorders:r.RESET_BORDER_PARAMS})},mobileBorderRadius:{on:()=>({fields:{mobileBorderRadiusAll:Wt},settings:{mobileBorderRadius:{all:Wt,classNamePrefix:Gl}},uniformRadius:"mobile"}),off:()=>({fields:xt(Yl.map(e=>`mobileBorderRadius${e}`)),settings:{mobileBorderRadius:{all:null,classNamePrefix:Gl}},uniformRadius:"mobile"})},mobileBoxShadow:{on:()=>({fields:Yt("mobileBoxShadow",Ut),settings:{mobileBoxShadow:{...Ut,classNamePrefix:Wl}}}),off:()=>({fields:Yt("mobileBoxShadow",zt),settings:{mobileBoxShadow:{...zt,color:null,classNamePrefix:Wl}}})}},jd=["padding","cellPadding","background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function Id(e,i,l){const s=c=>`${i}padding${c}`;if(l){const[c,p]=[e[s("LeftRight")],e[s("TopBottom")]];return{fields:{[s("Left")]:c,[s("Right")]:c,[s("Top")]:p,[s("Bottom")]:p}}}const[n,d]=[e[s("Left")],e[s("Top")]];return{fields:{[s("LeftRight")]:n,[s("TopBottom")]:d,[s("Right")]:n,[s("Bottom")]:d},settings:{[`${i}padding`]:{top:d,bottom:d,left:n,right:n}}}}function vd(e){const{form:i,settings:l,send:s,isTableCells:n,mobileBorders:d,setMobileBorders:c,setBackgroundImageEmpty:p}=e,g=(0,a.useMemo)(()=>Fl(l),[l]),[b,_]=(0,a.useState)(()=>Ul(g,l.customTable.mobileBorder,n)),[h,m]=(0,a.useState)(!0),[T,E]=(0,a.useState)(()=>Ht(g,"desktop")),[x,R]=(0,a.useState)(()=>Ht(g,"mobile"));(0,a.useEffect)(()=>{_(v=>xd(v,Ul(g,l.customTable.mobileBorder,n))),E(Ht(g,"desktop")),R(Ht(g,"mobile"))},[g,l,n]);const j=n?"cell_":"",N=(0,a.useMemo)(()=>{const v=U=>{U&&(U.fields&&i.setFieldsValue(U.fields),U.mobileBorders&&c(U.mobileBorders),U.backgroundImageEmpty!==void 0&&p?.(U.backgroundImageEmpty),U.uniformRadius&&(U.uniformRadius==="mobile"?R:E)(!0),U.settings&&s(U.settings))},$=U=>{const I=i.getFieldsValue(!0),L=wd[U],P={fields:I,settings:l,prefix:j};b[U]?v(L?.off?.(P)):Vl(U,I,d,n)||v(L?.on?.(P)),_(z=>({...z,[U]:!z[U]}))};return Object.fromEntries(jd.map(U=>[U,()=>$(U)]))},[i,l,s,n,d,c,p,b,j]);return{open:b,toggle:N,paddingsExt:h,togglePaddingMode:()=>{const v=Id(i.getFieldsValue(!0),j,h);i.setFieldsValue(v.fields??{}),v.settings&&s(v.settings),m(!h)},oneBorderRadiusValue:T,setOneBorderRadiusValue:E,oneMobileBorderRadiusValue:x,setOneMobileBorderRadiusValue:R}}var Xt={width:"",style:"",color:""},Cd="em-mob-box_shadow-",Xl={mobileBorderWidth:"width",mobileBorderStyle:"style",mobileBorderColor:"color"},Pd=(e,i)=>({settings:{[e]:i}});function Kl(e,i){return{hOffset:e[`${i}HOffset`],vOffset:e[`${i}VOffset`],blurRadius:e[`${i}BlurRadius`],spreadRadius:e[`${i}SpreadRadius`],color:e[`${i}Color`],inset:e[`${i}Inset`]}}var Kt=e=>`em-mob-border_${e}-`,kt=e=>({...r.RESET_BORDER_PARAMS[e],classNamePrefix:Kt(e)});function ql(){return{top:kt("top"),right:kt("right"),bottom:kt("bottom"),left:kt("left")}}var Ad=e=>e?.width!=null&&e?.style!=null&&e?.color!=null;function Nd(e){const i=l=>({...e,classNamePrefix:Kt(l)});return{top:i("top"),right:i("right"),bottom:i("bottom"),left:i("left")}}function Ld(e,i,l,s){const n=vi(s.settings.customTable),d=(c,p)=>{const g=c===i?l:e[p];return Co(g)?g:n[c]};return{width:d("width","mobileBorderWidth"),style:d("style","mobileBorderStyle"),color:d("color","mobileBorderColor")}}var Od=(e,i,l,s)=>{const n=l.mobileBorderPosition||"all",d=Xl[e],c=s.mobileBorders;if(!Co(i)){const b=n==="all"?{...ql(),all:{...c.all,[d]:null,classNamePrefix:Kt("all")}}:{...c,[n]:kt(n),all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:b},mobileBorders:b}}const p={...Ld(l,d,i,s),classNamePrefix:Kt(n)},g=n==="all"?{...ql(),all:p}:{...c,...Ad(c.all)?Nd(c.all):{},[n]:p,all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:g},mobileBorders:g,fields:{mobileBorderWidth:p.width,mobileBorderStyle:p.style,mobileBorderColor:p.color}}},$d=(e,i,l,s)=>{const n=s.mobileBorders[i],d=Vt(n)?n:vi(s.settings.customTable);return{fields:{mobileBorderWidth:d.width??"",mobileBorderColor:d.color??"",mobileBorderStyle:d.style??""}}},Fd=(e,i,l)=>{if(i?.style==="")return{settings:{[e]:i},fields:{[e]:Xt}};const s=l[e]??{},n=l.borderAll??{},d={...s,width:s.width===""?n.width||"1":s.width,color:s.color===""?n.color||"#b9b1b1":s.color,style:s.style===""?n.style||"solid":s.style};return{settings:{[e]:i},fields:{[e]:d,borderAll:Xt}}},Md=(e,i)=>{const l=ft.filter(n=>n!=="borderAll"),s=i?.style===""?{borderAll:Xt}:Object.fromEntries(l.map(n=>[n,Xt]));return{settings:{[e]:i},fields:s}},$o=(e,i)=>Object.fromEntries(e.map(l=>[l,i])),Pi=(e,i)=>i.map(l=>e+l),Dd=["textAlign","valign"],Jl=["Inset","HOffset","VOffset","BlurRadius","SpreadRadius","Color"],Vd=["Color","Image","PositionX","PositionY","Repeat","Size"],Hd={...$o(Pi("boxShadow",Jl),(e,i,l)=>({settings:{boxShadow:Kl(l,"boxShadow")}})),...$o(Pi("mobileBoxShadow",Jl),(e,i,l)=>({settings:{mobileBoxShadow:{...Kl(l,"mobileBoxShadow"),classNamePrefix:Cd}}})),...$o(Object.keys(H.BORDER_RADIUS_POSITION),(e,i)=>({settings:{borderRadius:{[H.BORDER_RADIUS_POSITION[e]]:+i}}})),...$o(Object.keys(H.MOBILE_BORDER_RADIUS_POSITION),(e,i)=>{const l=H.MOBILE_BORDER_RADIUS_POSITION[e];return{settings:{mobileBorderRadius:{[l]:i,classNamePrefix:`em-mob-border_radius_${l}-`}}}}),...$o(Pi("mobileBackground",Vd),(e,i)=>{const l=ht({[e]:i});return l?{settings:l}:{}}),...$o(Object.keys(Xl),Od),...$o(["borderTop","borderRight","borderBottom","borderLeft"],Fd),...$o(["fontSize","lineHeight"],(e,i)=>Co(i)?{settings:{[e]:i}}:{}),...$o(Dd,()=>({})),borderAll:Md,borderPosition:()=>({}),mobileBorderPosition:$d,backgroundImage:(e,i,l,s)=>({settings:{backgroundImage:[{...s.settings.customTable.backgroundImage?.[0],type:"url",value:_t(i)}],...i?{backgroundSize:"cover"}:{}},backgroundImageEmpty:i===""}),mobileWidth:(e,i,l)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:i,dim:_t(l.mobileWidthDim)}}}),mobileWidthDim:(e,i,l)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:l.mobileWidth||100,dim:_t(i)}}}),mobileHeight:(e,i,l)=>({settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:i,dim:_t(l.mobileHeightDim)}}}),linkHref:(e,i)=>{const l=Qo(i);return{settings:{linkHref:l},linkHref:l,...l!==i?{fields:{linkHref:l}}:{}}}};function Ud(e,i,l){const[s]=Object.keys(e);return s?(Hd[s]??Pd)(s,e[s],i,l):{}}function zd(e){const{form:i,settings:l,send:s,mobileBorders:n,setMobileBorders:d,setBackgroundImageEmpty:c,onLinkHref:p}=e;return(0,a.useCallback)(g=>{const b=Ud(g,i.getFieldsValue(!0),{settings:l,mobileBorders:n});b.fields&&i.setFieldsValue(b.fields),b.mobileBorders&&d(b.mobileBorders),b.backgroundImageEmpty!==void 0&&c(b.backgroundImageEmpty),b.linkHref!==void 0&&p(b.linkHref),b.settings&&s(b.settings)},[i,l,s,n,d,c,p])}function Wd(e){const i=e.customTable.mobileBorder,[l,s]=(0,a.useState)(i);return(0,a.useEffect)(()=>s(i),[i]),[l,s]}function Gd(e,i){return(0,a.useCallback)(l=>e({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i,settings:l}),[e,i])}var it=["hover"],Ql={width:"100%"},Zl={paddingBottom:4},Yd={textAlign:"right"},Ai=e=>e.parentNode,Xd=e=>e.closest(".selected-element-panel"),Kd=e=>e.closest(".email-pane__collapse-wrapper"),qd=({elementSettings:e,__:i,token:l,sendAction:s,typografItems:n})=>{const d=H.useGoogleFontsLoader(),c=(0,a.useMemo)(()=>({marginBottom:l.formItemMarginBottomXS}),[l.formItemMarginBottomXS]),p=(0,a.useMemo)(()=>({items:n}),[n]),g=(0,a.useCallback)(()=>s("add_img"),[s]),b=(0,a.useCallback)(()=>s("typograf"),[s]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:c,children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:g,style:Ql,children:i("Add image")})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:c,children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:p,trigger:it,placement:"bottom",getPopupContainer:Xd,children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:b,style:Ql,children:i("Typography")})})})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:it,title:i("Text font"),placement:"bottom",zIndex:1,getPopupContainer:Ai,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:Kd})})}),!e.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:it,title:i("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:it,title:i("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]})},Jd=({elementSettings:e,__:i,token:l,textInputRef:s,linkProtocol:n,handleLinkProtocolsChange:d})=>{const c=!!e.customTable?.isNewLink,p=(0,a.useMemo)(()=>({marginBottom:l.formItemMarginBottomXS}),[l.formItemMarginBottomXS]);return(0,a.useEffect)(()=>{c&&s.current?.focus()},[c,s]),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsx)(Jo,{show:n==="#",__:i,style:p}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:it,title:i("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{ref:s,addonBefore:(0,o.jsx)(qo,{linkProtocol:n,handleLinkProtocolsChange:d,__:i}),allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(Ko,{linkProtocol:n})})})})]})})},Qd=({form:e,elementSettings:i,__:l,token:s,isMacOS:n,formValues:d,textInputRef:c,linkProtocol:p,handleLinkProtocolsChange:g})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(n?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(n?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(n?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(n?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(to,{form:e,className:(0,Ue.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":!!i.textLink}),elementSettings:i,name:"textLink",tooltipTitle:l("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),d?.textLink&&(0,o.jsx)(Jd,{elementSettings:i,__:l,token:s,textInputRef:c,linkProtocol:p,handleLinkProtocolsChange:g})]}),Zd=({form:e,elementSettings:i,__:l})=>{const s=(0,a.useMemo)(()=>[{message:l("Please set the font color")}],[l]),n=(0,a.useMemo)(()=>[{message:l("Please set the background color")}],[l]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:Zl,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:it,title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:Ai,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:s,children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:it,title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:Ai,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:n,children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:Zl,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(et,{form:e,elementSettings:i,name:"textAlign"})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:Yd,children:(0,o.jsx)(Oo,{form:e,elementSettings:i,name:"valign",isNewIconType:!0})})]})]})},ec=e=>{const{form:i,elementSettings:l,__:s,token:n,appConfig:d,backgroundRepeatOptions:c,backgroundSizeOptions:p,handleToggleShowPaddingCell:g,handleTogglePaddingCell:b,handleToggleBackground:_,handleToggleBorder:h,handleToggleBorderRadius:m,paddingCellShow:T,paddingsExt:E,backgroundShow:x,cellBordersShow:R,borderRadiusShow:j,oneBorderRadiusValue:N,setOneBorderRadiusValue:B,backgroundImageEmpty:v}=e;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$FormSection,{title:s("Text"),dividerTop:!1,children:[d.formTextFieldTypografEnabled&&(0,o.jsx)(qd,{...e}),(0,o.jsx)(Qd,{...e}),(0,o.jsx)(Zd,{...e})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Padding"),collapsible:!0,open:T,onToggle:g,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:E,onToggleExtended:b,gutter:n.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:s("Horizontal padding"),vertical:s("Vertical padding"),left:s("Left padding"),right:s("Right padding"),top:s("Top padding"),bottom:s("Bottom padding"),individual:s("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Background"),collapsible:!0,open:x,onToggle:_,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:d.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:v,usedColors:l.usedColors,colorPlaceholder:s("Background color"),horizontalPositionPlaceholder:s("Horizontal position"),horizontalPositionTooltip:s("Horizontal position"),verticalPositionPlaceholder:s("Vertical position"),verticalPositionTooltip:s("Vertical position"),backgroundRepeatTooltip:s("Background image repeat"),backgroundSizeTooltip:s("Background image size"),selectPlaceholder:s("Please choose"),backgroundRepeatOptions:c,backgroundSizeOptions:p,imageUploadSlot:(d.formTableFieldBackgroundImageEnabled,void 0)})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Borders"),collapsible:!0,open:R,onToggle:h,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:i,namePrefix:"cell_"})}),d.formFieldBorderRadiusEnabled&&!1]})},es=({form:e,elementSettings:i,paddingShow:l,paddingsExt:s,backgroundShow:n,bordersShow:d,borderRadiusShow:c,boxShadowShow:p,handleToggleShowPadding:g,handleTogglePadding:b,handleToggleBackground:_,handleToggleBorder:h,handleToggleBorderRadius:m,handleToggleBoxShadow:T,backgroundRepeatOptions:E,backgroundSizeOptions:x,backgroundImageEmpty:R,oneBorderRadiusValue:j,setOneBorderRadiusValue:N})=>{const{__:B}=r.useI18n(),v=r.useAppConfig(),{token:$}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:B("Padding"),collapsible:!0,open:l,onToggle:g,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:s,onToggleExtended:b,gutter:$.marginSM,labels:{horizontal:B("Horizontal padding"),vertical:B("Vertical padding"),left:B("Left padding"),right:B("Right padding"),top:B("Top padding"),bottom:B("Bottom padding"),individual:B("Individual padding")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:n,onToggle:_,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:v.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:R,usedColors:i.usedColors,colorPlaceholder:B("Background color"),horizontalPositionPlaceholder:B("Horizontal position"),horizontalPositionTooltip:B("Horizontal position"),verticalPositionPlaceholder:B("Vertical position"),verticalPositionTooltip:B("Vertical position"),backgroundRepeatTooltip:B("Background image repeat"),backgroundSizeTooltip:B("Background image size"),selectPlaceholder:B("Please choose"),backgroundRepeatOptions:E,backgroundSizeOptions:x,imageUploadSlot:v.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Ao,{form:e,label:B("Background image"),name:"backgroundImage",tooltipTitle:B("Background image"),placeholder:B("Background image link/route")}):void 0}),(0,o.jsx)(ot,{form:e,showBackground:!0})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:d,onToggle:h,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e})}),v.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:c,onToggle:m,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,oneBorderRadiusValue:j,setOneBorderRadiusValue:N,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:p,onToggle:T,dividerTop:!0,children:(0,o.jsx)(jo,{})}),v.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})})]})};es.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,paddingShow:f.default.bool,paddingsExt:f.default.bool,backgroundShow:f.default.bool,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,handleToggleShowPadding:f.default.func,handleTogglePadding:f.default.func,handleToggleBackground:f.default.func,handleToggleBorder:f.default.func,handleToggleBorderRadius:f.default.func,handleToggleBoxShadow:f.default.func,backgroundRepeatOptions:f.default.array,backgroundSizeOptions:f.default.array,backgroundImageEmpty:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func};var os=({form:e,elementSettings:i,mobileSizeShow:l,mobileBackgroundShow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:p,handleToggleMobileBackground:g,handleToggleMobileBorder:b,handleToggleMobileBorderRadius:_,handleToggleMobileBoxShadow:h,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:T,mobileBorders:E})=>{const{__:x,_x:R}=r.useI18n(),j=r.useAppConfig(),{token:N}=(0,t.ui_kit$useToken)(),B=r.useSelector(r.selectEmailSettings);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:x("Size"),collapsible:!0,open:l,onToggle:p,dividerTop:!0,children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:x("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:N.formItemMarginBottomMD+4},children:(0,o.jsx)(Ho,{form:e,name:"mobileWidth",elementSettings:i})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:N.formItemMarginBottomXS*2},children:(0,o.jsx)(t.ui_kit$Tooltip,{title:x("Height"),placement:"bottom",children:(0,o.jsx)(Zo,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Background"),collapsible:!0,open:s,onToggle:g,dividerTop:!0,children:(0,o.jsx)(gt,{elementSettings:Uo(i),imageEnabled:j.formTableFieldBackgroundImageEnabled,desktopBackground:bt(i)})}),j.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Borders"),collapsible:!0,open:n,onToggle:b,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:E,usedColors:B.usedColors,labels:{color:x("Color"),width:R("Width","border"),none:x("None"),solid:x("Solid"),dashed:x("Dashed"),dotted:x("Dotted"),above:x("Above"),below:x("Below"),onLeft:x("On the left"),onRight:x("On the right"),around:x("Around"),usedColors:x("Used"),recommendedColors:x("Recommended")}})}),j.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Border radius"),collapsible:!0,open:d,onToggle:_,dividerTop:!0,children:(0,o.jsx)(Ro,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:m,setOneBorderRadiusValue:T,elementSettings:i})}),j.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Box shadow"),collapsible:!0,open:c,onToggle:h,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),j.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})})]})};os.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,handleToggleMobileSize:f.default.func,handleToggleMobileBackground:f.default.func,handleToggleMobileBorder:f.default.func,handleToggleMobileBorderRadius:f.default.func,handleToggleMobileBoxShadow:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,mobileBorders:f.default.object};var oc=({form:e,elementViewType:i,mobileViewActive:l,elementSettings:s,paddingShow:n,paddingsExt:d,backgroundShow:c,bordersShow:p,borderRadiusShow:g,boxShadowShow:b,mobileSizeShow:_,mobileBackgroundShow:h,mobileBordersShow:m,mobileBorderRadiusShow:T,mobileBoxShadowShow:E,handleToggleShowPadding:x,handleTogglePadding:R,handleToggleBackground:j,handleToggleBorder:N,handleToggleBorderRadius:B,handleToggleBoxShadow:v,handleToggleMobileSize:$,handleToggleMobileBackground:U,handleToggleMobileBorder:I,handleToggleMobileBorderRadius:L,handleToggleMobileBoxShadow:P,backgroundRepeatOptions:z,backgroundSizeOptions:le,backgroundImageEmpty:C,oneBorderRadiusValue:re,setOneBorderRadiusValue:ce,oneMobileBorderRadiusValue:fe,setOneMobileBorderRadiusValue:Be,mobileBorders:se})=>(0,o.jsx)(o.Fragment,{children:i==="mobile"&&l.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(os,{form:e,elementSettings:s,mobileSizeShow:_,mobileBackgroundShow:h,mobileBordersShow:m,mobileBorderRadiusShow:T,mobileBoxShadowShow:E,handleToggleMobileSize:$,handleToggleMobileBackground:U,handleToggleMobileBorder:I,handleToggleMobileBorderRadius:L,handleToggleMobileBoxShadow:P,oneMobileBorderRadiusValue:fe,setOneMobileBorderRadiusValue:Be,mobileBorders:se})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(es,{form:e,elementSettings:s,paddingShow:n,paddingsExt:d,backgroundShow:c,bordersShow:p,borderRadiusShow:g,boxShadowShow:b,handleToggleShowPadding:x,handleTogglePadding:R,handleToggleBackground:j,handleToggleBorder:N,handleToggleBorderRadius:B,handleToggleBoxShadow:v,backgroundRepeatOptions:z,backgroundSizeOptions:le,backgroundImageEmpty:C,oneBorderRadiusValue:re,setOneBorderRadiusValue:ce})})}),ts=e=>e.customTable?.backgroundImage?.[0]?.value==="",is=({elementSettings:e,formName:i})=>{const{__:l}=r.useI18n(),s=r.useSendPostMessage(),[n]=t.ui_kit$Form.useForm(),{token:d}=(0,t.ui_kit$useToken)(),c=r.useAppConfig(),p=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),b=r.useSelector(r.selectIsCodeMode),_=r.useSelector(r.selectCodeModeDirection),h=i===r.EDIT_SELECTED_TABLE_CELLS,m=Gd(s,e.type),[T,E]=Wd(e),[x,R]=(0,a.useState)(ts(e)),[j,N]=(0,a.useState)("https://"),B=vd({form:n,settings:e,send:m,isTableCells:h,mobileBorders:T,setMobileBorders:E,setBackgroundImageEmpty:R}),v=(0,a.useCallback)(Pe=>Vo(Pe,N),[]),$=zd({form:n,settings:e,send:m,mobileBorders:T,setMobileBorders:E,setBackgroundImageEmpty:R,onLinkHref:v}),U=(0,a.useMemo)(()=>({table:Bd(e),cell:Sd(e)}),[e]),I=(0,a.useRef)(),L=t.ui_kit$Form.useWatch([],n),P=[{label:l("Not defined"),value:"none"},{label:l("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:l("Repeat background (repeat)"),value:"repeat"},{label:l("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:l("Repeat background vertically (repeat-y)"),value:"repeat-y"}],z=[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],le=b&&_!=="bottom",[C,re]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&re(!0)},[]);const ce=Pe=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:Pe,locale:"ru_RU"})},fe=[{key:"1",label:l("This element"),onClick:()=>ce("typograf")},{key:"2",label:l("The whole email"),onClick:()=>ce("typograf_all")}];(0,a.useEffect)(()=>{n.setFieldsValue(Fl(e)),R(ts(e))},[n,e]),(0,a.useEffect)(()=>{n.getFieldValue("linkHref")||n.setFieldsValue({linkHref:null})},[L?.textLink,L?.linkHref,e.customTable?.linkHref,n]),(0,a.useEffect)(()=>{e.customTable?.linkHref&&Vo(e.customTable?.linkHref||"",N),n.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[n,e,N]);const Be=Pe=>{n.setFieldValue("linkHref",Pe!=="mergetag"?Pe:""),N(Pe)},{open:se,toggle:he}=B;return(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:i,initialValues:{paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",cell_paddingTop:"",cell_paddingLeft:"",cell_paddingRight:"",cell_paddingBottom:"",cell_paddingLeftRight:"",cell_paddingTopBottom:"",borderAll:{width:"",style:"",color:""},borderTop:{width:"",style:"",color:""},borderBottom:{width:"",style:"",color:""},borderLeft:{width:"",style:"",color:""},borderRight:{width:"",style:"",color:""},cellBackgroundColor:"",backgroundImageForCell:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",show:"all",borderPosition:"",borderRadiusAll:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBackgroundColor:"",mobileBackgroundImage:"",cell_borderPosition:"cell_borderAll",cell_borderAll:{color:"",width:"",style:""},cell_borderTop:{color:"",width:"",style:""},cell_borderBottom:{color:"",width:"",style:""},cell_borderLeft:{color:"",width:"",style:""},cell_borderRight:{color:"",width:"",style:""},cell_borderRadiusAll:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",textBackgroundColor:"",valign:""},onValuesChange:$,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!le&&(0,o.jsx)(t.ui_kit$Tooltip,{title:l("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:l("Appearance on mobile devices"),type:"info"})}),h?(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ec,{form:n,formValues:L,elementSettings:U.cell,appConfig:c,token:d,isMacOS:C,__:l,handleToggleShowPaddingCell:he.cellPadding,handleTogglePaddingCell:B.togglePaddingMode,handleToggleBackground:he.background,handleToggleBorder:he.border,handleToggleBorderRadius:he.borderRadius,paddingCellShow:se.cellPadding,paddingsExt:B.paddingsExt,backgroundShow:se.background,cellBordersShow:se.border,borderRadiusShow:se.borderRadius,oneBorderRadiusValue:B.oneBorderRadiusValue,setOneBorderRadiusValue:B.setOneBorderRadiusValue,backgroundImageEmpty:x,backgroundRepeatOptions:P,backgroundSizeOptions:z,sendAction:ce,typografItems:fe,textInputRef:I,linkProtocol:j,handleLinkProtocolsChange:Be})}):(0,o.jsx)(oc,{form:n,elementSettings:U.table,handleToggleShowPadding:he.padding,handleTogglePadding:B.togglePaddingMode,handleToggleBackground:he.background,handleToggleBorder:he.border,handleToggleBorderRadius:he.borderRadius,handleToggleBoxShadow:he.boxShadow,handleToggleMobileSize:he.mobileSize,handleToggleMobileBackground:he.mobileBackground,handleToggleMobileBorder:he.mobileBorder,handleToggleMobileBorderRadius:he.mobileBorderRadius,handleToggleMobileBoxShadow:he.mobileBoxShadow,paddingShow:se.padding,paddingsExt:B.paddingsExt,backgroundShow:se.background,bordersShow:se.border,borderRadiusShow:se.borderRadius,boxShadowShow:se.boxShadow,mobileSizeShow:se.mobileSize,mobileBackgroundShow:se.mobileBackground,mobileBordersShow:se.mobileBorder,mobileBorderRadiusShow:se.mobileBorderRadius,mobileBoxShadowShow:se.mobileBoxShadow,oneBorderRadiusValue:B.oneBorderRadiusValue,setOneBorderRadiusValue:B.setOneBorderRadiusValue,oneMobileBorderRadiusValue:B.oneMobileBorderRadiusValue,setOneMobileBorderRadiusValue:B.setOneMobileBorderRadiusValue,backgroundImageEmpty:x,backgroundRepeatOptions:P,backgroundSizeOptions:z,mobileBorders:T,elementViewType:p,mobileViewActive:g})," "]})};is.propTypes={elementSettings:f.default.object.isRequired,formName:f.default.string};var nt=({className:e=null,formSettings:i,emailElementType:l,formName:s})=>{const n=r.useDispatch(),d=r.useSendStyleToggleToIframe(),c=(0,a.useRef)(),p=r.useSelector(r.selectActiveSettingsTab),g=r.useSelector(r.selectElementSettings$1),b=r.useSelector(r.selectElementSettings),_=r.useContainer(),h=r.getComponentRegistry(_),m=l==="email"?g:b,T=m.type,E=T===r.ELEMENT_TYPES.CAROUSEL||T===r.ELEMENT_TYPES.IMG?i.settings:m,[x,R]=(0,a.useState)(E),[j,N]=(0,a.useState)(E);E!==j&&(N(E),R(E));const B=$=>{const U=$.data.operation,I=$.data.action;if(U===r.EVENT_TYPES.APPLICATION_ACTION){let P=function(z,le=null){const C={[z]:le||!x[z]};d(C,x.type),n(r.setEmailSettings(C)),R(re=>({...re,...C}))};var L=P;I==="toggle_strong"&&P("textStrong"),I==="toggle_italic"&&P("textItalic"),I==="toggle_underline"&&P("textUnderline"),I==="toggle_strikethrough"&&P("textStrikethrough"),I==="textAlign_left"&&P("textAlign","left"),I==="textAlign_right"&&P("textAlign","right"),I==="textAlign_center"&&P("textAlign","center")}};r.useListenPostMessage(B);const v=m;return(0,o.jsx)("div",{className:"selected-element-panel",children:(0,o.jsx)(r.CSSTransition,{nodeRef:c,in:p===r.PROPERTIES,timeout:300,classNames:"transition",children:(0,o.jsxs)("div",{ref:c,className:(0,Ue.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,o.jsx)(a.Fragment,{children:h.getReactElement(i.content)},i.instanceKey):null,(m.type===r.ELEMENT_TYPES.IMG||m.type===r.ELEMENT_TYPES.COUNTDOWN||m.type===r.ELEMENT_TYPES.VIDEO)&&(0,o.jsx)(Fr,{elementSettings:m}),m.type===r.ELEMENT_TYPES.TEXT&&(0,o.jsx)(yn,{elementSettings:m}),m.type===r.ELEMENT_TYPES.LINK&&(0,o.jsx)(tl,{elementSettings:m}),m.type===r.ELEMENT_TYPES.TABLE&&(0,o.jsx)(ol,{elementSettings:m}),m.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,o.jsx)(is,{elementSettings:v,formName:s},v.customTable.tableKey),(m.type===r.ELEMENT_TYPES.TD||m.type===r.ELEMENT_TYPES.STRUCTURE||m.type===r.ELEMENT_TYPES.GROUP||m.type===r.ELEMENT_TYPES.COLUMN)&&(0,o.jsx)(nl,{elementSettings:m}),m.type===r.ELEMENT_TYPES.VAR&&(0,o.jsx)(_l,{elementSettings:m}),m.type===r.ELEMENT_TYPES.BUTTON&&(0,o.jsx)(fl,{elementSettings:m}),m.type===r.ELEMENT_TYPES.DIV&&(0,o.jsx)(ul,{elementSettings:m}),m.type===r.ELEMENT_TYPES.VINDENT&&(0,o.jsx)(ll,{elementSettings:m}),m.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,o.jsx)(hl,{elementSettings:m}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,o.jsx)(Sl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(Tl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,o.jsx)(Cl,{elementSettings:i})]})})})};nt.propTypes={className:f.default.string,formName:f.default.string};function zo(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var rs=({emailElementType:e,isSelectedElement:i=!1,selectedElement:l={parent:!1}})=>{const{__:s}=r.useI18n(),n=r.useDispatch(),d=r.useSendPostMessage(),[c]=t.ui_kit$Form.useForm(),p=(0,a.useRef)(),g=(0,a.useRef)(),b=r.useSelector(r.selectElementSettings$1),_=r.useSelector(r.selectElementSettings),h=r.useAppConfig(),m=l||(e==="email"?b:_),[T,E]=(0,a.useState)(m.floatBlocks?.wrap),[x,R]=(0,a.useState)(m.floatBlocks?.dirRevers),[j,N]=(0,a.useState)(null),[B,v]=(0,a.useState)(0),[$,U]=(0,a.useState)([]),I=r.useSelector(r.selectEmailViewType),L=(0,a.useCallback)(Ce=>{n(e==="email"?r.setElementSettings$1(Ce):r.setElementSettings(Ce))},[n,e]);(0,a.useEffect)(()=>{if(m&&JSON.stringify(m)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:m.floatBlocks?.gap,gapMobile:m.floatBlocks?.gapMobile,gapDim:"px",valign:m.floatBlocks?.valign}),m.floatBlocks?.items.length>0){let Q=function(K,q){if(K.length!==q.length)return!1;for(let Z=0;Z<K.length;Z++)if(K[Z]!==q[Z])return!1;return!0};var Ce=Q;const ge=m.floatBlocks.items.reduce((K,q)=>K+q.width,0),_e=m.floatBlocks.items.map(K=>((K.width||0)/ge*100).toFixed(1));v(ge),!Q(_e,$)&&m.changeKey!=="gap"&&U(_e),m.floatBlocks.items.forEach((K,q)=>c.setFieldsValue({["width-"+q]:K.width||0})),m.floatBlocks.items.length>=8?document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive"):document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.contains("noactive")&&document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.remove("noactive")}E(m.floatBlocks?.wrap)}},[c,m,j,$]);let P=0;m.floatBlocks?.items.length>0&&(P=m.floatBlocks.items.length);const z=(Ce,ge)=>{Object.keys(ge).forEach(_e=>{if(_e.includes("width")){const Q=parseInt(_e.match(/\d+/));c.setFieldsValue({[_e]:Ce.items[Q]})}})},[le,C]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const Ce=()=>C(!0),ge=()=>C(!1);return document.addEventListener("keyup",ge),document.addEventListener("keydown",Ce),()=>{document.removeEventListener("keyup",ge),document.removeEventListener("keydown",Ce)}},[]);const re=Ce=>{g.current&&le&&clearTimeout(g.current),g.current=setTimeout(()=>ge(Ce),50);function ge(_e){const Q=c.getFieldsValue(!0),K=Object.keys(_e)[0];if(N(K),K.includes("width")){if(Q[K]&&Q[K]>=30){let q={items:[],gap:Q.gap,valign:Q.valign,activateSection:i?void 0:"structure"},Z=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){Z=parseFloat(Object.keys(_e)[0].substring(Object.keys(_e)[0].length-1));const V=Q["width-"+(Z+1)]?Z+1:0;let M=B;Object.keys(Q).forEach(Y=>{Y.includes("width")&&Y.indexOf("width-"+V)===-1&&(M-=Q[Y])}),Q["width-"+V]=M}Object.keys(Q).forEach(V=>{V.includes("width")&&q.items.push(Q[V])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:q}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...q,items:m.floatBlocks.items.map((V,M)=>({...m.floatBlocks.items[M],width:q.items[M]}))},changeKey:K})}}else if(K==="gap"){const q={items:m.floatBlocks.items.map(Y=>Y.width),gap:m.floatBlocks.gap},Z=q.items.reduce((Y,X)=>Y+X,0)+(q.items.length-1)*q.gap,V=Q.gap,M=Z-(q.items.length-1)*V;if(M>q.items.length*30||m.floatBlocks.gap-_e>=0){const Y=(Te,Se)=>Math.round(Se*Te/100);let X=q.items.map((Te,Se)=>Y($[Se],M));const oe=Z-(X.reduce((Te,Se)=>Te+Se,0)+(q.items.length-1)*V);if(oe!==0){const Te=X.length-Math.abs(oe);X=X.map((Se,te)=>Te<=te?Se+(oe>0?1:-1):Se)}let me={items:X,gap:V||0};z(me,Q),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:me,editFromStructure:zo()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...me,items:m.floatBlocks.items.map((Te,Se)=>({...Te,width:me.items[Se]}))},changeKey:K})}}else if(K==="valign"){let q={valign:Q.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:q,editFromStructure:zo()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...q},changeKey:K})}else if(K==="gapMobile"){let q={mobileHeight:{classNamePrefix:"em-mob-height-",value:_e[K],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:q}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,gapMobile:q.mobileHeight.value},changeKey:K})}setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),600)}},ce=()=>{const Ce=c.getFieldsValue(!0),ge=m.floatBlocks.items.map(M=>M.width);let _e={items:[],gap:Ce.gap};const Q=ge.reduce((M,Y)=>M+Y,0),K=ge.length,q=Math.ceil(B/K)*K,Z=q/K,V=Q-q;if(_e.items=Array(K).fill(Z),V!==0){const M=ge.length-Math.abs(V);_e.items=_e.items.map((Y,X)=>M<=X?Y+(V>0?1:-1):Y)}z(_e,Ce),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:_e,editFromStructure:zo()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,..._e,items:m.floatBlocks.items.map((M,Y)=>({...M,width:_e.items[Y]}))},changeKey:"width"})},fe=Ce=>{const ge=c.getFieldsValue(!0),_e=m.floatBlocks.items.map(me=>me.width),Q=m.floatBlocks.gap||20,K=Ce.cols-_e.length;let q=[],Z=_e.reduce((me,Te)=>me+Te,0);Ce.cols>=_e.length?Z-=Q*K:Z+=Q*Math.abs(K);const V=Math.round(Z/Ce.cols);function M(me,Te){const Se=[];for(let te=0;te<me;te++)Se.push(Ce.width?.[te]?Math.round(Z/100*Ce.width?.[te]):Te);return Se}q=M(Ce.cols,V);const Y=Z-q.reduce((me,Te)=>me+Te,0);if(Y!==0){let me=q.map((Se,te)=>[te,Se]).filter(Se=>Se[1]>30);const Te=me.length-Math.abs(Y);me=me.map((Se,te)=>{const D=Te<=te?Se[1]+(Y>0?1:-1):Se[1];return[Se[0],D]}),me.map(Se=>(q[Se[0]]=Se[1],Se))}let X={items:q,gap:ge.gap||20};const oe=q.reduce((me,Te)=>me+Te,0);U(q.map(me=>(me/oe*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:X,editFromStructure:zo()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...X,items:X.items.map((me,Te)=>({width:me,current:!1}))},changeKey:"width"})},Be=()=>{const Ce=c.getFieldsValue(!0);if(P<8){const ge=m.floatBlocks.items.map(M=>M.width),_e=m.floatBlocks.gap,Q=ge.reduce((M,Y)=>M+(Y>30?Y:0),0),K=(Q-30-_e)/Q,q=ge.map(M=>M>30?Math.round(M*K):M).reduce((M,Y)=>M+(Y>30?Y:0),0);let Z=ge.map(M=>M>30?Math.round(M*K):M);Z.push(30);const V=Q-q-30-_e;if(V!==0){let M=Z.map((X,oe)=>[oe,X]).filter(X=>X[1]>30);const Y=M.length-Math.abs(V);M=M.map((X,oe)=>{const me=Y<=oe?X[1]+(V>0?1:-1):X[1];return[X[0],me]}),M.map(X=>(Z[X[0]]=X[1],X))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:Ce.gap,gapMobile:Ce.gapMobile,minWidth:30},editFromStructure:zo()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,items:Z.map((M,Y)=>({width:M,current:m.floatBlocks.items[Y]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},se=Ce=>{const ge=c.getFieldsValue(!0);let _e=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((me,Te)=>{me===Ce.target.closest(".selected-element-panel__columns-settings__controls__column")&&(_e=Te)});const Q=+m.floatBlocks.gap,K=+m.floatBlocks.items[_e].width+Q,q=m.floatBlocks.items.map(me=>+me.width),Z=(q.length-1)*Q,V=q.reduce((me,Te)=>me+Te,0)+Z,M=q.length-1,Y=Math.floor(K/M);let X=q.filter((me,Te)=>Te!==_e).map(me=>me+Y);const oe=V-(X.reduce((me,Te)=>me+Te,0)+(q.length-2)*Q);if(oe!==0){const me=X.length-Math.abs(oe);X=X.map((Te,Se)=>me<=Se?Te+(oe>0?1:-1):Te)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:_e,gap:ge.gap},editFromStructure:zo()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,items:X.map((me,Te)=>({width:me,current:m.floatBlocks.items.filter((Se,te)=>te!==_e)[Te].current}))},changeKey:"width"})},he=Ce=>{if(P>=8)return;const ge=c.getFieldsValue(!0);let _e=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((Se,te)=>{Se===Ce.target.closest(".selected-element-panel__columns-settings__controls__column")&&(_e=te)});const Q=parseFloat(ge.gap)||0,K=m.floatBlocks.items.map(Se=>+Se.width),q=K[_e],Z=K.reduce((Se,te)=>Se+te,0),V=Z-Q,M=Z+q,Y=M>0?V/M:1;let X=[];const oe=[];K.forEach((Se,te)=>{X.push(Math.max(30,Math.round(Se*Y))),oe.push(m.floatBlocks.items[te]?.current||!1),te===_e&&(X.push(Math.max(30,Math.round(q*Y))),oe.push(!1))});const me=V-X.reduce((Se,te)=>Se+te,0);if(me!==0){let Se=X.map((D,ie)=>[ie,D]).filter(D=>D[1]>30);const te=Se.length-Math.abs(me);Se=Se.map((D,ie)=>[D[0],te<=ie?D[1]+(me>0?1:-1):D[1]]),Se.forEach(D=>X[D[0]]=D[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:_e,gap:ge.gap,widths:X},editFromStructure:zo()});const Te=X.reduce((Se,te)=>Se+te,0);U(X.map(Se=>(Se/Te*100).toFixed(1))),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,items:X.map((Se,te)=>({width:Se,current:oe[te]||!1}))},changeKey:"width"})},Pe=(0,a.useCallback)(Ce=>{const ge=".selected-element-panel__columns-settings__controls__column",_e=Array.from(document.querySelectorAll(ge)).indexOf(Ce.target.closest(ge)),Q=_e-1;if(Q<0)return;const K=m.floatBlocks,q=K.items.map(({width:Z,current:V})=>({width:Z,current:V||!1}));[q[Q],q[_e]]=[q[_e],q[Q]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:Q,indexB:_e},editFromStructure:zo()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...K,items:q},changeKey:"width"})},[m,L,i,d]),pe=Ce=>{E(Ce),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!T}}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,wrap:!T},changeKey:"wrap"})},De=Ce=>{R(Ce),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!x}}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,dirRevert:!x},changeKey:"dir"})},Oe=()=>setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),300);return m.floatBlocks&&m.floatBlocks.items.length>0&&(0,o.jsx)(t.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:m.floatBlocks?.gap||0,gapDim:"px",gapMobile:m.floatBlocks?.gapMobile||0,valign:m.floatBlocks?.valign||"top",...m.floatBlocks?.items.reduce((Ce,{width:ge},_e)=>(Ce[`width-${_e}`]=ge,Ce),{})},onValuesChange:re,onFieldsChange:Oe,className:"element-controls",children:(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:h.switchDesktopMobilePropsEnabled||h.stepToOtherElementEnabled||h.deleteButtonEnabled||m.type==="structure"?0:24},children:[m.floatBlocks.items.length===1&&(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:10},title:s('The selected element is in the block that supports a multicolumn structure. To add a new column, click the "Add a column" button.'),type:"info"}),I!=="mobile"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__header",children:[(0,o.jsx)("span",{className:"selected-element-panel__columns-settings__header-title",children:s("Columns")}),(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__links",children:[(0,o.jsxs)("span",{className:"selected-element-panel__columns-settings__links__add",onClick:Be,children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:h.iconStrokeWidth})," ",s("Add column")]}),m.floatBlocks.items.length>1&&(0,o.jsx)("span",{onClick:ce,children:(0,o.jsxs)(t.ui_kit$Tooltip,{title:s("Make columns the same width."),children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Equalize")]})})]})]}),m.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:m.floatBlocks.items.map((Ce,ge)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(Ce.current?"current":""),style:{width:Ce.width/B*100+"%"},children:[ge>0&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Swap columns"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:Pe,children:(0,o.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:t.icons$SwapHorizontalIcon,size:15,strokeWidth:h.iconStrokeWidth})})}),m.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Delete column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:se,children:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:15,strokeWidth:h.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),m.floatBlocks.items.length<8&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Copy column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:he,children:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:15,strokeWidth:h.iconStrokeWidth})})}),(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:"",name:"width-"+ge,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,value:Ce.width||0,placeholder:s("Width"),ref:j==="width-"+ge&&p})})})]},"floatblock-"+ge))})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{fe({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{fe({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{fe({cols:2,width:[66,34]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideLeft",component:t.icons$LayoutCol2WideLeft})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{fe({cols:2,width:[34,66]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideRight",component:t.icons$LayoutCol2WideRight})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{fe({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{fe({cols:4})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol4",component:t.icons$LayoutCol4})})]})]}),m.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[I==="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-wrap",label:s("Line break on mobile devices"),size:"small",disabled:m.floatBlocks?.wrap===void 0,checked:T,onChange:pe,labelStyle:{position:"relative",top:2}})}),I!=="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-dir-revers",label:s("Reverse order on desktop"),size:"small",disabled:m.floatBlocks?.wrap===void 0,checked:x,onChange:De,labelStyle:{position:"relative",top:2}})})]}),m.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Vertical alignment"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"valign",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{disabled:m.floatBlocks.items.length<=1,strokeWidth:h.iconStrokeWidth,labels:{alignTop:s("Align top"),alignMiddle:s("Center vertically"),alignBottom:s("Align bottom")}})})})}),(0,o.jsxs)(o.Fragment,{children:[I!=="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent between columns"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:m.floatBlocks.items.length<=1,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",ref:j==="gap"&&p})})})}),I==="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:m.floatBlocks.items.length<=1,placeholder:s("Indent in mobile"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};rs.propTypes={selectedElement:f.default.shape({parent:f.default.string})};var tc=()=>{},ls=({email:e,formSettings:i={},onClosePanel:l=tc})=>{const{__:s}=r.useI18n(),n=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),p=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,g=r.useSelector(r.selectElementSettings$1),b=r.useSelector(r.selectElementSettings),_=r.useSelector(r.selectPropertiesPanelKey),h=p==="email"?g:b,m=Object.keys(i).length>0?i.settings:h,T=i?.type==="advanced"&&!!i?.content,E=!!i?.extraTabs?.length,x=r.useAppConfig(),R=m.type==="customTable",j=r.useInspectorTabs(m.type||i.type,R),N=(0,a.useCallback)(ce=>{j.activate(ce),d(r.setPropertiesPanelKey(ce||""))},[j,d]),B=!!m.type&&!!m.floatBlocks?.items.length>0&&!!m.floatBlocks?.items.filter(ce=>!!ce.width).length>0,v=(0,a.useRef)(null),$=(0,a.useRef)(_);$.current=_,(0,a.useEffect)(()=>{const ce=Object.values(r.ELEMENT_TYPES),fe=m.type&&ce.includes(m.type)?`${m.type}-${JSON.stringify(m.path||[])}`:null;if(T||E){const Be=n.querySelector(".email-pane .panel-form__body");Be&&(Be.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(m.type&&ce.includes(m.type)){const Be=v.current!==fe;if(v.current=fe,m.activateSection!=="structure"){if(Be){const se=n.querySelector(".email-pane .panel-form__body");se&&(se.scrollTop=0)}r.keepsInspectorTab(String($.current??""),Be)||d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(m)!=="{}"&&(v.current=null,d(r.setPropertiesPanelKey("")))},[m,d,n,T,E]);const U=(0,a.useMemo)(()=>{const ce=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:m.caption?m.caption:s("Edit element")})}];return B&&ce.push({key:r.STRUCTURE,label:s("Columns")}),ce},[m.caption,B,s]),I=(0,a.useMemo)(()=>[...U,...j.tabs.map(({key:ce,label:fe})=>({key:ce,label:fe}))],[U,j.tabs]),L=(0,a.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),P=ce=>{ce.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(p==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},z=ce=>{ce.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},le=()=>{l(m),d(r.resetToLastActiveSettingsTab()),setTimeout(()=>{d(p==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},C=(0,o.jsxs)(o.Fragment,{children:[x.deleteButtonEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Remove element by Delete Key"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:P,disabled:!m.deletable,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:x.iconStrokeWidth})})}),x.stepToOtherElementEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Up to parent element"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:z,disabled:!m.parent,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"GoToParent",component:t.icons$GoToParent,size:18,strokeWidth:x.iconStrokeWidth})})})]}),re=x.switchDesktopMobilePropsEnabled||x.stepToOtherElementEnabled||x.deleteButtonEnabled;return(0,o.jsxs)(t.ui_kit$PanelForm,{children:[(0,o.jsx)(t.ui_kit$PanelForm.Header,{onClose:le,closeIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"Close",component:t.icons$Close,size:24,strokeWidth:x.iconStrokeWidth}),extra:re?C:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:R?L:I,activeKey:_,onChange:N})}),(0,o.jsx)(t.ui_kit$PanelForm.Body,{children:R?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:_==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(nt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,o.jsx)("div",{style:{display:_==="Table properties"?void 0:"none"},children:(0,o.jsx)(nt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:_==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(nt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p})}),B&&(0,o.jsx)("div",{style:{display:_==="Structure"?void 0:"none"},children:(0,o.jsx)(rs,{selectedElement:m,emailElementType:p,isSelectedElement:!1})}),j.tabs.map(ce=>(0,o.jsx)("div",{className:ce.className,hidden:_!==ce.key,children:ce.children},ce.key))]})})]})},ic=({taxonomy:e})=>{const{__:i,_x:l}=r.useI18n(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=(0,a.useRef)(null),c=r.useSelector(r.selectActiveModal$1)===r.MODALS.ADD_NEW_GROUP_MODAL,p=r.useNotification(),g=r.useProjectData(),b=(0,a.useCallback)(()=>{n.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[n]);(0,a.useEffect)(()=>{c&&b()},[c,b]);const _=()=>s(r.closeModal$1()),[h,m]=r.useAddTermMutation(),[T,E]=(0,a.useState)(!1),x=()=>{n.validateFields().then(({name:R})=>(E(!0),h({project:g,kind:"group",name:R}).then(j=>{if("error"in j){p.error(j);return}p.success({title:i("The group “")+j.data.name+l("” was successfully created.",e)}),_()}))).catch(R=>{}).finally(()=>E(!1))};return(0,o.jsx)(t.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:x,onCancel:_,className:"new-group-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:m.isLoading||T,onClick:x,children:i("Create group")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:n,layout:"vertical",name:"add_new_group_form",onFinish:x,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:i("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:m.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},rc=({group:e,refetch:i})=>{const{__:l,_x:s}=r.useI18n(),n=r.useDispatch(),[d]=t.ui_kit$Form.useForm(),c=(0,a.useRef)(null),p=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,g=r.useNotification(),{id:b=null,name:_=""}=e,h=()=>n(r.closeModal$1()),[m,T]=r.useEditTermMutation();(0,a.useEffect)(()=>{p&&d.setFieldsValue({name:_})},[p,_,d]);const E=()=>{d.validateFields().then(({name:x})=>{m({kind:"group",id:b,name:x}).then(({data:R,error:j})=>{j?(g.error({error:j}),d.setFieldValue("name",x)):(i().then(({data:N})=>{if(N){const B=N[0]?.children?.find(v=>v.id===b)?.name;d.setFieldValue("name",B)}}),h(),g.success({title:l("The group “")+x+s("” was successfully changed to “","group")+R.name+l("”.")}))})})};return(0,o.jsx)(t.ui_kit$Modal,{title:l("Change group name"),open:p,onOk:E,onCancel:h,className:"new-group-name-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:T.isLoading,onClick:E,children:l("Change name")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:d,layout:"vertical",name:"rename_group_form",onFinish:E,initialValues:{remember:!1,name:_},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:l("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:T.isLoading,size:"large",placeholder:l("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},Ni={width:"100%"},lc=["hover"],sc={color:"#ff4d4f"},ac={color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0},nc=({level:e,onRename:i,onRemove:l})=>{const{__:s}=r.useI18n(),n=(0,a.useMemo)(()=>({items:[{label:s("Rename"),key:"Rename",icon:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:16}),onClick:()=>i(e)},{label:s("Remove"),key:"Remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),style:sc,onClick:()=>l(e)}]}),[s,e,l,i]);return(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"groups-management__group_menu","data-group-id":e.id,size:"large",children:(0,o.jsx)(t.ui_kit$Dropdown,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:n,trigger:lc,children:(0,o.jsx)("span",{className:"groups-management__actions",children:(0,o.jsx)(r.EmIcons,{icon:"MoreOutlined",component:t.icons$MoreOutlined})})})})},dc=({className:e,levels:i,readOnlyLevels:l=!1,levelsRead:s=!1,refetchProjectGroups:n,isLoading:d})=>{const{__:c,_x:p}=r.useI18n(),g=r.useDispatch(),b=r.useNotification(),{modal:_}=t.ui_kit$App.useApp(),{confirm:h}=_,{token:m}=(0,t.ui_kit$useToken)(),T=r.useSelector(r.selectProjectGroups),E=i??T,[x]=r.useDeleteTermMutation(),[R,j]=(0,a.useState)({id:null,name:""}),N=(0,a.useCallback)((I,L)=>{x({kind:"group",id:Number(I)}).unwrap().then(P=>{P?.deleted&&b.success({title:c("The group “")+L+p("” was successfully deleted.","recovery")})}).catch(P=>{b.error({error:P})})},[x,b,c,p]),B=(0,a.useCallback)(I=>{const L=I.name??"";h({mask:{closable:!0},centered:!0,title:p("Are you sure to delete “","group")+L+c("” group and all nested groups?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:ac}),okText:c("Yes"),cancelText:c("No"),onOk:()=>N(String(I.id),L)})},[h,N,c,p]),v=(0,a.useCallback)(I=>{g(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),j({id:I.id,name:I.name??""})},[g]),$=(0,a.useMemo)(()=>({marginBottom:m.formItemMarginBottomMD}),[m]),U=(0,a.useCallback)(()=>{g(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL))},[g]);return(0,o.jsxs)("div",{className:(0,Ue.default)("groups-management",{[e]:e}),children:[d?(0,o.jsx)(t.ui_kit$Skeleton,{active:!0}):(0,o.jsxs)(t.ui_kit$Row,{children:[!!E?.length&&E?.map((I,L)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${I.id}`,style:{marginBottom:m.formItemMarginBottomMD},label:(0,o.jsxs)(t.ui_kit$Flex,{justify:"space-between",align:"center",style:Ni,children:[(0,o.jsx)("span",{children:I.name}),!l&&(0,o.jsx)(nc,{level:I,onRename:v,onRemove:B})]}),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:l?"multiple":"tags",style:Ni,placeholder:c(l?"Select a category":"Type category here"),options:I.children?.map(P=>({label:P.name,value:String(P.id)})),tagRender:P=>{const{label:z,closable:le,onClose:C}=P,re=ce=>{ce.preventDefault(),ce.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:m.colorPrimary,onMouseDown:re,closable:le,onClose:C,style:{borderRadius:6},children:z})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},I.id)),l&&s&&!E?.length&&(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Text,{type:"secondary",style:$,children:c("This project has no template sections yet.")})}),!l&&(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:$,children:(0,o.jsx)(t.ui_kit$Button,{id:"add_group_button",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),style:Ni,onClick:U,children:c("Add group")})})})]}),(0,o.jsx)(ic,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,o.jsx)(rc,{group:R,refetch:n})]})};function cc(e,{gallery:i=!1}={}){const l=r.isEmailsV2Enabled(),s=r.useGetTemplateSectionsQuery({scope:"gallery"},{skip:!l||!i}),n=r.useGetTemplateSectionsQuery({scope:"project",projectId:e},{skip:!l||!e});return{emailsOnV2:l,standardSections:s.data,projectSections:n.data,projectSectionsLoading:l&&!!e&&n.isLoading}}var{title:Li,description:qt,tags:Jt,type:Oi,is_template:uc,group:ss}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},mc={[Li]:"",[qt]:"",[Jt]:[],[uc]:!1},pc={[qt]:"",[Jt]:[],[Oi]:""};function hc(e){const i=new Set;return e?.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0))}var bc=e=>Array.isArray(e)&&e.length>0,as=({className:e="",element:i})=>{const{__:l}=r.useI18n(),s=r.useDispatch(),n=r.useEmailAttributesWriter(),[d]=t.ui_kit$Form.useForm(),{token:c}=(0,t.ui_kit$useToken)(),p=r.useAppConfig(),g=r.useEditorLocked(),b=r.useEditorLockCheck(),_=r.useSelector(r.selectProjectGroups),{data:h}=r.useGetBlockTypesQuery(),m=r.useProjectData(),T=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,E=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{emailsOnV2:x,projectSections:R,projectSectionsLoading:j}=cc(m?.id),{data:N,refetch:B,isLoading:v,isFetching:$,isUninitialized:U,isSuccess:I}=r.useGetTermsQuery({project:m,kind:"group"},{skip:x||!m?.id}),L=(0,a.useMemo)(()=>x?R??[]:_,[x,R,_]);(0,a.useEffect)(()=>{N&&s(r.projectGroupsLoaded(N,T==="email"?i.group??[]:void 0))},[s,N,T,i.group]),(0,a.useEffect)(()=>{!U&&B()},[U,B]),(0,a.useEffect)(()=>{if(!x||!i.is_template)return;const Q=new Set(i.projectCategories??[]),K={};let q=!1;for(const Z of R??[]){const V=`group_${Z.id}`,M=(Z.children??[]).filter(X=>Q.has(String(X.id))).map(X=>String(X.id)),Y=d.getFieldValue(V);(!Y||Y.length!==M.length||M.some((X,oe)=>Y[oe]!==X))&&(q=!0),K[V]=M}q&&d.setFieldsValue(K)},[d,x,i.is_template,i.projectCategories,R]);const[P,z]=(0,a.useState)([]),[le,C]=(0,a.useState)([]),[re,ce]=(0,a.useState)(i.is_template||!1),fe=r.useProjectData();(0,a.useEffect)(()=>{!U&&B()},[i.group,B,U]),(0,a.useEffect)(()=>{if(I&&i.is_template&&bc(i.group)){const Q=i.group;let K={};Q.length&&_.length&&Q?.forEach(Z=>{_?.forEach(V=>{let M=V.children.find(Y=>Y.id===Z);M&&(K.hasOwnProperty(V.id)||(K[V.id]=[]),K[V.id].push({label:M.name,value:M.id}))})});let q={};for(let Z in K)K.hasOwnProperty(+Z)&&(q[`group_${Z}`]=K[Z].map(V=>({...V,value:String(V.value)})));d.setFieldsValue(q)}},[d,_,i.is_template,i.group,I]);const{data:Be,isFetching:se,refetch:he}=r.useGetTermsQuery({project:fe,kind:E},{skip:!fe?.id});(0,a.useEffect)(()=>{C(hc(Be)?.map(Q=>({value:Q.name,key:Q.id})))},[Be]),(0,a.useEffect)(()=>{if(i){const Q=r.getTaxonomy(i,E)??[],K=Be??[],q=Q.map(M=>M.name??""),Z=i.emailtags||i.blocktags||[],V=Q.concat(K).filter(M=>Z.some(Y=>r.sameTermId(M.id,Y))).map(M=>M.name??"");d.setFieldsValue({title:i.title,description:i.description,tags:Array.isArray(i.tags)?i.tags:V.length?Array.from(new Set(V)):q,type:i.type})}},[d,i,E,Be]);const Pe=(0,a.useMemo)(()=>{if(!(T==="email"?x:r.isBlocksV2Enabled())||!i)return[];const Q=r.getTaxonomy(i,E)??[],K=Be??[],q=[...Q,...K];return((T==="email"?i.emailtags:i.blocktags)??[]).filter(Z=>!q.some(V=>V.name&&r.sameTermId(V.id,Z)))},[x,T,i,E,Be]),[pe,De]=(0,a.useState)(void 0),Oe=!Array.isArray(i?.tags);(0,a.useEffect)(()=>{Oe&&Pe.length&&fe?.id&&!se&&pe!==i?.id&&(De(i?.id),he())},[Oe,Pe.length,fe?.id,se,pe,i?.id,he]);const Ce=Oe&&Pe.length>0&&(Be===void 0||se||pe!==i?.id),ge=Q=>{if(b())return;const K=Object.keys(Q)[0],q=Q,Z=K.split("_")[0];if(Z===Li)n({title:q[K]});else if(Z===qt)n({description:q[K]});else if(Z===Jt){const V=q[K],M=T==="email"&&(V?.length??0)===0;n({tags:(V??[]).map(Y=>Y.trim()),...M?{emailtags:[]}:{}})}else Z==="is"&&T==="email"?n({is_template:q[K]}):Z===Oi&&T==="block"&&n({type:q[K]});switch(K.split("_")[0]){case ss:if(x){const V=new Set((R??[]).flatMap(oe=>(oe.children??[]).map(me=>String(me.id)))),M=d.getFieldsValue(!0),Y=Object.keys(M).filter(oe=>oe.startsWith(`${ss}_`)).flatMap(oe=>M[oe]??[]).map(String).filter(oe=>V.has(oe)),X=(i.projectCategories??[]).map(String).filter(oe=>!V.has(oe));n({projectCategories:[...new Set([...X,...Y])]});break}s(r.setEmailGroups({[K.split("_")[1]]:Q[K]}));break;default:return}};(0,a.useEffect)(()=>{if(h){const Q=h;let K=[];const q={Applications:l("Apps"),Articles:l("Article"),Banners:l("Banners"),Buttons:l("Buttons"),"Call to Action":l("Call to Action"),Contacts:l("Contacts"),Content:l("Content"),"E-Commerce":l("E-Commerce"),Feature:l("Features"),Footer:l("Footers"),Header:l("Headers"),Lists:l("Lists"),Menu:l("Menus"),Other:l("Others"),Polls:l("Polls"),Promocodes:l("Promocodes"),Separators:l("Separators"),Transactional:l("Transactional")};for(let Z in Q)K.push({label:q[Q[Z]],value:Q[Z]});z(K)}},[h,l]);const _e=Q=>{ce(Q)};return(0,o.jsx)("div",{className:(0,Ue.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:T==="email"?{EmailInitialValues:mc}:pc,onValuesChange:ge,autoComplete:"off",disabled:g,children:[p.subjectEnabled&&T==="email"&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Title"),name:Li,tooltip:{title:l("The title of the email is displayed in the list of the templates and usually matches the subject line, but you can change it."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type title here"),autoSize:{minRows:1}})}),p.descriptionEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Description"),name:qt,tooltip:{title:l("Description is used in other sections of the service."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type your description here"),autoSize:{minRows:2}})}),p.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Tags"),name:Jt,tooltip:{title:l("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:l("Please input tags!"),type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:l("Type your tags here"),options:le,disabled:Ce||g,loading:Ce,tagRender:Q=>{const{label:K,closable:q,onClose:Z}=Q,V=M=>{M.preventDefault(),M.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:V,closable:q,onClose:Z,style:{borderRadius:6},children:K})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),T==="email"&&p.isTemplateEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,o.jsx)(t.ui_kit$Tooltip,{title:i.isNew?l("Save email first."):l("Use this email as a template for creating future emails."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:re,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",onChange:_e,disabled:!!i.isNew||g,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),re&&(0,o.jsx)(dc,{element:i,levels:L,readOnlyLevels:x,levelsRead:R!==void 0,refetchProjectGroups:B,isLoading:x?j:v||$}),T==="block"&&(0,o.jsx)(t.ui_kit$Form.Item,{name:Oi,label:l("Type"),tooltip:{title:l("Select the block type to find any block on the list faster."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:l("Please input type!")}],children:(0,o.jsx)(t.ui_kit$Select,{placeholder:l("Choose block type"),options:P,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};as.propTypes={className:f.default.string,email:f.default.object};var{utm_source:ns,utm_medium:ds,utm_campaign:cs,utm_term:us,utm_content:ms}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},gc={[ns]:"",[ds]:"",[cs]:"",[us]:"",[ms]:""},ps=({className:e="",email:i=void 0})=>{const{__:l}=r.useI18n(),s=r.useEmailAttributesWriter(),n=r.useEditorLocked(),d=r.useEditorLockCheck(),[c]=t.ui_kit$Form.useForm();(0,a.useEffect)(()=>{i&&c.setFieldsValue({utm_source:i.utm_parameters?.utm_source||"",utm_medium:i.utm_parameters?.utm_medium||"",utm_campaign:i.utm_parameters?.utm_campaign||"",utm_term:i.utm_parameters?.utm_term||"",utm_content:i.utm_parameters?.utm_content||""})},[c,i]);const p=g=>{if(d())return;const b=Object.keys(g)[0],_=g;s({utm_parameters:{...i?.utm_parameters,[b]:_[b]}})};return(0,o.jsx)("div",{className:(0,Ue.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:c,layout:"vertical",name:"settings_panel_form_utm",initialValues:gc,onValuesChange:p,autoComplete:"off",disabled:n,children:[(0,o.jsx)(t.ui_kit$Alert,{title:l("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_source"),name:ns,tooltip:{title:l("Mandatory. Indicates the traffic source. Example: utm_source=google"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("google")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_medium"),name:ds,tooltip:{title:l("Identifies what type of link was used, such as cost per click or email. For example: utm_medium=cpc"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("cpc")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_campaign"),name:cs,tooltip:{title:l("Indicates a specific product promotion or a marketing campaign. Example: utm_campaign=spring_sale"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("spring_sale")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_term"),name:us,tooltip:{title:l("Identifies search terms. For example: utm_term=running+shoes"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("running+shoes")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_content"),name:ms,tooltip:{title:l("Indicates what user clicked to get to the site: a banner or a text link. It is often used for A/B testing and ad campaigns. Example: utm_content=logolink or utm_content=textlink"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("textlink")})})]})})};ps.propTypes={className:f.default.string,email:f.default.object};var fc={USD:"$",EUR:"€",GBP:"£",RUB:"₽",JPY:"¥",CNY:"¥",INR:"₹",KRW:"₩",AUD:"A$",CAD:"C$",CHF:"CHF",BRL:"R$",MXN:"MX$",UAH:"₴",KZT:"₸",PLN:"zł",TRY:"₺",CZK:"Kč",ILS:"₪",SGD:"S$",HKD:"HK$",NZD:"NZ$",ZAR:"R"};function _c(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function hs(e){const i=e?.trim();return i?fc[i.toUpperCase()]??i:"$"}function $i(e,i){return`${hs(i)}${_c(e)}`}function xc(e){const i=parseFloat(e.price??""),l=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(l)&&l>0?{sale:$i(i-l,e.priceCurrency),original:$i(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:$i(i,e.priceCurrency)}}var no=({variant:e="line",width:i,height:l,className:s})=>{const n=(0,a.useMemo)(()=>({width:i,height:l}),[i,l]);return(0,o.jsx)("span",{className:(0,Ue.default)("preview-skeleton",`preview-skeleton--${e}`,s),style:n,"aria-hidden":"true"})};function Fi({className:e}){return(0,o.jsx)("svg",{className:e,width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}function bs({className:e}){return(0,o.jsxs)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,o.jsx)("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor"})]})}function kc({className:e}){return(0,o.jsxs)("svg",{className:e,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,o.jsx)("path",{d:"M12 12V7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 12L15.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 3a9 9 0 0 1 7.5 4",fill:"currentColor",fillOpacity:"0.18"})]})}var Ec=2;function Bc({card:e}){const i=xc(e),l=(0,a.useMemo)(()=>({backgroundImage:`url(${e.image})`}),[e.image]),s=!!e.headline?.trim(),n=!!e.image?.trim(),d=!i.sale&&!i.original;return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[n?(0,o.jsx)("div",{className:"product-carousel-preview__card-image",style:l}):(0,o.jsx)(no,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[s?(0,o.jsx)("div",{className:"product-carousel-preview__card-headline",children:e.headline}):(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(no,{height:12}),(0,o.jsx)(no,{height:12,width:"75%"})]}),d?(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(no,{width:48,height:14}),(0,o.jsx)(no,{width:40,height:12})]}):(i.sale||i.original)&&(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[i.sale&&(0,o.jsx)("span",{className:"product-carousel-preview__card-sale-price",children:i.sale}),i.original&&(0,o.jsx)("span",{className:"product-carousel-preview__card-original-price",children:i.original})]})]})]})}function Sc(){return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,o.jsx)(no,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(no,{height:12}),(0,o.jsx)(no,{height:12,width:"75%"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(no,{width:48,height:14}),(0,o.jsx)(no,{width:40,height:12})]})]})]})}var Tc=({data:e,subjectLine:i,cards:l})=>{const{__:s}=r.useI18n(),n=!!e.logo?.trim(),d=!!i?.trim();return(0,o.jsxs)("div",{className:"product-carousel-preview",children:[(0,o.jsx)("div",{className:"product-carousel-preview__header",children:(0,o.jsxs)("div",{className:"product-carousel-preview__header-main",children:[n?(0,o.jsx)("img",{src:e.logo,alt:"",className:"product-carousel-preview__logo"}):(0,o.jsx)(no,{variant:"circle",width:40,height:40,className:"product-carousel-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-text",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__header-row",children:[(0,o.jsx)("div",{className:"product-carousel-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"product-carousel-preview__time",children:"10:10 AM"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-row product-carousel-preview__header-row--subject",children:[d?(0,o.jsx)("div",{className:"product-carousel-preview__subject-line",children:i}):(0,o.jsx)(no,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,o.jsx)(Fi,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,o.jsx)("div",{className:"product-carousel-preview__carousel",children:l.length>0?l.map((c,p)=>(0,o.jsx)(Bc,{card:c},c.id||p)):Array.from({length:Ec},(c,p)=>(0,o.jsx)(Sc,{},`skeleton-${p}`))})]})};function Rc(e){const i=parseFloat(e?.price??""),l=parseFloat(e?.discountValue??"");if(!Number.isNaN(i)&&i>0&&!Number.isNaN(l)&&l>0){const n=Math.round(l/i*100);if(n>0)return`${n}% Off`}const s=e?.discountValue?.trim();return s?/off/i.test(s)||s.includes("%")?s:`${s} Off`:null}function gs(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var yc=({data:e,subjectLine:i,card:l})=>{const{__:s}=r.useI18n(),n=!!e.logo?.trim(),d=!!i?.trim(),c=!!l?.image?.trim(),p=!!l?.headline?.trim(),g=Rc(l),b=gs(e.discountCode),_=!!(g||b),h=(0,a.useMemo)(()=>({backgroundImage:`url(${l?.image})`}),[l?.image]);return(0,o.jsxs)("div",{className:"single-image-preview",children:[(0,o.jsx)("div",{className:"single-image-preview__header",children:(0,o.jsxs)("div",{className:"single-image-preview__header-main",children:[n?(0,o.jsx)("img",{src:e.logo,alt:"",className:"single-image-preview__logo"}):(0,o.jsx)(no,{variant:"circle",width:40,height:40,className:"single-image-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__header-text",children:[(0,o.jsxs)("div",{className:"single-image-preview__header-row",children:[(0,o.jsx)("div",{className:"single-image-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"single-image-preview__time",children:"10:10 AM"})]}),d?(0,o.jsx)("div",{className:"single-image-preview__subject-line",children:i}):(0,o.jsx)(no,{height:14,className:"single-image-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__promo-row",children:[(0,o.jsxs)("div",{className:"single-image-preview__promo-content",children:[g?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(bs,{className:"single-image-preview__promo-icon"}),(0,o.jsx)("span",{className:"single-image-preview__promo-badge",children:g})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(no,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,o.jsx)(no,{width:72,height:14})]}),_&&(0,o.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),b?(0,o.jsx)("span",{className:"single-image-preview__promo-code",children:b}):(0,o.jsx)(no,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,o.jsx)(Fi,{className:"single-image-preview__star-icon"})]})]})]})}),(0,o.jsxs)("div",{className:"single-image-preview__card",children:[c?(0,o.jsx)("div",{className:"single-image-preview__card-image",style:h}):(0,o.jsx)(no,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,o.jsx)("div",{className:"single-image-preview__card-body",children:p?(0,o.jsx)("div",{className:"single-image-preview__card-description",children:l?.headline}):(0,o.jsxs)("div",{className:"single-image-preview__card-description-skeleton",children:[(0,o.jsx)(no,{height:12}),(0,o.jsx)(no,{height:12,width:"92%"})]})})]})]})};function wc(e){const i=e?.trim();if(!i)return null;const l=(0,rt.default)(i);if(!l.isValid())return null;const s=(0,rt.default)().startOf("day"),n=l.startOf("day").diff(s,"day");return n===0?"Today":n===1?"Tomorrow":n>1&&n<=7?l.format("MMM D"):l.format("MMM D, YYYY")}function Mi(e){const i=e?.trim();return i||null}function jc(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function Ic(e,i){return jc(wc(e),i)}var vc=({data:e,subjectLine:i})=>{const{__:l}=r.useI18n(),s=!!e.logo?.trim(),n=!!i?.trim(),d=Mi(e.description),c=gs(e.discountCode),p=!!(d||c);return(0,o.jsx)("div",{className:"deal-annotation-preview",children:(0,o.jsxs)("div",{className:"deal-annotation-preview__header-main",children:[s?(0,o.jsx)("img",{src:e.logo,alt:"",className:"deal-annotation-preview__logo"}):(0,o.jsx)(no,{variant:"circle",width:40,height:40,className:"deal-annotation-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__header-text",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__header-row",children:[(0,o.jsx)("div",{className:"deal-annotation-preview__brand-name",children:l("Your company")}),(0,o.jsx)("div",{className:"deal-annotation-preview__time",children:"10:10 AM"})]}),n?(0,o.jsx)("div",{className:"deal-annotation-preview__subject-line",children:i}):(0,o.jsx)(no,{height:14,className:"deal-annotation-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-row",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-content",children:[d?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(bs,{className:"deal-annotation-preview__promo-icon"}),(0,o.jsx)("span",{className:"deal-annotation-preview__promo-badge",children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(no,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,o.jsx)(no,{width:72,height:14})]}),p&&(0,o.jsx)("span",{className:"deal-annotation-preview__promo-separator",children:"·"}),c?(0,o.jsx)("span",{className:"deal-annotation-preview__promo-code",children:c}):(0,o.jsx)(no,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,o.jsx)(Fi,{className:"deal-annotation-preview__star-icon"})]})]})]})})},Cc=({data:e})=>{const{__:i}=r.useI18n(),l=Mi(e.description),s=Ic(e.availabilityEnds,i),n=Mi(e.discountCode);return(0,o.jsxs)("div",{className:"deal-card-preview",children:[(0,o.jsx)("div",{className:"deal-card-preview__sender",children:i("Your company")}),l?(0,o.jsx)("div",{className:"deal-card-preview__headline",children:l}):(0,o.jsx)(no,{height:24,className:"deal-card-preview__headline-skeleton"}),(0,o.jsxs)("div",{className:"deal-card-preview__details",children:[(0,o.jsxs)("div",{className:"deal-card-preview__expires",children:[(0,o.jsx)(kc,{className:"deal-card-preview__clock-icon"}),(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Expires")}),s?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:s}):(0,o.jsx)(no,{width:72,height:14,className:"deal-card-preview__detail-skeleton"})]})]}),(0,o.jsx)("div",{className:"deal-card-preview__code",children:(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Code")}),n?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:n}):(0,o.jsx)(no,{width:56,height:14,className:"deal-card-preview__detail-skeleton"})]})})]}),(0,o.jsxs)("div",{className:"deal-card-preview__actions",children:[(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Visit site")}),(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Copy code")})]})]})};function Pc(e){return e.annotationType===Ke.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===Ke.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL?e.cards||[]:[]}function Ac(e,i){switch(e){case Ke.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case Ke.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION:return i("Deal Annotation");case Ke.GMAIL_ANNOTATION_TYPES.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var Di=300,Wo=16;function Nc(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function Lc(e){const i=Array.from(document.querySelectorAll(e));for(const l of i){if(!(l instanceof HTMLElement))continue;const s=l.getBoundingClientRect(),n=window.getComputedStyle(l);if(s.width>0&&s.height>0&&n.display!=="none"&&n.visibility!=="hidden")return l}return null}var Oc=({data:e,subjectLine:i,parentRef:l,overlayTargetSelector:s,onApply:n,applyDisabled:d=!1,applyBlockers:c=[],onRemove:p,visible:g=!0})=>{const{__:b}=r.useI18n(),[_,h]=(0,a.useState)(null),[m,T]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!g){h(null),T(null);return}const B=()=>{if(!Nc(l?.current)){h(null),T(null);return}if(s){const re=l?.current?.closest(".email-pane__col_settings-inner")||Lc(".email-pane__col_settings-inner");if(re){T(re),h({type:"popover"});return}}if(!l?.current)return;let z=l.current.getBoundingClientRect();if(z.width===0&&z.height===0){const re=l.current.closest(".email-pane__col");re&&(z=re.getBoundingClientRect())}const le=Math.max(Wo,Math.min(z.top,window.innerHeight-Wo));let C=z.left-Di-Wo;C<Wo&&(C=z.right+Wo),C+Di>window.innerWidth-Wo&&(C=window.innerWidth-Di-Wo),T(document.body),h({type:"side",top:le,left:Math.max(Wo,C)})};B();const v=window.requestAnimationFrame(B),$=[window],U=l?.current?.closest(".email-pane__collapse-wrapper"),I=l?.current?.closest(".email-pane__col");U&&$.push(U),I&&$.push(I),$.forEach(z=>{z.addEventListener("scroll",B,{passive:!0})}),window.addEventListener("resize",B);const L=l?.current,P=L&&typeof ResizeObserver<"u"?new ResizeObserver(B):null;return P?.observe(L),()=>{window.cancelAnimationFrame(v),P?.disconnect(),$.forEach(z=>{z.removeEventListener("scroll",B)}),window.removeEventListener("resize",B)}},[l,e,s,g]);const E=(0,a.useMemo)(()=>_?.type==="side"?{position:"fixed",top:_.top,left:_.left}:void 0,[_]);if(!g||!e||!Ke.hasGmailAnnotationsPreviewContent(e)&&!n||!_)return null;const x=Pc(e),R=e.annotationType||Ke.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,j=(()=>{switch(R){case Ke.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL:return(0,o.jsx)(Tc,{data:e,subjectLine:i,cards:x});case Ke.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW:return(0,o.jsx)(yc,{data:e,subjectLine:i,card:x[0]});case Ke.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION:return(0,o.jsx)(vc,{data:e,subjectLine:i});case Ke.GMAIL_ANNOTATION_TYPES.DEAL_CARD:return(0,o.jsx)(Cc,{data:e});default:return null}})(),N=(0,o.jsxs)("div",{className:`annotations-preview${_.type==="popover"?" annotations-preview--popover":""}`,style:E,children:[(0,o.jsxs)("div",{className:"annotations-preview__content",children:[(0,o.jsxs)("div",{className:"annotations-preview__type",children:[b("Preview"),": ",Ac(R,b)]}),j]}),(n||p)&&(0,o.jsxs)("div",{className:"annotations-preview__footer",children:[p&&(0,o.jsx)(t.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:p,children:b("Remove annotations")}),n&&(0,o.jsx)(t.ui_kit$Tooltip,{title:d&&c.length?c.join(". "):"",children:(0,o.jsx)("span",{className:"annotations-preview__apply-wrap",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"small",onClick:n,disabled:d,children:b("Apply")})})})]})]});return(0,Za.createPortal)(N,m||document.body)},{Text:$c}=t.ui_kit$Typography,Fc=10,Mc=1,fs={width:"100%"},Dc="https://developers.google.com/workspace/gmail/promotab",yo=["hover"],Vc=["annotationLogo"],_s=["cards",0,"price"],Hc=["cards",0,"discountPercent"],Uc=["cards",0,"priceCurrency"];function xo(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Fo={clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})},zc={optionFilterProp:"label"};function Wc(e){return{value:e||void 0}}var Gc=Ke.POPULAR_PRICE_CURRENCIES.map(e=>{const i=hs(e);return{value:e,label:i===e?e:`${e} (${i})`}}),xs=({name:e,pricePath:i,iconStrokeWidth:l})=>{const{__:s}=r.useI18n(),n=(0,a.useMemo)(()=>[i],[i]),d=(0,a.useMemo)(()=>[({getFieldValue:c})=>({validator:async(p,g)=>{const b=typeof g=="string"?g.trim():"";if(!b)return;if(Ke.parseDiscountPercent(b)===null)throw new Error(s("Discount must be a percentage greater than 0 and up to 100"));const _=Ke.parseDecimalInput(c(i));if(_===null||_<=0)throw new Error(s("Enter the price as a number to calculate the discount"))}})],[s,i]);return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:s("Discount, %"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,dependencies:n,rules:d,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Percent02Icon",component:t.icons$Percent02Icon,size:16,strokeWidth:l}),placeholder:s("Discount, %"),inputMode:"decimal",allowClear:Fo})})})},ks=({name:e,iconStrokeWidth:i})=>{const{__:l}=r.useI18n(),s=(0,a.useMemo)(()=>[{validator:async(n,d)=>{const c=typeof d=="string"?d.trim():"";if(c&&!Ke.isValidPriceCurrency(c))throw new Error(l("Price currency must be a three-letter ISO 4217 code, for example USD"))}}],[l]);return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:l("Price currency"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,rules:s,getValueProps:Wc,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:Gc,placeholder:l("Price currency"),prefix:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:zc,allowClear:!0,getPopupContainer:xo})})})},Yc=({onAdd:e})=>{const{__:i}=r.useI18n(),l=(0,a.useCallback)(()=>e(Ke.createEmptyAnnotationCard()),[e]);return(0,o.jsx)(t.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),onClick:l,children:i("Add card")})},Xc=({field:e,index:i,form:l,isSingleImagePreview:s,onRemove:n})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),p=(0,a.useMemo)(()=>[e.name,"image"],[e.name]),g=(0,a.useMemo)(()=>["cards",e.name,"image"],[e.name]),b=(0,a.useMemo)(()=>[e.name,"headline"],[e.name]),_=(0,a.useMemo)(()=>[e.name,"url"],[e.name]),h=(0,a.useMemo)(()=>[e.name,"price"],[e.name]),m=(0,a.useMemo)(()=>["cards",e.name,"price"],[e.name]),T=(0,a.useMemo)(()=>[e.name,"discountPercent"],[e.name]),E=(0,a.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),x=(0,a.useMemo)(()=>[e.name,"id"],[e.name]),R=(0,a.useMemo)(()=>[{validator:async(N,B)=>{const v=typeof B=="string"?B.trim():"";if(v&&!/^https?:\/\//i.test(v))throw new Error(d("Please enter the correct URL."))}}],[d]),j=(0,a.useCallback)(()=>n(e.name),[n,e.name]);return(0,o.jsxs)("div",{className:"selected-social-form__card",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsx)($c,{className:"selected-social-form__card-title",children:s?d("Single image preview"):`${d("Card")} ${i+1}`}),!s&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:d("Delete"),placement:"top",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:c.iconStrokeWidth}),"aria-label":d("Delete"),onClick:j})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:d("Image"),placement:"top",getPopupContainer:xo,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(Ao,{form:l,label:d("Image"),name:p,watchPath:g})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:d("Headline"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:b,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"ElementTitle",component:t.icons$ElementTitle,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Headline"),allowClear:Fo})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:d("Link"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:_,className:"selected-social-form__card-field",rules:R,children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Enter link"),allowClear:Fo})})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:d("Price"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Price"),allowClear:Fo})})}),(0,o.jsx)(xs,{name:T,pricePath:m,iconStrokeWidth:c.iconStrokeWidth}),(0,o.jsx)(ks,{name:E,iconStrokeWidth:c.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:x,hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})})]})};function Es({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:i("Discount code"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"discountCode",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Sale04Icon",component:t.icons$Sale04Icon,size:16,strokeWidth:e}),placeholder:i("Discount code"),allowClear:Fo})})})}var Kc=({className:e="",isActive:i=!0,email:l})=>{const{__:s}=r.useI18n(),n=r.useAppConfig(),d=r.useEditorLocked(),c=r.useEditorLockCheck(),{document:p}=r.useDocumentSessionContext(),g=r.useNotification(),[b]=t.ui_kit$Form.useForm(),_=(0,a.useRef)(null),h=(0,a.useRef)(!1),m=(0,a.useRef)(null),[T,E]=(0,a.useState)(!1),x=t.ui_kit$Form.useWatch("annotationType",b),R=t.ui_kit$Form.useWatch("annotationLogo",b),j=t.ui_kit$Form.useWatch("description",b),N=t.ui_kit$Form.useWatch("discountCode",b),B=t.ui_kit$Form.useWatch("availabilityStarts",b),v=t.ui_kit$Form.useWatch("availabilityEnds",b),$=t.ui_kit$Form.useWatch("offerPageUrl",b),U=t.ui_kit$Form.useWatch("merchantHomepageUrl",b),I=t.ui_kit$Form.useWatch("cards",b),L=JSON.stringify(I??[]),P=(0,a.useMemo)(()=>JSON.parse(L)??[],[L]),z=x||Ke.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,le=z===Ke.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL||z===Ke.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,C=z===Ke.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION||z===Ke.GMAIL_ANNOTATION_TYPES.DEAL_CARD,re=z===Ke.GMAIL_ANNOTATION_TYPES.DEAL_CARD,ce=z===Ke.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION,fe=z===Ke.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,Be=z===Ke.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW?Mc:Fc,se=(0,a.useMemo)(()=>[{value:Ke.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,label:s("Product carousel")},{value:Ke.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,label:s("Single image preview")},{value:Ke.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION,label:s("Deal Annotation")},{value:Ke.GMAIL_ANNOTATION_TYPES.DEAL_CARD,label:s("Deal Card")}],[s]),he=(0,a.useMemo)(()=>{let K="";p&&(K=p.getContent()),!K&&l?.html&&(K=l.html);const q=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i),Z=q?q[1].trim():l?.title||l?.subject||"";return Ke.formatPreviewSubjectLine(Z)},[p,l?.html,l?.title,l?.subject]),Pe=(0,a.useMemo)(()=>Ke.buildAnnotationsData({annotationType:z,annotationLogo:R,description:j,discountCode:N,availabilityStarts:B,availabilityEnds:v,offerPageUrl:$,merchantHomepageUrl:U,cards:P}),[z,R,j,N,B,v,$,U,P]),pe=(0,a.useMemo)(()=>le?Ke.getDiscountPercentBlockers(P,s):[],[le,P,s]),De=(0,a.useMemo)(()=>Ke.canApplyGmailAnnotations(Pe)&&pe.length===0,[Pe,pe]),Oe=(0,a.useMemo)(()=>[...Ke.getAnnotationsApplyBlockers(Pe,s),...pe],[Pe,pe,s]),Ce=(0,a.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),ge=(0,a.useCallback)(()=>{!p||c()||!Ke.removeAnnotationsFromDocument(p)||(b.setFieldsValue(Ke.getEmptyAnnotationsFormValues(z)),m.current={emailId:l?.id,markup:null},E(!1),g.success(s("Gmail annotations were removed from the template code.")))},[p,c,b,z,l?.id,g,s]);(0,a.useEffect)(()=>{if(!le)return;const K=b.getFieldValue("cards")??[];if(z===Ke.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW){if(K.length>1){b.setFieldsValue({cards:[K[0]]});return}K.length===0&&b.setFieldsValue({cards:[Ke.createEmptyAnnotationCard()]});return}K.length===0&&b.setFieldsValue({cards:[Ke.createEmptyAnnotationCard()]})},[b,le,z,P]);const _e=(0,a.useCallback)(K=>{if(!K||!h.current||!p||c())return!1;const q=Ke.applyAnnotationsEditToDocument(p,Ke.buildAnnotationsData(K));if(q){const Z=Ke.readGmailAnnotationsScript(p.getContent());m.current={emailId:l?.id,markup:Z},E(Z!==null)}return q},[p,c,l?.id]),Q=(0,a.useCallback)(()=>{_e(b.getFieldsValue(!0))&&g.success(s("Gmail annotation was successfully applied to the template code."))},[_e,b,g,s]);return(0,a.useEffect)(()=>{if(!i)return;const K=Ke.normalizeEditorHtml(p?.getContent()||l?.html||""),q={emailId:l?.id,markup:K?Ke.readGmailAnnotationsScript(K):null};if(E(q.markup!==null),!Ke.shouldReloadAnnotationsForm(m.current,q))return;m.current=q,h.current=!1;const Z=K?Ke.parseGmailAnnotations(K):null;b.setFieldsValue(Z?Ke.mapParsedAnnotationsToFormValues(Z):Ke.getEmptyAnnotationsFormValues()),h.current=!0},[i,l?.id,l?.html,p,b]),(0,o.jsxs)("div",{className:(0,Ue.default)("selected-social-form","annotations-panel",e),ref:_,children:[(0,o.jsx)(Oc,{data:Pe,subjectLine:he,parentRef:_,overlayTargetSelector:"#pane-content-iframe",onApply:Q,applyDisabled:!De||d,applyBlockers:Oe,onRemove:T&&!d?ge:void 0,visible:i}),(0,o.jsxs)(t.ui_kit$Form,{form:b,layout:"vertical",className:"selected-social-form__form element-controls",autoComplete:"off",disabled:d,children:[(0,o.jsxs)("div",{className:"selected-social-form__section",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:s("General settings")}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:s("Annotation type"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"annotationType",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:se,placeholder:s("Annotation type"),getPopupContainer:xo})})}),!re&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:s("Organization logo"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(Ao,{form:b,label:s("Organization logo"),name:"annotationLogo",watchPath:Vc})})}),(fe||ce)&&(0,o.jsx)(Es,{iconStrokeWidth:n.iconStrokeWidth}),fe&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:s("Price"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:_s,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:n.iconStrokeWidth}),placeholder:s("Price"),allowClear:Fo})})}),(0,o.jsx)(xs,{name:Hc,pricePath:_s,iconStrokeWidth:n.iconStrokeWidth}),(0,o.jsx)(ks,{name:Uc,iconStrokeWidth:n.iconStrokeWidth})]}),C&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:s("Discount description"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"description",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined,size:16,strokeWidth:n.iconStrokeWidth}),placeholder:s("Discount description"),allowClear:Fo})})}),re&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Es,{iconStrokeWidth:n.iconStrokeWidth}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:s("Offer page URL"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"offerPageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:n.iconStrokeWidth}),placeholder:s("Offer page URL"),allowClear:Fo})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:s("Merchant homepage URL"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"merchantHomepageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:n.iconStrokeWidth}),placeholder:s("Merchant homepage URL"),allowClear:Fo})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:s("Starts"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityStarts",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Starts"),style:fs,getPopupContainer:xo})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:yo,title:s("Ends"),placement:"bottom",getPopupContainer:xo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityEnds",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Ends"),style:fs,getPopupContainer:xo})})})})]})]})]}),le&&(0,o.jsxs)("div",{className:(0,Ue.default)("selected-social-form__section",{"selected-social-form__section--bordered":!fe,"annotations-panel__cards-section":fe}),children:[z===Ke.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL&&(0,o.jsxs)("div",{className:"selected-social-form__section-title",children:[s("Promotion cards"),(0,o.jsx)("span",{className:"annotations-panel__section-hint",children:s("max 10")})]}),(0,o.jsx)(t.ui_kit$Form.List,{name:"cards",children:(K,{add:q,remove:Z})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:K.map((V,M)=>(0,o.jsx)(Xc,{field:V,index:M,form:b,isSingleImagePreview:fe,onRemove:Z},V.key))}),!fe&&P.length<Be&&(0,o.jsx)(Yc,{onAdd:q})]})})]}),(0,o.jsxs)("div",{className:"annotations-panel__docs-hint",children:[Ce[0],(0,o.jsx)("a",{href:Dc,target:"_blank",rel:"noopener noreferrer",children:s("Gmail annotations")}),Ce[1]]})]})]})},qc={appearance:"title"},Vi=({email:e,pluginOnly:i=!1})=>{const{__:l}=r.useI18n(),s=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[n,d]=(0,a.useState)(r.SETTINGS),c=r.useAppConfig(),p=r.usePluginViewTabs("documentSettings",qc),{lastOpenedKey:g,lastOpenedStamp:b,claimNewest:_}=p,h=(0,a.useCallback)(I=>{p.activate(I),d(I||"")},[p]);(0,a.useEffect)(()=>{g&&(_(),d(g))},[g,b,_]);const m=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!m.current&&p.openedKnown){m.current=!0;const I=_();I&&d(I)}},[p.openedKnown,_]);const T=!i&&c.settingsTabEnabled,E=!i&&c.UTMEnabled&&s==="email",x=!i&&c.annotationsEnabled&&s==="email",R=[T&&"Settings",E&&"UTM parameters",x&&"Annotations parameters"].filter(Boolean),j=[...R,...p.openedKeys].includes(n)?n:R[0]??"",N=p.keys[0],B=R.length===0,v=B&&p.openedKnown&&p.openedKeys.length===0,$=(0,a.useRef)(!1);(0,a.useEffect)(()=>{B||($.current=!1)},[B]),(0,a.useEffect)(()=>{v&&N&&!$.current&&($.current=!0,p.activate(N))},[v,N,p]);const U=(0,a.useMemo)(()=>{const I=[];return T&&I.push({label:(0,o.jsx)(o.Fragment,{children:l("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(as,{className:"email-settings__collapse-panel-content",element:e})}),E&&I.push({label:(0,o.jsx)(o.Fragment,{children:l("UTM parameters")}),key:r.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(ps,{className:"email-settings__collapse-panel-content",email:e})}),x&&I.push({label:(0,o.jsx)(o.Fragment,{children:l("Annotations")}),key:r.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Kc,{className:"email-settings__collapse-panel-content",email:e,isActive:j===r.ANNOTATIONS_PARAMETERS})}),I.push(...p.tabs()),I},[l,e,T,E,x,j,p]);return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:j,onChange:h,items:U})})};Vi.propTypes={};var Bs=320,Jc=1200,Qc=350,{backgroundColor:Ss,backgroundImage:Hi,backgroundPositionX:Ui,backgroundPositionY:zi,backgroundRepeat:Qt,backgroundSize:Wi,responsive:Zc,backgroundColorContent:eu,width:Gi}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},ou={[Ss]:"",[Hi]:"",[Ui]:"",[zi]:"",[Qt]:"checked",[Wi]:"",[eu]:"",[Gi]:""};function Yi(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var Ts=({className:e=""})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),s=r.useDispatch(),n=r.useAppConfig(),[d]=t.ui_kit$Form.useForm(),c=r.useSendPostMessage(),p=r.useEmailAttribute("common_styles"),g=r.useSelector(r.selectEmailSettings),b=r.useSelector(r.selectIsSettingsDisabled$1),_=r.useSelector(r.selectActiveSettingsTab),h=r.useSelector(r.selectIsNeedUpdateAppearance),[m,T]=(0,a.useState)(!0),E=(0,a.useRef)(!1),x=(0,a.useRef)(null),R=i("Email not yet loaded or global container not found.");(0,a.useEffect)(()=>{h&&(s(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,h,s,c,p]),(0,a.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);const j=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],N=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,a.useEffect)(()=>{const{width:z,...le}=g,C={...le,backgroundImage:g.backgroundImage?g.backgroundImage[0]?.value:"",backgroundRepeat:g[Qt]===""?"repeat":g[Qt],backgroundSize:g[Wi],responsive:g.responsive?.shutdown};E.current||(C.width=z?.value,C.widthDim=z?.dim),d.setFieldsValue(C),T(!g.backgroundImage)},[g,d]);const B=(0,a.useCallback)(z=>{const le=Yi(z);!le||le.value<Bs||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:le}})},[c]),v=(0,a.useCallback)(z=>{const le=Yi(z);le&&s(r.setEmailSettings({...g,width:le}))},[s,g]),$=(0,a.useCallback)(z=>{x.current&&clearTimeout(x.current),v(z),x.current=setTimeout(()=>{B(z)},Qc)},[B,v]),U=z=>{const le=d.getFieldsValue(!0),C=Object.keys(z)[0];switch(C){case Gi:$(z[C]);break;case Ui:case zi:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[C]:z[C]===""?"none":z[C]}});break;case Hi:T(z[C]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[C]:[{...g?.backgroundImage?.[0],type:"url",value:z[C]}],backgroundSize:"cover"}});break;case Zc:{const re=Yi(le.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:z[C],styles:z[C]},...re?{width:re}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:z})}},I=z=>{s(r.setMobileViewActive({shutdown:z,styles:z})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},L=()=>{E.current=!0},P=()=>{x.current&&(clearTimeout(x.current),x.current=null);const z=d.getFieldValue(Gi);v(z),B(z),requestAnimationFrame(()=>{E.current=!1})};return(0,o.jsx)("div",{className:(0,Ue.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...ou},onValuesChange:U,autoComplete:"off",className:"element-controls",children:[b?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:R,type:"error"}):null,(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email layout width"),dividerTop:!1,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:g.width?.value?i("This field sets the width of the email."):i("Couldn`t determine the email width"),placement:"right",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$InputNumber,{min:Bs,max:Jc,placeholder:i("Width"),disabled:!g.width?.value,addonAfter:"px",onFocus:L,onBlur:P})})})})})}),n.emailResponsiveControlEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"responsive",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"responsive",label:i("Responsive email"),size:"small",name:"responsive",disabled:g.responsive?.shutdown===void 0,onChange:I})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email background color"),dividerTop:!n.emailResponsiveControlEnabled,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:m?16:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Ss,style:{marginBottom:l.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:g.usedColors,disabled:b})})})}),(0,o.jsx)(t.ui_kit$Col,{span:m?12:24,children:n.formEmailFieldBackgroundImageEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ao,{form:d,label:i("Background image"),name:Hi,tooltipTitle:i("Background image"),disabled:b||_!=="Styles",elementSettings:g}),!m&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Ui,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Vertical position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:zi,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical})})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image repeat"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Qt,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:b,options:j})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Wi,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:b,options:N})})})})]})]})]})})]})})]})})};Ts.propTypes={className:f.default.string};var{Option:Rs}=t.ui_kit$Select,{width:ys,widthDim:tu}={width:"width",widthDim:"widthDim"},iu={[ys]:"",[tu]:""},ws=({className:e=""})=>{const{__:i}=r.useI18n(),l=r.useSelector(r.selectBlockSettings),s=r.useSelector(r.selectIsSettingsDisabled),[n]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,a.useEffect)(()=>{n.setFieldsValue({width:l.width.value,widthDim:l.width.dim})},[l,n]);const p=g=>{const b=n.getFieldsValue(!0),_=Object.keys(g)[0];let h;switch(_){case"width":h={[_]:{value:g[_],dim:b.widthDim}};break;case"widthDim":h={width:{value:b.width,dim:g[_]}};break;default:return}d({operation:r.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:h})};return(0,o.jsx)("div",{className:(0,Ue.default)("block-appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...iu},onValuesChange:p,autoComplete:"off",children:[s?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Container width"),name:ys,tooltip:{title:i("Specifies the block width."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:i("Please input container width")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:s,placeholder:i("Container width"),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(Rs,{value:"px",children:"px"}),(0,o.jsx)(Rs,{value:"%",children:"%"})]})})})})]})})};ws.propTypes={className:f.default.string};var ru=()=>{};function js(){const e=r.useContainer(),i=(0,a.useCallback)(s=>{if(!e)return ru;const n=r.provideDefaultCommonStyles(e).watch(s);return()=>n.dispose()},[e]),l=(0,a.useCallback)(()=>r.getDefaultCommonStyles(e),[e]);return(0,a.useSyncExternalStore)(i,l,l)}function Is(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xi(e,i){const l={...e};for(const s of Object.keys(i)){const n=i[s],d=e[s];Is(n)&&Is(d)?l[s]=Xi(d,n):n!==void 0&&(l[s]=n)}return l}function vs(e,i){const l=r.COMMON_STYLES;if(typeof e=="string"){const s=e.trim();if(s.startsWith("{"))try{const n=JSON.parse(s);if(n&&typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length>0)return Xi(l,n)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?Xi(l,i):l}var Cs=e=>({textFontFamily:e.text.fontFamily,textFontSize:e.text.fontSize,textFontSizeDim:e.text.fontSizeDim,textLineHeight:e.text.lineHeight,textLineHeightDim:e.text.lineHeightDim,textColor:e.text.color,textContrastColor:e.text.contrastColor||"#FFFFFF",textAlign:e.text.textAlign,textPaddingBottom:e.text.paddingBottom,textPaddingBottomDim:e.text.paddingBottomDim,headingFontFamily:e.headings.fontFamily,headingFontSize:e.headings.fontSize,headingFontSizeDim:e.headings.fontSizeDim,headingLineHeight:e.headings.lineHeight,headingLineHeightDim:e.headings.lineHeightDim,headingColor:e.headings.color,headingContrastColor:e.headings.contrastColor||"#FFFFFF",headingAlign:e.headings.textAlign,headingPaddingTop:e.headings.paddingTop,headingPaddingTopDim:e.headings.paddingTopDim,headingPaddingBottom:e.headings.paddingBottom,headingPaddingBottomDim:e.headings.paddingBottomDim,headingLetterSpacing:e.headings.letterSpacing,headingLetterSpacingDim:e.headings.letterSpacingDim,headingBold:e.headings.bold,headingItalic:e.headings.italic,linkColor:e.links.color,linkContrastColor:e.links.contrastColor||"#FFFFFF",linkUnderline:e.links.underline,buttonsFontFamily:e.buttons.fontFamily,buttonsFontSize:e.buttons.fontSize,buttonsFontSizeDim:e.buttons.fontSizeDim,buttonsLetterSpacing:e.buttons.letterSpacing,buttonsLetterSpacingDim:e.buttons.letterSpacingDim,buttonsColor:e.buttons.color,buttonsContrastColor:e.buttons.contrastColor||"#1C52DC",buttonsBold:e.buttons.bold,buttonsItalic:e.buttons.italic,buttonsBackgroundColor:e.buttons.backgroundColor,buttonsContrastBackgroundColor:e.buttons.contrastBackgroundColor||"#FFFFFF",buttonsMarginTop:e.buttons.marginTop,buttonsMarginTopDim:e.buttons.marginTopDim,buttonsMarginBottom:e.buttons.marginBottom,buttonsMarginBottomDim:e.buttons.marginBottomDim,buttonsBorder:e.buttons.border,buttonsAlign:e.buttons.textAlign,buttonsBorderRadius:e.buttons.borderRadius,buttonsPadding:e.buttons.padding,cardsContrastBackgroundColor:e.cards?.contrastBackgroundColor||"#1C52DC",cardsBaseBackgroundColor:e.cards?.baseBackgroundColor||"#F8F8F8",cardsContrastTextColor:e.cards?.contrastTextColor||"#FFFFFF",cardsBaseTextColor:e.cards?.baseTextColor||"#5A5A5A",cardsBorder:e.cards?.border||{all:null,top:null,right:null,bottom:null,left:null},cardsBorderRadius:e.cards?.borderRadius||{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},blockBackgroundColor:e.block?.backgroundColor||"",blockContrastBackgroundColor:e.block?.contrastBackgroundColor||"#1C52DC",blockPaddingAll:e.block?.padding?.all,blockPaddingTop:e.block?.padding?.top,blockPaddingRight:e.block?.padding?.right,blockPaddingBottom:e.block?.padding?.bottom,blockPaddingLeft:e.block?.padding?.left}),lu={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},su={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},au={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},nu=({className:e})=>{const{__:i}=r.useI18n(),l=H.useGoogleFontsLoader(),s=r.useDispatch(),n=r.useSendPostMessage(),[d]=t.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),p=r.useSelector(r.selectIsNeedUpdateContentAppearance),g=js(),b=r.useEmailAttribute("common_styles"),_=r.useAppConfig(),{token:h}=(0,t.ui_kit$useToken)(),[m,T]=(0,a.useState)({}),[E,x]=(0,a.useState)({}),[R,j]=(0,a.useState)(!0),[N,B]=(0,a.useState)(!0),[v,$]=(0,a.useState)(!1),[U,I]=(0,a.useState)(!1),L={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},P=vs(b,g),[z,le]=(0,a.useState)(P.headings.bold),[C,re]=(0,a.useState)(P.headings.italic),[ce,fe]=(0,a.useState)(P.links.underline),[Be,se]=(0,a.useState)(P.buttons.bold),[he,Pe]=(0,a.useState)(P.buttons.italic),[pe,De]=(0,a.useState)(null),Oe=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,a.useEffect)(()=>{Oe||De(null)},[P,De,Oe]),(0,a.useEffect)(()=>{Oe&&!pe&&De(Cs(P))},[P,pe,Oe]),(0,a.useEffect)(()=>{p&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(Cs(P)))},[d,p,s,P]);const[Ce,ge]=(0,a.useState)(Math.min(P.headings.fontSize-1,19)),[_e,Q]=(0,a.useState)(Math.max(P.text.fontSize+1,20));(0,a.useEffect)(()=>{if(pe){const V=pe.buttonsBorder;T(V);const M=Object.keys(V).find(oe=>V[oe]?.width||V[oe]?.style||V[oe]?.color),Y=pe.cardsBorder;x(Y);const X=Object.keys(Y).find(oe=>Y[oe]?.width||Y[oe]?.style||Y[oe]?.color);d.setFieldsValue({buttons_borderPosition:M||"all",buttons_borderWidth:V[M]?.width!==null?V[M]?.width:"",buttons_borderColor:V[M]?.color||"",buttons_borderStyle:V[M]?.style||"",cards_borderPosition:X||"all",cards_borderWidth:Y[X]?.width!==null?Y[X]?.width:"",cards_borderColor:Y[X]?.color||"",cards_borderStyle:Y[X]?.style||"",buttons_borderRadiusAll:u(pe.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(pe.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(pe.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(pe.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(pe.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(pe.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(pe.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(pe.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(pe.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(pe.cardsBorderRadius.bottomRight),blockPaddingAll:u(pe.blockPaddingAll),blockPaddingTop:u(pe.blockPaddingTop),blockPaddingRight:u(pe.blockPaddingRight),blockPaddingBottom:u(pe.blockPaddingBottom),blockPaddingLeft:u(pe.blockPaddingLeft),blockPaddingLeftRight:u(pe.blockPaddingRight)||u(pe.blockPaddingLeft),blockPaddingTopBottom:u(pe.blockPaddingTop)||u(pe.blockPaddingBottom)}),!u(pe.blockPaddingAll)&&(u(pe.blockPaddingTop)||u(pe.blockPaddingRight)||u(pe.blockPaddingBottom)||u(pe.blockPaddingLeft))&&(pe.blockPaddingTop!==pe.blockPaddingBottom||pe.blockPaddingRight!==pe.blockPaddingLeft)?I(!1):I(!0),!u(pe.buttonsBorderRadius.all)&&(u(pe.buttonsBorderRadius.topLeft)||u(pe.buttonsBorderRadius.bottomLeft)||u(pe.buttonsBorderRadius.topRight)||u(pe.buttonsBorderRadius.bottomRight))?j(!1):j(!0),pe.buttonsPadding&&!u(pe.buttonsPadding.all)&&(u(pe.buttonsPadding.bottom)||u(pe.buttonsPadding.right)||u(pe.buttonsPadding.left)||u(pe.buttonsPadding.top))&&$(!1),!u(pe.cardsBorderRadius?.all)&&(u(pe.cardsBorderRadius?.topLeft)||u(pe.cardsBorderRadius?.bottomLeft)||u(pe.cardsBorderRadius?.topRight)||u(pe.cardsBorderRadius?.bottomRight))?B(!1):B(!0)}},[d,pe]);const K=()=>{I(M=>!M);const V=d.getFieldsValue(!0);if(!U){V.blockPaddingLeftRight=V.blockPaddingLeft,V.blockPaddingTopBottom=V.blockPaddingTop,V.blockPaddingRight=V.blockPaddingLeft,V.blockPaddingBottom=V.blockPaddingTop;const M=Number(V.blockPaddingTopBottom),Y=Number(V.blockPaddingLeftRight);n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(M)?M:0,bottom:Number.isFinite(M)?M:0,left:Number.isFinite(Y)?Y:0,right:Number.isFinite(Y)?Y:0}}})}},q=V=>{const M=V.target.closest("button");if(!M)return;const Y=M.name,X=M.classList.contains("selected-td-form__button--active");M.className=X?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{M.blur()}catch{}Y==="headingBold"?le(!X):Y==="headingItalic"?re(!X):Y==="linkUnderline"?fe(!X):Y==="buttonsBold"?se(!X):Y==="buttonsItalic"&&Pe(!X),n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Y]:!X}})},Z=V=>{const M=d.getFieldsValue(!0),Y=Object.keys(V)[0];let X={};switch(Y){case"headingFontSize":ge(Math.min(M.headingFontSize-1,19)),X=V;break;case"textFontSize":Q(Math.max(M.textFontSize+1,20)),X=V;break;case"buttons_borderStyle":X={buttonsBorder:{[M.buttons_borderPosition]:{...m[M.buttons_borderPosition],style:V[Y]}}},M.buttons_borderPosition==="all"?T(oe=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...oe[M.buttons_borderPosition],style:V[Y]}})):T(oe=>({...oe,[M.buttons_borderPosition]:{...oe[M.buttons_borderPosition],style:V[Y]}}));break;case"buttons_borderColor":X={buttonsBorder:{[M.buttons_borderPosition]:{...m[M.buttonsBorderPosition],color:V[Y]}}},M.buttons_borderPosition==="all"?T(oe=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...oe[M.buttons_borderPosition],color:V[Y]}})):T(oe=>({...oe,[M.buttons_borderPosition]:{...oe[M.buttons_borderPosition],color:V[Y]}}));break;case"buttons_borderWidth":X={buttonsBorder:{[M.buttons_borderPosition]:{...m[M.buttons_borderPosition],width:V[Y]}}},M.buttonsBorderPosition==="all"?T(oe=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...oe[M.buttons_borderPosition],width:V[Y]}})):T(oe=>({...oe,[M.buttons_borderPosition]:{...oe[M.buttons_borderPosition],width:V[Y]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:m[V[Y]]?.width||"",buttons_borderColor:m[V[Y]]?.color||"",buttons_borderStyle:m[V[Y]]?.style||""});break;case"cards_borderStyle":X={cardsBorder:{[M.cards_borderPosition]:{...E[M.cards_borderPosition],style:V[Y]}}},M.cards_borderPosition==="all"?x(oe=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...oe[M.cards_borderPosition],style:V[Y]}})):x(oe=>({...oe,[M.cards_borderPosition]:{...oe[M.cards_borderPosition],style:V[Y]}}));break;case"cards_borderColor":X={cardsBorder:{[M.cards_borderPosition]:{...E[M.cardsBorderPosition],color:V[Y]}}},M.cards_borderPosition==="all"?x(oe=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...oe[M.cards_borderPosition],color:V[Y]}})):x(oe=>({...oe,[M.cards_borderPosition]:{...oe[M.cards_borderPosition],color:V[Y]}}));break;case"cards_borderWidth":X={cardsBorder:{[M.cards_borderPosition]:{...E[M.cards_borderPosition],width:V[Y]}}},M.cardsBorderPosition==="all"?x(oe=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...oe[M.cards_borderPosition],width:V[Y]}})):x(oe=>({...oe,[M.cards_borderPosition]:{...oe[M.cards_borderPosition],width:V[Y]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:E[V[Y]]?.width||"",cards_borderColor:E[V[Y]]?.color||"",cards_borderStyle:E[V[Y]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":X={buttonsBorderRadius:{[lu[Y]]:+V[Y]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":X={cardsBorderRadius:{[su[Y]]:+V[Y]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":v?(X={padding:{all:+V[Y]}},d.setFieldsValue({paddingTop:V[Y],paddingLeft:V[Y],paddingRight:V[Y],paddingBottom:V[Y]})):X={buttonsPadding:{[L[Y]]:+V[Y]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":X={blockPadding:{[au[Y]]:+V[Y]}};break;case"blockPaddingTopBottom":X={blockPadding:{top:+V[Y],bottom:+V[Y]}},M.blockPaddingTop=M.blockPaddingBottom=+V[Y];break;case"blockPaddingLeftRight":X={blockPadding:{left:+V[Y],right:+V[Y]}},M.blockPaddingLeft=M.blockPaddingRight=+V[Y];break;default:X=V}Y!=="buttons_borderPosition"&&n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:X})};return pe&&(0,o.jsx)("div",{className:(0,Ue.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"content_appearance_panel_form",initialValues:pe,onValuesChange:Z,autoComplete:"off",className:"element-controls",children:[null,(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:U,onToggleExtended:K,fieldNames:{paddingLeftRight:"blockPaddingLeftRight",paddingLeft:"blockPaddingLeft",paddingRight:"blockPaddingRight",paddingTopBottom:"blockPaddingTopBottom",paddingTop:"blockPaddingTop",paddingBottom:"blockPaddingBottom"},labels:{horizontal:i("Horizontal padding"),vertical:i("Vertical padding"),left:i("Left padding"),right:i("Right padding"),top:i("Top padding"),bottom:i("Bottom padding"),individual:i("Individual padding")},gutter:10,rowStyle:{paddingBottom:4}})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("General text"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:V=>V.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font size of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:15,max:Ce,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Line height of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Color of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Headings"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:V=>V.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontSize",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:_e,max:40,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)({"selected-td-form__button--active":z}),type:"default",name:"headingBold",onClick:q,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)({"selected-td-form__button--active":C}),type:"default",name:"headingItalic",onClick:q,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block header color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Links"),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Underline"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)({"selected-td-form__button--active":ce}),type:"default",name:"linkUnderline",onClick:q,children:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Text & background")]}),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:V=>V.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontSize",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsLetterSpacing",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button text color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button background color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),_.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(et,{form:d,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign",withHotKeys:!1})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)({"selected-td-form__button--active":Be}),type:"default",name:"buttonsBold",onClick:q,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)({"selected-td-form__button--active":he}),type:"default",name:"buttonsItalic",onClick:q,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]})]}),_.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(H.SelectedElementFormBorder,{form:d,borders:m,namePrefix:"buttons_"})})}),_.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Ro,{form:d,oneBorderRadiusValue:R,setOneBorderRadiusValue:j,elementSettings:pe,namePrefix:"buttons_"})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base background color"),usedColors:c.usedColors})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Contrasting colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting background color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting text color"),usedColors:c.usedColors})})})})]})]}),_.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(H.SelectedElementFormBorder,{form:d,borders:E,namePrefix:"cards_"})})}),_.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Ro,{form:d,oneBorderRadiusValue:N,setOneBorderRadiusValue:B,elementSettings:pe,namePrefix:"cards_"})})})]})})},Ki=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,n]=(0,a.useState)(r.APPEARANCE),d=r.useAppConfig(),c=b=>n(b||"");e.common_styles&&e.common_styles;const p=l==="email"&&d.commonStylesEnabled&&!0;let g=[{label:(0,o.jsx)(o.Fragment,{children:i(l==="email"?"Global styles":"Block styles")}),key:r.APPEARANCE,forceRender:!0,className:"email-settings__collapse-panel",children:l==="email"?(0,o.jsx)(Ts,{className:"email-settings__collapse-panel-content"}):(0,o.jsx)(ws,{className:"email-settings__collapse-panel-content"})}];return p&&g.push({label:(0,o.jsx)(o.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(nu,{className:"email-settings__collapse-panel-content"})}),(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse appearance-panel__content-styles",size:"large",activeKey:s,onChange:c,items:g})})};Ki.propTypes={};var du=ao.__commonJSMin((e=>{var i=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"].reduce((l,s)=>(l[s.toLowerCase()]=s,l),{});e.CASE_SENSITIVE_TAG_NAMES_MAP=i}));function cu(e){return e.type===lo.Tag||e.type===lo.Script||e.type===lo.Style}var lo,uu,mu,pu,hu,bu,gu,fu,_u,xu,Ps=ao.__esmMin((()=>{(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(lo||(lo={})),uu=lo.Root,mu=lo.Text,pu=lo.Directive,hu=lo.Comment,bu=lo.Script,gu=lo.Style,fu=lo.Tag,_u=lo.CDATA,xu=lo.Doctype}));function As(e){return cu(e)}function Ns(e){return e.type===lo.CDATA}function Ls(e){return e.type===lo.Text}function Os(e){return e.type===lo.Comment}function $s(e){return e.type===lo.Directive}function Fs(e){return e.type===lo.Root}function ku(e){return Object.hasOwn(e,"children")}function qi(e,i=!1){let l;if(Ls(e))l=new Bt(e.data);else if(Os(e))l=new ei(e.data);else if(As(e)){const s=i?Ji(e.children):[],n=new ii(e.name,{...e.attribs},s);for(const d of s)d.parent=n;e.namespace!=null&&(n.namespace=e.namespace),e["x-attribsNamespace"]&&(n["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(n["x-attribsPrefix"]={...e["x-attribsPrefix"]}),l=n}else if(Ns(e)){const s=i?Ji(e.children):[],n=new ti(s);for(const d of s)d.parent=n;l=n}else if(Fs(e)){const s=i?Ji(e.children):[],n=new Tt(s);for(const d of s)d.parent=n;e["x-mode"]&&(n["x-mode"]=e["x-mode"]),l=n}else if($s(e)){const s=new oi(e.name,e.data);e["x-name"]!=null&&(s["x-name"]=e["x-name"],s["x-publicId"]=e["x-publicId"],s["x-systemId"]=e["x-systemId"]),l=s}else throw new Error(`Not implemented yet: ${e.type}`);return l.startIndex=e.startIndex,l.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(l.sourceCodeLocation=e.sourceCodeLocation),l}function Ji(e){const i=e.map(l=>qi(l,!0));for(let l=1;l<i.length;l++)i[l].prev=i[l-1],i[l-1].next=i[l];return i}var Zt,Et,Bt,ei,oi,St,ti,Tt,ii,Ms=ao.__esmMin((()=>{Ps(),Zt=class{parent=null;prev=null;next=null;startIndex=null;endIndex=null;get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return qi(this,e)}},Et=class extends Zt{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},Bt=class extends Et{type=lo.Text;get nodeType(){return 3}},ei=class extends Et{type=lo.Comment;get nodeType(){return 8}},oi=class extends Et{type=lo.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},St=class extends Zt{children;constructor(e){super(),this.children=e}get firstChild(){return this.children[0]??null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},ti=class extends St{type=lo.CDATA;get nodeType(){return 4}},Tt=class extends St{type=lo.Root;get nodeType(){return 9}},ii=class extends St{name;attribs;type;constructor(e,i,l=[],s=e==="script"?lo.Script:e==="style"?lo.Style:lo.Tag){super(l),this.name=e,this.attribs=i,this.type=s}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>({name:e,value:this.attribs[e],namespace:this["x-attribsNamespace"]?.[e],prefix:this["x-attribsPrefix"]?.[e]}))}namespace;"x-attribsNamespace";"x-attribsPrefix"}})),Qi=ao.__exportAll({CDATA:()=>ti,Comment:()=>ei,DataNode:()=>Et,Document:()=>Tt,DomHandler:()=>er,Element:()=>ii,Node:()=>Zt,NodeWithChildren:()=>St,ProcessingInstruction:()=>oi,Text:()=>Bt,cloneNode:()=>qi,default:()=>er,hasChildren:()=>ku,isCDATA:()=>Ns,isComment:()=>Os,isDirective:()=>$s,isDocument:()=>Fs,isTag:()=>As,isText:()=>Ls}),Zi,er,or=ao.__esmMin((()=>{Ps(),Ms(),Ms(),Zi={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},er=class{dom=[];root=new Tt(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,l){typeof i=="function"&&(l=i,i=Zi),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??Zi,this.elementCB=l??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new Tt(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;const e=this.tagStack.pop();this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,i){const l=this.options.xmlMode?lo.Tag:void 0,s=new ii(e,i,void 0,l);this.addNode(s),this.tagStack.push(s)}ontext(e){const{lastNode:i}=this;if(i&&i.type===lo.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const l=new Bt(e);this.addNode(l),this.lastNode=l}}oncomment(e){if(this.lastNode&&this.lastNode.type===lo.Comment){this.lastNode.data+=e;return}const i=new ei(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new Bt(""),i=new ti([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const l=new oi(e,i);this.addNode(l)}handleCallback(e){if(typeof this.callback=="function")this.callback(e,this.dom);else if(e)throw e}addNode(e){const i=this.tagStack[this.tagStack.length-1],l=i.children[i.children.length-1];this.options.withStartIndices&&this.parser&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),i.children.push(e),l&&(e.prev=l,l.next=e),e.parent=i,this.lastNode=null}}})),Ds=ao.__commonJSMin((e=>{var i=du(),l=(or(),ao.__toCommonJS(Qi)),s="\r",n=new RegExp(s,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function p(E){return i.CASE_SENSITIVE_TAG_NAMES_MAP[E]}function g(E){const x={};let R=0;const j=E.length;for(;R<j;R++){const N=E[R];x[N.name]=N.value}return x}function b(E){E=E.toLowerCase();const x=p(E);return x||E}function _(E,x){const R="<"+x,j=E.toLowerCase().indexOf(R);if(j===-1)return!1;const N=E[j+R.length];return N===">"||N===" "||N===" "||N===`
10
+ `||N==="\r"||N==="/"}function h(E){return E.replace(n,d)}function m(E){return E.replace(c,s)}function T(E,x=null,R){const j=[];let N,B=0;const v=E.length;for(;B<v;B++){const $=E[B];switch($.nodeType){case 1:{const I=b($.nodeName);N=new l.Element(I,g($.attributes)),N.children=T(I==="template"?$.content.childNodes:$.childNodes,N);break}case 3:N=new l.Text(m($.nodeValue??""));break;case 8:N=new l.Comment($.nodeValue??"");break;default:continue}const U=j[B-1]??null;U&&(U.next=N),N.parent=x,N.prev=U,N.next=null,j.push(N)}return R&&(N=new l.ProcessingInstruction(R.substring(0,R.indexOf(" ")).toLowerCase(),R),N.next=j[0]??null,N.parent=x,j.unshift(N),j[1]&&(j[1].prev=j[0])),j}e.escapeSpecialCharacters=h,e.formatDOM=T,e.hasOpenTag=_})),Eu=ao.__commonJSMin((e=>{var i=Ds(),l="html",s="head",n="body",d=/<([a-zA-Z]+[0-9]?)/;function c(E,x){return x?x.createHTML(E):E}var p=(E,x,R)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},g=(E,x,R)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},b=typeof window=="object"&&window.DOMParser;if(typeof b=="function"){const E=new b,x="text/html";g=(R,j,N)=>(j&&(R=`<${j}>${R}</${j}>`),E.parseFromString(R,x)),p=g}if(typeof document=="object"&&document.implementation){const E=document.implementation.createHTMLDocument();p=function(x,R,j){if(R){const N=E.documentElement.querySelector(R);return N&&(N.innerHTML=c(x,j)),E}return E.documentElement.innerHTML=c(x,j),E}}var _=typeof document=="object"&&document.createElement("template"),h;_&&_.content&&(h=(E,x)=>(_.innerHTML=c(E,x),_.content.childNodes));var m=()=>document.createDocumentFragment().childNodes;function T(E,x){E=i.escapeSpecialCharacters(E);const R=d.exec(E)?.[1]?.toLowerCase();switch(R){case l:{const j=g(E);if(!i.hasOpenTag(E,s)){const N=j.querySelector(s);N?.parentNode?.removeChild(N)}if(!i.hasOpenTag(E,n)){const N=j.querySelector(n);N?.parentNode?.removeChild(N)}return j.querySelectorAll(l)}case s:case n:{const j=p(E,void 0,x).querySelectorAll(R);return i.hasOpenTag(E,n)&&i.hasOpenTag(E,s)?j[0].parentNode?.childNodes??m():j}default:return h?h(E,x):p(E,n,x).querySelector(n)?.childNodes??m()}}e.default=T})),Bu=ao.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=Ds(),l=Eu(),s=/<(![a-zA-Z\s]+)>/;function n(d,c){if(typeof d!="string")throw new TypeError("First argument must be a string");if(!d)return[];const p=s.exec(d),g=p?p[1]:void 0;return i.formatDOM(l.default(d,c?.trustedTypePolicy),null,g)}e.default=n})),Su=ao.__commonJSMin((e=>{var i=0;e.SAME=i;var l=1;e.CAMELCASE=l,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),Tu=ao.__commonJSMin((e=>{var i=0,l=1,s=2,n=3,d=4,c=5,p=6;function g(B){return _.hasOwnProperty(B)?_[B]:null}function b(B,v,$,U,I,L,P){this.acceptsBooleans=v===s||v===n||v===d,this.attributeName=U,this.attributeNamespace=I,this.mustUseProperty=$,this.propertyName=B,this.type=v,this.sanitizeURL=L,this.removeEmptyString=P}var _={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(B=>{_[B]=new b(B,i,!1,B,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([B,v])=>{_[B]=new b(B,l,!1,v,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(B=>{_[B]=new b(B,s,!1,B.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(B=>{_[B]=new b(B,s,!1,B,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(B=>{_[B]=new b(B,n,!1,B.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(B=>{_[B]=new b(B,n,!0,B,null,!1,!1)}),["capture","download"].forEach(B=>{_[B]=new b(B,d,!1,B,null,!1,!1)}),["cols","rows","size","span"].forEach(B=>{_[B]=new b(B,p,!1,B,null,!1,!1)}),["rowSpan","start"].forEach(B=>{_[B]=new b(B,c,!1,B.toLowerCase(),null,!1,!1)});var h=/[\-\:]([a-z])/g,m=B=>B[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(B=>{const v=B.replace(h,m);_[v]=new b(v,l,!1,B,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(B=>{const v=B.replace(h,m);_[v]=new b(v,l,!1,B,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(B=>{const v=B.replace(h,m);_[v]=new b(v,l,!1,B,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(B=>{_[B]=new b(B,l,!1,B.toLowerCase(),null,!1,!1)});var T="xlinkHref";_[T]=new b("xlinkHref",l,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(B=>{_[B]=new b(B,l,!1,B.toLowerCase(),null,!0,!0)});var{CAMELCASE:E,SAME:x,possibleStandardNames:R}=Su(),j=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),N=Object.keys(R).reduce((B,v)=>{const $=R[v];return $===x?B[v]=v:$===E?B[v.toLowerCase()]=v:B[v]=$,B},{});e.BOOLEAN=n,e.BOOLEANISH_STRING=s,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=p,e.RESERVED=i,e.STRING=l,e.getPropertyInfo=g,e.isCustomAttribute=j,e.possibleStandardNames=N}));function Ru(e,i){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];i=i||{};var l=1,s=1;function n(E){var x=E.match(Hs);x&&(l+=x.length);var R=E.lastIndexOf(Ks);s=~R?E.length-R:s+E.length}function d(){var E={line:l,column:s};return function(x){return x.position=new c(E),b(),x}}function c(E){this.start=E,this.end={line:l,column:s},this.source=i.source}c.prototype.content=e;function p(E){var x=new Error(i.source+":"+l+":"+s+": "+E);if(x.reason=E,x.filename=i.source,x.line=l,x.column=s,x.source=e,!i.silent)throw x}function g(E){var x=E.exec(e);if(x){var R=x[0];return n(R),e=e.slice(R.length),x}}function b(){g(Us)}function _(E){var x;for(E=E||[];x=h();)x!==!1&&E.push(x);return E}function h(){var E=d();if(!(ir!=e.charAt(0)||rr!=e.charAt(1))){for(var x=2;Go!=e.charAt(x)&&(rr!=e.charAt(x)||ir!=e.charAt(x+1));)++x;if(x+=2,Go===e.charAt(x-1))return p("End of comment missing");var R=e.slice(2,x-2);return s+=2,n(R),e=e.slice(x),s+=2,E({type:qs,comment:R})}}function m(){var E=d(),x=g(zs);if(x){if(h(),!g(Ws))return p("property missing ':'");var R=g(Gs),j=E({type:Js,property:Vs(x[0].replace(tr,Go)),value:R?Vs(R[0].replace(tr,Go)):Go});return g(Ys),j}}function T(){var E=[];_(E);for(var x;x=m();)x!==!1&&(E.push(x),_(E));return E}return b(),T()}function Vs(e){return e?e.replace(Xs,Go):Go}var tr,Hs,Us,zs,Ws,Gs,Ys,Xs,Ks,ir,rr,Go,qs,Js,yu=ao.__esmMin((()=>{tr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Hs=/\n/g,Us=/^\s*/,zs=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Ws=/^:\s*/,Gs=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ys=/^[;\s]*/,Xs=/^\s+|\s+$/g,Ks=`
11
+ `,ir="/",rr="*",Go="",qs="comment",Js="declaration"}));function wu(e,i){let l=null;if(!e||typeof e!="string")return l;const s=Ru(e),n=typeof i=="function";return s.forEach(d=>{if(d.type!=="declaration")return;const{property:c,value:p}=d;n?i(c,p,d):p&&(l=l??{},l[c]=p)}),l}var ju=ao.__esmMin((()=>{yu()})),Iu=ao.__exportAll({default:()=>vu});function vu(e,i){const l={};return!e||typeof e!="string"||wu(e,(s,n)=>{s&&n&&(l[la(s,i)]=n)}),l}var Qs,Zs,ea,oa,ta,ia,ra,lr,la,Cu=ao.__esmMin((()=>{ju(),Qs=/^--[a-zA-Z0-9_-]+$/,Zs=/-([a-z])/g,ea=/^[^-]+$/,oa=/^-(webkit|moz|ms|o|khtml)-/,ta=/^-(ms)-/,ia=e=>!e||ea.test(e)||Qs.test(e),ra=(e,i)=>i.toUpperCase(),lr=(e,i)=>`${i}-`,la=(e,i={})=>ia(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(ta,lr):e=e.replace(oa,lr),e.replace(Zs,ra))})),sa=ao.__commonJSMin((e=>{var i=e&&e.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=d,e.setStyleProp=p;var l=po("react"),s=i((Cu(),ao.__toCommonJS(Iu))),n=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function d(_,h){return _.includes("-")?!n.has(_):!!(h&&typeof h.is=="string")}var c={reactCompat:!0};function p(_,h){if(typeof _=="string"){if(!_.trim()){h.style={};return}try{h.style=(0,s.default)(_,c)}catch{h.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(l.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var g=_=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(_.name);e.canTextBeChildOfNode=g;var b=_=>_;e.returnFirstArg=b})),aa=ao.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=Tu(),l=sa(),s=["checked","value"],n=["input","select","textarea"],d={reset:!0,submit:!0};function c(g={},b){const _={},h=!!(g.type&&d[g.type]);for(const m in g){const T=g[m];if((0,i.isCustomAttribute)(m)){_[m]=T;continue}const E=m.toLowerCase();let x=p(E);if(x){const R=(0,i.getPropertyInfo)(x);switch(s.includes(x)&&n.includes(b)&&!h&&(x=p("default"+E)),_[x]=T,R?.type){case i.BOOLEAN:_[x]=!0;break;case i.OVERLOADED_BOOLEAN:T===""&&(_[x]=!0)}continue}l.PRESERVE_CUSTOM_ATTRIBUTES&&(_[m]=T)}return(0,l.setStyleProp)(g.style,_),_}function p(g){return i.possibleStandardNames[g]}})),Pu=ao.__commonJSMin((e=>{var i=e&&e.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=p;var l=(or(),ao.__toCommonJS(Qi)),s=po("react"),n=i(aa()),d=sa(),c={cloneElement:s.cloneElement,createElement:s.createElement,isValidElement:s.isValidElement};function p(_,h={}){var m,T,E,x,R;const j=[],N=typeof h.replace=="function",B=(m=h.transform)!==null&&m!==void 0?m:d.returnFirstArg,{cloneElement:v,createElement:$,isValidElement:U}=(T=h.library)!==null&&T!==void 0?T:c,I=_.length;g(_);for(let L=0;L<I;L++){const P=_[L];if(N){let re=(E=h.replace)===null||E===void 0?void 0:E.call(h,P,L);if(U(re)){I>1&&(re=v(re,{key:(x=re.key)!==null&&x!==void 0?x:L})),j.push(B(re,P,L));continue}}if(P.type==="text"){const re=!P.data.trim().length;if(re&&P.parent&&!(0,d.canTextBeChildOfNode)(P.parent)||h.trim&&re)continue;j.push(B(P.data,P,L));continue}const z=P;let le={};b(z)?((0,d.setStyleProp)(z.attribs.style,z.attribs),le=z.attribs):z.attribs&&(le=(0,n.default)(z.attribs,z.name));let C;switch(P.type){case"script":case"style":P.children[0]&&(le.dangerouslySetInnerHTML={__html:P.children[0].data});break;case"tag":P.name==="textarea"&&P.children[0]?le.defaultValue=P.children[0].data:!((R=P.children)===null||R===void 0)&&R.length&&(C=p(P.children,h));break;default:continue}I>1&&(le.key=L),j.push(B($(P.name,le,C),P,L))}return j.length===1?j[0]:j}function g(_){for(const h of _)(h.type==="tag"||h.type==="script"||h.type==="style")&&(Object.setPrototypeOf(h,l.Element.prototype),g(h.children))}function b(_){return d.PRESERVE_CUSTOM_ATTRIBUTES&&_.type==="tag"&&(0,d.isCustomComponent)(_.name,_.attribs)}})),Au=ao.__commonJSMin((e=>{var i=e&&e.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=p;var l=i(Bu());e.htmlToDOM=l.default;var s=i(aa());e.attributesToProps=s.default;var n=i(Pu());e.domToReact=n.default;var d=(or(),ao.__toCommonJS(Qi));Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return d.Text}});var c={lowerCaseAttributeNames:!1};function p(g,b){var _;if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];const h=Object.assign(Object.assign({},(_=b?.htmlparser2)!==null&&_!==void 0?_:c),{trustedTypePolicy:b?.trustedTypePolicy});return(0,n.default)((0,l.default)(g,h),b)}})),dt=ao.__toESM(Au(),1),Nu=dt.default.default||dt.default,sr=new Set;function Lu(e,i){sr.has(e)||(sr.add(e),Promise.resolve(i()).finally(()=>{sr.delete(e)}))}var Ou={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function na(e,i,l){l.document&&(r.writeEmailAttributes(l.document,{[e]:i}),l.pushToDataLayer({event:"submit",action:Ou[e],entity_type:l.entityType,entity_id:l.entityId,project_id:l.projectId,context:"editor"}))}function ar({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function da({limitsInPlugin:e,hostedAiActive:i,counter:l,limit:s}){return ar({limitsInPlugin:e,hostedAiActive:i})?s>0&&l>=s:!1}function ca(e,i){if(!i||typeof e!="string")return i||e;const l=i.trim();if(!l)return e;if(/^\s*<!DOCTYPE/i.test(l)||/^\s*<\s*html[\s>]/i.test(l))return i;try{const s=new DOMParser().parseFromString(e,"text/html"),n=s.querySelector("editor");if(n){n.innerHTML=i;const d=e.match(/^[\s\uFEFF]*<!DOCTYPE[^>]*>/i);return`${d?`${d[0]}
12
+ `:""}${s.documentElement.outerHTML}`}}catch{}return i}var $u=e=>{const{__:i}=r.useI18n();return[{key:"📧",label:(0,o.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["📧 ",i("Subject line & preheader generator")]})},{key:"🌎",label:(0,o.jsxs)("div",{onClick:()=>{e("translator")},children:["🌎 ",i("Translator")]})},{key:"📄",label:(0,o.jsxs)("div",{onClick:()=>{e("writer")},children:["📄 ",i("Copywriter")]})},{key:"🔎",label:(0,o.jsxs)("div",{onClick:()=>{e("corrector")},children:["🔎 ",i("Proofreader")]})},{key:"🧠",label:(0,o.jsxs)("div",{onClick:()=>{e("psychologist")},children:["🧠 ",i("Psychologist")]})},{key:"📈",label:(0,o.jsxs)("div",{onClick:()=>{e("marketolog")},children:["📈 ",i("Marketer")]})},{key:"✨",label:(0,o.jsxs)("div",{onClick:()=>{e("email-generator")},children:["✨ ",i("Email generator")]})}]},Fu={background:r.emCssVar("colorInfo"),color:"#ffffff"},ua=({messages:e,newEmailAiGeneratorRef:i})=>{const l=r.useElementEntityKind(),{document:s}=r.useDocumentSessionContext(),n=r.useContentReader(),d=r.useUserContentReplacer(),{__:c,_n:p}=r.useI18n(),g=r.useDispatch(),b=r.useAppNavigate(),_=(0,a.useRef)(null),h=r.useAppConfig(),m=r.useEditorLocked(),T=r.useEditorLockCheck(),E=r.useNotification(),x=r.useEditorProjectId(),R=r.useWpEntityId(),j=r.usePushToDataLayer(),N={document:s,pushToDataLayer:j,entityType:l==="block"?"block":"email",entityId:R,projectId:x},B=r.useEventEmitter(To.events.ON_LIMIT_ID),[v,$]=(0,a.useState)(null),[U,I]=(0,a.useState)(0),[L,P]=(0,a.useState)(!1),[z,le]=(0,a.useState)(""),[C,re]=(0,a.useState)([]),[ce,fe]=(0,a.useState)(!1),[Be,se]=(0,a.useState)(!1),[he,Pe]=(0,a.useState)(null),[pe,De]=(0,a.useState)(0),[Oe,Ce]=(0,a.useState)(null),ge=r.useEmailAttribute("subject"),_e=r.useEmailAttribute("preheader"),Q=r.useCurrentUser(),K=r.toLanguageCode(r.useInterfaceLocale()),q=Q.avatar_url||Q.avatar_urls?.[24],Z=[Q.first_name,Q.last_name].filter(Boolean).join(" ")||Q.username,V=r.useMessageService(),[M]=r.useLazyGetDialogQuery(),Y=r.useSendPostMessage(),[X,oe]=r.useSendMessageMutation(),me=(0,a.useRef)(new Set),Te=(0,a.useCallback)(Ee=>{const S=X(Ee),ee=me.current;ee.add(S);const k=()=>ee.delete(S);return S.then(k,k),S},[X]);(0,a.useEffect)(()=>{const Ee=me.current;return()=>{Ee.forEach(S=>S.abort?.()),Ee.clear()}},[]);const[Se,{reset:te}]=r.useGetAiGenerateStatusMutation(),[D,{data:ie=[]}]=r.useLazyGetGeneratedContentQuery(),[ye]=r.useLazyGetLimitsStatsByTypeQuery(),W={cursor:L?"not-allowed":"default",pointerEvents:L?"none":"auto"};(0,a.useEffect)(()=>{Oe&&ce&&(i.current=!0),ce||(i.current=!1)},[Oe,ce]);const Re=!!(h.limits&&h.counters)&&!0,{limits:$e}=h.limits?h:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:Ae,ai_generator_limit:We}=$e,Ve=r.useEventEmitter(To.events.AI_TEXT_REQUEST_ID).hasListeners(),Ge=ar({limitsInPlugin:Re,hostedAiActive:Ve}),de=da({limitsInPlugin:Re,hostedAiActive:Ve,counter:U,limit:Ae}),je=da({limitsInPlugin:Re,hostedAiActive:Ve,counter:pe,limit:We}),G=(0,a.useCallback)(()=>{B.fire({name:"AiChatCount",count:U+1})},[B,U]),be=(0,a.useCallback)(()=>{B.fire({name:"AiGeneratorCount",count:pe+1})},[B,pe]),Le=(0,a.useCallback)(async Ee=>!0,[c,ye,E]);(0,a.useEffect)(()=>{Re&&(I(h?.counters?.ai_counter||0),De(h?.counters?.ai_generator_counter||0))},[h,Re]),(0,a.useEffect)(()=>{Ce(C.length<=0?!1:C.toReversed().find(S=>S.data?.context)?.data.context==="email-generator")},[C]);const He=(0,a.useCallback)(async()=>await V.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[V]),Je=(0,a.useCallback)(()=>{const Ee=_.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{Ee?.scrollTo({top:Ee.scrollHeight,behavior:"smooth"})},0)},[_]),Ze=(0,a.useCallback)(()=>{r.swallowPromiseRejection(M({entity_id:R}).then(Ee=>{re(Ee.data.documents),Je()}))},[R,M,re,Je]),so=(0,a.useCallback)(Ee=>{if(!Ee?.data?._eventResult)return!1;const{aiMessage:S,aiHtml:ee}=Ee.data;if(re(k=>{const ne=[...k];for(let ve=ne.length-1;ve>=0;ve--)if(ne[ve]?.data?.isLoading&&ne[ve]?.data?.role==="assistant"){ne[ve]={data:{role:"assistant",message:S,isLoading:!1}};break}return ne}),ee){const k=ca(n(),String(ee));d(k,{undoable:!0})}return Je(),!0},[n,d,Je]),O=(0,a.useCallback)(Ee=>{re(S=>{for(let ee=S.length-1;ee>=0;ee--)if(S[ee]?.data?.isLoading&&S[ee]?.data?.role==="assistant"){const k=[...S];return Ee?k[ee]={data:{role:"assistant",message:Ee}}:k.splice(ee,1),k}return S})},[]),ae=(0,a.useCallback)(Ee=>{const S=Ee?.message==="ERROR"?void 0:Ee?.message;return[Ee?.data?.message,S].find(ee=>typeof ee=="string"&&ee)||c("Something went wrong.")},[c]),w=s?.get().docId,y=r.useEventEmitter(To.events.AI_TEXT_PROGRESS_ID);(0,a.useEffect)(()=>{const Ee=y.event(({progress:S,status:ee,docId:k})=>{if(k!==w)return;const ne=ee||`${Math.round(S)}%`;re(ve=>{const qe=[...ve];for(let Fe=qe.length-1;Fe>=0;Fe--)if(qe[Fe]?.data?.isLoading&&qe[Fe]?.data?.role==="assistant"){qe[Fe]={data:{...qe[Fe].data,message:ne}};break}return qe})});return()=>Ee.dispose()},[y,w]);const ue=r.useEventEmitter(To.events.AI_TEXT_STREAM_ID);(0,a.useEffect)(()=>{const Ee=ue.event(({partialHtml:S,docId:ee})=>{if(ee!==w)return;const k=ca(n(),String(S));d(k,{undoable:!0})});return()=>Ee.dispose()},[ue,n,d,g,w]);const Ie=(0,a.useCallback)(Ee=>{fe(!0),P(!0),r.swallowPromiseRejection(Se({task_id:Ee||v,entity_id:R,status:"started"}).then(()=>{Ze()}))},[R,Se,v,Ze]),Ye=(0,a.useCallback)(()=>{Se({task_id:v,entity_id:R,status:"completed"}).then(Ee=>{Ee.data.status===403&&te(),Ze()}).catch(Ee=>{}),P(!1),fe(!1)},[R,Se,v,Ze,te]);(0,a.useEffect)(()=>{let Ee;if(ce){const S=ie[ie.length-1]?.processing?.email;if(S){let ee=ie[ie.length-1].status;d(String(S),{undoable:!0}),ee===0&&Ye()}he&&(clearInterval(Ee),fe(!1),Pe(!1),P(!1),O())}return()=>{clearInterval(Ee)}},[d,he,g,ie,ce,ge,_e,R,v,Ze,Se,oe,Ye,O]),(0,a.useEffect)(Je,[Je]),(0,a.useEffect)(()=>{e?.length>0&&re(e),Y({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,Y]),(0,a.useEffect)(()=>{const Ee=V.onInit(()=>{V.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:L}),V.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:L})});return()=>Ee.dispose()},[L,V]);const Qe=async()=>{if(z&&!T()){const Ee=z.replaceAll(/\n/g,"<br>"),S={project_id:x,connection:"chat",entity_id:R,message:Ee,locale:K,subject:ge||"",preheader:_e||"",textContent:li.extractDocumentTextContent(n())};if(Oe&&je||de){E.error({title:c(Oe?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")});const ee={data:{role:"assistant",message:c(Oe?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};re(k=>[...k,ee])}else{if(!await Le(Oe?"email_generate":"ai")){le("");return}Ge&&(Oe&&pe!==We?(be(),De(k=>k+1)):U!==Ae&&(G(),I(k=>k+1))),j({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:S.entity_id,project_id:S.project_id});const ee=[{data:{role:"user",message:Ee,userInfo:{display_name:Z,avatar_url:q}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];re(k=>[...k,...ee]),Te({body:S}).then(k=>{if(k?.error)throw k.error;if(!k?.data||k.data.status===401)throw new Error(r.ERROR);if(!so(k)){if(j({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:R,project_id:x,context:"editor"}),k.data.task_id){let ne=k.data.task_id;$(ne),D({id:ne,setError:Pe}),r.swallowPromiseRejection(He().then(ve=>{ve?Ie(ne):se(!0)}))}Ze()}}).catch(k=>{const ne=ae(k);E.error({title:k?.data?.code||c("Error"),description:ne}),O(ne)})}le("")}},co=async Ee=>{if(T())return;const S={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};re(k=>[...k,S]);const ee={project_id:x,connection:"chat",entity_id:R,context:Ee,locale:K,subject:ge||"",preheader:_e||"",textContent:li.extractDocumentTextContent(n())};if(Ge&&(Oe&&pe!==We?(be(),De(k=>k+1)):U!==Ae&&(G(),I(k=>k+1))),de)E.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),O(c("You have reached the limit of AI chat usage."));else{if(!await Le("ai")){O();return}j({event:"select",action:"select_ai_assistant_role",context:ee.context,entity_id:ee.entity_id,project_id:ee.project_id}),Te({body:ee}).then(k=>{if(k?.error)throw k.error;if(!k?.data||k.data.status===401)throw new Error(r.ERROR);so(k)||Ze()}).catch(k=>{const ne=ae(k);E.error({title:k?.data?.code||c("Error"),description:ne}),O(ne)})}},ro=(0,a.useCallback)(async Ee=>{const S={data:{role:"user",message:Ee,userInfo:{display_name:Z,avatar_url:q}}},ee={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};re(ne=>[...ne,S,ee]);const k={project_id:x,connection:"chat",entity_id:R,message:Ee,locale:K,subject:ge||"",preheader:_e||"",textContent:li.extractDocumentTextContent(n())};if(je)E.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),O(c("You have reached the limit of AI chat usage."));else{if(!await Le(Oe?"email_generate":"ai")){O();return}Te({body:k}).then(ne=>{if(ne?.error)throw ne.error;if(!ne?.data||ne.data.status===401)throw new Error(r.ERROR);if(!so(ne)){if(j({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:R,project_id:x,context:"editor"}),ne.data.task_id){let ve=ne.data.task_id;$(ve),D({id:ve,setError:Pe}),r.swallowPromiseRejection(He().then(qe=>{qe?Ie(ve):se(!0)}))}Ge&&(Oe&&pe!==We?(be(),De(ve=>ve+1)):U!==Ae&&(G(),I(ve=>ve+1))),Ze()}}).catch(ne=>{const ve=ae(ne);E.error({title:ne?.data?.code||c("Error"),description:ve}),O(ve)})}},[c,U,pe,q,He,O,Ie,ae,Z,Ae,We,Q,ge,_e,R,Oe,je,K,G,be,Ge,n,E,Le,x,Te,D,Ze]);(0,a.useEffect)(()=>{const Ee=new To.Disposable,S=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&S&&R&&!m){const ee={project_id:x,connection:"chat",entity_id:R,context:"email-generator",locale:K};Lu(`discuss-ai-generator-context:${R}`,()=>{if(Ve){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),ro(S);return}r.swallowPromiseRejection(X({body:ee}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),Ee.isDisposed()||ro(S)}))})}return()=>Ee.dispose()},[e,ro,R,K,x,X,Ve,m]);const uo=Ee=>{typeof Ee.target.className=="string"&&Ee.target.className.includes("ai-response-change-context")&&(oe.isLoading||co(Ee.target.role))},ko=Ee=>{if(T())return;const S=Ee.children[0].data??"";na("subject",S,N),E.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:S})},Bo=Ee=>{if(T())return;const S=Ee.children[0].data??"";na("preheader",S,N),E.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:S,duration:300})},F=Ee=>{const S=Ee.children[0].data;navigator.clipboard.writeText(S).then(()=>{E.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:S})}).catch(ee=>{})},J={replace:Ee=>{if(Ee.attribs?.class?.split(" ").includes("ai-response-title"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Replace the title"),children:(0,o.jsx)("div",{onClick:()=>ko(Ee),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,dt.domToReact)(Ee.children,J)})})});if(Ee.attribs?.class?.split(" ").includes("ai-response-preheader"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Replace the preheader"),children:(0,o.jsx)("div",{onClick:()=>Bo(Ee),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,dt.domToReact)(Ee.children,J)})})});if(Ee.attribs?.class?.split(" ").includes("ai-response-copy"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Copy to clipboard"),children:(0,o.jsx)("div",{onClick:()=>F(Ee),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,dt.domToReact)(Ee.children,J)})})});if(Ee.attribs?.class?.split(" ").includes("ai-response-user-message")){const S=Ee.attribs?.data||Ee.children?.[0]?.data;return(0,o.jsx)("li",{className:Ee.attribs?.class,data:Ee.attribs?.data,onClick:()=>ro(S),children:(0,dt.domToReact)(Ee.children,J)})}}},we=()=>{Ie(),se(!1)},ze=()=>{Ye(),se(!1)};return(0,o.jsxs)("div",{ref:_,className:"discuss-main",children:[C.length>0&&(0,o.jsx)(t.ui_kit$List,{onClick:uo,className:"comment-list",itemLayout:"horizontal",dataSource:C,renderItem:Ee=>(0,o.jsx)("li",{id:Ee._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:Ee.data.userInfo?"":"ai-comment",avatar:Ee.data.role==="assistant"?(0,o.jsx)(r.EmIcons,{icon:"ChatGpt",component:t.icons$ChatGpt,className:"anticon-robot",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}):Ee.data.userInfo&&Ee.data._modified?Ee.data.userInfo.avatar_url:q||(0,o.jsx)(r.EmIcons,{icon:"UserOutlined",component:t.icons$UserOutlined,className:"anticon-user",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}),author:(0,o.jsx)("div",{style:W,children:Ee?.data?.role==="user"?Q?.username||c("User"):c("AI Assistant")}),datetime:Ee._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(Ee._created),p,!0)}}):null,content:Ee.data.isLoading?(0,o.jsx)("div",{className:"spin",children:(0,o.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:t.icons$LoadingOutlined,style:{fontSize:24},spin:!0})}):(0,o.jsx)("div",{style:W,children:Nu(Ee.data.message,J)})})},Ee._id)}),Re&&(Oe?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${pe} ${c("of")} ${We>0?We:"∞"} ${c("mail generator")} ${p("was used","were used",pe)}`,exceeded:We>0&&pe>=We,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>b(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${U} ${c("of")} ${Ae>0?Ae:"∞"} ${c("messeges")} ${p("was used","were used",U)}`,exceeded:Ae>0&&U>=Ae,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>b(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,o.jsxs)(t.ui_kit$Form,{onFinish:Qe,className:"addMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{disabled:L||m,value:z,onChange:Ee=>le(Ee.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:Ee=>Ee.key==="Enter"&&Ee.ctrlKey&&Qe(),spellCheck:"false"})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Button,{disabled:oe.isLoading||L||m,type:"default",style:Fu,className:"button-target",children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"top",disabled:L,arrow:{pointAtCenter:!0},menu:{items:$u(co)},children:(0,o.jsxs)("div",{disabled:L,style:{margin:0,padding:0,color:"#ffffff",display:"inline-flex",alignItems:"center"},children:[(0,o.jsx)(r.EmIcons,{icon:"ChatGpt",component:t.icons$ChatGpt,style:{marginRight:5}}),c("Role")]})},"Export")}),(0,o.jsxs)(t.ui_kit$Button,{disabled:oe.isLoading||L||m,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]}),(0,o.jsx)(t.ui_kit$Modal,{title:c("Warning"),open:Be,onOk:we,onCancel:ze,children:(0,o.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},Mu=[r.VALID,r.ERRORS,r.WARNINGS],ma=({summary:e,__:i,selectedTags:l,setSelectedTags:s})=>{const n=(0,a.useCallback)((c,p)=>{s(p?l.length===2?[]:[...l,c]:l.filter(g=>g!==c))},[l,s]),d=(0,a.useCallback)(c=>i(c==="valid"?"Valid":c==="warnings"?"Warnings":"Errors"),[i]);return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"optimise__valid-title",children:(0,o.jsx)(t.ui_kit$Space,{className:"optimise__valid-title-space",size:8,children:Mu.map((c,p)=>(0,o.jsxs)(t.ui_kit$CheckableTag,{checked:l?.includes(c),onChange:g=>n(c,g),className:(0,Ue.default)(`${c} optimise__button`,{[`${c}_active`]:l.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+p))})})},{LINKS:Du}=r.OPTIMISE_TABS,pa=(0,a.memo)(({__:e,activeTab:i,validateLinksResult:l,validateLinks:s,selectedTags:n,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:g,onValidate:b,goToLinkHandler:_})=>i!==Du||!l?.links?null:l.links.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No links found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-14",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(ma,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:n}),(0,o.jsx)(t.ui_kit$Button,{disabled:p,loading:c,onClick:b,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:g}),children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:s,renderItem:(h,m)=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:h.status==="valid"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.VALID}):h.status==="warnings"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>_(h.linkId,600>(h.statusCode||0)&&(h.statusCode||0)>399||!h.statusCode),children:h.url===""?e("empty link"):h.url}),description:(0,o.jsxs)(o.Fragment,{children:[!!h.text?.length&&(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:h.text}),h.page?.title&&h.page.title,h.page?.secure&&h.status==="valid"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),!h.resolvedUrl&&!h.statusCode&&h.type==="url"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},m+"_"+h.linkId)})})})]}));pa.displayName="LinksSection";var{IMAGES:Vu}=r.OPTIMISE_TABS,ha=(0,a.memo)(({__:e,activeTab:i,validateImagesResult:l,validateImages:s,selectedTags:n,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:g,onValidate:b,goToImageHandler:_,showImgPreviewHandler:h,hideBlockPreviewHandler:m})=>i!==Vu||!l?.images?null:l.images.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,o.jsx)(t.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,o.jsxs)("div",{className:"optimise__summary",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.images.length," "]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.summaryTime?.value,l.summaryTime?.name]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...l.images.map(T=>T.image.responseTime))/1e3).toFixed(2)+e("s")}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("time to load")})]})]}),type:"warning"})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(ma,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:n}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:g}),disabled:p,loading:c,onClick:b,children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:s,renderItem:(T,E)=>(0,o.jsx)(t.ui_kit$List.Item,{className:`optimise__image-item image-item ${t.ui_kit$LIST_ITEM_BORDERLESS_CLASS}`,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{className:(0,Ue.default)("image-item__meta",{"image-item__meta_fail":!T.resolvedUrl&&!T.statusCode}),avatar:(0,o.jsx)(t.ui_kit$Image,{className:(0,Ue.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!T.resolvedUrl||!T.valid}),width:92,height:"auto",src:T.resolvedUrl||"",preview:!1,onMouseEnter:()=>h(T.url,T.image.dimensions?.width),onMouseLeave:()=>m()}),title:T.url?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:T.message,children:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>_(T.imageId,600>(T.statusCode||0)&&(T.statusCode||0)>399||!T.statusCode),children:T?.url===""?e("empty src"):T.url})}):T.message,description:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"image-size",children:[T.image.dimensions&&(0,o.jsxs)(o.Fragment,{children:[T.image.dimensions.width+" × "+T.image.dimensions.height,(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsxs)("span",{children:[Math.round(T.image.bytes/1024),e("kB")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsxs)("span",{children:[T.image.responseTime,e("ms")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsx)("span",{className:"image-size-format",children:Xo.normalizeImageFormatForDisplay(T.image.contentType)})]}),T.image.secure&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),T.resolvedUrl&&!T.valid&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!T.resolvedUrl&&!T.statusCode&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},E)})})})]}));ha.displayName="ImagesSection";var{SPAM_ASSASSIN:Hu}=r.OPTIMISE_TABS,ba=(0,a.memo)(({__:e,activeTab:i,validateSpamResult:l,isLoading:s,disabled:n,iconStrokeWidth:d,onValidate:c})=>{const p=l?.report?.length||Object.prototype.hasOwnProperty.call(l,"spamScore");if(i!==Hu||!p)return null;const g=l.spamScore||0,b=l.baseSpamScore||0,_=g<2||!l.spamScore||g<=b-1?"success":g<b-1?"warning":"danger";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:[(0,o.jsxs)("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam",children:[(0,o.jsxs)(t.ui_kit$Title,{level:1,className:"optimise__spam-score-title",type:_,children:[(0,o.jsx)("span",{className:"optimise__spam-score-value",children:g}),(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,o.jsx)(t.ui_kit$Button,{disabled:n,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:d}),loading:s,onClick:c,children:e("Refresh")})]}),g>b-1&&(0,o.jsx)(t.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(b-1)+"."})]}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(l.report?.length||0)>0?(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l.report,renderItem:h=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-report-score",children:h.score}),(0,o.jsx)("span",{className:"optimise__spam-report-description",children:h.description})]})})})}):(0,o.jsx)(o.Fragment,{children:l.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});ba.displayName="SpamSection";var{PROBLEMS:Uu}=r.OPTIMISE_TABS,ga=(0,a.memo)(({__:e,activeTab:i,problemsList:l,onSetMonacoPosition:s})=>i!==Uu?null:l?.length?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l,renderItem:n=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:n.severity<6?(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsxs)(t.ui_kit$Text,{onClick:()=>s(n),className:(0,Ue.default)("optimise__text-clickable",{warning:n.severity<6,error:n.severity>=6}),children:["Line: ",n.startLineNumber," ",n.startLineNumber!==n.endLineNumber&&" – "+n.endLineNumber]}),description:(0,o.jsx)(t.ui_kit$Text,{children:n.message})})})})})}):(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No problems found."),type:"info"})}));ga.displayName="ProblemsSection";var zu={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},validateLinksResult:{},validateImagesResult:{}},Wu=(e,i)=>{switch(i.type){case"SET_ACTIVE_TAB":return{...e,activeTab:i.payload!==e.activeTab?i.payload:""};case"SET_SELECTED_TAGS":return{...e,selectedTags:i.payload};case"SET_VALIDATE_LINKS":return{...e,validateLinks:i.payload};case"SET_VALIDATE_IMAGES":return{...e,validateImages:i.payload};case"SET_VALIDATE_SPAM_RESULT":return{...e,validateSpamResult:i.payload};case"SET_VALIDATE_LINKS_RESULT":return{...e,validateLinksResult:i.payload};case"SET_VALIDATE_IMAGES_RESULT":return{...e,validateImagesResult:i.payload};case"RESET_SELECTED_TAGS":return{...e,selectedTags:[]};default:return e}};function Gu(){const e=r.useContainer(),i=(0,a.useMemo)(()=>{if(!e)throw new Error("[optimise] нет DI-контейнера стора");return si.getOptimiseChecks(e)},[e]),l=(0,a.useCallback)(n=>{const d=i.watch(n);return()=>d.dispose()},[i]),s=(0,a.useSyncExternalStore)(l,()=>i.snapshot());return(0,a.useMemo)(()=>({...s,checks:i}),[s,i])}var Yu=()=>{const e=(0,a.useRef)(null);return{showImgPreviewHandler:(0,a.useCallback)((i,l)=>{e.current&&clearTimeout(e.current);let s=document.querySelector(".img-preview"),n=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(s=document.createElement("div"),s.classList.add("img-preview"),n=document.createElement("div"),n.classList.add("img-preview-content"),s.append(n),document.querySelector(".email-pane__col_settings-inner")?.append(s)),n&&(n.innerHTML=`<table cellspacing="0" cellpadding="0" border="0" width="100%"><img height="auto" width=${(l||0)+"px"} alt="" style="max-width: 100%; object-fit: contain" src=${i}></table>`),s&&s.style.opacity!=="1"&&setTimeout(()=>{s&&(s.style.opacity="1",s.style.transform="translateX(-100%)")},10)},[]),hideBlockPreviewHandler:(0,a.useCallback)(()=>{const i=document.querySelector(".img-preview");i&&(e.current=setTimeout(()=>{i&&(i.style.opacity="0",i.style.transform="translateX(-99%)",setTimeout(()=>{i?.remove()},300))},300))},[])}},{LINKS:Xu,IMAGES:Ku}=r.OPTIMISE_TABS,qu=({activeTab:e,selectedTags:i,validateLinksResult:l,validateImagesResult:s,setValidateLinks:n,setValidateImages:d})=>{(0,a.useEffect)(()=>{e===Xu&&l.links&&n(i.length>0?l.links.filter(c=>i.includes(c.status)):l.links),e===Ku&&s.images&&d(i.length>0?s.images.filter(c=>i.includes(c.status)):s.images)},[l.links,s.images,i,e,n,d])},Ju={ai:(0,o.jsx)(r.EmIcons,{icon:"AIRequests",component:t.icons$AIRequests}),email_generate:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),image_generate:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),optimization:(0,o.jsx)(r.EmIcons,{icon:"Optimization",component:t.icons$Optimization}),preview:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),test_sends:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),link_check:(0,o.jsx)(r.EmIcons,{icon:"Web",component:t.icons$Web}),image_check:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),spam_check:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),projects:(0,o.jsx)(r.EmIcons,{icon:"FolderOpen",component:t.icons$FolderOpen}),emails:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),blocks:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),users:(0,o.jsx)(r.EmIcons,{icon:"SliderGroup",component:t.icons$SliderGroup})};function fa(e,i){if(e==null)return null;if(typeof e=="number"||typeof e=="string"){const l=e==="∞"||typeof e=="string"&&e.toLowerCase()==="infinity";return(0,o.jsx)("span",{className:i==="old"?"limit-upgrade-modal__limit-old":`limit-upgrade-modal__limit-new${l?" limit-upgrade-modal__limit-new--infinity":""}`,children:l?"∞":e})}return e}var ri=({open:e,onClose:i,title:l,subtitle:s,usageResource:n,icon:d,previousDisplay:c,nextDisplay:p,onChangePlan:g,secondaryAction:b,changePlanLabel:_})=>{const{__:h}=r.useI18n(),m=_??h("Change plan"),T=!!b,E=n!=null?Ju[n]:d??null;return(0,o.jsx)(t.ui_kit$Modal,{open:e,onCancel:i,footer:null,closable:!1,width:400,centered:!0,className:"limit-upgrade-modal",destroyOnHidden:!0,mask:{closable:!0},children:(0,o.jsxs)("div",{className:"limit-upgrade-modal__wrap",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__header",children:(0,o.jsx)("button",{type:"button",className:"limit-upgrade-modal__close",onClick:i,"aria-label":h("Close"),children:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined})})}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,o.jsx)("h1",{className:"limit-upgrade-modal__title",children:l}),(0,o.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:s}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:E}),fa(c,"old"),(0,o.jsx)("div",{className:"limit-upgrade-modal__arrow-btn","aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"ArrowUpOutlined",component:t.icons$ArrowUpOutlined,className:"limit-upgrade-modal__arrow-icon"})}),fa(p,"new")]})]}),(0,o.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,o.jsx)("div",{className:T?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:b?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:b.onClick,children:b.label}),(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:m})]}):(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:m})})]})})},{LINKS:nr,IMAGES:dr,SPAM_ASSASSIN:_a,PROBLEMS:cr}=r.OPTIMISE_TABS,xa={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},ka={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},Ea=(e,i,l,s)=>`${e} ${l("of")} ${i>0?i:"∞"} ${s("test","tests",i>0?i:e)} ${s("was used","were used",e)}`,Ba=()=>{const{__:e,_n:i}=r.useI18n(),l=r.useDispatch(),s=r.useOpenPlanCatalog(),n=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),p=r.useAppConfig(),g=r.useEditorProjectId(),b=r.useRouteEmailId(),{document:_}=r.useDocumentSessionContext(),h=r.useEmailOfDocument(_,void 0),m=b||(h?.id!=null?String(h.id):void 0),T=m||h?.renderGuid,E=g||(h?.project!=null?String(h.project):void 0),[x,R]=(0,a.useState)(null),j=(0,a.useRef)(!1),N=(0,a.useRef)({link_check:!1,image_check:!1,spam_check:!1}),B=(0,a.useCallback)(te=>{R(te)},[]),v=r.useMessageService(),$=r.useSelector(r.selectProblemsList),U=r.usePushToDataLayer(),[I,L]=(0,a.useReducer)(Wu,zu),{checks:P,limits:z,running:le}=Gu(),{limitsInPlugin:C,perTypeAvailable:re,aggregateLimit:ce,aggregateCounter:fe,disableFields:Be,typeLimits:se}=z,he=(0,a.useCallback)(te=>si.isOptimiseTypeDisabled(z,te),[z]),Pe=(0,a.useCallback)(te=>L({type:"SET_VALIDATE_LINKS",payload:te}),[]),pe=(0,a.useCallback)(te=>L({type:"SET_VALIDATE_IMAGES",payload:te}),[]),De=(0,a.useCallback)(te=>L({type:"SET_SELECTED_TAGS",payload:te}),[]);qu({activeTab:I.activeTab,selectedTags:I.selectedTags,validateLinksResult:I.validateLinksResult,validateImagesResult:I.validateImagesResult,setValidateLinks:Pe,setValidateImages:pe});const{showImgPreviewHandler:Oe,hideBlockPreviewHandler:Ce}=Yu(),ge=(0,a.useCallback)(te=>{if(re){const{limit:D}=se[te];B({presetId:ka[te],previousDisplay:D>0?D:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}B({presetId:"optimization_exceeded",previousDisplay:ce,nextDisplay:r.presetLimitDisplay("infinity")})},[re,se,B,ce]),_e=(0,a.useCallback)((te,D)=>{switch(te.reason){case"notSaved":d.error({title:"Save the mail first."});return;case"typeLimit":ge(te.type);return;case"planLimit":B({presetId:te.exceeded.presetId,previousDisplay:te.exceeded.previousLimit,nextDisplay:r.presetLimitDisplay(te.exceeded.nextLimit)});return;case"usageLimit":B({presetId:ka[te.type],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")});return;case"failed":{if("error"in te){d.error({error:te.error});return}const ie=te.data;(ie?.statusCode??0)>300||!ie?.success?d.error({error:{data:ie}}):d.error({title:e("Something went wrong.")}),D();return}default:return}},[d,ge,B,e]),Q=(0,a.useCallback)(te=>{te!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${te}`})},[d,e]),K=(0,a.useCallback)(()=>{n(p.billingPageUrl||r.APP_ROUTES.billing)},[p.billingPageUrl,n]),q=te=>{if(!C||!re)return null;const{counter:D,limit:ie,disabled:ye}=se[te];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:Ea(D,ie,e,i),exceeded:ye,extra:(0,o.jsx)("button",{type:"button",style:xa,onClick:K,children:e("Need more?")})})},Z=(0,a.useCallback)((te,D)=>{v.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:te,isError:D}})},[v]),V=(0,a.useCallback)((te,D)=>{v.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:te,isError:D}})},[v]),M=(0,a.useCallback)(te=>{const D={startColumn:te.startColumn,startLineNumber:te.startLineNumber,endColumn:te.endColumn,endLineNumber:te.endLineNumber};l(r.setActiveProblemRange(D))},[l]),Y=(0,a.useCallback)(te=>{L({type:"SET_ACTIVE_TAB",payload:te}),L({type:"RESET_SELECTED_TAGS"}),te===cr&&$?.length>0&&U({event:"check",action:"check_email_code",email_id:m,project_id:E,problems_count:$?.length||0})},[$,U,m,E]),X=(0,a.useCallback)(te=>({entityId:T??"",readContent:c,beforeRequest:te}),[T,c]),oe=(0,a.useCallback)(async()=>{const te=await P.run("link_check",X(()=>v.send({operation:"sandbox_set_attr_to_links"})));if(te.ok===!1){_e(te,()=>!I.validateLinksResult.links&&Y(""));return}L({type:"SET_VALIDATE_LINKS_RESULT",payload:te.value}),d.success(e("Links validation was successfully completed")),Q(te.limitRemaining),U({event:"check",action:"check_email_links",email_id:m,project_id:E,links_count:te.value.links?.length||0})},[P,X,v,_e,I.validateLinksResult.links,Y,d,e,Q,U,m,E]),me=(0,a.useCallback)(async()=>{const te=await P.run("image_check",X(()=>v.send({operation:"sandbox_set_attr_to_images"})));if(te.ok===!1){_e(te,()=>!I.validateImagesResult?.images?.length&&Y(""));return}const{images:D,summary:ie,totalKb:ye}=te.value,W={images:D||[],summary:ie,summaryTime:{value:(ye>1200?ye/1e3:ye).toFixed(1),name:ye>1200?e("MB"):e("KB")}};L({type:"SET_VALIDATE_IMAGES_RESULT",payload:W}),d.success(e("Images validation was successfully completed")),Q(te.limitRemaining),U({event:"check",action:"check_email_images",email_id:m,project_id:E,images_count:W.images?.length||0})},[P,X,v,_e,I.validateImagesResult,Y,d,e,Q,U,m,E]),Te=(0,a.useCallback)(async()=>{const te=await P.run("spam_check",X());if(te.ok===!1){_e(te,()=>!I.validateSpamResult?.report?.length&&Y(""));return}L({type:"SET_VALIDATE_SPAM_RESULT",payload:te.value}),d.success(e("Spam validation was successfully completed")),Q(te.limitRemaining),U({event:"check",action:"check_email_spam",email_id:m,project_id:E,spam_score:te.value.spamScore||0})},[P,X,_e,I.validateSpamResult,Y,d,e,Q,U,m,E]);(0,a.useEffect)(()=>{if(C){if(re){si.OPTIMISE_LIMIT_TYPES.forEach(te=>{const{limit:D,counter:ie,disabled:ye}=se[te];if(!ye){N.current[te]=!1;return}N.current[te]||D>0&&ie>=D&&(N.current[te]=!0,ge(te))});return}if(!(ce>0&&fe>=ce)){j.current=!1;return}j.current||(j.current=!0,ge("link_check"))}},[C,re,se,fe,ce,ge]);const Se=x?r.getLimitUpgradePresetDefinition(x.presetId):null;return(0,o.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[Se&&x?(0,o.jsx)(ri,{open:!0,onClose:()=>R(null),title:e(Se.titleKey),subtitle:e(Se.subtitleKey),usageResource:Se.usageResource,previousDisplay:x.previousDisplay,nextDisplay:x.nextDisplay,onChangePlan:()=>{R(null),s()}}):null,C&&!re&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:Ea(fe,ce,e,i),exceeded:Be,extra:(0,o.jsx)("button",{type:"button",style:xa,onClick:K,children:e("Need more?")})}),p.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[q("link_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Links validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:te=>te.preventDefault(),onClick:()=>{Y(nr),!I.validateLinksResult?.links?.length&&I.activeTab!==nr&&oe()},loading:le.link_check,disabled:he("link_check")&&!I.validateLinksResult?.links?.length,children:!le.link_check&&(I.activeTab===nr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(pa,{__:e,activeTab:I.activeTab,validateLinksResult:I.validateLinksResult,validateLinks:I.validateLinks,selectedTags:I.selectedTags,setSelectedTags:De,isLoading:le.link_check,disabled:he("link_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:oe,goToLinkHandler:Z})]}),p.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[q("image_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Images validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:te=>te.preventDefault(),onClick:()=>{Y(dr),!I.validateImagesResult?.images?.length&&I.activeTab!==dr&&me()},loading:le.image_check,children:!le.image_check&&(I.activeTab===dr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(ha,{__:e,activeTab:I.activeTab,validateImagesResult:I.validateImagesResult,validateImages:I.validateImages,selectedTags:I.selectedTags,setSelectedTags:De,isLoading:le.image_check,disabled:he("image_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:me,goToImageHandler:V,showImgPreviewHandler:Oe,hideBlockPreviewHandler:Ce})]}),p.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[q("spam_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("SpamAssassin")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:te=>te.preventDefault(),loading:le.spam_check,onClick:()=>{Y(_a),I.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(I.validateSpamResult,"spamScore")||Te()},disabled:he("spam_check")&&!(I.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(I.validateSpamResult,"spamScore")),children:!le.spam_check&&(I.activeTab===_a?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(ba,{__:e,activeTab:I.activeTab,validateSpamResult:I.validateSpamResult,isLoading:le.spam_check,disabled:he("spam_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:Te})]}),p.optimizeCheckCodeEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:te=>te.preventDefault(),onClick:()=>Y(cr),children:I.activeTab===cr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth})})})]}),(0,o.jsx)(ga,{__:e,activeTab:I.activeTab,problemsList:$,onSetMonacoPosition:M})]})]})},Qu=({state:e,onCancel:i,onRetry:l,onDismiss:s})=>{const{__:n}=r.useI18n();return e.kind==="hidden"?null:(0,o.jsx)("div",{className:"indexing-tray",role:"status","aria-live":"polite",children:(0,o.jsx)(t.ui_kit$Card,{size:"small",variant:"borderless",className:"indexing-tray__card",children:(0,o.jsxs)(t.ui_kit$Flex,{vertical:!0,gap:8,children:[Zu(e,n),(0,o.jsx)(t.ui_kit$Flex,{justify:"flex-end",children:em(e,{onCancel:i,onRetry:l,onDismiss:s},n)})]})})})};function Zu(e,i){switch(e.kind){case"scanning":return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Flex,{align:"center",gap:8,children:[(0,o.jsx)(t.ui_kit$Spin,{size:"small"}),(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Moving files from old storage…")})]}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:i("Found so far: %s").replace("%s",String(e.scanned))}),(0,o.jsx)(t.ui_kit$Progress,{percent:100,status:"active",showInfo:!1,strokeColor:r.emCssVar("colorPrimary")})]});case"indexing":{const l=e.total>0?Math.min(100,Math.round(e.scanned/e.total*100)):0;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Indexing files…")}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:`${e.scanned} / ${e.total}`}),(0,o.jsx)(t.ui_kit$Progress,{percent:l,status:"active",strokeColor:r.emCssVar("colorPrimary")})]})}case"done":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Files ready: %s").replace("%s",String(e.files+e.folders+e.trashed))});case"failed":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Could not move files from old storage")});case"cancelled":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Move stopped")});default:return null}}function em(e,i,l){switch(e.kind){case"scanning":case"indexing":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onCancel,disabled:e.cancelling,children:e.cancelling?l("Stopping…"):l("Cancel")});case"failed":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:l("Retry")});case"cancelled":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:l("Resume")});case"done":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onDismiss,children:l("Close")});default:return null}}var om=2500,Sa=48,tm=4e3;function im(e){switch(e.status){case"running":return e.phase==="indexing"?{kind:"indexing",scanned:e.scanned??0,total:e.total??0,cancelling:!!e.cancelling}:{kind:"scanning",scanned:e.scanned??0,cancelling:!!e.cancelling};case"done":return{kind:"done",files:e.files??0,folders:e.folders??0,trashed:e.trashed??0};case"failed":return{kind:"failed"};case"cancelled":return{kind:"cancelled"};default:return{kind:"hidden"}}}function rm(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function lm({projectId:e,api:i,triggered:l,onCompleted:s}){const[n,d]=(0,a.useState)({kind:"hidden"}),c=(0,a.useRef)(!1),p=(0,a.useRef)(!0),g=(0,a.useRef)(e);g.current=e;const b=(0,a.useRef)(l);b.current=l;const _=(0,a.useRef)(s);_.current=s,(0,a.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]),(0,a.useEffect)(()=>{d({kind:"hidden"})},[e]);const h=(0,a.useCallback)(async()=>{try{const T=await i.files.backfillList({project_id:e});return!T.ok||T.error?null:im(T.data)}catch{return null}},[i,e]),m=(0,a.useCallback)(async()=>{if(c.current)return;c.current=!0;const T=g.current;let E=0;try{for(;p.current&&g.current===T&&b.current;){const x=await h();if(!p.current)break;if(x)if(x.kind==="hidden"){if(E+=1,E>=Sa){d({kind:"failed"});break}}else{if(E=0,d(x),x.kind==="done")try{await _.current?.()}catch{}if(rm(x))break}else if(E+=1,E>=Sa){d({kind:"failed"});break}await new Promise(R=>setTimeout(R,om))}}finally{c.current=!1}},[h]);return(0,a.useEffect)(()=>{l&&m()},[l,m]),(0,a.useEffect)(()=>{if(n.kind!=="done")return;const T=setTimeout(()=>{p.current&&d({kind:"hidden"})},tm);return()=>clearTimeout(T)},[n.kind]),{state:n,cancel:(0,a.useCallback)(()=>{d(T=>T.kind==="scanning"||T.kind==="indexing"?{...T,cancelling:!0}:T),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,a.useCallback)(()=>{b.current=!0,i.files.backfillCreate({project_id:e}),m()},[i,e,m]),dismiss:(0,a.useCallback)(()=>d({kind:"hidden"}),[])}}var sm=r.lazyRoute(()=>(0,It.__vitePreload)(()=>Promise.resolve().then(()=>po("./a6abc393.js")),void 0,{}.url)),am=r.lazyRoute(()=>(0,It.__vitePreload)(()=>Promise.resolve().then(()=>po("./c0b0ceff.js")),void 0,{}.url)),Ta={height:"100%"};function nm(e){(e?(0,It.__vitePreload)(()=>Promise.resolve().then(()=>po("./de0d3c9a.js")),void 0,{}.url):(0,It.__vitePreload)(()=>Promise.resolve().then(()=>po("./3bff2ae6.js")),void 0,{}.url)).catch(()=>{})}var dm=({storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:n})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),p=!!d.imageCenterFileManagerView;(0,a.useEffect)(()=>{c&&nm(p)},[c,p]);let g=(0,o.jsx)(t.ui_kit$PageLoader,{style:Ta});return e&&i&&d.imageCenterFileManagerView?g=(0,o.jsx)(sm,{storageProvider:e,dataProvider:i,pathProxy:l},n):e&&i&&(g=(0,o.jsx)(am,{dataProvider:i,usesBuiltInStorage:s},n)),(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:Ta}),children:g})};function cm(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useStorageProvider(),s=r.useProjectData(),n=r.useRestClient(r.EM_FILES_MODULES),d=r.useStore(),c=(0,a.useMemo)(()=>r.createRestClientV2(d),[d]),p=r.useI18n(),g=r.useCurrentUser(),b=s?.id?String(s.id):"",_=g?.id!=="0"?String(g.id):"",h=r.isFileManagerV2Enabled(e),[m,T]=(0,a.useState)(null),E=h&&!!b&&m===b,[x,R]=(0,a.useState)(0),[j,N]=(0,a.useState)(0),B=(0,a.useRef)(b);(0,a.useEffect)(()=>{B.current!==b&&(B.current=b,T(null))},[b]);const v=(0,a.useCallback)(L=>{L&&b&&T(b)},[b]),$=(0,a.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:l,projectId:b,restApi:n,restApiV2:c,i18n:p,pathPostfix:_,appConfig:e,isStandalone:i,onIndexingStateChange:v}),[e,v,p,i,b,x,n,c,l,_]),U=(0,a.useCallback)(async()=>{try{typeof $.dataProvider?.clearCache=="function"&&await $.dataProvider.clearCache()}catch{}T(null),R(L=>L+1),N(L=>L+1)},[$.dataProvider]),I=(0,a.useCallback)(()=>{b&&T(b)},[b]);return{...$,projectId:b,restApiV2:c,v2Enabled:h,backfillTriggered:E,contentKey:`${b}:${j}`,handleIndexingCompleted:U,markIndexingStarted:I}}var um={height:"100%"},Ra=()=>{const{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,projectId:n,restApiV2:d,v2Enabled:c,backfillTriggered:p,contentKey:g,handleIndexingCompleted:b,markIndexingStarted:_}=cm(),h=r.useSelector(r.selectActiveModal$1),m=r.isImageCenterModal(h),{state:T,cancel:E,retry:x,dismiss:R}=lm({projectId:n,api:d,triggered:p,onCompleted:b}),j=a.default.useCallback(()=>{_(),x()},[_,x]);return(0,o.jsxs)(o.Fragment,{children:[m&&(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:um}),children:(0,o.jsx)(dm,{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:g})}),c&&(0,o.jsx)(Qu,{state:T,onCancel:E,onRetry:j,onDismiss:R})]})},mm=(function(){var e=window.__emailmaker__;if(e&&e.assetUrl)return e.assetUrl("icon-menu-block-welcome.1c534a003522feadd2e7.png");if(e&&e.publicPath)try{return new URL("static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png",e.publicPath).href}catch{}try{return new URL("/static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png",typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"").href}catch{return"/static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png"}})();function pm(e){return!!(e?.global_block??e?.acf?.global_block)}var hm=({className:e,size:i=16})=>{const l=r.useAppConfig(),{__:s}=r.useI18n(),n=s("Global block");return(0,o.jsx)(t.ui_kit$Tooltip,{title:n,placement:"top",trigger:["hover"],children:(0,o.jsx)("span",{className:(0,Ue.default)("block-global-badge",e),"aria-label":n,role:"img",children:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:i,strokeWidth:l.iconStrokeWidth})})})},ya=new Map;function wa(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function ur(e,i){const l=i??"";if(e===void 0)return r.sanitizeHtml(wa(l));const s=String(e),n=ya.get(s);if(n&&n.source===l)return n.markup;const d=r.sanitizeHtml(wa(l));return ya.set(s,{source:l,markup:d}),d}function bm(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function mr(e){return!r.isBlocksV2Enabled()||e.html&&e.html.trim()!==""?e.html:`<tr><td style="padding:16px 20px;font-family:Arial,sans-serif;font-size:14px;line-height:20px;color:#5b6370;background:#f4f5f7">${bm(e.title??"")}</td></tr>`}function gm(e,i){return e?i.openBlockFromEmailEnabled===!0?"over-email":null:"link"}var fm={fontSize:"16px",margin:0},{name:pr,type:ja,tags:Ia}={name:"name",type:"type",tags:"tags"},va={[pr]:"",[ja]:[],[Ia]:[]},ct={Header:10,Menu:20,Banners:30,Content:40,Lists:50,Buttons:60,Promocodes:70,"E-Commerce":80,Transactional:80,Articles:90,Polls:100,Applications:110,Feature:120,Separators:130,Contacts:140,Footer:150},hr=({parentEmailId:e,blocksTab:i,search:l,reloadBlockScreens:s,setIsShowAddAllBlocksModal:n})=>{const{parentId:d}=r.useBlocksParentId(e),c=r.useEditorProjectId(),p=r.useSetHtmlElementInIframeHandler(),g=r.useDragStartBlockToIframeHandler(),[b]=t.ui_kit$Form.useForm(),{data:_}=r.useGetBlockTypesQuery(),{token:h}=(0,t.ui_kit$useToken)(),{__:m,_x:T}=r.useI18n(),E=r.useNotification(),{modal:x}=t.ui_kit$App.useApp(),{confirm:R}=x,j={pathname:r.useRoutePathname()},N=r.useAppConfig(),B=r.useSelector(r.selectParentBlocks),v=js(),$=(0,a.useRef)(null),U=(0,a.useRef)(null),I=r.useRootElement(),L=660,P=207/L,z=S=>pm(S)?(0,o.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,o.jsx)(hm,{className:"block-global-badge--tile",size:14})}):null,le=r.useEmailAttribute("common_styles"),C=(0,a.useMemo)(()=>vs(le,v),[le,v]),re=(0,a.useRef)(null),ce=(0,a.useRef)(null),fe=(0,a.useRef)(null),Be=r.useStore(),se=(S,ee=!1)=>(k,ne,ve,qe,Fe)=>{if(!r.isBlocksV2Enabled()){S(k,ne,ve,qe,Fe);return}const Eo=ho=>{if(ho===void 0){E.error({id:"BLOCK_GET_ERROR",title:m("Failed to load")});return}if(ho===Fe.html){S(k,ne,ve,qe,Fe);return}S(k,ve==="common"?ro({html:ho}):ho,ve,qe,{...Fe,html:ho})},Mo=()=>Be.getState();if(!jt.waitsForWrite(Fe)){Eo(jt.freshBlockHtml(Mo,Fe));return}(ee?jt.blockHtmlForInsertOnce(Mo,Fe):jt.blockHtmlForInsert(Mo,Fe))?.then(Eo)},he=se(p,!0),Pe=se(g);(0,a.useEffect)(()=>{U.current?.scrollTo({top:0})},[i,l]);const pe=r.useProjectData(),{data:De}=r.useGetTermsQuery({project:pe,kind:r.BLOCK_TAGS},{skip:!pe?.id}),[Oe,Ce]=(0,a.useState)(()=>r.projectBlocksArgs(c));(0,a.useEffect)(()=>{l||(b.setFieldsValue(va),He({type:null,name:null}),s())},[l,b,s]),(0,a.useEffect)(()=>{if(_){const S=_;let ee=[];for(let k in S)ee.push({label:m(r.TYPES_TRANSLATE[S[k]]),value:S[k]})}},[_,m]);const{isSuccess:ge,isError:_e,isLoading:Q,isFetching:K,data:q,refetch:Z,error:V}=r.useGetBlocksQuery({...Oe,projectId:c,page:1}),M=(0,a.useMemo)(()=>{if(ge&&q)return[...q].sort((S,ee)=>ct[S.type]-ct[ee.type])},[ge,q]),[Y,X]=(0,a.useState)([]);r.usePrevious(S=>{S!==_e&&E.fromError("BLOCK_GET_ERROR",{},V,!0)},[_e,V,E]);const[oe,me]=(0,a.useState)(()=>r.parentEmailBlocksArgs(d,c)),{isSuccess:Te,isError:Se,isLoading:te,isFetching:D}=r.useGetParentEmailBlocksQuery({...oe,emailId:d,page:1,...r.pageProjectKey(c)},{skip:!d||B.length}),ie=(0,a.useMemo)(()=>{if(Te||B.length)return[...B].sort((S,ee)=>ct[S.type]-ct[ee.type])},[Te,B]),[ye,W]=(0,a.useState)([]);(0,a.useEffect)(()=>{const S=new Set;if(B.length&&ie){for(const ee of ie)ee.type&&S.add(ee.type);W(Array.from(S))}else W([])},[B,ie]);const[Re,$e]=(0,a.useState)(()=>r.templateBlocksArgs(c)),{isSuccess:Ae,isError:We,isLoading:Ve,isFetching:Ge,data:de=[]}=r.useGetTemplateBlocksQuery({...Re,page:1,...r.pageProjectKey(c)}),je=(0,a.useMemo)(()=>{if(de.length)return[...de].sort((S,ee)=>ct[S.type]-ct[ee.type])},[de]),[G,be]=(0,a.useState)([]);(0,a.useEffect)(()=>{const S=new Set;if(je&&de.length){for(const ee of je)ee.type&&S.add(ee.type);be(Array.from(S))}},[de.length,je]);const Le=(0,a.useMemo)(()=>{const S=new Set;for(const ee of Y)S.add(ee);for(const ee of ye)S.add(ee);for(const ee of G)S.add(ee);return Array.from(S)},[G,ye,Y]),He=S=>{Ce(ee=>({...ee,...S,page:1})),me(ee=>({...ee,...S,page:1})),$e(ee=>({...ee,...S,page:1}))},Je=r.useFitBlockPreviewHeight(P),Ze=(0,a.useCallback)(()=>{I.querySelector(".blocks-search__result-wrapper.is_search")&&(I.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),I.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(I,207/L),I.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",I.querySelectorAll(".blocks-search__result-wrapper").forEach(S=>S.style.opacity=1))},[L,I]);(0,a.useEffect)(()=>{!(Ge||Ve)&&Ae&&i!=="template"&&(l?Ze():s())},[Ge,Ve,Ae,Ze,Oe.name,s,l,i]),(0,a.useEffect)(()=>{const S=new Set;if(ge&&M){for(const ee of M)ee.type&&S.add(ee.type);X(Array.from(S))}},[ge,M]);const so=S=>{const ee=Object.keys(S)[0],k=b.getFieldsValue(!0);switch(ee){case Ia:const ne=(De||[]).filter(ve=>S[ee].includes(ve.name)).map(ve=>ve.id)||null;He({tags:ne});break;case ja:He({type:k.type||null});break;case pr:$.current&&window.clearTimeout($.current),$.current=window.setTimeout(function(){He({name:k.name||null})},300)}},O=S=>{s(),S.target.getAttribute("data-type")?(S.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(ee=>ee.style.display="none"),S.target.closest(".blocks-search").querySelectorAll(`[data-type="${S.target.getAttribute("data-type")}"]`).forEach(ee=>ee.style.display="block")):S.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(ee=>ee.style.display="block"),S.target.parentElement.querySelector(".active").classList.remove("active"),S.target.classList.add("active")};let ae=null;const w=S=>{clearTimeout(ae);let ee=I.querySelector(".block-search__preview")?I.querySelector(".block-search__preview"):null,k=I.querySelector(".block-search__preview-title")?I.querySelector(".block-search__preview-title"):null,ne=I.querySelector(".block-search__preview-content")?I.querySelector(".block-search__preview-content"):null;I.querySelector(".block-search__preview")||(ee=document.createElement("div"),ee.classList.add("block-search__preview"),k=document.createElement("div"),k.classList.add("block-search__preview-title"),ne=document.createElement("div"),ne.classList.add("block-search__preview-content"),ee.append(ne),ee.append(k),I.querySelector(".email-pane__col_settings-inner").append(ee)),k.innerHTML="",ne.innerHTML="",k.innerHTML=S.title;let ve=S.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();ne.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+ve+"</table>"),ee.style.opacity!=="1"&&setTimeout(function(){ee.style.opacity="1",ee.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},y=()=>{let S=I.querySelector(".block-search__preview");S&&(ae=setTimeout(()=>{S.style.opacity="0",S.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){S.remove()},300)},300))};(0,a.useEffect)(()=>{I.querySelectorAll(".blocks-search__result").forEach(S=>{S.style.display="block"})},[i]);const ue=!q?.length&&(!d||!B?.length)&&!de?.length&&(Oe.tags||Oe.name||Oe.type)&&!(Q||K),Ie=S=>Be.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(S.id)).then(ee=>{if(ee.error){E.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(S),ee.error);return}E.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(S),title:m('The block "')+S.title+T('" was successfully removed.',"block")}),Z()});(0,a.useEffect)(()=>{!Q&&!K&&s()},[Q,K,s]),(0,a.useEffect)(()=>{(i==="common"||l)&&setTimeout(s,50)},[q,s,i,l]);const Ye=S=>{R({mask:{closable:!0},centered:!0,title:T("Are you sure you want to delete the “","block")+S.title+m("” block?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:{color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:m("Yes"),cancelText:m("No"),onOk:()=>Ie(S)})},Qe=(S,ee)=>`${S.pathname.split("emails")[0]}blocks/${ee.id}`,co=S=>{let ee=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:h.colorError},onClick:()=>Ye(S)}];const k=gm(!0,N);return k==="link"&&ee.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px",margin:0}}),label:(0,o.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:Qe(j,S),children:" "})}),k==="over-email"&&ee.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:fm}),onClick:()=>{r.getEmitter(To.getContainer(Be),To.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(S.id)).then(({errors:ne})=>{ne.length&&E.fromError("BLOCK_GET_ERROR",r.getBlockDesc(S),ne[0])})}}),ee},ro=S=>{let ee=S.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(ee.replaceChildren(...r.parseFromString(S.html)),Object.keys(C).length!==0&&(ee.querySelectorAll(".em-contrast-card").forEach(k=>{C.cards?.contrastBackgroundColor&&(k.getAttribute("bgcolor")?C.cards.contrastBackgroundColor?k.setAttribute("bgcolor",C.cards.contrastBackgroundColor):k.removeAttribute("bgcolor"):C.cards.contrastBackgroundColor?k.style.backgroundColor=C.cards.contrastBackgroundColor:k.style.removeProperty("background-color")),C.cards?.contrastTextColor&&k.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(ne=>{if(ko(ne.style.color).toLowerCase()!=="#ffffff"){let ve=ne.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.cards.contrastTextColor};`);ne.setAttribute("style",ve)}})}),ee.querySelectorAll(".em-card").forEach(k=>{C.cards?.baseBackgroundColor&&(k.getAttribute("bgcolor")?C.cards.baseBackgroundColor?k.setAttribute("bgcolor",C.cards.baseBackgroundColor):k.removeAttribute("bgcolor"):C.cards.baseBackgroundColor?k.style.backgroundColor=C.cards.baseBackgroundColor:k.style.removeProperty("background-color")),C.cards?.baseTextColor&&k.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(ne=>{if(ko(ne.style.color).toLowerCase()!=="#ffffff"){let ve=ne.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.cards.baseTextColor};`);ne.setAttribute("style",ve)}})}),ee.querySelectorAll(".em-card, .em-contrast-card").forEach(k=>{C.cards?.border&&F({settings:{border:C.cards?.border},elem:k}),C.cards?.borderRadius?.all?(k.style.borderBottomLeftRadius&&k.style.borderBottomLeftRadius!=="0px"&&(k.style.borderBottomLeftRadius=C.cards?.borderRadius.all+"px"),k.style.borderBottomRightRadius&&k.style.borderBottomRightRadius!=="0px"&&(k.style.borderBottomRightRadius=C.cards?.borderRadius.all+"px"),k.style.borderTopLeftRadius&&k.style.borderTopLeftRadius!=="0px"&&(k.style.borderTopLeftRadius=C.cards?.borderRadius.all+"px"),k.style.borderTopRightRadius&&k.style.borderTopRightRadius!=="0px"&&(k.style.borderTopRightRadius=C.cards?.borderRadius.all+"px")):C.cards?.borderRadius?.all===""?k.style.removeProperty("border-radius"):(C.cards?.borderRadius?.topLeft&&k.style.borderTopLeftRadius&&k.style.borderTopLeftRadius!=="0px"?k.style.borderTopLeftRadius=C.cards?.borderRadius.topLeft+"px":C.cards?.borderRadius?.topLeft===""&&k.style.removeProperty("border-top-left-radius"),C.cards?.borderRadius?.topRight&&k.style.borderTopRightRadius&&k.style.borderTopRightRadius!=="0px"?k.style.borderTopRightRadius=C.cards?.borderRadius.topRight+"px":C.cards?.borderRadius?.topRight===""&&k.style.removeProperty("border-top-right-radius"),C.cards?.borderRadius?.bottomRight&&k.style.borderBottomRightRadius&&k.style.borderBottomRightRadius!=="0px"?k.style.borderBottomRightRadius=C.cards?.borderRadius.bottomRight+"px":C.cards?.borderRadius?.bottomRight===""&&k.style.removeProperty("border-bottom-right-radius"),C.cards?.borderRadius?.bottomLeft&&k.style.borderBottomLeftRadius&&k.style.borderBottomLeftRadius!=="0px"?k.style.borderBottomLeftRadius=C.cards?.borderRadius.bottomLeft+"px":C.cards?.borderRadius?.bottomLeft===""&&k.style.removeProperty("border-bottom-left-radius"))}),ee.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(k=>{if(!k.style.display&&parseFloat(k.style.fontSize)<=20){let ne="",ve=C.text.fontFamily;if(parseFloat(k.style.fontSize)>14&&(ne=k.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${C.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${C.text.lineHeight}px`),k.setAttribute("style",ne)),!k.closest(".em-contrast-card, .em-card")&&ko(k.style.color).toLowerCase()!=="#ffffff"&&(ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.text.color};`),k.setAttribute("style",ne)),k.closest(".em-contrast-block")&&!k.closest(".em-contrast-card, .em-card")&&(ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.text.contrastColor};`),k.setAttribute("style",ne)),ve[0]==="Safe Fonts"?(k.style.fontFamily=ve[1],uo({elem:ee})):ve[0]==="Google Fonts"&&(ve[1]==="Sans Serif"?k.style.fontFamily="Helvetica, Arial, sans-serif":ve[1]==="Serif"&&(k.style.fontFamily='"Times New Roman", Times, serif'),k.classList.remove(...[...k.classList].filter(qe=>qe.startsWith("em-font"))),k.classList.add(`em-font-${ve[2].replace(/\s/g,"")}-${ve[3].replace(/\s/g,"")}`),Bo({elem:ee,fontFamilyArray:ve})),k.closest('[em="atom"] > tr > td')&&k.closest('[em="atom"] > tr > td').style.paddingBottom)k.closest('[em="atom"] > tr > td').style.paddingBottom=C.text.paddingBottom+"px";else if(k.nextElementSibling||k.closest("table")&&k.closest("table").nextElementSibling){let qe=k.nextElementSibling??k.closest("table").nextElementSibling;qe&&qe.tagName==="TABLE"&&(qe.classList.contains("em-vindent-table")||qe.querySelector("td").innerHTML==="")&&qe.querySelector("td").setAttribute("height",C.text.paddingBottom)}}else if(!k.style.display&&parseFloat(k.style.fontSize)>=20&&ko(k.style.color).toLowerCase()!=="#eb3737"){let ne="",ve=C.headings.fontFamily;parseFloat(k.style.fontSize)<40&&(ne=k.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${C.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${C.headings.lineHeight}px`),k.setAttribute("style",ne)),!k.closest(".em-contrast-card, .em-card")&&ko(k.style.color).toLowerCase()!=="#ffffff"&&(ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.headings.color};`),k.setAttribute("style",ne)),k.closest(".em-contrast-block")&&!k.closest(".em-contrast-card, .em-card")&&(ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.headings.contrastColor};`),k.setAttribute("style",ne)),ve[0]==="Safe Fonts"?(k.style.fontFamily=ve[1],uo({elem:ee})):ve[0]==="Google Fonts"&&(ve[1]==="Sans Serif"?k.style.fontFamily="Helvetica, Arial, sans-serif":ve[1]==="Serif"&&(k.style.fontFamily='"Times New Roman", Times, serif'),k.classList.remove(...[...k.classList].filter(Fe=>Fe.startsWith("em-font"))),k.classList.add(`em-font-${ve[2].replace(/\s/g,"")}-${ve[3].replace(/\s/g,"")}`),Bo({elem:ee,fontFamilyArray:ve}));let qe="";if(C.headings.letterSpacing>0?qe=k.style.letterSpacing?k.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${C.headings.letterSpacing}px`):k.getAttribute("style")+` letter-spacing: ${C.headings.letterSpacing}px;`:qe=k.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),k.setAttribute("style",qe),C.headings.bold?k.querySelector("b")?k.querySelector("b").replaceWith(...k.querySelector("b").childNodes):k.querySelector("strong")||(k.innerHTML="<strong>"+k.innerHTML+"</strong>"):k.querySelector("strong")?k.querySelector("strong").replaceWith(...k.querySelector("strong").childNodes):k.querySelector("b")&&k.querySelector("b").replaceWith(...k.querySelector("b").childNodes),k.style.fontWeight){let Fe=k.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");k.setAttribute("style",Fe)}if(C.headings.italic?k.querySelector("i")?k.querySelector("i").replaceWith(...k.querySelector("i").childNodes):k.querySelector("em")||(k.innerHTML="<em>"+k.innerHTML+"</em>"):k.querySelector("em")?k.querySelector("em").replaceWith(...k.querySelector("em").childNodes):k.querySelector("i")&&k.querySelector("i").replaceWith(...k.querySelector("i").childNodes),k.style.fontStyle){let Fe=k.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");k.setAttribute("style",Fe)}if(k.closest('[em="atom"] > tr > td')&&k.closest('[em="atom"] > tr > td').style.paddingTop)k.closest('[em="atom"] > tr > td').style.paddingTop=C.headings.paddingTop+"px";else if(k.previousElementSibling){let Fe=k.previousElementSibling;Fe&&Fe.tagName==="TABLE"&&(Fe.classList.contains("em-vindent-table")||Fe.querySelector("td").innerHTML==="")&&Fe.querySelector("td").setAttribute("height",C.headings.paddingTop)}if(k.closest('[em="atom"] > tr > td')&&k.closest('[em="atom"] > tr > td').style.paddingBottom)k.closest('[em="atom"] > tr > td').style.paddingBottom=C.headings.paddingBottom+"px";else if(k.nextElementSibling){let Fe=k.nextElementSibling;Fe&&Fe.tagName==="TABLE"&&(Fe.classList.contains("em-vindent-table")||Fe.querySelector("td").innerHTML==="")&&Fe.querySelector("td").setAttribute("height",C.headings.paddingBottom)}}}),ee.querySelectorAll('a[style*="color"]').forEach(k=>{if(k.style.display){if(k.style.display&&k.style.display==="block"){let ne="";if(ne=k.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${C.buttons.fontSize}px`),k.setAttribute("style",ne),k.closest("td").style.backgroundColor&&!k.closest("td").style.borderWidth&&!k.closest(".em-contrast-card"))if(k.closest(".em-contrast-block")?ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.contrastColor};`):ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.color};`),k.setAttribute("style",ne),k.closest(".em-contrast-block"))if(C.buttons.contrastBackgroundColor){let Fe=k.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${C.buttons.contrastBackgroundColor};`);k.closest("td").setAttribute("style",Fe)}else k.closest("td").style.removeProperty("background-color");else if(C.buttons.backgroundColor){let Fe=k.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${C.buttons.backgroundColor};`);k.closest("td").setAttribute("style",Fe)}else k.closest("td").style.removeProperty("background-color");else if(k.closest("td").style.borderWidth)if(Object.values(C.buttons.border).every(Fe=>Fe===null)){if(k.closest(".em-contrast-block")){if(C.buttons.contrastBackgroundColor){let Fe=k.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Eo=>Eo.replace(/#[A-Fa-f0-9]{6}/,`${C.buttons.contrastBackgroundColor}`));k.closest("td").setAttribute("style",Fe),ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.contrastBackgroundColor};`),k.setAttribute("style",ne)}}else if(C.buttons.backgroundColor){let Fe=k.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Eo=>Eo.replace(/#[A-Fa-f0-9]{6}/,`${C.buttons.backgroundColor}`));k.closest("td").setAttribute("style",Fe),ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.backgroundColor};`),k.setAttribute("style",ne)}}else for(const Fe in C.buttons.border)C.buttons.border[Fe]&&C.buttons.border[Fe].color!==void 0&&(ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.border[Fe].color};`),k.setAttribute("style",ne));else k.closest(".em-contrast-block")?C.buttons.contrastBackgroundColor&&(ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.contrastBackgroundColor};`),k.setAttribute("style",ne)):C.buttons.backgroundColor&&(ne=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.backgroundColor};`),k.setAttribute("style",ne));let ve=C.buttons.fontFamily;ve[0]==="Safe Fonts"?(k.style.fontFamily=ve[1],uo({elem:ee})):ve[0]==="Google Fonts"&&(ve[1]==="Sans Serif"?k.style.fontFamily="Helvetica, Arial, sans-serif":ve[1]==="Serif"&&(k.style.fontFamily='"Times New Roman", Times, serif'),k.classList.remove(...[...k.classList].filter(Fe=>Fe.startsWith("em-font"))),k.classList.add(`em-font-${ve[2].replace(/\s/g,"")}-${ve[3].replace(/\s/g,"")}`),Bo({elem:ee,fontFamilyArray:ve})),k.closest("td").setAttribute("align",C.buttons.textAlign);let qe="";if(C.buttons.letterSpacing>0?qe=k.style.letterSpacing?k.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${C.buttons.letterSpacing}px`):k.getAttribute("style")+` letter-spacing: ${C.buttons.letterSpacing}px;`:qe=k.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),k.setAttribute("style",qe),C.buttons.bold?k.querySelector("b")?k.querySelector("b").replaceWith(...k.querySelector("b").childNodes):k.querySelector("strong")||(k.innerHTML="<strong>"+k.innerHTML+"</strong>"):k.querySelector("strong")?k.querySelector("strong").replaceWith(...k.querySelector("strong").childNodes):k.querySelector("b")&&k.querySelector("b").replaceWith(...k.querySelector("b").childNodes),k.style.fontWeight){let Fe=k.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");k.setAttribute("style",Fe)}if(C.buttons.italic?k.querySelector("i")?k.querySelector("i").replaceWith(...k.querySelector("i").childNodes):k.querySelector("em")||(k.innerHTML="<em>"+k.innerHTML+"</em>"):k.querySelector("em")?k.querySelector("em").replaceWith(...k.querySelector("em").childNodes):k.querySelector("i")&&k.querySelector("i").replaceWith(...k.querySelector("i").childNodes),k.style.fontStyle){let Fe=k.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");k.setAttribute("style",Fe)}if(k.closest('[em="atom"] > tr > td')&&k.closest('[em="atom"] > tr > td').style.paddingTop)k.closest('[em="atom"] > tr > td').style.paddingTop=C.buttons.marginTop+"px";else if(k.closest("table").previousElementSibling){let Fe=k.closest("table").previousElementSibling;Fe&&Fe.tagName==="TABLE"&&(Fe.classList.contains("em-vindent-table")||Fe.querySelector("td").innerHTML==="")&&Fe.querySelector("td").setAttribute("height",C.buttons.marginTop)}if(k.closest('[em="atom"] > tr > td')&&k.closest('[em="atom"] > tr > td').style.paddingBottom)k.closest('[em="atom"] > tr > td').style.paddingBottom=C.buttons.marginBottom+"px";else if(k.closest("table").previousElementSibling){let Fe=k.closest("table").nextElementSibling;Fe&&Fe.tagName==="TABLE"&&(Fe.classList.contains("em-vindent-table")||Fe.querySelector("td").innerHTML==="")&&Fe.querySelector("td").setAttribute("height",C.buttons.marginBottom)}C.buttons.padding.all&&(k.style.padding=C.buttons.padding.all+"px"),C.buttons.padding.top&&(k.style.paddingTop=C.buttons.padding.top+"px"),C.buttons.padding.right&&(k.style.paddingRight=C.buttons.padding.right+"px"),C.buttons.padding.bottom&&(k.style.paddingBottom=C.buttons.padding.bottom+"px"),C.buttons.padding.left&&(k.style.paddingLeft=C.buttons.padding.left+"px"),F({settings:{border:C.buttons.border},elem:k.closest("td")}),J({settings:{borderRadius:C.buttons.borderRadius},elem:k.closest("td")})}}else{let ne=C.text.fontFamily;if(ko(k.style.color).toLowerCase()==="#1c52dc"){let qe=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.links.color};`);k.setAttribute("style",qe)}else{let qe=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.text.color};`);k.setAttribute("style",qe)}if(k.closest(".em-contrast-block")){let qe=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.links.contrastColor};`);k.setAttribute("style",qe)}let ve="";C.links.underline?ve=k.style.textDecoration?k.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):k.getAttribute("style")+" text-decoration: underline;":ve=k.style.textDecoration?k.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):k.getAttribute("style")+" text-decoration: none;",k.setAttribute("style",ve),ne[0]==="Safe Fonts"?(k.style.fontFamily=ne[1],uo({elem:ee})):ne[0]==="Google Fonts"&&(ne[1]==="Sans Serif"?k.style.fontFamily="Helvetica, Arial, sans-serif":ne[1]==="Serif"&&(k.style.fontFamily='"Times New Roman", Times, serif'),k.classList.remove(...[...k.classList].filter(qe=>qe.startsWith("em-font"))),k.classList.add(`em-font-${ne[2].replace(/\s/g,"")}-${ne[3].replace(/\s/g,"")}`),Bo({elem:ee,fontFamilyArray:ne}))}}),ee.querySelector('[em="block"]'))){const k=ee.querySelectorAll('[em="block"]');C.block?.backgroundColor&&k.forEach(ne=>{ne.querySelectorAll(":scope > td").forEach(ve=>{ve.setAttribute("bgcolor",C.block.backgroundColor)})}),C.block?.padding&&k.forEach(ne=>{ne.querySelectorAll(":scope > td").forEach(ve=>{ve.style.paddingTop=C.block.padding.top+"px",ve.style.paddingRight=C.block.padding.right+"px",ve.style.paddingBottom=C.block.padding.bottom+"px",ve.style.paddingLeft=C.block.padding.left+"px"})})}return ee.tagName==="DIV"?r.getElementInnerHTML(ee):r.getElementInnerHTML(ee.querySelector("tbody")||ee)},uo=S=>{S.elem.querySelectorAll("link[em-class]").forEach(ee=>{S.elem.querySelector("."+ee.getAttribute("em-class"))||ee.remove()})};function ko(S){if(S&&S.charAt(0)==="r"){if(S.charAt(3)==="a")return S=S.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),S&&S.length===4?"#"+("0"+parseInt(S[1],10).toString(16)).slice(-2)+("0"+parseInt(S[2],10).toString(16)).slice(-2)+("0"+parseInt(S[3],10).toString(16)).slice(-2):"";{S=S.replace("rgb(","").replace(")","").split(",");let ee=parseInt(S[0],10).toString(16),k=parseInt(S[1],10).toString(16),ne=parseInt(S[2],10).toString(16);return ee=ee.length===1?"0"+ee:ee,k=k.length===1?"0"+k:k,ne=ne.length===1?"0"+ne:ne,"#"+ee+k+ne}}else if(S&&S.charAt(0)==="#")return S}const Bo=S=>{const ee=S.elem.querySelectorAll("link"),k=`em-font-${S.fontFamilyArray[2].replace(/\s/g,"")}-${S.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(ee)?.find(ve=>ve.getAttribute("em-class")===k)){let ve=document.createElement("link");ve.setAttribute("rel","stylesheet"),ve.setAttribute("href",`https://fonts.googleapis.com/css2?family=${S.fontFamilyArray[2]}:ital,wght@${we[S.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${we[S.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),ve.setAttribute("em-class",k),S.elem.insertAdjacentElement("afterbegin",ve)}Ee({elem:S.elem});let ne=`font-family: '${S.fontFamilyArray[2]}', ${ze[S.fontFamilyArray[1]]}!important;`;ne+=` font-weight: ${we[S.fontFamilyArray[3]].replaceAll("i","")}!important;`,we[S.fontFamilyArray[3]].indexOf("i")>-1&&(ne+=" font-style: italic!important;"),S.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
13
+ .em-font-${S.fontFamilyArray[2].replace(/\s/g,"")}-${S.fontFamilyArray[3].replace(/\s/g,"")} { ${ne} }`),setTimeout(()=>uo({elem:S.elem}),0)},F=S=>{S.settings.border.all?S.settings.border.all.width!=null&&(S.settings.border.all.style||S.settings.border.all.color)?(S.elem.style.borderWidth=S.settings.border.all.width+"px",S.elem.style.borderStyle=S.settings.border.all.style,S.elem.style.borderColor=S.settings.border.all.color):S.elem.style.removeProperty("border"):(S.settings.border.top&&(S.settings.border.top.width!=null&&(S.settings.border.top.style||S.settings.border.top.color)?(S.elem.style.borderTopWidth=S.settings.border.top.width+"px",S.elem.style.borderTopStyle=S.settings.border.top.style,S.elem.style.borderTopColor=S.settings.border.top.color):S.elem.style.removeProperty("border-top")),S.settings.border.right&&(S.settings.border.right.width!=null&&(S.settings.border.right.style||S.settings.border.right.color)?(S.elem.style.borderRightWidth=S.settings.border.right.width+"px",S.elem.style.borderRightStyle=S.settings.border.right.style,S.elem.style.borderRightColor=S.settings.border.right.color):S.elem.style.removeProperty("border-right")),S.settings.border.bottom&&(S.settings.border.bottom.width!=null&&(S.settings.border.bottom.style||S.settings.border.bottom.color)?(S.elem.style.borderBottomWidth=S.settings.border.bottom.width+"px",S.elem.style.borderBottomStyle=S.settings.border.bottom.style,S.elem.style.borderBottomColor=S.settings.border.bottom.color):S.elem.style.removeProperty("border-bottom")),S.settings.border.left&&(S.settings.border.left.width!=null&&(S.settings.border.left.style||S.settings.border.left.color)?(S.elem.style.borderLeftWidth=S.settings.border.left.width+"px",S.elem.style.borderLeftStyle=S.settings.border.left.style,S.elem.style.borderLeftColor=S.settings.border.left.color):S.elem.style.removeProperty("border-left")))},J=S=>{S.settings.borderRadius.all?S.elem.style.borderRadius=S.settings.borderRadius.all+"px":S.settings.borderRadius.all===""?S.elem.style.removeProperty("border-radius"):(S.settings.borderRadius.topLeft?S.elem.style.borderTopLeftRadius=S.settings.borderRadius.topLeft+"px":S.settings.borderRadius.topLeft===""&&S.elem.style.removeProperty("border-top-left-radius"),S.settings.borderRadius.topRight?S.elem.style.borderTopRightRadius=S.settings.borderRadius.topRight+"px":S.settings.borderRadius.topRight===""&&S.elem.style.removeProperty("border-top-right-radius"),S.settings.borderRadius.bottomRight?S.elem.style.borderBottomRightRadius=S.settings.borderRadius.bottomRight+"px":S.settings.borderRadius.bottomRight===""&&S.elem.style.removeProperty("border-bottom-right-radius"),S.settings.borderRadius.bottomLeft?S.elem.style.borderBottomLeftRadius=S.settings.borderRadius.bottomLeft+"px":S.settings.borderRadius.bottomLeft===""&&S.elem.style.removeProperty("border-bottom-left-radius"))},we={Thin:"100","Thin Italic":"100i",ExtraLight:"200","ExtraLight Italic":"200i",Light:"300","Light Italic":"300i",Regular:"400","Regular Italic":"400i",Medium:"500","Medium Italic":"500i",SemiBold:"600","SemiBold Italic":"600i",Bold:"700","Bold Italic":"700i",ExtraBold:"800","ExtraBold Italic":"800i",Black:"900","Black Italic":"900i"},ze={"Sans Serif":"sans-serif",Serif:"serif"};function Ee(S){if(!S.elem.querySelector('style[em="styles"]')){let ee=document.createElement("style");ee.setAttribute("em","styles"),S.elem.append(ee)}}return(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search",{is_search:l}),children:[(0,o.jsx)(t.ui_kit$Form,{className:(0,Ue.default)("blocks-search__form",{is_search:l}),form:b,layout:"vertical",name:"blocks_search_form",initialValues:{...va},onValuesChange:so,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:pr,children:(0,o.jsx)(t.ui_kit$SearchInput,{placeholder:m("Search by title"),allowClear:!0,enterButton:!1})})}),(_e||Se||We)&&(0,o.jsx)(t.ui_kit$Alert,{title:m("Error"),description:m("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),l&&!ue&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"search_All"),Le.map(S=>(0,o.jsx)("li",{"data-type":S,onClick:O,children:m(r.TYPES_TRANSLATE[S])},"search_"+S))]})}),(0,o.jsxs)("div",{ref:U,className:(0,Ue.default)("blocks-search__result-wrapper",{is_search:l}),children:[(i==="project"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Y.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"blocksSections_All"),Y.map(S=>(0,o.jsx)("li",{"data-type":S,onClick:O,children:m(r.TYPES_TRANSLATE[S])},"blocksSections_"+S))]})}),(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:re,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!(Q||K)&&(M?.length?M.map((S,ee)=>{const k=ur(S.id,mr(S));return(0,o.jsx)("div",{className:"blocks-search__result","data-type":S.type,children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"leftTop",menu:{items:co(S)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:ne=>he(ne,S.html,"project",S.title,S),onDragStart:ne=>Pe(ne,S.html,"project",S.title,S),onMouseEnter:()=>w({html:S.html,title:S.title}),onMouseLeave:y,children:[z(S),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:k,onContentLoad:Je,style:{transform:`scale(${P})`}})]})},"commenMenu")},S.id+ee.toString())}):!(Oe.tags||Oe.name||Oe.type)&&ge&&!(Q||K)&&!l&&(0,o.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,o.jsxs)("div",{style:{width:"110%"},children:[(0,o.jsx)("h3",{style:{lineHeight:"1.2"},children:m("You don`t have any saved blocks yet.")}),m("To add a block from the dashboard click the"),' "',m("Save to Blocks button."),'" ',(0,o.jsx)(r.EmIcons,{icon:"SaveBlock",component:t.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),m("You can also save all blocks at once. The AI assistant will automatically determine the type and create a name for each block when saving."),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),(0,o.jsx)(t.ui_kit$Flex,{justify:"left",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",onClick:()=>n(!0),style:{cursor:"pointer"},children:m("Save all blocks")})})]}),(0,o.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,o.jsx)("img",{src:mm,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),(Q||K)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&q?.length>0&&B?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!ye.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"templateBlocksSections_All"),ye.map(S=>(0,o.jsx)("li",{"data-type":S,onClick:O,children:m(r.TYPES_TRANSLATE[S])},"templateBlocksSections_"+S))]})}),(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:ce,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[B&&!(te||D)&&ie?.length?(0,o.jsx)(o.Fragment,{children:ie.map((S,ee)=>{const k=ur(S.id,mr(S));return(0,o.jsx)("div",{className:"blocks-search__result","data-type":S.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:ne=>he(ne,S.html,"template",S.title,S),onDragStart:ne=>Pe(ne,S.html,"template",S.title,S),onMouseEnter:()=>w({html:S.html,title:S.title}),onMouseLeave:()=>y(),children:[z(S),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:k,onContentLoad:Je,style:{transform:`scale(${P})`}})]})},S.id+ee.toString())})}):!l&&!Ve&&!D&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:m("No related blocks found.")})," "]}),(te||D)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&B?.length>0&&de?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!G?.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"commonBlocksSections_All"),G.map(S=>(0,o.jsx)("li",{"data-type":S,onClick:O,children:m(r.TYPES_TRANSLATE[S])},"commonBlocksSections_"+S))]})}),(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:fe,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder common",children:[Ae&&!!je?.length&&!(Ge||Ve)&&(0,o.jsx)(o.Fragment,{children:je.map((S,ee)=>{const k=ro({html:ur(S.id,mr(S))});return(0,o.jsx)("div",{className:"blocks-search__result","data-type":S.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:ne=>he(ne,ro({html:S.html}),"common",S.title,S),onDragStart:ne=>Pe(ne,ro({html:S.html}),"common",S.title,S),onMouseEnter:()=>w({html:ro({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+S.html+"</table>")}),title:S.title}),onMouseLeave:()=>y(),children:[z(S),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:k,onContentLoad:Je,style:{transform:`scale(${P})`}})]})},S.id+ee.toString())})})," "]}),(Ve||Ge)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),ue&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:m("There are no blocks for this request.")})]})]})};hr.propTypes={};function _m(e,i){return e==="email"||r.isBlocksV2Enabled()?!0:i!==void 0&&r.isPluginGoHistory(i)}var Ca=({comments:e,subjectId:i,isLoggedIn:l,projectTitle:s="",emailElementType:n,email:d})=>{const{__:c,_n:p}=r.useI18n(),g=r.useSendPostMessage(),b=r.useNotification(),{token:_}=(0,t.ui_kit$useToken)(),h=r.useAppConfig(),m=r.usePushToDataLayer(),T=(0,a.useRef)(null),[E,x]=(0,a.useState)(""),[R,j]=(0,a.useState)("ADD"),[N,B]=(0,a.useState)(!1),[v,$]=(0,a.useState)(null),[U,I]=(0,a.useState)(null),[L,P]=(0,a.useState)(""),[z,le]=(0,a.useState)(""),[C,re]=(0,a.useState)(!1),[ce,fe]=(0,a.useState)(""),[Be,se]=r.useAddCommentMutation(),[he,Pe]=r.useDeleteCommentMutation(),[pe,De]=r.useEditCommentMutation(),[Oe,Ce]=r.useDeleteTargetMutation(),[ge]=r.useAutoSaveBlockMutation(),_e=r.useDispatch(),Q=r.useStore(),K=r.useCurrentUser(),q=r.useCurrentProjectRequested(),Z=r.useContentReader(),V=de=>{const je=r.getEmailDocuments(To.getContainer(Q));je.save("anchor",{project:de}).then(G=>{const be=G?je.revisionFacts()?.lastRevisionAt:void 0;be!==void 0&&d?.id!=null&&_e(r.rememberAutosaveTime({emailId:d.id,modified:new Date(be).toISOString()}))})},M=()=>{const de=q;if(_m(n,To.getContainer(Q))){V(de);return}const je={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:de,html:Z(),excerpt:d?.date_gmt};d?.id!=null&&ge({blockId:d.id,body:je}).catch(G=>{})};function Y(de){re(!1),fe(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ce}),B(!0),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function X(){I(v),e.filter(de=>de.parent===v).length?pe({commentId:v,status:"deleted"}).unwrap():he(v),document.querySelector('.discuss-main li[id="'+v+'"] .comment-icon-target')?.getAttribute("target-id")&&g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+v+'"] .comment-icon-target')?.getAttribute("target-id")}),M(),fe("")}function oe(de){I(v);const je=e.find(be=>be.id?.toString()===v),G=je?.target_id?.toString()||"";re(!!G),fe(G),le(je?.content?.slice(3,-5)?.toString()),j("EDIT")}function me(de){I(v),P(""),j("REPLY")}const Te=()=>{b.error({mask:{closable:!0},centered:!0,title:c("Please log in"),content:(r.isUseBlocksBuild()?c("To leave comments you must be logged into Blocks and added to the project "):c("To leave comments you must be logged into EmailMaker and added to the project "))+`${s}.`,okText:c("Okay. I'll log in.")})};async function Se(){l?(await pe({commentId:U,content:z,targetId:ce}).unwrap(),j("ADD"),le(""),I(0),re(!1),B(!1),fe(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Te()}const te=de=>{j("ADD"),le(""),I(0),re(!1),B(!1),fe(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},D=async()=>{l?((E||L)&&await Be({subjectId:i,author:K.id,parent:R==="ADD"?"0":U,content:E||L,author_name:K.name,author_email:K.email,targetId:ce}).then(de=>{if(de.error){const{data:je}=de.error;b.error({title:je?.code??c("Error"),description:je?.message??c("Something went wrong. Try again later.")})}else m({event:"submit",action:"send_discussion_chat_message",entity_type:n==="block"?"block":"email",entity_id:d?.id,project_id:d?.project,context:"editor"},void 0,{analyticsName:"editor_comment_sent"})}),fe(""),j("ADD"),P(""),x(""),I(0),re(!1),B(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Te()};function ie(){C?(B(!1),re(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ce})):(B(!N),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!N}),N&&re(!1))}function ye(de){let je=JSON.parse(JSON.stringify(de));if(!je||!je.length)return[];let G=[],be=new Map;for(let Le=0,He=je.length;Le<He;++Le){let Je=je[Le],Ze=be.get(Je.id);if((!Ze||Array.isArray(Ze))&&(Ze&&(Je.children=Ze),be.set(Je.id,Je)),String(Je.parent)==="0")G.push(Je);else{let so=be.get(Je.parent);so?(Array.isArray(so)?so:so.children=so.children||[]).push(Je):be.set(Je.parent,[Je])}}return G.forEach(Le=>{Le.status==="deleted"&&!Le.children&&(Pe.isUninitialized||Pe.isSuccess)&&he(Le.id).unwrap().catch(He=>{})}),G}const W=de=>{const je=de.data.operation;if(je===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(fe(de.data.settings.value),de.data.settings.value!==""?(re(!0),B(!1)):(re(!1),B(!0))),je===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&M(),je===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+de.data.settings.targetId+'"]')){let G=document.querySelector('.comment-icon-target[target-id="'+de.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,G.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,G.offsetTop),G.classList.add("active"),setTimeout(()=>{G.classList.remove("active")},2e3)}else g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:de.data.settings.targetId}),b.error({title:c("There's no such comment.")});je===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&b.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(W);const Re=de=>{g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:de})},$e=de=>(de?.sort((je,G)=>je.date>G.date?1:-1),(0,o.jsx)(o.Fragment,{children:de&&!!de.length&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:de,renderItem:je=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("li",{id:je.id,children:(0,o.jsxs)(o.Fragment,{children:[je.status==="deleted"&&je.clildren&&(0,o.jsx)(t.ui_kit$Comment,{className:"deletedComment",content:(0,o.jsx)(t.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:$e(je.children)}),je.status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:je.author_id,author:je.author_name,avatar:je.author_avatar_urls&&je.author_avatar_urls[48]||"",className:(0,Ue.default)(je.target_id&&"targetted-comment-item",(!je.author_avatar_urls||!je.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>$(je.id),menu:{items:je.author===K.id?Ve:Ge},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>je.target_id&&Re(je.target_id),dangerouslySetInnerHTML:{__html:je.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:je.date&&r.formatDate(r.tryParseISO(je.date),p,!0)}}),je.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":je.target_id,onClick:()=>Re(je.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:_.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[R==="REPLY"&&U===je.id&&We,R==="EDIT"&&U===je.id&&Ae,$e(je.children)]})})})]})})})})})),Ae=(0,o.jsxs)(t.ui_kit$Form,{onFinish:Se,className:"commentForm",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:z,onChange:de=>le(de.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:de=>de.key==="Escape"&&te(),onPressEnter:de=>de.key==="Enter"&&de.ctrlKey&&Se(),ref:T})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[C?(0,o.jsx)(t.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:Y,children:(0,o.jsx)(t.ui_kit$Button,{loading:Ce.isLoading,type:N||C&&R==="EDIT"&&ce!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="EDIT"&&ce!==""?{background:_.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}):(0,o.jsx)(t.ui_kit$Button,{onClick:ie,loading:Ce.isLoading,type:N||C&&R==="EDIT"&&ce!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="EDIT"&&ce!==""?{background:_.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:De.isLoading,htmlType:"submit",children:[c("Save")," ",(0,o.jsx)(r.EmIcons,{icon:"SaveOutlined",component:t.icons$SaveOutlined,size:16,strokeWidth:h.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:te,className:"button-reply",children:c("Cancel")})]})})]}),We=(0,o.jsxs)(t.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:D,children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:L,onChange:de=>P(de.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:de=>de.key==="Escape"&&te(),onPressEnter:de=>de.key==="Enter"&&de.ctrlKey&&D(),ref:T})}),(0,o.jsx)(t.ui_kit$Form.Item,{hidden:!0,name:"targetId",children:(0,o.jsx)(t.ui_kit$Input,{type:"hidden"})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ie,type:N||C&&R==="REPLY"&&ce!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="REPLY"&&ce!==""?{background:_.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:R==="REPLY"&&se.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:te,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,a.useEffect)(()=>{R==="REPLY"&&T.current.focus({cursor:"start"}),R==="EDIT"&&T.current.focus({cursor:"end"})},[R]);let Ve=[];Ve.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:me},{key:"Edit comment",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:oe},{key:"Delete comment",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:_.colorError},onClick:X});let Ge=[];return Ge.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:me}),(0,o.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:ye(e),renderItem:de=>(0,o.jsxs)("li",{id:de.id,children:[de.comment_status==="deleted"&&(0,o.jsx)(t.ui_kit$Comment,{className:"deletedComment",content:(0,o.jsx)(t.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:$e(de.children)}),de.comment_status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:de.author_id,author:de.author_name,avatar:de.author_avatar_urls&&de.author_avatar_urls[48]||"",className:(0,Ue.default)(de.target_id&&"targetted-comment-item",(!de.author_avatar_urls||!de.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>$(de.id),menu:{items:de.author===K.id?Ve:Ge},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>de.target_id&&Re(de.target_id),dangerouslySetInnerHTML:{__html:de.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:de.date&&r.formatDate(r.tryParseISO(de.date),p,!0)}}),de.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":de.target_id,onClick:()=>Re(de.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:_.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[R==="REPLY"&&U===de.id&&We,R==="EDIT"&&U===de.id&&Ae,$e(de.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:D,className:R==="ADD"?"addMode":"replyEditMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{value:E,onChange:de=>x(de.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:de=>de.key==="Enter"&&de.ctrlKey&&D()})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ie,type:N||C&&R==="ADD"&&ce!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="ADD"&&ce!==""?{background:_.colorInfo}:{},icon:(0,o.jsx)(r.EmIcons,{icon:"Target",component:t.icons$Target,size:16,strokeWidth:h.iconStrokeWidth,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-add",type:"primary",loading:R==="ADD"&&se.isLoading,htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]})]})};function xm(e,i){return{ID:e.userId,userId:e.userId,display_name:e.displayName,user_email:e.email,user_firstname:e.firstName,user_lastname:e.lastName,avatar_url:e.avatarUrl,...i?{role:i}:{}}}var km=["common_styles","subject","preheader","meta"];function Em(e,i){r.writeSourceReport(e,r.fromRevision(i))}function Bm(e){if(!e)return null;const i=e.get().attributes??{},l={};for(const s of km)i[s]!==void 0&&(l[s]=i[s]);return{content:e.getContent(),attributes:l}}function Pa(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var Aa=(e,i)=>({key:e.id,id:e.id,author:e.author,authorName:e.authorName,date:r.formatDate(r.tryParseISO(e.date||e.modified),i),title:e.title,html:e.html,common_styles:e.common_styles,loading:!1,isAutosave:e.isAutosave===!0}),br=({emailElement:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),n=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),p=r.useEditorLocked(),g=r.useEditorLockCheck(),{document:b}=r.useDocumentSessionContext(),_=r.useSelector(r.selectHistoryData),h=r.useDocumentHistoryReader(),m=r.useRevisionContent(),T=r.useNotification(),E=(0,a.useRef)({preview:0,apply:0}),x=r.useProjectData()?.members,R=r.useSelector(r.selectElementHistoryHasMore),j=r.useSelector(r.selectIsPanelHistoryCollapsed),[N,B]=(0,a.useState)(!0),[v,$]=(0,a.useState)(!1),[U,I]=(0,a.useState)([]),[L,P]=(0,a.useState)([]),z=X=>s(r.switchIsPanelHistoryCollapsed(X)),le=(0,a.useCallback)(X=>{if(!X?.html||g())return;const oe=r.fromRevision(X);oe?.attributes&&d(oe.attributes),s(r.markAppearanceNeedsUpdate());const me=b?.get().version;c(X.html,{undoable:!0}),b&&b.get().version===me&&b.markUnsaved()},[c,s,d,b,g]),C=(0,a.useCallback)(X=>{Em(b,X),s(r.markAppearanceNeedsUpdate())},[b,s]),{data:re}=r.projectsApi.useGetProjectQuery(Number(n),{skip:!n}),[ce,fe]=(0,a.useState)([]);(0,a.useEffect)(()=>{if(re){const{owner:X,admins:oe,users:me}=re?.members;fe([X&&{...X},oe&&Array.isArray(oe)&&oe.map(Te=>({...Te})),me&&Array.isArray(me)&&me.map(Te=>({...Te}))].filter(Te=>Te).flat(1).map(Te=>({id:Te.ID,display_name:Te.display_name})))}},[re,re?.members,i]);const[Be,se]=(0,a.useState)(1),[he,Pe]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const X=Array.isArray(_)&&_.length&&_?.map(oe=>Aa(oe,i));P(X||[]),I(X),B(!1),R||Pe(!0)},[_,R,i]);const pe=()=>{$(!0),P(U.concat([...new Array(3)].map(()=>({loading:!0})))),h(e.id,Be+1).then(X=>{if(X.isStale)return;const{data:oe,hasMore:me}=X.data,Te=Array.isArray(oe)&&oe?.map(te=>Aa(te,i)),Se=U.concat(Te);P(Se),I(Se),$(!1),window.dispatchEvent(new Event("resize")),me||Pe(!0),se(Be+1)})},De=!N&&!v&&!he?(0,o.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,o.jsx)(t.ui_kit$Button,{onClick:pe,children:i("loading more")})}):null,[Oe,Ce]=(0,a.useState)(),[ge,_e]=(0,a.useState)(null),Q=(0,a.useCallback)(X=>{le(X),Ce(null),_e(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[le,l,s]),K=(0,a.useCallback)((X,oe)=>me=>{const Te=E.current;Te[oe]+=1,oe==="apply"&&(Te.preview+=1);const Se=Te[oe],te=()=>Se===E.current[oe];if(me?.html||!me?.id){X(me);return}m(e.id,me).then(D=>{te()&&X(D)},D=>{te()&&(Ce(null),T.error({message:i("Failed to load"),innerException:D}))})},[m,e.id,T,i]),q=K(Q,"apply"),Z=K(C,"preview"),V=({author:X,authorName:oe})=>{if(Y.revisionService)return oe||X||"–";const me=ce.find(Se=>Se.id?.toString()===X?.toString())?.display_name;if(me)return me;const Te=r.authorFromMembers(X,x);return Te?xm(Te).display_name||Te.email||"–":oe||"–"},M=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{!j&&!ge&&(M.current=b,_e(Bm(b)))},[j,_e,b,ge]),(0,a.useEffect)(()=>{j&&(E.current.preview+=1),j&&ge&&(M.current===b&&(Pa(b,ge),s(r.markAppearanceNeedsUpdate())),_e(null))},[j,ge,b,s]);const Y=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse secondary-tabs_unset_scroll",size:"large",activeKey:r.HISTORY,items:[{label:(0,o.jsx)(o.Fragment,{children:i("Version history")}),key:r.HISTORY,forceRender:!0,className:"email-settings__collapse-panel",style:{height:"100%"},children:(0,o.jsx)(t.ui_kit$List,{className:"history-panel__list",loading:N,itemLayout:"horizontal",loadMore:De,dataSource:L,header:(0,o.jsxs)("div",{className:"history-panel__list-header",children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:i("Time")}),(0,o.jsx)("div",{className:"history-panel__list-author",children:i("Author")}),(0,o.jsx)("div",{className:"history-panel__restore",children:"Set"})]}),renderItem:(X,oe)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{oe!==Oe&&(Ce(oe),Z(U[oe])),s(r.setBlockSettingsDisable(!0))},className:(0,Ue.default)("history-panel__item",{"history-panel__item_active":oe===Oe}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:X.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:X.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:V(X)}),X.isAutosave&&Oe!==oe&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!X.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:p,onClick:me=>{Oe===oe&&me.stopPropagation(),q(U[oe])},children:i("Set")}),X.isAutosave&&Oe===oe&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:p,onClick:me=>{Oe===oe&&me.stopPropagation(),q(U[oe])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),ge&&Pa(b,ge),_e(null),z(!0),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,o.jsx)(r.EmIcons,{icon:"Close",component:t.icons$Close})})]})};br.propTypes={};var Na=async({blockTags:e,projectTagsArray:i,addTerm:l,project:s,notification:n})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const p=i.find(g=>g.name===c);return p?Promise.resolve(p.id):l({project:s,kind:r.BLOCK_TAGS,name:c}).then(({error:g,data:b})=>{if(g?.status===400)return r.existingTermIdFromError(g);if(b)return b.id;if(g)return n.fromError("TAG_CREATING_ERROR",c,g),null})});return(await Promise.all(d)).filter(c=>c!=null)},La=()=>{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=e.offsetHeight*207/660+"px"}),document.querySelector(".blocks-search__blocks-wrapper")&&(document.querySelector(".blocks-search__blocks-wrapper").style.transition="opacity 0.2s",document.querySelectorAll(".blocks-search__blocks-wrapper").forEach(e=>e.style.opacity=1))},1500))},Sm=async e=>{const{block:i,form:l,projectData:s,projectTagsArray:n,projectId:d,addBlock:c,editBlock:p,editProject:g,addTerm:b,notification:_,__:h,handleCloseModal:m,htmlContent:T,refetchBlocks:E,reloadBlockScreens:x,onGlobalBlockTemplateSynced:R,onPlainBlockCreated:j}=e;try{const{valid:N,values:B,blockTags:v}=await Oa({form:l,notification:_,__:h});if(!N)return;const $=await Na({blockTags:v,projectTagsArray:n,addTerm:b,project:s,notification:_});await r.createBlock({block:i,form:l,projectId:d,htmlContent:T,values:B,tagIds:$,addBlock:c,editBlock:p,editProject:g,notification:_,refetchBlocks:E,reloadBlockScreens:x,projectTagsArray:n,__:h,handleCloseModal:m,onGlobalBlockTemplateSynced:R,onPlainBlockCreated:j})}catch{}},Oa=async({form:e,notification:i,__:l})=>{let s=!0;const n=await e.validateFields(),d=n.tags;return d?.length>10&&(i.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:r.getBlockDesc(n),title:l("Maximum 10 tags available.")}),s=!1),{valid:s,values:n,blockTags:d}},gr=({isModalVisible:e,htmlContent:i,projectId:l,setIsShowAddAllBlocksModal:s,setIsShowAddAllBlocksModalForNewEmail:n})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[p]=t.ui_kit$Form.useForm(),[g,b]=(0,a.useState)([]),[_,h]=r.useAddBlockMutation(),[m]=r.useEditBlockMutation(),{data:T}=r.useGetBlockTypesQuery(),E=r.useNotification(),x=r.useAppConfig(),[R,j]=(0,a.useState)([]),N=r.useProjectData(),{refetch:B}=r.useGetBlocksQuery(r.projectBlocksArgs(l)),[v,$]=r.useAddTermMutation(),[U,I]=r.useEditProjectMutation(),L=r.useSendPostMessage(),P=(0,a.useCallback)((fe,Be)=>{L({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:fe,...Be?{emBlockVersion:Be}:{}}})},[L]),z=(0,a.useCallback)(()=>{L({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID})},[L]),{data:le}=r.useGetTermsQuery({project:N,kind:r.BLOCK_TAGS},{skip:!N?.id});(0,a.useEffect)(()=>{j((le||[]).map(fe=>({value:fe.name})))},[le]),(0,a.useEffect)(()=>{if(T){const fe=T;let Be=[];for(let se in fe)Be.push({label:d(r.TYPES_TRANSLATE[fe[se]]),value:fe[se]});b(Be)}},[T,d]);const C=()=>{c(r.closeModal())},re=()=>{s(!0),n(!1),C()},ce=async()=>{await Sm({form:p,projectData:N,projectTagsArray:le||[],projectId:l,addBlock:_,editBlock:m,editProject:U,addTerm:v,notification:E,__:d,handleCloseModal:C,htmlContent:i,refetchBlocks:B,reloadBlockScreens:La,onGlobalBlockTemplateSynced:P,onPlainBlockCreated:z})};return(0,o.jsx)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,onOk:()=>re(),onCancel:C,footer:(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"8px 0"},children:[(0,o.jsx)(t.ui_kit$Button,{size:"large",onClick:re,children:d("Save all blocks")},"create-all-blocks"),(0,o.jsx)(t.ui_kit$Button,{className:"add-new-block-modal__save-btn",size:"large",type:"primary",loading:h.isLoading,onClick:ce,icon:(0,o.jsx)(r.EmIcons,{icon:"CreateBlock",component:t.icons$CreateBlock,style:{fontSize:22}}),children:d("Save block")},"submit")]}),children:(0,o.jsxs)(t.ui_kit$Form,{form:p,layout:"vertical",name:"add_new_block_form",onFinish:ce,initialValues:{title:"",type:"",tags:[],global_block:!1},autoComplete:"off",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:16,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Block name"),name:"title",rules:[{required:!0,message:d("Please input block name")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Input,{disabled:h.isLoading||$.isLoading||I.isLoading,size:"large",placeholder:d("Enter block name"),spellCheck:"false"})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Type"),name:"type",rules:[{required:!0,message:d("Please choose block type")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Select,{disabled:h.isLoading||$.isLoading||I.isLoading,size:"large",placeholder:d("Choose block type"),options:g})})})]}),x.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),tooltip:{title:d("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},disabled:h.isLoading||$.isLoading||I.isLoading,options:R})}),x.globalBlockCheckboxEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{name:"global_block",valuePropName:"checked",style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Switch,{label:d("Global block"),disabled:h.isLoading||$.isLoading||I.isLoading})})]})})};gr.propTypes={};var Tm="https://app.emailmaker.ru/api/".replace(/\/+$/,""),Rm=`${Tm}/wp-json/ai-generator/v1/identificate_blocks`,ym=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function wm(e){return await e.getInstance(To.TOKEN_ID)}async function jm(e,i,l,s,n){const d={blocks:s,types:ym,locale:i};l.current=d;try{const c=await wm(n),p=await fetch(Rm,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(d)});if(!p.ok||p.status!==200)throw new Error(`${p.statusText}`);return await p.json()}catch(c){throw c}}var Im=(e,i="block")=>{const l=new DOMParser,s=l.parseFromString(e,"text/html"),n=s.querySelectorAll(`[em="${i}"]`),d=s.querySelectorAll("link");return{parser:l,document:s,blockElements:n,styleElement:s.querySelector('[em="styles"]'),linksElements:d}};function vm(e){return Array.from(e).map(i=>i.outerHTML).join("")}var Cm=(e,i="block",l=!1)=>{if(!e?.html)return[];const{document:s,blockElements:n,styleElement:d,linksElements:c}=Im(e.html,i),p=vm(c);if(!(n instanceof NodeList))return[];const g=s.querySelector("head"),b=g?g.innerHTML:"";return Array.from(n).map((_,h)=>{if(!(_ instanceof Element)||!_.outerHTML)return null;const m=d?d.outerHTML:"";return{id:`${e.id}-${h}`,html:l?`<!DOCTYPE html>
14
+ <html>
15
+ <head>${b}</head>
16
+ <body>
17
+ <table>${_.outerHTML}</table>
18
+ </body>
19
+ </html>`:r.minifyHtml(`${p}${m}${_.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function Pm(e,i,l){const{images:s}=e,{blocks:n}=i;return s?.map(d=>{const c=n.find(p=>p.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:l}})}var Am=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),Nm=e=>e.replace(/src="[^"]*"/g,'src=""'),Lm=e=>/<div\s+[^>]*style="font-family:/i.test(e),Om=e=>{const i=new Set,l=[];for(const s of e)if(Lm(s.html)){const n=Nm(Am(s.html));i.has(n)||(i.add(n),l.push(s))}else l.push(s);return l},$m=async e=>{const{block:i,form:l,projectData:s,projectId:n,addBlock:d,editProject:c,notification:p,__:g,handleCloseModal:b,htmlContent:_,refetchBlocks:h,reloadBlockScreens:m,values:T,tagIds:E,projectTagsArray:x}=e;try{return await r.createBlock({block:i,form:l,projectId:n,htmlContent:_,values:T,tagIds:E,addBlock:d,editProject:c,notification:p,refetchBlocks:h,reloadBlockScreens:m,projectTagsArray:x,__:g,handleCloseModal:b})}catch(R){throw R}},Fm=({projectData:e,addTerm:i,addBlock:l,editProject:s,reloadBlockScreens:n,notification:d,__:c,handleCloseModal:p,setTriggerOpenSavedBlocksTab:g,setTagsOptions:b,form:_,projectId:h})=>{const[m,T]=(0,a.useState)(!1),E=r.useInvalidateProject(),{data:x}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,a.useEffect)(()=>{b((x||[]).map(j=>({value:j.name})))},[x,b]),{bulkSave:async(j,N,B,v)=>{T(!0);try{if(!N)return;const $=await Na({blockTags:v,projectTagsArray:x||[],addTerm:i,project:e,notification:d});let U=!0,I=0;for(const L of j)try{await $m({block:L,form:_,projectData:e,projectId:h,addBlock:l,editProject:s,notification:d,__:c,handleCloseModal:p,values:B,tagIds:$,projectTagsArray:x||[]})}catch{U=!1,I++}if(U&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!U){if(I===j.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}g(!0),E(h),n()}catch($){throw $}finally{T(!1),_.resetFields(),p()}},confirmSavingBlocksLoading:m}},fr=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:l,setTriggerOpenSavedBlocksTab:s,projectId:n})=>{const{__:d,_n:c,sprintf:p}=r.useI18n(),g=r.useContainer(),b=r.useProjectData(),{tagsEnabled:_}=r.useAppConfig(),[h,m]=(0,a.useState)(!1),[T]=t.ui_kit$Form.useForm(),[E,x]=(0,a.useState)([]),[R,j]=(0,a.useState)([]),N=(0,a.useRef)({}),[B]=r.useAddTermMutation(),[v]=r.useEditProjectMutation(),[$,U]=r.useAddBlockMutation(),I=r.useEditorLocale()||void 0,L=Cm(i),P=Om(L).map(Be=>Be),z=P.length,le=r.useNotification(),C=()=>{h||ce||l(!1)},{bulkSave:re,confirmSavingBlocksLoading:ce}=Fm({projectData:b,addTerm:B,addBlock:$,editProject:v,reloadBlockScreens:La,notification:le,__:d,handleCloseModal:C,setTriggerOpenSavedBlocksTab:s,setTagsOptions:j,form:T,projectId:n}),fe=async()=>{try{const{valid:Be,values:se,blockTags:he}=await Oa({form:T,notification:le,__:d});s(!1),m(!0);const Pe=await jm(i,I,N,P,g),pe=r.wpProjectId(i.project,n??b?.id),De=Pm(Pe,N.current,String(pe??""));m(!1),await re(De,Be,se,he)}catch{m(!1),l(!1),le.error({title:d("Failed to save blocks."),placement:"bottomRight"})}};return(0,o.jsxs)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Bulk saving of blocks")}),open:e,onOk:fe,onCancel:C,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(h||ce)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:h||ce,onClick:fe,children:p(c("Save %d block","Save %d blocks",z),z)},"submit")}),children:[h||ce?(0,o.jsx)("div",{children:d("All blocks saved at this point can be found in the “Saved Blocks” section in the sidebar.")}):(0,o.jsx)("div",{children:p(c("Your letter contains %d block that can be saved for future use.","Your letter contains %d blocks that can be saved for future use.",z),z)}),!(h||ce)&&_&&(0,o.jsx)(t.ui_kit$Form,{form:T,name:"add_all_blocks_form",layout:"vertical",onFinish:fe,style:{paddingTop:24},children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",labelCol:{span:24},wrapperCol:{span:24},style:{display:"block",marginBottom:0},children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),style:{width:"100%"},value:E,onChange:x,disabled:U.isLoading,options:R})})}),(ce||h)&&(0,o.jsx)("div",{className:"modal-spinner",children:(0,o.jsx)(t.ui_kit$Spin,{size:"large"})})]})};fr.propTypes={};var _r=({isModalVisible:e=!1,email:i=null})=>{const{__:l}=r.useI18n(),[s]=t.ui_kit$Form.useForm(),n=r.useDispatch(),d=r.useRouteEmailId(),c=r.useNotification(),p=r.useCurrentUser(),g=r.useProjectData()?.projects_test_emails,[b,_]=r.useSendTestEmailMutation(),{token:h}=(0,t.ui_kit$useToken)(),[m,T]=(0,a.useState)(!1);r.useAppConfig(),r.useCookieManager();const E=r.useProjectData(),x=r.testEmailProject(i,E?.id),R=r.testEmailId(d,i,x),{data:j}=r.useGetProjectTestRecipientsQuery(x??0,{skip:!0}),[N,B]=r.useEditProjectMutation(),[v]=r.usePutProjectTestRecipientsMutation(),$=r.useProjectData(),{testEmails:U}=r.useAppConfig(),I=r.usePushToDataLayer(),[L,P]=(0,a.useState)([]),[z,le]=(0,a.useState)(!1),C=r.useEventEmitter(To.events.ON_SEND_EMAIL_MODAL_ID);(0,a.useEffect)(()=>{e?C.fire(i).then(se=>{se.some(he=>he===!1)?n(r.closeModal$1()):T(e)}):T(e)},[e,n,T,i,C]),(0,a.useEffect)(()=>{},[$,x,j]),(0,a.useEffect)(()=>{P(U.map(se=>({value:se})))},[U]),(0,a.useEffect)(()=>{const se=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(se&&m&&s.getFieldValue("recipients")?.length===0){const he=JSON.parse(se);he?.[x]&&s.setFieldsValue({recipients:he[x]})}},[x,m,s]),(0,a.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const re=()=>{n(r.closeModal$1()),s.resetFields()},ce=r.useContentReader(),fe=()=>{s.validateFields().then(()=>{const se={user_id:p.id,project_id:x,email_id:R,subject:s.getFieldValue("subject"),email:s.getFieldValue("recipients").join(","),html:r.encodedHtml(ce())};b(se).unwrap().catch(he=>{c.error({error:{data:{code:he?.data?.code,message:he?.data?.message}}})}),le(!0),I({event:"submit",action:"send_test_email",entity_id:d,project_id:x,recipients_count:s.getFieldValue("recipients").length})}).catch(se=>{})},Be=a.default.useRef(g);return Be.current=g,(0,a.useEffect)(()=>{const se=Be.current;if(_.isSuccess&&z){_.data?.status;{const he=[...new Set([...L.map(ge=>ge.value),...s.getFieldValue("recipients")])],Pe=he.map(ge=>({projects_test_email:ge}));((ge,_e)=>{if(!ge||!_e)return ge===_e;if(ge.length!==_e.length)return!1;const Q=ge.map(q=>q.projects_test_email).sort(),K=_e.map(q=>q.projects_test_email).sort();return Q.every((q,Z)=>q===K[Z])})(Pe,r.isProjectsV2Enabled()?(j||[]).map(ge=>({projects_test_email:ge})):se)||(r.isProjectsV2Enabled()?v({projectId:x,emails:he}):N({projectId:x,projects_test_emails:Pe}));const De=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)?JSON.parse(localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)):[];let Oe=s.getFieldValue("recipients");localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_test_emails,JSON.stringify({...De,[x]:[...new Set(Oe)]}));const Ce=i.title||i.subject||l("Untitled email.").replace(/\.$/,"");c.success(l("The email “")+Ce+l("” was successfully sent."))}le(!1),s.resetFields(),n(r.closeModal$1())}},[_,s,x,N,v,j,L,z,n,i.title,i.subject,c,B,l]),(0,a.useEffect)(()=>{B.isError&&(c.error(B),le(!1),s.resetFields(),n(r.closeModal$1()))},[n,B,s]),(0,a.useEffect)(()=>{s.setFieldsValue({subject:i.subject||i.title})},[i,s]),(0,o.jsx)(t.ui_kit$Modal,{width:572,title:(0,o.jsxs)("div",{style:{paddingBottom:8},children:[(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:20,strokeWidth:2})," ",l("Send a test email")]}),open:m,onCancel:re,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:B.isLoading,icon:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:18,strokeWidth:2,className:"email-preview-menu__list-item-icon"}),onClick:fe,disabled:_.isLoading,children:l("Send")},"submit")],forceRender:!0,children:(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"send_mail_form",initialValues:{subject:i.subject||i.title,recipients:[]},autoComplete:"off",children:[(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Subject"),name:"subject",rules:[{required:!1,message:l("Please type subject")}],children:(0,o.jsx)(t.ui_kit$Input,{size:"large",placeholder:l("Type subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Recipients"),name:"recipients",tooltip:{title:l("The test email will be sent to the specified addresses."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{required:!0,validator:(se,he)=>he.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):he.length!==0?he.every(Pe=>r.emailValidation.test(Pe.toLowerCase()))?Promise.resolve():Promise.reject(new Error(l("Please type correct emails"))):Promise.reject(new Error(l("Please type emails")))}],children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:l("Add up to 10 recipients"),tooltip:{title:"Tooltip with customize icon",icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},options:L,tagRender:se=>{const{label:he,closable:Pe,onClose:pe}=se,De=Oe=>{Oe.preventDefault(),Oe.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:h.colorPrimary,onMouseDown:De,closable:Pe,onClose:pe,style:{borderRadius:6},children:he})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};_r.propTypes={isModalVisible:f.default.bool,email:f.default.shape({html:f.default.string,subject:f.default.string})};var Mm=ao.__exportAll({AddAllBlocksModal:()=>fr,AddNewBlockModal:()=>gr,BlocksSearch:()=>hr,Discuss:()=>Ca,DiscussAi:()=>ua,EmailProperties:()=>ls,EmailSettings:()=>Vi,EmailStyles:()=>Ki,FileManagerDataLayer:()=>Ra,HistoryPanel:()=>br,LimitUpgradeModal:()=>ri,Optimise:()=>Ba,SaveBlockBtn:()=>Sr.SaveBlockBtn,SelectedElementPanel:()=>nt,SendTestEmailModal:()=>_r});_o.AddAllBlocksModal=fr,_o.AddNewBlockModal=gr,_o.BlocksSearch=hr,_o.Discuss=Ca,_o.DiscussAi=ua,_o.EmailProperties=ls,_o.EmailSettings=Vi,_o.EmailStyles=Ki,_o.FileManagerDataLayer=Ra,_o.HistoryPanel=br,_o.LimitUpgradeModal=ri,_o.LimitUpgradeModal$1=ri,_o.Optimise=Ba,_o.SaveBlockBtn=Sr.SaveBlockBtn,_o.SelectedElementPanel=nt,_o.SendTestEmailModal=_r,_o.getImageDimensionsFromBlob=Tr,Object.defineProperty(_o,"panels_exports",{enumerable:!0,get:function(){return Mm}}),_o.resolveDataProviderPreview=Rr,_o.shouldCountAiUsage=ar,_o.useImageBlobFetch=yr});