@emailmaker/emailmaker 1.1.109 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -1
- package/emailmaker-core.8c2b05d7.js +859 -0
- package/emailmaker-esm.js +11 -11
- package/{emailmaker-po.7b3c64f5.js → emailmaker-po.8c2b05d7.js} +1 -1
- package/emailmaker.d.ts +254 -3
- package/emailmaker.js +12 -12
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.7b3c64f5.html → iframe-eblock.8c2b05d7.html} +2 -2
- package/iframe/{iframe.7b3c64f5.html → iframe.8c2b05d7.html} +2 -2
- package/iframe/js/elMarkupHelper.DnlKn-Lc.js +277 -0
- package/iframe/js/iframe-eblock.body.8c2b05d7.js +9 -0
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/iframe.body.8c2b05d7.js +129 -0
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{efb5b933.js → 1687225b.js} +1 -1
- package/static/core/{86b377fd.js → 1912a30e.js} +1 -1
- package/static/core/{2f32a31d.js → 286097e2.js} +2 -2
- package/static/core/{874f77d2.js → 316f71b7.js} +1 -1
- package/static/core/{26971a74.js → 42ec1ce9.js} +2 -2
- package/static/core/466f98bb.js +28 -0
- package/static/core/{8c37b60d.js → 48e93de9.js} +1 -1
- package/static/core/{26473b73.js → 492992bb.js} +1 -1
- package/static/core/{98ab1508.js → 60b75c99.js} +1 -1
- package/static/core/{f115f982.js → 6535dd13.js} +7 -7
- package/static/core/{5c4304c8.js → 6e548251.js} +1 -1
- package/static/core/844fbb88.js +1 -0
- package/static/core/{9ef544f4.js → 97aabe39.js} +1 -1
- package/static/core/{cebc7ae2.js → 9e7c400d.js} +10 -10
- package/static/core/9ff19e12.js +4 -0
- package/static/core/{b35140b6.js → aab84cf4.js} +1 -1
- package/static/core/{a85c7f02.js → b6999cba.js} +1 -1
- package/static/core/{1157da89.js → b752ed52.js} +1 -1
- package/static/core/{ee6c9aa1.js → b99f4f42.js} +1 -1
- package/static/core/{213ffad0.js → bbb11e65.js} +1 -1
- package/static/core/{6314ae82.js → c2daae71.js} +1 -1
- package/static/core/{3bfab25b.js → c6cd3dc2.js} +1 -1
- package/static/core/{2e29db3c.js → c7b2d60e.js} +1 -1
- package/static/core/{850805d7.js → d2a90b69.js} +1 -1
- package/static/core/{756e184f.js → dfbe3ba4.js} +1 -1
- package/static/core/{87dcdb89.js → e13d6875.js} +1 -1
- package/static/core/{e8fa95c8.js → ed4586a5.js} +1 -1
- package/static/core/{dfcb8d34.js → ee6a6899.js} +1 -1
- package/static/esm/ea997fe3.js +1 -0
- package/static/umd-runtime/runtime.BqNyFZPj.js +1 -0
- package/vendor/@emailmaker/ui-kit/package.json +1 -1
- package/emailmaker-core.7b3c64f5.js +0 -859
- package/iframe/js/elMarkupHelper.BcpgksI_.js +0 -279
- package/iframe/js/iframe-eblock.body.7b3c64f5.js +0 -9
- package/iframe/js/iframe.body.7b3c64f5.js +0 -129
- package/static/core/6fb2f217.js +0 -4
- package/static/core/e4b8362a.js +0 -28
- package/static/core/e90908e7.js +0 -1
- package/static/esm/73c89921.js +0 -1
- package/static/umd-runtime/runtime.DaVzSc6X.js +0 -1
package/static/core/e4b8362a.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/9c8a1125.js",["require","exports","module","static/core/5dc34752.js","static/core/25b4c1c1.js","static/core/be05067a.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./5dc34752.js"),r=B("./25b4c1c1.js"),u=B("./be05067a.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/be05067a.js",["require","exports","module","static/core/5dc34752.js","static/core/25b4c1c1.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./5dc34752.js"),r=t("./25b4c1c1.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/d9cb742c.js",["require","exports","module","static/core/5dc34752.js","static/core/25b4c1c1.js","static/core/3a4a94f4.js","vite/preload-helper"],function(h,I,W){const A=h("./5dc34752.js"),n=h("./25b4c1c1.js"),p=h("./3a4a94f4.js");let D=h("vite/preload-helper");var R=A.__exportAll({IMPORT_UPLOAD_CONCURRENCY:()=>15,createDocumentProcessor:()=>T,createFileProcessor:()=>H,createImportFileNamer:()=>_,ensureFileExtension:()=>$,extractUploadResult:()=>F,fetchFileData:()=>U,getExt:()=>C,handleUploadResult:()=>j,importEmail:()=>L,importHtml:()=>x,importZip:()=>P,splitFileName:()=>b,uploadFile:()=>n.uploadFile});function C(e){const t=e.split(".");return t[t.length-1].toLowerCase()}function b(e){const t=e.split(".");return t[t.length-1].toLowerCase()}var w="index.html";function M(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=`-${M(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("/")+"/",{html:m,hasBrowserExtensionArtifacts:N}=n.prepareEmailHtmlForEditor(n.zipEntryToText(s[i])),c=l.slice(0,l.length-1).join("/"),g=_();return{html:await p.changeHtml(m,async y=>{const f=y.document;await p.replaceImagesInDocument(f,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)),c&&!o.match("^(ht|f)tp(s?)://")&&(o=`${c}/${o}`);const v=s[o];return v?t(n.zipEntryToBlob(v),o):t(o,g(o,p.getFileNameWithExt(o)))}),r&&r(y)}),hasBrowserExtensionArtifacts:N}}}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}}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 B=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 H=(e,t,r,s,a)=>{const{maxSizeMB:i,maxWidthOrHeight:l}=n.resolveImageCompressionLimits(a),d=n.getBrowserImageCompressionLibUrl(),u=O(15);return(m,N)=>u(async()=>{try{const c=await U(m,e);if(!c)return typeof m=="string"?m:"";const g=await $(N,c.type),y=c.type?.trim()||n.inferImageMimeFromFileName(g)||"";let f=new File([c],g.toLowerCase(),{type:y});if(n.isAllowedImageUploadFile(f)){const o=f.type?.trim()||n.inferImageMimeFromFileName(f.name)||c.type||"";try{f=await n.prepareImageForUpload(f,{maxSizeMB:i,maxWidthOrHeight:l,mimeType:o||c.type,fileName:f.name,libURL:d,enableCompression:n.shouldEnableImageCompression(a,o),convertSvgToPng:!0})}catch{}}return j(await t({user_id:r.id,folder:s.id,file:f}),m)}catch{return typeof m=="string"?m:""}})},T=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 R}})});
|
|
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/e4b8362a.js",["require","exports","module","static/core/5dc34752.js","static/core/c9d6507f.js","static/core/25b4c1c1.js","static/core/3a4a94f4.js","static/core/e90908e7.js","static/core/d9cb742c.js","static/core/be05067a.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(go,uo,Ym){const lo=go("./5dc34752.js"),fo=go("./c9d6507f.js"),r=go("./25b4c1c1.js"),di=go("./3a4a94f4.js"),Tr=go("./e90908e7.js"),Fa=go("./d9cb742c.js"),W=go("./be05067a.js");let n=go("react");n=lo.__toESM(n);let o=go("react/jsx-runtime"),t=go("__delivery__/libs"),Ma=go("react-dom"),Lt=go("vite/preload-helper"),Ue=go("classnames");Ue=lo.__toESM(Ue);let Lo=go("dayjs");Lo=lo.__toESM(Lo);var f=lo.__toESM(r.require_prop_types());async function Rr(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 Da=67108864,Va=2e3;function Ot(e){e.abandonTimer!==void 0&&(clearTimeout(e.abandonTimer),e.abandonTimer=void 0)}function yr(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 Ha(e={}){const i=e.maxCacheBytes??Da,l=e.abandonDelayMs??Va,s=new Map,a=new Map;let d=0;function c(g){const E=s.get(g);E&&(d-=E.size,s.delete(g))}function m(g,E){if(c(g),!(E.size>i)){s.set(g,E),d+=E.size;for(const y of s.keys()){if(d<=i)break;c(y)}}}function b(g){const E=a.get(g);E&&(Ot(E),a.delete(g))}function x(g,E){E.waiters-=1,!(E.waiters>0||E.abandonTimer!==void 0||a.get(g)!==E)&&(E.abandonTimer=setTimeout(()=>{E.abandonTimer=void 0,!(a.get(g)!==E||E.waiters>0)&&(a.delete(g),E.controller.abort())},l))}function k(g,E,y){return E.waiters+=1,Ot(E),y.then(()=>x(g,E),()=>x(g,E)),y}async function h(g,E,y){const v=ft(g);if(!v)throw new Error("Empty image URL");const P=s.get(v);if(P){if(E?.aborted)throw new DOMException("Aborted","AbortError");return s.delete(v),s.set(v,P),P}const w=a.get(v);if(w)return k(v,w,yr(w.promise,E));const I=new AbortController,N={promise:y(v,I.signal).then(X=>(b(v),m(v,X),X)).catch(X=>{throw b(v),X}),controller:I,waiters:0,abandonTimer:void 0};return a.set(v,N),k(v,N,yr(N.promise,E))}function p(g){const E=ft(g);if(!E)return;const y=a.get(E);y&&(Ot(y),y.controller.abort(),a.delete(E)),c(E)}function S(){for(const[,g]of a)Ot(g),g.controller.abort();a.clear(),s.clear(),d=0}return{resolve:h,abandonKey:p,invalidateAll:S}}async function wr(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 Ua(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 Wa(e,i){const l=await fetch(e,i);if(!l.ok)throw new Error(`Server returned ${l.status}`);return l.blob()}async function za(e,i,l){const s=l?{signal:l}:void 0,{blob:a}=await r.se(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)=>fo.fetchWithResourceProxy(d,{config:i.appConfig,standalone:i.isStandalone,intent:m?.intent||"downloadBlob",validateBlob:async b=>!b.type||b.type.startsWith("image/"),init:c})},d=>Wa(d,s),Ua,{fetchInit:s});return a}function jr(){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(fo.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(fo.events.PROXY_URL_EVENT_ID);return(0,n.useCallback)(async(m,b)=>za(m,{appConfig:e,isStandalone:i,fireFileProxy:x=>d.fire({url:x,project:a}),fireProxyUrl:x=>c.fire({url:x,project:a})},b),[e,a,i,d,c])}function Ga(e){return fo.getContainer(e).getOrCreateInstance(fo.IMAGE_BLOB_RESOLVER_ID,()=>Ha())}function vr(){const e=r.useStore();return(0,n.useMemo)(()=>Ga(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 Ir=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:x})=>{const k=r.useCurrentUser(),h=r.useProjectData(),p=r.useAppConfig(),S=r.useIsStandalone(),{__:g}=r.useI18n();r.useSendPostMessage();const E=r.useSendPostMessageEx(),{openImagePicker:y}=r.useImagePicker(),v=r.useStorageProvider(),P=r.useRestClient(),w=h?.id!==void 0?String(h?.id):"",I=k?.id!=="0"?String(k.id):"",{dataProvider:N}=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:v,projectId:w,restApi:P,i18n:{__:g},pathPostfix:I,appConfig:p,isStandalone:S}),[p,S,w,P,v,I,g]),X=jr(),[V]=r.useLazyGetImageInfoQuery(),[F,$]=(0,n.useState)({width:"",height:"",size:""}),[z,ee]=(0,n.useState)(!1),[R,q]=(0,n.useState)(0),[re,de]=(0,n.useState)(""),se=(0,n.useRef)(""),me=(0,n.useRef)(b?.counter||0),xe=vr(),Ie=(0,n.useRef)(""),ae=(0,n.useRef)(""),[We,ve]=(0,n.useState)(0),pe=r.usePlanFeatureGate("image_editor"),ge=()=>{Ie.current&&(URL.revokeObjectURL(Ie.current),Ie.current="")};(0,n.useEffect)(()=>{if(!i){$({width:"",height:"",size:"",format:""}),se.current="",de(""),ge();return}if(i.startsWith("data:")||i.startsWith("blob:")){ge(),se.current=i,de(i),$({width:"",height:"",size:"",format:""});return}const K=r.stripEmVersionFromUrlString(i);ae.current=K;const G=ft(K),Q=new AbortController;let ne=!1;const _e=async Ae=>{ge();const je=We?r.appendEmVersionForPreviewReload(Ae):Ae;se.current=je,de(je);try{const{data:Oe}=await V(K);return ne||!Oe?!1:($({width:Oe?.width,height:Oe?.height,size:Oe?.fileSize!=null?(Oe.fileSize/1024).toFixed(0):"",format:$t(Oe?.format)}),!0)}catch{return!1}},fe=async()=>{const Ae=await xe.resolve(G,Q.signal,X);if(ne)return;const{width:je,height:Oe}=await Rr(Ae);if(ne)return;ge();const Y=URL.createObjectURL(Ae);Ie.current=Y,se.current=Y,de(Y),$({width:je,height:Oe,size:(Ae.size/1024).toFixed(0),format:$t(Ae.type)})};return(async()=>{try{if(!S){const Ae=await wr(N,K);if(Ae?.previewUrl&&await _e(Ae.previewUrl))return}await fe()}catch{ne||(ge(),se.current="",de(""),$({width:"",height:"",size:"",format:""}))}})(),()=>{ne=!0,Q.abort()}},[i,N,X,V,S,xe,We]);const le=(0,n.useCallback)(()=>{const K=ae.current;K&&xe.abandonKey(ft(K)),ve(Date.now())},[xe]);(0,n.useEffect)(()=>{!b?.counter||b.name!==d||b.counter!==me.current&&(me.current=b.counter,le())},[d,b,le]),(0,n.useEffect)(()=>()=>ge(),[]);const te=!!i&&!gt(r.stripEmVersionFromUrlString(String(i))),ce=async(K=null)=>{const G=d.startsWith("src"),Q=K||(G?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),ne=r.stripEmVersionFromUrlString(i||""),_e=await y({kind:G?"img":"background",currentUrl:gt(ne)?"":ne,entryModal:Q});if(!_e?.url)return;const fe=ne===r.stripEmVersionFromUrlString(_e.url);(!fe||_e.url!==i)&&e(_e.url),_e.meta?.mode==="save"&&fe&&(le(),G&&E(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(_e.url)}))},ue=[{label:g("Upload"),key:"Upload",onClick:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];p.imageCenterStockEnabled&&ue.push({label:g("Stock"),key:"Stock",onClick:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),p.imageCenterGifEnabled&&ue.push({label:g("GIF"),key:"GIF",onClick:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),p.elementAIimageEnabled&&ue.push({label:g("AI"),key:"AI",onClick:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const be=()=>{ee(!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")||ce(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:re?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:re,alt:"",onLoad:()=>{x&&Ir(r.stripEmVersionFromUrlString(i||""))&&x("success")},onError:()=>{const K=ae.current,G=r.stripEmVersionFromUrlString(re||""),Q=r.stripEmVersionFromUrlString(K||"");if(K&&G!==Q){se.current=K,de(K);return}x&&Ir(Q)&&x("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," ",g("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:g("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:()=>{pe.isLocked&&te?(ee(!0),q(r.FEATURE_UPSELL_SLIDE.image_editor)):ce(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:ue},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:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):g("Upload")})},"Actions")]}):(0,o.jsx)(t.ui_kit$Button,{type:"default",block:!0,onClick:()=>ce(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:g("Add image")}),z&&(0,o.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:be,initialSlide:R})]})};ci.propTypes={};var Ya=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),Xa=(e,i,l)=>i||(l?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Cr=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,x]=(0,n.useState)("success"),k=(0,n.useMemo)(()=>({marginBottom:m.formItemMarginBottomXS}),[m.formItemMarginBottomXS]),h=t.ui_kit$Form.useWatch(Xa(l,s,d),e);return(0,n.useEffect)(()=>{if(!h){x("");return}if(typeof h=="string"&&(h.startsWith("data:")||h.startsWith("blob:"))){x("success");return}if(Ya(h)){x("validating");return}x("success")},[h]),(0,o.jsx)(t.ui_kit$Form.Item,{name:l,validateStatus:b,style:k,children:(0,o.jsx)(ci,{validateStatus:b,placeholder:i,name:Cr(l),disabled:a,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[Cr(l).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:x})})};Ao.propTypes={label:f.default.string.isRequired,name:f.default.oneOfType([f.default.string,f.default.arrayOf(f.default.oneOfType([f.default.string,f.default.number]))]).isRequired,watchPath:f.default.arrayOf(f.default.oneOfType([f.default.string,f.default.number])),tooltipTitle:f.default.string,disabled:f.default.bool,previewReloadSignal:f.default.shape({name:f.default.string,counter:f.default.number}),form:f.default.shape({getFieldValue:f.default.func.isRequired}).isRequired},Ao.defaulProps={disabled:!1,previewReloadSignal:null};var 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",x=m?"mobileBorderRadiusAll":"borderRadiusAll",k=m?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",h=m?"mobileBorderRadiusTopRight":"borderRadiusTopRight",p=m?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",S=m?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",g=m?W.MOBILE_BORDER_RADIUS_POSITION:W.BORDER_RADIUS_POSITION,E=()=>{const y=e.getFieldsValue(!0);let v;i?(e.setFieldsValue({[k]:y[x]||null,[S]:y[x]||null,[h]:y[x]||null,[p]:y[x]||null}),v={[b]:{[g[k]]:y[x]||0,[g[S]]:y[x]||0,[g[h]]:y[x]||0,[g[p]]:y[x]||0}}):y[k]===y[S]&&y[k]===y[h]&&y[k]===y[p]?(e.setFieldsValue({[x]:y[k]}),v={[b]:{[g[x]]:y[k]}}):(e.setFieldsValue({[k]:null,[S]:null,[h]:null,[p]:null}),v={[b]:{[g[x]]:0,[g[k]]:0,[g[S]]:0,[g[h]]:0,[g[p]]:0}});const P=m?{mobileBorderRadius:{all:y.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${a}${b}`]:{...s[`${a}${b}`],...v[`${a}${b}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:P}),l(w=>!w)};return(0,o.jsx)(t.ui_kit$FormBorderRadiusInputs,{namePrefix:a,typeOfForm:d,oneBorderRadiusValue:i,onToggle:E,borderRadiusIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};To.displayName="SelectedElementFormBorderRadius";var Ka="em-mob-text_align-",qa=({value:e,onChange:i,onSync:l,fieldName:s,...a})=>{const d=(typeof e=="object"?e?.value:e)??"",c=m=>{const b={classNamePrefix:Ka,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",x=b?"mobileAlign":s;if(b){const k=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:x,children:(0,o.jsx)(qa,{fieldName:x,onSync:k,disabled:l&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:a})})}return(0,o.jsx)(t.ui_kit$Form.Item,{name:x,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",x=b?"mobileVerticalAlign":"valign",k=h=>{e.setFieldsValue({[x]:h}),b||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[x]:h}})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:x,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{...!b&&{value:i.valign,onChange:k},disabled:s,isNewIconType:a,strokeWidth:m.iconStrokeWidth})})},Ja=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],Qa=({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),x=t.ui_kit$Form.useWatch(Ja,e);(0,n.useEffect)(()=>{if(!x)return;const[h,p,S,g,E,y]=x;(h===0||h===void 0||h===null)&&(p===0||p===void 0||p===null)&&(S===0||S===void 0||S===null)&&(g===0||g===void 0||g===null)&&(E===""||E===void 0||E===null)&&(y===!1||y===void 0)||b(!1)},[x]);const k=()=>{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:k})}),(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)(Qa,{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,x]=(0,n.useState)(!1),[k,h]=(0,n.useState)(!1),[p,S]=(0,n.useState)(!1),[g,E]=(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")),x($.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")),E($.searchParams.get("tp")==="true")},[i]);const y=[{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")}],v=[{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"}],w=$=>$&&$<(0,Lo.default)().endOf("day")-864e5,I=$=>{E($)},N=()=>{const $=!c;e.setFieldValue("countdownNumbersStrong",$),l({countdownNumbersStrong:$}),m($)},X=()=>{const $=!b;e.setFieldValue("countdownNumbersItalic",$),l({countdownNumbersItalic:$}),x($)},V=()=>{const $=!k;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:w,showTime:!0,placement:"bottomRight",getPopupContainer:$=>{const z=$?.closest(".blocks-app");return z||($?.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:y.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:I})})})]}),(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:N,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":k}),onClick:V,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:v})})})]})]})};ui.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.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:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var Za={marginBottom:10},Io=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:Za,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:en,mobileBorderRadiusTopLeft:hi,mobileBorderRadiusBottomLeft:bi,mobileBorderRadiusTopRight:fi,mobileBorderRadiusBottomRight:gi,borderRadiusBottomRight:_i,borderRadiusTopRight:xi,borderRadiusBottomLeft:ki,borderRadiusTopLeft:Ei,alt:on,src:tn,title:rn,link:lt,borderRadiusAll:Pr,imgReplacer:ln,expanded:sn}={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})}},an=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(()=>an(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),nn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,dn=/^(?:<\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(nn);if(l)i=l[2];else{const s=i.match(dn);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},Ar=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":""),po=e=>e&&e!=="auto"?e:e===0?"0":"",Nr=(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 Lr(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 rn:case tn:case on:case ln:if(s){const k=[...e.carouselImages];k[d.split("_")[1]][d.split("_")[0]]=c[d],m={carouselImages:k}}else m=c;break;case sn:if(a){const k=[...e.sections];k[d.split("_")[1]][d.split("_")[0]]=c[d],m={sections:k}}break;case lt:let x=et(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(m.carouselImages=e.carouselImages,s?(i.setFieldValue(["images",[lt+"_"+d.split("_")[1]]],x),m.carouselImages[d.split("_")[1]].link=x,m.link="",i.setFieldValue(lt,"")):(e.carouselImages.forEach((k,h)=>{i.setFieldValue(["images",lt+"_"+h],x),m.carouselImages[h].link=x,m.link=x}),i.setFieldValue(lt,x))):(i.setFieldValue(lt,x),m.link=x);break;case Pr:m={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[Ei]]:b[Ei],[W.BORDER_RADIUS_POSITION[ki]]:b[ki],[W.BORDER_RADIUS_POSITION[xi]]:b[xi],[W.BORDER_RADIUS_POSITION[_i]]:b[_i],[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Ei:case ki:case xi:case _i:m={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[Pr]]:null,[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case en:case hi:case bi:case fi:case gi:m={mobileBorderRadius:{...e.mobileBorderRadius,[W.MOBILE_BORDER_RADIUS_POSITION[hi]]:b[hi],[W.MOBILE_BORDER_RADIUS_POSITION[bi]]:b[bi],[W.MOBILE_BORDER_RADIUS_POSITION[fi]]:b[fi],[W.MOBILE_BORDER_RADIUS_POSITION[gi]]:b[gi],[W.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+W.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:"%"})]}),cn=(0,o.jsx)(t.ui_kit$Select,{className:"select-after",children:(0,o.jsx)(pi,{value:"px",children:"px"})}),Or=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,hasLink:b,hasAlt:x,hasTitle:k,isOpenSrcReplacer:h,mergeTagItems:p,mergeMenuOpen:S,setMergeMenuOpen:g,cascaderRef:E,linkInputRef:y,linkButtonRef:v,altInputRef:P,altButtonRef:w,titleInputRef:I,titleButtonRef:N,srcReplacerInputRef:X,srcReplacerButtonRef:V,linkProtocol:F,handleLinkProtocolsChange:$,linkButtonHandler:z,linkInputHandler:ee,altButtonHandler:R,altInputHandler:q,titleButtonHandler:re,titleInputHandler:de,srcReplacerButtonHandler:se,srcInputHandler:me,handleSelect:xe,onChange:Ie,filter:ae,renderSearchOption:We,handleChangeValues:ve,toggleShowBorderHandler:pe,toggleShowBorderRadiusHandler:ge,toggleShowBoxShadowHandler:le})=>{const{__:te}=r.useI18n(),{token:ce}=(0,t.ui_kit$useToken)(),ue=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})}),ue.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:ve}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),ue.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:()=>g(!0),children:te("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:E,classNames:{popup:{root:"merge-tags"}},options:p,placeholder:te("Start typing the title"),showSearch:{filter:ae,render:We},spellCheck:"false",getPopupContainer:be=>be.closest(".email-pane__collapse-wrapper"),onChange:Ie,style:{display:S?"block":"none"},open:S,onKeyDown:be=>{be.key==="Escape"&&g(!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:te("Image path"),name:"src",placeholder:te("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!x&&!b&&!k&&!h?ce.formItemMarginBottomMD+4:ce.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:x||te("Alternative text"),placement:"bottom",getPopupContainer:be=>be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!x}),onClick:R,ref:w,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),ue.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:k||te("Tooltip text"),placement:"bottom",getPopupContainer:be=>be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),onClick:re,ref:N,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:b||te("Hyperlink URL"),placement:"bottom",getPopupContainer:be=>be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:z,ref:v})}),ue.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:te("Image replacer"),placement:"bottom",getPopupContainer:be=>be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":h}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:se,ref:V})})]}),(!!b||!!x||!!k||!!h)&&(0,o.jsxs)("div",{style:{marginBottom:ce.formItemMarginBottomMD+4},children:[!!b&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:F==="#",__:te,style:{marginBottom:ce.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:te("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:F,handleLinkProtocolsChange:$,__:te}),placeholder:te("Hyperlink URL"),allowClear:!0,ref:y,onChange:ee,onSelect:xe,prefix:(0,o.jsx)(Jo,{linkProtocol:F})})})})]}),!!x&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:te("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:te("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:q,ref:P,onSelect:xe})})}),ue.formFieldImageTitleEnabled&&!!k&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:te("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:te("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:de,ref:I,onSelect:xe})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:te("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:te("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:te("Image src")}),onChange:me,ref:X,onSelect:xe})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:te("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:ue.formImageFieldHeightEnabled,showMinMax:!1,gutter:ce.marginSM,rowStyle:{marginBottom:ue.formImageFieldHeightEnabled?4:24},labels:{width:te("Width"),height:te("Height"),minWidth:te("Minimum width"),maxWidth:te("Maximum width")}})}),ue.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Borders"),collapsible:!0,open:s,onToggle:pe,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),ue.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Border radius"),collapsible:!0,open:a,onToggle:ge,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,elementSettings:i})}),ue.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Box shadow"),collapsible:!0,open:d,onToggle:le,dividerTop:!0,children:(0,o.jsx)(jo,{})}),ue.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),ue.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Or.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,hasLink:f.default.string,hasAlt:f.default.string,hasTitle:f.default.string,isOpenSrcReplacer:f.default.oneOfType([f.default.bool,f.default.number]),mergeTagItems:f.default.array,mergeMenuOpen:f.default.bool,setMergeMenuOpen:f.default.func,cascaderRef:f.default.object,linkInputRef:f.default.object,linkButtonRef:f.default.object,altInputRef:f.default.object,altButtonRef:f.default.object,titleInputRef:f.default.object,titleButtonRef:f.default.object,srcReplacerInputRef:f.default.object,srcReplacerButtonRef:f.default.object,linkProtocol:f.default.string,handleLinkProtocolsChange:f.default.func,linkButtonHandler:f.default.func,linkInputHandler:f.default.func,altButtonHandler:f.default.func,altInputHandler:f.default.func,titleButtonHandler:f.default.func,titleInputHandler:f.default.func,srcReplacerButtonHandler:f.default.func,srcInputHandler:f.default.func,handleSelect:f.default.func,onChange:f.default.func,filter:f.default.func,renderSearchOption:f.default.func,handleChangeValues:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func};var Uo=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=(0,n.useRef)(),[b,x]=(0,n.useState)(l[i]?.value==="auto"),{token:k}=(0,t.ui_kit$useToken)(),[h,p]=(0,n.useState)(""),S=E=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),x(y=>!y),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:b?null:"auto",dim:""}}})},g=E=>{x(!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:k.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:m,min:0,max:h,placeholder:d("Width"),onChange:g,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:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.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,x]=(0,n.useState)(l.mobileHeight?.value==="auto"),{token:k}=(0,t.ui_kit$useToken)(),h=S=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),x(g=>!g),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=>{x(!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:k.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:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var $r=({form:e,elementSettings:i,handleChangeValues:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:m,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:x,hasLink:k,hasAlt:h,hasTitle:p,linkInputRef:S,linkButtonRef:g,altInputRef:E,altButtonRef:y,titleInputRef:v,titleButtonRef:P,linkInputHandler:w,altButtonHandler:I,altInputHandler:N,titleButtonHandler:X,titleInputHandler:V,linkButtonHandler:F,toggleShowMobileBorderHandler:$,toggleShowMobileBorderRadiusHandler:z,toggleShowMobileBoxShadowHandler:ee,toggleShowMobileSizeHandler:R})=>{const{__:q}=r.useI18n(),{token:re}=(0,t.ui_kit$useToken)(),de=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"})}),de.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:q("Image path"),name:"src",placeholder:q("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!h&&!k&&!p?re.formItemMarginBottomMD+4:re.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:h||q("Alternative text"),placement:"bottom",getPopupContainer:se=>se.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:I,ref:y,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),de.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p||q("Tooltip text"),placement:"bottom",getPopupContainer:se=>se.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:k||q("Hyperlink URL"),placement:"bottom",getPopupContainer:se=>se.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":!!k}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:F,ref:g})})]}),(!!k||!!h||!!p)&&(0,o.jsxs)("div",{style:{marginBottom:re.formItemMarginBottomMD+4},children:[!!k&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:re.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:S,allowClear:!0,placeholder:q("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onChange:w})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:re.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:q("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:N,ref:E})})}),de.formFieldImageTitleEnabled&&!!p&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:re.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:q("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:V,ref:v})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:q("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:q("Width")})}),de.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:q("Height")})})]})}),de.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Borders"),collapsible:!0,open:a,onToggle:$,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),de.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Border radius"),collapsible:!0,open:d,onToggle:z,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:x,elementSettings:i,typeOfForm:"mobile"})}),de.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Box shadow"),collapsible:!0,open:c,onToggle:ee,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),de.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),de.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};$r.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,handleChangeValues:f.default.func,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,hasLink:f.default.string,hasAlt:f.default.string,hasTitle:f.default.string,linkInputRef:f.default.object,linkButtonRef:f.default.object,altInputRef:f.default.object,altButtonRef:f.default.object,titleInputRef:f.default.object,titleButtonRef:f.default.object,linkInputHandler:f.default.func,altButtonHandler:f.default.func,altInputHandler:f.default.func,titleButtonHandler:f.default.func,titleInputHandler:f.default.func,linkButtonHandler:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func};var un=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(un(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 Fr=2e3;function Mr(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<Fr);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<Fr);if(!i)return b.some(h=>h.key===m);const x=s.current.get(d);if(x!==void 0)return x;const k=b.findIndex(h=>h.key===m);return k>=0&&(l.current=b.slice(k)),s.current.set(d,k>=0),k>=0},[i]),forget:(0,n.useCallback)(()=>{l.current=[],s.current=new WeakMap},[])}}var mn=1e3,pn=2e4,Dr="https://useblocks.io/app/",hn=["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 bn(e){const i={...e};return hn.forEach(l=>delete i[l]),Ri(i)}var Vr=({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(),x=r.useSendPostMessage(),k=r.useSendPostMessageEx(),{openImagePicker:h}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),S=r.useSelector(r.selectMobileViewActive),g=r.useCurrentUser(),E=r.useSelector(r.selectIsCodeMode),y=r.useSelector(r.selectCodeModeDirection),[v]=r.useUploadImageMutation(),[P,w]=r.useSendShortLinkMutation(),[I,N]=(0,n.useState)({name:"",counter:0}),X=(0,n.useRef)(null),V=(0,n.useRef)(null),F=(0,n.useRef)(null),$=(0,n.useRef)(null),z=(0,n.useRef)(null),ee=(0,n.useRef)(null),R=(0,n.useRef)(null),q=(0,n.useRef)(null),re=(0,n.useRef)(null),[de,se]=(0,n.useState)({}),[me,xe]=(0,n.useState)(!0),[Ie,ae]=(0,n.useState)(!0),[We,ve]=(0,n.useState)(""),[pe,ge]=(0,n.useState)(""),[le,te]=(0,n.useState)(""),[ce,ue]=(0,n.useState)(!1),[be,K]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(!1),[ne,_e]=(0,n.useState)(!1),[fe,Ae]=(0,n.useState)(!1),[je,Oe]=(0,n.useState)(!1),[Y,oe]=(0,n.useState)(!1),[we,H]=(0,n.useState)(!1),[Re,Pe]=(0,n.useState)("https://"),Ne=(0,n.useRef)(!1),Ve=(0,n.useRef)(),He=e,ze=(0,n.useRef)(He);ze.current=He;const ie=(0,n.useCallback)(()=>l.getFieldsValue(!0).video,[l]),[Be,j]=(0,n.useState)(),[Z,ye]=(0,n.useState)(!1),[Ce,De]=(0,n.useState)(null),[Ye,qe]=(0,n.useState)({start:0,end:0}),[M,O]=(0,n.useState)(!1),[T,D]=(0,n.useState)(!1),[he,$e]=(0,n.useState)(!1),[io,Je]=(0,n.useState)(!1),ro=(0,n.useRef)(void 0),oo=(0,n.useRef)(null),mo=(0,n.useRef)(null),Eo=io||he||we;(0,n.useEffect)(()=>()=>clearTimeout(ro.current),[]);const Te=(0,n.useRef)(null);(0,n.useEffect)(()=>{const A=Te.current,Le=A?.firstElementChild??null;if(!Eo||!A||!Le)return;const ke=[];for(let Qe=A.parentElement;Qe;Qe=Qe.parentElement)getComputedStyle(Qe).overflowY!=="visible"&&ke.push(Qe);let Ee=0,Me="";const Xe=()=>{const Qe=A.getBoundingClientRect(),ho=A.offsetHeight>0?Qe.height/A.offsetHeight:1;let bo=Math.max(Qe.top,0),eo=Math.min(Qe.bottom,window.innerHeight);ke.forEach(qo=>{const bt=qo.getBoundingClientRect();bo=Math.max(bo,bt.top),eo=Math.min(eo,bt.bottom)});const co=(bo-Qe.top)/(ho||1),So=Math.max(eo-bo,0)/(ho||1),wo=`${Math.round(co)}/${Math.round(So)}`;wo!==Me&&(Me=wo,Le.style.top=`${co}px`,Le.style.height=`${So}px`),Ee=requestAnimationFrame(Xe)};return Xe(),()=>cancelAnimationFrame(Ee)},[Eo]);const C=()=>{const A=oo.current;mo.current=A?.isConnected&&typeof A.selectionStart=="number"?{element:A,start:A.selectionStart,end:A.selectionEnd??A.selectionStart}:null},U=E&&y!=="bottom",_=r.useElementEntityKind();(0,n.useEffect)(()=>{Z&&re.current&&re.current.focus()},[Z]);const L=(A,Le)=>{const ke=document.getElementById(Le);if(ke){const Ee=Le.substring(Le.indexOf("selected_image_form_")+20),Me=ke.value?.substring(0,Ye.start),Xe=ke.value?.substring(Ye.end);x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[Ee]:Me+A+Xe}}),l.setFieldValue(Ee,Me+A+Xe),ke.focus(),setTimeout(()=>{ke.selectionStart=Ye.start,ke.selectionEnd=Ye.start+A.length},400),O(!0)}},B=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{B?.items?.length&&j(r.mapMargeTags(B.items))},[B,j]);const J=(A,Le)=>{if(ye(!1),A){const ke=B.syntax.length>1?Be.findIndex(Me=>Me.key===Le[0].key):0,Ee=B.syntax[ke].replace("%value%",A[A.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),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:Ee}}))}},Se=(A,Le)=>Le.some(ke=>ke.label.toLowerCase().indexOf(A.toLowerCase())>-1),Ke=(A,Le)=>{const ke=Le.map((Ee,Me)=>{const Xe=Ee.label.split(new RegExp(`(${A})`,"gi"));return(0,o.jsxs)("span",{children:[Me!==0&&(0,o.jsx)("span",{children:" / "}),Xe.map((Qe,ho)=>Qe.toLowerCase()===A.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Qe},ho):Qe)]},Ee.value)});return(0,o.jsx)("div",{title:Le.map(Ee=>Ee.label).join(" / "),children:ke})},Fe=r.useRootElement();(0,n.useEffect)(()=>{const A=({target:Ee})=>{Ee.closest('[id="merge_tags_wrapper"]')||(oo.current=Ee,De(Ee))},Le=({target:Ee})=>{!Ee.closest(".merge-tags")&&!Ee.closest("#merge_tags_button")&&ye(!1)},ke=new fo.Disposable;return ke.addDisposable(r.addWindowListenerFromShadow(Fe,"focusin",A)),ke.addDisposable(r.addWindowListenerFromShadow(Fe,"click",Le)),()=>{ke.dispose()}},[Fe]);const no=({target:A})=>{if(A&&!M){const{selectionStart:Le,selectionEnd:ke}=A;qe({start:Le,end:ke})}O(!1)},ko=e.border,Xo=e.mobileBorder,Co=Object.keys(ko).find(A=>ko[A]?.width||ko[A]?.style||ko[A]?.color),Bo=Object.keys(Xo).find(A=>Xo[A]?.width||Xo[A]?.style||Xo[A]?.color),ao=A=>A&&(A?.width||A?.style||A?.color)?A:"",{remember:yo,fillFields:Ko}=st(e),{remember:xo,isOwnEcho:Do,forget:It}=Mr(bn,{ordered:!0}),No=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{if(e){const A=e.path;A!==No.current&&(No.current=A,It());const Le=Do(e)?()=>{}:Ko;e.src!==Ve.current&&(Ve.current=e.src,Ne.current=!1);const ke=e.boxShadow;if(se(ke),e.link&&Pe(Ft(e.link,"https://")),Le(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:ao(e.mobileBorder.all)||!(ao(e.mobileBorder.top)||ao(e.mobileBorder.bottom)||ao(e.mobileBorder.right)||ao(e.mobileBorder.left))&&ao(e.border.all),mobileBorderTop:ao(e.mobileBorder.top)||!ao(e.mobileBorder.all)&&ao(e.border.top),mobileBorderBottom:ao(e.mobileBorder.bottom)||!ao(e.mobileBorder.all)&&ao(e.border.bottom),mobileBorderRight:ao(e.mobileBorder.right)||!ao(e.mobileBorder.all)&&ao(e.border.right),mobileBorderLeft:ao(e.mobileBorder.left)||!ao(e.mobileBorder.all)&&ao(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:po(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:po(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 Xe=new URL("https://emailmaker.ru/?"+e.countdown),Qe=Xe.searchParams.get("font1"),ho=!1,bo=!1;Qe.endsWith("-b")?(Qe=Qe.substring(0,Qe.length-2),ho=!0):Qe.endsWith("-i")?(Qe=Qe.substring(0,Qe.length-2),bo=!0):Qe.endsWith("-bi")&&(Qe=Qe.substring(0,Qe.length-3),ho=!0,bo=!0);let eo=Xe.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),Le(l,{countdownTime:(0,Lo.default)(new Date(Date.parse(Xe.searchParams.get("time"))+Xe.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:Xe.searchParams.get("frames")||20,countdownTimeZone:Xe.searchParams.get("timezone"),countdownLanguage:Xe.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+Xe.searchParams.get("bg"),countdownTransparency:Xe.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:Qe,countdownNumbersFontSize:Xe.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+Xe.searchParams.get("color1"),countdownLabelsFont:eo,countdownLabelsFontSize:Xe.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+Xe.searchParams.get("color2"),countdownNumbersStrong:ho,countdownNumbersItalic:bo,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))?ae(!1):ae(!0);const Ee=s.isStaleBorderSnapshot(e,!!Co),Me=a.isStaleBorderSnapshot(e,!!Bo);Ee&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Me||Ee&&!Bo)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),ue(Xe=>Co&&!Ee?!0:Xe),K(Xe=>Co&&!Ee||Bo&&!Me?!0:Xe),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),Ae(!!e.boxShadow),Oe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),oe(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?ve(e.link):ve(Ne.current?"...":""),ge(e.alt),te(e.title),D(e.imgReplacer?.length)}},[l,e,Ko,Do,It,He,Co,Bo,s,a]),(0,n.useEffect)(()=>{if(Eo)return;const A=mo.current;mo.current=null,!(!A||!A.element.isConnected||A.element.disabled)&&oo.current===A.element&&(A.element.focus(),A.element.setSelectionRange(A.start,A.end))},[Eo]);const rt=async(A,Le,ke)=>{const Ee={};Ee.user_id=g.id,Ee.folder=A,Le&&(Le=await r.prepareImageForEditorUpload(Le,c),Ee.file=Le),ke&&(Ee.page_url=ke);const Me=await v(Ee);if(Me.error)b.fromError("IMAGE_UPLOAD_ERROR",Le,Me.error,!0);else{const Xe=Fa.extractUploadResult(Me.data);if(Xe.error)return;if(Xe.file_url)return Xe.file_url}},ai=(A,Le)=>new Promise((ke,Ee)=>{const Me=new Image,Xe=new Image;Me.crossOrigin="Anonymous",Xe.crossOrigin="Anonymous";let Qe=Le?2:1;const ho=()=>{clearTimeout(eo),Ee(new Error("video preview images are not loaded"))},bo=()=>{Qe-=1,Qe===0&&(clearTimeout(eo),ke({frame:Me,button:Le?Xe:null}))},eo=setTimeout(ho,pn);Me.onload=bo,Me.onerror=ho,Me.src=A,Le&&(Xe.onload=bo,Xe.onerror=ho,Xe.src=Le)}),ni=(A,Le,ke,Ee)=>{const Me=document.createElement("canvas"),Xe=Me.getContext("2d");if(Me.width=A.width,Me.height=A.height,Xe.clearRect(0,0,Me.width,Me.height),Xe.drawImage(A,0,0,A.width,A.height),!Le)return Me;const Qe=Math.min(Me.width,Me.height);let ho;if(A.height>A.width)ho=.3;else{const bt=A.width/A.height;ho=Math.min(Ee,.3+(bt-1)/(ke-1)*.1)}const bo=Qe*ho,eo=Le.width/Le.height;let co,So;eo>=1?(co=bo,So=bo/eo):(So=bo,co=bo*eo);const wo=(Me.width-co)/2,qo=(Me.height-So)/2;return Xe.drawImage(Le,wo,qo,co,So),Me},Ct=A=>new Promise(Le=>{A.toBlob(ke=>Le(ke?new File([ke],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),Am=async A=>{const Le=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!A||!Le||Le==="none"||he)){C(),$e(!0);try{const{frame:ke,button:Ee}=await ai(A,`${Dr}${Le}.png`),Me=await Ct(ni(ke,Ee,2,.4)),Xe=Me&&await rt(m,Me);if(!Xe)return;x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:ze.current.type,settings:{src:Xe}}),Pt({...ze.current,src:Xe,video:ie()||ze.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{l.setFieldValue("src",Xe)},100)}catch{}finally{$e(!1)}}},Nm=async()=>{const A=ie(),Le=A?.source,ke=A?.playButton;if(!Le)return;const Ee=()=>ie()?.source!==Le;C(),Je(!0);try{const Me=await rt("tmp",null,Le);if(!Me||Ee())return;const{frame:Xe,button:Qe}=await ai(Me,ke&&ke!=="none"?`${Dr}${ke}.png`:null);if(Ee())return;const ho=await Ct(ni(Xe,Qe,2.5,.35)),bo=ho&&await rt(m,ho);bo&&!Ee()&&Br(bo)}catch{}finally{Je(!1)}},Er=A=>{clearTimeout(ro.current),ro.current=setTimeout(()=>{A()},mn)},Lm=()=>{const A=l.getFieldsValue(!0);let Le=new URL("https://cdt3.emcdn.ru/rndt?"+e.countdown),ke=A.countdownNumbersFont;A.countdownNumbersStrong&&A.countdownNumbersItalic?ke+="-bi":A.countdownNumbersStrong?ke+="-b":A.countdownNumbersItalic&&(ke+="-i");let Ee=A.countdownLabelsFont;A.countdownLabelsStrong&&A.countdownLabelsItalic?Ee+="-bi":A.countdownLabelsStrong?Ee+="-b":A.countdownLabelsItalic&&(Ee+="-i"),Le.searchParams.set("time",new Date(A.countdownTime.$d-A.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Le.searchParams.set("bg",A.countdownBackgroundColor.substring(1)||"#FFFFFF"),Le.searchParams.set("tp",!!A.countdownTransparency),Le.searchParams.set("font1",ke),Le.searchParams.set("size1",A.countdownNumbersFontSize*2||12),Le.searchParams.set("color1",A.countdownNumbersColor.substring(1)||"#000000"),Le.searchParams.set("font2",Ee),Le.searchParams.set("size2",A.countdownLabelsFontSize*2||8),Le.searchParams.set("color2",A.countdownLabelsColor.substring(1)||"#959595"),Le.searchParams.set("spacing",Math.round(A.countdownNumbersFontSize*.4)||5),Le.searchParams.set("locale",A.countdownLanguage.replace("_","-")),Le.searchParams.set("timezone",A.countdownTimeZone),Le.searchParams.set("frames",A.countdownDuration),P({link:JSON.stringify({target:Le.href})}),C(),H(!0)},Pt=(0,n.useCallback)(A=>{yo(A),xo(A),d(_==="email"?r.setElementSettings$1(A):r.setElementSettings(A))},[d,_,yo,xo]),Br=(0,n.useCallback)((A,Le)=>{const ke=ze.current,Ee=r.stripEmVersionFromUrlString(ke.src||"")===r.stripEmVersionFromUrlString(A||"");(!Ee||A!==ke.src)&&(x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:ke.type,settings:{src:A}}),Pt({...ke,src:A,...ke.type==="video"?{video:ie()||ke.video}:{},activateSection:null,changeKey:"src"}),l.setFieldValue("src",A)),Le?.mode==="save"&&Ee&&(N(Me=>({name:"src",counter:Me.counter+1})),k(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(A)}))},[l,ie,Pt,x,k]),At=(0,n.useCallback)(async A=>{const Le=e.src||"",ke=r.stripEmVersionFromUrlString(Le),Ee=await h({kind:"img",currentUrl:gt(ke)?"":ke,entryModal:A});Ee?.url&&Br(Ee.url,Ee.meta)},[Br,e.src,h]),Sr=(A,...Le)=>{const ke=l.getFieldsValue(!0),Ee=Object.keys(A)[0];let Me;switch(Ee){case"link":let Xe=et(A[Ee]);Xe!==A[Ee]&&l.setFieldValue("link",Xe),Me={link:Xe};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Me={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"?(Me={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ke.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):ke.borderAll?.width||ke.borderAll?.style||ke.borderAll?.color?(Me={border:{all:null,left:ke.borderAll,right:ke.borderAll,top:ke.borderAll,bottom:ke.borderAll,[W.REVERSE_BORDER_POSITIONS[Ee]]:{...ke[Ee],...A[Ee]}}},l.setFieldsValue({borderAll:null,borderLeft:ke.borderAll,borderRight:ke.borderAll,borderTop:ke.borderAll,borderBottom:ke.borderAll,[Ee]:{...ke[Ee],...A[Ee]}})):(Me={border:{all:null,left:ke.borderLeft,right:ke.borderRight,top:ke.borderTop,bottom:ke.borderBottom,[W.REVERSE_BORDER_POSITIONS[Ee]]:{...ke[Ee],...A[Ee]}}},l.setFieldsValue({border:Me.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ke.mobileBorderPosition==="mobileBorderAll")Me={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ke.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[Ee]+"-"}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const eo=W.MOBILE_REVERSE_BORDER_POSITIONS[Ee],co={...ke[Ee],...A[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;Me={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};Me={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":Me={[Ee]:{value:A[Ee],dim:ke.widthDim}};break;case"widthDim":Me={width:{value:ke.width,dim:A[Ee]}};break;case"height":Me={[Ee]:{value:A[Ee],dim:ke.heightDim}};break;case"heightDim":Me={height:{value:ke.height,dim:A[Ee]}};break;case"borderRadiusAll":Me={borderRadius:{[W.BORDER_RADIUS_POSITION[Ee]]:+A[Ee]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Me={borderRadius:{topLeft:ke.borderRadiusTopLeft,bottomLeft:ke.borderRadiusBottomLeft,topRight:ke.borderRadiusTopRight,bottomRight:ke.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[Ee]]:+A[Ee]}};break;case"mobileWidth":Me={[Ee]:{classNamePrefix:"em-mob-width-",value:A[Ee],dim:ke.mobileWidthDim}};break;case"mobileWidthDim":Me={mobileWidth:{classNamePrefix:"em-mob-width-",value:ke.mobileWidth||100,dim:A[Ee]}};break;case"mobileHeight":Me={[Ee]:{classNamePrefix:"em-mob-height-",value:A[Ee],dim:ke.mobileHeightDim}};break;case"mobileHeightDim":Me={mobileHeight:{classNamePrefix:"em-mob-height-",value:ke.mobileHeight,dim:A[Ee]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Me={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[Ee]]:A[Ee],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[Ee]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Me={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":Me={[Ee]:{classNamePrefix:"em-mob-text_align-",value:A[Ee]}};break;case"mobileVerticalAlign":Me={[Ee]:{classNamePrefix:"em-mob-vertical_align-",value:A[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":Er(Lm);break;case"video":{const eo={...e.video,...ke.video,...A.video},co=eo.source??ke.link;Er(Nm),x({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=A[Ee],ho=e.src,bo=ke.video?.playButton||e.video?.playButton;if(e.type==="video"&&bo&&bo!=="none"&&!he&&Qe&&(!ho||Qe!==ho)){Er(()=>Am(Qe));return}Me=A;break;default:Me=A}Ee!=="borderPosition"&&Ee!=="mobileBorderPosition"&&Ee.indexOf("countdown")===-1&&Ee!=="video"&&(x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Me}),Ee!=="video"&&Ee.indexOf("countdown")===-1&&Ee!=="mobileBorderRadiusAll"&&Ee!=="mobileBorderRadiusTopLeft"&&Ee!=="mobileBorderRadiusTopRight"&&Ee!=="mobileBorderRadiusBottomLeft"&&Ee!=="mobileBorderRadiusBottomRight"&&Pt({...e,...Me,mobileBorderRadius:{...e.mobileBorderRadius,...Me?.mobileBorderRadius},activateSection:null,changeKey:Ee}))};(0,n.useEffect)(()=>{w.isError&&(b.error(w),H(!1))},[w]),(0,n.useEffect)(()=>{if(w.isSuccess&&we){if(w.data.data?.status===400)b.error({title:w.data.code,description:w.data.message});else{let A=new URL(w.data.target),Le={countdown:{link:w.data.link,params:A.search.substring(1)}};x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Le})}H(!1)}},[w,we,e,b,x]);const Om=A=>{A.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(Om),r.useImageControlRequest(e.src,A=>{A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_AI):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&At(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const $m=()=>{const A=l.getFieldsValue(!0);s.markBorderToggled(!ce),setTimeout(()=>{ue(Le=>!Le),ce?(A.borderAll=W.NULL_BORDER,A.borderTop=W.NULL_BORDER,A.borderBottom=W.NULL_BORDER,A.borderRight=W.NULL_BORDER,A.borderLeft=W.NULL_BORDER):A.borderAll={width:1,color:"#E5E5E5",style:"solid"},x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:A.borderAll.color,style:A.borderAll.style,width:A.borderAll.width}}}})})},Fm=()=>{const A=l.getFieldsValue(!0);a.markBorderToggled(!be),setTimeout(()=>{K(Le=>!Le),be?(A.mobileBorderAll=W.NULL_BORDER,A.mobileBorderTop=W.NULL_BORDER,A.mobileBorderBottom=W.NULL_BORDER,A.mobileBorderRight=W.NULL_BORDER,A.mobileBorderLeft=W.NULL_BORDER):A.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:A.mobileBorderAll.color,style:A.mobileBorderAll.style,width:A.mobileBorderAll.width}}}})})},Mm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{Q(Le=>!Le),G?(A.borderRadiusAll=0,xe(!0)):A.borderRadiusAll=5,x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:A.borderRadiusAll}}})})},Dm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{_e(Le=>!Le),ne?(A.mobileBorderRadiusAll=null,ae(!0)):A.mobileBorderRadiusAll=5,x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:A.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Vm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{Ae(Le=>!Le),fe?(A.boxShadowInset=!1,A.boxShadowHOffset=null,A.boxShadowVOffset=null,A.boxShadowBlurRadius=null,A.boxShadowSpreadRadius=null,A.boxShadowColor=""):(A.boxShadowInset=!1,A.boxShadowHOffset=5,A.boxShadowVOffset=5,A.boxShadowBlurRadius=10,A.boxShadowSpreadRadius=-5,A.boxShadowColor="#000000"),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:A.boxShadowBlurRadius,color:A.boxShadowColor,hOffset:A.boxShadowHOffset,inset:A.boxShadowInset,spreadRadius:A.boxShadowSpreadRadius,vOffset:A.boxShadowVOffset}}})})},Hm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{Oe(Le=>!Le),je?(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=null,A.mobileBoxShadowVOffset=null,A.mobileBoxShadowBlurRadius=null,A.mobileBoxShadowSpreadRadius=null,A.mobileBoxShadowColor=""):(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=5,A.mobileBoxShadowVOffset=5,A.mobileBoxShadowBlurRadius=10,A.mobileBoxShadowSpreadRadius=-5,A.mobileBoxShadowColor="#000000"),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:A.mobileBoxShadowBlurRadius,color:A.mobileBoxShadowColor,hOffset:A.mobileBoxShadowHOffset,inset:A.mobileBoxShadowInset,spreadRadius:A.mobileBoxShadowSpreadRadius,vOffset:A.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Um=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{oe(Le=>!Le),Y&&(A.mobileWidth="",A.mobileHeight="",x({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-"}}}))})},Pa=()=>{We?(Ne.current=!1,ve(""),l.setFieldValue("link",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Ne.current=!0,ve(X.current&&X.current.input.value?X.current.input.value:"..."),setTimeout(()=>{X.current.focus()}))},Aa=A=>{A.target.value===""?ve("..."):(V.current.classList.add("selected-td-form__button--active"),ve(A.target.value)),Ho(A.target.value,Pe)},Na=()=>{const A=l.getFieldsValue(!0);pe?(ge(""),A.alt="",x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(ge(F.current&&F.current.input.value?F.current.input.value:"..."),setTimeout(()=>{F.current.focus()}))},La=A=>{A.target.value===""?ge("..."):($.current.classList.add("selected-td-form__button--active"),ge(A.target.value))},Oa=()=>{const A=l.getFieldsValue(!0);le?(te(""),A.title="",x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(te(z.current&&z.current.input.value?z.current.input.value:"..."),setTimeout(()=>{z.current.focus()}))},Wm=()=>{D(!T),T?(l.setFieldValue("imgReplacer",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>R.current.focus())},zm=A=>{A.target.value!==""&&q.current.classList.add("selected-td-form__button--active")},$a=A=>{A.target.value===""?te("..."):(ee.current.classList.add("selected-td-form__button--active"),te(A.target.value))},Gm=A=>{l.setFieldValue("link",A!=="mergetag"?A:""),Pe(A)};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[Co]||"borderAll",mobileBorderPosition:W.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:Sr,autoComplete:"off",disabled:Eo,className:Eo?"element-controls selected-image-form_busy":"element-controls",children:[Eo&&(0,o.jsx)("div",{className:"selected-image-form__loader",ref:Te,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…")})]})}),!U&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),p==="mobile"&&S.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)($r,{form:l,elementSettings:e,handleChangeValues:Sr,boxShadow:de,mobileBordersShow:be,mobileBorderRadiusShow:ne,mobileBoxShadowShow:je,mobileSizeShow:Y,oneMobileBorderRadiusValue:Ie,setOneMobileBorderRadiusValue:ae,hasLink:We,hasAlt:pe,hasTitle:le,linkInputRef:X,linkButtonRef:V,altInputRef:F,altButtonRef:$,titleInputRef:z,titleButtonRef:ee,linkInputHandler:Aa,altButtonHandler:Na,altInputHandler:La,titleButtonHandler:Oa,titleInputHandler:$a,linkButtonHandler:Pa,toggleShowMobileBorderHandler:Fm,toggleShowMobileBorderRadiusHandler:Dm,toggleShowMobileBoxShadowHandler:Hm,toggleShowMobileSizeHandler:Um})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Or,{form:l,elementSettings:e,boxShadow:de,bordersShow:ce,borderRadiusShow:G,boxShadowShow:fe,oneBorderRadiusValue:me,setOneBorderRadiusValue:xe,hasLink:We,hasAlt:pe,hasTitle:le,isOpenSrcReplacer:T,mergeTagItems:Be,mergeMenuOpen:Z,setMergeMenuOpen:ye,cascaderRef:re,linkInputRef:X,linkButtonRef:V,altInputRef:F,altButtonRef:$,titleInputRef:z,titleButtonRef:ee,srcReplacerInputRef:R,srcReplacerButtonRef:q,linkProtocol:Re,handleLinkProtocolsChange:Gm,linkButtonHandler:Pa,linkInputHandler:Aa,altButtonHandler:Na,altInputHandler:La,titleButtonHandler:Oa,titleInputHandler:$a,srcReplacerButtonHandler:Wm,srcInputHandler:zm,handleSelect:no,onChange:J,filter:Se,renderSearchOption:Ke,handleChangeValues:Sr,toggleShowBorderHandler:$m,toggleShowBorderRadiusHandler:Mm,toggleShowBoxShadowHandler:Vm})})]})};Vr.propTypes={elementSettings:f.default.object.isRequired};var Hr=()=>{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(),[x,k]=(0,n.useState)(null);(0,n.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&k(!0)},[]);const h=v=>{a(v),e.setFieldsValue({[s]:v}),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[s]:v}})},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,g=d?x?p:S:void 0,E=i[s],y=typeof E=="string"?E:"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:s,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{value:y,onChange:h,disabled:l&&!i.parent,strokeWidth:b?.iconStrokeWidth,labels:g})})},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),x=r.useSendPostMessage(),[k,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)(()=>{k!==b&&h(b)},[b,k,l]);const p=()=>{const S={[l]:!k};e.setFieldValue(l,!k),x({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(g=>!g)};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":k&&!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":k&&!c}),onClick:p,children:s})})};Ze.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string,imgParent:f.default.bool};var fn=["email","block"];function gn(e){const i=r.getMessageService(e).getTarget(),l=r.getCanvasService(e);fn.map(s=>l?.peek(s)?.element).find(s=>!!i&&s?.contentWindow===i)?.focus({preventScroll:!0})}var Ur=()=>{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")}]},_n=(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:x=()=>{},showTopDivider:k=!0})=>{const{__:h}=r.useI18n(),p=W.useGoogleFontsLoader(),{token:S}=(0,t.ui_kit$useToken)(),g=r.useNotification(),E=r.useSendPostMessage(),y=r.useContainer(),v=r.useAppConfig(),P=(0,n.useRef)(),w=(0,n.useRef)(null),I=(0,n.useRef)(null),N=(0,n.useRef)(null),X=(0,n.useRef)(!1),V=l,[F,$]=(0,n.useState)(!!V.textReplacer?.length),[z,ee]=(0,n.useState)(!!V.textAnchor?.length),[R,q]=(0,n.useState)(null),[re,de]=(0,n.useState)({start:0,end:0}),[se,me]=(0,n.useState)(!1),[xe,Ie]=(0,n.useState)([]),[ae,We]=(0,n.useState)(V.list?.bulletsColor),[ve,pe]=(0,n.useState)(l);l!==ve&&(pe(l),We(V.list?.bulletsColor),$(!!V.textReplacer?.length),ee(!!V.textAnchor?.length));const[ge,le]=(0,n.useState)(!1),[te,ce]=(0,n.useState)(!1),ue=(0,n.useRef)(null),be=(0,n.useRef)(""),K=Ur(),G=(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 ne=null;(0,n.useEffect)(()=>{if(Q?.textColor&&b){const O=e.getFieldValue("textColor");E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{ColorBullets:O}})}},[Q?.textColor]),(0,n.useEffect)(()=>{const O=e.getFieldValue("textLink");typeof l.linkHref=="string"&&le(!0),ue&&!O&&(le(!1),e.setFieldsValue({linkHref:null})),ue.current=O||null},[Q?.textLink,Q?.linkHref,l.linkHref,e]),(0,n.useEffect)(()=>{const O=e.getFieldValue("listUL"),T=e.getFieldValue("listOL");O&&be.current!=="listUL"?(e.setFieldValue("listOL",!1),be.current="listUL"):T&&be.current!=="listOL"&&(e.setFieldValue("listUL",!1),be.current="listOL"),!O&&!T&&(be.current="")},[Q?.listUL,Q?.listOL,e]);const _e=O=>{O.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&q(null)};r.useListenPostMessage(_e);const[fe,Ae]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Ae(!0)},[]);const je=(0,n.useRef)(null);function Oe(O){const T=O.key.toLowerCase();let D=!1;return((ne==="control"||ne==="meta")&&(T==="a"||T==="A")||(ne==="a"||ne==="A")&&(T==="control"||T==="meta"))&&(D=!0),ne=T,T!=="control"&&T!=="a"&&T!=="A"&&T!=="meta"&&(ne=null),D}const Y=O=>{E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:O,locale:"ru_RU"}),g.success({title:h("It`s done!")})},oe=[{key:"1",label:h("This element"),onClick:()=>Y("typograf")},{key:"2",label:h("The whole email"),onClick:()=>Y("typograf_all")}],[we,H]=(0,n.useState)(),[Re,Pe]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const O=_n(G,ae,{});Ie(O)},[G,ae]),(0,n.useEffect)(()=>{const O=l.linkHref||l.href;O&&Ho(O,c);const T=l.linkHref||l.href,D=T&&Bi(T)?T.slice(1):T||"https://";(i??((he,$e)=>he.setFieldsValue($e)))(e,{linkHref:D})},[e,l,c,i]);const Ne=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Ne?.items?.length&&H(r.mapMargeTags(Ne.items))},[Ne,H]);const Ve=O=>{e.setFieldValue("linkHref",O!=="mergetag"?O:""),c(O)},He=(O,T)=>{if(Pe(!1),O){const D=Ne.syntax.length>1?we.findIndex($e=>$e.key===T[0].key):0,he=Ne.syntax[D].replace("%value%",O[O.length-1]);if(R?.getAttribute("id")==="selected_button_form_href"||R?.getAttribute("id")==="selected_text_form_linkHref"||R?.getAttribute("id")==="selected_text_form_textReplacer")ye(he,R?.getAttribute("id"));else{e.setFieldValue("textReplacer",he);const $e=Date.now();E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${he}~~${$e}`}}),y&&setTimeout(()=>gn(y))}}},ze=(O,T)=>T.some(D=>D.label.toLowerCase().indexOf(O.toLowerCase())>-1),ie=(O,T)=>{const D=T.map((he,$e)=>{const io=he.label.split(new RegExp(`(${O})`,"gi"));return(0,o.jsxs)("span",{children:[$e!==0&&(0,o.jsx)("span",{children:" / "}),io.map((Je,ro)=>Je.toLowerCase()===O.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Je},ro):Je)]},he.value)});return(0,o.jsx)("div",{title:T.map(he=>he.label).join(" / "),children:D})};(0,n.useEffect)(()=>{Re&&je.current&&je.current.focus()},[Re]);const Be=r.useRootElement();(0,n.useEffect)(()=>{const O=({target:he})=>{he.closest('[id="merge_tags_wrapper"]')||q(he)},T=({target:he})=>{!he.closest(".merge-tags")&&!he.closest("#merge_tags_button")&&Pe(!1)},D=new fo.Disposable;return D.addDisposable(r.addWindowListenerFromShadow(Be,"focusin",O)),D.addDisposable(r.addWindowListenerFromShadow(Be,"click",T)),()=>{D.dispose()}},[Be]);const j=(0,n.useCallback)(()=>{const O=window.getSelection();O&&O.toString().length>0&&(X.current=!0)},[]),Z=(0,n.useCallback)(({target:O})=>{if(O&&!se){const{selectionStart:T,selectionEnd:D}=O;de(he=>he?.start===T&&he?.end===D?he:{start:T,end:D})}me(!1)},[se]);(0,n.useEffect)(()=>Z({target:m?.target}),[m,Z]);const ye=(O,T)=>{const D=document.getElementById(T);if(D){const he=D.value?.substring(0,re.start),$e=D.value?.substring(re.end),io=T.substring(T.lastIndexOf("_")+1);E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[io]:he+O+$e}}),e.setFieldValue(io,he+O+$e),D.focus(),setTimeout(()=>{D.selectionStart=re.start,D.selectionEnd=re.start+O.length},400),me(!0)}},Ce=()=>{$(!F),F?(e.setFieldValue("textReplacer",""),E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:""}})):setTimeout(()=>w.current.focus())},De=O=>{O.target.value!==""&&I.current?.classList.add("selected-td-form__button--active")},Ye=(O="unknown")=>{ee(!z),z?(e.setFieldValue("textAnchor",""),E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textAnchor:""}})):setTimeout(()=>N.current?.focus())},qe=O=>{const T=O.target,D=T.value,he=T.selectionStart,$e=Oe(O);if(X.current&&he===0&&E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${D}~`}}),X.current=$e,he===0&&O.key===" "){O.preventDefault();return}if(O.key===" "){if(he!==D.length){O.preventDefault();return}D.endsWith(" ")&&O.preventDefault()}},M=O=>{We(O),b&&x(!1)};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"})})})}),v.formTextFieldTypografEnabled&&!a||v.mergeTagsShow&&we?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:k,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[v.formTextFieldTypografEnabled&&!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:12,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")})})}),(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:oe},trigger:["hover"],placement:"bottom",getPopupContainer:O=>O.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")})})})})]}),v.mergeTagsShow&&we&&(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:Re?"none":"inline-flex"},onClick:()=>Pe(!0),children:h("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:je,classNames:{popup:{root:"merge-tags"}},options:we,placeholder:h("Start typing the title"),showSearch:{filter:ze,render:ie},spellCheck:"false",getPopupContainer:O=>O.closest(".email-pane__collapse-wrapper"),onChange:He,style:{display:Re?"block":"none",width:"100%"},open:Re,onKeyDown:O=>{O.key==="Escape"&&Pe(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:k||v.formTextFieldTypografEnabled&&!a,bodyStyle:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text font"),placement:"bottom",zIndex:1,getPopupContainer:O=>O.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:O=>O.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:O=>O.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:Z})}),!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:Z})}),(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:Z})}),l?.list?.isList&&v.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:O=>O.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:I})})}),(!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:O=>O.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":te||z}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>ce(!te)})})})]})]}),!a&&te&&(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})})]}),v.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:O=>O.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:I})})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Anchor"),placement:"bottom",getPopupContainer:O=>O.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":z}),icon:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:O=>{O.preventDefault(),Ye("mouseDown")}})})})]}),s&&typeof l.linkHref=="string"&&ge&&(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:Ve,__:h}),allowClear:!0,placeholder:h(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:l?.isNewLink,onSelect:Z,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:Z})}),(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:Z})})]})]}),s&&z&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Anchor name"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textAnchor",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("Anchor name"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:h("Anchor"),"aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:N,onSelect:Z,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||ee(!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:qe,onDoubleClick:j,ref:w,onSelect:Z})})})]})}),!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:O=>O.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:O=>O.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:O=>O.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:O=>O.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:O=>O.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:O=>O.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=W.useGoogleFontsLoader(),c=r.useSendPostMessage(),m=r.useDispatch(),b=r.useElementEntityKind(),x=r.useAppConfig(),[k,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,g]=(0,n.useState)(i.textAlign),[E,y]=(0,n.useState)(i.linkHref),v=P=>g(P);return(0,n.useEffect)(()=>{g(i.textAlign),y(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(k?"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(k?"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(k?"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(k?"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 E=="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:v}),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:x.iconStrokeWidth}):S==="center"?(0,o.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:t.icons$AlignCenterOutlined,size:18,strokeWidth:x.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:t.icons$AlignLeftOutlined,size:18,strokeWidth:x.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&&(0,o.jsxs)(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:x.iconStrokeWidth}),onClick:()=>p("add_img"),className:"selected-td-form__button"})}),(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:f.default.object.isRequired,imgParent:f.default.bool,name:f.default.string};var xn=({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),x=m&&b!=="bottom",[k,h]=(0,n.useState)("https://"),[p,S]=(0,n.useState)(!1),g=Ur(),E=(0,n.useMemo)(()=>g,[]),y=r.useElementEntityKind(),{remember:v,fillFields:P}=st(e),w=(0,n.useCallback)(N=>{v(N),l(y==="email"?r.setElementSettings$1(N):r.setElementSettings(N))},[l,y,v]);(0,n.useEffect)(()=>{if(e){const{subject:N,body:X,baseEmail:V}=Ar(e.linkHref),F=e.linkHref,$=typeof F=="string"&&Bi(F),z=typeof F=="string"&&F.startsWith("mailto:")?V:$?F.slice(1):typeof F=="string"?F:"https://";h(Ft(F||"","https://")),P(a,{...e,lineHeight:u(e.lineHeight),linkHref:z,subject:N,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:Nr(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:E.find(ee=>ee.symbol===e?.list?.bulletType)?.code??E[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[a,e]);const I=N=>{const X=a.getFieldsValue(!0),V=Object.keys(N)[0];let F;switch(V){case"mobileFontSize":F={[V]:{classNamePrefix:"em-mob-font_size-",value:N[V],dim:X.mobileFontSizeDim}};break;case"mobileLineHeight":F={[V]:{classNamePrefix:"em-mob-line_height-",value:N[V],dim:X.mobileLineHeightDim}};break;case"mobileTextAlign":F={[V]:{classNamePrefix:"em-mob-text_align-",value:N[V]}};break;case"linkHref":let $=et(N[V]);if($!==N[V]&&a.setFieldValue("linkHref",$),k==="#"&&$&&!$.startsWith("#")&&($="#"+$),$.startsWith("mailto:")){const ee=a.getFieldValue("subject"),R=a.getFieldValue("body");F={[V]:Si($,ee,R)}}else F={[V]:$};Ho($,h);break;case"subject":case"body":const z=a.getFieldValue("linkHref")||"";if(z.substring(0,7)==="mailto:"){const ee=z.split("?")[0],R=V==="subject"?N[V]:a.getFieldValue("subject"),q=V==="body"?N[V]:a.getFieldValue("body"),re=[];R&&re.push(`subject=${encodeURIComponent(R)}`),q&&re.push(`body=${encodeURIComponent(q)}`),F={linkHref:re.length>0?`${ee}?${re.join("&")}`:ee}}else return;break;default:F=N}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:F}),w({...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:E.find($=>$.code===a.getFieldValue("BulletType"))?.symbol??E[0].symbol},...F,activateSection:null,changeKey:V})};return(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:I,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:[!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"})}),!(d==="mobile"&&!x&&c.styles)&&(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:x?(0,o.jsx)(yi,{form:a,elementSettings:e}):(0,o.jsx)(_t,{form:a,fillFields:P,elementSettings:e,linkProtocol:k,setLinkProtocol:h,isBulletFontColorChecked:p,setIsBulletFontColorChecked:S})}),!x&&(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:k,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)(Hr,{})}),(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")},Wr={marginBottom:10},zr={position:"relative",top:2};function kn(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=kn(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:Wr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-rounding",label:s("Rounded corners in Outlook (VML)"),size:"small",labelStyle:zr})})},"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:Wr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-background",label:s("Background image in Outlook (VML)"),size:"small",labelStyle:zr})})},"outlookBackground")]})};it.propTypes={form:f.default.object,showRounding:f.default.bool,showBackground:f.default.bool};var Gr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:b,backgroundSizeOptions:x,sizeShow:k,modificationShow:h,oneBorderRadiusValue:p,setOneBorderRadiusValue:S,toggleShowBorderHandler:g,toggleShowBorderRadiusHandler:E,toggleShowBoxShadowHandler:y,toggleShowSizeHandler:v,toggleShowBackgroundHandler:P,toggleShowModificationHandler:w})=>{const{__:I}=r.useI18n(),N=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:I("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:I("Size"),collapsible:!0,open:k,onToggle:v,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:I("Width"),height:I("Height"),minWidth:I("Minimum width"),maxWidth:I("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:I("Background"),collapsible:!0,open:c,onToggle:P,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:N.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:m,usedColors:i.usedColors,colorPlaceholder:I("Background color"),horizontalPositionPlaceholder:I("Horizontal position"),horizontalPositionTooltip:I("Horizontal position"),verticalPositionPlaceholder:I("Vertical position"),verticalPositionTooltip:I("Vertical position"),backgroundRepeatTooltip:I("Background image repeat"),backgroundSizeTooltip:I("Background image size"),selectPlaceholder:I("Please choose"),backgroundRepeatOptions:b,backgroundSizeOptions:x,imageUploadSlot:N.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Ao,{form:e,label:I("Background image"),name:"backgroundImage",tooltipTitle:I("Background image"),placeholder:I("Background image link/route")}):void 0}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),N.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Borders"),collapsible:!0,open:s,onToggle:g,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),N.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Border radius"),collapsible:!0,open:a,onToggle:E,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:S,elementSettings:i})}),N.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Box shadow"),collapsible:!0,open:d,onToggle:y,dividerTop:!0,children:(0,o.jsx)(jo,{})}),N.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Export settings"),collapsible:!0,open:h,onToggle:w,dividerTop:!0,children:(0,o.jsx)(wi,{form:e,elementSettings:i})}),N.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),N.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Gr.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,backgroundSizeOptions:f.default.array,sizeShow:f.default.bool,modificationShow:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func};var Yr=({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=k=>{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"}}})},x=k=>{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:x,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})]})})};Yr.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.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",En=/^(https?:)?\/\//i,Bn=/^(\d*\.?\d+)(%|px)$/;function Sn(e){return e in ji}function Xr(e){return En.test(e.trim())}function vi(e,i){const l=ji[e],s=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?s&&s!==at&&!Xr(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||!Sn(i)?null:vi(i,e[i])}function Tn(){return Object.keys(ji).reduce((e,i)=>({...e,...vi(i,"")}),{})}function Kr(e){const i=(e??"").trim(),l=i.match(Bn);return l?{position:l[1],unit:l[2]}:{position:i,unit:"px"}}function qr(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 Rn(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:Tn()})}var yn=/^\d*\.?\d+$/,wn={bottom:"auto"},Jr={marginBottom:0},jn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),vn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),In=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,Qr=({value:e,onChange:i,inheritedValue:l,options:s,placeholder:a,prefix:d})=>{const c=e||l,[m,b]=(0,n.useState)(()=>Kr(c));(0,n.useEffect)(()=>{b(p=>qr(p.position,p.unit)===c?p:Kr(c))},[c]);const x=(0,n.useCallback)((p,S)=>{b({position:p,unit:S});const g=s.some(E=>E.value===p);(p===""||g||yn.test(p))&&i?.(qr(p,S))},[i,s]),k=(0,n.useCallback)(p=>x(p,m.unit),[x,m.unit]),h=(0,n.useCallback)(p=>x(m.position,p),[x,m.position]);return(0,o.jsx)(t.ui_kit$InputSelect,{options:s,position:m.position,setPosition:k,unit:m.unit,setUnit:h,placeholder:a,prefix:d,dropdownStyle:wn,tooltipTitle:a,getTooltipPopupContainer:In})},Cn=({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:Jr,children:(0,o.jsx)(Qr,{inheritedValue:e,options:Dt.horizontal,placeholder:l("Horizontal position"),prefix:jn})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:Jr,children:(0,o.jsx)(Qr,{inheritedValue:i,options:Dt.vertical,placeholder:l("Vertical position"),prefix:vn})})})]})},Zr=["hover"],el=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,ol=({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})},Pn=({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,x=(0,n.useMemo)(()=>({marginBottom:b}),[b]),k=(0,n.useMemo)(()=>({marginBottom:(b??0)*1.5}),[b]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Cn,{desktopPositionX:e,desktopPositionY:i}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:k,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Zr,title:c("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:x,children:(0,o.jsx)(ol,{emptyValue:"none",inheritedValue:l,options:a,placeholder:c("Please choose"),getPopupContainer:el})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Zr,title:c("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:x,children:(0,o.jsx)(ol,{emptyValue:"",inheritedValue:s,options:d,placeholder:c("Please choose"),getPopupContainer:el})})})})]})]})},An=ci,Nn=({value:e,inheritedImage:i,...l})=>(0,o.jsx)(An,{...l,value:e||i}),Ln=e=>/^https?:\/\//i.test(e.trim()),On=({form:e,name:i="mobileBackgroundImage",placeholder:l="",disabled:s=!1,elementSettings:a,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:m})=>{const{__:b}=r.useI18n(),{token:x}=(0,t.ui_kit$useToken)(),k=t.ui_kit$Form.useWatch(i,e),[h,p]=(0,n.useState)(""),S=k||d,g=x.formItemMarginBottomXS??0,E=(0,n.useMemo)(()=>({marginBottom:g/2}),[g]);(0,n.useEffect)(()=>{if(!S){p("");return}p(Ln(S)?"validating":"success")},[S]);const y=!!k&&!Xr(k),v=y?"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:v,help:y?b("Enter a URL starting with http:// or https://"):void 0,style:E,children:(0,o.jsx)(Nn,{inheritedImage:d,validateStatus:v,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})]})},$n={image:"",positionX:"",positionY:"",repeat:"",size:""},St=({elementSettings:e,imageEnabled:i=!1,desktopBackground:l=$n})=>{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,[x,k]=(0,n.useState)(b==="none"),h=t.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,n.useEffect)(()=>{k(b==="none")},[b]),(0,n.useEffect)(()=>{h&&k(!1)},[h]);const p=(0,n.useCallback)(I=>{k(I),d.setFieldsValue({mobileBackgroundImage:""}),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:vi("mobileBackgroundImage",I?"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]),g=(0,n.useMemo)(()=>[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],[s]),E=Rn(x?"none":h,l.image),y=(0,n.useMemo)(()=>({marginBottom:E?c:0}),[c,E]),v=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:y,children:(0,o.jsx)(Yr,{form:d,elementSettings:e,label:s("Background color")})}),[s,e,d,y]),P=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:y,children:(0,o.jsx)(On,{form:d,placeholder:s("Background image"),elementSettings:e,inheritedImage:x?"":l.image,isImageNone:x,onImageNoneChange:p})}),[s,l.image,e,d,p,x,y]),w=(0,n.useMemo)(()=>(0,o.jsx)(Pn,{desktopPositionX:l.positionX,desktopPositionY:l.positionY,desktopRepeat:l.repeat,desktopSize:l.size,backgroundRepeatOptions:S,backgroundSizeOptions:g}),[S,g,l.positionX,l.positionY,l.repeat,l.size]);return(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:v,imageEnabled:i,backgroundImageEmpty:!E,imageUploadSlot:P,imageControlsSlot:w,usedColors:e.usedColors})},tl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:k,toggleShowMobileBorderRadiusHandler:h,toggleShowMobileBoxShadowHandler:p,toggleShowMobileSizeHandler:S,toggleShowMobileBackgroundHandler:g})=>{const{__:E}=r.useI18n(),{token:y}=(0,t.ui_kit$useToken)(),v=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:E("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:E("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$FormSection,{title:E("Background"),collapsible:!0,open:m,onToggle:g,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:Wo(i),imageEnabled:v.formTableFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),v.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Borders"),collapsible:!0,open:s,onToggle:k,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),v.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Border radius"),collapsible:!0,open:a,onToggle:h,dividerTop:!0,children:(0,o.jsx)(To,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:b,setOneBorderRadiusValue:x,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Box shadow"),collapsible:!0,open:d,onToggle:p,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),v.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),v.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};tl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,mobileBoxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func};var il=({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,x]=(0,n.useState)({}),[k,h]=(0,n.useState)(!0),[p,S]=(0,n.useState)({}),[g,E]=(0,n.useState)(!0),y=r.useSelector(r.selectEmailViewType),v=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[P,w]=(0,n.useState)(e.backgroundImage[0].value===""),I=r.useSelector(r.selectIsCodeMode),N=r.useSelector(r.selectCodeModeDirection),X=I&&N!=="bottom",[V,F]=(0,n.useState)(!1),[$,z]=(0,n.useState)(!1),[ee,R]=(0,n.useState)(!1),[q,re]=(0,n.useState)(!1),[de,se]=(0,n.useState)(!1),[me,xe]=(0,n.useState)(!1),[Ie,ae]=(0,n.useState)(!1),[We,ve]=(0,n.useState)(!1),[pe,ge]=(0,n.useState)(!1),[le,te]=(0,n.useState)(!1),[ce,ue]=(0,n.useState)(!1),be=[{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"}],G=j=>j&&(j?.width||j?.style||j?.color)?j:"",Q=e.border,ne=e.mobileBorder,_e=Object.keys(Q).find(j=>Q[j]?.width||Q[j]?.style||Q[j]?.color),fe=Object.keys(ne).find(j=>ne[j]?.width||ne[j]?.style||ne[j]?.color),{remember:Ae,fillFields:je}=st(e);(0,n.useEffect)(()=>{if(e){const j=e.boxShadow,Z=e.mobileBoxShadow;x(j),S(Z),je(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:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:G(e.mobileBorder.all)||!(G(e.mobileBorder.top)||G(e.mobileBorder.bottom)||G(e.mobileBorder.right)||G(e.mobileBorder.left))&&G(e.border.all),mobileBorderTop:G(e.mobileBorder.top)||!G(e.mobileBorder.all)&&G(e.border.top),mobileBorderBottom:G(e.mobileBorder.bottom)||!G(e.mobileBorder.all)&&G(e.border.bottom),mobileBorderRight:G(e.mobileBorder.right)||!G(e.mobileBorder.all)&&G(e.border.right),mobileBorderLeft:G(e.mobileBorder.left)||!G(e.mobileBorder.all)&&G(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)?E(!1):E(!0),w(e.backgroundImage[0].value==="");const ye=a.isStaleBorderSnapshot(e,!!_e),Ce=d.isStaleBorderSnapshot(e,!!fe);ye&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ce||ye&&!fe)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),F(De=>_e&&!ye?!0:De),z(De=>_e&&!ye||fe&&!Ce?!0:De),R(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),re(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),se(!!e.boxShadow),xe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ae(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),ve(!!e.mobileWidth.value),ge(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),te(Et(e)),ue(!!e.exportAsPicture)}},[s,e,_e,fe,a,d,je]);const Oe=(0,n.useCallback)(j=>{Ae(j),c(m==="email"?r.setElementSettings$1(j):r.setElementSettings(j))},[c,m,Ae]),Y=j=>{const Z=s.getFieldsValue(!0),ye=Object.keys(j)[0];let Ce;switch(ye){case"exportAsPicture":Ce={exportAsPicture:Z.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ce={boxShadow:{hOffset:Z.boxShadowHOffset,vOffset:Z.boxShadowVOffset,blurRadius:Z.boxShadowBlurRadius,spreadRadius:Z.boxShadowSpreadRadius,color:Z.boxShadowColor,inset:Z.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":Z.borderPosition==="borderAll"?(Ce={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Z.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):Z.borderAll?.width||Z.borderAll?.style||Z.borderAll?.color?(Ce={border:{all:null,left:Z.borderAll,right:Z.borderAll,top:Z.borderAll,bottom:Z.borderAll,[W.REVERSE_BORDER_POSITIONS[ye]]:{...Z[ye],...j[ye]}}},s.setFieldsValue({borderAll:null,borderLeft:Z.borderAll,borderRight:Z.borderAll,borderTop:Z.borderAll,borderBottom:Z.borderAll,[ye]:{...Z[ye],...j[ye]}})):(Ce={border:{all:null,left:Z.borderLeft,right:Z.borderRight,top:Z.borderTop,bottom:Z.borderBottom,[W.REVERSE_BORDER_POSITIONS[ye]]:{...Z[ye],...j[ye]}}},s.setFieldsValue({border:Ce.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(Z.mobileBorderPosition==="mobileBorderAll")Ce={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Z.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[ye]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const De=W.MOBILE_REVERSE_BORDER_POSITIONS[ye],Ye={...Z[ye],...j[ye]},qe=!Ye?.width&&!Ye?.style&&!Ye?.color;if(Z.mobileBorder?.all?.width||Z.mobileBorder?.all?.style||Z.mobileBorder?.all?.color){const M=Z.mobileBorderAll;Ce={mobileBorder:{all:null,left:M,right:M,top:M,bottom:M,[De]:qe?null:{...Ye,classNamePrefix:"em-mob-border_"+De+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:M,mobileBorderRight:M,mobileBorderTop:M,mobileBorderBottom:M,[ye]:Ye})}else{const M=e.mobileBorder||{},O=T=>{const D=M[T];return D&&(D?.width||D?.style||D?.color)?D:null};Ce={mobileBorder:{all:null,left:De==="left"?qe?null:{...Ye,classNamePrefix:"em-mob-border_left-"}:O("left"),right:De==="right"?qe?null:{...Ye,classNamePrefix:"em-mob-border_right-"}:O("right"),top:De==="top"?qe?null:{...Ye,classNamePrefix:"em-mob-border_top-"}:O("top"),bottom:De==="bottom"?qe?null:{...Ye,classNamePrefix:"em-mob-border_bottom-"}:O("bottom")}},s.setFieldsValue({[ye]:Ye})}}break;case"width":Ce={[ye]:{value:j[ye],dim:Z.widthDim}};break;case"widthDim":Ce={width:{value:Z.width,dim:j[ye]}};break;case"maxWidth":Ce={[ye]:{value:j[ye],dim:Z.maxWidthDim}};break;case"maxWidthDim":Ce={maxWidth:{value:Z.maxWidth,dim:j[ye]}};break;case"minWidth":Ce={[ye]:{value:j[ye],dim:Z.minWidthDim}};break;case"minWidthDim":Ce={minWidth:{value:Z.minWidth,dim:j[ye]}};break;case"backgroundImage":w(j[ye]===""),Ce={[ye]:[{...e.backgroundImage[0],value:j[ye]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ce={borderRadius:{[W.BORDER_RADIUS_POSITION[ye]]:+j[ye]}};break;case"mobileWidth":Ce={[ye]:{classNamePrefix:"em-mob-width-",value:j[ye],dim:Z.mobileWidthDim}};break;case"mobileWidthDim":Ce={mobileWidth:{classNamePrefix:"em-mob-width-",value:Z.mobileWidth||100,dim:j[ye]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ce={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[ye]]:j[ye],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[ye]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ce={mobileBoxShadow:{hOffset:Z.mobileBoxShadowHOffset,vOffset:Z.mobileBoxShadowVOffset,blurRadius:Z.mobileBoxShadowBlurRadius,spreadRadius:Z.mobileBoxShadowSpreadRadius,color:Z.mobileBoxShadowColor,inset:Z.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ce=xt(j),!Ce)return;break;case"mobileAlign":Ce={[ye]:{classNamePrefix:"em-mob-table_align-",value:j[ye]}};break;default:Ce=j}ye!=="borderPosition"&&ye!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ce}),ye!=="mobileBorderRadiusAll"&&ye!=="mobileBorderRadiusTopLeft"&&ye!=="mobileBorderRadiusTopRight"&&ye!=="mobileBorderRadiusBottomLeft"&&ye!=="mobileBorderRadiusBottomRight"&&Oe({...e,...Ce,mobileBorderRadius:{...e.mobileBorderRadius,...Ce?.mobileBorderRadius},activateSection:null,changeKey:ye}))},oe=()=>{const j=s.getFieldsValue(!0);a.markBorderToggled(!V),setTimeout(()=>{F(Z=>!Z),V?(j.borderAll=W.NULL_BORDER,j.borderTop=W.NULL_BORDER,j.borderBottom=W.NULL_BORDER,j.borderRight=W.NULL_BORDER,j.borderLeft=W.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}}}})})},we=()=>{const j=s.getFieldsValue(!0);d.markBorderToggled(!$),setTimeout(()=>{z(Z=>!Z),$?(j.mobileBorderAll=W.NULL_BORDER,j.mobileBorderTop=W.NULL_BORDER,j.mobileBorderBottom=W.NULL_BORDER,j.mobileBorderRight=W.NULL_BORDER,j.mobileBorderLeft=W.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}}}})})},H=()=>{const j=s.getFieldsValue(!0);setTimeout(()=>{R(Z=>!Z),ee?(j.borderRadiusAll=0,h(!0)):j.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:j.borderRadiusAll}}})})},Re=()=>{const j=s.getFieldsValue(!0);setTimeout(()=>{re(Z=>!Z),q?(j.mobileBorderRadiusAll=null,E(!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-"}}})})},Pe=()=>{const j=s.getFieldsValue(!0);setTimeout(()=>{se(Z=>!Z),de?(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}}})})},Ne=()=>{const j=s.getFieldsValue(!0);setTimeout(()=>{xe(Z=>!Z),me?(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-"}}})})},Ve=()=>{const j=s.getFieldsValue(!0);setTimeout(()=>{ae(Z=>!Z),Ie&&(j.width="",j.minWidth="",j.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 j=s.getFieldsValue(!0);setTimeout(()=>{ve(Z=>!Z),We&&(j.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 j=s.getFieldsValue(!0);setTimeout(()=>{ge(Z=>!Z),pe?(j.backgroundColor="",j.backgroundImage="",j.backgroundPositionX="",j.backgroundPositionY="",j.backgroundRepeat="none",j.backgroundSize="",w(!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}})})},ie=()=>{const j=s.getFieldsValue(!0);setTimeout(()=>{te(Z=>!Z),le?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}}}),le&&Bt(s,e,l)})},Be=()=>{const j=s.getFieldsValue(!0);setTimeout(()=>{ue(Z=>!Z),ce&&(j.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:W.BORDER_POSITIONS[_e]||"borderAll",mobileBorderPosition:W.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"})}),y==="mobile"&&v.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(tl,{form:s,elementSettings:e,mobileBoxShadow:p,mobileBordersShow:$,mobileBorderRadiusShow:q,mobileBoxShadowShow:me,mobileSizeShow:We,mobileBackgroundShow:le,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:E,toggleShowMobileBorderHandler:we,toggleShowMobileBorderRadiusHandler:Re,toggleShowMobileBoxShadowHandler:Ne,toggleShowMobileSizeHandler:He,toggleShowMobileBackgroundHandler:ie})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Gr,{form:s,elementSettings:e,boxShadow:b,bordersShow:V,borderRadiusShow:ee,boxShadowShow:de,backgroundShow:pe,backgroundImageEmpty:P,backgroundRepeatOptions:be,backgroundSizeOptions:K,sizeShow:Ie,modificationShow:ce,oneBorderRadiusValue:k,setOneBorderRadiusValue:h,toggleShowBorderHandler:oe,toggleShowBorderRadiusHandler:H,toggleShowBoxShadowHandler:Pe,toggleShowSizeHandler:Ve,toggleShowBackgroundHandler:ze,toggleShowModificationHandler:Be})})]})};il.propTypes={elementSettings:f.default.object.isRequired};var rl=({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)({}),[x,k]=(0,n.useState)("https://"),h=({target:g})=>{const{selectionStart:E,selectionEnd:y}=g;g&&b({target:g,selection:{start:E,end:y}})};(0,n.useEffect)(()=>{if(e){let g="",E="",y=e.href==null?"https://":e.href;if(y&&y.substring(0,7)==="mailto:"){const v=new URL(e.href);g=v.searchParams.get("subject")||"",E=v.searchParams.get("body")||"",y=e.href.split("?")[0],k("mailto:")}else e.href&&(e.href.substring(0,8)==="https://"||e.href.substring(0,7)==="http://"?k("https://"):e.href.substring(0,4)==="tel:"?k("tel:"):e.href.substring(0,4)==="sms:"?k("sms:"):e.href.substring(0,6)==="ftp://"?k("ftp://"):k(""));s.setFieldsValue({...e,href:y,subject:g,body:E})}},[s,e]);const p=g=>{const E=Object.keys(g)[0];let y=g;if(E==="href"){const v=et(g[E]);if(v!==g[E]&&s.setFieldValue("href",v),v.substring(0,7)==="mailto:"){const P=s.getFieldValue("subject"),w=s.getFieldValue("body"),I=[];P&&I.push(`subject=${encodeURIComponent(P)}`),w&&I.push(`body=${encodeURIComponent(w)}`),y={href:I.length>0?`${v}?${I.join("&")}`:v}}else y={href:v}}if(E==="subject"||E==="body"){const v=s.getFieldValue("href")||"";if(v.substring(0,7)==="mailto:"){const P=v.split("?")[0],w=E==="subject"?g[E]:s.getFieldValue("subject"),I=E==="body"?g[E]:s.getFieldValue("body"),N=[];w&&N.push(`subject=${encodeURIComponent(w)}`),I&&N.push(`body=${encodeURIComponent(I)}`),y={href:N.length>0?`${P}?${N.join("&")}`:P}}else return}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:y})},S=g=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:g})};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:x,setLinkProtocol:k})]}):(0,o.jsx)(yi,{form:s,elementSettings:e,showAddParagraph:!1})})};rl.propTypes={elementSettings:f.default.object.isRequired};var ll=()=>{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"})})})})};ll.propTypes={};var sl=({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})})});sl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var al=({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),x=m&&b!=="bottom",k=r.useElementEntityKind(),{remember:h,fillFields:p}=st(e);(0,n.useEffect)(()=>{e&&p(l,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:po(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[l,e,p]);const S=(0,n.useCallback)(E=>{h(E),s(k==="email"?r.setElementSettings$1(E):r.setElementSettings(E))},[s,k,h]),g=E=>{const y=l.getFieldsValue(!0),v=Object.keys(E)[0];let P;switch(v){case"height":P={[v]:{value:E[v],dim:y.heightDim}};break;case"heightDim":P={height:{value:y.height,dim:E[v]}};break;case"mobileHeight":P={[v]:{classNamePrefix:"em-mob-height-",value:E[v],dim:y.mobileHeightDim}};break;case"mobileHeightDim":P={mobileHeight:{classNamePrefix:"em-mob-height-",value:y.mobileHeight,dim:E[v]}};break;default:P=E}a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:P}),S({...e,...P,activateSection:null,changeKey:v})};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:g,autoComplete:"off",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"})}),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)(sl,{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)(ll,{})})]})};al.propTypes={elementSettings:f.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,x]=(0,n.useState)(""),[k,h]=(0,n.useState)("px"),[p,S]=(0,n.useState)(""),[g,E]=(0,n.useState)("px"),y=[{label:m("Not defined"),value:""},{label:m("Contain"),value:"contain"},{label:m("Cover"),value:"cover"}],v=I=>{if(!I||typeof I!="string")return{value:"",unit:"px"};I=I.trim();const N=I.match(/^(\d*\.?\d+)(%|px)$/);return N?{value:N[1],unit:N[2]}:{value:I,unit:"px"}};(0,n.useEffect)(()=>{const I=e.getFieldValue("backgroundPositionX"),N=e.getFieldValue("backgroundPositionY"),X=v(I),V=v(N);x(String(X.value)),h(X.unit),S(String(V.value)),E(V.unit)},[e]);const P=(I,N)=>{x(String(I)),h(N),c&&c({backgroundPositionX:{position:I,unit:N}})},w=(I,N)=>{S(String(I)),E(N),c&&c({backgroundPositionY:{position:I,unit:N}})};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:I=>P(I,k),unit:k,setUnit:I=>P(b,I),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:I=>w(I,g),unit:g,setUnit:I=>w(p,I),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:y,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},Fn=({form:e,elementSettings:i,__:l,appConfig:s})=>{const a=W.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})})})})]})]})},nl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:b,sizeShow:x,maxWidthValue:k,modificationShow:h,paddingsExt:p,oneBorderRadiusValue:S,setOneBorderRadiusValue:g,elementListShow:E,togglePaddingHandler:y,toggleShowBorderHandler:v,toggleShowBorderRadiusHandler:P,toggleShowBoxShadowHandler:w,toggleShowSizeHandler:I,toggleShowBackgroundHandler:N,toggleShowModificationHandler:X,handleChangeValues:V})=>{const{__:F}=r.useI18n(),{token:$}=(0,t.ui_kit$useToken)(),z=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{form:e,elementSettings:i})}),z.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Fo,{form:e,elementSettings:i})})]}),z.formCellFieldPaddingsEnabled&&(0,o.jsxs)(o.Fragment,{children:[E&&(0,o.jsx)("div",{style:{marginTop:"15px"},children:(0,o.jsx)(Fn,{form:e,elementSettings:i,appConfig:z,__:F})}),(0,o.jsx)(t.ui_kit$FormSection,{title:F("Padding"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:p,onToggleExtended:y,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"&&z.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:F("Size"),collapsible:!0,open:x,onToggle:I,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:k,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:N,dividerTop:!0,children:[(0,o.jsx)(Ii,{form:e,backgroundImageEmpty:m,appConfig:z,token:$,elementSettings:i,backgroundRepeatOptions:b,handleChangeValues:V}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),z.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:F("Borders"),collapsible:!0,open:s,onToggle:v,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),z.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:g,elementSettings:i})}),z.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:F("Box shadow"),collapsible:!0,open:d,onToggle:w,dividerTop:!0,children:(0,o.jsx)(jo,{})}),z.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})]}),z.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})}),z.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:F("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};nl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,sizeShow:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),modificationShow:f.default.bool,paddingsExt:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,elementListShow:f.default.bool,togglePaddingHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func,handleChangeValues:f.default.func};var Ut=({form:e,elementSettings:i,mobilePaddingsExt:l,setMobilePaddingsExt:s,rowStyle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=()=>{s(x=>!x);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:f.default.shape({getFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,mobilePaddingsExt:f.default.bool.isRequired,setMobilePaddingsExt:f.default.func.isRequired,rowStyle:f.default.object};var dl=({form:e,elementSettings:i,boxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:b,mobilePaddingsExt:x,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:g,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:P})=>{const{__:w}=r.useI18n(),I=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"})}),I.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"})})]}),I.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Padding"),collapsible:!0,open:b,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:i,mobilePaddingsExt:x,setMobilePaddingsExt:k,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&I.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Size"),collapsible:!0,open:c,onToggle:y,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:w("Background"),collapsible:!0,open:m,onToggle:v,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:Wo(i),imageEnabled:I.formCellFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),I.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Borders"),collapsible:!0,open:s,onToggle:S,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),I.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Border radius"),collapsible:!0,open:a,onToggle:g,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementSettings:i,typeOfForm:"mobile"})}),I.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Box shadow"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),I.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:w(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})}),I.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};dl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};var cl=({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)(""),[x,k]=(0,n.useState)({}),[h,p]=(0,n.useState)(!0),[S,g]=(0,n.useState)(!0),E=r.useSelector(r.selectEmailViewType),y=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[v,P]=(0,n.useState)(e.backgroundImage[0].value===""),w=r.useSelector(r.selectIsCodeMode),I=r.useSelector(r.selectCodeModeDirection),N=w&&I!=="bottom",[X,V]=(0,n.useState)(!1),[F,$]=(0,n.useState)(!1),[z,ee]=(0,n.useState)(!1),[R,q]=(0,n.useState)(!1),[re,de]=(0,n.useState)(!1),[se,me]=(0,n.useState)(!1),[xe,Ie]=(0,n.useState)(!1),[ae,We]=(0,n.useState)(!1),[ve,pe]=(0,n.useState)(!1),[ge,le]=(0,n.useState)(!1),[te,ce]=(0,n.useState)(!1),[ue,be]=(0,n.useState)(!1),[K,G]=(0,n.useState)(!1),[Q,ne]=(0,n.useState)(!1),[_e,fe]=(0,n.useState)(!1),Ae=r.useElementEntityKind(),je=[{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"}],Oe=e.border,Y=e.mobileBorder,oe=Object.keys(Oe).find(T=>Oe[T]?.width||Oe[T]?.style||Oe[T]?.color),we=Object.keys(Y).find(T=>Y[T]?.width||Y[T]?.style||Y[T]?.color),H=T=>T&&(T?.width||T?.style||T?.color)?T:"",{remember:Re,fillFields:Pe}=st(e);(0,n.useEffect)(()=>{if(e){const T=e.boxShadow;k(T),Pe(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:H(e.mobileBorder.all)||!(H(e.mobileBorder.top)||H(e.mobileBorder.bottom)||H(e.mobileBorder.right)||H(e.mobileBorder.left))&&H(e.border.all),mobileBorderTop:H(e.mobileBorder.top)||!H(e.mobileBorder.all)&&H(e.border.top),mobileBorderBottom:H(e.mobileBorder.bottom)||!H(e.mobileBorder.all)&&H(e.border.bottom),mobileBorderRight:H(e.mobileBorder.right)||!H(e.mobileBorder.all)&&H(e.border.right),mobileBorderLeft:H(e.mobileBorder.left)||!H(e.mobileBorder.all)&&H(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:po(e.mobileWidth?.value)||po(e.width?.value),mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||po(e.height?.value),mobileHeightDim:po(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))?g(!1):g(!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)?V(!1):V(!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 D=d.isStaleBorderSnapshot(e,!!oe),he=c.isStaleBorderSnapshot(e,!!we);D&&a.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(he||D&&!we)&&a.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),ee($e=>oe&&!D?!0:$e),q($e=>oe&&!D||we&&!he?!0:$e),de(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),me(!!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),Ie(!!e.boxShadow),We(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),pe(!!e.width.value&&e.type!=="column"||!!e.height.value),le(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),ce(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),be(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Et(e)&&be(!0),G(!!e.exportAsPicture||!!e.isContrastBlock),ne(!!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,oe,we,d,c,Pe]);const Ne=(0,n.useCallback)(T=>{Re(T),s(Ae==="email"?r.setElementSettings$1(T):r.setElementSettings(T))},[s,Ae,Re]),Ve=T=>{const D=a.getFieldsValue(!0),he=Object.keys(T)[0];let $e;switch(b(a.getFieldsValue(!0).widthDim==="%"?100:""),he){case"exportAsPicture":$e={exportAsPicture:D.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":$e={boxShadow:{hOffset:D.boxShadowHOffset,vOffset:D.boxShadowVOffset,blurRadius:D.boxShadowBlurRadius,spreadRadius:D.boxShadowSpreadRadius,color:D.boxShadowColor,inset:D.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":D.borderPosition==="borderAll"?($e={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...D.borderAll}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):D.borderAll?.width||D.borderAll?.style||D.borderAll?.color?($e={border:{all:null,left:D.borderAll,right:D.borderAll,top:D.borderAll,bottom:D.borderAll,[W.REVERSE_BORDER_POSITIONS[he]]:{...D[he],...T[he]}}},a.setFieldsValue({borderAll:null,borderLeft:D.borderAll,borderRight:D.borderAll,borderTop:D.borderAll,borderBottom:D.borderAll,[he]:{...D[he],...T[he]}})):($e={border:{all:null,left:D.borderLeft,right:D.borderRight,top:D.borderTop,bottom:D.borderBottom,[W.REVERSE_BORDER_POSITIONS[he]]:{...D[he],...T[he]}}},a.setFieldsValue({border:$e.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(D.mobileBorderPosition==="mobileBorderAll")$e={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...D.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[he]+"-"}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const io=W.MOBILE_REVERSE_BORDER_POSITIONS[he],Je={...D[he],...T[he]},ro=!Je?.width&&!Je?.style&&!Je?.color;if(D.mobileBorder?.all?.width||D.mobileBorder?.all?.style||D.mobileBorder?.all?.color){const oo=D.mobileBorderAll;$e={mobileBorder:{all:null,left:oo,right:oo,top:oo,bottom:oo,[io]:ro?null:{...Je,classNamePrefix:"em-mob-border_"+io+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:oo,mobileBorderRight:oo,mobileBorderTop:oo,mobileBorderBottom:oo,[he]:Je})}else{const oo=e.mobileBorder||{},mo=Eo=>{const Te=oo[Eo];return Te&&(Te?.width||Te?.style||Te?.color)?Te:null};$e={mobileBorder:{all:null,left:io==="left"?ro?null:{...Je,classNamePrefix:"em-mob-border_left-"}:mo("left"),right:io==="right"?ro?null:{...Je,classNamePrefix:"em-mob-border_right-"}:mo("right"),top:io==="top"?ro?null:{...Je,classNamePrefix:"em-mob-border_top-"}:mo("top"),bottom:io==="bottom"?ro?null:{...Je,classNamePrefix:"em-mob-border_bottom-"}:mo("bottom")}},a.setFieldsValue({[he]:Je})}}break;case"width":$e={[he]:{value:T[he],dim:D.widthDim}};break;case"height":$e={[he]:{value:T[he],dim:D.heightDim}};break;case"widthDim":$e={width:{value:D.width,dim:T[he]}};break;case"heightDim":$e={height:{value:D.height,dim:T[he]}};break;case"backgroundImage":P(T[he]===""),$e={[he]:[{...e.backgroundImage[0],value:T[he]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":$e={padding:{left:D.paddingLeft,right:D.paddingRight,top:D.paddingTop,bottom:D.paddingBottom,[W.PADDING_POSITION[he]]:+T[he]}};break;case"paddingTopBottom":$e={padding:{left:D.paddingLeft,right:D.paddingRight,top:+T[he],bottom:+T[he]}},D.paddingTop=D.paddingBottom=+T[he];break;case"paddingLeftRight":$e={padding:{top:D.paddingTop,bottom:D.paddingBottom,left:+T[he],right:+T[he]}},D.paddingLeft=D.paddingRight=+T[he];break;case"borderRadiusAll":$e={borderRadius:{[W.BORDER_RADIUS_POSITION[he]]:+T[he]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":$e={borderRadius:{topLeft:D.borderRadiusTopLeft,bottomLeft:D.borderRadiusBottomLeft,topRight:D.borderRadiusTopRight,bottomRight:D.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[he]]:+T[he]}};break;case"mobileWidth":$e={[he]:{classNamePrefix:"em-mob-width-",value:T[he],dim:D.mobileWidthDim}};break;case"mobileWidthDim":$e={mobileWidth:{classNamePrefix:"em-mob-width-",value:D.mobileWidth||100,dim:T[he]}};break;case"mobileHeight":$e={[he]:{classNamePrefix:"em-mob-height-",value:T[he],dim:D.mobileHeightDim}};break;case"mobileHeightDim":$e={mobileHeight:{classNamePrefix:"em-mob-height-",value:D.mobileHeight,dim:T[he]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":$e={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[he]]:T[he],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[he]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":$e={mobileBoxShadow:{hOffset:D.mobileBoxShadowHOffset,vOffset:D.mobileBoxShadowVOffset,blurRadius:D.mobileBoxShadowBlurRadius,spreadRadius:D.mobileBoxShadowSpreadRadius,color:D.mobileBoxShadowColor,inset:D.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":$e={[he]:{classNamePrefix:"em-mob-text_align-",value:T[he]}};break;case"mobileVerticalAlign":$e={[he]:{classNamePrefix:"em-mob-vertical_align-",value:T[he]}};break;case"mobileDirection":$e={[he]:{classNamePrefix:"em-mob-direction-",value:T[he]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if($e=xt(T),!$e)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":$e={mobilePadding:{all:null,top:D.mobilePaddingTop!==""?D.mobilePaddingTop:null,right:D.mobilePaddingRight!==""?D.mobilePaddingRight:null,bottom:D.mobilePaddingBottom!==""?D.mobilePaddingBottom:null,left:D.mobilePaddingLeft!==""?D.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":D.mobilePaddingTop=D.mobilePaddingBottom=T[he],$e={mobilePadding:{all:null,top:D.mobilePaddingTop!==""?D.mobilePaddingTop:null,right:D.mobilePaddingRight!==""?D.mobilePaddingRight:null,bottom:D.mobilePaddingBottom!==""?D.mobilePaddingBottom:null,left:D.mobilePaddingLeft!==""?D.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":D.mobilePaddingLeft=D.mobilePaddingRight=T[he],$e={mobilePadding:{all:null,top:D.mobilePaddingTop!==""?D.mobilePaddingTop:null,right:D.mobilePaddingRight!==""?D.mobilePaddingRight:null,bottom:D.mobilePaddingBottom!==""?D.mobilePaddingBottom:null,left:D.mobilePaddingLeft!==""?D.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":$e={[he]:isNaN(parseFloat(T[he].position))?T[he].position:T[he].position+T[he].unit};break;default:$e=T}he!=="borderPosition"&&he!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:$e}),he!=="mobileBorderRadiusAll"&&he!=="mobileBorderRadiusTopLeft"&&he!=="mobileBorderRadiusTopRight"&&he!=="mobileBorderRadiusBottomLeft"&&he!=="mobileBorderRadiusBottomRight"&&Ne({...e,...$e,mobileBorderRadius:{...e.mobileBorderRadius,...$e?.mobileBorderRadius},activateSection:null,changeKey:he}))},He=()=>{V(D=>!D);const T=a.getFieldsValue(!0);X||(T.paddingLeftRight=T.paddingLeft,T.paddingTopBottom=T.paddingTop,T.paddingRight=T.paddingLeft,T.paddingBottom=T.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:T.paddingTopBottom,bottom:T.paddingTopBottom,left:T.paddingLeftRight,right:T.paddingLeftRight}}}))},ze=()=>{const T=a.getFieldsValue(!0);d.markBorderToggled(!z),setTimeout(()=>{ee(D=>!D),z?(T.borderAll=W.NULL_BORDER,T.borderTop=W.NULL_BORDER,T.borderBottom=W.NULL_BORDER,T.borderRight=W.NULL_BORDER,T.borderLeft=W.NULL_BORDER):T.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:T.borderAll.color,style:T.borderAll.style,width:T.borderAll.width}}}})})},ie=()=>{const T=a.getFieldsValue(!0);c.markBorderToggled(!R),setTimeout(()=>{q(D=>!D),R?(T.mobileBorderAll=W.NULL_BORDER,T.mobileBorderTop=W.NULL_BORDER,T.mobileBorderBottom=W.NULL_BORDER,T.mobileBorderRight=W.NULL_BORDER,T.mobileBorderLeft=W.NULL_BORDER):T.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:T.mobileBorderAll.color,style:T.mobileBorderAll.style,width:T.mobileBorderAll.width}}}})})},Be=()=>{const T=a.getFieldsValue(!0);setTimeout(()=>{de(D=>!D),re?(T.borderRadiusAll=0,p(!0)):T.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:T.borderRadiusAll}}})})},j=()=>{const T=a.getFieldsValue(!0);setTimeout(()=>{me(D=>!D),se?(T.mobileBorderRadiusAll=null,g(!0)):T.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:T.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Z=()=>{const T=a.getFieldsValue(!0);setTimeout(()=>{Ie(D=>!D),xe?(T.boxShadowInset=!1,T.boxShadowHOffset=null,T.boxShadowVOffset=null,T.boxShadowBlurRadius=null,T.boxShadowSpreadRadius=null,T.boxShadowColor=""):(T.boxShadowInset=!1,T.boxShadowHOffset=5,T.boxShadowVOffset=5,T.boxShadowBlurRadius=10,T.boxShadowSpreadRadius=-5,T.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:T.boxShadowBlurRadius,color:T.boxShadowColor,hOffset:T.boxShadowHOffset,inset:T.boxShadowInset,spreadRadius:T.boxShadowSpreadRadius,vOffset:T.boxShadowVOffset}}})})},ye=()=>{const T=a.getFieldsValue(!0);setTimeout(()=>{We(D=>!D),ae?(T.mobileBoxShadowInset=!1,T.mobileBoxShadowHOffset=null,T.mobileBoxShadowVOffset=null,T.mobileBoxShadowBlurRadius=null,T.mobileBoxShadowSpreadRadius=null,T.mobileBoxShadowColor=""):(T.mobileBoxShadowInset=!1,T.mobileBoxShadowHOffset=5,T.mobileBoxShadowVOffset=5,T.mobileBoxShadowBlurRadius=10,T.mobileBoxShadowSpreadRadius=-5,T.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:T.mobileBoxShadowBlurRadius,color:T.mobileBoxShadowColor,hOffset:T.mobileBoxShadowHOffset,inset:T.mobileBoxShadowInset,spreadRadius:T.mobileBoxShadowSpreadRadius,vOffset:T.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Ce=()=>{const T=a.getFieldsValue(!0);setTimeout(()=>{pe(D=>!D),ve&&(T.width="",T.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 T=a.getFieldsValue(!0);setTimeout(()=>{le(D=>!D),ge&&(T.mobileWidth="",T.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-"}}}))})},Ye=()=>{const T=a.getFieldsValue(!0);setTimeout(()=>{ce(D=>!D),te?(T.backgroundColor="",T.backgroundImage="",T.backgroundPositionX="",T.backgroundPositionY="",T.backgroundRepeat="none",T.backgroundSize="",P(!0)):(T.backgroundColor="#E5E5E5",T.backgroundSize="",T.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:T.backgroundColor,backgroundImage:[{type:"url",value:T.backgroundImage}],backgroundPositionX:T.backgroundPositionX,backgroundPositionY:T.backgroundPositionY,backgroundRepeat:T.backgroundRepeat,backgroundSize:T.backgroundSize}})})},qe=()=>{const T=a.getFieldsValue(!0);setTimeout(()=>{be(D=>!D),ue?T.mobileBackgroundColor="":T.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:T.mobileBackgroundColor}}}),ue&&Bt(a,e,l)})},M=()=>{const T=a.getFieldsValue(!0);setTimeout(()=>{G(D=>!D),K&&(T.exportAsPicture=!1,T.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},O=()=>{const T=a.getFieldsValue(!0);setTimeout(()=>{ne(D=>!D),Q&&(T.mobilePaddingLeftRight="",T.mobilePaddingLeft="",T.mobilePaddingRight="",T.mobilePaddingTopBottom="",T.mobilePaddingTop="",T.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:W.BORDER_POSITIONS[oe]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[we]||"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:Ve,autoComplete:"off",className:"element-controls",children:E==="mobile"&&y.styles?(0,o.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:E==="mobile"&&y.styles?"flex":"none"},children:[(0,o.jsx)("div",{className:"selected_form-mobile-props-header",children:!N&&(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)(dl,{form:a,elementSettings:e,boxShadow:x,mobileBordersShow:R,mobileBorderRadiusShow:se,mobileBoxShadowShow:ae,mobileSizeShow:ge,mobileBackgroundShow:ue,mobilePaddingShow:Q,mobilePaddingsExt:F,setMobilePaddingsExt:$,oneMobileBorderRadiusValue:S,setOneMobileBorderRadiusValue:g,toggleShowMobileBorderHandler:ie,toggleShowMobileBorderRadiusHandler:j,toggleShowMobileBoxShadowHandler:ye,toggleShowMobileSizeHandler:De,toggleShowMobileBackgroundHandler:qe,toggleShowMobilePaddingHandler:O})})]}):(0,o.jsxs)(o.Fragment,{children:[!N&&(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)(nl,{form:a,elementSettings:e,boxShadow:x,bordersShow:z,borderRadiusShow:re,boxShadowShow:xe,backgroundShow:te,backgroundImageEmpty:v,backgroundRepeatOptions:je,sizeShow:ve,maxWidthValue:m,modificationShow:K,paddingsExt:X,oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementListShow:_e,togglePaddingHandler:He,toggleShowBorderHandler:ze,toggleShowBorderRadiusHandler:Be,toggleShowBoxShadowHandler:Z,toggleShowSizeHandler:Ce,toggleShowBackgroundHandler:Ye,toggleShowModificationHandler:M,handleChangeValues:Ve})})]})})};cl.propTypes={elementSettings:f.default.object.isRequired};var ul=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:b,sizeShow:x,maxWidthValue:k,modificationShow:h,paddingShow:p,paddingsExt:S,oneBorderRadiusValue:g,setOneBorderRadiusValue:E,togglePaddingHandler:y,toggleShowPaddingHandler:v,toggleShowBorderHandler:P,toggleShowBorderRadiusHandler:w,toggleShowBoxShadowHandler:I,toggleShowSizeHandler:N,toggleShowBackgroundHandler:X,toggleShowModificationHandler:V,handleChangeValues:F})=>{const{__:$}=r.useI18n(),{token:z}=(0,t.ui_kit$useToken)(),ee=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})})]}),ee.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Padding"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:S,onToggleExtended:y,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:x,onToggle:N,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:k,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:ee,token:z,elementSettings:i,backgroundRepeatOptions:b,handleChangeValues:F}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),ee.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Borders"),collapsible:!0,open:s,onToggle:P,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),ee.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Border radius"),collapsible:!0,open:a,onToggle:w,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:g,setOneBorderRadiusValue:E,elementSettings:i})}),ee.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Box shadow"),collapsible:!0,open:d,onToggle:I,dividerTop:!0,children:(0,o.jsx)(jo,{})}),ee.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Export settings"),collapsible:!0,open:h,onToggle:V,dividerTop:!0,children:(0,o.jsx)(wi,{form:e,elementSettings:i})}),ee.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})})}),ee.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};ul.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,sizeShow:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),modificationShow:f.default.bool,paddingShow:f.default.bool,paddingsExt:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,togglePaddingHandler:f.default.func,toggleShowPaddingHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func,handleChangeValues:f.default.func};var ml=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:b,mobilePaddingsExt:x,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:g,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:P})=>{const{__:w}=r.useI18n(),{token:I}=(0,t.ui_kit$useToken)(),N=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"})})]}),N.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Padding"),collapsible:!0,open:b,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:i,mobilePaddingsExt:x,setMobilePaddingsExt:k})}),(0,o.jsx)(t.ui_kit$FormSection,{title:w("Size"),collapsible:!0,open:c,onToggle:y,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:I.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:I.formItemMarginBottomXS},children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:w("Background"),collapsible:!0,open:m,onToggle:v,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:Wo(i),imageEnabled:N.formDivFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),N.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Borders"),collapsible:!0,open:s,onToggle:S,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),N.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Border radius"),collapsible:!0,open:a,onToggle:g,dividerTop:!0,children:(0,o.jsx)(To,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementSettings:i})}),N.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Box shadow"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),N.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("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"})})}),N.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};ml.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,mobileBoxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};var pl=({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,x]=(0,n.useState)(!0),[k,h]=(0,n.useState)({}),[p,S]=(0,n.useState)(!0),g=r.useSelector(r.selectEmailViewType),E=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[y,v]=(0,n.useState)(e.backgroundImage[0].value===""),P=r.useSelector(r.selectIsCodeMode),w=r.useSelector(r.selectCodeModeDirection),I=P&&w!=="bottom",[N,X]=(0,n.useState)(!1),[V,F]=(0,n.useState)(!1),[$,z]=(0,n.useState)(!1),[ee,R]=(0,n.useState)(!1),[q,re]=(0,n.useState)(!1),[de,se]=(0,n.useState)(!1),[me,xe]=(0,n.useState)(!1),[Ie,ae]=(0,n.useState)(!1),[We,ve]=(0,n.useState)(!1),[pe,ge]=(0,n.useState)(!1),[le,te]=(0,n.useState)(!1),[ce,ue]=(0,n.useState)(!1),[be,K]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(!1),[ne,_e]=(0,n.useState)(!1),[fe,Ae]=(0,n.useState)(""),je=[{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 Oe=e.border,Y=e.mobileBorder,oe=Object.keys(Oe).find(M=>Oe[M]?.width||Oe[M]?.style||Oe[M]?.color),we=Object.keys(Y).find(M=>Y[M]?.width||Y[M]?.style||Y[M]?.color),H=M=>M&&(M?.width||M?.style||M?.color)?M:"";(0,n.useEffect)(()=>{if(e){const M=e.boxShadow,O=e.mobileBoxShadow;m(M),h(O),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:H(e.mobileBorder.all)||!(H(e.mobileBorder.top)||H(e.mobileBorder.bottom)||H(e.mobileBorder.right)||H(e.mobileBorder.left))&&H(e.border.all),mobileBorderTop:H(e.mobileBorder.top)||!H(e.mobileBorder.all)&&H(e.border.top),mobileBorderBottom:H(e.mobileBorder.bottom)||!H(e.mobileBorder.all)&&H(e.border.bottom),mobileBorderRight:H(e.mobileBorder.right)||!H(e.mobileBorder.all)&&H(e.border.right),mobileBorderLeft:H(e.mobileBorder.left)||!H(e.mobileBorder.all)&&H(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:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:po(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))?x(!1):x(!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),v(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 T=a.isStaleBorderSnapshot(e,!!oe),D=d.isStaleBorderSnapshot(e,!!we);T&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(D||T&&!we)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),z(he=>oe&&!T?!0:he),R(he=>oe&&!T||we&&!D?!0:he),re(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),se(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),xe(!!e.boxShadow),ae(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ve(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),ge(!!e.mobileWidth.value||!!e.mobileHeight.value),te(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),ue(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,oe,we,a,d]);const Re=M=>{const O=s.getFieldsValue(!0),T=Object.keys(M)[0];let D;switch(Ae(s.getFieldsValue(!0).widthDim==="%"?100:""),T){case"exportAsPicture":D={exportAsPicture:O.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":D={boxShadow:{hOffset:O.boxShadowHOffset,vOffset:O.boxShadowVOffset,blurRadius:O.boxShadowBlurRadius,spreadRadius:O.boxShadowSpreadRadius,color:O.boxShadowColor,inset:O.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":O.borderPosition==="borderAll"?(D={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...O.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):O.borderAll?.width||O.borderAll?.style||O.borderAll?.color?(D={border:{all:null,left:O.borderAll,right:O.borderAll,top:O.borderAll,bottom:O.borderAll,[W.REVERSE_BORDER_POSITIONS[T]]:{...O[T],...M[T]}}},s.setFieldsValue({borderAll:null,borderLeft:O.borderAll,borderRight:O.borderAll,borderTop:O.borderAll,borderBottom:O.borderAll,[T]:{...O[T],...M[T]}})):(D={border:{all:null,left:O.borderLeft,right:O.borderRight,top:O.borderTop,bottom:O.borderBottom,[W.REVERSE_BORDER_POSITIONS[T]]:{...O[T],...M[T]}}},s.setFieldsValue({border:D.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(O.mobileBorderPosition==="mobileBorderAll")D={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...O.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[T]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const he=W.MOBILE_REVERSE_BORDER_POSITIONS[T],$e={...O[T],...M[T]},io=!$e?.width&&!$e?.style&&!$e?.color;if(O.mobileBorder?.all?.width||O.mobileBorder?.all?.style||O.mobileBorder?.all?.color){const Je=O.mobileBorderAll;D={mobileBorder:{all:null,left:Je,right:Je,top:Je,bottom:Je,[he]:io?null:{...$e,classNamePrefix:"em-mob-border_"+he+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Je,mobileBorderRight:Je,mobileBorderTop:Je,mobileBorderBottom:Je,[T]:$e})}else{const Je=e.mobileBorder||{},ro=oo=>{const mo=Je[oo];return mo&&(mo?.width||mo?.style||mo?.color)?mo:null};D={mobileBorder:{all:null,left:he==="left"?io?null:{...$e,classNamePrefix:"em-mob-border_left-"}:ro("left"),right:he==="right"?io?null:{...$e,classNamePrefix:"em-mob-border_right-"}:ro("right"),top:he==="top"?io?null:{...$e,classNamePrefix:"em-mob-border_top-"}:ro("top"),bottom:he==="bottom"?io?null:{...$e,classNamePrefix:"em-mob-border_bottom-"}:ro("bottom")}},s.setFieldsValue({[T]:$e})}}break;case"width":D={[T]:{value:M[T],dim:O.widthDim}};break;case"height":D={[T]:{value:M[T],dim:O.heightDim}};break;case"widthDim":D={width:{value:O.width,dim:M[T]}};break;case"heightDim":D={height:{value:O.height,dim:M[T]}};break;case"maxWidth":D={[T]:{value:M[T],dim:O.maxWidthDim}};break;case"maxWidthDim":D={maxWidth:{value:O.maxWidth,dim:M[T]}};break;case"minWidth":D={[T]:{value:M[T],dim:O.minWidthDim}};break;case"minWidthDim":D={minWidth:{value:O.minWidth,dim:M[T]}};break;case"backgroundImage":v(M[T]===""),D={[T]:[{...e.backgroundImage[0],value:M[T]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":D={padding:{[W.PADDING_POSITION[T]]:+M[T]}};break;case"paddingTopBottom":D={padding:{top:+M[T],bottom:+M[T]}},O.paddingTop=O.paddingBottom=+M[T];break;case"paddingLeftRight":D={padding:{left:+M[T],right:+M[T]}},O.paddingLeft=O.paddingRight=+M[T];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":D={borderRadius:{[W.BORDER_RADIUS_POSITION[T]]:+M[T]}};break;case"mobileWidth":D={[T]:{classNamePrefix:"em-mob-width-",value:M[T],dim:O.mobileWidthDim}};break;case"mobileWidthDim":D={mobileWidth:{classNamePrefix:"em-mob-width-",value:O.mobileWidth||100,dim:M[T]}};break;case"mobileHeight":D={[T]:{classNamePrefix:"em-mob-height-",value:M[T],dim:O.mobileHeightDim}};break;case"mobileHeightDim":D={mobileHeight:{classNamePrefix:"em-mob-height-",value:O.mobileHeight,dim:M[T]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":D={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[T]]:M[T],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[T]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":D={mobileBoxShadow:{hOffset:O.mobileBoxShadowHOffset,vOffset:O.mobileBoxShadowVOffset,blurRadius:O.mobileBoxShadowBlurRadius,spreadRadius:O.mobileBoxShadowSpreadRadius,color:O.mobileBoxShadowColor,inset:O.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":D={[T]:{classNamePrefix:"em-mob-text_align-",value:M[T]}};break;case"mobileVerticalAlign":D={[T]:{classNamePrefix:"em-mob-vertical_align-",value:M[T]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(D=xt(M),!D)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":D={mobilePadding:{all:null,top:O.mobilePaddingTop!==""?O.mobilePaddingTop:null,right:O.mobilePaddingRight!==""?O.mobilePaddingRight:null,bottom:O.mobilePaddingBottom!==""?O.mobilePaddingBottom:null,left:O.mobilePaddingLeft!==""?O.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":O.mobilePaddingTop=O.mobilePaddingBottom=M[T],D={mobilePadding:{all:null,top:O.mobilePaddingTop!==""?O.mobilePaddingTop:null,right:O.mobilePaddingRight!==""?O.mobilePaddingRight:null,bottom:O.mobilePaddingBottom!==""?O.mobilePaddingBottom:null,left:O.mobilePaddingLeft!==""?O.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":O.mobilePaddingLeft=O.mobilePaddingRight=M[T],D={mobilePadding:{all:null,top:O.mobilePaddingTop!==""?O.mobilePaddingTop:null,right:O.mobilePaddingRight!==""?O.mobilePaddingRight:null,bottom:O.mobilePaddingBottom!==""?O.mobilePaddingBottom:null,left:O.mobilePaddingLeft!==""?O.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":D={[T]:{classNamePrefix:"em-mob-direction-",value:M[T]}};break;case"backgroundPositionX":case"backgroundPositionY":D={[T]:isNaN(parseFloat(M[T].position))?M[T].position:M[T].position+M[T].unit};break;default:D=M}T!=="borderPosition"&&T!=="mobileBorderPosition"&&l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:D})},Pe=()=>{X(O=>!O);const M=s.getFieldsValue(!0);N||(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}}}))},Ne=()=>{const M=s.getFieldsValue(!0);a.markBorderToggled(!$),setTimeout(()=>{z(O=>!O),$?(M.borderAll=W.NULL_BORDER,M.borderTop=W.NULL_BORDER,M.borderBottom=W.NULL_BORDER,M.borderRight=W.NULL_BORDER,M.borderLeft=W.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}}}})})},Ve=()=>{const M=s.getFieldsValue(!0);d.markBorderToggled(!ee),setTimeout(()=>{R(O=>!O),ee?(M.mobileBorderAll=W.NULL_BORDER,M.mobileBorderTop=W.NULL_BORDER,M.mobileBorderBottom=W.NULL_BORDER,M.mobileBorderRight=W.NULL_BORDER,M.mobileBorderLeft=W.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(()=>{re(O=>!O),q?(M.borderRadiusAll=0,x(!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(()=>{se(O=>!O),de?(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-"}}})})},ie=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{xe(O=>!O),me?(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(()=>{ae(O=>!O),Ie?(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-"}}})})},j=()=>{setTimeout(()=>{ve(M=>!M)})},Z=()=>{setTimeout(()=>{ge(M=>!M)})},ye=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{te(O=>!O),le?(M.backgroundColor="",M.backgroundImage="",M.backgroundPositionX="",M.backgroundPositionY="",M.backgroundRepeat="none",M.backgroundSize="",v(!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(()=>{ue(O=>!O),ce?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}}}),ce&&Bt(s,e,l)})},De=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{K(O=>!O),be&&(M.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},Ye=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{Q(O=>!O),G&&(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}}}))})},qe=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{_e(O=>!O),ne&&(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:W.BORDER_POSITIONS[oe]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[we]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:""},onValuesChange:Re,autoComplete:"off",className:"element-controls",children:[!I&&(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"})}),g==="mobile"&&E.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(ml,{form:s,elementSettings:e,mobileBoxShadow:k,mobileBordersShow:ee,mobileBorderRadiusShow:de,mobileBoxShadowShow:Ie,mobileSizeShow:pe,mobileBackgroundShow:ce,mobilePaddingShow:ne,mobilePaddingsExt:V,setMobilePaddingsExt:F,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:S,toggleShowMobileBorderHandler:Ve,toggleShowMobileBorderRadiusHandler:ze,toggleShowMobileBoxShadowHandler:Be,toggleShowMobileSizeHandler:Z,toggleShowMobileBackgroundHandler:Ce,toggleShowMobilePaddingHandler:qe})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ul,{form:s,elementSettings:e,boxShadow:c,bordersShow:$,borderRadiusShow:q,boxShadowShow:me,backgroundShow:le,backgroundImageEmpty:y,backgroundRepeatOptions:je,sizeShow:We,maxWidthValue:fe,modificationShow:be,paddingShow:G,paddingsExt:N,oneBorderRadiusValue:b,setOneBorderRadiusValue:x,togglePaddingHandler:Pe,toggleShowPaddingHandler:Ye,toggleShowBorderHandler:Ne,toggleShowBorderRadiusHandler:He,toggleShowBoxShadowHandler:ie,toggleShowSizeHandler:j,toggleShowBackgroundHandler:ye,toggleShowModificationHandler:De,handleChangeValues:Re})})]})};pl.propTypes={elementSettings:f.default.object.isRequired};var hl=({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:cn})})})})})]})}),(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,{})})]})};hl.propTypes={form:f.default.object.isRequired,elementSettings:f.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$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,{})})]})};bl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var Ci=0,fl=({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:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:po(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Ci=e.width.value+e.gap.value)},[s,e]);const x=k=>{const h=s.getFieldsValue(!0),p=Object.keys(k)[0];let S;switch(p){case"width":Ci=k[p]+h.gap,S={[p]:{value:k[p],dim:h.widthDim},gap:{value:h.gap}};break;case"widthDim":S={width:{value:h.width,dim:k[p]},gap:{value:h.gap}};break;case"gap":h.width=Ci-k[p],S={[p]:{value:k[p],dim:"px"}};break;case"mobileWidth":S={[p]:{classNamePrefix:"em-mob-width-",value:k[p],dim:h.mobileWidthDim}};break;case"mobileWidthDim":S={mobileWidth:{classNamePrefix:"em-mob-width-",value:h.mobileWidth||100,dim:k[p]}};break;case"mobileContentWidth":S={[p]:{classNamePrefix:"em-mob-width-",value:k[p],dim:h.mobileContentWidthDim}};break;case"mobileContentWidthDim":S={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:k[p]}};break;case"mobileVerticalAlign":S={[p]:{classNamePrefix:"em-mob-vertical_align-",value:k[p]}};break;default:S=k}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:x,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)(bl,{form:s,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(hl,{form:s,elementSettings:e})})]})};fl.propTypes={elementSettings:f.default.object.isRequired};var gl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,bordersShow:a,borderRadiusShow:d,boxShadowShow:c,backgroundShow:m,backgroundImageEmpty:b,backgroundRepeatOptions:x,paddingShow:k,paddingsExt:h,maxWidthValue:p,oneBorderRadiusValue:S,setOneBorderRadiusValue:g,linkProtocol:E,linkTarget:y,isOpenTextReplacer:v,textReplacerButtonRef:P,textReplacerInputRef:w,handleLinkProtocolsChange:I,handleSelect:N,textReplacerInputHandler:X,handleTextReplacerKeyDown:V,srcButtonHandler:F,togglePaddingHandler:$,toggleShowPaddingHandler:z,toggleShowBackgroundHandler:ee,toggleShowBorderHandler:R,toggleShowBorderRadiusHandler:q,toggleShowBoxShadowHandler:re,setLinkProtocol:de,handleChangeValues:se})=>{const{__:me}=r.useI18n(),{token:xe}=(0,t.ui_kit$useToken)(),Ie=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:me("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})}),Ie.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:E==="#",__:me,style:{marginBottom:xe.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:me("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:Ie.formButtonFieldReplacerEnabled?xe.formItemMarginBottomXS:xe.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:E,handleLinkProtocolsChange:I,__:me}),placeholder:me("Hyperlink URL"),allowClear:!0,onSelect:N,prefix:(0,o.jsx)(Jo,{linkProtocol:E})})})}),E==="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:me("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:me("Body")})})]}),Ie.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:me("Text replacer"),placement:"bottom",getPopupContainer:ae=>ae.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:"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:v&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:me("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:me("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:me("Text")}),onChange:X,onKeyDown:V,ref:w,onSelect:N})})})})]})}),Ie.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:me("Padding"),collapsible:!0,open:k,onToggle:z,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:$,gutter:xe.marginSM,labels:{horizontal:me("Horizontal padding"),vertical:me("Vertical padding"),left:me("Left padding"),right:me("Right padding"),top:me("Top padding"),bottom:me("Bottom padding"),individual:me("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:me("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:p,dimensionSelect:Oo,gutter:xe.marginSM,labels:{width:me("Width"),height:me("Height"),minWidth:me("Minimum width"),maxWidth:me("Maximum width")}})}),(0,o.jsx)(_t,{form:e,fillFields:i,elementSettings:l,showAddParagraph:!1,isButton:!0,setLinkProtocol:de,linkProtocol:E,linkTarget:y}),(0,o.jsxs)(t.ui_kit$FormSection,{title:me("Background"),collapsible:!0,open:m,onToggle:ee,dividerTop:!0,children:[(0,o.jsx)(Ii,{form:e,backgroundImageEmpty:b,appConfig:Ie,token:xe,elementSettings:l,backgroundRepeatOptions:x,handleChangeValues:se}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),Ie.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:me("Borders"),collapsible:!0,open:a,onToggle:R,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:l})}),Ie.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:me("Border radius"),collapsible:!0,open:d,onToggle:q,dividerTop:!0,children:[(0,o.jsx)(To,{form:e,oneBorderRadiusValue:S,setOneBorderRadiusValue:g,elementSettings:l}),(0,o.jsx)(it,{form:e,showRounding:!0})]}),Ie.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:me("Box shadow"),collapsible:!0,open:c,onToggle:re,dividerTop:!0,children:(0,o.jsx)(jo,{})}),Ie.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:me("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:l,form:e})}),Ie.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:me("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})]})};gl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,paddingShow:f.default.bool,paddingsExt:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,linkProtocol:f.default.string,linkTarget:f.default.object,isOpenTextReplacer:f.default.bool,textReplacerButtonRef:f.default.object,textReplacerInputRef:f.default.object,handleLinkProtocolsChange:f.default.func,handleSelect:f.default.func,textReplacerInputHandler:f.default.func,handleTextReplacerKeyDown:f.default.func,srcButtonHandler:f.default.func,togglePaddingHandler:f.default.func,toggleShowPaddingHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,setLinkProtocol:f.default.func,handleChangeValues:f.default.func};var _l=({form:e,fillFields:i,elementSettings:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:m,mobileBackgroundShow:b,mobilePaddingShow:x,mobilePaddingsExt:k,setMobilePaddingsExt:h,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:S,linkProtocol:g,handleLinkProtocolsChange:E,setLinkProtocol:y,toggleShowMobileBorderHandler:v,toggleShowMobileBorderRadiusHandler:P,toggleShowMobileBoxShadowHandler:w,toggleShowMobileSizeHandler:I,toggleShowMobileBackgroundHandler:N,toggleShowMobilePaddingHandler:X})=>{const{__:V}=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:g==="#",__:V,style:{marginBottom:F.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:V("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:g==="mailto:"?F.formItemMarginBottomXS:F.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:g,handleLinkProtocolsChange:E,__:V}),placeholder:V("Hyperlink URL"),allowClear:!0,prefix:(0,o.jsx)(Jo,{linkProtocol:g})})})}),g==="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:V("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:V("Body")})})]})]}),!!l.showOnMobile&&(0,o.jsx)(_t,{form:e,fillFields:i,elementSettings:l,setLinkProtocol:y,linkProtocol:g,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)(Hr,{})})}),$.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:V("Padding"),collapsible:!0,open:x,onToggle:X,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:l,mobilePaddingsExt:k,setMobilePaddingsExt:h})}),(0,o.jsx)(t.ui_kit$FormSection,{title:V("Size"),collapsible:!0,open:m,onToggle:I,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:V("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:V("Height"),placement:"bottom",children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:V("Background"),collapsible:!0,open:b,onToggle:N,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:V("Borders"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),$.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:V("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:V("Box shadow"),collapsible:!0,open:c,onToggle:w,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),$.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:V("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})}),$.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:V("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};_l.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,linkProtocol:f.default.string,handleLinkProtocolsChange:f.default.func,setLinkProtocol:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};var Mn=Object.freeze({}),xl=({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)({}),[x,k]=(0,n.useState)(!0),[h,p]=(0,n.useState)(!0),S=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),[E,y]=(0,n.useState)(e.backgroundImage?.[0].value===""),v=r.useSelector(r.selectIsCodeMode),P=r.useSelector(r.selectCodeModeDirection),w=v&&P!=="bottom",I=(0,n.useRef)(null),N=(0,n.useRef)(null),[X,V]=(0,n.useState)(!1),[F,$]=(0,n.useState)(!1),[z,ee]=(0,n.useState)(!1),[R,q]=(0,n.useState)(!1),[re,de]=(0,n.useState)(!1),[se,me]=(0,n.useState)(!1),[xe,Ie]=(0,n.useState)(!1),[ae,We]=(0,n.useState)(!1),[ve,pe]=(0,n.useState)(!1),[ge,le]=(0,n.useState)(!1),[te,ce]=(0,n.useState)(!1),[ue,be]=(0,n.useState)(!1),[K,G]=(0,n.useState)(!1),[Q,ne]=(0,n.useState)(""),[_e,fe]=(0,n.useState)("https://"),[Ae,je]=(0,n.useState)({}),Oe=e,[Y,oe]=(0,n.useState)(!!Oe.textReplacer?.length),[we,H]=(0,n.useState)(e);e!==we&&(H(e),oe(!!Oe.textReplacer?.length));const Re=r.useElementEntityKind(),Pe=[{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,Ve=e.mobileBorder,He=Object.keys(Ne).find(C=>Ne[C]?.width||Ne[C]?.style||Ne[C]?.color),ze=Object.keys(Ve).find(C=>Ve[C]?.width||Ve[C]?.style||Ve[C]?.color),ie=C=>C&&(C?.width||C?.style||C?.color)?C:"",{remember:Be,fillFields:j}=st(e);(0,n.useEffect)(()=>{if(e){const C=e.boxShadow||Mn,U=e.mobilePadding||{},_=e.mobileAlign||{};b(C);let L="",B="",J=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const Fe=Ar(e.href);L=Fe.subject,B=Fe.body,J=Fe.baseEmail}Ho(e.href,fe)}j(s,{...e,href:J,subject:L,body:B,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:ie(e.mobileBorder.all)||!(ie(e.mobileBorder.top)||ie(e.mobileBorder.bottom)||ie(e.mobileBorder.right)||ie(e.mobileBorder.left))&&ie(e.border.all),mobileBorderTop:ie(e.mobileBorder.top)||!ie(e.mobileBorder.all)&&ie(e.border.top),mobileBorderBottom:ie(e.mobileBorder.bottom)||!ie(e.mobileBorder.all)&&ie(e.border.bottom),mobileBorderRight:ie(e.mobileBorder.right)||!ie(e.mobileBorder.all)&&ie(e.border.right),mobileBorderLeft:ie(e.mobileBorder.left)||!ie(e.mobileBorder.all)&&ie(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:po(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:po(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(_?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(U.all)||u(U.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(U.all)||u(U.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(U.all)||u(U.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(U.all)||u(U.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(U.top)||u(U.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(U.left)||u(U.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Nr(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))?k(!1):k(!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),y(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)?V(!1):V(!0),!u(U.all)&&(u(U.top)||u(U.right)||u(U.bottom)||u(U.left))&&(U.top!==U.bottom||U.right!==U.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 Se=a.isStaleBorderSnapshot(e,!!He),Ke=d.isStaleBorderSnapshot(e,!!ze);Se&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ke||Se&&!ze)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),ee(Fe=>He&&!Se?!0:Fe),q(Fe=>He&&!Se||ze&&!Ke?!0:Fe),de(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),me(!!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),Ie(!!e.boxShadow),We(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),pe(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),le(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),ce(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Et(e)&&ce(!0),be(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),G(!!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,w,He,ze,a,d,j]);const Z=(0,n.useCallback)(C=>{Be(C),c(Re==="email"?r.setElementSettings$1(C):r.setElementSettings(C))},[c,Re,Be]),ye=C=>{const U=s.getFieldsValue(!0),_=Object.keys(C)[0];let L;switch(ne(s.getFieldsValue(!0).widthDim==="%"?100:""),_){case"exportAsPicture":L={exportAsPicture:U.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":L={boxShadow:{hOffset:U.boxShadowHOffset,vOffset:U.boxShadowVOffset,blurRadius:U.boxShadowBlurRadius,spreadRadius:U.boxShadowSpreadRadius,color:U.boxShadowColor,inset:U.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":U.borderPosition==="borderAll"?(L={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...U.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):U.borderAll?.width||U.borderAll?.style||U.borderAll?.color?(L={border:{all:null,left:U.borderAll,right:U.borderAll,top:U.borderAll,bottom:U.borderAll,[W.REVERSE_BORDER_POSITIONS[_]]:{...U[_],...C[_]}}},s.setFieldsValue({borderAll:null,borderLeft:U.borderAll,borderRight:U.borderAll,borderTop:U.borderAll,borderBottom:U.borderAll,[_]:{...U[_],...C[_]}})):(L={border:{all:null,left:U.borderLeft,right:U.borderRight,top:U.borderTop,bottom:U.borderBottom,[W.REVERSE_BORDER_POSITIONS[_]]:{...U[_],...C[_]}}},s.setFieldsValue({border:L.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(U.mobileBorderPosition==="mobileBorderAll")L={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...U.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[_]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const Se=W.MOBILE_REVERSE_BORDER_POSITIONS[_],Ke={...U[_],...C[_]},Fe=!Ke?.width&&!Ke?.style&&!Ke?.color;if(U.mobileBorder?.all?.width||U.mobileBorder?.all?.style||U.mobileBorder?.all?.color){const no=U.mobileBorderAll;L={mobileBorder:{all:null,left:no,right:no,top:no,bottom:no,[Se]:Fe?null:{...Ke,classNamePrefix:"em-mob-border_"+Se+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:no,mobileBorderRight:no,mobileBorderTop:no,mobileBorderBottom:no,[_]:Ke})}else{const no=e.mobileBorder||{},ko=Xo=>{const Co=no[Xo];return Co&&(Co?.width||Co?.style||Co?.color)?Co:null};L={mobileBorder:{all:null,left:Se==="left"?Fe?null:{...Ke,classNamePrefix:"em-mob-border_left-"}:ko("left"),right:Se==="right"?Fe?null:{...Ke,classNamePrefix:"em-mob-border_right-"}:ko("right"),top:Se==="top"?Fe?null:{...Ke,classNamePrefix:"em-mob-border_top-"}:ko("top"),bottom:Se==="bottom"?Fe?null:{...Ke,classNamePrefix:"em-mob-border_bottom-"}:ko("bottom")}},s.setFieldsValue({[_]:Ke})}}break;case"width":L={[_]:{value:C[_],dim:U.widthDim}};break;case"height":L={[_]:{value:C[_],dim:U.heightDim}};break;case"widthDim":L={width:{value:U.width,dim:C[_]}};break;case"heightDim":L={height:{value:U.height,dim:C[_]}};break;case"backgroundImage":y(C[_]===""),L={[_]:[{...e.backgroundImage[0],value:C[_]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":L={padding:{left:U.paddingLeft,right:U.paddingRight,top:U.paddingTop,bottom:U.paddingBottom,[W.PADDING_POSITION[_]]:+C[_]}};break;case"paddingTopBottom":L={padding:{left:U.paddingLeft,right:U.paddingRight,top:+C[_],bottom:+C[_]}},U.paddingTop=U.paddingBottom=+C[_];break;case"paddingLeftRight":L={padding:{top:U.paddingTop,bottom:U.paddingBottom,left:+C[_],right:+C[_]}},U.paddingLeft=U.paddingRight=+C[_];break;case"borderRadiusAll":L={borderRadius:{[W.BORDER_RADIUS_POSITION[_]]:+C[_]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":L={borderRadius:{topLeft:U.borderRadiusTopLeft,bottomLeft:U.borderRadiusBottomLeft,topRight:U.borderRadiusTopRight,bottomRight:U.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[_]]:+C[_]}};break;case"mobileWidth":L={[_]:{classNamePrefix:"em-mob-width-",value:C[_],dim:U.mobileWidthDim}};break;case"mobileWidthDim":L={mobileWidth:{classNamePrefix:"em-mob-width-",value:U.mobileWidth||100,dim:C[_]}};break;case"mobileHeight":L={[_]:{classNamePrefix:"em-mob-height-",value:C[_],dim:U.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:C[_],dim:U.mobileHeightDim}};break;case"mobileHeightDim":L={mobileHeight:{classNamePrefix:"em-mob-height-",value:U.mobileHeight,dim:C[_]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":L={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[_]]:C[_],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[_]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":L={mobileBoxShadow:{hOffset:U.mobileBoxShadowHOffset,vOffset:U.mobileBoxShadowVOffset,blurRadius:U.mobileBoxShadowBlurRadius,spreadRadius:U.mobileBoxShadowSpreadRadius,color:U.mobileBoxShadowColor,inset:U.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":L={[_]:{classNamePrefix:"em-mob-table_align-",value:C[_]}};break;case"mobileTextAlign":L={[_]:{classNamePrefix:"em-mob-text_align-",value:C[_]}};break;case"mobileVerticalAlign":L={[_]:{classNamePrefix:"em-mob-vertical_align-",value:C[_]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(L=xt(C),!L)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":L={mobilePadding:{all:null,top:U.mobilePaddingTop!==""?U.mobilePaddingTop:null,right:U.mobilePaddingRight!==""?U.mobilePaddingRight:null,bottom:U.mobilePaddingBottom!==""?U.mobilePaddingBottom:null,left:U.mobilePaddingLeft!==""?U.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":U.mobilePaddingTop=U.mobilePaddingBottom=C[_],L={mobilePadding:{all:null,top:U.mobilePaddingTop!==""?U.mobilePaddingTop:null,right:U.mobilePaddingRight!==""?U.mobilePaddingRight:null,bottom:U.mobilePaddingBottom!==""?U.mobilePaddingBottom:null,left:U.mobilePaddingLeft!==""?U.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":U.mobilePaddingLeft=U.mobilePaddingRight=C[_],L={mobilePadding:{all:null,top:U.mobilePaddingTop!==""?U.mobilePaddingTop:null,right:U.mobilePaddingRight!==""?U.mobilePaddingRight:null,bottom:U.mobilePaddingBottom!==""?U.mobilePaddingBottom:null,left:U.mobilePaddingLeft!==""?U.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":L={[_]:{classNamePrefix:"em-mob-font_size-",value:C[_],dim:U.mobileFontSizeDim}};break;case"href":let B=et(C[_]);B!==C[_]&&(s.setFieldValue("href",B),U.href=B),B.startsWith("mailto:")?L={[_]:Si(B,U.subject,U.body)}:L={[_]:B},Ho(C[_],fe);break;case"subject":case"body":const J=U.href||"";if(J.startsWith("mailto:")){const Se=_==="subject"?C[_]:U.subject,Ke=_==="body"?C[_]:U.body;L={href:Si(J,Se,Ke)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":L={[_]:isNaN(parseFloat(C[_].position))?C[_].position:C[_].position+C[_].unit};break;default:L=C}_!=="borderPosition"&&_!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:L}),_!=="mobileBorderRadiusAll"&&_!=="mobileBorderRadiusTopLeft"&&_!=="mobileBorderRadiusTopRight"&&_!=="mobileBorderRadiusBottomLeft"&&_!=="mobileBorderRadiusBottomRight"&&Z({...e,...L,mobileBorderRadius:{...e.mobileBorderRadius,...L?.mobileBorderRadius},activateSection:null,changeKey:_}))},Ce=()=>{V(U=>!U);const C=s.getFieldsValue(!0);X||(C.paddingLeftRight=C.paddingLeft,C.paddingTopBottom=C.paddingTop,C.paddingRight=C.paddingLeft,C.paddingBottom=C.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:C.paddingTopBottom,bottom:C.paddingTopBottom,left:C.paddingLeftRight,right:C.paddingLeftRight}}}))},De=()=>{const C=s.getFieldsValue(!0);a.markBorderToggled(!z),setTimeout(()=>{ee(U=>!U),z?(C.borderAll=W.NULL_BORDER,C.borderTop=W.NULL_BORDER,C.borderBottom=W.NULL_BORDER,C.borderRight=W.NULL_BORDER,C.borderLeft=W.NULL_BORDER):C.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:C.borderAll.color,style:C.borderAll.style,width:C.borderAll.width}}}})})},Ye=()=>{const C=s.getFieldsValue(!0);d.markBorderToggled(!R),setTimeout(()=>{q(U=>!U),R?(C.mobileBorderAll=W.NULL_BORDER,C.mobileBorderTop=W.NULL_BORDER,C.mobileBorderBottom=W.NULL_BORDER,C.mobileBorderRight=W.NULL_BORDER,C.mobileBorderLeft=W.NULL_BORDER):C.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:C.mobileBorderAll.color,style:C.mobileBorderAll.style,width:C.mobileBorderAll.width}}}})})},qe=()=>{const C=s.getFieldsValue(!0);setTimeout(()=>{de(U=>!U),re?(C.borderRadiusAll=0,k(!0)):C.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:C.borderRadiusAll}}})})},M=()=>{const C=s.getFieldsValue(!0);setTimeout(()=>{me(U=>!U),se?(C.mobileBorderRadiusAll=null,p(!0)):C.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:C.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},O=()=>{const C=s.getFieldsValue(!0);setTimeout(()=>{Ie(U=>!U),xe?(C.boxShadowInset=!1,C.boxShadowHOffset=null,C.boxShadowVOffset=null,C.boxShadowBlurRadius=null,C.boxShadowSpreadRadius=null,C.boxShadowColor=""):(C.boxShadowInset=!1,C.boxShadowHOffset=5,C.boxShadowVOffset=5,C.boxShadowBlurRadius=10,C.boxShadowSpreadRadius=-5,C.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:C.boxShadowBlurRadius,color:C.boxShadowColor,hOffset:C.boxShadowHOffset,inset:C.boxShadowInset,spreadRadius:C.boxShadowSpreadRadius,vOffset:C.boxShadowVOffset}}})})},T=()=>{const C=s.getFieldsValue(!0);setTimeout(()=>{We(U=>!U),ae?(C.mobileBoxShadowInset=!1,C.mobileBoxShadowHOffset=null,C.mobileBoxShadowVOffset=null,C.mobileBoxShadowBlurRadius=null,C.mobileBoxShadowSpreadRadius=null,C.mobileBoxShadowColor=""):(C.mobileBoxShadowInset=!1,C.mobileBoxShadowHOffset=5,C.mobileBoxShadowVOffset=5,C.mobileBoxShadowBlurRadius=10,C.mobileBoxShadowSpreadRadius=-5,C.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:C.mobileBoxShadowBlurRadius,color:C.mobileBoxShadowColor,hOffset:C.mobileBoxShadowHOffset,inset:C.mobileBoxShadowInset,spreadRadius:C.mobileBoxShadowSpreadRadius,vOffset:C.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},D=()=>{const C=s.getFieldsValue(!0);setTimeout(()=>{pe(U=>!U),ve&&(C.mobileWidth="",C.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-"}}}))})},he=()=>{const C=s.getFieldsValue(!0);setTimeout(()=>{le(U=>!U),ge?(C.backgroundColor="",C.backgroundImage="",C.backgroundPositionX="",C.backgroundPositionY="",C.backgroundRepeat="none",C.backgroundSize="",y(!0)):(C.backgroundColor="#E5E5E5",C.backgroundSize="",C.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:C.backgroundColor,backgroundImage:[{type:"url",value:C.backgroundImage}],backgroundPositionX:C.backgroundPositionX,backgroundPositionY:C.backgroundPositionY,backgroundRepeat:C.backgroundRepeat,backgroundSize:C.backgroundSize}})})},$e=()=>{const C=s.getFieldsValue(!0);setTimeout(()=>{ce(U=>!U),te?C.mobileBackgroundColor="":C.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:C.mobileBackgroundColor}}}),te&&Bt(s,e,l)})},io=()=>{const C=s.getFieldsValue(!0);setTimeout(()=>{be(U=>!U),ue&&(C.paddingLeftRight="",C.paddingLeft="",C.paddingRight="",C.paddingTopBottom="",C.paddingTop="",C.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Je=()=>{const C=s.getFieldsValue(!0);setTimeout(()=>{G(U=>!U),K&&(C.mobilePaddingLeftRight="",C.mobilePaddingLeft="",C.mobilePaddingRight="",C.mobilePaddingTopBottom="",C.mobilePaddingTop="",C.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_"}}}))})},ro=C=>{s.setFieldValue("href",C!=="mergetag"?C:""),fe(C)},oo=(0,n.useCallback)(({target:C})=>{if(!C)return;const{selectionStart:U,selectionEnd:_}=C;je(L=>L.target===C&&L.selection?.start===U&&L.selection?.end===_?L:{target:C,selection:{start:U,end:_}})},[]),mo=C=>{C.target.value!==""&&N.current.classList.add("selected-td-form__button--active")},Eo=()=>{oe(!Y),Y?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>I.current.focus())},Te=C=>{const U=C.target,_=U.value,L=U.selectionStart;if(L===0&&C.key===" "){C.preventDefault();return}if(C.key===" "){if(L!==_.length){C.preventDefault();return}_.endsWith(" ")&&C.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:W.BORDER_POSITIONS[He]||"borderAll",mobileBorderPosition:W.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:ye,autoComplete:"off",className:"element-controls",children:[!w&&(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"})}),w?(0,o.jsx)(yi,{form:s,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,o.jsx)(o.Fragment,{children:S==="mobile"&&g.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(_l,{form:s,fillFields:j,elementSettings:e,boxShadow:m,mobileBordersShow:R,mobileBorderRadiusShow:se,mobileBoxShadowShow:ae,mobileSizeShow:ve,mobileBackgroundShow:te,mobilePaddingShow:K,mobilePaddingsExt:F,setMobilePaddingsExt:$,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,linkProtocol:_e,handleLinkProtocolsChange:ro,setLinkProtocol:fe,toggleShowMobileBorderHandler:Ye,toggleShowMobileBorderRadiusHandler:M,toggleShowMobileBoxShadowHandler:T,toggleShowMobileSizeHandler:D,toggleShowMobileBackgroundHandler:$e,toggleShowMobilePaddingHandler:Je})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(gl,{form:s,fillFields:j,elementSettings:e,boxShadow:m,bordersShow:z,borderRadiusShow:re,boxShadowShow:xe,backgroundShow:ge,backgroundImageEmpty:E,backgroundRepeatOptions:Pe,paddingShow:ue,paddingsExt:X,maxWidthValue:Q,oneBorderRadiusValue:x,setOneBorderRadiusValue:k,linkProtocol:_e,linkTarget:Ae,isOpenTextReplacer:Y,textReplacerButtonRef:N,textReplacerInputRef:I,handleLinkProtocolsChange:ro,handleSelect:oo,textReplacerInputHandler:mo,handleTextReplacerKeyDown:Te,srcButtonHandler:Eo,togglePaddingHandler:Ce,toggleShowPaddingHandler:io,toggleShowBackgroundHandler:he,toggleShowBorderHandler:De,toggleShowBorderRadiusHandler:qe,toggleShowBoxShadowHandler:O,setLinkProtocol:fe,handleChangeValues:ye})})})]})};xl.propTypes={elementSettings:f.default.object.isRequired};var kl=({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")})})})};kl.propTypes={elementSettings:f.default.object.isRequired};function Dn(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 Vn(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function Hn(e,i,l){return(e??[]).map((s,a)=>a===i.index?{...s,[i.key]:l}:s)}function El(e){return(e??[]).map((i,l)=>({...i,slideIndex:l}))}var Bl=({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(),x=r.useSendPostMessage(),k="src"+l,h="title"+l,p="alt"+l,S="link"+l,g="imgReplacer"+l,E=(0,n.useRef)(null),y=(0,n.useRef)(null),v=(0,n.useRef)(null),P=(0,n.useRef)(null),w=(0,n.useRef)(null),I=(0,n.useRef)(null),N=(0,n.useRef)(null),X=(0,n.useRef)(null),[V,F]=(0,n.useState)(""),[$,z]=(0,n.useState)(""),[ee,R]=(0,n.useState)(""),[q,re]=(0,n.useState)(!1),[de,se]=(0,n.useState)("https://"),me=(0,n.useRef)(!1),xe=(0,n.useRef)(l);(0,n.useEffect)(()=>{l!==xe.current&&(xe.current=l,me.current=!1),z(e.images?.[p]),R(e.images?.[h]);const be=e.images?.[S];F(be||(me.current?"...":""))},[e,p,h,S,l]);const Ie=()=>{V?(me.current=!1,F(""),s.setFieldValue(S,""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[S]:""}})):(me.current=!0,F(E.current&&E.current.input.value?E.current.input.value:"..."),setTimeout(()=>{E.current.focus()}))},ae=be=>{be.target.value===""?F("..."):(y.current.classList.add("selected-td-form__button--active"),F(be.target.value));const K=be.target.value;Ho(K,se)},We=()=>{$?(z(""),s.setFieldValue("alt",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[p]:""}})):(z(v.current&&v.current.input.value?v.current.input.value:"..."),setTimeout(()=>{v.current.focus()}))},ve=be=>{be.target.value===""?z("..."):(P.current.classList.add("selected-td-form__button--active"),z(be.target.value))},pe=()=>{ee?(R(!1),s.setFieldValue("title",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(R(w.current&&w.current.input.value?w.current.input.value:"..."),setTimeout(()=>{w.current.focus()}))},ge=()=>{re(!q),q?(s.setFieldValue(g,""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[g]:""}})):setTimeout(()=>N.current.focus())},le=be=>{be.target.value!==""&&X.current.classList.add("selected-td-form__button--active")},te=be=>{be.target.value===""?R("..."):(I.current.classList.add("selected-td-form__button--active"),R(be.target.value))},ce=be=>{s.setFieldValue("LinkName",be!=="mergetag"?be:""),se(be)},ue=be=>{const K=s.getFieldsValue(!0),G=+l.substring(1),Q=Object.keys(K?.images).reduce((_e,fe)=>(fe.includes(l)||(_e[fe]=K[fe]),_e),{}),ne=e.carouselImages?.filter((_e,fe)=>fe!==G);i(_e=>({..._e,settings:{..._e.settings,carouselImages:El(ne)}})),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:ne}}),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:k,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:be=>be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!$}),onClick:We,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),b.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:ee||c("Tooltip text"),placement:"bottom",getPopupContainer:be=>be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!ee}),onClick:pe,ref:I,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:V||c("Hyperlink URL"),placement:"bottom",getPopupContainer:be=>be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":!!V}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:Ie,ref:y})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:be=>be.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":q}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ge,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:ue,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!V||!!$||!!ee||!!q)&&(0,o.jsxs)("div",{children:[!!V&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:de==="#",__: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:de,handleLinkProtocolsChange:ce,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:E,onChange:ae,onSelect:a,prefix:(0,o.jsx)(Jo,{linkProtocol:de})})})})]}),!!$&&(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:ve,ref:v,onSelect:a})})}),b.formFieldImageTitleEnabled&&!!ee&&(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:te,ref:w,onSelect:a})})}),!!q&&(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:g,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:le,ref:N,onSelect:a})})})]})]})};Bl.propTypes={};var Sl=({form:e,elementSettings:i,formFields:l,setElementSettings:s,borderRadiusShow:a,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:m,mergeTagItems:b,mergeMenuOpen:x,setMergeMenuOpen:k,cascaderRef:h,handleLinkProtocolsChange:p,handleSelect:S,onChange:g,filter:E,renderSearchOption:y,toggleShowBorderRadiusHandler:v,setNewSlide:P})=>{const{__:w}=r.useI18n(),{token:I}=(0,t.ui_kit$useToken)(),N=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:m==="#",__:w,style:{marginBottom:I.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:w("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,__:w}),placeholder:w("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"}),N.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:I.formItemMarginBottomMD,marginTop:I.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:x?"none":"inline-flex"},onClick:()=>k(!0),children:w("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:h,classNames:{popup:{root:"merge-tags"}},options:b,placeholder:w("Start typing the title"),showSearch:{filter:E,render:y},spellCheck:"false",getPopupContainer:X=>X.closest(".email-pane__collapse-wrapper"),onChange:g,style:{display:x?"block":"none"},open:x,onKeyDown:X=>{X.key==="Escape"&&k(!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:I.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((X,V)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)(Bl,{elementSettings:l,setElementSettings:s,postfix:"_"+V,form:e,handleSelect:S})},V))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:I.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:w("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:I.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:I.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Loop",label:w("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:I.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Autoplay",label:w("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),N.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Border radius"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};Sl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,formFields:f.default.object,setElementSettings:f.default.func,borderRadiusShow:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,linkProtocol:f.default.string,mergeTagItems:f.default.array,mergeMenuOpen:f.default.bool,setMergeMenuOpen:f.default.func,cascaderRef:f.default.object,handleLinkProtocolsChange:f.default.func,handleSelect:f.default.func,onChange:f.default.func,filter:f.default.func,renderSearchOption:f.default.func,toggleShowBorderRadiusHandler:f.default.func,setNewSlide:f.default.func};var Tl=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("p",{children:e("No properties to edit.")})})};Tl.propTypes={};var Un={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 Wn(e){const i={...Ti(e)};return delete i.parent,delete i.path,delete i.nextElem,delete i.prevElem,i}var Rl=({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),[x,k]=(0,n.useState)(!0),[h,p]=(0,n.useState)(!0),[S,g]=(0,n.useState)(!1),[E,y]=(0,n.useState)(!1),[v,P]=(0,n.useState)("https://"),[w,I]=(0,n.useState)(l?.getFieldsValue(!0)),[N,X]=(0,n.useState)(e),{remember:V,isOwnEcho:F}=Mr(Wn),[$,z]=(0,n.useState)(e);e!==$&&(z(e),F(e?.settings)||X(e));const[ee,R]=(0,n.useState)({name:"",counter:0}),[q,re]=(0,n.useState)(null),[de,se]=(0,n.useState)(),[me,xe]=(0,n.useState)(!1),[Ie,ae]=(0,n.useState)(!1),[We,ve]=(0,n.useState)({start:0,end:0}),pe=(0,n.useRef)(null),ge=`selected_${N.type}_form_link`,le=r.useSelector(r.selectIsCodeMode),te=r.useSelector(r.selectCodeModeDirection),ce=le&&te!=="bottom";(0,n.useEffect)(()=>{me&&pe.current&&pe.current.focus()},[me]);const ue=(H,Re)=>{const Pe=document.getElementById(Re);if(Pe){const Ne=N,Ve=Dn(Ne.type,Re),He=Vn(Ve),ze=Pe.value?.substring(0,We.start),ie=Pe.value?.substring(We.end);let Be={[Ve]:ze+H+ie};He?Be={carouselImages:Hn(Ne.settings?.carouselImages,He,ze+H+ie)}:N.type===r.ELEMENT_TYPES.CAROUSEL&&ge===Re&&(Be={[Ve]:ze+H+ie,carouselImages:[...N.settings?.carouselImages.map(j=>({...j,link:ze+H+ie}))||[]]}),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...N.settings,...Be}}),X(j=>({...j,settings:{...j.settings,...Be}})),l.setFieldValue(Ve,ze+H+ie),Pe.focus(),setTimeout(()=>{Pe.selectionStart=We.start,Pe.selectionEnd=We.start+H.length},400),ae(!0)}},be=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{be?.items?.length&&se(r.mapMargeTags(be.items))},[be,se]);const K=(H,Re)=>{if(xe(!1),H){const Pe=be.syntax.length>1?de.findIndex(He=>He.key===Re[0].key):0,Ne=be.syntax[Pe].replace("%value%",H[H.length-1]),Ve=`selected_${N.type}_form${N.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(He=>q?.getAttribute("id").includes(`${Ve}_${He}`))||q?.getAttribute("id").includes(ge)?ue(Ne,q?.getAttribute("id")):(l.setFieldValue("imgReplacer",Ne),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...N.settings,imgReplacer:Ne}}),X(He=>({...He,settings:{...He.settings,imgReplacer:Ne}})))}},G=r.useRootElement();(0,n.useEffect)(()=>{const H=({target:Ne})=>{Ne.closest('[id="merge_tags_wrapper"]')||re(Ne)},Re=({target:Ne})=>{!Ne.closest(".merge-tags")&&!Ne.closest("#merge_tags_button")&&xe(!1)},Pe=new fo.Disposable;return Pe.addDisposable(r.addWindowListenerFromShadow(G,"focusin",H)),Pe.addDisposable(r.addWindowListenerFromShadow(G,"click",Re)),()=>{Pe.dispose()}},[G]);const Q=(H,Re)=>Re.some(Pe=>Pe.label.toLowerCase().indexOf(H.toLowerCase())>-1),ne=(H,Re)=>{const Pe=Re.map((Ne,Ve)=>{const He=Ne.label.split(new RegExp(`(${H})`,"gi"));return(0,o.jsxs)("span",{children:[Ve!==0&&(0,o.jsx)("span",{children:" / "}),He.map((ze,ie)=>ze.toLowerCase()===H.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:ze},ie):ze)]},Ne.value)});return(0,o.jsx)("div",{title:Re.map(Ne=>Ne.label).join(" / "),children:Pe})};(0,n.useEffect)(()=>{const H=l?.getFieldsValue(!0);I(H)},[l]);const _e=({target:H})=>{if(H&&!Ie){const{selectionStart:Re,selectionEnd:Pe}=H;ve({start:Re,end:Pe})}ae(!1)};(0,n.useEffect)(()=>{if(N.settings){const H=N.settings,Re=Ti(H);l?.setFieldsValue(Re),I(Re),H.link&&P(Ft(H.link,"https://")),u(H.borderRadius?.all)||(u(H.borderRadius?.topLeft)||u(H.borderRadius?.bottomLeft)||u(H.borderRadius?.topRight)||u(H.borderRadius?.bottomRight)?k(!1):u(H.borderRadius?.all)||k(!0)),u(H.mobileBorderRadius?.topLeft)||u(H.mobileBorderRadius?.bottomLeft)||u(H.mobileBorderRadius?.topRight)||u(H.mobileBorderRadius?.bottomRight)?p(!1):p(!0),g(!!H.borderRadius?.all||!!H.borderRadius?.topLeft||!!H.borderRadius?.bottomLeft||!!H.borderRadius?.topRight||!!H.borderRadius?.bottomRight),y(!!H.mobileBorderRadius?.all||!!H.mobileBorderRadius?.topLeft||!!H.mobileBorderRadius?.bottomLeft||!!H.mobileBorderRadius?.topRight||!!H.mobileBorderRadius?.bottomRight)}},[l,N]);const fe=H=>{const Re=Lr(N.settings,l,H);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:Re.caption,settings:Re}),V({...N.settings,...Re}),X(Pe=>({...Pe,settings:{...Pe.settings,...Re}}))},Ae=(H,Re)=>{const Pe=r.stripEmVersionFromUrlString(N.settings?.src||"")===r.stripEmVersionFromUrlString(H||"");(!Pe||H!==N.settings?.src)&&fe({src:H}),Re?.mode==="save"&&Pe&&(R(Ne=>({name:"src",counter:Ne.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(H)}))},je=async H=>{const Re=N.settings?.src||"",Pe=r.stripEmVersionFromUrlString(Re),Ne=await c({kind:"img",currentUrl:gt(Pe)?"":Pe,entryModal:H});Ne?.url&&Ae(Ne.url,Ne.meta)},Oe=H=>{const Re=H.data.operation;Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_AI):Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):Re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Re===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage(Oe);const Y=()=>{setTimeout(()=>{g(H=>!H),l.setFieldValue("borderRadiusAll",S?0:5),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...N.settings,borderRadius:{all:S?"":5}}}),X(H=>({...H,settings:{...H.settings,borderRadius:{all:S?null:5}}}))})},oe=H=>{l.setFieldValue("link",H!=="mergetag"?H:""),P(H)},we=()=>{const{width:H,height:Re,renderedWidth:Pe,renderedHeight:Ne}=N?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Ve={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:H.value,dim:"px"},height:{value:Re.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Pe,renderedHeight:Ne,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},He=[...N?.settings?.carouselImages,Ve];a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...N.settings,carouselImages:He}});const ze=El(He);X(ie=>({...ie,settings:{...ie.settings,carouselImages:ze}}))};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:Un,onValuesChange:fe,autoComplete:"off",className:"element-controls",children:[!ce&&(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)(Tl,{})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Sl,{form:l,elementSettings:N,formFields:w,setElementSettings:X,borderRadiusShow:S,oneBorderRadiusValue:x,setOneBorderRadiusValue:k,linkProtocol:v,mergeTagItems:de,mergeMenuOpen:me,setMergeMenuOpen:xe,cascaderRef:pe,handleLinkProtocolsChange:oe,handleSelect:_e,onChange:K,filter:Q,renderSearchOption:ne,toggleShowBorderRadiusHandler:Y,setNewSlide:we})})]})};Rl.propTypes={};var zn={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},yl=({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,x]=(0,n.useState)(e);e!==b&&(x(e),m(e)),(0,n.useEffect)(()=>{if(c.settings){const S=c.settings,g=Ti(S);s?.setFieldsValue(g)}},[s,c]);const k=S=>{const g=Lr(c.settings,s,S);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:g.caption,settings:g}),m(E=>({...E,settings:{...E.settings,...g}}))},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(g=>({...g,settings:{...g.settings,sections:c.settings.sections?.filter((E,y)=>y!==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:zn,onValuesChange:k,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,g)=>(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 ")+(g+1)}),(0,o.jsx)(t.ui_kit$Form.Item,{name:`expanded_${g}`,valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:`expanded_${g}`,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(g)})})]},`expanded_${g}`))})}),(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"})]})})};yl.propTypes={};var{Text:Gn}=t.ui_kit$Typography,Yn="em",wl="text/plain",Xn=(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),Kn=(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 qn=/^[a-z][a-z0-9+.-]*:/i;function jl(e){const i=et(typeof e=="string"?e:String(e??""));return i?qn.test(i)?i:`https://${i}`:""}function Jn(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 Qn(e){const i=jl(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 vl(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 Zn(){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 ed(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 Il(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 Cl(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 od(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return!s||l&&s===l?"":s}function td(e,i,l){const s=String(e??"").trim(),a=String(i??"").trim(),d=String(l??"").trim();return d&&(!s||d!==s)?d:a}function id(e,i){return(e||[]).map(l=>({...l,itemBorderColor:l.customIcon?"":i}))}function rd(e,i,l){return(e||[]).map(s=>({...s,buttonBgColor:s.customIcon?"":td(i,l,s.buttonBgColor)}))}function ld(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 Pl({__: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:"",x=typeof m.title=="string"?m.title:"",[k,h]=(0,n.useState)(!1),[p,S]=(0,n.useState)(!1),g=(0,n.useRef)(null),E=(0,n.useRef)(null),y=(0,n.useMemo)(()=>({clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,n.useEffect)(()=>{b.trim()&&h(!0)},[b]);const v=!!(b.trim()||k),P=!!(x.trim()||p),w=v||P;(0,n.useLayoutEffect)(()=>{a(l,{alt:v,title:P})},[v,l,a,P]);const I=(0,n.useMemo)(()=>({marginBottom:w?d.formItemMarginBottomXS:0}),[w,d.formItemMarginBottomXS]),N=(0,n.useMemo)(()=>[l,"alt"],[l]),X=(0,n.useMemo)(()=>[l,"title"],[l]),V=w?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",F=v?"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",z=(0,n.useMemo)(()=>b.trim()?b.trim():e("Alternative text"),[e,b]),ee=(0,n.useMemo)(()=>x.trim()?x.trim():e("Tooltip text"),[e,x]),R=(0,n.useMemo)(()=>(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":v}),[v]),q=(0,n.useMemo)(()=>(0,Ue.default)("selected-td-form__button",{"selected-td-form__button--active":P}),[P]),re=(0,n.useCallback)(me=>{setTimeout(()=>{const xe=me.current;if(xe){if(typeof xe.focus=="function"){xe.focus();return}xe.input&&typeof xe.input.focus=="function"&&xe.input.focus()}},0)},[]),de=(0,n.useCallback)(()=>{v?(h(!1),b.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(h(!0),re(g))},[v,b,l,re,i,s]),se=(0,n.useCallback)(()=>{if(P)a(l,{title:!1}),S(!1),x.trim()&&(i.setFieldValue(["items",l,"title"],""),setTimeout(()=>s(),0));else{S(!0),a(l,{title:!0});const me=b.trim();i.setFieldValue(["items",l,"title"],me),setTimeout(()=>s(),0),re(E)}},[b,l,re,i,a,s,P,x]);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:I,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:z,placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:R,onClick:de,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:ee,placement:"bottom",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:q,onClick:se,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:V,children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:N,className:F,children:(0,o.jsx)(t.ui_kit$Input,{ref:g,placeholder:e("Alternative text"),allowClear:y,prefix:Xn})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:X,className:$,children:(0,o.jsx)(t.ui_kit$Input,{ref:E,placeholder:e("Social network name"),allowClear:y,prefix:Kn})})]})]})}Pl.propTypes={__:f.default.func.isRequired,form:f.default.object.isRequired,fieldName:f.default.oneOfType([f.default.number,f.default.string]).isRequired,pushSettingsToIframe:f.default.func.isRequired,onMetaActiveChange:f.default.func.isRequired};function sd(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 ad(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=ed(e),l=String(e?.hostCellBgForIconLuminance??"").trim(),s=sd(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:Cl(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),x=c.platform&&!m?r.getSocialIconForBlockCell(c.platform,zt(i,b,l)):null;return{...c,customIcon:m,title:String(c.title??"").trim(),...x?{iconSrc:x}:{},iconWidth:null,iconHeight:null,buttonBgColor:b,itemBorderColor:m?"":String(c.itemBorderColor??"").trim()}}):[]}}var Al=({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,x]=(0,n.useState)(e),[k,h]=(0,n.useState)(null),[p,S]=(0,n.useState)(null),g=(0,n.useRef)(null),E=(0,n.useRef)(null),y=(0,n.useRef)(null),v=(0,n.useRef)(Il(e)),P=r.useSelector(r.selectEmailSettings),w=(0,n.useRef)(null),I=(0,n.useRef)(!1),N=(0,n.useRef)(""),X=(0,n.useRef)({}),V=Zn(),F=P?.usedColors??[],$=t.ui_kit$Form.useWatch("items",a)||[],z=(0,n.useCallback)(()=>{w.current&&(document.removeEventListener("dragover",w.current,!0),w.current=null)},[]),ee=(0,n.useCallback)(()=>{if(w.current)return;const Y=oe=>{oe.preventDefault(),oe.dataTransfer&&(oe.dataTransfer.dropEffect="move")};document.addEventListener("dragover",Y,!0),w.current=Y},[]),R=(0,n.useMemo)(()=>r.getSocialPresetsForBrand(Yn).filter(Y=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[Y.id]),[]),q=(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,V),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(Y.labelMsgid)})]})})),[i,R,V]),re=(0,n.useCallback)((Y,oe)=>{X.current={...X.current,[Y]:{...X.current[Y],...oe}}},[]);(0,n.useEffect)(()=>{const Y=Il(e);v.current!==Y&&(v.current=Y,X.current={},x(e))},[e]);const de=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(b?.settings){if(de.current){de.current=!1;return}const Y=b.settings;N.current=Y.bgEnabled&&Y.bgColor?String(Y.bgColor).trim():"",a.setFieldsValue(ad(b.settings))}},[b,a]),(0,n.useEffect)(()=>()=>z(),[z]);const se=(0,n.useCallback)(()=>{const Y=a.getFieldsValue(!0),oe=b.settings||{},we=String(oe.hostCellBgForIconLuminance??"").trim(),H=(Y.globalBgColor||"").trim(),Re=typeof Y.iconSize=="number"&&!Number.isNaN(Y.iconSize)?Y.iconSize:oe.iconSize??40,Pe=typeof Y.borderRadius=="number"&&!Number.isNaN(Y.borderRadius)?Y.borderRadius:oe.borderRadius??0,Ne=typeof Y.gap=="number"&&!Number.isNaN(Y.gap)?Y.gap:oe.gap??8,Ve={blockBgEnabled:!!H,blockBgColor:H},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 ie={...oe,type:"social",align:Y.align??oe.align??"center",iconSize:Re,borderRadius:Pe,gap:Ne,bgEnabled:!!H,bgColor:H,hostCellBgForIconLuminance:we,borderWidth:typeof oe.borderWidth=="number"?oe.borderWidth:0,borderColor:typeof oe.borderColor=="string"?oe.borderColor:"",buttonBorderColor:"",buttonBorderWidth:ze,showLabel:Y.showLabel,items:(Y.items||[]).filter(Boolean).map((Be,j)=>{const Z=!!Be.customIcon,ye=X.current[j]||{},Ce=Z?"":od(H,(Be.buttonBgColor||"").trim()),De=typeof Be.href=="string"?jl(Be.href):Be.href,Ye=Z?"":Gt(H,Ce),qe=!Z&&Be.platform?r.getSocialIconForBlockCell(Be.platform,zt(Ve,Ye,we)):null,M=Z?"":He||String(Be.itemBorderColor??"").trim(),O=Jn(Z?Be.iconSrc||"":qe||Be.iconSrc||"");return{...Be,customIcon:Z,href:De,iconSrc:O,iconWidth:null,iconHeight:null,buttonBgColor:Ce,itemBorderColor:M,title:ye.title?String(Be.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:b.caption,settings:ie}),N.current=H,de.current=!0,x(Be=>({...Be,settings:ie}))},[b.caption,b.settings,a,d]),me=(0,n.useCallback)(Y=>{if(Y==null||Y==="")return-1;const oe=r.stripEmVersionFromUrlString(String(Y));return(a.getFieldValue("items")||[]).findIndex(we=>r.stripEmVersionFromUrlString(we&&we.iconSrc||"")===oe)},[a]),xe=(0,n.useCallback)((Y,oe,we,H)=>{const Re=[...a.getFieldValue("items")||[]];if(Y<0||Y>=Re.length)return;const Pe=r.stripEmVersionFromUrlString(String(H||""))===r.stripEmVersionFromUrlString(String(oe||""));(!Pe||oe!==Re[Y]?.iconSrc)&&(Re[Y]={...Re[Y],iconSrc:oe,customIcon:!0,buttonBgColor:"",itemBorderColor:""},a.setFieldValue("items",Re),setTimeout(()=>se(),0)),we?.mode==="save"&&Pe&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(oe)})},[a,se,c]),Ie=(0,n.useCallback)(async(Y,oe)=>{const we=r.stripEmVersionFromUrlString(String(oe||"")),H=me(oe);if(H<0)return;const Re=(a.getFieldValue("items")||[])[H]?.iconSrc,{entryModal:Pe,currentUrl:Ne,imageDataUrl:Ve}=await vl(we,Y),He=await m({kind:"img",currentUrl:Ne,entryModal:Pe,imageDataUrl:Ve});He?.url&&xe(H,He.url,He.meta,Re)},[xe,me,a,m]),ae=(0,n.useCallback)(async Y=>{const oe=(a.getFieldValue("items")||[])[Y];if(!oe)return;const{entryModal:we,currentUrl:H,imageDataUrl:Re}=await vl(r.stripEmVersionFromUrlString(String(oe.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),Pe=oe.iconSrc,Ne=await m({kind:"img",currentUrl:H,entryModal:we,imageDataUrl:Re});Ne?.url&&xe(Y,Ne.url,Ne.meta,Pe)},[xe,a,m]),We=(0,n.useCallback)(Y=>{const oe=parseInt(Y.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(oe)||ae(oe)},[ae]),ve=(0,n.useCallback)(Y=>{const oe=Y.data?.operation,we=Y.data?.src;oe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Ie(r.MODALS.UPLOAD_IMAGE_MODAL_AI,we):oe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Ie(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,we):oe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Ie(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,we):oe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Ie(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,we):oe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Ie(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,we):oe===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,Ie]);r.useListenPostMessage(ve);const pe=(0,n.useCallback)(()=>{const Y=a.getFieldValue("items")||[],oe=R[0],we=(a.getFieldValue("globalItemBorderColor")||"").trim(),H=(a.getFieldValue("globalBgColor")||"").trim();if(!oe)a.setFieldsValue({items:[...Y,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:H,itemBorderColor:we}]});else{const Re=String(b?.settings?.hostCellBgForIconLuminance??"").trim(),Pe=Gt(H,H),Ne=r.getSocialIconForBlockCell(oe.id,zt({blockBgEnabled:!!H,blockBgColor:H},Pe,Re)),Ve=i(oe.labelMsgid);a.setFieldsValue({items:[...Y,{platform:oe.id,customIcon:!1,href:"",alt:Ve,title:"",iconSrc:Ne,iconWidth:null,iconHeight:null,buttonBgColor:H,itemBorderColor:we}]})}setTimeout(()=>se(),0)},[i,b?.settings?.hostCellBgForIconLuminance,a,R,se]),ge=(0,n.useCallback)((Y,oe)=>{Y.dataTransfer.setData(wl,String(oe)),Y.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(oe)),Y.dataTransfer.effectAllowed="move",g.current=oe,h(oe),ee()},[ee]),le=(0,n.useCallback)(()=>{z(),g.current=null,h(null),S(null)},[z]),te=(0,n.useCallback)((Y,oe,we)=>{if(we<2)return;Y.preventDefault(),Y.dataTransfer.dropEffect="move";const H=g.current;H!==null&&H!==oe&&S(oe)},[]),ce=(0,n.useCallback)((Y,oe)=>{Y.currentTarget.contains(Y.relatedTarget)||S(we=>we===oe?null:we)},[]),ue=(0,n.useCallback)((Y,oe,we)=>{Y.preventDefault(),S(null);const H=Y.dataTransfer.getData(wl),Re=parseInt(H,10);if(Number.isNaN(Re)||Re===oe){z();return}we(Re,oe),z(),setTimeout(()=>se(),0)},[z,se]),be=(0,n.useCallback)(Y=>{const oe=Y.currentTarget,we=parseInt(oe.dataset.itemIndex??"",10);Number.isNaN(we)||ge(Y,we)},[ge]),K=(0,n.useCallback)(Y=>{const oe=Y.currentTarget,we=parseInt(oe.dataset.itemIndex??"",10),H=parseInt(oe.dataset.listLength??"",10);Number.isNaN(we)||Number.isNaN(H)||H<2||(Y.preventDefault(),Y.dataTransfer&&(Y.dataTransfer.dropEffect="move"))},[]),G=(0,n.useCallback)(Y=>{const oe=Y.currentTarget,we=parseInt(oe.dataset.itemIndex??"",10),H=parseInt(oe.dataset.listLength??"",10);Number.isNaN(we)||Number.isNaN(H)||te(Y,we,H)},[te]),Q=(0,n.useCallback)(Y=>{const oe=parseInt(Y.currentTarget.dataset.itemIndex??"",10);Number.isNaN(oe)||ce(Y,oe)},[ce]),ne=(0,n.useCallback)(Y=>{const oe=parseInt(Y.currentTarget.dataset.itemIndex??"",10),we=E.current;Number.isNaN(oe)||typeof we!="function"||ue(Y,oe,we)},[ue]),_e=(0,n.useCallback)(Y=>{Y.stopPropagation();const oe=parseInt(Y.currentTarget.dataset.fieldName??"",10),we=y.current;Number.isNaN(oe)||typeof we!="function"||(we(oe),queueMicrotask(se))},[se]),fe=(0,n.useCallback)((Y,oe)=>{const we=R.find(ie=>ie.id===oe);if(!we)return;const H=i(we.labelMsgid),Re=X.current[Y]||{},Pe=String(a.getFieldValue(["items",Y,"alt"])??"").trim();(Re.alt||Pe)&&a.setFieldValue(["items",Y,"alt"],H),Re.title&&a.setFieldValue(["items",Y,"title"],H);const Ne=(a.getFieldValue("globalBgColor")||"").trim(),Ve=Gt(Ne,(a.getFieldValue(["items",Y,"buttonBgColor"])||"").trim()),He=String(b?.settings?.hostCellBgForIconLuminance??"").trim(),ze=r.getSocialIconForBlockCell(oe,zt({blockBgEnabled:!!Ne,blockBgColor:Ne},Ve,He));ze&&(a.setFieldValue(["items",Y,"customIcon"],!1),a.setFieldValue(["items",Y,"iconSrc"],ze))},[i,b?.settings?.hostCellBgForIconLuminance,a,R]),Ae=(0,n.useCallback)(Y=>{if(Object.prototype.hasOwnProperty.call(Y,"globalItemBorderColor")){if(!I.current){const oe=String(Y.globalItemBorderColor??"").trim(),we=a.getFieldValue("items")||[];a.setFieldsValue({items:id(we,oe)})}}else if(Object.prototype.hasOwnProperty.call(Y,"globalBgColor")){const oe=N.current,we=String(Y.globalBgColor??"").trim(),H=a.getFieldValue("items")||[];a.setFieldsValue({items:rd(H,oe,we)})}else if(Y?.items!=null){const oe=a.getFieldValue("items")||[],we=Cl(oe);we!==(a.getFieldValue("globalItemBorderColor")||"").trim()&&(I.current=!0,a.setFieldValue("globalItemBorderColor",we),queueMicrotask(()=>{I.current=!1}));const H=b.settings?.items||[];oe.forEach((Re,Pe)=>{const Ne=Re?.platform,Ve=H[Pe]?.platform;Ne&&Ne!==Ve&&fe(Pe,Ne)})}ld(Y?.items,fe),se()},[b.settings?.items,a,se,fe]),je=(0,n.useCallback)((Y,oe)=>{if(a.setFieldValue(Y,oe),Array.isArray(Y)&&Y[0]==="items"){Ae({items:{[Y[1]]:{[Y[2]]:oe}}});return}Ae({[Y]:oe})},[a,Ae]),Oe=(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:je})})})})]}),(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:je})})})})]})]}),(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:oe,move:we})=>(E.current=we,y.current=oe,(0,o.jsx)("div",{className:"selected-social-form__items",children:Y.map((H,Re)=>{const Pe=!!($[Re]?.customIcon??$[H.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,Ue.default)("selected-social-form__card",k===Re&&"selected-social-form__card--dragging",p===Re&&k!==Re&&"selected-social-form__card--drag-over"),"data-item-index":Re,"data-list-length":Y.length,onDragEnterCapture:K,onDragOverCapture:G,onDragLeave:Q,onDropCapture:ne,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":Re,onDragStart:be,onDragEnd:le,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)(Gn,{className:"selected-social-form__card-title",children:[i("Button")," ",Re+1]})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":H.name,onClick:_e})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[H.name,"iconSrc"],hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[H.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:[H.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:q,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,o.jsx)(r.EmIcons,{icon:"ChevronDownCustom",component:t.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:Po,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":Re,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:We})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[H.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Ne,Ve)=>{const He=typeof Ve=="string"?Ve.trim():String(Ve??"").trim();if(He&&!Qn(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,{})}})}),Pe?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:[H.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Wt,{form:a,name:["items",H.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:F,onColorChange:je})})})}),(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:[H.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Wt,{form:a,name:["items",H.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:F,onColorChange:je})})})})]}),(0,o.jsx)(Pl,{__:i,form:a,fieldName:H.name,pushSettingsToIframe:se,onMetaActiveChange:re})]},H.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:pe,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:Ae,autoComplete:"off",children:(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:Oe})})})};Al.propTypes={elementSettings:f.default.shape({settings:f.default.object,type:f.default.string,caption:f.default.string})};var Nl=r.BASIC_BORDER_COLOR,nd=(e,i,l,s,a,d,c="")=>{const m=e.getFieldsValue(!0),b=i?"cell_":c;setTimeout(()=>{i?s(x=>!x):l(x=>!x),a&&(m[b+"borderWidth"]=null,m[b+"borderColor"]="",m[b+"borderStyle"]=""),d(x=>({...r.RESET_BORDER_PARAMS,[m[b+"borderPosition"]]:{...x[m[b+"borderPosition"]],width:m[b+"borderWidth"],color:m[b+"borderColor"],style:m[b+"borderStyle"]}}))})},dd=(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=Nl,a(b=>({...s,[m?.mobileBorderPosition]:{color:Nl,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}}}})})},cd=(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"]}}})})},ud=(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}-`}}})})})},md=(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}}})})},pd=(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-"}}})})},hd=(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-"}}})})},bd=e=>{setTimeout(()=>{e(i=>!i)})},fd=(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)})},gd=(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}}}))})},_d=(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}}}))},xd=e=>{setTimeout(()=>{e(i=>!i)})},kd=(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)},Ed=({form:e,onBorderSideClear:i,formName:l,elementSettings:s,formValues:a,isMacOS:d,__:c,token:m,appConfig:b,typografItems:x,backgroundRepeatOptions:k,backgroundSizeOptions:h,sendAction:p,handleToggleShowPaddingCell:S,handleTogglePaddingCell:g,handleToggleBackground:E,handleToggleBorder:y,handleToggleBorderRadius:v,paddingCellShow:P,paddingsExt:w,backgroundShow:I,cellBordersShow:N,borderRadiusShow:X,oneBorderRadiusValue:V,setOneBorderRadiusValue:F,textInputRef:$,linkProtocol:z,handleLinkProtocolsChange:ee,backgroundImageEmpty:R})=>{const q=W.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:x},trigger:["hover"],placement:"bottom",getPopupContainer:re=>re.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:re=>re.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:q,getPopupContainer:re=>re.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:z==="#",__: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:z,handleLinkProtocolsChange:ee,__:c}),allowClear:!0,placeholder:c("Hyperlink URL"),autoFocus:s?.customTable?.isNewLink,prefix:(0,o.jsx)(Jo,{linkProtocol:z})})})})]})}),(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:re=>re.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:re=>re.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:w,onToggleExtended:g,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:I,onToggle:E,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:k,backgroundSizeOptions:h,imageUploadSlot:(b.formTableFieldBackgroundImageEnabled,void 0)})}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Borders"),collapsible:!0,open:N,onToggle:y,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,namePrefix:"cell_"})}),b.formFieldBorderRadiusEnabled&&!1]})},Ll=({form:e,onBorderSideClear:i,elementSettings:l,paddingShow:s,paddingsExt:a,backgroundShow:d,bordersShow:c,borderRadiusShow:m,boxShadowShow:b,handleToggleShowPadding:x,handleTogglePadding:k,handleToggleBackground:h,handleToggleBorder:p,handleToggleBorderRadius:S,handleToggleBoxShadow:g,backgroundRepeatOptions:E,backgroundSizeOptions:y,backgroundImageEmpty:v,oneBorderRadiusValue:P,setOneBorderRadiusValue:w,boxShadow:I})=>{const{__:N}=r.useI18n(),X=r.useAppConfig(),{token:V}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:N("Padding"),collapsible:!0,open:s,onToggle:x,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:a,onToggleExtended:k,gutter:V.marginSM,labels:{horizontal:N("Horizontal padding"),vertical:N("Vertical padding"),left:N("Left padding"),right:N("Right padding"),top:N("Top padding"),bottom:N("Bottom padding"),individual:N("Individual padding")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:N("Background"),collapsible:!0,open:d,onToggle:h,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:X.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:v,usedColors:l.usedColors,colorPlaceholder:N("Background color"),horizontalPositionPlaceholder:N("Horizontal position"),horizontalPositionTooltip:N("Horizontal position"),verticalPositionPlaceholder:N("Vertical position"),verticalPositionTooltip:N("Vertical position"),backgroundRepeatTooltip:N("Background image repeat"),backgroundSizeTooltip:N("Background image size"),selectPlaceholder:N("Please choose"),backgroundRepeatOptions:E,backgroundSizeOptions:y,imageUploadSlot:X.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Ao,{form:e,label:N("Background image"),name:"backgroundImage",tooltipTitle:N("Background image"),placeholder:N("Background image link/route")}):void 0}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:N("Borders"),collapsible:!0,open:c,onToggle:p,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,onBorderSideClear:i})}),X.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:N("Border radius"),collapsible:!0,open:m,onToggle:S,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:P,setOneBorderRadiusValue:w,elementSettings:l})}),X.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:N("Box shadow"),collapsible:!0,open:b,onToggle:g,dividerTop:!0,children:(0,o.jsx)(jo,{})}),X.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:N("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:l,form:e})})]})};Ll.propTypes={form:f.default.object.isRequired,onBorderSideClear:f.default.func,elementSettings:f.default.object.isRequired,paddingShow:f.default.bool,paddingsExt:f.default.bool,backgroundShow:f.default.bool,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,handleToggleShowPadding:f.default.func,handleTogglePadding:f.default.func,handleToggleBackground:f.default.func,handleToggleBorder:f.default.func,handleToggleBorderRadius:f.default.func,handleToggleBoxShadow:f.default.func,backgroundRepeatOptions:f.default.array,backgroundSizeOptions:f.default.array,backgroundImageEmpty:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,boxShadow:f.default.object};var Ol=({form:e,elementSettings:i,mobileSizeShow:l,mobileBackgroundShow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:m,handleToggleMobileBackground:b,handleToggleMobileBorder:x,handleToggleMobileBorderRadius:k,handleToggleMobileBoxShadow:h,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:S,mobileBorders:g,mobileBoxShadow:E})=>{const{__:y,_x:v}=r.useI18n(),P=r.useAppConfig(),{token:w}=(0,t.ui_kit$useToken)(),I=r.useSelector(r.selectEmailSettings);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:y("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:y("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:w.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:w.formItemMarginBottomXS*2},children:(0,o.jsx)(t.ui_kit$Tooltip,{title:y("Height"),placement:"bottom",children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:y("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:y("Borders"),collapsible:!0,open:a,onToggle:x,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:g,usedColors:I.usedColors,labels:{color:y("Color"),width:v("Width","border"),none:y("None"),solid:y("Solid"),dashed:y("Dashed"),dotted:y("Dotted"),above:y("Above"),below:y("Below"),onLeft:y("On the left"),onRight:y("On the right"),around:y("Around"),usedColors:y("Used"),recommendedColors:y("Recommended")}})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Border radius"),collapsible:!0,open:d,onToggle:k,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:y("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:y("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})})]})};Ol.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,handleToggleMobileSize:f.default.func,handleToggleMobileBackground:f.default.func,handleToggleMobileBorder:f.default.func,handleToggleMobileBorderRadius:f.default.func,handleToggleMobileBoxShadow:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,mobileBorders:f.default.object,mobileBoxShadow:f.default.object};var Bd=({form:e,onBorderSideClear:i,elementViewType:l,mobileViewActive:s,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:m,bordersShow:b,borderRadiusShow:x,boxShadowShow:k,mobileSizeShow:h,mobileBackgroundShow:p,mobileBordersShow:S,mobileBorderRadiusShow:g,mobileBoxShadowShow:E,handleToggleShowPadding:y,handleTogglePadding:v,handleToggleBackground:P,handleToggleBorder:w,handleToggleBorderRadius:I,handleToggleBoxShadow:N,handleToggleMobileSize:X,handleToggleMobileBackground:V,handleToggleMobileBorder:F,handleToggleMobileBorderRadius:$,handleToggleMobileBoxShadow:z,backgroundRepeatOptions:ee,backgroundSizeOptions:R,backgroundImageEmpty:q,oneBorderRadiusValue:re,setOneBorderRadiusValue:de,oneMobileBorderRadiusValue:se,setOneMobileBorderRadiusValue:me,boxShadow:xe,mobileBorders:Ie,mobileBoxShadow:ae})=>(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)(Ol,{form:e,elementSettings:a,mobileSizeShow:h,mobileBackgroundShow:p,mobileBordersShow:S,mobileBorderRadiusShow:g,mobileBoxShadowShow:E,handleToggleMobileSize:X,handleToggleMobileBackground:V,handleToggleMobileBorder:F,handleToggleMobileBorderRadius:$,handleToggleMobileBoxShadow:z,oneMobileBorderRadiusValue:se,setOneMobileBorderRadiusValue:me,mobileBorders:Ie,mobileBoxShadow:ae})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Ll,{form:e,onBorderSideClear:i,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:m,bordersShow:b,borderRadiusShow:x,boxShadowShow:k,handleToggleShowPadding:y,handleTogglePadding:v,handleToggleBackground:P,handleToggleBorder:w,handleToggleBorderRadius:I,handleToggleBoxShadow:N,backgroundRepeatOptions:ee,backgroundSizeOptions:R,backgroundImageEmpty:q,oneBorderRadiusValue:re,setOneBorderRadiusValue:de,boxShadow:xe})})}),Sd=["borderTop","borderBottom","borderLeft","borderRight"],$l=({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),x=r.useSelector(r.selectIsCodeMode),k=r.useSelector(r.selectCodeModeDirection),[h,p]=(0,n.useState)({}),[S,g]=(0,n.useState)(!0),[E,y]=(0,n.useState)({}),[v,P]=(0,n.useState)({}),[w,I]=(0,n.useState)(!0),[N,X]=(0,n.useState)(e.customTable?.backgroundImage[0].value===""),[V,F]=(0,n.useState)(),[$,z]=(0,n.useState)(!1),[ee,R]=(0,n.useState)(!1),[q,re]=(0,n.useState)(!1),[de,se]=(0,n.useState)(!1),[me,xe]=(0,n.useState)(!1),[Ie,ae]=(0,n.useState)(!1),[We,ve]=(0,n.useState)(!1),[pe,ge]=(0,n.useState)(!1),[le,te]=(0,n.useState)(!0),[ce,ue]=(0,n.useState)(!0),[be,K]=(0,n.useState)(!0),[G,Q]=(0,n.useState)(!1),[ne,_e]=(0,n.useState)("https://"),[fe,Ae]=(0,n.useState)({}),[je,Oe]=(0,n.useState)(!1),[Y,oe]=(0,n.useState)(!1),[we,H]=(0,n.useState)(!1),[Re,Pe]=(0,n.useState)({}),Ne=(0,n.useRef)(null),Ve=(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"}],ie=[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],Be={width:"",style:"",color:""},j=x&&k!=="bottom",Z=r.BASIC_BORDER_COLOR,ye=i==="Edit selected table cells"||!1,[Ce,De]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&De(!0)},[]);const Ye=L=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:L,locale:"ru_RU"})},qe=[{key:"1",label:l("This element"),onClick:()=>Ye("typograf")},{key:"2",label:l("The whole email"),onClick:()=>Ye("typograf_all")}];let M="";(0,n.useEffect)(()=>{if(e){Et(e)&&ge(!0);const L=e.border,B=e.boxShadow,J=e.customTable?.mobileBorder,Se=e.customTable?.mobileBoxShadow,Ke=e.customTable?.cellBorders;Pe(L),p(B),y(J),P(Se),Ae(Ke);const Fe=ye?e?.customTable?.cell_borderPosition:e?.customTable?.borderPosition,no=Object.keys(J).find(ko=>J[ko]?.width||J[ko]?.style||J[ko]?.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:no||"all",mobileBorderWidth:J[no]?.width!==null?J[no]?.width:"",mobileBorderColor:J[no]?.color||"",mobileBorderStyle:J[no]?.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:Fe||"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:po(e.customTable?.mobileWidth?.value),mobileWidthDim:e.customTable?.mobileWidth?.dim,mobileHeight:po(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))?g(!1):g(!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)?I(!1):I(!0),X(e.customTable?.backgroundImage[0].value===""),F(ko=>L[Fe]?.width||L[Fe]?.style||L[Fe]?.color?!0:ko),R(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),se(!!e.boxShadow),H(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),ae(!!e.customTable?.mobileWidth.value),oe(!!e.exportAsPicture)}},[a,e]),(0,n.useEffect)(()=>{const L=a.getFieldValue("linkHref");typeof e.customTable?.linkHref=="string"&&Oe(!0),Ne&&!L&&(Oe(!1),a.setFieldsValue({linkHref:null})),Ne.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 O=L=>{a.setFieldValue("linkHref",L!=="mergetag"?L:""),_e(L)},T=L=>{const B=a.getFieldsValue(!0),J=Object.keys(L)[0];let Se;const Ke=Sd.includes(J)&&B[J]?{...B[J],width:B[J].width===""?B.borderAll?.width||"1":B[J].width,color:B[J].color===""?B.borderAll?.color||Z:B[J].color,style:B[J].style===""?B.borderAll?.style||"solid":B[J].style}:null,Fe=["top","right","bottom","left"],no="em-mob-border_",ko=Bo=>({...r.RESET_BORDER_PARAMS[Bo],classNamePrefix:`${no}${Bo}-`}),Xo=(Bo,ao,yo,Ko)=>Fe.reduce((xo,Do)=>(xo[Do]={...Bo,[yo]:Do===ao?Ko:Bo[yo],classNamePrefix:`${no}${Do}-`},xo),{}),Co=(Bo,ao,yo,Ko)=>{const xo=Ko.mobileBorderPosition,Do=xo==="all",It=ao===""||ao==null;let No;Do?No={all:{...yo.all,[Bo]:It?null:ao,classNamePrefix:`${no}all-`},...Fe.reduce((ni,Ct)=>({...ni,[Ct]:ko(Ct)}),{})}:It?No={...yo,[xo]:ko(xo),all:{...r.RESET_BORDER_PARAMS.all}}:yo.all?.color!=null&&yo.all?.width!=null&&yo.all?.style!=null?No={...Xo(yo.all,xo,Bo,ao),all:{...r.RESET_BORDER_PARAMS.all}}:No={...yo,[xo]:{...yo[xo],[Bo]:ao,classNamePrefix:`${no}${xo}-`},all:{...r.RESET_BORDER_PARAMS.all}};const rt=Do?No.all:No[xo],ai={mobileBorderColor:rt?.color??Z,mobileBorderWidth:rt?.width??1,mobileBorderStyle:rt?.style??"solid"};return{newBorders:No,sending:{mobileBorder:No},formUpdates:ai}};switch(J){case"exportAsPicture":Se={exportAsPicture:B.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Se={boxShadow:{hOffset:B.boxShadowHOffset,vOffset:B.boxShadowVOffset,blurRadius:B.boxShadowBlurRadius,spreadRadius:B.boxShadowSpreadRadius,color:B.boxShadowColor,inset:B.boxShadowInset}};break;case"width":Se={[J]:{value:L[J],dim:B.widthDim}};break;case"widthDim":Se={width:{value:B.width,dim:L[J]}};break;case"maxWidth":Se={[J]:{value:L[J],dim:B.maxWidthDim}};break;case"maxWidthDim":Se={maxWidth:{value:B.maxWidth,dim:L[J]}};break;case"minWidth":Se={[J]:{value:L[J],dim:B.minWidthDim}};break;case"minWidthDim":Se={minWidth:{value:B.minWidth,dim:L[J]}};break;case"backgroundImage":X(L[J]===""),Se={[J]:[{...e.customTable?.backgroundImage[0],value:L[J]}],backgroundSize:"cover"},a.setFieldsValue({backgroundColor:""});break;case"backgroundColor":X(!0),Se=L,a.setFieldsValue({backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Se={borderRadius:{[W.BORDER_RADIUS_POSITION[J]]:+L[J]}};break;case"mobileWidth":Se={[J]:{classNamePrefix:"em-mob-width-",value:L[J],dim:B.mobileWidthDim}};break;case"mobileWidthDim":Se={mobileWidth:{classNamePrefix:"em-mob-width-",value:B.mobileWidth||100,dim:L[J]}};break;case"mobileHeight":Se={[J]:{classNamePrefix:"em-mob-height-",value:L[J],dim:B.mobileHeightDim}};break;case"mobileBorderStyle":case"mobileBorderColor":case"mobileBorderWidth":const Bo={mobileBorderStyle:"style",mobileBorderColor:"color",mobileBorderWidth:"width"}[J],{newBorders:ao,sending:yo,formUpdates:Ko}=Co(Bo,L[J],E,B);Object.assign(B,Ko),y(ao),Se=yo;break;case"mobileBorderPosition":a.setFieldsValue({mobileBorderWidth:E[L[J]].width||"",mobileBorderColor:E[L[J]].color||"",mobileBorderStyle:E[L[J]].style||""});break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Se={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[J]]:L[J],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[J]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Se={mobileBoxShadow:{hOffset:B.mobileBoxShadowHOffset,vOffset:B.mobileBoxShadowVOffset,blurRadius:B.mobileBoxShadowBlurRadius,spreadRadius:B.mobileBoxShadowSpreadRadius,color:B.mobileBoxShadowColor,inset:B.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Se=xt(L),!Se)return;break;case"mobileAlign":Se={[J]:{classNamePrefix:"em-mob-table_align-",value:L[J]}};break;case"borderPosition":Se=L,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Se});break;case"borderAll":L[J]?.style===""?a.setFieldsValue({borderAll:Be}):a.setFieldsValue({borderTop:Be,borderBottom:Be,borderLeft:Be,borderRight:Be}),Se=L;break;case"borderTop":a.setFieldsValue({borderTop:Ke}),L[J]?.style===""?a.setFieldsValue({borderTop:Be}):a.setFieldsValue({borderAll:Be}),Se=L;break;case"borderBottom":a.setFieldsValue({borderBottom:Ke}),L[J]?.style===""?a.setFieldsValue({borderBottom:Be}):a.setFieldsValue({borderAll:Be}),Se=L;break;case"borderLeft":a.setFieldsValue({borderLeft:Ke}),L[J]?.style===""?a.setFieldsValue({borderLeft:Be}):a.setFieldsValue({borderAll:Be}),Se=L;break;case"borderRight":a.setFieldsValue({borderRight:Ke}),L[J]?.style===""?a.setFieldsValue({borderRight:Be}):a.setFieldsValue({borderAll:Be}),Se=L;break;case"cell_borderPosition":Se=L,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Se});break;case"fontSize":case"lineHeight":if(L[J]===null||L[J]===""||L[J]===void 0)return;Se=L;break;case"linkHref":{const xo=et(L[J]);xo!==L[J]&&a.setFieldValue("linkHref",xo),Se={linkHref:xo},Ho(xo,_e);break}default:Se=L}J!=="borderPosition"&&s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Se})},D=(0,n.useCallback)(()=>{nd(a,ye,F,Q,V,Pe,M)},[a,ye,V,M]),he=(0,n.useCallback)(()=>{dd(a,z,$,E,y,s,e)},[a,$,E,s,e]),$e=(0,n.useCallback)(()=>{cd(a,R,ee,g,s,e,M)},[a,ee,g,s,e,M]),io=(0,n.useCallback)(()=>{ud(a,re,q,s,e)},[a,q,s,e]),Je=(0,n.useCallback)(()=>{md(a,se,de,s,e)},[a,de,s,e]),ro=(0,n.useCallback)(()=>{pd(a,xe,me,s,e)},[a,me,s,e]),oo=(0,n.useCallback)(()=>{hd(a,ae,Ie,s,e)},[a,Ie,s,e]),mo=(0,n.useCallback)(()=>{bd(ve)},[ve]),Eo=(0,n.useCallback)(()=>{fd(a,ge,pe,s,e)},[a,pe,s,e]),Te=(0,n.useCallback)(()=>{gd(a,te,le,s,e)},[a,le,s,e]),C=(0,n.useCallback)(()=>{_d(a,ue,ce,s,e)},[a,ce,s,e]),U=(0,n.useCallback)(()=>{xd(K)},[K]),_=(0,n.useCallback)(()=>{kd(a,ue,ce,s,e)},[a,ce,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:T,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!j&&(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"})}),ye?(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Ed,{form:a,onBorderSideClear:T,formValues:He,elementSettings:e,appConfig:c,token:d,isMacOS:Ce,__:l,handleToggleShowPaddingCell:U,handleTogglePaddingCell:_,handleToggleBackground:mo,handleToggleBorder:D,handleToggleBorderRadius:$e,paddingCellShow:be,paddingsExt:ce,backgroundShow:We,cellBordersShow:G,borderRadiusShow:ee,oneBorderRadiusValue:S,setOneBorderRadiusValue:g,backgroundImageEmpty:N,backgroundRepeatOptions:ze,backgroundSizeOptions:ie,sendAction:Ye,typografItems:qe,textInputRef:Ve,linkProtocol:ne,handleLinkProtocolsChange:O,isCodeVision:j})}):(0,o.jsx)(Bd,{form:a,onBorderSideClear:T,elementSettings:e,handleToggleShowPadding:Te,handleTogglePadding:C,handleToggleBackground:mo,handleToggleBorder:D,handleToggleBorderRadius:$e,handleToggleBoxShadow:Je,handleToggleMobileSize:oo,handleToggleMobileBackground:Eo,handleToggleMobileBorder:he,handleToggleMobileBorderRadius:io,handleToggleMobileBoxShadow:ro,paddingShow:le,paddingsExt:ce,backgroundShow:We,bordersShow:V,borderRadiusShow:ee,boxShadowShow:de,mobileSizeShow:Ie,mobileBackgroundShow:pe,mobileBordersShow:$,mobileBorderRadiusShow:q,mobileBoxShadowShow:me,oneBorderRadiusValue:S,setOneBorderRadiusValue:g,oneMobileBorderRadiusValue:w,setOneMobileBorderRadiusValue:I,backgroundImageEmpty:N,backgroundRepeatOptions:ze,backgroundSizeOptions:ie,boxShadow:h,mobileBorders:E,mobileBoxShadow:v,elementViewType:m,mobileViewActive:b})," "]})};$l.propTypes={elementSettings:f.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),x=r.useSelector(r.selectElementSettings),k=r.useContainer(),h=r.getComponentRegistry(k),p=l==="email"?b:x,S=p.type,g=S===r.ELEMENT_TYPES.CAROUSEL||S===r.ELEMENT_TYPES.IMG?i.settings:p,[E,y]=(0,n.useState)(g),[v,P]=(0,n.useState)(g);g!==v&&(P(g),y(g));const w=I=>{const N=I.data.operation,X=I.data.action;if(N===r.EVENT_TYPES.APPLICATION_ACTION){let F=function($,z=null){const ee={[$]:z||!E[$]};d(ee,E.type),a(r.setEmailSettings(ee)),y(R=>({...R,...ee}))};var V=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(w),(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)(Vr,{elementSettings:p}),p.type===r.ELEMENT_TYPES.TEXT&&(0,o.jsx)(xn,{elementSettings:p}),p.type===r.ELEMENT_TYPES.LINK&&(0,o.jsx)(rl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.TABLE&&(0,o.jsx)(il,{elementSettings:p}),p.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,o.jsx)($l,{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)(cl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.VAR&&(0,o.jsx)(kl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.BUTTON&&(0,o.jsx)(xl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.DIV&&(0,o.jsx)(pl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.VINDENT&&(0,o.jsx)(al,{elementSettings:p}),p.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,o.jsx)(fl,{elementSettings:p}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,o.jsx)(Rl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(yl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,o.jsx)(Al,{elementSettings:i})]})})})};dt.propTypes={className:f.default.string,formName:f.default.string};function zo(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var Fl=({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)(),x=r.useSelector(r.selectElementSettings$1),k=r.useSelector(r.selectElementSettings),h=r.useAppConfig(),p=l||(e==="email"?x:k),[S,g]=(0,n.useState)(p.floatBlocks?.wrap),[E,y]=(0,n.useState)(p.floatBlocks?.dirRevers),[v,P]=(0,n.useState)(null),[w,I]=(0,n.useState)(0),[N,X]=(0,n.useState)([]),V=r.useSelector(r.selectEmailViewType),F=(0,n.useCallback)(pe=>{a(e==="email"?r.setElementSettings$1(pe):r.setElementSettings(pe))},[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 te=function(ce,ue){if(ce.length!==ue.length)return!1;for(let be=0;be<ce.length;be++)if(ce[be]!==ue[be])return!1;return!0};var pe=te;const ge=p.floatBlocks.items.reduce((ce,ue)=>ce+ue.width,0),le=p.floatBlocks.items.map(ce=>((ce.width||0)/ge*100).toFixed(1));I(ge),!te(le,N)&&p.changeKey!=="gap"&&X(le),p.floatBlocks.items.forEach((ce,ue)=>c.setFieldsValue({["width-"+ue]:ce.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")}g(p.floatBlocks?.wrap)}},[c,p,v,N]);let $=0;p.floatBlocks?.items.length>0&&($=p.floatBlocks.items.length);const z=(pe,ge)=>{Object.keys(ge).forEach(le=>{if(le.includes("width")){const te=parseInt(le.match(/\d+/));c.setFieldsValue({[le]:pe.items[te]})}})},[ee,R]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const pe=()=>R(!0),ge=()=>R(!1);return document.addEventListener("keyup",ge),document.addEventListener("keydown",pe),()=>{document.removeEventListener("keyup",ge),document.removeEventListener("keydown",pe)}},[]);const q=pe=>{b.current&&ee&&clearTimeout(b.current),b.current=setTimeout(()=>ge(pe),50);function ge(le){const te=c.getFieldsValue(!0),ce=Object.keys(le)[0];if(P(ce),ce.includes("width")){if(te[ce]&&te[ce]>=30){let ue={items:[],gap:te.gap,valign:te.valign,activateSection:i?void 0:"structure"},be=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){be=parseFloat(Object.keys(le)[0].substring(Object.keys(le)[0].length-1));const K=te["width-"+(be+1)]?be+1:0;let G=w;Object.keys(te).forEach(Q=>{Q.includes("width")&&Q.indexOf("width-"+K)===-1&&(G-=te[Q])}),te["width-"+K]=G}Object.keys(te).forEach(K=>{K.includes("width")&&ue.items.push(te[K])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:ue}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...ue,items:p.floatBlocks.items.map((K,G)=>({...p.floatBlocks.items[G],width:ue.items[G]}))},changeKey:ce})}}else if(ce==="gap"){const ue={items:p.floatBlocks.items.map(Q=>Q.width),gap:p.floatBlocks.gap},be=ue.items.reduce((Q,ne)=>Q+ne,0)+(ue.items.length-1)*ue.gap,K=te.gap,G=be-(ue.items.length-1)*K;if(G>ue.items.length*30||p.floatBlocks.gap-le>=0){const Q=(Ae,je)=>Math.round(je*Ae/100);let ne=ue.items.map((Ae,je)=>Q(N[je],G));const _e=be-(ne.reduce((Ae,je)=>Ae+je,0)+(ue.items.length-1)*K);if(_e!==0){const Ae=ne.length-Math.abs(_e);ne=ne.map((je,Oe)=>Ae<=Oe?je+(_e>0?1:-1):je)}let fe={items:ne,gap:K||0};z(fe,te),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((Ae,je)=>({...Ae,width:fe.items[je]}))},changeKey:ce})}}else if(ce==="valign"){let ue={valign:te.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:ue,editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...ue},changeKey:ce})}else if(ce==="gapMobile"){let ue={mobileHeight:{classNamePrefix:"em-mob-height-",value:le[ce],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:ue}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,gapMobile:ue.mobileHeight.value},changeKey:ce})}setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),600)}},re=()=>{const pe=c.getFieldsValue(!0),ge=p.floatBlocks.items.map(G=>G.width);let le={items:[],gap:pe.gap};const te=ge.reduce((G,Q)=>G+Q,0),ce=ge.length,ue=Math.ceil(w/ce)*ce,be=ue/ce,K=te-ue;if(le.items=Array(ce).fill(be),K!==0){const G=ge.length-Math.abs(K);le.items=le.items.map((Q,ne)=>G<=ne?Q+(K>0?1:-1):Q)}z(le,pe),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:le,editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...le,items:p.floatBlocks.items.map((G,Q)=>({...G,width:le.items[Q]}))},changeKey:"width"})},de=pe=>{const ge=c.getFieldsValue(!0),le=p.floatBlocks.items.map(fe=>fe.width),te=p.floatBlocks.gap||20,ce=pe.cols-le.length;let ue=[],be=le.reduce((fe,Ae)=>fe+Ae,0);pe.cols>=le.length?be-=te*ce:be+=te*Math.abs(ce);const K=Math.round(be/pe.cols);function G(fe,Ae){const je=[];for(let Oe=0;Oe<fe;Oe++)je.push(pe.width?.[Oe]?Math.round(be/100*pe.width?.[Oe]):Ae);return je}ue=G(pe.cols,K);const Q=be-ue.reduce((fe,Ae)=>fe+Ae,0);if(Q!==0){let fe=ue.map((je,Oe)=>[Oe,je]).filter(je=>je[1]>30);const Ae=fe.length-Math.abs(Q);fe=fe.map((je,Oe)=>{const Y=Ae<=Oe?je[1]+(Q>0?1:-1):je[1];return[je[0],Y]}),fe.map(je=>(ue[je[0]]=je[1],je))}let ne={items:ue,gap:ge.gap||20};const _e=ue.reduce((fe,Ae)=>fe+Ae,0);X(ue.map(fe=>(fe/_e*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:ne,editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...ne,items:ne.items.map((fe,Ae)=>({width:fe,current:!1}))},changeKey:"width"})},se=()=>{const pe=c.getFieldsValue(!0);if($<8){const ge=p.floatBlocks.items.map(G=>G.width),le=p.floatBlocks.gap,te=ge.reduce((G,Q)=>G+(Q>30?Q:0),0),ce=(te-30-le)/te,ue=ge.map(G=>G>30?Math.round(G*ce):G).reduce((G,Q)=>G+(Q>30?Q:0),0);let be=ge.map(G=>G>30?Math.round(G*ce):G);be.push(30);const K=te-ue-30-le;if(K!==0){let G=be.map((ne,_e)=>[_e,ne]).filter(ne=>ne[1]>30);const Q=G.length-Math.abs(K);G=G.map((ne,_e)=>{const fe=Q<=_e?ne[1]+(K>0?1:-1):ne[1];return[ne[0],fe]}),G.map(ne=>(be[ne[0]]=ne[1],ne))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:pe.gap,gapMobile:pe.gapMobile,minWidth:30},editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:be.map((G,Q)=>({width:G,current:p.floatBlocks.items[Q]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},me=pe=>{const ge=c.getFieldsValue(!0);let le=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((fe,Ae)=>{fe===pe.target.closest(".selected-element-panel__columns-settings__controls__column")&&(le=Ae)});const te=+p.floatBlocks.gap,ce=+p.floatBlocks.items[le].width+te,ue=p.floatBlocks.items.map(fe=>+fe.width),be=(ue.length-1)*te,K=ue.reduce((fe,Ae)=>fe+Ae,0)+be,G=ue.length-1,Q=Math.floor(ce/G);let ne=ue.filter((fe,Ae)=>Ae!==le).map(fe=>fe+Q);const _e=K-(ne.reduce((fe,Ae)=>fe+Ae,0)+(ue.length-2)*te);if(_e!==0){const fe=ne.length-Math.abs(_e);ne=ne.map((Ae,je)=>fe<=je?Ae+(_e>0?1:-1):Ae)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:le,gap:ge.gap},editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:ne.map((fe,Ae)=>({width:fe,current:p.floatBlocks.items.filter((je,Oe)=>Oe!==le)[Ae].current}))},changeKey:"width"})},xe=pe=>{if($>=8)return;const ge=c.getFieldsValue(!0);let le=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((je,Oe)=>{je===pe.target.closest(".selected-element-panel__columns-settings__controls__column")&&(le=Oe)});const te=parseFloat(ge.gap)||0,ce=p.floatBlocks.items.map(je=>+je.width),ue=ce[le],be=ce.reduce((je,Oe)=>je+Oe,0),K=be-te,G=be+ue,Q=G>0?K/G:1;let ne=[];const _e=[];ce.forEach((je,Oe)=>{ne.push(Math.max(30,Math.round(je*Q))),_e.push(p.floatBlocks.items[Oe]?.current||!1),Oe===le&&(ne.push(Math.max(30,Math.round(ue*Q))),_e.push(!1))});const fe=K-ne.reduce((je,Oe)=>je+Oe,0);if(fe!==0){let je=ne.map((Y,oe)=>[oe,Y]).filter(Y=>Y[1]>30);const Oe=je.length-Math.abs(fe);je=je.map((Y,oe)=>[Y[0],Oe<=oe?Y[1]+(fe>0?1:-1):Y[1]]),je.forEach(Y=>ne[Y[0]]=Y[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:le,gap:ge.gap,widths:ne},editFromStructure:zo()});const Ae=ne.reduce((je,Oe)=>je+Oe,0);X(ne.map(je=>(je/Ae*100).toFixed(1))),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:ne.map((je,Oe)=>({width:je,current:_e[Oe]||!1}))},changeKey:"width"})},Ie=(0,n.useCallback)(pe=>{const ge=".selected-element-panel__columns-settings__controls__column",le=Array.from(document.querySelectorAll(ge)).indexOf(pe.target.closest(ge)),te=le-1;if(te<0)return;const ce=p.floatBlocks,ue=ce.items.map(({width:be,current:K})=>({width:be,current:K||!1}));[ue[te],ue[le]]=[ue[le],ue[te]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:te,indexB:le},editFromStructure:zo()}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...ce,items:ue},changeKey:"width"})},[p,F,i,d]),ae=pe=>{g(pe),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"})},We=pe=>{y(pe),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!E}}),F({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,dirRevert:!E},changeKey:"dir"})},ve=()=>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((pe,{width:ge},le)=>(pe[`width-${le}`]=ge,pe),{})},onValuesChange:q,onFieldsChange:ve,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"}),V!=="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:se,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:re,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((pe,ge)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(pe.current?"current":""),style:{width:pe.width/w*100+"%"},children:[ge>0&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Swap columns"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:Ie,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:me,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-"+ge,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,value:pe.width||0,placeholder:s("Width"),ref:v==="width-"+ge&&m})})})]},"floatblock-"+ge))})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{de({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{de({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{de({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:()=>{de({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:()=>{de({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{de({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:[V==="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:ae,labelStyle:{position:"relative",top:2}})}),V!=="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:E,onChange:We,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:[V!=="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:v==="gap"&&m})})})}),V==="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"})})})})]})]})]})]})})};Fl.propTypes={selectedElement:f.default.shape({parent:f.default.string})};var Td=()=>{},Ml=({email:e,formSettings:i={},onClosePanel:l=Td})=>{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),x=r.useSelector(r.selectElementSettings),k=r.useSelector(r.selectPropertiesPanelKey),h=m==="email"?b:x,p=Object.keys(i).length>0?i.settings:h,S=i?.type==="advanced"&&!!i?.content,g=!!i?.extraTabs?.length,E=r.useAppConfig(),y=p.type==="customTable",v=!!p.type&&!!p.floatBlocks?.items.length>0&&!!p.floatBlocks?.items.filter(z=>!!z.width).length>0,P=(0,n.useRef)(null);(0,n.useEffect)(()=>{const z=Object.values(r.ELEMENT_TYPES),ee=p.type&&z.includes(p.type)?`${p.type}-${JSON.stringify(p.path||[])}`:null;if(S||g){const R=a.querySelector(".email-pane .panel-form__body");R&&(R.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(p.type&&z.includes(p.type)){const R=P.current!==ee;if(P.current=ee,p.activateSection!=="structure"){if(R){const q=a.querySelector(".email-pane .panel-form__body");q&&(q.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,g]);const w=(0,n.useMemo)(()=>{const z=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:p.caption?p.caption:s("Edit element")})}];return v&&z.push({key:r.STRUCTURE,label:s("Columns")}),z},[p.caption,v,s]),I=(0,n.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),N=z=>{z.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(m==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},X=z=>{z.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},V=()=>{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:[E.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:N,disabled:!p.deletable,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:E.iconStrokeWidth})})}),E.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:E.iconStrokeWidth})})})]}),$=E.switchDesktopMobilePropsEnabled||E.stepToOtherElementEnabled||E.deleteButtonEnabled;return(0,o.jsxs)(t.ui_kit$PanelForm,{children:[(0,o.jsx)(t.ui_kit$PanelForm.Header,{onClose:V,closeIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"Close",component:t.icons$Close,size:24,strokeWidth:E.iconStrokeWidth}),extra:$?F:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:y?I:w,activeKey:k,onChange:z=>d(r.setPropertiesPanelKey(z||""))})}),(0,o.jsx)(t.ui_kit$PanelForm.Body,{children:y?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:k==="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:k==="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:k==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m})}),v&&(0,o.jsx)("div",{style:{display:k==="Structure"?void 0:"none"},children:(0,o.jsx)(Fl,{selectedElement:p,emailElementType:m,isSelectedElement:!1})})]})})]})},Rd=({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(),x=(0,n.useCallback)(()=>{a.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[a]);(0,n.useEffect)(()=>{c&&x()},[c,x]);const k=()=>s(r.closeModal$1()),[h,p]=r.useAddTermMutation(),[S,g]=(0,n.useState)(!1),E=()=>{a.validateFields().then(({name:y})=>(g(!0),h({project:b,kind:"group",name:y}).then(v=>{if("error"in v){m.error(v);return}m.success({title:i("The group “")+v.data.name+l("” was successfully created.",e)}),k()}))).catch(y=>{}).finally(()=>g(!1))};return(0,o.jsx)(t.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:E,onCancel:k,className:"new-group-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:p.isLoading||S,onClick:E,children:i("Create group")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",name:"add_new_group_form",onFinish:E,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message: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}})})})})},yd=({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:x=null,name:k=""}=e,h=()=>a(r.closeModal$1()),[p,S]=r.useEditTermMutation();(0,n.useEffect)(()=>{m&&d.setFieldsValue({name:k})},[m,k,d]);const g=()=>{d.validateFields().then(({name:E})=>{p({kind:"group",id:x,name:E}).then(({data:y,error:v})=>{v?(b.error({error:v}),d.setFieldValue("name",E)):(i().then(({data:P})=>{if(P){const w=P[0]?.children?.find(I=>I.id===x)?.name;d.setFieldValue("name",w)}}),h(),b.success({title:l("The group “")+E+s("” was successfully changed to “","group")+y.name+l("”.")}))})})};return(0,o.jsx)(t.ui_kit$Modal,{title:l("Change group name"),open:m,onOk:g,onCancel:h,className:"new-group-name-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:S.isLoading,onClick:g,children:l("Change name")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:d,layout:"vertical",name:"rename_group_form",onFinish:g,initialValues:{remember:!1,name:k},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}})})})})},wd=({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:x}=(0,t.ui_kit$useToken)(),k=r.useSelector(r.selectProjectGroups),[h]=r.useDeleteTermMutation(),p=(P,w)=>{h({kind:"group",id:Number(P)}).unwrap().then(I=>{I?.deleted&&c.success({title:s("The group “")+w+a("” was successfully deleted.","recovery")})}).catch(I=>{c.error({error:I})})},S=(P,w)=>{b({mask:{closable:!0},centered:!0,title:a("Are you sure to delete “","group")+w+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),w)})},g=(P,w)=>{d(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),v({id:P,name:w})},E=P=>[{label:s("Rename"),key:"Rename",icon:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:16}),onClick:()=>g(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)}],[y,v]=(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:[!!k?.length&&k?.map((P,w)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${P.id}`,style:{marginBottom:x.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:E(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(I=>({label:I.name,value:String(I.id)})),tagRender:I=>{const{label:N,closable:X,onClose:V}=I,F=$=>{$.preventDefault(),$.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:x.colorPrimary,onMouseDown:F,closable:X,onClose:V,style:{borderRadius:6},children:N})},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:x.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)(Rd,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,o.jsx)(yd,{group:y,refetch:i})]})},{title:Pi,description:Yt,tags:Xt,type:Ai,is_template:jd,group:vd}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},Id={[Pi]:"",[Yt]:"",[Xt]:[],[jd]:!1},Cd={[Yt]:"",[Xt]:[],[Ai]:""};function Pd(e){const i=new Set;return e?.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0))}var Ad=e=>Array.isArray(e)&&e.length>0,Dl=({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.useSelector(r.selectProjectGroups),{data:x}=r.useGetBlocksSchemaQuery(),k=r.useProjectData(),h=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,p=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{data:S,refetch:g,isLoading:E,isFetching:y,isUninitialized:v,isSuccess:P}=r.useGetTermsQuery({project:k,kind:"group"},{skip:!k?.id});(0,n.useEffect)(()=>{S&&s(r.projectGroupsLoaded(S,h==="email"?i.group??[]:void 0))},[s,S,h,i.group]),(0,n.useEffect)(()=>{!v&&g()},[v,g]);const[w,I]=(0,n.useState)([]),[N,X]=(0,n.useState)([]),[V,F]=(0,n.useState)(i.is_template||!1),$=r.useProjectData();(0,n.useEffect)(()=>{!v&&g()},[i.group,g,v]),(0,n.useEffect)(()=>{if(P&&i.is_template&&Ad(i.group)){const q=i.group;let re={};q.length&&b.length&&q?.forEach(se=>{b?.forEach(me=>{let xe=me.children.find(Ie=>Ie.id===se);xe&&(re.hasOwnProperty(me.id)||(re[me.id]=[]),re[me.id].push({label:xe.name,value:xe.id}))})});let de={};for(let se in re)re.hasOwnProperty(+se)&&(de[`group_${se}`]=re[se].map(me=>({...me,value:String(me.value)})));d.setFieldsValue(de)}},[d,b,i.is_template,i.group,P]);const{data:z}=r.useGetTermsQuery({project:$,kind:p},{skip:!$?.id});(0,n.useEffect)(()=>{X(Pd(z)?.map(q=>({value:q.name,key:q.id})))},[z]),(0,n.useEffect)(()=>{if(i){const q=r.getTaxonomy(i,p)?.map(se=>se.name),re=i.emailtags||i.blocktags,de=r.getTaxonomy(i,p)?.filter(se=>re.includes(se.id)).map(se=>se.name);d.setFieldsValue({title:i.title,description:i.description,tags:i.tags||de||q,type:i.type})}},[d,i,p]);const ee=q=>{const re=Object.keys(q)[0],de=q,se=re.split("_")[0];if(se===Pi)a({title:de[re]});else if(se===Yt)a({description:de[re]});else if(se===Xt){const me=de[re];a({tags:me?.map(xe=>xe.trim())})}else se==="is"&&h==="email"&&a({is_template:de[re]});switch(re.split("_")[0]){case vd:s(r.setEmailGroups({[re.split("_")[1]]:q[re]}));break;case Ai:s(r.blocksApi.util.updateQueryData("getBlock",i.id,me=>{Object.assign(me,{type:q[re]})}));break;default:return}};(0,n.useEffect)(()=>{if(x){const q=x.schema.properties.acf.properties.type.items.enum;let re=[];const de={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 se in q)re.push({label:de[q[se]],value:q[se]});I(re)}},[x,l]);const R=q=>{F(q)};return(0,o.jsx)("div",{className:(0,Ue.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:h==="email"?{EmailInitialValues:Id}:Cd,onValuesChange:ee,autoComplete:"off",children:[m.subjectEnabled&&h==="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:N,tagRender:q=>{const{label:re,closable:de,onClose:se}=q,me=xe=>{xe.preventDefault(),xe.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:me,closable:de,onClose:se,style:{borderRadius:6},children:re})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),h==="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:V,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",onChange:R,disabled:i.isNew,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),V&&(0,o.jsx)(wd,{element:i,refetchProjectGroups:g,isLoading:E||y}),h==="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:w,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};Dl.propTypes={className:f.default.string,email:f.default.object};var{utm_source:Vl,utm_medium:Hl,utm_campaign:Ul,utm_term:Wl,utm_content:zl}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},Nd={[Vl]:"",[Hl]:"",[Ul]:"",[Wl]:"",[zl]:""},Gl=({className:e="",email:i=void 0})=>{const{__:l}=r.useI18n(),s=r.useEmailAttributesWriter(),[a]=t.ui_kit$Form.useForm();(0,n.useEffect)(()=>{i&&a.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||""})},[a,i]);const d=c=>{const m=Object.keys(c)[0],b=c;s({utm_parameters:{...i?.utm_parameters,[m]:b[m]}})};return(0,o.jsx)("div",{className:(0,Ue.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"settings_panel_form_utm",initialValues:Nd,onValuesChange:d,autoComplete:"off",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:Vl,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:Hl,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:Ul,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:Wl,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:zl,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")})})]})})};Gl.propTypes={className:f.default.string,email:f.default.object};var Ge={PRODUCT_CAROUSEL:"productCarousel",SINGLE_IMAGE_PREVIEW:"singleImagePreview",DEAL_ANNOTATION:"dealAnnotation",DEAL_CARD:"dealCard"},Yl="emailmaker-gmail-annotations";function Ni(e){return/^[A-Za-z]{3}$/.test((e??"").trim())}function Ld(e){return typeof e=="object"&&e!==null}function Kt(e,i){const l=e[i];return typeof l=="string"?l:""}var Od=new Set(["PromotionCard","DiscountOffer","Organization"]);function Xl(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&&Od.has(String(s["@type"])))}function $d(){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||Ge.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 Kl(e){return Jt(e?.image)&&Oi(e?.url)}function Fd(e){switch(qt(e)){case Ge.SINGLE_IMAGE_PREVIEW:return Kl(e.cards?.[0]);case Ge.DEAL_ANNOTATION:return!Li(e);case Ge.DEAL_CARD:return Jt(e.description)&&(Oi(e.offerPageUrl)||Oi(e.merchantHomepageUrl));case Ge.PRODUCT_CAROUSEL:default:return!!e.cards?.some(Kl)}}function Md(e){switch(qt(e)){case Ge.SINGLE_IMAGE_PREVIEW:return!ct(e.cards?.[0])&&!Jt(e.discountCode);case Ge.DEAL_ANNOTATION:return Li(e);case Ge.DEAL_CARD:return Li(e)&&!e.offerPageUrl&&!e.merchantHomepageUrl;case Ge.PRODUCT_CAROUSEL:default:return!e.cards?.some(ct)}}function Dd(e){switch(qt(e)){case Ge.DEAL_ANNOTATION:case Ge.DEAL_CARD:return!!(e.description||e.discountCode||e.availabilityStarts||e.availabilityEnds||e.offerPageUrl||e.merchantHomepageUrl);case Ge.SINGLE_IMAGE_PREVIEW:return ct(e.cards?.[0]);case Ge.PRODUCT_CAROUSEL:default:return e.logo?!0:!!e.cards?.some(ct)}}function Vd(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:$d(),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 ql(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 Jl(e){return{"@context":"http://schema.org/","@type":"Organization",logo:e}}function Hd(e){const i=qt(e),l=[];if(i===Ge.DEAL_CARD)return[$i(e)];if(i===Ge.DEAL_ANNOTATION){const s=[];return e.logo&&s.push(Jl(e.logo)),s.push($i(e)),s}if(e.logo&&l.push(Jl(e.logo)),i===Ge.SINGLE_IMAGE_PREVIEW){const s=e.cards?.[0];return e.discountCode?.trim()&&l.push($i(e)),s&&ct(s)&&l.push(ql(s)),l}return(e.cards||[]).filter(ct).forEach((s,a)=>{l.push(ql(s,a+1))}),l}function Ud(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Wd(e){if(Md(e))return null;const i=Ud(JSON.stringify(Hd(e),null,2));return`<script type="application/ld+json" id="${Yl}">
|
|
10
|
-
${i}
|
|
11
|
-
<\/script>`}function Ql(e,i){const l=e.toLowerCase().indexOf("<\/script>",i);return l===-1?-1:l+9}function Zl(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=["']${Yl}["']`,"i").exec(e);if(i?.index!==void 0){const a=e.indexOf(">",i.index)+1;if(a<=0)return null;const d=Ql(e,a);if(d!==-1)return Zl(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=Ql(e,a);if(d!==-1&&Xl(e.slice(a,d-9)))return Zl(e,s.index,a,d)}return null}function zd(e){const i=e.indexOf(">")+1,l=e.toLowerCase().lastIndexOf("<\/script>");return i<=0||l===-1?e:e.slice(i,l)}function Gd(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 es(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 Yd(e,i){const l=Fi(e),s=Wd(i);if(!s&&!l)return null;if(l&&!s){const c=es(e,l.range);return e.slice(c.start,c.end)?{range:c,text:""}:null}if(l&&s){const c=zd(s);return e.slice(l.contentRange.start,l.contentRange.end)===c?null:{range:l.contentRange,text:c}}if(!s)return null;const a=Gd(e),d=`${a>0&&e[a-1]!==`
|
|
14
|
-
`?`
|
|
15
|
-
`:""}${s}
|
|
16
|
-
`;return{range:{start:a,end:a},text:d}}function os(e){const i=Fi(e);return i?e.slice(i.contentRange.start,i.contentRange.end):null}function Xd(e){let i=e;for(let l=0;l<50;l++){const s=Fi(i);if(!s)return i;const{start:a,end:d}=es(i,s.range);i=i.slice(0,a)+i.slice(d)}return i}function Kd(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"||Xl(s.textContent||"")){const a=JSON.parse(s.textContent||"[]"),d=(Array.isArray(a)?a:[a]).filter(Ld),c={cards:[]};let m=!1,b=!1,x=!1;return d.forEach(k=>{const h=Kt(k,"@type");if(h==="Organization"){const p=Kt(k,"logo");p&&(c.logo=p);return}if(h==="DiscountOffer"){b=!0;for(const p of["description","discountCode","availabilityStarts","availabilityEnds"]){const S=Kt(k,p);S&&(c[p]=S)}for(const p of["offerPageUrl","merchantHomepageUrl"]){const S=Kt(k,p);S&&(c[p]=S,m=!0)}return}h==="PromotionCard"&&(k.position!==void 0&&(x=!0),c.cards.push(Vd(k)))}),c.cards.length>1?c.annotationType=Ge.PRODUCT_CAROUSEL:c.cards.length===1?c.annotationType=x?Ge.PRODUCT_CAROUSEL:Ge.SINGLE_IMAGE_PREVIEW:b&&(c.annotationType=m?Ge.DEAL_CARD:Ge.DEAL_ANNOTATION),c}}}catch{}return null}var qd={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 Jd(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function ts(e){const i=e?.trim();return i?qd[i.toUpperCase()]??i:"$"}function Mi(e,i){return`${ts(i)}${Jd(e)}`}function Qd(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 so=({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 is({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 Zd({className:e}){return(0,o.jsxs)("svg",{className:e,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,o.jsx)("path",{d:"M12 12V7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 12L15.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 3a9 9 0 0 1 7.5 4",fill:"currentColor",fillOpacity:"0.18"})]})}var ec=2;function oc({card:e}){const i=Qd(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)(so,{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)(so,{height:12}),(0,o.jsx)(so,{height:12,width:"75%"})]}),d?(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(so,{width:48,height:14}),(0,o.jsx)(so,{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 tc(){return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,o.jsx)(so,{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)(so,{height:12}),(0,o.jsx)(so,{height:12,width:"75%"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(so,{width:48,height:14}),(0,o.jsx)(so,{width:40,height:12})]})]})]})}var ic=({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)(so,{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)(so,{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)(oc,{card:c},c.id||m)):Array.from({length:ec},(c,m)=>(0,o.jsx)(tc,{},`skeleton-${m}`))})]})};function rc(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 rs(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var lc=({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=rc(l),x=rs(e.discountCode),k=!!(b||x),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)(so,{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)(so,{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)(is,{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)(so,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,o.jsx)(so,{width:72,height:14})]}),k&&(0,o.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),x?(0,o.jsx)("span",{className:"single-image-preview__promo-code",children:x}):(0,o.jsx)(so,{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)(so,{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)(so,{height:12}),(0,o.jsx)(so,{height:12,width:"92%"})]})})]})]})};function sc(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 ac(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function nc(e,i){return ac(sc(e),i)}var dc=({data:e,subjectLine:i})=>{const{__:l}=r.useI18n(),s=!!e.logo?.trim(),a=!!i?.trim(),d=Vi(e.description),c=rs(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)(so,{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)(so,{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)(is,{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)(so,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,o.jsx)(so,{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)(so,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,o.jsx)(Di,{className:"deal-annotation-preview__star-icon"})]})]})]})})},cc=({data:e})=>{const{__:i}=r.useI18n(),l=Vi(e.description),s=nc(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)(so,{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)(Zd,{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)(so,{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)(so,{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 uc(e){return e.annotationType===Ge.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===Ge.PRODUCT_CAROUSEL?e.cards||[]:[]}function mc(e,i){switch(e){case Ge.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case Ge.DEAL_ANNOTATION:return i("Deal Annotation");case Ge.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var Hi=300,Go=16;function pc(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function hc(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 bc=({data:e,subjectLine:i,parentRef:l,overlayTargetSelector:s,onApply:a,applyDisabled:d=!1,applyBlockers:c=[],onRemove:m,visible:b=!0})=>{const{__:x}=r.useI18n(),[k,h]=(0,n.useState)(null),[p,S]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!b){h(null),S(null);return}const w=()=>{if(!pc(l?.current)){h(null),S(null);return}if(s){const q=l?.current?.closest(".email-pane__col_settings-inner")||hc(".email-pane__col_settings-inner");if(q){S(q),h({type:"popover"});return}}if(!l?.current)return;let z=l.current.getBoundingClientRect();if(z.width===0&&z.height===0){const q=l.current.closest(".email-pane__col");q&&(z=q.getBoundingClientRect())}const ee=Math.max(Go,Math.min(z.top,window.innerHeight-Go));let R=z.left-Hi-Go;R<Go&&(R=z.right+Go),R+Hi>window.innerWidth-Go&&(R=window.innerWidth-Hi-Go),S(document.body),h({type:"side",top:ee,left:Math.max(Go,R)})};w();const I=window.requestAnimationFrame(w),N=[window],X=l?.current?.closest(".email-pane__collapse-wrapper"),V=l?.current?.closest(".email-pane__col");X&&N.push(X),V&&N.push(V),N.forEach(z=>{z.addEventListener("scroll",w,{passive:!0})}),window.addEventListener("resize",w);const F=l?.current,$=F&&typeof ResizeObserver<"u"?new ResizeObserver(w):null;return $?.observe(F),()=>{window.cancelAnimationFrame(I),$?.disconnect(),N.forEach(z=>{z.removeEventListener("scroll",w)}),window.removeEventListener("resize",w)}},[l,e,s,b]);const g=(0,n.useMemo)(()=>k?.type==="side"?{position:"fixed",top:k.top,left:k.left}:void 0,[k]);if(!b||!e||!Dd(e)&&!a||!k)return null;const E=uc(e),y=e.annotationType||Ge.PRODUCT_CAROUSEL,v=(()=>{switch(y){case Ge.PRODUCT_CAROUSEL:return(0,o.jsx)(ic,{data:e,subjectLine:i,cards:E});case Ge.SINGLE_IMAGE_PREVIEW:return(0,o.jsx)(lc,{data:e,subjectLine:i,card:E[0]});case Ge.DEAL_ANNOTATION:return(0,o.jsx)(dc,{data:e,subjectLine:i});case Ge.DEAL_CARD:return(0,o.jsx)(cc,{data:e});default:return null}})(),P=(0,o.jsxs)("div",{className:`annotations-preview${k.type==="popover"?" annotations-preview--popover":""}`,style:g,children:[(0,o.jsxs)("div",{className:"annotations-preview__content",children:[(0,o.jsxs)("div",{className:"annotations-preview__type",children:[x("Preview"),": ",mc(y,x)]}),v]}),(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:x("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:x("Apply")})})})]})]});return(0,Ma.createPortal)(P,p||document.body)};function fc(e){return e.replaceAll(`\r
|
|
17
|
-
`,`
|
|
18
|
-
`)}function gc(e){if(!e)return"";const i=document.createElement("textarea");return i.innerHTML=e,i.value.replace(/\u00A0/g," ").trim()}var _c=["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 ls(e,i){const l=ut(e),s=Rt(i);return l===null||l<=0||s===null?"":Tt(l*s/100)}function xc(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(ls(e,m)===d)return m}return Tt(a)}function Qt(){return{id:fo.generateUUID(),image:"",url:"",headline:"",price:"",priceCurrency:"",discountPercent:""}}function kc({discountValue:e,...i}){return{...i,discountPercent:xc(i.price,e)}}function ss(e,i){return i?.length?i.map(kc):e===Ge.PRODUCT_CAROUSEL||e===Ge.SINGLE_IMAGE_PREVIEW?[Qt()]:[]}function as(e=Ge.PRODUCT_CAROUSEL){return{annotationType:e,annotationLogo:"",description:"",discountCode:"",availabilityStarts:null,availabilityEnds:null,offerPageUrl:"",merchantHomepageUrl:"",cards:ss(e)}}function Ec(e){const i=e.annotationType||Ge.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:ss(i,e.cards)}}function ns(e){const i=e.cards||[];return{annotationType:typeof e.annotationType=="string"?e.annotationType:Ge.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||fo.generateUUID(),image:l.image||"",url:l.url||"",headline:l.headline||"",price:l.price||"",priceCurrency:l.priceCurrency||"",discountValue:ls(l.price,l.discountPercent)}))}}function Bc(e,i){const l=e.getContent();if(!l)return!1;const s=Yd(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 Sc(e,i){return e?e.emailId!==i.emailId||e.markup!==i.markup:!0}function Tc(e){const i=e.getContent(),l=Xd(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 Rc(e,i){const l=e.annotationType??Ge.PRODUCT_CAROUSEL,s=[];return l===Ge.PRODUCT_CAROUSEL||l===Ge.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===Ge.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 yc(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:wc}=t.ui_kit$Typography,jc=10,vc=1,ds={width:"100%"},Ic="https://developers.google.com/workspace/gmail/promotab",Ro=["hover"],Cc=["annotationLogo"],cs=["cards",0,"price"],Pc=["cards",0,"discountPercent"],Ac=["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,{})},Nc={optionFilterProp:"label"};function Lc(e){return{value:e||void 0}}var Oc=_c.map(e=>{const i=ts(e);return{value:e,label:i===e?e:`${e} (${i})`}}),us=({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 x=typeof b=="string"?b.trim():"";if(!x)return;if(Rt(x)===null)throw new Error(s("Discount must be a percentage greater than 0 and up to 100"));const k=ut(c(i));if(k===null||k<=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})})})},ms=({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:Lc,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:Oc,placeholder:l("Price currency"),prefix:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:Nc,allowClear:!0,getPopupContainer:_o})})})},$c=({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")})},Fc=({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]),x=(0,n.useMemo)(()=>[e.name,"headline"],[e.name]),k=(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]),g=(0,n.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),E=(0,n.useMemo)(()=>[e.name,"id"],[e.name]),y=(0,n.useMemo)(()=>[{validator:async(P,w)=>{const I=typeof w=="string"?w.trim():"";if(I&&!/^https?:\/\//i.test(I))throw new Error(d("Please enter the correct URL."))}}],[d]),v=(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)(wc,{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:v})})]}),(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:x,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:k,className:"selected-social-form__card-field",rules:y,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)(us,{name:S,pricePath:p,iconStrokeWidth:c.iconStrokeWidth}),(0,o.jsx)(ms,{name:g,iconStrokeWidth:c.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:E,hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})})]})};function ps({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 Mc=({className:e="",isActive:i=!0,email:l})=>{const{__:s}=r.useI18n(),a=r.useAppConfig(),{document:d}=r.useDocumentSessionContext(),c=r.useNotification(),[m]=t.ui_kit$Form.useForm(),b=(0,n.useRef)(null),x=(0,n.useRef)(!1),k=(0,n.useRef)(null),[h,p]=(0,n.useState)(!1),S=t.ui_kit$Form.useWatch("annotationType",m),g=t.ui_kit$Form.useWatch("annotationLogo",m),E=t.ui_kit$Form.useWatch("description",m),y=t.ui_kit$Form.useWatch("discountCode",m),v=t.ui_kit$Form.useWatch("availabilityStarts",m),P=t.ui_kit$Form.useWatch("availabilityEnds",m),w=t.ui_kit$Form.useWatch("offerPageUrl",m),I=t.ui_kit$Form.useWatch("merchantHomepageUrl",m),N=t.ui_kit$Form.useWatch("cards",m),X=JSON.stringify(N??[]),V=(0,n.useMemo)(()=>JSON.parse(X)??[],[X]),F=S||Ge.PRODUCT_CAROUSEL,$=F===Ge.PRODUCT_CAROUSEL||F===Ge.SINGLE_IMAGE_PREVIEW,z=F===Ge.DEAL_ANNOTATION||F===Ge.DEAL_CARD,ee=F===Ge.DEAL_CARD,R=F===Ge.DEAL_ANNOTATION,q=F===Ge.SINGLE_IMAGE_PREVIEW,re=F===Ge.SINGLE_IMAGE_PREVIEW?vc:jc,de=(0,n.useMemo)(()=>[{value:Ge.PRODUCT_CAROUSEL,label:s("Product carousel")},{value:Ge.SINGLE_IMAGE_PREVIEW,label:s("Single image preview")},{value:Ge.DEAL_ANNOTATION,label:s("Deal Annotation")},{value:Ge.DEAL_CARD,label:s("Deal Card")}],[s]),se=(0,n.useMemo)(()=>{let le="";d&&(le=d.getContent()),!le&&l?.html&&(le=l.html);const te=le.match(/<title[^>]*>([\s\S]*?)<\/title>/i),ce=te?te[1].trim():l?.title||l?.subject||"";return gc(ce)},[d,l?.html,l?.title,l?.subject]),me=(0,n.useMemo)(()=>ns({annotationType:F,annotationLogo:g,description:E,discountCode:y,availabilityStarts:v,availabilityEnds:P,offerPageUrl:w,merchantHomepageUrl:I,cards:V}),[F,g,E,y,v,P,w,I,V]),xe=(0,n.useMemo)(()=>$?yc(V,s):[],[$,V,s]),Ie=(0,n.useMemo)(()=>Fd(me)&&xe.length===0,[me,xe]),ae=(0,n.useMemo)(()=>[...Rc(me,s),...xe],[me,xe,s]),We=(0,n.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),ve=(0,n.useCallback)(()=>{!d||!Tc(d)||(m.setFieldsValue(as(F)),k.current={emailId:l?.id,markup:null},p(!1),c.success(s("Gmail annotations were removed from the template code.")))},[d,m,F,l?.id,c,s]);(0,n.useEffect)(()=>{if(!$)return;const le=m.getFieldValue("cards")??[];if(F===Ge.SINGLE_IMAGE_PREVIEW){if(le.length>1){m.setFieldsValue({cards:[le[0]]});return}le.length===0&&m.setFieldsValue({cards:[Qt()]});return}le.length===0&&m.setFieldsValue({cards:[Qt()]})},[m,$,F,V]);const pe=(0,n.useCallback)(le=>{if(!le||!x.current||!d)return!1;const te=Bc(d,ns(le));if(te){const ce=os(d.getContent());k.current={emailId:l?.id,markup:ce},p(ce!==null)}return te},[d,l?.id]),ge=(0,n.useCallback)(()=>{pe(m.getFieldsValue(!0))&&c.success(s("Gmail annotation was successfully applied to the template code."))},[pe,m,c,s]);return(0,n.useEffect)(()=>{if(!i)return;const le=fc(d?.getContent()||l?.html||""),te={emailId:l?.id,markup:le?os(le):null};if(p(te.markup!==null),!Sc(k.current,te))return;k.current=te,x.current=!1;const ce=le?Kd(le):null;m.setFieldsValue(ce?Ec(ce):as()),x.current=!0},[i,l?.id,l?.html,d,m]),(0,o.jsxs)("div",{className:(0,Ue.default)("selected-social-form","annotations-panel",e),ref:b,children:[(0,o.jsx)(bc,{data:me,subjectLine:se,parentRef:b,overlayTargetSelector:"#pane-content-iframe",onApply:ge,applyDisabled:!Ie,applyBlockers:ae,onRemove:h?ve:void 0,visible:i}),(0,o.jsxs)(t.ui_kit$Form,{form:m,layout:"vertical",className:"selected-social-form__form element-controls",autoComplete:"off",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:de,placeholder:s("Annotation type"),getPopupContainer:_o})})}),!ee&&(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:m,label:s("Organization logo"),name:"annotationLogo",watchPath:Cc})})}),(q||R)&&(0,o.jsx)(ps,{iconStrokeWidth:a.iconStrokeWidth}),q&&(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:cs,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)(us,{name:Pc,pricePath:cs,iconStrokeWidth:a.iconStrokeWidth}),(0,o.jsx)(ms,{name:Ac,iconStrokeWidth:a.iconStrokeWidth})]}),z&&(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})})}),ee&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ps,{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:ds,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:ds,getPopupContainer:_o})})})})]})]})]}),$&&(0,o.jsxs)("div",{className:(0,Ue.default)("selected-social-form__section",{"selected-social-form__section--bordered":!q,"annotations-panel__cards-section":q}),children:[F===Ge.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:(le,{add:te,remove:ce})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:le.map((ue,be)=>(0,o.jsx)(Fc,{field:ue,index:be,form:m,isSingleImagePreview:q,onRemove:ce},ue.key))}),!q&&V.length<re&&(0,o.jsx)($c,{onAdd:te})]})})]}),(0,o.jsxs)("div",{className:"annotations-panel__docs-hint",children:[We[0],(0,o.jsx)("a",{href:Ic,target:"_blank",rel:"noopener noreferrer",children:s("Gmail annotations")}),We[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",x=d.annotationsEnabled&&l==="email",k=[m&&"Settings",b&&"UTM parameters",x&&"Annotations parameters"].filter(Boolean),h=k.includes(s)?s:k[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)(Dl,{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)(Gl,{className:"email-settings__collapse-panel-content",email:e})}),x&&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)(Mc,{className:"email-settings__collapse-panel-content",email:e,isActive:h===r.ANNOTATIONS_PARAMETERS})}),S},[i,e,m,b,x,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 hs=320,Dc=1200,Vc=350,{backgroundColor:bs,backgroundImage:zi,backgroundPositionX:Gi,backgroundPositionY:Yi,backgroundRepeat:Zt,backgroundSize:Xi,responsive:Hc,backgroundColorContent:Uc,width:Ki}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},Wc={[bs]:"",[zi]:"",[Gi]:"",[Yi]:"",[Zt]:"checked",[Xi]:"",[Uc]:"",[Ki]:""};function qi(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var fs=({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),x=r.useSelector(r.selectIsSettingsDisabled$1),k=r.useSelector(r.selectActiveSettingsTab),h=r.useSelector(r.selectIsNeedUpdateAppearance),[p,S]=(0,n.useState)(!0),g=(0,n.useRef)(!1),E=(0,n.useRef)(null),y=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)(()=>()=>{E.current&&clearTimeout(E.current)},[]);const v=[{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:z,...ee}=b,R={...ee,backgroundImage:b.backgroundImage?b.backgroundImage[0]?.value:"",backgroundRepeat:b[Zt]===""?"repeat":b[Zt],backgroundSize:b[Xi],responsive:b.responsive?.shutdown};g.current||(R.width=z?.value,R.widthDim=z?.dim),d.setFieldsValue(R),S(!b.backgroundImage)},[b,d]);const w=(0,n.useCallback)(z=>{const ee=qi(z);!ee||ee.value<hs||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:ee}})},[c]),I=(0,n.useCallback)(z=>{const ee=qi(z);ee&&s(r.setEmailSettings({...b,width:ee}))},[s,b]),N=(0,n.useCallback)(z=>{E.current&&clearTimeout(E.current),I(z),E.current=setTimeout(()=>{w(z)},Vc)},[w,I]),X=z=>{const ee=d.getFieldsValue(!0),R=Object.keys(z)[0];switch(R){case Ki:N(z[R]);break;case Gi:case Yi:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[R]:z[R]===""?"none":z[R]}});break;case zi:S(z[R]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[R]:[{...b?.backgroundImage?.[0],type:"url",value:z[R]}],backgroundSize:"cover"}});break;case Hc:{const q=qi(ee.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:z[R],styles:z[R]},...q?{width:q}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:z})}},V=z=>{s(r.setMobileViewActive({shutdown:z,styles:z})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},F=()=>{g.current=!0},$=()=>{E.current&&(clearTimeout(E.current),E.current=null);const z=d.getFieldValue(Ki);I(z),w(z),requestAnimationFrame(()=>{g.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,...Wc},onValuesChange:X,autoComplete:"off",className:"element-controls",children:[x?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:y,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:hs,max:Dc,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:V})})})}),(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:bs,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:x})})})}),(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:x||k!=="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:x,options:v})})})}),(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:x,options:P})})})})]})]})]})})]})})]})})};fs.propTypes={className:f.default.string};var{Option:gs}=t.ui_kit$Select,{width:_s,widthDim:zc}={width:"width",widthDim:"widthDim"},Gc={[_s]:"",[zc]:""},xs=({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 x=a.getFieldsValue(!0),k=Object.keys(b)[0];let h;switch(k){case"width":h={[k]:{value:b[k],dim:x.widthDim}};break;case"widthDim":h={width:{value:x.width,dim:b[k]}};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,...Gc},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:_s,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)(gs,{value:"px",children:"px"}),(0,o.jsx)(gs,{value:"%",children:"%"})]})})})})]})})};xs.propTypes={className:f.default.string};var Yc=()=>{};function ks(){const e=r.useContainer(),i=(0,n.useCallback)(s=>{if(!e)return Yc;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 Es(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];Es(a)&&Es(d)?l[s]=Ji(d,a):a!==void 0&&(l[s]=a)}return l}function Bs(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 Ss=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}),Xc={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},Kc={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},qc={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},Jc=({className:e})=>{const{__:i}=r.useI18n(),l=W.useGoogleFontsLoader(),s=r.useDispatch(),a=r.useSendPostMessage(),[d]=t.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),m=r.useSelector(r.selectIsNeedUpdateContentAppearance),b=ks(),x=r.useEmailAttribute("common_styles"),k=r.useAppConfig(),{token:h}=(0,t.ui_kit$useToken)(),[p,S]=(0,n.useState)({}),[g,E]=(0,n.useState)({}),[y,v]=(0,n.useState)(!0),[P,w]=(0,n.useState)(!0),[I,N]=(0,n.useState)(!1),[X,V]=(0,n.useState)(!1),F={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},$=Bs(x,b),[z,ee]=(0,n.useState)($.headings.bold),[R,q]=(0,n.useState)($.headings.italic),[re,de]=(0,n.useState)($.links.underline),[se,me]=(0,n.useState)($.buttons.bold),[xe,Ie]=(0,n.useState)($.buttons.italic),[ae,We]=(0,n.useState)(null),ve=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,n.useEffect)(()=>{ve||We(null)},[$,We,ve]),(0,n.useEffect)(()=>{ve&&!ae&&We(Ss($))},[$,ae,ve]),(0,n.useEffect)(()=>{m&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(Ss($)))},[d,m,s,$]);const[pe,ge]=(0,n.useState)(Math.min($.headings.fontSize-1,19)),[le,te]=(0,n.useState)(Math.max($.text.fontSize+1,20));(0,n.useEffect)(()=>{if(ae){const K=ae.buttonsBorder;S(K);const G=Object.keys(K).find(_e=>K[_e]?.width||K[_e]?.style||K[_e]?.color),Q=ae.cardsBorder;E(Q);const ne=Object.keys(Q).find(_e=>Q[_e]?.width||Q[_e]?.style||Q[_e]?.color);d.setFieldsValue({buttons_borderPosition:G||"all",buttons_borderWidth:K[G]?.width!==null?K[G]?.width:"",buttons_borderColor:K[G]?.color||"",buttons_borderStyle:K[G]?.style||"",cards_borderPosition:ne||"all",cards_borderWidth:Q[ne]?.width!==null?Q[ne]?.width:"",cards_borderColor:Q[ne]?.color||"",cards_borderStyle:Q[ne]?.style||"",buttons_borderRadiusAll:u(ae.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(ae.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(ae.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(ae.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(ae.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(ae.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(ae.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(ae.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(ae.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(ae.cardsBorderRadius.bottomRight),blockPaddingAll:u(ae.blockPaddingAll),blockPaddingTop:u(ae.blockPaddingTop),blockPaddingRight:u(ae.blockPaddingRight),blockPaddingBottom:u(ae.blockPaddingBottom),blockPaddingLeft:u(ae.blockPaddingLeft),blockPaddingLeftRight:u(ae.blockPaddingRight)||u(ae.blockPaddingLeft),blockPaddingTopBottom:u(ae.blockPaddingTop)||u(ae.blockPaddingBottom)}),!u(ae.blockPaddingAll)&&(u(ae.blockPaddingTop)||u(ae.blockPaddingRight)||u(ae.blockPaddingBottom)||u(ae.blockPaddingLeft))&&(ae.blockPaddingTop!==ae.blockPaddingBottom||ae.blockPaddingRight!==ae.blockPaddingLeft)?V(!1):V(!0),!u(ae.buttonsBorderRadius.all)&&(u(ae.buttonsBorderRadius.topLeft)||u(ae.buttonsBorderRadius.bottomLeft)||u(ae.buttonsBorderRadius.topRight)||u(ae.buttonsBorderRadius.bottomRight))?v(!1):v(!0),ae.buttonsPadding&&!u(ae.buttonsPadding.all)&&(u(ae.buttonsPadding.bottom)||u(ae.buttonsPadding.right)||u(ae.buttonsPadding.left)||u(ae.buttonsPadding.top))&&N(!1),!u(ae.cardsBorderRadius?.all)&&(u(ae.cardsBorderRadius?.topLeft)||u(ae.cardsBorderRadius?.bottomLeft)||u(ae.cardsBorderRadius?.topRight)||u(ae.cardsBorderRadius?.bottomRight))?w(!1):w(!0)}},[d,ae]);const ce=()=>{V(G=>!G);const K=d.getFieldsValue(!0);if(!X){K.blockPaddingLeftRight=K.blockPaddingLeft,K.blockPaddingTopBottom=K.blockPaddingTop,K.blockPaddingRight=K.blockPaddingLeft,K.blockPaddingBottom=K.blockPaddingTop;const G=Number(K.blockPaddingTopBottom),Q=Number(K.blockPaddingLeftRight);a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(G)?G:0,bottom:Number.isFinite(G)?G:0,left:Number.isFinite(Q)?Q:0,right:Number.isFinite(Q)?Q:0}}})}},ue=K=>{const G=K.target.closest("button");if(!G)return;const Q=G.name,ne=G.classList.contains("selected-td-form__button--active");G.className=ne?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{G.blur()}catch{}Q==="headingBold"?ee(!ne):Q==="headingItalic"?q(!ne):Q==="linkUnderline"?de(!ne):Q==="buttonsBold"?me(!ne):Q==="buttonsItalic"&&Ie(!ne),a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Q]:!ne}})},be=K=>{const G=d.getFieldsValue(!0),Q=Object.keys(K)[0];let ne={};switch(Q){case"headingFontSize":ge(Math.min(G.headingFontSize-1,19)),ne=K;break;case"textFontSize":te(Math.max(G.textFontSize+1,20)),ne=K;break;case"buttons_borderStyle":ne={buttonsBorder:{[G.buttons_borderPosition]:{...p[G.buttons_borderPosition],style:K[Q]}}},G.buttons_borderPosition==="all"?S(_e=>({...r.RESET_BORDER_PARAMS,[G.buttons_borderPosition]:{..._e[G.buttons_borderPosition],style:K[Q]}})):S(_e=>({..._e,[G.buttons_borderPosition]:{..._e[G.buttons_borderPosition],style:K[Q]}}));break;case"buttons_borderColor":ne={buttonsBorder:{[G.buttons_borderPosition]:{...p[G.buttonsBorderPosition],color:K[Q]}}},G.buttons_borderPosition==="all"?S(_e=>({...r.RESET_BORDER_PARAMS,[G.buttons_borderPosition]:{..._e[G.buttons_borderPosition],color:K[Q]}})):S(_e=>({..._e,[G.buttons_borderPosition]:{..._e[G.buttons_borderPosition],color:K[Q]}}));break;case"buttons_borderWidth":ne={buttonsBorder:{[G.buttons_borderPosition]:{...p[G.buttons_borderPosition],width:K[Q]}}},G.buttonsBorderPosition==="all"?S(_e=>({...r.RESET_BORDER_PARAMS,[G.buttons_borderPosition]:{..._e[G.buttons_borderPosition],width:K[Q]}})):S(_e=>({..._e,[G.buttons_borderPosition]:{..._e[G.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":ne={cardsBorder:{[G.cards_borderPosition]:{...g[G.cards_borderPosition],style:K[Q]}}},G.cards_borderPosition==="all"?E(_e=>({...r.RESET_BORDER_PARAMS,[G.cards_borderPosition]:{..._e[G.cards_borderPosition],style:K[Q]}})):E(_e=>({..._e,[G.cards_borderPosition]:{..._e[G.cards_borderPosition],style:K[Q]}}));break;case"cards_borderColor":ne={cardsBorder:{[G.cards_borderPosition]:{...g[G.cardsBorderPosition],color:K[Q]}}},G.cards_borderPosition==="all"?E(_e=>({...r.RESET_BORDER_PARAMS,[G.cards_borderPosition]:{..._e[G.cards_borderPosition],color:K[Q]}})):E(_e=>({..._e,[G.cards_borderPosition]:{..._e[G.cards_borderPosition],color:K[Q]}}));break;case"cards_borderWidth":ne={cardsBorder:{[G.cards_borderPosition]:{...g[G.cards_borderPosition],width:K[Q]}}},G.cardsBorderPosition==="all"?E(_e=>({...r.RESET_BORDER_PARAMS,[G.cards_borderPosition]:{..._e[G.cards_borderPosition],width:K[Q]}})):E(_e=>({..._e,[G.cards_borderPosition]:{..._e[G.cards_borderPosition],width:K[Q]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:g[K[Q]]?.width||"",cards_borderColor:g[K[Q]]?.color||"",cards_borderStyle:g[K[Q]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":ne={buttonsBorderRadius:{[Xc[Q]]:+K[Q]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":ne={cardsBorderRadius:{[Kc[Q]]:+K[Q]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":I?(ne={padding:{all:+K[Q]}},d.setFieldsValue({paddingTop:K[Q],paddingLeft:K[Q],paddingRight:K[Q],paddingBottom:K[Q]})):ne={buttonsPadding:{[F[Q]]:+K[Q]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":ne={blockPadding:{[qc[Q]]:+K[Q]}};break;case"blockPaddingTopBottom":ne={blockPadding:{top:+K[Q],bottom:+K[Q]}},G.blockPaddingTop=G.blockPaddingBottom=+K[Q];break;case"blockPaddingLeftRight":ne={blockPadding:{left:+K[Q],right:+K[Q]}},G.blockPaddingLeft=G.blockPaddingRight=+K[Q];break;default:ne=K}Q!=="buttons_borderPosition"&&a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:ne})};return ae&&(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:ae,onValuesChange:be,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:ce,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:pe,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:le,max:40,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ue.default)({"selected-td-form__button--active":z}),type:"default",name:"headingBold",onClick:ue,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:ue,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":re}),type:"default",name:"linkUnderline",onClick:ue,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})})})}),k.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":se}),type:"default",name:"buttonsBold",onClick:ue,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:ue,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]})]}),k.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)(W.SelectedElementFormBorder,{form:d,borders:p,namePrefix:"buttons_"})})}),k.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:y,setOneBorderRadiusValue:v,elementSettings:ae,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})})})})]})]}),k.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)(W.SelectedElementFormBorder,{form:d,borders:g,namePrefix:"cards_"})})}),k.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:w,elementSettings:ae,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=x=>a(x||"");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)(fs,{className:"email-settings__collapse-panel-content"}):(0,o.jsx)(xs,{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)(Jc,{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 Qc=lo.__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 Zc(e){return e.type===to.Tag||e.type===to.Script||e.type===to.Style}var to,eu,ou,tu,iu,ru,lu,su,au,nu,Ts=lo.__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"})(to||(to={})),eu=to.Root,ou=to.Text,tu=to.Directive,iu=to.Comment,ru=to.Script,lu=to.Style,su=to.Tag,au=to.CDATA,nu=to.Doctype}));function Rs(e){return Zc(e)}function ys(e){return e.type===to.CDATA}function ws(e){return e.type===to.Text}function js(e){return e.type===to.Comment}function vs(e){return e.type===to.Directive}function Is(e){return e.type===to.Root}function du(e){return Object.hasOwn(e,"children")}function Zi(e,i=!1){let l;if(ws(e))l=new wt(e.data);else if(js(e))l=new oi(e.data);else if(Rs(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(ys(e)){const s=i?er(e.children):[],a=new ii(s);for(const d of s)d.parent=a;l=a}else if(Is(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(vs(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,Cs=lo.__esmMin((()=>{Ts(),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=to.Text;get nodeType(){return 3}},oi=class extends yt{type=to.Comment;get nodeType(){return 8}},ti=class extends yt{type=to.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=to.CDATA;get nodeType(){return 4}},vt=class extends jt{type=to.Root;get nodeType(){return 9}},ri=class extends jt{name;attribs;type;constructor(e,i,l=[],s=e==="script"?to.Script:e==="style"?to.Style:to.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=lo.__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:()=>du,isCDATA:()=>ys,isComment:()=>js,isDirective:()=>vs,isDocument:()=>Is,isTag:()=>Rs,isText:()=>ws}),tr,ir,rr=lo.__esmMin((()=>{Ts(),Cs(),Cs(),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?to.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===to.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===to.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}}})),Ps=lo.__commonJSMin((e=>{var i=Qc(),l=(rr(),lo.__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(g){return i.CASE_SENSITIVE_TAG_NAMES_MAP[g]}function b(g){const E={};let y=0;const v=g.length;for(;y<v;y++){const P=g[y];E[P.name]=P.value}return E}function x(g){g=g.toLowerCase();const E=m(g);return E||g}function k(g,E){const y="<"+E,v=g.toLowerCase().indexOf(y);if(v===-1)return!1;const P=g[v+y.length];return P===">"||P===" "||P===" "||P===`
|
|
19
|
-
`||P==="\r"||P==="/"}function h(g){return g.replace(a,d)}function p(g){return g.replace(c,s)}function S(g,E=null,y){const v=[];let P,w=0;const I=g.length;for(;w<I;w++){const N=g[w];switch(N.nodeType){case 1:{const V=x(N.nodeName);P=new l.Element(V,b(N.attributes)),P.children=S(V==="template"?N.content.childNodes:N.childNodes,P);break}case 3:P=new l.Text(p(N.nodeValue??""));break;case 8:P=new l.Comment(N.nodeValue??"");break;default:continue}const X=v[w-1]??null;X&&(X.next=P),P.parent=E,P.prev=X,P.next=null,v.push(P)}return y&&(P=new l.ProcessingInstruction(y.substring(0,y.indexOf(" ")).toLowerCase(),y),P.next=v[0]??null,P.parent=E,v.unshift(P),v[1]&&(v[1].prev=v[0])),v}e.escapeSpecialCharacters=h,e.formatDOM=S,e.hasOpenTag=k})),cu=lo.__commonJSMin((e=>{var i=Ps(),l="html",s="head",a="body",d=/<([a-zA-Z]+[0-9]?)/;function c(g,E){return E?E.createHTML(g):g}var m=(g,E,y)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},b=(g,E,y)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},x=typeof window=="object"&&window.DOMParser;if(typeof x=="function"){const g=new x,E="text/html";b=(y,v,P)=>(v&&(y=`<${v}>${y}</${v}>`),g.parseFromString(y,E)),m=b}if(typeof document=="object"&&document.implementation){const g=document.implementation.createHTMLDocument();m=function(E,y,v){if(y){const P=g.documentElement.querySelector(y);return P&&(P.innerHTML=c(E,v)),g}return g.documentElement.innerHTML=c(E,v),g}}var k=typeof document=="object"&&document.createElement("template"),h;k&&k.content&&(h=(g,E)=>(k.innerHTML=c(g,E),k.content.childNodes));var p=()=>document.createDocumentFragment().childNodes;function S(g,E){g=i.escapeSpecialCharacters(g);const y=d.exec(g)?.[1]?.toLowerCase();switch(y){case l:{const v=b(g);if(!i.hasOpenTag(g,s)){const P=v.querySelector(s);P?.parentNode?.removeChild(P)}if(!i.hasOpenTag(g,a)){const P=v.querySelector(a);P?.parentNode?.removeChild(P)}return v.querySelectorAll(l)}case s:case a:{const v=m(g,void 0,E).querySelectorAll(y);return i.hasOpenTag(g,a)&&i.hasOpenTag(g,s)?v[0].parentNode?.childNodes??p():v}default:return h?h(g,E):m(g,a,E).querySelector(a)?.childNodes??p()}}e.default=S})),uu=lo.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=Ps(),l=cu(),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})),mu=lo.__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}})),pu=lo.__commonJSMin((e=>{var i=0,l=1,s=2,a=3,d=4,c=5,m=6;function b(w){return k.hasOwnProperty(w)?k[w]:null}function x(w,I,N,X,V,F,$){this.acceptsBooleans=I===s||I===a||I===d,this.attributeName=X,this.attributeNamespace=V,this.mustUseProperty=N,this.propertyName=w,this.type=I,this.sanitizeURL=F,this.removeEmptyString=$}var k={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(w=>{k[w]=new x(w,i,!1,w,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([w,I])=>{k[w]=new x(w,l,!1,I,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(w=>{k[w]=new x(w,s,!1,w.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(w=>{k[w]=new x(w,s,!1,w,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(w=>{k[w]=new x(w,a,!1,w.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(w=>{k[w]=new x(w,a,!0,w,null,!1,!1)}),["capture","download"].forEach(w=>{k[w]=new x(w,d,!1,w,null,!1,!1)}),["cols","rows","size","span"].forEach(w=>{k[w]=new x(w,m,!1,w,null,!1,!1)}),["rowSpan","start"].forEach(w=>{k[w]=new x(w,c,!1,w.toLowerCase(),null,!1,!1)});var h=/[\-\:]([a-z])/g,p=w=>w[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(w=>{const I=w.replace(h,p);k[I]=new x(I,l,!1,w,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(w=>{const I=w.replace(h,p);k[I]=new x(I,l,!1,w,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(w=>{const I=w.replace(h,p);k[I]=new x(I,l,!1,w,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(w=>{k[w]=new x(w,l,!1,w.toLowerCase(),null,!1,!1)});var S="xlinkHref";k[S]=new x("xlinkHref",l,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(w=>{k[w]=new x(w,l,!1,w.toLowerCase(),null,!0,!0)});var{CAMELCASE:g,SAME:E,possibleStandardNames:y}=mu(),v=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(y).reduce((w,I)=>{const N=y[I];return N===E?w[I]=I:N===g?w[I.toLowerCase()]=I:w[I]=N,w},{});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=v,e.possibleStandardNames=P}));function hu(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(g){var E=g.match(Ns);E&&(l+=E.length);var y=g.lastIndexOf(Vs);s=~y?g.length-y:s+g.length}function d(){var g={line:l,column:s};return function(E){return E.position=new c(g),x(),E}}function c(g){this.start=g,this.end={line:l,column:s},this.source=i.source}c.prototype.content=e;function m(g){var E=new Error(i.source+":"+l+":"+s+": "+g);if(E.reason=g,E.filename=i.source,E.line=l,E.column=s,E.source=e,!i.silent)throw E}function b(g){var E=g.exec(e);if(E){var y=E[0];return a(y),e=e.slice(y.length),E}}function x(){b(Ls)}function k(g){var E;for(g=g||[];E=h();)E!==!1&&g.push(E);return g}function h(){var g=d();if(!(sr!=e.charAt(0)||ar!=e.charAt(1))){for(var E=2;Yo!=e.charAt(E)&&(ar!=e.charAt(E)||sr!=e.charAt(E+1));)++E;if(E+=2,Yo===e.charAt(E-1))return m("End of comment missing");var y=e.slice(2,E-2);return s+=2,a(y),e=e.slice(E),s+=2,g({type:Hs,comment:y})}}function p(){var g=d(),E=b(Os);if(E){if(h(),!b($s))return m("property missing ':'");var y=b(Fs),v=g({type:Us,property:As(E[0].replace(lr,Yo)),value:y?As(y[0].replace(lr,Yo)):Yo});return b(Ms),v}}function S(){var g=[];k(g);for(var E;E=p();)E!==!1&&(g.push(E),k(g));return g}return x(),S()}function As(e){return e?e.replace(Ds,Yo):Yo}var lr,Ns,Ls,Os,$s,Fs,Ms,Ds,Vs,sr,ar,Yo,Hs,Us,bu=lo.__esmMin((()=>{lr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ns=/\n/g,Ls=/^\s*/,Os=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,$s=/^:\s*/,Fs=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ms=/^[;\s]*/,Ds=/^\s+|\s+$/g,Vs=`
|
|
20
|
-
`,sr="/",ar="*",Yo="",Hs="comment",Us="declaration"}));function fu(e,i){let l=null;if(!e||typeof e!="string")return l;const s=hu(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 gu=lo.__esmMin((()=>{bu()})),_u=lo.__exportAll({default:()=>xu});function xu(e,i){const l={};return!e||typeof e!="string"||fu(e,(s,a)=>{s&&a&&(l[Js(s,i)]=a)}),l}var Ws,zs,Gs,Ys,Xs,Ks,qs,nr,Js,ku=lo.__esmMin((()=>{gu(),Ws=/^--[a-zA-Z0-9_-]+$/,zs=/-([a-z])/g,Gs=/^[^-]+$/,Ys=/^-(webkit|moz|ms|o|khtml)-/,Xs=/^-(ms)-/,Ks=e=>!e||Gs.test(e)||Ws.test(e),qs=(e,i)=>i.toUpperCase(),nr=(e,i)=>`${i}-`,Js=(e,i={})=>Ks(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(Xs,nr):e=e.replace(Ys,nr),e.replace(zs,qs))})),Qs=lo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(k){return k&&k.__esModule?k:{default:k}};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((ku(),lo.__toCommonJS(_u))),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(k,h){return k.includes("-")?!a.has(k):!!(h&&typeof h.is=="string")}var c={reactCompat:!0};function m(k,h){if(typeof k=="string"){if(!k.trim()){h.style={};return}try{h.style=(0,s.default)(k,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=k=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(k.name);e.canTextBeChildOfNode=b;var x=k=>k;e.returnFirstArg=x})),Zs=lo.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=pu(),l=Qs(),s=["checked","value"],a=["input","select","textarea"],d={reset:!0,submit:!0};function c(b={},x){const k={},h=!!(b.type&&d[b.type]);for(const p in b){const S=b[p];if((0,i.isCustomAttribute)(p)){k[p]=S;continue}const g=p.toLowerCase();let E=m(g);if(E){const y=(0,i.getPropertyInfo)(E);switch(s.includes(E)&&a.includes(x)&&!h&&(E=m("default"+g)),k[E]=S,y?.type){case i.BOOLEAN:k[E]=!0;break;case i.OVERLOADED_BOOLEAN:S===""&&(k[E]=!0)}continue}l.PRESERVE_CUSTOM_ATTRIBUTES&&(k[p]=S)}return(0,l.setStyleProp)(b.style,k),k}function m(b){return i.possibleStandardNames[b]}})),Eu=lo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(k){return k&&k.__esModule?k:{default:k}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=m;var l=(rr(),lo.__toCommonJS(or)),s=go("react"),a=i(Zs()),d=Qs(),c={cloneElement:s.cloneElement,createElement:s.createElement,isValidElement:s.isValidElement};function m(k,h={}){var p,S,g,E,y;const v=[],P=typeof h.replace=="function",w=(p=h.transform)!==null&&p!==void 0?p:d.returnFirstArg,{cloneElement:I,createElement:N,isValidElement:X}=(S=h.library)!==null&&S!==void 0?S:c,V=k.length;b(k);for(let F=0;F<V;F++){const $=k[F];if(P){let q=(g=h.replace)===null||g===void 0?void 0:g.call(h,$,F);if(X(q)){V>1&&(q=I(q,{key:(E=q.key)!==null&&E!==void 0?E:F})),v.push(w(q,$,F));continue}}if($.type==="text"){const q=!$.data.trim().length;if(q&&$.parent&&!(0,d.canTextBeChildOfNode)($.parent)||h.trim&&q)continue;v.push(w($.data,$,F));continue}const z=$;let ee={};x(z)?((0,d.setStyleProp)(z.attribs.style,z.attribs),ee=z.attribs):z.attribs&&(ee=(0,a.default)(z.attribs,z.name));let R;switch($.type){case"script":case"style":$.children[0]&&(ee.dangerouslySetInnerHTML={__html:$.children[0].data});break;case"tag":$.name==="textarea"&&$.children[0]?ee.defaultValue=$.children[0].data:!((y=$.children)===null||y===void 0)&&y.length&&(R=m($.children,h));break;default:continue}V>1&&(ee.key=F),v.push(w(N($.name,ee,R),$,F))}return v.length===1?v[0]:v}function b(k){for(const h of k)(h.type==="tag"||h.type==="script"||h.type==="style")&&(Object.setPrototypeOf(h,l.Element.prototype),b(h.children))}function x(k){return d.PRESERVE_CUSTOM_ATTRIBUTES&&k.type==="tag"&&(0,d.isCustomComponent)(k.name,k.attribs)}})),Bu=lo.__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(uu());e.htmlToDOM=l.default;var s=i(Zs());e.attributesToProps=s.default;var a=i(Eu());e.domToReact=a.default;var d=(rr(),lo.__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,x){var k;if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];const h=Object.assign(Object.assign({},(k=x?.htmlparser2)!==null&&k!==void 0?k:c),{trustedTypePolicy:x?.trustedTypePolicy});return(0,a.default)((0,l.default)(b,h),x)}})),mt=lo.__toESM(Bu(),1),Su=mt.default.default||mt.default,Tu={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function ea(e,i,l){l.document&&(r.writeEmailAttributes(l.document,{[e]:i}),l.pushToDataLayer({event:"submit",action:Tu[e],entity_type:l.entityType,entity_id:l.entityId,project_id:l.projectId,context:"editor"}))}function dr({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function oa({limitsInPlugin:e,hostedAiActive:i,counter:l,limit:s}){return dr({limitsInPlugin:e,hostedAiActive:i})?s>0&&l>=s:!1}function ta(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 Ru=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")]})}]},yu={background:r.emCssVar("colorInfo"),color:"#ffffff"},ia=({messages:e,newEmailAiGeneratorRef:i})=>{const l=r.useElementEntityKind(),{document:s}=r.useDocumentSessionContext(),a=r.useContentReader(),d=r.useContentReplacer(),{__:c,_n:m}=r.useI18n(),b=r.useDispatch(),x=r.useAppNavigate(),k=(0,n.useRef)(null),h=r.useAppConfig(),p=r.useNotification(),S=r.useEditorProjectId(),g=r.useOpenEmailId(),E=r.usePushToDataLayer(),y={document:s,pushToDataLayer:E,entityType:l==="block"?"block":"email",entityId:g,projectId:S},v=r.useEventEmitter(fo.events.ON_LIMIT_ID),[P,w]=(0,n.useState)(null),[I,N]=(0,n.useState)(0),[X,V]=(0,n.useState)(!1),[F,$]=(0,n.useState)(""),[z,ee]=(0,n.useState)([]),[R,q]=(0,n.useState)(!1),[re,de]=(0,n.useState)(!1),[se,me]=(0,n.useState)(null),[xe,Ie]=(0,n.useState)(0),[ae,We]=(0,n.useState)(null),ve=r.useEmailAttribute("subject"),pe=r.useEmailAttribute("preheader"),ge=r.useCurrentUser(),le=r.toLanguageCode(r.useInterfaceLocale()),te=ge.avatar_url||ge.avatar_urls?.[24],ce=[ge.first_name,ge.last_name].filter(Boolean).join(" ")||ge.username,ue=r.useMessageService(),[be]=r.useLazyGetDialogQuery(),K=r.useSendPostMessage(),[G,Q]=r.useSendMessageMutation(),[ne,{reset:_e}]=r.useGetAiGenerateStatusMutation(),[fe,{data:Ae=[]}]=r.useLazyGetGeneratedContentQuery(),[je]=r.useLazyGetLimitsStatsByTypeQuery(),Oe={cursor:X?"not-allowed":"default",pointerEvents:X?"none":"auto"};(0,n.useEffect)(()=>{ae&&R&&(i.current=!0),R||(i.current=!1)},[ae,R]);const Y=!!(h.limits&&h.counters)&&!0,{limits:oe}=h.limits?h:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:we,ai_generator_limit:H}=oe,Re=r.useEventEmitter(fo.events.AI_TEXT_REQUEST_ID).hasListeners(),Pe=dr({limitsInPlugin:Y,hostedAiActive:Re}),Ne=oa({limitsInPlugin:Y,hostedAiActive:Re,counter:I,limit:we}),Ve=oa({limitsInPlugin:Y,hostedAiActive:Re,counter:xe,limit:H}),He=(0,n.useCallback)(()=>{v.fire({name:"AiChatCount",count:I+1})},[v,I]),ze=(0,n.useCallback)(()=>{v.fire({name:"AiGeneratorCount",count:xe+1})},[v,xe]),ie=(0,n.useCallback)(async Te=>!0,[c,je,p]);(0,n.useEffect)(()=>{Y&&(N(h?.counters?.ai_counter||0),Ie(h?.counters?.ai_generator_counter||0))},[h,Y]),(0,n.useEffect)(()=>{We(z.length<=0?!1:z.toReversed().find(C=>C.data?.context)?.data.context==="email-generator")},[z]);const Be=(0,n.useCallback)(async()=>await ue.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[ue]),j=(0,n.useCallback)(()=>{const Te=k.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{Te?.scrollTo({top:Te.scrollHeight,behavior:"smooth"})},0)},[k]),Z=(0,n.useCallback)(()=>{r.swallowPromiseRejection(be({entity_id:g}).then(Te=>{ee(Te.data.documents),j()}))},[g,be,ee,j]),ye=(0,n.useCallback)(Te=>{if(!Te?.data?._eventResult)return!1;const{aiMessage:C,aiHtml:U}=Te.data;if(ee(_=>{const L=[..._];for(let B=L.length-1;B>=0;B--)if(L[B]?.data?.isLoading&&L[B]?.data?.role==="assistant"){L[B]={data:{role:"assistant",message:C,isLoading:!1}};break}return L}),U){const _=ta(a(),String(U));d(_,{undoable:!0})}return j(),!0},[a,d,j]),Ce=(0,n.useCallback)(Te=>{ee(C=>{for(let U=C.length-1;U>=0;U--)if(C[U]?.data?.isLoading&&C[U]?.data?.role==="assistant"){const _=[...C];return Te?_[U]={data:{role:"assistant",message:Te}}:_.splice(U,1),_}return C})},[]),De=(0,n.useCallback)(Te=>{const C=Te?.message==="ERROR"?void 0:Te?.message;return[Te?.data?.message,C].find(U=>typeof U=="string"&&U)||c("Something went wrong.")},[c]),Ye=r.useEventEmitter(fo.events.AI_TEXT_PROGRESS_ID);(0,n.useEffect)(()=>{const Te=Ye.event(({progress:C,status:U})=>{const _=U||`${Math.round(C)}%`;ee(L=>{const B=[...L];for(let J=B.length-1;J>=0;J--)if(B[J]?.data?.isLoading&&B[J]?.data?.role==="assistant"){B[J]={data:{...B[J].data,message:_}};break}return B})});return()=>Te.dispose()},[Ye]);const qe=r.useEventEmitter(fo.events.AI_TEXT_STREAM_ID);(0,n.useEffect)(()=>{const Te=qe.event(({partialHtml:C})=>{const U=ta(a(),String(C));d(U,{undoable:!0})});return()=>Te.dispose()},[qe,a,d,b]);const M=(0,n.useCallback)(Te=>{q(!0),V(!0),r.swallowPromiseRejection(ne({task_id:Te||P,entity_id:g,status:"started"}).then(()=>{Z()}))},[g,ne,P,Z]),O=(0,n.useCallback)(()=>{ne({task_id:P,entity_id:g,status:"completed"}).then(Te=>{Te.data.status===403&&_e(),Z()}).catch(Te=>{}),V(!1),q(!1)},[g,ne,P,Z,_e]);(0,n.useEffect)(()=>{let Te;if(R){const C=Ae[Ae.length-1]?.processing?.email;if(C){let U=Ae[Ae.length-1].status;d(String(C),{undoable:!0}),U===0&&O()}se&&(clearInterval(Te),q(!1),me(!1),V(!1),Ce())}return()=>{clearInterval(Te)}},[d,se,b,Ae,R,ve,pe,g,P,Z,ne,Q,O,Ce]),(0,n.useEffect)(j,[j]),(0,n.useEffect)(()=>{e?.length>0&&ee(e),K({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,K]),(0,n.useEffect)(()=>{const Te=ue.onInit(()=>{ue.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:X}),ue.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:X})});return()=>Te.dispose()},[X,ue]);const T=async()=>{if(F){const Te=F.replaceAll(/\n/g,"<br>"),C={project_id:S,connection:"chat",entity_id:g,message:Te,locale:le,subject:ve||"",preheader:pe||"",textContent:di.extractDocumentTextContent(a())};if(ae&&Ve||Ne){p.error({title:c(ae?"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 U={data:{role:"assistant",message:c(ae?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};ee(_=>[..._,U])}else{if(!await ie(ae?"email_generate":"ai")){$("");return}Pe&&(ae&&xe!==H?(ze(),Ie(_=>_+1)):I!==we&&(He(),N(_=>_+1))),E({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:C.entity_id,project_id:C.project_id});const U=[{data:{role:"user",message:Te,userInfo:{display_name:ce,avatar_url:te}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];ee(_=>[..._,...U]),G({body:C}).then(_=>{if(_?.error)throw _.error;if(!_?.data||_.data.status===401)throw new Error(r.ERROR);if(!ye(_)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:g,project_id:S,context:"editor"}),_.data.task_id){let L=_.data.task_id;w(L),fe({id:L,setError:me}),r.swallowPromiseRejection(Be().then(B=>{B?M(L):de(!0)}))}Z()}}).catch(_=>{const L=De(_);p.error({title:_?.data?.code||c("Error"),description:L}),Ce(L)})}$("")}},D=async Te=>{const C={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};ee(_=>[..._,C]);const U={project_id:S,connection:"chat",entity_id:g,context:Te,locale:le,subject:ve||"",preheader:pe||"",textContent:di.extractDocumentTextContent(a())};if(Pe&&(ae&&xe!==H?(ze(),Ie(_=>_+1)):I!==we&&(He(),N(_=>_+1))),Ne)p.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),Ce(c("You have reached the limit of AI chat usage."));else{if(!await ie("ai")){Ce();return}E({event:"select",action:"select_ai_assistant_role",context:U.context,entity_id:U.entity_id,project_id:U.project_id}),G({body:U}).then(_=>{if(_?.error)throw _.error;if(!_?.data||_.data.status===401)throw new Error(r.ERROR);ye(_)||Z()}).catch(_=>{const L=De(_);p.error({title:_?.data?.code||c("Error"),description:L}),Ce(L)})}},he=(0,n.useCallback)(async Te=>{const C={data:{role:"user",message:Te,userInfo:{display_name:ce,avatar_url:te}}},U={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};ee(L=>[...L,C,U]);const _={project_id:S,connection:"chat",entity_id:g,message:Te,locale:le,subject:ve||"",preheader:pe||"",textContent:di.extractDocumentTextContent(a())};if(Ve)p.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),Ce(c("You have reached the limit of AI chat usage."));else{if(!await ie(ae?"email_generate":"ai")){Ce();return}G({body:_}).then(L=>{if(L?.error)throw L.error;if(!L?.data||L.data.status===401)throw new Error(r.ERROR);if(!ye(L)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:g,project_id:S,context:"editor"}),L.data.task_id){let B=L.data.task_id;w(B),fe({id:B,setError:me}),r.swallowPromiseRejection(Be().then(J=>{J?M(B):de(!0)}))}Pe&&(ae&&xe!==H?(ze(),Ie(B=>B+1)):I!==we&&(He(),N(B=>B+1))),Z()}}).catch(L=>{const B=De(L);p.error({title:L?.data?.code||c("Error"),description:B}),Ce(B)})}},[c,I,xe,te,Be,Ce,M,De,ce,we,H,ge,ve,pe,g,ae,Ve,le,He,ze,Pe,a,p,ie,S,G,fe,Z]);(0,n.useEffect)(()=>{const Te=new fo.Disposable,C=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&C&&g){const U={project_id:S,connection:"chat",entity_id:g,context:"email-generator",locale:le};r.runOnceInFlight(`discuss-ai-generator-context:${g}`,()=>{if(Re){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),he(C);return}r.swallowPromiseRejection(G({body:U}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),Te.isDisposed()||he(C)}))})}return()=>Te.dispose()},[e,he,g,le,S,G,Re]);const $e=Te=>{typeof Te.target.className=="string"&&Te.target.className.includes("ai-response-change-context")&&(Q.isLoading||D(Te.target.role))},io=Te=>{const C=Te.children[0].data??"";ea("subject",C,y),p.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:C})},Je=Te=>{const C=Te.children[0].data??"";ea("preheader",C,y),p.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:C,duration:300})},ro=Te=>{const C=Te.children[0].data;navigator.clipboard.writeText(C).then(()=>{p.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:C})}).catch(U=>{})},oo={replace:Te=>{if(Te.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:()=>io(Te),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,mt.domToReact)(Te.children,oo)})})});if(Te.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:()=>Je(Te),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,mt.domToReact)(Te.children,oo)})})});if(Te.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:()=>ro(Te),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,mt.domToReact)(Te.children,oo)})})});if(Te.attribs?.class?.split(" ").includes("ai-response-user-message")){const C=Te.attribs?.data||Te.children?.[0]?.data;return(0,o.jsx)("li",{className:Te.attribs?.class,data:Te.attribs?.data,onClick:()=>he(C),children:(0,mt.domToReact)(Te.children,oo)})}}},mo=()=>{M(),de(!1)},Eo=()=>{O(),de(!1)};return(0,o.jsxs)("div",{ref:k,className:"discuss-main",children:[z.length>0&&(0,o.jsx)(t.ui_kit$List,{onClick:$e,className:"comment-list",itemLayout:"horizontal",dataSource:z,renderItem:Te=>(0,o.jsx)("li",{id:Te._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:Te.data.userInfo?"":"ai-comment",avatar:Te.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"}}):Te.data.userInfo&&Te.data._modified?Te.data.userInfo.avatar_url:te||(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:Oe,children:Te?.data?.role==="user"?ge?.username||c("User"):c("AI Assistant")}),datetime:Te._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(Te._created),m,!0)}}):null,content:Te.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:Oe,children:Su(Te.data.message,oo)})})},Te._id)}),Y&&(ae?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${xe} ${c("of")} ${H>0?H:"∞"} ${c("mail generator")} ${m("was used","were used",xe)}`,exceeded:H>0&&xe>=H,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>x(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${I} ${c("of")} ${we>0?we:"∞"} ${c("messeges")} ${m("was used","were used",I)}`,exceeded:we>0&&I>=we,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>x(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,o.jsxs)(t.ui_kit$Form,{onFinish:T,className:"addMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{disabled:X,value:F,onChange:Te=>$(Te.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:Te=>Te.key==="Enter"&&Te.ctrlKey&&T(),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:Q.isLoading||X,type:"default",style:yu,className:"button-target",children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"top",disabled:X,arrow:{pointAtCenter:!0},menu:{items:Ru(D)},children:(0,o.jsxs)("div",{disabled:X,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:Q.isLoading||X,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:re,onOk:mo,onCancel:Eo,children:(0,o.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},wu=[r.VALID,r.ERRORS,r.WARNINGS],ra=({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:wu.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:ju}=r.OPTIMISE_TABS,la=(0,n.memo)(({__:e,activeTab:i,validateLinksResult:l,validateLinks:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:m,iconStrokeWidth:b,onValidate:x,goToLinkHandler:k})=>i!==ju||!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)(ra,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:a}),(0,o.jsx)(t.ui_kit$Button,{disabled:m,loading:c,onClick:x,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:()=>k(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)})})})]}));la.displayName="LinksSection";var{IMAGES:vu}=r.OPTIMISE_TABS,sa=(0,n.memo)(({__:e,activeTab:i,validateImagesResult:l,validateImages:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:m,iconStrokeWidth:b,onValidate:x,goToImageHandler:k,showImgPreviewHandler:h,hideBlockPreviewHandler:p})=>i!==vu||!l?.images?null:l.images.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,o.jsx)(t.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,o.jsxs)("div",{className:"optimise__summary",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.images.length," "]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.summaryTime?.value,l.summaryTime?.name]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...l.images.map(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)(ra,{__: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:x,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,g)=>(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:()=>k(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")})]})})},g)})})})]}));sa.displayName="ImagesSection";var{SPAM_ASSASSIN:Iu}=r.OPTIMISE_TABS,aa=(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!==Iu||!m)return null;const b=l.spamScore||0,x=l.baseSpamScore||0,k=b<2||!l.spamScore||b<=x-1?"success":b<x-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:k,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>x-1&&(0,o.jsx)(t.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(x-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.")})})})]})});aa.displayName="SpamSection";var{PROBLEMS:Cu}=r.OPTIMISE_TABS,na=(0,n.memo)(({__:e,activeTab:i,problemsList:l,onSetMonacoPosition:s})=>i!==Cu?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"})}));na.displayName="ProblemsSection";var Pu={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,linkCheckCounter:0,imageCheckCounter:0,spamCheckCounter:0,validateLinksResult:{},validateImagesResult:{}},Au=(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"},cr={link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},Nu=(e,i)=>{const l=Object.values(li),s=Object.values(cr);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},Lu=(e,i)=>({counter:e,limit:i,disabled:i>0&&e>=i}),Ou=({appConfig:e,data:i,isSuccess:l,optimisationCounter:s,linkCheckCounter:a,imageCheckCounter:d,spamCheckCounter:c,setOptimisationCounter:m,setLinkCheckCounter:b,setImageCheckCounter:x,setSpamCheckCounter:k})=>{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]),g=(0,n.useMemo)(()=>h&&Nu(p,S),[h,p,S]),E=(0,n.useMemo)(()=>pt(S,"optimization_limit",0),[S]),y=(0,n.useMemo)(()=>!g&&s>=E&&E>0,[g,s,E]),v=(0,n.useMemo)(()=>{const w={link_check:a,image_check:d,spam_check:c};return Object.keys(cr).reduce((I,N)=>{const X=cr[N],V=g?pt(S,X,0):E,F=g?w[N]:s;return I[N]=Lu(F,V),I},{})},[g,S,E,a,d,c,s]),P=w=>g?v[w].disabled:y;return(0,n.useEffect)(()=>{if(!h){const w=i?.counters;l&&w?.optimization_counter&&m(w.optimization_counter);return}m(pt(p,"optimization_counter",0)),g&&(b(pt(p,li.link_check,0)),x(pt(p,li.image_check,0)),k(pt(p,li.spam_check,0)))},[h,g,i,l,p,m,b,x,k]),{limitsInPlugin:h,perTypeAvailable:g,currentBillingOptimisationLimits:E,disableFields:y,typeLimits:v,isTypeDisabled:P}},$u=()=>{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:Fu,IMAGES:Mu}=r.OPTIMISE_TABS,Du=({activeTab:e,selectedTags:i,validateLinksResult:l,validateImagesResult:s,setValidateLinks:a,setValidateImages:d})=>{(0,n.useEffect)(()=>{e===Fu&&l.links&&a(i.length>0?l.links.filter(c=>i.includes(c.status)):l.links),e===Mu&&s.images&&d(i.length>0?s.images.filter(c=>i.includes(c.status)):s.images)},[l.links,s.images,i,e,a,d])},Vu=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,da=e=>e.statusCode!==null&&e.statusCode<300?r.VALID:e.statusCode<400&&e.statusCode>=300||e.statusCode===200&&!e.valid?r.WARNINGS:r.ERRORS,ca=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}),Hu={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 ua(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:x,changePlanLabel:k})=>{const{__:h}=r.useI18n(),p=k??h("Change plan"),S=!!x,g=a!=null?Hu[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:g}),ua(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"})}),ua(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:x?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:x.onClick,children:x.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:ur,IMAGES:mr,SPAM_ASSASSIN:ma,PROBLEMS:pr}=r.OPTIMISE_TABS,pa={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},Uu={link_check:"LinkCheckCount",image_check:"ImageCheckCount",spam_check:"SpamCheckCount"},Wu={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},ha=(e,i,l,s)=>`${e} ${l("of")} ${i>0?i:"∞"} ${s("test","tests",i>0?i:e)} ${s("was used","were used",e)}`,ba=()=>{const{__:e,_n:i}=r.useI18n(),l=r.useDispatch(),s=r.useOpenPlanCatalog(),a=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),m=r.useAppConfig(),b=r.useEditorProjectId(),x=r.useRouteEmailId(),{document:k}=r.useDocumentSessionContext(),h=r.useEmailOfDocument(k,void 0),p=x||(h?.id!=null?String(h.id):void 0),S=p||h?.renderGuid,g=b||(h?.project!=null?String(h.project):void 0),[E,y]=(0,n.useState)(null),v=(0,n.useRef)(!1),P=(0,n.useRef)({link_check:!1,image_check:!1,spam_check:!1}),w=r.useProjectPlanLimitPreflight(),I=(0,n.useCallback)(j=>{y(j)},[]),N=(0,n.useCallback)((j,Z)=>j?.status===401&&j?.data?.code==="usage_limit_exceeded"?(I({presetId:{link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"}[Z],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")}),l(r.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0):!1,[l,e,I]),X=(0,n.useCallback)((j,Z)=>{N(j,Z)||d.error({error:j})},[N,d]),V=(0,n.useCallback)(async j=>!0,[l,w,I]),F=r.useMessageService(),$=r.useSelector(r.selectProblemsList),z=r.useEventEmitter(fo.events.ON_LIMIT_ID),ee=r.usePushToDataLayer(),[R,q]=(0,n.useReducer)(Au,Pu),[re,de]=r.useEditSpamMutation(),[se,me]=r.useEditLinksMutation(),[xe,Ie]=r.useEditImagesMutation(),{data:ae,isSuccess:We}=r.useGetProjectQuery(+(g||0),{skip:!0}),ve=r.useInvalidateProject(),pe=(0,n.useCallback)(j=>q({type:"SET_OPTIMISATION_COUNTER",payload:j}),[]),ge=(0,n.useCallback)(j=>q({type:"SET_LINK_CHECK_COUNTER",payload:j}),[]),le=(0,n.useCallback)(j=>q({type:"SET_IMAGE_CHECK_COUNTER",payload:j}),[]),te=(0,n.useCallback)(j=>q({type:"SET_SPAM_CHECK_COUNTER",payload:j}),[]),ce=(0,n.useCallback)(j=>q({type:"SET_VALIDATE_LINKS",payload:j}),[]),ue=(0,n.useCallback)(j=>q({type:"SET_VALIDATE_IMAGES",payload:j}),[]),be=(0,n.useCallback)(j=>q({type:"SET_SELECTED_TAGS",payload:j}),[]),{limitsInPlugin:K,perTypeAvailable:G,currentBillingOptimisationLimits:Q,disableFields:ne,typeLimits:_e,isTypeDisabled:fe}=Ou({appConfig:m,data:ae,isSuccess:We,optimisationCounter:R.optimisationCounter,linkCheckCounter:R.linkCheckCounter,imageCheckCounter:R.imageCheckCounter,spamCheckCounter:R.spamCheckCounter,setOptimisationCounter:pe,setLinkCheckCounter:ge,setImageCheckCounter:le,setSpamCheckCounter:te});Du({activeTab:R.activeTab,selectedTags:R.selectedTags,validateLinksResult:R.validateLinksResult,validateImagesResult:R.validateImagesResult,setValidateLinks:ce,setValidateImages:ue});const{showImgPreviewHandler:Ae,hideBlockPreviewHandler:je}=$u(),Oe=(0,n.useCallback)(j=>j==="link_check"?R.linkCheckCounter:j==="image_check"?R.imageCheckCounter:R.spamCheckCounter,[R.linkCheckCounter,R.imageCheckCounter,R.spamCheckCounter]),Y=(0,n.useCallback)(j=>{if(K){if(G){q({type:{link_check:"INCREMENT_LINK_CHECK_COUNTER",image_check:"INCREMENT_IMAGE_CHECK_COUNTER",spam_check:"INCREMENT_SPAM_CHECK_COUNTER"}[j]}),z.fire({name:Uu[j],count:Oe(j)+1});return}q({type:"INCREMENT_OPTIMISATION_COUNTER"}),z.fire({name:"OptimizationCount",count:R.optimisationCounter+1})}},[K,G,z,Oe,R.optimisationCounter]),oe=(0,n.useCallback)(j=>{if(G){const{limit:Z}=_e[j];I({presetId:Wu[j],previousDisplay:Z>0?Z:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}I({presetId:"optimization_exceeded",previousDisplay:Q,nextDisplay:r.presetLimitDisplay("infinity")})},[G,_e,I,Q]),we=(0,n.useCallback)(()=>{a(m.billingPageUrl||r.APP_ROUTES.billing)},[m.billingPageUrl,a]),H=j=>{if(!K||!G)return null;const{counter:Z,limit:ye,disabled:Ce}=_e[j];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ha(Z,ye,e,i),exceeded:Ce,extra:(0,o.jsx)("button",{type:"button",style:pa,onClick:we,children:e("Need more?")})})},Re=(0,n.useCallback)((j,Z)=>{F.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:j,isError:Z}})},[F]),Pe=(0,n.useCallback)((j,Z)=>{F.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:j,isError:Z}})},[F]),Ne=(0,n.useCallback)(j=>{const Z={startColumn:j.startColumn,startLineNumber:j.startLineNumber,endColumn:j.endColumn,endLineNumber:j.endLineNumber};l(r.setActiveProblemRange(Z))},[l]),Ve=(0,n.useCallback)(j=>{q({type:"SET_ACTIVE_TAB",payload:j}),q({type:"RESET_SELECTED_TAGS"}),j===pr&&$?.length>0&&ee({event:"check",action:"check_email_code",email_id:p,project_id:g,problems_count:$?.length||0})},[$,ee,p,g]),He=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(fe("link_check")){oe("link_check");return}if(!await V("link_check"))return;Y("link_check");const j=c(),Z=new DOMParser().parseFromString(j,"text/html"),ye={},Ce={};Z.querySelectorAll("a[href]").forEach((De,Ye)=>{ye[`link_${Ye}`]=De.getAttribute("href"),Ce[`link_${Ye}`]=De.textContent||""}),F.send({operation:"sandbox_set_attr_to_links"}),se({entity_id:S,data:ye}).then(({data:De,error:Ye})=>{if(Ye)X(Ye,"link_check");else if(De?.result){const qe=[...De.result];qe?.sort((T,D)=>T.linkId-D.linkId);const M=qe.map(T=>({...T,text:Ce[T.linkId],status:Vu(T)})),O={links:M,summary:ca(M)};q({type:"SET_VALIDATE_LINKS_RESULT",payload:O}),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}`}),ee({event:"check",action:"check_email_links",email_id:p,project_id:g,links_count:O.links?.length||0})}else De.statusCode>300||!De.success?d.error({error:{data:De}}):d.error({title:e("Something went wrong.")}),!R.validateLinksResult.links&&Ve("")}).catch(De=>{X(De,"link_check")})},[p,S,fe,oe,V,Y,c,F,se,d,e,ee,g,ve,R.validateLinksResult.links,X,Ve]),ze=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(fe("image_check")){oe("image_check");return}if(!await V("image_check"))return;Y("image_check");const j=c(),Z=new DOMParser().parseFromString(j,"text/html"),ye={};Z.querySelectorAll("img").forEach((Ce,De)=>ye[`image_${De}`]=Ce.src),F.send({operation:"sandbox_set_attr_to_images"}),xe({entity_id:S,data:ye}).then(({data:Ce,error:De})=>{let Ye;if(De)X(De,"image_check");else if(Ce?.result){const qe=Object.values(Ce.result);qe.sort((O,T)=>O.imageId-T.imageId);const M=qe.reduce((O,T)=>O+Math.round(T.image.bytes/1024),0);Ye={images:qe.map(O=>({...O,status:da(O)}))||[],summary:ca(qe.map(O=>({...O,status:da(O)}))),summaryTime:{value:(M>1200?M/1e3:M).toFixed(1),name:M>1200?e("MB"):e("KB")}},Ye&&q({type:"SET_VALIDATE_IMAGES_RESULT",payload:Ye}),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}`}),ee({event:"check",action:"check_email_images",email_id:p,project_id:g,images_count:Ye.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&&Ve("")}).catch(Ce=>{X(Ce,"image_check")})},[p,S,fe,oe,V,Y,c,F,xe,d,e,ee,g,ve,R.validateImagesResult,X,Ve]),ie=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(fe("spam_check")){oe("spam_check");return}await V("spam_check")&&(Y("spam_check"),re({entity_id:S,data:{html:c()}}).then(({data:j,error:Z})=>{if(Z)X(Z,"spam_check");else if(j&&j.success){const ye=!!j.result.report&&Object.values(j.result.report);ye?(ye.sort((Ce,De)=>Ce.score-De.score),q({type:"SET_VALIDATE_SPAM_RESULT",payload:{...j.result,report:ye}})):j.result&&q({type:"SET_VALIDATE_SPAM_RESULT",payload:{...j.result,report:ye}}),d.success(e("Spam validation was successfully completed")),j.limit_warning&&j.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${j.limit_remaining}`}),ee({event:"check",action:"check_email_spam",email_id:p,project_id:g,spam_score:j.result?.spamScore||0})}else j.statusCode>300||!j.success?d.error({error:{data:j}}):d.error({title:e("Something went wrong.")}),!R.validateSpamResult?.report?.length&&Ve("")}).catch(j=>{X(j,"spam_check")}))},[p,S,fe,oe,V,Y,c,re,d,e,ee,g,ve,R.validateSpamResult,X,Ve]);(0,n.useEffect)(()=>{if(K){if(G){["link_check","image_check","spam_check"].forEach(j=>{const{limit:Z,counter:ye,disabled:Ce}=_e[j];if(!Ce){P.current[j]=!1;return}P.current[j]||Z>0&&ye>=Z&&(P.current[j]=!0,oe(j))});return}if(!(Q>0&&R.optimisationCounter>=Q)){v.current=!1;return}v.current||(v.current=!0,oe("link_check"))}},[K,G,_e,R.optimisationCounter,Q,oe]);const Be=E?r.getLimitUpgradePresetDefinition(E.presetId):null;return(0,o.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[Be&&E?(0,o.jsx)(si,{open:!0,onClose:()=>y(null),title:e(Be.titleKey),subtitle:e(Be.subtitleKey),usageResource:Be.usageResource,previousDisplay:E.previousDisplay,nextDisplay:E.nextDisplay,onChangePlan:()=>{y(null),s()}}):null,K&&!G&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ha(R.optimisationCounter,Q,e,i),exceeded:ne,extra:(0,o.jsx)("button",{type:"button",style:pa,onClick:we,children:e("Need more?")})}),m.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[H("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:j=>j.preventDefault(),onClick:()=>{Ve(ur),!R.validateLinksResult?.links?.length&&R.activeTab!==ur&&He()},loading:me.isLoading,disabled:fe("link_check")&&!R.validateLinksResult?.links?.length,children:!me.isLoading&&(R.activeTab===ur?(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)(la,{__:e,activeTab:R.activeTab,validateLinksResult:R.validateLinksResult,validateLinks:R.validateLinks,selectedTags:R.selectedTags,setSelectedTags:be,isLoading:me.isLoading,disabled:fe("link_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:He,goToLinkHandler:Re})]}),m.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[H("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:j=>j.preventDefault(),onClick:()=>{Ve(mr),!R.validateImagesResult?.images?.length&&R.activeTab!==mr&&ze()},loading:Ie.isLoading,children:!Ie.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,validateImagesResult:R.validateImagesResult,validateImages:R.validateImages,selectedTags:R.selectedTags,setSelectedTags:be,isLoading:Ie.isLoading,disabled:fe("image_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:ze,goToImageHandler:Pe,showImgPreviewHandler:Ae,hideBlockPreviewHandler:je})]}),m.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[H("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:j=>j.preventDefault(),loading:de.isLoading,onClick:()=>{Ve(ma),R.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(R.validateSpamResult,"spamScore")||ie()},disabled:fe("spam_check")&&!(R.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(R.validateSpamResult,"spamScore")),children:!de.isLoading&&(R.activeTab===ma?(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,validateSpamResult:R.validateSpamResult,isLoading:de.isLoading,disabled:fe("spam_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:ie})]}),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:j=>j.preventDefault(),onClick:()=>Ve(pr),children: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)(na,{__:e,activeTab:R.activeTab,problemsList:$,onSetMonacoPosition:Ne})]})]})},zu=({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:[Gu(e,a),(0,o.jsx)(t.ui_kit$Flex,{justify:"flex-end",children:Yu(e,{onCancel:i,onRetry:l,onDismiss:s},a)})]})})})};function Gu(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 Yu(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 Xu=2500,fa=48,Ku=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 Ju(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function Qu({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 x=(0,n.useRef)(l);x.current=l;const k=(0,n.useRef)(s);k.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 g=0;try{for(;m.current&&b.current===S&&x.current;){const E=await h();if(!m.current)break;if(E)if(E.kind==="hidden"){if(g+=1,g>=fa){d({kind:"failed"});break}}else{if(g=0,d(E),E.kind==="done")try{await k.current?.()}catch{}if(Ju(E))break}else if(g+=1,g>=fa){d({kind:"failed"});break}await new Promise(y=>setTimeout(y,Xu))}}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"})},Ku);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)(()=>{x.current=!0,i.files.backfillCreate({project_id:e}),p()},[i,e,p]),dismiss:(0,n.useCallback)(()=>d({kind:"hidden"}),[])}}var Zu=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./2f32a31d.js")),void 0,{}.url)),em=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./9ef544f4.js")),void 0,{}.url)),ga={height:"100%"};function om(e){(e?(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./26971a74.js")),void 0,{}.url):(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./efb5b933.js")),void 0,{}.url)).catch(()=>{})}var tm=({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&&om(m)},[c,m]);let b=(0,o.jsx)(t.ui_kit$PageLoader,{style:ga});return e&&i&&d.imageCenterFileManagerView?b=(0,o.jsx)(Zu,{storageProvider:e,dataProvider:i,pathProxy:l},a):e&&i&&(b=(0,o.jsx)(em,{dataProvider:i,usesBuiltInStorage:s},a)),(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:ga}),children:b})};function im(){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(),x=s?.id?String(s.id):"",k=b?.id!=="0"?String(b.id):"",h=r.isFileManagerV2Enabled(e),[p,S]=(0,n.useState)(null),g=h&&!!x&&p===x,[E,y]=(0,n.useState)(0),[v,P]=(0,n.useState)(0),w=(0,n.useRef)(x);(0,n.useEffect)(()=>{w.current!==x&&(w.current=x,S(null))},[x]);const I=(0,n.useCallback)(F=>{F&&x&&S(x)},[x]),N=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:l,projectId:x,restApi:a,restApiV2:c,i18n:m,pathPostfix:k,appConfig:e,isStandalone:i,onIndexingStateChange:I}),[e,I,m,i,x,E,a,c,l,k]),X=(0,n.useCallback)(async()=>{try{typeof N.dataProvider?.clearCache=="function"&&await N.dataProvider.clearCache()}catch{}S(null),y(F=>F+1),P(F=>F+1)},[N.dataProvider]),V=(0,n.useCallback)(()=>{x&&S(x)},[x]);return{...N,projectId:x,restApiV2:c,v2Enabled:h,backfillTriggered:g,contentKey:`${x}:${v}`,handleIndexingCompleted:X,markIndexingStarted:V}}var rm={height:"100%"},_a=()=>{const{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,projectId:a,restApiV2:d,v2Enabled:c,backfillTriggered:m,contentKey:b,handleIndexingCompleted:x,markIndexingStarted:k}=im(),h=r.useSelector(r.selectActiveModal$1),p=r.isImageCenterModal(h),{state:S,cancel:g,retry:E,dismiss:y}=Qu({projectId:a,api:d,triggered:m,onCompleted:x}),v=n.default.useCallback(()=>{k(),E()},[k,E]);return(0,o.jsxs)(o.Fragment,{children:[p&&(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:rm}),children:(0,o.jsx)(tm,{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:b})}),c&&(0,o.jsx)(zu,{state:S,onCancel:g,onRetry:v,onDismiss:y})]})},lm=(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 sm(e){return!!(e?.global_block??e?.acf?.global_block)}var am=({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})})})},xa=new Map;function ka(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function hr(e,i){const l=i??"";if(e===void 0)return r.sanitizeHtml(ka(l));const s=String(e),a=xa.get(s);if(a&&a.source===l)return a.markup;const d=r.sanitizeHtml(ka(l));return xa.set(s,{source:l,markup:d}),d}function nm(e,i){return e?i.openBlockFromEmailEnabled===!0?"over-email":null:"link"}var dm={fontSize:"16px",margin:0},{name:br,type:Ea,tags:Ba}={name:"name",type:"type",tags:"tags"},Sa={[br]:"",[Ea]:[],[Ba]:[]},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},fr=({parentEmailId:e,blocksTab:i,search:l,reloadBlockScreens:s,setIsShowAddAllBlocksModal:a})=>{const d=r.parentEmailSource(e),c=r.useEditorProjectId(),m=r.useSetHtmlElementInIframeHandler(),b=r.useDragStartBlockToIframeHandler(),[x]=t.ui_kit$Form.useForm(),{data:k}=r.useGetBlocksSchemaQuery(),{token:h}=(0,t.ui_kit$useToken)(),{__:p,_x:S}=r.useI18n(),g=r.useNotification(),{modal:E}=t.ui_kit$App.useApp(),{confirm:y}=E,v={pathname:r.useRoutePathname()},P=r.useAppConfig(),w=r.useSelector(r.selectParentBlocks),I=ks(),N=(0,n.useRef)(null),X=(0,n.useRef)(null),V=r.useRootElement(),F=660,$=207/F,z=_=>sm(_)?(0,o.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,o.jsx)(am,{className:"block-global-badge--tile",size:14})}):null,ee=r.useEmailAttribute("common_styles"),R=(0,n.useMemo)(()=>Bs(ee,I),[ee,I]),q=(0,n.useRef)(null),re=(0,n.useRef)(null),de=(0,n.useRef)(null),se=r.useStore();(0,n.useEffect)(()=>{X.current?.scrollTo({top:0})},[i,l]);const me=r.useProjectData(),{data:xe}=r.useGetTermsQuery({project:me,kind:r.BLOCK_TAGS},{skip:!me?.id}),[Ie,ae]=(0,n.useState)(()=>r.projectBlocksArgs(c));(0,n.useEffect)(()=>{l||(x.setFieldsValue(Sa),j({type:null,name:null}),s())},[l,x,s]),(0,n.useEffect)(()=>{if(k){const _=k.schema.properties.acf.properties.type.items.enum;let L=[];for(let B in _)L.push({label:p(r.TYPES_TRANSLATE[_[B]]),value:_[B]})}},[k,p]);const{isSuccess:We,isError:ve,isLoading:pe,isFetching:ge,data:le,refetch:te,error:ce}=r.useGetBlocksQuery({...Ie,page:1}),ue=(0,n.useMemo)(()=>{if(We&&le)return[...le].sort((_,L)=>ht[_.type]-ht[L.type])},[We,le]),[be,K]=(0,n.useState)([]);r.usePrevious(_=>{_!==ve&&g.fromError("BLOCK_GET_ERROR",{},ce,!0)},[ve,ce,g]);const[G,Q]=(0,n.useState)(()=>r.parentEmailBlocksArgs(d)),{isSuccess:ne,isError:_e,isLoading:fe,isFetching:Ae}=r.useGetParentEmailBlocksQuery({...G,emailId:d,page:1},{skip:!d||w.length}),je=(0,n.useMemo)(()=>{if(ne||w.length)return[...w].sort((_,L)=>ht[_.type]-ht[L.type])},[ne,w]),[Oe,Y]=(0,n.useState)([]);(0,n.useEffect)(()=>{const _=new Set;if(w.length&&je){for(const L of je)L.type&&_.add(L.type);Y(Array.from(_))}else Y([])},[w,je]);const[oe,we]=(0,n.useState)(r.templateBlocksArgs),{isSuccess:H,isError:Re,isLoading:Pe,isFetching:Ne,data:Ve=[]}=r.useGetTemplateBlocksQuery({...oe,page:1}),He=(0,n.useMemo)(()=>{if(Ve.length)return[...Ve].sort((_,L)=>ht[_.type]-ht[L.type])},[Ve]),[ze,ie]=(0,n.useState)([]);(0,n.useEffect)(()=>{const _=new Set;if(He&&Ve.length){for(const L of He)L.type&&_.add(L.type);ie(Array.from(_))}},[Ve.length,He]);const Be=(0,n.useMemo)(()=>{const _=new Set;for(const L of be)_.add(L);for(const L of Oe)_.add(L);for(const L of ze)_.add(L);return Array.from(_)},[ze,Oe,be]),j=_=>{ae(L=>({...L,..._,page:1})),Q(L=>({...L,..._,page:1})),we(L=>({...L,..._,page:1}))},Z=r.useFitBlockPreviewHeight($),ye=(0,n.useCallback)(()=>{V.querySelector(".blocks-search__result-wrapper.is_search")&&(V.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),V.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(V,207/F),V.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",V.querySelectorAll(".blocks-search__result-wrapper").forEach(_=>_.style.opacity=1))},[F,V]);(0,n.useEffect)(()=>{!(Ne||Pe)&&H&&i!=="template"&&(l?ye():s())},[Ne,Pe,H,ye,Ie.name,s,l,i]),(0,n.useEffect)(()=>{const _=new Set;if(We&&ue){for(const L of ue)L.type&&_.add(L.type);K(Array.from(_))}},[We,ue]);const Ce=_=>{const L=Object.keys(_)[0],B=x.getFieldsValue(!0);switch(L){case Ba:const J=(xe||[]).filter(Se=>_[L].includes(Se.name)).map(Se=>Se.id)||null;j({tags:J});break;case Ea:j({type:B.type||null});break;case br:N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(function(){j({name:B.name||null})},300)}},De=_=>{s(),_.target.getAttribute("data-type")?(_.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(L=>L.style.display="none"),_.target.closest(".blocks-search").querySelectorAll(`[data-type="${_.target.getAttribute("data-type")}"]`).forEach(L=>L.style.display="block")):_.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(L=>L.style.display="block"),_.target.parentElement.querySelector(".active").classList.remove("active"),_.target.classList.add("active")};let Ye=null;const qe=_=>{clearTimeout(Ye);let L=V.querySelector(".block-search__preview")?V.querySelector(".block-search__preview"):null,B=V.querySelector(".block-search__preview-title")?V.querySelector(".block-search__preview-title"):null,J=V.querySelector(".block-search__preview-content")?V.querySelector(".block-search__preview-content"):null;V.querySelector(".block-search__preview")||(L=document.createElement("div"),L.classList.add("block-search__preview"),B=document.createElement("div"),B.classList.add("block-search__preview-title"),J=document.createElement("div"),J.classList.add("block-search__preview-content"),L.append(J),L.append(B),V.querySelector(".email-pane__col_settings-inner").append(L)),B.innerHTML="",J.innerHTML="",B.innerHTML=_.title;let Se=_.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();J.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+Se+"</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 _=V.querySelector(".block-search__preview");_&&(Ye=setTimeout(()=>{_.style.opacity="0",_.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){_.remove()},300)},300))};(0,n.useEffect)(()=>{V.querySelectorAll(".blocks-search__result").forEach(_=>{_.style.display="block"})},[i]);const O=!le?.length&&(!d||!w?.length)&&!Ve?.length&&(Ie.tags||Ie.name||Ie.type)&&!(pe||ge),T=_=>se.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(_.id)).then(L=>{L.error&&g.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(_),L.error),g.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(_),title:p('The block "')+L.data.title+S('" was successfully removed.',"block")}),te()});(0,n.useEffect)(()=>{!pe&&!ge&&s()},[pe,ge,s]),(0,n.useEffect)(()=>{(i==="common"||l)&&setTimeout(s,50)},[le,s,i,l]);const D=_=>{y({mask:{closable:!0},centered:!0,title:S("Are you sure you want to delete the “","block")+_.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:()=>T(_)})},he=(_,L)=>`${_.pathname.split("emails")[0]}blocks/${L.id}`,$e=_=>{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:()=>D(_)}];const B=nm(!0,P);return B==="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:he(v,_),children:" "})}),B==="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:dm}),onClick:()=>{r.getEmitter(fo.getContainer(se),fo.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(_.id)).then(({errors:J})=>{J.length&&g.fromError("BLOCK_GET_ERROR",r.getBlockDesc(_),J[0])})}}),L},io=_=>{let L=_.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(L.replaceChildren(...r.parseFromString(_.html)),Object.keys(R).length!==0&&(L.querySelectorAll(".em-contrast-card").forEach(B=>{R.cards?.contrastBackgroundColor&&(B.getAttribute("bgcolor")?R.cards.contrastBackgroundColor?B.setAttribute("bgcolor",R.cards.contrastBackgroundColor):B.removeAttribute("bgcolor"):R.cards.contrastBackgroundColor?B.style.backgroundColor=R.cards.contrastBackgroundColor:B.style.removeProperty("background-color")),R.cards?.contrastTextColor&&B.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(J=>{if(ro(J.style.color).toLowerCase()!=="#ffffff"){let Se=J.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.cards.contrastTextColor};`);J.setAttribute("style",Se)}})}),L.querySelectorAll(".em-card").forEach(B=>{R.cards?.baseBackgroundColor&&(B.getAttribute("bgcolor")?R.cards.baseBackgroundColor?B.setAttribute("bgcolor",R.cards.baseBackgroundColor):B.removeAttribute("bgcolor"):R.cards.baseBackgroundColor?B.style.backgroundColor=R.cards.baseBackgroundColor:B.style.removeProperty("background-color")),R.cards?.baseTextColor&&B.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(J=>{if(ro(J.style.color).toLowerCase()!=="#ffffff"){let Se=J.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.cards.baseTextColor};`);J.setAttribute("style",Se)}})}),L.querySelectorAll(".em-card, .em-contrast-card").forEach(B=>{R.cards?.border&&mo({settings:{border:R.cards?.border},elem:B}),R.cards?.borderRadius?.all?(B.style.borderBottomLeftRadius&&B.style.borderBottomLeftRadius!=="0px"&&(B.style.borderBottomLeftRadius=R.cards?.borderRadius.all+"px"),B.style.borderBottomRightRadius&&B.style.borderBottomRightRadius!=="0px"&&(B.style.borderBottomRightRadius=R.cards?.borderRadius.all+"px"),B.style.borderTopLeftRadius&&B.style.borderTopLeftRadius!=="0px"&&(B.style.borderTopLeftRadius=R.cards?.borderRadius.all+"px"),B.style.borderTopRightRadius&&B.style.borderTopRightRadius!=="0px"&&(B.style.borderTopRightRadius=R.cards?.borderRadius.all+"px")):R.cards?.borderRadius?.all===""?B.style.removeProperty("border-radius"):(R.cards?.borderRadius?.topLeft&&B.style.borderTopLeftRadius&&B.style.borderTopLeftRadius!=="0px"?B.style.borderTopLeftRadius=R.cards?.borderRadius.topLeft+"px":R.cards?.borderRadius?.topLeft===""&&B.style.removeProperty("border-top-left-radius"),R.cards?.borderRadius?.topRight&&B.style.borderTopRightRadius&&B.style.borderTopRightRadius!=="0px"?B.style.borderTopRightRadius=R.cards?.borderRadius.topRight+"px":R.cards?.borderRadius?.topRight===""&&B.style.removeProperty("border-top-right-radius"),R.cards?.borderRadius?.bottomRight&&B.style.borderBottomRightRadius&&B.style.borderBottomRightRadius!=="0px"?B.style.borderBottomRightRadius=R.cards?.borderRadius.bottomRight+"px":R.cards?.borderRadius?.bottomRight===""&&B.style.removeProperty("border-bottom-right-radius"),R.cards?.borderRadius?.bottomLeft&&B.style.borderBottomLeftRadius&&B.style.borderBottomLeftRadius!=="0px"?B.style.borderBottomLeftRadius=R.cards?.borderRadius.bottomLeft+"px":R.cards?.borderRadius?.bottomLeft===""&&B.style.removeProperty("border-bottom-left-radius"))}),L.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(B=>{if(!B.style.display&&parseFloat(B.style.fontSize)<=20){let J="",Se=R.text.fontFamily;if(parseFloat(B.style.fontSize)>14&&(J=B.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${R.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${R.text.lineHeight}px`),B.setAttribute("style",J)),!B.closest(".em-contrast-card, .em-card")&&ro(B.style.color).toLowerCase()!=="#ffffff"&&(J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.text.color};`),B.setAttribute("style",J)),B.closest(".em-contrast-block")&&!B.closest(".em-contrast-card, .em-card")&&(J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.text.contrastColor};`),B.setAttribute("style",J)),Se[0]==="Safe Fonts"?(B.style.fontFamily=Se[1],Je({elem:L})):Se[0]==="Google Fonts"&&(Se[1]==="Sans Serif"?B.style.fontFamily="Helvetica, Arial, sans-serif":Se[1]==="Serif"&&(B.style.fontFamily='"Times New Roman", Times, serif'),B.classList.remove(...[...B.classList].filter(Ke=>Ke.startsWith("em-font"))),B.classList.add(`em-font-${Se[2].replace(/\s/g,"")}-${Se[3].replace(/\s/g,"")}`),oo({elem:L,fontFamilyArray:Se})),B.closest('[em="atom"] > tr > td')&&B.closest('[em="atom"] > tr > td').style.paddingBottom)B.closest('[em="atom"] > tr > td').style.paddingBottom=R.text.paddingBottom+"px";else if(B.nextElementSibling||B.closest("table")&&B.closest("table").nextElementSibling){let Ke=B.nextElementSibling??B.closest("table").nextElementSibling;Ke&&Ke.tagName==="TABLE"&&(Ke.classList.contains("em-vindent-table")||Ke.querySelector("td").innerHTML==="")&&Ke.querySelector("td").setAttribute("height",R.text.paddingBottom)}}else if(!B.style.display&&parseFloat(B.style.fontSize)>=20&&ro(B.style.color).toLowerCase()!=="#eb3737"){let J="",Se=R.headings.fontFamily;parseFloat(B.style.fontSize)<40&&(J=B.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${R.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${R.headings.lineHeight}px`),B.setAttribute("style",J)),!B.closest(".em-contrast-card, .em-card")&&ro(B.style.color).toLowerCase()!=="#ffffff"&&(J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.headings.color};`),B.setAttribute("style",J)),B.closest(".em-contrast-block")&&!B.closest(".em-contrast-card, .em-card")&&(J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.headings.contrastColor};`),B.setAttribute("style",J)),Se[0]==="Safe Fonts"?(B.style.fontFamily=Se[1],Je({elem:L})):Se[0]==="Google Fonts"&&(Se[1]==="Sans Serif"?B.style.fontFamily="Helvetica, Arial, sans-serif":Se[1]==="Serif"&&(B.style.fontFamily='"Times New Roman", Times, serif'),B.classList.remove(...[...B.classList].filter(Fe=>Fe.startsWith("em-font"))),B.classList.add(`em-font-${Se[2].replace(/\s/g,"")}-${Se[3].replace(/\s/g,"")}`),oo({elem:L,fontFamilyArray:Se}));let Ke="";if(R.headings.letterSpacing>0?Ke=B.style.letterSpacing?B.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${R.headings.letterSpacing}px`):B.getAttribute("style")+` letter-spacing: ${R.headings.letterSpacing}px;`:Ke=B.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),B.setAttribute("style",Ke),R.headings.bold?B.querySelector("b")?B.querySelector("b").replaceWith(...B.querySelector("b").childNodes):B.querySelector("strong")||(B.innerHTML="<strong>"+B.innerHTML+"</strong>"):B.querySelector("strong")?B.querySelector("strong").replaceWith(...B.querySelector("strong").childNodes):B.querySelector("b")&&B.querySelector("b").replaceWith(...B.querySelector("b").childNodes),B.style.fontWeight){let Fe=B.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");B.setAttribute("style",Fe)}if(R.headings.italic?B.querySelector("i")?B.querySelector("i").replaceWith(...B.querySelector("i").childNodes):B.querySelector("em")||(B.innerHTML="<em>"+B.innerHTML+"</em>"):B.querySelector("em")?B.querySelector("em").replaceWith(...B.querySelector("em").childNodes):B.querySelector("i")&&B.querySelector("i").replaceWith(...B.querySelector("i").childNodes),B.style.fontStyle){let Fe=B.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");B.setAttribute("style",Fe)}if(B.closest('[em="atom"] > tr > td')&&B.closest('[em="atom"] > tr > td').style.paddingTop)B.closest('[em="atom"] > tr > td').style.paddingTop=R.headings.paddingTop+"px";else if(B.previousElementSibling){let Fe=B.previousElementSibling;Fe&&Fe.tagName==="TABLE"&&(Fe.classList.contains("em-vindent-table")||Fe.querySelector("td").innerHTML==="")&&Fe.querySelector("td").setAttribute("height",R.headings.paddingTop)}if(B.closest('[em="atom"] > tr > td')&&B.closest('[em="atom"] > tr > td').style.paddingBottom)B.closest('[em="atom"] > tr > td').style.paddingBottom=R.headings.paddingBottom+"px";else if(B.nextElementSibling){let Fe=B.nextElementSibling;Fe&&Fe.tagName==="TABLE"&&(Fe.classList.contains("em-vindent-table")||Fe.querySelector("td").innerHTML==="")&&Fe.querySelector("td").setAttribute("height",R.headings.paddingBottom)}}}),L.querySelectorAll('a[style*="color"]').forEach(B=>{if(B.style.display){if(B.style.display&&B.style.display==="block"){let J="";if(J=B.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${R.buttons.fontSize}px`),B.setAttribute("style",J),B.closest("td").style.backgroundColor&&!B.closest("td").style.borderWidth&&!B.closest(".em-contrast-card"))if(B.closest(".em-contrast-block")?J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.contrastColor};`):J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.color};`),B.setAttribute("style",J),B.closest(".em-contrast-block"))if(R.buttons.contrastBackgroundColor){let Fe=B.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${R.buttons.contrastBackgroundColor};`);B.closest("td").setAttribute("style",Fe)}else B.closest("td").style.removeProperty("background-color");else if(R.buttons.backgroundColor){let Fe=B.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${R.buttons.backgroundColor};`);B.closest("td").setAttribute("style",Fe)}else B.closest("td").style.removeProperty("background-color");else if(B.closest("td").style.borderWidth)if(Object.values(R.buttons.border).every(Fe=>Fe===null)){if(B.closest(".em-contrast-block")){if(R.buttons.contrastBackgroundColor){let Fe=B.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,no=>no.replace(/#[A-Fa-f0-9]{6}/,`${R.buttons.contrastBackgroundColor}`));B.closest("td").setAttribute("style",Fe),J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.contrastBackgroundColor};`),B.setAttribute("style",J)}}else if(R.buttons.backgroundColor){let Fe=B.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,no=>no.replace(/#[A-Fa-f0-9]{6}/,`${R.buttons.backgroundColor}`));B.closest("td").setAttribute("style",Fe),J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.backgroundColor};`),B.setAttribute("style",J)}}else for(const Fe in R.buttons.border)R.buttons.border[Fe]&&R.buttons.border[Fe].color!==void 0&&(J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.border[Fe].color};`),B.setAttribute("style",J));else B.closest(".em-contrast-block")?R.buttons.contrastBackgroundColor&&(J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.contrastBackgroundColor};`),B.setAttribute("style",J)):R.buttons.backgroundColor&&(J=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.backgroundColor};`),B.setAttribute("style",J));let Se=R.buttons.fontFamily;Se[0]==="Safe Fonts"?(B.style.fontFamily=Se[1],Je({elem:L})):Se[0]==="Google Fonts"&&(Se[1]==="Sans Serif"?B.style.fontFamily="Helvetica, Arial, sans-serif":Se[1]==="Serif"&&(B.style.fontFamily='"Times New Roman", Times, serif'),B.classList.remove(...[...B.classList].filter(Fe=>Fe.startsWith("em-font"))),B.classList.add(`em-font-${Se[2].replace(/\s/g,"")}-${Se[3].replace(/\s/g,"")}`),oo({elem:L,fontFamilyArray:Se})),B.closest("td").setAttribute("align",R.buttons.textAlign);let Ke="";if(R.buttons.letterSpacing>0?Ke=B.style.letterSpacing?B.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${R.buttons.letterSpacing}px`):B.getAttribute("style")+` letter-spacing: ${R.buttons.letterSpacing}px;`:Ke=B.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),B.setAttribute("style",Ke),R.buttons.bold?B.querySelector("b")?B.querySelector("b").replaceWith(...B.querySelector("b").childNodes):B.querySelector("strong")||(B.innerHTML="<strong>"+B.innerHTML+"</strong>"):B.querySelector("strong")?B.querySelector("strong").replaceWith(...B.querySelector("strong").childNodes):B.querySelector("b")&&B.querySelector("b").replaceWith(...B.querySelector("b").childNodes),B.style.fontWeight){let Fe=B.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");B.setAttribute("style",Fe)}if(R.buttons.italic?B.querySelector("i")?B.querySelector("i").replaceWith(...B.querySelector("i").childNodes):B.querySelector("em")||(B.innerHTML="<em>"+B.innerHTML+"</em>"):B.querySelector("em")?B.querySelector("em").replaceWith(...B.querySelector("em").childNodes):B.querySelector("i")&&B.querySelector("i").replaceWith(...B.querySelector("i").childNodes),B.style.fontStyle){let Fe=B.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");B.setAttribute("style",Fe)}if(B.closest('[em="atom"] > tr > td')&&B.closest('[em="atom"] > tr > td').style.paddingTop)B.closest('[em="atom"] > tr > td').style.paddingTop=R.buttons.marginTop+"px";else if(B.closest("table").previousElementSibling){let Fe=B.closest("table").previousElementSibling;Fe&&Fe.tagName==="TABLE"&&(Fe.classList.contains("em-vindent-table")||Fe.querySelector("td").innerHTML==="")&&Fe.querySelector("td").setAttribute("height",R.buttons.marginTop)}if(B.closest('[em="atom"] > tr > td')&&B.closest('[em="atom"] > tr > td').style.paddingBottom)B.closest('[em="atom"] > tr > td').style.paddingBottom=R.buttons.marginBottom+"px";else if(B.closest("table").previousElementSibling){let Fe=B.closest("table").nextElementSibling;Fe&&Fe.tagName==="TABLE"&&(Fe.classList.contains("em-vindent-table")||Fe.querySelector("td").innerHTML==="")&&Fe.querySelector("td").setAttribute("height",R.buttons.marginBottom)}R.buttons.padding.all&&(B.style.padding=R.buttons.padding.all+"px"),R.buttons.padding.top&&(B.style.paddingTop=R.buttons.padding.top+"px"),R.buttons.padding.right&&(B.style.paddingRight=R.buttons.padding.right+"px"),R.buttons.padding.bottom&&(B.style.paddingBottom=R.buttons.padding.bottom+"px"),R.buttons.padding.left&&(B.style.paddingLeft=R.buttons.padding.left+"px"),mo({settings:{border:R.buttons.border},elem:B.closest("td")}),Eo({settings:{borderRadius:R.buttons.borderRadius},elem:B.closest("td")})}}else{let J=R.text.fontFamily;if(ro(B.style.color).toLowerCase()==="#1c52dc"){let Ke=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.links.color};`);B.setAttribute("style",Ke)}else{let Ke=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.text.color};`);B.setAttribute("style",Ke)}if(B.closest(".em-contrast-block")){let Ke=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.links.contrastColor};`);B.setAttribute("style",Ke)}let Se="";R.links.underline?Se=B.style.textDecoration?B.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):B.getAttribute("style")+" text-decoration: underline;":Se=B.style.textDecoration?B.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):B.getAttribute("style")+" text-decoration: none;",B.setAttribute("style",Se),J[0]==="Safe Fonts"?(B.style.fontFamily=J[1],Je({elem:L})):J[0]==="Google Fonts"&&(J[1]==="Sans Serif"?B.style.fontFamily="Helvetica, Arial, sans-serif":J[1]==="Serif"&&(B.style.fontFamily='"Times New Roman", Times, serif'),B.classList.remove(...[...B.classList].filter(Ke=>Ke.startsWith("em-font"))),B.classList.add(`em-font-${J[2].replace(/\s/g,"")}-${J[3].replace(/\s/g,"")}`),oo({elem:L,fontFamilyArray:J}))}}),L.querySelector('[em="block"]'))){const B=L.querySelectorAll('[em="block"]');R.block?.backgroundColor&&B.forEach(J=>{J.querySelectorAll(":scope > td").forEach(Se=>{Se.setAttribute("bgcolor",R.block.backgroundColor)})}),R.block?.padding&&B.forEach(J=>{J.querySelectorAll(":scope > td").forEach(Se=>{Se.style.paddingTop=R.block.padding.top+"px",Se.style.paddingRight=R.block.padding.right+"px",Se.style.paddingBottom=R.block.padding.bottom+"px",Se.style.paddingLeft=R.block.padding.left+"px"})})}return L.tagName==="DIV"?r.getElementInnerHTML(L):r.getElementInnerHTML(L.querySelector("tbody")||L)},Je=_=>{_.elem.querySelectorAll("link[em-class]").forEach(L=>{_.elem.querySelector("."+L.getAttribute("em-class"))||L.remove()})};function ro(_){if(_&&_.charAt(0)==="r"){if(_.charAt(3)==="a")return _=_.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),_&&_.length===4?"#"+("0"+parseInt(_[1],10).toString(16)).slice(-2)+("0"+parseInt(_[2],10).toString(16)).slice(-2)+("0"+parseInt(_[3],10).toString(16)).slice(-2):"";{_=_.replace("rgb(","").replace(")","").split(",");let L=parseInt(_[0],10).toString(16),B=parseInt(_[1],10).toString(16),J=parseInt(_[2],10).toString(16);return L=L.length===1?"0"+L:L,B=B.length===1?"0"+B:B,J=J.length===1?"0"+J:J,"#"+L+B+J}}else if(_&&_.charAt(0)==="#")return _}const oo=_=>{const L=_.elem.querySelectorAll("link"),B=`em-font-${_.fontFamilyArray[2].replace(/\s/g,"")}-${_.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(L)?.find(Se=>Se.getAttribute("em-class")===B)){let Se=document.createElement("link");Se.setAttribute("rel","stylesheet"),Se.setAttribute("href",`https://fonts.googleapis.com/css2?family=${_.fontFamilyArray[2]}:ital,wght@${Te[_.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${Te[_.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),Se.setAttribute("em-class",B),_.elem.insertAdjacentElement("afterbegin",Se)}U({elem:_.elem});let J=`font-family: '${_.fontFamilyArray[2]}', ${C[_.fontFamilyArray[1]]}!important;`;J+=` font-weight: ${Te[_.fontFamilyArray[3]].replaceAll("i","")}!important;`,Te[_.fontFamilyArray[3]].indexOf("i")>-1&&(J+=" font-style: italic!important;"),_.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
|
|
22
|
-
.em-font-${_.fontFamilyArray[2].replace(/\s/g,"")}-${_.fontFamilyArray[3].replace(/\s/g,"")} { ${J} }`),setTimeout(()=>Je({elem:_.elem}),0)},mo=_=>{_.settings.border.all?_.settings.border.all.width!=null&&(_.settings.border.all.style||_.settings.border.all.color)?(_.elem.style.borderWidth=_.settings.border.all.width+"px",_.elem.style.borderStyle=_.settings.border.all.style,_.elem.style.borderColor=_.settings.border.all.color):_.elem.style.removeProperty("border"):(_.settings.border.top&&(_.settings.border.top.width!=null&&(_.settings.border.top.style||_.settings.border.top.color)?(_.elem.style.borderTopWidth=_.settings.border.top.width+"px",_.elem.style.borderTopStyle=_.settings.border.top.style,_.elem.style.borderTopColor=_.settings.border.top.color):_.elem.style.removeProperty("border-top")),_.settings.border.right&&(_.settings.border.right.width!=null&&(_.settings.border.right.style||_.settings.border.right.color)?(_.elem.style.borderRightWidth=_.settings.border.right.width+"px",_.elem.style.borderRightStyle=_.settings.border.right.style,_.elem.style.borderRightColor=_.settings.border.right.color):_.elem.style.removeProperty("border-right")),_.settings.border.bottom&&(_.settings.border.bottom.width!=null&&(_.settings.border.bottom.style||_.settings.border.bottom.color)?(_.elem.style.borderBottomWidth=_.settings.border.bottom.width+"px",_.elem.style.borderBottomStyle=_.settings.border.bottom.style,_.elem.style.borderBottomColor=_.settings.border.bottom.color):_.elem.style.removeProperty("border-bottom")),_.settings.border.left&&(_.settings.border.left.width!=null&&(_.settings.border.left.style||_.settings.border.left.color)?(_.elem.style.borderLeftWidth=_.settings.border.left.width+"px",_.elem.style.borderLeftStyle=_.settings.border.left.style,_.elem.style.borderLeftColor=_.settings.border.left.color):_.elem.style.removeProperty("border-left")))},Eo=_=>{_.settings.borderRadius.all?_.elem.style.borderRadius=_.settings.borderRadius.all+"px":_.settings.borderRadius.all===""?_.elem.style.removeProperty("border-radius"):(_.settings.borderRadius.topLeft?_.elem.style.borderTopLeftRadius=_.settings.borderRadius.topLeft+"px":_.settings.borderRadius.topLeft===""&&_.elem.style.removeProperty("border-top-left-radius"),_.settings.borderRadius.topRight?_.elem.style.borderTopRightRadius=_.settings.borderRadius.topRight+"px":_.settings.borderRadius.topRight===""&&_.elem.style.removeProperty("border-top-right-radius"),_.settings.borderRadius.bottomRight?_.elem.style.borderBottomRightRadius=_.settings.borderRadius.bottomRight+"px":_.settings.borderRadius.bottomRight===""&&_.elem.style.removeProperty("border-bottom-right-radius"),_.settings.borderRadius.bottomLeft?_.elem.style.borderBottomLeftRadius=_.settings.borderRadius.bottomLeft+"px":_.settings.borderRadius.bottomLeft===""&&_.elem.style.removeProperty("border-bottom-left-radius"))},Te={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"},C={"Sans Serif":"sans-serif",Serif:"serif"};function U(_){if(!_.elem.querySelector('style[em="styles"]')){let L=document.createElement("style");L.setAttribute("em","styles"),_.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:x,layout:"vertical",name:"blocks_search_form",initialValues:{...Sa},onValuesChange:Ce,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:br,children:(0,o.jsx)(t.ui_kit$SearchInput,{placeholder:p("Search by title"),allowClear:!0,enterButton:!1})})}),(ve||_e||Re)&&(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&&!O&&(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(_=>(0,o.jsx)("li",{"data-type":_,onClick:De,children:p(r.TYPES_TRANSLATE[_])},"search_"+_))]})}),(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:[!!be.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"),be.map(_=>(0,o.jsx)("li",{"data-type":_,onClick:De,children:p(r.TYPES_TRANSLATE[_])},"blocksSections_"+_))]})}),(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:q,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!(pe||ge)&&(ue?.length?ue.map((_,L)=>{const B=hr(_.id,_.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":_.type,children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"leftTop",menu:{items:$e(_)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:J=>m(J,_.html,"project",_.title,_),onDragStart:J=>b(J,_.html,"project",_.title,_),onMouseEnter:()=>qe({html:_.html,title:_.title}),onMouseLeave:M,children:[z(_),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:B,onContentLoad:Z,style:{transform:`scale(${$})`}})]})},"commenMenu")},_.id+L.toString())}):!(Ie.tags||Ie.name||Ie.type)&&We&&!(pe||ge)&&!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:lm,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),(pe||ge)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&le?.length>0&&w?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Oe.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"),Oe.map(_=>(0,o.jsx)("li",{"data-type":_,onClick:De,children:p(r.TYPES_TRANSLATE[_])},"templateBlocksSections_"+_))]})}),(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:re,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[w&&!(fe||Ae)&&je?.length?(0,o.jsx)(o.Fragment,{children:je.map((_,L)=>{const B=hr(_.id,_.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":_.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:J=>m(J,_.html,"template",_.title,_),onDragStart:J=>b(J,_.html,"template",_.title,_),onMouseEnter:()=>qe({html:_.html,title:_.title}),onMouseLeave:()=>M(),children:[z(_),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:B,onContentLoad:Z,style:{transform:`scale(${$})`}})]})},_.id+L.toString())})}):!l&&!Pe&&!Ae&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:p("No related blocks found.")})," "]}),(fe||Ae)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&w?.length>0&&Ve?.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(_=>(0,o.jsx)("li",{"data-type":_,onClick:De,children:p(r.TYPES_TRANSLATE[_])},"commonBlocksSections_"+_))]})}),(0,o.jsxs)("div",{className:(0,Ue.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:de,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder common",children:[H&&!!He?.length&&!(Ne||Pe)&&(0,o.jsx)(o.Fragment,{children:He.map((_,L)=>{const B=io({html:hr(_.id,_.html)});return(0,o.jsx)("div",{className:"blocks-search__result","data-type":_.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:J=>m(J,io({html:_.html}),"common",_.title,_),onDragStart:J=>b(J,io({html:_.html}),"common",_.title,_),onMouseEnter:()=>qe({html:io({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+_.html+"</table>")}),title:_.title}),onMouseLeave:()=>M(),children:[z(_),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:B,onContentLoad:Z,style:{transform:`scale(${$})`}})]})},_.id+L.toString())})})," "]}),(Pe||Ne)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),O&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:p("There are no blocks for this request.")})]})]})};fr.propTypes={};var Ta=({comments:e,subjectId:i,isLoggedIn:l,projectTitle:s="",emailElementType:a,email:d})=>{const{__:c,_n:m}=r.useI18n(),b=r.useSendPostMessage(),x=r.useNotification(),{token:k}=(0,t.ui_kit$useToken)(),h=r.useAppConfig(),p=r.usePushToDataLayer(),S=(0,n.useRef)(null),[g,E]=(0,n.useState)(""),[y,v]=(0,n.useState)("ADD"),[P,w]=(0,n.useState)(!1),[I,N]=(0,n.useState)(null),[X,V]=(0,n.useState)(null),[F,$]=(0,n.useState)(""),[z,ee]=(0,n.useState)(""),[R,q]=(0,n.useState)(!1),[re,de]=(0,n.useState)(""),[se,me]=r.useAddCommentMutation(),[xe,Ie]=r.useDeleteCommentMutation(),[ae,We]=r.useEditCommentMutation(),[ve,pe]=r.useDeleteTargetMutation(),[ge]=r.useAutoSaveBlockMutation(),le=r.useDispatch(),te=r.useStore(),ce=r.useCurrentUser(),ue=r.useCurrentProjectRequested(),be=r.useContentReader(),K=ie=>{const Be=r.getEmailDocuments(fo.getContainer(te));Be.save("anchor",{project:ie}).then(j=>{const Z=j?Be.revisionFacts()?.lastRevisionAt:void 0;Z!==void 0&&d?.id!=null&&le(r.rememberAutosaveTime({emailId:d.id,modified:new Date(Z).toISOString()}))})},G=()=>{const ie=ue;if(a==="email"){K(ie);return}const Be={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:ie,html:be(),excerpt:d?.date_gmt};ge({blockId:d?.id,body:Be}).catch(j=>{})};function Q(ie){q(!1),de(""),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:re}),w(!0),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function ne(){V(I),e.filter(ie=>ie.parent===I).length?ae({commentId:I,status:"deleted"}).unwrap():xe(I),document.querySelector('.discuss-main li[id="'+I+'"] .comment-icon-target')?.getAttribute("target-id")&&b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+I+'"] .comment-icon-target')?.getAttribute("target-id")}),G(),de("")}function _e(ie){V(I);const Be=e.find(Z=>Z.id?.toString()===I),j=Be?.target_id?.toString()||"";q(!!j),de(j),ee(Be?.content?.slice(3,-5)?.toString()),v("EDIT")}function fe(ie){V(I),$(""),v("REPLY")}const Ae=()=>{x.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 je(){l?(await ae({commentId:X,content:z,targetId:re}).unwrap(),v("ADD"),ee(""),V(0),q(!1),w(!1),de(""),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Ae()}const Oe=ie=>{v("ADD"),ee(""),V(0),q(!1),w(!1),de(""),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},Y=async()=>{l?((g||F)&&await se({subjectId:i,author:ce.id,parent:y==="ADD"?"0":X,content:g||F,author_name:ce.name,author_email:ce.email,targetId:re}).then(ie=>{ie.error?x.error({title:ie.error.data.code,description:ie.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"})}),de(""),v("ADD"),$(""),E(""),V(0),q(!1),w(!1),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Ae()};function oe(){R?(w(!1),q(!1),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:re})):(w(!P),b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!P}),P&&q(!1))}function we(ie){let Be=JSON.parse(JSON.stringify(ie));if(!Be||!Be.length)return[];let j=[],Z=new Map;for(let ye=0,Ce=Be.length;ye<Ce;++ye){let De=Be[ye],Ye=Z.get(De.id);if((!Ye||Array.isArray(Ye))&&(Ye&&(De.children=Ye),Z.set(De.id,De)),String(De.parent)==="0")j.push(De);else{let qe=Z.get(De.parent);qe?(Array.isArray(qe)?qe:qe.children=qe.children||[]).push(De):Z.set(De.parent,[De])}}return j.forEach(ye=>{ye.status==="deleted"&&!ye.children&&(Ie.isUninitialized||Ie.isSuccess)&&xe(ye.id).unwrap().catch(Ce=>{})}),j}const H=ie=>{const Be=ie.data.operation;if(Be===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(de(ie.data.settings.value),ie.data.settings.value!==""?(q(!0),w(!1)):(q(!1),w(!0))),Be===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&G(),Be===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+ie.data.settings.targetId+'"]')){let j=document.querySelector('.comment-icon-target[target-id="'+ie.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,j.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,j.offsetTop),j.classList.add("active"),setTimeout(()=>{j.classList.remove("active")},2e3)}else b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ie.data.settings.targetId}),x.error({title:c("There's no such comment.")});Be===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&x.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(H);const Re=ie=>{b({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:ie})},Pe=ie=>(ie?.sort((Be,j)=>Be.date>j.date?1:-1),(0,o.jsx)(o.Fragment,{children:ie&&!!ie.length&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:ie,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:Pe(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:()=>N(Be.id),menu:{items:Be.author===ce.id?He:ze},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>Be.target_id&&Re(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:()=>Re(Be.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[y==="REPLY"&&X===Be.id&&Ve,y==="EDIT"&&X===Be.id&&Ne,Pe(Be.children)]})})})]})})})})})),Ne=(0,o.jsxs)(t.ui_kit$Form,{onFinish:je,className:"commentForm",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:z,onChange:ie=>ee(ie.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:ie=>ie.key==="Escape"&&Oe(),onPressEnter:ie=>ie.key==="Enter"&&ie.ctrlKey&&je(),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:pe.isLoading,type:P||R&&y==="EDIT"&&re!==""?"primary":"default",className:"button-target "+(P&&!R?"button-target_choose":""),style:R&&y==="EDIT"&&re!==""?{background:k.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}):(0,o.jsx)(t.ui_kit$Button,{onClick:oe,loading:pe.isLoading,type:P||R&&y==="EDIT"&&re!==""?"primary":"default",className:"button-target "+(P&&!R?"button-target_choose":""),style:R&&y==="EDIT"&&re!==""?{background:k.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:We.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:Oe,className:"button-reply",children:c("Cancel")})]})})]}),Ve=(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:ie=>$(ie.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:ie=>ie.key==="Escape"&&Oe(),onPressEnter:ie=>ie.key==="Enter"&&ie.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:oe,type:P||R&&y==="REPLY"&&re!==""?"primary":"default",className:"button-target "+(P&&!R?"button-target_choose":""),style:R&&y==="REPLY"&&re!==""?{background:k.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:y==="REPLY"&&me.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:Oe,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,n.useEffect)(()=>{y==="REPLY"&&S.current.focus({cursor:"start"}),y==="EDIT"&&S.current.focus({cursor:"end"})},[y]);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:k.colorError},onClick:ne});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:we(e),renderItem:ie=>(0,o.jsxs)("li",{id:ie.id,children:[ie.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:Pe(ie.children)}),ie.comment_status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:ie.author_id,author:ie.author_name,avatar:ie.author_avatar_urls&&ie.author_avatar_urls[48]||"",className:(0,Ue.default)(ie.target_id&&"targetted-comment-item",(!ie.author_avatar_urls||!ie.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>N(ie.id),menu:{items:ie.author===ce.id?He:ze},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>ie.target_id&&Re(ie.target_id),dangerouslySetInnerHTML:{__html:ie.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:ie.date&&r.formatDate(r.tryParseISO(ie.date),m,!0)}}),ie.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":ie.target_id,onClick:()=>Re(ie.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[y==="REPLY"&&X===ie.id&&Ve,y==="EDIT"&&X===ie.id&&Ne,Pe(ie.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:Y,className:y==="ADD"?"addMode":"replyEditMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{value:g,onChange:ie=>E(ie.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:ie=>ie.key==="Enter"&&ie.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:oe,type:P||R&&y==="ADD"&&re!==""?"primary":"default",className:"button-target "+(P&&!R?"button-target_choose":""),style:R&&y==="ADD"&&re!==""?{background:k.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:y==="ADD"&&me.isLoading,htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]})]})},cm=["common_styles","subject","preheader","meta"];function um(e,i){r.writeSourceReport(e,r.fromRevision(i))}function mm(e){if(!e)return null;const i=e.get().attributes??{},l={};for(const s of cm)i[s]!==void 0&&(l[s]=i[s]);return{content:e.getContent(),attributes:l}}function Ra(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var ya=(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}),gr=({emailElement:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),a=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),{document:m}=r.useDocumentSessionContext(),b=r.useSelector(r.selectHistoryData),x=r.useDocumentHistoryReader(),k=r.useSelector(r.selectElementHistoryHasMore),h=r.useSelector(r.selectIsPanelHistoryCollapsed),[p,S]=(0,n.useState)(!0),[g,E]=(0,n.useState)(!1),[y,v]=(0,n.useState)([]),[P,w]=(0,n.useState)([]),I=ve=>s(r.switchIsPanelHistoryCollapsed(ve)),N=(0,n.useCallback)(ve=>{if(!ve?.html)return;const pe=r.fromRevision(ve);pe?.attributes&&d(pe.attributes),s(r.markAppearanceNeedsUpdate());const ge=m?.get().version;c(ve.html,{undoable:!0}),m&&m.get().version===ge&&m.markUnsaved()},[c,s,d,m]),X=(0,n.useCallback)(ve=>{um(m,ve),s(r.markAppearanceNeedsUpdate())},[m,s]),{data:V}=r.projectsApi.useGetProjectQuery(Number(a),{skip:!a}),[F,$]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(V){const{owner:ve,admins:pe,users:ge}=V?.members;$([ve&&{...ve},pe&&Array.isArray(pe)&&pe.map(le=>({...le})),ge&&Array.isArray(ge)&&ge.map(le=>({...le}))].filter(le=>le).flat(1).map(le=>({id:le.ID,display_name:le.display_name})))}},[V,V?.members,i]);const[z,ee]=(0,n.useState)(1),[R,q]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const ve=Array.isArray(b)&&b.length&&b?.map(pe=>ya(pe,i));w(ve||[]),v(ve),S(!1),k||q(!0)},[b,k,i]);const re=()=>{E(!0),w(y.concat([...new Array(3)].map(()=>({loading:!0})))),x(e.id,z+1).then(ve=>{const{data:pe,hasMore:ge}=ve.data,le=Array.isArray(pe)&&pe?.map(ce=>ya(ce,i)),te=y.concat(le);w(te),v(te),E(!1),window.dispatchEvent(new Event("resize")),ge||q(!0),ee(z+1)})},de=!p&&!g&&!R?(0,o.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,o.jsx)(t.ui_kit$Button,{onClick:re,children:i("loading more")})}):null,[se,me]=(0,n.useState)(),[xe,Ie]=(0,n.useState)(null),ae=(0,n.useCallback)(ve=>{N(ve),me(null),Ie(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[N,l,s]);(0,n.useEffect)(()=>{!h&&!xe&&Ie(mm(m))},[h,Ie,m,xe]),(0,n.useEffect)(()=>{h&&xe&&(Ra(m,xe),s(r.markAppearanceNeedsUpdate()),Ie(null))},[h,xe,m,s]);const We=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:p,itemLayout:"horizontal",loadMore:de,dataSource:P,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:(ve,pe)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{pe!==se&&(me(pe),X(y[pe])),s(r.setBlockSettingsDisable(!0))},className:(0,Ue.default)("history-panel__item",{"history-panel__item_active":pe===se}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:ve.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:ve.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:We.revisionService?ve.author:F.find(ge=>ge.id?.toString()===ve.author?.toString())?.display_name||"–"}),ve.isAutosave&&se!==pe&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!ve.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",onClick:ge=>{se===pe&&ge.stopPropagation(),ae(y[pe])},children:i("Set")}),ve.isAutosave&&se===pe&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",onClick:ge=>{se===pe&&ge.stopPropagation(),ae(y[pe])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),xe&&Ra(m,xe),Ie(null),I(!0),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,o.jsx)(r.EmIcons,{icon:"Close",component:t.icons$Close})})]})};gr.propTypes={};var wa=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:x})=>{if(b?.status===400)return r.existingTermIdFromError(b);if(x)return x.id;if(b)return a.fromError("TAG_CREATING_ERROR",c,b),null})});return(await Promise.all(d)).filter(c=>c!=null)},ja=()=>{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))},pm=async e=>{const{block:i,form:l,projectData:s,projectTagsArray:a,projectId:d,addBlock:c,editBlock:m,editProject:b,addTerm:x,notification:k,__:h,handleCloseModal:p,htmlContent:S,refetchBlocks:g,reloadBlockScreens:E,onGlobalBlockTemplateSynced:y}=e;try{const{valid:v,values:P,blockTags:w}=await va({form:l,notification:k,__:h});if(!v)return;const I=await wa({blockTags:w,projectTagsArray:a,addTerm:x,project:s,notification:k});await Ca({block:i,form:l,projectId:d,htmlContent:S,values:P,tagIds:I,addBlock:c,editBlock:m,editProject:b,notification:k,refetchBlocks:g,reloadBlockScreens:E,projectTagsArray:a,__:h,handleCloseModal:p,onGlobalBlockTemplateSynced:y})}catch{}},va=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 Ia(e){if(e!==null&&typeof e=="object"&&"data"in e){const i=e.data;return{code:i?.code,message:i?.message}}return{}}async function hm(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 bm(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 Ca=async({block:e,form:i,projectId:l,htmlContent:s,values:a,tagIds:d,addBlock:c,editBlock:m,editProject:b,notification:x,refetchBlocks:k,reloadBlockScreens:h,projectTagsArray:p,__:S,handleCloseModal:g,onGlobalBlockTemplateSynced:E})=>{const y=bm({block:e,projectId:l,htmlContent:s,values:a}),v=await c({...y,blocktags:d.join(",")});if(v.error){const N=Ia(v.error);throw x.error({id:"BLOCK_CREATING_ERROR",data:{title:y.title,code:y.html},innerException:v.error,message:N.code,description:N.message}),i.resetFields(),g(),new Error("Ошибка создания блока")}const P=v.data;!e&&a?.global_block===!0&&P?.id&&await hm({created:P,blockData:y,editBlock:m,onGlobalBlockTemplateSynced:E}),e||(i.resetFields(),g());const w=p.map(N=>N.id),I=await b({projectId:l,blocktags:[...new Set([...w,...d])].join(",")});if(I.error){const N=Ia(I.error);x.error({message:N.message,code:N.code})}else!e&&k&&(x.success({id:"BLOCK_CREATING_SUCCESS",data:r.getBlockDesc(v.data),message:S("The block “")+String(v.data?.title??"")+S("” was successfully created.")}),k());return!e&&h&&h(),v.data},_r=({isModalVisible:e,htmlContent:i,projectId:l,setIsShowAddAllBlocksModal:s,setIsShowAddAllBlocksModalForNewEmail:a})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[m]=t.ui_kit$Form.useForm(),[b,x]=(0,n.useState)([]),[k,h]=r.useAddBlockMutation(),[p]=r.useEditBlockMutation(),{data:S}=r.useGetBlocksSchemaQuery(),g=r.useNotification(),E=r.useAppConfig(),[y,v]=(0,n.useState)([]),P=r.useProjectData(),{refetch:w}=r.useGetBlocksQuery(r.projectBlocksArgs(l)),[I,N]=r.useAddTermMutation(),[X,V]=r.useEditProjectMutation(),F=r.useSendPostMessage(),$=(0,n.useCallback)((re,de)=>{F({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:re,...de?{emBlockVersion:de}:{}}})},[F]),{data:z}=r.useGetTermsQuery({project:P,kind:r.BLOCK_TAGS},{skip:!P?.id});(0,n.useEffect)(()=>{v((z||[]).map(re=>({value:re.name})))},[z]),(0,n.useEffect)(()=>{if(S){const re=S.schema.properties.acf.properties.type.items.enum;let de=[];for(let se in re)de.push({label:d(r.TYPES_TRANSLATE[re[se]]),value:re[se]});x(de)}},[S,d]);const ee=()=>{c(r.closeModal())},R=()=>{s(!0),a(!1),ee()},q=async()=>{await pm({form:m,projectData:P,projectTagsArray:z||[],projectId:l,addBlock:k,editBlock:p,editProject:X,addTerm:I,notification:g,__:d,handleCloseModal:ee,htmlContent:i,refetchBlocks:w,reloadBlockScreens:ja,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:ee,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:q,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:q,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||N.isLoading||V.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||N.isLoading||V.isLoading,size:"large",placeholder:d("Choose block type"),options:b})})})]}),E.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||N.isLoading||V.isLoading,options:y})}),E.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||N.isLoading||V.isLoading})})]})})};_r.propTypes={};var fm="https://app.emailmaker.ru/api/".replace(/\/+$/,""),gm=`${fm}/wp-json/ai-generator/v1/identificate_blocks`,_m=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function xm(e){return await e.getInstance(fo.TOKEN_ID)}async function km(e,i,l,s,a){const d={blocks:s,types:_m,locale:i};l.current=d;try{const c=await xm(a),m=await fetch(gm,{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 Em=(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 Bm(e){return Array.from(e).map(i=>i.outerHTML).join("")}var Sm=(e,i="block",l=!1)=>{if(!e?.html)return[];const{document:s,blockElements:a,styleElement:d,linksElements:c}=Em(e.html,i),m=Bm(c);if(!(a instanceof NodeList))return[];const b=s.querySelector("head"),x=b?b.innerHTML:"";return Array.from(a).map((k,h)=>{if(!(k instanceof Element)||!k.outerHTML)return null;const p=d?d.outerHTML:"";return{id:`${e.id}-${h}`,html:l?`<!DOCTYPE html>
|
|
23
|
-
<html>
|
|
24
|
-
<head>${x}</head>
|
|
25
|
-
<body>
|
|
26
|
-
<table>${k.outerHTML}</table>
|
|
27
|
-
</body>
|
|
28
|
-
</html>`:r.minifyHtml(`${m}${p}${k.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function Tm(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 Rm=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),ym=e=>e.replace(/src="[^"]*"/g,'src=""'),wm=e=>/<div\s+[^>]*style="font-family:/i.test(e),jm=e=>{const i=new Set,l=[];for(const s of e)if(wm(s.html)){const a=ym(Rm(s.html));i.has(a)||(i.add(a),l.push(s))}else l.push(s);return l},vm=async e=>{const{block:i,form:l,projectData:s,projectId:a,addBlock:d,editProject:c,notification:m,__:b,handleCloseModal:x,htmlContent:k,refetchBlocks:h,reloadBlockScreens:p,values:S,tagIds:g,projectTagsArray:E}=e;try{await Ca({block:i,form:l,projectId:a,htmlContent:k,values:S,tagIds:g,addBlock:d,editProject:c,notification:m,refetchBlocks:h,reloadBlockScreens:p,projectTagsArray:E,__:b,handleCloseModal:x})}catch(y){throw y}},Im=({projectData:e,addTerm:i,addBlock:l,editProject:s,reloadBlockScreens:a,notification:d,__:c,handleCloseModal:m,setTriggerOpenSavedBlocksTab:b,setTagsOptions:x,form:k,projectId:h})=>{const[p,S]=(0,n.useState)(!1),g=r.useInvalidateProject(),{data:E}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,n.useEffect)(()=>{x((E||[]).map(v=>({value:v.name})))},[E,x]),{bulkSave:async(v,P,w,I)=>{S(!0);try{if(!P)return;const N=await wa({blockTags:I,projectTagsArray:E||[],addTerm:i,project:e,notification:d});let X=!0,V=0;for(const F of v)try{await vm({block:F,form:k,projectData:e,projectId:h,addBlock:l,editProject:s,notification:d,__:c,handleCloseModal:m,values:w,tagIds:N,projectTagsArray:E||[]})}catch{X=!1,V++}if(X&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!X){if(V===v.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}b(!0),g(h),a()}catch(N){throw N}finally{S(!1),k.resetFields(),m()}},confirmSavingBlocksLoading:p}},xr=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:l,setTriggerOpenSavedBlocksTab:s,projectId:a})=>{const{__:d,_n:c,sprintf:m}=r.useI18n(),b=r.useContainer(),x=r.useProjectData(),{tagsEnabled:k}=r.useAppConfig(),[h,p]=(0,n.useState)(!1),[S]=t.ui_kit$Form.useForm(),[g,E]=(0,n.useState)([]),[y,v]=(0,n.useState)([]),P=(0,n.useRef)({}),[w]=r.useAddTermMutation(),[I]=r.useEditProjectMutation(),[N,X]=r.useAddBlockMutation(),V=r.useEditorLocale()||void 0,F=Sm(i),$=jm(F).map(se=>se),z=$.length,ee=r.useNotification(),R=()=>{h||re||l(!1)},{bulkSave:q,confirmSavingBlocksLoading:re}=Im({projectData:x,addTerm:w,addBlock:N,editProject:I,reloadBlockScreens:ja,notification:ee,__:d,handleCloseModal:R,setTriggerOpenSavedBlocksTab:s,setTagsOptions:v,form:S,projectId:a}),de=async()=>{try{const{valid:se,values:me,blockTags:xe}=await va({form:S,notification:ee,__:d});s(!1),p(!0);const Ie=await km(i,V,P,$,b),ae=Tm(Ie,P.current,i.project.toString());p(!1),await q(ae,se,me,xe)}catch{p(!1),l(!1),ee.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:de,onCancel:R,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(h||re)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:h||re,onClick:de,children:m(c("Save %d block","Save %d blocks",z),z)},"submit")}),children:[h||re?(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.",z),z)}),!(h||re)&&k&&(0,o.jsx)(t.ui_kit$Form,{form:S,name:"add_all_blocks_form",layout:"vertical",onFinish:de,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:g,onChange:E,disabled:X.isLoading,options:y})})}),(re||h)&&(0,o.jsx)("div",{className:"modal-spinner",children:(0,o.jsx)(t.ui_kit$Spin,{size:"large"})})]})};xr.propTypes={};var Cm=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"),kr=({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,[x,k]=r.useSendTestEmailMutation(),{token:h}=(0,t.ui_kit$useToken)(),[p,S]=(0,n.useState)(!1);r.useAppConfig(),r.useCookieManager();const g=i.project,{data:E}=r.useGetProjectTestRecipientsQuery(g??0,{skip:!0}),[y,v]=r.useEditProjectMutation(),[P]=r.usePutProjectTestRecipientsMutation(),w=r.useProjectData(),{testEmails:I}=r.useAppConfig(),N=r.usePushToDataLayer(),[X,V]=(0,n.useState)([]),[F,$]=(0,n.useState)(!1),z=r.useEventEmitter(fo.events.ON_SEND_EMAIL_MODAL_ID);(0,n.useEffect)(()=>{e?z.fire(i).then(de=>{de.some(se=>se===!1)?a(r.closeModal$1()):S(e)}):S(e)},[e,a,S,i,z]),(0,n.useEffect)(()=>{},[w,g,E]),(0,n.useEffect)(()=>{V(I.map(de=>({value:de})))},[I]),(0,n.useEffect)(()=>{const de=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(de&&p&&s.getFieldValue("recipients")?.length===0){const se=JSON.parse(de);se?.[g]&&s.setFieldsValue({recipients:se[g]})}},[g,p,s]),(0,n.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const ee=()=>{a(r.closeModal$1()),s.resetFields()},R=r.useContentReader(),q=()=>{s.validateFields().then(()=>{const de={user_id:m.id,project_id:g,email_id:d,subject:s.getFieldValue("subject"),email:s.getFieldValue("recipients").join(","),html:Cm(R())};x(de).unwrap().catch(se=>{c.error({error:{data:{code:se?.data?.code,message:se?.data?.message}}})}),$(!0),N({event:"submit",action:"send_test_email",entity_id:d,project_id:g,recipients_count:s.getFieldValue("recipients").length})}).catch(de=>{})},re=n.default.useRef(b);return re.current=b,(0,n.useEffect)(()=>{const de=re.current;if(k.isSuccess&&F){k.data?.status;{const se=[...new Set([...X.map(ve=>ve.value),...s.getFieldValue("recipients")])],me=se.map(ve=>({projects_test_email:ve}));((ve,pe)=>{if(!ve||!pe)return ve===pe;if(ve.length!==pe.length)return!1;const ge=ve.map(te=>te.projects_test_email).sort(),le=pe.map(te=>te.projects_test_email).sort();return ge.every((te,ce)=>te===le[ce])})(me,r.isProjectsV2Enabled()?(E||[]).map(ve=>({projects_test_email:ve})):de)||(r.isProjectsV2Enabled()?P({projectId:g,emails:se}):y({projectId:g,projects_test_emails:me}));const Ie=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)?JSON.parse(localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)):[];let ae=s.getFieldValue("recipients");localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_test_emails,JSON.stringify({...Ie,[g]:[...new Set(ae)]}));const We=i.title||i.subject||l("Untitled email.").replace(/\.$/,"");c.success(l("The email “")+We+l("” was successfully sent."))}$(!1),s.resetFields(),a(r.closeModal$1())}},[k,s,g,y,P,E,X,F,a,i.title,i.subject,c,v,l]),(0,n.useEffect)(()=>{v.isError&&(c.error(v),$(!1),s.resetFields(),a(r.closeModal$1()))},[a,v,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:ee,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:v.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:q,disabled:k.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:(de,se)=>se.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):se.length!==0?se.every(me=>r.emailValidation.test(me.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:de=>{const{label:se,closable:me,onClose:xe}=de,Ie=ae=>{ae.preventDefault(),ae.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:h.colorPrimary,onMouseDown:Ie,closable:me,onClose:xe,style:{borderRadius:6},children:se})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};kr.propTypes={isModalVisible:f.default.bool,email:f.default.shape({html:f.default.string,subject:f.default.string})};var Pm=lo.__exportAll({AddAllBlocksModal:()=>xr,AddNewBlockModal:()=>_r,BlocksSearch:()=>fr,Discuss:()=>Ta,DiscussAi:()=>ia,EmailProperties:()=>Ml,EmailSettings:()=>Wi,EmailStyles:()=>Qi,FileManagerDataLayer:()=>_a,HistoryPanel:()=>gr,LimitUpgradeModal:()=>si,Optimise:()=>ba,SaveBlockBtn:()=>Tr.SaveBlockBtn,SelectedElementPanel:()=>dt,SendTestEmailModal:()=>kr});uo.AddAllBlocksModal=xr,uo.AddNewBlockModal=_r,uo.BlocksSearch=fr,uo.Discuss=Ta,uo.DiscussAi=ia,uo.EmailProperties=Ml,uo.EmailSettings=Wi,uo.EmailStyles=Qi,uo.FileManagerDataLayer=_a,uo.HistoryPanel=gr,uo.LimitUpgradeModal=si,uo.LimitUpgradeModal$1=si,uo.Optimise=ba,uo.SaveBlockBtn=Tr.SaveBlockBtn,uo.SelectedElementPanel=dt,uo.SendTestEmailModal=kr,uo.canonicalImageUrlKey=ft,uo.getImageDimensionsFromBlob=Rr,uo.normalizeImageFormatForDisplay=$t,Object.defineProperty(uo,"panels_exports",{enumerable:!0,get:function(){return Pm}}),uo.resolveDataProviderPreview=wr,uo.shouldCountAiUsage=dr,uo.useImageBlobFetch=jr,uo.useImageBlobResolver=vr});
|