@emailmaker/emailmaker 1.2.3 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/emailmaker-core.b63d7b8b.js +859 -0
- package/emailmaker-esm.js +11 -11
- package/{emailmaker-po.8c2b05d7.js → emailmaker-po.b63d7b8b.js} +1 -1
- package/emailmaker.js +12 -12
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/css/sandbox.css +19 -0
- package/iframe/{iframe-eblock.8c2b05d7.html → iframe-eblock.b63d7b8b.html} +2 -2
- package/iframe/{iframe.8c2b05d7.html → iframe.b63d7b8b.html} +2 -2
- package/iframe/js/elMarkupHelper.C4wWAApZ.js +278 -0
- package/iframe/js/iframe-eblock.body.b63d7b8b.js +9 -0
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/iframe.body.b63d7b8b.js +129 -0
- package/iframe/js/iframe.js +2 -2
- package/iframe/js/sanitize-html/sanitize-html.js +46 -21756
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{abcacabc.js → 1922419a.js} +1 -1
- package/static/core/{9ff19e12.js → 253d6f68.js} +2 -2
- package/static/core/{dfbe3ba4.js → 32a14159.js} +1 -1
- package/static/core/{bbb11e65.js → 3a876cdd.js} +1 -1
- package/static/core/{aab84cf4.js → 40574d12.js} +1 -1
- package/static/core/{6535dd13.js → 4f63baad.js} +1 -1
- package/static/core/{60b75c99.js → 4fef179c.js} +1 -1
- package/static/core/{ed4586a5.js → 5e13bbc1.js} +3 -3
- package/static/core/{e13d6875.js → 6319e32c.js} +1 -1
- package/static/core/{c2daae71.js → 66a5de32.js} +1 -1
- package/static/core/{1687225b.js → 69842511.js} +1 -1
- package/static/core/{b99f4f42.js → 7a9faff8.js} +11 -11
- package/static/core/{1912a30e.js → 85accd9c.js} +1 -1
- package/static/core/{ee6a6899.js → 86e5503b.js} +2 -2
- package/static/core/{c7b2d60e.js → 89fb48c9.js} +1 -1
- package/static/core/{48e93de9.js → 8fdd9471.js} +1 -1
- package/static/core/{b6999cba.js → 9f6b8cdd.js} +1 -1
- package/static/core/{b712bb05.js → 9f7f5230.js} +1 -1
- package/static/core/{c6cd3dc2.js → a6518f19.js} +1 -1
- package/static/core/{b752ed52.js → a9d62c49.js} +1 -1
- package/static/core/{42ec1ce9.js → aea50cd5.js} +1 -1
- package/static/core/bb58b8a1.js +28 -0
- package/static/core/c266ad76.js +1 -0
- package/static/core/cd715a88.js +7 -0
- package/static/core/{9e7c400d.js → d0d2525d.js} +1 -1
- package/static/core/d402573d.js +1 -0
- package/static/core/{286097e2.js → e2694475.js} +2 -2
- package/static/core/e6f6edff.js +1 -0
- package/static/core/e8edbf21.js +2 -0
- package/static/core/{d2a90b69.js → f85176c7.js} +1 -1
- package/static/core/{492992bb.js → fa6f5198.js} +1 -1
- package/static/esm/{ea997fe3.js → 74f083c2.js} +1 -1
- package/static/umd-runtime/{runtime.BqNyFZPj.js → runtime.9w1dxMVc.js} +1 -1
- package/vendor/@emailmaker/ui-kit/package.json +1 -1
- package/emailmaker-core.8c2b05d7.js +0 -859
- package/iframe/js/elMarkupHelper.DnlKn-Lc.js +0 -277
- package/iframe/js/iframe-eblock.body.8c2b05d7.js +0 -9
- package/iframe/js/iframe.body.8c2b05d7.js +0 -129
- package/iframe/js/sanitize-html/sanitize-html.min.js +0 -16923
- package/static/core/316f71b7.js +0 -2
- package/static/core/466f98bb.js +0 -28
- package/static/core/6e548251.js +0 -1
- package/static/core/844fbb88.js +0 -1
- package/static/core/97aabe39.js +0 -7
- package/static/core/e88db487.js +0 -1
package/static/core/466f98bb.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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/df55e6fd.js",["require","exports","module","static/core/5dc34752.js","static/core/c804e4dd.js","static/core/5835858b.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./5dc34752.js"),r=B("./c804e4dd.js"),u=B("./5835858b.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`,G=`${p}borderRadiusBottomRight`,ue="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",q=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:q,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:q,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:q,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,[G]: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,[G]:n})}else{const n=s[U];n===s[H]&&n===s[M]&&n===s[G]?o.setFieldsValue({[le]:n}):o.setFieldsValue({[U]:null,[H]:null,[M]:null,[G]: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:q})}),(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/5835858b.js",["require","exports","module","static/core/5dc34752.js","static/core/c804e4dd.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./5dc34752.js"),r=t("./c804e4dd.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}})});
|
|
5
|
-
|
|
6
|
-
__emailmaker__.define("static/core/ffc6c926.js",["require","exports","module","static/core/5dc34752.js","static/core/c804e4dd.js","static/core/abb243ca.js","vite/preload-helper"],function(h,I,B){const R=h("./5dc34752.js"),n=h("./c804e4dd.js"),p=h("./abb243ca.js");let D=h("vite/preload-helper");var b=R.__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,D.__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}})});
|
|
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/466f98bb.js",["require","exports","module","static/core/5dc34752.js","static/core/422c8b42.js","static/core/c804e4dd.js","static/core/abb243ca.js","static/core/844fbb88.js","static/core/ffc6c926.js","static/core/5835858b.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(go,uo,Km){const ro=go("./5dc34752.js"),bo=go("./422c8b42.js"),r=go("./c804e4dd.js"),di=go("./abb243ca.js"),Rr=go("./844fbb88.js"),Ma=go("./ffc6c926.js"),U=go("./5835858b.js");let n=go("react");n=ro.__toESM(n);let o=go("react/jsx-runtime"),t=go("__delivery__/libs"),Da=go("react-dom"),Lt=go("vite/preload-helper"),Ue=go("classnames");Ue=ro.__toESM(Ue);let Lo=go("dayjs");Lo=ro.__toESM(Lo);var g=ro.__toESM(r.require_prop_types());async function yr(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),a=new Image;a.onload=()=>{URL.revokeObjectURL(s);const d=a.naturalWidth||a.width,c=a.naturalHeight||a.height;d>0&&c>0?i({width:d,height:c}):l(new Error("Could not read image dimensions"))},a.onerror=()=>{URL.revokeObjectURL(s),l(new Error("Could not decode image"))},a.src=s})}function ft(e){return e.trim()}var Va=67108864,Ha=2e3;function Ot(e){e.abandonTimer!==void 0&&(clearTimeout(e.abandonTimer),e.abandonTimer=void 0)}function wr(e,i){return i?new Promise((l,s)=>{if(i.aborted){s(new DOMException("Aborted","AbortError"));return}const a=()=>{s(new DOMException("Aborted","AbortError"))};i.addEventListener("abort",a,{once:!0}),e.then(d=>{i.removeEventListener("abort",a),l(d)},d=>{i.removeEventListener("abort",a),s(d)})}):e}function Ua(e={}){const i=e.maxCacheBytes??Va,l=e.abandonDelayMs??Ha,s=new Map,a=new Map;let d=0;function c(_){const B=s.get(_);B&&(d-=B.size,s.delete(_))}function m(_,B){if(c(_),!(B.size>i)){s.set(_,B),d+=B.size;for(const T of s.keys()){if(d<=i)break;c(T)}}}function b(_){const B=a.get(_);B&&(Ot(B),a.delete(_))}function f(_,B){B.waiters-=1,!(B.waiters>0||B.abandonTimer!==void 0||a.get(_)!==B)&&(B.abandonTimer=setTimeout(()=>{B.abandonTimer=void 0,!(a.get(_)!==B||B.waiters>0)&&(a.delete(_),B.controller.abort())},l))}function E(_,B,T){return B.waiters+=1,Ot(B),T.then(()=>f(_,B),()=>f(_,B)),T}async function h(_,B,T){const I=ft(_);if(!I)throw new Error("Empty image URL");const P=s.get(I);if(P){if(B?.aborted)throw new DOMException("Aborted","AbortError");return s.delete(I),s.set(I,P),P}const y=a.get(I);if(y)return E(I,y,wr(y.promise,B));const C=new AbortController,O={promise:T(I,C.signal).then(X=>(b(I),m(I,X),X)).catch(X=>{throw b(I),X}),controller:C,waiters:0,abandonTimer:void 0};return a.set(I,O),E(I,O,wr(O.promise,B))}function p(_){const B=ft(_);if(!B)return;const T=a.get(B);T&&(Ot(T),T.controller.abort(),a.delete(B)),c(B)}function S(){for(const[,_]of a)Ot(_),_.controller.abort();a.clear(),s.clear(),d=0}return{resolve:h,abandonKey:p,invalidateAll:S}}async function jr(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,a=s.url||i,d=s.thumbnailUrl||s.thumbnail||a||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(s):"")||"";return d?{file:s,previewUrl:d}:null}function gt(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 Wa(e){if(!(e instanceof Blob)||e.size===0)throw new r.e("Failed to download file from the URL.","UploadUrlDownloadFailed");const i=e.type?.split(";")[0]?.trim()||"image/png";if(!i.startsWith("image/"))throw new r.e("Content type at the URL is not allowed.","UploadUrlContentTypeNotAllowed");return{blob:e,mimeType:i}}async function za(e,i){const l=await fetch(e,i);if(!l.ok)throw new Error(`Server returned ${l.status}`);return l.blob()}async function Ga(e,i,l){const s=l?{signal:l}:void 0,{blob:a}=await r.ue(e,{handleFileProxy:async d=>{const c=await i.fireFileProxy(d);return r.pickFileProxyBlobFromFireResults(c)??null},handleProxyUrl:async d=>{const c=await i.fireProxyUrl(d);return r.pickProxyUrlOverrideFromFireResults(c,d)},fetchWithProxy:(d,c,m)=>bo.fetchWithResourceProxy(d,{config:i.appConfig,standalone:i.isStandalone,intent:m?.intent||"downloadBlob",validateBlob:async b=>!b.type||b.type.startsWith("image/"),init:c})},d=>za(d,s),Wa,{fetchInit:s});return a}function vr(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useProjectData(),s=r.useEditorProjectId(),a=l?.id!==void 0?String(l.id):s||"",d=r.useEventEmitter(bo.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(bo.events.PROXY_URL_EVENT_ID);return(0,n.useCallback)(async(m,b)=>Ga(m,{appConfig:e,isStandalone:i,fireFileProxy:f=>d.fire({url:f,project:a}),fireProxyUrl:f=>c.fire({url:f,project:a})},b),[e,a,i,d,c])}function Ya(e){return bo.getContainer(e).getOrCreateInstance(bo.IMAGE_BLOB_RESOLVER_ID,()=>Ua())}function Ir(){const e=r.useStore();return(0,n.useMemo)(()=>Ya(e),[e])}function $t(e){const i=String(e??"").split(";")[0].trim();if(!i)return"";const l=i.toLowerCase(),s=l.indexOf("/");if(s===-1)return l;const a=l.slice(s+1);return a==="svg+xml"?"svg":a}var Cr=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),ci=({onChange:e,value:i,validateStatus:l,placeholder:s,disabled:a,name:d,elementSettings:c,imageInfo:m,previewReloadSignal:b,onRemotePreviewValidate:f})=>{const E=r.useCurrentUser(),h=r.useProjectData(),p=r.useAppConfig(),S=r.useIsStandalone(),{__:_}=r.useI18n();r.useSendPostMessage();const B=r.useSendPostMessageEx(),{openImagePicker:T}=r.useImagePicker(),I=r.useStorageProvider(),P=r.useRestClient(),y=h?.id!==void 0?String(h?.id):"",C=E?.id!=="0"?String(E.id):"",{dataProvider:O}=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:I,projectId:y,restApi:P,i18n:{__:_},pathPostfix:C,appConfig:p,isStandalone:S}),[p,S,y,P,I,C,_]),X=vr(),[H]=r.useLazyGetImageInfoQuery(),[F,$]=(0,n.useState)({width:"",height:"",size:""}),[V,te]=(0,n.useState)(!1),[R,Z]=(0,n.useState)(0),[ge,le]=(0,n.useState)(""),pe=(0,n.useRef)(""),be=(0,n.useRef)(b?.counter||0),xe=Ir(),Re=(0,n.useRef)(""),oe=(0,n.useRef)(""),[Ve,Oe]=(0,n.useState)(0),ye=r.usePlanFeatureGate("image_editor"),he=()=>{Re.current&&(URL.revokeObjectURL(Re.current),Re.current="")};(0,n.useEffect)(()=>{if(!i){$({width:"",height:"",size:"",format:""}),pe.current="",le(""),he();return}if(i.startsWith("data:")||i.startsWith("blob:")){he(),pe.current=i,le(i),$({width:"",height:"",size:"",format:""});return}const K=r.stripEmVersionFromUrlString(i);oe.current=K;const z=ft(K),q=new AbortController;let ue=!1;const _e=async Le=>{he();const we=Ve?r.appendEmVersionForPreviewReload(Le):Le;pe.current=we,le(we);try{const{data:Ne}=await H(K);return ue||!Ne?!1:($({width:Ne?.width,height:Ne?.height,size:Ne?.fileSize!=null?(Ne.fileSize/1024).toFixed(0):"",format:$t(Ne?.format)}),!0)}catch{return!1}},fe=async()=>{const Le=await xe.resolve(z,q.signal,X);if(ue)return;const{width:we,height:Ne}=await yr(Le);if(ue)return;he();const Y=URL.createObjectURL(Le);Re.current=Y,pe.current=Y,le(Y),$({width:we,height:Ne,size:(Le.size/1024).toFixed(0),format:$t(Le.type)})};return(async()=>{try{if(!S){const Le=await jr(O,K);if(Le?.previewUrl&&await _e(Le.previewUrl))return}await fe()}catch{ue||(he(),pe.current="",le(""),$({width:"",height:"",size:"",format:""}))}})(),()=>{ue=!0,q.abort()}},[i,O,X,H,S,xe,Ve]);const me=(0,n.useCallback)(()=>{const K=oe.current;K&&xe.abandonKey(ft(K)),Oe(Date.now())},[xe]);(0,n.useEffect)(()=>{!b?.counter||b.name!==d||b.counter!==be.current&&(be.current=b.counter,me())},[d,b,me]),(0,n.useEffect)(()=>()=>he(),[]);const ie=!!i&&!gt(r.stripEmVersionFromUrlString(String(i))),Q=async(K=null)=>{const z=d.startsWith("src"),q=K||(z?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),ue=r.stripEmVersionFromUrlString(i||""),_e=await T({kind:z?"img":"background",currentUrl:gt(ue)?"":ue,entryModal:q});if(!_e?.url)return;const fe=ue===r.stripEmVersionFromUrlString(_e.url);(!fe||_e.url!==i)&&e(_e.url),_e.meta?.mode==="save"&&fe&&(me(),z&&B(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(_e.url)}))},se=[{label:_("Upload"),key:"Upload",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];p.imageCenterStockEnabled&&se.push({label:_("Stock"),key:"Stock",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),p.imageCenterGifEnabled&&se.push({label:_("GIF"),key:"GIF",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),p.elementAIimageEnabled&&se.push({label:_("AI"),key:"AI",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const ne=()=>{te(!1)};return(0,o.jsxs)("div",{className:(0,Ue.default)("upload-bg-image",{"upload-bg-image_disabled":a}),children:[i?(0,o.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:K=>{K.target?.closest(".upload-bg-image__edit")||K.target?.closest(".upload-bg-image__edit-menu")||K.target?.closest(".upload-bg-image__menu")||K.target?.closest(".inputGroup")||Q(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:()=>p.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:p.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:s,name:d,disabled:a,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:K=>K.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:ge?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:ge,alt:"",onLoad:()=>{f&&Cr(r.stripEmVersionFromUrlString(i||""))&&f("success")},onError:()=>{const K=oe.current,z=r.stripEmVersionFromUrlString(ge||""),q=r.stripEmVersionFromUrlString(K||"");if(K&&z!==q){pe.current=K,le(K);return}f&&Cr(q)&&f("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"})})]})})}),F.width&&F.height?(0,o.jsxs)("div",{className:"image-size",children:[F.width," × ",F.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+m.renderedWidth+" × "+m.renderedHeight,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[F.size," ",_("kB")]}),F.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:F.format})]})]}):(0,o.jsx)(t.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:s})]})}),(0,o.jsx)("div",{style:{flexGrow:1}}),F.format!=="gif"&&p.imageCenterEditorEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:_("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:p.iconStrokeWidth,onClick:()=>{ye.isLocked&&ie?(te(!0),Z(r.FEATURE_UPSELL_SLIDE.image_editor)):Q(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:se},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:p.iconStrokeWidth,icon:"SyncOutlined",component:t.icons$SyncOutlined,onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):_("Upload")})},"Actions")]}):(0,o.jsx)(t.ui_kit$Button,{type:"default",block:!0,onClick:()=>Q(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:p.iconStrokeWidth}),children:_("Add image")}),V&&(0,o.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:ne,initialSlide:R})]})};ci.propTypes={};var Xa=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),Ka=(e,i,l)=>i||(l?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Pr=e=>Array.isArray(e)?e.join("_"):e,Ao=({form:e,label:i,name:l,watchPath:s,disabled:a=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:m}=(0,t.ui_kit$useToken)(),[b,f]=(0,n.useState)("success"),E=(0,n.useMemo)(()=>({marginBottom:m.formItemMarginBottomXS}),[m.formItemMarginBottomXS]),h=t.ui_kit$Form.useWatch(Ka(l,s,d),e);return(0,n.useEffect)(()=>{if(!h){f("");return}if(typeof h=="string"&&(h.startsWith("data:")||h.startsWith("blob:"))){f("success");return}if(Xa(h)){f("validating");return}f("success")},[h]),(0,o.jsx)(t.ui_kit$Form.Item,{name:l,validateStatus:b,style:E,children:(0,o.jsx)(ci,{validateStatus:b,placeholder:i,name:Pr(l),disabled:a,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[Pr(l).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:f})})};Ao.propTypes={label:g.default.string.isRequired,name:g.default.oneOfType([g.default.string,g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number]))]).isRequired,watchPath:g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number])),tooltipTitle:g.default.string,disabled:g.default.bool,previewReloadSignal:g.default.shape({name:g.default.string,counter:g.default.number}),form:g.default.shape({getFieldValue:g.default.func.isRequired}).isRequired},Ao.defaulProps={disabled:!1,previewReloadSignal:null};var To=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:l,elementSettings:s,namePrefix:a="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),m=d==="mobile",b=m?"mobileBorderRadius":"borderRadius",f=m?"mobileBorderRadiusAll":"borderRadiusAll",E=m?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",h=m?"mobileBorderRadiusTopRight":"borderRadiusTopRight",p=m?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",S=m?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",_=m?U.MOBILE_BORDER_RADIUS_POSITION:U.BORDER_RADIUS_POSITION,B=()=>{const T=e.getFieldsValue(!0);let I;i?(e.setFieldsValue({[E]:T[f]||null,[S]:T[f]||null,[h]:T[f]||null,[p]:T[f]||null}),I={[b]:{[_[E]]:T[f]||0,[_[S]]:T[f]||0,[_[h]]:T[f]||0,[_[p]]:T[f]||0}}):T[E]===T[S]&&T[E]===T[h]&&T[E]===T[p]?(e.setFieldsValue({[f]:T[E]}),I={[b]:{[_[f]]:T[E]}}):(e.setFieldsValue({[E]:null,[S]:null,[h]:null,[p]:null}),I={[b]:{[_[f]]:0,[_[E]]:0,[_[S]]:0,[_[h]]:0,[_[p]]:0}});const P=m?{mobileBorderRadius:{all:T.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${a}${b}`]:{...s[`${a}${b}`],...I[`${a}${b}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:P}),l(y=>!y)};return(0,o.jsx)(t.ui_kit$FormBorderRadiusInputs,{namePrefix:a,typeOfForm:d,oneBorderRadiusValue:i,onToggle:B,borderRadiusIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};To.displayName="SelectedElementFormBorderRadius";var qa="em-mob-text_align-",Ja=({value:e,onChange:i,onSync:l,fieldName:s,...a})=>{const d=(typeof e=="object"?e?.value:e)??"",c=m=>{const b={classNamePrefix:qa,value:m};i?.(b),l?.({[s]:b})};return(0,o.jsx)(t.ui_kit$FormAlignControl,{value:d,onChange:c,...a})},Vo=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",tooltipTitle:a,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),m=r.useAppConfig(),b=d==="mobile",f=b?"mobileAlign":s;if(b){const E=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:f,children:(0,o.jsx)(Ja,{fieldName:f,onSync:E,disabled:l&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:a})})}return(0,o.jsx)(t.ui_kit$Form.Item,{name:f,children:(0,o.jsx)(t.ui_kit$FormAlignControl,{disabled:l&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:a})})},Fo=({form:e,elementSettings:i,tooltipTitle:l,disabled:s=!1,isNewIconType:a=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),m=r.useAppConfig(),b=d==="mobile",f=b?"mobileVerticalAlign":"valign",E=h=>{e.setFieldsValue({[f]:h}),b||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[f]:h}})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:f,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{...!b&&{value:i.valign,onChange:E},disabled:s,isNewIconType:a,strokeWidth:m.iconStrokeWidth})})},Qa=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],Za=({form:e,elementSettings:i,enableSwitch:l,usedColors:s,withoutShadowLabel:a})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[m,b]=(0,n.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),f=t.ui_kit$Form.useWatch(Qa,e);(0,n.useEffect)(()=>{if(!f)return;const[h,p,S,_,B,T]=f;(h===0||h===void 0||h===null)&&(p===0||p===void 0||p===null)&&(S===0||S===void 0||S===null)&&(_===0||_===void 0||_===null)&&(B===""||B===void 0||B===null)&&(T===!1||T===void 0)||b(!1)},[f]);const E=()=>{b(h=>!h),e.setFieldsValue({mobileBoxShadowHOffset:m?"":0,mobileBoxShadowVOffset:m?"":0,mobileBoxShadowBlurRadius:m?"":0,mobileBoxShadowSpreadRadius:m?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:m?null:0,vOffset:m?null:0,blurRadius:m?null:0,spreadRadius:m?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:a,labelSize:"small",size:"small",checked:m,onChange:E})}),(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{__:a}=r.useI18n(),d=r.useSelector(r.selectEmailSettings).usedColors;return e==="mobile"&&i&&l?(0,o.jsx)(Za,{form:i,elementSettings:l,enableSwitch:s,usedColors:d,withoutShadowLabel:a("Without shadow")}):(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};jo.displayName="SelectedElementFormBoxShadow";var vo=({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})})})]})})})})},ui=({form:e,elementSettings:i,handleChangeValues:l})=>{const{__:s}=r.useI18n(),a=(0,n.useRef)(),{token:d}=(0,t.ui_kit$useToken)(),[c,m]=(0,n.useState)(!1),[b,f]=(0,n.useState)(!1),[E,h]=(0,n.useState)(!1),[p,S]=(0,n.useState)(!1),[_,B]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let $=new URL("https://emailmaker.ru/?"+i.countdown);m($.searchParams.get("font1").endsWith("-b")||$.searchParams.get("font1").endsWith("-bi")),f($.searchParams.get("font1").endsWith("-i")||$.searchParams.get("font1").endsWith("-bi")),h($.searchParams.get("font2").endsWith("-b")||$.searchParams.get("font2").endsWith("-bi")),S($.searchParams.get("font2").endsWith("-i")||$.searchParams.get("font2").endsWith("-bi")),B($.searchParams.get("tp")==="true")},[i]);const T=[{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")}],I=[{value:"20",label:s("20 s")},{value:"40",label:s("40 s")},{value:"60",label:s("60 s")}],P=[{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"}],y=$=>$&&$<(0,Lo.default)().endOf("day")-864e5,C=$=>{B($)},O=()=>{const $=!c;e.setFieldValue("countdownNumbersStrong",$),l({countdownNumbersStrong:$}),m($)},X=()=>{const $=!b;e.setFieldValue("countdownNumbersItalic",$),l({countdownNumbersItalic:$}),f($)},H=()=>{const $=!E;e.setFieldValue("countdownLabelsStrong",$),l({countdownLabelsStrong:$}),h($)},F=()=>{const $=!p;e.setFieldValue("countdownLabelsItalic",$),l({countdownLabelsItalic:$}),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,{label:s("End time"),name:"countdownTime",children:(0,o.jsx)(t.ui_kit$DatePicker,{ref:a,format:"DD.MM.YYYY HH:mm",disabledDate:y,showTime:!0,placement:"bottomRight",getPopupContainer:$=>{const V=$?.closest(".blocks-app");return V||($?.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:T.map($=>(0,o.jsx)(t.ui_kit$Select.Option,{value:$.value,children:$.label},$.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:C})})})]}),(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:P})})}),(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:O,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":b}),onClick:X,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:P})})}),(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":E}),onClick:H,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":p}),onClick:F,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:I})})})]})]})};ui.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var mi=({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")]})]})})]})};mi.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var en={marginBottom:10},Io=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:en,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:pi}=t.ui_kit$Select,{mobileBorderRadiusAll:on,mobileBorderRadiusTopLeft:hi,mobileBorderRadiusBottomLeft:bi,mobileBorderRadiusTopRight:fi,mobileBorderRadiusBottomRight:gi,borderRadiusBottomRight:_i,borderRadiusTopRight:xi,borderRadiusBottomLeft:ki,borderRadiusTopLeft:Ei,alt:tn,src:rn,title:ln,link:lt,borderRadiusAll:Ar,imgReplacer:sn,expanded:an}={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"},Jo=({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})}},nn=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=n.default.useMemo(()=>nn(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})},Zo=({show:e,__:i,style:l,className:s})=>{const a=n.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:a}):null},Bi=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),dn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,cn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function et(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const l=i.match(dn);if(l)i=l[2];else{const s=i.match(cn);s&&(i=s[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var Ft=(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://":Bi(e)?"#":"":i,Ho=(e,i)=>{const l=Ft(e,"");return i(l),l},Nr=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]}}},Si=(e,i,l)=>{if(!e||!e.startsWith("mailto:"))return e;const s=e.split("?")[0],a=[];return i&&a.push(`subject=${encodeURIComponent(i)}`),l&&a.push(`body=${encodeURIComponent(l)}`),a.length>0?`${s}?${a.join("&")}`:s},u=e=>e||(e===0?"0":""),mo=e=>e&&e!=="auto"?e:e===0?"0":"",Lr=(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 Ti(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,a)=>(Object.keys(s).forEach(d=>{l[d+"_"+a]=s[d]}),!0)),i.images=l}if(e.sections?.length>0){const l=[];e.sections?.map((s,a)=>(l.push({[`expanded_${a}`]:s.expanded}),!0)),i.sections=l}return i}function Or(e,i,l){const s=l.hasOwnProperty("images"),a=l.hasOwnProperty("sections"),d=Object.keys(s?l.images:a?l.sections:l)[0],c=s?l.images:a?l.sections:l;let m={};const b=i.getFieldsValue(!0);switch(d.split("_")[0]){case ln:case rn:case tn:case sn:if(s){const E=[...e.carouselImages];E[d.split("_")[1]][d.split("_")[0]]=c[d],m={carouselImages:E}}else m=c;break;case an:if(a){const E=[...e.sections];E[d.split("_")[1]][d.split("_")[0]]=c[d],m={sections:E}}break;case lt:let f=et(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(m.carouselImages=e.carouselImages,s?(i.setFieldValue(["images",[lt+"_"+d.split("_")[1]]],f),m.carouselImages[d.split("_")[1]].link=f,m.link="",i.setFieldValue(lt,"")):(e.carouselImages.forEach((E,h)=>{i.setFieldValue(["images",lt+"_"+h],f),m.carouselImages[h].link=f,m.link=f}),i.setFieldValue(lt,f))):(i.setFieldValue(lt,f),m.link=f);break;case Ar:m={borderRadius:{...e.borderRadius,[U.BORDER_RADIUS_POSITION[Ei]]:b[Ei],[U.BORDER_RADIUS_POSITION[ki]]:b[ki],[U.BORDER_RADIUS_POSITION[xi]]:b[xi],[U.BORDER_RADIUS_POSITION[_i]]:b[_i],[U.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Ei:case ki:case xi:case _i:m={borderRadius:{...e.borderRadius,[U.BORDER_RADIUS_POSITION[Ar]]:null,[U.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case on:case hi:case bi:case fi:case gi:m={mobileBorderRadius:{...e.mobileBorderRadius,[U.MOBILE_BORDER_RADIUS_POSITION[hi]]:b[hi],[U.MOBILE_BORDER_RADIUS_POSITION[bi]]:b[bi],[U.MOBILE_BORDER_RADIUS_POSITION[fi]]:b[fi],[U.MOBILE_BORDER_RADIUS_POSITION[gi]]:b[gi],[U.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[d]+"-"}};break;default:m=c}return{...e,...m}}var Oo=(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(pi,{value:"px",children:"px"}),(0,o.jsx)(pi,{value:"%",children:"%"})]}),un=(0,o.jsx)(t.ui_kit$Select,{className:"select-after",children:(0,o.jsx)(pi,{value:"px",children:"px"})}),$r=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,hasLink:b,hasAlt:f,hasTitle:E,isOpenSrcReplacer:h,mergeTagItems:p,mergeMenuOpen:S,setMergeMenuOpen:_,cascaderRef:B,linkInputRef:T,linkButtonRef:I,altInputRef:P,altButtonRef:y,titleInputRef:C,titleButtonRef:O,srcReplacerInputRef:X,srcReplacerButtonRef:H,linkProtocol:F,handleLinkProtocolsChange:$,linkButtonHandler:V,linkInputHandler:te,altButtonHandler:R,altInputHandler:Z,titleButtonHandler:ge,titleInputHandler:le,srcReplacerButtonHandler:pe,srcInputHandler:be,handleSelect:xe,onChange:Re,filter:oe,renderSearchOption:Ve,handleChangeValues:Oe,toggleShowBorderHandler:ye,toggleShowBorderRadiusHandler:he,toggleShowBoxShadowHandler:me})=>{const{__:ie}=r.useI18n(),{token:Q}=(0,t.ui_kit$useToken)(),se=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)(Vo,{form:e,elementSettings:i,imgParent:!0})}),se.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Fo,{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)(ui,{form:e,elementSettings:i,handleChangeValues:Oe}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),se.mergeTagsShow&&p&&(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:S?"none":"inline-flex"},onClick:()=>_(!0),children:ie("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:B,classNames:{popup:{root:"merge-tags"}},options:p,placeholder:ie("Start typing the title"),showSearch:{filter:oe,render:Ve},spellCheck:"false",getPopupContainer:ne=>ne.closest(".email-pane__collapse-wrapper"),onChange:Re,style:{display:S?"block":"none"},open:S,onKeyDown:ne=>{ne.key==="Escape"&&_(!1)}})]})}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(mi,{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:ie("Image path"),name:"src",placeholder:ie("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!f&&!b&&!E&&!h?Q.formItemMarginBottomMD+4:Q.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:f||ie("Alternative text"),placement:"bottom",getPopupContainer:ne=>ne.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":!!f}),onClick:R,ref:y,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),se.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:E||ie("Tooltip text"),placement:"bottom",getPopupContainer:ne=>ne.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":!!E}),onClick:ge,ref:O,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:b||ie("Hyperlink URL"),placement:"bottom",getPopupContainer:ne=>ne.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}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:V,ref:I})}),se.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:ie("Image replacer"),placement:"bottom",getPopupContainer:ne=>ne.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:pe,ref:H})})]}),(!!b||!!f||!!E||!!h)&&(0,o.jsxs)("div",{style:{marginBottom:Q.formItemMarginBottomMD+4},children:[!!b&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:F==="#",__:ie,style:{marginBottom:Q.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:ie("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:Q.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:F,handleLinkProtocolsChange:$,__:ie}),placeholder:ie("Hyperlink URL"),allowClear:!0,ref:T,onChange:te,onSelect:xe,prefix:(0,o.jsx)(Jo,{linkProtocol:F})})})})]}),!!f&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:ie("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:Q.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:ie("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Z,ref:P,onSelect:xe})})}),se.formFieldImageTitleEnabled&&!!E&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:ie("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:Q.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:ie("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:le,ref:C,onSelect:xe})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:ie("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:Q.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:ie("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:ie("Image src")}),onChange:be,ref:X,onSelect:xe})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:ie("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:se.formImageFieldHeightEnabled,showMinMax:!1,gutter:Q.marginSM,rowStyle:{marginBottom:se.formImageFieldHeightEnabled?4:24},labels:{width:ie("Width"),height:ie("Height"),minWidth:ie("Minimum width"),maxWidth:ie("Maximum width")}})}),se.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:ie("Borders"),collapsible:!0,open:s,onToggle:ye,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:i})}),se.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:ie("Border radius"),collapsible:!0,open:a,onToggle:he,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,elementSettings:i})}),se.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:ie("Box shadow"),collapsible:!0,open:d,onToggle:me,dividerTop:!0,children:(0,o.jsx)(jo,{})}),se.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:ie("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),se.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:ie("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};$r.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,isOpenSrcReplacer:g.default.oneOfType([g.default.bool,g.default.number]),mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,srcReplacerInputRef:g.default.object,srcReplacerButtonRef:g.default.object,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,linkButtonHandler:g.default.func,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,srcReplacerButtonHandler:g.default.func,srcInputHandler:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,handleChangeValues:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func};var Uo=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=(0,n.useRef)(),[b,f]=(0,n.useState)(l[i]?.value==="auto"),{token:E}=(0,t.ui_kit$useToken)(),[h,p]=(0,n.useState)(""),S=B=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),f(T=>!T),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:b?null:"auto",dim:""}}})},_=B=>{f(!1),p(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:E.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:m,min:0,max:h,placeholder:d("Width"),onChange:_,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:Oo})})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:b,onChange:S})]})};Uo.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var ot=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=(0,n.useRef)(),[b,f]=(0,n.useState)(l.mobileHeight?.value==="auto"),{token:E}=(0,t.ui_kit$useToken)(),h=S=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),f(_=>!_),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:b?null:"auto",dim:""}}})},p=S=>{f(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:E.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:m,min:0,placeholder:d("Height"),onChange:p,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:b,onChange:h})]})};ot.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var Fr=({form:e,elementSettings:i,handleChangeValues:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:m,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:f,hasLink:E,hasAlt:h,hasTitle:p,linkInputRef:S,linkButtonRef:_,altInputRef:B,altButtonRef:T,titleInputRef:I,titleButtonRef:P,linkInputHandler:y,altButtonHandler:C,altInputHandler:O,titleButtonHandler:X,titleInputHandler:H,linkButtonHandler:F,toggleShowMobileBorderHandler:$,toggleShowMobileBorderRadiusHandler:V,toggleShowMobileBoxShadowHandler:te,toggleShowMobileSizeHandler:R})=>{const{__:Z}=r.useI18n(),{token:ge}=(0,t.ui_kit$useToken)(),le=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)(Vo,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),le.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Fo,{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)(ui,{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)(mi,{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:Z("Image path"),name:"src",placeholder:Z("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!h&&!E&&!p?ge.formItemMarginBottomMD+4:ge.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:h||Z("Alternative text"),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",{"selected-td-form__button--active":!!h}),onClick:C,ref:T,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),le.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p||Z("Tooltip text"),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",{"selected-td-form__button--active":!!p}),onClick:X,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:E||Z("Hyperlink URL"),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",{"selected-td-form__button--active":!!E}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:F,ref:_})})]}),(!!E||!!h||!!p)&&(0,o.jsxs)("div",{style:{marginBottom:ge.formItemMarginBottomMD+4},children:[!!E&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Z("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:ge.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:S,allowClear:!0,placeholder:Z("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onChange:y})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Z("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:ge.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Z("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:O,ref:B})})}),le.formFieldImageTitleEnabled&&!!p&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Z("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:ge.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Z("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:H,ref:I})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Size"),collapsible:!0,open:m,onToggle:R,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)(Uo,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:Z("Width")})}),le.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:Z("Height")})})]})}),le.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Borders"),collapsible:!0,open:a,onToggle:$,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),le.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Border radius"),collapsible:!0,open:d,onToggle:V,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:f,elementSettings:i,typeOfForm:"mobile"})}),le.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Box shadow"),collapsible:!0,open:c,onToggle:te,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),le.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),le.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Fr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,handleChangeValues:g.default.func,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,linkButtonHandler:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func};var mn=e=>typeof e=="object"&&e!==null?e.path:void 0;function $o(){const e=(0,n.useRef)(!1),i=(0,n.useRef)(null),l=(0,n.useCallback)(a=>{e.current=!a},[]),s=(0,n.useCallback)((a,d)=>{const c=JSON.stringify(mn(a)??null);return i.current!==c&&(i.current=c,e.current=!1),d?e.current:(e.current=!1,!1)},[]);return(0,n.useMemo)(()=>({markBorderToggled:l,isStaleBorderSnapshot:s}),[l,s])}function st(e){const i=(0,n.useRef)(null),l=(0,n.useRef)(e);return l.current=e,{remember:(0,n.useCallback)(s=>{i.current=s},[]),fillFields:(0,n.useCallback)((s,a)=>{l.current!==i.current&&s.setFieldsValue(a)},[])}}var Mr=2e3;function Dr(e,{ordered:i=!1}={}){const l=(0,n.useRef)([]),s=(0,n.useRef)(new WeakMap),a=(0,n.useRef)(e);return a.current=e,{remember:(0,n.useCallback)(d=>{const c=Date.now(),m=l.current.filter(b=>c-b.at<Mr);m.push({key:JSON.stringify(a.current(d)),at:c}),l.current=m.slice(-10),i&&d&&typeof d=="object"&&s.current.set(d,!1)},[i]),isOwnEcho:(0,n.useCallback)(d=>{if(!d)return!1;const c=Date.now(),m=JSON.stringify(a.current(d)),b=l.current.filter(h=>c-h.at<Mr);if(!i)return b.some(h=>h.key===m);const f=s.current.get(d);if(f!==void 0)return f;const E=b.findIndex(h=>h.key===m);return E>=0&&(l.current=b.slice(E)),s.current.set(d,E>=0),E>=0},[i]),forget:(0,n.useCallback)(()=>{l.current=[],s.current=new WeakMap},[])}}var pn=1e3,hn=2e4,Vr="https://useblocks.io/app/",bn=["activateSection","changeKey","parent","path","nextElem","prevElem"];function Ri(e){if(Array.isArray(e))return e.map(Ri);if(e&&typeof e=="object"){const i=e;return Object.fromEntries(Object.keys(i).sort().map(l=>[l,Ri(i[l])]))}return e}function fn(e){const i={...e};return bn.forEach(l=>delete i[l]),Ri(i)}var Hr=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=$o(),a=$o();let d=r.useDispatch();const c=r.useAppConfig(),m=r.useEditorProjectId(),b=r.useNotification(),f=r.useSendPostMessage(),E=r.useSendPostMessageEx(),{openImagePicker:h}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),S=r.useSelector(r.selectMobileViewActive),_=r.useCurrentUser(),B=r.useSelector(r.selectIsCodeMode),T=r.useSelector(r.selectCodeModeDirection),[I]=r.useUploadImageMutation(),[P,y]=r.useSendShortLinkMutation(),[C,O]=(0,n.useState)({name:"",counter:0}),X=(0,n.useRef)(null),H=(0,n.useRef)(null),F=(0,n.useRef)(null),$=(0,n.useRef)(null),V=(0,n.useRef)(null),te=(0,n.useRef)(null),R=(0,n.useRef)(null),Z=(0,n.useRef)(null),ge=(0,n.useRef)(null),[le,pe]=(0,n.useState)({}),[be,xe]=(0,n.useState)(!0),[Re,oe]=(0,n.useState)(!0),[Ve,Oe]=(0,n.useState)(""),[ye,he]=(0,n.useState)(""),[me,ie]=(0,n.useState)(""),[Q,se]=(0,n.useState)(!1),[ne,K]=(0,n.useState)(!1),[z,q]=(0,n.useState)(!1),[ue,_e]=(0,n.useState)(!1),[fe,Le]=(0,n.useState)(!1),[we,Ne]=(0,n.useState)(!1),[Y,re]=(0,n.useState)(!1),[je,W]=(0,n.useState)(!1),[Se,Ie]=(0,n.useState)("https://"),Pe=(0,n.useRef)(!1),Me=(0,n.useRef)(),He=e,ze=(0,n.useRef)(He);ze.current=He;const ae=(0,n.useCallback)(()=>l.getFieldsValue(!0).video,[l]),[Be,v]=(0,n.useState)(),[ee,Te]=(0,n.useState)(!1),[Ce,De]=(0,n.useState)(null),[We,Je]=(0,n.useState)({start:0,end:0}),[M,J]=(0,n.useState)(!1),[j,w]=(0,n.useState)(!1),[ce,ve]=(0,n.useState)(!1),[Ye,qe]=(0,n.useState)(!1),oo=(0,n.useRef)(void 0),to=(0,n.useRef)(null),no=(0,n.useRef)(null),fo=Ye||ce||je;(0,n.useEffect)(()=>()=>clearTimeout(oo.current),[]);const xo=(0,n.useRef)(null);(0,n.useEffect)(()=>{const N=xo.current,Ae=N?.firstElementChild??null;if(!fo||!N||!Ae)return;const ke=[];for(let Qe=N.parentElement;Qe;Qe=Qe.parentElement)getComputedStyle(Qe).overflowY!=="visible"&&ke.push(Qe);let Ee=0,Fe="";const Ke=()=>{const Qe=N.getBoundingClientRect(),po=N.offsetHeight>0?Qe.height/N.offsetHeight:1;let ho=Math.max(Qe.top,0),eo=Math.min(Qe.bottom,window.innerHeight);ke.forEach(qo=>{const bt=qo.getBoundingClientRect();ho=Math.max(ho,bt.top),eo=Math.min(eo,bt.bottom)});const co=(ho-Qe.top)/(po||1),So=Math.max(eo-ho,0)/(po||1),wo=`${Math.round(co)}/${Math.round(So)}`;wo!==Fe&&(Fe=wo,Ae.style.top=`${co}px`,Ae.style.height=`${So}px`),Ee=requestAnimationFrame(Ke)};return Ke(),()=>cancelAnimationFrame(Ee)},[fo]);const D=()=>{const N=to.current;no.current=N?.isConnected&&typeof N.selectionStart=="number"?{element:N,start:N.selectionStart,end:N.selectionEnd??N.selectionStart}:null},A=B&&T!=="bottom",x=r.useElementEntityKind();(0,n.useEffect)(()=>{ee&&ge.current&&ge.current.focus()},[ee]);const L=(N,Ae)=>{const ke=document.getElementById(Ae);if(ke){const Ee=Ae.substring(Ae.indexOf("selected_image_form_")+20),Fe=ke.value?.substring(0,We.start),Ke=ke.value?.substring(We.end);f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[Ee]:Fe+N+Ke}}),l.setFieldValue(Ee,Fe+N+Ke),ke.focus(),setTimeout(()=>{ke.selectionStart=We.start,ke.selectionEnd=We.start+N.length},400),J(!0)}},k=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{k?.items?.length&&v(r.mapMargeTags(k.items))},[k,v]);const G=(N,Ae)=>{if(Te(!1),N){const ke=k.syntax.length>1?Be.findIndex(Fe=>Fe.key===Ae[0].key):0,Ee=k.syntax[ke].replace("%value%",N[N.length-1]);Ce?.getAttribute("id")==="selected_image_form_title"||Ce?.getAttribute("id")==="selected_image_form_alt"||Ce?.getAttribute("id")==="selected_image_form_link"||Ce?.getAttribute("id")==="selected_image_form_imgReplacer"?L(Ee,Ce?.getAttribute("id")):(l.setFieldValue("imgReplacer",Ee),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:Ee}}))}},de=(N,Ae)=>Ae.some(ke=>ke.label.toLowerCase().indexOf(N.toLowerCase())>-1),Ge=(N,Ae)=>{const ke=Ae.map((Ee,Fe)=>{const Ke=Ee.label.split(new RegExp(`(${N})`,"gi"));return(0,o.jsxs)("span",{children:[Fe!==0&&(0,o.jsx)("span",{children:" / "}),Ke.map((Qe,po)=>Qe.toLowerCase()===N.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Qe},po):Qe)]},Ee.value)});return(0,o.jsx)("div",{title:Ae.map(Ee=>Ee.label).join(" / "),children:ke})},$e=r.useRootElement();(0,n.useEffect)(()=>{const N=({target:Ee})=>{Ee.closest('[id="merge_tags_wrapper"]')||(to.current=Ee,De(Ee))},Ae=({target:Ee})=>{!Ee.closest(".merge-tags")&&!Ee.closest("#merge_tags_button")&&Te(!1)},ke=new bo.Disposable;return ke.addDisposable(r.addWindowListenerFromShadow($e,"focusin",N)),ke.addDisposable(r.addWindowListenerFromShadow($e,"click",Ae)),()=>{ke.dispose()}},[$e]);const ao=({target:N})=>{if(N&&!M){const{selectionStart:Ae,selectionEnd:ke}=N;Je({start:Ae,end:ke})}J(!1)},Eo=e.border,Xo=e.mobileBorder,Co=Object.keys(Eo).find(N=>Eo[N]?.width||Eo[N]?.style||Eo[N]?.color),Bo=Object.keys(Xo).find(N=>Xo[N]?.width||Xo[N]?.style||Xo[N]?.color),so=N=>N&&(N?.width||N?.style||N?.color)?N:"",{remember:yo,fillFields:Ko}=st(e),{remember:ko,isOwnEcho:Do,forget:It}=Dr(fn,{ordered:!0}),No=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{if(e){const N=e.path;N!==No.current&&(No.current=N,It());const Ae=Do(e)?()=>{}:Ko;e.src!==Me.current&&(Me.current=e.src,Pe.current=!1);const ke=e.boxShadow;if(pe(ke),e.link&&Ie(Ft(e.link,"https://")),Ae(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:so(e.mobileBorder.all)||!(so(e.mobileBorder.top)||so(e.mobileBorder.bottom)||so(e.mobileBorder.right)||so(e.mobileBorder.left))&&so(e.border.all),mobileBorderTop:so(e.mobileBorder.top)||!so(e.mobileBorder.all)&&so(e.border.top),mobileBorderBottom:so(e.mobileBorder.bottom)||!so(e.mobileBorder.all)&&so(e.border.bottom),mobileBorderRight:so(e.mobileBorder.right)||!so(e.mobileBorder.all)&&so(e.border.right),mobileBorderLeft:so(e.mobileBorder.left)||!so(e.mobileBorder.all)&&so(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:mo(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:mo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:mo(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:mo(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",...He.video}}),e.countdown){let Ke=new URL("https://emailmaker.ru/?"+e.countdown),Qe=Ke.searchParams.get("font1"),po=!1,ho=!1;Qe.endsWith("-b")?(Qe=Qe.substring(0,Qe.length-2),po=!0):Qe.endsWith("-i")?(Qe=Qe.substring(0,Qe.length-2),ho=!0):Qe.endsWith("-bi")&&(Qe=Qe.substring(0,Qe.length-3),po=!0,ho=!0);let eo=Ke.searchParams.get("font2"),co=!1,So=!1;eo.endsWith("-b")?(eo=eo.substring(0,eo.length-2),co=!0):eo.endsWith("-i")?(eo=eo.substring(0,eo.length-2),So=!0):eo.endsWith("-bi")&&(eo=eo.substring(0,eo.length-3),co=!0,So=!0),Ae(l,{countdownTime:(0,Lo.default)(new Date(Date.parse(Ke.searchParams.get("time"))+Ke.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:Ke.searchParams.get("frames")||20,countdownTimeZone:Ke.searchParams.get("timezone"),countdownLanguage:Ke.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+Ke.searchParams.get("bg"),countdownTransparency:Ke.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:Qe,countdownNumbersFontSize:Ke.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+Ke.searchParams.get("color1"),countdownLabelsFont:eo,countdownLabelsFontSize:Ke.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+Ke.searchParams.get("color2"),countdownNumbersStrong:po,countdownNumbersItalic:ho,countdownLabelsStrong:co,countdownLabelsItalic:So})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?xe(!1):xe(!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))?oe(!1):oe(!0);const Ee=s.isStaleBorderSnapshot(e,!!Co),Fe=a.isStaleBorderSnapshot(e,!!Bo);Ee&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Fe||Ee&&!Bo)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),se(Ke=>Co&&!Ee?!0:Ke),K(Ke=>Co&&!Ee||Bo&&!Fe?!0:Ke),q(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),_e(!!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),Le(!!e.boxShadow),Ne(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),re(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?Oe(e.link):Oe(Pe.current?"...":""),he(e.alt),ie(e.title),w(e.imgReplacer?.length)}},[l,e,Ko,Do,It,He,Co,Bo,s,a]),(0,n.useEffect)(()=>{if(fo)return;const N=no.current;no.current=null,!(!N||!N.element.isConnected||N.element.disabled)&&to.current===N.element&&(N.element.focus(),N.element.setSelectionRange(N.start,N.end))},[fo]);const rt=async(N,Ae,ke)=>{const Ee={};Ee.user_id=_.id,Ee.folder=N,Ae&&(Ae=await r.prepareImageForEditorUpload(Ae,c),Ee.file=Ae),ke&&(Ee.page_url=ke);const Fe=await I(Ee);if(Fe.error)b.fromError("IMAGE_UPLOAD_ERROR",Ae,Fe.error,!0);else{const Ke=Ma.extractUploadResult(Fe.data);if(Ke.error)return;if(Ke.file_url)return Ke.file_url}},ai=(N,Ae)=>new Promise((ke,Ee)=>{const Fe=new Image,Ke=new Image;Fe.crossOrigin="Anonymous",Ke.crossOrigin="Anonymous";let Qe=Ae?2:1;const po=()=>{clearTimeout(eo),Ee(new Error("video preview images are not loaded"))},ho=()=>{Qe-=1,Qe===0&&(clearTimeout(eo),ke({frame:Fe,button:Ae?Ke:null}))},eo=setTimeout(po,hn);Fe.onload=ho,Fe.onerror=po,Fe.src=N,Ae&&(Ke.onload=ho,Ke.onerror=po,Ke.src=Ae)}),ni=(N,Ae,ke,Ee)=>{const Fe=document.createElement("canvas"),Ke=Fe.getContext("2d");if(Fe.width=N.width,Fe.height=N.height,Ke.clearRect(0,0,Fe.width,Fe.height),Ke.drawImage(N,0,0,N.width,N.height),!Ae)return Fe;const Qe=Math.min(Fe.width,Fe.height);let po;if(N.height>N.width)po=.3;else{const bt=N.width/N.height;po=Math.min(Ee,.3+(bt-1)/(ke-1)*.1)}const ho=Qe*po,eo=Ae.width/Ae.height;let co,So;eo>=1?(co=ho,So=ho/eo):(So=ho,co=ho*eo);const wo=(Fe.width-co)/2,qo=(Fe.height-So)/2;return Ke.drawImage(Ae,wo,qo,co,So),Fe},Ct=N=>new Promise(Ae=>{N.toBlob(ke=>Ae(ke?new File([ke],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),Lm=async N=>{const Ae=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!N||!Ae||Ae==="none"||ce)){D(),ve(!0);try{const{frame:ke,button:Ee}=await ai(N,`${Vr}${Ae}.png`),Fe=await Ct(ni(ke,Ee,2,.4)),Ke=Fe&&await rt(m,Fe);if(!Ke)return;f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:ze.current.type,settings:{src:Ke}}),Pt({...ze.current,src:Ke,video:ae()||ze.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{l.setFieldValue("src",Ke)},100)}catch{}finally{ve(!1)}}},Om=async()=>{const N=ae(),Ae=N?.source,ke=N?.playButton;if(!Ae)return;const Ee=()=>ae()?.source!==Ae;D(),qe(!0);try{const Fe=await rt("tmp",null,Ae);if(!Fe||Ee())return;const{frame:Ke,button:Qe}=await ai(Fe,ke&&ke!=="none"?`${Vr}${ke}.png`:null);if(Ee())return;const po=await Ct(ni(Ke,Qe,2.5,.35)),ho=po&&await rt(m,po);ho&&!Ee()&&Sr(ho)}catch{}finally{qe(!1)}},Br=N=>{clearTimeout(oo.current),oo.current=setTimeout(()=>{N()},pn)},$m=()=>{const N=l.getFieldsValue(!0);let Ae=new URL("https://cdt3.emcdn.ru/rndt?"+e.countdown),ke=N.countdownNumbersFont;N.countdownNumbersStrong&&N.countdownNumbersItalic?ke+="-bi":N.countdownNumbersStrong?ke+="-b":N.countdownNumbersItalic&&(ke+="-i");let Ee=N.countdownLabelsFont;N.countdownLabelsStrong&&N.countdownLabelsItalic?Ee+="-bi":N.countdownLabelsStrong?Ee+="-b":N.countdownLabelsItalic&&(Ee+="-i"),Ae.searchParams.set("time",new Date(N.countdownTime.$d-N.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Ae.searchParams.set("bg",N.countdownBackgroundColor.substring(1)||"#FFFFFF"),Ae.searchParams.set("tp",!!N.countdownTransparency),Ae.searchParams.set("font1",ke),Ae.searchParams.set("size1",N.countdownNumbersFontSize*2||12),Ae.searchParams.set("color1",N.countdownNumbersColor.substring(1)||"#000000"),Ae.searchParams.set("font2",Ee),Ae.searchParams.set("size2",N.countdownLabelsFontSize*2||8),Ae.searchParams.set("color2",N.countdownLabelsColor.substring(1)||"#959595"),Ae.searchParams.set("spacing",Math.round(N.countdownNumbersFontSize*.4)||5),Ae.searchParams.set("locale",N.countdownLanguage.replace("_","-")),Ae.searchParams.set("timezone",N.countdownTimeZone),Ae.searchParams.set("frames",N.countdownDuration),P({link:JSON.stringify({target:Ae.href})}),D(),W(!0)},Pt=(0,n.useCallback)(N=>{yo(N),ko(N),d(x==="email"?r.setElementSettings$1(N):r.setElementSettings(N))},[d,x,yo,ko]),Sr=(0,n.useCallback)((N,Ae)=>{const ke=ze.current,Ee=r.stripEmVersionFromUrlString(ke.src||"")===r.stripEmVersionFromUrlString(N||"");(!Ee||N!==ke.src)&&(f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:ke.type,settings:{src:N}}),Pt({...ke,src:N,...ke.type==="video"?{video:ae()||ke.video}:{},activateSection:null,changeKey:"src"}),l.setFieldValue("src",N)),Ae?.mode==="save"&&Ee&&(O(Fe=>({name:"src",counter:Fe.counter+1})),E(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(N)}))},[l,ae,Pt,f,E]),At=(0,n.useCallback)(async N=>{const Ae=e.src||"",ke=r.stripEmVersionFromUrlString(Ae),Ee=await h({kind:"img",currentUrl:gt(ke)?"":ke,entryModal:N});Ee?.url&&Sr(Ee.url,Ee.meta)},[Sr,e.src,h]),Tr=(N,...Ae)=>{const ke=l.getFieldsValue(!0),Ee=Object.keys(N)[0];let Fe;switch(Ee){case"link":let Ke=et(N[Ee]);Ke!==N[Ee]&&l.setFieldValue("link",Ke),Fe={link:Ke};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Fe={boxShadow:{hOffset:ke.boxShadowHOffset,vOffset:ke.boxShadowVOffset,blurRadius:ke.boxShadowBlurRadius,spreadRadius:ke.boxShadowSpreadRadius,color:ke.boxShadowColor,inset:ke.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ke.borderPosition==="borderAll"?(Fe={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...ke.borderAll}}},l.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):ke.borderAll?.width||ke.borderAll?.style||ke.borderAll?.color?(Fe={border:{all:null,left:ke.borderAll,right:ke.borderAll,top:ke.borderAll,bottom:ke.borderAll,[U.REVERSE_BORDER_POSITIONS[Ee]]:{...ke[Ee],...N[Ee]}}},l.setFieldsValue({borderAll:null,borderLeft:ke.borderAll,borderRight:ke.borderAll,borderTop:ke.borderAll,borderBottom:ke.borderAll,[Ee]:{...ke[Ee],...N[Ee]}})):(Fe={border:{all:null,left:ke.borderLeft,right:ke.borderRight,top:ke.borderTop,bottom:ke.borderBottom,[U.REVERSE_BORDER_POSITIONS[Ee]]:{...ke[Ee],...N[Ee]}}},l.setFieldsValue({border:Fe.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ke.mobileBorderPosition==="mobileBorderAll")Fe={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...ke.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[Ee]+"-"}}},l.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const eo=U.MOBILE_REVERSE_BORDER_POSITIONS[Ee],co={...ke[Ee],...N[Ee]},So=!co?.width&&!co?.style&&!co?.color;if(ke.mobileBorder?.all?.width||ke.mobileBorder?.all?.style||ke.mobileBorder?.all?.color){const wo=ke.mobileBorderAll;Fe={mobileBorder:{all:null,left:wo,right:wo,top:wo,bottom:wo,[eo]:So?null:{...co,classNamePrefix:"em-mob-border_"+eo+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:wo,mobileBorderRight:wo,mobileBorderTop:wo,mobileBorderBottom:wo,[Ee]:co})}else{const wo=e.mobileBorder||{},qo=bt=>{const Nt=wo[bt];return Nt&&(Nt?.width||Nt?.style||Nt?.color)?Nt:null};Fe={mobileBorder:{all:null,left:eo==="left"?So?null:{...co,classNamePrefix:"em-mob-border_left-"}:qo("left"),right:eo==="right"?So?null:{...co,classNamePrefix:"em-mob-border_right-"}:qo("right"),top:eo==="top"?So?null:{...co,classNamePrefix:"em-mob-border_top-"}:qo("top"),bottom:eo==="bottom"?So?null:{...co,classNamePrefix:"em-mob-border_bottom-"}:qo("bottom")}},l.setFieldsValue({[Ee]:co})}}break;case"width":Fe={[Ee]:{value:N[Ee],dim:ke.widthDim}};break;case"widthDim":Fe={width:{value:ke.width,dim:N[Ee]}};break;case"height":Fe={[Ee]:{value:N[Ee],dim:ke.heightDim}};break;case"heightDim":Fe={height:{value:ke.height,dim:N[Ee]}};break;case"borderRadiusAll":Fe={borderRadius:{[U.BORDER_RADIUS_POSITION[Ee]]:+N[Ee]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Fe={borderRadius:{topLeft:ke.borderRadiusTopLeft,bottomLeft:ke.borderRadiusBottomLeft,topRight:ke.borderRadiusTopRight,bottomRight:ke.borderRadiusBottomRight,[U.BORDER_RADIUS_POSITION[Ee]]:+N[Ee]}};break;case"mobileWidth":Fe={[Ee]:{classNamePrefix:"em-mob-width-",value:N[Ee],dim:ke.mobileWidthDim}};break;case"mobileWidthDim":Fe={mobileWidth:{classNamePrefix:"em-mob-width-",value:ke.mobileWidth||100,dim:N[Ee]}};break;case"mobileHeight":Fe={[Ee]:{classNamePrefix:"em-mob-height-",value:N[Ee],dim:ke.mobileHeightDim}};break;case"mobileHeightDim":Fe={mobileHeight:{classNamePrefix:"em-mob-height-",value:ke.mobileHeight,dim:N[Ee]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Fe={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[Ee]]:N[Ee],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[Ee]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Fe={mobileBoxShadow:{hOffset:ke.mobileBoxShadowHOffset,vOffset:ke.mobileBoxShadowVOffset,blurRadius:ke.mobileBoxShadowBlurRadius,spreadRadius:ke.mobileBoxShadowSpreadRadius,color:ke.mobileBoxShadowColor,inset:ke.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Fe={[Ee]:{classNamePrefix:"em-mob-text_align-",value:N[Ee]}};break;case"mobileVerticalAlign":Fe={[Ee]:{classNamePrefix:"em-mob-vertical_align-",value:N[Ee]}};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":Br($m);break;case"video":{const eo={...e.video,...ke.video,...N.video},co=eo.source??ke.link;Br(Om),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:eo,link:co}}),Pt({...e,video:eo,link:co,activateSection:null,changeKey:"video"});break}case"src":const Qe=N[Ee],po=e.src,ho=ke.video?.playButton||e.video?.playButton;if(e.type==="video"&&ho&&ho!=="none"&&!ce&&Qe&&(!po||Qe!==po)){Br(()=>Lm(Qe));return}Fe=N;break;default:Fe=N}Ee!=="borderPosition"&&Ee!=="mobileBorderPosition"&&Ee.indexOf("countdown")===-1&&Ee!=="video"&&(f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Fe}),Ee!=="video"&&Ee.indexOf("countdown")===-1&&Ee!=="mobileBorderRadiusAll"&&Ee!=="mobileBorderRadiusTopLeft"&&Ee!=="mobileBorderRadiusTopRight"&&Ee!=="mobileBorderRadiusBottomLeft"&&Ee!=="mobileBorderRadiusBottomRight"&&Pt({...e,...Fe,mobileBorderRadius:{...e.mobileBorderRadius,...Fe?.mobileBorderRadius},activateSection:null,changeKey:Ee}))};(0,n.useEffect)(()=>{y.isError&&(b.error(y),W(!1))},[y]),(0,n.useEffect)(()=>{if(y.isSuccess&&je){if(y.data.data?.status===400)b.error({title:y.data.code,description:y.data.message});else{let N=new URL(y.data.target),Ae={countdown:{link:y.data.link,params:N.search.substring(1)}};f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ae})}W(!1)}},[y,je,e,b,f]);const Fm=N=>{N.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(Fm),r.useImageControlRequest(e.src,N=>{N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_AI):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&At(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const Mm=()=>{const N=l.getFieldsValue(!0);s.markBorderToggled(!Q),setTimeout(()=>{se(Ae=>!Ae),Q?(N.borderAll=U.NULL_BORDER,N.borderTop=U.NULL_BORDER,N.borderBottom=U.NULL_BORDER,N.borderRight=U.NULL_BORDER,N.borderLeft=U.NULL_BORDER):N.borderAll={width:1,color:"#E5E5E5",style:"solid"},f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:N.borderAll.color,style:N.borderAll.style,width:N.borderAll.width}}}})})},Dm=()=>{const N=l.getFieldsValue(!0);a.markBorderToggled(!ne),setTimeout(()=>{K(Ae=>!Ae),ne?(N.mobileBorderAll=U.NULL_BORDER,N.mobileBorderTop=U.NULL_BORDER,N.mobileBorderBottom=U.NULL_BORDER,N.mobileBorderRight=U.NULL_BORDER,N.mobileBorderLeft=U.NULL_BORDER):N.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:N.mobileBorderAll.color,style:N.mobileBorderAll.style,width:N.mobileBorderAll.width}}}})})},Vm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{q(Ae=>!Ae),z?(N.borderRadiusAll=0,xe(!0)):N.borderRadiusAll=5,f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:N.borderRadiusAll}}})})},Hm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{_e(Ae=>!Ae),ue?(N.mobileBorderRadiusAll=null,oe(!0)):N.mobileBorderRadiusAll=5,f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:N.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Um=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{Le(Ae=>!Ae),fe?(N.boxShadowInset=!1,N.boxShadowHOffset=null,N.boxShadowVOffset=null,N.boxShadowBlurRadius=null,N.boxShadowSpreadRadius=null,N.boxShadowColor=""):(N.boxShadowInset=!1,N.boxShadowHOffset=5,N.boxShadowVOffset=5,N.boxShadowBlurRadius=10,N.boxShadowSpreadRadius=-5,N.boxShadowColor="#000000"),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:N.boxShadowBlurRadius,color:N.boxShadowColor,hOffset:N.boxShadowHOffset,inset:N.boxShadowInset,spreadRadius:N.boxShadowSpreadRadius,vOffset:N.boxShadowVOffset}}})})},Wm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{Ne(Ae=>!Ae),we?(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=null,N.mobileBoxShadowVOffset=null,N.mobileBoxShadowBlurRadius=null,N.mobileBoxShadowSpreadRadius=null,N.mobileBoxShadowColor=""):(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=5,N.mobileBoxShadowVOffset=5,N.mobileBoxShadowBlurRadius=10,N.mobileBoxShadowSpreadRadius=-5,N.mobileBoxShadowColor="#000000"),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:N.mobileBoxShadowBlurRadius,color:N.mobileBoxShadowColor,hOffset:N.mobileBoxShadowHOffset,inset:N.mobileBoxShadowInset,spreadRadius:N.mobileBoxShadowSpreadRadius,vOffset:N.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},zm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{re(Ae=>!Ae),Y&&(N.mobileWidth="",N.mobileHeight="",f({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-"}}}))})},Aa=()=>{Ve?(Pe.current=!1,Oe(""),l.setFieldValue("link",""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Pe.current=!0,Oe(X.current&&X.current.input.value?X.current.input.value:"..."),setTimeout(()=>{X.current.focus()}))},Na=N=>{N.target.value===""?Oe("..."):(H.current.classList.add("selected-td-form__button--active"),Oe(N.target.value)),Ho(N.target.value,Ie)},La=()=>{const N=l.getFieldsValue(!0);ye?(he(""),N.alt="",f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(he(F.current&&F.current.input.value?F.current.input.value:"..."),setTimeout(()=>{F.current.focus()}))},Oa=N=>{N.target.value===""?he("..."):($.current.classList.add("selected-td-form__button--active"),he(N.target.value))},$a=()=>{const N=l.getFieldsValue(!0);me?(ie(""),N.title="",f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(ie(V.current&&V.current.input.value?V.current.input.value:"..."),setTimeout(()=>{V.current.focus()}))},Gm=()=>{w(!j),j?(l.setFieldValue("imgReplacer",""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>R.current.focus())},Ym=N=>{N.target.value!==""&&Z.current.classList.add("selected-td-form__button--active")},Fa=N=>{N.target.value===""?ie("..."):(te.current.classList.add("selected-td-form__button--active"),ie(N.target.value))},Xm=N=>{l.setFieldValue("link",N!=="mergetag"?N:""),Ie(N)};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:U.BORDER_POSITIONS[Co]||"borderAll",mobileBorderPosition:U.MOBILE_BORDER_POSITIONS[Bo]||"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:Tr,autoComplete:"off",disabled:fo,className:fo?"element-controls selected-image-form_busy":"element-controls",children:[fo&&(0,o.jsx)("div",{className:"selected-image-form__loader",ref:xo,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:He.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!A&&(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"&&S.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Fr,{form:l,elementSettings:e,handleChangeValues:Tr,boxShadow:le,mobileBordersShow:ne,mobileBorderRadiusShow:ue,mobileBoxShadowShow:we,mobileSizeShow:Y,oneMobileBorderRadiusValue:Re,setOneMobileBorderRadiusValue:oe,hasLink:Ve,hasAlt:ye,hasTitle:me,linkInputRef:X,linkButtonRef:H,altInputRef:F,altButtonRef:$,titleInputRef:V,titleButtonRef:te,linkInputHandler:Na,altButtonHandler:La,altInputHandler:Oa,titleButtonHandler:$a,titleInputHandler:Fa,linkButtonHandler:Aa,toggleShowMobileBorderHandler:Dm,toggleShowMobileBorderRadiusHandler:Hm,toggleShowMobileBoxShadowHandler:Wm,toggleShowMobileSizeHandler:zm})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)($r,{form:l,elementSettings:e,boxShadow:le,bordersShow:Q,borderRadiusShow:z,boxShadowShow:fe,oneBorderRadiusValue:be,setOneBorderRadiusValue:xe,hasLink:Ve,hasAlt:ye,hasTitle:me,isOpenSrcReplacer:j,mergeTagItems:Be,mergeMenuOpen:ee,setMergeMenuOpen:Te,cascaderRef:ge,linkInputRef:X,linkButtonRef:H,altInputRef:F,altButtonRef:$,titleInputRef:V,titleButtonRef:te,srcReplacerInputRef:R,srcReplacerButtonRef:Z,linkProtocol:Se,handleLinkProtocolsChange:Xm,linkButtonHandler:Aa,linkInputHandler:Na,altButtonHandler:La,altInputHandler:Oa,titleButtonHandler:$a,titleInputHandler:Fa,srcReplacerButtonHandler:Gm,srcInputHandler:Ym,handleSelect:ao,onChange:G,filter:de,renderSearchOption:Ge,handleChangeValues:Tr,toggleShowBorderHandler:Mm,toggleShowBorderRadiusHandler:Vm,toggleShowBoxShadowHandler:Um})})]})};Hr.propTypes={elementSettings:g.default.object.isRequired};var Ur=()=>{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"})})})},tt=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",setAlignStateHandle:a=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),m=r.useSendPostMessage(),b=r.useAppConfig(),[f,E]=(0,n.useState)(null);(0,n.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&E(!0)},[]);const h=I=>{a(I),e.setFieldsValue({[s]:I}),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[s]:I}})},p=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,S=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,_=d?f?p:S:void 0,B=i[s],T=typeof B=="string"?B:"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:s,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{value:T,onChange:h,disabled:l&&!i.parent,strokeWidth:b?.iconStrokeWidth,labels:_})})},Ze=({form:e,elementSettings:i,name:l,icon:s,tooltipTitle:a=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:m}=r.useI18n(),b=e.getFieldValue(l),f=r.useSendPostMessage(),[E,h]=(0,n.useState)(i[l]);(0,n.useEffect)(()=>{i[l]!==e.getFieldValue(l)&&(e.setFieldValue(l,i[l]),h(i[l]))},[i,e,l]),(0,n.useEffect)(()=>{E!==b&&h(b)},[b,E,l]);const p=()=>{const S={[l]:!E};e.setFieldValue(l,!E),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:S}),l==="textSuperscript"?e.setFieldValue("textSubscript",!1):l==="textSubscript"&&e.setFieldValue("textSuperscript",!1),h(_=>!_)};return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:d?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:a||m(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":E&&!c}),onClick:p,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":E&&!c}),onClick:p,children:s})})};Ze.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string,imgParent:g.default.bool};var gn=["email","block"];function _n(e){const i=r.getMessageService(e).getTarget(),l=r.getCanvasService(e);gn.map(s=>l?.peek(s)?.element).find(s=>!!i&&s?.contentWindow===i)?.focus({preventScroll:!0})}var Wr=()=>{const{__:e}=r.useI18n();return[{symbol:"•",code:"•",description:e("Bullet")},{symbol:"+",code:"+",description:e("Plus")},{symbol:"»",code:"»",description:e("Double quotation")},{symbol:"×",code:"×",description:e("Cross")},{symbol:"–",code:"—",description:e("Dash")},{symbol:"›",code:"›",description:e("Single quotation")},{symbol:"→",code:"→",description:e("Arrow")},{symbol:"⇒",code:"⇒",description:e("Double arrow")},{symbol:"►",code:"▸",description:e("Pointer")},{symbol:"−",code:"−",description:e("Minus")},{symbol:"∗",code:"∗",description:e("Star")},{symbol:"♦",code:"♦",description:e("Diamond")}]},xn=(e,i="#c6c3c3",l={},s)=>{const{symbolSize:a="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:m={whiteSpace:"normal",lineHeight:"1.2"}}=l;return e.map(b=>({value:b.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:a,lineHeight:"0.7",width:a,textAlign:"center",...m},children:b.symbol}),(0,o.jsx)("span",{style:m,children:b.description})]})}))},_t=({form:e,fillFields:i,elementSettings:l,showAddParagraph:s=!0,isButton:a=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:m,isBulletFontColorChecked:b=!1,setIsBulletFontColorChecked:f=()=>{},showTopDivider:E=!0})=>{const{__:h}=r.useI18n(),p=U.useGoogleFontsLoader(),{token:S}=(0,t.ui_kit$useToken)(),_=r.useNotification(),B=r.useSendPostMessage(),T=r.useContainer(),I=r.useAppConfig(),P=(0,n.useRef)(),y=(0,n.useRef)(null),C=(0,n.useRef)(null),O=(0,n.useRef)(null),X=(0,n.useRef)(!1),H=l,[F,$]=(0,n.useState)(!!H.textReplacer?.length),[V,te]=(0,n.useState)(!!H.textAnchor?.length),[R,Z]=(0,n.useState)(null),[ge,le]=(0,n.useState)({start:0,end:0}),[pe,be]=(0,n.useState)(!1),[xe,Re]=(0,n.useState)([]),[oe,Ve]=(0,n.useState)(H.list?.bulletsColor),[Oe,ye]=(0,n.useState)(l);l!==Oe&&(ye(l),Ve(H.list?.bulletsColor),$(!!H.textReplacer?.length),te(!!H.textAnchor?.length));const[he,me]=(0,n.useState)(!1),[ie,Q]=(0,n.useState)(!1),se=(0,n.useRef)(null),ne=(0,n.useRef)(""),K=Wr(),z=(0,n.useMemo)(()=>K,[]),q={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,n.useEffect)(()=>{a&&l?.textColor!==void 0&&e.setFieldValue("textColor",l.textColor)},[a,l?.textColor,e]);let ue=null;(0,n.useEffect)(()=>{if(q?.textColor&&b){const w=e.getFieldValue("textColor");B({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{ColorBullets:w}})}},[q?.textColor]),(0,n.useEffect)(()=>{const w=e.getFieldValue("textLink");typeof l.linkHref=="string"&&me(!0),se&&!w&&(me(!1),e.setFieldsValue({linkHref:null})),se.current=w||null},[q?.textLink,q?.linkHref,l.linkHref,e]),(0,n.useEffect)(()=>{const w=e.getFieldValue("listUL"),ce=e.getFieldValue("listOL");w&&ne.current!=="listUL"?(e.setFieldValue("listOL",!1),ne.current="listUL"):ce&&ne.current!=="listOL"&&(e.setFieldValue("listUL",!1),ne.current="listOL"),!w&&!ce&&(ne.current="")},[q?.listUL,q?.listOL,e]);const _e=w=>{w.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&Z(null)};r.useListenPostMessage(_e);const[fe,Le]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Le(!0)},[]);const we=(0,n.useRef)(null);function Ne(w){const ce=w.key.toLowerCase();let ve=!1;return((ue==="control"||ue==="meta")&&(ce==="a"||ce==="A")||(ue==="a"||ue==="A")&&(ce==="control"||ce==="meta"))&&(ve=!0),ue=ce,ce!=="control"&&ce!=="a"&&ce!=="A"&&ce!=="meta"&&(ue=null),ve}const Y=w=>{B({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:w,locale:"ru_RU"}),_.success({title:h("It`s done!")})},re=[{key:"1",label:h("This element"),onClick:()=>Y("typograf")},{key:"2",label:h("The whole email"),onClick:()=>Y("typograf_all")}],[je,W]=(0,n.useState)(),[Se,Ie]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const w=xn(z,oe,{});Re(w)},[z,oe]),(0,n.useEffect)(()=>{const w=l.linkHref||l.href;w&&Ho(w,c);const ce=l.linkHref||l.href,ve=ce&&Bi(ce)?ce.slice(1):ce||"https://";(i??((Ye,qe)=>Ye.setFieldsValue(qe)))(e,{linkHref:ve})},[e,l,c,i]);const Pe=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Pe?.items?.length&&W(r.mapMargeTags(Pe.items))},[Pe,W]);const Me=w=>{e.setFieldValue("linkHref",w!=="mergetag"?w:""),c(w)},He=(w,ce)=>{if(Ie(!1),w){const ve=Pe.syntax.length>1?je.findIndex(qe=>qe.key===ce[0].key):0,Ye=Pe.syntax[ve].replace("%value%",w[w.length-1]);if(R?.getAttribute("id")==="selected_button_form_href"||R?.getAttribute("id")==="selected_text_form_linkHref"||R?.getAttribute("id")==="selected_text_form_textReplacer")Te(Ye,R?.getAttribute("id"));else{e.setFieldValue("textReplacer",Ye);const qe=Date.now();B({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${Ye}~~${qe}`}}),T&&setTimeout(()=>_n(T))}}},ze=(w,ce)=>ce.some(ve=>ve.label.toLowerCase().indexOf(w.toLowerCase())>-1),ae=(w,ce)=>{const ve=ce.map((Ye,qe)=>{const oo=Ye.label.split(new RegExp(`(${w})`,"gi"));return(0,o.jsxs)("span",{children:[qe!==0&&(0,o.jsx)("span",{children:" / "}),oo.map((to,no)=>to.toLowerCase()===w.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:to},no):to)]},Ye.value)});return(0,o.jsx)("div",{title:ce.map(Ye=>Ye.label).join(" / "),children:ve})};(0,n.useEffect)(()=>{Se&&we.current&&we.current.focus()},[Se]);const Be=r.useRootElement();(0,n.useEffect)(()=>{const w=({target:Ye})=>{Ye.closest('[id="merge_tags_wrapper"]')||Z(Ye)},ce=({target:Ye})=>{!Ye.closest(".merge-tags")&&!Ye.closest("#merge_tags_button")&&Ie(!1)},ve=new bo.Disposable;return ve.addDisposable(r.addWindowListenerFromShadow(Be,"focusin",w)),ve.addDisposable(r.addWindowListenerFromShadow(Be,"click",ce)),()=>{ve.dispose()}},[Be]);const v=(0,n.useCallback)(()=>{const w=window.getSelection();w&&w.toString().length>0&&(X.current=!0)},[]),ee=(0,n.useCallback)(({target:w})=>{if(w&&!pe){const{selectionStart:ce,selectionEnd:ve}=w;le(Ye=>Ye?.start===ce&&Ye?.end===ve?Ye:{start:ce,end:ve})}be(!1)},[pe]);(0,n.useEffect)(()=>ee({target:m?.target}),[m,ee]);const Te=(w,ce)=>{const ve=document.getElementById(ce);if(ve){const Ye=ve.value?.substring(0,ge.start),qe=ve.value?.substring(ge.end),oo=ce.substring(ce.lastIndexOf("_")+1);B({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[oo]:Ye+w+qe}}),e.setFieldValue(oo,Ye+w+qe),ve.focus(),setTimeout(()=>{ve.selectionStart=ge.start,ve.selectionEnd=ge.start+w.length},400),be(!0)}},Ce=()=>{$(!F),F?(e.setFieldValue("textReplacer",""),B({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:""}})):setTimeout(()=>y.current.focus())},De=w=>{w.target.value!==""&&C.current?.classList.add("selected-td-form__button--active")},We=(w="unknown")=>{te(!V),V?(e.setFieldValue("textAnchor",""),B({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textAnchor:""}})):setTimeout(()=>O.current?.focus())},Je=w=>{const ce=w.target,ve=ce.value,Ye=ce.selectionStart,qe=Ne(w);if(X.current&&Ye===0&&B({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${ve}~`}}),X.current=qe,Ye===0&&w.key===" "){w.preventDefault();return}if(w.key===" "){if(Ye!==ve.length){w.preventDefault();return}ve.endsWith(" ")&&w.preventDefault()}},M=w=>{Ve(w),b&&f(!1)},J=a?I.formButtonFieldInsertImageEnabled:I.formTextFieldTypografEnabled,j=I.formTextFieldTypografEnabled&&!a;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)(tt,{form:e,elementSettings:l,name:"textAlign"})})})}),J||j||I.mergeTagsShow&&je?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:E,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[J&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Col,{span:j?12:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:S.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>Y("add_img"),style:{width:"100%"},children:h("Add image")})})})}),j&&(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:S.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:re},trigger:["hover"],placement:"bottom",getPopupContainer:w=>w.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:()=>Y("typograf"),style:{width:"100%"},children:h("Typography")})})})})}),I.mergeTagsShow&&je&&(0,o.jsxs)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:S.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:Se?"none":"inline-flex"},onClick:()=>Ie(!0),children:h("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:we,classNames:{popup:{root:"merge-tags"}},options:je,placeholder:h("Start typing the title"),showSearch:{filter:ze,render:ae},spellCheck:"false",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),onChange:He,style:{display:Se?"block":"none",width:"100%"},open:Se,onKeyDown:w=>{w.key==="Escape"&&Ie(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:E||J||j,bodyStyle:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text font"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.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:p,getPopupContainer:w=>w.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:[a&&(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)(Ze,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(fe?"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:w=>w.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})})})})]}),!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(Ze,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(fe?"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)(Ze,{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:ee})}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(Ze,{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:ee})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(Ze,{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)(Ze,{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)(Ze,{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:ee})}),l?.list?.isList&&I.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:w=>w.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":F}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ce,ref:C})})}),(!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:w=>w.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":ie||V}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>Q(!ie)})})})]})]}),!a&&ie&&(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)(Ze,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:h("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),I.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:w=>w.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":F}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ce,ref:C})})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Anchor"),placement:"bottom",getPopupContainer:w=>w.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":V}),icon:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:w=>{w.preventDefault(),We("mouseDown")}})})})]}),s&&typeof l.linkHref=="string"&&he&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:d==="#",__:h,style:{marginBottom:S.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:"?S.formItemMarginBottomXS:""},children:(0,o.jsx)(t.ui_kit$Input,{ref:P,addonBefore:(0,o.jsx)(Qo,{linkProtocol:d,handleLinkProtocolsChange:Me,__:h}),allowClear:!0,placeholder:h(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:l?.isNewLink,onSelect:ee,prefix:(0,o.jsx)(Jo,{linkProtocol:d})})})}),d==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:S.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("Subject"),onSelect:ee})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:S.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:h("Body"),onSelect:ee})})]})]}),s&&V&&(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:O,onSelect:ee,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||te(!1)}})})}),!a&&F&&(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:De,onKeyDown:Je,onDoubleClick:v,ref:y,onSelect:ee})})})]})}),!a&&(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:w=>w.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:w=>w.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})})})})]})]}),!a&&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:w=>w.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:p,getPopupContainer:w=>w.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:w=>w.stopPropagation(),options:xe})})})})}),(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:w=>w.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:b,onChange:M,externalValue:b?q?.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)(Ze,{form:e,elementSettings:l,name:"BulletTextStrong",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"BulletTextItalic",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"BulletTextStrikethrough",tooltipTitle:h(fe?"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)(Ze,{form:e,elementSettings:l,name:"BulletTextUnderline",tooltipTitle:h(fe?"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"})})})})]})]})]})},yi=({form:e,elementSettings:i,showAddParagraph:l=!0,isButton:s=!1})=>{const{__:a}=r.useI18n(),d=U.useGoogleFontsLoader(),c=r.useSendPostMessage(),m=r.useDispatch(),b=r.useElementEntityKind(),f=r.useAppConfig(),[E,h]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&h(!0)},[]);const p=P=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:P,locale:"ru_RU"})},[S,_]=(0,n.useState)(i.textAlign),[B,T]=(0,n.useState)(i.linkHref),I=P=>_(P);return(0,n.useEffect)(()=>{_(i.textAlign),T(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:a("Text font"),placement:"bottom",zIndex:1,getPopupContainer:P=>P.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:P=>P.closest(".selected_text_common_form_mobile")})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("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:a("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:a("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:a("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)(Ze,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:a(E?"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)(Ze,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:a(E?"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)(Ze,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:a(E?"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)(Ze,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:a(E?"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:a("Text color"),placement:"bottom",zIndex:1,getPopupContainer:P=>P.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:a("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:a("Color"),usedColors:i.usedColors,getPopupContainer:P=>P.closest(".selected_text_common_form_mobile")})})}),!s&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text background"),placement:"bottom",zIndex:1,getPopupContainer:P=>P.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:a("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:a("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 B=="string"?(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("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:a("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:P=>P.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)("div",{children:(0,o.jsx)(Ze,{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)(Ze,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:a("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)(tt,{form:e,elementSettings:i,name:"textAlign",setAlignStateHandle:I}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:615,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:P=>P.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)(t.ui_kit$Button,{icon:S==="right"?(0,o.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:t.icons$AlignRightOutlined,size:18,strokeWidth:f.iconStrokeWidth}):S==="center"?(0,o.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:t.icons$AlignCenterOutlined,size:18,strokeWidth:f.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:t.icons$AlignLeftOutlined,size:18,strokeWidth:f.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:a("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:()=>p("add_p"),className:"selected-td-form__button"})}),(!s||f.formButtonFieldInsertImageEnabled)&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("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:f.iconStrokeWidth}),onClick:()=>p("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}),m(r.resetToLastActiveSettingsTab()),setTimeout(()=>{m(b==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},Mt=({elementSettings:e,imgParent:i=!1,name:l="mobileAlign"})=>{const{__:s}=r.useI18n(),a=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:a?.iconStrokeWidth,labels:{alignLeft:s("Text align left"),alignCenter:s("Text align center"),alignRight:s("Text align right"),alignJustify:s("Text align justify")}})})};Mt.propTypes={elementSettings:g.default.object.isRequired,imgParent:g.default.bool,name:g.default.string};var kn=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useDispatch(),s=r.useSendPostMessage(),[a]=t.ui_kit$Form.useForm(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),m=r.useSelector(r.selectIsCodeMode),b=r.useSelector(r.selectCodeModeDirection),f=m&&b!=="bottom",[E,h]=(0,n.useState)("https://"),[p,S]=(0,n.useState)(!1),_=Wr(),B=(0,n.useMemo)(()=>_,[]),T=r.useElementEntityKind(),{remember:I,fillFields:P}=st(e),y=(0,n.useCallback)(O=>{I(O),l(T==="email"?r.setElementSettings$1(O):r.setElementSettings(O))},[l,T,I]);(0,n.useEffect)(()=>{if(e){const{subject:O,body:X,baseEmail:H}=Nr(e.linkHref),F=e.linkHref,$=typeof F=="string"&&Bi(F),V=typeof F=="string"&&F.startsWith("mailto:")?H:$?F.slice(1):typeof F=="string"?F:"https://";h(Ft(F||"","https://")),P(a,{...e,lineHeight:u(e.lineHeight),linkHref:V,subject:O,body:X,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:Lr(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:p,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:B.find(te=>te.symbol===e?.list?.bulletType)?.code??B[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[a,e]);const C=O=>{const X=a.getFieldsValue(!0),H=Object.keys(O)[0];let F;switch(H){case"mobileFontSize":F={[H]:{classNamePrefix:"em-mob-font_size-",value:O[H],dim:X.mobileFontSizeDim}};break;case"mobileLineHeight":F={[H]:{classNamePrefix:"em-mob-line_height-",value:O[H],dim:X.mobileLineHeightDim}};break;case"mobileTextAlign":F={[H]:{classNamePrefix:"em-mob-text_align-",value:O[H]}};break;case"linkHref":let $=et(O[H]);if($!==O[H]&&a.setFieldValue("linkHref",$),E==="#"&&$&&!$.startsWith("#")&&($="#"+$),$.startsWith("mailto:")){const te=a.getFieldValue("subject"),R=a.getFieldValue("body");F={[H]:Si($,te,R)}}else F={[H]:$};Ho($,h);break;case"subject":case"body":const V=a.getFieldValue("linkHref")||"";if(V.substring(0,7)==="mailto:"){const te=V.split("?")[0],R=H==="subject"?O[H]:a.getFieldValue("subject"),Z=H==="body"?O[H]:a.getFieldValue("body"),ge=[];R&&ge.push(`subject=${encodeURIComponent(R)}`),Z&&ge.push(`body=${encodeURIComponent(Z)}`),F={linkHref:ge.length>0?`${te}?${ge.join("&")}`:te}}else return;break;default:F=O}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:F}),y({...e,list:{...e.list,bulletsColor:a.getFieldValue("ColorBullets"),bulletFontFamily:a.getFieldValue("BulletsFontFamily"),bulletFontSize:a.getFieldValue("BulletsSize"),betweenParagraphs:a.getFieldValue("SpacingBetweenParagraphs"),betweenRowCell:a.getFieldValue("SpacingBetweenBulletsAndText"),bulletType:B.find($=>$.code===a.getFieldValue("BulletType"))?.symbol??B[0].symbol},...F,activateSection:null,changeKey:H})};return(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:C,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:[!f&&(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"&&!f&&c.styles)&&(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:f?(0,o.jsx)(yi,{form:a,elementSettings:e}):(0,o.jsx)(_t,{form:a,fillFields:P,elementSettings:e,linkProtocol:E,setLinkProtocol:h,isBulletFontColorChecked:p,setIsBulletFontColorChecked:S})}),!f&&(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)(Mt,{form:a,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,o.jsx)(_t,{form:a,fillFields:P,elementSettings:e,linkProtocol:E,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)(Ur,{})}),(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"})})})]})]})]})},wi=(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")},zr={marginBottom:10},Gr={position:"relative",top:2};function En(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var it=({form:e,showRounding:i=!1,showBackground:l=!1})=>{const{__:s}=r.useI18n(),a=En(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:zr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-rounding",label:s("Rounded corners in Outlook (VML)"),size:"small",labelStyle:Gr})})},"outlookRounding"),l&&a&&(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:zr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-background",label:s("Background image in Outlook (VML)"),size:"small",labelStyle:Gr})})},"outlookBackground")]})};it.propTypes={form:g.default.object,showRounding:g.default.bool,showBackground:g.default.bool};var Yr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:b,backgroundSizeOptions:f,sizeShow:E,modificationShow:h,oneBorderRadiusValue:p,setOneBorderRadiusValue:S,toggleShowBorderHandler:_,toggleShowBorderRadiusHandler:B,toggleShowBoxShadowHandler:T,toggleShowSizeHandler:I,toggleShowBackgroundHandler:P,toggleShowModificationHandler:y})=>{const{__:C}=r.useI18n(),O=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Vo,{form:e,elementSettings:i,tooltipTitle:C("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:C("Size"),collapsible:!0,open:E,onToggle:I,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:Oo,minWidthDimensionSelect:Oo,maxWidthDimensionSelect:Oo,rowStyle:{marginBottom:4},labels:{width:C("Width"),height:C("Height"),minWidth:C("Minimum width"),maxWidth:C("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:C("Background"),collapsible:!0,open:c,onToggle:P,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:O.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:m,usedColors:i.usedColors,colorPlaceholder:C("Background color"),horizontalPositionPlaceholder:C("Horizontal position"),horizontalPositionTooltip:C("Horizontal position"),verticalPositionPlaceholder:C("Vertical position"),verticalPositionTooltip:C("Vertical position"),backgroundRepeatTooltip:C("Background image repeat"),backgroundSizeTooltip:C("Background image size"),selectPlaceholder:C("Please choose"),backgroundRepeatOptions:b,backgroundSizeOptions:f,imageUploadSlot:O.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Ao,{form:e,label:C("Background image"),name:"backgroundImage",tooltipTitle:C("Background image"),placeholder:C("Background image link/route")}):void 0}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),O.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Borders"),collapsible:!0,open:s,onToggle:_,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:i})}),O.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Border radius"),collapsible:!0,open:a,onToggle:B,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:S,elementSettings:i})}),O.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Box shadow"),collapsible:!0,open:d,onToggle:T,dividerTop:!0,children:(0,o.jsx)(jo,{})}),O.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Export settings"),collapsible:!0,open:h,onToggle:y,dividerTop:!0,children:(0,o.jsx)(wi,{form:e,elementSettings:i})}),O.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),O.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Yr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,sizeShow:g.default.bool,modificationShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func};var Xr=({form:e,elementSettings:i,label:l})=>{const{__:s}=r.useI18n();(0,n.useRef)();const[a,d]=(0,n.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,t.ui_kit$useToken)(),m=r.useSendPostMessage(),b=E=>{e.setFieldsValue({mobileBackgroundColor:""}),d(h=>!h),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:a?"":"none"}}})},f=E=>{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:f,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:a,onChange:b})]})})};Xr.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired};var Dt={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"}]},ji={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",Bn=/^(https?:)?\/\//i,Sn=/^(\d*\.?\d+)(%|px)$/;function Tn(e){return e in ji}function Kr(e){return Bn.test(e.trim())}function vi(e,i){const l=ji[e],s=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?s&&s!==at&&!Kr(s)?null:{[e]:[{classNamePrefix:l,value:s,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:l,value:s||at}}:{[e]:{classNamePrefix:l,value:s}}}function xt(e){const[i]=Object.keys(e??{});return!i||!Tn(i)?null:vi(i,e[i])}function Rn(){return Object.keys(ji).reduce((e,i)=>({...e,...vi(i,"")}),{})}function qr(e){const i=(e??"").trim(),l=i.match(Sn);return l?{position:l[1],unit:l[2]}:{position:i,unit:"px"}}function Jr(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Wo(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 kt(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 nt(e){const i=Wo(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 Et(e){const i=Wo(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 yn(e,i){return e===at?!1:!!e||!!i}function Bt(e,i,l){e.setFieldsValue({...nt({}),mobileBackgroundColor:""}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Wo(i).type,settings:Rn()})}var wn=/^\d*\.?\d+$/,jn={bottom:"auto"},Qr={marginBottom:0},vn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),In=(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),Cn=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,Zr=({value:e,onChange:i,inheritedValue:l,options:s,placeholder:a,prefix:d})=>{const c=e||l,[m,b]=(0,n.useState)(()=>qr(c));(0,n.useEffect)(()=>{b(p=>Jr(p.position,p.unit)===c?p:qr(c))},[c]);const f=(0,n.useCallback)((p,S)=>{b({position:p,unit:S});const _=s.some(B=>B.value===p);(p===""||_||wn.test(p))&&i?.(Jr(p,S))},[i,s]),E=(0,n.useCallback)(p=>f(p,m.unit),[f,m.unit]),h=(0,n.useCallback)(p=>f(m.position,p),[f,m.position]);return(0,o.jsx)(t.ui_kit$InputSelect,{options:s,position:m.position,setPosition:E,unit:m.unit,setUnit:h,placeholder:a,prefix:d,dropdownStyle:jn,tooltipTitle:a,getTooltipPopupContainer:Cn})},Pn=({desktopPositionX:e,desktopPositionY:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)(),a=s.formItemMarginBottomXS,d=(0,n.useMemo)(()=>({marginBottom:a}),[a]);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:Qr,children:(0,o.jsx)(Zr,{inheritedValue:e,options:Dt.horizontal,placeholder:l("Horizontal position"),prefix:vn})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:Qr,children:(0,o.jsx)(Zr,{inheritedValue:i,options:Dt.vertical,placeholder:l("Vertical position"),prefix:In})})})]})},el=["hover"],ol=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,tl=({value:e,emptyValue:i,inheritedValue:l,...s})=>{const a=!!e&&e!==i,d=s.options.some(c=>c.value===l)?l:i;return(0,o.jsx)(t.ui_kit$Select,{...s,value:a?e:d})},An=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:l,desktopSize:s,backgroundRepeatOptions:a,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:m}=(0,t.ui_kit$useToken)(),b=m.formItemMarginBottomXS,f=(0,n.useMemo)(()=>({marginBottom:b}),[b]),E=(0,n.useMemo)(()=>({marginBottom:(b??0)*1.5}),[b]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Pn,{desktopPositionX:e,desktopPositionY:i}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:E,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:el,title:c("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:f,children:(0,o.jsx)(tl,{emptyValue:"none",inheritedValue:l,options:a,placeholder:c("Please choose"),getPopupContainer:ol})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:el,title:c("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:f,children:(0,o.jsx)(tl,{emptyValue:"",inheritedValue:s,options:d,placeholder:c("Please choose"),getPopupContainer:ol})})})})]})]})},Nn=ci,Ln=({value:e,inheritedImage:i,...l})=>(0,o.jsx)(Nn,{...l,value:e||i}),On=e=>/^https?:\/\//i.test(e.trim()),$n=({form:e,name:i="mobileBackgroundImage",placeholder:l="",disabled:s=!1,elementSettings:a,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:m})=>{const{__:b}=r.useI18n(),{token:f}=(0,t.ui_kit$useToken)(),E=t.ui_kit$Form.useWatch(i,e),[h,p]=(0,n.useState)(""),S=E||d,_=f.formItemMarginBottomXS??0,B=(0,n.useMemo)(()=>({marginBottom:_/2}),[_]);(0,n.useEffect)(()=>{if(!S){p("");return}p(On(S)?"validating":"success")},[S]);const T=!!E&&!Kr(E),I=T?"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:I,help:T?b("Enter a URL starting with http:// or https://"):void 0,style:B,children:(0,o.jsx)(Ln,{inheritedImage:d,validateStatus:I,placeholder:l,name:i,disabled:s,elementSettings:a,imageInfo:a,onRemotePreviewValidate:p})}),(0,o.jsx)(t.ui_kit$Switch,{label:b("Without image"),labelSize:"small",size:"small",checked:c,onChange:m})]})},Fn={image:"",positionX:"",positionY:"",repeat:"",size:""},St=({elementSettings:e,imageEnabled:i=!1,desktopBackground:l=Fn})=>{const{__:s}=r.useI18n(),{token:a}=(0,t.ui_kit$useToken)(),d=t.ui_kit$Form.useFormInstance(),c=a.formItemMarginBottomMD,m=r.useSendPostMessage(),b=e.mobileBackgroundImage?.[0]?.value,[f,E]=(0,n.useState)(b==="none"),h=t.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,n.useEffect)(()=>{E(b==="none")},[b]),(0,n.useEffect)(()=>{h&&E(!1)},[h]);const p=(0,n.useCallback)(C=>{E(C),d.setFieldsValue({mobileBackgroundImage:""}),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:vi("mobileBackgroundImage",C?"none":"")})},[e.type,d,m]),S=(0,n.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]),_=(0,n.useMemo)(()=>[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],[s]),B=yn(f?"none":h,l.image),T=(0,n.useMemo)(()=>({marginBottom:B?c:0}),[c,B]),I=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:T,children:(0,o.jsx)(Xr,{form:d,elementSettings:e,label:s("Background color")})}),[s,e,d,T]),P=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:T,children:(0,o.jsx)($n,{form:d,placeholder:s("Background image"),elementSettings:e,inheritedImage:f?"":l.image,isImageNone:f,onImageNoneChange:p})}),[s,l.image,e,d,p,f,T]),y=(0,n.useMemo)(()=>(0,o.jsx)(An,{desktopPositionX:l.positionX,desktopPositionY:l.positionY,desktopRepeat:l.repeat,desktopSize:l.size,backgroundRepeatOptions:S,backgroundSizeOptions:_}),[S,_,l.positionX,l.positionY,l.repeat,l.size]);return(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:I,imageEnabled:i,backgroundImageEmpty:!B,imageUploadSlot:P,imageControlsSlot:y,usedColors:e.usedColors})},il=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:f,toggleShowMobileBorderHandler:E,toggleShowMobileBorderRadiusHandler:h,toggleShowMobileBoxShadowHandler:p,toggleShowMobileSizeHandler:S,toggleShowMobileBackgroundHandler:_})=>{const{__:B}=r.useI18n(),{token:T}=(0,t.ui_kit$useToken)(),I=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Vo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Size"),collapsible:!0,open:c,onToggle:S,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:B("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:T.formItemMarginBottomMD+4},children:(0,o.jsx)(Uo,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:m,onToggle:_,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:Wo(i),imageEnabled:I.formTableFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),I.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:s,onToggle:E,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),I.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:a,onToggle:h,dividerTop:!0,children:(0,o.jsx)(To,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:b,setOneBorderRadiusValue:f,elementSettings:i})}),I.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:d,onToggle:p,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),I.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),I.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};il.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func};var rl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=$o(),d=$o(),c=r.useDispatch(),m=r.useElementEntityKind(),[b,f]=(0,n.useState)({}),[E,h]=(0,n.useState)(!0),[p,S]=(0,n.useState)({}),[_,B]=(0,n.useState)(!0),T=r.useSelector(r.selectEmailViewType),I=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[P,y]=(0,n.useState)(e.backgroundImage[0].value===""),C=r.useSelector(r.selectIsCodeMode),O=r.useSelector(r.selectCodeModeDirection),X=C&&O!=="bottom",[H,F]=(0,n.useState)(!1),[$,V]=(0,n.useState)(!1),[te,R]=(0,n.useState)(!1),[Z,ge]=(0,n.useState)(!1),[le,pe]=(0,n.useState)(!1),[be,xe]=(0,n.useState)(!1),[Re,oe]=(0,n.useState)(!1),[Ve,Oe]=(0,n.useState)(!1),[ye,he]=(0,n.useState)(!1),[me,ie]=(0,n.useState)(!1),[Q,se]=(0,n.useState)(!1),ne=[{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"}],K=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],z=v=>v&&(v?.width||v?.style||v?.color)?v:"",q=e.border,ue=e.mobileBorder,_e=Object.keys(q).find(v=>q[v]?.width||q[v]?.style||q[v]?.color),fe=Object.keys(ue).find(v=>ue[v]?.width||ue[v]?.style||ue[v]?.color),{remember:Le,fillFields:we}=st(e);(0,n.useEffect)(()=>{if(e){const v=e.boxShadow,ee=e.mobileBoxShadow;f(v),S(ee),we(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:mo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:z(e.mobileBorder.all)||!(z(e.mobileBorder.top)||z(e.mobileBorder.bottom)||z(e.mobileBorder.right)||z(e.mobileBorder.left))&&z(e.border.all),mobileBorderTop:z(e.mobileBorder.top)||!z(e.mobileBorder.all)&&z(e.border.top),mobileBorderBottom:z(e.mobileBorder.bottom)||!z(e.mobileBorder.all)&&z(e.border.bottom),mobileBorderRight:z(e.mobileBorder.right)||!z(e.mobileBorder.all)&&z(e.border.right),mobileBorderLeft:z(e.mobileBorder.left)||!z(e.mobileBorder.all)&&z(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:""),...nt(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)?B(!1):B(!0),y(e.backgroundImage[0].value==="");const Te=a.isStaleBorderSnapshot(e,!!_e),Ce=d.isStaleBorderSnapshot(e,!!fe);Te&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ce||Te&&!fe)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),F(De=>_e&&!Te?!0:De),V(De=>_e&&!Te||fe&&!Ce?!0:De),R(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ge(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),pe(!!e.boxShadow),xe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),oe(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Oe(!!e.mobileWidth.value),he(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),ie(Et(e)),se(!!e.exportAsPicture)}},[s,e,_e,fe,a,d,we]);const Ne=(0,n.useCallback)(v=>{Le(v),c(m==="email"?r.setElementSettings$1(v):r.setElementSettings(v))},[c,m,Le]),Y=v=>{const ee=s.getFieldsValue(!0),Te=Object.keys(v)[0];let Ce;switch(Te){case"exportAsPicture":Ce={exportAsPicture:ee.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ce={boxShadow:{hOffset:ee.boxShadowHOffset,vOffset:ee.boxShadowVOffset,blurRadius:ee.boxShadowBlurRadius,spreadRadius:ee.boxShadowSpreadRadius,color:ee.boxShadowColor,inset:ee.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ee.borderPosition==="borderAll"?(Ce={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...ee.borderAll}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):ee.borderAll?.width||ee.borderAll?.style||ee.borderAll?.color?(Ce={border:{all:null,left:ee.borderAll,right:ee.borderAll,top:ee.borderAll,bottom:ee.borderAll,[U.REVERSE_BORDER_POSITIONS[Te]]:{...ee[Te],...v[Te]}}},s.setFieldsValue({borderAll:null,borderLeft:ee.borderAll,borderRight:ee.borderAll,borderTop:ee.borderAll,borderBottom:ee.borderAll,[Te]:{...ee[Te],...v[Te]}})):(Ce={border:{all:null,left:ee.borderLeft,right:ee.borderRight,top:ee.borderTop,bottom:ee.borderBottom,[U.REVERSE_BORDER_POSITIONS[Te]]:{...ee[Te],...v[Te]}}},s.setFieldsValue({border:Ce.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ee.mobileBorderPosition==="mobileBorderAll")Ce={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...ee.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[Te]+"-"}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const De=U.MOBILE_REVERSE_BORDER_POSITIONS[Te],We={...ee[Te],...v[Te]},Je=!We?.width&&!We?.style&&!We?.color;if(ee.mobileBorder?.all?.width||ee.mobileBorder?.all?.style||ee.mobileBorder?.all?.color){const M=ee.mobileBorderAll;Ce={mobileBorder:{all:null,left:M,right:M,top:M,bottom:M,[De]:Je?null:{...We,classNamePrefix:"em-mob-border_"+De+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:M,mobileBorderRight:M,mobileBorderTop:M,mobileBorderBottom:M,[Te]:We})}else{const M=e.mobileBorder||{},J=j=>{const w=M[j];return w&&(w?.width||w?.style||w?.color)?w:null};Ce={mobileBorder:{all:null,left:De==="left"?Je?null:{...We,classNamePrefix:"em-mob-border_left-"}:J("left"),right:De==="right"?Je?null:{...We,classNamePrefix:"em-mob-border_right-"}:J("right"),top:De==="top"?Je?null:{...We,classNamePrefix:"em-mob-border_top-"}:J("top"),bottom:De==="bottom"?Je?null:{...We,classNamePrefix:"em-mob-border_bottom-"}:J("bottom")}},s.setFieldsValue({[Te]:We})}}break;case"width":Ce={[Te]:{value:v[Te],dim:ee.widthDim}};break;case"widthDim":Ce={width:{value:ee.width,dim:v[Te]}};break;case"maxWidth":Ce={[Te]:{value:v[Te],dim:ee.maxWidthDim}};break;case"maxWidthDim":Ce={maxWidth:{value:ee.maxWidth,dim:v[Te]}};break;case"minWidth":Ce={[Te]:{value:v[Te],dim:ee.minWidthDim}};break;case"minWidthDim":Ce={minWidth:{value:ee.minWidth,dim:v[Te]}};break;case"backgroundImage":y(v[Te]===""),Ce={[Te]:[{...e.backgroundImage[0],value:v[Te]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ce={borderRadius:{[U.BORDER_RADIUS_POSITION[Te]]:+v[Te]}};break;case"mobileWidth":Ce={[Te]:{classNamePrefix:"em-mob-width-",value:v[Te],dim:ee.mobileWidthDim}};break;case"mobileWidthDim":Ce={mobileWidth:{classNamePrefix:"em-mob-width-",value:ee.mobileWidth||100,dim:v[Te]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ce={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[Te]]:v[Te],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[Te]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ce={mobileBoxShadow:{hOffset:ee.mobileBoxShadowHOffset,vOffset:ee.mobileBoxShadowVOffset,blurRadius:ee.mobileBoxShadowBlurRadius,spreadRadius:ee.mobileBoxShadowSpreadRadius,color:ee.mobileBoxShadowColor,inset:ee.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ce=xt(v),!Ce)return;break;case"mobileAlign":Ce={[Te]:{classNamePrefix:"em-mob-table_align-",value:v[Te]}};break;default:Ce=v}Te!=="borderPosition"&&Te!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ce}),Te!=="mobileBorderRadiusAll"&&Te!=="mobileBorderRadiusTopLeft"&&Te!=="mobileBorderRadiusTopRight"&&Te!=="mobileBorderRadiusBottomLeft"&&Te!=="mobileBorderRadiusBottomRight"&&Ne({...e,...Ce,mobileBorderRadius:{...e.mobileBorderRadius,...Ce?.mobileBorderRadius},activateSection:null,changeKey:Te}))},re=()=>{const v=s.getFieldsValue(!0);a.markBorderToggled(!H),setTimeout(()=>{F(ee=>!ee),H?(v.borderAll=U.NULL_BORDER,v.borderTop=U.NULL_BORDER,v.borderBottom=U.NULL_BORDER,v.borderRight=U.NULL_BORDER,v.borderLeft=U.NULL_BORDER):v.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:v.borderAll.color,style:v.borderAll.style,width:v.borderAll.width}}}})})},je=()=>{const v=s.getFieldsValue(!0);d.markBorderToggled(!$),setTimeout(()=>{V(ee=>!ee),$?(v.mobileBorderAll=U.NULL_BORDER,v.mobileBorderTop=U.NULL_BORDER,v.mobileBorderBottom=U.NULL_BORDER,v.mobileBorderRight=U.NULL_BORDER,v.mobileBorderLeft=U.NULL_BORDER):v.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:v.mobileBorderAll.color,style:v.mobileBorderAll.style,width:v.mobileBorderAll.width}}}})})},W=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{R(ee=>!ee),te?(v.borderRadiusAll=0,h(!0)):v.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:v.borderRadiusAll}}})})},Se=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{ge(ee=>!ee),Z?(v.mobileBorderRadiusAll=null,B(!0)):v.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:v.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Ie=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{pe(ee=>!ee),le?(v.boxShadowInset=!1,v.boxShadowHOffset=null,v.boxShadowVOffset=null,v.boxShadowBlurRadius=null,v.boxShadowSpreadRadius=null,v.boxShadowColor=""):(v.boxShadowInset=!1,v.boxShadowHOffset=5,v.boxShadowVOffset=5,v.boxShadowBlurRadius=10,v.boxShadowSpreadRadius=-5,v.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:v.boxShadowBlurRadius,color:v.boxShadowColor,hOffset:v.boxShadowHOffset,inset:v.boxShadowInset,spreadRadius:v.boxShadowSpreadRadius,vOffset:v.boxShadowVOffset}}})})},Pe=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{xe(ee=>!ee),be?(v.mobileBoxShadowInset=!1,v.mobileBoxShadowHOffset=null,v.mobileBoxShadowVOffset=null,v.mobileBoxShadowBlurRadius=null,v.mobileBoxShadowSpreadRadius=null,v.mobileBoxShadowColor=""):(v.mobileBoxShadowInset=!1,v.mobileBoxShadowHOffset=5,v.mobileBoxShadowVOffset=5,v.mobileBoxShadowBlurRadius=10,v.mobileBoxShadowSpreadRadius=-5,v.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:v.mobileBoxShadowBlurRadius,color:v.mobileBoxShadowColor,hOffset:v.mobileBoxShadowHOffset,inset:v.mobileBoxShadowInset,spreadRadius:v.mobileBoxShadowSpreadRadius,vOffset:v.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Me=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{oe(ee=>!ee),Re&&(v.width="",v.minWidth="",v.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"}}}))})},He=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{Oe(ee=>!ee),Ve&&(v.mobileWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},ze=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{he(ee=>!ee),ye?(v.backgroundColor="",v.backgroundImage="",v.backgroundPositionX="",v.backgroundPositionY="",v.backgroundRepeat="none",v.backgroundSize="",y(!0)):(v.backgroundColor="#E5E5E5",v.backgroundSize="",v.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:v.backgroundColor,backgroundImage:[{type:"url",value:v.backgroundImage}],backgroundPositionX:v.backgroundPositionX,backgroundPositionY:v.backgroundPositionY,backgroundRepeat:v.backgroundRepeat,backgroundSize:v.backgroundSize}})})},ae=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{ie(ee=>!ee),me?v.mobileBackgroundColor="":v.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:v.mobileBackgroundColor}}}),me&&Bt(s,e,l)})},Be=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{se(ee=>!ee),Q&&(v.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:U.BORDER_POSITIONS[_e]||"borderAll",mobileBorderPosition:U.MOBILE_BORDER_POSITIONS[fe]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:Y,autoComplete:"off",className:"element-controls",children:[!X&&(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"})}),T==="mobile"&&I.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(il,{form:s,elementSettings:e,mobileBoxShadow:p,mobileBordersShow:$,mobileBorderRadiusShow:Z,mobileBoxShadowShow:be,mobileSizeShow:Ve,mobileBackgroundShow:me,oneMobileBorderRadiusValue:_,setOneMobileBorderRadiusValue:B,toggleShowMobileBorderHandler:je,toggleShowMobileBorderRadiusHandler:Se,toggleShowMobileBoxShadowHandler:Pe,toggleShowMobileSizeHandler:He,toggleShowMobileBackgroundHandler:ae})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Yr,{form:s,elementSettings:e,boxShadow:b,bordersShow:H,borderRadiusShow:te,boxShadowShow:le,backgroundShow:ye,backgroundImageEmpty:P,backgroundRepeatOptions:ne,backgroundSizeOptions:K,sizeShow:Re,modificationShow:Q,oneBorderRadiusValue:E,setOneBorderRadiusValue:h,toggleShowBorderHandler:re,toggleShowBorderRadiusHandler:W,toggleShowBoxShadowHandler:Ie,toggleShowSizeHandler:Me,toggleShowBackgroundHandler:ze,toggleShowModificationHandler:Be})})]})};rl.propTypes={elementSettings:g.default.object.isRequired};var ll=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=r.useAppConfig(),d=r.useSelector(r.selectIsCodeMode),c=r.useSelector(r.selectCodeModeDirection),[m,b]=(0,n.useState)({}),[f,E]=(0,n.useState)("https://"),h=({target:_})=>{const{selectionStart:B,selectionEnd:T}=_;_&&b({target:_,selection:{start:B,end:T}})};(0,n.useEffect)(()=>{if(e){let _="",B="",T=e.href==null?"https://":e.href;if(T&&T.substring(0,7)==="mailto:"){const I=new URL(e.href);_=I.searchParams.get("subject")||"",B=I.searchParams.get("body")||"",T=e.href.split("?")[0],E("mailto:")}else e.href&&(e.href.substring(0,8)==="https://"||e.href.substring(0,7)==="http://"?E("https://"):e.href.substring(0,4)==="tel:"?E("tel:"):e.href.substring(0,4)==="sms:"?E("sms:"):e.href.substring(0,6)==="ftp://"?E("ftp://"):E(""));s.setFieldsValue({...e,href:T,subject:_,body:B})}},[s,e]);const p=_=>{const B=Object.keys(_)[0];let T=_;if(B==="href"){const I=et(_[B]);if(I!==_[B]&&s.setFieldValue("href",I),I.substring(0,7)==="mailto:"){const P=s.getFieldValue("subject"),y=s.getFieldValue("body"),C=[];P&&C.push(`subject=${encodeURIComponent(P)}`),y&&C.push(`body=${encodeURIComponent(y)}`),T={href:C.length>0?`${I}?${C.join("&")}`:I}}else T={href:I}}if(B==="subject"||B==="body"){const I=s.getFieldValue("href")||"";if(I.substring(0,7)==="mailto:"){const P=I.split("?")[0],y=B==="subject"?_[B]:s.getFieldValue("subject"),C=B==="body"?_[B]:s.getFieldValue("body"),O=[];y&&O.push(`subject=${encodeURIComponent(y)}`),C&&O.push(`body=${encodeURIComponent(C)}`),T={href:O.length>0?`${P}?${O.join("&")}`:P}}else return}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:T})},S=_=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:_})};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:p,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})})}),a.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:()=>S("add_img"),children:i("Add inline image")})})}),(0,o.jsx)(_t,{form:s,elementSettings:e,showAddParagraph:!1,linkTarget:m,linkProtocol:f,setLinkProtocol:E})]}):(0,o.jsx)(yi,{form:s,elementSettings:e,showAddParagraph:!1})})};ll.propTypes={elementSettings:g.default.object.isRequired};var sl=()=>{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"})})})})};sl.propTypes={};var al=({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)(ot,{form:e,name:"mobileHeight",elementSettings:i})})});al.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var nl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useDispatch(),a=r.useSendPostMessage(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),m=r.useSelector(r.selectIsCodeMode),b=r.useSelector(r.selectCodeModeDirection),f=m&&b!=="bottom",E=r.useElementEntityKind(),{remember:h,fillFields:p}=st(e);(0,n.useEffect)(()=>{e&&p(l,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:mo(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[l,e,p]);const S=(0,n.useCallback)(B=>{h(B),s(E==="email"?r.setElementSettings$1(B):r.setElementSettings(B))},[s,E,h]),_=B=>{const T=l.getFieldsValue(!0),I=Object.keys(B)[0];let P;switch(I){case"height":P={[I]:{value:B[I],dim:T.heightDim}};break;case"heightDim":P={height:{value:T.height,dim:B[I]}};break;case"mobileHeight":P={[I]:{classNamePrefix:"em-mob-height-",value:B[I],dim:T.mobileHeightDim}};break;case"mobileHeightDim":P={mobileHeight:{classNamePrefix:"em-mob-height-",value:T.mobileHeight,dim:B[I]}};break;default:P=B}a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:P}),S({...e,...P,activateSection:null,changeKey:I})};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:_,autoComplete:"off",children:[!f&&(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)(al,{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)(sl,{})})]})};nl.propTypes={elementSettings:g.default.object.isRequired};var Vt=({form:e,elementSettings:i,typeOfForm:l="desktop"})=>{const s=r.useSendPostMessage(),a=l==="mobile",d=a?"mobileDirection":"direction",c=b=>{e.setFieldsValue({[d]:b}),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[d]:b}})},m=a?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:m,onChange:c})})},Ht=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,Ii=({form:e,backgroundImageEmpty:i,appConfig:l,token:s,elementSettings:a,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:m}=r.useI18n(),[b,f]=(0,n.useState)(""),[E,h]=(0,n.useState)("px"),[p,S]=(0,n.useState)(""),[_,B]=(0,n.useState)("px"),T=[{label:m("Not defined"),value:""},{label:m("Contain"),value:"contain"},{label:m("Cover"),value:"cover"}],I=C=>{if(!C||typeof C!="string")return{value:"",unit:"px"};C=C.trim();const O=C.match(/^(\d*\.?\d+)(%|px)$/);return O?{value:O[1],unit:O[2]}:{value:C,unit:"px"}};(0,n.useEffect)(()=>{const C=e.getFieldValue("backgroundPositionX"),O=e.getFieldValue("backgroundPositionY"),X=I(C),H=I(O);f(String(X.value)),h(X.unit),S(String(H.value)),B(H.unit)},[e]);const P=(C,O)=>{f(String(C)),h(O),c&&c({backgroundPositionX:{position:C,unit:O}})},y=(C,O)=>{S(String(C)),B(O),c&&c({backgroundPositionY:{position:C,unit:O}})};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:m("Background color"),placement:"bottom",getPopupContainer:Ht,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:m("Background color"),usedColors:a.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:m("Background image"),placement:"bottom",getPopupContainer:Ht,children:(0,o.jsx)("div",{children:(0,o.jsx)(Ao,{form:e,label:m("Background image"),name:"backgroundImage",tooltipTitle:m("Background image"),placeholder:m("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:Dt.horizontal,position:b,setPosition:C=>P(C,E),unit:E,setUnit:C=>P(b,C),placeholder:m("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Horizontal position"),getTooltipPopupContainer:Ht})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Dt.vertical,position:p,setPosition:C=>y(C,_),unit:_,setUnit:C=>y(p,C),placeholder:m("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Vertical position"),getTooltipPopupContainer:Ht})})]}),(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:m("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:m("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:m("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:m("Please choose"),options:T,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},Mn=({form:e,elementSettings:i,__:l,appConfig:s})=>{const a=U.useGoogleFontsLoader(),[d,c]=(0,n.useState)(null);return(0,n.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:m=>m.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:a,getPopupContainer:m=>m.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)(Ze,{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)(Ze,{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)(Ze,{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)(Ze,{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:m=>m.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:m=>m.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})})})})]})]})},dl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:b,sizeShow:f,maxWidthValue:E,modificationShow:h,paddingsExt:p,oneBorderRadiusValue:S,setOneBorderRadiusValue:_,elementListShow:B,togglePaddingHandler:T,toggleShowBorderHandler:I,toggleShowBorderRadiusHandler:P,toggleShowBoxShadowHandler:y,toggleShowSizeHandler:C,toggleShowBackgroundHandler:O,toggleShowModificationHandler:X,handleChangeValues:H})=>{const{__:F}=r.useI18n(),{token:$}=(0,t.ui_kit$useToken)(),V=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)(tt,{form:e,elementSettings:i})}),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)(Fo,{form:e,elementSettings:i})})]}),V.formCellFieldPaddingsEnabled&&(0,o.jsxs)(o.Fragment,{children:[B&&(0,o.jsx)("div",{style:{marginTop:"15px"},children:(0,o.jsx)(Mn,{form:e,elementSettings:i,appConfig:V,__:F})}),(0,o.jsx)(t.ui_kit$FormSection,{title:F("Padding"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:p,onToggleExtended:T,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:F("Horizontal padding"),vertical:F("Vertical padding"),left:F("Left padding"),right:F("Right padding"),top:F("Top padding"),bottom:F("Bottom padding"),individual:F("Individual padding")}})})]}),i.type!=="group"&&V.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:F("Size"),collapsible:!0,open:f,onToggle:C,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:E,dimensionSelect:Oo,rowStyle:{paddingBottom:4},labels:{width:F("Width"),height:F("Height"),minWidth:F("Minimum width"),maxWidth:F("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:F("Background"),collapsible:!0,open:c,onToggle:O,dividerTop:!0,children:[(0,o.jsx)(Ii,{form:e,backgroundImageEmpty:m,appConfig:V,token:$,elementSettings:i,backgroundRepeatOptions:b,handleChangeValues:H}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),V.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:F("Borders"),collapsible:!0,open:s,onToggle:I,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:i})}),V.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:F("Border radius"),collapsible:!0,open:a,onToggle:P,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:S,setOneBorderRadiusValue:_,elementSettings:i})}),V.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:F("Box shadow"),collapsible:!0,open:d,onToggle:y,dividerTop:!0,children:(0,o.jsx)(jo,{})}),V.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,o.jsxs)(t.ui_kit$FormSection,{title:F("Settings"),collapsible:!0,open:h,onToggle:X,dividerTop:!0,children:[i.type==="structure"&&(0,o.jsx)(t.ui_kit$Tooltip,{title:F("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:F("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,o.jsx)(wi,{form:e,elementSettings:i})]}),V.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:F(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Vt,{elementSettings:i,form:e}):void 0})}),V.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:F("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};dl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,elementListShow:g.default.bool,togglePaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var Ut=({form:e,elementSettings:i,mobilePaddingsExt:l,setMobilePaddingsExt:s,rowStyle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=()=>{s(f=>!f);const b=e.getFieldsValue(!0);l||(b.mobilePaddingLeftRight=b.mobilePaddingLeft,b.mobilePaddingTopBottom=b.mobilePaddingTop,b.mobilePaddingRight=b.mobilePaddingLeft,b.mobilePaddingBottom=b.mobilePaddingTop,c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:b.mobilePaddingTop!==""?b.mobilePaddingTop:null,bottom:b.mobilePaddingTopBottom!==""?b.mobilePaddingTopBottom:null,left:b.mobilePaddingLeft!==""?b.mobilePaddingLeft:null,right:b.mobilePaddingRight!==""?b.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,o.jsx)(t.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:l,onToggleExtended:m,showHorizontal:!0,gutter:10,rowStyle:a,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")}})};Ut.propTypes={form:g.default.shape({getFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,mobilePaddingsExt:g.default.bool.isRequired,setMobilePaddingsExt:g.default.func.isRequired,rowStyle:g.default.object};var cl=({form:e,elementSettings:i,boxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:b,mobilePaddingsExt:f,setMobilePaddingsExt:E,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:_,toggleShowMobileBoxShadowHandler:B,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:I,toggleShowMobilePaddingHandler:P})=>{const{__:y}=r.useI18n(),C=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)(Vo,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),C.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)(Fo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),C.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Padding"),collapsible:!0,open:b,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:i,mobilePaddingsExt:f,setMobilePaddingsExt:E,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&C.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Size"),collapsible:!0,open:c,onToggle:T,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)(Uo,{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)(ot,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:y("Background"),collapsible:!0,open:m,onToggle:I,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:Wo(i),imageEnabled:C.formCellFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),C.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Borders"),collapsible:!0,open:s,onToggle:S,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),C.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Border radius"),collapsible:!0,open:a,onToggle:_,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementSettings:i,typeOfForm:"mobile"})}),C.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Box shadow"),collapsible:!0,open:d,onToggle:B,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),C.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:y(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Vt,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};cl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var ul=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=$o(),c=$o(),[m,b]=(0,n.useState)(""),[f,E]=(0,n.useState)({}),[h,p]=(0,n.useState)(!0),[S,_]=(0,n.useState)(!0),B=r.useSelector(r.selectEmailViewType),T=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[I,P]=(0,n.useState)(e.backgroundImage[0].value===""),y=r.useSelector(r.selectIsCodeMode),C=r.useSelector(r.selectCodeModeDirection),O=y&&C!=="bottom",[X,H]=(0,n.useState)(!1),[F,$]=(0,n.useState)(!1),[V,te]=(0,n.useState)(!1),[R,Z]=(0,n.useState)(!1),[ge,le]=(0,n.useState)(!1),[pe,be]=(0,n.useState)(!1),[xe,Re]=(0,n.useState)(!1),[oe,Ve]=(0,n.useState)(!1),[Oe,ye]=(0,n.useState)(!1),[he,me]=(0,n.useState)(!1),[ie,Q]=(0,n.useState)(!1),[se,ne]=(0,n.useState)(!1),[K,z]=(0,n.useState)(!1),[q,ue]=(0,n.useState)(!1),[_e,fe]=(0,n.useState)(!1),Le=r.useElementEntityKind(),we=[{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"}],Ne=e.border,Y=e.mobileBorder,re=Object.keys(Ne).find(j=>Ne[j]?.width||Ne[j]?.style||Ne[j]?.color),je=Object.keys(Y).find(j=>Y[j]?.width||Y[j]?.style||Y[j]?.color),W=j=>j&&(j?.width||j?.style||j?.color)?j:"",{remember:Se,fillFields:Ie}=st(e);(0,n.useEffect)(()=>{if(e){const j=e.boxShadow;E(j),Ie(a,{...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:mo(e.mobileWidth?.value)||mo(e.width?.value),mobileWidthDim:mo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:mo(e.mobileHeight?.value)||mo(e.height?.value),mobileHeightDim:mo(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||""),...nt(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))?p(!1):p(!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))?_(!1):_(!0),P(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)?H(!1):H(!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)?$(!1):$(!0);const w=d.isStaleBorderSnapshot(e,!!re),ce=c.isStaleBorderSnapshot(e,!!je);w&&a.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(ce||w&&!je)&&a.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),te(ve=>re&&!w?!0:ve),Z(ve=>re&&!w||je&&!ce?!0:ve),le(!!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||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Re(!!e.boxShadow),Ve(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ye(!!e.width.value&&e.type!=="column"||!!e.height.value),me(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),Q(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),ne(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Et(e)&&ne(!0),z(!!e.exportAsPicture||!!e.isContrastBlock),ue(!!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"?fe(!0):fe(!1)}},[a,e,re,je,d,c,Ie]);const Pe=(0,n.useCallback)(j=>{Se(j),s(Le==="email"?r.setElementSettings$1(j):r.setElementSettings(j))},[s,Le,Se]),Me=j=>{const w=a.getFieldsValue(!0),ce=Object.keys(j)[0];let ve;switch(b(a.getFieldsValue(!0).widthDim==="%"?100:""),ce){case"exportAsPicture":ve={exportAsPicture:w.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":ve={boxShadow:{hOffset:w.boxShadowHOffset,vOffset:w.boxShadowVOffset,blurRadius:w.boxShadowBlurRadius,spreadRadius:w.boxShadowSpreadRadius,color:w.boxShadowColor,inset:w.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":w.borderPosition==="borderAll"?(ve={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...w.borderAll}}},a.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):w.borderAll?.width||w.borderAll?.style||w.borderAll?.color?(ve={border:{all:null,left:w.borderAll,right:w.borderAll,top:w.borderAll,bottom:w.borderAll,[U.REVERSE_BORDER_POSITIONS[ce]]:{...w[ce],...j[ce]}}},a.setFieldsValue({borderAll:null,borderLeft:w.borderAll,borderRight:w.borderAll,borderTop:w.borderAll,borderBottom:w.borderAll,[ce]:{...w[ce],...j[ce]}})):(ve={border:{all:null,left:w.borderLeft,right:w.borderRight,top:w.borderTop,bottom:w.borderBottom,[U.REVERSE_BORDER_POSITIONS[ce]]:{...w[ce],...j[ce]}}},a.setFieldsValue({border:ve.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(w.mobileBorderPosition==="mobileBorderAll")ve={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...w.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[ce]+"-"}}},a.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const Ye=U.MOBILE_REVERSE_BORDER_POSITIONS[ce],qe={...w[ce],...j[ce]},oo=!qe?.width&&!qe?.style&&!qe?.color;if(w.mobileBorder?.all?.width||w.mobileBorder?.all?.style||w.mobileBorder?.all?.color){const to=w.mobileBorderAll;ve={mobileBorder:{all:null,left:to,right:to,top:to,bottom:to,[Ye]:oo?null:{...qe,classNamePrefix:"em-mob-border_"+Ye+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:to,mobileBorderRight:to,mobileBorderTop:to,mobileBorderBottom:to,[ce]:qe})}else{const to=e.mobileBorder||{},no=fo=>{const xo=to[fo];return xo&&(xo?.width||xo?.style||xo?.color)?xo:null};ve={mobileBorder:{all:null,left:Ye==="left"?oo?null:{...qe,classNamePrefix:"em-mob-border_left-"}:no("left"),right:Ye==="right"?oo?null:{...qe,classNamePrefix:"em-mob-border_right-"}:no("right"),top:Ye==="top"?oo?null:{...qe,classNamePrefix:"em-mob-border_top-"}:no("top"),bottom:Ye==="bottom"?oo?null:{...qe,classNamePrefix:"em-mob-border_bottom-"}:no("bottom")}},a.setFieldsValue({[ce]:qe})}}break;case"width":ve={[ce]:{value:j[ce],dim:w.widthDim}};break;case"height":ve={[ce]:{value:j[ce],dim:w.heightDim}};break;case"widthDim":ve={width:{value:w.width,dim:j[ce]}};break;case"heightDim":ve={height:{value:w.height,dim:j[ce]}};break;case"backgroundImage":P(j[ce]===""),ve={[ce]:[{...e.backgroundImage[0],value:j[ce]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":ve={padding:{left:w.paddingLeft,right:w.paddingRight,top:w.paddingTop,bottom:w.paddingBottom,[U.PADDING_POSITION[ce]]:+j[ce]}};break;case"paddingTopBottom":ve={padding:{left:w.paddingLeft,right:w.paddingRight,top:+j[ce],bottom:+j[ce]}},w.paddingTop=w.paddingBottom=+j[ce];break;case"paddingLeftRight":ve={padding:{top:w.paddingTop,bottom:w.paddingBottom,left:+j[ce],right:+j[ce]}},w.paddingLeft=w.paddingRight=+j[ce];break;case"borderRadiusAll":ve={borderRadius:{[U.BORDER_RADIUS_POSITION[ce]]:+j[ce]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":ve={borderRadius:{topLeft:w.borderRadiusTopLeft,bottomLeft:w.borderRadiusBottomLeft,topRight:w.borderRadiusTopRight,bottomRight:w.borderRadiusBottomRight,[U.BORDER_RADIUS_POSITION[ce]]:+j[ce]}};break;case"mobileWidth":ve={[ce]:{classNamePrefix:"em-mob-width-",value:j[ce],dim:w.mobileWidthDim}};break;case"mobileWidthDim":ve={mobileWidth:{classNamePrefix:"em-mob-width-",value:w.mobileWidth||100,dim:j[ce]}};break;case"mobileHeight":ve={[ce]:{classNamePrefix:"em-mob-height-",value:j[ce],dim:w.mobileHeightDim}};break;case"mobileHeightDim":ve={mobileHeight:{classNamePrefix:"em-mob-height-",value:w.mobileHeight,dim:j[ce]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":ve={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[ce]]:j[ce],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[ce]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":ve={mobileBoxShadow:{hOffset:w.mobileBoxShadowHOffset,vOffset:w.mobileBoxShadowVOffset,blurRadius:w.mobileBoxShadowBlurRadius,spreadRadius:w.mobileBoxShadowSpreadRadius,color:w.mobileBoxShadowColor,inset:w.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":ve={[ce]:{classNamePrefix:"em-mob-text_align-",value:j[ce]}};break;case"mobileVerticalAlign":ve={[ce]:{classNamePrefix:"em-mob-vertical_align-",value:j[ce]}};break;case"mobileDirection":ve={[ce]:{classNamePrefix:"em-mob-direction-",value:j[ce]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(ve=xt(j),!ve)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":ve={mobilePadding:{all:null,top:w.mobilePaddingTop!==""?w.mobilePaddingTop:null,right:w.mobilePaddingRight!==""?w.mobilePaddingRight:null,bottom:w.mobilePaddingBottom!==""?w.mobilePaddingBottom:null,left:w.mobilePaddingLeft!==""?w.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":w.mobilePaddingTop=w.mobilePaddingBottom=j[ce],ve={mobilePadding:{all:null,top:w.mobilePaddingTop!==""?w.mobilePaddingTop:null,right:w.mobilePaddingRight!==""?w.mobilePaddingRight:null,bottom:w.mobilePaddingBottom!==""?w.mobilePaddingBottom:null,left:w.mobilePaddingLeft!==""?w.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":w.mobilePaddingLeft=w.mobilePaddingRight=j[ce],ve={mobilePadding:{all:null,top:w.mobilePaddingTop!==""?w.mobilePaddingTop:null,right:w.mobilePaddingRight!==""?w.mobilePaddingRight:null,bottom:w.mobilePaddingBottom!==""?w.mobilePaddingBottom:null,left:w.mobilePaddingLeft!==""?w.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":ve={[ce]:isNaN(parseFloat(j[ce].position))?j[ce].position:j[ce].position+j[ce].unit};break;default:ve=j}ce!=="borderPosition"&&ce!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ve}),ce!=="mobileBorderRadiusAll"&&ce!=="mobileBorderRadiusTopLeft"&&ce!=="mobileBorderRadiusTopRight"&&ce!=="mobileBorderRadiusBottomLeft"&&ce!=="mobileBorderRadiusBottomRight"&&Pe({...e,...ve,mobileBorderRadius:{...e.mobileBorderRadius,...ve?.mobileBorderRadius},activateSection:null,changeKey:ce}))},He=()=>{H(w=>!w);const j=a.getFieldsValue(!0);X||(j.paddingLeftRight=j.paddingLeft,j.paddingTopBottom=j.paddingTop,j.paddingRight=j.paddingLeft,j.paddingBottom=j.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:j.paddingTopBottom,bottom:j.paddingTopBottom,left:j.paddingLeftRight,right:j.paddingLeftRight}}}))},ze=()=>{const j=a.getFieldsValue(!0);d.markBorderToggled(!V),setTimeout(()=>{te(w=>!w),V?(j.borderAll=U.NULL_BORDER,j.borderTop=U.NULL_BORDER,j.borderBottom=U.NULL_BORDER,j.borderRight=U.NULL_BORDER,j.borderLeft=U.NULL_BORDER):j.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:j.borderAll.color,style:j.borderAll.style,width:j.borderAll.width}}}})})},ae=()=>{const j=a.getFieldsValue(!0);c.markBorderToggled(!R),setTimeout(()=>{Z(w=>!w),R?(j.mobileBorderAll=U.NULL_BORDER,j.mobileBorderTop=U.NULL_BORDER,j.mobileBorderBottom=U.NULL_BORDER,j.mobileBorderRight=U.NULL_BORDER,j.mobileBorderLeft=U.NULL_BORDER):j.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:j.mobileBorderAll.color,style:j.mobileBorderAll.style,width:j.mobileBorderAll.width}}}})})},Be=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{le(w=>!w),ge?(j.borderRadiusAll=0,p(!0)):j.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:j.borderRadiusAll}}})})},v=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{be(w=>!w),pe?(j.mobileBorderRadiusAll=null,_(!0)):j.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:j.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ee=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{Re(w=>!w),xe?(j.boxShadowInset=!1,j.boxShadowHOffset=null,j.boxShadowVOffset=null,j.boxShadowBlurRadius=null,j.boxShadowSpreadRadius=null,j.boxShadowColor=""):(j.boxShadowInset=!1,j.boxShadowHOffset=5,j.boxShadowVOffset=5,j.boxShadowBlurRadius=10,j.boxShadowSpreadRadius=-5,j.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:j.boxShadowBlurRadius,color:j.boxShadowColor,hOffset:j.boxShadowHOffset,inset:j.boxShadowInset,spreadRadius:j.boxShadowSpreadRadius,vOffset:j.boxShadowVOffset}}})})},Te=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{Ve(w=>!w),oe?(j.mobileBoxShadowInset=!1,j.mobileBoxShadowHOffset=null,j.mobileBoxShadowVOffset=null,j.mobileBoxShadowBlurRadius=null,j.mobileBoxShadowSpreadRadius=null,j.mobileBoxShadowColor=""):(j.mobileBoxShadowInset=!1,j.mobileBoxShadowHOffset=5,j.mobileBoxShadowVOffset=5,j.mobileBoxShadowBlurRadius=10,j.mobileBoxShadowSpreadRadius=-5,j.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:j.mobileBoxShadowBlurRadius,color:j.mobileBoxShadowColor,hOffset:j.mobileBoxShadowHOffset,inset:j.mobileBoxShadowInset,spreadRadius:j.mobileBoxShadowSpreadRadius,vOffset:j.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Ce=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ye(w=>!w),Oe&&(j.width="",j.height="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},De=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{me(w=>!w),he&&(j.mobileWidth="",j.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-"}}}))})},We=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{Q(w=>!w),ie?(j.backgroundColor="",j.backgroundImage="",j.backgroundPositionX="",j.backgroundPositionY="",j.backgroundRepeat="none",j.backgroundSize="",P(!0)):(j.backgroundColor="#E5E5E5",j.backgroundSize="",j.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:j.backgroundColor,backgroundImage:[{type:"url",value:j.backgroundImage}],backgroundPositionX:j.backgroundPositionX,backgroundPositionY:j.backgroundPositionY,backgroundRepeat:j.backgroundRepeat,backgroundSize:j.backgroundSize}})})},Je=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ne(w=>!w),se?j.mobileBackgroundColor="":j.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:j.mobileBackgroundColor}}}),se&&Bt(a,e,l)})},M=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{z(w=>!w),K&&(j.exportAsPicture=!1,j.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},J=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ue(w=>!w),q&&(j.mobilePaddingLeftRight="",j.mobilePaddingLeft="",j.mobilePaddingRight="",j.mobilePaddingTopBottom="",j.mobilePaddingTop="",j.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:a,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:U.BORDER_POSITIONS[re]||"borderAll",mobileBorderPosition:U.MOBILE_BORDER_POSITIONS[je]||"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:Me,autoComplete:"off",className:"element-controls",children:B==="mobile"&&T.styles?(0,o.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:B==="mobile"&&T.styles?"flex":"none"},children:[(0,o.jsx)("div",{className:"selected_form-mobile-props-header",children:!O&&(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)(cl,{form:a,elementSettings:e,boxShadow:f,mobileBordersShow:R,mobileBorderRadiusShow:pe,mobileBoxShadowShow:oe,mobileSizeShow:he,mobileBackgroundShow:se,mobilePaddingShow:q,mobilePaddingsExt:F,setMobilePaddingsExt:$,oneMobileBorderRadiusValue:S,setOneMobileBorderRadiusValue:_,toggleShowMobileBorderHandler:ae,toggleShowMobileBorderRadiusHandler:v,toggleShowMobileBoxShadowHandler:Te,toggleShowMobileSizeHandler:De,toggleShowMobileBackgroundHandler:Je,toggleShowMobilePaddingHandler:J})})]}):(0,o.jsxs)(o.Fragment,{children:[!O&&(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)(dl,{form:a,elementSettings:e,boxShadow:f,bordersShow:V,borderRadiusShow:ge,boxShadowShow:xe,backgroundShow:ie,backgroundImageEmpty:I,backgroundRepeatOptions:we,sizeShow:Oe,maxWidthValue:m,modificationShow:K,paddingsExt:X,oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementListShow:_e,togglePaddingHandler:He,toggleShowBorderHandler:ze,toggleShowBorderRadiusHandler:Be,toggleShowBoxShadowHandler:ee,toggleShowSizeHandler:Ce,toggleShowBackgroundHandler:We,toggleShowModificationHandler:M,handleChangeValues:Me})})]})})};ul.propTypes={elementSettings:g.default.object.isRequired};var ml=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:b,sizeShow:f,maxWidthValue:E,modificationShow:h,paddingShow:p,paddingsExt:S,oneBorderRadiusValue:_,setOneBorderRadiusValue:B,togglePaddingHandler:T,toggleShowPaddingHandler:I,toggleShowBorderHandler:P,toggleShowBorderRadiusHandler:y,toggleShowBoxShadowHandler:C,toggleShowSizeHandler:O,toggleShowBackgroundHandler:X,toggleShowModificationHandler:H,handleChangeValues:F})=>{const{__:$}=r.useI18n(),{token:V}=(0,t.ui_kit$useToken)(),te=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:$("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)(tt,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Fo,{form:e,elementSettings:i})})]}),te.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Padding"),collapsible:!0,open:p,onToggle:I,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:S,onToggleExtended:T,labels:{horizontal:$("Horizontal padding"),vertical:$("Vertical padding"),left:$("Left padding"),right:$("Right padding"),top:$("Top padding"),bottom:$("Bottom padding"),individual:$("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:$("Size"),collapsible:!0,open:f,onToggle:O,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:E,dimensionSelect:Oo,showMinMax:!0,minWidthDimensionSelect:Oo,maxWidthDimensionSelect:Oo,labels:{width:$("Width"),height:$("Height"),minWidth:$("Minimum width"),maxWidth:$("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:$("Background"),collapsible:!0,open:c,onToggle:X,dividerTop:!0,children:[(0,o.jsx)(Ii,{form:e,backgroundImageEmpty:m,appConfig:te,token:V,elementSettings:i,backgroundRepeatOptions:b,handleChangeValues:F}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),te.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Borders"),collapsible:!0,open:s,onToggle:P,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:i})}),te.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Border radius"),collapsible:!0,open:a,onToggle:y,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:_,setOneBorderRadiusValue:B,elementSettings:i})}),te.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Box shadow"),collapsible:!0,open:d,onToggle:C,dividerTop:!0,children:(0,o.jsx)(jo,{})}),te.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Export settings"),collapsible:!0,open:h,onToggle:H,dividerTop:!0,children:(0,o.jsx)(wi,{form:e,elementSettings:i})}),te.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Vt,{elementSettings:i,form:e})})}),te.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};ml.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var pl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:b,mobilePaddingsExt:f,setMobilePaddingsExt:E,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:_,toggleShowMobileBoxShadowHandler:B,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:I,toggleShowMobilePaddingHandler:P})=>{const{__:y}=r.useI18n(),{token:C}=(0,t.ui_kit$useToken)(),O=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)(Mt,{form:e,elementSettings:i,imgParent:!0})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Fo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),O.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Padding"),collapsible:!0,open:b,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:i,mobilePaddingsExt:f,setMobilePaddingsExt:E})}),(0,o.jsx)(t.ui_kit$FormSection,{title:y("Size"),collapsible:!0,open:c,onToggle:T,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:C.formItemMarginBottomXS*2},children:(0,o.jsx)(Uo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS},children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:y("Background"),collapsible:!0,open:m,onToggle:I,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:Wo(i),imageEnabled:O.formDivFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),O.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Borders"),collapsible:!0,open:s,onToggle:S,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),O.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Border radius"),collapsible:!0,open:a,onToggle:_,dividerTop:!0,children:(0,o.jsx)(To,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementSettings:i})}),O.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Box shadow"),collapsible:!0,open:d,onToggle:B,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),O.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Vt,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),O.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};pl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var hl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=$o(),d=$o(),[c,m]=(0,n.useState)({}),[b,f]=(0,n.useState)(!0),[E,h]=(0,n.useState)({}),[p,S]=(0,n.useState)(!0),_=r.useSelector(r.selectEmailViewType),B=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[T,I]=(0,n.useState)(e.backgroundImage[0].value===""),P=r.useSelector(r.selectIsCodeMode),y=r.useSelector(r.selectCodeModeDirection),C=P&&y!=="bottom",[O,X]=(0,n.useState)(!1),[H,F]=(0,n.useState)(!1),[$,V]=(0,n.useState)(!1),[te,R]=(0,n.useState)(!1),[Z,ge]=(0,n.useState)(!1),[le,pe]=(0,n.useState)(!1),[be,xe]=(0,n.useState)(!1),[Re,oe]=(0,n.useState)(!1),[Ve,Oe]=(0,n.useState)(!1),[ye,he]=(0,n.useState)(!1),[me,ie]=(0,n.useState)(!1),[Q,se]=(0,n.useState)(!1),[ne,K]=(0,n.useState)(!1),[z,q]=(0,n.useState)(!1),[ue,_e]=(0,n.useState)(!1),[fe,Le]=(0,n.useState)(""),we=[{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 Ne=e.border,Y=e.mobileBorder,re=Object.keys(Ne).find(M=>Ne[M]?.width||Ne[M]?.style||Ne[M]?.color),je=Object.keys(Y).find(M=>Y[M]?.width||Y[M]?.style||Y[M]?.color),W=M=>M&&(M?.width||M?.style||M?.color)?M:"";(0,n.useEffect)(()=>{if(e){const M=e.boxShadow,J=e.mobileBoxShadow;m(M),h(J),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:mo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:mo(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:""),...nt(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))?f(!1):f(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?S(!1):S(!0),I(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)?X(!1):X(!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)?F(!1):F(!0);const j=a.isStaleBorderSnapshot(e,!!re),w=d.isStaleBorderSnapshot(e,!!je);j&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(w||j&&!je)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),V(ce=>re&&!j?!0:ce),R(ce=>re&&!j||je&&!w?!0:ce),ge(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),pe(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),xe(!!e.boxShadow),oe(!!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),he(!!e.mobileWidth.value||!!e.mobileHeight.value),ie(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),se(Et(e)),K(!!e.exportAsPicture),q(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),_e(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[s,e,re,je,a,d]);const Se=M=>{const J=s.getFieldsValue(!0),j=Object.keys(M)[0];let w;switch(Le(s.getFieldsValue(!0).widthDim==="%"?100:""),j){case"exportAsPicture":w={exportAsPicture:J.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":w={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"?(w={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...J.borderAll}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):J.borderAll?.width||J.borderAll?.style||J.borderAll?.color?(w={border:{all:null,left:J.borderAll,right:J.borderAll,top:J.borderAll,bottom:J.borderAll,[U.REVERSE_BORDER_POSITIONS[j]]:{...J[j],...M[j]}}},s.setFieldsValue({borderAll:null,borderLeft:J.borderAll,borderRight:J.borderAll,borderTop:J.borderAll,borderBottom:J.borderAll,[j]:{...J[j],...M[j]}})):(w={border:{all:null,left:J.borderLeft,right:J.borderRight,top:J.borderTop,bottom:J.borderBottom,[U.REVERSE_BORDER_POSITIONS[j]]:{...J[j],...M[j]}}},s.setFieldsValue({border:w.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(J.mobileBorderPosition==="mobileBorderAll")w={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...J.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[j]+"-"}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const ce=U.MOBILE_REVERSE_BORDER_POSITIONS[j],ve={...J[j],...M[j]},Ye=!ve?.width&&!ve?.style&&!ve?.color;if(J.mobileBorder?.all?.width||J.mobileBorder?.all?.style||J.mobileBorder?.all?.color){const qe=J.mobileBorderAll;w={mobileBorder:{all:null,left:qe,right:qe,top:qe,bottom:qe,[ce]:Ye?null:{...ve,classNamePrefix:"em-mob-border_"+ce+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:qe,mobileBorderRight:qe,mobileBorderTop:qe,mobileBorderBottom:qe,[j]:ve})}else{const qe=e.mobileBorder||{},oo=to=>{const no=qe[to];return no&&(no?.width||no?.style||no?.color)?no:null};w={mobileBorder:{all:null,left:ce==="left"?Ye?null:{...ve,classNamePrefix:"em-mob-border_left-"}:oo("left"),right:ce==="right"?Ye?null:{...ve,classNamePrefix:"em-mob-border_right-"}:oo("right"),top:ce==="top"?Ye?null:{...ve,classNamePrefix:"em-mob-border_top-"}:oo("top"),bottom:ce==="bottom"?Ye?null:{...ve,classNamePrefix:"em-mob-border_bottom-"}:oo("bottom")}},s.setFieldsValue({[j]:ve})}}break;case"width":w={[j]:{value:M[j],dim:J.widthDim}};break;case"height":w={[j]:{value:M[j],dim:J.heightDim}};break;case"widthDim":w={width:{value:J.width,dim:M[j]}};break;case"heightDim":w={height:{value:J.height,dim:M[j]}};break;case"maxWidth":w={[j]:{value:M[j],dim:J.maxWidthDim}};break;case"maxWidthDim":w={maxWidth:{value:J.maxWidth,dim:M[j]}};break;case"minWidth":w={[j]:{value:M[j],dim:J.minWidthDim}};break;case"minWidthDim":w={minWidth:{value:J.minWidth,dim:M[j]}};break;case"backgroundImage":I(M[j]===""),w={[j]:[{...e.backgroundImage[0],value:M[j]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":w={padding:{[U.PADDING_POSITION[j]]:+M[j]}};break;case"paddingTopBottom":w={padding:{top:+M[j],bottom:+M[j]}},J.paddingTop=J.paddingBottom=+M[j];break;case"paddingLeftRight":w={padding:{left:+M[j],right:+M[j]}},J.paddingLeft=J.paddingRight=+M[j];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":w={borderRadius:{[U.BORDER_RADIUS_POSITION[j]]:+M[j]}};break;case"mobileWidth":w={[j]:{classNamePrefix:"em-mob-width-",value:M[j],dim:J.mobileWidthDim}};break;case"mobileWidthDim":w={mobileWidth:{classNamePrefix:"em-mob-width-",value:J.mobileWidth||100,dim:M[j]}};break;case"mobileHeight":w={[j]:{classNamePrefix:"em-mob-height-",value:M[j],dim:J.mobileHeightDim}};break;case"mobileHeightDim":w={mobileHeight:{classNamePrefix:"em-mob-height-",value:J.mobileHeight,dim:M[j]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":w={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[j]]:M[j],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[j]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":w={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":w={[j]:{classNamePrefix:"em-mob-text_align-",value:M[j]}};break;case"mobileVerticalAlign":w={[j]:{classNamePrefix:"em-mob-vertical_align-",value:M[j]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(w=xt(M),!w)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":w={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=M[j],w={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=M[j],w={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"mobileDirection":w={[j]:{classNamePrefix:"em-mob-direction-",value:M[j]}};break;case"backgroundPositionX":case"backgroundPositionY":w={[j]:isNaN(parseFloat(M[j].position))?M[j].position:M[j].position+M[j].unit};break;default:w=M}j!=="borderPosition"&&j!=="mobileBorderPosition"&&l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:w})},Ie=()=>{X(J=>!J);const M=s.getFieldsValue(!0);O||(M.paddingLeftRight=M.paddingLeft,M.paddingTopBottom=M.paddingTop,M.paddingRight=M.paddingLeft,M.paddingBottom=M.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:M.paddingTopBottom,bottom:M.paddingTopBottom,left:M.paddingLeftRight,right:M.paddingLeftRight}}}))},Pe=()=>{const M=s.getFieldsValue(!0);a.markBorderToggled(!$),setTimeout(()=>{V(J=>!J),$?(M.borderAll=U.NULL_BORDER,M.borderTop=U.NULL_BORDER,M.borderBottom=U.NULL_BORDER,M.borderRight=U.NULL_BORDER,M.borderLeft=U.NULL_BORDER):M.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:M.borderAll.color,style:M.borderAll.style,width:M.borderAll.width}}}})})},Me=()=>{const M=s.getFieldsValue(!0);d.markBorderToggled(!te),setTimeout(()=>{R(J=>!J),te?(M.mobileBorderAll=U.NULL_BORDER,M.mobileBorderTop=U.NULL_BORDER,M.mobileBorderBottom=U.NULL_BORDER,M.mobileBorderRight=U.NULL_BORDER,M.mobileBorderLeft=U.NULL_BORDER):M.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:M.mobileBorderAll.color,style:M.mobileBorderAll.style,width:M.mobileBorderAll.width}}}})})},He=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{ge(J=>!J),Z?(M.borderRadiusAll=0,f(!0)):M.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:M.borderRadiusAll}}})})},ze=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{pe(J=>!J),le?(M.mobileBorderRadiusAll=null,S(!0)):M.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:M.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ae=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{xe(J=>!J),be?(M.boxShadowInset=!1,M.boxShadowHOffset=null,M.boxShadowVOffset=null,M.boxShadowBlurRadius=null,M.boxShadowSpreadRadius=null,M.boxShadowColor=""):(M.boxShadowInset=!1,M.boxShadowHOffset=5,M.boxShadowVOffset=5,M.boxShadowBlurRadius=10,M.boxShadowSpreadRadius=-5,M.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:M.boxShadowBlurRadius,color:M.boxShadowColor,hOffset:M.boxShadowHOffset,inset:M.boxShadowInset,spreadRadius:M.boxShadowSpreadRadius,vOffset:M.boxShadowVOffset}}})})},Be=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{oe(J=>!J),Re?(M.mobileBoxShadowInset=!1,M.mobileBoxShadowHOffset=null,M.mobileBoxShadowVOffset=null,M.mobileBoxShadowBlurRadius=null,M.mobileBoxShadowSpreadRadius=null,M.mobileBoxShadowColor=""):(M.mobileBoxShadowInset=!1,M.mobileBoxShadowHOffset=5,M.mobileBoxShadowVOffset=5,M.mobileBoxShadowBlurRadius=10,M.mobileBoxShadowSpreadRadius=-5,M.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:M.mobileBoxShadowBlurRadius,color:M.mobileBoxShadowColor,hOffset:M.mobileBoxShadowHOffset,inset:M.mobileBoxShadowInset,spreadRadius:M.mobileBoxShadowSpreadRadius,vOffset:M.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},v=()=>{setTimeout(()=>{Oe(M=>!M)})},ee=()=>{setTimeout(()=>{he(M=>!M)})},Te=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{ie(J=>!J),me?(M.backgroundColor="",M.backgroundImage="",M.backgroundPositionX="",M.backgroundPositionY="",M.backgroundRepeat="none",M.backgroundSize="",I(!0)):(M.backgroundColor="#E5E5E5",M.backgroundSize="",M.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:M.backgroundColor,backgroundImage:[{type:"url",value:M.backgroundImage}],backgroundPositionX:M.backgroundPositionX,backgroundPositionY:M.backgroundPositionY,backgroundRepeat:M.backgroundRepeat,backgroundSize:M.backgroundSize}})})},Ce=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{se(J=>!J),Q?M.mobileBackgroundColor="":M.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:M.mobileBackgroundColor}}}),Q&&Bt(s,e,l)})},De=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{K(J=>!J),ne&&(M.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},We=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{q(J=>!J),z&&(M.paddingLeftRight="",M.paddingLeft="",M.paddingRight="",M.paddingTopBottom="",M.paddingTop="",M.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Je=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{_e(J=>!J),ue&&(M.mobilePaddingLeftRight="",M.mobilePaddingLeft="",M.mobilePaddingRight="",M.mobilePaddingTopBottom="",M.mobilePaddingTop="",M.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:U.BORDER_POSITIONS[re]||"borderAll",mobileBorderPosition:U.MOBILE_BORDER_POSITIONS[je]||"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:Se,autoComplete:"off",className:"element-controls",children:[!C&&(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"})}),_==="mobile"&&B.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(pl,{form:s,elementSettings:e,mobileBoxShadow:E,mobileBordersShow:te,mobileBorderRadiusShow:le,mobileBoxShadowShow:Re,mobileSizeShow:ye,mobileBackgroundShow:Q,mobilePaddingShow:ue,mobilePaddingsExt:H,setMobilePaddingsExt:F,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:S,toggleShowMobileBorderHandler:Me,toggleShowMobileBorderRadiusHandler:ze,toggleShowMobileBoxShadowHandler:Be,toggleShowMobileSizeHandler:ee,toggleShowMobileBackgroundHandler:Ce,toggleShowMobilePaddingHandler:Je})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ml,{form:s,elementSettings:e,boxShadow:c,bordersShow:$,borderRadiusShow:Z,boxShadowShow:be,backgroundShow:me,backgroundImageEmpty:T,backgroundRepeatOptions:we,sizeShow:Ve,maxWidthValue:fe,modificationShow:ne,paddingShow:z,paddingsExt:O,oneBorderRadiusValue:b,setOneBorderRadiusValue:f,togglePaddingHandler:Ie,toggleShowPaddingHandler:We,toggleShowBorderHandler:Pe,toggleShowBorderRadiusHandler:He,toggleShowBoxShadowHandler:ae,toggleShowSizeHandler:v,toggleShowBackgroundHandler:Te,toggleShowModificationHandler:De,handleChangeValues:Se})})]})};hl.propTypes={elementSettings:g.default.object.isRequired};var bl=({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:Oo})})})})}),(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:un})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Vertical alignment"),dividerTop:!0,children:(0,o.jsx)(Fo,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{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)(Io,{})})]})};bl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var fl=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(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"})}),(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)(Uo,{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)(Fo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{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)(Io,{})})]})};fl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var Ci=0,gl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=r.useSelector(r.selectEmailViewType),d=r.useSelector(r.selectMobileViewActive),c=r.useSelector(r.selectIsCodeMode),m=r.useSelector(r.selectCodeModeDirection),b=c&&m!=="bottom";(0,n.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:mo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:mo(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Ci=e.width.value+e.gap.value)},[s,e]);const f=E=>{const h=s.getFieldsValue(!0),p=Object.keys(E)[0];let S;switch(p){case"width":Ci=E[p]+h.gap,S={[p]:{value:E[p],dim:h.widthDim},gap:{value:h.gap}};break;case"widthDim":S={width:{value:h.width,dim:E[p]},gap:{value:h.gap}};break;case"gap":h.width=Ci-E[p],S={[p]:{value:E[p],dim:"px"}};break;case"mobileWidth":S={[p]:{classNamePrefix:"em-mob-width-",value:E[p],dim:h.mobileWidthDim}};break;case"mobileWidthDim":S={mobileWidth:{classNamePrefix:"em-mob-width-",value:h.mobileWidth||100,dim:E[p]}};break;case"mobileContentWidth":S={[p]:{classNamePrefix:"em-mob-width-",value:E[p],dim:h.mobileContentWidthDim}};break;case"mobileContentWidthDim":S={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:E[p]}};break;case"mobileVerticalAlign":S={[p]:{classNamePrefix:"em-mob-vertical_align-",value:E[p]}};break;default:S=E}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:S})};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:f,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"})}),a==="mobile"&&d.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:a==="mobile"&&d.styles?"block":"none"},children:(0,o.jsx)(fl,{form:s,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(bl,{form:s,elementSettings:e})})]})};gl.propTypes={elementSettings:g.default.object.isRequired};var _l=({form:e,fillFields:i,elementSettings:l,boxShadow:s,bordersShow:a,borderRadiusShow:d,boxShadowShow:c,backgroundShow:m,backgroundImageEmpty:b,backgroundRepeatOptions:f,paddingShow:E,paddingsExt:h,maxWidthValue:p,oneBorderRadiusValue:S,setOneBorderRadiusValue:_,linkProtocol:B,linkTarget:T,isOpenTextReplacer:I,textReplacerButtonRef:P,textReplacerInputRef:y,handleLinkProtocolsChange:C,handleSelect:O,textReplacerInputHandler:X,handleTextReplacerKeyDown:H,srcButtonHandler:F,togglePaddingHandler:$,toggleShowPaddingHandler:V,toggleShowBackgroundHandler:te,toggleShowBorderHandler:R,toggleShowBorderRadiusHandler:Z,toggleShowBoxShadowHandler:ge,setLinkProtocol:le,handleChangeValues:pe})=>{const{__:be}=r.useI18n(),{token:xe}=(0,t.ui_kit$useToken)(),Re=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:be("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)(Vo,{form:e,elementSettings:l})}),Re.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(tt,{form:e,name:"textAlign",elementSettings:l})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(Zo,{show:B==="#",__:be,style:{marginBottom:xe.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:be("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:Re.formButtonFieldReplacerEnabled?xe.formItemMarginBottomXS:xe.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:B,handleLinkProtocolsChange:C,__:be}),placeholder:be("Hyperlink URL"),allowClear:!0,onSelect:O,prefix:(0,o.jsx)(Jo,{linkProtocol:B})})})}),B==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:xe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:be("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:xe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:be("Body")})})]}),Re.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:be("Text replacer"),placement:"bottom",getPopupContainer:oe=>oe.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":I}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:F,ref:P})})}),(0,o.jsx)(t.ui_kit$Col,{span:21,children:I&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:be("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:be("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:be("Text")}),onChange:X,onKeyDown:H,ref:y,onSelect:O})})})})]})}),Re.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:be("Padding"),collapsible:!0,open:E,onToggle:V,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:$,gutter:xe.marginSM,labels:{horizontal:be("Horizontal padding"),vertical:be("Vertical padding"),left:be("Left padding"),right:be("Right padding"),top:be("Top padding"),bottom:be("Bottom padding"),individual:be("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:be("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:p,dimensionSelect:Oo,gutter:xe.marginSM,labels:{width:be("Width"),height:be("Height"),minWidth:be("Minimum width"),maxWidth:be("Maximum width")}})}),(0,o.jsx)(_t,{form:e,fillFields:i,elementSettings:l,showAddParagraph:!1,isButton:!0,setLinkProtocol:le,linkProtocol:B,linkTarget:T}),(0,o.jsxs)(t.ui_kit$FormSection,{title:be("Background"),collapsible:!0,open:m,onToggle:te,dividerTop:!0,children:[(0,o.jsx)(Ii,{form:e,backgroundImageEmpty:b,appConfig:Re,token:xe,elementSettings:l,backgroundRepeatOptions:f,handleChangeValues:pe}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),Re.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:be("Borders"),collapsible:!0,open:a,onToggle:R,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:l})}),Re.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:be("Border radius"),collapsible:!0,open:d,onToggle:Z,dividerTop:!0,children:[(0,o.jsx)(To,{form:e,oneBorderRadiusValue:S,setOneBorderRadiusValue:_,elementSettings:l}),(0,o.jsx)(it,{form:e,showRounding:!0})]}),Re.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:be("Box shadow"),collapsible:!0,open:c,onToggle:ge,dividerTop:!0,children:(0,o.jsx)(jo,{})}),Re.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:be("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:l,form:e})}),Re.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:be("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})]})};_l.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,paddingShow:g.default.bool,paddingsExt:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,linkTarget:g.default.object,isOpenTextReplacer:g.default.bool,textReplacerButtonRef:g.default.object,textReplacerInputRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,textReplacerInputHandler:g.default.func,handleTextReplacerKeyDown:g.default.func,srcButtonHandler:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,setLinkProtocol:g.default.func,handleChangeValues:g.default.func};var xl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:m,mobileBackgroundShow:b,mobilePaddingShow:f,mobilePaddingsExt:E,setMobilePaddingsExt:h,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:S,linkProtocol:_,handleLinkProtocolsChange:B,setLinkProtocol:T,toggleShowMobileBorderHandler:I,toggleShowMobileBorderRadiusHandler:P,toggleShowMobileBoxShadowHandler:y,toggleShowMobileSizeHandler:C,toggleShowMobileBackgroundHandler:O,toggleShowMobilePaddingHandler:X})=>{const{__:H}=r.useI18n(),{token:F}=(0,t.ui_kit$useToken)(),$=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)(Vo,{form:e,elementSettings:l,imgParent:!0,typeOfForm:"mobile"})}),$.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mt,{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)(Zo,{show:_==="#",__:H,style:{marginBottom:F.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:H("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:_==="mailto:"?F.formItemMarginBottomXS:F.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:_,handleLinkProtocolsChange:B,__:H}),placeholder:H("Hyperlink URL"),allowClear:!0,prefix:(0,o.jsx)(Jo,{linkProtocol:_})})})}),_==="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:H("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:F.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:H("Body")})})]})]}),!!l.showOnMobile&&(0,o.jsx)(_t,{form:e,fillFields:i,elementSettings:l,setLinkProtocol:T,linkProtocol:_,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)(Ur,{})})}),$.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:H("Padding"),collapsible:!0,open:f,onToggle:X,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:l,mobilePaddingsExt:E,setMobilePaddingsExt:h})}),(0,o.jsx)(t.ui_kit$FormSection,{title:H("Size"),collapsible:!0,open:m,onToggle:C,dividerTop:!0,bodyStyle:{paddingBottom:F.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:H("Width"),placement:"bottom",children:(0,o.jsx)(Uo,{form:e,name:"mobileWidth",elementSettings:l})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:H("Height"),placement:"bottom",children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:H("Background"),collapsible:!0,open:b,onToggle:O,dividerTop:!0,bodyStyle:{paddingBottom:F.formItemMarginBottomMD},children:(0,o.jsx)(St,{elementSettings:Wo(l),imageEnabled:$.formButtonFieldBackgroundImageEnabled,desktopBackground:kt(l)})}),$.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:H("Borders"),collapsible:!0,open:a,onToggle:I,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),$.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:H("Border radius"),collapsible:!0,open:d,onToggle:P,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:S,elementSettings:l,typeOfForm:"mobile"})}),$.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:H("Box shadow"),collapsible:!0,open:c,onToggle:y,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),$.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:H("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})}),$.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:H("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};xl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,setLinkProtocol:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var Dn=Object.freeze({}),kl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=$o(),d=$o(),c=r.useDispatch(),[m,b]=(0,n.useState)({}),[f,E]=(0,n.useState)(!0),[h,p]=(0,n.useState)(!0),S=r.useSelector(r.selectEmailViewType),_=r.useSelector(r.selectMobileViewActive),[B,T]=(0,n.useState)(e.backgroundImage?.[0].value===""),I=r.useSelector(r.selectIsCodeMode),P=r.useSelector(r.selectCodeModeDirection),y=I&&P!=="bottom",C=(0,n.useRef)(null),O=(0,n.useRef)(null),[X,H]=(0,n.useState)(!1),[F,$]=(0,n.useState)(!1),[V,te]=(0,n.useState)(!1),[R,Z]=(0,n.useState)(!1),[ge,le]=(0,n.useState)(!1),[pe,be]=(0,n.useState)(!1),[xe,Re]=(0,n.useState)(!1),[oe,Ve]=(0,n.useState)(!1),[Oe,ye]=(0,n.useState)(!1),[he,me]=(0,n.useState)(!1),[ie,Q]=(0,n.useState)(!1),[se,ne]=(0,n.useState)(!1),[K,z]=(0,n.useState)(!1),[q,ue]=(0,n.useState)(""),[_e,fe]=(0,n.useState)("https://"),[Le,we]=(0,n.useState)({}),Ne=e,[Y,re]=(0,n.useState)(!!Ne.textReplacer?.length),[je,W]=(0,n.useState)(e);e!==je&&(W(e),re(!!Ne.textReplacer?.length));const Se=r.useElementEntityKind(),Ie=[{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"}],Pe=e.border,Me=e.mobileBorder,He=Object.keys(Pe).find(D=>Pe[D]?.width||Pe[D]?.style||Pe[D]?.color),ze=Object.keys(Me).find(D=>Me[D]?.width||Me[D]?.style||Me[D]?.color),ae=D=>D&&(D?.width||D?.style||D?.color)?D:"",{remember:Be,fillFields:v}=st(e);(0,n.useEffect)(()=>{if(e){const D=e.boxShadow||Dn,A=e.mobilePadding||{},x=e.mobileAlign||{};b(D);let L="",k="",G=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const $e=Nr(e.href);L=$e.subject,k=$e.body,G=$e.baseEmail}Ho(e.href,fe)}v(s,{...e,href:G,subject:L,body:k,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:ae(e.mobileBorder.all)||!(ae(e.mobileBorder.top)||ae(e.mobileBorder.bottom)||ae(e.mobileBorder.right)||ae(e.mobileBorder.left))&&ae(e.border.all),mobileBorderTop:ae(e.mobileBorder.top)||!ae(e.mobileBorder.all)&&ae(e.border.top),mobileBorderBottom:ae(e.mobileBorder.bottom)||!ae(e.mobileBorder.all)&&ae(e.border.bottom),mobileBorderRight:ae(e.mobileBorder.right)||!ae(e.mobileBorder.all)&&ae(e.border.right),mobileBorderLeft:ae(e.mobileBorder.left)||!ae(e.mobileBorder.all)&&ae(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:mo(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:mo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:mo(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:mo(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(x?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(A.all)||u(A.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(A.all)||u(A.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(A.all)||u(A.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(A.all)||u(A.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(A.top)||u(A.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(A.left)||u(A.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Lr(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))?E(!1):E(!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))?p(!1):p(!0),T(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)?H(!1):H(!0),!u(A.all)&&(u(A.top)||u(A.right)||u(A.bottom)||u(A.left))&&(A.top!==A.bottom||A.right!==A.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)?$(!1):$(!0);const de=a.isStaleBorderSnapshot(e,!!He),Ge=d.isStaleBorderSnapshot(e,!!ze);de&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ge||de&&!ze)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),te($e=>He&&!de?!0:$e),Z($e=>He&&!de||ze&&!Ge?!0:$e),le(!!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||!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),Re(!!e.boxShadow),Ve(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),ye(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),me(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Et(e)&&Q(!0),ne(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),z(!!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,y,He,ze,a,d,v]);const ee=(0,n.useCallback)(D=>{Be(D),c(Se==="email"?r.setElementSettings$1(D):r.setElementSettings(D))},[c,Se,Be]),Te=D=>{const A=s.getFieldsValue(!0),x=Object.keys(D)[0];let L;switch(ue(s.getFieldsValue(!0).widthDim==="%"?100:""),x){case"exportAsPicture":L={exportAsPicture:A.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":L={boxShadow:{hOffset:A.boxShadowHOffset,vOffset:A.boxShadowVOffset,blurRadius:A.boxShadowBlurRadius,spreadRadius:A.boxShadowSpreadRadius,color:A.boxShadowColor,inset:A.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":A.borderPosition==="borderAll"?(L={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...A.borderAll}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):A.borderAll?.width||A.borderAll?.style||A.borderAll?.color?(L={border:{all:null,left:A.borderAll,right:A.borderAll,top:A.borderAll,bottom:A.borderAll,[U.REVERSE_BORDER_POSITIONS[x]]:{...A[x],...D[x]}}},s.setFieldsValue({borderAll:null,borderLeft:A.borderAll,borderRight:A.borderAll,borderTop:A.borderAll,borderBottom:A.borderAll,[x]:{...A[x],...D[x]}})):(L={border:{all:null,left:A.borderLeft,right:A.borderRight,top:A.borderTop,bottom:A.borderBottom,[U.REVERSE_BORDER_POSITIONS[x]]:{...A[x],...D[x]}}},s.setFieldsValue({border:L.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(A.mobileBorderPosition==="mobileBorderAll")L={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...A.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[x]+"-"}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const de=U.MOBILE_REVERSE_BORDER_POSITIONS[x],Ge={...A[x],...D[x]},$e=!Ge?.width&&!Ge?.style&&!Ge?.color;if(A.mobileBorder?.all?.width||A.mobileBorder?.all?.style||A.mobileBorder?.all?.color){const ao=A.mobileBorderAll;L={mobileBorder:{all:null,left:ao,right:ao,top:ao,bottom:ao,[de]:$e?null:{...Ge,classNamePrefix:"em-mob-border_"+de+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:ao,mobileBorderRight:ao,mobileBorderTop:ao,mobileBorderBottom:ao,[x]:Ge})}else{const ao=e.mobileBorder||{},Eo=Xo=>{const Co=ao[Xo];return Co&&(Co?.width||Co?.style||Co?.color)?Co:null};L={mobileBorder:{all:null,left:de==="left"?$e?null:{...Ge,classNamePrefix:"em-mob-border_left-"}:Eo("left"),right:de==="right"?$e?null:{...Ge,classNamePrefix:"em-mob-border_right-"}:Eo("right"),top:de==="top"?$e?null:{...Ge,classNamePrefix:"em-mob-border_top-"}:Eo("top"),bottom:de==="bottom"?$e?null:{...Ge,classNamePrefix:"em-mob-border_bottom-"}:Eo("bottom")}},s.setFieldsValue({[x]:Ge})}}break;case"width":L={[x]:{value:D[x],dim:A.widthDim}};break;case"height":L={[x]:{value:D[x],dim:A.heightDim}};break;case"widthDim":L={width:{value:A.width,dim:D[x]}};break;case"heightDim":L={height:{value:A.height,dim:D[x]}};break;case"backgroundImage":T(D[x]===""),L={[x]:[{...e.backgroundImage[0],value:D[x]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":L={padding:{left:A.paddingLeft,right:A.paddingRight,top:A.paddingTop,bottom:A.paddingBottom,[U.PADDING_POSITION[x]]:+D[x]}};break;case"paddingTopBottom":L={padding:{left:A.paddingLeft,right:A.paddingRight,top:+D[x],bottom:+D[x]}},A.paddingTop=A.paddingBottom=+D[x];break;case"paddingLeftRight":L={padding:{top:A.paddingTop,bottom:A.paddingBottom,left:+D[x],right:+D[x]}},A.paddingLeft=A.paddingRight=+D[x];break;case"borderRadiusAll":L={borderRadius:{[U.BORDER_RADIUS_POSITION[x]]:+D[x]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":L={borderRadius:{topLeft:A.borderRadiusTopLeft,bottomLeft:A.borderRadiusBottomLeft,topRight:A.borderRadiusTopRight,bottomRight:A.borderRadiusBottomRight,[U.BORDER_RADIUS_POSITION[x]]:+D[x]}};break;case"mobileWidth":L={[x]:{classNamePrefix:"em-mob-width-",value:D[x],dim:A.mobileWidthDim}};break;case"mobileWidthDim":L={mobileWidth:{classNamePrefix:"em-mob-width-",value:A.mobileWidth||100,dim:D[x]}};break;case"mobileHeight":L={[x]:{classNamePrefix:"em-mob-height-",value:D[x],dim:A.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:D[x],dim:A.mobileHeightDim}};break;case"mobileHeightDim":L={mobileHeight:{classNamePrefix:"em-mob-height-",value:A.mobileHeight,dim:D[x]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":L={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[x]]:D[x],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[x]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":L={mobileBoxShadow:{hOffset:A.mobileBoxShadowHOffset,vOffset:A.mobileBoxShadowVOffset,blurRadius:A.mobileBoxShadowBlurRadius,spreadRadius:A.mobileBoxShadowSpreadRadius,color:A.mobileBoxShadowColor,inset:A.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":L={[x]:{classNamePrefix:"em-mob-table_align-",value:D[x]}};break;case"mobileTextAlign":L={[x]:{classNamePrefix:"em-mob-text_align-",value:D[x]}};break;case"mobileVerticalAlign":L={[x]:{classNamePrefix:"em-mob-vertical_align-",value:D[x]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(L=xt(D),!L)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":L={mobilePadding:{all:null,top:A.mobilePaddingTop!==""?A.mobilePaddingTop:null,right:A.mobilePaddingRight!==""?A.mobilePaddingRight:null,bottom:A.mobilePaddingBottom!==""?A.mobilePaddingBottom:null,left:A.mobilePaddingLeft!==""?A.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":A.mobilePaddingTop=A.mobilePaddingBottom=D[x],L={mobilePadding:{all:null,top:A.mobilePaddingTop!==""?A.mobilePaddingTop:null,right:A.mobilePaddingRight!==""?A.mobilePaddingRight:null,bottom:A.mobilePaddingBottom!==""?A.mobilePaddingBottom:null,left:A.mobilePaddingLeft!==""?A.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":A.mobilePaddingLeft=A.mobilePaddingRight=D[x],L={mobilePadding:{all:null,top:A.mobilePaddingTop!==""?A.mobilePaddingTop:null,right:A.mobilePaddingRight!==""?A.mobilePaddingRight:null,bottom:A.mobilePaddingBottom!==""?A.mobilePaddingBottom:null,left:A.mobilePaddingLeft!==""?A.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":L={[x]:{classNamePrefix:"em-mob-font_size-",value:D[x],dim:A.mobileFontSizeDim}};break;case"href":let k=et(D[x]);k!==D[x]&&(s.setFieldValue("href",k),A.href=k),k.startsWith("mailto:")?L={[x]:Si(k,A.subject,A.body)}:L={[x]:k},Ho(D[x],fe);break;case"subject":case"body":const G=A.href||"";if(G.startsWith("mailto:")){const de=x==="subject"?D[x]:A.subject,Ge=x==="body"?D[x]:A.body;L={href:Si(G,de,Ge)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":L={[x]:isNaN(parseFloat(D[x].position))?D[x].position:D[x].position+D[x].unit};break;default:L=D}x!=="borderPosition"&&x!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:L}),x!=="mobileBorderRadiusAll"&&x!=="mobileBorderRadiusTopLeft"&&x!=="mobileBorderRadiusTopRight"&&x!=="mobileBorderRadiusBottomLeft"&&x!=="mobileBorderRadiusBottomRight"&&ee({...e,...L,mobileBorderRadius:{...e.mobileBorderRadius,...L?.mobileBorderRadius},activateSection:null,changeKey:x}))},Ce=()=>{H(A=>!A);const D=s.getFieldsValue(!0);X||(D.paddingLeftRight=D.paddingLeft,D.paddingTopBottom=D.paddingTop,D.paddingRight=D.paddingLeft,D.paddingBottom=D.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:D.paddingTopBottom,bottom:D.paddingTopBottom,left:D.paddingLeftRight,right:D.paddingLeftRight}}}))},De=()=>{const D=s.getFieldsValue(!0);a.markBorderToggled(!V),setTimeout(()=>{te(A=>!A),V?(D.borderAll=U.NULL_BORDER,D.borderTop=U.NULL_BORDER,D.borderBottom=U.NULL_BORDER,D.borderRight=U.NULL_BORDER,D.borderLeft=U.NULL_BORDER):D.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:D.borderAll.color,style:D.borderAll.style,width:D.borderAll.width}}}})})},We=()=>{const D=s.getFieldsValue(!0);d.markBorderToggled(!R),setTimeout(()=>{Z(A=>!A),R?(D.mobileBorderAll=U.NULL_BORDER,D.mobileBorderTop=U.NULL_BORDER,D.mobileBorderBottom=U.NULL_BORDER,D.mobileBorderRight=U.NULL_BORDER,D.mobileBorderLeft=U.NULL_BORDER):D.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:D.mobileBorderAll.color,style:D.mobileBorderAll.style,width:D.mobileBorderAll.width}}}})})},Je=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{le(A=>!A),ge?(D.borderRadiusAll=0,E(!0)):D.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:D.borderRadiusAll}}})})},M=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{be(A=>!A),pe?(D.mobileBorderRadiusAll=null,p(!0)):D.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:D.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},J=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{Re(A=>!A),xe?(D.boxShadowInset=!1,D.boxShadowHOffset=null,D.boxShadowVOffset=null,D.boxShadowBlurRadius=null,D.boxShadowSpreadRadius=null,D.boxShadowColor=""):(D.boxShadowInset=!1,D.boxShadowHOffset=5,D.boxShadowVOffset=5,D.boxShadowBlurRadius=10,D.boxShadowSpreadRadius=-5,D.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:D.boxShadowBlurRadius,color:D.boxShadowColor,hOffset:D.boxShadowHOffset,inset:D.boxShadowInset,spreadRadius:D.boxShadowSpreadRadius,vOffset:D.boxShadowVOffset}}})})},j=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{Ve(A=>!A),oe?(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=null,D.mobileBoxShadowVOffset=null,D.mobileBoxShadowBlurRadius=null,D.mobileBoxShadowSpreadRadius=null,D.mobileBoxShadowColor=""):(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=5,D.mobileBoxShadowVOffset=5,D.mobileBoxShadowBlurRadius=10,D.mobileBoxShadowSpreadRadius=-5,D.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:D.mobileBoxShadowBlurRadius,color:D.mobileBoxShadowColor,hOffset:D.mobileBoxShadowHOffset,inset:D.mobileBoxShadowInset,spreadRadius:D.mobileBoxShadowSpreadRadius,vOffset:D.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},w=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{ye(A=>!A),Oe&&(D.mobileWidth="",D.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-"}}}))})},ce=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{me(A=>!A),he?(D.backgroundColor="",D.backgroundImage="",D.backgroundPositionX="",D.backgroundPositionY="",D.backgroundRepeat="none",D.backgroundSize="",T(!0)):(D.backgroundColor="#E5E5E5",D.backgroundSize="",D.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:D.backgroundColor,backgroundImage:[{type:"url",value:D.backgroundImage}],backgroundPositionX:D.backgroundPositionX,backgroundPositionY:D.backgroundPositionY,backgroundRepeat:D.backgroundRepeat,backgroundSize:D.backgroundSize}})})},ve=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{Q(A=>!A),ie?D.mobileBackgroundColor="":D.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:D.mobileBackgroundColor}}}),ie&&Bt(s,e,l)})},Ye=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{ne(A=>!A),se&&(D.paddingLeftRight="",D.paddingLeft="",D.paddingRight="",D.paddingTopBottom="",D.paddingTop="",D.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},qe=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{z(A=>!A),K&&(D.mobilePaddingLeftRight="",D.mobilePaddingLeft="",D.mobilePaddingRight="",D.mobilePaddingTopBottom="",D.mobilePaddingTop="",D.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_"}}}))})},oo=D=>{s.setFieldValue("href",D!=="mergetag"?D:""),fe(D)},to=(0,n.useCallback)(({target:D})=>{if(!D)return;const{selectionStart:A,selectionEnd:x}=D;we(L=>L.target===D&&L.selection?.start===A&&L.selection?.end===x?L:{target:D,selection:{start:A,end:x}})},[]),no=D=>{D.target.value!==""&&O.current.classList.add("selected-td-form__button--active")},fo=()=>{re(!Y),Y?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>C.current.focus())},xo=D=>{const A=D.target,x=A.value,L=A.selectionStart;if(L===0&&D.key===" "){D.preventDefault();return}if(D.key===" "){if(L!==x.length){D.preventDefault();return}x.endsWith(" ")&&D.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:U.BORDER_POSITIONS[He]||"borderAll",mobileBorderPosition:U.MOBILE_BORDER_POSITIONS[ze]||"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:Te,autoComplete:"off",className:"element-controls",children:[!y&&(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"})}),y?(0,o.jsx)(yi,{form:s,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,o.jsx)(o.Fragment,{children:S==="mobile"&&_.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(xl,{form:s,fillFields:v,elementSettings:e,boxShadow:m,mobileBordersShow:R,mobileBorderRadiusShow:pe,mobileBoxShadowShow:oe,mobileSizeShow:Oe,mobileBackgroundShow:ie,mobilePaddingShow:K,mobilePaddingsExt:F,setMobilePaddingsExt:$,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,linkProtocol:_e,handleLinkProtocolsChange:oo,setLinkProtocol:fe,toggleShowMobileBorderHandler:We,toggleShowMobileBorderRadiusHandler:M,toggleShowMobileBoxShadowHandler:j,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:ve,toggleShowMobilePaddingHandler:qe})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(_l,{form:s,fillFields:v,elementSettings:e,boxShadow:m,bordersShow:V,borderRadiusShow:ge,boxShadowShow:xe,backgroundShow:he,backgroundImageEmpty:B,backgroundRepeatOptions:Ie,paddingShow:se,paddingsExt:X,maxWidthValue:q,oneBorderRadiusValue:f,setOneBorderRadiusValue:E,linkProtocol:_e,linkTarget:Le,isOpenTextReplacer:Y,textReplacerButtonRef:O,textReplacerInputRef:C,handleLinkProtocolsChange:oo,handleSelect:to,textReplacerInputHandler:no,handleTextReplacerKeyDown:xo,srcButtonHandler:fo,togglePaddingHandler:Ce,toggleShowPaddingHandler:Ye,toggleShowBackgroundHandler:ce,toggleShowBorderHandler:De,toggleShowBorderRadiusHandler:Je,toggleShowBoxShadowHandler:J,setLinkProtocol:fe,handleChangeValues:Te})})})]})};kl.propTypes={elementSettings:g.default.object.isRequired};var El=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useSendPostMessage();(0,n.useEffect)(()=>{e&&l.setFieldsValue({...e})},[l,e]);const a=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:a,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")})})})};El.propTypes={elementSettings:g.default.object.isRequired};function Vn(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 Hn(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function Un(e,i,l){return(e??[]).map((s,a)=>a===i.index?{...s,[i.key]:l}:s)}function Bl(e){return(e??[]).map((i,l)=>({...i,slideIndex:l}))}var Sl=({elementSettings:e,setElementSettings:i,postfix:l="",form:s,handleSelect:a,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:m}=(0,t.ui_kit$useToken)(),b=r.useAppConfig(),f=r.useSendPostMessage(),E="src"+l,h="title"+l,p="alt"+l,S="link"+l,_="imgReplacer"+l,B=(0,n.useRef)(null),T=(0,n.useRef)(null),I=(0,n.useRef)(null),P=(0,n.useRef)(null),y=(0,n.useRef)(null),C=(0,n.useRef)(null),O=(0,n.useRef)(null),X=(0,n.useRef)(null),[H,F]=(0,n.useState)(""),[$,V]=(0,n.useState)(""),[te,R]=(0,n.useState)(""),[Z,ge]=(0,n.useState)(!1),[le,pe]=(0,n.useState)("https://"),be=(0,n.useRef)(!1),xe=(0,n.useRef)(l);(0,n.useEffect)(()=>{l!==xe.current&&(xe.current=l,be.current=!1),V(e.images?.[p]),R(e.images?.[h]);const ne=e.images?.[S];F(ne||(be.current?"...":""))},[e,p,h,S,l]);const Re=()=>{H?(be.current=!1,F(""),s.setFieldValue(S,""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[S]:""}})):(be.current=!0,F(B.current&&B.current.input.value?B.current.input.value:"..."),setTimeout(()=>{B.current.focus()}))},oe=ne=>{ne.target.value===""?F("..."):(T.current.classList.add("selected-td-form__button--active"),F(ne.target.value));const K=ne.target.value;Ho(K,pe)},Ve=()=>{$?(V(""),s.setFieldValue("alt",""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[p]:""}})):(V(I.current&&I.current.input.value?I.current.input.value:"..."),setTimeout(()=>{I.current.focus()}))},Oe=ne=>{ne.target.value===""?V("..."):(P.current.classList.add("selected-td-form__button--active"),V(ne.target.value))},ye=()=>{te?(R(!1),s.setFieldValue("title",""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(R(y.current&&y.current.input.value?y.current.input.value:"..."),setTimeout(()=>{y.current.focus()}))},he=()=>{ge(!Z),Z?(s.setFieldValue(_,""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[_]:""}})):setTimeout(()=>O.current.focus())},me=ne=>{ne.target.value!==""&&X.current.classList.add("selected-td-form__button--active")},ie=ne=>{ne.target.value===""?R("..."):(C.current.classList.add("selected-td-form__button--active"),R(ne.target.value))},Q=ne=>{s.setFieldValue("LinkName",ne!=="mergetag"?ne:""),pe(ne)},se=ne=>{const K=s.getFieldsValue(!0),z=+l.substring(1),q=Object.keys(K?.images).reduce((_e,fe)=>(fe.includes(l)||(_e[fe]=K[fe]),_e),{}),ue=e.carouselImages?.filter((_e,fe)=>fe!==z);i(_e=>({..._e,settings:{..._e.settings,carouselImages:Bl(ue)}})),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:ue}}),s.setFieldsValue({images:q})};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:E,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:$||c("Alternative text"),placement:"bottom",getPopupContainer:ne=>ne.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:Ve,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),b.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:te||c("Tooltip text"),placement:"bottom",getPopupContainer:ne=>ne.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":!!te}),onClick:ye,ref:C,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:H||c("Hyperlink URL"),placement:"bottom",getPopupContainer:ne=>ne.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:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:Re,ref:T})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:ne=>ne.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":Z}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:he,ref:X})})]}),(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:se,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!H||!!$||!!te||!!Z)&&(0,o.jsxs)("div",{children:[!!H&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:le==="#",__:c,style:{marginBottom:m.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:S,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:le,handleLinkProtocolsChange:Q,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:B,onChange:oe,onSelect:a,prefix:(0,o.jsx)(Jo,{linkProtocol:le})})})})]}),!!$&&(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:p,className:"selected-image-form__alt",style:{marginTop:m.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:I,onSelect:a})})}),b.formFieldImageTitleEnabled&&!!te&&(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:m.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:ie,ref:y,onSelect:a})})}),!!Z&&(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:_,className:"selected-image-form__alt",style:{marginTop:m.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:me,ref:O,onSelect:a})})})]})]})};Sl.propTypes={};var Tl=({form:e,elementSettings:i,formFields:l,setElementSettings:s,borderRadiusShow:a,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:m,mergeTagItems:b,mergeMenuOpen:f,setMergeMenuOpen:E,cascaderRef:h,handleLinkProtocolsChange:p,handleSelect:S,onChange:_,filter:B,renderSearchOption:T,toggleShowBorderRadiusHandler:I,setNewSlide:P})=>{const{__:y}=r.useI18n(),{token:C}=(0,t.ui_kit$useToken)(),O=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:m==="#",__:y,style:{marginBottom:C.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:y("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:m,handleLinkProtocolsChange:p,__:y}),placeholder:y("Link for all slides"),allowClear:!0,onSelect:S,prefix:(0,o.jsx)(Jo,{linkProtocol:m})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),O.mergeTagsShow&&b&&(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:C.formItemMarginBottomMD,marginTop:C.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:f?"none":"inline-flex"},onClick:()=>E(!0),children:y("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:h,classNames:{popup:{root:"merge-tags"}},options:b,placeholder:y("Start typing the title"),showSearch:{filter:B,render:T},spellCheck:"false",getPopupContainer:X=>X.closest(".email-pane__collapse-wrapper"),onChange:_,style:{display:f?"block":"none"},open:f,onKeyDown:X=>{X.key==="Escape"&&E(!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:C.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((X,H)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)(Sl,{elementSettings:l,setElementSettings:s,postfix:"_"+H,form:e,handleSelect:S})},H))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:C.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:()=>P(),children:y("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:C.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:C.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Loop",label:y("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:C.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Autoplay",label:y("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),O.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Border radius"),collapsible:!0,open:a,onToggle:I,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};Tl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,formFields:g.default.object,setElementSettings:g.default.func,borderRadiusShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,toggleShowBorderRadiusHandler:g.default.func,setNewSlide:g.default.func};var Rl=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("p",{children:e("No properties to edit.")})})};Rl.propTypes={};var Wn={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 zn(e){const i={...Ti(e)};return delete i.parent,delete i.path,delete i.nextElem,delete i.prevElem,i}var yl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm();let s=r.useDispatch();r.useAppConfig();const a=r.useSendPostMessage(),d=r.useSendPostMessageEx(),{openImagePicker:c}=r.useImagePicker(),m=r.useSelector(r.selectEmailViewType),b=r.useSelector(r.selectMobileViewActive),[f,E]=(0,n.useState)(!0),[h,p]=(0,n.useState)(!0),[S,_]=(0,n.useState)(!1),[B,T]=(0,n.useState)(!1),[I,P]=(0,n.useState)("https://"),[y,C]=(0,n.useState)(l?.getFieldsValue(!0)),[O,X]=(0,n.useState)(e),{remember:H,isOwnEcho:F}=Dr(zn),[$,V]=(0,n.useState)(e);e!==$&&(V(e),F(e?.settings)||X(e));const[te,R]=(0,n.useState)({name:"",counter:0}),[Z,ge]=(0,n.useState)(null),[le,pe]=(0,n.useState)(),[be,xe]=(0,n.useState)(!1),[Re,oe]=(0,n.useState)(!1),[Ve,Oe]=(0,n.useState)({start:0,end:0}),ye=(0,n.useRef)(null),he=`selected_${O.type}_form_link`,me=r.useSelector(r.selectIsCodeMode),ie=r.useSelector(r.selectCodeModeDirection),Q=me&&ie!=="bottom";(0,n.useEffect)(()=>{be&&ye.current&&ye.current.focus()},[be]);const se=(W,Se)=>{const Ie=document.getElementById(Se);if(Ie){const Pe=O,Me=Vn(Pe.type,Se),He=Hn(Me),ze=Ie.value?.substring(0,Ve.start),ae=Ie.value?.substring(Ve.end);let Be={[Me]:ze+W+ae};He?Be={carouselImages:Un(Pe.settings?.carouselImages,He,ze+W+ae)}:O.type===r.ELEMENT_TYPES.CAROUSEL&&he===Se&&(Be={[Me]:ze+W+ae,carouselImages:[...O.settings?.carouselImages.map(v=>({...v,link:ze+W+ae}))||[]]}),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...O.settings,...Be}}),X(v=>({...v,settings:{...v.settings,...Be}})),l.setFieldValue(Me,ze+W+ae),Ie.focus(),setTimeout(()=>{Ie.selectionStart=Ve.start,Ie.selectionEnd=Ve.start+W.length},400),oe(!0)}},ne=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{ne?.items?.length&&pe(r.mapMargeTags(ne.items))},[ne,pe]);const K=(W,Se)=>{if(xe(!1),W){const Ie=ne.syntax.length>1?le.findIndex(He=>He.key===Se[0].key):0,Pe=ne.syntax[Ie].replace("%value%",W[W.length-1]),Me=`selected_${O.type}_form${O.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(He=>Z?.getAttribute("id").includes(`${Me}_${He}`))||Z?.getAttribute("id").includes(he)?se(Pe,Z?.getAttribute("id")):(l.setFieldValue("imgReplacer",Pe),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...O.settings,imgReplacer:Pe}}),X(He=>({...He,settings:{...He.settings,imgReplacer:Pe}})))}},z=r.useRootElement();(0,n.useEffect)(()=>{const W=({target:Pe})=>{Pe.closest('[id="merge_tags_wrapper"]')||ge(Pe)},Se=({target:Pe})=>{!Pe.closest(".merge-tags")&&!Pe.closest("#merge_tags_button")&&xe(!1)},Ie=new bo.Disposable;return Ie.addDisposable(r.addWindowListenerFromShadow(z,"focusin",W)),Ie.addDisposable(r.addWindowListenerFromShadow(z,"click",Se)),()=>{Ie.dispose()}},[z]);const q=(W,Se)=>Se.some(Ie=>Ie.label.toLowerCase().indexOf(W.toLowerCase())>-1),ue=(W,Se)=>{const Ie=Se.map((Pe,Me)=>{const He=Pe.label.split(new RegExp(`(${W})`,"gi"));return(0,o.jsxs)("span",{children:[Me!==0&&(0,o.jsx)("span",{children:" / "}),He.map((ze,ae)=>ze.toLowerCase()===W.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:ze},ae):ze)]},Pe.value)});return(0,o.jsx)("div",{title:Se.map(Pe=>Pe.label).join(" / "),children:Ie})};(0,n.useEffect)(()=>{const W=l?.getFieldsValue(!0);C(W)},[l]);const _e=({target:W})=>{if(W&&!Re){const{selectionStart:Se,selectionEnd:Ie}=W;Oe({start:Se,end:Ie})}oe(!1)};(0,n.useEffect)(()=>{if(O.settings){const W=O.settings,Se=Ti(W);l?.setFieldsValue(Se),C(Se),W.link&&P(Ft(W.link,"https://")),u(W.borderRadius?.all)||(u(W.borderRadius?.topLeft)||u(W.borderRadius?.bottomLeft)||u(W.borderRadius?.topRight)||u(W.borderRadius?.bottomRight)?E(!1):u(W.borderRadius?.all)||E(!0)),u(W.mobileBorderRadius?.topLeft)||u(W.mobileBorderRadius?.bottomLeft)||u(W.mobileBorderRadius?.topRight)||u(W.mobileBorderRadius?.bottomRight)?p(!1):p(!0),_(!!W.borderRadius?.all||!!W.borderRadius?.topLeft||!!W.borderRadius?.bottomLeft||!!W.borderRadius?.topRight||!!W.borderRadius?.bottomRight),T(!!W.mobileBorderRadius?.all||!!W.mobileBorderRadius?.topLeft||!!W.mobileBorderRadius?.bottomLeft||!!W.mobileBorderRadius?.topRight||!!W.mobileBorderRadius?.bottomRight)}},[l,O]);const fe=W=>{const Se=Or(O.settings,l,W);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:Se.caption,settings:Se}),H({...O.settings,...Se}),X(Ie=>({...Ie,settings:{...Ie.settings,...Se}}))},Le=(W,Se)=>{const Ie=r.stripEmVersionFromUrlString(O.settings?.src||"")===r.stripEmVersionFromUrlString(W||"");(!Ie||W!==O.settings?.src)&&fe({src:W}),Se?.mode==="save"&&Ie&&(R(Pe=>({name:"src",counter:Pe.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(W)}))},we=async W=>{const Se=O.settings?.src||"",Ie=r.stripEmVersionFromUrlString(Se),Pe=await c({kind:"img",currentUrl:gt(Ie)?"":Ie,entryModal:W});Pe?.url&&Le(Pe.url,Pe.meta)},Ne=W=>{const Se=W.data.operation;Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_AI):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Se===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage(Ne);const Y=()=>{setTimeout(()=>{_(W=>!W),l.setFieldValue("borderRadiusAll",S?0:5),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...O.settings,borderRadius:{all:S?"":5}}}),X(W=>({...W,settings:{...W.settings,borderRadius:{all:S?null:5}}}))})},re=W=>{l.setFieldValue("link",W!=="mergetag"?W:""),P(W)},je=()=>{const{width:W,height:Se,renderedWidth:Ie,renderedHeight:Pe}=O?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Me={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:W.value,dim:"px"},height:{value:Se.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Ie,renderedHeight:Pe,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},He=[...O?.settings?.carouselImages,Me];a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...O.settings,carouselImages:He}});const ze=Bl(He);X(ae=>({...ae,settings:{...ae.settings,carouselImages:ze}}))};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:Wn,onValuesChange:fe,autoComplete:"off",className:"element-controls",children:[!Q&&(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"&&b.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(Rl,{})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Tl,{form:l,elementSettings:O,formFields:y,setElementSettings:X,borderRadiusShow:S,oneBorderRadiusValue:f,setOneBorderRadiusValue:E,linkProtocol:I,mergeTagItems:le,mergeMenuOpen:be,setMergeMenuOpen:xe,cascaderRef:ye,handleLinkProtocolsChange:re,handleSelect:_e,onChange:K,filter:q,renderSearchOption:ue,toggleShowBorderRadiusHandler:Y,setNewSlide:je})})]})};yl.propTypes={};var Gn={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},wl=({elementSettings:e})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),[s]=t.ui_kit$Form.useForm(),a=r.useSendPostMessage(),d=r.useAppConfig(),[c,m]=(0,n.useState)(e),[b,f]=(0,n.useState)(e);e!==b&&(f(e),m(e)),(0,n.useEffect)(()=>{if(c.settings){const S=c.settings,_=Ti(S);s?.setFieldsValue(_)}},[s,c]);const E=S=>{const _=Or(c.settings,s,S);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:_.caption,settings:_}),m(B=>({...B,settings:{...B.settings,..._}}))},h=()=>{m(S=>({...S,sections:c?.settings?.sections.push({expanded:!1})})),a({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.")}})},p=S=>{m(_=>({..._,settings:{..._.settings,sections:c.settings.sections?.filter((B,T)=>T!==S)}})),a({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:S}})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Gn,onValuesChange:E,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((S,_)=>(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 ")+(_+1)}),(0,o.jsx)(t.ui_kit$Form.Item,{name:`expanded_${_}`,valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:`expanded_${_}`,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:()=>p(_)})})]},`expanded_${_}`))})}),(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"})]})})};wl.propTypes={};var{Text:Yn}=t.ui_kit$Typography,Xn="em",jl="text/plain",Kn=(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),qn=(0,o.jsx)("span",{className:"addon-text-content",children:"Title"});function Po(e){return e.closest(".email-pane__collapse-wrapper")}function Wt({form:e,name:i,placeholder:l,usedColors:s,onColorChange:a}){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=>a(i,c)})}var Jn=/^[a-z][a-z0-9+.-]*:/i;function vl(e){const i=et(typeof e=="string"?e:String(e??""));return i?Jn.test(i)?i:`https://${i}`:""}function Qn(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 Zn(e){const i=vl(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 Il(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&>(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 a=await s.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((d,c)=>{const m=new FileReader;m.onload=()=>d(m.result),m.onerror=c,m.readAsDataURL(a)})}}}catch{}return{entryModal:r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function ed(){const e=r.useSelector(r.selectEditorThemeColor$1),[i,l]=(0,n.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,n.useEffect)(()=>{const s=()=>l(document.body.classList.contains("dark"));s();const a=new MutationObserver(s);return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function od(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function zt(e,i,l){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(l??"").trim()}}function Cl(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 Pl(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 Gt(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return s||l}function td(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return!s||l&&s===l?"":s}function id(e,i,l){const s=String(e??"").trim(),a=String(i??"").trim(),d=String(l??"").trim();return d&&(!s||d!==s)?d:a}function rd(e,i){return(e||[]).map(l=>({...l,itemBorderColor:l.customIcon?"":i}))}function ld(e,i,l){return(e||[]).map(s=>({...s,buttonBgColor:s.customIcon?"":id(i,l,s.buttonBgColor)}))}function sd(e,i){if(e==null)return;const l=(s,a)=>{if(!a||!Object.prototype.hasOwnProperty.call(a,"platform"))return;const d=a.platform;d==null||d===""||i(s,d)};if(Array.isArray(e))e.forEach((s,a)=>{l(a,s)});else if(typeof e=="object")for(const s of Object.keys(e)){const a=Number.parseInt(s,10);Number.isNaN(a)||l(a,e[s])}}function Al({__:e,form:i,fieldName:l,pushSettingsToIframe:s,onMetaActiveChange:a}){const{token:d}=(0,t.ui_kit$useToken)(),c=t.ui_kit$Form.useWatch(["items",l],i),m=c&&typeof c=="object"?c:{},b=typeof m.alt=="string"?m.alt:"",f=typeof m.title=="string"?m.title:"",[E,h]=(0,n.useState)(!1),[p,S]=(0,n.useState)(!1),_=(0,n.useRef)(null),B=(0,n.useRef)(null),T=(0,n.useMemo)(()=>({clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,n.useEffect)(()=>{b.trim()&&h(!0)},[b]);const I=!!(b.trim()||E),P=!!(f.trim()||p),y=I||P;(0,n.useLayoutEffect)(()=>{a(l,{alt:I,title:P})},[I,l,a,P]);const C=(0,n.useMemo)(()=>({marginBottom:y?d.formItemMarginBottomXS:0}),[y,d.formItemMarginBottomXS]),O=(0,n.useMemo)(()=>[l,"alt"],[l]),X=(0,n.useMemo)(()=>[l,"title"],[l]),H=y?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",F=I?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",$=P?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",V=(0,n.useMemo)(()=>b.trim()?b.trim():e("Alternative text"),[e,b]),te=(0,n.useMemo)(()=>f.trim()?f.trim():e("Tooltip text"),[e,f]),R=(0,n.useMemo)(()=>(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":I}),[I]),Z=(0,n.useMemo)(()=>(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":P}),[P]),ge=(0,n.useCallback)(be=>{setTimeout(()=>{const xe=be.current;if(xe){if(typeof xe.focus=="function"){xe.focus();return}xe.input&&typeof xe.input.focus=="function"&&xe.input.focus()}},0)},[]),le=(0,n.useCallback)(()=>{I?(h(!1),b.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(h(!0),ge(_))},[I,b,l,ge,i,s]),pe=(0,n.useCallback)(()=>{if(P)a(l,{title:!1}),S(!1),f.trim()&&(i.setFieldValue(["items",l,"title"],""),setTimeout(()=>s(),0));else{S(!0),a(l,{title:!0});const be=b.trim();i.setFieldValue(["items",l,"title"],be),setTimeout(()=>s(),0),ge(B)}},[b,l,ge,i,a,s,P,f]);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:C,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:V,placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:R,onClick:le,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:te,placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:Z,onClick:pe,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:H,children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:O,className:F,children:(0,o.jsx)(t.ui_kit$Input,{ref:_,placeholder:e("Alternative text"),allowClear:T,prefix:Kn})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:X,className:$,children:(0,o.jsx)(t.ui_kit$Input,{ref:B,placeholder:e("Social network name"),allowClear:T,prefix:qn})})]})]})}Al.propTypes={__:g.default.func.isRequired,form:g.default.object.isRequired,fieldName:g.default.oneOfType([g.default.number,g.default.string]).isRequired,pushSettingsToIframe:g.default.func.isRequired,onMetaActiveChange:g.default.func.isRequired};function ad(e,i){if(!Array.isArray(e)||e.length===0)return i;let l=null;for(const s of e){const a=s.iconWidth;if(a==null||Number.isNaN(a)||a<=0)return i;if(l===null)l=a;else if(a!==l)return i}return l??i}function nd(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=od(e),l=String(e?.hostCellBgForIconLuminance??"").trim(),s=ad(e.items,e.iconSize??40),a=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:Pl(e.items),buttonBorderWidth:a,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const m=!!c.customIcon,b=m?"":Gt(d,c.buttonBgColor),f=c.platform&&!m?r.getSocialIconForBlockCell(c.platform,zt(i,b,l)):null;return{...c,customIcon:m,title:String(c.title??"").trim(),...f?{iconSrc:f}:{},iconWidth:null,iconHeight:null,buttonBgColor:b,itemBorderColor:m?"":String(c.itemBorderColor??"").trim()}}):[]}}var Nl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useAppConfig(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=r.useSendPostMessageEx(),{openImagePicker:m}=r.useImagePicker(),[b,f]=(0,n.useState)(e),[E,h]=(0,n.useState)(null),[p,S]=(0,n.useState)(null),_=(0,n.useRef)(null),B=(0,n.useRef)(null),T=(0,n.useRef)(null),I=(0,n.useRef)(Cl(e)),P=r.useSelector(r.selectEmailSettings),y=(0,n.useRef)(null),C=(0,n.useRef)(!1),O=(0,n.useRef)(""),X=(0,n.useRef)({}),H=ed(),F=P?.usedColors??[],$=t.ui_kit$Form.useWatch("items",a)||[],V=(0,n.useCallback)(()=>{y.current&&(document.removeEventListener("dragover",y.current,!0),y.current=null)},[]),te=(0,n.useCallback)(()=>{if(y.current)return;const Y=re=>{re.preventDefault(),re.dataTransfer&&(re.dataTransfer.dropEffect="move")};document.addEventListener("dragover",Y,!0),y.current=Y},[]),R=(0,n.useMemo)(()=>r.getSocialPresetsForBrand(Xn).filter(Y=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[Y.id]),[]),Z=(0,n.useMemo)(()=>R.map(Y=>({value:Y.id,label:(0,o.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,o.jsx)("img",{src:r.getSocialIcon(Y.id,H),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(Y.labelMsgid)})]})})),[i,R,H]),ge=(0,n.useCallback)((Y,re)=>{X.current={...X.current,[Y]:{...X.current[Y],...re}}},[]);(0,n.useEffect)(()=>{const Y=Cl(e);I.current!==Y&&(I.current=Y,X.current={},f(e))},[e]);const le=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(b?.settings){if(le.current){le.current=!1;return}const Y=b.settings;O.current=Y.bgEnabled&&Y.bgColor?String(Y.bgColor).trim():"",a.setFieldsValue(nd(b.settings))}},[b,a]),(0,n.useEffect)(()=>()=>V(),[V]);const pe=(0,n.useCallback)(()=>{const Y=a.getFieldsValue(!0),re=b.settings||{},je=String(re.hostCellBgForIconLuminance??"").trim(),W=(Y.globalBgColor||"").trim(),Se=typeof Y.iconSize=="number"&&!Number.isNaN(Y.iconSize)?Y.iconSize:re.iconSize??40,Ie=typeof Y.borderRadius=="number"&&!Number.isNaN(Y.borderRadius)?Y.borderRadius:re.borderRadius??0,Pe=typeof Y.gap=="number"&&!Number.isNaN(Y.gap)?Y.gap:re.gap??8,Me={blockBgEnabled:!!W,blockBgColor:W},He=(Y.globalItemBorderColor||"").trim();let ze=typeof Y.buttonBorderWidth=="number"&&!Number.isNaN(Y.buttonBorderWidth)?Y.buttonBorderWidth:0;ze=Math.max(0,Math.min(24,Math.round(ze)));const ae={...re,type:"social",align:Y.align??re.align??"center",iconSize:Se,borderRadius:Ie,gap:Pe,bgEnabled:!!W,bgColor:W,hostCellBgForIconLuminance:je,borderWidth:typeof re.borderWidth=="number"?re.borderWidth:0,borderColor:typeof re.borderColor=="string"?re.borderColor:"",buttonBorderColor:"",buttonBorderWidth:ze,showLabel:Y.showLabel,items:(Y.items||[]).filter(Boolean).map((Be,v)=>{const ee=!!Be.customIcon,Te=X.current[v]||{},Ce=ee?"":td(W,(Be.buttonBgColor||"").trim()),De=typeof Be.href=="string"?vl(Be.href):Be.href,We=ee?"":Gt(W,Ce),Je=!ee&&Be.platform?r.getSocialIconForBlockCell(Be.platform,zt(Me,We,je)):null,M=ee?"":He||String(Be.itemBorderColor??"").trim(),J=Qn(ee?Be.iconSrc||"":Je||Be.iconSrc||"");return{...Be,customIcon:ee,href:De,iconSrc:J,iconWidth:null,iconHeight:null,buttonBgColor:Ce,itemBorderColor:M,title:Te.title?String(Be.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:b.caption,settings:ae}),O.current=W,le.current=!0,f(Be=>({...Be,settings:ae}))},[b.caption,b.settings,a,d]),be=(0,n.useCallback)(Y=>{if(Y==null||Y==="")return-1;const re=r.stripEmVersionFromUrlString(String(Y));return(a.getFieldValue("items")||[]).findIndex(je=>r.stripEmVersionFromUrlString(je&&je.iconSrc||"")===re)},[a]),xe=(0,n.useCallback)((Y,re,je,W)=>{const Se=[...a.getFieldValue("items")||[]];if(Y<0||Y>=Se.length)return;const Ie=r.stripEmVersionFromUrlString(String(W||""))===r.stripEmVersionFromUrlString(String(re||""));(!Ie||re!==Se[Y]?.iconSrc)&&(Se[Y]={...Se[Y],iconSrc:re,customIcon:!0,buttonBgColor:"",itemBorderColor:""},a.setFieldValue("items",Se),setTimeout(()=>pe(),0)),je?.mode==="save"&&Ie&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(re)})},[a,pe,c]),Re=(0,n.useCallback)(async(Y,re)=>{const je=r.stripEmVersionFromUrlString(String(re||"")),W=be(re);if(W<0)return;const Se=(a.getFieldValue("items")||[])[W]?.iconSrc,{entryModal:Ie,currentUrl:Pe,imageDataUrl:Me}=await Il(je,Y),He=await m({kind:"img",currentUrl:Pe,entryModal:Ie,imageDataUrl:Me});He?.url&&xe(W,He.url,He.meta,Se)},[xe,be,a,m]),oe=(0,n.useCallback)(async Y=>{const re=(a.getFieldValue("items")||[])[Y];if(!re)return;const{entryModal:je,currentUrl:W,imageDataUrl:Se}=await Il(r.stripEmVersionFromUrlString(String(re.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),Ie=re.iconSrc,Pe=await m({kind:"img",currentUrl:W,entryModal:je,imageDataUrl:Se});Pe?.url&&xe(Y,Pe.url,Pe.meta,Ie)},[xe,a,m]),Ve=(0,n.useCallback)(Y=>{const re=parseInt(Y.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(re)||oe(re)},[oe]),Oe=(0,n.useCallback)(Y=>{const re=Y.data?.operation,je=Y.data?.src;re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_AI,je):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,je):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,je):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,je):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,je):re===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,Re]);r.useListenPostMessage(Oe);const ye=(0,n.useCallback)(()=>{const Y=a.getFieldValue("items")||[],re=R[0],je=(a.getFieldValue("globalItemBorderColor")||"").trim(),W=(a.getFieldValue("globalBgColor")||"").trim();if(!re)a.setFieldsValue({items:[...Y,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:W,itemBorderColor:je}]});else{const Se=String(b?.settings?.hostCellBgForIconLuminance??"").trim(),Ie=Gt(W,W),Pe=r.getSocialIconForBlockCell(re.id,zt({blockBgEnabled:!!W,blockBgColor:W},Ie,Se)),Me=i(re.labelMsgid);a.setFieldsValue({items:[...Y,{platform:re.id,customIcon:!1,href:"",alt:Me,title:"",iconSrc:Pe,iconWidth:null,iconHeight:null,buttonBgColor:W,itemBorderColor:je}]})}setTimeout(()=>pe(),0)},[i,b?.settings?.hostCellBgForIconLuminance,a,R,pe]),he=(0,n.useCallback)((Y,re)=>{Y.dataTransfer.setData(jl,String(re)),Y.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(re)),Y.dataTransfer.effectAllowed="move",_.current=re,h(re),te()},[te]),me=(0,n.useCallback)(()=>{V(),_.current=null,h(null),S(null)},[V]),ie=(0,n.useCallback)((Y,re,je)=>{if(je<2)return;Y.preventDefault(),Y.dataTransfer.dropEffect="move";const W=_.current;W!==null&&W!==re&&S(re)},[]),Q=(0,n.useCallback)((Y,re)=>{Y.currentTarget.contains(Y.relatedTarget)||S(je=>je===re?null:je)},[]),se=(0,n.useCallback)((Y,re,je)=>{Y.preventDefault(),S(null);const W=Y.dataTransfer.getData(jl),Se=parseInt(W,10);if(Number.isNaN(Se)||Se===re){V();return}je(Se,re),V(),setTimeout(()=>pe(),0)},[V,pe]),ne=(0,n.useCallback)(Y=>{const re=Y.currentTarget,je=parseInt(re.dataset.itemIndex??"",10);Number.isNaN(je)||he(Y,je)},[he]),K=(0,n.useCallback)(Y=>{const re=Y.currentTarget,je=parseInt(re.dataset.itemIndex??"",10),W=parseInt(re.dataset.listLength??"",10);Number.isNaN(je)||Number.isNaN(W)||W<2||(Y.preventDefault(),Y.dataTransfer&&(Y.dataTransfer.dropEffect="move"))},[]),z=(0,n.useCallback)(Y=>{const re=Y.currentTarget,je=parseInt(re.dataset.itemIndex??"",10),W=parseInt(re.dataset.listLength??"",10);Number.isNaN(je)||Number.isNaN(W)||ie(Y,je,W)},[ie]),q=(0,n.useCallback)(Y=>{const re=parseInt(Y.currentTarget.dataset.itemIndex??"",10);Number.isNaN(re)||Q(Y,re)},[Q]),ue=(0,n.useCallback)(Y=>{const re=parseInt(Y.currentTarget.dataset.itemIndex??"",10),je=B.current;Number.isNaN(re)||typeof je!="function"||se(Y,re,je)},[se]),_e=(0,n.useCallback)(Y=>{Y.stopPropagation();const re=parseInt(Y.currentTarget.dataset.fieldName??"",10),je=T.current;Number.isNaN(re)||typeof je!="function"||(je(re),queueMicrotask(pe))},[pe]),fe=(0,n.useCallback)((Y,re)=>{const je=R.find(ae=>ae.id===re);if(!je)return;const W=i(je.labelMsgid),Se=X.current[Y]||{},Ie=String(a.getFieldValue(["items",Y,"alt"])??"").trim();(Se.alt||Ie)&&a.setFieldValue(["items",Y,"alt"],W),Se.title&&a.setFieldValue(["items",Y,"title"],W);const Pe=(a.getFieldValue("globalBgColor")||"").trim(),Me=Gt(Pe,(a.getFieldValue(["items",Y,"buttonBgColor"])||"").trim()),He=String(b?.settings?.hostCellBgForIconLuminance??"").trim(),ze=r.getSocialIconForBlockCell(re,zt({blockBgEnabled:!!Pe,blockBgColor:Pe},Me,He));ze&&(a.setFieldValue(["items",Y,"customIcon"],!1),a.setFieldValue(["items",Y,"iconSrc"],ze))},[i,b?.settings?.hostCellBgForIconLuminance,a,R]),Le=(0,n.useCallback)(Y=>{if(Object.prototype.hasOwnProperty.call(Y,"globalItemBorderColor")){if(!C.current){const re=String(Y.globalItemBorderColor??"").trim(),je=a.getFieldValue("items")||[];a.setFieldsValue({items:rd(je,re)})}}else if(Object.prototype.hasOwnProperty.call(Y,"globalBgColor")){const re=O.current,je=String(Y.globalBgColor??"").trim(),W=a.getFieldValue("items")||[];a.setFieldsValue({items:ld(W,re,je)})}else if(Y?.items!=null){const re=a.getFieldValue("items")||[],je=Pl(re);je!==(a.getFieldValue("globalItemBorderColor")||"").trim()&&(C.current=!0,a.setFieldValue("globalItemBorderColor",je),queueMicrotask(()=>{C.current=!1}));const W=b.settings?.items||[];re.forEach((Se,Ie)=>{const Pe=Se?.platform,Me=W[Ie]?.platform;Pe&&Pe!==Me&&fe(Ie,Pe)})}sd(Y?.items,fe),pe()},[b.settings?.items,a,pe,fe]),we=(0,n.useCallback)((Y,re)=>{if(a.setFieldValue(Y,re),Array.isArray(Y)&&Y[0]==="items"){Le({items:{[Y[1]]:{[Y[2]]:re}}});return}Le({[Y]:re})},[a,Le]),Ne=(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)(Vo,{form:a,elementSettings:{...b,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)(Wt,{form:a,name:"globalBgColor",placeholder:i("Background color"),usedColors:F,onColorChange:we})})})})]}),(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)(Wt,{form:a,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:F,onColorChange:we})})})})]})]}),(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:(Y,{remove:re,move:je})=>(B.current=je,T.current=re,(0,o.jsx)("div",{className:"selected-social-form__items",children:Y.map((W,Se)=>{const Ie=!!($[Se]?.customIcon??$[W.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,Ue.default)("selected-social-form__card",E===Se&&"selected-social-form__card--dragging",p===Se&&E!==Se&&"selected-social-form__card--drag-over"),"data-item-index":Se,"data-list-length":Y.length,onDragEnterCapture:K,onDragOverCapture:z,onDragLeave:q,onDropCapture:ue,children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head-main",children:[Y.length>1?(0,o.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":Se,onDragStart:ne,onDragEnd:me,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)(Yn,{className:"selected-social-form__card-title",children:[i("Button")," ",Se+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:_e})})]}),(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:Z,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":Se,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:Ve})})]}),(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(Pe,Me)=>{const He=typeof Me=="string"?Me.trim():String(Me??"").trim();if(He&&!Zn(He))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,{})}})}),Ie?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)(Wt,{form:a,name:["items",W.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:F,onColorChange:we})})})}),(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)(Wt,{form:a,name:["items",W.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:F,onColorChange:we})})})})]}),(0,o.jsx)(Al,{__:i,form:a,fieldName:W.name,pushSettingsToIframe:pe,onMetaActiveChange:ge})]},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:ye,children:i("Add button")})]})]});return(0,o.jsx)("div",{className:"selected-social-form",children:(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:Le,autoComplete:"off",children:(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:Ne})})})};Nl.propTypes={elementSettings:g.default.shape({settings:g.default.object,type:g.default.string,caption:g.default.string})};var Ll=r.BASIC_BORDER_COLOR,dd=(e,i,l,s,a,d,c="")=>{const m=e.getFieldsValue(!0),b=i?"cell_":c;setTimeout(()=>{i?s(f=>!f):l(f=>!f),a&&(m[b+"borderWidth"]=null,m[b+"borderColor"]="",m[b+"borderStyle"]=""),d(f=>({...r.RESET_BORDER_PARAMS,[m[b+"borderPosition"]]:{...f[m[b+"borderPosition"]],width:m[b+"borderWidth"],color:m[b+"borderColor"],style:m[b+"borderStyle"]}}))})},cd=(e,i,l,s,a,d,c)=>{const m=e.getFieldsValue(!0);setTimeout(()=>{i(b=>!b),!l&&!s[m?.mobileBorderPosition]?.color&&(m.mobileBorderStyle="solid",m.mobileBorderWidth=1,m.mobileBorderColor=Ll,a(b=>({...s,[m?.mobileBorderPosition]:{color:Ll,style:"solid",width:1}}))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,settings:{mobileBorder:{...s,[m?.mobileBorderPosition]:{color:m.mobileBorderColor,style:m.mobileBorderStyle,width:m.mobileBorderWidth}}}})})},ud=(e,i,l,s,a,d,c="")=>{const m=e.getFieldsValue(!0);setTimeout(()=>{i(b=>!b),l?(m[c+"borderRadiusAll"]=0,s(!0)):m[c+"borderRadiusAll"]||(m[c+"borderRadiusAll"]=0),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:d.type,settings:{borderRadius:{all:m[c+"borderRadiusAll"]}}})})},md=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBorderRadiusAll&&!d.mobileBorderRadiusTopLeft&&!d.mobileBorderRadiusTopRight&&!d.mobileBorderRadiusBottomRight&&!d.mobileBorderRadiusBottomLeft&&(d.mobileBorderRadiusAll=0),["all","topLeft","topRight","bottomRight","bottomLeft"].forEach(c=>{if(!d.mobileBorderRadius?.[c])return;const m=`mobileBorderRadius${c[0].toUpperCase()}${c.slice(1)}`;s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBorderRadius:{[c]:d[m],classNamePrefix:`em-mob-border_radius_${c}-`}}})})})},pd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.boxShadowColor?(d.boxShadowInset=!1,d.boxShadowHOffset=5,d.boxShadowVOffset=5,d.boxShadowBlurRadius=10,d.boxShadowSpreadRadius=-5,d.boxShadowColor="#000000"):l&&(d.boxShadowInset=!1,d.boxShadowHOffset=null,d.boxShadowVOffset=null,d.boxShadowBlurRadius=null,d.boxShadowSpreadRadius=null,d.boxShadowColor=""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{boxShadow:{blurRadius:d.boxShadowBlurRadius,color:d.boxShadowColor,hOffset:d.boxShadowHOffset,inset:d.boxShadowInset,spreadRadius:d.boxShadowSpreadRadius,vOffset:d.boxShadowVOffset}}})})},hd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBoxShadowColor&&(d.mobileBoxShadowInset=!1,d.mobileBoxShadowHOffset=5,d.mobileBoxShadowVOffset=5,d.mobileBoxShadowBlurRadius=10,d.mobileBoxShadowSpreadRadius=-5,d.mobileBoxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBoxShadow:{blurRadius:d.mobileBoxShadowBlurRadius,color:d.mobileBoxShadowColor,hOffset:d.mobileBoxShadowHOffset,inset:d.mobileBoxShadowInset,spreadRadius:d.mobileBoxShadowSpreadRadius,vOffset:d.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},bd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileWidth&&(d.mobileWidth=""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileWidth:{value:d.mobileWidth,dim:d.mobileWidthDim,classNamePrefix:"em-mob-width-"}}})})},fd=e=>{setTimeout(()=>{e(i=>!i)})},gd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBackgroundColor&&(d.mobileBackgroundColor="#E5E5E5"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:d.mobileBackgroundColor}}}),l&&Bt(e,a,s)})},_d=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),l&&(d.paddingLeftRight="",d.paddingLeft="",d.paddingRight="",d.paddingTopBottom="",d.paddingTop="",d.paddingBottom="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{padding:{all:0}}}))})},xd=(e,i,l,s,a)=>{i(c=>!c);const d=e.getFieldsValue(!0);l||(d.paddingLeftRight=d.paddingLeft,d.paddingTopBottom=d.paddingTop,d.paddingRight=d.paddingLeft,d.paddingBottom=d.paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{padding:{top:d.paddingTopBottom,bottom:d.paddingTopBottom,left:d.paddingLeftRight,right:d.paddingLeftRight}}}))},kd=e=>{setTimeout(()=>{e(i=>!i)})},Ed=(e,i,l,s,a)=>{i(c=>!c);const d=e.getFieldsValue(!0);l||(d.cell_paddingLeftRight=d.cell_paddingLeft,d.cell_paddingTopBottom=d.cell_paddingTop,d.cell_paddingRight=d.cell_paddingLeft,d.cell_paddingBottom=d.cell_paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{cell_padding:{top:d.cell_paddingTopBottom,bottom:d.cell_paddingTopBottom,left:d.cell_paddingLeftRight,right:d.cell_paddingLeftRight}}})),(l&&d.cell_paddingLeftRight||d.cell_paddingLeftRight===0)&&(d.cell_paddingLeft=d.cell_paddingLeftRight,d.cell_paddingRight=d.cell_paddingLeftRight),(l&&d.cell_paddingTopBottom||d.cell_paddingTopBottom===0)&&(d.cell_paddingTop=d.cell_paddingTopBottom,d.cell_paddingBottom=d.cell_paddingTopBottom)},Bd=({form:e,onBorderSideClear:i,formName:l,elementSettings:s,formValues:a,isMacOS:d,__:c,token:m,appConfig:b,typografItems:f,backgroundRepeatOptions:E,backgroundSizeOptions:h,sendAction:p,handleToggleShowPaddingCell:S,handleTogglePaddingCell:_,handleToggleBackground:B,handleToggleBorder:T,handleToggleBorderRadius:I,paddingCellShow:P,paddingsExt:y,backgroundShow:C,cellBordersShow:O,borderRadiusShow:X,oneBorderRadiusValue:H,setOneBorderRadiusValue:F,textInputRef:$,linkProtocol:V,handleLinkProtocolsChange:te,backgroundImageEmpty:R})=>{const Z=U.useGoogleFontsLoader();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$FormSection,{title:c("Text"),dividerTop:!1,children:[b.formTextFieldTypografEnabled&&(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:{marginBottom:m.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>p("add_img"),style:{width:"100%"},children:c("Add image")})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:m.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:f},trigger:["hover"],placement:"bottom",getPopupContainer:ge=>ge.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:()=>p("typograf"),style:{width:"100%"},children:c("Typography")})})})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text font"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.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:Z,getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper")})})}),!s.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:c("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:c("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:c("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:c("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)(Ze,{form:e,elementSettings:s,name:"textStrong",tooltipTitle:c(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)(Ze,{form:e,elementSettings:s,name:"textItalic",tooltipTitle:c(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)(Ze,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:c(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)(Ze,{form:e,elementSettings:s,name:"textUnderline",tooltipTitle:c(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.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(Ze,{form:e,className:(0,Ue.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof s.linkHref=="string"}),elementSettings:s,name:"textLink",tooltipTitle:c("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),a?.textLink&&(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsx)(Zo,{show:V==="#",__:c,style:{marginBottom:m.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("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:$,addonBefore:(0,o.jsx)(Qo,{linkProtocol:V,handleLinkProtocolsChange:te,__:c}),allowClear:!0,placeholder:c("Hyperlink URL"),autoFocus:s?.customTable?.isNewLink,prefix:(0,o.jsx)(Jo,{linkProtocol:V})})})})]})}),(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:c("Text color"),placement:"bottom",zIndex:2,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:c("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:c("Color"),usedColors:s.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text background"),placement:"bottom",zIndex:2,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:c("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:c("Background color"),usedColors:s.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)(tt,{form:e,elementSettings:s,name:"textAlign"})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Fo,{form:e,elementSettings:s,name:"valign",isNewIconType:!0})})]})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Padding"),collapsible:!0,open:P,onToggle:S,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:y,onToggleExtended:_,gutter:m.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:c("Horizontal padding"),vertical:c("Vertical padding"),left:c("Left padding"),right:c("Right padding"),top:c("Top padding"),bottom:c("Bottom padding"),individual:c("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Background"),collapsible:!0,open:C,onToggle:B,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:b.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:R,usedColors:s.usedColors,colorPlaceholder:c("Background color"),horizontalPositionPlaceholder:c("Horizontal position"),horizontalPositionTooltip:c("Horizontal position"),verticalPositionPlaceholder:c("Vertical position"),verticalPositionTooltip:c("Vertical position"),backgroundRepeatTooltip:c("Background image repeat"),backgroundSizeTooltip:c("Background image size"),selectPlaceholder:c("Please choose"),backgroundRepeatOptions:E,backgroundSizeOptions:h,imageUploadSlot:(b.formTableFieldBackgroundImageEnabled,void 0)})}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Borders"),collapsible:!0,open:O,onToggle:T,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,namePrefix:"cell_"})}),b.formFieldBorderRadiusEnabled&&!1]})},Ol=({form:e,onBorderSideClear:i,elementSettings:l,paddingShow:s,paddingsExt:a,backgroundShow:d,bordersShow:c,borderRadiusShow:m,boxShadowShow:b,handleToggleShowPadding:f,handleTogglePadding:E,handleToggleBackground:h,handleToggleBorder:p,handleToggleBorderRadius:S,handleToggleBoxShadow:_,backgroundRepeatOptions:B,backgroundSizeOptions:T,backgroundImageEmpty:I,oneBorderRadiusValue:P,setOneBorderRadiusValue:y,boxShadow:C})=>{const{__:O}=r.useI18n(),X=r.useAppConfig(),{token:H}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:O("Padding"),collapsible:!0,open:s,onToggle:f,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:a,onToggleExtended:E,gutter:H.marginSM,labels:{horizontal:O("Horizontal padding"),vertical:O("Vertical padding"),left:O("Left padding"),right:O("Right padding"),top:O("Top padding"),bottom:O("Bottom padding"),individual:O("Individual padding")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:O("Background"),collapsible:!0,open:d,onToggle:h,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:X.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:I,usedColors:l.usedColors,colorPlaceholder:O("Background color"),horizontalPositionPlaceholder:O("Horizontal position"),horizontalPositionTooltip:O("Horizontal position"),verticalPositionPlaceholder:O("Vertical position"),verticalPositionTooltip:O("Vertical position"),backgroundRepeatTooltip:O("Background image repeat"),backgroundSizeTooltip:O("Background image size"),selectPlaceholder:O("Please choose"),backgroundRepeatOptions:B,backgroundSizeOptions:T,imageUploadSlot:X.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Ao,{form:e,label:O("Background image"),name:"backgroundImage",tooltipTitle:O("Background image"),placeholder:O("Background image link/route")}):void 0}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:O("Borders"),collapsible:!0,open:c,onToggle:p,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,onBorderSideClear:i})}),X.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Border radius"),collapsible:!0,open:m,onToggle:S,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:P,setOneBorderRadiusValue:y,elementSettings:l})}),X.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Box shadow"),collapsible:!0,open:b,onToggle:_,dividerTop:!0,children:(0,o.jsx)(jo,{})}),X.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:l,form:e})})]})};Ol.propTypes={form:g.default.object.isRequired,onBorderSideClear:g.default.func,elementSettings:g.default.object.isRequired,paddingShow:g.default.bool,paddingsExt:g.default.bool,backgroundShow:g.default.bool,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,handleToggleShowPadding:g.default.func,handleTogglePadding:g.default.func,handleToggleBackground:g.default.func,handleToggleBorder:g.default.func,handleToggleBorderRadius:g.default.func,handleToggleBoxShadow:g.default.func,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,backgroundImageEmpty:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,boxShadow:g.default.object};var $l=({form:e,elementSettings:i,mobileSizeShow:l,mobileBackgroundShow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:m,handleToggleMobileBackground:b,handleToggleMobileBorder:f,handleToggleMobileBorderRadius:E,handleToggleMobileBoxShadow:h,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:S,mobileBorders:_,mobileBoxShadow:B})=>{const{__:T,_x:I}=r.useI18n(),P=r.useAppConfig(),{token:y}=(0,t.ui_kit$useToken)(),C=r.useSelector(r.selectEmailSettings);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:T("Size"),collapsible:!0,open:l,onToggle:m,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:T("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:y.formItemMarginBottomMD+4},children:(0,o.jsx)(Uo,{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:y.formItemMarginBottomXS*2},children:(0,o.jsx)(t.ui_kit$Tooltip,{title:T("Height"),placement:"bottom",children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:T("Background"),collapsible:!0,open:s,onToggle:b,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:Wo(i),imageEnabled:P.formTableFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),P.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:T("Borders"),collapsible:!0,open:a,onToggle:f,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:_,usedColors:C.usedColors,labels:{color:T("Color"),width:I("Width","border"),none:T("None"),solid:T("Solid"),dashed:T("Dashed"),dotted:T("Dotted"),above:T("Above"),below:T("Below"),onLeft:T("On the left"),onRight:T("On the right"),around:T("Around"),usedColors:T("Used"),recommendedColors:T("Recommended")}})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:T("Border radius"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(To,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:p,setOneBorderRadiusValue:S,elementSettings:i})}),P.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:T("Box shadow"),collapsible:!0,open:c,onToggle:h,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),P.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:T("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})})]})};$l.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,handleToggleMobileSize:g.default.func,handleToggleMobileBackground:g.default.func,handleToggleMobileBorder:g.default.func,handleToggleMobileBorderRadius:g.default.func,handleToggleMobileBoxShadow:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,mobileBorders:g.default.object,mobileBoxShadow:g.default.object};var Sd=({form:e,onBorderSideClear:i,elementViewType:l,mobileViewActive:s,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:m,bordersShow:b,borderRadiusShow:f,boxShadowShow:E,mobileSizeShow:h,mobileBackgroundShow:p,mobileBordersShow:S,mobileBorderRadiusShow:_,mobileBoxShadowShow:B,handleToggleShowPadding:T,handleTogglePadding:I,handleToggleBackground:P,handleToggleBorder:y,handleToggleBorderRadius:C,handleToggleBoxShadow:O,handleToggleMobileSize:X,handleToggleMobileBackground:H,handleToggleMobileBorder:F,handleToggleMobileBorderRadius:$,handleToggleMobileBoxShadow:V,backgroundRepeatOptions:te,backgroundSizeOptions:R,backgroundImageEmpty:Z,oneBorderRadiusValue:ge,setOneBorderRadiusValue:le,oneMobileBorderRadiusValue:pe,setOneMobileBorderRadiusValue:be,boxShadow:xe,mobileBorders:Re,mobileBoxShadow:oe})=>(0,o.jsx)(o.Fragment,{children:l==="mobile"&&s.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)($l,{form:e,elementSettings:a,mobileSizeShow:h,mobileBackgroundShow:p,mobileBordersShow:S,mobileBorderRadiusShow:_,mobileBoxShadowShow:B,handleToggleMobileSize:X,handleToggleMobileBackground:H,handleToggleMobileBorder:F,handleToggleMobileBorderRadius:$,handleToggleMobileBoxShadow:V,oneMobileBorderRadiusValue:pe,setOneMobileBorderRadiusValue:be,mobileBorders:Re,mobileBoxShadow:oe})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Ol,{form:e,onBorderSideClear:i,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:m,bordersShow:b,borderRadiusShow:f,boxShadowShow:E,handleToggleShowPadding:T,handleTogglePadding:I,handleToggleBackground:P,handleToggleBorder:y,handleToggleBorderRadius:C,handleToggleBoxShadow:O,backgroundRepeatOptions:te,backgroundSizeOptions:R,backgroundImageEmpty:Z,oneBorderRadiusValue:ge,setOneBorderRadiusValue:le,boxShadow:xe})})}),Td=["borderTop","borderBottom","borderLeft","borderRight"],Fl=({elementSettings:e,formName:i})=>{const{__:l}=r.useI18n(),s=r.useSendPostMessage(),[a]=t.ui_kit$Form.useForm(),{token:d}=(0,t.ui_kit$useToken)(),c=r.useAppConfig(),m=r.useSelector(r.selectEmailViewType),b=r.useSelector(r.selectMobileViewActive),f=r.useSelector(r.selectIsCodeMode),E=r.useSelector(r.selectCodeModeDirection),[h,p]=(0,n.useState)({}),[S,_]=(0,n.useState)(!0),[B,T]=(0,n.useState)({}),[I,P]=(0,n.useState)({}),[y,C]=(0,n.useState)(!0),[O,X]=(0,n.useState)(e.customTable?.backgroundImage[0].value===""),[H,F]=(0,n.useState)(),[$,V]=(0,n.useState)(!1),[te,R]=(0,n.useState)(!1),[Z,ge]=(0,n.useState)(!1),[le,pe]=(0,n.useState)(!1),[be,xe]=(0,n.useState)(!1),[Re,oe]=(0,n.useState)(!1),[Ve,Oe]=(0,n.useState)(!1),[ye,he]=(0,n.useState)(!1),[me,ie]=(0,n.useState)(!0),[Q,se]=(0,n.useState)(!0),[ne,K]=(0,n.useState)(!0),[z,q]=(0,n.useState)(!1),[ue,_e]=(0,n.useState)("https://"),[fe,Le]=(0,n.useState)({}),[we,Ne]=(0,n.useState)(!1),[Y,re]=(0,n.useState)(!1),[je,W]=(0,n.useState)(!1),[Se,Ie]=(0,n.useState)({}),Pe=(0,n.useRef)(null),Me=(0,n.useRef)(),He=t.ui_kit$Form.useWatch([],a),ze=[{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"}],ae=[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],Be={width:"",style:"",color:""},v=f&&E!=="bottom",ee=r.BASIC_BORDER_COLOR,Te=i==="Edit selected table cells"||!1,[Ce,De]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&De(!0)},[]);const We=L=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:L,locale:"ru_RU"})},Je=[{key:"1",label:l("This element"),onClick:()=>We("typograf")},{key:"2",label:l("The whole email"),onClick:()=>We("typograf_all")}];let M="";(0,n.useEffect)(()=>{if(e){Et(e)&&he(!0);const L=e.border,k=e.boxShadow,G=e.customTable?.mobileBorder,de=e.customTable?.mobileBoxShadow,Ge=e.customTable?.cellBorders;Ie(L),p(k),T(G),P(de),Le(Ge);const $e=Te?e?.customTable?.cell_borderPosition:e?.customTable?.borderPosition,ao=Object.keys(G).find(Eo=>G[Eo]?.width||G[Eo]?.style||G[Eo]?.color);a.setFieldsValue({...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,show:e.show?e.show:"all",mobileAlign:e.mobileAlign?.value,mobileBorderPosition:ao||"all",mobileBorderWidth:G[ao]?.width!==null?G[ao]?.width:"",mobileBorderColor:G[ao]?.color||"",mobileBorderStyle:G[ao]?.style||"",...nt(e),exportAsPicture:e?.exportAsPicture,paddingLeftRight:u(e.customTable?.paddingLeftRight.replace(/px$/,"")),paddingTopBottom:u(e.customTable?.paddingTopBottom.replace(/px$/,"")),paddingRight:u(e.customTable?.paddingRight.replace(/px$/,"")),paddingLeft:u(e.customTable?.paddingLeft.replace(/px$/,"")),paddingTop:u(e.customTable?.paddingTop.replace(/px$/,"")),paddingBottom:u(e.customTable?.paddingBottom.replace(/px$/,"")),backgroundColor:u(e.customTable?.backgroundColor),backgroundImage:u(e.customTable?.backgroundImage[0].value),backgroundPositionX:u(e.customTable?.backgroundPositionX),backgroundPositionY:u(e.customTable?.backgroundPositionY),backgroundRepeat:u(e.customTable?.backgroundRepeat),backgroundSize:u(e.customTable?.backgroundSize),borderAll:u(e.customTable?.borderAll),borderRadiusAll:u(e.customTable?.borderRadius.all),borderRadiusTopLeft:u(e.customTable?.borderRadius.topLeft),borderRadiusBottomLeft:u(e.customTable?.borderRadius.bottomLeft),borderRadiusTopRight:u(e.customTable?.borderRadius.topRight),borderRadiusBottomRight:u(e.customTable?.borderRadius.bottomRight),borderRadius:{all:u(e.customTable?.borderRadius.all),topLeft:u(e.customTable?.borderRadius.topLeft),topRight:u(e.customTable?.borderRadius.topRight),bottomLeft:u(e.customTable?.borderRadius.bottomLeft),bottomRight:u(e.customTable?.borderRadius.bottomRight)},borderTop:u(e.customTable?.borderTop),borderBottom:u(e.customTable?.borderBottom),borderLeft:u(e.customTable?.borderLeft),borderRight:u(e.customTable?.borderRight),borderPosition:$e||"borderAll",boxShadowInset:u(e.customTable?.boxShadow?.inset)||!1,boxShadowHOffset:u(e.customTable?.boxShadow?.hOffset),boxShadowVOffset:u(e.customTable?.boxShadow?.vOffset),boxShadowBlurRadius:u(e.customTable?.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.customTable?.boxShadow?.spreadRadius),boxShadowColor:u(e.customTable?.boxShadow?.color),mobileBoxShadowInset:u(e.customTable?.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.customTable?.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.customTable?.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.customTable?.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.customTable?.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.customTable?.mobileBoxShadow?.color),mobileBackgroundColor:u(e.customTable?.mobileBackgroundColor?.value!=="none"?e.customTable?.mobileBackgroundColor?.value:""),mobileWidth:mo(e.customTable?.mobileWidth?.value),mobileWidthDim:e.customTable?.mobileWidth?.dim,mobileHeight:mo(e.customTable?.mobileHeight?.value),mobileHeightDim:e.customTable?.mobileHeight?.dim,mobileBorderRadiusAll:u(e.customTable?.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.customTable?.mobileBorderRadius.topLeft!==null?e.customTable?.mobileBorderRadius.topLeft:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.customTable?.mobileBorderRadius.bottomLeft!==null?e.customTable?.mobileBorderRadius.bottomLeft:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.customTable?.mobileBorderRadius.topRight!==null?e.customTable?.mobileBorderRadius.topRight:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.customTable?.mobileBorderRadius.bottomRight!==null?e.customTable?.mobileBorderRadius.bottomRight:e.customTable?.mobileBorderRadius.all),cellBackgroundColor:u(e.customTable?.cellBackgroundColor),cell_borderPosition:u("cell_borderAll"),cell_borderAll:u(e.customTable?.cell_borderAll),cell_borderTop:u(e.customTable?.cell_borderTop),cell_borderBottom:u(e.customTable?.cell_borderBottom),cell_borderLeft:u(e.customTable?.cell_borderLeft),cell_borderRight:u(e.customTable?.cell_borderRight),cell_paddingLeftRight:u(e.customTable?.cell_paddingLeftRight?.replace(/px$/,"")),cell_paddingTopBottom:u(e.customTable?.cell_paddingTopBottom?.replace(/px$/,"")),cell_paddingRight:u(e.customTable?.cell_paddingRight?.replace(/px$/,"")),cell_paddingLeft:u(e.customTable?.cell_paddingLeft?.replace(/px$/,"")),cell_paddingTop:u(e.customTable?.cell_paddingTop?.replace(/px$/,"")),cell_paddingBottom:u(e.customTable?.cell_paddingBottom?.replace(/px$/,"")),fontFamily:u(e.customTable?.fontFamily),fontSize:u(e.customTable?.fontSize),lineHeight:u(e.customTable?.lineHeight),textStrong:u(e.customTable?.textStrong),textItalic:u(e.customTable?.textItalic),textStrikethrough:u(e.customTable?.textStrikethrough),textUnderline:u(e.customTable?.textUnderline),textLink:u(e.customTable?.textLink),linkHref:u(e.customTable?.linkHref),linkTarget:u(e.customTable?.linkTarget),textColor:u(e.customTable?.textColor),textBackgroundColor:u(e.customTable?.textBackgroundColor),textAlign:u(e.customTable?.textAlign),valign:u(e.customTable?.textValign)}),!u(e.customTable?.borderRadius.all)&&(u(e.customTable?.borderRadius.topLeft)||u(e.customTable?.borderRadius.bottomLeft)||u(e.customTable?.borderRadius.topRight)||u(e.customTable?.borderRadius.bottomRight))?_(!1):_(!0),!u(e.customTable?.mobileBorderRadius.all)&&u(e.customTable?.mobileBorderRadius.topLeft)||u(e.customTable?.mobileBorderRadius.bottomLeft)||u(e.customTable?.mobileBorderRadius.topRight)||u(e.customTable?.mobileBorderRadius.bottomRight)?C(!1):C(!0),X(e.customTable?.backgroundImage[0].value===""),F(Eo=>L[$e]?.width||L[$e]?.style||L[$e]?.color?!0:Eo),R(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),pe(!!e.boxShadow),W(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),oe(!!e.customTable?.mobileWidth.value),re(!!e.exportAsPicture)}},[a,e]),(0,n.useEffect)(()=>{const L=a.getFieldValue("linkHref");typeof e.customTable?.linkHref=="string"&&Ne(!0),Pe&&!L&&(Ne(!1),a.setFieldsValue({linkHref:null})),Pe.current=L||null},[He?.textLink,He?.linkHref,e.customTable?.linkHref,a]),(0,n.useEffect)(()=>{e.customTable?.linkHref&&Ho(e.customTable?.linkHref||"",_e),a.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[a,e,_e]);const J=L=>{a.setFieldValue("linkHref",L!=="mergetag"?L:""),_e(L)},j=L=>{const k=a.getFieldsValue(!0),G=Object.keys(L)[0];let de;const Ge=Td.includes(G)&&k[G]?{...k[G],width:k[G].width===""?k.borderAll?.width||"1":k[G].width,color:k[G].color===""?k.borderAll?.color||ee:k[G].color,style:k[G].style===""?k.borderAll?.style||"solid":k[G].style}:null,$e=["top","right","bottom","left"],ao="em-mob-border_",Eo=Bo=>({...r.RESET_BORDER_PARAMS[Bo],classNamePrefix:`${ao}${Bo}-`}),Xo=(Bo,so,yo,Ko)=>$e.reduce((ko,Do)=>(ko[Do]={...Bo,[yo]:Do===so?Ko:Bo[yo],classNamePrefix:`${ao}${Do}-`},ko),{}),Co=(Bo,so,yo,Ko)=>{const ko=Ko.mobileBorderPosition,Do=ko==="all",It=so===""||so==null;let No;Do?No={all:{...yo.all,[Bo]:It?null:so,classNamePrefix:`${ao}all-`},...$e.reduce((ni,Ct)=>({...ni,[Ct]:Eo(Ct)}),{})}:It?No={...yo,[ko]:Eo(ko),all:{...r.RESET_BORDER_PARAMS.all}}:yo.all?.color!=null&&yo.all?.width!=null&&yo.all?.style!=null?No={...Xo(yo.all,ko,Bo,so),all:{...r.RESET_BORDER_PARAMS.all}}:No={...yo,[ko]:{...yo[ko],[Bo]:so,classNamePrefix:`${ao}${ko}-`},all:{...r.RESET_BORDER_PARAMS.all}};const rt=Do?No.all:No[ko],ai={mobileBorderColor:rt?.color??ee,mobileBorderWidth:rt?.width??1,mobileBorderStyle:rt?.style??"solid"};return{newBorders:No,sending:{mobileBorder:No},formUpdates:ai}};switch(G){case"exportAsPicture":de={exportAsPicture:k.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":de={boxShadow:{hOffset:k.boxShadowHOffset,vOffset:k.boxShadowVOffset,blurRadius:k.boxShadowBlurRadius,spreadRadius:k.boxShadowSpreadRadius,color:k.boxShadowColor,inset:k.boxShadowInset}};break;case"width":de={[G]:{value:L[G],dim:k.widthDim}};break;case"widthDim":de={width:{value:k.width,dim:L[G]}};break;case"maxWidth":de={[G]:{value:L[G],dim:k.maxWidthDim}};break;case"maxWidthDim":de={maxWidth:{value:k.maxWidth,dim:L[G]}};break;case"minWidth":de={[G]:{value:L[G],dim:k.minWidthDim}};break;case"minWidthDim":de={minWidth:{value:k.minWidth,dim:L[G]}};break;case"backgroundImage":X(L[G]===""),de={[G]:[{...e.customTable?.backgroundImage[0],value:L[G]}],backgroundSize:"cover"},a.setFieldsValue({backgroundColor:""});break;case"backgroundColor":X(!0),de=L,a.setFieldsValue({backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":de={borderRadius:{[U.BORDER_RADIUS_POSITION[G]]:+L[G]}};break;case"mobileWidth":de={[G]:{classNamePrefix:"em-mob-width-",value:L[G],dim:k.mobileWidthDim}};break;case"mobileWidthDim":de={mobileWidth:{classNamePrefix:"em-mob-width-",value:k.mobileWidth||100,dim:L[G]}};break;case"mobileHeight":de={[G]:{classNamePrefix:"em-mob-height-",value:L[G],dim:k.mobileHeightDim}};break;case"mobileBorderStyle":case"mobileBorderColor":case"mobileBorderWidth":const Bo={mobileBorderStyle:"style",mobileBorderColor:"color",mobileBorderWidth:"width"}[G],{newBorders:so,sending:yo,formUpdates:Ko}=Co(Bo,L[G],B,k);Object.assign(k,Ko),T(so),de=yo;break;case"mobileBorderPosition":a.setFieldsValue({mobileBorderWidth:B[L[G]].width||"",mobileBorderColor:B[L[G]].color||"",mobileBorderStyle:B[L[G]].style||""});break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":de={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[G]]:L[G],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[G]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":de={mobileBoxShadow:{hOffset:k.mobileBoxShadowHOffset,vOffset:k.mobileBoxShadowVOffset,blurRadius:k.mobileBoxShadowBlurRadius,spreadRadius:k.mobileBoxShadowSpreadRadius,color:k.mobileBoxShadowColor,inset:k.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(de=xt(L),!de)return;break;case"mobileAlign":de={[G]:{classNamePrefix:"em-mob-table_align-",value:L[G]}};break;case"borderPosition":de=L,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:de});break;case"borderAll":L[G]?.style===""?a.setFieldsValue({borderAll:Be}):a.setFieldsValue({borderTop:Be,borderBottom:Be,borderLeft:Be,borderRight:Be}),de=L;break;case"borderTop":a.setFieldsValue({borderTop:Ge}),L[G]?.style===""?a.setFieldsValue({borderTop:Be}):a.setFieldsValue({borderAll:Be}),de=L;break;case"borderBottom":a.setFieldsValue({borderBottom:Ge}),L[G]?.style===""?a.setFieldsValue({borderBottom:Be}):a.setFieldsValue({borderAll:Be}),de=L;break;case"borderLeft":a.setFieldsValue({borderLeft:Ge}),L[G]?.style===""?a.setFieldsValue({borderLeft:Be}):a.setFieldsValue({borderAll:Be}),de=L;break;case"borderRight":a.setFieldsValue({borderRight:Ge}),L[G]?.style===""?a.setFieldsValue({borderRight:Be}):a.setFieldsValue({borderAll:Be}),de=L;break;case"cell_borderPosition":de=L,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:de});break;case"fontSize":case"lineHeight":if(L[G]===null||L[G]===""||L[G]===void 0)return;de=L;break;case"linkHref":{const ko=et(L[G]);ko!==L[G]&&a.setFieldValue("linkHref",ko),de={linkHref:ko},Ho(ko,_e);break}default:de=L}G!=="borderPosition"&&s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:de})},w=(0,n.useCallback)(()=>{dd(a,Te,F,q,H,Ie,M)},[a,Te,H,M]),ce=(0,n.useCallback)(()=>{cd(a,V,$,B,T,s,e)},[a,$,B,s,e]),ve=(0,n.useCallback)(()=>{ud(a,R,te,_,s,e,M)},[a,te,_,s,e,M]),Ye=(0,n.useCallback)(()=>{md(a,ge,Z,s,e)},[a,Z,s,e]),qe=(0,n.useCallback)(()=>{pd(a,pe,le,s,e)},[a,le,s,e]),oo=(0,n.useCallback)(()=>{hd(a,xe,be,s,e)},[a,be,s,e]),to=(0,n.useCallback)(()=>{bd(a,oe,Re,s,e)},[a,Re,s,e]),no=(0,n.useCallback)(()=>{fd(Oe)},[Oe]),fo=(0,n.useCallback)(()=>{gd(a,he,ye,s,e)},[a,ye,s,e]),xo=(0,n.useCallback)(()=>{_d(a,ie,me,s,e)},[a,me,s,e]),D=(0,n.useCallback)(()=>{xd(a,se,Q,s,e)},[a,Q,s,e]),A=(0,n.useCallback)(()=>{kd(K)},[K]),x=(0,n.useCallback)(()=>{Ed(a,se,Q,s,e)},[a,Q,s,e]);return(0,o.jsxs)(t.ui_kit$Form,{form:a,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:"",cellBackgroundPositionX:"",cellBackgroundPositionY:"",cellBackgroundRepeat:"",cellBackgroundSize:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:"",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorder:"",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBorderAll:"",mobileBorderTop:"",mobileBorderBottom:"",mobileBorderLeft:"",mobileBorderRight:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:"",cell_border:"",cell_borderColor:"",cell_borderWidth:"",cell_borderStyle:"",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:"",cell_RadiusTopLeft:"",cell_RadiusBottomLeft:"",cell_RadiusTopRight:"",cell_RadiusBottomRight:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",verticalAlign:"",textBackgroundColor:"",valign:""},onValuesChange:j,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!v&&(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"})}),Te?(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Bd,{form:a,onBorderSideClear:j,formValues:He,elementSettings:e,appConfig:c,token:d,isMacOS:Ce,__:l,handleToggleShowPaddingCell:A,handleTogglePaddingCell:x,handleToggleBackground:no,handleToggleBorder:w,handleToggleBorderRadius:ve,paddingCellShow:ne,paddingsExt:Q,backgroundShow:Ve,cellBordersShow:z,borderRadiusShow:te,oneBorderRadiusValue:S,setOneBorderRadiusValue:_,backgroundImageEmpty:O,backgroundRepeatOptions:ze,backgroundSizeOptions:ae,sendAction:We,typografItems:Je,textInputRef:Me,linkProtocol:ue,handleLinkProtocolsChange:J,isCodeVision:v})}):(0,o.jsx)(Sd,{form:a,onBorderSideClear:j,elementSettings:e,handleToggleShowPadding:xo,handleTogglePadding:D,handleToggleBackground:no,handleToggleBorder:w,handleToggleBorderRadius:ve,handleToggleBoxShadow:qe,handleToggleMobileSize:to,handleToggleMobileBackground:fo,handleToggleMobileBorder:ce,handleToggleMobileBorderRadius:Ye,handleToggleMobileBoxShadow:oo,paddingShow:me,paddingsExt:Q,backgroundShow:Ve,bordersShow:H,borderRadiusShow:te,boxShadowShow:le,mobileSizeShow:Re,mobileBackgroundShow:ye,mobileBordersShow:$,mobileBorderRadiusShow:Z,mobileBoxShadowShow:be,oneBorderRadiusValue:S,setOneBorderRadiusValue:_,oneMobileBorderRadiusValue:y,setOneMobileBorderRadiusValue:C,backgroundImageEmpty:O,backgroundRepeatOptions:ze,backgroundSizeOptions:ae,boxShadow:h,mobileBorders:B,mobileBoxShadow:I,elementViewType:m,mobileViewActive:b})," "]})};Fl.propTypes={elementSettings:g.default.object.isRequired};var dt=({className:e=null,formSettings:i,emailElementType:l,formName:s})=>{const a=r.useDispatch(),d=r.useSendStyleToggleToIframe(),c=(0,n.useRef)(),m=r.useSelector(r.selectActiveSettingsTab),b=r.useSelector(r.selectElementSettings$1),f=r.useSelector(r.selectElementSettings),E=r.useContainer(),h=r.getComponentRegistry(E),p=l==="email"?b:f,S=p.type,_=S===r.ELEMENT_TYPES.CAROUSEL||S===r.ELEMENT_TYPES.IMG?i.settings:p,[B,T]=(0,n.useState)(_),[I,P]=(0,n.useState)(_);_!==I&&(P(_),T(_));const y=C=>{const O=C.data.operation,X=C.data.action;if(O===r.EVENT_TYPES.APPLICATION_ACTION){let F=function($,V=null){const te={[$]:V||!B[$]};d(te,B.type),a(r.setEmailSettings(te)),T(R=>({...R,...te}))};var H=F;X==="toggle_strong"&&F("textStrong"),X==="toggle_italic"&&F("textItalic"),X==="toggle_underline"&&F("textUnderline"),X==="toggle_strikethrough"&&F("textStrikethrough"),X==="textAlign_left"&&F("textAlign","left"),X==="textAlign_right"&&F("textAlign","right"),X==="textAlign_center"&&F("textAlign","center")}};return r.useListenPostMessage(y),(0,o.jsx)("div",{className:"selected-element-panel",children:(0,o.jsx)(r.CSSTransition,{nodeRef:c,in:m===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)(n.Fragment,{children:h.getReactElement(i.content)},i.instanceKey):null,(p.type===r.ELEMENT_TYPES.IMG||p.type===r.ELEMENT_TYPES.COUNTDOWN||p.type===r.ELEMENT_TYPES.VIDEO)&&(0,o.jsx)(Hr,{elementSettings:p}),p.type===r.ELEMENT_TYPES.TEXT&&(0,o.jsx)(kn,{elementSettings:p}),p.type===r.ELEMENT_TYPES.LINK&&(0,o.jsx)(ll,{elementSettings:p}),p.type===r.ELEMENT_TYPES.TABLE&&(0,o.jsx)(rl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,o.jsx)(Fl,{elementSettings:p,formName:s}),(p.type===r.ELEMENT_TYPES.TD||p.type===r.ELEMENT_TYPES.STRUCTURE||p.type===r.ELEMENT_TYPES.GROUP||p.type===r.ELEMENT_TYPES.COLUMN)&&(0,o.jsx)(ul,{elementSettings:p}),p.type===r.ELEMENT_TYPES.VAR&&(0,o.jsx)(El,{elementSettings:p}),p.type===r.ELEMENT_TYPES.BUTTON&&(0,o.jsx)(kl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.DIV&&(0,o.jsx)(hl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.VINDENT&&(0,o.jsx)(nl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,o.jsx)(gl,{elementSettings:p}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,o.jsx)(yl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(wl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,o.jsx)(Nl,{elementSettings:i})]})})})};dt.propTypes={className:g.default.string,formName:g.default.string};function zo(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var Ml=({emailElementType:e,isSelectedElement:i=!1,selectedElement:l={parent:!1}})=>{const{__:s}=r.useI18n(),a=r.useDispatch(),d=r.useSendPostMessage(),[c]=t.ui_kit$Form.useForm(),m=(0,n.useRef)(),b=(0,n.useRef)(),f=r.useSelector(r.selectElementSettings$1),E=r.useSelector(r.selectElementSettings),h=r.useAppConfig(),p=l||(e==="email"?f:E),[S,_]=(0,n.useState)(p.floatBlocks?.wrap),[B,T]=(0,n.useState)(p.floatBlocks?.dirRevers),[I,P]=(0,n.useState)(null),[y,C]=(0,n.useState)(0),[O,X]=(0,n.useState)([]),H=r.useSelector(r.selectEmailViewType),F=(0,n.useCallback)(ye=>{a(e==="email"?r.setElementSettings$1(ye):r.setElementSettings(ye))},[a,e]);(0,n.useEffect)(()=>{if(p&&JSON.stringify(p)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:p.floatBlocks?.gap,gapMobile:p.floatBlocks?.gapMobile,gapDim:"px",valign:p.floatBlocks?.valign}),p.floatBlocks?.items.length>0){let ie=function(Q,se){if(Q.length!==se.length)return!1;for(let ne=0;ne<Q.length;ne++)if(Q[ne]!==se[ne])return!1;return!0};var ye=ie;const he=p.floatBlocks.items.reduce((Q,se)=>Q+se.width,0),me=p.floatBlocks.items.map(Q=>((Q.width||0)/he*100).toFixed(1));C(he),!ie(me,O)&&p.changeKey!=="gap"&&X(me),p.floatBlocks.items.forEach((Q,se)=>c.setFieldsValue({["width-"+se]:Q.width||0})),p.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")}_(p.floatBlocks?.wrap)}},[c,p,I,O]);let $=0;p.floatBlocks?.items.length>0&&($=p.floatBlocks.items.length);const V=(ye,he)=>{Object.keys(he).forEach(me=>{if(me.includes("width")){const ie=parseInt(me.match(/\d+/));c.setFieldsValue({[me]:ye.items[ie]})}})},[te,R]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const ye=()=>R(!0),he=()=>R(!1);return document.addEventListener("keyup",he),document.addEventListener("keydown",ye),()=>{document.removeEventListener("keyup",he),document.removeEventListener("keydown",ye)}},[]);const Z=ye=>{b.current&&te&&clearTimeout(b.current),b.current=setTimeout(()=>he(ye),50);function he(me){const ie=c.getFieldsValue(!0),Q=Object.keys(me)[0];if(P(Q),Q.includes("width")){if(ie[Q]&&ie[Q]>=30){let se={items:[],gap:ie.gap,valign:ie.valign,activateSection:i?void 0:"structure"},ne=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){ne=parseFloat(Object.keys(me)[0].substring(Object.keys(me)[0].length-1));const K=ie["width-"+(ne+1)]?ne+1:0;let z=y;Object.keys(ie).forEach(q=>{q.includes("width")&&q.indexOf("width-"+K)===-1&&(z-=ie[q])}),ie["width-"+K]=z}Object.keys(ie).forEach(K=>{K.includes("width")&&se.items.push(ie[K])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:se}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...se,items:p.floatBlocks.items.map((K,z)=>({...p.floatBlocks.items[z],width:se.items[z]}))},changeKey:Q})}}else if(Q==="gap"){const se={items:p.floatBlocks.items.map(q=>q.width),gap:p.floatBlocks.gap},ne=se.items.reduce((q,ue)=>q+ue,0)+(se.items.length-1)*se.gap,K=ie.gap,z=ne-(se.items.length-1)*K;if(z>se.items.length*30||p.floatBlocks.gap-me>=0){const q=(Le,we)=>Math.round(we*Le/100);let ue=se.items.map((Le,we)=>q(O[we],z));const _e=ne-(ue.reduce((Le,we)=>Le+we,0)+(se.items.length-1)*K);if(_e!==0){const Le=ue.length-Math.abs(_e);ue=ue.map((we,Ne)=>Le<=Ne?we+(_e>0?1:-1):we)}let fe={items:ue,gap:K||0};V(fe,ie),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:fe,editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...fe,items:p.floatBlocks.items.map((Le,we)=>({...Le,width:fe.items[we]}))},changeKey:Q})}}else if(Q==="valign"){let se={valign:ie.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:se,editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...se},changeKey:Q})}else if(Q==="gapMobile"){let se={mobileHeight:{classNamePrefix:"em-mob-height-",value:me[Q],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:se}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,gapMobile:se.mobileHeight.value},changeKey:Q})}setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),600)}},ge=()=>{const ye=c.getFieldsValue(!0),he=p.floatBlocks.items.map(z=>z.width);let me={items:[],gap:ye.gap};const ie=he.reduce((z,q)=>z+q,0),Q=he.length,se=Math.ceil(y/Q)*Q,ne=se/Q,K=ie-se;if(me.items=Array(Q).fill(ne),K!==0){const z=he.length-Math.abs(K);me.items=me.items.map((q,ue)=>z<=ue?q+(K>0?1:-1):q)}V(me,ye),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:me,editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...me,items:p.floatBlocks.items.map((z,q)=>({...z,width:me.items[q]}))},changeKey:"width"})},le=ye=>{const he=c.getFieldsValue(!0),me=p.floatBlocks.items.map(fe=>fe.width),ie=p.floatBlocks.gap||20,Q=ye.cols-me.length;let se=[],ne=me.reduce((fe,Le)=>fe+Le,0);ye.cols>=me.length?ne-=ie*Q:ne+=ie*Math.abs(Q);const K=Math.round(ne/ye.cols);function z(fe,Le){const we=[];for(let Ne=0;Ne<fe;Ne++)we.push(ye.width?.[Ne]?Math.round(ne/100*ye.width?.[Ne]):Le);return we}se=z(ye.cols,K);const q=ne-se.reduce((fe,Le)=>fe+Le,0);if(q!==0){let fe=se.map((we,Ne)=>[Ne,we]).filter(we=>we[1]>30);const Le=fe.length-Math.abs(q);fe=fe.map((we,Ne)=>{const Y=Le<=Ne?we[1]+(q>0?1:-1):we[1];return[we[0],Y]}),fe.map(we=>(se[we[0]]=we[1],we))}let ue={items:se,gap:he.gap||20};const _e=se.reduce((fe,Le)=>fe+Le,0);X(se.map(fe=>(fe/_e*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:ue,editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...ue,items:ue.items.map((fe,Le)=>({width:fe,current:!1}))},changeKey:"width"})},pe=()=>{const ye=c.getFieldsValue(!0);if($<8){const he=p.floatBlocks.items.map(z=>z.width),me=p.floatBlocks.gap,ie=he.reduce((z,q)=>z+(q>30?q:0),0),Q=(ie-30-me)/ie,se=he.map(z=>z>30?Math.round(z*Q):z).reduce((z,q)=>z+(q>30?q:0),0);let ne=he.map(z=>z>30?Math.round(z*Q):z);ne.push(30);const K=ie-se-30-me;if(K!==0){let z=ne.map((ue,_e)=>[_e,ue]).filter(ue=>ue[1]>30);const q=z.length-Math.abs(K);z=z.map((ue,_e)=>{const fe=q<=_e?ue[1]+(K>0?1:-1):ue[1];return[ue[0],fe]}),z.map(ue=>(ne[ue[0]]=ue[1],ue))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:ye.gap,gapMobile:ye.gapMobile,minWidth:30},editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:ne.map((z,q)=>({width:z,current:p.floatBlocks.items[q]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},be=ye=>{const he=c.getFieldsValue(!0);let me=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((fe,Le)=>{fe===ye.target.closest(".selected-element-panel__columns-settings__controls__column")&&(me=Le)});const ie=+p.floatBlocks.gap,Q=+p.floatBlocks.items[me].width+ie,se=p.floatBlocks.items.map(fe=>+fe.width),ne=(se.length-1)*ie,K=se.reduce((fe,Le)=>fe+Le,0)+ne,z=se.length-1,q=Math.floor(Q/z);let ue=se.filter((fe,Le)=>Le!==me).map(fe=>fe+q);const _e=K-(ue.reduce((fe,Le)=>fe+Le,0)+(se.length-2)*ie);if(_e!==0){const fe=ue.length-Math.abs(_e);ue=ue.map((Le,we)=>fe<=we?Le+(_e>0?1:-1):Le)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:me,gap:he.gap},editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:ue.map((fe,Le)=>({width:fe,current:p.floatBlocks.items.filter((we,Ne)=>Ne!==me)[Le].current}))},changeKey:"width"})},xe=ye=>{if($>=8)return;const he=c.getFieldsValue(!0);let me=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((we,Ne)=>{we===ye.target.closest(".selected-element-panel__columns-settings__controls__column")&&(me=Ne)});const ie=parseFloat(he.gap)||0,Q=p.floatBlocks.items.map(we=>+we.width),se=Q[me],ne=Q.reduce((we,Ne)=>we+Ne,0),K=ne-ie,z=ne+se,q=z>0?K/z:1;let ue=[];const _e=[];Q.forEach((we,Ne)=>{ue.push(Math.max(30,Math.round(we*q))),_e.push(p.floatBlocks.items[Ne]?.current||!1),Ne===me&&(ue.push(Math.max(30,Math.round(se*q))),_e.push(!1))});const fe=K-ue.reduce((we,Ne)=>we+Ne,0);if(fe!==0){let we=ue.map((Y,re)=>[re,Y]).filter(Y=>Y[1]>30);const Ne=we.length-Math.abs(fe);we=we.map((Y,re)=>[Y[0],Ne<=re?Y[1]+(fe>0?1:-1):Y[1]]),we.forEach(Y=>ue[Y[0]]=Y[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:me,gap:he.gap,widths:ue},editFromStructure:zo()});const Le=ue.reduce((we,Ne)=>we+Ne,0);X(ue.map(we=>(we/Le*100).toFixed(1))),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:ue.map((we,Ne)=>({width:we,current:_e[Ne]||!1}))},changeKey:"width"})},Re=(0,n.useCallback)(ye=>{const he=".selected-element-panel__columns-settings__controls__column",me=Array.from(document.querySelectorAll(he)).indexOf(ye.target.closest(he)),ie=me-1;if(ie<0)return;const Q=p.floatBlocks,se=Q.items.map(({width:ne,current:K})=>({width:ne,current:K||!1}));[se[ie],se[me]]=[se[me],se[ie]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:ie,indexB:me},editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...Q,items:se},changeKey:"width"})},[p,F,i,d]),oe=ye=>{_(ye),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!S}}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,wrap:!S},changeKey:"wrap"})},Ve=ye=>{T(ye),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!B}}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,dirRevert:!B},changeKey:"dir"})},Oe=()=>setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),300);return p.floatBlocks&&p.floatBlocks.items.length>0&&(0,o.jsx)(t.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:p.floatBlocks?.gap||0,gapDim:"px",gapMobile:p.floatBlocks?.gapMobile||0,valign:p.floatBlocks?.valign||"top",...p.floatBlocks?.items.reduce((ye,{width:he},me)=>(ye[`width-${me}`]=he,ye),{})},onValuesChange:Z,onFieldsChange:Oe,className:"element-controls",children:(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:h.switchDesktopMobilePropsEnabled||h.stepToOtherElementEnabled||h.deleteButtonEnabled||p.type==="structure"?0:24},children:[p.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"}),H!=="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:pe,children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:h.iconStrokeWidth})," ",s("Add column")]}),p.floatBlocks.items.length>1&&(0,o.jsx)("span",{onClick:ge,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")]})})]})]}),p.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:p.floatBlocks.items.map((ye,he)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(ye.current?"current":""),style:{width:ye.width/y*100+"%"},children:[he>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:Re,children:(0,o.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:t.icons$SwapHorizontalIcon,size:15,strokeWidth:h.iconStrokeWidth})})}),p.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:be,children:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:15,strokeWidth:h.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),p.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:xe,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-"+he,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,value:ye.width||0,placeholder:s("Width"),ref:I==="width-"+he&&m})})})]},"floatblock-"+he))})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{le({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{le({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{le({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:()=>{le({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:()=>{le({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{le({cols:4})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol4",component:t.icons$LayoutCol4})})]})]}),p.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[H==="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:p.floatBlocks?.wrap===void 0,checked:S,onChange:oe,labelStyle:{position:"relative",top:2}})}),H!=="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:p.floatBlocks?.wrap===void 0,checked:B,onChange:Ve,labelStyle:{position:"relative",top:2}})})]}),p.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:p.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:[H!=="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:p.floatBlocks.items.length<=1,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",ref:I==="gap"&&m})})})}),H==="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:p.floatBlocks.items.length<=1,placeholder:s("Indent in mobile"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};Ml.propTypes={selectedElement:g.default.shape({parent:g.default.string})};var Rd=()=>{},Dl=({email:e,formSettings:i={},onClosePanel:l=Rd})=>{const{__:s}=r.useI18n(),a=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),m=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,b=r.useSelector(r.selectElementSettings$1),f=r.useSelector(r.selectElementSettings),E=r.useSelector(r.selectPropertiesPanelKey),h=m==="email"?b:f,p=Object.keys(i).length>0?i.settings:h,S=i?.type==="advanced"&&!!i?.content,_=!!i?.extraTabs?.length,B=r.useAppConfig(),T=p.type==="customTable",I=!!p.type&&!!p.floatBlocks?.items.length>0&&!!p.floatBlocks?.items.filter(V=>!!V.width).length>0,P=(0,n.useRef)(null);(0,n.useEffect)(()=>{const V=Object.values(r.ELEMENT_TYPES),te=p.type&&V.includes(p.type)?`${p.type}-${JSON.stringify(p.path||[])}`:null;if(S||_){const R=a.querySelector(".email-pane .panel-form__body");R&&(R.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(p.type&&V.includes(p.type)){const R=P.current!==te;if(P.current=te,p.activateSection!=="structure"){if(R){const Z=a.querySelector(".email-pane .panel-form__body");Z&&(Z.scrollTop=0)}d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(p)!=="{}"&&(P.current=null,d(r.setPropertiesPanelKey("")))},[p,d,a,S,_]);const y=(0,n.useMemo)(()=>{const V=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:p.caption?p.caption:s("Edit element")})}];return I&&V.push({key:r.STRUCTURE,label:s("Columns")}),V},[p.caption,I,s]),C=(0,n.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),O=V=>{V.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(m==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},X=V=>{V.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},H=()=>{l(p),d(r.resetToLastActiveSettingsTab()),setTimeout(()=>{d(m==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},F=(0,o.jsxs)(o.Fragment,{children:[B.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:O,disabled:!p.deletable,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:B.iconStrokeWidth})})}),B.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:X,disabled:!p.parent,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"GoToParent",component:t.icons$GoToParent,size:18,strokeWidth:B.iconStrokeWidth})})})]}),$=B.switchDesktopMobilePropsEnabled||B.stepToOtherElementEnabled||B.deleteButtonEnabled;return(0,o.jsxs)(t.ui_kit$PanelForm,{children:[(0,o.jsx)(t.ui_kit$PanelForm.Header,{onClose:H,closeIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"Close",component:t.icons$Close,size:24,strokeWidth:B.iconStrokeWidth}),extra:$?F:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:T?C:y,activeKey:E,onChange:V=>d(r.setPropertiesPanelKey(V||""))})}),(0,o.jsx)(t.ui_kit$PanelForm.Body,{children:T?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:E==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,o.jsx)("div",{style:{display:E==="Table properties"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:E==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m})}),I&&(0,o.jsx)("div",{style:{display:E==="Structure"?void 0:"none"},children:(0,o.jsx)(Ml,{selectedElement:p,emailElementType:m,isSelectedElement:!1})})]})})]})},yd=({taxonomy:e})=>{const{__:i,_x:l}=r.useI18n(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=(0,n.useRef)(null),c=r.useSelector(r.selectActiveModal$1)===r.MODALS.ADD_NEW_GROUP_MODAL,m=r.useNotification(),b=r.useProjectData(),f=(0,n.useCallback)(()=>{a.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[a]);(0,n.useEffect)(()=>{c&&f()},[c,f]);const E=()=>s(r.closeModal$1()),[h,p]=r.useAddTermMutation(),[S,_]=(0,n.useState)(!1),B=()=>{a.validateFields().then(({name:T})=>(_(!0),h({project:b,kind:"group",name:T}).then(I=>{if("error"in I){m.error(I);return}m.success({title:i("The group “")+I.data.name+l("” was successfully created.",e)}),E()}))).catch(T=>{}).finally(()=>_(!1))};return(0,o.jsx)(t.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:B,onCancel:E,className:"new-group-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:p.isLoading||S,onClick:B,children:i("Create group")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",name:"add_new_group_form",onFinish:B,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:p.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},wd=({group:e,refetch:i})=>{const{__:l,_x:s}=r.useI18n(),a=r.useDispatch(),[d]=t.ui_kit$Form.useForm(),c=(0,n.useRef)(null),m=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,b=r.useNotification(),{id:f=null,name:E=""}=e,h=()=>a(r.closeModal$1()),[p,S]=r.useEditTermMutation();(0,n.useEffect)(()=>{m&&d.setFieldsValue({name:E})},[m,E,d]);const _=()=>{d.validateFields().then(({name:B})=>{p({kind:"group",id:f,name:B}).then(({data:T,error:I})=>{I?(b.error({error:I}),d.setFieldValue("name",B)):(i().then(({data:P})=>{if(P){const y=P[0]?.children?.find(C=>C.id===f)?.name;d.setFieldValue("name",y)}}),h(),b.success({title:l("The group “")+B+s("” was successfully changed to “","group")+T.name+l("”.")}))})})};return(0,o.jsx)(t.ui_kit$Modal,{title:l("Change group name"),open:m,onOk:_,onCancel:h,className:"new-group-name-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:S.isLoading,onClick:_,children:l("Change name")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:d,layout:"vertical",name:"rename_group_form",onFinish:_,initialValues:{remember:!1,name:E},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:S.isLoading,size:"large",placeholder:l("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},jd=({className:e,refetchProjectGroups:i,isLoading:l})=>{const{__:s,_x:a}=r.useI18n(),d=r.useDispatch(),c=r.useNotification(),{modal:m}=t.ui_kit$App.useApp(),{confirm:b}=m,{token:f}=(0,t.ui_kit$useToken)(),E=r.useSelector(r.selectProjectGroups),[h]=r.useDeleteTermMutation(),p=(P,y)=>{h({kind:"group",id:Number(P)}).unwrap().then(C=>{C?.deleted&&c.success({title:s("The group “")+y+a("” was successfully deleted.","recovery")})}).catch(C=>{c.error({error:C})})},S=(P,y)=>{b({mask:{closable:!0},centered:!0,title:a("Are you sure to delete “","group")+y+s("” group and all nested groups?"),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:s("Yes"),cancelText:s("No"),onOk:()=>p(String(P),y)})},_=(P,y)=>{d(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),I({id:P,name:y})},B=P=>[{label:s("Rename"),key:"Rename",icon:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:16}),onClick:()=>_(P.id,P.name)},{label:s("Remove"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),key:"Remove",style:{color:"#ff4d4f"},onClick:()=>S(P.id,P.name)}],[T,I]=(0,n.useState)({id:null,name:""});return(0,o.jsxs)("div",{className:(0,Ue.default)("groups-management",{[e]:e}),children:[l?(0,o.jsx)(t.ui_kit$Skeleton,{active:!0}):(0,o.jsxs)(t.ui_kit$Row,{children:[!!E?.length&&E?.map((P,y)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${P.id}`,style:{marginBottom:f.formItemMarginBottomMD},label:(0,o.jsxs)(t.ui_kit$Flex,{justify:"space-between",align:"center",style:{width:"100%"},children:[(0,o.jsx)("span",{children:P.name}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"groups-management__group_menu","data-group-id":P.id,size:"large",children:(0,o.jsx)(t.ui_kit$Dropdown,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:{items:B(P)},trigger:["hover"],children:(0,o.jsx)("span",{className:"groups-management__actions",children:(0,o.jsx)(r.EmIcons,{icon:"MoreOutlined",component:t.icons$MoreOutlined})})})})]}),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:s("Type category here"),options:P.children?.map(C=>({label:C.name,value:String(C.id)})),tagRender:C=>{const{label:O,closable:X,onClose:H}=C,F=$=>{$.preventDefault(),$.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:f.colorPrimary,onMouseDown:F,closable:X,onClose:H,style:{borderRadius:6},children:O})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},P.id)),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:f.formItemMarginBottomMD},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:{width:"100%"},onClick:()=>d(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL)),children:s("Add group")})})})]}),(0,o.jsx)(yd,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,o.jsx)(wd,{group:T,refetch:i})]})},{title:Pi,description:Yt,tags:Xt,type:Ai,is_template:vd,group:Id}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},Cd={[Pi]:"",[Yt]:"",[Xt]:[],[vd]:!1},Pd={[Yt]:"",[Xt]:[],[Ai]:""};function Ad(e){const i=new Set;return e?.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0))}var Nd=e=>Array.isArray(e)&&e.length>0,Vl=({className:e="",element:i})=>{const{__:l}=r.useI18n(),s=r.useDispatch(),a=r.useEmailAttributesWriter(),[d]=t.ui_kit$Form.useForm(),{token:c}=(0,t.ui_kit$useToken)(),m=r.useAppConfig(),b=r.useEditorLocked(),f=r.useEditorLockCheck(),E=r.useSelector(r.selectProjectGroups),{data:h}=r.useGetBlocksSchemaQuery(),p=r.useProjectData(),S=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,_=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{data:B,refetch:T,isLoading:I,isFetching:P,isUninitialized:y,isSuccess:C}=r.useGetTermsQuery({project:p,kind:"group"},{skip:!p?.id});(0,n.useEffect)(()=>{B&&s(r.projectGroupsLoaded(B,S==="email"?i.group??[]:void 0))},[s,B,S,i.group]),(0,n.useEffect)(()=>{!y&&T()},[y,T]);const[O,X]=(0,n.useState)([]),[H,F]=(0,n.useState)([]),[$,V]=(0,n.useState)(i.is_template||!1),te=r.useProjectData();(0,n.useEffect)(()=>{!y&&T()},[i.group,T,y]),(0,n.useEffect)(()=>{if(C&&i.is_template&&Nd(i.group)){const le=i.group;let pe={};le.length&&E.length&&le?.forEach(xe=>{E?.forEach(Re=>{let oe=Re.children.find(Ve=>Ve.id===xe);oe&&(pe.hasOwnProperty(Re.id)||(pe[Re.id]=[]),pe[Re.id].push({label:oe.name,value:oe.id}))})});let be={};for(let xe in pe)pe.hasOwnProperty(+xe)&&(be[`group_${xe}`]=pe[xe].map(Re=>({...Re,value:String(Re.value)})));d.setFieldsValue(be)}},[d,E,i.is_template,i.group,C]);const{data:R}=r.useGetTermsQuery({project:te,kind:_},{skip:!te?.id});(0,n.useEffect)(()=>{F(Ad(R)?.map(le=>({value:le.name,key:le.id})))},[R]),(0,n.useEffect)(()=>{if(i){const le=r.getTaxonomy(i,_)?.map(xe=>xe.name),pe=i.emailtags||i.blocktags,be=r.getTaxonomy(i,_)?.filter(xe=>pe.includes(xe.id)).map(xe=>xe.name);d.setFieldsValue({title:i.title,description:i.description,tags:i.tags||be||le,type:i.type})}},[d,i,_]);const Z=le=>{if(f())return;const pe=Object.keys(le)[0],be=le,xe=pe.split("_")[0];if(xe===Pi)a({title:be[pe]});else if(xe===Yt)a({description:be[pe]});else if(xe===Xt){const Re=be[pe];a({tags:Re?.map(oe=>oe.trim())})}else xe==="is"&&S==="email"?a({is_template:be[pe]}):xe===Ai&&S==="block"&&a({type:be[pe]});if(pe.split("_")[0]===Id)s(r.setEmailGroups({[pe.split("_")[1]]:le[pe]}));else return};(0,n.useEffect)(()=>{if(h){const le=h.schema.properties.acf.properties.type.items.enum;let pe=[];const be={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")};for(let xe in le)pe.push({label:be[le[xe]],value:le[xe]});X(pe)}},[h,l]);const ge=le=>{V(le)};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:S==="email"?{EmailInitialValues:Cd}:Pd,onValuesChange:Z,autoComplete:"off",disabled:b,children:[m.subjectEnabled&&S==="email"&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Title"),name:Pi,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}})}),m.descriptionEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Description"),name:Yt,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}})}),m.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Tags"),name:Xt,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:H,tagRender:le=>{const{label:pe,closable:be,onClose:xe}=le,Re=oe=>{oe.preventDefault(),oe.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:Re,closable:be,onClose:xe,style:{borderRadius:6},children:pe})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),S==="email"&&m.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:$,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",onChange:ge,disabled:!!i.isNew||b,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),$&&(0,o.jsx)(jd,{element:i,refetchProjectGroups:T,isLoading:I||P}),S==="block"&&(0,o.jsx)(t.ui_kit$Form.Item,{name:Ai,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:O,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};Vl.propTypes={className:g.default.string,email:g.default.object};var{utm_source:Hl,utm_medium:Ul,utm_campaign:Wl,utm_term:zl,utm_content:Gl}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},Ld={[Hl]:"",[Ul]:"",[Wl]:"",[zl]:"",[Gl]:""},Yl=({className:e="",email:i=void 0})=>{const{__:l}=r.useI18n(),s=r.useEmailAttributesWriter(),a=r.useEditorLocked(),d=r.useEditorLockCheck(),[c]=t.ui_kit$Form.useForm();(0,n.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 m=b=>{if(d())return;const f=Object.keys(b)[0],E=b;s({utm_parameters:{...i?.utm_parameters,[f]:E[f]}})};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:Ld,onValuesChange:m,autoComplete:"off",disabled:a,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:Hl,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:Ul,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:Wl,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:zl,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:Gl,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")})})]})})};Yl.propTypes={className:g.default.string,email:g.default.object};var Xe={PRODUCT_CAROUSEL:"productCarousel",SINGLE_IMAGE_PREVIEW:"singleImagePreview",DEAL_ANNOTATION:"dealAnnotation",DEAL_CARD:"dealCard"},Xl="emailmaker-gmail-annotations";function Ni(e){return/^[A-Za-z]{3}$/.test((e??"").trim())}function Od(e){return typeof e=="object"&&e!==null}function Kt(e,i){const l=e[i];return typeof l=="string"?l:""}var $d=new Set(["PromotionCard","DiscountOffer","Organization"]);function Kl(e){let i;try{i=JSON.parse(e)}catch{return!1}const l=Array.isArray(i)?i:[i];return l.length===0?!1:l.every(s=>typeof s=="object"&&s!==null&&$d.has(String(s["@type"])))}function Fd(){let e=new Date().getTime(),i=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,l=>{let s=Math.random()*16;return e>0?(s=(e+s)%16|0,e=Math.floor(e/16)):(s=(i+s)%16|0,i=Math.floor(i/16)),(l==="x"?s:s&3|8).toString(16)})}function qt(e){return e.annotationType||Xe.PRODUCT_CAROUSEL}function ct(e){return!!(e?.image||e?.url||e?.headline||e?.price||e?.priceCurrency||e?.discountValue)}function Li(e){return!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds}function Jt(e){return typeof e=="string"&&e.trim().length>0}function Oi(e){return Jt(e)?/^https?:\/\//i.test(e.trim()):!1}function ql(e){return Jt(e?.image)&&Oi(e?.url)}function Md(e){switch(qt(e)){case Xe.SINGLE_IMAGE_PREVIEW:return ql(e.cards?.[0]);case Xe.DEAL_ANNOTATION:return!Li(e);case Xe.DEAL_CARD:return Jt(e.description)&&(Oi(e.offerPageUrl)||Oi(e.merchantHomepageUrl));case Xe.PRODUCT_CAROUSEL:default:return!!e.cards?.some(ql)}}function Dd(e){switch(qt(e)){case Xe.SINGLE_IMAGE_PREVIEW:return!ct(e.cards?.[0])&&!Jt(e.discountCode);case Xe.DEAL_ANNOTATION:return Li(e);case Xe.DEAL_CARD:return Li(e)&&!e.offerPageUrl&&!e.merchantHomepageUrl;case Xe.PRODUCT_CAROUSEL:default:return!e.cards?.some(ct)}}function Vd(e){switch(qt(e)){case Xe.DEAL_ANNOTATION:case Xe.DEAL_CARD:return!!(e.description||e.discountCode||e.availabilityStarts||e.availabilityEnds||e.offerPageUrl||e.merchantHomepageUrl);case Xe.SINGLE_IMAGE_PREVIEW:return ct(e.cards?.[0]);case Xe.PRODUCT_CAROUSEL:default:return e.logo?!0:!!e.cards?.some(ct)}}function Hd(e){let i=typeof e.price=="string"||typeof e.price=="number"?String(e.price):"",l=typeof e.discountValue=="string"||typeof e.discountValue=="number"?String(e.discountValue):"";const s=typeof e.em_regularPrice=="string"||typeof e.em_regularPrice=="number"?String(e.em_regularPrice):"",a=typeof e.em_price=="string"||typeof e.em_price=="number"?String(e.em_price):"";if(!i&&s&&(i=s),!l&&i&&a){const d=parseFloat(i),c=parseFloat(a);!isNaN(d)&&!isNaN(c)&&d>=c&&(l=String(d-c))}return{id:Fd(),image:typeof e.image=="string"?e.image:"",url:typeof e.url=="string"?e.url:"",headline:typeof e.headline=="string"?e.headline:"",price:i,priceCurrency:typeof e.priceCurrency=="string"?e.priceCurrency:"",discountValue:l}}function Jl(e,i){const l={"@context":"http://schema.org/","@type":"PromotionCard",image:e.image};if(e.url&&(l.url=e.url),e.headline&&(l.headline=e.headline),e.price&&(l.price=e.price),e.priceCurrency){const s=e.priceCurrency.trim();l.priceCurrency=Ni(s)?s.toUpperCase():s}return e.discountValue&&(l.discountValue=e.discountValue),i&&(l.position=i),l}function $i(e){const i={"@context":"http://schema.org/","@type":"DiscountOffer"};for(const l of["description","discountCode","availabilityStarts","availabilityEnds","offerPageUrl","merchantHomepageUrl"]){const s=e[l];s&&(i[l]=s)}return i}function Ql(e){return{"@context":"http://schema.org/","@type":"Organization",logo:e}}function Ud(e){const i=qt(e),l=[];if(i===Xe.DEAL_CARD)return[$i(e)];if(i===Xe.DEAL_ANNOTATION){const s=[];return e.logo&&s.push(Ql(e.logo)),s.push($i(e)),s}if(e.logo&&l.push(Ql(e.logo)),i===Xe.SINGLE_IMAGE_PREVIEW){const s=e.cards?.[0];return e.discountCode?.trim()&&l.push($i(e)),s&&ct(s)&&l.push(Jl(s)),l}return(e.cards||[]).filter(ct).forEach((s,a)=>{l.push(Jl(s,a+1))}),l}function Wd(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function zd(e){if(Dd(e))return null;const i=Wd(JSON.stringify(Ud(e),null,2));return`<script type="application/ld+json" id="${Xl}">
|
|
10
|
-
${i}
|
|
11
|
-
<\/script>`}function Zl(e,i){const l=e.toLowerCase().indexOf("<\/script>",i);return l===-1?-1:l+9}function es(e,i,l,s){return{range:{start:i,end:s},contentRange:{start:l,end:s-9}}}function Fi(e){const i=new RegExp(`<script\\b[^>]*\\bid=["']${Xl}["']`,"i").exec(e);if(i?.index!==void 0){const a=e.indexOf(">",i.index)+1;if(a<=0)return null;const d=Zl(e,a);if(d!==-1)return es(e,i.index,a,d)}const l=/<script\b[^>]*type=["']application\/ld\+json["'][^>]*>/gi;let s;for(;(s=l.exec(e))!==null;){const a=s.index+s[0].length,d=Zl(e,a);if(d!==-1&&Kl(e.slice(a,d-9)))return es(e,s.index,a,d)}return null}function Gd(e){const i=e.indexOf(">")+1,l=e.toLowerCase().lastIndexOf("<\/script>");return i<=0||l===-1?e:e.slice(i,l)}function Yd(e){const i=/<\/head>/i.exec(e);if(i?.index!==void 0)return i.index;const l=/<head\b[^>]*>/i.exec(e);if(l?.index!==void 0)return l.index+l[0].length;const s=/<body\b[^>]*>/i.exec(e);return s?.index!==void 0?s.index:e.length}function os(e,i){let{start:l,end:s}=i;return l>0&&e[l-1]===`
|
|
12
|
-
`?l-=1:s<e.length&&e[s]===`
|
|
13
|
-
`&&(s+=1),{start:l,end:s}}function Xd(e,i){const l=Fi(e),s=zd(i);if(!s&&!l)return null;if(l&&!s){const c=os(e,l.range);return e.slice(c.start,c.end)?{range:c,text:""}:null}if(l&&s){const c=Gd(s);return e.slice(l.contentRange.start,l.contentRange.end)===c?null:{range:l.contentRange,text:c}}if(!s)return null;const a=Yd(e),d=`${a>0&&e[a-1]!==`
|
|
14
|
-
`?`
|
|
15
|
-
`:""}${s}
|
|
16
|
-
`;return{range:{start:a,end:a},text:d}}function ts(e){const i=Fi(e);return i?e.slice(i.contentRange.start,i.contentRange.end):null}function Kd(e){let i=e;for(let l=0;l<50;l++){const s=Fi(i);if(!s)return i;const{start:a,end:d}=os(i,s.range);i=i.slice(0,a)+i.slice(d)}return i}function qd(e){try{const i=new DOMParser().parseFromString(e,"text/html").querySelectorAll('script[type="application/ld+json"]');for(let l=0;l<i.length;l++){const s=i[l];if(s.id==="emailmaker-gmail-annotations"||Kl(s.textContent||"")){const a=JSON.parse(s.textContent||"[]"),d=(Array.isArray(a)?a:[a]).filter(Od),c={cards:[]};let m=!1,b=!1,f=!1;return d.forEach(E=>{const h=Kt(E,"@type");if(h==="Organization"){const p=Kt(E,"logo");p&&(c.logo=p);return}if(h==="DiscountOffer"){b=!0;for(const p of["description","discountCode","availabilityStarts","availabilityEnds"]){const S=Kt(E,p);S&&(c[p]=S)}for(const p of["offerPageUrl","merchantHomepageUrl"]){const S=Kt(E,p);S&&(c[p]=S,m=!0)}return}h==="PromotionCard"&&(E.position!==void 0&&(f=!0),c.cards.push(Hd(E)))}),c.cards.length>1?c.annotationType=Xe.PRODUCT_CAROUSEL:c.cards.length===1?c.annotationType=f?Xe.PRODUCT_CAROUSEL:Xe.SINGLE_IMAGE_PREVIEW:b&&(c.annotationType=m?Xe.DEAL_CARD:Xe.DEAL_ANNOTATION),c}}}catch{}return null}var Jd={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 Qd(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function is(e){const i=e?.trim();return i?Jd[i.toUpperCase()]??i:"$"}function Mi(e,i){return`${is(i)}${Qd(e)}`}function Zd(e){const i=parseFloat(e.price??""),l=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(l)&&l>0?{sale:Mi(i-l,e.priceCurrency),original:Mi(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:Mi(i,e.priceCurrency)}}var lo=({variant:e="line",width:i,height:l,className:s})=>{const a=(0,n.useMemo)(()=>({width:i,height:l}),[i,l]);return(0,o.jsx)("span",{className:(0,Ue.default)("preview-skeleton",`preview-skeleton--${e}`,s),style:a,"aria-hidden":"true"})};function Di({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 rs({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 ec({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 oc=2;function tc({card:e}){const i=Zd(e),l=(0,n.useMemo)(()=>({backgroundImage:`url(${e.image})`}),[e.image]),s=!!e.headline?.trim(),a=!!e.image?.trim(),d=!i.sale&&!i.original;return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[a?(0,o.jsx)("div",{className:"product-carousel-preview__card-image",style:l}):(0,o.jsx)(lo,{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)(lo,{height:12}),(0,o.jsx)(lo,{height:12,width:"75%"})]}),d?(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(lo,{width:48,height:14}),(0,o.jsx)(lo,{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 ic(){return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,o.jsx)(lo,{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)(lo,{height:12}),(0,o.jsx)(lo,{height:12,width:"75%"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(lo,{width:48,height:14}),(0,o.jsx)(lo,{width:40,height:12})]})]})]})}var rc=({data:e,subjectLine:i,cards:l})=>{const{__:s}=r.useI18n(),a=!!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:[a?(0,o.jsx)("img",{src:e.logo,alt:"",className:"product-carousel-preview__logo"}):(0,o.jsx)(lo,{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)(lo,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,o.jsx)(Di,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,o.jsx)("div",{className:"product-carousel-preview__carousel",children:l.length>0?l.map((c,m)=>(0,o.jsx)(tc,{card:c},c.id||m)):Array.from({length:oc},(c,m)=>(0,o.jsx)(ic,{},`skeleton-${m}`))})]})};function lc(e){const i=parseFloat(e?.price??""),l=parseFloat(e?.discountValue??"");if(!Number.isNaN(i)&&i>0&&!Number.isNaN(l)&&l>0){const a=Math.round(l/i*100);if(a>0)return`${a}% Off`}const s=e?.discountValue?.trim();return s?/off/i.test(s)||s.includes("%")?s:`${s} Off`:null}function ls(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var sc=({data:e,subjectLine:i,card:l})=>{const{__:s}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim(),c=!!l?.image?.trim(),m=!!l?.headline?.trim(),b=lc(l),f=ls(e.discountCode),E=!!(b||f),h=(0,n.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:[a?(0,o.jsx)("img",{src:e.logo,alt:"",className:"single-image-preview__logo"}):(0,o.jsx)(lo,{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)(lo,{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:[b?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(rs,{className:"single-image-preview__promo-icon"}),(0,o.jsx)("span",{className:"single-image-preview__promo-badge",children:b})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(lo,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,o.jsx)(lo,{width:72,height:14})]}),E&&(0,o.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),f?(0,o.jsx)("span",{className:"single-image-preview__promo-code",children:f}):(0,o.jsx)(lo,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,o.jsx)(Di,{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)(lo,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,o.jsx)("div",{className:"single-image-preview__card-body",children:m?(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)(lo,{height:12}),(0,o.jsx)(lo,{height:12,width:"92%"})]})})]})]})};function ac(e){const i=e?.trim();if(!i)return null;const l=(0,Lo.default)(i);if(!l.isValid())return null;const s=(0,Lo.default)().startOf("day"),a=l.startOf("day").diff(s,"day");return a===0?"Today":a===1?"Tomorrow":a>1&&a<=7?l.format("MMM D"):l.format("MMM D, YYYY")}function Vi(e){const i=e?.trim();return i||null}function nc(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function dc(e,i){return nc(ac(e),i)}var cc=({data:e,subjectLine:i})=>{const{__:l}=r.useI18n(),s=!!e.logo?.trim(),a=!!i?.trim(),d=Vi(e.description),c=ls(e.discountCode),m=!!(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)(lo,{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"})]}),a?(0,o.jsx)("div",{className:"deal-annotation-preview__subject-line",children:i}):(0,o.jsx)(lo,{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)(rs,{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)(lo,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,o.jsx)(lo,{width:72,height:14})]}),m&&(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)(lo,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,o.jsx)(Di,{className:"deal-annotation-preview__star-icon"})]})]})]})})},uc=({data:e})=>{const{__:i}=r.useI18n(),l=Vi(e.description),s=dc(e.availabilityEnds,i),a=Vi(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)(lo,{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)(ec,{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)(lo,{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")}),a?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:a}):(0,o.jsx)(lo,{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 mc(e){return e.annotationType===Xe.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===Xe.PRODUCT_CAROUSEL?e.cards||[]:[]}function pc(e,i){switch(e){case Xe.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case Xe.DEAL_ANNOTATION:return i("Deal Annotation");case Xe.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var Hi=300,Go=16;function hc(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function bc(e){const i=Array.from(document.querySelectorAll(e));for(const l of i){if(!(l instanceof HTMLElement))continue;const s=l.getBoundingClientRect(),a=window.getComputedStyle(l);if(s.width>0&&s.height>0&&a.display!=="none"&&a.visibility!=="hidden")return l}return null}var fc=({data:e,subjectLine:i,parentRef:l,overlayTargetSelector:s,onApply:a,applyDisabled:d=!1,applyBlockers:c=[],onRemove:m,visible:b=!0})=>{const{__:f}=r.useI18n(),[E,h]=(0,n.useState)(null),[p,S]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!b){h(null),S(null);return}const y=()=>{if(!hc(l?.current)){h(null),S(null);return}if(s){const Z=l?.current?.closest(".email-pane__col_settings-inner")||bc(".email-pane__col_settings-inner");if(Z){S(Z),h({type:"popover"});return}}if(!l?.current)return;let V=l.current.getBoundingClientRect();if(V.width===0&&V.height===0){const Z=l.current.closest(".email-pane__col");Z&&(V=Z.getBoundingClientRect())}const te=Math.max(Go,Math.min(V.top,window.innerHeight-Go));let R=V.left-Hi-Go;R<Go&&(R=V.right+Go),R+Hi>window.innerWidth-Go&&(R=window.innerWidth-Hi-Go),S(document.body),h({type:"side",top:te,left:Math.max(Go,R)})};y();const C=window.requestAnimationFrame(y),O=[window],X=l?.current?.closest(".email-pane__collapse-wrapper"),H=l?.current?.closest(".email-pane__col");X&&O.push(X),H&&O.push(H),O.forEach(V=>{V.addEventListener("scroll",y,{passive:!0})}),window.addEventListener("resize",y);const F=l?.current,$=F&&typeof ResizeObserver<"u"?new ResizeObserver(y):null;return $?.observe(F),()=>{window.cancelAnimationFrame(C),$?.disconnect(),O.forEach(V=>{V.removeEventListener("scroll",y)}),window.removeEventListener("resize",y)}},[l,e,s,b]);const _=(0,n.useMemo)(()=>E?.type==="side"?{position:"fixed",top:E.top,left:E.left}:void 0,[E]);if(!b||!e||!Vd(e)&&!a||!E)return null;const B=mc(e),T=e.annotationType||Xe.PRODUCT_CAROUSEL,I=(()=>{switch(T){case Xe.PRODUCT_CAROUSEL:return(0,o.jsx)(rc,{data:e,subjectLine:i,cards:B});case Xe.SINGLE_IMAGE_PREVIEW:return(0,o.jsx)(sc,{data:e,subjectLine:i,card:B[0]});case Xe.DEAL_ANNOTATION:return(0,o.jsx)(cc,{data:e,subjectLine:i});case Xe.DEAL_CARD:return(0,o.jsx)(uc,{data:e});default:return null}})(),P=(0,o.jsxs)("div",{className:`annotations-preview${E.type==="popover"?" annotations-preview--popover":""}`,style:_,children:[(0,o.jsxs)("div",{className:"annotations-preview__content",children:[(0,o.jsxs)("div",{className:"annotations-preview__type",children:[f("Preview"),": ",pc(T,f)]}),I]}),(a||m)&&(0,o.jsxs)("div",{className:"annotations-preview__footer",children:[m&&(0,o.jsx)(t.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:m,children:f("Remove annotations")}),a&&(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:a,disabled:d,children:f("Apply")})})})]})]});return(0,Da.createPortal)(P,p||document.body)};function gc(e){return e.replaceAll(`\r
|
|
17
|
-
`,`
|
|
18
|
-
`)}function _c(e){if(!e)return"";const i=document.createElement("textarea");return i.innerHTML=e,i.value.replace(/\u00A0/g," ").trim()}var xc=["USD","EUR","GBP","JPY","CNY","CAD","AUD","CHF","INR","BRL","MXN","KRW","RUB","UAH","KZT","PLN","TRY","SEK","NOK","DKK","CZK","ILS","AED","SGD","HKD","NZD","ZAR"];function ut(e){let i=(e??"").replace(/[\s\u00A0%]/g,"");return i=i.includes(".")?i.replace(/,/g,""):i.replace(",","."),/^\d+(\.\d+)?$/.test(i)?Number(i):null}function Tt(e,i=2){return String(Number(e.toFixed(i)))}function Rt(e){const i=ut(e);return i!==null&&i>0&&i<=100?i:null}function ss(e,i){const l=ut(e),s=Rt(i);return l===null||l<=0||s===null?"":Tt(l*s/100)}function kc(e,i){if(i?.includes("%")){const c=Rt(i);return c===null?"":Tt(c)}const l=ut(e),s=ut(i);if(l===null||l<=0||s===null||s<=0)return"";const a=s/l*100,d=Tt(s);for(const c of[0,1,2]){const m=Tt(a,c);if(ss(e,m)===d)return m}return Tt(a)}function Qt(){return{id:bo.generateUUID(),image:"",url:"",headline:"",price:"",priceCurrency:"",discountPercent:""}}function Ec({discountValue:e,...i}){return{...i,discountPercent:kc(i.price,e)}}function as(e,i){return i?.length?i.map(Ec):e===Xe.PRODUCT_CAROUSEL||e===Xe.SINGLE_IMAGE_PREVIEW?[Qt()]:[]}function ns(e=Xe.PRODUCT_CAROUSEL){return{annotationType:e,annotationLogo:"",description:"",discountCode:"",availabilityStarts:null,availabilityEnds:null,offerPageUrl:"",merchantHomepageUrl:"",cards:as(e)}}function Bc(e){const i=e.annotationType||Xe.PRODUCT_CAROUSEL;return{annotationType:i,annotationLogo:e.logo||"",description:e.description||"",discountCode:e.discountCode||"",availabilityStarts:e.availabilityStarts?(0,Lo.default)(e.availabilityStarts):null,availabilityEnds:e.availabilityEnds?(0,Lo.default)(e.availabilityEnds):null,offerPageUrl:e.offerPageUrl||"",merchantHomepageUrl:e.merchantHomepageUrl||"",cards:as(i,e.cards)}}function ds(e){const i=e.cards||[];return{annotationType:typeof e.annotationType=="string"?e.annotationType:Xe.PRODUCT_CAROUSEL,logo:typeof e.annotationLogo=="string"?e.annotationLogo:"",description:typeof e.description=="string"?e.description:"",discountCode:typeof e.discountCode=="string"?e.discountCode:"",availabilityStarts:e.availabilityStarts&&Lo.default.isDayjs(e.availabilityStarts)?e.availabilityStarts.toISOString():void 0,availabilityEnds:e.availabilityEnds&&Lo.default.isDayjs(e.availabilityEnds)?e.availabilityEnds.toISOString():void 0,offerPageUrl:typeof e.offerPageUrl=="string"?e.offerPageUrl:"",merchantHomepageUrl:typeof e.merchantHomepageUrl=="string"?e.merchantHomepageUrl:"",cards:i.map(l=>({id:l.id||bo.generateUUID(),image:l.image||"",url:l.url||"",headline:l.headline||"",price:l.price||"",priceCurrency:l.priceCurrency||"",discountValue:ss(l.price,l.discountPercent)}))}}function Sc(e,i){const l=e.getContent();if(!l)return!1;const s=Xd(l,i);if(!s||l.slice(s.range.start,s.range.end)===s.text)return!1;const a=l.slice(s.range.start,s.range.end);return e.mutate({changes:[new r.TextChange(s.range.start,a,s.range.start,s.text)]},{source:"user"}),!0}function Tc(e,i){return e?e.emailId!==i.emailId||e.markup!==i.markup:!0}function Rc(e){const i=e.getContent(),l=Kd(i);return l===i?!1:(e.mutate({changes:[new r.TextChange(0,i,0,l)]},{source:"user"}),!0)}function Ui(e){return!!e&&/^https?:\/\//i.test(e.trim())}function yc(e,i){const l=e.annotationType??Xe.PRODUCT_CAROUSEL,s=[];return l===Xe.PRODUCT_CAROUSEL||l===Xe.SINGLE_IMAGE_PREVIEW?(e.cards?.some(a=>!!a.image&&Ui(a.url))||s.push(i("At least one card needs an image and a link starting with https://")),e.cards?.some(a=>!!a.priceCurrency?.trim()&&!Ni(a.priceCurrency))&&s.push(i("Price currency must be a three-letter ISO 4217 code, for example USD")),s):l===Xe.DEAL_CARD?(e.description?.trim()||s.push(i("Discount description is required")),!Ui(e.offerPageUrl)&&!Ui(e.merchantHomepageUrl)&&s.push(i("Offer page or merchant homepage link starting with https:// is required")),s):(!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds&&s.push(i("Fill in at least one offer field")),s)}function wc(e,i){const l=[],s=e.filter(a=>!!a.discountPercent?.trim());return s.some(a=>Rt(a.discountPercent)===null)&&l.push(i("Discount must be a percentage greater than 0 and up to 100")),s.some(a=>{const d=ut(a.price);return Rt(a.discountPercent)!==null&&(d===null||d<=0)})&&l.push(i("Enter the price as a number to calculate the discount")),l}var{Text:jc}=t.ui_kit$Typography,vc=10,Ic=1,cs={width:"100%"},Cc="https://developers.google.com/workspace/gmail/promotab",Ro=["hover"],Pc=["annotationLogo"],us=["cards",0,"price"],Ac=["cards",0,"discountPercent"],Nc=["cards",0,"priceCurrency"];function _o(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Mo={clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})},Lc={optionFilterProp:"label"};function Oc(e){return{value:e||void 0}}var $c=xc.map(e=>{const i=is(e);return{value:e,label:i===e?e:`${e} (${i})`}}),ms=({name:e,pricePath:i,iconStrokeWidth:l})=>{const{__:s}=r.useI18n(),a=(0,n.useMemo)(()=>[i],[i]),d=(0,n.useMemo)(()=>[({getFieldValue:c})=>({validator:async(m,b)=>{const f=typeof b=="string"?b.trim():"";if(!f)return;if(Rt(f)===null)throw new Error(s("Discount must be a percentage greater than 0 and up to 100"));const E=ut(c(i));if(E===null||E<=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:Ro,title:s("Discount, %"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,dependencies:a,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:Mo})})})},ps=({name:e,iconStrokeWidth:i})=>{const{__:l}=r.useI18n(),s=(0,n.useMemo)(()=>[{validator:async(a,d)=>{const c=typeof d=="string"?d.trim():"";if(c&&!Ni(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:Ro,title:l("Price currency"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,rules:s,getValueProps:Oc,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:$c,placeholder:l("Price currency"),prefix:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:Lc,allowClear:!0,getPopupContainer:_o})})})},Fc=({onAdd:e})=>{const{__:i}=r.useI18n(),l=(0,n.useCallback)(()=>e(Qt()),[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")})},Mc=({field:e,index:i,form:l,isSingleImagePreview:s,onRemove:a})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),m=(0,n.useMemo)(()=>[e.name,"image"],[e.name]),b=(0,n.useMemo)(()=>["cards",e.name,"image"],[e.name]),f=(0,n.useMemo)(()=>[e.name,"headline"],[e.name]),E=(0,n.useMemo)(()=>[e.name,"url"],[e.name]),h=(0,n.useMemo)(()=>[e.name,"price"],[e.name]),p=(0,n.useMemo)(()=>["cards",e.name,"price"],[e.name]),S=(0,n.useMemo)(()=>[e.name,"discountPercent"],[e.name]),_=(0,n.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),B=(0,n.useMemo)(()=>[e.name,"id"],[e.name]),T=(0,n.useMemo)(()=>[{validator:async(P,y)=>{const C=typeof y=="string"?y.trim():"";if(C&&!/^https?:\/\//i.test(C))throw new Error(d("Please enter the correct URL."))}}],[d]),I=(0,n.useCallback)(()=>a(e.name),[a,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)(jc,{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:Ro,title:d("Delete"),placement:"top",getPopupContainer:_o,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:I})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:d("Image"),placement:"top",getPopupContainer:_o,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(Ao,{form:l,label:d("Image"),name:m,watchPath:b})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:d("Headline"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:f,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:Mo})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:d("Link"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:E,className:"selected-social-form__card-field",rules:T,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:Mo})})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:d("Price"),placement:"bottom",getPopupContainer:_o,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:Mo})})}),(0,o.jsx)(ms,{name:S,pricePath:p,iconStrokeWidth:c.iconStrokeWidth}),(0,o.jsx)(ps,{name:_,iconStrokeWidth:c.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:B,hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})})]})};function hs({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:i("Discount code"),placement:"bottom",getPopupContainer:_o,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:Mo})})})}var Dc=({className:e="",isActive:i=!0,email:l})=>{const{__:s}=r.useI18n(),a=r.useAppConfig(),d=r.useEditorLocked(),c=r.useEditorLockCheck(),{document:m}=r.useDocumentSessionContext(),b=r.useNotification(),[f]=t.ui_kit$Form.useForm(),E=(0,n.useRef)(null),h=(0,n.useRef)(!1),p=(0,n.useRef)(null),[S,_]=(0,n.useState)(!1),B=t.ui_kit$Form.useWatch("annotationType",f),T=t.ui_kit$Form.useWatch("annotationLogo",f),I=t.ui_kit$Form.useWatch("description",f),P=t.ui_kit$Form.useWatch("discountCode",f),y=t.ui_kit$Form.useWatch("availabilityStarts",f),C=t.ui_kit$Form.useWatch("availabilityEnds",f),O=t.ui_kit$Form.useWatch("offerPageUrl",f),X=t.ui_kit$Form.useWatch("merchantHomepageUrl",f),H=t.ui_kit$Form.useWatch("cards",f),F=JSON.stringify(H??[]),$=(0,n.useMemo)(()=>JSON.parse(F)??[],[F]),V=B||Xe.PRODUCT_CAROUSEL,te=V===Xe.PRODUCT_CAROUSEL||V===Xe.SINGLE_IMAGE_PREVIEW,R=V===Xe.DEAL_ANNOTATION||V===Xe.DEAL_CARD,Z=V===Xe.DEAL_CARD,ge=V===Xe.DEAL_ANNOTATION,le=V===Xe.SINGLE_IMAGE_PREVIEW,pe=V===Xe.SINGLE_IMAGE_PREVIEW?Ic:vc,be=(0,n.useMemo)(()=>[{value:Xe.PRODUCT_CAROUSEL,label:s("Product carousel")},{value:Xe.SINGLE_IMAGE_PREVIEW,label:s("Single image preview")},{value:Xe.DEAL_ANNOTATION,label:s("Deal Annotation")},{value:Xe.DEAL_CARD,label:s("Deal Card")}],[s]),xe=(0,n.useMemo)(()=>{let Q="";m&&(Q=m.getContent()),!Q&&l?.html&&(Q=l.html);const se=Q.match(/<title[^>]*>([\s\S]*?)<\/title>/i),ne=se?se[1].trim():l?.title||l?.subject||"";return _c(ne)},[m,l?.html,l?.title,l?.subject]),Re=(0,n.useMemo)(()=>ds({annotationType:V,annotationLogo:T,description:I,discountCode:P,availabilityStarts:y,availabilityEnds:C,offerPageUrl:O,merchantHomepageUrl:X,cards:$}),[V,T,I,P,y,C,O,X,$]),oe=(0,n.useMemo)(()=>te?wc($,s):[],[te,$,s]),Ve=(0,n.useMemo)(()=>Md(Re)&&oe.length===0,[Re,oe]),Oe=(0,n.useMemo)(()=>[...yc(Re,s),...oe],[Re,oe,s]),ye=(0,n.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),he=(0,n.useCallback)(()=>{!m||c()||!Rc(m)||(f.setFieldsValue(ns(V)),p.current={emailId:l?.id,markup:null},_(!1),b.success(s("Gmail annotations were removed from the template code.")))},[m,c,f,V,l?.id,b,s]);(0,n.useEffect)(()=>{if(!te)return;const Q=f.getFieldValue("cards")??[];if(V===Xe.SINGLE_IMAGE_PREVIEW){if(Q.length>1){f.setFieldsValue({cards:[Q[0]]});return}Q.length===0&&f.setFieldsValue({cards:[Qt()]});return}Q.length===0&&f.setFieldsValue({cards:[Qt()]})},[f,te,V,$]);const me=(0,n.useCallback)(Q=>{if(!Q||!h.current||!m||c())return!1;const se=Sc(m,ds(Q));if(se){const ne=ts(m.getContent());p.current={emailId:l?.id,markup:ne},_(ne!==null)}return se},[m,c,l?.id]),ie=(0,n.useCallback)(()=>{me(f.getFieldsValue(!0))&&b.success(s("Gmail annotation was successfully applied to the template code."))},[me,f,b,s]);return(0,n.useEffect)(()=>{if(!i)return;const Q=gc(m?.getContent()||l?.html||""),se={emailId:l?.id,markup:Q?ts(Q):null};if(_(se.markup!==null),!Tc(p.current,se))return;p.current=se,h.current=!1;const ne=Q?qd(Q):null;f.setFieldsValue(ne?Bc(ne):ns()),h.current=!0},[i,l?.id,l?.html,m,f]),(0,o.jsxs)("div",{className:(0,Ue.default)("selected-social-form","annotations-panel",e),ref:E,children:[(0,o.jsx)(fc,{data:Re,subjectLine:xe,parentRef:E,overlayTargetSelector:"#pane-content-iframe",onApply:ie,applyDisabled:!Ve||d,applyBlockers:Oe,onRemove:S&&!d?he:void 0,visible:i}),(0,o.jsxs)(t.ui_kit$Form,{form:f,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:Ro,title:s("Annotation type"),placement:"bottom",getPopupContainer:_o,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:be,placeholder:s("Annotation type"),getPopupContainer:_o})})}),!Z&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Organization logo"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(Ao,{form:f,label:s("Organization logo"),name:"annotationLogo",watchPath:Pc})})}),(le||ge)&&(0,o.jsx)(hs,{iconStrokeWidth:a.iconStrokeWidth}),le&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Price"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:us,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:a.iconStrokeWidth}),placeholder:s("Price"),allowClear:Mo})})}),(0,o.jsx)(ms,{name:Ac,pricePath:us,iconStrokeWidth:a.iconStrokeWidth}),(0,o.jsx)(ps,{name:Nc,iconStrokeWidth:a.iconStrokeWidth})]}),R&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Discount description"),placement:"bottom",getPopupContainer:_o,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:a.iconStrokeWidth}),placeholder:s("Discount description"),allowClear:Mo})})}),Z&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(hs,{iconStrokeWidth:a.iconStrokeWidth}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Offer page URL"),placement:"bottom",getPopupContainer:_o,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:a.iconStrokeWidth}),placeholder:s("Offer page URL"),allowClear:Mo})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Merchant homepage URL"),placement:"bottom",getPopupContainer:_o,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:a.iconStrokeWidth}),placeholder:s("Merchant homepage URL"),allowClear:Mo})})})]}),(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:Ro,title:s("Starts"),placement:"bottom",getPopupContainer:_o,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:cs,getPopupContainer:_o})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Ends"),placement:"bottom",getPopupContainer:_o,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:cs,getPopupContainer:_o})})})})]})]})]}),te&&(0,o.jsxs)("div",{className:(0,Ue.default)("selected-social-form__section",{"selected-social-form__section--bordered":!le,"annotations-panel__cards-section":le}),children:[V===Xe.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:(Q,{add:se,remove:ne})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:Q.map((K,z)=>(0,o.jsx)(Mc,{field:K,index:z,form:f,isSingleImagePreview:le,onRemove:ne},K.key))}),!le&&$.length<pe&&(0,o.jsx)(Fc,{onAdd:se})]})})]}),(0,o.jsxs)("div",{className:"annotations-panel__docs-hint",children:[ye[0],(0,o.jsx)("a",{href:Cc,target:"_blank",rel:"noopener noreferrer",children:s("Gmail annotations")}),ye[1]]})]})]})},Wi=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,a]=(0,n.useState)(r.SETTINGS),d=r.useAppConfig(),c=S=>a(S||""),m=d.settingsTabEnabled,b=d.UTMEnabled&&l==="email",f=d.annotationsEnabled&&l==="email",E=[m&&"Settings",b&&"UTM parameters",f&&"Annotations parameters"].filter(Boolean),h=E.includes(s)?s:E[0],p=(0,n.useMemo)(()=>{const S=[];return m&&S.push({label:(0,o.jsx)(o.Fragment,{children:i("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Vl,{className:"email-settings__collapse-panel-content",element:e})}),b&&S.push({label:(0,o.jsx)(o.Fragment,{children:i("UTM parameters")}),key:r.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Yl,{className:"email-settings__collapse-panel-content",email:e})}),f&&S.push({label:(0,o.jsx)(o.Fragment,{children:i("Annotations")}),key:r.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Dc,{className:"email-settings__collapse-panel-content",email:e,isActive:h===r.ANNOTATIONS_PARAMETERS})}),S},[i,e,m,b,f,h]);return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:h,onChange:c,items:p})})};Wi.propTypes={};var bs=320,Vc=1200,Hc=350,{backgroundColor:fs,backgroundImage:zi,backgroundPositionX:Gi,backgroundPositionY:Yi,backgroundRepeat:Zt,backgroundSize:Xi,responsive:Uc,backgroundColorContent:Wc,width:Ki}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},zc={[fs]:"",[zi]:"",[Gi]:"",[Yi]:"",[Zt]:"checked",[Xi]:"",[Wc]:"",[Ki]:""};function qi(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var gs=({className:e=""})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),s=r.useDispatch(),a=r.useAppConfig(),[d]=t.ui_kit$Form.useForm(),c=r.useSendPostMessage(),m=r.useEmailAttribute("common_styles"),b=r.useSelector(r.selectEmailSettings),f=r.useSelector(r.selectIsSettingsDisabled$1),E=r.useSelector(r.selectActiveSettingsTab),h=r.useSelector(r.selectIsNeedUpdateAppearance),[p,S]=(0,n.useState)(!0),_=(0,n.useRef)(!1),B=(0,n.useRef)(null),T=i("Email not yet loaded or global container not found.");(0,n.useEffect)(()=>{h&&(s(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,h,s,c,m]),(0,n.useEffect)(()=>()=>{B.current&&clearTimeout(B.current)},[]);const I=[{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"}],P=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,n.useEffect)(()=>{const{width:V,...te}=b,R={...te,backgroundImage:b.backgroundImage?b.backgroundImage[0]?.value:"",backgroundRepeat:b[Zt]===""?"repeat":b[Zt],backgroundSize:b[Xi],responsive:b.responsive?.shutdown};_.current||(R.width=V?.value,R.widthDim=V?.dim),d.setFieldsValue(R),S(!b.backgroundImage)},[b,d]);const y=(0,n.useCallback)(V=>{const te=qi(V);!te||te.value<bs||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:te}})},[c]),C=(0,n.useCallback)(V=>{const te=qi(V);te&&s(r.setEmailSettings({...b,width:te}))},[s,b]),O=(0,n.useCallback)(V=>{B.current&&clearTimeout(B.current),C(V),B.current=setTimeout(()=>{y(V)},Hc)},[y,C]),X=V=>{const te=d.getFieldsValue(!0),R=Object.keys(V)[0];switch(R){case Ki:O(V[R]);break;case Gi:case Yi:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[R]:V[R]===""?"none":V[R]}});break;case zi:S(V[R]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[R]:[{...b?.backgroundImage?.[0],type:"url",value:V[R]}],backgroundSize:"cover"}});break;case Uc:{const Z=qi(te.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:V[R],styles:V[R]},...Z?{width:Z}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:V})}},H=V=>{s(r.setMobileViewActive({shutdown:V,styles:V})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},F=()=>{_.current=!0},$=()=>{B.current&&(clearTimeout(B.current),B.current=null);const V=d.getFieldValue(Ki);C(V),y(V),requestAnimationFrame(()=>{_.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,...zc},onValuesChange:X,autoComplete:"off",className:"element-controls",children:[f?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:T,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:b.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:Vc,placeholder:i("Width"),disabled:!b.width?.value,addonAfter:"px",onFocus:F,onBlur:$})})})})})}),a.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:b.responsive?.shutdown===void 0,onChange:H})})})}),(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:!a.emailResponsiveControlEnabled,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:p?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:fs,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:b.usedColors,disabled:f})})})}),(0,o.jsx)(t.ui_kit$Col,{span:p?12:24,children:a.formEmailFieldBackgroundImageEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ao,{form:d,label:i("Background image"),name:zi,tooltipTitle:i("Background image"),disabled:f||E!=="Styles",elementSettings:b}),!p&&(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:Gi,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:Yi,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:Zt,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:f,options:I})})})}),(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:Xi,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:f,options:P})})})})]})]})]})})]})})]})})};gs.propTypes={className:g.default.string};var{Option:_s}=t.ui_kit$Select,{width:xs,widthDim:Gc}={width:"width",widthDim:"widthDim"},Yc={[xs]:"",[Gc]:""},ks=({className:e=""})=>{const{__:i}=r.useI18n(),l=r.useSelector(r.selectBlockSettings),s=r.useSelector(r.selectIsSettingsDisabled),[a]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,n.useEffect)(()=>{a.setFieldsValue({width:l.width.value,widthDim:l.width.dim})},[l,a]);const m=b=>{const f=a.getFieldsValue(!0),E=Object.keys(b)[0];let h;switch(E){case"width":h={[E]:{value:b[E],dim:f.widthDim}};break;case"widthDim":h={width:{value:f.width,dim:b[E]}};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:a,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...Yc},onValuesChange:m,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:xs,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)(_s,{value:"px",children:"px"}),(0,o.jsx)(_s,{value:"%",children:"%"})]})})})})]})})};ks.propTypes={className:g.default.string};var Xc=()=>{};function Es(){const e=r.useContainer(),i=(0,n.useCallback)(s=>{if(!e)return Xc;const a=r.provideDefaultCommonStyles(e).watch(s);return()=>a.dispose()},[e]),l=(0,n.useCallback)(()=>r.getDefaultCommonStyles(e),[e]);return(0,n.useSyncExternalStore)(i,l,l)}function Bs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ji(e,i){const l={...e};for(const s of Object.keys(i)){const a=i[s],d=e[s];Bs(a)&&Bs(d)?l[s]=Ji(d,a):a!==void 0&&(l[s]=a)}return l}function Ss(e,i){const l=r.COMMON_STYLES;if(typeof e=="string"){const s=e.trim();if(s.startsWith("{"))try{const a=JSON.parse(s);if(a&&typeof a=="object"&&!Array.isArray(a)&&Object.keys(a).length>0)return Ji(l,a)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?Ji(l,i):l}var Ts=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}),Kc={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},qc={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},Jc={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},Qc=({className:e})=>{const{__:i}=r.useI18n(),l=U.useGoogleFontsLoader(),s=r.useDispatch(),a=r.useSendPostMessage(),[d]=t.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),m=r.useSelector(r.selectIsNeedUpdateContentAppearance),b=Es(),f=r.useEmailAttribute("common_styles"),E=r.useAppConfig(),{token:h}=(0,t.ui_kit$useToken)(),[p,S]=(0,n.useState)({}),[_,B]=(0,n.useState)({}),[T,I]=(0,n.useState)(!0),[P,y]=(0,n.useState)(!0),[C,O]=(0,n.useState)(!1),[X,H]=(0,n.useState)(!1),F={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},$=Ss(f,b),[V,te]=(0,n.useState)($.headings.bold),[R,Z]=(0,n.useState)($.headings.italic),[ge,le]=(0,n.useState)($.links.underline),[pe,be]=(0,n.useState)($.buttons.bold),[xe,Re]=(0,n.useState)($.buttons.italic),[oe,Ve]=(0,n.useState)(null),Oe=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,n.useEffect)(()=>{Oe||Ve(null)},[$,Ve,Oe]),(0,n.useEffect)(()=>{Oe&&!oe&&Ve(Ts($))},[$,oe,Oe]),(0,n.useEffect)(()=>{m&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(Ts($)))},[d,m,s,$]);const[ye,he]=(0,n.useState)(Math.min($.headings.fontSize-1,19)),[me,ie]=(0,n.useState)(Math.max($.text.fontSize+1,20));(0,n.useEffect)(()=>{if(oe){const K=oe.buttonsBorder;S(K);const z=Object.keys(K).find(_e=>K[_e]?.width||K[_e]?.style||K[_e]?.color),q=oe.cardsBorder;B(q);const ue=Object.keys(q).find(_e=>q[_e]?.width||q[_e]?.style||q[_e]?.color);d.setFieldsValue({buttons_borderPosition:z||"all",buttons_borderWidth:K[z]?.width!==null?K[z]?.width:"",buttons_borderColor:K[z]?.color||"",buttons_borderStyle:K[z]?.style||"",cards_borderPosition:ue||"all",cards_borderWidth:q[ue]?.width!==null?q[ue]?.width:"",cards_borderColor:q[ue]?.color||"",cards_borderStyle:q[ue]?.style||"",buttons_borderRadiusAll:u(oe.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(oe.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(oe.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(oe.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(oe.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(oe.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(oe.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(oe.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(oe.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(oe.cardsBorderRadius.bottomRight),blockPaddingAll:u(oe.blockPaddingAll),blockPaddingTop:u(oe.blockPaddingTop),blockPaddingRight:u(oe.blockPaddingRight),blockPaddingBottom:u(oe.blockPaddingBottom),blockPaddingLeft:u(oe.blockPaddingLeft),blockPaddingLeftRight:u(oe.blockPaddingRight)||u(oe.blockPaddingLeft),blockPaddingTopBottom:u(oe.blockPaddingTop)||u(oe.blockPaddingBottom)}),!u(oe.blockPaddingAll)&&(u(oe.blockPaddingTop)||u(oe.blockPaddingRight)||u(oe.blockPaddingBottom)||u(oe.blockPaddingLeft))&&(oe.blockPaddingTop!==oe.blockPaddingBottom||oe.blockPaddingRight!==oe.blockPaddingLeft)?H(!1):H(!0),!u(oe.buttonsBorderRadius.all)&&(u(oe.buttonsBorderRadius.topLeft)||u(oe.buttonsBorderRadius.bottomLeft)||u(oe.buttonsBorderRadius.topRight)||u(oe.buttonsBorderRadius.bottomRight))?I(!1):I(!0),oe.buttonsPadding&&!u(oe.buttonsPadding.all)&&(u(oe.buttonsPadding.bottom)||u(oe.buttonsPadding.right)||u(oe.buttonsPadding.left)||u(oe.buttonsPadding.top))&&O(!1),!u(oe.cardsBorderRadius?.all)&&(u(oe.cardsBorderRadius?.topLeft)||u(oe.cardsBorderRadius?.bottomLeft)||u(oe.cardsBorderRadius?.topRight)||u(oe.cardsBorderRadius?.bottomRight))?y(!1):y(!0)}},[d,oe]);const Q=()=>{H(z=>!z);const K=d.getFieldsValue(!0);if(!X){K.blockPaddingLeftRight=K.blockPaddingLeft,K.blockPaddingTopBottom=K.blockPaddingTop,K.blockPaddingRight=K.blockPaddingLeft,K.blockPaddingBottom=K.blockPaddingTop;const z=Number(K.blockPaddingTopBottom),q=Number(K.blockPaddingLeftRight);a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(z)?z:0,bottom:Number.isFinite(z)?z:0,left:Number.isFinite(q)?q:0,right:Number.isFinite(q)?q:0}}})}},se=K=>{const z=K.target.closest("button");if(!z)return;const q=z.name,ue=z.classList.contains("selected-td-form__button--active");z.className=ue?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{z.blur()}catch{}q==="headingBold"?te(!ue):q==="headingItalic"?Z(!ue):q==="linkUnderline"?le(!ue):q==="buttonsBold"?be(!ue):q==="buttonsItalic"&&Re(!ue),a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[q]:!ue}})},ne=K=>{const z=d.getFieldsValue(!0),q=Object.keys(K)[0];let ue={};switch(q){case"headingFontSize":he(Math.min(z.headingFontSize-1,19)),ue=K;break;case"textFontSize":ie(Math.max(z.textFontSize+1,20)),ue=K;break;case"buttons_borderStyle":ue={buttonsBorder:{[z.buttons_borderPosition]:{...p[z.buttons_borderPosition],style:K[q]}}},z.buttons_borderPosition==="all"?S(_e=>({...r.RESET_BORDER_PARAMS,[z.buttons_borderPosition]:{..._e[z.buttons_borderPosition],style:K[q]}})):S(_e=>({..._e,[z.buttons_borderPosition]:{..._e[z.buttons_borderPosition],style:K[q]}}));break;case"buttons_borderColor":ue={buttonsBorder:{[z.buttons_borderPosition]:{...p[z.buttonsBorderPosition],color:K[q]}}},z.buttons_borderPosition==="all"?S(_e=>({...r.RESET_BORDER_PARAMS,[z.buttons_borderPosition]:{..._e[z.buttons_borderPosition],color:K[q]}})):S(_e=>({..._e,[z.buttons_borderPosition]:{..._e[z.buttons_borderPosition],color:K[q]}}));break;case"buttons_borderWidth":ue={buttonsBorder:{[z.buttons_borderPosition]:{...p[z.buttons_borderPosition],width:K[q]}}},z.buttonsBorderPosition==="all"?S(_e=>({...r.RESET_BORDER_PARAMS,[z.buttons_borderPosition]:{..._e[z.buttons_borderPosition],width:K[q]}})):S(_e=>({..._e,[z.buttons_borderPosition]:{..._e[z.buttons_borderPosition],width:K[q]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:p[K[q]]?.width||"",buttons_borderColor:p[K[q]]?.color||"",buttons_borderStyle:p[K[q]]?.style||""});break;case"cards_borderStyle":ue={cardsBorder:{[z.cards_borderPosition]:{..._[z.cards_borderPosition],style:K[q]}}},z.cards_borderPosition==="all"?B(_e=>({...r.RESET_BORDER_PARAMS,[z.cards_borderPosition]:{..._e[z.cards_borderPosition],style:K[q]}})):B(_e=>({..._e,[z.cards_borderPosition]:{..._e[z.cards_borderPosition],style:K[q]}}));break;case"cards_borderColor":ue={cardsBorder:{[z.cards_borderPosition]:{..._[z.cardsBorderPosition],color:K[q]}}},z.cards_borderPosition==="all"?B(_e=>({...r.RESET_BORDER_PARAMS,[z.cards_borderPosition]:{..._e[z.cards_borderPosition],color:K[q]}})):B(_e=>({..._e,[z.cards_borderPosition]:{..._e[z.cards_borderPosition],color:K[q]}}));break;case"cards_borderWidth":ue={cardsBorder:{[z.cards_borderPosition]:{..._[z.cards_borderPosition],width:K[q]}}},z.cardsBorderPosition==="all"?B(_e=>({...r.RESET_BORDER_PARAMS,[z.cards_borderPosition]:{..._e[z.cards_borderPosition],width:K[q]}})):B(_e=>({..._e,[z.cards_borderPosition]:{..._e[z.cards_borderPosition],width:K[q]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:_[K[q]]?.width||"",cards_borderColor:_[K[q]]?.color||"",cards_borderStyle:_[K[q]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":ue={buttonsBorderRadius:{[Kc[q]]:+K[q]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":ue={cardsBorderRadius:{[qc[q]]:+K[q]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":C?(ue={padding:{all:+K[q]}},d.setFieldsValue({paddingTop:K[q],paddingLeft:K[q],paddingRight:K[q],paddingBottom:K[q]})):ue={buttonsPadding:{[F[q]]:+K[q]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":ue={blockPadding:{[Jc[q]]:+K[q]}};break;case"blockPaddingTopBottom":ue={blockPadding:{top:+K[q],bottom:+K[q]}},z.blockPaddingTop=z.blockPaddingBottom=+K[q];break;case"blockPaddingLeftRight":ue={blockPadding:{left:+K[q],right:+K[q]}},z.blockPaddingLeft=z.blockPaddingRight=+K[q];break;default:ue=K}q!=="buttons_borderPosition"&&a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:ue})};return oe&&(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:oe,onValuesChange:ne,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:X,onToggleExtended:Q,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:K=>K.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:ye,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:K=>K.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:me,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":V}),type:"default",name:"headingBold",onClick:se,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":R}),type:"default",name:"headingItalic",onClick:se,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":ge}),type:"default",name:"linkUnderline",onClick:se,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:K=>K.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})})})}),E.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{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":pe}),type:"default",name:"buttonsBold",onClick:se,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":xe}),type:"default",name:"buttonsItalic",onClick:se,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]})]}),E.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)(U.SelectedElementFormBorder,{form:d,borders:p,namePrefix:"buttons_"})})}),E.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)(To,{form:d,oneBorderRadiusValue:T,setOneBorderRadiusValue:I,elementSettings:oe,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})})})})]})]}),E.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)(U.SelectedElementFormBorder,{form:d,borders:_,namePrefix:"cards_"})})}),E.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)(To,{form:d,oneBorderRadiusValue:P,setOneBorderRadiusValue:y,elementSettings:oe,namePrefix:"cards_"})})})]})})},Qi=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,a]=(0,n.useState)(r.APPEARANCE),d=r.useAppConfig(),c=f=>a(f||"");e.common_styles&&e.common_styles;const m=l==="email"&&d.commonStylesEnabled&&!0;let b=[{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)(gs,{className:"email-settings__collapse-panel-content"}):(0,o.jsx)(ks,{className:"email-settings__collapse-panel-content"})}];return m&&b.push({label:(0,o.jsx)(o.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Qc,{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:b})})};Qi.propTypes={};var Zc=ro.__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 eu(e){return e.type===io.Tag||e.type===io.Script||e.type===io.Style}var io,ou,tu,iu,ru,lu,su,au,nu,du,Rs=ro.__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"})(io||(io={})),ou=io.Root,tu=io.Text,iu=io.Directive,ru=io.Comment,lu=io.Script,su=io.Style,au=io.Tag,nu=io.CDATA,du=io.Doctype}));function ys(e){return eu(e)}function ws(e){return e.type===io.CDATA}function js(e){return e.type===io.Text}function vs(e){return e.type===io.Comment}function Is(e){return e.type===io.Directive}function Cs(e){return e.type===io.Root}function cu(e){return Object.hasOwn(e,"children")}function Zi(e,i=!1){let l;if(js(e))l=new wt(e.data);else if(vs(e))l=new oi(e.data);else if(ys(e)){const s=i?er(e.children):[],a=new ri(e.name,{...e.attribs},s);for(const d of s)d.parent=a;e.namespace!=null&&(a.namespace=e.namespace),e["x-attribsNamespace"]&&(a["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(a["x-attribsPrefix"]={...e["x-attribsPrefix"]}),l=a}else if(ws(e)){const s=i?er(e.children):[],a=new ii(s);for(const d of s)d.parent=a;l=a}else if(Cs(e)){const s=i?er(e.children):[],a=new vt(s);for(const d of s)d.parent=a;e["x-mode"]&&(a["x-mode"]=e["x-mode"]),l=a}else if(Is(e)){const s=new ti(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 er(e){const i=e.map(l=>Zi(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 ei,yt,wt,oi,ti,jt,ii,vt,ri,Ps=ro.__esmMin((()=>{Rs(),ei=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 Zi(this,e)}},yt=class extends ei{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},wt=class extends yt{type=io.Text;get nodeType(){return 3}},oi=class extends yt{type=io.Comment;get nodeType(){return 8}},ti=class extends yt{type=io.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},jt=class extends ei{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}},ii=class extends jt{type=io.CDATA;get nodeType(){return 4}},vt=class extends jt{type=io.Root;get nodeType(){return 9}},ri=class extends jt{name;attribs;type;constructor(e,i,l=[],s=e==="script"?io.Script:e==="style"?io.Style:io.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"}})),or=ro.__exportAll({CDATA:()=>ii,Comment:()=>oi,DataNode:()=>yt,Document:()=>vt,DomHandler:()=>ir,Element:()=>ri,Node:()=>ei,NodeWithChildren:()=>jt,ProcessingInstruction:()=>ti,Text:()=>wt,cloneNode:()=>Zi,default:()=>ir,hasChildren:()=>cu,isCDATA:()=>ws,isComment:()=>vs,isDirective:()=>Is,isDocument:()=>Cs,isTag:()=>ys,isText:()=>js}),tr,ir,rr=ro.__esmMin((()=>{Rs(),Ps(),Ps(),tr={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},ir=class{dom=[];root=new vt(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,l){typeof i=="function"&&(l=i,i=tr),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??tr,this.elementCB=l??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new vt(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?io.Tag:void 0,s=new ri(e,i,void 0,l);this.addNode(s),this.tagStack.push(s)}ontext(e){const{lastNode:i}=this;if(i&&i.type===io.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const l=new wt(e);this.addNode(l),this.lastNode=l}}oncomment(e){if(this.lastNode&&this.lastNode.type===io.Comment){this.lastNode.data+=e;return}const i=new oi(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new wt(""),i=new ii([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const l=new ti(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}}})),As=ro.__commonJSMin((e=>{var i=Zc(),l=(rr(),ro.__toCommonJS(or)),s="\r",a=new RegExp(s,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function m(_){return i.CASE_SENSITIVE_TAG_NAMES_MAP[_]}function b(_){const B={};let T=0;const I=_.length;for(;T<I;T++){const P=_[T];B[P.name]=P.value}return B}function f(_){_=_.toLowerCase();const B=m(_);return B||_}function E(_,B){const T="<"+B,I=_.toLowerCase().indexOf(T);if(I===-1)return!1;const P=_[I+T.length];return P===">"||P===" "||P===" "||P===`
|
|
19
|
-
`||P==="\r"||P==="/"}function h(_){return _.replace(a,d)}function p(_){return _.replace(c,s)}function S(_,B=null,T){const I=[];let P,y=0;const C=_.length;for(;y<C;y++){const O=_[y];switch(O.nodeType){case 1:{const H=f(O.nodeName);P=new l.Element(H,b(O.attributes)),P.children=S(H==="template"?O.content.childNodes:O.childNodes,P);break}case 3:P=new l.Text(p(O.nodeValue??""));break;case 8:P=new l.Comment(O.nodeValue??"");break;default:continue}const X=I[y-1]??null;X&&(X.next=P),P.parent=B,P.prev=X,P.next=null,I.push(P)}return T&&(P=new l.ProcessingInstruction(T.substring(0,T.indexOf(" ")).toLowerCase(),T),P.next=I[0]??null,P.parent=B,I.unshift(P),I[1]&&(I[1].prev=I[0])),I}e.escapeSpecialCharacters=h,e.formatDOM=S,e.hasOpenTag=E})),uu=ro.__commonJSMin((e=>{var i=As(),l="html",s="head",a="body",d=/<([a-zA-Z]+[0-9]?)/;function c(_,B){return B?B.createHTML(_):_}var m=(_,B,T)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},b=(_,B,T)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},f=typeof window=="object"&&window.DOMParser;if(typeof f=="function"){const _=new f,B="text/html";b=(T,I,P)=>(I&&(T=`<${I}>${T}</${I}>`),_.parseFromString(T,B)),m=b}if(typeof document=="object"&&document.implementation){const _=document.implementation.createHTMLDocument();m=function(B,T,I){if(T){const P=_.documentElement.querySelector(T);return P&&(P.innerHTML=c(B,I)),_}return _.documentElement.innerHTML=c(B,I),_}}var E=typeof document=="object"&&document.createElement("template"),h;E&&E.content&&(h=(_,B)=>(E.innerHTML=c(_,B),E.content.childNodes));var p=()=>document.createDocumentFragment().childNodes;function S(_,B){_=i.escapeSpecialCharacters(_);const T=d.exec(_)?.[1]?.toLowerCase();switch(T){case l:{const I=b(_);if(!i.hasOpenTag(_,s)){const P=I.querySelector(s);P?.parentNode?.removeChild(P)}if(!i.hasOpenTag(_,a)){const P=I.querySelector(a);P?.parentNode?.removeChild(P)}return I.querySelectorAll(l)}case s:case a:{const I=m(_,void 0,B).querySelectorAll(T);return i.hasOpenTag(_,a)&&i.hasOpenTag(_,s)?I[0].parentNode?.childNodes??p():I}default:return h?h(_,B):m(_,a,B).querySelector(a)?.childNodes??p()}}e.default=S})),mu=ro.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=As(),l=uu(),s=/<(![a-zA-Z\s]+)>/;function a(d,c){if(typeof d!="string")throw new TypeError("First argument must be a string");if(!d)return[];const m=s.exec(d),b=m?m[1]:void 0;return i.formatDOM(l.default(d,c?.trustedTypePolicy),null,b)}e.default=a})),pu=ro.__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}})),hu=ro.__commonJSMin((e=>{var i=0,l=1,s=2,a=3,d=4,c=5,m=6;function b(y){return E.hasOwnProperty(y)?E[y]:null}function f(y,C,O,X,H,F,$){this.acceptsBooleans=C===s||C===a||C===d,this.attributeName=X,this.attributeNamespace=H,this.mustUseProperty=O,this.propertyName=y,this.type=C,this.sanitizeURL=F,this.removeEmptyString=$}var E={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(y=>{E[y]=new f(y,i,!1,y,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([y,C])=>{E[y]=new f(y,l,!1,C,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(y=>{E[y]=new f(y,s,!1,y.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(y=>{E[y]=new f(y,s,!1,y,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(y=>{E[y]=new f(y,a,!1,y.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(y=>{E[y]=new f(y,a,!0,y,null,!1,!1)}),["capture","download"].forEach(y=>{E[y]=new f(y,d,!1,y,null,!1,!1)}),["cols","rows","size","span"].forEach(y=>{E[y]=new f(y,m,!1,y,null,!1,!1)}),["rowSpan","start"].forEach(y=>{E[y]=new f(y,c,!1,y.toLowerCase(),null,!1,!1)});var h=/[\-\:]([a-z])/g,p=y=>y[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(y=>{const C=y.replace(h,p);E[C]=new f(C,l,!1,y,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(y=>{const C=y.replace(h,p);E[C]=new f(C,l,!1,y,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(y=>{const C=y.replace(h,p);E[C]=new f(C,l,!1,y,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(y=>{E[y]=new f(y,l,!1,y.toLowerCase(),null,!1,!1)});var S="xlinkHref";E[S]=new f("xlinkHref",l,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(y=>{E[y]=new f(y,l,!1,y.toLowerCase(),null,!0,!0)});var{CAMELCASE:_,SAME:B,possibleStandardNames:T}=pu(),I=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]*$")),P=Object.keys(T).reduce((y,C)=>{const O=T[C];return O===B?y[C]=C:O===_?y[C.toLowerCase()]=C:y[C]=O,y},{});e.BOOLEAN=a,e.BOOLEANISH_STRING=s,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=m,e.RESERVED=i,e.STRING=l,e.getPropertyInfo=b,e.isCustomAttribute=I,e.possibleStandardNames=P}));function bu(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 a(_){var B=_.match(Ls);B&&(l+=B.length);var T=_.lastIndexOf(Hs);s=~T?_.length-T:s+_.length}function d(){var _={line:l,column:s};return function(B){return B.position=new c(_),f(),B}}function c(_){this.start=_,this.end={line:l,column:s},this.source=i.source}c.prototype.content=e;function m(_){var B=new Error(i.source+":"+l+":"+s+": "+_);if(B.reason=_,B.filename=i.source,B.line=l,B.column=s,B.source=e,!i.silent)throw B}function b(_){var B=_.exec(e);if(B){var T=B[0];return a(T),e=e.slice(T.length),B}}function f(){b(Os)}function E(_){var B;for(_=_||[];B=h();)B!==!1&&_.push(B);return _}function h(){var _=d();if(!(sr!=e.charAt(0)||ar!=e.charAt(1))){for(var B=2;Yo!=e.charAt(B)&&(ar!=e.charAt(B)||sr!=e.charAt(B+1));)++B;if(B+=2,Yo===e.charAt(B-1))return m("End of comment missing");var T=e.slice(2,B-2);return s+=2,a(T),e=e.slice(B),s+=2,_({type:Us,comment:T})}}function p(){var _=d(),B=b($s);if(B){if(h(),!b(Fs))return m("property missing ':'");var T=b(Ms),I=_({type:Ws,property:Ns(B[0].replace(lr,Yo)),value:T?Ns(T[0].replace(lr,Yo)):Yo});return b(Ds),I}}function S(){var _=[];E(_);for(var B;B=p();)B!==!1&&(_.push(B),E(_));return _}return f(),S()}function Ns(e){return e?e.replace(Vs,Yo):Yo}var lr,Ls,Os,$s,Fs,Ms,Ds,Vs,Hs,sr,ar,Yo,Us,Ws,fu=ro.__esmMin((()=>{lr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ls=/\n/g,Os=/^\s*/,$s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Fs=/^:\s*/,Ms=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ds=/^[;\s]*/,Vs=/^\s+|\s+$/g,Hs=`
|
|
20
|
-
`,sr="/",ar="*",Yo="",Us="comment",Ws="declaration"}));function gu(e,i){let l=null;if(!e||typeof e!="string")return l;const s=bu(e),a=typeof i=="function";return s.forEach(d=>{if(d.type!=="declaration")return;const{property:c,value:m}=d;a?i(c,m,d):m&&(l=l??{},l[c]=m)}),l}var _u=ro.__esmMin((()=>{fu()})),xu=ro.__exportAll({default:()=>ku});function ku(e,i){const l={};return!e||typeof e!="string"||gu(e,(s,a)=>{s&&a&&(l[Qs(s,i)]=a)}),l}var zs,Gs,Ys,Xs,Ks,qs,Js,nr,Qs,Eu=ro.__esmMin((()=>{_u(),zs=/^--[a-zA-Z0-9_-]+$/,Gs=/-([a-z])/g,Ys=/^[^-]+$/,Xs=/^-(webkit|moz|ms|o|khtml)-/,Ks=/^-(ms)-/,qs=e=>!e||Ys.test(e)||zs.test(e),Js=(e,i)=>i.toUpperCase(),nr=(e,i)=>`${i}-`,Qs=(e,i={})=>qs(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(Ks,nr):e=e.replace(Xs,nr),e.replace(Gs,Js))})),Zs=ro.__commonJSMin((e=>{var i=e&&e.__importDefault||function(E){return E&&E.__esModule?E:{default:E}};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=m;var l=go("react"),s=i((Eu(),ro.__toCommonJS(xu))),a=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function d(E,h){return E.includes("-")?!a.has(E):!!(h&&typeof h.is=="string")}var c={reactCompat:!0};function m(E,h){if(typeof E=="string"){if(!E.trim()){h.style={};return}try{h.style=(0,s.default)(E,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 b=E=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(E.name);e.canTextBeChildOfNode=b;var f=E=>E;e.returnFirstArg=f})),ea=ro.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=hu(),l=Zs(),s=["checked","value"],a=["input","select","textarea"],d={reset:!0,submit:!0};function c(b={},f){const E={},h=!!(b.type&&d[b.type]);for(const p in b){const S=b[p];if((0,i.isCustomAttribute)(p)){E[p]=S;continue}const _=p.toLowerCase();let B=m(_);if(B){const T=(0,i.getPropertyInfo)(B);switch(s.includes(B)&&a.includes(f)&&!h&&(B=m("default"+_)),E[B]=S,T?.type){case i.BOOLEAN:E[B]=!0;break;case i.OVERLOADED_BOOLEAN:S===""&&(E[B]=!0)}continue}l.PRESERVE_CUSTOM_ATTRIBUTES&&(E[p]=S)}return(0,l.setStyleProp)(b.style,E),E}function m(b){return i.possibleStandardNames[b]}})),Bu=ro.__commonJSMin((e=>{var i=e&&e.__importDefault||function(E){return E&&E.__esModule?E:{default:E}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=m;var l=(rr(),ro.__toCommonJS(or)),s=go("react"),a=i(ea()),d=Zs(),c={cloneElement:s.cloneElement,createElement:s.createElement,isValidElement:s.isValidElement};function m(E,h={}){var p,S,_,B,T;const I=[],P=typeof h.replace=="function",y=(p=h.transform)!==null&&p!==void 0?p:d.returnFirstArg,{cloneElement:C,createElement:O,isValidElement:X}=(S=h.library)!==null&&S!==void 0?S:c,H=E.length;b(E);for(let F=0;F<H;F++){const $=E[F];if(P){let Z=(_=h.replace)===null||_===void 0?void 0:_.call(h,$,F);if(X(Z)){H>1&&(Z=C(Z,{key:(B=Z.key)!==null&&B!==void 0?B:F})),I.push(y(Z,$,F));continue}}if($.type==="text"){const Z=!$.data.trim().length;if(Z&&$.parent&&!(0,d.canTextBeChildOfNode)($.parent)||h.trim&&Z)continue;I.push(y($.data,$,F));continue}const V=$;let te={};f(V)?((0,d.setStyleProp)(V.attribs.style,V.attribs),te=V.attribs):V.attribs&&(te=(0,a.default)(V.attribs,V.name));let R;switch($.type){case"script":case"style":$.children[0]&&(te.dangerouslySetInnerHTML={__html:$.children[0].data});break;case"tag":$.name==="textarea"&&$.children[0]?te.defaultValue=$.children[0].data:!((T=$.children)===null||T===void 0)&&T.length&&(R=m($.children,h));break;default:continue}H>1&&(te.key=F),I.push(y(O($.name,te,R),$,F))}return I.length===1?I[0]:I}function b(E){for(const h of E)(h.type==="tag"||h.type==="script"||h.type==="style")&&(Object.setPrototypeOf(h,l.Element.prototype),b(h.children))}function f(E){return d.PRESERVE_CUSTOM_ATTRIBUTES&&E.type==="tag"&&(0,d.isCustomComponent)(E.name,E.attribs)}})),Su=ro.__commonJSMin((e=>{var i=e&&e.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=m;var l=i(mu());e.htmlToDOM=l.default;var s=i(ea());e.attributesToProps=s.default;var a=i(Bu());e.domToReact=a.default;var d=(rr(),ro.__toCommonJS(or));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 m(b,f){var E;if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];const h=Object.assign(Object.assign({},(E=f?.htmlparser2)!==null&&E!==void 0?E:c),{trustedTypePolicy:f?.trustedTypePolicy});return(0,a.default)((0,l.default)(b,h),f)}})),mt=ro.__toESM(Su(),1),Tu=mt.default.default||mt.default,dr=new Set;function Ru(e,i){dr.has(e)||(dr.add(e),Promise.resolve(i()).finally(()=>{dr.delete(e)}))}var yu={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function oa(e,i,l){l.document&&(r.writeEmailAttributes(l.document,{[e]:i}),l.pushToDataLayer({event:"submit",action:yu[e],entity_type:l.entityType,entity_id:l.entityId,project_id:l.projectId,context:"editor"}))}function cr({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function ta({limitsInPlugin:e,hostedAiActive:i,counter:l,limit:s}){return cr({limitsInPlugin:e,hostedAiActive:i})?s>0&&l>=s:!1}function ia(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"),a=s.querySelector("editor");if(a){a.innerHTML=i;const d=e.match(/^[\s\uFEFF]*<!DOCTYPE[^>]*>/i);return`${d?`${d[0]}
|
|
21
|
-
`:""}${s.documentElement.outerHTML}`}}catch{}return i}var wu=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")]})}]},ju={background:r.emCssVar("colorInfo"),color:"#ffffff"},ra=({messages:e,newEmailAiGeneratorRef:i})=>{const l=r.useElementEntityKind(),{document:s}=r.useDocumentSessionContext(),a=r.useContentReader(),d=r.useUserContentReplacer(),{__:c,_n:m}=r.useI18n(),b=r.useDispatch(),f=r.useAppNavigate(),E=(0,n.useRef)(null),h=r.useAppConfig(),p=r.useEditorLocked(),S=r.useEditorLockCheck(),_=r.useNotification(),B=r.useEditorProjectId(),T=r.useOpenEmailId(),I=r.usePushToDataLayer(),P={document:s,pushToDataLayer:I,entityType:l==="block"?"block":"email",entityId:T,projectId:B},y=r.useEventEmitter(bo.events.ON_LIMIT_ID),[C,O]=(0,n.useState)(null),[X,H]=(0,n.useState)(0),[F,$]=(0,n.useState)(!1),[V,te]=(0,n.useState)(""),[R,Z]=(0,n.useState)([]),[ge,le]=(0,n.useState)(!1),[pe,be]=(0,n.useState)(!1),[xe,Re]=(0,n.useState)(null),[oe,Ve]=(0,n.useState)(0),[Oe,ye]=(0,n.useState)(null),he=r.useEmailAttribute("subject"),me=r.useEmailAttribute("preheader"),ie=r.useCurrentUser(),Q=r.toLanguageCode(r.useInterfaceLocale()),se=ie.avatar_url||ie.avatar_urls?.[24],ne=[ie.first_name,ie.last_name].filter(Boolean).join(" ")||ie.username,K=r.useMessageService(),[z]=r.useLazyGetDialogQuery(),q=r.useSendPostMessage(),[ue,_e]=r.useSendMessageMutation(),[fe,{reset:Le}]=r.useGetAiGenerateStatusMutation(),[we,{data:Ne=[]}]=r.useLazyGetGeneratedContentQuery(),[Y]=r.useLazyGetLimitsStatsByTypeQuery(),re={cursor:F?"not-allowed":"default",pointerEvents:F?"none":"auto"};(0,n.useEffect)(()=>{Oe&&ge&&(i.current=!0),ge||(i.current=!1)},[Oe,ge]);const je=!!(h.limits&&h.counters)&&!0,{limits:W}=h.limits?h:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:Se,ai_generator_limit:Ie}=W,Pe=r.useEventEmitter(bo.events.AI_TEXT_REQUEST_ID).hasListeners(),Me=cr({limitsInPlugin:je,hostedAiActive:Pe}),He=ta({limitsInPlugin:je,hostedAiActive:Pe,counter:X,limit:Se}),ze=ta({limitsInPlugin:je,hostedAiActive:Pe,counter:oe,limit:Ie}),ae=(0,n.useCallback)(()=>{y.fire({name:"AiChatCount",count:X+1})},[y,X]),Be=(0,n.useCallback)(()=>{y.fire({name:"AiGeneratorCount",count:oe+1})},[y,oe]),v=(0,n.useCallback)(async A=>!0,[c,Y,_]);(0,n.useEffect)(()=>{je&&(H(h?.counters?.ai_counter||0),Ve(h?.counters?.ai_generator_counter||0))},[h,je]),(0,n.useEffect)(()=>{ye(R.length<=0?!1:R.toReversed().find(x=>x.data?.context)?.data.context==="email-generator")},[R]);const ee=(0,n.useCallback)(async()=>await K.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[K]),Te=(0,n.useCallback)(()=>{const A=E.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{A?.scrollTo({top:A.scrollHeight,behavior:"smooth"})},0)},[E]),Ce=(0,n.useCallback)(()=>{r.swallowPromiseRejection(z({entity_id:T}).then(A=>{Z(A.data.documents),Te()}))},[T,z,Z,Te]),De=(0,n.useCallback)(A=>{if(!A?.data?._eventResult)return!1;const{aiMessage:x,aiHtml:L}=A.data;if(Z(k=>{const G=[...k];for(let de=G.length-1;de>=0;de--)if(G[de]?.data?.isLoading&&G[de]?.data?.role==="assistant"){G[de]={data:{role:"assistant",message:x,isLoading:!1}};break}return G}),L){const k=ia(a(),String(L));d(k,{undoable:!0})}return Te(),!0},[a,d,Te]),We=(0,n.useCallback)(A=>{Z(x=>{for(let L=x.length-1;L>=0;L--)if(x[L]?.data?.isLoading&&x[L]?.data?.role==="assistant"){const k=[...x];return A?k[L]={data:{role:"assistant",message:A}}:k.splice(L,1),k}return x})},[]),Je=(0,n.useCallback)(A=>{const x=A?.message==="ERROR"?void 0:A?.message;return[A?.data?.message,x].find(L=>typeof L=="string"&&L)||c("Something went wrong.")},[c]),M=r.useEventEmitter(bo.events.AI_TEXT_PROGRESS_ID);(0,n.useEffect)(()=>{const A=M.event(({progress:x,status:L})=>{const k=L||`${Math.round(x)}%`;Z(G=>{const de=[...G];for(let Ge=de.length-1;Ge>=0;Ge--)if(de[Ge]?.data?.isLoading&&de[Ge]?.data?.role==="assistant"){de[Ge]={data:{...de[Ge].data,message:k}};break}return de})});return()=>A.dispose()},[M]);const J=r.useEventEmitter(bo.events.AI_TEXT_STREAM_ID);(0,n.useEffect)(()=>{const A=J.event(({partialHtml:x})=>{const L=ia(a(),String(x));d(L,{undoable:!0})});return()=>A.dispose()},[J,a,d,b]);const j=(0,n.useCallback)(A=>{le(!0),$(!0),r.swallowPromiseRejection(fe({task_id:A||C,entity_id:T,status:"started"}).then(()=>{Ce()}))},[T,fe,C,Ce]),w=(0,n.useCallback)(()=>{fe({task_id:C,entity_id:T,status:"completed"}).then(A=>{A.data.status===403&&Le(),Ce()}).catch(A=>{}),$(!1),le(!1)},[T,fe,C,Ce,Le]);(0,n.useEffect)(()=>{let A;if(ge){const x=Ne[Ne.length-1]?.processing?.email;if(x){let L=Ne[Ne.length-1].status;d(String(x),{undoable:!0}),L===0&&w()}xe&&(clearInterval(A),le(!1),Re(!1),$(!1),We())}return()=>{clearInterval(A)}},[d,xe,b,Ne,ge,he,me,T,C,Ce,fe,_e,w,We]),(0,n.useEffect)(Te,[Te]),(0,n.useEffect)(()=>{e?.length>0&&Z(e),q({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,q]),(0,n.useEffect)(()=>{const A=K.onInit(()=>{K.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:F}),K.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:F})});return()=>A.dispose()},[F,K]);const ce=async()=>{if(V&&!S()){const A=V.replaceAll(/\n/g,"<br>"),x={project_id:B,connection:"chat",entity_id:T,message:A,locale:Q,subject:he||"",preheader:me||"",textContent:di.extractDocumentTextContent(a())};if(Oe&&ze||He){_.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 L={data:{role:"assistant",message:c(Oe?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};Z(k=>[...k,L])}else{if(!await v(Oe?"email_generate":"ai")){te("");return}Me&&(Oe&&oe!==Ie?(Be(),Ve(k=>k+1)):X!==Se&&(ae(),H(k=>k+1))),I({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:x.entity_id,project_id:x.project_id});const L=[{data:{role:"user",message:A,userInfo:{display_name:ne,avatar_url:se}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];Z(k=>[...k,...L]),ue({body:x}).then(k=>{if(k?.error)throw k.error;if(!k?.data||k.data.status===401)throw new Error(r.ERROR);if(!De(k)){if(I({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:T,project_id:B,context:"editor"}),k.data.task_id){let G=k.data.task_id;O(G),we({id:G,setError:Re}),r.swallowPromiseRejection(ee().then(de=>{de?j(G):be(!0)}))}Ce()}}).catch(k=>{const G=Je(k);_.error({title:k?.data?.code||c("Error"),description:G}),We(G)})}te("")}},ve=async A=>{if(S())return;const x={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};Z(k=>[...k,x]);const L={project_id:B,connection:"chat",entity_id:T,context:A,locale:Q,subject:he||"",preheader:me||"",textContent:di.extractDocumentTextContent(a())};if(Me&&(Oe&&oe!==Ie?(Be(),Ve(k=>k+1)):X!==Se&&(ae(),H(k=>k+1))),He)_.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),We(c("You have reached the limit of AI chat usage."));else{if(!await v("ai")){We();return}I({event:"select",action:"select_ai_assistant_role",context:L.context,entity_id:L.entity_id,project_id:L.project_id}),ue({body:L}).then(k=>{if(k?.error)throw k.error;if(!k?.data||k.data.status===401)throw new Error(r.ERROR);De(k)||Ce()}).catch(k=>{const G=Je(k);_.error({title:k?.data?.code||c("Error"),description:G}),We(G)})}},Ye=(0,n.useCallback)(async A=>{const x={data:{role:"user",message:A,userInfo:{display_name:ne,avatar_url:se}}},L={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};Z(G=>[...G,x,L]);const k={project_id:B,connection:"chat",entity_id:T,message:A,locale:Q,subject:he||"",preheader:me||"",textContent:di.extractDocumentTextContent(a())};if(ze)_.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),We(c("You have reached the limit of AI chat usage."));else{if(!await v(Oe?"email_generate":"ai")){We();return}ue({body:k}).then(G=>{if(G?.error)throw G.error;if(!G?.data||G.data.status===401)throw new Error(r.ERROR);if(!De(G)){if(I({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:T,project_id:B,context:"editor"}),G.data.task_id){let de=G.data.task_id;O(de),we({id:de,setError:Re}),r.swallowPromiseRejection(ee().then(Ge=>{Ge?j(de):be(!0)}))}Me&&(Oe&&oe!==Ie?(Be(),Ve(de=>de+1)):X!==Se&&(ae(),H(de=>de+1))),Ce()}}).catch(G=>{const de=Je(G);_.error({title:G?.data?.code||c("Error"),description:de}),We(de)})}},[c,X,oe,se,ee,We,j,Je,ne,Se,Ie,ie,he,me,T,Oe,ze,Q,ae,Be,Me,a,_,v,B,ue,we,Ce]);(0,n.useEffect)(()=>{const A=new bo.Disposable,x=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&x&&T&&!p){const L={project_id:B,connection:"chat",entity_id:T,context:"email-generator",locale:Q};Ru(`discuss-ai-generator-context:${T}`,()=>{if(Pe){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),Ye(x);return}r.swallowPromiseRejection(ue({body:L}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),A.isDisposed()||Ye(x)}))})}return()=>A.dispose()},[e,Ye,T,Q,B,ue,Pe,p]);const qe=A=>{typeof A.target.className=="string"&&A.target.className.includes("ai-response-change-context")&&(_e.isLoading||ve(A.target.role))},oo=A=>{if(S())return;const x=A.children[0].data??"";oa("subject",x,P),_.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:x})},to=A=>{if(S())return;const x=A.children[0].data??"";oa("preheader",x,P),_.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:x,duration:300})},no=A=>{const x=A.children[0].data;navigator.clipboard.writeText(x).then(()=>{_.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:x})}).catch(L=>{})},fo={replace:A=>{if(A.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:()=>oo(A),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,mt.domToReact)(A.children,fo)})})});if(A.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:()=>to(A),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,mt.domToReact)(A.children,fo)})})});if(A.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:()=>no(A),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,mt.domToReact)(A.children,fo)})})});if(A.attribs?.class?.split(" ").includes("ai-response-user-message")){const x=A.attribs?.data||A.children?.[0]?.data;return(0,o.jsx)("li",{className:A.attribs?.class,data:A.attribs?.data,onClick:()=>Ye(x),children:(0,mt.domToReact)(A.children,fo)})}}},xo=()=>{j(),be(!1)},D=()=>{w(),be(!1)};return(0,o.jsxs)("div",{ref:E,className:"discuss-main",children:[R.length>0&&(0,o.jsx)(t.ui_kit$List,{onClick:qe,className:"comment-list",itemLayout:"horizontal",dataSource:R,renderItem:A=>(0,o.jsx)("li",{id:A._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:A.data.userInfo?"":"ai-comment",avatar:A.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"}}):A.data.userInfo&&A.data._modified?A.data.userInfo.avatar_url:se||(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:re,children:A?.data?.role==="user"?ie?.username||c("User"):c("AI Assistant")}),datetime:A._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(A._created),m,!0)}}):null,content:A.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:re,children:Tu(A.data.message,fo)})})},A._id)}),je&&(Oe?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${oe} ${c("of")} ${Ie>0?Ie:"∞"} ${c("mail generator")} ${m("was used","were used",oe)}`,exceeded:Ie>0&&oe>=Ie,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>f(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${X} ${c("of")} ${Se>0?Se:"∞"} ${c("messeges")} ${m("was used","were used",X)}`,exceeded:Se>0&&X>=Se,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>f(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,o.jsxs)(t.ui_kit$Form,{onFinish:ce,className:"addMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{disabled:F||p,value:V,onChange:A=>te(A.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:A=>A.key==="Enter"&&A.ctrlKey&&ce(),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:_e.isLoading||F||p,type:"default",style:ju,className:"button-target",children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"top",disabled:F,arrow:{pointAtCenter:!0},menu:{items:wu(ve)},children:(0,o.jsxs)("div",{disabled:F,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:_e.isLoading||F||p,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:pe,onOk:xo,onCancel:D,children:(0,o.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},vu=[r.VALID,r.ERRORS,r.WARNINGS],la=({summary:e,__:i,selectedTags:l,setSelectedTags:s})=>{const a=(0,n.useCallback)((c,m)=>{s(m?l.length===2?[]:[...l,c]:l.filter(b=>b!==c))},[l,s]),d=(0,n.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:vu.map((c,m)=>(0,o.jsxs)(t.ui_kit$CheckableTag,{checked:l?.includes(c),onChange:b=>a(c,b),className:(0,Ue.default)(`${c} optimise__button`,{[`${c}_active`]:l.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+m))})})},{LINKS:Iu}=r.OPTIMISE_TABS,sa=(0,n.memo)(({__:e,activeTab:i,validateLinksResult:l,validateLinks:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:m,iconStrokeWidth:b,onValidate:f,goToLinkHandler:E})=>i!==Iu||!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)(la,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:a}),(0,o.jsx)(t.ui_kit$Button,{disabled:m,loading:c,onClick:f,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:b}),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,p)=>(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:()=>E(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")})]})]})})},p+"_"+h.linkId)})})})]}));sa.displayName="LinksSection";var{IMAGES:Cu}=r.OPTIMISE_TABS,aa=(0,n.memo)(({__:e,activeTab:i,validateImagesResult:l,validateImages:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:m,iconStrokeWidth:b,onValidate:f,goToImageHandler:E,showImgPreviewHandler:h,hideBlockPreviewHandler:p})=>i!==Cu||!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(S=>S.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)(la,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:a}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:b}),disabled:m,loading:c,onClick:f,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:(S,_)=>(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":!S.resolvedUrl&&!S.statusCode}),avatar:(0,o.jsx)(t.ui_kit$Image,{className:(0,Ue.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!S.resolvedUrl||!S.valid}),width:92,height:"auto",src:S.resolvedUrl||"",preview:!1,onMouseEnter:()=>h(S.url,S.image.dimensions?.width),onMouseLeave:()=>p()}),title:S.url?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:S.message,children:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>E(S.imageId,600>(S.statusCode||0)&&(S.statusCode||0)>399||!S.statusCode),children:S?.url===""?e("empty src"):S.url})}):S.message,description:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"image-size",children:[S.image.dimensions&&(0,o.jsxs)(o.Fragment,{children:[S.image.dimensions.width+" × "+S.image.dimensions.height,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[Math.round(S.image.bytes/1024),e("kB")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[S.image.responseTime,e("ms")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"image-size-format",children:$t(S.image.contentType)})]}),S.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")})]}),S.resolvedUrl&&!S.valid&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!S.resolvedUrl&&!S.statusCode&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},_)})})})]}));aa.displayName="ImagesSection";var{SPAM_ASSASSIN:Pu}=r.OPTIMISE_TABS,na=(0,n.memo)(({__:e,activeTab:i,validateSpamResult:l,isLoading:s,disabled:a,iconStrokeWidth:d,onValidate:c})=>{const m=l?.report?.length||Object.prototype.hasOwnProperty.call(l,"spamScore");if(i!==Pu||!m)return null;const b=l.spamScore||0,f=l.baseSpamScore||0,E=b<2||!l.spamScore||b<=f-1?"success":b<f-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:E,children:[(0,o.jsx)("span",{className:"optimise__spam-score-value",children:b}),(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,o.jsx)(t.ui_kit$Button,{disabled:a,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:d}),loading:s,onClick:c,children:e("Refresh")})]}),b>f-1&&(0,o.jsx)(t.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(f-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.")})})})]})});na.displayName="SpamSection";var{PROBLEMS:Au}=r.OPTIMISE_TABS,da=(0,n.memo)(({__:e,activeTab:i,problemsList:l,onSetMonacoPosition:s})=>i!==Au?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:a=>(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:a.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(a),className:(0,Ue.default)("optimise__text-clickable",{warning:a.severity<6,error:a.severity>=6}),children:["Line: ",a.startLineNumber," ",a.startLineNumber!==a.endLineNumber&&" – "+a.endLineNumber]}),description:(0,o.jsx)(t.ui_kit$Text,{children:a.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"})}));da.displayName="ProblemsSection";var Nu={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,linkCheckCounter:0,imageCheckCounter:0,spamCheckCounter:0,validateLinksResult:{},validateImagesResult:{}},Lu=(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_OPTIMISATION_COUNTER":return{...e,optimisationCounter:i.payload};case"INCREMENT_OPTIMISATION_COUNTER":return{...e,optimisationCounter:e.optimisationCounter+1};case"SET_LINK_CHECK_COUNTER":return{...e,linkCheckCounter:i.payload};case"INCREMENT_LINK_CHECK_COUNTER":return{...e,linkCheckCounter:e.linkCheckCounter+1};case"SET_IMAGE_CHECK_COUNTER":return{...e,imageCheckCounter:i.payload};case"INCREMENT_IMAGE_CHECK_COUNTER":return{...e,imageCheckCounter:e.imageCheckCounter+1};case"SET_SPAM_CHECK_COUNTER":return{...e,spamCheckCounter:i.payload};case"INCREMENT_SPAM_CHECK_COUNTER":return{...e,spamCheckCounter:e.spamCheckCounter+1};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}},li={link_check:"link_check_counter",image_check:"image_check_counter",spam_check:"spam_check_counter"},ur={link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},Ou=(e,i)=>{const l=Object.values(li),s=Object.values(ur);return l.some(a=>e?.[a]!==void 0)||s.some(a=>i?.[a]!==void 0)||l.some(a=>i?.[a]!==void 0)||s.some(a=>e?.[a]!==void 0)},pt=(e,i,l=0)=>{const s=e?.[i];return typeof s=="number"&&!Number.isNaN(s)?s:l},$u=(e,i)=>({counter:e,limit:i,disabled:i>0&&e>=i}),Fu=({appConfig:e,data:i,isSuccess:l,optimisationCounter:s,linkCheckCounter:a,imageCheckCounter:d,spamCheckCounter:c,setOptimisationCounter:m,setLinkCheckCounter:b,setImageCheckCounter:f,setSpamCheckCounter:E})=>{const h=(0,n.useMemo)(()=>!!(e.limits&&e.counters)&&!0,[e]),p=(0,n.useMemo)(()=>e.counters,[e,i]),S=(0,n.useMemo)(()=>e.limits,[e,i]),_=(0,n.useMemo)(()=>h&&Ou(p,S),[h,p,S]),B=(0,n.useMemo)(()=>pt(S,"optimization_limit",0),[S]),T=(0,n.useMemo)(()=>!_&&s>=B&&B>0,[_,s,B]),I=(0,n.useMemo)(()=>{const y={link_check:a,image_check:d,spam_check:c};return Object.keys(ur).reduce((C,O)=>{const X=ur[O],H=_?pt(S,X,0):B,F=_?y[O]:s;return C[O]=$u(F,H),C},{})},[_,S,B,a,d,c,s]),P=y=>_?I[y].disabled:T;return(0,n.useEffect)(()=>{if(!h){const y=i?.counters;l&&y?.optimization_counter&&m(y.optimization_counter);return}m(pt(p,"optimization_counter",0)),_&&(b(pt(p,li.link_check,0)),f(pt(p,li.image_check,0)),E(pt(p,li.spam_check,0)))},[h,_,i,l,p,m,b,f,E]),{limitsInPlugin:h,perTypeAvailable:_,currentBillingOptimisationLimits:B,disableFields:T,typeLimits:I,isTypeDisabled:P}},Mu=()=>{const e=(0,n.useRef)(null);return{showImgPreviewHandler:(0,n.useCallback)((i,l)=>{e.current&&clearTimeout(e.current);let s=document.querySelector(".img-preview"),a=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(s=document.createElement("div"),s.classList.add("img-preview"),a=document.createElement("div"),a.classList.add("img-preview-content"),s.append(a),document.querySelector(".email-pane__col_settings-inner")?.append(s)),a&&(a.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,n.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:Du,IMAGES:Vu}=r.OPTIMISE_TABS,Hu=({activeTab:e,selectedTags:i,validateLinksResult:l,validateImagesResult:s,setValidateLinks:a,setValidateImages:d})=>{(0,n.useEffect)(()=>{e===Du&&l.links&&a(i.length>0?l.links.filter(c=>i.includes(c.status)):l.links),e===Vu&&s.images&&d(i.length>0?s.images.filter(c=>i.includes(c.status)):s.images)},[l.links,s.images,i,e,a,d])},Uu=e=>(e.statusCode!==null?e.statusCode<300&&(e.page?.secure??!0):e.type!=="invalid")?r.VALID:(e.statusCode&&e.statusCode<400||e.statusCode===200&&(e.page?.secure??!0))&&e.type!=="invalid"?r.WARNINGS:r.ERRORS,ca=e=>e.statusCode!==null&&e.statusCode<300?r.VALID:e.statusCode<400&&e.statusCode>=300||e.statusCode===200&&!e.valid?r.WARNINGS:r.ERRORS,ua=e=>({valid:e.filter(i=>i.status===r.VALID).length,warnings:e.filter(i=>i.status===r.WARNINGS).length,errors:e.filter(i=>i.status===r.ERRORS).length}),Wu={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 ma(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 si=({open:e,onClose:i,title:l,subtitle:s,usageResource:a,icon:d,previousDisplay:c,nextDisplay:m,onChangePlan:b,secondaryAction:f,changePlanLabel:E})=>{const{__:h}=r.useI18n(),p=E??h("Change plan"),S=!!f,_=a!=null?Wu[a]: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:_}),ma(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"})}),ma(m,"new")]})]}),(0,o.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,o.jsx)("div",{className:S?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:f?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:f.onClick,children:f.label}),(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:b,children:p})]}):(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:b,children:p})})]})})},{LINKS:mr,IMAGES:pr,SPAM_ASSASSIN:pa,PROBLEMS:hr}=r.OPTIMISE_TABS,ha={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},zu={link_check:"LinkCheckCount",image_check:"ImageCheckCount",spam_check:"SpamCheckCount"},Gu={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},ba=(e,i,l,s)=>`${e} ${l("of")} ${i>0?i:"∞"} ${s("test","tests",i>0?i:e)} ${s("was used","were used",e)}`,fa=()=>{const{__:e,_n:i}=r.useI18n(),l=r.useDispatch(),s=r.useOpenPlanCatalog(),a=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),m=r.useAppConfig(),b=r.useEditorProjectId(),f=r.useRouteEmailId(),{document:E}=r.useDocumentSessionContext(),h=r.useEmailOfDocument(E,void 0),p=f||(h?.id!=null?String(h.id):void 0),S=p||h?.renderGuid,_=b||(h?.project!=null?String(h.project):void 0),[B,T]=(0,n.useState)(null),I=(0,n.useRef)(!1),P=(0,n.useRef)({link_check:!1,image_check:!1,spam_check:!1}),y=r.useProjectPlanLimitPreflight(),C=(0,n.useCallback)(v=>{T(v)},[]),O=(0,n.useCallback)((v,ee)=>v?.status===401&&v?.data?.code==="usage_limit_exceeded"?(C({presetId:{link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"}[ee],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")}),l(r.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0):!1,[l,e,C]),X=(0,n.useCallback)((v,ee)=>{O(v,ee)||d.error({error:v})},[O,d]),H=(0,n.useCallback)(async v=>!0,[l,y,C]),F=r.useMessageService(),$=r.useSelector(r.selectProblemsList),V=r.useEventEmitter(bo.events.ON_LIMIT_ID),te=r.usePushToDataLayer(),[R,Z]=(0,n.useReducer)(Lu,Nu),[ge,le]=r.useEditSpamMutation(),[pe,be]=r.useEditLinksMutation(),[xe,Re]=r.useEditImagesMutation(),{data:oe,isSuccess:Ve}=r.useGetProjectQuery(+(_||0),{skip:!0}),Oe=r.useInvalidateProject(),ye=(0,n.useCallback)(v=>Z({type:"SET_OPTIMISATION_COUNTER",payload:v}),[]),he=(0,n.useCallback)(v=>Z({type:"SET_LINK_CHECK_COUNTER",payload:v}),[]),me=(0,n.useCallback)(v=>Z({type:"SET_IMAGE_CHECK_COUNTER",payload:v}),[]),ie=(0,n.useCallback)(v=>Z({type:"SET_SPAM_CHECK_COUNTER",payload:v}),[]),Q=(0,n.useCallback)(v=>Z({type:"SET_VALIDATE_LINKS",payload:v}),[]),se=(0,n.useCallback)(v=>Z({type:"SET_VALIDATE_IMAGES",payload:v}),[]),ne=(0,n.useCallback)(v=>Z({type:"SET_SELECTED_TAGS",payload:v}),[]),{limitsInPlugin:K,perTypeAvailable:z,currentBillingOptimisationLimits:q,disableFields:ue,typeLimits:_e,isTypeDisabled:fe}=Fu({appConfig:m,data:oe,isSuccess:Ve,optimisationCounter:R.optimisationCounter,linkCheckCounter:R.linkCheckCounter,imageCheckCounter:R.imageCheckCounter,spamCheckCounter:R.spamCheckCounter,setOptimisationCounter:ye,setLinkCheckCounter:he,setImageCheckCounter:me,setSpamCheckCounter:ie});Hu({activeTab:R.activeTab,selectedTags:R.selectedTags,validateLinksResult:R.validateLinksResult,validateImagesResult:R.validateImagesResult,setValidateLinks:Q,setValidateImages:se});const{showImgPreviewHandler:Le,hideBlockPreviewHandler:we}=Mu(),Ne=(0,n.useCallback)(v=>v==="link_check"?R.linkCheckCounter:v==="image_check"?R.imageCheckCounter:R.spamCheckCounter,[R.linkCheckCounter,R.imageCheckCounter,R.spamCheckCounter]),Y=(0,n.useCallback)(v=>{if(K){if(z){Z({type:{link_check:"INCREMENT_LINK_CHECK_COUNTER",image_check:"INCREMENT_IMAGE_CHECK_COUNTER",spam_check:"INCREMENT_SPAM_CHECK_COUNTER"}[v]}),V.fire({name:zu[v],count:Ne(v)+1});return}Z({type:"INCREMENT_OPTIMISATION_COUNTER"}),V.fire({name:"OptimizationCount",count:R.optimisationCounter+1})}},[K,z,V,Ne,R.optimisationCounter]),re=(0,n.useCallback)(v=>{if(z){const{limit:ee}=_e[v];C({presetId:Gu[v],previousDisplay:ee>0?ee:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}C({presetId:"optimization_exceeded",previousDisplay:q,nextDisplay:r.presetLimitDisplay("infinity")})},[z,_e,C,q]),je=(0,n.useCallback)(()=>{a(m.billingPageUrl||r.APP_ROUTES.billing)},[m.billingPageUrl,a]),W=v=>{if(!K||!z)return null;const{counter:ee,limit:Te,disabled:Ce}=_e[v];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ba(ee,Te,e,i),exceeded:Ce,extra:(0,o.jsx)("button",{type:"button",style:ha,onClick:je,children:e("Need more?")})})},Se=(0,n.useCallback)((v,ee)=>{F.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:v,isError:ee}})},[F]),Ie=(0,n.useCallback)((v,ee)=>{F.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:v,isError:ee}})},[F]),Pe=(0,n.useCallback)(v=>{const ee={startColumn:v.startColumn,startLineNumber:v.startLineNumber,endColumn:v.endColumn,endLineNumber:v.endLineNumber};l(r.setActiveProblemRange(ee))},[l]),Me=(0,n.useCallback)(v=>{Z({type:"SET_ACTIVE_TAB",payload:v}),Z({type:"RESET_SELECTED_TAGS"}),v===hr&&$?.length>0&&te({event:"check",action:"check_email_code",email_id:p,project_id:_,problems_count:$?.length||0})},[$,te,p,_]),He=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(fe("link_check")){re("link_check");return}if(!await H("link_check"))return;Y("link_check");const v=c(),ee=new DOMParser().parseFromString(v,"text/html"),Te={},Ce={};ee.querySelectorAll("a[href]").forEach((De,We)=>{Te[`link_${We}`]=De.getAttribute("href"),Ce[`link_${We}`]=De.textContent||""}),F.send({operation:"sandbox_set_attr_to_links"}),pe({entity_id:S,data:Te}).then(({data:De,error:We})=>{if(We)X(We,"link_check");else if(De?.result){const Je=[...De.result];Je?.sort((j,w)=>j.linkId-w.linkId);const M=Je.map(j=>({...j,text:Ce[j.linkId],status:Uu(j)})),J={links:M,summary:ua(M)};Z({type:"SET_VALIDATE_LINKS_RESULT",payload:J}),d.success(e("Links validation was successfully completed")),De.limit_warning&&De.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${De.limit_remaining}`}),te({event:"check",action:"check_email_links",email_id:p,project_id:_,links_count:J.links?.length||0})}else De.statusCode>300||!De.success?d.error({error:{data:De}}):d.error({title:e("Something went wrong.")}),!R.validateLinksResult.links&&Me("")}).catch(De=>{X(De,"link_check")})},[p,S,fe,re,H,Y,c,F,pe,d,e,te,_,Oe,R.validateLinksResult.links,X,Me]),ze=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(fe("image_check")){re("image_check");return}if(!await H("image_check"))return;Y("image_check");const v=c(),ee=new DOMParser().parseFromString(v,"text/html"),Te={};ee.querySelectorAll("img").forEach((Ce,De)=>Te[`image_${De}`]=Ce.src),F.send({operation:"sandbox_set_attr_to_images"}),xe({entity_id:S,data:Te}).then(({data:Ce,error:De})=>{let We;if(De)X(De,"image_check");else if(Ce?.result){const Je=Object.values(Ce.result);Je.sort((J,j)=>J.imageId-j.imageId);const M=Je.reduce((J,j)=>J+Math.round(j.image.bytes/1024),0);We={images:Je.map(J=>({...J,status:ca(J)}))||[],summary:ua(Je.map(J=>({...J,status:ca(J)}))),summaryTime:{value:(M>1200?M/1e3:M).toFixed(1),name:M>1200?e("MB"):e("KB")}},We&&Z({type:"SET_VALIDATE_IMAGES_RESULT",payload:We}),d.success(e("Images validation was successfully completed")),Ce.limit_warning&&Ce.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${Ce.limit_remaining}`}),te({event:"check",action:"check_email_images",email_id:p,project_id:_,images_count:We.images?.length||0})}else Ce.statusCode>300||!Ce.success?d.error({error:{data:Ce}}):d.error({title:e("Something went wrong.")}),!R.validateImagesResult?.images?.length&&Me("")}).catch(Ce=>{X(Ce,"image_check")})},[p,S,fe,re,H,Y,c,F,xe,d,e,te,_,Oe,R.validateImagesResult,X,Me]),ae=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(fe("spam_check")){re("spam_check");return}await H("spam_check")&&(Y("spam_check"),ge({entity_id:S,data:{html:c()}}).then(({data:v,error:ee})=>{if(ee)X(ee,"spam_check");else if(v&&v.success){const Te=!!v.result.report&&Object.values(v.result.report);Te?(Te.sort((Ce,De)=>Ce.score-De.score),Z({type:"SET_VALIDATE_SPAM_RESULT",payload:{...v.result,report:Te}})):v.result&&Z({type:"SET_VALIDATE_SPAM_RESULT",payload:{...v.result,report:Te}}),d.success(e("Spam validation was successfully completed")),v.limit_warning&&v.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${v.limit_remaining}`}),te({event:"check",action:"check_email_spam",email_id:p,project_id:_,spam_score:v.result?.spamScore||0})}else v.statusCode>300||!v.success?d.error({error:{data:v}}):d.error({title:e("Something went wrong.")}),!R.validateSpamResult?.report?.length&&Me("")}).catch(v=>{X(v,"spam_check")}))},[p,S,fe,re,H,Y,c,ge,d,e,te,_,Oe,R.validateSpamResult,X,Me]);(0,n.useEffect)(()=>{if(K){if(z){["link_check","image_check","spam_check"].forEach(v=>{const{limit:ee,counter:Te,disabled:Ce}=_e[v];if(!Ce){P.current[v]=!1;return}P.current[v]||ee>0&&Te>=ee&&(P.current[v]=!0,re(v))});return}if(!(q>0&&R.optimisationCounter>=q)){I.current=!1;return}I.current||(I.current=!0,re("link_check"))}},[K,z,_e,R.optimisationCounter,q,re]);const Be=B?r.getLimitUpgradePresetDefinition(B.presetId):null;return(0,o.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[Be&&B?(0,o.jsx)(si,{open:!0,onClose:()=>T(null),title:e(Be.titleKey),subtitle:e(Be.subtitleKey),usageResource:Be.usageResource,previousDisplay:B.previousDisplay,nextDisplay:B.nextDisplay,onChangePlan:()=>{T(null),s()}}):null,K&&!z&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ba(R.optimisationCounter,q,e,i),exceeded:ue,extra:(0,o.jsx)("button",{type:"button",style:ha,onClick:je,children:e("Need more?")})}),m.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[W("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:v=>v.preventDefault(),onClick:()=>{Me(mr),!R.validateLinksResult?.links?.length&&R.activeTab!==mr&&He()},loading:be.isLoading,disabled:fe("link_check")&&!R.validateLinksResult?.links?.length,children:!be.isLoading&&(R.activeTab===mr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,o.jsx)(sa,{__:e,activeTab:R.activeTab,validateLinksResult:R.validateLinksResult,validateLinks:R.validateLinks,selectedTags:R.selectedTags,setSelectedTags:ne,isLoading:be.isLoading,disabled:fe("link_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:He,goToLinkHandler:Se})]}),m.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[W("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:v=>v.preventDefault(),onClick:()=>{Me(pr),!R.validateImagesResult?.images?.length&&R.activeTab!==pr&&ze()},loading:Re.isLoading,children:!Re.isLoading&&(R.activeTab===pr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,o.jsx)(aa,{__:e,activeTab:R.activeTab,validateImagesResult:R.validateImagesResult,validateImages:R.validateImages,selectedTags:R.selectedTags,setSelectedTags:ne,isLoading:Re.isLoading,disabled:fe("image_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:ze,goToImageHandler:Ie,showImgPreviewHandler:Le,hideBlockPreviewHandler:we})]}),m.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[W("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:v=>v.preventDefault(),loading:le.isLoading,onClick:()=>{Me(pa),R.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(R.validateSpamResult,"spamScore")||ae()},disabled:fe("spam_check")&&!(R.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(R.validateSpamResult,"spamScore")),children:!le.isLoading&&(R.activeTab===pa?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,o.jsx)(na,{__:e,activeTab:R.activeTab,validateSpamResult:R.validateSpamResult,isLoading:le.isLoading,disabled:fe("spam_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:ae})]}),m.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:v=>v.preventDefault(),onClick:()=>Me(hr),children:R.activeTab===hr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth})})})]}),(0,o.jsx)(da,{__:e,activeTab:R.activeTab,problemsList:$,onSetMonacoPosition:Pe})]})]})},Yu=({state:e,onCancel:i,onRetry:l,onDismiss:s})=>{const{__:a}=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:[Xu(e,a),(0,o.jsx)(t.ui_kit$Flex,{justify:"flex-end",children:Ku(e,{onCancel:i,onRetry:l,onDismiss:s},a)})]})})})};function Xu(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 Ku(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 qu=2500,ga=48,Ju=4e3;function Qu(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 Zu(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function em({projectId:e,api:i,triggered:l,onCompleted:s}){const[a,d]=(0,n.useState)({kind:"hidden"}),c=(0,n.useRef)(!1),m=(0,n.useRef)(!0),b=(0,n.useRef)(e);b.current=e;const f=(0,n.useRef)(l);f.current=l;const E=(0,n.useRef)(s);E.current=s,(0,n.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]),(0,n.useEffect)(()=>{d({kind:"hidden"})},[e]);const h=(0,n.useCallback)(async()=>{try{const S=await i.files.backfillList({project_id:e});return!S.ok||S.error?null:Qu(S.data)}catch{return null}},[i,e]),p=(0,n.useCallback)(async()=>{if(c.current)return;c.current=!0;const S=b.current;let _=0;try{for(;m.current&&b.current===S&&f.current;){const B=await h();if(!m.current)break;if(B)if(B.kind==="hidden"){if(_+=1,_>=ga){d({kind:"failed"});break}}else{if(_=0,d(B),B.kind==="done")try{await E.current?.()}catch{}if(Zu(B))break}else if(_+=1,_>=ga){d({kind:"failed"});break}await new Promise(T=>setTimeout(T,qu))}}finally{c.current=!1}},[h]);return(0,n.useEffect)(()=>{l&&p()},[l,p]),(0,n.useEffect)(()=>{if(a.kind!=="done")return;const S=setTimeout(()=>{m.current&&d({kind:"hidden"})},Ju);return()=>clearTimeout(S)},[a.kind]),{state:a,cancel:(0,n.useCallback)(()=>{d(S=>S.kind==="scanning"||S.kind==="indexing"?{...S,cancelling:!0}:S),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,n.useCallback)(()=>{f.current=!0,i.files.backfillCreate({project_id:e}),p()},[i,e,p]),dismiss:(0,n.useCallback)(()=>d({kind:"hidden"}),[])}}var om=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./286097e2.js")),void 0,{}.url)),tm=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./97aabe39.js")),void 0,{}.url)),_a={height:"100%"};function im(e){(e?(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./42ec1ce9.js")),void 0,{}.url):(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./1687225b.js")),void 0,{}.url)).catch(()=>{})}var rm=({storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:a})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),m=!!d.imageCenterFileManagerView;(0,n.useEffect)(()=>{c&&im(m)},[c,m]);let b=(0,o.jsx)(t.ui_kit$PageLoader,{style:_a});return e&&i&&d.imageCenterFileManagerView?b=(0,o.jsx)(om,{storageProvider:e,dataProvider:i,pathProxy:l},a):e&&i&&(b=(0,o.jsx)(tm,{dataProvider:i,usesBuiltInStorage:s},a)),(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:_a}),children:b})};function lm(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useStorageProvider(),s=r.useProjectData(),a=r.useRestClient(r.EM_FILES_MODULES),d=r.useStore(),c=(0,n.useMemo)(()=>r.createRestClientV2(d),[d]),m=r.useI18n(),b=r.useCurrentUser(),f=s?.id?String(s.id):"",E=b?.id!=="0"?String(b.id):"",h=r.isFileManagerV2Enabled(e),[p,S]=(0,n.useState)(null),_=h&&!!f&&p===f,[B,T]=(0,n.useState)(0),[I,P]=(0,n.useState)(0),y=(0,n.useRef)(f);(0,n.useEffect)(()=>{y.current!==f&&(y.current=f,S(null))},[f]);const C=(0,n.useCallback)(F=>{F&&f&&S(f)},[f]),O=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:l,projectId:f,restApi:a,restApiV2:c,i18n:m,pathPostfix:E,appConfig:e,isStandalone:i,onIndexingStateChange:C}),[e,C,m,i,f,B,a,c,l,E]),X=(0,n.useCallback)(async()=>{try{typeof O.dataProvider?.clearCache=="function"&&await O.dataProvider.clearCache()}catch{}S(null),T(F=>F+1),P(F=>F+1)},[O.dataProvider]),H=(0,n.useCallback)(()=>{f&&S(f)},[f]);return{...O,projectId:f,restApiV2:c,v2Enabled:h,backfillTriggered:_,contentKey:`${f}:${I}`,handleIndexingCompleted:X,markIndexingStarted:H}}var sm={height:"100%"},xa=()=>{const{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,projectId:a,restApiV2:d,v2Enabled:c,backfillTriggered:m,contentKey:b,handleIndexingCompleted:f,markIndexingStarted:E}=lm(),h=r.useSelector(r.selectActiveModal$1),p=r.isImageCenterModal(h),{state:S,cancel:_,retry:B,dismiss:T}=em({projectId:a,api:d,triggered:m,onCompleted:f}),I=n.default.useCallback(()=>{E(),B()},[E,B]);return(0,o.jsxs)(o.Fragment,{children:[p&&(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:sm}),children:(0,o.jsx)(rm,{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:b})}),c&&(0,o.jsx)(Yu,{state:S,onCancel:_,onRetry:I,onDismiss:T})]})},am=(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 nm(e){return!!(e?.global_block??e?.acf?.global_block)}var dm=({className:e,size:i=16})=>{const l=r.useAppConfig(),{__:s}=r.useI18n(),a=s("Global block");return(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"top",trigger:["hover"],children:(0,o.jsx)("span",{className:(0,Ue.default)("block-global-badge",e),"aria-label":a,role:"img",children:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:i,strokeWidth:l.iconStrokeWidth})})})},ka=new Map;function Ea(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function br(e,i){const l=i??"";if(e===void 0)return r.sanitizeHtml(Ea(l));const s=String(e),a=ka.get(s);if(a&&a.source===l)return a.markup;const d=r.sanitizeHtml(Ea(l));return ka.set(s,{source:l,markup:d}),d}function cm(e,i){return e?i.openBlockFromEmailEnabled===!0?"over-email":null:"link"}var um={fontSize:"16px",margin:0},{name:fr,type:Ba,tags:Sa}={name:"name",type:"type",tags:"tags"},Ta={[fr]:"",[Ba]:[],[Sa]:[]},ht={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},gr=({parentEmailId:e,blocksTab:i,search:l,reloadBlockScreens:s,setIsShowAddAllBlocksModal:a})=>{const d=r.parentEmailSource(e),c=r.useEditorProjectId(),m=r.useSetHtmlElementInIframeHandler(),b=r.useDragStartBlockToIframeHandler(),[f]=t.ui_kit$Form.useForm(),{data:E}=r.useGetBlocksSchemaQuery(),{token:h}=(0,t.ui_kit$useToken)(),{__:p,_x:S}=r.useI18n(),_=r.useNotification(),{modal:B}=t.ui_kit$App.useApp(),{confirm:T}=B,I={pathname:r.useRoutePathname()},P=r.useAppConfig(),y=r.useSelector(r.selectParentBlocks),C=Es(),O=(0,n.useRef)(null),X=(0,n.useRef)(null),H=r.useRootElement(),F=660,$=207/F,V=x=>nm(x)?(0,o.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,o.jsx)(dm,{className:"block-global-badge--tile",size:14})}):null,te=r.useEmailAttribute("common_styles"),R=(0,n.useMemo)(()=>Ss(te,C),[te,C]),Z=(0,n.useRef)(null),ge=(0,n.useRef)(null),le=(0,n.useRef)(null),pe=r.useStore();(0,n.useEffect)(()=>{X.current?.scrollTo({top:0})},[i,l]);const be=r.useProjectData(),{data:xe}=r.useGetTermsQuery({project:be,kind:r.BLOCK_TAGS},{skip:!be?.id}),[Re,oe]=(0,n.useState)(()=>r.projectBlocksArgs(c));(0,n.useEffect)(()=>{l||(f.setFieldsValue(Ta),v({type:null,name:null}),s())},[l,f,s]),(0,n.useEffect)(()=>{if(E){const x=E.schema.properties.acf.properties.type.items.enum;let L=[];for(let k in x)L.push({label:p(r.TYPES_TRANSLATE[x[k]]),value:x[k]})}},[E,p]);const{isSuccess:Ve,isError:Oe,isLoading:ye,isFetching:he,data:me,refetch:ie,error:Q}=r.useGetBlocksQuery({...Re,page:1}),se=(0,n.useMemo)(()=>{if(Ve&&me)return[...me].sort((x,L)=>ht[x.type]-ht[L.type])},[Ve,me]),[ne,K]=(0,n.useState)([]);r.usePrevious(x=>{x!==Oe&&_.fromError("BLOCK_GET_ERROR",{},Q,!0)},[Oe,Q,_]);const[z,q]=(0,n.useState)(()=>r.parentEmailBlocksArgs(d)),{isSuccess:ue,isError:_e,isLoading:fe,isFetching:Le}=r.useGetParentEmailBlocksQuery({...z,emailId:d,page:1},{skip:!d||y.length}),we=(0,n.useMemo)(()=>{if(ue||y.length)return[...y].sort((x,L)=>ht[x.type]-ht[L.type])},[ue,y]),[Ne,Y]=(0,n.useState)([]);(0,n.useEffect)(()=>{const x=new Set;if(y.length&&we){for(const L of we)L.type&&x.add(L.type);Y(Array.from(x))}else Y([])},[y,we]);const[re,je]=(0,n.useState)(r.templateBlocksArgs),{isSuccess:W,isError:Se,isLoading:Ie,isFetching:Pe,data:Me=[]}=r.useGetTemplateBlocksQuery({...re,page:1}),He=(0,n.useMemo)(()=>{if(Me.length)return[...Me].sort((x,L)=>ht[x.type]-ht[L.type])},[Me]),[ze,ae]=(0,n.useState)([]);(0,n.useEffect)(()=>{const x=new Set;if(He&&Me.length){for(const L of He)L.type&&x.add(L.type);ae(Array.from(x))}},[Me.length,He]);const Be=(0,n.useMemo)(()=>{const x=new Set;for(const L of ne)x.add(L);for(const L of Ne)x.add(L);for(const L of ze)x.add(L);return Array.from(x)},[ze,Ne,ne]),v=x=>{oe(L=>({...L,...x,page:1})),q(L=>({...L,...x,page:1})),je(L=>({...L,...x,page:1}))},ee=r.useFitBlockPreviewHeight($),Te=(0,n.useCallback)(()=>{H.querySelector(".blocks-search__result-wrapper.is_search")&&(H.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),H.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(H,207/F),H.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",H.querySelectorAll(".blocks-search__result-wrapper").forEach(x=>x.style.opacity=1))},[F,H]);(0,n.useEffect)(()=>{!(Pe||Ie)&&W&&i!=="template"&&(l?Te():s())},[Pe,Ie,W,Te,Re.name,s,l,i]),(0,n.useEffect)(()=>{const x=new Set;if(Ve&&se){for(const L of se)L.type&&x.add(L.type);K(Array.from(x))}},[Ve,se]);const Ce=x=>{const L=Object.keys(x)[0],k=f.getFieldsValue(!0);switch(L){case Sa:const G=(xe||[]).filter(de=>x[L].includes(de.name)).map(de=>de.id)||null;v({tags:G});break;case Ba:v({type:k.type||null});break;case fr:O.current&&window.clearTimeout(O.current),O.current=window.setTimeout(function(){v({name:k.name||null})},300)}},De=x=>{s(),x.target.getAttribute("data-type")?(x.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(L=>L.style.display="none"),x.target.closest(".blocks-search").querySelectorAll(`[data-type="${x.target.getAttribute("data-type")}"]`).forEach(L=>L.style.display="block")):x.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(L=>L.style.display="block"),x.target.parentElement.querySelector(".active").classList.remove("active"),x.target.classList.add("active")};let We=null;const Je=x=>{clearTimeout(We);let L=H.querySelector(".block-search__preview")?H.querySelector(".block-search__preview"):null,k=H.querySelector(".block-search__preview-title")?H.querySelector(".block-search__preview-title"):null,G=H.querySelector(".block-search__preview-content")?H.querySelector(".block-search__preview-content"):null;H.querySelector(".block-search__preview")||(L=document.createElement("div"),L.classList.add("block-search__preview"),k=document.createElement("div"),k.classList.add("block-search__preview-title"),G=document.createElement("div"),G.classList.add("block-search__preview-content"),L.append(G),L.append(k),H.querySelector(".email-pane__col_settings-inner").append(L)),k.innerHTML="",G.innerHTML="",k.innerHTML=x.title;let de=x.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();G.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+de+"</table>"),L.style.opacity!=="1"&&setTimeout(function(){L.style.opacity="1",L.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},M=()=>{let x=H.querySelector(".block-search__preview");x&&(We=setTimeout(()=>{x.style.opacity="0",x.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){x.remove()},300)},300))};(0,n.useEffect)(()=>{H.querySelectorAll(".blocks-search__result").forEach(x=>{x.style.display="block"})},[i]);const J=!me?.length&&(!d||!y?.length)&&!Me?.length&&(Re.tags||Re.name||Re.type)&&!(ye||he),j=x=>pe.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(x.id)).then(L=>{L.error&&_.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(x),L.error),_.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(x),title:p('The block "')+L.data.title+S('" was successfully removed.',"block")}),ie()});(0,n.useEffect)(()=>{!ye&&!he&&s()},[ye,he,s]),(0,n.useEffect)(()=>{(i==="common"||l)&&setTimeout(s,50)},[me,s,i,l]);const w=x=>{T({mask:{closable:!0},centered:!0,title:S("Are you sure you want to delete the “","block")+x.title+p("” 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:p("Yes"),cancelText:p("No"),onOk:()=>j(x)})},ce=(x,L)=>`${x.pathname.split("emails")[0]}blocks/${L.id}`,ve=x=>{let L=[{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:()=>w(x)}];const k=cm(!0,P);return k==="link"&&L.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:ce(I,x),children:" "})}),k==="over-email"&&L.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:um}),onClick:()=>{r.getEmitter(bo.getContainer(pe),bo.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(x.id)).then(({errors:G})=>{G.length&&_.fromError("BLOCK_GET_ERROR",r.getBlockDesc(x),G[0])})}}),L},Ye=x=>{let L=x.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(L.replaceChildren(...r.parseFromString(x.html)),Object.keys(R).length!==0&&(L.querySelectorAll(".em-contrast-card").forEach(k=>{R.cards?.contrastBackgroundColor&&(k.getAttribute("bgcolor")?R.cards.contrastBackgroundColor?k.setAttribute("bgcolor",R.cards.contrastBackgroundColor):k.removeAttribute("bgcolor"):R.cards.contrastBackgroundColor?k.style.backgroundColor=R.cards.contrastBackgroundColor:k.style.removeProperty("background-color")),R.cards?.contrastTextColor&&k.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(G=>{if(oo(G.style.color).toLowerCase()!=="#ffffff"){let de=G.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.cards.contrastTextColor};`);G.setAttribute("style",de)}})}),L.querySelectorAll(".em-card").forEach(k=>{R.cards?.baseBackgroundColor&&(k.getAttribute("bgcolor")?R.cards.baseBackgroundColor?k.setAttribute("bgcolor",R.cards.baseBackgroundColor):k.removeAttribute("bgcolor"):R.cards.baseBackgroundColor?k.style.backgroundColor=R.cards.baseBackgroundColor:k.style.removeProperty("background-color")),R.cards?.baseTextColor&&k.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(G=>{if(oo(G.style.color).toLowerCase()!=="#ffffff"){let de=G.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.cards.baseTextColor};`);G.setAttribute("style",de)}})}),L.querySelectorAll(".em-card, .em-contrast-card").forEach(k=>{R.cards?.border&&no({settings:{border:R.cards?.border},elem:k}),R.cards?.borderRadius?.all?(k.style.borderBottomLeftRadius&&k.style.borderBottomLeftRadius!=="0px"&&(k.style.borderBottomLeftRadius=R.cards?.borderRadius.all+"px"),k.style.borderBottomRightRadius&&k.style.borderBottomRightRadius!=="0px"&&(k.style.borderBottomRightRadius=R.cards?.borderRadius.all+"px"),k.style.borderTopLeftRadius&&k.style.borderTopLeftRadius!=="0px"&&(k.style.borderTopLeftRadius=R.cards?.borderRadius.all+"px"),k.style.borderTopRightRadius&&k.style.borderTopRightRadius!=="0px"&&(k.style.borderTopRightRadius=R.cards?.borderRadius.all+"px")):R.cards?.borderRadius?.all===""?k.style.removeProperty("border-radius"):(R.cards?.borderRadius?.topLeft&&k.style.borderTopLeftRadius&&k.style.borderTopLeftRadius!=="0px"?k.style.borderTopLeftRadius=R.cards?.borderRadius.topLeft+"px":R.cards?.borderRadius?.topLeft===""&&k.style.removeProperty("border-top-left-radius"),R.cards?.borderRadius?.topRight&&k.style.borderTopRightRadius&&k.style.borderTopRightRadius!=="0px"?k.style.borderTopRightRadius=R.cards?.borderRadius.topRight+"px":R.cards?.borderRadius?.topRight===""&&k.style.removeProperty("border-top-right-radius"),R.cards?.borderRadius?.bottomRight&&k.style.borderBottomRightRadius&&k.style.borderBottomRightRadius!=="0px"?k.style.borderBottomRightRadius=R.cards?.borderRadius.bottomRight+"px":R.cards?.borderRadius?.bottomRight===""&&k.style.removeProperty("border-bottom-right-radius"),R.cards?.borderRadius?.bottomLeft&&k.style.borderBottomLeftRadius&&k.style.borderBottomLeftRadius!=="0px"?k.style.borderBottomLeftRadius=R.cards?.borderRadius.bottomLeft+"px":R.cards?.borderRadius?.bottomLeft===""&&k.style.removeProperty("border-bottom-left-radius"))}),L.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(k=>{if(!k.style.display&&parseFloat(k.style.fontSize)<=20){let G="",de=R.text.fontFamily;if(parseFloat(k.style.fontSize)>14&&(G=k.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${R.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${R.text.lineHeight}px`),k.setAttribute("style",G)),!k.closest(".em-contrast-card, .em-card")&&oo(k.style.color).toLowerCase()!=="#ffffff"&&(G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.text.color};`),k.setAttribute("style",G)),k.closest(".em-contrast-block")&&!k.closest(".em-contrast-card, .em-card")&&(G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.text.contrastColor};`),k.setAttribute("style",G)),de[0]==="Safe Fonts"?(k.style.fontFamily=de[1],qe({elem:L})):de[0]==="Google Fonts"&&(de[1]==="Sans Serif"?k.style.fontFamily="Helvetica, Arial, sans-serif":de[1]==="Serif"&&(k.style.fontFamily='"Times New Roman", Times, serif'),k.classList.remove(...[...k.classList].filter(Ge=>Ge.startsWith("em-font"))),k.classList.add(`em-font-${de[2].replace(/\s/g,"")}-${de[3].replace(/\s/g,"")}`),to({elem:L,fontFamilyArray:de})),k.closest('[em="atom"] > tr > td')&&k.closest('[em="atom"] > tr > td').style.paddingBottom)k.closest('[em="atom"] > tr > td').style.paddingBottom=R.text.paddingBottom+"px";else if(k.nextElementSibling||k.closest("table")&&k.closest("table").nextElementSibling){let Ge=k.nextElementSibling??k.closest("table").nextElementSibling;Ge&&Ge.tagName==="TABLE"&&(Ge.classList.contains("em-vindent-table")||Ge.querySelector("td").innerHTML==="")&&Ge.querySelector("td").setAttribute("height",R.text.paddingBottom)}}else if(!k.style.display&&parseFloat(k.style.fontSize)>=20&&oo(k.style.color).toLowerCase()!=="#eb3737"){let G="",de=R.headings.fontFamily;parseFloat(k.style.fontSize)<40&&(G=k.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${R.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${R.headings.lineHeight}px`),k.setAttribute("style",G)),!k.closest(".em-contrast-card, .em-card")&&oo(k.style.color).toLowerCase()!=="#ffffff"&&(G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.headings.color};`),k.setAttribute("style",G)),k.closest(".em-contrast-block")&&!k.closest(".em-contrast-card, .em-card")&&(G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.headings.contrastColor};`),k.setAttribute("style",G)),de[0]==="Safe Fonts"?(k.style.fontFamily=de[1],qe({elem:L})):de[0]==="Google Fonts"&&(de[1]==="Sans Serif"?k.style.fontFamily="Helvetica, Arial, sans-serif":de[1]==="Serif"&&(k.style.fontFamily='"Times New Roman", Times, serif'),k.classList.remove(...[...k.classList].filter($e=>$e.startsWith("em-font"))),k.classList.add(`em-font-${de[2].replace(/\s/g,"")}-${de[3].replace(/\s/g,"")}`),to({elem:L,fontFamilyArray:de}));let Ge="";if(R.headings.letterSpacing>0?Ge=k.style.letterSpacing?k.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${R.headings.letterSpacing}px`):k.getAttribute("style")+` letter-spacing: ${R.headings.letterSpacing}px;`:Ge=k.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),k.setAttribute("style",Ge),R.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 $e=k.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");k.setAttribute("style",$e)}if(R.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 $e=k.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");k.setAttribute("style",$e)}if(k.closest('[em="atom"] > tr > td')&&k.closest('[em="atom"] > tr > td').style.paddingTop)k.closest('[em="atom"] > tr > td').style.paddingTop=R.headings.paddingTop+"px";else if(k.previousElementSibling){let $e=k.previousElementSibling;$e&&$e.tagName==="TABLE"&&($e.classList.contains("em-vindent-table")||$e.querySelector("td").innerHTML==="")&&$e.querySelector("td").setAttribute("height",R.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=R.headings.paddingBottom+"px";else if(k.nextElementSibling){let $e=k.nextElementSibling;$e&&$e.tagName==="TABLE"&&($e.classList.contains("em-vindent-table")||$e.querySelector("td").innerHTML==="")&&$e.querySelector("td").setAttribute("height",R.headings.paddingBottom)}}}),L.querySelectorAll('a[style*="color"]').forEach(k=>{if(k.style.display){if(k.style.display&&k.style.display==="block"){let G="";if(G=k.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${R.buttons.fontSize}px`),k.setAttribute("style",G),k.closest("td").style.backgroundColor&&!k.closest("td").style.borderWidth&&!k.closest(".em-contrast-card"))if(k.closest(".em-contrast-block")?G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.contrastColor};`):G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.color};`),k.setAttribute("style",G),k.closest(".em-contrast-block"))if(R.buttons.contrastBackgroundColor){let $e=k.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${R.buttons.contrastBackgroundColor};`);k.closest("td").setAttribute("style",$e)}else k.closest("td").style.removeProperty("background-color");else if(R.buttons.backgroundColor){let $e=k.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${R.buttons.backgroundColor};`);k.closest("td").setAttribute("style",$e)}else k.closest("td").style.removeProperty("background-color");else if(k.closest("td").style.borderWidth)if(Object.values(R.buttons.border).every($e=>$e===null)){if(k.closest(".em-contrast-block")){if(R.buttons.contrastBackgroundColor){let $e=k.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ao=>ao.replace(/#[A-Fa-f0-9]{6}/,`${R.buttons.contrastBackgroundColor}`));k.closest("td").setAttribute("style",$e),G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.contrastBackgroundColor};`),k.setAttribute("style",G)}}else if(R.buttons.backgroundColor){let $e=k.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ao=>ao.replace(/#[A-Fa-f0-9]{6}/,`${R.buttons.backgroundColor}`));k.closest("td").setAttribute("style",$e),G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.backgroundColor};`),k.setAttribute("style",G)}}else for(const $e in R.buttons.border)R.buttons.border[$e]&&R.buttons.border[$e].color!==void 0&&(G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.border[$e].color};`),k.setAttribute("style",G));else k.closest(".em-contrast-block")?R.buttons.contrastBackgroundColor&&(G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.contrastBackgroundColor};`),k.setAttribute("style",G)):R.buttons.backgroundColor&&(G=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.backgroundColor};`),k.setAttribute("style",G));let de=R.buttons.fontFamily;de[0]==="Safe Fonts"?(k.style.fontFamily=de[1],qe({elem:L})):de[0]==="Google Fonts"&&(de[1]==="Sans Serif"?k.style.fontFamily="Helvetica, Arial, sans-serif":de[1]==="Serif"&&(k.style.fontFamily='"Times New Roman", Times, serif'),k.classList.remove(...[...k.classList].filter($e=>$e.startsWith("em-font"))),k.classList.add(`em-font-${de[2].replace(/\s/g,"")}-${de[3].replace(/\s/g,"")}`),to({elem:L,fontFamilyArray:de})),k.closest("td").setAttribute("align",R.buttons.textAlign);let Ge="";if(R.buttons.letterSpacing>0?Ge=k.style.letterSpacing?k.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${R.buttons.letterSpacing}px`):k.getAttribute("style")+` letter-spacing: ${R.buttons.letterSpacing}px;`:Ge=k.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),k.setAttribute("style",Ge),R.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 $e=k.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");k.setAttribute("style",$e)}if(R.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 $e=k.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");k.setAttribute("style",$e)}if(k.closest('[em="atom"] > tr > td')&&k.closest('[em="atom"] > tr > td').style.paddingTop)k.closest('[em="atom"] > tr > td').style.paddingTop=R.buttons.marginTop+"px";else if(k.closest("table").previousElementSibling){let $e=k.closest("table").previousElementSibling;$e&&$e.tagName==="TABLE"&&($e.classList.contains("em-vindent-table")||$e.querySelector("td").innerHTML==="")&&$e.querySelector("td").setAttribute("height",R.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=R.buttons.marginBottom+"px";else if(k.closest("table").previousElementSibling){let $e=k.closest("table").nextElementSibling;$e&&$e.tagName==="TABLE"&&($e.classList.contains("em-vindent-table")||$e.querySelector("td").innerHTML==="")&&$e.querySelector("td").setAttribute("height",R.buttons.marginBottom)}R.buttons.padding.all&&(k.style.padding=R.buttons.padding.all+"px"),R.buttons.padding.top&&(k.style.paddingTop=R.buttons.padding.top+"px"),R.buttons.padding.right&&(k.style.paddingRight=R.buttons.padding.right+"px"),R.buttons.padding.bottom&&(k.style.paddingBottom=R.buttons.padding.bottom+"px"),R.buttons.padding.left&&(k.style.paddingLeft=R.buttons.padding.left+"px"),no({settings:{border:R.buttons.border},elem:k.closest("td")}),fo({settings:{borderRadius:R.buttons.borderRadius},elem:k.closest("td")})}}else{let G=R.text.fontFamily;if(oo(k.style.color).toLowerCase()==="#1c52dc"){let Ge=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.links.color};`);k.setAttribute("style",Ge)}else{let Ge=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.text.color};`);k.setAttribute("style",Ge)}if(k.closest(".em-contrast-block")){let Ge=k.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.links.contrastColor};`);k.setAttribute("style",Ge)}let de="";R.links.underline?de=k.style.textDecoration?k.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):k.getAttribute("style")+" text-decoration: underline;":de=k.style.textDecoration?k.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):k.getAttribute("style")+" text-decoration: none;",k.setAttribute("style",de),G[0]==="Safe Fonts"?(k.style.fontFamily=G[1],qe({elem:L})):G[0]==="Google Fonts"&&(G[1]==="Sans Serif"?k.style.fontFamily="Helvetica, Arial, sans-serif":G[1]==="Serif"&&(k.style.fontFamily='"Times New Roman", Times, serif'),k.classList.remove(...[...k.classList].filter(Ge=>Ge.startsWith("em-font"))),k.classList.add(`em-font-${G[2].replace(/\s/g,"")}-${G[3].replace(/\s/g,"")}`),to({elem:L,fontFamilyArray:G}))}}),L.querySelector('[em="block"]'))){const k=L.querySelectorAll('[em="block"]');R.block?.backgroundColor&&k.forEach(G=>{G.querySelectorAll(":scope > td").forEach(de=>{de.setAttribute("bgcolor",R.block.backgroundColor)})}),R.block?.padding&&k.forEach(G=>{G.querySelectorAll(":scope > td").forEach(de=>{de.style.paddingTop=R.block.padding.top+"px",de.style.paddingRight=R.block.padding.right+"px",de.style.paddingBottom=R.block.padding.bottom+"px",de.style.paddingLeft=R.block.padding.left+"px"})})}return L.tagName==="DIV"?r.getElementInnerHTML(L):r.getElementInnerHTML(L.querySelector("tbody")||L)},qe=x=>{x.elem.querySelectorAll("link[em-class]").forEach(L=>{x.elem.querySelector("."+L.getAttribute("em-class"))||L.remove()})};function oo(x){if(x&&x.charAt(0)==="r"){if(x.charAt(3)==="a")return x=x.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),x&&x.length===4?"#"+("0"+parseInt(x[1],10).toString(16)).slice(-2)+("0"+parseInt(x[2],10).toString(16)).slice(-2)+("0"+parseInt(x[3],10).toString(16)).slice(-2):"";{x=x.replace("rgb(","").replace(")","").split(",");let L=parseInt(x[0],10).toString(16),k=parseInt(x[1],10).toString(16),G=parseInt(x[2],10).toString(16);return L=L.length===1?"0"+L:L,k=k.length===1?"0"+k:k,G=G.length===1?"0"+G:G,"#"+L+k+G}}else if(x&&x.charAt(0)==="#")return x}const to=x=>{const L=x.elem.querySelectorAll("link"),k=`em-font-${x.fontFamilyArray[2].replace(/\s/g,"")}-${x.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(L)?.find(de=>de.getAttribute("em-class")===k)){let de=document.createElement("link");de.setAttribute("rel","stylesheet"),de.setAttribute("href",`https://fonts.googleapis.com/css2?family=${x.fontFamilyArray[2]}:ital,wght@${xo[x.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${xo[x.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),de.setAttribute("em-class",k),x.elem.insertAdjacentElement("afterbegin",de)}A({elem:x.elem});let G=`font-family: '${x.fontFamilyArray[2]}', ${D[x.fontFamilyArray[1]]}!important;`;G+=` font-weight: ${xo[x.fontFamilyArray[3]].replaceAll("i","")}!important;`,xo[x.fontFamilyArray[3]].indexOf("i")>-1&&(G+=" font-style: italic!important;"),x.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
|
|
22
|
-
.em-font-${x.fontFamilyArray[2].replace(/\s/g,"")}-${x.fontFamilyArray[3].replace(/\s/g,"")} { ${G} }`),setTimeout(()=>qe({elem:x.elem}),0)},no=x=>{x.settings.border.all?x.settings.border.all.width!=null&&(x.settings.border.all.style||x.settings.border.all.color)?(x.elem.style.borderWidth=x.settings.border.all.width+"px",x.elem.style.borderStyle=x.settings.border.all.style,x.elem.style.borderColor=x.settings.border.all.color):x.elem.style.removeProperty("border"):(x.settings.border.top&&(x.settings.border.top.width!=null&&(x.settings.border.top.style||x.settings.border.top.color)?(x.elem.style.borderTopWidth=x.settings.border.top.width+"px",x.elem.style.borderTopStyle=x.settings.border.top.style,x.elem.style.borderTopColor=x.settings.border.top.color):x.elem.style.removeProperty("border-top")),x.settings.border.right&&(x.settings.border.right.width!=null&&(x.settings.border.right.style||x.settings.border.right.color)?(x.elem.style.borderRightWidth=x.settings.border.right.width+"px",x.elem.style.borderRightStyle=x.settings.border.right.style,x.elem.style.borderRightColor=x.settings.border.right.color):x.elem.style.removeProperty("border-right")),x.settings.border.bottom&&(x.settings.border.bottom.width!=null&&(x.settings.border.bottom.style||x.settings.border.bottom.color)?(x.elem.style.borderBottomWidth=x.settings.border.bottom.width+"px",x.elem.style.borderBottomStyle=x.settings.border.bottom.style,x.elem.style.borderBottomColor=x.settings.border.bottom.color):x.elem.style.removeProperty("border-bottom")),x.settings.border.left&&(x.settings.border.left.width!=null&&(x.settings.border.left.style||x.settings.border.left.color)?(x.elem.style.borderLeftWidth=x.settings.border.left.width+"px",x.elem.style.borderLeftStyle=x.settings.border.left.style,x.elem.style.borderLeftColor=x.settings.border.left.color):x.elem.style.removeProperty("border-left")))},fo=x=>{x.settings.borderRadius.all?x.elem.style.borderRadius=x.settings.borderRadius.all+"px":x.settings.borderRadius.all===""?x.elem.style.removeProperty("border-radius"):(x.settings.borderRadius.topLeft?x.elem.style.borderTopLeftRadius=x.settings.borderRadius.topLeft+"px":x.settings.borderRadius.topLeft===""&&x.elem.style.removeProperty("border-top-left-radius"),x.settings.borderRadius.topRight?x.elem.style.borderTopRightRadius=x.settings.borderRadius.topRight+"px":x.settings.borderRadius.topRight===""&&x.elem.style.removeProperty("border-top-right-radius"),x.settings.borderRadius.bottomRight?x.elem.style.borderBottomRightRadius=x.settings.borderRadius.bottomRight+"px":x.settings.borderRadius.bottomRight===""&&x.elem.style.removeProperty("border-bottom-right-radius"),x.settings.borderRadius.bottomLeft?x.elem.style.borderBottomLeftRadius=x.settings.borderRadius.bottomLeft+"px":x.settings.borderRadius.bottomLeft===""&&x.elem.style.removeProperty("border-bottom-left-radius"))},xo={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"},D={"Sans Serif":"sans-serif",Serif:"serif"};function A(x){if(!x.elem.querySelector('style[em="styles"]')){let L=document.createElement("style");L.setAttribute("em","styles"),x.elem.append(L)}}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:f,layout:"vertical",name:"blocks_search_form",initialValues:{...Ta},onValuesChange:Ce,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:fr,children:(0,o.jsx)(t.ui_kit$SearchInput,{placeholder:p("Search by title"),allowClear:!0,enterButton:!1})})}),(Oe||_e||Se)&&(0,o.jsx)(t.ui_kit$Alert,{title:p("Error"),description:p("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),l&&!J&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:De,children:p("All")},"search_All"),Be.map(x=>(0,o.jsx)("li",{"data-type":x,onClick:De,children:p(r.TYPES_TRANSLATE[x])},"search_"+x))]})}),(0,o.jsxs)("div",{ref:X,className:(0,Ue.default)("blocks-search__result-wrapper",{is_search:l}),children:[(i==="project"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!ne.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:De,children:p("All")},"blocksSections_All"),ne.map(x=>(0,o.jsx)("li",{"data-type":x,onClick:De,children:p(r.TYPES_TRANSLATE[x])},"blocksSections_"+x))]})}),(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:Z,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!(ye||he)&&(se?.length?se.map((x,L)=>{const k=br(x.id,x.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":x.type,children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"leftTop",menu:{items:ve(x)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:G=>m(G,x.html,"project",x.title,x),onDragStart:G=>b(G,x.html,"project",x.title,x),onMouseEnter:()=>Je({html:x.html,title:x.title}),onMouseLeave:M,children:[V(x),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:k,onContentLoad:ee,style:{transform:`scale(${$})`}})]})},"commenMenu")},x.id+L.toString())}):!(Re.tags||Re.name||Re.type)&&Ve&&!(ye||he)&&!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:p("You don`t have any saved blocks yet.")}),p("To add a block from the dashboard click the"),' "',p("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",{}),p("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:()=>a(!0),style:{cursor:"pointer"},children:p("Save all blocks")})})]}),(0,o.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,o.jsx)("img",{src:am,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),(ye||he)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&me?.length>0&&y?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Ne.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:De,children:p("All")},"templateBlocksSections_All"),Ne.map(x=>(0,o.jsx)("li",{"data-type":x,onClick:De,children:p(r.TYPES_TRANSLATE[x])},"templateBlocksSections_"+x))]})}),(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:ge,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[y&&!(fe||Le)&&we?.length?(0,o.jsx)(o.Fragment,{children:we.map((x,L)=>{const k=br(x.id,x.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":x.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:G=>m(G,x.html,"template",x.title,x),onDragStart:G=>b(G,x.html,"template",x.title,x),onMouseEnter:()=>Je({html:x.html,title:x.title}),onMouseLeave:()=>M(),children:[V(x),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:k,onContentLoad:ee,style:{transform:`scale(${$})`}})]})},x.id+L.toString())})}):!l&&!Ie&&!Le&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:p("No related blocks found.")})," "]}),(fe||Le)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&y?.length>0&&Me?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!ze?.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:De,children:p("All")},"commonBlocksSections_All"),ze.map(x=>(0,o.jsx)("li",{"data-type":x,onClick:De,children:p(r.TYPES_TRANSLATE[x])},"commonBlocksSections_"+x))]})}),(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:le,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder common",children:[W&&!!He?.length&&!(Pe||Ie)&&(0,o.jsx)(o.Fragment,{children:He.map((x,L)=>{const k=Ye({html:br(x.id,x.html)});return(0,o.jsx)("div",{className:"blocks-search__result","data-type":x.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:G=>m(G,Ye({html:x.html}),"common",x.title,x),onDragStart:G=>b(G,Ye({html:x.html}),"common",x.title,x),onMouseEnter:()=>Je({html:Ye({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+x.html+"</table>")}),title:x.title}),onMouseLeave:()=>M(),children:[V(x),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:k,onContentLoad:ee,style:{transform:`scale(${$})`}})]})},x.id+L.toString())})})," "]}),(Ie||Pe)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),J&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:p("There are no blocks for this request.")})]})]})};gr.propTypes={};var Ra=({comments:e,subjectId:i,isLoggedIn:l,projectTitle:s="",emailElementType:a,email:d})=>{const{__:c,_n:m}=r.useI18n(),b=r.useSendPostMessage(),f=r.useNotification(),{token:E}=(0,t.ui_kit$useToken)(),h=r.useAppConfig(),p=r.usePushToDataLayer(),S=(0,n.useRef)(null),[_,B]=(0,n.useState)(""),[T,I]=(0,n.useState)("ADD"),[P,y]=(0,n.useState)(!1),[C,O]=(0,n.useState)(null),[X,H]=(0,n.useState)(null),[F,$]=(0,n.useState)(""),[V,te]=(0,n.useState)(""),[R,Z]=(0,n.useState)(!1),[ge,le]=(0,n.useState)(""),[pe,be]=r.useAddCommentMutation(),[xe,Re]=r.useDeleteCommentMutation(),[oe,Ve]=r.useEditCommentMutation(),[Oe,ye]=r.useDeleteTargetMutation(),[he]=r.useAutoSaveBlockMutation(),me=r.useDispatch(),ie=r.useStore(),Q=r.useCurrentUser(),se=r.useCurrentProjectRequested(),ne=r.useContentReader(),K=ae=>{const Be=r.getEmailDocuments(bo.getContainer(ie));Be.save("anchor",{project:ae}).then(v=>{const ee=v?Be.revisionFacts()?.lastRevisionAt:void 0;ee!==void 0&&d?.id!=null&&me(r.rememberAutosaveTime({emailId:d.id,modified:new Date(ee).toISOString()}))})},z=()=>{const ae=se;if(a==="email"){K(ae);return}const Be={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:ae,html:ne(),excerpt:d?.date_gmt};he({blockId:d?.id,body:Be}).catch(v=>{})};function q(ae){Z(!1),le(""),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ge}),y(!0),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function ue(){H(C),e.filter(ae=>ae.parent===C).length?oe({commentId:C,status:"deleted"}).unwrap():xe(C),document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")&&b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")}),z(),le("")}function _e(ae){H(C);const Be=e.find(ee=>ee.id?.toString()===C),v=Be?.target_id?.toString()||"";Z(!!v),le(v),te(Be?.content?.slice(3,-5)?.toString()),I("EDIT")}function fe(ae){H(C),$(""),I("REPLY")}const Le=()=>{f.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 we(){l?(await oe({commentId:X,content:V,targetId:ge}).unwrap(),I("ADD"),te(""),H(0),Z(!1),y(!1),le(""),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Le()}const Ne=ae=>{I("ADD"),te(""),H(0),Z(!1),y(!1),le(""),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},Y=async()=>{l?((_||F)&&await pe({subjectId:i,author:Q.id,parent:T==="ADD"?"0":X,content:_||F,author_name:Q.name,author_email:Q.email,targetId:ge}).then(ae=>{ae.error?f.error({title:ae.error.data.code,description:ae.error.data.message}):p({event:"submit",action:"send_discussion_chat_message",entity_type:a==="block"?"block":"email",entity_id:d?.id,project_id:d?.project,context:"editor"},void 0,{analyticsName:"editor_comment_sent"})}),le(""),I("ADD"),$(""),B(""),H(0),Z(!1),y(!1),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Le()};function re(){R?(y(!1),Z(!1),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ge})):(y(!P),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!P}),P&&Z(!1))}function je(ae){let Be=JSON.parse(JSON.stringify(ae));if(!Be||!Be.length)return[];let v=[],ee=new Map;for(let Te=0,Ce=Be.length;Te<Ce;++Te){let De=Be[Te],We=ee.get(De.id);if((!We||Array.isArray(We))&&(We&&(De.children=We),ee.set(De.id,De)),String(De.parent)==="0")v.push(De);else{let Je=ee.get(De.parent);Je?(Array.isArray(Je)?Je:Je.children=Je.children||[]).push(De):ee.set(De.parent,[De])}}return v.forEach(Te=>{Te.status==="deleted"&&!Te.children&&(Re.isUninitialized||Re.isSuccess)&&xe(Te.id).unwrap().catch(Ce=>{})}),v}const W=ae=>{const Be=ae.data.operation;if(Be===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(le(ae.data.settings.value),ae.data.settings.value!==""?(Z(!0),y(!1)):(Z(!1),y(!0))),Be===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&z(),Be===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+ae.data.settings.targetId+'"]')){let v=document.querySelector('.comment-icon-target[target-id="'+ae.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,v.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,v.offsetTop),v.classList.add("active"),setTimeout(()=>{v.classList.remove("active")},2e3)}else b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ae.data.settings.targetId}),f.error({title:c("There's no such comment.")});Be===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&f.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(W);const Se=ae=>{b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:ae})},Ie=ae=>(ae?.sort((Be,v)=>Be.date>v.date?1:-1),(0,o.jsx)(o.Fragment,{children:ae&&!!ae.length&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:ae,renderItem:Be=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("li",{id:Be.id,children:(0,o.jsxs)(o.Fragment,{children:[Be.status==="deleted"&&Be.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:Ie(Be.children)}),Be.status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:Be.author_id,author:Be.author_name,avatar:Be.author_avatar_urls&&Be.author_avatar_urls[48]||"",className:(0,Ue.default)(Be.target_id&&"targetted-comment-item",(!Be.author_avatar_urls||!Be.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>O(Be.id),menu:{items:Be.author===Q.id?He:ze},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>Be.target_id&&Se(Be.target_id),dangerouslySetInnerHTML:{__html:Be.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:Be.date&&r.formatDate(r.tryParseISO(Be.date),m,!0)}}),Be.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":Be.target_id,onClick:()=>Se(Be.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:E.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[T==="REPLY"&&X===Be.id&&Me,T==="EDIT"&&X===Be.id&&Pe,Ie(Be.children)]})})})]})})})})})),Pe=(0,o.jsxs)(t.ui_kit$Form,{onFinish:we,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:V,onChange:ae=>te(ae.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:ae=>ae.key==="Escape"&&Ne(),onPressEnter:ae=>ae.key==="Enter"&&ae.ctrlKey&&we(),ref:S})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[R?(0,o.jsx)(t.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:q,children:(0,o.jsx)(t.ui_kit$Button,{loading:ye.isLoading,type:P||R&&T==="EDIT"&&ge!==""?"primary":"default",className:"button-target "+(P&&!R?"button-target_choose":""),style:R&&T==="EDIT"&&ge!==""?{background:E.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}):(0,o.jsx)(t.ui_kit$Button,{onClick:re,loading:ye.isLoading,type:P||R&&T==="EDIT"&&ge!==""?"primary":"default",className:"button-target "+(P&&!R?"button-target_choose":""),style:R&&T==="EDIT"&&ge!==""?{background:E.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:Ve.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:Ne,className:"button-reply",children:c("Cancel")})]})})]}),Me=(0,o.jsxs)(t.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:Y,children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:F,onChange:ae=>$(ae.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:ae=>ae.key==="Escape"&&Ne(),onPressEnter:ae=>ae.key==="Enter"&&ae.ctrlKey&&Y(),ref:S})}),(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:re,type:P||R&&T==="REPLY"&&ge!==""?"primary":"default",className:"button-target "+(P&&!R?"button-target_choose":""),style:R&&T==="REPLY"&&ge!==""?{background:E.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:T==="REPLY"&&be.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:Ne,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,n.useEffect)(()=>{T==="REPLY"&&S.current.focus({cursor:"start"}),T==="EDIT"&&S.current.focus({cursor:"end"})},[T]);let He=[];He.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:fe},{key:"Edit comment",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:_e},{key:"Delete comment",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:E.colorError},onClick:ue});let ze=[];return ze.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:fe}),(0,o.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:je(e),renderItem:ae=>(0,o.jsxs)("li",{id:ae.id,children:[ae.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:Ie(ae.children)}),ae.comment_status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:ae.author_id,author:ae.author_name,avatar:ae.author_avatar_urls&&ae.author_avatar_urls[48]||"",className:(0,Ue.default)(ae.target_id&&"targetted-comment-item",(!ae.author_avatar_urls||!ae.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>O(ae.id),menu:{items:ae.author===Q.id?He:ze},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>ae.target_id&&Se(ae.target_id),dangerouslySetInnerHTML:{__html:ae.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:ae.date&&r.formatDate(r.tryParseISO(ae.date),m,!0)}}),ae.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":ae.target_id,onClick:()=>Se(ae.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:E.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[T==="REPLY"&&X===ae.id&&Me,T==="EDIT"&&X===ae.id&&Pe,Ie(ae.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:Y,className:T==="ADD"?"addMode":"replyEditMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{value:_,onChange:ae=>B(ae.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:ae=>ae.key==="Enter"&&ae.ctrlKey&&Y()})}),(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:re,type:P||R&&T==="ADD"&&ge!==""?"primary":"default",className:"button-target "+(P&&!R?"button-target_choose":""),style:R&&T==="ADD"&&ge!==""?{background:E.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:T==="ADD"&&be.isLoading,htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]})]})},mm=["common_styles","subject","preheader","meta"];function pm(e,i){r.writeSourceReport(e,r.fromRevision(i))}function hm(e){if(!e)return null;const i=e.get().attributes??{},l={};for(const s of mm)i[s]!==void 0&&(l[s]=i[s]);return{content:e.getContent(),attributes:l}}function ya(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var wa=(e,i)=>({key:e.id,author:e.author,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}),_r=({emailElement:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),a=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),m=r.useEditorLocked(),b=r.useEditorLockCheck(),{document:f}=r.useDocumentSessionContext(),E=r.useSelector(r.selectHistoryData),h=r.useDocumentHistoryReader(),p=r.useSelector(r.selectElementHistoryHasMore),S=r.useSelector(r.selectIsPanelHistoryCollapsed),[_,B]=(0,n.useState)(!0),[T,I]=(0,n.useState)(!1),[P,y]=(0,n.useState)([]),[C,O]=(0,n.useState)([]),X=he=>s(r.switchIsPanelHistoryCollapsed(he)),H=(0,n.useCallback)(he=>{if(!he?.html||b())return;const me=r.fromRevision(he);me?.attributes&&d(me.attributes),s(r.markAppearanceNeedsUpdate());const ie=f?.get().version;c(he.html,{undoable:!0}),f&&f.get().version===ie&&f.markUnsaved()},[c,s,d,f,b]),F=(0,n.useCallback)(he=>{pm(f,he),s(r.markAppearanceNeedsUpdate())},[f,s]),{data:$}=r.projectsApi.useGetProjectQuery(Number(a),{skip:!a}),[V,te]=(0,n.useState)([]);(0,n.useEffect)(()=>{if($){const{owner:he,admins:me,users:ie}=$?.members;te([he&&{...he},me&&Array.isArray(me)&&me.map(Q=>({...Q})),ie&&Array.isArray(ie)&&ie.map(Q=>({...Q}))].filter(Q=>Q).flat(1).map(Q=>({id:Q.ID,display_name:Q.display_name})))}},[$,$?.members,i]);const[R,Z]=(0,n.useState)(1),[ge,le]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const he=Array.isArray(E)&&E.length&&E?.map(me=>wa(me,i));O(he||[]),y(he),B(!1),p||le(!0)},[E,p,i]);const pe=()=>{I(!0),O(P.concat([...new Array(3)].map(()=>({loading:!0})))),h(e.id,R+1).then(he=>{const{data:me,hasMore:ie}=he.data,Q=Array.isArray(me)&&me?.map(ne=>wa(ne,i)),se=P.concat(Q);O(se),y(se),I(!1),window.dispatchEvent(new Event("resize")),ie||le(!0),Z(R+1)})},be=!_&&!T&&!ge?(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,[xe,Re]=(0,n.useState)(),[oe,Ve]=(0,n.useState)(null),Oe=(0,n.useCallback)(he=>{H(he),Re(null),Ve(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[H,l,s]);(0,n.useEffect)(()=>{!S&&!oe&&Ve(hm(f))},[S,Ve,f,oe]),(0,n.useEffect)(()=>{S&&oe&&(ya(f,oe),s(r.markAppearanceNeedsUpdate()),Ve(null))},[S,oe,f,s]);const ye=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:_,itemLayout:"horizontal",loadMore:be,dataSource:C,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:(he,me)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{me!==xe&&(Re(me),F(P[me])),s(r.setBlockSettingsDisable(!0))},className:(0,Ue.default)("history-panel__item",{"history-panel__item_active":me===xe}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:he.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:he.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:ye.revisionService?he.author:V.find(ie=>ie.id?.toString()===he.author?.toString())?.display_name||"–"}),he.isAutosave&&xe!==me&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!he.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:m,onClick:ie=>{xe===me&&ie.stopPropagation(),Oe(P[me])},children:i("Set")}),he.isAutosave&&xe===me&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:m,onClick:ie=>{xe===me&&ie.stopPropagation(),Oe(P[me])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),oe&&ya(f,oe),Ve(null),X(!0),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,o.jsx)(r.EmIcons,{icon:"Close",component:t.icons$Close})})]})};_r.propTypes={};var ja=async({blockTags:e,projectTagsArray:i,addTerm:l,project:s,notification:a})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const m=i.find(b=>b.name===c);return m?Promise.resolve(m.id):l({project:s,kind:r.BLOCK_TAGS,name:c}).then(({error:b,data:f})=>{if(b?.status===400)return r.existingTermIdFromError(b);if(f)return f.id;if(b)return a.fromError("TAG_CREATING_ERROR",c,b),null})});return(await Promise.all(d)).filter(c=>c!=null)},va=()=>{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))},bm=async e=>{const{block:i,form:l,projectData:s,projectTagsArray:a,projectId:d,addBlock:c,editBlock:m,editProject:b,addTerm:f,notification:E,__:h,handleCloseModal:p,htmlContent:S,refetchBlocks:_,reloadBlockScreens:B,onGlobalBlockTemplateSynced:T}=e;try{const{valid:I,values:P,blockTags:y}=await Ia({form:l,notification:E,__:h});if(!I)return;const C=await ja({blockTags:y,projectTagsArray:a,addTerm:f,project:s,notification:E});await Pa({block:i,form:l,projectId:d,htmlContent:S,values:P,tagIds:C,addBlock:c,editBlock:m,editProject:b,notification:E,refetchBlocks:_,reloadBlockScreens:B,projectTagsArray:a,__:h,handleCloseModal:p,onGlobalBlockTemplateSynced:T})}catch{}},Ia=async({form:e,notification:i,__:l})=>{let s=!0;const a=await e.validateFields(),d=a.tags;return d?.length>10&&(i.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:r.getBlockDesc(a),title:l("Maximum 10 tags available.")}),s=!1),{valid:s,values:a,blockTags:d}};function Ca(e){if(e!==null&&typeof e=="object"&&"data"in e){const i=e.data;return{code:i?.code,message:i?.message}}return{}}async function fm(e){const{created:i,blockData:l,editBlock:s,onGlobalBlockTemplateSynced:a}=e;if(!i.id)return;const d=new Date,c=r.formatEmBlockVersion(d);if(s){const m=i.html??l.html??"",b=r.injectEmBlockIdIntoBlockHtml(m,String(i.id),d);b!==m&&await s({blockId:String(i.id),html:b})}a?.(String(i.id),c)}function gm(e){const{block:i,projectId:l,htmlContent:s,values:a}=e;return i?{title:i.blockTitle,project:i.projectId,html:i.htmlContent,type:i.blockType||"Other",global_block:!1}:{title:a?.title??"",project:l,html:s||"",type:a?.type||"Other",...a?.global_block===!0?{global_block:!0}:{}}}var Pa=async({block:e,form:i,projectId:l,htmlContent:s,values:a,tagIds:d,addBlock:c,editBlock:m,editProject:b,notification:f,refetchBlocks:E,reloadBlockScreens:h,projectTagsArray:p,__:S,handleCloseModal:_,onGlobalBlockTemplateSynced:B})=>{const T=gm({block:e,projectId:l,htmlContent:s,values:a}),I=await c({...T,blocktags:d.join(",")});if(I.error){const O=Ca(I.error);throw f.error({id:"BLOCK_CREATING_ERROR",data:{title:T.title,code:T.html},innerException:I.error,message:O.code,description:O.message}),i.resetFields(),_(),new Error("Ошибка создания блока")}const P=I.data;!e&&a?.global_block===!0&&P?.id&&await fm({created:P,blockData:T,editBlock:m,onGlobalBlockTemplateSynced:B}),e||(i.resetFields(),_());const y=p.map(O=>O.id),C=await b({projectId:l,blocktags:[...new Set([...y,...d])].join(",")});if(C.error){const O=Ca(C.error);f.error({message:O.message,code:O.code})}else!e&&E&&(f.success({id:"BLOCK_CREATING_SUCCESS",data:r.getBlockDesc(I.data),message:S("The block “")+String(I.data?.title??"")+S("” was successfully created.")}),E());return!e&&h&&h(),I.data},xr=({isModalVisible:e,htmlContent:i,projectId:l,setIsShowAddAllBlocksModal:s,setIsShowAddAllBlocksModalForNewEmail:a})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[m]=t.ui_kit$Form.useForm(),[b,f]=(0,n.useState)([]),[E,h]=r.useAddBlockMutation(),[p]=r.useEditBlockMutation(),{data:S}=r.useGetBlocksSchemaQuery(),_=r.useNotification(),B=r.useAppConfig(),[T,I]=(0,n.useState)([]),P=r.useProjectData(),{refetch:y}=r.useGetBlocksQuery(r.projectBlocksArgs(l)),[C,O]=r.useAddTermMutation(),[X,H]=r.useEditProjectMutation(),F=r.useSendPostMessage(),$=(0,n.useCallback)((ge,le)=>{F({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:ge,...le?{emBlockVersion:le}:{}}})},[F]),{data:V}=r.useGetTermsQuery({project:P,kind:r.BLOCK_TAGS},{skip:!P?.id});(0,n.useEffect)(()=>{I((V||[]).map(ge=>({value:ge.name})))},[V]),(0,n.useEffect)(()=>{if(S){const ge=S.schema.properties.acf.properties.type.items.enum;let le=[];for(let pe in ge)le.push({label:d(r.TYPES_TRANSLATE[ge[pe]]),value:ge[pe]});f(le)}},[S,d]);const te=()=>{c(r.closeModal())},R=()=>{s(!0),a(!1),te()},Z=async()=>{await bm({form:m,projectData:P,projectTagsArray:V||[],projectId:l,addBlock:E,editBlock:p,editProject:X,addTerm:C,notification:_,__:d,handleCloseModal:te,htmlContent:i,refetchBlocks:y,reloadBlockScreens:va,onGlobalBlockTemplateSynced:$})};return(0,o.jsx)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,onOk:()=>R(),onCancel:te,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:R,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:Z,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:m,layout:"vertical",name:"add_new_block_form",onFinish:Z,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||O.isLoading||H.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||O.isLoading||H.isLoading,size:"large",placeholder:d("Choose block type"),options:b})})})]}),B.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||O.isLoading||H.isLoading,options:T})}),B.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||O.isLoading||H.isLoading})})]})})};xr.propTypes={};var _m="https://app.emailmaker.ru/api/".replace(/\/+$/,""),xm=`${_m}/wp-json/ai-generator/v1/identificate_blocks`,km=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function Em(e){return await e.getInstance(bo.TOKEN_ID)}async function Bm(e,i,l,s,a){const d={blocks:s,types:km,locale:i};l.current=d;try{const c=await Em(a),m=await fetch(xm,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(d)});if(!m.ok||m.status!==200)throw new Error(`${m.statusText}`);return await m.json()}catch(c){throw c}}var Sm=(e,i="block")=>{const l=new DOMParser,s=l.parseFromString(e,"text/html"),a=s.querySelectorAll(`[em="${i}"]`),d=s.querySelectorAll("link");return{parser:l,document:s,blockElements:a,styleElement:s.querySelector('[em="styles"]'),linksElements:d}};function Tm(e){return Array.from(e).map(i=>i.outerHTML).join("")}var Rm=(e,i="block",l=!1)=>{if(!e?.html)return[];const{document:s,blockElements:a,styleElement:d,linksElements:c}=Sm(e.html,i),m=Tm(c);if(!(a instanceof NodeList))return[];const b=s.querySelector("head"),f=b?b.innerHTML:"";return Array.from(a).map((E,h)=>{if(!(E instanceof Element)||!E.outerHTML)return null;const p=d?d.outerHTML:"";return{id:`${e.id}-${h}`,html:l?`<!DOCTYPE html>
|
|
23
|
-
<html>
|
|
24
|
-
<head>${f}</head>
|
|
25
|
-
<body>
|
|
26
|
-
<table>${E.outerHTML}</table>
|
|
27
|
-
</body>
|
|
28
|
-
</html>`:r.minifyHtml(`${m}${p}${E.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function ym(e,i,l){const{images:s}=e,{blocks:a}=i;return s?.map(d=>{const c=a.find(m=>m.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:l}})}var wm=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),jm=e=>e.replace(/src="[^"]*"/g,'src=""'),vm=e=>/<div\s+[^>]*style="font-family:/i.test(e),Im=e=>{const i=new Set,l=[];for(const s of e)if(vm(s.html)){const a=jm(wm(s.html));i.has(a)||(i.add(a),l.push(s))}else l.push(s);return l},Cm=async e=>{const{block:i,form:l,projectData:s,projectId:a,addBlock:d,editProject:c,notification:m,__:b,handleCloseModal:f,htmlContent:E,refetchBlocks:h,reloadBlockScreens:p,values:S,tagIds:_,projectTagsArray:B}=e;try{await Pa({block:i,form:l,projectId:a,htmlContent:E,values:S,tagIds:_,addBlock:d,editProject:c,notification:m,refetchBlocks:h,reloadBlockScreens:p,projectTagsArray:B,__:b,handleCloseModal:f})}catch(T){throw T}},Pm=({projectData:e,addTerm:i,addBlock:l,editProject:s,reloadBlockScreens:a,notification:d,__:c,handleCloseModal:m,setTriggerOpenSavedBlocksTab:b,setTagsOptions:f,form:E,projectId:h})=>{const[p,S]=(0,n.useState)(!1),_=r.useInvalidateProject(),{data:B}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,n.useEffect)(()=>{f((B||[]).map(I=>({value:I.name})))},[B,f]),{bulkSave:async(I,P,y,C)=>{S(!0);try{if(!P)return;const O=await ja({blockTags:C,projectTagsArray:B||[],addTerm:i,project:e,notification:d});let X=!0,H=0;for(const F of I)try{await Cm({block:F,form:E,projectData:e,projectId:h,addBlock:l,editProject:s,notification:d,__:c,handleCloseModal:m,values:y,tagIds:O,projectTagsArray:B||[]})}catch{X=!1,H++}if(X&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!X){if(H===I.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}b(!0),_(h),a()}catch(O){throw O}finally{S(!1),E.resetFields(),m()}},confirmSavingBlocksLoading:p}},kr=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:l,setTriggerOpenSavedBlocksTab:s,projectId:a})=>{const{__:d,_n:c,sprintf:m}=r.useI18n(),b=r.useContainer(),f=r.useProjectData(),{tagsEnabled:E}=r.useAppConfig(),[h,p]=(0,n.useState)(!1),[S]=t.ui_kit$Form.useForm(),[_,B]=(0,n.useState)([]),[T,I]=(0,n.useState)([]),P=(0,n.useRef)({}),[y]=r.useAddTermMutation(),[C]=r.useEditProjectMutation(),[O,X]=r.useAddBlockMutation(),H=r.useEditorLocale()||void 0,F=Rm(i),$=Im(F).map(pe=>pe),V=$.length,te=r.useNotification(),R=()=>{h||ge||l(!1)},{bulkSave:Z,confirmSavingBlocksLoading:ge}=Pm({projectData:f,addTerm:y,addBlock:O,editProject:C,reloadBlockScreens:va,notification:te,__:d,handleCloseModal:R,setTriggerOpenSavedBlocksTab:s,setTagsOptions:I,form:S,projectId:a}),le=async()=>{try{const{valid:pe,values:be,blockTags:xe}=await Ia({form:S,notification:te,__:d});s(!1),p(!0);const Re=await Bm(i,H,P,$,b),oe=ym(Re,P.current,i.project.toString());p(!1),await Z(oe,pe,be,xe)}catch{p(!1),l(!1),te.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:le,onCancel:R,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(h||ge)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:h||ge,onClick:le,children:m(c("Save %d block","Save %d blocks",V),V)},"submit")}),children:[h||ge?(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:m(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.",V),V)}),!(h||ge)&&E&&(0,o.jsx)(t.ui_kit$Form,{form:S,name:"add_all_blocks_form",layout:"vertical",onFinish:le,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:_,onChange:B,disabled:X.isLoading,options:T})})}),(ge||h)&&(0,o.jsx)("div",{className:"modal-spinner",children:(0,o.jsx)(t.ui_kit$Spin,{size:"large"})})]})};kr.propTypes={};var Am=e=>e.replace(/[\\]/g,"\\\\").replace(/["]/g,'\\"').replace(/[/]/g,"\\/").replace(/[\b]/g,"\\b").replace(/[\f]/g,"\\f").replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t"),Er=({isModalVisible:e=!1,email:i=null})=>{const{__:l}=r.useI18n(),[s]=t.ui_kit$Form.useForm(),a=r.useDispatch(),d=r.useRouteEmailId(),c=r.useNotification(),m=r.useCurrentUser(),b=r.useProjectData()?.projects_test_emails,[f,E]=r.useSendTestEmailMutation(),{token:h}=(0,t.ui_kit$useToken)(),[p,S]=(0,n.useState)(!1);r.useAppConfig(),r.useCookieManager();const _=i.project,{data:B}=r.useGetProjectTestRecipientsQuery(_??0,{skip:!0}),[T,I]=r.useEditProjectMutation(),[P]=r.usePutProjectTestRecipientsMutation(),y=r.useProjectData(),{testEmails:C}=r.useAppConfig(),O=r.usePushToDataLayer(),[X,H]=(0,n.useState)([]),[F,$]=(0,n.useState)(!1),V=r.useEventEmitter(bo.events.ON_SEND_EMAIL_MODAL_ID);(0,n.useEffect)(()=>{e?V.fire(i).then(le=>{le.some(pe=>pe===!1)?a(r.closeModal$1()):S(e)}):S(e)},[e,a,S,i,V]),(0,n.useEffect)(()=>{},[y,_,B]),(0,n.useEffect)(()=>{H(C.map(le=>({value:le})))},[C]),(0,n.useEffect)(()=>{const le=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(le&&p&&s.getFieldValue("recipients")?.length===0){const pe=JSON.parse(le);pe?.[_]&&s.setFieldsValue({recipients:pe[_]})}},[_,p,s]),(0,n.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const te=()=>{a(r.closeModal$1()),s.resetFields()},R=r.useContentReader(),Z=()=>{s.validateFields().then(()=>{const le={user_id:m.id,project_id:_,email_id:d,subject:s.getFieldValue("subject"),email:s.getFieldValue("recipients").join(","),html:Am(R())};f(le).unwrap().catch(pe=>{c.error({error:{data:{code:pe?.data?.code,message:pe?.data?.message}}})}),$(!0),O({event:"submit",action:"send_test_email",entity_id:d,project_id:_,recipients_count:s.getFieldValue("recipients").length})}).catch(le=>{})},ge=n.default.useRef(b);return ge.current=b,(0,n.useEffect)(()=>{const le=ge.current;if(E.isSuccess&&F){E.data?.status;{const pe=[...new Set([...X.map(Oe=>Oe.value),...s.getFieldValue("recipients")])],be=pe.map(Oe=>({projects_test_email:Oe}));((Oe,ye)=>{if(!Oe||!ye)return Oe===ye;if(Oe.length!==ye.length)return!1;const he=Oe.map(ie=>ie.projects_test_email).sort(),me=ye.map(ie=>ie.projects_test_email).sort();return he.every((ie,Q)=>ie===me[Q])})(be,r.isProjectsV2Enabled()?(B||[]).map(Oe=>({projects_test_email:Oe})):le)||(r.isProjectsV2Enabled()?P({projectId:_,emails:pe}):T({projectId:_,projects_test_emails:be}));const Re=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({...Re,[_]:[...new Set(oe)]}));const Ve=i.title||i.subject||l("Untitled email.").replace(/\.$/,"");c.success(l("The email “")+Ve+l("” was successfully sent."))}$(!1),s.resetFields(),a(r.closeModal$1())}},[E,s,_,T,P,B,X,F,a,i.title,i.subject,c,I,l]),(0,n.useEffect)(()=>{I.isError&&(c.error(I),$(!1),s.resetFields(),a(r.closeModal$1()))},[a,I,s]),(0,n.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:p,onCancel:te,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:I.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:Z,disabled:E.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:(le,pe)=>pe.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):pe.length!==0?pe.every(be=>r.emailValidation.test(be.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:X,tagRender:le=>{const{label:pe,closable:be,onClose:xe}=le,Re=oe=>{oe.preventDefault(),oe.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:h.colorPrimary,onMouseDown:Re,closable:be,onClose:xe,style:{borderRadius:6},children:pe})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};Er.propTypes={isModalVisible:g.default.bool,email:g.default.shape({html:g.default.string,subject:g.default.string})};var Nm=ro.__exportAll({AddAllBlocksModal:()=>kr,AddNewBlockModal:()=>xr,BlocksSearch:()=>gr,Discuss:()=>Ra,DiscussAi:()=>ra,EmailProperties:()=>Dl,EmailSettings:()=>Wi,EmailStyles:()=>Qi,FileManagerDataLayer:()=>xa,HistoryPanel:()=>_r,LimitUpgradeModal:()=>si,Optimise:()=>fa,SaveBlockBtn:()=>Rr.SaveBlockBtn,SelectedElementPanel:()=>dt,SendTestEmailModal:()=>Er});uo.AddAllBlocksModal=kr,uo.AddNewBlockModal=xr,uo.BlocksSearch=gr,uo.Discuss=Ra,uo.DiscussAi=ra,uo.EmailProperties=Dl,uo.EmailSettings=Wi,uo.EmailStyles=Qi,uo.FileManagerDataLayer=xa,uo.HistoryPanel=_r,uo.LimitUpgradeModal=si,uo.LimitUpgradeModal$1=si,uo.Optimise=fa,uo.SaveBlockBtn=Rr.SaveBlockBtn,uo.SelectedElementPanel=dt,uo.SendTestEmailModal=Er,uo.canonicalImageUrlKey=ft,uo.getImageDimensionsFromBlob=yr,uo.normalizeImageFormatForDisplay=$t,Object.defineProperty(uo,"panels_exports",{enumerable:!0,get:function(){return Nm}}),uo.resolveDataProviderPreview=jr,uo.shouldCountAiUsage=cr,uo.useImageBlobFetch=vr,uo.useImageBlobResolver=Ir});
|