useblocks 1.1.85-dev.7 → 1.1.85-dev.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +6 -4
  2. package/iframe/.vite/manifest.json +4 -4
  3. package/iframe/js/{discussHandlers.C5qc-xPl.js → discussHandlers.BuuVtU3Y.js} +5 -5
  4. package/iframe/js/iframe-eblock.body.js +1 -1
  5. package/iframe/js/iframe-eblock.js +1 -1
  6. package/iframe/js/iframe.body.js +2 -2
  7. package/iframe/js/iframe.js +1 -1
  8. package/node_modules/useblocks-ui-kit/es/components/Custom/FormPanel/FormSection/index.js +1 -1
  9. package/node_modules/useblocks-ui-kit/es/components/Custom/Inputs/ColorPickerInput/index.js +1 -1
  10. package/node_modules/useblocks-ui-kit/es/components/Custom/Inputs/ControlFontFamily/index.js +1 -1
  11. package/node_modules/useblocks-ui-kit/es/components/Custom/Inputs/InputSelect/index.js +34 -31
  12. package/node_modules/useblocks-ui-kit/es/components/Custom/PanelForm/index.js +1 -1
  13. package/node_modules/useblocks-ui-kit/es/components/DataDisplay/Card/index.js +1 -1
  14. package/node_modules/useblocks-ui-kit/es/components/DataDisplay/Skeleton/index.js +1 -1
  15. package/node_modules/useblocks-ui-kit/es/components/DataEntry/Cascader/index.js +1 -1
  16. package/node_modules/useblocks-ui-kit/es/components/DataEntry/Checkbox/index.js +1 -1
  17. package/node_modules/useblocks-ui-kit/es/components/DataEntry/ColorPicker/index.js +1 -1
  18. package/node_modules/useblocks-ui-kit/es/components/DataEntry/DatePicker/index.js +1 -1
  19. package/node_modules/useblocks-ui-kit/es/components/DataEntry/Form/index.js +1 -1
  20. package/node_modules/useblocks-ui-kit/es/components/DataEntry/Input/index.js +1 -1
  21. package/node_modules/useblocks-ui-kit/es/components/DataEntry/InputNumber/index.js +1 -1
  22. package/node_modules/useblocks-ui-kit/es/components/DataEntry/InputOTP/index.js +1 -1
  23. package/node_modules/useblocks-ui-kit/es/components/DataEntry/Password/index.js +1 -1
  24. package/node_modules/useblocks-ui-kit/es/components/DataEntry/Radio/index.js +1 -1
  25. package/node_modules/useblocks-ui-kit/es/components/DataEntry/SearchInput/index.js +1 -1
  26. package/node_modules/useblocks-ui-kit/es/components/DataEntry/Switch/index.js +2 -2
  27. package/node_modules/useblocks-ui-kit/es/components/DataEntry/TextArea/index.js +1 -1
  28. package/node_modules/useblocks-ui-kit/es/components/Feedback/Alert/index.js +1 -1
  29. package/node_modules/useblocks-ui-kit/es/components/Feedback/Popconfirm/index.js +1 -1
  30. package/node_modules/useblocks-ui-kit/es/components/Feedback/Spin/index.js +1 -1
  31. package/node_modules/useblocks-ui-kit/es/components/Feedback/Tooltip/index.js +1 -1
  32. package/node_modules/useblocks-ui-kit/es/components/General/Button/index.js +1 -1
  33. package/node_modules/useblocks-ui-kit/es/components/Layout/Divider/index.js +1 -1
  34. package/node_modules/useblocks-ui-kit/es/components/Layout/Row/index.js +1 -1
  35. package/node_modules/useblocks-ui-kit/es/components/Layout/Space/index.js +1 -1
  36. package/node_modules/useblocks-ui-kit/es/components/Navigation/FloatButton/index.js +1 -1
  37. package/node_modules/useblocks-ui-kit/es/components/Navigation/Segmented/index.js +1 -1
  38. package/node_modules/useblocks-ui-kit/es/components/Navigation/Tabs/index.js +1 -1
  39. package/node_modules/useblocks-ui-kit/package.json +1 -1
  40. package/package.json +2 -2
  41. package/runtime/react/index.js +1 -1
  42. package/static/core/{b49f995f.js → 06d19668.js} +3 -3
  43. package/static/core/{51a46897.js → 13c7b13a.js} +1 -1
  44. package/static/core/{fdfb1e94.js → 1afe0f9c.js} +1 -1
  45. package/static/core/{8035d07f.js → 28160edc.js} +1 -1
  46. package/static/core/{6a939bac.js → 3d7934fb.js} +1 -1
  47. package/static/core/{53bcd609.js → 3df10afa.js} +8 -8
  48. package/static/core/{e2699a48.js → 41028939.js} +1 -1
  49. package/static/core/{7f91ed03.js → 45eb9af1.js} +1 -1
  50. package/static/core/{60f7aa8d.js → 48a8ba9d.js} +1 -1
  51. package/static/core/{740a4f32.js → 49a8dc9c.js} +1 -1
  52. package/static/core/{284b592e.js → 59cfe4a0.js} +1 -1
  53. package/static/core/{ec4827f1.js → 778aee63.js} +1 -1
  54. package/static/core/{c28968c1.js → 799f4d8e.js} +1 -1
  55. package/static/core/{77d63e01.js → 7c047ede.js} +1 -1
  56. package/static/core/{9ea82ab5.js → 982730aa.js} +1 -1
  57. package/static/core/{23f020c5.js → a46eae76.js} +1 -1
  58. package/static/core/{fc390885.js → b165db74.js} +1 -1
  59. package/static/core/{991b35ff.js → cb42ad65.js} +1 -1
  60. package/static/core/{7d627bff.js → db82c42b.js} +1 -1
  61. package/static/core/{1bdeb37f.js → df189a9d.js} +1 -1
  62. package/static/core/{74c1d64b.js → f1478faf.js} +1 -1
  63. package/static/core/{6ff64eea.js → f1498d3c.js} +1 -1
  64. package/static/core/{ea93d0cd.js → f8d889a1.js} +2 -2
  65. package/static/core/{78b1e678.js → fa60c7fb.js} +1 -1
  66. package/static/core/{d2bb1c0d.js → ff43365e.js} +1 -1
  67. package/static/esm/349f9e2c.js +1 -0
  68. package/static/umd-runtime/runtime.js +1 -1
  69. package/static/umd-runtime/ui-kit.js +2 -2
  70. package/{useblocks-core.46f9d75a.js → useblocks-core.ee20cf1c.js} +15 -15
  71. package/useblocks-esm.js +10 -10
  72. package/{useblocks-po.46f9d75a.js → useblocks-po.ee20cf1c.js} +1 -1
  73. package/useblocks.d.ts +9 -2
  74. package/useblocks.js +12 -12
  75. package/vite/index.cjs +38 -0
  76. package/vite/index.js +38 -0
  77. package/static/esm/ff1698e6.js +0 -1
  78. /package/iframe/{iframe-eblock.46f9d75a.html → iframe-eblock.ee20cf1c.html} +0 -0
  79. /package/iframe/{iframe.46f9d75a.html → iframe.ee20cf1c.html} +0 -0
@@ -1,15 +1,15 @@
1
1
  (function(){try{if(typeof document<"u"){var e=".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(--ub-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(--ub-borderRadius) * 1px);border:1px solid var(--ub-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(--ub-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(--ub-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(--ub-colorBorderSecondary);border-radius:calc(var(--ub-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(--ub-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(--ub-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(--ub-colorBorderSecondary);border-radius:calc(var(--ub-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(--ub-colorTextQuaternary,var(--ub-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(--ub-colorBorderSecondary);border-radius:calc(var(--ub-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(--ub-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(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;padding:10px}.blocks-app .form-editor-input__preview-input{border-radius:calc(var(--ub-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(--ub-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(--ub-colorBorderSecondary);border-radius:calc(var(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),i=e;if(!o.sheets[i]){var p=!1;try{if(typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&document.adoptedStyleSheets){var t=new CSSStyleSheet;t.replaceSync(e),document.adoptedStyleSheets=document.adoptedStyleSheets.concat([t]),o.sheets[i]=t,o.order.push(i),p=!0}}catch{p=!1}if(!p){var r=document.createElement("style");r.setAttribute("data-useblocks","true"),r.appendChild(document.createTextNode(e)),document.head.appendChild(r),o.sheets[i]=r,o.order.push(i)}}}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
- __useblocks__.define("static/core/9281699f.js",["require","exports","module","static/core/2ff39ddf.js","static/core/10c6144f.js","static/core/a669ca97.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./2ff39ddf.js"),r=B("./10c6144f.js"),u=B("./a669ca97.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]),F=(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:F,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 ve=()=>{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}),[]),F=(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:F,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`,Fe="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:Fe,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}),[]),F=(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:F,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})]})},v={TEXT:"text",EMAIL:"email",PHONE:"phone",NAME:"name",URL:"url",PASSWORD:"password"},p="inputField_",le=`${p}borderRadiusAll`,U=`${p}borderRadiusTopLeft`,H=`${p}borderRadiusTopRight`,M=`${p}borderRadiusBottomLeft`,q=`${p}borderRadiusBottomRight`,ue="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",G=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function me({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:G,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}function Te(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("fieldBackground"),a=i.ui_kit$Form.useWatch(`${p}borderAll`),o=i.ui_kit$Form.useWatch("placeholderTextColor"),c=i.ui_kit$Form.useWatch("inputValueTextColor"),_=a?.color??"#d9d9d9";return(0,e.jsx)("div",{className:"form-editor-input__bg-preview","aria-hidden":!0,children:(0,e.jsx)("div",{className:"form-editor-input__preview-panel",children:(0,e.jsxs)("div",{className:"form-editor-input__preview-input",style:{background:l,borderColor:_,color:c},children:[(0,e.jsx)("span",{className:"form-editor-input__preview-placeholder-bit",style:{color:o},children:t("Placeholder")}),(0,e.jsx)("span",{children:" · "}),(0,e.jsx)("span",{children:t("Value")})]})})})}function Se(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useFormInstance(),a=(0,d.useCallback)(()=>{const o=l.getFieldValue("paddingHorizontal");o!=null&&o!==""&&l.setFieldValue("fieldMinHeight",o)},[l]);return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Internal padding"),children:(0,e.jsxs)("div",{className:"form-editor-input__padding-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"paddingHorizontal",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:"0",prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnWidthOutlined",component:i.icons$ColumnWidthOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMinHeight",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:t("Height"),prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnHeightOutlined",component:i.icons$ColumnHeightOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Apply horizontal padding to height"),children:(0,e.jsx)(i.ui_kit$Button,{type:"default",className:"form-editor-input__padding-link-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"BorderOuterOutlined",component:i.icons$BorderOuterOutlined,size:16}),onClick:a})})]})})}function Be(){const{__:t}=r.useI18n();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("Field state appearance")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customStylesForStates",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Use your own styles instead of defaults for states such as error, focus, and success.")})]}),(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("High contrast mode")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"highContrastMode",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Improves visibility by automatically tuning the form for accessibility. Turn off to restore the previous look.")})]})]})}function Ie(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility"),children:(0,e.jsxs)("div",{className:"form-editor-input__visibility-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldVisibility",className:"form-editor-input__visibility-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-segment",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"desktop",title:t("Desktop"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DesktopOutlined",component:i.icons$DesktopOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"mobile",title:t("Mobile"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MobileOutlined",component:i.icons$MobileOutlined,size:16,strokeWidth:l})})]})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldDirection",className:"form-editor-input__direction-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"ltr",title:t("Left to right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowLeftOutlined",component:i.icons$ArrowLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"rtl",title:t("Right to left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowRightOutlined",component:i.icons$ArrowRightOutlined,size:16,strokeWidth:l})})]})})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility in AMP"),children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"ampVisibility",className:"form-editor-input__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-amp",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"amp",children:"AMP"}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"html",children:"HTML"})]})})})]})}function Ne(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("limitLength")?(0,e.jsx)(i.ui_kit$Form.Item,{name:"maxLength",label:t("Maximum length"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:1,max:9999,placeholder:t("Characters"),addonAfter:t("chars")})}):null}function ye(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("inputType"),a=(0,d.useMemo)(()=>[{value:"minLength8",label:t("Minimum length 8 characters")},{value:"lowercase",label:t("Lowercase letters (a-z)")},{value:"uppercase",label:t("Uppercase letters (A-Z)")},{value:"digits",label:t("Digits (0-9)")},{value:"special",label:t("Special characters")}],[t]),o=(0,d.useMemo)(()=>[{value:"https",label:"HTTPS"},{value:"http",label:"HTTP"},{value:"mailto",label:"mailto:"},{value:"ftp",label:"FTP"}],[]);return l?(0,e.jsxs)(e.Fragment,{children:[l===v.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===v.PHONE&&(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"countryCodeSelector",label:t("Country selector (flag+code)")}),l===v.URL&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"urlAutoPrependProtocol",label:t("Auto-prepend protocol on blur")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"allowedProtocols",label:t("Allowed protocols"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose allowed protocols"),options:o,getPopupContainer:G,allowClear:!0})})]}),l===v.PASSWORD&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showPasswordEye",label:t("Show eye icon")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"passwordComplexityRules",label:t("Complexity rules"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose complexity rules"),options:a,getPopupContainer:G,allowClear:!0})})]})]}):null}var Le=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:v.TEXT,label:t("Text")},{value:v.EMAIL,label:t("Email")},{value:v.PHONE,label:t("Phone number")},{value:v.NAME,label:t("Name")},{value:v.URL,label:t("URL")},{value:v.PASSWORD,label:t("Password")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",required:!1,limitLength:!1,maxLength:100,hintText:"",countryCodeSelector:!1,urlAutoPrependProtocol:!1,allowedProtocols:[],showPasswordEye:!1,passwordComplexityRules:[],paddingHorizontal:16,customStylesForStates:!1,highContrastMode:!1,fieldVisibility:"always",fieldDirection:"ltr",ampVisibility:"always",fieldBackground:"#ffffff",inputValueTextFontFamily:ue,inputValueTextFontSize:14,inputValueTextLineHeight:22,inputValueTextColor:"#333333",inputValueTextStrong:!1,inputValueTextItalic:!1,inputValueTextStrikethrough:!1,inputValueTextUnderline:!1,placeholderTextFontFamily:ue,placeholderTextFontSize:14,placeholderTextLineHeight:22,placeholderTextColor:"rgba(0, 0, 0, 0.25)",placeholderTextStrong:!1,placeholderTextItalic:!1,placeholderTextStrikethrough:!1,placeholderTextUnderline:!1,[`${p}borderPosition`]:`${p}borderAll`,[`${p}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${p}borderTop`]:{...u.NULL_BORDER},[`${p}borderBottom`]:{...u.NULL_BORDER},[`${p}borderRight`]:{...u.NULL_BORDER},[`${p}borderLeft`]:{...u.NULL_BORDER},[le]:5,[U]:null,[H]:null,[M]:null,[q]:null}),[]),F=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[le]??0;o.setFieldsValue({[U]:n,[H]:n,[M]:n,[q]:n})}else{const n=s[U];n===s[H]&&n===s[M]&&n===s[q]?o.setFieldsValue({[le]:n}):o.setFieldsValue({[U]:null,[H]:null,[M]:null,[q]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-input-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-input",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"inputType",label:t("Type"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-input__full-width",placeholder:t("Choose input type"),options:b,allowClear:!0,getPopupContainer:G})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Field required")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"hintText",label:t("Hint text"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Come up with a hint"),allowClear:!0})}),(0,e.jsx)(ye,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-input__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-input__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-input__expanded",children:[(0,e.jsx)(Se,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Size"),collapsible:!0,defaultOpen:!1,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMaxWidth",label:t("Max width"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:2e3,placeholder:t("Not set"),addonAfter:"px"})})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Background"),children:(0,e.jsx)(i.ui_kit$FormColorField,{name:"fieldBackground",label:t("Background color")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Input field text"),children:(0,e.jsx)(me,{namePrefix:"inputValueText",microLabel:t("Font")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Placeholder text"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(me,{namePrefix:"placeholderText",microLabel:t("Font")})}),(0,e.jsx)(Te,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:p,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:p})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Accessibility"),children:(0,e.jsx)(Be,{})}),(0,e.jsx)(Ie,{})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-input-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:F,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}),[]),F=(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:F,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=ve,I.FormEditorDropdownListPanel=Ce,I.FormEditorInputPanel=Le,I.FormEditorRadioPanel=Pe});
3
-
4
- __useblocks__.define("static/core/41a7e33c.js",["require","exports","module","static/core/2ff39ddf.js","static/core/10c6144f.js","static/core/68612347.js","vite/preload-helper"],function(d,v,W){const D=d("./2ff39ddf.js"),n=d("./10c6144f.js"),p=d("./68612347.js");let U=d("vite/preload-helper");var P=D.__exportAll({createDocumentProcessor:()=>R,createFileProcessor:()=>M,ensureFileExtension:()=>b,extractUploadResult:()=>E,fetchFileData:()=>I,getExt:()=>j,handleUploadResult:()=>A,importEmail:()=>C,importHtml:()=>_,importZip:()=>N,splitFileName:()=>$,uploadFile:()=>n.uploadFile});function j(e){const t=e.split(".");return t[t.length-1].toLowerCase()}function $(e){const t=e.split(".");return t[t.length-1].toLowerCase()}var y="index.html";function w(e,t){return e.find(r=>r.toLowerCase().endsWith(t))}async function N(e,t,r){const a=await n.readZip(e),l=Object.keys(a),i=a[y]&&y||w(l,y)||w(l,".html")||w(l,".htm");if(i){const u=i.split("/"),c=document.location.pathname.split("/"),s=document.location.origin+c.slice(0,c.length-u.length).join("/")+"/",{html:x,hasBrowserExtensionArtifacts:f}=n.prepareEmailHtmlForEditor(n.zipEntryToText(a[i])),h=u.slice(0,u.length-1).join("/");return{html:await p.changeHtml(x,async g=>{const m=g.document;await p.replaceImagesInDocument(m,async o=>{o=o.replace("\\","/"),o.startsWith(".")&&(o=o.substring(1)),o.startsWith("/")&&(o=o.substring(1)),o.startsWith(s)&&(o=o.substring(s.length)),h&&!o.match("^(ht|f)tp(s?)://")&&(o=`${h}/${o}`);const F=a[o];if(F)return t(n.zipEntryToBlob(F),o);const H=p.getFileNameWithExt(o);return t(o,H)}),r&&r(g)}),hasBrowserExtensionArtifacts:f}}}async function _(e,t,r){const{html:a,hasBrowserExtensionArtifacts:l}=n.prepareEmailHtmlForEditor(e);return{html:await p.changeHtml(a,async i=>{const u=i.document;await p.replaceImagesInDocument(u,async c=>{c=c.replace("\\","/");const s=p.getFileNameWithExt(c);return t(c,s)}),r&&r(i)}),hasBrowserExtensionArtifacts:l}}async function C(e,t,r){if(e)switch(j(e.name)){case"zip":return N(e,t,r);case"eml":{const a=await e.arrayBuffer(),{default:l}=await(0,U.__vitePreload)(async()=>{const{default:u}=await Promise.resolve().then(()=>d("./6561b34a.js"));return{default:u}},void 0,{}.url),i=(await l.parse(a)).html??void 0;if(typeof i>"u")throw new Error("Eml does not contain text/html");return _(i,t,r)}default:return _(await e.text(),t,r)}}async function I(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 b(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 E(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 A(e,t){if(!e||e.error)return typeof t=="string"?t:"";const r=E(e.data);return r.error?typeof t=="string"?t:"":r.file_url?r.file_url:typeof t=="string"?t:""}var M=(e,t,r,a,l)=>{const{maxSizeMB:i,maxWidthOrHeight:u}=n.resolveImageCompressionLimits(l),c=n.getBrowserImageCompressionLibUrl();return async(s,x)=>{try{const f=await I(s,e);if(!f)return typeof s=="string"?s:"";const h=await b(x,f.type),g=f.type?.trim()||n.inferImageMimeFromFileName(h)||"";let m=new File([f],h.toLowerCase(),{type:g});if(n.isAllowedImageUploadFile(m)){const o=m.type?.trim()||n.inferImageMimeFromFileName(m.name)||f.type||"";try{m=await n.prepareImageForUpload(m,{maxSizeMB:i,maxWidthOrHeight:u,mimeType:o||f.type,fileName:m.name,libURL:c,enableCompression:n.shouldEnableImageCompression(l,o),convertSvgToPng:!0})}catch{}}return A(await t({user_id:r.id,folder:a.id,file:m}),s)}catch{return typeof s=="string"?s:""}}},R=e=>t=>{const r=t.document;r.title=(r.querySelector("title")?.textContent??"").replace(/\s+/g," ").trim()||p.getFileNameAndExt(e.name)[0]};Object.defineProperty(v,"extractUploadResult",{enumerable:!0,get:function(){return E}}),Object.defineProperty(v,"import_exports",{enumerable:!0,get:function(){return P}})});
2
+ __useblocks__.define("static/core/5cf8c192.js",["require","exports","module","static/core/2ff39ddf.js","static/core/b2b19022.js","static/core/e02ef34c.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./2ff39ddf.js"),r=B("./b2b19022.js"),u=B("./e02ef34c.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]),F=(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:F,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 ve=()=>{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}),[]),F=(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:F,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`,Fe="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:Fe,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}),[]),F=(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:F,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})]})},v={TEXT:"text",EMAIL:"email",PHONE:"phone",NAME:"name",URL:"url",PASSWORD:"password"},p="inputField_",le=`${p}borderRadiusAll`,U=`${p}borderRadiusTopLeft`,H=`${p}borderRadiusTopRight`,M=`${p}borderRadiusBottomLeft`,q=`${p}borderRadiusBottomRight`,ue="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",G=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function me({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:G,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}function Te(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("fieldBackground"),a=i.ui_kit$Form.useWatch(`${p}borderAll`),o=i.ui_kit$Form.useWatch("placeholderTextColor"),c=i.ui_kit$Form.useWatch("inputValueTextColor"),_=a?.color??"#d9d9d9";return(0,e.jsx)("div",{className:"form-editor-input__bg-preview","aria-hidden":!0,children:(0,e.jsx)("div",{className:"form-editor-input__preview-panel",children:(0,e.jsxs)("div",{className:"form-editor-input__preview-input",style:{background:l,borderColor:_,color:c},children:[(0,e.jsx)("span",{className:"form-editor-input__preview-placeholder-bit",style:{color:o},children:t("Placeholder")}),(0,e.jsx)("span",{children:" · "}),(0,e.jsx)("span",{children:t("Value")})]})})})}function Se(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useFormInstance(),a=(0,d.useCallback)(()=>{const o=l.getFieldValue("paddingHorizontal");o!=null&&o!==""&&l.setFieldValue("fieldMinHeight",o)},[l]);return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Internal padding"),children:(0,e.jsxs)("div",{className:"form-editor-input__padding-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"paddingHorizontal",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:"0",prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnWidthOutlined",component:i.icons$ColumnWidthOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMinHeight",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:t("Height"),prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnHeightOutlined",component:i.icons$ColumnHeightOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Apply horizontal padding to height"),children:(0,e.jsx)(i.ui_kit$Button,{type:"default",className:"form-editor-input__padding-link-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"BorderOuterOutlined",component:i.icons$BorderOuterOutlined,size:16}),onClick:a})})]})})}function Be(){const{__:t}=r.useI18n();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("Field state appearance")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customStylesForStates",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Use your own styles instead of defaults for states such as error, focus, and success.")})]}),(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("High contrast mode")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"highContrastMode",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Improves visibility by automatically tuning the form for accessibility. Turn off to restore the previous look.")})]})]})}function Ie(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility"),children:(0,e.jsxs)("div",{className:"form-editor-input__visibility-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldVisibility",className:"form-editor-input__visibility-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-segment",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"desktop",title:t("Desktop"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DesktopOutlined",component:i.icons$DesktopOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"mobile",title:t("Mobile"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MobileOutlined",component:i.icons$MobileOutlined,size:16,strokeWidth:l})})]})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldDirection",className:"form-editor-input__direction-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"ltr",title:t("Left to right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowLeftOutlined",component:i.icons$ArrowLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"rtl",title:t("Right to left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowRightOutlined",component:i.icons$ArrowRightOutlined,size:16,strokeWidth:l})})]})})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility in AMP"),children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"ampVisibility",className:"form-editor-input__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-amp",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"amp",children:"AMP"}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"html",children:"HTML"})]})})})]})}function Ne(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("limitLength")?(0,e.jsx)(i.ui_kit$Form.Item,{name:"maxLength",label:t("Maximum length"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:1,max:9999,placeholder:t("Characters"),addonAfter:t("chars")})}):null}function ye(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("inputType"),a=(0,d.useMemo)(()=>[{value:"minLength8",label:t("Minimum length 8 characters")},{value:"lowercase",label:t("Lowercase letters (a-z)")},{value:"uppercase",label:t("Uppercase letters (A-Z)")},{value:"digits",label:t("Digits (0-9)")},{value:"special",label:t("Special characters")}],[t]),o=(0,d.useMemo)(()=>[{value:"https",label:"HTTPS"},{value:"http",label:"HTTP"},{value:"mailto",label:"mailto:"},{value:"ftp",label:"FTP"}],[]);return l?(0,e.jsxs)(e.Fragment,{children:[l===v.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===v.PHONE&&(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"countryCodeSelector",label:t("Country selector (flag+code)")}),l===v.URL&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"urlAutoPrependProtocol",label:t("Auto-prepend protocol on blur")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"allowedProtocols",label:t("Allowed protocols"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose allowed protocols"),options:o,getPopupContainer:G,allowClear:!0})})]}),l===v.PASSWORD&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showPasswordEye",label:t("Show eye icon")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"passwordComplexityRules",label:t("Complexity rules"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose complexity rules"),options:a,getPopupContainer:G,allowClear:!0})})]})]}):null}var Le=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:v.TEXT,label:t("Text")},{value:v.EMAIL,label:t("Email")},{value:v.PHONE,label:t("Phone number")},{value:v.NAME,label:t("Name")},{value:v.URL,label:t("URL")},{value:v.PASSWORD,label:t("Password")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",required:!1,limitLength:!1,maxLength:100,hintText:"",countryCodeSelector:!1,urlAutoPrependProtocol:!1,allowedProtocols:[],showPasswordEye:!1,passwordComplexityRules:[],paddingHorizontal:16,customStylesForStates:!1,highContrastMode:!1,fieldVisibility:"always",fieldDirection:"ltr",ampVisibility:"always",fieldBackground:"#ffffff",inputValueTextFontFamily:ue,inputValueTextFontSize:14,inputValueTextLineHeight:22,inputValueTextColor:"#333333",inputValueTextStrong:!1,inputValueTextItalic:!1,inputValueTextStrikethrough:!1,inputValueTextUnderline:!1,placeholderTextFontFamily:ue,placeholderTextFontSize:14,placeholderTextLineHeight:22,placeholderTextColor:"rgba(0, 0, 0, 0.25)",placeholderTextStrong:!1,placeholderTextItalic:!1,placeholderTextStrikethrough:!1,placeholderTextUnderline:!1,[`${p}borderPosition`]:`${p}borderAll`,[`${p}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${p}borderTop`]:{...u.NULL_BORDER},[`${p}borderBottom`]:{...u.NULL_BORDER},[`${p}borderRight`]:{...u.NULL_BORDER},[`${p}borderLeft`]:{...u.NULL_BORDER},[le]:5,[U]:null,[H]:null,[M]:null,[q]:null}),[]),F=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[le]??0;o.setFieldsValue({[U]:n,[H]:n,[M]:n,[q]:n})}else{const n=s[U];n===s[H]&&n===s[M]&&n===s[q]?o.setFieldsValue({[le]:n}):o.setFieldsValue({[U]:null,[H]:null,[M]:null,[q]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-input-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-input",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"inputType",label:t("Type"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-input__full-width",placeholder:t("Choose input type"),options:b,allowClear:!0,getPopupContainer:G})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Field required")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"hintText",label:t("Hint text"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Come up with a hint"),allowClear:!0})}),(0,e.jsx)(ye,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-input__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-input__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-input__expanded",children:[(0,e.jsx)(Se,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Size"),collapsible:!0,defaultOpen:!1,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMaxWidth",label:t("Max width"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:2e3,placeholder:t("Not set"),addonAfter:"px"})})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Background"),children:(0,e.jsx)(i.ui_kit$FormColorField,{name:"fieldBackground",label:t("Background color")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Input field text"),children:(0,e.jsx)(me,{namePrefix:"inputValueText",microLabel:t("Font")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Placeholder text"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(me,{namePrefix:"placeholderText",microLabel:t("Font")})}),(0,e.jsx)(Te,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:p,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:p})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Accessibility"),children:(0,e.jsx)(Be,{})}),(0,e.jsx)(Ie,{})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-input-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:F,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}),[]),F=(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:F,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=ve,I.FormEditorDropdownListPanel=Ce,I.FormEditorInputPanel=Le,I.FormEditorRadioPanel=Pe});
5
3
 
6
4
  (function(){try{if(typeof document<"u"){var t=".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(--ub-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(--ub-colorBgContainer);width:34px;height:34px;color:var(--ub-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(--ub-colorFillTertiary);color:var(--ub-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(--ub-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(--ub-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(--ub-colorText);width:34px;height:34px;color:var(--ub-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(--ub-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(--ub-colorBorder);min-width:147px;height:32px;color:var(--ub-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}",e=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),o=t;if(!e.sheets[o]){var a=!1;try{if(typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&document.adoptedStyleSheets){var r=new CSSStyleSheet;r.replaceSync(t),document.adoptedStyleSheets=document.adoptedStyleSheets.concat([r]),e.sheets[o]=r,e.order.push(o),a=!0}}catch{a=!1}if(!a){var i=document.createElement("style");i.setAttribute("data-useblocks","true"),i.appendChild(document.createTextNode(t)),document.head.appendChild(i),e.sheets[o]=i,e.order.push(o)}}}}catch(l){console.error("vite-plugin-css-injected-by-js",l)}})();
7
- __useblocks__.define("static/core/52b6b918.js",["require","exports","module","static/core/2ff39ddf.js","static/core/10c6144f.js","react","react/jsx-runtime","__delivery__/libs"],function(G,j,He){const Pe=G("./2ff39ddf.js"),O=G("./10c6144f.js");let re=G("react");re=Pe.__toESM(re);let w=G("react/jsx-runtime"),E=G("__delivery__/libs");var m=class ge extends Error{constructor(t,e,r,a){super(t),this.code=e,this.status=r,this.details=a,this.name="FileManagerApiError",Error.captureStackTrace&&Error.captureStackTrace(this,ge)}},L="",$=class{constructor(){this.map=new Map}static childrenViewKey(i,t){return`v${L}${i}${L}${t}`}static childrenCountKey(i){return`c${L}${i}`}getFreshError(i,t){let e=this.map.get(i);return e?t!==1/0&&Date.now()-e.updatedAt>t?(this.map.delete(i),null):e.error:null}setError(i,t){this.map.set(i,{error:t,updatedAt:Date.now()})}delete(i){this.map.delete(i)}clearChildrenViewErrorsForParent(i){let t=`v${L}${i}${L}`;for(let e of[...this.map.keys()])e.startsWith(t)&&this.map.delete(e)}clearAll(){this.map.clear()}},Ce=class{constructor(){this.deletingIds=new Set}beginDeleting(i){for(let t of i)t&&this.deletingIds.add(t)}endDeleting(i){for(let t of i)t&&this.deletingIds.delete(t)}isDeleting(i){return!!i&&this.deletingIds.has(i)}};function ae(i){return{sortBy:i?.sortBy??"name",sortOrder:i?.sortOrder==null?i?.sortBy!=null&&i.sortBy!==""?"desc":"asc":i.sortOrder==="desc"?"desc":"asc"}}function le(i,t,e){let{sortBy:r,sortOrder:a}=ae(e),l=0;switch(r){case"name":l=(i.name||"").localeCompare(t.name||"");break;case"date":l=new Date(i.date||0).getTime()-new Date(t.date||0).getTime();break;case"size":l=(Number(i.size)||0)-(Number(t.size)||0);break;case"type":l=(i.extension||i.type||"").toLowerCase().localeCompare((t.extension||t.type||"").toLowerCase());break;default:l=(i.name||"").localeCompare(t.name||"")}return a==="desc"?-l:l}function W(i){return i!=null&&String(i).trim()!==""}function be(i,t){let{sortBy:e}=ae(t);switch(e){case"date":return W(i.date)?!Number.isNaN(new Date(i.date).getTime()):!1;case"size":return i.size!=null&&Number.isFinite(Number(i.size));case"type":return W(i.extension)||W(i.type);default:return W(i.name)}}function Ee(i,t){let e=typeof t?.search=="string"?t.search.trim():"";if(!e)return!0;let r=e.toLowerCase();return(i.name?.toLowerCase().includes(r)??!1)||(i.type?.toLowerCase().includes(r)??!1)||(i.extension?.toLowerCase().includes(r)??!1)}var Se=le,Te=Ee,Ne=be;function se(i={}){return{...i,comparator:i.comparator??Se,filterMatch:i.filterMatch??Te,hasSortValue:i.hasSortValue??Ne}}var q="Trash";function B(i){return i.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}function oe(i,t,e=q){let r=B(i);if(!r)return[];let a=[i,r];if(r===B(t)){a.push(t);let l=B(t);l==="Trash"||l.toLowerCase()==="trash"?a.push(e,q,q.toLowerCase()):e!=="Trash"&&B(e)!==l&&a.push(e)}return Array.from(new Set(a.map(B).filter(Boolean)))}function Ae(i){let t=new Map;for(let[e,r]of Object.entries(i))r.id&&t.set(B(e),r);return e=>{let r=t.get(B(e));if(r)return{id:r.id,name:r.name??r.id,folderId:r.folderId??null,isFolder:!0}}}function x(){if(typeof globalThis?.crypto?.randomUUID=="function")return globalThis.crypto.randomUUID();try{let i=globalThis.crypto||globalThis.msCrypto;if(i&&typeof i.getRandomValues=="function"){let t=new Uint8Array(16);i.getRandomValues(t);let e="";for(let r=0;r<t.length;r++)e+=t[r].toString(16).padStart(2,"0");return`id_${e}`}}catch{}return`id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random()*(2**53-1)).toString(36).slice(0,8)}`}var Oe=/^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;function ne(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return i}}function xe(i){let t=new URL(i.trim());t.hash="",t.hostname=t.hostname.toLowerCase(),(t.protocol==="https:"&&t.port==="443"||t.protocol==="http:"&&t.port==="80")&&(t.port="");let e=(t.search.startsWith("?")?t.search.slice(1):t.search).split("&").filter(Boolean).map(r=>{let a=r.indexOf("="),l=a===-1?r:r.slice(0,a),s=a===-1?"":r.slice(a+1);return{pair:r,key:ne(l),value:ne(s)}}).filter(({key:r})=>!Oe.test(r)).sort((r,a)=>{let l=r.key.localeCompare(a.key);return l===0?r.value.localeCompare(a.value):l});return t.search=e.length?`?${e.map(({pair:r})=>r).join("&")}`:"",t.toString()}function de(i){try{return xe(i)}catch{return i.trim()}}var he="",Q=18e5;function T(i){return i==null||i===""?he:i}function X(i){if(i==null)return 1/0;let t=Number(i);return Number.isFinite(t)&&t>=0?t:1/0}function Be(i){return!i||typeof i.search!="string"?!1:i.search.trim().length>0}function D(i){if(!i)return null;let t=i.folderId;return t==null?null:String(t)}function I(i){return!!i&&!!i.isFolder}function ue(i){if(!i||typeof i!="object")return!1;let t=i;return t.code==="path_folder_not_found"||t.code==="folder_not_found"||t.code==="FolderNotFound"||t.data?.code==="path_folder_not_found"||t.data?.code==="folder_not_found"||t.status===404||t.data?.data?.status===404}function De(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i.charCodeAt(e),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)}function M(i){if(!i||typeof i!="object")return String(i??"");let t=i,e=[],r={},a=["page","pageSize","sortBy","sortOrder","search","itemType","limit"];for(let d of Object.keys(t).sort()){let o=t[d];a.includes(d)?e.push(`${d}=${String(o??"")}`):r[d]=o}let l=Object.keys(r).length?JSON.stringify(r):"",s=e.join("|"),n=l?De(l):"";return`${s}${n?`|${n}`:""}`}var ce=class Ie{constructor(){this.entities=new Map,this.childrenByParent=new Map,this.maxCacheSize=1e4}now(){return Date.now()}checkCacheSize(){if(this.entities.size>this.maxCacheSize){let t=Array.from(this.entities.entries()).sort((r,a)=>r[1].updatedAt-a[1].updatedAt),e=Math.floor(this.maxCacheSize*.1);for(let r=0;r<e&&r<t.length;r++){let[a,l]=t[r];this.deleteEntityById(a)}}}getEntity(t){return this.entities.get(t)?.value}getRecord(t){return this.entities.get(t)}getFileSystemItem(t){let e=this.getEntity(t);return e&&!I(e)?e:void 0}getFolder(t){let e=this.getEntity(t);return e&&I(e)?e:void 0}getChildrenIds(t,e={}){let r=T(t),a=this.childrenByParent.get(r);return a?e.onlyFileSystemItems?Array.from(a.files):e.onlyFolders?Array.from(a.folders):[...Array.from(a.folders),...Array.from(a.files)]:[]}searchByUrl(t){let e=de(t);for(let r of this.entities.values()){let a=r.value.url;if(a&&(a===t||de(a)===e))return r.value}return null}upsertEntity(t){let e=this.entities.get(t.id)??null,r=e?e.value:null,a=r?D(r):null,l=D(t),s=r?I(r):!1,n=I(t),d;if(r&&I(r)&&n){let u=r.childrenCount,f=t.childrenCount;u!==void 0&&f===void 0&&(d=u)}if(r&&(a!==l||s!==n)){let u=T(a),f=this.childrenByParent.get(u);f&&(s?f.folders.delete(t.id):f.files.delete(t.id),f.files.size===0&&f.folders.size===0&&this.childrenByParent.delete(u))}let o=t;d!==void 0&&(o={...t,childrenCount:d}),this.entities.set(t.id,{value:{...o},updatedAt:this.now()}),this.checkCacheSize();let h=T(l),c=this.childrenByParent.get(h);c||(c={files:new Set,folders:new Set},this.childrenByParent.set(h,c)),n?c.folders.add(t.id):c.files.add(t.id)}updateServerChildrenCount(t,e){if(t==null||e==null||Number.isNaN(e))return;let r=this.entities.get(t);if(!r||!I(r.value))return;let a={...r.value,childrenCount:e};this.entities.set(t,{value:a,updatedAt:this.now()})}deleteEntityById(t){let e=this.entities.get(t)??null;if(!e)return{entity:null,parentId:null};let r=e.value,a=D(r),l=T(a),s=this.childrenByParent.get(l);return s&&(I(r)?s.folders.delete(t):s.files.delete(t),s.files.size===0&&s.folders.size===0&&this.childrenByParent.delete(l)),this.entities.delete(t),{entity:{...r},parentId:a}}deleteFolderRecursive(t){let e=this.entities.get(t);if(!e||!I(e.value))return{deletedFolderRecords:[],deletedFileSystemItemRecords:[]};let r=[{id:t,parentId:D(e.value)}],a=[],l=[];for(;r.length;){let d=r.shift();a.push(d);let o=this.childrenByParent.get(T(d.id));if(o){for(let h of Array.from(o.folders)){let c=this.entities.get(h);c&&r.push({id:h,parentId:D(c.value)})}for(let h of Array.from(o.files))l.push(h)}}let s=[];for(let d of l){let o=this.entities.get(d);if(!o)continue;let h=o.value,c=T(D(h)),u=this.childrenByParent.get(c);u&&(u.files.delete(d),u.files.size===0&&u.folders.size===0&&this.childrenByParent.delete(c)),this.entities.delete(d),s.push({...h})}let n=[];for(let d=a.length-1;d>=0;d--){let{id:o,parentId:h}=a[d],c=this.entities.get(o);if(!c)continue;let u=c.value,f=T(u.id);this.childrenByParent.delete(f);let p=T(h),v=this.childrenByParent.get(p);v&&(v.folders.delete(o),v.files.size===0&&v.folders.size===0&&this.childrenByParent.delete(p)),this.entities.delete(o),n.push({...u})}return{deletedFolderRecords:n,deletedFileSystemItemRecords:s}}moveEntityById(t,e){let r=this.entities.get(t)??null;if(!r)return null;let a=r.value,l=T(D(a)),s=this.childrenByParent.get(l);s&&(I(a)?s.folders.delete(t):s.files.delete(t),s.files.size===0&&s.folders.size===0&&this.childrenByParent.delete(l));let n={...a,folderId:e};if(I(a)&&I(n)){let h=a.childrenCount;h!==void 0&&(n.childrenCount=h)}this.entities.set(t,{value:n,updatedAt:this.now()});let d=T(e),o=this.childrenByParent.get(d);return o||(o={files:new Set,folders:new Set},this.childrenByParent.set(d,o)),I(n)?o.folders.add(t):o.files.add(t),{...n}}copyFileSystemItem(t,e,r){let a=this.entities.get(t)??null;if(!a||I(a.value))return null;let l={...a.value,id:e,folderId:r};return this.upsertEntity(l),{...l}}copyFolderShallow(t,e,r){let a=this.entities.get(t)??null;if(!a||!I(a.value))return null;let l={...a.value,id:e,folderId:r};return this.upsertEntity(l),{...l}}isEntityStale(t,e){let r=this.entities.get(t)??null;return!r||e!==1/0&&this.now()-r.updatedAt>e}touch(t,e){let r=this.entities.get(t);r&&(r.updatedAt=e??this.now())}getEntitiesByIds(t){return t.map(e=>this.entities.get(e)?.value??null)}searchByName(t,e){if(!t||t.trim()==="")return[];let r=e?.parentId,a=e?.recursive??!1,l=e?.itemType??"all",s=e?.caseSensitive??!1,n=e?.limit??1/0,d=s?t.trim():t.trim().toLowerCase(),o=[],h=null;if(r!==void 0){h=new Set;let c=T(r);if(h.add(c),a){let u=[c],f=new Set;for(;u.length>0;){let p=u.shift();if(f.has(p))continue;f.add(p);let v=this.childrenByParent.get(p);if(v)for(let y of v.folders)h.add(y),u.push(y)}}}for(let[,c]of this.entities){if(o.length>=n)break;let u=c.value;if(h!==null){let p=T(D(u));if(!h.has(p))continue}if(l==="file"&&I(u)||l==="folder"&&!I(u))continue;let f=u.name??"";(s?f:f.toLowerCase()).includes(d)&&o.push({...u})}return o}toJSON(){return{entities:Array.from(this.entities.entries()),childrenByParent:Array.from(this.childrenByParent.entries()).map(([t,e])=>[t,{files:Array.from(e.files),folders:Array.from(e.folders)}])}}static fromJSON(t){let e=new Ie;for(let[r,a]of t.entities??[])e.entities.set(r,{value:a.value,updatedAt:a.updatedAt});for(let[r,a]of t.childrenByParent??[])e.childrenByParent.set(r,{files:new Set(a.files),folders:new Set(a.folders)});return e}},fe=class _e{constructor(t={},e=Q,r,a,l=new $,s=ue){this.views=new Map,this.maxViewsPerParent=50;let n=se(t);this.strategy={allowSortedInsert:n.allowSortedInsert??!0,allowSearchInsert:n.allowSearchInsert??!0,invalidateOnPaginationFull:n.invalidateOnPaginationFull??!0,preloadPagesBefore:n.preloadPagesBefore??0,preloadPagesAfter:n.preloadPagesAfter??1,comparator:n.comparator,filterMatch:n.filterMatch,hasSortValue:n.hasSortValue},this.ttl=e,this.errorTtl=r??e,this.entityTtl=a??e,this.failedRequests=l,this.isFolderNotFoundError=s}setServerChildrenCountHandler(t){this.serverChildrenCountHandler=t}setChildrenCountInvalidator(t){this.childrenCountInvalidator=t}now(){return Date.now()}parentKey(t){return T(t??null)}isExpired(t){return t==null||this.ttl!==1/0&&this.now()-t>this.ttl}areEntitiesStale(t,e){return!t||t.some(r=>!e.getEntity(r)||e.isEntityStale(r,this.entityTtl))}isEntityTypeCompatible(t,e){return!!(!e||e==="all"||e==="file"&&!I(t)||e==="folder"&&I(t))}markViewStaleForReload(t){t.view.meta={...t.view.meta??{},stale:!0},t.view.updatedAt=this.now(),t.view.loadId=x(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}cleanupOldViews(t){if(t.size<=this.maxViewsPerParent)return;let e=Array.from(t.entries()).sort((r,a)=>(a[1].view.updatedAt||0)-(r[1].view.updatedAt||0));for(;t.size>this.maxViewsPerParent&&e.length>0;){let[r]=e.pop();t.delete(r)}}async getOrCreateChildren(t,e,r,a){let l=this.parentKey(t),s=M(e??{}),n=this.views.get(l);n||(n=new Map,this.views.set(l,n));let d=$.childrenViewKey(l,s),o=n.get(s);o||(o={params:e,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},n.set(s,o),this.cleanupOldViews(n));let h=this.failedRequests.getFreshError(d,this.errorTtl);if(h!=null)throw h;if(o.view.value&&!this.isExpired(o.view.updatedAt)&&!this.areEntitiesStale(o.view.value,a)&&!o.view.meta?.stale){let f=o.view.value.map(v=>a.getEntity(v)).filter(Boolean),p=o.params?.itemType||"all";return{items:f.filter(v=>this.isEntityTypeCompatible(v,p)),...o.view.meta??{}}}if(o.view.promise)return o.view.promise;let c=x();o.view.loadId=c;let u=(async()=>{try{let f=await r(t,e),p=Be(e),v=p?{...f,total:void 0}:f,y=this.views.get(l)?.get(M(e));if(!y||y.view.loadId!==c){let b=Error("StaleLoad");throw b.name="StaleLoad",b}for(let b of v.items)a.upsertEntity(b);o.view.value=v.items.map(b=>b.id);let{items:R,...P}=v,_={...P};o.view.meta=_,o.view.meta&&(o.view.meta.stale=!1),this.failedRequests.delete(d),o.view.updatedAt=this.now(),!p&&typeof _.total=="number"&&(this.serverChildrenCountHandler?this.serverChildrenCountHandler(t??null,_.total,a):a.updateServerChildrenCount(t,_.total));let C=this.strategy.preloadPagesAfter??0,N=this.strategy.preloadPagesBefore??0,z=X(e?.pageSize);if((C>0||N>0)&&Number.isFinite(z)){let b=t,g={...e},U=typeof _.totalPages=="number"?_.totalPages:1,V=e?.page??1,K=z,A=r,S=c;setTimeout(()=>{this.preloadPagesAsync(b,g,V,U,K,C,N,a,_,A,S)},0)}return v}catch(f){if(f?.name==="StaleLoad")throw this.failedRequests.delete(d),o.view.value=void 0,o.view.updatedAt=this.now(),f;if(this.isFolderNotFoundError(f))return this.failedRequests.delete(d),o.view.value=[],o.view.meta={total:0,totalPages:0},o.view.updatedAt=this.now(),{items:[],total:0,totalPages:0};throw this.failedRequests.setError(d,f),o.view.value=void 0,o.view.updatedAt=this.now(),f}finally{o.view.promise=null}})();return o.view.promise=u,u}async preloadPagesAsync(t,e,r,a,l,s,n,d,o,h,c){try{let u=this.parentKey(t),f=this.views.get(u);if(!f)return;let p=f.get(M(e));if(!p||c!=null&&p.view.loadId!==c)return;let v=f.get(M(e));if(!v?.view.meta)return;let y=typeof v.view.meta.totalPages=="number"?v.view.meta.totalPages:1;if(y!==a)return;let R=async P=>{let _={...e,page:P};try{let C=await h(t,_),N=this.views.get(u);if(!N)return;let z=N.get(M(e));if(!z||c!=null&&z.view.loadId!==c||z.view.loadId!==c)return;for(let U of C.items)d.upsertEntity(U);let b=M(_),g=N.get(b);if(g||(g={params:_,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:z.view.loadId}},N.set(b,g),this.cleanupOldViews(N)),!g.view.value||this.isExpired(g.view.updatedAt)){g.view.value=C.items.map(K=>K.id);let{items:U,...V}=C;g.view.meta={...V,page:P,totalPages:y},g.view.updatedAt=this.now()}}catch{}};if(s>0&&r<y)for(let P=1;P<=Math.min(s,y-r);P++){let _=r+P,C=M({...e,page:_}),N=f.get(C);(!N?.view.value||this.isExpired(N.view.updatedAt))&&R(_)}if(n>0&&r>1)for(let P=1;P<=Math.min(n,r-1);P++){let _=r-P,C=M({...e,page:_}),N=f.get(C);(!N?.view.value||this.isExpired(N.view.updatedAt))&&R(_)}}catch{}}removeEmptyPageIfNeeded(t,e,r,a,l){if(e.view.value&&e.view.value.length===0&&r<a){let s=M({...l,page:r});t.delete(s)}}updateTotalPagesForAllViews(t,e){for(let[,r]of t)r.view.meta&&(r.view.meta.totalPages=e)}isParamsSame(t,e){let r=Object.keys(t??{}).filter(l=>l!=="page").sort(),a=Object.keys(e??{}).filter(l=>l!=="page").sort();if(r.length!==a.length)return!1;for(let l=0;l<r.length;l++){let s=r[l];if(s!==a[l]||t[s]!==e[s])return!1}return!0}syncTotalsInSameViews(t,e){let r=e.view.meta;if(!r||typeof r.total!="number")return;let a=Number(r.total),l=X(e.params?.pageSize),s=Number.isFinite(l)&&l>0?Math.max(1,Math.ceil(a/l)):void 0;for(let[,n]of t)this.isParamsSame(n.params??{},e.params??{})&&(n.view.meta||(n.view.meta={}),n.view.meta.total=a,s!==void 0&&(n.view.meta.totalPages=s))}cascadeShiftPages(t,e,r,a,l,s,n){let d=e,o=r,h=!1,c=0;for(;d.view.value&&d.view.value.length<a&&o<l&&c<100;){c++;let u=M({...n,page:o+1}),f=t.get(u);if(!f?.view.value||this.isExpired(f.view.updatedAt)){d.view.meta={...d.view.meta??{},stale:!0};break}let p=a-d.view.value.length,v=f.view.value.slice(0,p).filter(y=>s.getEntity(y));if(v.length===0){d.view.meta={...d.view.meta??{},stale:!0};break}if(d.view.value=[...d.view.value,...v],d.view.updatedAt=Date.now(),f.view.value=f.view.value.slice(v.length),f.view.updatedAt=Date.now(),f.view.value.length===0){let y=o+1,R=f.view.meta;if(y<(R&&typeof R.totalPages=="number"?R.totalPages:1)){let P=M({...n,page:y});t.delete(P),h=!0}break}d=f,o++}return(!d.view.value||d.view.value.length<a)&&o>=l&&(d.view.meta={...d.view.meta??{},stale:!0}),h}cascadeShiftToNextPage(t,e,r,a,l,s,n){if(!e.view.value||e.view.value.length<=a)return!1;if(r-(n.page||1)>=10)return e.view.meta={...e.view.meta??{},stale:!0},!1;let d={...n,page:r+1},o=M(d),h=t.get(o),c=!1;if(!h?.view.value||this.isExpired(h.view.updatedAt))if(r>=l){h={params:d,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},t.set(o,h),this.cleanupOldViews(t);let p=e.view.meta;p&&(h.view.meta={...p,page:r+1}),c=!0}else return e.view.meta={...e.view.meta??{},stale:!0},!1;let u=e.view.value.slice(a).filter(p=>s.getEntity(p));if(u.length===0)return c&&t.delete(o),!1;e.view.value=e.view.value.slice(0,a),e.view.updatedAt=Date.now(),h.view.value=[...u,...h.view.value??[]],h.view.updatedAt=Date.now();let f=h.view.meta&&typeof h.view.meta.totalPages=="number"?h.view.meta.totalPages:l;if(!c&&this.cascadeShiftToNextPage(t,h,r+1,a,f,s,n))return!0;if(!h.view.value||h.view.value.length===0){let p=r+1,v=h.view.meta,y=v&&typeof v.totalPages=="number"?v.totalPages:1;this.removeEmptyPageIfNeeded(t,h,p,y,n)}return c}canCompareInSortedView(t,e){let r=t.params??{};return!r.sortBy&&!r.sortOrder||!this.strategy.hasSortValue||this.strategy.hasSortValue(e,t.params)}tryInsertSorted(t,e,r){let a=this.strategy.comparator;if(!a||!t.view.value)return!1;let l=t.params?.itemType||"all";if(!this.isEntityTypeCompatible(e,l)||!this.canCompareInSortedView(t,e))return!1;let s=t.view.value.map(o=>r.getEntity(o));if(s.some(o=>!o))return!1;if(s.length===0){let o=t.params??{};if(o.sortBy||o.sortOrder){let h=a(e,e,t.params);if(typeof h!="number"||Number.isNaN(h))return!1}return t.view.value.includes(e.id)?(t.view.updatedAt=this.now(),!0):(t.view.value=[e.id],t.view.updatedAt=this.now(),!0)}let n=0,d=s.length;for(;n<d;){let o=Math.floor((n+d)/2),h=a(e,s[o],t.params);if(typeof h!="number"||Number.isNaN(h))return!1;h>=0?n=o+1:d=o}return t.view.value.includes(e.id)?(t.view.updatedAt=this.now(),!0):(t.view.value=[...t.view.value.slice(0,n),e.id,...t.view.value.slice(n)],t.view.updatedAt=this.now(),!0)}updateChildrenCountForOperation(t,e,r,a){let l=D(e);switch(t){case"delete":this.adjustChildrenCount(a,l,-1),this.childrenCountInvalidator?.(l);break;case"insert":case"copy":this.adjustChildrenCount(a,l,1),this.childrenCountInvalidator?.(l);break;case"move":this.adjustChildrenCount(a,r??null,-1),this.adjustChildrenCount(a,l,1),this.childrenCountInvalidator?.(r??null),this.childrenCountInvalidator?.(l)}}adjustChildrenCount(t,e,r){if(!e)return;let a=t.getFolder(e);if(a&&typeof a.childrenCount=="number"){let l=Math.max(0,a.childrenCount+r);t.updateServerChildrenCount(e,l)}}smartInvalidateChildrenViews(t,e,r,a,l,s){if(!e)return;this.updateChildrenCountForOperation(r,e,l,a);let n=this.parentKey(t),d=this.views.get(n);if(d)for(let[,o]of d){let h=o.params??{},c=h?.page??1,u=X(h?.pageSize),f=Number.isFinite(u),p=!!(h?.sortBy||h?.sortOrder),v=!!h?.search,y=h?.itemType||"all";if(this.isEntityTypeCompatible(e,y)){if(v&&this.strategy.filterMatch&&!this.strategy.filterMatch(e,o.params)){o.view.value?.includes(e.id)&&(o.view.value=o.view.value.filter(R=>R!==e.id),o.view.meta&&typeof o.view.meta.total=="number"&&(o.view.meta.total=Math.max(0,o.view.meta.total-1)),this.markViewStaleForReload(o));continue}if(!o.view.value){o.view.meta&&(o.view.meta.stale=!0),o.view.loadId=x(),o.view.abortController&&(o.view.abortController.abort(),o.view.abortController=void 0);continue}if(o.view.value.includes(e.id),this.shouldInvalidateCompletely(o,r,e,p,f,c)){this.markViewStaleForReload(o);continue}switch(r){case"delete":this.handleDelete(d,o,c,u,f,e,a);break;case"insert":case"copy":this.handleInsert(d,o,c,u,f,p,e,a);break;case"update":this.handleUpdate(d,o,c,u,f,p,v,e,a);break;case"move":this.handleMove(d,o,c,u,f,p,e,l,a)}}}}shouldInvalidateCompletely(t,e,r,a,l,s){return!!(l&&s>1&&(e==="insert"||e==="delete"||e==="move")||this.isExpired(t.view.updatedAt))}tryReinsertEntity(t,e,r,a,l){let s=t.params?.itemType||"all";if(!this.isEntityTypeCompatible(e,s))return!1;let n=t.params??{};return this.strategy.filterMatch(e,n)?this.tryInsertSorted(t,e,r)?!0:n.sortBy||n.sortOrder?!1:!a||t.view.value.length<l?(t.view.value.push(e.id),!0):!1:!1}handleDelete(t,e,r,a,l,s,n){let d=e.view.value.includes(s.id);if(d&&(e.view.value=e.view.value.filter(o=>o!==s.id)),e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total=Math.max(0,e.view.meta.total-1),l&&Number.isFinite(a)&&typeof e.view.meta.total=="number"){let o=a;o>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/o)))}this.syncTotalsInSameViews(t,e)}if(e.view.updatedAt=Date.now(),d&&l&&e.view.value.length<a&&n){let o=e.view.meta,h=o&&typeof o.totalPages=="number"?o.totalPages:1;if(this.cascadeShiftPages(t,e,r,a,h,n,e.params??{})&&e.view.meta&&typeof e.view.meta.totalPages=="number"){let c=Math.max(1,e.view.meta.totalPages-1);e.view.meta.totalPages=c,this.updateTotalPagesForAllViews(t,c)}}e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}handleInsert(t,e,r,a,l,s,n,d){if(!e.view.value.includes(n.id)){if(s&&this.strategy.allowSortedInsert&&this.strategy.comparator&&d)if(this.tryInsertSorted(e,n,d)){if(e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total+=1,l&&Number.isFinite(a)){let o=a;o>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/o)))}this.syncTotalsInSameViews(t,e)}if(e.view.updatedAt=Date.now(),l&&(e.view.value?.length??0)>a&&d){let o=e.view.meta,h=o&&typeof o.totalPages=="number"?o.totalPages:1;if(this.cascadeShiftToNextPage(t,e,r,a,h,d,e.params??{})&&e.view.meta&&typeof e.view.meta.totalPages=="number"){let c=e.view.meta.totalPages+1;e.view.meta.totalPages=c,this.updateTotalPagesForAllViews(t,c)}}}else this.markViewStaleForReload(e);else if(!l||e.view.value.length<a){if(e.view.value.push(n.id),e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total+=1,l&&Number.isFinite(a)){let o=a;o>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/o)))}this.syncTotalsInSameViews(t,e)}e.view.updatedAt=Date.now()}else this.markViewStaleForReload(e);e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}}handleUpdate(t,e,r,a,l,s,n,d,o){let h=e.view.value.includes(d.id),c=this.isEntityTypeCompatible(d,e.params?.itemType||"all");if(h&&!c){if(e.view.value=e.view.value.filter(u=>u!==d.id),e.view.meta&&typeof e.view.meta.total=="number"&&(e.view.meta.total=Math.max(0,e.view.meta.total-1),l&&Number.isFinite(a)&&typeof e.view.meta.total=="number")){let u=a;u>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/u)))}if(e.view.updatedAt=Date.now(),l&&e.view.value.length<a&&o){let u=e.view.meta,f=u&&typeof u.totalPages=="number"?u.totalPages:1;if(this.cascadeShiftPages(t,e,r,a,f,o,e.params??{})&&e.view.meta&&typeof e.view.meta.totalPages=="number"){let p=Math.max(1,e.view.meta.totalPages-1);e.view.meta.totalPages=p,this.updateTotalPagesForAllViews(t,p)}}e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0);return}if(h&&(s||n)){e.view.value=e.view.value.filter(u=>u!==d.id),this.tryReinsertEntity(e,d,o,l,a)?(e.view.updatedAt=Date.now(),e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)):this.markViewStaleForReload(e);return}if(h){e.view.updatedAt=Date.now(),e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0);return}if(c&&!n){if(s&&this.strategy.allowSortedInsert&&this.strategy.comparator&&o)if(this.tryInsertSorted(e,d,o)){if(e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total+=1,l&&Number.isFinite(a)){let u=a;u>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/u)))}this.syncTotalsInSameViews(t,e)}e.view.updatedAt=Date.now()}else this.markViewStaleForReload(e);else if(!l||e.view.value.length<a){if(e.view.value.push(d.id),e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total+=1,l&&Number.isFinite(a)){let u=a;u>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/u)))}this.syncTotalsInSameViews(t,e)}e.view.updatedAt=Date.now()}else this.markViewStaleForReload(e);e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}}handleMove(t,e,r,a,l,s,n,d,o){if(e.view.value.includes(n.id)){if(e.view.value=e.view.value.filter(h=>h!==n.id),e.view.meta&&typeof e.view.meta.total=="number"&&(e.view.meta.total=Math.max(0,e.view.meta.total-1),l&&Number.isFinite(a)&&typeof e.view.meta.total=="number")){let h=a;h>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/h)))}if(e.view.updatedAt=Date.now(),l&&e.view.value.length<a&&o){let h=e.view.meta,c=h&&typeof h.totalPages=="number"?h.totalPages:1;if(this.cascadeShiftPages(t,e,r,a,c,o,e.params??{})&&e.view.meta&&typeof e.view.meta.totalPages=="number"){let u=Math.max(1,e.view.meta.totalPages-1);e.view.meta.totalPages=u,this.updateTotalPagesForAllViews(t,u)}}this.syncTotalsInSameViews(t,e)}e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}forceInvalidateChildrenViews(t){let e=this.parentKey(t??null);this.failedRequests.clearChildrenViewErrorsForParent(e);let r=this.views.get(e);if(r)for(let[,a]of r)a.view.value=void 0,a.view.meta=void 0,a.view.promise=null,a.view.updatedAt=0,a.view.loadId=x(),a.view.abortController&&(a.view.abortController.abort(),a.view.abortController=void 0)}getKnownTotal(t){let e=this.parentKey(t??null),r=this.views.get(e);if(!r)return;let a=null;for(let[,l]of r){let s=l.view.meta;s&&typeof s.total=="number"&&(!a||(l.view.updatedAt??0)>a.updatedAt)&&(a={total:Number(s.total),updatedAt:l.view.updatedAt??0})}return a?a.total:void 0}toJSON(){return{views:Array.from(this.views.entries()).map(([t,e])=>[t,Array.from(e.entries())]),ttl:this.ttl,errorTtl:this.errorTtl,entityTtl:this.entityTtl,strategy:{allowSortedInsert:this.strategy.allowSortedInsert,allowSearchInsert:this.strategy.allowSearchInsert,invalidateOnPaginationFull:this.strategy.invalidateOnPaginationFull,preloadPagesBefore:this.strategy.preloadPagesBefore,preloadPagesAfter:this.strategy.preloadPagesAfter}}}static fromJSON(t,e){let r=e?.ttl??t?.ttl??18e5,a=e?.errorTtl??t?.errorTtl??r,l=e?.failedRequests??new $,s=new _e({},r,a,void 0,l,e?.isFolderNotFoundError);for(let[n,d]of t.views??[]){let o=new Map;for(let[h,c]of d){let u=c;u?.view&&"error"in u.view&&delete u.view.error,o.set(h,u)}s.views.set(n,o)}return s}},Me=class Fe{invalidateChildrenCountCache(t){let e=T(t??"");this.childrenCountPromises.delete(e),this.failedRequests.delete($.childrenCountKey(e))}constructor(t={},e=Q,r,a){this.childrenCountPromises=new Map,this.isFolderNotFoundError=a?.isFolderNotFoundError??ue,this.failedRequests=new $,this.ttl=a?.ttl??e,this.errorTtl=a?.errorTtl??r??this.ttl,this.entities=new ce,this.views=new fe(t,this.ttl,this.errorTtl,void 0,this.failedRequests,this.isFolderNotFoundError),this.views.setServerChildrenCountHandler((l,s,n)=>{this.handleServerReportedChildrenCount(l,s,n??this.entities)}),this.views.setChildrenCountInvalidator(l=>{this.invalidateChildrenCountCache(l)})}getEntity(t){return this.entities.getEntity(t)??null}getFileSystemItem(t){return this.entities.getFileSystemItem(t)??null}getFolder(t){return this.entities.getFolder(t)??null}async getOrCreateChildren(t,e,r){return this.views.getOrCreateChildren(t,e,r,this.entities)}upsertEntity(t){let e=this.entities.getEntity(t.id),r=e?D(e):null,a=D(t),l=e?I(e):!1,s=I(t);if(this.entities.upsertEntity(t),e){if(r!==a||l!==s){this.views.smartInvalidateChildrenViews(r,e,"delete",this.entities),this.views.smartInvalidateChildrenViews(a,t,"insert",this.entities);return}this.views.smartInvalidateChildrenViews(a,t,"update",this.entities,void 0,e)}else this.views.smartInvalidateChildrenViews(a,t,"insert",this.entities)}isAncestor(t,e){let r=e,a=new Set;for(;r&&!a.has(r);){if(a.add(r),T(r)===T(t))return!0;let l=this.entities.getEntity(r);if(!l)break;r=D(l),r===null&&(r=he)}return!1}moveEntity(t,e){let r=this.entities.getEntity(t);if(!r||I(r)&&e!==null&&this.isAncestor(t,e))return null;let a=D(r),l=this.entities.moveEntityById(t,e);return l?(this.views.smartInvalidateChildrenViews(a,r,"delete",this.entities),this.views.smartInvalidateChildrenViews(e,l,"insert",this.entities),l):null}copyEntity(t,e,r,a){let l=this.entities.getEntity(t);if(!l)return null;let s=null;if(I(l)){let n=[t],d=[];for(;n.length;){let h=n.shift();d.push(h);let c=this.entities.getChildrenIds(h,{onlyFolders:!0});for(let u of c)n.push(u)}let o=new Map;for(let h of d)o.set(h,x());for(let h of d){let c=this.entities.getFolder(h),u=o.get(h),f=D(c),p=f===null?e:o.get(f)??null,v={...c,...h===t?a:void 0,id:u,folderId:(h===t?a?.folderId:void 0)??p};this.entities.upsertEntity(v)}for(let h of d){let c=o.get(h),u=this.entities.getChildrenIds(h,{onlyFileSystemItems:!0});for(let f of u){let p=this.entities.getFileSystemItem(f);if(!p)continue;let v=x(),y={...p,id:v,folderId:c};this.entities.upsertEntity(y)}}s=this.entities.getEntity(o.get(t))??null}else{let n=r??x();if(s=this.entities.copyFileSystemItem(t,n,e??null),s&&a){let d={...s,...a,id:n,folderId:a.folderId??e??null};this.entities.upsertEntity(d),s=d}}return s&&this.views.smartInvalidateChildrenViews(e,s,"copy",this.entities),s}searchByUrl(t){return this.entities.searchByUrl(t)??null}deleteEntity(t){let e=this.entities.getEntity(t);if(!e)return null;if(I(e)){let{deletedFolderRecords:r,deletedFileSystemItemRecords:a}=this.entities.deleteFolderRecursive(t);for(let l of a)this.views.smartInvalidateChildrenViews(l.folderId,l,"delete",this.entities);for(let l of r)this.views.smartInvalidateChildrenViews(l.folderId,l,"delete",this.entities);for(let l of r)this.views.forceInvalidateChildrenViews(l.id);return e}{let{entity:r,parentId:a}=this.entities.deleteEntityById(t);return r&&this.views.smartInvalidateChildrenViews(a,r,"delete",this.entities),r}}deleteFolderRecursive(t){let{deletedFolderRecords:e,deletedFileSystemItemRecords:r}=this.entities.deleteFolderRecursive(t);for(let a of r)this.views.smartInvalidateChildrenViews(a.folderId,a,"delete",this.entities);for(let a of e)this.views.smartInvalidateChildrenViews(a.folderId,a,"delete",this.entities);for(let a of e)this.views.forceInvalidateChildrenViews(a.id);return{deletedFileSystemItemIds:r.map(a=>a.id),deletedFolderIds:e.map(a=>a.id)}}forceInvalidate(t){let e=this.entities.getEntity(t);if(!e){this.views.forceInvalidateChildrenViews(t??null),this.invalidateChildrenCountCache(t);return}let r=new Set;if(I(e)){let a=[t];for(;a.length;){let l=a.pop();if(r.has(l))continue;r.add(l),this.views.forceInvalidateChildrenViews(l),this.invalidateChildrenCountCache(l);let s=this.entities.getChildrenIds(l,{onlyFolders:!0});for(let n of s)a.push(n)}}else{let a=e.folderId??null;this.views.forceInvalidateChildrenViews(a),this.invalidateChildrenCountCache(a)}}invalidateListingViews(t){this.views.forceInvalidateChildrenViews(t??null)}getChildrenIds(t){return this.entities.getChildrenIds(t)}searchByName(t,e){return this.entities.searchByName(t,e)}async getChildrenCount(t="",e){let r=T(t),a=$.childrenCountKey(r),l=this.failedRequests.getFreshError(a,this.errorTtl);if(l!=null)return Promise.reject(l);let s=this.childrenCountPromises.get(r);if(s)return s;let n=(async()=>{try{let d=this.entities.getFolder(t);if(d&&typeof d.childrenCount=="number")return this.failedRequests.delete(a),d.childrenCount;let o=this.views.getKnownTotal(t);if(typeof o=="number")return d&&this.handleServerReportedChildrenCount(t,o,this.entities),this.failedRequests.delete(a),o;if(e){let h=await e(t);return this.entities.getFolder(t)&&this.handleServerReportedChildrenCount(t,h,this.entities),this.failedRequests.delete(a),h}return this.failedRequests.delete(a),this.entities.getChildrenIds(t).length}catch(d){if(this.childrenCountPromises.delete(r),this.isFolderNotFoundError(d))return this.failedRequests.delete(a),0;throw this.failedRequests.setError(a,d),d}finally{this.childrenCountPromises.delete(r)}})();return this.childrenCountPromises.set(r,n),n}toJSON(){return{entities:this.entities.toJSON(),views:this.views.toJSON(),ttl:this.ttl,errorTtl:this.errorTtl}}static fromJSON(t,e,r){let a=r?.ttl??t?.ttl??18e5,l=r?.errorTtl??t?.errorTtl??a,s=new Fe(e??{},a,l,r),n=ce.fromJSON(t?.entities??{}),d=fe.fromJSON(t?.views??{},{failedRequests:s.failedRequests,ttl:a,errorTtl:l,isFolderNotFoundError:r?.isFolderNotFoundError});if(e){let o=se(e);d.strategy={allowSortedInsert:o.allowSortedInsert??!0,allowSearchInsert:o.allowSearchInsert??!0,invalidateOnPaginationFull:o.invalidateOnPaginationFull??!0,preloadPagesBefore:o.preloadPagesBefore??0,preloadPagesAfter:o.preloadPagesAfter??1,comparator:o.comparator,filterMatch:o.filterMatch}}return s.entities=n,s.views=d,d.setServerChildrenCountHandler((o,h,c)=>{s.handleServerReportedChildrenCount(o,h,c??n)}),d.setChildrenCountInvalidator(o=>{s.invalidateChildrenCountCache(o)}),s}handleServerReportedChildrenCount(t,e,r){this.checkAndResolveChildrenCountConflict(t,e,r),this.invalidateChildrenCountCache(t)}checkAndResolveChildrenCountConflict(t,e,r){if(!r||e===void 0)return;let a=t??null;if(!a){r.updateServerChildrenCount(a,e);return}let l=r.getFolder(a)?.childrenCount;l!==void 0&&l!==e&&this.views.forceInvalidateChildrenViews(a),r.updateServerChildrenCount(a,e)}},Re="",Ue="Trash",ke="Edited",me=1e4,pe=1e4,ve=25,we=10;function H(i,t){let e=i??{},r=Array.isArray(e.detailed)?e.detailed.map(a=>({requestId:a.requestId??a.id,success:!!a.success,data:t(a.data),error:a.error})):void 0;return{success:!!e.success,error:e.error,detailed:r}}function ee(i){return i==null?"":String(i)}function F(i){return{...i,name:ee(i.name)}}function ze(i){return(i??[]).map(F)}function k(i){return!i||typeof i!="object"||!("name"in i)?i:{...i,name:ee(i.name)}}function Ve(i){return i?i.replaceAll("\\","/").split("/").filter(Boolean):[]}var je=class{_getTrashPath(){return this._pathOptions.trashPath||Ue}_getPathLookupCandidates(i){return oe(i,this._getTrashPath(),q)}_folderFromResolvedPath(i,t){if(i.isFolder!==!0)throw new m(i.isFolder===!1?"Path '%s' resolves to a file, not a folder".replace("%s",t):"Path '%s' resolved to an item that is not marked as a folder".replace("%s",t),"ValidationError");if(!i.id)throw new m("Path '%s' resolved to a folder without id".replace("%s",t),"ValidationError");let e={id:i.id,name:i.name||i.id,parentId:i.folderId};return this._cache.upsertEntity(F({id:e.id,name:e.name,folderId:e.parentId??null,isFolder:!0})),e}async _resolveFolderByPath(i){if(typeof this._dataProvider.findItemByPath=="function")for(let t of this._getPathLookupCandidates(i)){let e=await this._dataProvider.findItemByPath(t);if(e)return this._folderFromResolvedPath(e,t)}}async _findOrCreateFolderByPath(i){let t=Ve(i);if(t.length>we)throw new m("Path depth exceeds maximum limit of %s".replace("%s",String(we)),"ValidationError");let e=await this._resolveFolderByPath(i);if(e)return e;let r;for(let a of t){let{files:l}=await this.getFiles({folderId:r?.id||"",itemType:"folder"}),s=l.find(n=>n.name===a);if(s){if(!s.isFolder)throw new m("Path component '%s' in '%s' is not a folder".replace("%s",a).replace("%s",i),"ValidationError");r={id:s.id,name:s.name,parentId:s.folderId}}else{if(typeof this._dataProvider.createFolder!="function")throw new m("Create folder operation is not supported by data provider","UnsupportedOperation");r=await this.createFolder({name:a,parentId:r?.id})}}return r}async getTrashFolder(){let i=await this._findOrCreateFolderByPath(this._getTrashPath());if(!i)throw new m("Trash folder path '%s' could not be resolved".replace("%s",this._getTrashPath()),"FolderNotFound");return i}async getTempFolder(){let i=this._pathOptions.tempPath??ke;if(i)try{return await this._findOrCreateFolderByPath(i)}catch(t){if(t instanceof m&&t.code==="ValidationError")throw t;return}}constructor(i,t={},e,r={}){this._dataProvider=i,this._options=t,this._pathOptions=e,this._blobFetchForceReloadOnceIds=new Set,this._mutationRegistry=new Ce,this._mapItem=async({childrenCount:l,...s})=>{let n=F(s);if(n.isFolder)return{...n,childCount:l,url:"",thumbnailUrl:""};let[d,o]=await Promise.all([this._getUrl(n),this._getThumbnailUrl(n)]);return{...n,childCount:0,url:d,thumbnailUrl:o}},this._config=r,this._useSoftDelete=this._pathOptions.useSoftDelete,this._rootId=this._pathOptions.rootId||Re,this._enableTrash=this._options.enableTrash===void 0||this._options.enableTrash,this._validateDuplicates=this._dataProvider.validateDuplicates,this._cache=new Me(t.cacheStrategy||{},t.cacheStrategy?.ttl,t.cacheStrategy?.errorTtl),this.setController({invalidateItemCache:l=>{this._cache.forceInvalidate(l)},getCachedItem:l=>this._cache.getEntity(l)});let a=Object.getPrototypeOf(this);for(let l of Object.getOwnPropertyNames(a)){let s=Object.getOwnPropertyDescriptor(a,l);l!=="constructor"&&typeof s?.value=="function"&&(this[l]=s.value.bind(this))}}setController(i){typeof this._dataProvider.setController=="function"&&this._dataProvider.setController(i)}async clearCache(i){let t=i??this._rootId;this._cache.forceInvalidate(t),this._cache.invalidateListingViews(t),typeof this._dataProvider.clearCache=="function"&&await this._dataProvider.clearCache(i)}markNextFileBlobFetchBypassHttpCache(i){this._blobFetchForceReloadOnceIds.add(this.normalizeId(i))}normalizeId(i){return!i||i==="root"||i==="folders"?this._rootId:i}_isDeletingId(i){return this._mutationRegistry.isDeleting(this.normalizeId(i))}_collectDeletingIds(i){let t=this.normalizeId(i),e=new Set([t]);if(!this._cache.getEntity(t)?.isFolder)return Array.from(e);let r=[t];for(;r.length>0;){let a=r.pop(),l=this._cache.getChildrenIds(a);for(let s of l)e.has(s)||(e.add(s),this._cache.getEntity(s)?.isFolder&&r.push(s))}return Array.from(e)}_emptyFilesResult(i,t){return{files:[],pagination:{...typeof i=="number"?{page:i}:{},...typeof t=="number"?{limit:t}:{},total:0,totalPages:1,hasNext:!1,hasPrev:!1}}}_validateName(i,t=!1){if(!i||i.trim().length===0)throw new m(t?"Folder name cannot be empty":"File name cannot be empty",t?"FolderInvalidName":"FileInvalidName");if(/[/\\:*?"<>|]/.test(i)){let e=t?"FolderInvalidName":"FileInvalidName";throw new m(t?"Folder name contains invalid characters: %s".replace("%s",i):"File name contains invalid characters: %s".replace("%s",i),e)}}_validateTargetFolderType(i){let t=this.normalizeId(i);if(t===this._rootId)return;let e=this._cache.getEntity(t);if(e&&!e.isFolder)throw new m("Target item with id '%s' is not a folder".replace("%s",i),"ValidationError")}_checkNameExistsInCache(i,t,e,r){let a=this.normalizeId(i),l=this._cache.getChildrenIds(a);for(let s of l){let n=this._cache.getEntity(s);if(n&&n.name===t&&!!n.isFolder===e&&(!r||n.id!==r))return!0}return!1}async _getUrl(i){if(i){if(i.url)return i.url;try{return typeof this._dataProvider?.getUrl=="function"&&this._dataProvider.getUrl(i)||void 0}catch{}}}async _getThumbnailUrl(i){if(i){if(i.thumbnailUrl)return i.thumbnailUrl;try{return typeof this._dataProvider?.getThumbnailUrl=="function"&&this._dataProvider.getThumbnailUrl(i)||void 0}catch{}}}_isAncestor(i,t){if(!t)return!1;let e=this.normalizeId(t),r=this.normalizeId(i);if(e===r)return!0;let a=this._cache.getEntity(e),l=new Set;for(;a&&a.folderId&&!l.has(a.id);){l.add(a.id);let s=this.normalizeId(a.folderId);if(s===r)return!0;if(a=this._cache.getEntity(s),!a||!a.isFolder)break}return!1}async getFile(i,t){return this._isDeletingId(i)?null:this._cache.searchByName(t,{parentId:this.normalizeId(i),caseSensitive:!0,recursive:!1,itemType:"file"})[0]||(await this.getFiles({folderId:i,itemType:"file",search:t})).files[0]}async getFileById(i){let t=this.normalizeId(i);if(this._isDeletingId(t))return null;let e=this._cache.getFileSystemItem(t);if(e&&!e.isFolder)return await this._mapItem(e);if(!this._dataProvider.pathMode)return null;let r=await this._getFileByPathStyleId(t);if(r&&!r.isFolder){let a=F(r);return this._cache.upsertEntity(a),await this._mapItem(a)}return null}async _getFileByPathStyleId(i){let t=i.replace(/\\/g,"/").replace(/^\/+/,""),e=t.lastIndexOf("/"),r=e<0?"":t.slice(0,e),a=e<0?t:t.slice(e+1);return a?this.getFile(r,a):null}async getFileUrl(i,t){let e=await this.getFile(i??"",t);if(e)return await this._getUrl(e)||await this._getThumbnailUrl(e)||e.thumbnail}async getFiles({folderId:i,search:t,sortBy:e,sortOrder:r,page:a,limit:l,itemType:s="all",noFolder:n=!1}){n&&(i=(await this.getTempFolder())?.id);let d=this.normalizeId(i??this._rootId),o=this._options.enablePagination===!1,h=o?1:a,c=o?me:l,u=this._options.clientSideFilter,f=this._options.clientSideSorting,p=this._options.clientSidePaging,v=p?Math.max(1,a??1):void 0,y=p?typeof l=="number"&&Number.isFinite(l)&&l>0?l:ve:void 0,R=this._emptyFilesResult(p?v:h,p?y:c);if(this._isDeletingId(d))return R;let P=this._options.unifiedCatalogFetch!==!1&&o&&(s==="folder"||s==="file"),_=P?"all":s,C={folderId:d,itemType:_};u||(C.search=t),f||(C.sortBy=e??(_==="folder"?void 0:"date"),C.sortOrder=r??(_==="folder"?void 0:"desc")),p||(C.page=h,C.limit=P?pe:c);let N=P?pe:p?void 0:c,z={folderId:d,itemType:_,search:u?void 0:t,sortBy:f?void 0:C.sortBy,sortOrder:f?void 0:C.sortOrder,page:p?void 0:h,pageSize:N},b;try{b=await this._cache.getOrCreateChildren(d,z,async(A,S)=>{let J=S.pageSize,te=J!=null&&Number.isFinite(Number(J))?Number(J):me,Z=await this._dataProvider.getItems({...S,folderId:A,limit:te}),ie=ze(Z.items);return p?{items:ie,total:typeof Z.pagination?.total=="number"?Z.pagination.total:ie.length}:{items:ie,...Z.pagination}})}catch(A){if(this._isDeletingId(d))return R;throw A}let g=b.items;if(P&&(s==="folder"?g=g.filter(A=>A.isFolder):s==="file"&&(g=g.filter(A=>!A.isFolder))),u){if(typeof this._options.clientSideFilter=="function")g=this._options.clientSideFilter(g,t);else if(t){let A=t.toLowerCase();g=g.filter(S=>S.name?.toLowerCase().includes(A))}}f&&(g=typeof this._options.clientSideSorting=="function"?this._options.clientSideSorting(g,e,r):this._defaultClientSideSort(g,e,r));let U;U=p||u||P?g.length:b.total??g.length;let V=g;if(p)if(typeof this._options.clientSidePaging=="function")V=this._options.clientSidePaging(g,v,y);else{let A=(v-1)*y,S=A+y;V=g.slice(A,S)}if(typeof this._dataProvider.getUrl=="function"||typeof this._dataProvider.getThumbnailUrl=="function"){let A=V.map(async S=>{if(S.isFolder)return S;let[J,te]=await Promise.all([S.url?Promise.resolve(S.url):typeof this._dataProvider.getUrl=="function"?this._dataProvider.getUrl(S):Promise.resolve(void 0),S.thumbnailUrl?Promise.resolve(S.thumbnailUrl):typeof this._dataProvider.getThumbnailUrl=="function"?this._dataProvider.getThumbnailUrl(S):Promise.resolve(void 0)]);return{...S,url:J,thumbnailUrl:te}});V=await Promise.all(A)}let K=p?{page:v,limit:y,total:U,totalPages:Math.max(1,Math.ceil(U/y)),hasNext:v*y<U,hasPrev:v>1}:{page:h,limit:c,total:U,...!p&&b.totalPages&&{totalPages:b.totalPages},...!p&&b.hasNextPage&&{hasNextPage:b.hasNextPage}};return{files:await Promise.all(V.map(this._mapItem)),pagination:K}}_defaultClientSideSort(i,t,e){return i.sort((r,a)=>le(r,a,{sortBy:t,sortOrder:e}))}async getFileData(i,t){let e=this.normalizeId(typeof i=="string"?i:i.id),r=t;this._blobFetchForceReloadOnceIds.delete(e)&&(r={...t,forceReload:!0});let a=this._cache.getEntity(e)||(typeof i=="string"?{id:e,name:"",folderId:this._rootId,isFolder:!1}:{...i,childrenCount:i.childCount});if(typeof this._dataProvider.getFileData=="function")return await this._dataProvider.getFileData(a,r);if(!a.url&&typeof this._dataProvider.getUrl!="function")throw new m("Cannot read file","FileReadError");let l=a.url||(typeof this._dataProvider.getUrl=="function"?await this._dataProvider.getUrl(a):"");if(l)return(await(this._config.fetchWithProxy??fetch)(l,r?.forceReload?{cache:"no-store"}:void 0)).blob();throw new m("Unable to get file data","FileReadError")}async findFileByUrl(i){let t=this._cache.searchByUrl(i);if(t)return t;if(typeof this._dataProvider.findFileByUrl=="function")try{let e=await this._dataProvider.findFileByUrl(i);if(e){let r=F(e);return this._cache.upsertEntity(r),r}}catch{}return null}async getChildrenCount(i){if(!i)return 0;let t=this.normalizeId(i??this._rootId);return this._isDeletingId(t)?0:this._cache.getChildrenCount(t,async()=>{try{if(this._options.clientSidePaging){let r=await this.getFiles({folderId:t,itemType:"all",page:1,limit:ve});return r.pagination.total??r.files.length}let e=await this._dataProvider.getItems({folderId:t,limit:0,itemType:"all"});return e.pagination===void 0?this._options.enablePagination===!1?e.items.length:0:e.pagination.total||0}catch(e){if(this._isDeletingId(t)||this._isPathFolderNotFoundError(e))return 0;throw e}})}_isPathFolderNotFoundError(i){if(!i||typeof i!="object")return!1;let t=i;return t.code==="path_folder_not_found"||t.data?.code==="path_folder_not_found"||t.status===404||t.data?.data?.status===404}async _uploadFile(i){let t=this.normalizeId(i.folderId??this._rootId);if(typeof this._dataProvider.uploadFile!="function")throw new m("Upload file operation is not supported by data provider","UnsupportedOperation");if(this._validateName(i.name,!1),this._validateDuplicates&&this._checkNameExistsInCache(t,i.name,!1))throw new m("File '%s' already exists in target folder".replace("%s",i.name),"FileAlreadyExists");let e=await this._dataProvider.uploadFile({...i,folderId:t}),r=F({name:i.name,size:i.size,...e,folderId:e.folderId??t});return this._cache.upsertEntity(r),r}async uploadFiles(i){let t=i.items.some(s=>s.noFolder)?await this.getTempFolder():null;i={...i,items:i.items?.map(s=>({...s,folderId:s.noFolder?t?.id:s.folderId}))};for(let s of i.items)s.folderId&&(i.folderId=s.folderId);let e=i.items||[],r=i.folderId??this._rootId,a=this.normalizeId(r);if(this._validateDuplicates){for(let s of e)if(s.name){this._validateName(s.name,!1);let n=this.normalizeId(s.folderId??a);if(this._checkNameExistsInCache(n,s.name,!1))throw new m("File '%s' already exists in target folder".replace("%s",s.name),"FileAlreadyExists")}}let l={detailed:Array(e.length),success:!0};if(typeof this._dataProvider.uploadFiles=="function"){let s=e.map(o=>({...o,folderId:this.normalizeId(o.folderId??a)})),n=await this._dataProvider.uploadFiles({folderId:a,items:s});l=H(n,o=>{if(o)return{id:o.id,name:ee(o.name),folderId:o.folderId,url:o.url,thumbnailUrl:o.thumbnailUrl,thumbnail:o.thumbnail}});let d=n?.detailed;if(l.detailed&&l.detailed.length){for(let o=0;o<l.detailed.length;o++){let h=l.detailed[o];if(h&&h.success){let c=h.data,u=c?.id??h.requestId,f=d?.[o]?.data,p=F({...f,...c,id:u,folderId:c?.folderId??f?.folderId??a,isFolder:!1});this._cache.upsertEntity(p),h.requestId=u}}l.success===void 0&&(l.success=!l.detailed.some(o=>!o.success))}else l.success=!l.error&&!!l.success}else if(typeof this._dataProvider.uploadFile=="function")l.detailed=await Promise.all(e.map(async s=>{let n=this.normalizeId(s.folderId??a);try{let d=await this._uploadFile({...s,folderId:n});return{requestId:d.id,data:d,success:!0}}catch(d){return{requestId:s?.id,success:!1,error:d}}})),l.success=!l.detailed.some(s=>!s.success);else throw new m("Upload files is not supported by data provider","UnsupportedOperation");if(l.success&&this._enableTrash)try{this._cache.forceInvalidate(a)}catch{}return l}async deleteFile(i){let t=this.normalizeId(i),e=[t];this._mutationRegistry.beginDeleting(e);try{if(this._useSoftDelete&&this._enableTrash){let r=await this.getTrashFolder();return await this.moveItem({itemId:t,targetFolderId:r.id,isFolder:!1})}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(e)}}async deleteItems(i,t){let e=Array.from(new Set(i.flatMap(r=>this._collectDeletingIds(this.normalizeId(r)))));this._mutationRegistry.beginDeleting(e);try{if(this._useSoftDelete&&this._enableTrash&&t.permanent!==!0){let r=await this.getTrashFolder();return await this.moveItems(r.id,i)}return await this.hardDeleteItems(i,t)}finally{this._mutationRegistry.endDeleting(e)}}async hardDeleteItems(i,t){let e={success:!0,detailed:[]},r=t.permanent?null:await this.getTrashFolder();if(typeof this._dataProvider.deleteItems=="function"){if(e=H(await this._dataProvider.deleteItems(i.map(a=>this._cache.getEntity(a)),t),a=>a),e.success){let a=e.detailed||i.map(l=>({requestId:l,success:!0,error:void 0}));for(let l of a)l.success&&(r?this._cache.moveEntity(l.requestId,r.id):this._cache.deleteEntity(l.requestId))}}else typeof this._dataProvider.deleteItem=="function"&&(e.detailed=await Promise.all(i.map(async a=>{let l=this._cache.getEntity(a);if(!l)return{requestId:a,success:!1,error:new m("Item with id '%s' not found".replace("%s",a),"FileNotFound")};try{return await this._dataProvider.deleteItem(l,t),r?this._cache.moveEntity(a,r.id):this._cache.deleteEntity(a),{requestId:a,success:!0}}catch(s){return{requestId:a,error:s,success:!1}}})),e.success=!e.detailed.some(a=>!a.success));if(e.success&&r)try{this._cache.forceInvalidate(r.id)}catch{}return e}async hardDeleteItem(i){let t=this._cache.getEntity(i);if(!t)throw new m("Item with id '%s' not found in cache".replace("%s",i),"FileNotFound");if(typeof this._dataProvider.deleteItem!="function")throw new m("Delete item operation is not supported by data provider","DeleteNotAllowed");if(await this._dataProvider.deleteItem(t,{permanent:!0}),this._cache.deleteEntity(i),this._enableTrash)try{let e=await this.getTrashFolder();e&&this._cache.forceInvalidate(e.id)}catch{}return!0}async cleanTrash(){if(!this._enableTrash)throw new m("Trash is not enabled","UnsupportedOperation");if(typeof this._dataProvider.cleanTrash=="function"){let i=await this._dataProvider.cleanTrash();try{let t=await this.getTrashFolder();t&&this._cache.forceInvalidate(t.id)}catch{}return i}throw new m("Clean trash is not supported by data provider","UnsupportedOperation")}async createFolder({name:i,parentId:t,is_force_create:e}){let r=this.normalizeId(t??this._rootId);if(this._validateName(i,!0),this._validateDuplicates&&this._checkNameExistsInCache(r,i,!0))throw new m("Folder '%s' already exists in parent folder".replace("%s",i),"FolderAlreadyExists");let a=await this._dataProvider.createFolder(i,r,e),l=F({id:a.id,folderId:r,name:a.name,isFolder:!0,childrenCount:a.childrenCount});return this._cache.upsertEntity(l),{...a,name:l.name}}async deleteFolder(i){let t=this.normalizeId(i),e=this._collectDeletingIds(t);this._mutationRegistry.beginDeleting(e);try{if(this._useSoftDelete&&this._enableTrash)try{let r=await this.getTrashFolder();return await this.moveItem({itemId:t,targetFolderId:r.id,isFolder:!0})?(this._cache.deleteFolderRecursive(t),!0):!1}catch{return await this.hardDeleteItem(t)}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(e)}}async renameFolder(i,t){if(typeof this._dataProvider.renameItem!="function")throw new m("Rename folder is not supported","RenameNotAllowed");let e=this.normalizeId(i),r=this._cache.getEntity(e);if(!r)throw new m("Folder with id '%s' not found in cache".replace("%s",i),"FolderNotFound");if(this._validateName(t,!0),this._validateDuplicates){let l=this.normalizeId(r.folderId);if(this._checkNameExistsInCache(l,t,!0,e))throw new m("Folder '%s' already exists in parent folder".replace("%s",t),"FolderAlreadyExists")}let a=k(await this._dataProvider.renameItem(r,t));return this._cache.upsertEntity(F({...this._cache.getEntity(a.id),...a})),this._cache.getEntity(a.id)}async renameFile(i,t){if(typeof this._dataProvider.renameItem!="function")throw new m("Rename file is not supported","RenameNotAllowed");let e=this._cache.getEntity(i);if(!e)throw new m("File with id '%s' not found in cache".replace("%s",i),"FileNotFound");let r=this.normalizeId(i);if(this._validateName(t,!1),this._validateDuplicates){let l=this.normalizeId(e.folderId);if(this._checkNameExistsInCache(l,t,!1,r))throw new m("File '%s' already exists in parent folder".replace("%s",t),"FileAlreadyExists")}let a=k(await this._dataProvider.renameItem(e,t));return a&&this._cache.upsertEntity(F({...this._cache.getEntity(r),...a})),this._cache.getEntity(r)}async moveItem({itemId:i,targetFolderId:t,isFolder:e}){if(typeof this._dataProvider.moveItem!="function")throw new m("Move item operation is not supported by data provider","MoveNotAllowed");let r=this.normalizeId(t);this._validateTargetFolderType(t);let a=this._cache.getEntity(i);if(!a){let s=k(await this._dataProvider.moveItem({id:i,folderId:r,isFolder:e},r));if(s.id===i)this._cache.upsertEntity(F({...s,folderId:r}));else{try{this._cache.deleteEntity(i)}catch{}this._cache.upsertEntity(F({...s,folderId:r}))}return!0}if(a.isFolder){if(i===r)throw new m("Cannot move folder into itself","MoveIntoSelf");if(this._isAncestor(i,r))throw new m("Cannot move folder into its descendant","MoveIntoDescendant")}if(this._validateDuplicates&&r!==this.normalizeId(a.folderId)&&a.name&&this._checkNameExistsInCache(r,a.name,!!a.isFolder,i)){let s=a.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new m(`${a.isFolder?"Folder":"File"} '${a.name}' already exists in target folder`,s)}let l=k(await this._dataProvider.moveItem(a,r));if(l.id===i){let s=this._cache.moveEntity(i,r);return this._cache.upsertEntity(F({...s,...l})),!0}{let s=this._cache.deleteEntity(i);return this._cache.upsertEntity(F({...s,...l,folderId:r})),!0}}async moveItems(i,t){let e=this.normalizeId(i);this._validateTargetFolderType(i);let r=t.map(l=>this._cache.getEntity(l));for(let l of r)if(l){if(l.isFolder){if(l.id===e)throw new m("Cannot move folder '%s' into itself".replace("%s",l.name),"MoveIntoSelf");if(this._isAncestor(l.id,e))throw new m("Cannot move folder '%s' into its descendant".replace("%s",l.name),"MoveIntoDescendant")}if(this._validateDuplicates&&e!==this.normalizeId(l.folderId)&&l.name&&this._checkNameExistsInCache(e,l.name,!!l.isFolder,l.id)){let s=l.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new m(`${l.isFolder?"Folder":"File"} '${l.name}' already exists in target folder`,s)}}let a={detailed:Array(r.length),success:!0};if(typeof this._dataProvider.moveItems=="function")a=H(await this._dataProvider.moveItems(r,e),l=>l);else if(typeof this._dataProvider.moveItem=="function")a.detailed=await Promise.all(t.map(async(l,s)=>{let n=r[s]||{id:l,folderId:null,isFolder:!1,name:l};try{return{requestId:l,data:k(await this._dataProvider.moveItem(n,e)),success:!0}}catch(d){return{requestId:l,success:!1,error:d}}}));else throw new m("Move items is not supported","MoveNotAllowed");if(a.success){let l=a.detailed||t.map(s=>({requestId:s,success:!0,data:void 0}));for(let s of l)if(s.success)if(!s.data||s.data.id===s.requestId)this._cache.moveEntity(s.requestId,e),s.data&&this._cache.upsertEntity(F({...this._cache.getEntity(s.requestId),...s.data,folderId:e}));else{let n=this._cache.deleteEntity(s.requestId);this._cache.upsertEntity(F({...n,...s.data,folderId:e}))}return a}return{success:!1,error:a.error||new m("Move items failed","MoveNotAllowed")}}async copyItem({itemId:i,targetFolderId:t}){if(typeof this._dataProvider.copyItem!="function")throw new m("Copy item is not supported","CopyNotAllowed");let e=this.normalizeId(t);this._validateTargetFolderType(t);let r=this._cache.getEntity(i);if(!r){let l=k(await this._dataProvider.copyItem({id:i,folderId:e},e));return this._cache.copyEntity(i,e,l.id),this._cache.upsertEntity(F({...l,folderId:e})),!0}if(this._validateDuplicates&&r.name){let l=e===this.normalizeId(r.folderId)?i:void 0;if(this._checkNameExistsInCache(e,r.name,!!r.isFolder,l)){let s=r.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new m(`${r.isFolder?"Folder":"File"} '${r.name}' already exists in target folder`,s)}}let a=k(await this._dataProvider.copyItem(r,e));return this._cache.copyEntity(i,e,a.id,{...a,folderId:e})||this._cache.upsertEntity(F({...a,folderId:e})),!0}async copyItems(i,t){let e=this.normalizeId(i);this._validateTargetFolderType(i);let r=t.map(n=>typeof n=="string"?{id:n}:n),a=r.map(n=>n.id),l=a.map((n,d)=>{let o=this._cache.getEntity(n),h=r[d]?.newName;return o?h?{...o,name:h}:o:void 0});if(this._validateDuplicates)for(let n=0;n<l.length;n++){let d=l[n];if(d&&d.name){let o=e===this.normalizeId(d.folderId)?a[n]:void 0;if(this._checkNameExistsInCache(e,d.name,!!d.isFolder,o)){let h=d.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new m(`${d.isFolder?"Folder":"File"} '${d.name}' already exists in target folder`,h)}}}let s={detailed:Array(l.length),success:!0};if(typeof this._dataProvider.copyItems=="function")s=H(await this._dataProvider.copyItems(l,e),n=>n);else if(typeof this._dataProvider.copyItem=="function")s.detailed=await Promise.all(a.map(async(n,d)=>{let o=l[d]||{id:n,folderId:null,isFolder:!1};try{return{requestId:n,data:k(await this._dataProvider.copyItem(o,e)),success:!0}}catch(h){return{requestId:n,success:!1,error:h}}}));else throw new m("Copy items is not supported","CopyNotAllowed");if(s.success&&s.detailed)for(let n=0,d=s.detailed.length;n<d;n++){let o=s.detailed[n];if(o.success&&o.data?.id){let h=o.data.folderId||e;!this._cache.copyEntity(o.requestId,h,o.data.id,{...o.data,folderId:h})&&o.data&&this._cache.upsertEntity(F({...o.data,folderId:h}))}}else if(!s.detailed)throw new m("batchResult in copy method must have detailed results","ValidationError");return s}async uploadFileByUrl(i){if(i.noFolder){let e=await this.getTempFolder();i={...i,folderId:e?.id}}let t=this.normalizeId(i.folderId??this._rootId);try{let e=F({...await this._dataProvider.uploadFileByUrl(i.url,t,{eventSource:i.eventSource}),folderId:t});return this._cache.upsertEntity(e),e}catch(e){throw e}}async updateFile(i,t){if(typeof this._dataProvider.updateFile!="function")throw new m("Update file is not supported","UnsupportedOperation");let e=this.normalizeId(i),r=this._cache.getEntity(e);if(!r)throw new m("File with id '%s' not found in cache".replace("%s",i),"FileNotFound");if(t.name&&t.name!==r.name&&this._validateName(t.name,!1),this._validateDuplicates&&t.name&&t.name!==r.name){let l=this.normalizeId(r.folderId);if(this._checkNameExistsInCache(l,t.name,!1,e))throw new m("File '%s' already exists in parent folder".replace("%s",t.name),"FileAlreadyExists")}let a=k(await this._dataProvider.updateFile(r,{...t}));return this._cache.upsertEntity(F({...this._cache.getEntity(e),...a,...t})),this._cache.getEntity(e)}},$e="",qe="Trash",Ge=class{constructor(i,t=$e,e=q,r=qe,a=!0){this._inner=i,this.rootPath=t,this.trashId=e,this.trashPath=r,this.ensureFolderTrailingSlash=a,this._pathToId=new Map,this._idToPath=new Map,this.validateDuplicates=this._inner.validateDuplicates??!1,typeof i.getUrl=="function"&&(this.getUrl=s=>i.getUrl({...s,id:this.pathForId(s.id,!1),folderId:s.folderId?this.pathForId(s.folderId,!0):this.rootPath})),typeof i.getThumbnailUrl=="function"&&(this.getThumbnailUrl=s=>i.getThumbnailUrl({...s,id:this.pathForId(s.id,!1),folderId:s.folderId?this.pathForId(s.folderId,!0):this.rootPath}));let l=this;typeof this._inner.deleteItems!="function"&&(l.deleteItems=void 0),typeof this._inner.deleteItem!="function"&&(l.deleteItem=void 0),typeof this._inner.moveItems=="function"?l.moveItem=void 0:l.moveItems=void 0,typeof this._inner.copyItems=="function"?l.copyItem=void 0:l.copyItems=void 0,typeof this._inner.uploadFiles=="function"?l.uploadFile=void 0:l.uploadFiles=void 0,typeof this._inner.clearCache!="function"&&(l.clearCache=void 0),this._getOrGenerateId(this.rootPath)}setController(i){typeof this._inner.setController=="function"&&this._inner.setController({invalidateItemCache:t=>{let e=t.replace(/^\/+|\/+$/g,""),r=this._pathToId.get(e);r&&i.invalidateItemCache(r)},getCachedItem:t=>{let e=t.replace(/^\/+|\/+$/g,""),r=this._pathToId.get(e);if(r){let a=i.getCachedItem(r);if(a)return{...a,id:this.pathForId(a.id,a.isFolder??!1),folderId:this.pathForId(a.folderId??"",a.isFolder??!1)}}}})}clearCache(i){if(typeof this._inner.clearCache=="function")return this._inner.clearCache(i)}findItemByPath(i){if(typeof this._inner.findItemByPath!="function")return;let t=(r,a,l)=>{if(!r)return;if(r.isFolder!==!0)return r;let s=B(B(l)===B(this.trashPath)?this.trashPath:a),n=r.folderId!=null&&r.folderId!==""?B(r.folderId):this.rootPath;return{...r,id:this._getOrGenerateId(s),name:r.name,folderId:n===B(this.rootPath)?this.rootPath||"":this._getOrGenerateId(n),isFolder:!0}},e=oe(i,this.trashPath,this.trashId);return(async()=>{for(let r of e){let a=await Promise.resolve(this._inner.findItemByPath(r)),l=t(a,r,i);if(l)return l}})()}_getOrGenerateId(i){if(i===this.rootPath)return"";let t=B(i);if(t===B(this.trashPath))return this.trashId;if(this._pathToId.has(t))return this._pathToId.get(t);let e=x();return this._pathToId.set(t,e),this._idToPath.set(e,t),e}pathForId(i,t,e){if(i===""||i===void 0)return this.rootPath;if(i===this.trashId)return this.trashPath;let r=this._idToPath.get(i);if(!r){if(e)return`unknown folder ${i}`;throw new m(`Path for id '${i}' not found in mapping`,"FileNotFound")}let a=0;for(;a<this.rootPath.length&&this.rootPath[a]==="/";)a++;if(a){let l=0;for(;l<r.length&&r[l]==="/";)l++;let s=r.slice(l);r="/".repeat(a)+s}return t&&this.ensureFolderTrailingSlash&&!r.endsWith("/")&&(r+="/"),r}_updateIdMapping(i,t){let e=t.replace(/^\/+|\/+$/g,""),r=this._idToPath.get(i);r&&this._pathToId.delete(r),this._idToPath.set(i,e),this._pathToId.set(e,i)}async getItems(i){let t=i.folderId?this.pathForId(i.folderId,!0):this.rootPath,e=await this._inner.getItems({...i,folderId:t}),r=e.items.map(a=>{let l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):this._getOrGenerateId(this.rootPath);return{...a,id:l,folderId:s}});return{...e,items:r}}async createFolder(i,t,e){let r=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.createFolder(i,r,e),l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):this._getOrGenerateId(this.rootPath);return{...a,id:l,folderId:s}}async renameItem(i,t){if(typeof this._inner.renameItem!="function")throw new m("Rename item is not supported by inner storage","RenameNotAllowed");let e=this.pathForId(i.id,i.isFolder??!1),r=e,{...a}=await this._inner.renameItem({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},t);return this._updateIdMapping(i.id,a.id),i.isFolder&&this.remapCachedFolderContents(i.id,r,a.id),a.folderId&&(a={...a,folderId:this._getOrGenerateId(a.folderId)}),{...a,id:this._getOrGenerateId(a.id)}}async deleteItem(i,t){if(typeof this._inner.deleteItem!="function")throw new m("Delete item is not supported by inner storage","DeleteNotAllowed");let e=this.pathForId(i.id,i.isFolder??!1);await this._inner.deleteItem({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},t),this.recursivelyRemoveMappings(i.id,e)}async uploadFile(i){if(typeof this._inner.uploadFile!="function")throw new m("Upload file is not supported by inner storage","UnsupportedOperation");let t=i.folderId?this.pathForId(i.folderId,!0):this.rootPath,e=await this._inner.uploadFile({...i,folderId:t}),r=this._getOrGenerateId(e.id),a=e.folderId?this._getOrGenerateId(e.folderId):this._getOrGenerateId(this.rootPath);return{...e,id:r,folderId:a}}async uploadFiles(i){let t=i.folderId,e=i.items?.map(s=>s.folderId)??[],r=i.folderId?this.pathForId(i.folderId,!0):this.rootPath,a={...i,folderId:r,items:i.items?.map(s=>({...s,folderId:s.folderId?this.pathForId(s.folderId??"",!0):r}))??[]},l=await this._inner.uploadFiles(a);return{...l,detailed:l.detailed?.map((s,n)=>{if(!s?.data)return s;let d=s.data.id?this._getOrGenerateId(s.data.id):"",o=s.data.folderId?this._getOrGenerateId(s.data.folderId):e[n]??t??this._getOrGenerateId(this.rootPath);return{...s,data:{...s.data,id:d,folderId:o}}})}}async findFileByUrl(i,t){let e=t?this.pathForId(t,!0):this.rootPath;if(typeof this._inner.findFileByUrl=="function"){let r=await this._inner.findFileByUrl(i,e);if(!r)return;let a=this._getOrGenerateId(r.id),l=r.folderId?this._getOrGenerateId(r.folderId):this._getOrGenerateId(this.rootPath);return{...r,id:a,folderId:l}}}async uploadFileByUrl(i,t,e){let r=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.uploadFileByUrl(i,r,e),l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):this._getOrGenerateId(this.rootPath);return{...a,id:l,folderId:s}}async moveItem(i,t){if(typeof this._inner.moveItem!="function")throw new m("Move item is not supported by inner storage","MoveNotAllowed");let e=this.pathForId(i.id,i.isFolder??!1),r=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.moveItem({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},r);this._updateIdMapping(i.id,a.id),i.isFolder&&this.remapCachedFolderContents(i.id,e,a.id);let l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):t;return{...a,id:l,folderId:s}}async moveItems(i,t){if(typeof this._inner.moveItems!="function")throw new m("Move items is not supported by inner storage","MoveNotAllowed");let e=t?this.pathForId(t,!0):this.rootPath,r=i.map(s=>({...s,id:this.pathForId(s.id,s.isFolder??!1),folderId:s.folderId?this.pathForId(s.folderId??"",!0):this.rootPath})),a=await this._inner.moveItems(r,e),l=[];if(a.detailed&&a.detailed.length>0){let s=new Map;for(let n=0;n<a.detailed.length;n++){let d=a.detailed[n],o=d.requestId||(n<i.length?i[n].id:void 0);o&&s.set(o,d)}for(let n of i){let d=s.get(n.id)||(a.detailed.length===i.length?a.detailed[i.indexOf(n)]:void 0);if(d?.success&&d.data){if(this._updateIdMapping(n.id,d.data.id),n.isFolder){let o=this.pathForId(n.id,n.isFolder??!1);this.remapCachedFolderContents(n.id,o,d.data.id)}l.push({requestId:n.id,success:!0,data:{...d.data,id:this._getOrGenerateId(d.data.id),folderId:d.data.folderId?this._getOrGenerateId(d.data.folderId):t||this._getOrGenerateId(this.rootPath)}})}else l.push({requestId:n.id,success:!1,error:d?.error||{message:"Move operation failed - no detailed result",code:"MoveNotAllowed"}})}}else for(let s of i)l.push({requestId:s.id,success:!1,error:{message:"Move operation failed - no detailed results",code:"MoveNotAllowed"}});return{success:a.success,detailed:l,error:a.error}}async copyItems(i,t){if(typeof this._inner.copyItems!="function")throw new m("Copy items is not supported by inner storage","CopyNotAllowed");let e=t?this.pathForId(t,!0):this.rootPath,r=i.map(n=>({...n,id:this.pathForId(n.id,n.isFolder??!1),folderId:n.folderId?this.pathForId(n.folderId??"",!0):this.rootPath})),a=await this._inner.copyItems(r,e),l=[];if(a.detailed&&a.detailed.length>0){let n=new Map;for(let d=0;d<a.detailed.length;d++){let o=a.detailed[d],h=o.requestId||(d<i.length?i[d].id:void 0);h&&n.set(h,o)}for(let d of i){let o=n.get(d.id)||(a.detailed.length===i.length?a.detailed[i.indexOf(d)]:void 0);if(o?.success&&o.data?.id){let h=this._getOrGenerateId(o.data.id);l.push({requestId:d.id,success:!0,data:{...o.data,id:h,folderId:o.data.folderId?this._getOrGenerateId(o.data.folderId):t||this._getOrGenerateId(this.rootPath)}})}else{let h=o?o.success?o.data?o.data.id?{message:"Unknown copy error",code:"CopyNotAllowed"}:{message:"No ID in copied item data",code:"CopyNotAllowed"}:{message:"No data returned from copy operation",code:"CopyNotAllowed"}:o.error||{message:"Copy operation failed",code:"CopyNotAllowed"}:{message:"No detailed result from copy operation",code:"CopyNotAllowed"};l.push({requestId:d.id,success:!1,error:h})}}}else for(let n of i)l.push({requestId:n.id,success:!1,error:{message:"No detailed results from copy operation",code:"CopyNotAllowed"}});let s=l.every(n=>n.success);return{success:s,detailed:l,error:s?void 0:a.error||{message:"Copy operation completed with errors",code:"CopyNotAllowed"}}}async deleteItems(i,t){if(typeof this._inner.deleteItems!="function")throw new m("Delete items is not supported by inner storage","DeleteNotAllowed");let e=i.map(s=>({...s,id:this.pathForId(s.id,s.isFolder??!1),folderId:s.folderId?this.pathForId(s.folderId??"",!0):this.rootPath})),r=await this._inner.deleteItems(e,t),a=[];if(r.detailed&&r.detailed.length>0){let s=new Map;for(let n=0;n<r.detailed.length;n++){let d=r.detailed[n],o=d.requestId||(n<i.length?i[n].id:void 0);o&&s.set(o,d)}for(let n of i){let d=s.get(n.id)||(r.detailed.length===i.length?r.detailed[i.indexOf(n)]:void 0);if(d?.success){let o=this.pathForId(n.id,n.isFolder??!1);if(t.permanent)this.recursivelyRemoveMappings(n.id,o);else if(this._updateIdMapping(n.id,this.trashPath+"/"+o+(n.isFolder?"/":"")),n.isFolder){let h=this.pathForId(n.id,n.isFolder??!1);this.remapCachedFolderContents(n.id,h,this.trashPath+"/"+o+(n.isFolder?"/":""))}a.push({requestId:n.id,success:!0})}else a.push({requestId:n.id,success:!1,error:d?.error||{message:"Delete operation failed",code:"DeleteNotAllowed"}})}}else for(let s of i)if(r.success){let n=this.pathForId(s.id,s.isFolder??!1);if(t.permanent)this.recursivelyRemoveMappings(s.id,n);else if(this._updateIdMapping(s.id,this.trashPath+"/"+n+(s.isFolder?"/":"")),s.isFolder){let d=this.pathForId(s.id,s.isFolder??!1);this.remapCachedFolderContents(s.id,d,this.trashPath+"/"+n+(s.isFolder?"/":""))}a.push({requestId:s.id,success:!0})}else a.push({requestId:s.id,success:!1,error:r.error||{message:"Delete operation failed",code:"DeleteNotAllowed"}});let l=a.every(s=>s.success);return{success:l,detailed:a,error:l?void 0:r.error||{message:"Some items failed to delete",code:"DeleteNotAllowed"}}}remapCachedFolderContents(i,t,e){let r=t.replace(/\/+$/,""),a=e.replace(/\/+$/,""),l=[];for(let[s,n]of this._idToPath.entries()){let d=n.replace(/\/+$/,"");d!==r&&d.startsWith(r+"/")&&l.push({id:s,oldPath:d})}for(let{id:s,oldPath:n}of l){let d=a+n.substring(r.length);this._updateIdMapping(s,d)}}recursivelyRemoveMappings(i,t){let e=t.replace(/\/+$/,""),r=[],a=[];for(let[l,s]of this._idToPath.entries()){let n=s.replace(/\/+$/,"");(n===e||n.startsWith(e+"/"))&&(r.push(l),a.push(n))}for(let l=0;l<r.length;l++)this._idToPath.delete(r[l]),this._pathToId.delete(a[l])}async copyItem(i,t){if(typeof this._inner.copyItem!="function")throw new m("Copy item is not supported by inner storage","CopyNotAllowed");let e=this.pathForId(i.id,i.isFolder??!1),r=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.copyItem({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},r),l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):t??"";return{...a,id:l,folderId:s}}async updateFile(i,t){if(typeof this._inner.updateFile!="function")throw new m("Update file is not supported by inner storage","UnsupportedOperation");let e=this.pathForId(i.id,!1),{...r}=await this._inner.updateFile({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},t);return this._updateIdMapping(i.id,r.id),r.folderId&&(r={...r,folderId:this._getOrGenerateId(r.folderId)}),{...r,id:this._getOrGenerateId(r.id)}}async getFileData(i,t){let e=this.pathForId(i.id,!1);if(typeof this._inner.getFileData=="function")return this._inner.getFileData({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},t);let r=i.url||(typeof this.getUrl=="function"?await this.getUrl(i):void 0);if(!r)throw new m("Cannot get file data: no url and no inner.getFileData","FileReadError");return fetch(r,t?.forceReload?{cache:"no-store"}:void 0).then(a=>a.blob())}async cleanTrash(){if(typeof this._inner.cleanTrash!="function")throw new m("Clean trash is not supported by inner storage","UnsupportedOperation");return await this._inner.cleanTrash()}};function Le(i){return typeof i!="object"||!i?!1:"name"in i&&i.name==="DirectResourceFetchError"?!("final"in i)||i.final!==!1:"final"in i&&i.final===!0}function Y(i){if(Le(i)||i instanceof m)throw i}async function Ke(i,t,e,r,a){let{fetchWithProxy:l,handleFileProxy:s,handleProxyUrl:n}=t,d={mode:"cors",...a?.fetchInit},o;if(s)try{let h=await Promise.resolve(s(i));if(h)return r(h)}catch(h){Y(h),o=h}if(n)try{let h=await Promise.resolve(n(i));if(h&&h!==i)return r(await e(h))}catch(h){Y(h),o=h}if(l)try{let h=await Promise.resolve(l(i,d,{intent:"downloadBlob"}));if(!h.ok)throw Error(`HTTP ${h.status}`);return r(await h.blob())}catch(h){Y(h),o=h}if(!l)try{return r(await e(i))}catch(h){Y(h),o=h}throw o instanceof Error?o:Error("Failed to download file from the URL")}var Je={ai:(0,w.jsx)(O.EmIcons,{icon:"AIRequests",component:E.icons$AIRequests}),email_generate:(0,w.jsx)(O.EmIcons,{icon:"EmailEnvelope",component:E.icons$EmailEnvelope}),image_generate:(0,w.jsx)(O.EmIcons,{icon:"Image",component:E.icons$Image}),optimization:(0,w.jsx)(O.EmIcons,{icon:"Optimization",component:E.icons$Optimization}),preview:(0,w.jsx)(O.EmIcons,{icon:"SendOutlined",component:E.icons$SendOutlined}),link_check:(0,w.jsx)(O.EmIcons,{icon:"Web",component:E.icons$Web}),image_check:(0,w.jsx)(O.EmIcons,{icon:"Image",component:E.icons$Image}),spam_check:(0,w.jsx)(O.EmIcons,{icon:"Block",component:E.icons$Block}),projects:(0,w.jsx)(O.EmIcons,{icon:"FolderOpen",component:E.icons$FolderOpen}),emails:(0,w.jsx)(O.EmIcons,{icon:"EmailEnvelope",component:E.icons$EmailEnvelope}),blocks:(0,w.jsx)(O.EmIcons,{icon:"Block",component:E.icons$Block}),users:(0,w.jsx)(O.EmIcons,{icon:"SliderGroup",component:E.icons$SliderGroup})};function ye(i,t){if(i==null)return null;if(typeof i=="number"||typeof i=="string"){const e=i==="∞"||typeof i=="string"&&i.toLowerCase()==="infinity";return(0,w.jsx)("span",{className:t==="old"?"limit-upgrade-modal__limit-old":`limit-upgrade-modal__limit-new${e?" limit-upgrade-modal__limit-new--infinity":""}`,children:e?"∞":i})}return i}var We=({open:i,onClose:t,title:e,subtitle:r,usageResource:a,icon:l,previousDisplay:s,nextDisplay:n,onChangePlan:d,secondaryAction:o,changePlanLabel:h})=>{const{__:c}=O.useI18n(),u=h??c("Change plan"),f=!!o,p=a!=null?Je[a]:l??null;return(0,w.jsx)(E.ui_kit$Modal,{open:i,onCancel:t,footer:null,closable:!1,width:400,centered:!0,className:"limit-upgrade-modal",destroyOnHidden:!0,mask:{closable:!0},children:(0,w.jsxs)("div",{className:"limit-upgrade-modal__wrap",children:[(0,w.jsx)("div",{className:"limit-upgrade-modal__header",children:(0,w.jsx)("button",{type:"button",className:"limit-upgrade-modal__close",onClick:t,"aria-label":c("Close"),children:(0,w.jsx)(O.EmIcons,{icon:"CloseOutlined",component:E.icons$CloseOutlined})})}),(0,w.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,w.jsx)("h1",{className:"limit-upgrade-modal__title",children:e}),(0,w.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:r}),(0,w.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,w.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:p}),ye(s,"old"),(0,w.jsx)("div",{className:"limit-upgrade-modal__arrow-btn","aria-hidden":!0,children:(0,w.jsx)(O.EmIcons,{icon:"ArrowUpOutlined",component:E.icons$ArrowUpOutlined,className:"limit-upgrade-modal__arrow-icon"})}),ye(n,"new")]})]}),(0,w.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,w.jsx)("div",{className:f?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:o?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(E.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:o.onClick,children:o.label}),(0,w.jsx)(E.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:d,children:u})]}):(0,w.jsx)(E.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:d,children:u})})]})})};Object.defineProperty(j,"D",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(j,"LimitUpgradeModal",{enumerable:!0,get:function(){return We}}),Object.defineProperty(j,"Z",{enumerable:!0,get:function(){return je}}),Object.defineProperty(j,"_",{enumerable:!0,get:function(){return q}}),Object.defineProperty(j,"b",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(j,"e",{enumerable:!0,get:function(){return m}}),Object.defineProperty(j,"ie",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(j,"ne",{enumerable:!0,get:function(){return Ge}})});
5
+ __useblocks__.define("static/core/4cda85e3.js",["require","exports","module","static/core/2ff39ddf.js","static/core/b2b19022.js","react","react/jsx-runtime","__delivery__/libs"],function(G,j,He){const Pe=G("./2ff39ddf.js"),O=G("./b2b19022.js");let re=G("react");re=Pe.__toESM(re);let w=G("react/jsx-runtime"),E=G("__delivery__/libs");var m=class ge extends Error{constructor(t,e,r,a){super(t),this.code=e,this.status=r,this.details=a,this.name="FileManagerApiError",Error.captureStackTrace&&Error.captureStackTrace(this,ge)}},L="",$=class{constructor(){this.map=new Map}static childrenViewKey(i,t){return`v${L}${i}${L}${t}`}static childrenCountKey(i){return`c${L}${i}`}getFreshError(i,t){let e=this.map.get(i);return e?t!==1/0&&Date.now()-e.updatedAt>t?(this.map.delete(i),null):e.error:null}setError(i,t){this.map.set(i,{error:t,updatedAt:Date.now()})}delete(i){this.map.delete(i)}clearChildrenViewErrorsForParent(i){let t=`v${L}${i}${L}`;for(let e of[...this.map.keys()])e.startsWith(t)&&this.map.delete(e)}clearAll(){this.map.clear()}},Ce=class{constructor(){this.deletingIds=new Set}beginDeleting(i){for(let t of i)t&&this.deletingIds.add(t)}endDeleting(i){for(let t of i)t&&this.deletingIds.delete(t)}isDeleting(i){return!!i&&this.deletingIds.has(i)}};function ae(i){return{sortBy:i?.sortBy??"name",sortOrder:i?.sortOrder==null?i?.sortBy!=null&&i.sortBy!==""?"desc":"asc":i.sortOrder==="desc"?"desc":"asc"}}function le(i,t,e){let{sortBy:r,sortOrder:a}=ae(e),l=0;switch(r){case"name":l=(i.name||"").localeCompare(t.name||"");break;case"date":l=new Date(i.date||0).getTime()-new Date(t.date||0).getTime();break;case"size":l=(Number(i.size)||0)-(Number(t.size)||0);break;case"type":l=(i.extension||i.type||"").toLowerCase().localeCompare((t.extension||t.type||"").toLowerCase());break;default:l=(i.name||"").localeCompare(t.name||"")}return a==="desc"?-l:l}function W(i){return i!=null&&String(i).trim()!==""}function be(i,t){let{sortBy:e}=ae(t);switch(e){case"date":return W(i.date)?!Number.isNaN(new Date(i.date).getTime()):!1;case"size":return i.size!=null&&Number.isFinite(Number(i.size));case"type":return W(i.extension)||W(i.type);default:return W(i.name)}}function Ee(i,t){let e=typeof t?.search=="string"?t.search.trim():"";if(!e)return!0;let r=e.toLowerCase();return(i.name?.toLowerCase().includes(r)??!1)||(i.type?.toLowerCase().includes(r)??!1)||(i.extension?.toLowerCase().includes(r)??!1)}var Se=le,Te=Ee,Ne=be;function se(i={}){return{...i,comparator:i.comparator??Se,filterMatch:i.filterMatch??Te,hasSortValue:i.hasSortValue??Ne}}var q="Trash";function B(i){return i.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}function oe(i,t,e=q){let r=B(i);if(!r)return[];let a=[i,r];if(r===B(t)){a.push(t);let l=B(t);l==="Trash"||l.toLowerCase()==="trash"?a.push(e,q,q.toLowerCase()):e!=="Trash"&&B(e)!==l&&a.push(e)}return Array.from(new Set(a.map(B).filter(Boolean)))}function Ae(i){let t=new Map;for(let[e,r]of Object.entries(i))r.id&&t.set(B(e),r);return e=>{let r=t.get(B(e));if(r)return{id:r.id,name:r.name??r.id,folderId:r.folderId??null,isFolder:!0}}}function x(){if(typeof globalThis?.crypto?.randomUUID=="function")return globalThis.crypto.randomUUID();try{let i=globalThis.crypto||globalThis.msCrypto;if(i&&typeof i.getRandomValues=="function"){let t=new Uint8Array(16);i.getRandomValues(t);let e="";for(let r=0;r<t.length;r++)e+=t[r].toString(16).padStart(2,"0");return`id_${e}`}}catch{}return`id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random()*(2**53-1)).toString(36).slice(0,8)}`}var Oe=/^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;function ne(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return i}}function xe(i){let t=new URL(i.trim());t.hash="",t.hostname=t.hostname.toLowerCase(),(t.protocol==="https:"&&t.port==="443"||t.protocol==="http:"&&t.port==="80")&&(t.port="");let e=(t.search.startsWith("?")?t.search.slice(1):t.search).split("&").filter(Boolean).map(r=>{let a=r.indexOf("="),l=a===-1?r:r.slice(0,a),s=a===-1?"":r.slice(a+1);return{pair:r,key:ne(l),value:ne(s)}}).filter(({key:r})=>!Oe.test(r)).sort((r,a)=>{let l=r.key.localeCompare(a.key);return l===0?r.value.localeCompare(a.value):l});return t.search=e.length?`?${e.map(({pair:r})=>r).join("&")}`:"",t.toString()}function de(i){try{return xe(i)}catch{return i.trim()}}var he="",Q=18e5;function T(i){return i==null||i===""?he:i}function X(i){if(i==null)return 1/0;let t=Number(i);return Number.isFinite(t)&&t>=0?t:1/0}function Be(i){return!i||typeof i.search!="string"?!1:i.search.trim().length>0}function D(i){if(!i)return null;let t=i.folderId;return t==null?null:String(t)}function I(i){return!!i&&!!i.isFolder}function ue(i){if(!i||typeof i!="object")return!1;let t=i;return t.code==="path_folder_not_found"||t.code==="folder_not_found"||t.code==="FolderNotFound"||t.data?.code==="path_folder_not_found"||t.data?.code==="folder_not_found"||t.status===404||t.data?.data?.status===404}function De(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i.charCodeAt(e),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)}function M(i){if(!i||typeof i!="object")return String(i??"");let t=i,e=[],r={},a=["page","pageSize","sortBy","sortOrder","search","itemType","limit"];for(let d of Object.keys(t).sort()){let o=t[d];a.includes(d)?e.push(`${d}=${String(o??"")}`):r[d]=o}let l=Object.keys(r).length?JSON.stringify(r):"",s=e.join("|"),n=l?De(l):"";return`${s}${n?`|${n}`:""}`}var ce=class Ie{constructor(){this.entities=new Map,this.childrenByParent=new Map,this.maxCacheSize=1e4}now(){return Date.now()}checkCacheSize(){if(this.entities.size>this.maxCacheSize){let t=Array.from(this.entities.entries()).sort((r,a)=>r[1].updatedAt-a[1].updatedAt),e=Math.floor(this.maxCacheSize*.1);for(let r=0;r<e&&r<t.length;r++){let[a,l]=t[r];this.deleteEntityById(a)}}}getEntity(t){return this.entities.get(t)?.value}getRecord(t){return this.entities.get(t)}getFileSystemItem(t){let e=this.getEntity(t);return e&&!I(e)?e:void 0}getFolder(t){let e=this.getEntity(t);return e&&I(e)?e:void 0}getChildrenIds(t,e={}){let r=T(t),a=this.childrenByParent.get(r);return a?e.onlyFileSystemItems?Array.from(a.files):e.onlyFolders?Array.from(a.folders):[...Array.from(a.folders),...Array.from(a.files)]:[]}searchByUrl(t){let e=de(t);for(let r of this.entities.values()){let a=r.value.url;if(a&&(a===t||de(a)===e))return r.value}return null}upsertEntity(t){let e=this.entities.get(t.id)??null,r=e?e.value:null,a=r?D(r):null,l=D(t),s=r?I(r):!1,n=I(t),d;if(r&&I(r)&&n){let u=r.childrenCount,f=t.childrenCount;u!==void 0&&f===void 0&&(d=u)}if(r&&(a!==l||s!==n)){let u=T(a),f=this.childrenByParent.get(u);f&&(s?f.folders.delete(t.id):f.files.delete(t.id),f.files.size===0&&f.folders.size===0&&this.childrenByParent.delete(u))}let o=t;d!==void 0&&(o={...t,childrenCount:d}),this.entities.set(t.id,{value:{...o},updatedAt:this.now()}),this.checkCacheSize();let h=T(l),c=this.childrenByParent.get(h);c||(c={files:new Set,folders:new Set},this.childrenByParent.set(h,c)),n?c.folders.add(t.id):c.files.add(t.id)}updateServerChildrenCount(t,e){if(t==null||e==null||Number.isNaN(e))return;let r=this.entities.get(t);if(!r||!I(r.value))return;let a={...r.value,childrenCount:e};this.entities.set(t,{value:a,updatedAt:this.now()})}deleteEntityById(t){let e=this.entities.get(t)??null;if(!e)return{entity:null,parentId:null};let r=e.value,a=D(r),l=T(a),s=this.childrenByParent.get(l);return s&&(I(r)?s.folders.delete(t):s.files.delete(t),s.files.size===0&&s.folders.size===0&&this.childrenByParent.delete(l)),this.entities.delete(t),{entity:{...r},parentId:a}}deleteFolderRecursive(t){let e=this.entities.get(t);if(!e||!I(e.value))return{deletedFolderRecords:[],deletedFileSystemItemRecords:[]};let r=[{id:t,parentId:D(e.value)}],a=[],l=[];for(;r.length;){let d=r.shift();a.push(d);let o=this.childrenByParent.get(T(d.id));if(o){for(let h of Array.from(o.folders)){let c=this.entities.get(h);c&&r.push({id:h,parentId:D(c.value)})}for(let h of Array.from(o.files))l.push(h)}}let s=[];for(let d of l){let o=this.entities.get(d);if(!o)continue;let h=o.value,c=T(D(h)),u=this.childrenByParent.get(c);u&&(u.files.delete(d),u.files.size===0&&u.folders.size===0&&this.childrenByParent.delete(c)),this.entities.delete(d),s.push({...h})}let n=[];for(let d=a.length-1;d>=0;d--){let{id:o,parentId:h}=a[d],c=this.entities.get(o);if(!c)continue;let u=c.value,f=T(u.id);this.childrenByParent.delete(f);let p=T(h),v=this.childrenByParent.get(p);v&&(v.folders.delete(o),v.files.size===0&&v.folders.size===0&&this.childrenByParent.delete(p)),this.entities.delete(o),n.push({...u})}return{deletedFolderRecords:n,deletedFileSystemItemRecords:s}}moveEntityById(t,e){let r=this.entities.get(t)??null;if(!r)return null;let a=r.value,l=T(D(a)),s=this.childrenByParent.get(l);s&&(I(a)?s.folders.delete(t):s.files.delete(t),s.files.size===0&&s.folders.size===0&&this.childrenByParent.delete(l));let n={...a,folderId:e};if(I(a)&&I(n)){let h=a.childrenCount;h!==void 0&&(n.childrenCount=h)}this.entities.set(t,{value:n,updatedAt:this.now()});let d=T(e),o=this.childrenByParent.get(d);return o||(o={files:new Set,folders:new Set},this.childrenByParent.set(d,o)),I(n)?o.folders.add(t):o.files.add(t),{...n}}copyFileSystemItem(t,e,r){let a=this.entities.get(t)??null;if(!a||I(a.value))return null;let l={...a.value,id:e,folderId:r};return this.upsertEntity(l),{...l}}copyFolderShallow(t,e,r){let a=this.entities.get(t)??null;if(!a||!I(a.value))return null;let l={...a.value,id:e,folderId:r};return this.upsertEntity(l),{...l}}isEntityStale(t,e){let r=this.entities.get(t)??null;return!r||e!==1/0&&this.now()-r.updatedAt>e}touch(t,e){let r=this.entities.get(t);r&&(r.updatedAt=e??this.now())}getEntitiesByIds(t){return t.map(e=>this.entities.get(e)?.value??null)}searchByName(t,e){if(!t||t.trim()==="")return[];let r=e?.parentId,a=e?.recursive??!1,l=e?.itemType??"all",s=e?.caseSensitive??!1,n=e?.limit??1/0,d=s?t.trim():t.trim().toLowerCase(),o=[],h=null;if(r!==void 0){h=new Set;let c=T(r);if(h.add(c),a){let u=[c],f=new Set;for(;u.length>0;){let p=u.shift();if(f.has(p))continue;f.add(p);let v=this.childrenByParent.get(p);if(v)for(let y of v.folders)h.add(y),u.push(y)}}}for(let[,c]of this.entities){if(o.length>=n)break;let u=c.value;if(h!==null){let p=T(D(u));if(!h.has(p))continue}if(l==="file"&&I(u)||l==="folder"&&!I(u))continue;let f=u.name??"";(s?f:f.toLowerCase()).includes(d)&&o.push({...u})}return o}toJSON(){return{entities:Array.from(this.entities.entries()),childrenByParent:Array.from(this.childrenByParent.entries()).map(([t,e])=>[t,{files:Array.from(e.files),folders:Array.from(e.folders)}])}}static fromJSON(t){let e=new Ie;for(let[r,a]of t.entities??[])e.entities.set(r,{value:a.value,updatedAt:a.updatedAt});for(let[r,a]of t.childrenByParent??[])e.childrenByParent.set(r,{files:new Set(a.files),folders:new Set(a.folders)});return e}},fe=class _e{constructor(t={},e=Q,r,a,l=new $,s=ue){this.views=new Map,this.maxViewsPerParent=50;let n=se(t);this.strategy={allowSortedInsert:n.allowSortedInsert??!0,allowSearchInsert:n.allowSearchInsert??!0,invalidateOnPaginationFull:n.invalidateOnPaginationFull??!0,preloadPagesBefore:n.preloadPagesBefore??0,preloadPagesAfter:n.preloadPagesAfter??1,comparator:n.comparator,filterMatch:n.filterMatch,hasSortValue:n.hasSortValue},this.ttl=e,this.errorTtl=r??e,this.entityTtl=a??e,this.failedRequests=l,this.isFolderNotFoundError=s}setServerChildrenCountHandler(t){this.serverChildrenCountHandler=t}setChildrenCountInvalidator(t){this.childrenCountInvalidator=t}now(){return Date.now()}parentKey(t){return T(t??null)}isExpired(t){return t==null||this.ttl!==1/0&&this.now()-t>this.ttl}areEntitiesStale(t,e){return!t||t.some(r=>!e.getEntity(r)||e.isEntityStale(r,this.entityTtl))}isEntityTypeCompatible(t,e){return!!(!e||e==="all"||e==="file"&&!I(t)||e==="folder"&&I(t))}markViewStaleForReload(t){t.view.meta={...t.view.meta??{},stale:!0},t.view.updatedAt=this.now(),t.view.loadId=x(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}cleanupOldViews(t){if(t.size<=this.maxViewsPerParent)return;let e=Array.from(t.entries()).sort((r,a)=>(a[1].view.updatedAt||0)-(r[1].view.updatedAt||0));for(;t.size>this.maxViewsPerParent&&e.length>0;){let[r]=e.pop();t.delete(r)}}async getOrCreateChildren(t,e,r,a){let l=this.parentKey(t),s=M(e??{}),n=this.views.get(l);n||(n=new Map,this.views.set(l,n));let d=$.childrenViewKey(l,s),o=n.get(s);o||(o={params:e,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},n.set(s,o),this.cleanupOldViews(n));let h=this.failedRequests.getFreshError(d,this.errorTtl);if(h!=null)throw h;if(o.view.value&&!this.isExpired(o.view.updatedAt)&&!this.areEntitiesStale(o.view.value,a)&&!o.view.meta?.stale){let f=o.view.value.map(v=>a.getEntity(v)).filter(Boolean),p=o.params?.itemType||"all";return{items:f.filter(v=>this.isEntityTypeCompatible(v,p)),...o.view.meta??{}}}if(o.view.promise)return o.view.promise;let c=x();o.view.loadId=c;let u=(async()=>{try{let f=await r(t,e),p=Be(e),v=p?{...f,total:void 0}:f,y=this.views.get(l)?.get(M(e));if(!y||y.view.loadId!==c){let b=Error("StaleLoad");throw b.name="StaleLoad",b}for(let b of v.items)a.upsertEntity(b);o.view.value=v.items.map(b=>b.id);let{items:R,...P}=v,_={...P};o.view.meta=_,o.view.meta&&(o.view.meta.stale=!1),this.failedRequests.delete(d),o.view.updatedAt=this.now(),!p&&typeof _.total=="number"&&(this.serverChildrenCountHandler?this.serverChildrenCountHandler(t??null,_.total,a):a.updateServerChildrenCount(t,_.total));let C=this.strategy.preloadPagesAfter??0,N=this.strategy.preloadPagesBefore??0,z=X(e?.pageSize);if((C>0||N>0)&&Number.isFinite(z)){let b=t,g={...e},U=typeof _.totalPages=="number"?_.totalPages:1,V=e?.page??1,K=z,A=r,S=c;setTimeout(()=>{this.preloadPagesAsync(b,g,V,U,K,C,N,a,_,A,S)},0)}return v}catch(f){if(f?.name==="StaleLoad")throw this.failedRequests.delete(d),o.view.value=void 0,o.view.updatedAt=this.now(),f;if(this.isFolderNotFoundError(f))return this.failedRequests.delete(d),o.view.value=[],o.view.meta={total:0,totalPages:0},o.view.updatedAt=this.now(),{items:[],total:0,totalPages:0};throw this.failedRequests.setError(d,f),o.view.value=void 0,o.view.updatedAt=this.now(),f}finally{o.view.promise=null}})();return o.view.promise=u,u}async preloadPagesAsync(t,e,r,a,l,s,n,d,o,h,c){try{let u=this.parentKey(t),f=this.views.get(u);if(!f)return;let p=f.get(M(e));if(!p||c!=null&&p.view.loadId!==c)return;let v=f.get(M(e));if(!v?.view.meta)return;let y=typeof v.view.meta.totalPages=="number"?v.view.meta.totalPages:1;if(y!==a)return;let R=async P=>{let _={...e,page:P};try{let C=await h(t,_),N=this.views.get(u);if(!N)return;let z=N.get(M(e));if(!z||c!=null&&z.view.loadId!==c||z.view.loadId!==c)return;for(let U of C.items)d.upsertEntity(U);let b=M(_),g=N.get(b);if(g||(g={params:_,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:z.view.loadId}},N.set(b,g),this.cleanupOldViews(N)),!g.view.value||this.isExpired(g.view.updatedAt)){g.view.value=C.items.map(K=>K.id);let{items:U,...V}=C;g.view.meta={...V,page:P,totalPages:y},g.view.updatedAt=this.now()}}catch{}};if(s>0&&r<y)for(let P=1;P<=Math.min(s,y-r);P++){let _=r+P,C=M({...e,page:_}),N=f.get(C);(!N?.view.value||this.isExpired(N.view.updatedAt))&&R(_)}if(n>0&&r>1)for(let P=1;P<=Math.min(n,r-1);P++){let _=r-P,C=M({...e,page:_}),N=f.get(C);(!N?.view.value||this.isExpired(N.view.updatedAt))&&R(_)}}catch{}}removeEmptyPageIfNeeded(t,e,r,a,l){if(e.view.value&&e.view.value.length===0&&r<a){let s=M({...l,page:r});t.delete(s)}}updateTotalPagesForAllViews(t,e){for(let[,r]of t)r.view.meta&&(r.view.meta.totalPages=e)}isParamsSame(t,e){let r=Object.keys(t??{}).filter(l=>l!=="page").sort(),a=Object.keys(e??{}).filter(l=>l!=="page").sort();if(r.length!==a.length)return!1;for(let l=0;l<r.length;l++){let s=r[l];if(s!==a[l]||t[s]!==e[s])return!1}return!0}syncTotalsInSameViews(t,e){let r=e.view.meta;if(!r||typeof r.total!="number")return;let a=Number(r.total),l=X(e.params?.pageSize),s=Number.isFinite(l)&&l>0?Math.max(1,Math.ceil(a/l)):void 0;for(let[,n]of t)this.isParamsSame(n.params??{},e.params??{})&&(n.view.meta||(n.view.meta={}),n.view.meta.total=a,s!==void 0&&(n.view.meta.totalPages=s))}cascadeShiftPages(t,e,r,a,l,s,n){let d=e,o=r,h=!1,c=0;for(;d.view.value&&d.view.value.length<a&&o<l&&c<100;){c++;let u=M({...n,page:o+1}),f=t.get(u);if(!f?.view.value||this.isExpired(f.view.updatedAt)){d.view.meta={...d.view.meta??{},stale:!0};break}let p=a-d.view.value.length,v=f.view.value.slice(0,p).filter(y=>s.getEntity(y));if(v.length===0){d.view.meta={...d.view.meta??{},stale:!0};break}if(d.view.value=[...d.view.value,...v],d.view.updatedAt=Date.now(),f.view.value=f.view.value.slice(v.length),f.view.updatedAt=Date.now(),f.view.value.length===0){let y=o+1,R=f.view.meta;if(y<(R&&typeof R.totalPages=="number"?R.totalPages:1)){let P=M({...n,page:y});t.delete(P),h=!0}break}d=f,o++}return(!d.view.value||d.view.value.length<a)&&o>=l&&(d.view.meta={...d.view.meta??{},stale:!0}),h}cascadeShiftToNextPage(t,e,r,a,l,s,n){if(!e.view.value||e.view.value.length<=a)return!1;if(r-(n.page||1)>=10)return e.view.meta={...e.view.meta??{},stale:!0},!1;let d={...n,page:r+1},o=M(d),h=t.get(o),c=!1;if(!h?.view.value||this.isExpired(h.view.updatedAt))if(r>=l){h={params:d,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},t.set(o,h),this.cleanupOldViews(t);let p=e.view.meta;p&&(h.view.meta={...p,page:r+1}),c=!0}else return e.view.meta={...e.view.meta??{},stale:!0},!1;let u=e.view.value.slice(a).filter(p=>s.getEntity(p));if(u.length===0)return c&&t.delete(o),!1;e.view.value=e.view.value.slice(0,a),e.view.updatedAt=Date.now(),h.view.value=[...u,...h.view.value??[]],h.view.updatedAt=Date.now();let f=h.view.meta&&typeof h.view.meta.totalPages=="number"?h.view.meta.totalPages:l;if(!c&&this.cascadeShiftToNextPage(t,h,r+1,a,f,s,n))return!0;if(!h.view.value||h.view.value.length===0){let p=r+1,v=h.view.meta,y=v&&typeof v.totalPages=="number"?v.totalPages:1;this.removeEmptyPageIfNeeded(t,h,p,y,n)}return c}canCompareInSortedView(t,e){let r=t.params??{};return!r.sortBy&&!r.sortOrder||!this.strategy.hasSortValue||this.strategy.hasSortValue(e,t.params)}tryInsertSorted(t,e,r){let a=this.strategy.comparator;if(!a||!t.view.value)return!1;let l=t.params?.itemType||"all";if(!this.isEntityTypeCompatible(e,l)||!this.canCompareInSortedView(t,e))return!1;let s=t.view.value.map(o=>r.getEntity(o));if(s.some(o=>!o))return!1;if(s.length===0){let o=t.params??{};if(o.sortBy||o.sortOrder){let h=a(e,e,t.params);if(typeof h!="number"||Number.isNaN(h))return!1}return t.view.value.includes(e.id)?(t.view.updatedAt=this.now(),!0):(t.view.value=[e.id],t.view.updatedAt=this.now(),!0)}let n=0,d=s.length;for(;n<d;){let o=Math.floor((n+d)/2),h=a(e,s[o],t.params);if(typeof h!="number"||Number.isNaN(h))return!1;h>=0?n=o+1:d=o}return t.view.value.includes(e.id)?(t.view.updatedAt=this.now(),!0):(t.view.value=[...t.view.value.slice(0,n),e.id,...t.view.value.slice(n)],t.view.updatedAt=this.now(),!0)}updateChildrenCountForOperation(t,e,r,a){let l=D(e);switch(t){case"delete":this.adjustChildrenCount(a,l,-1),this.childrenCountInvalidator?.(l);break;case"insert":case"copy":this.adjustChildrenCount(a,l,1),this.childrenCountInvalidator?.(l);break;case"move":this.adjustChildrenCount(a,r??null,-1),this.adjustChildrenCount(a,l,1),this.childrenCountInvalidator?.(r??null),this.childrenCountInvalidator?.(l)}}adjustChildrenCount(t,e,r){if(!e)return;let a=t.getFolder(e);if(a&&typeof a.childrenCount=="number"){let l=Math.max(0,a.childrenCount+r);t.updateServerChildrenCount(e,l)}}smartInvalidateChildrenViews(t,e,r,a,l,s){if(!e)return;this.updateChildrenCountForOperation(r,e,l,a);let n=this.parentKey(t),d=this.views.get(n);if(d)for(let[,o]of d){let h=o.params??{},c=h?.page??1,u=X(h?.pageSize),f=Number.isFinite(u),p=!!(h?.sortBy||h?.sortOrder),v=!!h?.search,y=h?.itemType||"all";if(this.isEntityTypeCompatible(e,y)){if(v&&this.strategy.filterMatch&&!this.strategy.filterMatch(e,o.params)){o.view.value?.includes(e.id)&&(o.view.value=o.view.value.filter(R=>R!==e.id),o.view.meta&&typeof o.view.meta.total=="number"&&(o.view.meta.total=Math.max(0,o.view.meta.total-1)),this.markViewStaleForReload(o));continue}if(!o.view.value){o.view.meta&&(o.view.meta.stale=!0),o.view.loadId=x(),o.view.abortController&&(o.view.abortController.abort(),o.view.abortController=void 0);continue}if(o.view.value.includes(e.id),this.shouldInvalidateCompletely(o,r,e,p,f,c)){this.markViewStaleForReload(o);continue}switch(r){case"delete":this.handleDelete(d,o,c,u,f,e,a);break;case"insert":case"copy":this.handleInsert(d,o,c,u,f,p,e,a);break;case"update":this.handleUpdate(d,o,c,u,f,p,v,e,a);break;case"move":this.handleMove(d,o,c,u,f,p,e,l,a)}}}}shouldInvalidateCompletely(t,e,r,a,l,s){return!!(l&&s>1&&(e==="insert"||e==="delete"||e==="move")||this.isExpired(t.view.updatedAt))}tryReinsertEntity(t,e,r,a,l){let s=t.params?.itemType||"all";if(!this.isEntityTypeCompatible(e,s))return!1;let n=t.params??{};return this.strategy.filterMatch(e,n)?this.tryInsertSorted(t,e,r)?!0:n.sortBy||n.sortOrder?!1:!a||t.view.value.length<l?(t.view.value.push(e.id),!0):!1:!1}handleDelete(t,e,r,a,l,s,n){let d=e.view.value.includes(s.id);if(d&&(e.view.value=e.view.value.filter(o=>o!==s.id)),e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total=Math.max(0,e.view.meta.total-1),l&&Number.isFinite(a)&&typeof e.view.meta.total=="number"){let o=a;o>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/o)))}this.syncTotalsInSameViews(t,e)}if(e.view.updatedAt=Date.now(),d&&l&&e.view.value.length<a&&n){let o=e.view.meta,h=o&&typeof o.totalPages=="number"?o.totalPages:1;if(this.cascadeShiftPages(t,e,r,a,h,n,e.params??{})&&e.view.meta&&typeof e.view.meta.totalPages=="number"){let c=Math.max(1,e.view.meta.totalPages-1);e.view.meta.totalPages=c,this.updateTotalPagesForAllViews(t,c)}}e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}handleInsert(t,e,r,a,l,s,n,d){if(!e.view.value.includes(n.id)){if(s&&this.strategy.allowSortedInsert&&this.strategy.comparator&&d)if(this.tryInsertSorted(e,n,d)){if(e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total+=1,l&&Number.isFinite(a)){let o=a;o>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/o)))}this.syncTotalsInSameViews(t,e)}if(e.view.updatedAt=Date.now(),l&&(e.view.value?.length??0)>a&&d){let o=e.view.meta,h=o&&typeof o.totalPages=="number"?o.totalPages:1;if(this.cascadeShiftToNextPage(t,e,r,a,h,d,e.params??{})&&e.view.meta&&typeof e.view.meta.totalPages=="number"){let c=e.view.meta.totalPages+1;e.view.meta.totalPages=c,this.updateTotalPagesForAllViews(t,c)}}}else this.markViewStaleForReload(e);else if(!l||e.view.value.length<a){if(e.view.value.push(n.id),e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total+=1,l&&Number.isFinite(a)){let o=a;o>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/o)))}this.syncTotalsInSameViews(t,e)}e.view.updatedAt=Date.now()}else this.markViewStaleForReload(e);e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}}handleUpdate(t,e,r,a,l,s,n,d,o){let h=e.view.value.includes(d.id),c=this.isEntityTypeCompatible(d,e.params?.itemType||"all");if(h&&!c){if(e.view.value=e.view.value.filter(u=>u!==d.id),e.view.meta&&typeof e.view.meta.total=="number"&&(e.view.meta.total=Math.max(0,e.view.meta.total-1),l&&Number.isFinite(a)&&typeof e.view.meta.total=="number")){let u=a;u>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/u)))}if(e.view.updatedAt=Date.now(),l&&e.view.value.length<a&&o){let u=e.view.meta,f=u&&typeof u.totalPages=="number"?u.totalPages:1;if(this.cascadeShiftPages(t,e,r,a,f,o,e.params??{})&&e.view.meta&&typeof e.view.meta.totalPages=="number"){let p=Math.max(1,e.view.meta.totalPages-1);e.view.meta.totalPages=p,this.updateTotalPagesForAllViews(t,p)}}e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0);return}if(h&&(s||n)){e.view.value=e.view.value.filter(u=>u!==d.id),this.tryReinsertEntity(e,d,o,l,a)?(e.view.updatedAt=Date.now(),e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)):this.markViewStaleForReload(e);return}if(h){e.view.updatedAt=Date.now(),e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0);return}if(c&&!n){if(s&&this.strategy.allowSortedInsert&&this.strategy.comparator&&o)if(this.tryInsertSorted(e,d,o)){if(e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total+=1,l&&Number.isFinite(a)){let u=a;u>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/u)))}this.syncTotalsInSameViews(t,e)}e.view.updatedAt=Date.now()}else this.markViewStaleForReload(e);else if(!l||e.view.value.length<a){if(e.view.value.push(d.id),e.view.meta&&typeof e.view.meta.total=="number"){if(e.view.meta.total+=1,l&&Number.isFinite(a)){let u=a;u>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/u)))}this.syncTotalsInSameViews(t,e)}e.view.updatedAt=Date.now()}else this.markViewStaleForReload(e);e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}}handleMove(t,e,r,a,l,s,n,d,o){if(e.view.value.includes(n.id)){if(e.view.value=e.view.value.filter(h=>h!==n.id),e.view.meta&&typeof e.view.meta.total=="number"&&(e.view.meta.total=Math.max(0,e.view.meta.total-1),l&&Number.isFinite(a)&&typeof e.view.meta.total=="number")){let h=a;h>0&&(e.view.meta.totalPages=Math.max(1,Math.ceil(e.view.meta.total/h)))}if(e.view.updatedAt=Date.now(),l&&e.view.value.length<a&&o){let h=e.view.meta,c=h&&typeof h.totalPages=="number"?h.totalPages:1;if(this.cascadeShiftPages(t,e,r,a,c,o,e.params??{})&&e.view.meta&&typeof e.view.meta.totalPages=="number"){let u=Math.max(1,e.view.meta.totalPages-1);e.view.meta.totalPages=u,this.updateTotalPagesForAllViews(t,u)}}this.syncTotalsInSameViews(t,e)}e.view.loadId=x(),e.view.abortController&&(e.view.abortController.abort(),e.view.abortController=void 0)}forceInvalidateChildrenViews(t){let e=this.parentKey(t??null);this.failedRequests.clearChildrenViewErrorsForParent(e);let r=this.views.get(e);if(r)for(let[,a]of r)a.view.value=void 0,a.view.meta=void 0,a.view.promise=null,a.view.updatedAt=0,a.view.loadId=x(),a.view.abortController&&(a.view.abortController.abort(),a.view.abortController=void 0)}getKnownTotal(t){let e=this.parentKey(t??null),r=this.views.get(e);if(!r)return;let a=null;for(let[,l]of r){let s=l.view.meta;s&&typeof s.total=="number"&&(!a||(l.view.updatedAt??0)>a.updatedAt)&&(a={total:Number(s.total),updatedAt:l.view.updatedAt??0})}return a?a.total:void 0}toJSON(){return{views:Array.from(this.views.entries()).map(([t,e])=>[t,Array.from(e.entries())]),ttl:this.ttl,errorTtl:this.errorTtl,entityTtl:this.entityTtl,strategy:{allowSortedInsert:this.strategy.allowSortedInsert,allowSearchInsert:this.strategy.allowSearchInsert,invalidateOnPaginationFull:this.strategy.invalidateOnPaginationFull,preloadPagesBefore:this.strategy.preloadPagesBefore,preloadPagesAfter:this.strategy.preloadPagesAfter}}}static fromJSON(t,e){let r=e?.ttl??t?.ttl??18e5,a=e?.errorTtl??t?.errorTtl??r,l=e?.failedRequests??new $,s=new _e({},r,a,void 0,l,e?.isFolderNotFoundError);for(let[n,d]of t.views??[]){let o=new Map;for(let[h,c]of d){let u=c;u?.view&&"error"in u.view&&delete u.view.error,o.set(h,u)}s.views.set(n,o)}return s}},Me=class Fe{invalidateChildrenCountCache(t){let e=T(t??"");this.childrenCountPromises.delete(e),this.failedRequests.delete($.childrenCountKey(e))}constructor(t={},e=Q,r,a){this.childrenCountPromises=new Map,this.isFolderNotFoundError=a?.isFolderNotFoundError??ue,this.failedRequests=new $,this.ttl=a?.ttl??e,this.errorTtl=a?.errorTtl??r??this.ttl,this.entities=new ce,this.views=new fe(t,this.ttl,this.errorTtl,void 0,this.failedRequests,this.isFolderNotFoundError),this.views.setServerChildrenCountHandler((l,s,n)=>{this.handleServerReportedChildrenCount(l,s,n??this.entities)}),this.views.setChildrenCountInvalidator(l=>{this.invalidateChildrenCountCache(l)})}getEntity(t){return this.entities.getEntity(t)??null}getFileSystemItem(t){return this.entities.getFileSystemItem(t)??null}getFolder(t){return this.entities.getFolder(t)??null}async getOrCreateChildren(t,e,r){return this.views.getOrCreateChildren(t,e,r,this.entities)}upsertEntity(t){let e=this.entities.getEntity(t.id),r=e?D(e):null,a=D(t),l=e?I(e):!1,s=I(t);if(this.entities.upsertEntity(t),e){if(r!==a||l!==s){this.views.smartInvalidateChildrenViews(r,e,"delete",this.entities),this.views.smartInvalidateChildrenViews(a,t,"insert",this.entities);return}this.views.smartInvalidateChildrenViews(a,t,"update",this.entities,void 0,e)}else this.views.smartInvalidateChildrenViews(a,t,"insert",this.entities)}isAncestor(t,e){let r=e,a=new Set;for(;r&&!a.has(r);){if(a.add(r),T(r)===T(t))return!0;let l=this.entities.getEntity(r);if(!l)break;r=D(l),r===null&&(r=he)}return!1}moveEntity(t,e){let r=this.entities.getEntity(t);if(!r||I(r)&&e!==null&&this.isAncestor(t,e))return null;let a=D(r),l=this.entities.moveEntityById(t,e);return l?(this.views.smartInvalidateChildrenViews(a,r,"delete",this.entities),this.views.smartInvalidateChildrenViews(e,l,"insert",this.entities),l):null}copyEntity(t,e,r,a){let l=this.entities.getEntity(t);if(!l)return null;let s=null;if(I(l)){let n=[t],d=[];for(;n.length;){let h=n.shift();d.push(h);let c=this.entities.getChildrenIds(h,{onlyFolders:!0});for(let u of c)n.push(u)}let o=new Map;for(let h of d)o.set(h,x());for(let h of d){let c=this.entities.getFolder(h),u=o.get(h),f=D(c),p=f===null?e:o.get(f)??null,v={...c,...h===t?a:void 0,id:u,folderId:(h===t?a?.folderId:void 0)??p};this.entities.upsertEntity(v)}for(let h of d){let c=o.get(h),u=this.entities.getChildrenIds(h,{onlyFileSystemItems:!0});for(let f of u){let p=this.entities.getFileSystemItem(f);if(!p)continue;let v=x(),y={...p,id:v,folderId:c};this.entities.upsertEntity(y)}}s=this.entities.getEntity(o.get(t))??null}else{let n=r??x();if(s=this.entities.copyFileSystemItem(t,n,e??null),s&&a){let d={...s,...a,id:n,folderId:a.folderId??e??null};this.entities.upsertEntity(d),s=d}}return s&&this.views.smartInvalidateChildrenViews(e,s,"copy",this.entities),s}searchByUrl(t){return this.entities.searchByUrl(t)??null}deleteEntity(t){let e=this.entities.getEntity(t);if(!e)return null;if(I(e)){let{deletedFolderRecords:r,deletedFileSystemItemRecords:a}=this.entities.deleteFolderRecursive(t);for(let l of a)this.views.smartInvalidateChildrenViews(l.folderId,l,"delete",this.entities);for(let l of r)this.views.smartInvalidateChildrenViews(l.folderId,l,"delete",this.entities);for(let l of r)this.views.forceInvalidateChildrenViews(l.id);return e}{let{entity:r,parentId:a}=this.entities.deleteEntityById(t);return r&&this.views.smartInvalidateChildrenViews(a,r,"delete",this.entities),r}}deleteFolderRecursive(t){let{deletedFolderRecords:e,deletedFileSystemItemRecords:r}=this.entities.deleteFolderRecursive(t);for(let a of r)this.views.smartInvalidateChildrenViews(a.folderId,a,"delete",this.entities);for(let a of e)this.views.smartInvalidateChildrenViews(a.folderId,a,"delete",this.entities);for(let a of e)this.views.forceInvalidateChildrenViews(a.id);return{deletedFileSystemItemIds:r.map(a=>a.id),deletedFolderIds:e.map(a=>a.id)}}forceInvalidate(t){let e=this.entities.getEntity(t);if(!e){this.views.forceInvalidateChildrenViews(t??null),this.invalidateChildrenCountCache(t);return}let r=new Set;if(I(e)){let a=[t];for(;a.length;){let l=a.pop();if(r.has(l))continue;r.add(l),this.views.forceInvalidateChildrenViews(l),this.invalidateChildrenCountCache(l);let s=this.entities.getChildrenIds(l,{onlyFolders:!0});for(let n of s)a.push(n)}}else{let a=e.folderId??null;this.views.forceInvalidateChildrenViews(a),this.invalidateChildrenCountCache(a)}}invalidateListingViews(t){this.views.forceInvalidateChildrenViews(t??null)}getChildrenIds(t){return this.entities.getChildrenIds(t)}searchByName(t,e){return this.entities.searchByName(t,e)}async getChildrenCount(t="",e){let r=T(t),a=$.childrenCountKey(r),l=this.failedRequests.getFreshError(a,this.errorTtl);if(l!=null)return Promise.reject(l);let s=this.childrenCountPromises.get(r);if(s)return s;let n=(async()=>{try{let d=this.entities.getFolder(t);if(d&&typeof d.childrenCount=="number")return this.failedRequests.delete(a),d.childrenCount;let o=this.views.getKnownTotal(t);if(typeof o=="number")return d&&this.handleServerReportedChildrenCount(t,o,this.entities),this.failedRequests.delete(a),o;if(e){let h=await e(t);return this.entities.getFolder(t)&&this.handleServerReportedChildrenCount(t,h,this.entities),this.failedRequests.delete(a),h}return this.failedRequests.delete(a),this.entities.getChildrenIds(t).length}catch(d){if(this.childrenCountPromises.delete(r),this.isFolderNotFoundError(d))return this.failedRequests.delete(a),0;throw this.failedRequests.setError(a,d),d}finally{this.childrenCountPromises.delete(r)}})();return this.childrenCountPromises.set(r,n),n}toJSON(){return{entities:this.entities.toJSON(),views:this.views.toJSON(),ttl:this.ttl,errorTtl:this.errorTtl}}static fromJSON(t,e,r){let a=r?.ttl??t?.ttl??18e5,l=r?.errorTtl??t?.errorTtl??a,s=new Fe(e??{},a,l,r),n=ce.fromJSON(t?.entities??{}),d=fe.fromJSON(t?.views??{},{failedRequests:s.failedRequests,ttl:a,errorTtl:l,isFolderNotFoundError:r?.isFolderNotFoundError});if(e){let o=se(e);d.strategy={allowSortedInsert:o.allowSortedInsert??!0,allowSearchInsert:o.allowSearchInsert??!0,invalidateOnPaginationFull:o.invalidateOnPaginationFull??!0,preloadPagesBefore:o.preloadPagesBefore??0,preloadPagesAfter:o.preloadPagesAfter??1,comparator:o.comparator,filterMatch:o.filterMatch}}return s.entities=n,s.views=d,d.setServerChildrenCountHandler((o,h,c)=>{s.handleServerReportedChildrenCount(o,h,c??n)}),d.setChildrenCountInvalidator(o=>{s.invalidateChildrenCountCache(o)}),s}handleServerReportedChildrenCount(t,e,r){this.checkAndResolveChildrenCountConflict(t,e,r),this.invalidateChildrenCountCache(t)}checkAndResolveChildrenCountConflict(t,e,r){if(!r||e===void 0)return;let a=t??null;if(!a){r.updateServerChildrenCount(a,e);return}let l=r.getFolder(a)?.childrenCount;l!==void 0&&l!==e&&this.views.forceInvalidateChildrenViews(a),r.updateServerChildrenCount(a,e)}},Re="",Ue="Trash",ke="Edited",me=1e4,pe=1e4,ve=25,we=10;function H(i,t){let e=i??{},r=Array.isArray(e.detailed)?e.detailed.map(a=>({requestId:a.requestId??a.id,success:!!a.success,data:t(a.data),error:a.error})):void 0;return{success:!!e.success,error:e.error,detailed:r}}function ee(i){return i==null?"":String(i)}function F(i){return{...i,name:ee(i.name)}}function ze(i){return(i??[]).map(F)}function k(i){return!i||typeof i!="object"||!("name"in i)?i:{...i,name:ee(i.name)}}function Ve(i){return i?i.replaceAll("\\","/").split("/").filter(Boolean):[]}var je=class{_getTrashPath(){return this._pathOptions.trashPath||Ue}_getPathLookupCandidates(i){return oe(i,this._getTrashPath(),q)}_folderFromResolvedPath(i,t){if(i.isFolder!==!0)throw new m(i.isFolder===!1?"Path '%s' resolves to a file, not a folder".replace("%s",t):"Path '%s' resolved to an item that is not marked as a folder".replace("%s",t),"ValidationError");if(!i.id)throw new m("Path '%s' resolved to a folder without id".replace("%s",t),"ValidationError");let e={id:i.id,name:i.name||i.id,parentId:i.folderId};return this._cache.upsertEntity(F({id:e.id,name:e.name,folderId:e.parentId??null,isFolder:!0})),e}async _resolveFolderByPath(i){if(typeof this._dataProvider.findItemByPath=="function")for(let t of this._getPathLookupCandidates(i)){let e=await this._dataProvider.findItemByPath(t);if(e)return this._folderFromResolvedPath(e,t)}}async _findOrCreateFolderByPath(i){let t=Ve(i);if(t.length>we)throw new m("Path depth exceeds maximum limit of %s".replace("%s",String(we)),"ValidationError");let e=await this._resolveFolderByPath(i);if(e)return e;let r;for(let a of t){let{files:l}=await this.getFiles({folderId:r?.id||"",itemType:"folder"}),s=l.find(n=>n.name===a);if(s){if(!s.isFolder)throw new m("Path component '%s' in '%s' is not a folder".replace("%s",a).replace("%s",i),"ValidationError");r={id:s.id,name:s.name,parentId:s.folderId}}else{if(typeof this._dataProvider.createFolder!="function")throw new m("Create folder operation is not supported by data provider","UnsupportedOperation");r=await this.createFolder({name:a,parentId:r?.id})}}return r}async getTrashFolder(){let i=await this._findOrCreateFolderByPath(this._getTrashPath());if(!i)throw new m("Trash folder path '%s' could not be resolved".replace("%s",this._getTrashPath()),"FolderNotFound");return i}async getTempFolder(){let i=this._pathOptions.tempPath??ke;if(i)try{return await this._findOrCreateFolderByPath(i)}catch(t){if(t instanceof m&&t.code==="ValidationError")throw t;return}}constructor(i,t={},e,r={}){this._dataProvider=i,this._options=t,this._pathOptions=e,this._blobFetchForceReloadOnceIds=new Set,this._mutationRegistry=new Ce,this._mapItem=async({childrenCount:l,...s})=>{let n=F(s);if(n.isFolder)return{...n,childCount:l,url:"",thumbnailUrl:""};let[d,o]=await Promise.all([this._getUrl(n),this._getThumbnailUrl(n)]);return{...n,childCount:0,url:d,thumbnailUrl:o}},this._config=r,this._useSoftDelete=this._pathOptions.useSoftDelete,this._rootId=this._pathOptions.rootId||Re,this._enableTrash=this._options.enableTrash===void 0||this._options.enableTrash,this._validateDuplicates=this._dataProvider.validateDuplicates,this._cache=new Me(t.cacheStrategy||{},t.cacheStrategy?.ttl,t.cacheStrategy?.errorTtl),this.setController({invalidateItemCache:l=>{this._cache.forceInvalidate(l)},getCachedItem:l=>this._cache.getEntity(l)});let a=Object.getPrototypeOf(this);for(let l of Object.getOwnPropertyNames(a)){let s=Object.getOwnPropertyDescriptor(a,l);l!=="constructor"&&typeof s?.value=="function"&&(this[l]=s.value.bind(this))}}setController(i){typeof this._dataProvider.setController=="function"&&this._dataProvider.setController(i)}async clearCache(i){let t=i??this._rootId;this._cache.forceInvalidate(t),this._cache.invalidateListingViews(t),typeof this._dataProvider.clearCache=="function"&&await this._dataProvider.clearCache(i)}markNextFileBlobFetchBypassHttpCache(i){this._blobFetchForceReloadOnceIds.add(this.normalizeId(i))}normalizeId(i){return!i||i==="root"||i==="folders"?this._rootId:i}_isDeletingId(i){return this._mutationRegistry.isDeleting(this.normalizeId(i))}_collectDeletingIds(i){let t=this.normalizeId(i),e=new Set([t]);if(!this._cache.getEntity(t)?.isFolder)return Array.from(e);let r=[t];for(;r.length>0;){let a=r.pop(),l=this._cache.getChildrenIds(a);for(let s of l)e.has(s)||(e.add(s),this._cache.getEntity(s)?.isFolder&&r.push(s))}return Array.from(e)}_emptyFilesResult(i,t){return{files:[],pagination:{...typeof i=="number"?{page:i}:{},...typeof t=="number"?{limit:t}:{},total:0,totalPages:1,hasNext:!1,hasPrev:!1}}}_validateName(i,t=!1){if(!i||i.trim().length===0)throw new m(t?"Folder name cannot be empty":"File name cannot be empty",t?"FolderInvalidName":"FileInvalidName");if(/[/\\:*?"<>|]/.test(i)){let e=t?"FolderInvalidName":"FileInvalidName";throw new m(t?"Folder name contains invalid characters: %s".replace("%s",i):"File name contains invalid characters: %s".replace("%s",i),e)}}_validateTargetFolderType(i){let t=this.normalizeId(i);if(t===this._rootId)return;let e=this._cache.getEntity(t);if(e&&!e.isFolder)throw new m("Target item with id '%s' is not a folder".replace("%s",i),"ValidationError")}_checkNameExistsInCache(i,t,e,r){let a=this.normalizeId(i),l=this._cache.getChildrenIds(a);for(let s of l){let n=this._cache.getEntity(s);if(n&&n.name===t&&!!n.isFolder===e&&(!r||n.id!==r))return!0}return!1}async _getUrl(i){if(i){if(i.url)return i.url;try{return typeof this._dataProvider?.getUrl=="function"&&this._dataProvider.getUrl(i)||void 0}catch{}}}async _getThumbnailUrl(i){if(i){if(i.thumbnailUrl)return i.thumbnailUrl;try{return typeof this._dataProvider?.getThumbnailUrl=="function"&&this._dataProvider.getThumbnailUrl(i)||void 0}catch{}}}_isAncestor(i,t){if(!t)return!1;let e=this.normalizeId(t),r=this.normalizeId(i);if(e===r)return!0;let a=this._cache.getEntity(e),l=new Set;for(;a&&a.folderId&&!l.has(a.id);){l.add(a.id);let s=this.normalizeId(a.folderId);if(s===r)return!0;if(a=this._cache.getEntity(s),!a||!a.isFolder)break}return!1}async getFile(i,t){return this._isDeletingId(i)?null:this._cache.searchByName(t,{parentId:this.normalizeId(i),caseSensitive:!0,recursive:!1,itemType:"file"})[0]||(await this.getFiles({folderId:i,itemType:"file",search:t})).files[0]}async getFileById(i){let t=this.normalizeId(i);if(this._isDeletingId(t))return null;let e=this._cache.getFileSystemItem(t);if(e&&!e.isFolder)return await this._mapItem(e);if(!this._dataProvider.pathMode)return null;let r=await this._getFileByPathStyleId(t);if(r&&!r.isFolder){let a=F(r);return this._cache.upsertEntity(a),await this._mapItem(a)}return null}async _getFileByPathStyleId(i){let t=i.replace(/\\/g,"/").replace(/^\/+/,""),e=t.lastIndexOf("/"),r=e<0?"":t.slice(0,e),a=e<0?t:t.slice(e+1);return a?this.getFile(r,a):null}async getFileUrl(i,t){let e=await this.getFile(i??"",t);if(e)return await this._getUrl(e)||await this._getThumbnailUrl(e)||e.thumbnail}async getFiles({folderId:i,search:t,sortBy:e,sortOrder:r,page:a,limit:l,itemType:s="all",noFolder:n=!1}){n&&(i=(await this.getTempFolder())?.id);let d=this.normalizeId(i??this._rootId),o=this._options.enablePagination===!1,h=o?1:a,c=o?me:l,u=this._options.clientSideFilter,f=this._options.clientSideSorting,p=this._options.clientSidePaging,v=p?Math.max(1,a??1):void 0,y=p?typeof l=="number"&&Number.isFinite(l)&&l>0?l:ve:void 0,R=this._emptyFilesResult(p?v:h,p?y:c);if(this._isDeletingId(d))return R;let P=this._options.unifiedCatalogFetch!==!1&&o&&(s==="folder"||s==="file"),_=P?"all":s,C={folderId:d,itemType:_};u||(C.search=t),f||(C.sortBy=e??(_==="folder"?void 0:"date"),C.sortOrder=r??(_==="folder"?void 0:"desc")),p||(C.page=h,C.limit=P?pe:c);let N=P?pe:p?void 0:c,z={folderId:d,itemType:_,search:u?void 0:t,sortBy:f?void 0:C.sortBy,sortOrder:f?void 0:C.sortOrder,page:p?void 0:h,pageSize:N},b;try{b=await this._cache.getOrCreateChildren(d,z,async(A,S)=>{let J=S.pageSize,te=J!=null&&Number.isFinite(Number(J))?Number(J):me,Z=await this._dataProvider.getItems({...S,folderId:A,limit:te}),ie=ze(Z.items);return p?{items:ie,total:typeof Z.pagination?.total=="number"?Z.pagination.total:ie.length}:{items:ie,...Z.pagination}})}catch(A){if(this._isDeletingId(d))return R;throw A}let g=b.items;if(P&&(s==="folder"?g=g.filter(A=>A.isFolder):s==="file"&&(g=g.filter(A=>!A.isFolder))),u){if(typeof this._options.clientSideFilter=="function")g=this._options.clientSideFilter(g,t);else if(t){let A=t.toLowerCase();g=g.filter(S=>S.name?.toLowerCase().includes(A))}}f&&(g=typeof this._options.clientSideSorting=="function"?this._options.clientSideSorting(g,e,r):this._defaultClientSideSort(g,e,r));let U;U=p||u||P?g.length:b.total??g.length;let V=g;if(p)if(typeof this._options.clientSidePaging=="function")V=this._options.clientSidePaging(g,v,y);else{let A=(v-1)*y,S=A+y;V=g.slice(A,S)}if(typeof this._dataProvider.getUrl=="function"||typeof this._dataProvider.getThumbnailUrl=="function"){let A=V.map(async S=>{if(S.isFolder)return S;let[J,te]=await Promise.all([S.url?Promise.resolve(S.url):typeof this._dataProvider.getUrl=="function"?this._dataProvider.getUrl(S):Promise.resolve(void 0),S.thumbnailUrl?Promise.resolve(S.thumbnailUrl):typeof this._dataProvider.getThumbnailUrl=="function"?this._dataProvider.getThumbnailUrl(S):Promise.resolve(void 0)]);return{...S,url:J,thumbnailUrl:te}});V=await Promise.all(A)}let K=p?{page:v,limit:y,total:U,totalPages:Math.max(1,Math.ceil(U/y)),hasNext:v*y<U,hasPrev:v>1}:{page:h,limit:c,total:U,...!p&&b.totalPages&&{totalPages:b.totalPages},...!p&&b.hasNextPage&&{hasNextPage:b.hasNextPage}};return{files:await Promise.all(V.map(this._mapItem)),pagination:K}}_defaultClientSideSort(i,t,e){return i.sort((r,a)=>le(r,a,{sortBy:t,sortOrder:e}))}async getFileData(i,t){let e=this.normalizeId(typeof i=="string"?i:i.id),r=t;this._blobFetchForceReloadOnceIds.delete(e)&&(r={...t,forceReload:!0});let a=this._cache.getEntity(e)||(typeof i=="string"?{id:e,name:"",folderId:this._rootId,isFolder:!1}:{...i,childrenCount:i.childCount});if(typeof this._dataProvider.getFileData=="function")return await this._dataProvider.getFileData(a,r);if(!a.url&&typeof this._dataProvider.getUrl!="function")throw new m("Cannot read file","FileReadError");let l=a.url||(typeof this._dataProvider.getUrl=="function"?await this._dataProvider.getUrl(a):"");if(l)return(await(this._config.fetchWithProxy??fetch)(l,r?.forceReload?{cache:"no-store"}:void 0)).blob();throw new m("Unable to get file data","FileReadError")}async findFileByUrl(i){let t=this._cache.searchByUrl(i);if(t)return t;if(typeof this._dataProvider.findFileByUrl=="function")try{let e=await this._dataProvider.findFileByUrl(i);if(e){let r=F(e);return this._cache.upsertEntity(r),r}}catch{}return null}async getChildrenCount(i){if(!i)return 0;let t=this.normalizeId(i??this._rootId);return this._isDeletingId(t)?0:this._cache.getChildrenCount(t,async()=>{try{if(this._options.clientSidePaging){let r=await this.getFiles({folderId:t,itemType:"all",page:1,limit:ve});return r.pagination.total??r.files.length}let e=await this._dataProvider.getItems({folderId:t,limit:0,itemType:"all"});return e.pagination===void 0?this._options.enablePagination===!1?e.items.length:0:e.pagination.total||0}catch(e){if(this._isDeletingId(t)||this._isPathFolderNotFoundError(e))return 0;throw e}})}_isPathFolderNotFoundError(i){if(!i||typeof i!="object")return!1;let t=i;return t.code==="path_folder_not_found"||t.data?.code==="path_folder_not_found"||t.status===404||t.data?.data?.status===404}async _uploadFile(i){let t=this.normalizeId(i.folderId??this._rootId);if(typeof this._dataProvider.uploadFile!="function")throw new m("Upload file operation is not supported by data provider","UnsupportedOperation");if(this._validateName(i.name,!1),this._validateDuplicates&&this._checkNameExistsInCache(t,i.name,!1))throw new m("File '%s' already exists in target folder".replace("%s",i.name),"FileAlreadyExists");let e=await this._dataProvider.uploadFile({...i,folderId:t}),r=F({name:i.name,size:i.size,...e,folderId:e.folderId??t});return this._cache.upsertEntity(r),r}async uploadFiles(i){let t=i.items.some(s=>s.noFolder)?await this.getTempFolder():null;i={...i,items:i.items?.map(s=>({...s,folderId:s.noFolder?t?.id:s.folderId}))};for(let s of i.items)s.folderId&&(i.folderId=s.folderId);let e=i.items||[],r=i.folderId??this._rootId,a=this.normalizeId(r);if(this._validateDuplicates){for(let s of e)if(s.name){this._validateName(s.name,!1);let n=this.normalizeId(s.folderId??a);if(this._checkNameExistsInCache(n,s.name,!1))throw new m("File '%s' already exists in target folder".replace("%s",s.name),"FileAlreadyExists")}}let l={detailed:Array(e.length),success:!0};if(typeof this._dataProvider.uploadFiles=="function"){let s=e.map(o=>({...o,folderId:this.normalizeId(o.folderId??a)})),n=await this._dataProvider.uploadFiles({folderId:a,items:s});l=H(n,o=>{if(o)return{id:o.id,name:ee(o.name),folderId:o.folderId,url:o.url,thumbnailUrl:o.thumbnailUrl,thumbnail:o.thumbnail}});let d=n?.detailed;if(l.detailed&&l.detailed.length){for(let o=0;o<l.detailed.length;o++){let h=l.detailed[o];if(h&&h.success){let c=h.data,u=c?.id??h.requestId,f=d?.[o]?.data,p=F({...f,...c,id:u,folderId:c?.folderId??f?.folderId??a,isFolder:!1});this._cache.upsertEntity(p),h.requestId=u}}l.success===void 0&&(l.success=!l.detailed.some(o=>!o.success))}else l.success=!l.error&&!!l.success}else if(typeof this._dataProvider.uploadFile=="function")l.detailed=await Promise.all(e.map(async s=>{let n=this.normalizeId(s.folderId??a);try{let d=await this._uploadFile({...s,folderId:n});return{requestId:d.id,data:d,success:!0}}catch(d){return{requestId:s?.id,success:!1,error:d}}})),l.success=!l.detailed.some(s=>!s.success);else throw new m("Upload files is not supported by data provider","UnsupportedOperation");if(l.success&&this._enableTrash)try{this._cache.forceInvalidate(a)}catch{}return l}async deleteFile(i){let t=this.normalizeId(i),e=[t];this._mutationRegistry.beginDeleting(e);try{if(this._useSoftDelete&&this._enableTrash){let r=await this.getTrashFolder();return await this.moveItem({itemId:t,targetFolderId:r.id,isFolder:!1})}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(e)}}async deleteItems(i,t){let e=Array.from(new Set(i.flatMap(r=>this._collectDeletingIds(this.normalizeId(r)))));this._mutationRegistry.beginDeleting(e);try{if(this._useSoftDelete&&this._enableTrash&&t.permanent!==!0){let r=await this.getTrashFolder();return await this.moveItems(r.id,i)}return await this.hardDeleteItems(i,t)}finally{this._mutationRegistry.endDeleting(e)}}async hardDeleteItems(i,t){let e={success:!0,detailed:[]},r=t.permanent?null:await this.getTrashFolder();if(typeof this._dataProvider.deleteItems=="function"){if(e=H(await this._dataProvider.deleteItems(i.map(a=>this._cache.getEntity(a)),t),a=>a),e.success){let a=e.detailed||i.map(l=>({requestId:l,success:!0,error:void 0}));for(let l of a)l.success&&(r?this._cache.moveEntity(l.requestId,r.id):this._cache.deleteEntity(l.requestId))}}else typeof this._dataProvider.deleteItem=="function"&&(e.detailed=await Promise.all(i.map(async a=>{let l=this._cache.getEntity(a);if(!l)return{requestId:a,success:!1,error:new m("Item with id '%s' not found".replace("%s",a),"FileNotFound")};try{return await this._dataProvider.deleteItem(l,t),r?this._cache.moveEntity(a,r.id):this._cache.deleteEntity(a),{requestId:a,success:!0}}catch(s){return{requestId:a,error:s,success:!1}}})),e.success=!e.detailed.some(a=>!a.success));if(e.success&&r)try{this._cache.forceInvalidate(r.id)}catch{}return e}async hardDeleteItem(i){let t=this._cache.getEntity(i);if(!t)throw new m("Item with id '%s' not found in cache".replace("%s",i),"FileNotFound");if(typeof this._dataProvider.deleteItem!="function")throw new m("Delete item operation is not supported by data provider","DeleteNotAllowed");if(await this._dataProvider.deleteItem(t,{permanent:!0}),this._cache.deleteEntity(i),this._enableTrash)try{let e=await this.getTrashFolder();e&&this._cache.forceInvalidate(e.id)}catch{}return!0}async cleanTrash(){if(!this._enableTrash)throw new m("Trash is not enabled","UnsupportedOperation");if(typeof this._dataProvider.cleanTrash=="function"){let i=await this._dataProvider.cleanTrash();try{let t=await this.getTrashFolder();t&&this._cache.forceInvalidate(t.id)}catch{}return i}throw new m("Clean trash is not supported by data provider","UnsupportedOperation")}async createFolder({name:i,parentId:t,is_force_create:e}){let r=this.normalizeId(t??this._rootId);if(this._validateName(i,!0),this._validateDuplicates&&this._checkNameExistsInCache(r,i,!0))throw new m("Folder '%s' already exists in parent folder".replace("%s",i),"FolderAlreadyExists");let a=await this._dataProvider.createFolder(i,r,e),l=F({id:a.id,folderId:r,name:a.name,isFolder:!0,childrenCount:a.childrenCount});return this._cache.upsertEntity(l),{...a,name:l.name}}async deleteFolder(i){let t=this.normalizeId(i),e=this._collectDeletingIds(t);this._mutationRegistry.beginDeleting(e);try{if(this._useSoftDelete&&this._enableTrash)try{let r=await this.getTrashFolder();return await this.moveItem({itemId:t,targetFolderId:r.id,isFolder:!0})?(this._cache.deleteFolderRecursive(t),!0):!1}catch{return await this.hardDeleteItem(t)}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(e)}}async renameFolder(i,t){if(typeof this._dataProvider.renameItem!="function")throw new m("Rename folder is not supported","RenameNotAllowed");let e=this.normalizeId(i),r=this._cache.getEntity(e);if(!r)throw new m("Folder with id '%s' not found in cache".replace("%s",i),"FolderNotFound");if(this._validateName(t,!0),this._validateDuplicates){let l=this.normalizeId(r.folderId);if(this._checkNameExistsInCache(l,t,!0,e))throw new m("Folder '%s' already exists in parent folder".replace("%s",t),"FolderAlreadyExists")}let a=k(await this._dataProvider.renameItem(r,t));return this._cache.upsertEntity(F({...this._cache.getEntity(a.id),...a})),this._cache.getEntity(a.id)}async renameFile(i,t){if(typeof this._dataProvider.renameItem!="function")throw new m("Rename file is not supported","RenameNotAllowed");let e=this._cache.getEntity(i);if(!e)throw new m("File with id '%s' not found in cache".replace("%s",i),"FileNotFound");let r=this.normalizeId(i);if(this._validateName(t,!1),this._validateDuplicates){let l=this.normalizeId(e.folderId);if(this._checkNameExistsInCache(l,t,!1,r))throw new m("File '%s' already exists in parent folder".replace("%s",t),"FileAlreadyExists")}let a=k(await this._dataProvider.renameItem(e,t));return a&&this._cache.upsertEntity(F({...this._cache.getEntity(r),...a})),this._cache.getEntity(r)}async moveItem({itemId:i,targetFolderId:t,isFolder:e}){if(typeof this._dataProvider.moveItem!="function")throw new m("Move item operation is not supported by data provider","MoveNotAllowed");let r=this.normalizeId(t);this._validateTargetFolderType(t);let a=this._cache.getEntity(i);if(!a){let s=k(await this._dataProvider.moveItem({id:i,folderId:r,isFolder:e},r));if(s.id===i)this._cache.upsertEntity(F({...s,folderId:r}));else{try{this._cache.deleteEntity(i)}catch{}this._cache.upsertEntity(F({...s,folderId:r}))}return!0}if(a.isFolder){if(i===r)throw new m("Cannot move folder into itself","MoveIntoSelf");if(this._isAncestor(i,r))throw new m("Cannot move folder into its descendant","MoveIntoDescendant")}if(this._validateDuplicates&&r!==this.normalizeId(a.folderId)&&a.name&&this._checkNameExistsInCache(r,a.name,!!a.isFolder,i)){let s=a.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new m(`${a.isFolder?"Folder":"File"} '${a.name}' already exists in target folder`,s)}let l=k(await this._dataProvider.moveItem(a,r));if(l.id===i){let s=this._cache.moveEntity(i,r);return this._cache.upsertEntity(F({...s,...l})),!0}{let s=this._cache.deleteEntity(i);return this._cache.upsertEntity(F({...s,...l,folderId:r})),!0}}async moveItems(i,t){let e=this.normalizeId(i);this._validateTargetFolderType(i);let r=t.map(l=>this._cache.getEntity(l));for(let l of r)if(l){if(l.isFolder){if(l.id===e)throw new m("Cannot move folder '%s' into itself".replace("%s",l.name),"MoveIntoSelf");if(this._isAncestor(l.id,e))throw new m("Cannot move folder '%s' into its descendant".replace("%s",l.name),"MoveIntoDescendant")}if(this._validateDuplicates&&e!==this.normalizeId(l.folderId)&&l.name&&this._checkNameExistsInCache(e,l.name,!!l.isFolder,l.id)){let s=l.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new m(`${l.isFolder?"Folder":"File"} '${l.name}' already exists in target folder`,s)}}let a={detailed:Array(r.length),success:!0};if(typeof this._dataProvider.moveItems=="function")a=H(await this._dataProvider.moveItems(r,e),l=>l);else if(typeof this._dataProvider.moveItem=="function")a.detailed=await Promise.all(t.map(async(l,s)=>{let n=r[s]||{id:l,folderId:null,isFolder:!1,name:l};try{return{requestId:l,data:k(await this._dataProvider.moveItem(n,e)),success:!0}}catch(d){return{requestId:l,success:!1,error:d}}}));else throw new m("Move items is not supported","MoveNotAllowed");if(a.success){let l=a.detailed||t.map(s=>({requestId:s,success:!0,data:void 0}));for(let s of l)if(s.success)if(!s.data||s.data.id===s.requestId)this._cache.moveEntity(s.requestId,e),s.data&&this._cache.upsertEntity(F({...this._cache.getEntity(s.requestId),...s.data,folderId:e}));else{let n=this._cache.deleteEntity(s.requestId);this._cache.upsertEntity(F({...n,...s.data,folderId:e}))}return a}return{success:!1,error:a.error||new m("Move items failed","MoveNotAllowed")}}async copyItem({itemId:i,targetFolderId:t}){if(typeof this._dataProvider.copyItem!="function")throw new m("Copy item is not supported","CopyNotAllowed");let e=this.normalizeId(t);this._validateTargetFolderType(t);let r=this._cache.getEntity(i);if(!r){let l=k(await this._dataProvider.copyItem({id:i,folderId:e},e));return this._cache.copyEntity(i,e,l.id),this._cache.upsertEntity(F({...l,folderId:e})),!0}if(this._validateDuplicates&&r.name){let l=e===this.normalizeId(r.folderId)?i:void 0;if(this._checkNameExistsInCache(e,r.name,!!r.isFolder,l)){let s=r.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new m(`${r.isFolder?"Folder":"File"} '${r.name}' already exists in target folder`,s)}}let a=k(await this._dataProvider.copyItem(r,e));return this._cache.copyEntity(i,e,a.id,{...a,folderId:e})||this._cache.upsertEntity(F({...a,folderId:e})),!0}async copyItems(i,t){let e=this.normalizeId(i);this._validateTargetFolderType(i);let r=t.map(n=>typeof n=="string"?{id:n}:n),a=r.map(n=>n.id),l=a.map((n,d)=>{let o=this._cache.getEntity(n),h=r[d]?.newName;return o?h?{...o,name:h}:o:void 0});if(this._validateDuplicates)for(let n=0;n<l.length;n++){let d=l[n];if(d&&d.name){let o=e===this.normalizeId(d.folderId)?a[n]:void 0;if(this._checkNameExistsInCache(e,d.name,!!d.isFolder,o)){let h=d.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new m(`${d.isFolder?"Folder":"File"} '${d.name}' already exists in target folder`,h)}}}let s={detailed:Array(l.length),success:!0};if(typeof this._dataProvider.copyItems=="function")s=H(await this._dataProvider.copyItems(l,e),n=>n);else if(typeof this._dataProvider.copyItem=="function")s.detailed=await Promise.all(a.map(async(n,d)=>{let o=l[d]||{id:n,folderId:null,isFolder:!1};try{return{requestId:n,data:k(await this._dataProvider.copyItem(o,e)),success:!0}}catch(h){return{requestId:n,success:!1,error:h}}}));else throw new m("Copy items is not supported","CopyNotAllowed");if(s.success&&s.detailed)for(let n=0,d=s.detailed.length;n<d;n++){let o=s.detailed[n];if(o.success&&o.data?.id){let h=o.data.folderId||e;!this._cache.copyEntity(o.requestId,h,o.data.id,{...o.data,folderId:h})&&o.data&&this._cache.upsertEntity(F({...o.data,folderId:h}))}}else if(!s.detailed)throw new m("batchResult in copy method must have detailed results","ValidationError");return s}async uploadFileByUrl(i){if(i.noFolder){let e=await this.getTempFolder();i={...i,folderId:e?.id}}let t=this.normalizeId(i.folderId??this._rootId);try{let e=F({...await this._dataProvider.uploadFileByUrl(i.url,t,{eventSource:i.eventSource}),folderId:t});return this._cache.upsertEntity(e),e}catch(e){throw e}}async updateFile(i,t){if(typeof this._dataProvider.updateFile!="function")throw new m("Update file is not supported","UnsupportedOperation");let e=this.normalizeId(i),r=this._cache.getEntity(e);if(!r)throw new m("File with id '%s' not found in cache".replace("%s",i),"FileNotFound");if(t.name&&t.name!==r.name&&this._validateName(t.name,!1),this._validateDuplicates&&t.name&&t.name!==r.name){let l=this.normalizeId(r.folderId);if(this._checkNameExistsInCache(l,t.name,!1,e))throw new m("File '%s' already exists in parent folder".replace("%s",t.name),"FileAlreadyExists")}let a=k(await this._dataProvider.updateFile(r,{...t}));return this._cache.upsertEntity(F({...this._cache.getEntity(e),...a,...t})),this._cache.getEntity(e)}},$e="",qe="Trash",Ge=class{constructor(i,t=$e,e=q,r=qe,a=!0){this._inner=i,this.rootPath=t,this.trashId=e,this.trashPath=r,this.ensureFolderTrailingSlash=a,this._pathToId=new Map,this._idToPath=new Map,this.validateDuplicates=this._inner.validateDuplicates??!1,typeof i.getUrl=="function"&&(this.getUrl=s=>i.getUrl({...s,id:this.pathForId(s.id,!1),folderId:s.folderId?this.pathForId(s.folderId,!0):this.rootPath})),typeof i.getThumbnailUrl=="function"&&(this.getThumbnailUrl=s=>i.getThumbnailUrl({...s,id:this.pathForId(s.id,!1),folderId:s.folderId?this.pathForId(s.folderId,!0):this.rootPath}));let l=this;typeof this._inner.deleteItems!="function"&&(l.deleteItems=void 0),typeof this._inner.deleteItem!="function"&&(l.deleteItem=void 0),typeof this._inner.moveItems=="function"?l.moveItem=void 0:l.moveItems=void 0,typeof this._inner.copyItems=="function"?l.copyItem=void 0:l.copyItems=void 0,typeof this._inner.uploadFiles=="function"?l.uploadFile=void 0:l.uploadFiles=void 0,typeof this._inner.clearCache!="function"&&(l.clearCache=void 0),this._getOrGenerateId(this.rootPath)}setController(i){typeof this._inner.setController=="function"&&this._inner.setController({invalidateItemCache:t=>{let e=t.replace(/^\/+|\/+$/g,""),r=this._pathToId.get(e);r&&i.invalidateItemCache(r)},getCachedItem:t=>{let e=t.replace(/^\/+|\/+$/g,""),r=this._pathToId.get(e);if(r){let a=i.getCachedItem(r);if(a)return{...a,id:this.pathForId(a.id,a.isFolder??!1),folderId:this.pathForId(a.folderId??"",a.isFolder??!1)}}}})}clearCache(i){if(typeof this._inner.clearCache=="function")return this._inner.clearCache(i)}findItemByPath(i){if(typeof this._inner.findItemByPath!="function")return;let t=(r,a,l)=>{if(!r)return;if(r.isFolder!==!0)return r;let s=B(B(l)===B(this.trashPath)?this.trashPath:a),n=r.folderId!=null&&r.folderId!==""?B(r.folderId):this.rootPath;return{...r,id:this._getOrGenerateId(s),name:r.name,folderId:n===B(this.rootPath)?this.rootPath||"":this._getOrGenerateId(n),isFolder:!0}},e=oe(i,this.trashPath,this.trashId);return(async()=>{for(let r of e){let a=await Promise.resolve(this._inner.findItemByPath(r)),l=t(a,r,i);if(l)return l}})()}_getOrGenerateId(i){if(i===this.rootPath)return"";let t=B(i);if(t===B(this.trashPath))return this.trashId;if(this._pathToId.has(t))return this._pathToId.get(t);let e=x();return this._pathToId.set(t,e),this._idToPath.set(e,t),e}pathForId(i,t,e){if(i===""||i===void 0)return this.rootPath;if(i===this.trashId)return this.trashPath;let r=this._idToPath.get(i);if(!r){if(e)return`unknown folder ${i}`;throw new m(`Path for id '${i}' not found in mapping`,"FileNotFound")}let a=0;for(;a<this.rootPath.length&&this.rootPath[a]==="/";)a++;if(a){let l=0;for(;l<r.length&&r[l]==="/";)l++;let s=r.slice(l);r="/".repeat(a)+s}return t&&this.ensureFolderTrailingSlash&&!r.endsWith("/")&&(r+="/"),r}_updateIdMapping(i,t){let e=t.replace(/^\/+|\/+$/g,""),r=this._idToPath.get(i);r&&this._pathToId.delete(r),this._idToPath.set(i,e),this._pathToId.set(e,i)}async getItems(i){let t=i.folderId?this.pathForId(i.folderId,!0):this.rootPath,e=await this._inner.getItems({...i,folderId:t}),r=e.items.map(a=>{let l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):this._getOrGenerateId(this.rootPath);return{...a,id:l,folderId:s}});return{...e,items:r}}async createFolder(i,t,e){let r=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.createFolder(i,r,e),l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):this._getOrGenerateId(this.rootPath);return{...a,id:l,folderId:s}}async renameItem(i,t){if(typeof this._inner.renameItem!="function")throw new m("Rename item is not supported by inner storage","RenameNotAllowed");let e=this.pathForId(i.id,i.isFolder??!1),r=e,{...a}=await this._inner.renameItem({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},t);return this._updateIdMapping(i.id,a.id),i.isFolder&&this.remapCachedFolderContents(i.id,r,a.id),a.folderId&&(a={...a,folderId:this._getOrGenerateId(a.folderId)}),{...a,id:this._getOrGenerateId(a.id)}}async deleteItem(i,t){if(typeof this._inner.deleteItem!="function")throw new m("Delete item is not supported by inner storage","DeleteNotAllowed");let e=this.pathForId(i.id,i.isFolder??!1);await this._inner.deleteItem({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},t),this.recursivelyRemoveMappings(i.id,e)}async uploadFile(i){if(typeof this._inner.uploadFile!="function")throw new m("Upload file is not supported by inner storage","UnsupportedOperation");let t=i.folderId?this.pathForId(i.folderId,!0):this.rootPath,e=await this._inner.uploadFile({...i,folderId:t}),r=this._getOrGenerateId(e.id),a=e.folderId?this._getOrGenerateId(e.folderId):this._getOrGenerateId(this.rootPath);return{...e,id:r,folderId:a}}async uploadFiles(i){let t=i.folderId,e=i.items?.map(s=>s.folderId)??[],r=i.folderId?this.pathForId(i.folderId,!0):this.rootPath,a={...i,folderId:r,items:i.items?.map(s=>({...s,folderId:s.folderId?this.pathForId(s.folderId??"",!0):r}))??[]},l=await this._inner.uploadFiles(a);return{...l,detailed:l.detailed?.map((s,n)=>{if(!s?.data)return s;let d=s.data.id?this._getOrGenerateId(s.data.id):"",o=s.data.folderId?this._getOrGenerateId(s.data.folderId):e[n]??t??this._getOrGenerateId(this.rootPath);return{...s,data:{...s.data,id:d,folderId:o}}})}}async findFileByUrl(i,t){let e=t?this.pathForId(t,!0):this.rootPath;if(typeof this._inner.findFileByUrl=="function"){let r=await this._inner.findFileByUrl(i,e);if(!r)return;let a=this._getOrGenerateId(r.id),l=r.folderId?this._getOrGenerateId(r.folderId):this._getOrGenerateId(this.rootPath);return{...r,id:a,folderId:l}}}async uploadFileByUrl(i,t,e){let r=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.uploadFileByUrl(i,r,e),l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):this._getOrGenerateId(this.rootPath);return{...a,id:l,folderId:s}}async moveItem(i,t){if(typeof this._inner.moveItem!="function")throw new m("Move item is not supported by inner storage","MoveNotAllowed");let e=this.pathForId(i.id,i.isFolder??!1),r=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.moveItem({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},r);this._updateIdMapping(i.id,a.id),i.isFolder&&this.remapCachedFolderContents(i.id,e,a.id);let l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):t;return{...a,id:l,folderId:s}}async moveItems(i,t){if(typeof this._inner.moveItems!="function")throw new m("Move items is not supported by inner storage","MoveNotAllowed");let e=t?this.pathForId(t,!0):this.rootPath,r=i.map(s=>({...s,id:this.pathForId(s.id,s.isFolder??!1),folderId:s.folderId?this.pathForId(s.folderId??"",!0):this.rootPath})),a=await this._inner.moveItems(r,e),l=[];if(a.detailed&&a.detailed.length>0){let s=new Map;for(let n=0;n<a.detailed.length;n++){let d=a.detailed[n],o=d.requestId||(n<i.length?i[n].id:void 0);o&&s.set(o,d)}for(let n of i){let d=s.get(n.id)||(a.detailed.length===i.length?a.detailed[i.indexOf(n)]:void 0);if(d?.success&&d.data){if(this._updateIdMapping(n.id,d.data.id),n.isFolder){let o=this.pathForId(n.id,n.isFolder??!1);this.remapCachedFolderContents(n.id,o,d.data.id)}l.push({requestId:n.id,success:!0,data:{...d.data,id:this._getOrGenerateId(d.data.id),folderId:d.data.folderId?this._getOrGenerateId(d.data.folderId):t||this._getOrGenerateId(this.rootPath)}})}else l.push({requestId:n.id,success:!1,error:d?.error||{message:"Move operation failed - no detailed result",code:"MoveNotAllowed"}})}}else for(let s of i)l.push({requestId:s.id,success:!1,error:{message:"Move operation failed - no detailed results",code:"MoveNotAllowed"}});return{success:a.success,detailed:l,error:a.error}}async copyItems(i,t){if(typeof this._inner.copyItems!="function")throw new m("Copy items is not supported by inner storage","CopyNotAllowed");let e=t?this.pathForId(t,!0):this.rootPath,r=i.map(n=>({...n,id:this.pathForId(n.id,n.isFolder??!1),folderId:n.folderId?this.pathForId(n.folderId??"",!0):this.rootPath})),a=await this._inner.copyItems(r,e),l=[];if(a.detailed&&a.detailed.length>0){let n=new Map;for(let d=0;d<a.detailed.length;d++){let o=a.detailed[d],h=o.requestId||(d<i.length?i[d].id:void 0);h&&n.set(h,o)}for(let d of i){let o=n.get(d.id)||(a.detailed.length===i.length?a.detailed[i.indexOf(d)]:void 0);if(o?.success&&o.data?.id){let h=this._getOrGenerateId(o.data.id);l.push({requestId:d.id,success:!0,data:{...o.data,id:h,folderId:o.data.folderId?this._getOrGenerateId(o.data.folderId):t||this._getOrGenerateId(this.rootPath)}})}else{let h=o?o.success?o.data?o.data.id?{message:"Unknown copy error",code:"CopyNotAllowed"}:{message:"No ID in copied item data",code:"CopyNotAllowed"}:{message:"No data returned from copy operation",code:"CopyNotAllowed"}:o.error||{message:"Copy operation failed",code:"CopyNotAllowed"}:{message:"No detailed result from copy operation",code:"CopyNotAllowed"};l.push({requestId:d.id,success:!1,error:h})}}}else for(let n of i)l.push({requestId:n.id,success:!1,error:{message:"No detailed results from copy operation",code:"CopyNotAllowed"}});let s=l.every(n=>n.success);return{success:s,detailed:l,error:s?void 0:a.error||{message:"Copy operation completed with errors",code:"CopyNotAllowed"}}}async deleteItems(i,t){if(typeof this._inner.deleteItems!="function")throw new m("Delete items is not supported by inner storage","DeleteNotAllowed");let e=i.map(s=>({...s,id:this.pathForId(s.id,s.isFolder??!1),folderId:s.folderId?this.pathForId(s.folderId??"",!0):this.rootPath})),r=await this._inner.deleteItems(e,t),a=[];if(r.detailed&&r.detailed.length>0){let s=new Map;for(let n=0;n<r.detailed.length;n++){let d=r.detailed[n],o=d.requestId||(n<i.length?i[n].id:void 0);o&&s.set(o,d)}for(let n of i){let d=s.get(n.id)||(r.detailed.length===i.length?r.detailed[i.indexOf(n)]:void 0);if(d?.success){let o=this.pathForId(n.id,n.isFolder??!1);if(t.permanent)this.recursivelyRemoveMappings(n.id,o);else if(this._updateIdMapping(n.id,this.trashPath+"/"+o+(n.isFolder?"/":"")),n.isFolder){let h=this.pathForId(n.id,n.isFolder??!1);this.remapCachedFolderContents(n.id,h,this.trashPath+"/"+o+(n.isFolder?"/":""))}a.push({requestId:n.id,success:!0})}else a.push({requestId:n.id,success:!1,error:d?.error||{message:"Delete operation failed",code:"DeleteNotAllowed"}})}}else for(let s of i)if(r.success){let n=this.pathForId(s.id,s.isFolder??!1);if(t.permanent)this.recursivelyRemoveMappings(s.id,n);else if(this._updateIdMapping(s.id,this.trashPath+"/"+n+(s.isFolder?"/":"")),s.isFolder){let d=this.pathForId(s.id,s.isFolder??!1);this.remapCachedFolderContents(s.id,d,this.trashPath+"/"+n+(s.isFolder?"/":""))}a.push({requestId:s.id,success:!0})}else a.push({requestId:s.id,success:!1,error:r.error||{message:"Delete operation failed",code:"DeleteNotAllowed"}});let l=a.every(s=>s.success);return{success:l,detailed:a,error:l?void 0:r.error||{message:"Some items failed to delete",code:"DeleteNotAllowed"}}}remapCachedFolderContents(i,t,e){let r=t.replace(/\/+$/,""),a=e.replace(/\/+$/,""),l=[];for(let[s,n]of this._idToPath.entries()){let d=n.replace(/\/+$/,"");d!==r&&d.startsWith(r+"/")&&l.push({id:s,oldPath:d})}for(let{id:s,oldPath:n}of l){let d=a+n.substring(r.length);this._updateIdMapping(s,d)}}recursivelyRemoveMappings(i,t){let e=t.replace(/\/+$/,""),r=[],a=[];for(let[l,s]of this._idToPath.entries()){let n=s.replace(/\/+$/,"");(n===e||n.startsWith(e+"/"))&&(r.push(l),a.push(n))}for(let l=0;l<r.length;l++)this._idToPath.delete(r[l]),this._pathToId.delete(a[l])}async copyItem(i,t){if(typeof this._inner.copyItem!="function")throw new m("Copy item is not supported by inner storage","CopyNotAllowed");let e=this.pathForId(i.id,i.isFolder??!1),r=t?this.pathForId(t,!0):this.rootPath,a=await this._inner.copyItem({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},r),l=this._getOrGenerateId(a.id),s=a.folderId?this._getOrGenerateId(a.folderId):t??"";return{...a,id:l,folderId:s}}async updateFile(i,t){if(typeof this._inner.updateFile!="function")throw new m("Update file is not supported by inner storage","UnsupportedOperation");let e=this.pathForId(i.id,!1),{...r}=await this._inner.updateFile({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},t);return this._updateIdMapping(i.id,r.id),r.folderId&&(r={...r,folderId:this._getOrGenerateId(r.folderId)}),{...r,id:this._getOrGenerateId(r.id)}}async getFileData(i,t){let e=this.pathForId(i.id,!1);if(typeof this._inner.getFileData=="function")return this._inner.getFileData({...i,id:e,folderId:this.pathForId(i.folderId??"",!0)},t);let r=i.url||(typeof this.getUrl=="function"?await this.getUrl(i):void 0);if(!r)throw new m("Cannot get file data: no url and no inner.getFileData","FileReadError");return fetch(r,t?.forceReload?{cache:"no-store"}:void 0).then(a=>a.blob())}async cleanTrash(){if(typeof this._inner.cleanTrash!="function")throw new m("Clean trash is not supported by inner storage","UnsupportedOperation");return await this._inner.cleanTrash()}};function Le(i){return typeof i!="object"||!i?!1:"name"in i&&i.name==="DirectResourceFetchError"?!("final"in i)||i.final!==!1:"final"in i&&i.final===!0}function Y(i){if(Le(i)||i instanceof m)throw i}async function Ke(i,t,e,r,a){let{fetchWithProxy:l,handleFileProxy:s,handleProxyUrl:n}=t,d={mode:"cors",...a?.fetchInit},o;if(s)try{let h=await Promise.resolve(s(i));if(h)return r(h)}catch(h){Y(h),o=h}if(n)try{let h=await Promise.resolve(n(i));if(h&&h!==i)return r(await e(h))}catch(h){Y(h),o=h}if(l)try{let h=await Promise.resolve(l(i,d,{intent:"downloadBlob"}));if(!h.ok)throw Error(`HTTP ${h.status}`);return r(await h.blob())}catch(h){Y(h),o=h}if(!l)try{return r(await e(i))}catch(h){Y(h),o=h}throw o instanceof Error?o:Error("Failed to download file from the URL")}var Je={ai:(0,w.jsx)(O.EmIcons,{icon:"AIRequests",component:E.icons$AIRequests}),email_generate:(0,w.jsx)(O.EmIcons,{icon:"EmailEnvelope",component:E.icons$EmailEnvelope}),image_generate:(0,w.jsx)(O.EmIcons,{icon:"Image",component:E.icons$Image}),optimization:(0,w.jsx)(O.EmIcons,{icon:"Optimization",component:E.icons$Optimization}),preview:(0,w.jsx)(O.EmIcons,{icon:"SendOutlined",component:E.icons$SendOutlined}),link_check:(0,w.jsx)(O.EmIcons,{icon:"Web",component:E.icons$Web}),image_check:(0,w.jsx)(O.EmIcons,{icon:"Image",component:E.icons$Image}),spam_check:(0,w.jsx)(O.EmIcons,{icon:"Block",component:E.icons$Block}),projects:(0,w.jsx)(O.EmIcons,{icon:"FolderOpen",component:E.icons$FolderOpen}),emails:(0,w.jsx)(O.EmIcons,{icon:"EmailEnvelope",component:E.icons$EmailEnvelope}),blocks:(0,w.jsx)(O.EmIcons,{icon:"Block",component:E.icons$Block}),users:(0,w.jsx)(O.EmIcons,{icon:"SliderGroup",component:E.icons$SliderGroup})};function ye(i,t){if(i==null)return null;if(typeof i=="number"||typeof i=="string"){const e=i==="∞"||typeof i=="string"&&i.toLowerCase()==="infinity";return(0,w.jsx)("span",{className:t==="old"?"limit-upgrade-modal__limit-old":`limit-upgrade-modal__limit-new${e?" limit-upgrade-modal__limit-new--infinity":""}`,children:e?"∞":i})}return i}var We=({open:i,onClose:t,title:e,subtitle:r,usageResource:a,icon:l,previousDisplay:s,nextDisplay:n,onChangePlan:d,secondaryAction:o,changePlanLabel:h})=>{const{__:c}=O.useI18n(),u=h??c("Change plan"),f=!!o,p=a!=null?Je[a]:l??null;return(0,w.jsx)(E.ui_kit$Modal,{open:i,onCancel:t,footer:null,closable:!1,width:400,centered:!0,className:"limit-upgrade-modal",destroyOnHidden:!0,mask:{closable:!0},children:(0,w.jsxs)("div",{className:"limit-upgrade-modal__wrap",children:[(0,w.jsx)("div",{className:"limit-upgrade-modal__header",children:(0,w.jsx)("button",{type:"button",className:"limit-upgrade-modal__close",onClick:t,"aria-label":c("Close"),children:(0,w.jsx)(O.EmIcons,{icon:"CloseOutlined",component:E.icons$CloseOutlined})})}),(0,w.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,w.jsx)("h1",{className:"limit-upgrade-modal__title",children:e}),(0,w.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:r}),(0,w.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,w.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:p}),ye(s,"old"),(0,w.jsx)("div",{className:"limit-upgrade-modal__arrow-btn","aria-hidden":!0,children:(0,w.jsx)(O.EmIcons,{icon:"ArrowUpOutlined",component:E.icons$ArrowUpOutlined,className:"limit-upgrade-modal__arrow-icon"})}),ye(n,"new")]})]}),(0,w.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,w.jsx)("div",{className:f?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:o?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(E.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:o.onClick,children:o.label}),(0,w.jsx)(E.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:d,children:u})]}):(0,w.jsx)(E.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:d,children:u})})]})})};Object.defineProperty(j,"D",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(j,"LimitUpgradeModal",{enumerable:!0,get:function(){return We}}),Object.defineProperty(j,"Z",{enumerable:!0,get:function(){return je}}),Object.defineProperty(j,"_",{enumerable:!0,get:function(){return q}}),Object.defineProperty(j,"b",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(j,"e",{enumerable:!0,get:function(){return m}}),Object.defineProperty(j,"ie",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(j,"ne",{enumerable:!0,get:function(){return Ge}})});
6
+
7
+ __useblocks__.define("static/core/b6d27bcf.js",["require","exports","module","static/core/2ff39ddf.js","static/core/b2b19022.js","static/core/4d23db03.js","vite/preload-helper"],function(d,v,W){const D=d("./2ff39ddf.js"),n=d("./b2b19022.js"),p=d("./4d23db03.js");let U=d("vite/preload-helper");var P=D.__exportAll({createDocumentProcessor:()=>R,createFileProcessor:()=>M,ensureFileExtension:()=>b,extractUploadResult:()=>E,fetchFileData:()=>I,getExt:()=>j,handleUploadResult:()=>A,importEmail:()=>C,importHtml:()=>_,importZip:()=>N,splitFileName:()=>$,uploadFile:()=>n.uploadFile});function j(e){const t=e.split(".");return t[t.length-1].toLowerCase()}function $(e){const t=e.split(".");return t[t.length-1].toLowerCase()}var y="index.html";function w(e,t){return e.find(r=>r.toLowerCase().endsWith(t))}async function N(e,t,r){const a=await n.readZip(e),l=Object.keys(a),i=a[y]&&y||w(l,y)||w(l,".html")||w(l,".htm");if(i){const u=i.split("/"),c=document.location.pathname.split("/"),s=document.location.origin+c.slice(0,c.length-u.length).join("/")+"/",{html:x,hasBrowserExtensionArtifacts:f}=n.prepareEmailHtmlForEditor(n.zipEntryToText(a[i])),h=u.slice(0,u.length-1).join("/");return{html:await p.changeHtml(x,async g=>{const m=g.document;await p.replaceImagesInDocument(m,async o=>{o=o.replace("\\","/"),o.startsWith(".")&&(o=o.substring(1)),o.startsWith("/")&&(o=o.substring(1)),o.startsWith(s)&&(o=o.substring(s.length)),h&&!o.match("^(ht|f)tp(s?)://")&&(o=`${h}/${o}`);const F=a[o];if(F)return t(n.zipEntryToBlob(F),o);const H=p.getFileNameWithExt(o);return t(o,H)}),r&&r(g)}),hasBrowserExtensionArtifacts:f}}}async function _(e,t,r){const{html:a,hasBrowserExtensionArtifacts:l}=n.prepareEmailHtmlForEditor(e);return{html:await p.changeHtml(a,async i=>{const u=i.document;await p.replaceImagesInDocument(u,async c=>{c=c.replace("\\","/");const s=p.getFileNameWithExt(c);return t(c,s)}),r&&r(i)}),hasBrowserExtensionArtifacts:l}}async function C(e,t,r){if(e)switch(j(e.name)){case"zip":return N(e,t,r);case"eml":{const a=await e.arrayBuffer(),{default:l}=await(0,U.__vitePreload)(async()=>{const{default:u}=await Promise.resolve().then(()=>d("./6561b34a.js"));return{default:u}},void 0,{}.url),i=(await l.parse(a)).html??void 0;if(typeof i>"u")throw new Error("Eml does not contain text/html");return _(i,t,r)}default:return _(await e.text(),t,r)}}async function I(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 b(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 E(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 A(e,t){if(!e||e.error)return typeof t=="string"?t:"";const r=E(e.data);return r.error?typeof t=="string"?t:"":r.file_url?r.file_url:typeof t=="string"?t:""}var M=(e,t,r,a,l)=>{const{maxSizeMB:i,maxWidthOrHeight:u}=n.resolveImageCompressionLimits(l),c=n.getBrowserImageCompressionLibUrl();return async(s,x)=>{try{const f=await I(s,e);if(!f)return typeof s=="string"?s:"";const h=await b(x,f.type),g=f.type?.trim()||n.inferImageMimeFromFileName(h)||"";let m=new File([f],h.toLowerCase(),{type:g});if(n.isAllowedImageUploadFile(m)){const o=m.type?.trim()||n.inferImageMimeFromFileName(m.name)||f.type||"";try{m=await n.prepareImageForUpload(m,{maxSizeMB:i,maxWidthOrHeight:u,mimeType:o||f.type,fileName:m.name,libURL:c,enableCompression:n.shouldEnableImageCompression(l,o),convertSvgToPng:!0})}catch{}}return A(await t({user_id:r.id,folder:a.id,file:m}),s)}catch{return typeof s=="string"?s:""}}},R=e=>t=>{const r=t.document;r.title=(r.querySelector("title")?.textContent??"").replace(/\s+/g," ").trim()||p.getFileNameAndExt(e.name)[0]};Object.defineProperty(v,"extractUploadResult",{enumerable:!0,get:function(){return E}}),Object.defineProperty(v,"import_exports",{enumerable:!0,get:function(){return P}})});
8
8
 
9
- __useblocks__.define("static/core/a669ca97.js",["require","exports","module","static/core/2ff39ddf.js","static/core/10c6144f.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./2ff39ddf.js"),o=t("./10c6144f.js");let r=t("react");r=i.__toESM(r);let l=t("react/jsx-runtime"),d=t("__delivery__/libs");function n(){return o.usePlanFeatureGate("google_fonts").isLocked?void 0:o.loadGFonts}var u=c=>{const{form:g,namePrefix:s="",typeOfForm:I="desktop"}=c,E=o.useSelector(o.selectEmailSettings).usedColors;return(0,l.jsx)(d.ui_kit$FormBorderInputs,{form:g,namePrefix:s,typeOfForm:I,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"},R={mobileBorderRadiusAll:"all",mobileBorderRadiusTopLeft:"topLeft",mobileBorderRadiusBottomLeft:"bottomLeft",mobileBorderRadiusTopRight:"topRight",mobileBorderRadiusBottomRight:"bottomRight"},a={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 a}}),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 R}}),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}})});
9
+ __useblocks__.define("static/core/e02ef34c.js",["require","exports","module","static/core/2ff39ddf.js","static/core/b2b19022.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./2ff39ddf.js"),o=t("./b2b19022.js");let r=t("react");r=i.__toESM(r);let l=t("react/jsx-runtime"),d=t("__delivery__/libs");function n(){return o.usePlanFeatureGate("google_fonts").isLocked?void 0:o.loadGFonts}var u=c=>{const{form:g,namePrefix:s="",typeOfForm:I="desktop"}=c,E=o.useSelector(o.selectEmailSettings).usedColors;return(0,l.jsx)(d.ui_kit$FormBorderInputs,{form:g,namePrefix:s,typeOfForm:I,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"},R={mobileBorderRadiusAll:"all",mobileBorderRadiusTopLeft:"topLeft",mobileBorderRadiusBottomLeft:"bottomLeft",mobileBorderRadiusTopRight:"topRight",mobileBorderRadiusBottomRight:"bottomRight"},a={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 a}}),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 R}}),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}})});
10
10
 
11
- (function(){try{if(typeof document<"u"){var t='.blocks-app .upload-bg-image{margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px)}.blocks-app .upload-bg-image__inner-wrap{border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);border-radius:calc(var(--ub-borderRadius) * 1px);cursor:pointer;background-color:var(--ub-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(--ub-borderColorHover)}.blocks-app .upload-bg-image__uploader{width:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2 + 1) * 1px);height:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2) * 1px);border-radius:calc(var(--ub-borderRadius) * .8px);border:none;border-right:1px solid var(--ub-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(--ub-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(--ub-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(--ub-colorTextQuaternary)}.blocks-app .upload-bg-image__edit,.blocks-app .upload-bg-image__edit-menu{color:var(--ub-colorLink);right:calc((var(--ub-borderWidth) + 2) * 1px);padding:6px;line-height:1;position:absolute}.blocks-app .upload-bg-image__edit{right:calc((var(--ub-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(--ub-colorFillSecondary);border-radius:calc(var(--ub-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(--ub-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(--ub-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(--ub-colorBgContainer) 60%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);box-shadow:28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent), -28px 0 0 0 color-mix(in srgb, var(--ub-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(--ub-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(--ub-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;align-items:flex-start;gap:10px;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(--ub-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(--ub-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active:hover{background:var(--ub-colorPrimaryBgHover)!important;color:var(--ub-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(--ub-colorFillSecondaryDarken);width:34px;height:34px;top:0;left:0}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper{background:var(--ub-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(--ub-colorFillSecondaryDarken)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .selected_text_common_form_mobile .codemode-textalign-dropdown{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadius) * 1px);box-shadow:var(--ub-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(--ub-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(--ub-colorTextSecondary);background-color:var(--ub-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(--ub-colorError)}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-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(--ub-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(--ub-colorFillQuaternary);border-radius:calc(var(--ub-borderRadius) * 1px);margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px);border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-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(--ub-colorBorderSecondary,#f0f0f0);margin-top:16px;padding-top:16px}.blocks-app .selected-social-form .selected-social-form__section-title{color:var(--ub-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(--ub-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(--ub-colorBorderSecondary,#f0f0f0);background:var(--ub-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(--ub-colorPrimary);box-shadow:0 0 0 1px var(--ub-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(--ub-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(--ub-colorText,#000000e0);background:var(--ub-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(--ub-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(--ub-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(--ub-colorText,#000000e0);background:var(--ub-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(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-title{min-width:0;color:var(--ub-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(--ub-formControlHeight) * 1px);min-width:calc(var(--ub-formControlHeight) * 1px);max-width:calc(var(--ub-formControlHeight) * 1px);height:calc(var(--ub-formControlHeight) * 1px);min-height:calc(var(--ub-formControlHeight) * 1px);max-height:calc(var(--ub-formControlHeight) * 1px);line-height:calc((var(--ub-formControlHeight) - 2) * 1px);color:var(--ub-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(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:focus-visible{outline:2px solid var(--ub-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(--ub-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(--ub-colorFillTertiary,#f8f8f8);height:32px;color:var(--ub-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(--ub-colorFillSecondary,#f0f0f0);color:var(--ub-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(--ub-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(--ub-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(--ub-boxShadowSecondary);border-radius:calc(var(--ub-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(--ub-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(--ub-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(--ub-colorBorder);z-index:100;background-color:var(--ub-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(--ub-colorPrimary)}.blocks-app .selected-element-panel__mobile-switch.ant-switch-checked{background-color:var(--ub-colorInfo)}.blocks-app #selected_element_form_desktop_props .ant-alert-info .ant-alert-title{color:var(--ub-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 .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(--ub-colorInfo);box-shadow:var(--ub-colorInfoBg) 0 0 0 2px!important}.blocks-app .ant-app .selected_form-mobile-props .ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:var(--ub-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(--ub-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(--ub-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(--ub-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(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-btn-background-ghost.ant-btn-primary{color:var(--ub-colorInfo);border-color:var(--ub-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(--ub-colorInfoBg)!important;color:var(--ub-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(--ub-colorInfoTextActive)}.blocks-app .ant-app .selected_form-mobile-props .ant-switch.ant-switch-checked:hover:not(.ant-switch-disabled){background-color:var(--ub-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(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info{background-color:var(--ub-colorInfoBg);border:none}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info .ant-alert-title{color:var(--ub-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(--ub-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(--ub-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(--ub-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(--ub-colorTextSecondary,#8c8c8c);margin-top:16px;font-size:12px;font-weight:300;line-height:1.4}.blocks-app .annotations-panel__section-hint{color:var(--ub-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(--ub-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(--ub-colorInfo)}.blocks-app .ant-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-user{background:var(--ub-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 .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(--ub-colorBorderSecondary);background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -25px}.blocks-app .optimise.ant-collapse>.ant-collapse-item{border-bottom:1px solid var(--ub-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(--ub-colorSuccessText)}.blocks-app .optimise .error{white-space:nowrap;color:var(--ub-colorErrorText)}.blocks-app .optimise .warning{white-space:nowrap;color:var(--ub-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(--ub-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(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-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(--ub-borderRadius) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-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(--ub-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(--ub-colorWarningText)}.blocks-app .optimise .errors{color:var(--ub-colorErrorText)}.blocks-app .optimise .valid{color:var(--ub-colorSuccessText)}.blocks-app .optimise__button.warnings{border-color:var(--ub-colorWarningBorder);background:var(--ub-colorWarningBg)}.blocks-app .optimise__button.warnings:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorWarningBorderHover);color:var(--ub-colorWarningTextHover);background:var(--ub-colorWarningBgHover)}.blocks-app .optimise__button.warnings_active{color:#fff;background-color:var(--ub-colorWarningActive);border-color:var(--ub-colorWarningActive)}.blocks-app .optimise__button.errors{border-color:var(--ub-colorErrorBorder);background:var(--ub-colorErrorBg)}.blocks-app .optimise__button.errors:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorErrorBorderHover);color:var(--ub-colorErrorTextHover);background:var(--ub-colorErrorBgHover)}.blocks-app .optimise__button.errors_active{color:#fff;background-color:var(--ub-colorErrorActive);border-color:var(--ub-colorErrorActive)}.blocks-app .optimise__button.valid{border-color:var(--ub-colorSuccessBorder);background:var(--ub-colorSuccessBg)}.blocks-app .optimise__button.valid:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorSuccessBorderHover);color:var(--ub-colorSuccessTextHover);background:var(--ub-colorSuccessBgHover)}.blocks-app .optimise__button.valid_active{color:#fff;background-color:var(--ub-colorSuccessActive);border-color:var(--ub-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(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-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(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-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(--ub-colorTextSecondary);text-align:left;margin-bottom:12px;line-height:1.2;list-style:none}.blocks-app .blocks-search__type-wrapper li.active{color:var(--ub-colorLink)}.blocks-app .blocks-search__type-wrapper li:hover{color:var(--ub-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(--ub-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(--ub-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(--ub-colorBgElevated);border:1px solid var(--ub-colorBorder);border-radius:calc(var(--ub-borderRadiusSM) * 1px);text-align:center;cursor:grab;background-color:var(--ub-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(--ub-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 .em-dragging-element .blocks-search__result-body{background-color:var(--ub-controlTmpOutline)}.blocks-app .blocks-search .em-ghost-element{border-radius:calc(var(--ub-borderRadiusXL) * 1px);overflow:hidden;background-color:var(--ub-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(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-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(--ub-colorTextSecondary);padding:8px 15px;font-size:14px}.blocks-app .block-search__preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-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(--ub-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(--ub-colorFillQuaternary)}.blocks-app .history-panel__list .ant-btn.ant-btn-sm{border:none;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(--ub-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.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),o=t;if(!e.sheets[o]){var p=!1;try{if(typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&document.adoptedStyleSheets){var l=new CSSStyleSheet;l.replaceSync(t),document.adoptedStyleSheets=document.adoptedStyleSheets.concat([l]),e.sheets[o]=l,e.order.push(o),p=!0}}catch{p=!1}if(!p){var a=document.createElement("style");a.setAttribute("data-useblocks","true"),a.appendChild(document.createTextNode(t)),document.head.appendChild(a),e.sheets[o]=a,e.order.push(o)}}}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
12
- __useblocks__.define("static/core/53bcd609.js",["require","exports","module","static/core/2ff39ddf.js","static/core/8782e9bb.js","static/core/10c6144f.js","static/core/cb7d16ff.js","static/core/68612347.js","static/core/41a7e33c.js","static/core/a669ca97.js","static/core/52b6b918.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(bt,nt,mp){const it=bt("./2ff39ddf.js"),De=bt("./8782e9bb.js"),s=bt("./10c6144f.js"),St=bt("./cb7d16ff.js"),hi=bt("./68612347.js"),Kl=bt("./41a7e33c.js"),H=bt("./a669ca97.js"),yt=bt("./52b6b918.js");let d=bt("react");d=it.__toESM(d);let t=bt("react/jsx-runtime"),o=bt("__delivery__/libs"),ql=bt("react-dom"),Do=bt("vite/preload-helper"),Ve=bt("classnames");Ve=it.__toESM(Ve);let $t=bt("dayjs");$t=it.__toESM($t);var g=it.__toESM(s.require_prop_types());async function vr(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,r)=>{const a=URL.createObjectURL(e),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);const n=l.naturalWidth||l.width,c=l.naturalHeight||l.height;n>0&&c>0?i({width:n,height:c}):r(new Error("Could not read image dimensions"))},l.onerror=()=>{URL.revokeObjectURL(a),r(new Error("Could not decode image"))},l.src=a})}function ko(e){return e.trim()}var Jl=67108864,Ql=2e3;function Vo(e){e.abandonTimer!==void 0&&(clearTimeout(e.abandonTimer),e.abandonTimer=void 0)}function Ir(e,i){return i?new Promise((r,a)=>{if(i.aborted){a(new DOMException("Aborted","AbortError"));return}const l=()=>{a(new DOMException("Aborted","AbortError"))};i.addEventListener("abort",l,{once:!0}),e.then(n=>{i.removeEventListener("abort",l),r(n)},n=>{i.removeEventListener("abort",l),a(n)})}):e}function Zl(e={}){const i=e.maxCacheBytes??Jl,r=e.abandonDelayMs??Ql,a=new Map,l=new Map;let n=0;function c(x){const E=a.get(x);E&&(n-=E.size,a.delete(x))}function m(x,E){if(c(x),!(E.size>i)){a.set(x,E),n+=E.size;for(const w of a.keys()){if(n<=i)break;c(w)}}}function f(x){const E=l.get(x);E&&(Vo(E),l.delete(x))}function _(x,E){E.waiters-=1,!(E.waiters>0||E.abandonTimer!==void 0||l.get(x)!==E)&&(E.abandonTimer=setTimeout(()=>{E.abandonTimer=void 0,!(l.get(x)!==E||E.waiters>0)&&(l.delete(x),E.controller.abort())},r))}function k(x,E,w){return E.waiters+=1,Vo(E),w.then(()=>_(x,E),()=>_(x,E)),w}async function b(x,E,w){const I=ko(x);if(!I)throw new Error("Empty image URL");const A=a.get(I);if(A){if(E?.aborted)throw new DOMException("Aborted","AbortError");return a.delete(I),a.set(I,A),A}const v=l.get(I);if(v)return k(I,v,Ir(v.promise,E));const P=new AbortController,C={promise:w(I,P.signal).then(Y=>(f(I),m(I,Y),Y)).catch(Y=>{throw f(I),Y}),controller:P,waiters:0,abandonTimer:void 0};return l.set(I,C),k(I,C,Ir(C.promise,E))}function h(x){const E=ko(x);if(!E)return;const w=l.get(E);w&&(Vo(w),w.controller.abort(),l.delete(E)),c(E)}function y(){for(const[,x]of l)Vo(x),x.controller.abort();l.clear(),a.clear(),n=0}return{resolve:b,abandonKey:h,invalidateAll:y}}async function Cr(e,i){if(!e||typeof e.findFileByUrl!="function")return null;const r=await e.findFileByUrl(i);if(!r)return null;const a=typeof e.getFileById=="function"&&r.id&&await e.getFileById(r.id)||r,l=a.url||i,n=a.thumbnailUrl||a.thumbnail||l||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(a):"")||"";return n?{file:a,previewUrl:n}:null}var bi="em_version";function kt(e){if(!e||!e.includes("em_version"))return e;try{const i=typeof document<"u"?document.baseURI:"http://localhost/",r=new URL(e,i);return r.searchParams.has("em_version")?(r.searchParams.delete(bi),/^https?:\/\//i.test(e)||e.startsWith("//")?r.href:r.pathname+r.search+r.hash):e}catch{return e}}function en(e){try{const i=typeof document<"u"?document.baseURI:"http://localhost/",r=new URL(e,i);return r.searchParams.set(bi,String(Date.now())),/^https?:\/\//i.test(e)||e.startsWith("//")?r.href:r.pathname+r.search+r.hash}catch{return`${e}${e.includes("?")?"&":"?"}${bi}=${Date.now()}`}}function Uo(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 tn(e){if(!(e instanceof Blob)||e.size===0)throw new yt.e("Failed to download file from the URL.","UploadUrlDownloadFailed");const i=e.type?.split(";")[0]?.trim()||"image/png";if(!i.startsWith("image/"))throw new yt.e("Content type at the URL is not allowed.","UploadUrlContentTypeNotAllowed");return{blob:e,mimeType:i}}async function on(e,i){const r=await fetch(e,i);if(!r.ok)throw new Error(`Server returned ${r.status}`);return r.blob()}async function rn(e,i,r){const a=r?{signal:r}:void 0,{blob:l}=await yt.ie(e,{handleFileProxy:async n=>{const c=await i.fireFileProxy(n);return s.pickFileProxyBlobFromFireResults(c)??null},handleProxyUrl:async n=>{const c=await i.fireProxyUrl(n);return s.pickProxyUrlOverrideFromFireResults(c,n)},fetchWithProxy:(n,c,m)=>De.fetchWithResourceProxy(n,{config:i.appConfig,standalone:i.isStandalone,intent:m?.intent||"downloadBlob",validateBlob:async f=>!f.type||f.type.startsWith("image/"),init:c})},n=>on(n,a),tn,{fetchInit:a});return l}function Pr(){const e=s.useAppConfig(),i=s.useIsStandalone(),r=s.useProjectData(),a=s.useEditorProjectId(),l=r?.id!==void 0?String(r.id):a||"",n=s.useEventEmitter(De.events.FILE_PROXY_EVENT_ID),c=s.useEventEmitter(De.events.PROXY_URL_EVENT_ID);return(0,d.useCallback)(async(m,f)=>rn(m,{appConfig:e,isStandalone:i,fireFileProxy:_=>n.fire({url:_,project:l}),fireProxyUrl:_=>c.fire({url:_,project:l})},f),[e,l,i,n,c])}function sn(e){return De.getContainer(e).getOrCreateInstance(De.IMAGE_BLOB_RESOLVER_ID,()=>Zl())}function Ar(){const e=s.useStore();return(0,d.useMemo)(()=>sn(e),[e])}var ft=class Xl extends Error{code;status;details;get httpStatus(){return this.status}constructor(i,r,a,l){super(i),this.name="FileManagerApiError",this.code=r,this.status=a,this.details=l,Error.captureStackTrace&&Error.captureStackTrace(this,Xl)}},an="Edited",ln=1e4;function Ho(e,i="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 409:return"FolderAlreadyExists";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return i}}var Nr={file_too_large:"FileTooLarge",file_size_exceeded:"FileTooLarge",file_size_limit:"FileTooLarge",invalid_file_name:"FileInvalidName",file_name_invalid:"FileInvalidName",invalid_name:"FileInvalidName",invalid_folder_name:"FolderInvalidName",folder_name_invalid:"FolderInvalidName",folder_invalid_name:"FolderInvalidName",file_type_not_allowed:"FileTypeNotAllowed",unsupported_type:"FileTypeNotAllowed",invalid_format:"FileTypeNotAllowed",batch_limit_exceeded:"BatchItemLimitExceeded",exceeded_max_files:"BatchItemLimitExceeded",file_count_exceeded:"BatchItemLimitExceeded",upload_limit_exceeded:"BatchItemLimitExceeded",too_many_files:"BatchItemLimitExceeded"};function nn(e){if(typeof e=="string")return e;if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&"400x400"in e){const i=e["400x400"];return typeof i=="string"?i:void 0}}function dn(e){const i=e.is_folder;if(i===!0||i===1)return!0;if(i===!1||i===0)return!1;if(typeof i=="string"){const a=i.trim().toLowerCase();if(a==="true"||a==="1"||a==="yes")return!0;if(a==="false"||a==="0"||a==="no"||a==="")return!1}if(String(e.item_type??"").toLowerCase()==="folder")return!0;const r=String(e.type??"").toLowerCase();return!!(r==="folder"||r==="directory"||r==="dir"||r==="inode/directory"||r==="application/x-directory"||r==="httpd/unix-directory"||r.endsWith("/directory"))}function Eo(e){if(!e)return["",""];const i=e.replaceAll("\\","/").split("/").filter(Boolean),r=i.pop()||"";return[i.join("/"),r]}function cn(e,i){if(!e)return"";const r=new RegExp(`^/?${i}/?`);return e.replace(r,"")}function un(e){return new Promise((i,r)=>{const a=new FileReader;a.onload=()=>{const l=a.result.toString().split(",")[1];i(l)},a.onerror=r,a.readAsDataURL(e)})}var mn=class{_api;_projectId;i18n;pathPostfix;appConfig;isStandalone;pathMode=!0;rootId="";trashPath="trash";tempPath=an;constructor(e){this._api=e.restApi,this._projectId=e.projectId,this.i18n=e.i18n||s.defaultI18nContext,this.pathPostfix=e.pathPostfix,this.appConfig=e.appConfig,this.isStandalone=!!e.isStandalone}removePrefix(e){let i=cn(e,this._projectId);if(this.pathPostfix){const r=new RegExp(`^/?${this.pathPostfix}/?`);i=i.replace(r,"")}return i}handleError(e,i){const{__:r}=this.i18n;if(e instanceof Error)throw e instanceof ft?e:new ft(e.message,i||"BackendError");const a=e.data,l=a?.message||r("Unknown error"),n=a?.data?.status??a?.status,c=a?.code,m=i||(c?Nr[c]:void 0)||(typeof n=="number"?Ho(n):void 0)||"BackendError";throw new ft(l,m,n)}convertRestError(e,i){const{__:r}=this.i18n;if(e instanceof ft||e instanceof Error)return e;if(e&&typeof e=="object"&&"data"in e&&!(e instanceof Error)){const a=e.data,l=a?.message||r("Unknown error"),n=a?.data?.status??a?.status,c=a?.code;return{message:l,code:i||(c?Nr[c]:void 0)||(n?Ho(n):void 0)||"BackendError",status:n,raw:e}}return e??{message:r("Unknown error")}}async getFolders({parentId:e}){const i=await this._api.folders_list({project_id:this._projectId,path_folder:e,per_page:ln},{type:De.ContentType.Json});if(i.error){if(this.isPathFolderNotFound(i.error))return[];this.handleError(i.error)}return await i.data.folders.map(r=>({id:this.removePrefix(r.full_path),name:r.name,folderId:this.removePrefix(r.parent_folder),childrenCount:r.files_count+r.folders_count,isFolder:!0}))}async getItems(e){if(e.limit===void 0&&(e.limit=Number.MAX_SAFE_INTEGER),e.itemType==="folder")return{items:await this.getFolders({parentId:e.folderId})};let i;try{i=await this._api.files_list({project_id:this._projectId,path_folder:e.folderId,filter_name:e.search,sort_by:e.sortBy,sort_order:e.sortOrder,per_page:e.limit,page:e.page})}catch(c){if(this.isPathFolderNotFound(c)||c?.status===404)return{items:[],pagination:{limit:e.limit,page:1,total:0,totalPages:0}};throw c}const r=i,a=!r.ok&&r.status===404||this.isPathFolderNotFound(i.error);if(i.error||!r.ok){if(a)return{items:[],pagination:{limit:e.limit,page:1,total:0,totalPages:0}};i.error&&this.handleError(i.error)}const l=i.data;let n=(l?.files||[]).map(c=>{const m=c.thumbnail,f=dn(c);return{...c,id:`${this.removePrefix(c.folder)}/${c.name}`,size:Number(c.size),date:c.date||new Date().toISOString(),folderId:this.removePrefix(c.folder),selected:!1,isFolder:f,thumbnail:nn(m)}});return l.total===Number.MAX_SAFE_INTEGER&&(l.total=n.length),e.itemType==="file"&&(n=n.filter(c=>!c.isFolder)),{items:n,pagination:{limit:l.per_page,page:l.page,total:l.total,totalPages:l.total_pages}}}async getFile(e){const i=await De.fetchWithResourceProxy(De.buildCdnFileUrl(this.appConfig,[this._projectId,e]),{config:this.appConfig,standalone:this.isStandalone,resourceType:"cdn",intent:"downloadBlob"});if(i.ok)return i.blob();{const r=await i.text(),a=Ho(i.status,"FileReadError"),{__:l}=this.i18n,n=r||l("Failed to get file: %s").replace("%s",i.statusText);throw new ft(n,a,i.status)}}getFileData=async(e,i)=>{const r=e.url||(typeof this.getUrl=="function"?this.getUrl(e):""),a=await De.fetchWithResourceProxy(r,{config:this.appConfig,standalone:this.isStandalone,resourceType:De.isCdnUrl(r,this.appConfig)?"cdn":"generic",intent:"downloadBlob",init:i?.forceReload?{cache:"no-store"}:void 0});if(a.ok)return a.blob();const l=await a.text(),n=Ho(a.status,"FileReadError"),{__:c}=this.i18n,m=l||c("Failed to get file: %s").replace("%s",a.statusText);throw new ft(m,n,a.status)};isPathFolderNotFound(e){if(!e||typeof e!="object"||e instanceof Error)return!1;const i=e;return i.code==="path_folder_not_found"||i.data?.code==="path_folder_not_found"||i.data?.data?.status===404}async deleteItem(e,i){if(e.isFolder){const r=await this._api.folders_delete({path_folder:e.id,project_id:this._projectId,force:i.permanent},{type:De.ContentType.Json});if(r.error){if(this.isPathFolderNotFound(r.error)){await this.clearCache(e.folderId??void 0);return}this.handleError(r.error,"FolderNotFound")}await this.clearCache(e.folderId??void 0)}else{const r=await this._api.files_delete({project_id:this._projectId,path_folder:e.folderId??"",file_name:[e.name],force:i.permanent},{type:De.ContentType.Json});r.error&&this.handleError(r.error,"FileNotFound")}}async deleteItems(e,i){try{if(e.length===0)return{success:!0};const r=e.filter(l=>l.isFolder),a=e.filter(l=>!l.isFolder);if(r.length>0){const l=new Set(r.map(m=>m.id)),n=r.filter(m=>{const f=m.folderId??"";return!l.has(f)}).map(m=>m.id),c=await this._api.folders_delete({project_id:this._projectId,path_folder:n.length===1?n[0]:n,force:i.permanent},{type:De.ContentType.Json});if(c.error&&!this.isPathFolderNotFound(c.error))return{success:!1,error:this.convertRestError(c.error)};for(const m of r)try{await this.clearCache(m.folderId??void 0)}catch{}}if(a.length>0){const l=new Map;for(const n of a){const c=n.folderId??"";l.has(c)||l.set(c,[]),l.get(c).push(n)}for(const[n,c]of l){const m=await this._api.files_delete({project_id:this._projectId,path_folder:n,file_name:c.map(f=>f.name),force:i.permanent},{type:De.ContentType.Json});if(m.error)return{success:!1,error:this.convertRestError(m.error)}}}return{success:!0}}catch(r){return{success:!1,error:r}}}async createFolder(e,i,r){const{__:a}=this.i18n;if(!e)throw new ft(a("Folder name is required"),"FolderInvalidName");const l=await this._api.folders_create({name:e,project_id:this._projectId,path_folder:i,is_force_create:r},{type:De.ContentType.Json});return l.error&&this.handleError(l.error),{id:this.removePrefix(l.data.full_path),name:l.data.name,folderId:this.removePrefix(l.data.parent_folder),childrenCount:l.data.files_count|l.data.folders_count,isFolder:!0}}async _uploadFile(e){const{__:i}=this.i18n;if(!e.name||!e.data)throw new ft(i("Invalid file data"),"ValidationError");const r=await this._api.files_create({file:e.data instanceof File?e.data:new File([e.data],e.name,{type:e.type}),path_folder:e.folderId,project_id:this._projectId},{type:De.ContentType.FormData});r.error&&this.handleError(r.error);const a=r.data instanceof Array?r.data[0]:r.data;if(!a)throw new ft(i("File upload failed"),"ValidationError");return{...a,id:this.removePrefix(a.folder)+"/"+a.name,size:Number(a.size),folderId:this.removePrefix(a.folder),date:a.date||new Date().toISOString(),selected:!1,isFolder:!1,thumbnail:a.thumbnail?.["400x400"]}}async uploadFiles(e){try{const i=e.items.map(a=>{if(a.data instanceof File)return a.data;const l=a.name||"file",n=a.data.type||a.type||"application/octet-stream";return new File([a.data],l,{type:n})}),r=await this._api.files_create({project_id:this._projectId,path_folder:e.folderId,file:i},{type:De.ContentType.FormData});return r.error?{success:!1,error:this.convertRestError(r.error)}:{success:!0,detailed:(Array.isArray(r.data)?r.data:[r.data]).map(a=>({success:!0,data:{id:[this.removePrefix(a.folder),a.name].filter(Boolean).join("/"),name:a.name,size:Number(a.size),folderId:this.removePrefix(a.folder),type:a.type,date:a.date||new Date().toISOString(),selected:!1,isFolder:!1,thumbnail:a.thumbnail?.["400x400"]}}))}}catch(i){return{success:!1,error:i}}}async renameItem(e,i){const{__:r}=this.i18n;if(!i){const m=e.isFolder?"FolderInvalidName":"FileInvalidName",f=e.isFolder?r("New folder name is required"):r("New file name is required");throw new ft(f,m)}const[a,l]=Eo(e.id),n=await this._api.files_rename_partial_update({file_name:l,new_name:i,path_folder:a,project_id:this._projectId,is_folder:e.isFolder},{type:De.ContentType.Json});n.error&&this.handleError(n.error);const c=n.data;return{id:this.removePrefix(c.folder)+"/"+c.name,name:c.name,folderId:this.removePrefix(c.folder)}}async moveItems(e,i){try{const r=e.map(l=>Eo(l.id)),a=await this._api.items_move_partial_update({file_name:r.map(l=>l[1]),target_folder:i,path_folder:r[0][0],project_id:this._projectId},{type:De.ContentType.Json});return a.error?{success:!1,error:this.convertRestError(a.error)}:{success:!0,detailed:a.data.results.map(l=>({success:l.success,error:this.convertRestError(l.error),data:{id:[this.removePrefix(l.new_path||""),l.item_name].filter(n=>n).join("/")}}))}}catch(r){return this.convertRestError(r),{success:!1,error:r}}}async copyItem(e,i){const[r,a]=Eo(e.id),l=await this._api.items_move_partial_update({file_name:a,target_folder:i,path_folder:r,project_id:this._projectId,is_copy:!0},{type:De.ContentType.Json});return l.error&&this.handleError(l.error),{id:[i,a].filter(n=>n).join("/")}}async copyItems(e,i){try{const r=e.map(l=>Eo(l.id)),a=await this._api.items_move_partial_update({file_name:r.map(l=>l[1]),target_folder:i,path_folder:r[0][0],project_id:this._projectId,is_copy:!0},{type:De.ContentType.Json});return a.error?{success:!1,error:this.convertRestError(a.error)}:{success:!0,detailed:a.data.results.map((l,n)=>({success:l.success,error:this.convertRestError(l.error),requestId:e[n].id,data:{id:[this.removePrefix(l.new_path||""),l.item_name].filter(c=>c).join("/")}}))}}catch(r){return{success:!1,error:this.convertRestError(r)}}}async uploadFileByUrl(e,i,r){const a=s.toAbsoluteUrl(e);try{if(a.startsWith("http://localhost")||a.startsWith("https://localhost")||this.appConfig?.resourceProxy||this.isStandalone){const c=await(await De.fetchWithResourceProxy(a,{config:this.appConfig,standalone:this.isStandalone,resourceType:r?.eventSource==="imageStock"?"stockImages":"generic",intent:"downloadBlob"})).blob();return this._uploadFile({name:a.split("/").pop()||"file",size:c.size,folderId:i,data:c,type:await s.getMimeType(a)||"application/octet-stream"})}const l=await this._api.files_upload_by_url_create({url:a,path_folder:i,project_id:this._projectId},{type:De.ContentType.Json});l.error&&this.handleError(l.error);const n=l.data instanceof Array?l.data[0]:l.data;return{id:`${this.removePrefix(n.folder)}/${n.name}`,name:n.name,size:Number(n.size),type:n.type,folderId:this.removePrefix(n.folder)||null,date:n.date||new Date().toISOString(),url:n.url}}catch(l){throw l}}async updateFile(e,i){const[r,a]=Eo(e.id),l=await this._api.files_partial_update({file_name:a,project_id:this._projectId,path_folder:r,updates:{data:typeof i.data=="string"?i.data:await un(i.data),name:i.name}},{type:De.ContentType.Json});if(l.error)this.handleError(l.error);else{const n=l.data;return{...n,id:`${this.removePrefix(n.folder)}/${n.name}`,size:Number(n.size),folderId:this.removePrefix(n.folder),date:n.date||new Date().toISOString(),thumbnail:n.thumbnail?.["400x400"],selected:!1}}}findFileByUrl(e,i){const r=De.unwrapResourceProxyUrl(e,this.appConfig),a=De.buildCdnFileUrl(this.appConfig,[]);if(a&&s.normalizeUrl(r).startsWith(s.normalizeUrl(a))){const l=r.replace(s.normalizeUrl(a)+"/","").split("/").filter(Boolean);if(l[0]===this._projectId){const n=this.removePrefix(l.slice(1,-1).join("/")),c=l[l.length-1];if(!i||n===this.removePrefix(i))return{id:[n,c].filter(Boolean).join("/"),name:c,folderId:n,isFolder:!1,url:r}}}}async clearCache(e){const i={project_id:this._projectId,path_folder:e||void 0},r=await this._api.cache_clear_create(i);r.error&&this.handleError(r.error)}getUrl=e=>De.buildCdnFileUrl(this.appConfig,[this._projectId,this.pathPostfix,e.folderId,e.name]);getThumbnailUrl=e=>{const i=e.name.lastIndexOf("."),r=i>0?e.name.slice(0,i):e.name,a=i>0?e.name.slice(i+1):"";return De.buildCdnFileUrl(this.appConfig,[this._projectId,this.pathPostfix,".thumbs",e.folderId,r,r+"-400x400."+a])};async cleanTrash(){try{const e=await this._api.empty_trash_create({project_id:this._projectId},{type:De.ContentType.UrlEncoded});e.error&&this.handleError(e.error,"BackendError");const i=e.data;return{success:i?.success??!0,deletedCount:i?.deleted_count??0}}catch(e){if(e instanceof ft)throw e;const{__:i}=this.i18n;throw new ft(i("Failed to clean trash"),"BackendError")}}};function Lr(e){return e.replace(/\/+$/,"")}function pn(e,i){const r=Lr(De.buildCdnFileUrl(i??{},[])),a=Lr(e);if(!(!r||!a.startsWith(`${r}/`)))return a.slice(r.length+1).split("/").filter(Boolean)[0]}function hn(e,i={}){const r=i.projectId?.trim();if(!r)return!1;const a=De.unwrapResourceProxyUrl(e,i.appConfig,i.isStandalone);return De.isCdnUrl(a,i.appConfig)?pn(a,i.appConfig)===r:!1}function bn(e,i={}){return De.unwrapResourceProxyUrl(e,i.appConfig,i.isStandalone)}var Or={"platform.validation":"ValidationError","platform.malformed_body":"ValidationError","platform.invalid_uuid":"ValidationError","platform.invalid_field_value":"ValidationError","platform.unauthorized":"AuthenticationFailed","platform.forbidden":"AuthorizationFailed","platform.not_found":"FileNotFound","platform.conflict":"FolderAlreadyExists","platform.payload_too_large":"PayloadTooLarge","platform.unsupported_media_type":"FileTypeNotAllowed","platform.too_many_requests":"RateLimitExceeded","platform.unavailable":"ServiceUnavailable","platform.internal":"BackendError","filemanager.file_not_found":"FileNotFound","filemanager.folder_not_found":"FolderNotFound","filemanager.file_exists":"FileAlreadyExists","filemanager.folder_exists":"FolderAlreadyExists","filemanager.invalid_file_name":"FileInvalidName","filemanager.invalid_folder_name":"FolderInvalidName","filemanager.item_not_found":"FileNotFound","filemanager.no_project_access":"AuthorizationFailed","filemanager.project_required":"ValidationError","filemanager.invalid_project_id":"ValidationError","filemanager.file_too_large":"FileTooLarge","filemanager.upload_too_large":"PayloadTooLarge","filemanager.no_files":"ValidationError","filemanager.batch_limit_exceeded":"BatchItemLimitExceeded","filemanager.too_many_items":"BatchItemLimitExceeded","filemanager.items_required":"ValidationError","filemanager.unsupported_file_type":"FileTypeNotAllowed","filemanager.upload_url_rejected":"UploadUrlInvalid","filemanager.transfer_into_descendant":"MoveIntoDescendant","filemanager.legacy_file_unsupported":"UnsupportedOperation","filemanager.backfill_unsupported":"UnsupportedOperation","filemanager.backfill_already_done":"UnsupportedOperation","filemanager.storage_unavailable":"ServiceUnavailable"};function Fr(e){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 409:return"FolderAlreadyExists";case 413:return"PayloadTooLarge";case 415:return"FileTypeNotAllowed";case 429:return"RateLimitExceeded";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return"BackendError"}}function fn(e,i){return(e?Or[e]:void 0)??Fr(i)}function gn(e){return(e?Or[e]:void 0)??"FileWriteError"}var $r=2e3,Mr=30,_n=$r*Mr;function xn(e){return typeof e?.watchThumbnail=="function"}var Dr=200,kn=class lo{pathMode=!1;rootId="";trashPath=yt._;useSoftDelete=!1;api;projectId;i18n;appConfig;isStandalone;onIndexingStateChange;pendingThumbnails=new Map;thumbWatchers=new Map;resolveSystemFolderByPath;constructor(i){this.api=i.restApi,this.projectId=i.projectId,this.i18n=i.i18n??s.defaultI18nContext,this.appConfig=i.appConfig,this.isStandalone=i.isStandalone,this.onIndexingStateChange=i.onIndexingStateChange,this.resolveSystemFolderByPath=yt.b({Trash:{id:yt._,folderId:this.rootId}})}async getItems(i){const r=i.folderId===yt._;if(i.itemType==="folder")return{items:await this.listFolders(i.folderId,r)};const a=i.itemType==="all"&&(i.page??1)<=1,[l,n]=await Promise.all([a?this.listFolders(i.folderId,r,i.search):[],this.listFiles(i,r)]);return{items:[...l,...n.items],pagination:n.pagination}}async listFolders(i,r,a){const l=await this.api.folders.foldersList({project_id:this.projectId,parent_id:r?void 0:this.normalizeFolderId(i),trashed:r||void 0});try{this.assertOk(l)}catch(c){if(lo.isNotFound(c))return[];throw c}let n=(l.data.items??[]).map(c=>this.mapFolder(c,i));if(a){const c=a.toLowerCase();n=n.filter(m=>m.name.toLowerCase().includes(c))}return n}async listFiles(i,r){const a=Math.min(i.limit??Dr,Dr),l=Math.max(i.page??1,1),n=await this.api.files.filesList({project_id:this.projectId,folder_id:r?void 0:this.normalizeFolderId(i.folderId),search:i.search||void 0,sort_by:i.sortBy,sort_order:i.sortOrder,limit:a,offset:(l-1)*a,trashed:r||void 0});try{this.assertOk(n)}catch(m){if(lo.isNotFound(m))return{items:[],pagination:{page:1,limit:a,total:0,totalPages:0,hasNext:!1,hasPrev:!1}};throw m}this.onIndexingStateChange?.(!!n.data.indexing);const c=r?yt._:this.normalizeFolderId(i.folderId)??this.rootId;return{items:(n.data.data??[]).map(m=>this.mapFile(m,c)),pagination:this.mapPagination(n.data.page,a)}}async createFolder(i,r){const a=await this.api.folders.foldersCreate({project_id:this.projectId,name:i,parent_id:this.normalizeFolderId(r)});return this.assertOk(a),this.mapFolder(a.data.folder??{},r)}async uploadFileByUrl(i,r){const a=await this.api.files.uploadByUrlCreate({project_id:this.projectId,url:i,folder_id:this.normalizeFolderId(r)});return this.assertOk(a),this.mapFile(a.data.file??{},this.normalizeFolderId(r)??this.rootId)}async uploadFiles(i){if(i.items.length===0)return{success:!0,detailed:[]};const r=new Map;i.items.forEach((n,c)=>{const m=this.normalizeFolderId(n.folderId??i.folderId??void 0)??this.rootId,f=n.requestId??`item-${c}`,_=r.get(m)??[];_.push({item:n,requestId:f}),r.set(m,_)});const a=[];for(const[n,c]of r){const m=new FormData;m.append("project_id",this.projectId),n!==this.rootId&&m.append("folder_id",n);for(const{item:k,requestId:b}of c)m.append("request_id",b),m.append("file",k.data,k.name);let f;try{f=await this.api.request({path:"/files",method:"POST",body:m,type:s.ContentType.FormData,format:"json",secure:!0}),this.assertOk(f)}catch(k){for(const{requestId:b}of c)a.push({requestId:b,success:!1,error:lo.toErrorInfo(k)});continue}const _=new Map((f.data.items??[]).map(k=>[k.request_id,k]));c.forEach(({requestId:k},b)=>{const h=_.get(k)??f.data.items?.[b];h?.file?a.push({requestId:k,success:!0,data:this.mapFile(h.file,n)}):a.push({requestId:k,success:!1,error:this.mapItemFail(h?.error)})})}const l=a.filter(n=>!n.success);return{success:l.length===0,error:l[0]?.error,detailed:a}}async uploadFile(i){const r=(await this.uploadFiles({items:[{name:i.name,size:i.size,type:i.type,folderId:i.folderId,data:i.data}]})).detailed?.[0];if(!r?.success||!r.data){const a=r?.error;throw a instanceof ft?a:new ft(String(a?.message??this.i18n.__("Unknown error")),a?.code||"FileWriteError",typeof a?.status=="number"?a.status:void 0)}return r.data}async updateFile(i,r){let a={id:i.id};if(r.data!==void 0){const l=typeof r.data=="string"?lo.base64ToBlob(r.data,i.type):r.data,n=new FormData;n.append("project_id",this.projectId),n.append("file",l,i.name);const c=await this.api.request({path:`/files/${i.id}/content`,method:"PUT",body:n,type:s.ContentType.FormData,format:"json",secure:!0});this.assertOk(c);const m=c.data.file??{};a={...a,size:m.size,type:m.mime,url:m.url,thumbnail:m.thumbnail_url,thumbnailUrl:m.thumbnail_url,lastEdited:m.updated_at}}if(r.name&&r.name!==i.name){const l=await this.renameItem(i,r.name);a={...a,...l}}return a}getFileData=async(i,r)=>{const{__:a}=this.i18n;if(!i.url)throw new ft(a("Failed to get file: %s").replace("%s",i.name),"FileReadError");const l=await De.fetchWithResourceProxy(i.url,{config:this.appConfig,standalone:this.isStandalone,resourceType:De.isCdnUrl(i.url,this.appConfig)?"cdn":"generic",intent:"downloadBlob",init:r?.forceReload?{cache:"no-store"}:void 0});if(l.ok)return l.blob();const n=await l.text();throw new ft(n||a("Failed to get file: %s").replace("%s",l.statusText),Fr(l.status),l.status)};static base64ToBlob(i,r){const a=i.includes(",")?i.slice(i.indexOf(",")+1):i,l=atob(a),n=new Uint8Array(l.length);for(let c=0;c<l.length;c+=1)n[c]=l.charCodeAt(c);return new Blob([n],r?{type:r}:void 0)}mapItemFail(i){const{__:r}=this.i18n;return{message:i?.message||r("Unknown error"),code:gn(i?.code)}}async renameItem(i,r){if(i.isFolder){const n=await this.api.folders.foldersPartialUpdate({id:i.id},{project_id:this.projectId,name:r});this.assertOk(n);const c=n.data.folder??{};return{id:i.id,name:c.name??r,folderId:c.parent_id??i.folderId,isFolder:!0,lastEdited:c.updated_at}}const a=await this.api.files.filesPartialUpdate({id:i.id},{project_id:this.projectId,name:r,mode:"replace"});this.assertOk(a);const l=a.data.file??{};return{id:i.id,name:l.name??r,folderId:l.folder_id??i.folderId,isFolder:!1,url:l.url,thumbnail:l.thumbnail_url,thumbnailUrl:l.thumbnail_url,extension:l.ext,type:l.mime,lastEdited:l.updated_at}}async deleteItem(i,r){try{if(i.isFolder){const a=await this.api.folders.foldersDelete({id:i.id,project_id:this.projectId,permanent:r.permanent||void 0});this.assertOk(a)}else{const a=await this.api.files.filesDelete({id:i.id,project_id:this.projectId,permanent:r.permanent||void 0});this.assertOk(a)}}catch(a){if(!lo.isNotFound(a))throw a}}async deleteItems(i,r){if(i.length===0)return{success:!0};const a=new Set(i.filter(m=>m.isFolder).map(m=>m.id)),l=new Set(i.filter(m=>a.has(m.folderId))),n=[];for(const m of i){if(l.has(m)){n.push({requestId:m.id,success:!0});continue}try{await this.deleteItem(m,r),n.push({requestId:m.id,success:!0})}catch(f){n.push({requestId:m.id,success:!1,error:lo.toErrorInfo(f)})}}const c=n.filter(m=>!m.success);return{success:c.length===0,error:c[0]?.error,detailed:n}}async moveItems(i,r){if(i.length===0)return{success:!0,detailed:[]};const a=i.filter(m=>m.folderId===yt._),l=i.filter(m=>m.folderId!==yt._),n=[];if(a.length>0){const m=await this.api.trash.restoreCreate({project_id:this.projectId,ids:a.map(f=>f.id),target_folder_id:this.normalizeFolderId(r),on_conflict:"keep_both"});this.assertOk(m),n.push(...this.mapTransferResults(m.data.items,a))}if(l.length>0){const m=await this.api.items.moveCreate({project_id:this.projectId,ids:l.map(f=>f.id),target_folder_id:this.normalizeFolderId(r)});this.assertOk(m),n.push(...this.mapTransferResults(m.data.items,l))}const c=n.filter(m=>!m.success);return{success:c.length===0,error:c[0]?.error,detailed:n}}async moveItem(i,r){return this.unwrapSingleTransfer(await this.moveItems([i],r),i)}async copyItems(i,r){if(i.length===0)return{success:!0,detailed:[]};const a=await this.api.items.copyCreate({project_id:this.projectId,ids:i.map(c=>c.id),target_folder_id:this.normalizeFolderId(r)});this.assertOk(a);const l=this.mapTransferResults(a.data.items,i),n=l.filter(c=>!c.success);return{success:n.length===0,error:n[0]?.error,detailed:l}}async copyItem(i,r){return this.unwrapSingleTransfer(await this.copyItems([i],r),i)}async cleanTrash(){const i=await this.api.trash.emptyCreate({project_id:this.projectId});return this.assertOk(i),{success:!0,deletedCount:(i.data.deleted_files??0)+(i.data.deleted_folders??0)}}async clearCache(i){}findItemByPath(i){return this.resolveSystemFolderByPath(i)}async findFileByUrl(i,r){const a={appConfig:this.appConfig,isStandalone:this.isStandalone,projectId:this.projectId};if(!hn(i,a))return;const l=bn(i,a),n=s.decodeFileNameFromUrl(l);if(!n)return;const{items:c}=await this.listFiles({folderId:r,search:n},!1);return c.find(m=>m.url===i||m.url===l)}mapTransferResults(i,r){const a=new Map(r.map(l=>[l.id,l]));return(i??[]).map((l,n)=>{const c=l.id??r[n]?.id,m=c?a.get(c):r[n];return l.error?{requestId:c,success:!1,error:this.mapItemFail(l.error)}:{requestId:c,success:!0,data:l.file?this.mapFile(l.file,l.file.folder_id??this.rootId):l.folder?this.mapFolder(l.folder):m?{id:m.id}:{id:c??""}}})}unwrapSingleTransfer(i,r){const a=i.detailed?.[0];if(!a?.success){const l=a?.error??i.error;throw l instanceof ft?l:new ft(String(l?.message??this.i18n.__("Unknown error")),l?.code||"BackendError",typeof l?.status=="number"?l.status:void 0)}return a.data??{id:r.id}}mapFile(i,r){return this.trackThumbnailReadiness(i),{id:i.id??"",name:i.name??"",folderId:i.folder_id??r,isFolder:!1,size:i.size,date:i.created_at,lastEdited:i.updated_at,type:i.mime,extension:i.ext,url:i.url,thumbnail:i.thumbnail_url,thumbnailUrl:i.thumbnail_url,dimensions:i.width&&i.height?`${i.width}x${i.height}`:void 0,aspectRatio:i.width&&i.height?String(i.width/i.height):void 0,selected:!1}}trackThumbnailReadiness(i){if(!i.id||!i.url||!i.mime?.startsWith("image/"))return;if(i.thumbnail_url){this.pendingThumbnails.delete(i.url);return}const r=i.created_at?new Date(i.created_at).getTime():NaN;Number.isFinite(r)&&Date.now()-r<_n?this.pendingThumbnails.set(i.url,i.id):this.pendingThumbnails.delete(i.url)}watchThumbnail(i,r){const a=this.pendingThumbnails.get(i);if(!a)return()=>{};const l=this.thumbWatchers.get(a);if(l)return l.listeners.add(r),()=>l.listeners.delete(r);const n={listeners:new Set([r]),cancelled:!1};return this.thumbWatchers.set(a,n),this.pollThumbnail(a,i,n),()=>{n.listeners.delete(r),n.listeners.size===0&&(n.cancelled=!0,this.thumbWatchers.delete(a))}}async pollThumbnail(i,r,a){for(let l=0;l<Mr;l+=1){if(await new Promise(c=>setTimeout(c,$r)),a.cancelled)return;let n;try{const c=await this.api.files.filesDetail({id:i,project_id:this.projectId});c.ok&&!c.error&&(n=c.data.file?.thumbnail_url)}catch{}if(a.cancelled)return;if(n){this.pendingThumbnails.delete(r),this.thumbWatchers.delete(i),a.listeners.forEach(c=>c(n));return}}this.thumbWatchers.delete(i),this.pendingThumbnails.delete(r)}mapFolder(i,r){return{id:i.id??"",name:i.name??"",folderId:i.parent_id??this.normalizeFolderId(r)??this.rootId,isFolder:!0,date:i.created_at,lastEdited:i.updated_at,selected:!1}}mapPagination(i,r){const a=i?.limit??r,l=i?.offset??0,n=i?.total??0,c=a>0?Math.floor(l/a)+1:1,m=a>0?Math.ceil(n/a):0;return{page:c,limit:a,total:n,totalPages:m,hasNext:c<m,hasPrev:c>1}}normalizeFolderId(i){if(!(!i||i===this.rootId))return i}assertOk(i){if(i.ok&&!i.error)return;const{__:r}=this.i18n,a=i.error?.error,l=fn(a?.code,i.status);throw new ft(a?.message||r("Unknown error"),l,i.status)}static isNotFound(i){return i instanceof ft&&(i.code==="FileNotFound"||i.code==="FolderNotFound")}static toErrorInfo(i){return i instanceof ft||i instanceof Error?i:{message:String(i),raw:i}}};function Vr({storageProvider:e,projectId:i,restApi:r,restApiV2:a,i18n:l,pathPostfix:n,appConfig:c,isStandalone:m,onIndexingStateChange:f}){const _=c?.fileManager,k=_?{..._,enablePagination:_.enablePagination===!1?!!_.clientSidePaging:_.enablePagination}:void 0,b=!!a&&s.isFileManagerV2Enabled(c),h=e||(b&&a?new kn({projectId:i,restApi:a,i18n:l,appConfig:c,isStandalone:m,onIndexingStateChange:f}):new mn({projectId:i,restApi:r,i18n:l,pathPostfix:n,appConfig:c,isStandalone:m})),y=h.pathMode?new yt.ne(h,h.rootId??"",yt._,h.trashPath,!0):null;return{storageProvider:h,pathProxy:y,dataProvider:new yt.Z(y??h,k,{...h,trashPath:h.pathMode?"trash":h.trashPath,rootId:h.pathMode?"":h.rootId??""},{fetchWithProxy:(x,E)=>De.fetchWithResourceProxy(x,{config:c,standalone:m,intent:"downloadBlob",init:E})}),usesBuiltInStorage:!e}}function Wo(e){const i=String(e??"").split(";")[0].trim();if(!i)return"";const r=i.toLowerCase(),a=r.indexOf("/");if(a===-1)return r;const l=r.slice(a+1);return l==="svg+xml"?"svg":l}var Ur=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),fi=({onChange:e,value:i,validateStatus:r,placeholder:a,disabled:l,name:n,elementSettings:c,imageInfo:m,previewReloadSignal:f,onRemotePreviewValidate:_})=>{const k=s.useCurrentUser(),b=s.useProjectData(),h=s.useAppConfig(),y=s.useIsStandalone(),{__:x}=s.useI18n(),E=s.useSendPostMessage(),{openImagePicker:w}=s.useImagePicker(),I=s.useStorageProvider(),A=s.useRestClient(),v=b?.id!==void 0?String(b?.id):"",P=k?.id!=="0"?String(k.id):"",{dataProvider:C}=(0,d.useMemo)(()=>Vr({storageProvider:I,projectId:v,restApi:A,i18n:{__:x},pathPostfix:P,appConfig:h,isStandalone:y}),[h,y,v,A,I,P,x]),Y=Pr(),[W]=s.useLazyGetImageInfoQuery(),[F,N]=(0,d.useState)({width:"",height:"",size:""}),[T,J]=(0,d.useState)(!1),[Z,se]=(0,d.useState)(0),[te,ne]=(0,d.useState)(""),_e=(0,d.useRef)(""),le=(0,d.useRef)(f?.counter||0),fe=Ar(),Ae=(0,d.useRef)(""),ce=(0,d.useRef)(""),[$e,Ce]=(0,d.useState)(0),ie=s.usePlanFeatureGate("image_editor"),Be=()=>{Ae.current&&(URL.revokeObjectURL(Ae.current),Ae.current="")};(0,d.useEffect)(()=>{if(!i){N({width:"",height:"",size:"",format:""}),_e.current="",ne(""),Be();return}if(i.startsWith("data:")||i.startsWith("blob:")){Be(),_e.current=i,ne(i),N({width:"",height:"",size:"",format:""});return}const Q=kt(i);ce.current=Q;const q=ko(Q),z=new AbortController;let G=!1;const re=async he=>{Be();const Pe=$e?en(he):he;_e.current=Pe,ne(Pe);try{const{data:ye}=await W(Q);return G||!ye?!1:(N({width:ye?.width,height:ye?.height,size:ye?.fileSize!=null?(ye.fileSize/1024).toFixed(0):"",format:Wo(ye?.format)}),!0)}catch{return!1}},ke=async()=>{const he=await fe.resolve(q,z.signal,Y);if(G)return;const{width:Pe,height:ye}=await vr(he);if(G)return;Be();const V=URL.createObjectURL(he);Ae.current=V,_e.current=V,ne(V),N({width:Pe,height:ye,size:(he.size/1024).toFixed(0),format:Wo(he.type)})};return(async()=>{try{if(!y){const he=await Cr(C,Q);if(he?.previewUrl&&await re(he.previewUrl))return}await ke()}catch{G||(Be(),_e.current="",ne(""),N({width:"",height:"",size:"",format:""}))}})(),()=>{G=!0,z.abort()}},[i,C,Y,W,y,fe,$e]);const ae=(0,d.useCallback)(()=>{const Q=ce.current;Q&&fe.abandonKey(ko(Q)),Ce(Date.now())},[fe]);(0,d.useEffect)(()=>{!f?.counter||f.name!==n||f.counter!==le.current&&(le.current=f.counter,ae())},[n,f,ae]),(0,d.useEffect)(()=>()=>Be(),[]);const oe=async(Q=null)=>{const q=n.startsWith("src"),z=Q||(q?s.MODALS.UPLOAD_IMAGE_MODAL:s.MODALS.UPLOAD_BACKGROUND_MODAL),G=kt(i||""),re=await w({kind:q?"img":"background",currentUrl:Uo(G)?"":G,entryModal:z});if(!re?.url)return;const ke=G===kt(re.url);(!ke||re.url!==i)&&e(re.url),re.meta?.mode==="save"&&ke&&(ae(),q&&E({operation:s.EVENT_TYPES.SANDBOX_IMAGE_RESET,url:String(re.url)}))},me=[{label:x("Upload"),key:"Upload",onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:s.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];h.imageCenterStockEnabled&&me.push({label:x("Stock"),key:"Stock",onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_STOCK:s.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),h.imageCenterGifEnabled&&me.push({label:x("GIF"),key:"GIF",onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_GIF:s.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),h.elementAIimageEnabled&&me.push({label:x("AI"),key:"AI",onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_AI:s.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const de=()=>{J(!1)};return(0,t.jsxs)("div",{className:(0,Ve.default)("upload-bg-image",{"upload-bg-image_disabled":l}),children:[i?(0,t.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:Q=>{Q.target?.closest(".upload-bg-image__edit")||Q.target?.closest(".upload-bg-image__edit-menu")||Q.target?.closest(".upload-bg-image__menu")||Q.target?.closest(".inputGroup")||oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:s.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>h.imagePathDropdownEnabled?(0,t.jsx)("div",{className:"inputGroup",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"Image",component:o.icons$Image,size:20,strokeWidth:h.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:a,name:n,disabled:l,className:"upload-bg-image__input"})}):(0,t.jsx)(t.Fragment,{}),classNames:{root:"upload-bg-image__dropdown-overlay"},styles:{root:{top:32,marginTop:"8px",width:347,left:0}},trigger:["hover"],placement:"bottom",getPopupContainer:Q=>Q.closest(".upload-bg-image__inner-wrap"),children:(0,t.jsxs)("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"},children:[(0,t.jsx)("div",{className:"upload-bg-image__uploader",children:(0,t.jsx)("div",{className:"upload-bg-image__uploader-content",children:(0,t.jsxs)("div",{className:"upload-bg-image__uploader-content-inner",children:[(0,t.jsx)("div",{className:"upload-bg-image__uploader-img-wrap",children:te?(0,t.jsx)("img",{className:"upload-bg-image__uploader-img",src:te,alt:"",onLoad:()=>{_&&Ur(kt(i||""))&&_("success")},onError:()=>{const Q=ce.current,q=kt(te||""),z=kt(Q||"");if(Q&&q!==z){_e.current=Q,ne(Q);return}_&&Ur(z)&&_("error")}}):(0,t.jsx)("div",{className:"upload-bg-image__uploader-img-placeholder","aria-hidden":!0})}),(0,t.jsx)("div",{className:"upload-bg-image__uploader-icons-wrap",children:(0,t.jsx)("div",{className:"upload-bg-image__uploader-content"})})]})})}),F.width&&F.height?(0,t.jsxs)("div",{className:"image-size",children:[F.width," × ",F.height,!!c&&(c.type===s.ELEMENT_TYPES.IMG||c.type===s.ELEMENT_TYPES.CAROUSEL)&&" → "+m.renderedWidth+" × "+m.renderedHeight,(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsxs)("span",{children:[F.size," ",x("kB")]}),F.format&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsx)("span",{className:"image-size-format",children:F.format})]})]}):(0,t.jsx)(o.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:a})]})}),(0,t.jsx)("div",{style:{flexGrow:1}}),F.format!=="gif"&&h.imageCenterEditorEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:x("Edit"),children:(0,t.jsx)(o.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,t.jsx)(s.EmIcons,{icon:"Edit",component:o.icons$Edit,size:16,strokeWidth:h.iconStrokeWidth,onClick:()=>{ie.isLocked?(J(!0),se(s.FEATURE_UPSELL_SLIDE.image_editor)):oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_EDIT:s.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT)}})})}),(0,t.jsx)(o.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:me},classNames:{root:"upload-bg-image__menu"},children:(0,t.jsx)(o.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,t.jsx)(s.EmIcons,{size:16,strokeWidth:h.iconStrokeWidth,icon:"SyncOutlined",component:o.icons$SyncOutlined,onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:s.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):x("Upload")})},"Actions")]}):(0,t.jsx)(o.ui_kit$Button,{type:"default",block:!0,onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:s.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,t.jsx)(s.EmIcons,{icon:"Image",component:o.icons$Image,size:16,strokeWidth:h.iconStrokeWidth}),children:x("Add image")}),(0,t.jsx)(s.PlanUpgradePrompt,{open:T,onCancel:de,initialSlide:Z})]})};fi.propTypes={};var En=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),Bn=(e,i,r)=>i||(r?.type===s.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Hr=e=>Array.isArray(e)?e.join("_"):e,Ot=({form:e,label:i,name:r,watchPath:a,disabled:l=!1,elementSettings:n,previewReloadSignal:c=void 0})=>{const{token:m}=(0,o.ui_kit$useToken)(),[f,_]=(0,d.useState)("success"),k=(0,d.useMemo)(()=>({marginBottom:m.formItemMarginBottomXS}),[m.formItemMarginBottomXS]),b=o.ui_kit$Form.useWatch(Bn(r,a,n),e);return(0,d.useEffect)(()=>{if(!b){_("");return}if(typeof b=="string"&&(b.startsWith("data:")||b.startsWith("blob:"))){_("success");return}if(En(b)){_("validating");return}_("success")},[b]),(0,t.jsx)(o.ui_kit$Form.Item,{name:r,validateStatus:f,style:k,children:(0,t.jsx)(fi,{validateStatus:f,placeholder:i,name:Hr(r),disabled:l,elementSettings:n,imageInfo:n?.type===s.ELEMENT_TYPES.CAROUSEL?n?.carouselImages?.[Hr(r).split("_")[1]]:n,previewReloadSignal:c,onRemotePreviewValidate:_})})};Ot.propTypes={label:g.default.string.isRequired,name:g.default.oneOfType([g.default.string,g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number]))]).isRequired,watchPath:g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number])),tooltipTitle:g.default.string,disabled:g.default.bool,previewReloadSignal:g.default.shape({name:g.default.string,counter:g.default.number}),form:g.default.shape({getFieldValue:g.default.func.isRequired}).isRequired},Ot.defaulProps={disabled:!1,previewReloadSignal:null};var Rt=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:r,elementSettings:a,namePrefix:l="",typeOfForm:n="desktop"})=>{const c=s.useSendPostMessage(),m=n==="mobile",f=m?"mobileBorderRadius":"borderRadius",_=m?"mobileBorderRadiusAll":"borderRadiusAll",k=m?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",b=m?"mobileBorderRadiusTopRight":"borderRadiusTopRight",h=m?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",y=m?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",x=m?H.MOBILE_BORDER_RADIUS_POSITION:H.BORDER_RADIUS_POSITION,E=()=>{const w=e.getFieldsValue(!0);let I;i?(e.setFieldsValue({[k]:w[_]||null,[y]:w[_]||null,[b]:w[_]||null,[h]:w[_]||null}),I={[f]:{[x[k]]:w[_]||0,[x[y]]:w[_]||0,[x[b]]:w[_]||0,[x[h]]:w[_]||0}}):w[k]===w[y]&&w[k]===w[b]&&w[k]===w[h]?(e.setFieldsValue({[_]:w[k]}),I={[f]:{[x[_]]:w[k]}}):(e.setFieldsValue({[k]:null,[y]:null,[b]:null,[h]:null}),I={[f]:{[x[_]]:0,[x[k]]:0,[x[y]]:0,[x[b]]:0,[x[h]]:0}});const A=m?{mobileBorderRadius:{all:w.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${l}${f}`]:{...a[`${l}${f}`],...I[`${l}${f}`]}};c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:A}),r(v=>!v)};return(0,t.jsx)(o.ui_kit$FormBorderRadiusInputs,{namePrefix:l,typeOfForm:n,oneBorderRadiusValue:i,onToggle:E,borderRadiusIcon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"BorderRadius",component:o.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};Rt.displayName="SelectedElementFormBorderRadius";var Tn="em-mob-text_align-",Sn=({value:e,onChange:i,onSync:r,fieldName:a,...l})=>{const n=(typeof e=="object"?e?.value:e)??"",c=m=>{const f={classNamePrefix:Tn,value:m};i?.(f),r?.({[a]:f})};return(0,t.jsx)(o.ui_kit$FormAlignControl,{value:n,onChange:c,...l})},zt=({form:e,elementSettings:i,imgParent:r=!1,name:a="align",tooltipTitle:l,typeOfForm:n="desktop"})=>{const c=s.useSendPostMessage(),m=s.useAppConfig(),f=n==="mobile",_=f?"mobileAlign":a;if(f){const k=b=>{c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:b})};return(0,t.jsx)(o.ui_kit$Form.Item,{name:_,children:(0,t.jsx)(Sn,{fieldName:_,onSync:k,disabled:r&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:l})})}return(0,t.jsx)(o.ui_kit$Form.Item,{name:_,children:(0,t.jsx)(o.ui_kit$FormAlignControl,{disabled:r&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:l})})},Vt=({form:e,elementSettings:i,tooltipTitle:r,disabled:a=!1,isNewIconType:l=!1,typeOfForm:n="desktop"})=>{const c=s.useSendPostMessage(),m=s.useAppConfig(),f=n==="mobile",_=f?"mobileVerticalAlign":"valign",k=b=>{e.setFieldsValue({[_]:b}),f||c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[_]:b}})};return(0,t.jsx)(o.ui_kit$Form.Item,{name:_,children:(0,t.jsx)(o.ui_kit$FormVerticalAlignControl,{...!f&&{value:i.valign,onChange:k},disabled:a,isNewIconType:l,strokeWidth:m.iconStrokeWidth})})},yn=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],Rn=({form:e,elementSettings:i,enableSwitch:r,usedColors:a,withoutShadowLabel:l})=>{const n=s.useSendPostMessage(),c=i.mobileBoxShadow,[m,f]=(0,d.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),_=o.ui_kit$Form.useWatch(yn,e);(0,d.useEffect)(()=>{if(!_)return;const[b,h,y,x,E,w]=_;(b===0||b===void 0||b===null)&&(h===0||h===void 0||h===null)&&(y===0||y===void 0||y===null)&&(x===0||x===void 0||x===null)&&(E===""||E===void 0||E===null)&&(w===!1||w===void 0)||f(!1)},[_]);const k=()=>{f(b=>!b),e.setFieldsValue({mobileBoxShadowHOffset:m?"":0,mobileBoxShadowVOffset:m?"":0,mobileBoxShadowBlurRadius:m?"":0,mobileBoxShadowSpreadRadius:m?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),n({operation:s.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,t.jsxs)(t.Fragment,{children:[r&&(0,t.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,t.jsx)(o.ui_kit$Switch,{id:"without-shadow",label:l,labelSize:"small",size:"small",checked:m,onChange:k})}),(0,t.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,t.jsx)(o.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:a})]})},It=({typeOfForm:e="desktop",form:i,elementSettings:r,enableSwitch:a=!0})=>{const{__:l}=s.useI18n(),n=s.useSelector(s.selectEmailSettings).usedColors;return e==="mobile"&&i&&r?(0,t.jsx)(Rn,{form:i,elementSettings:r,enableSwitch:a,usedColors:n,withoutShadowLabel:l("Without shadow")}):(0,t.jsx)(o.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:n})};It.displayName="SelectedElementFormBoxShadow";var Ct=({form:e,elementSettings:i,directionControl:r})=>{const{__:a}=s.useI18n();return(0,t.jsx)(o.ui_kit$FormDisplayControl,{directionControl:r,className:"selected-element-form-show",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"show",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$Radio.Group,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Radio.Button,{value:"all",children:a("Both")}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:a("Desktop"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"desktop",children:(0,t.jsx)(s.EmIcons,{icon:"DesktopOutlined",component:o.icons$DesktopOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:a("Mobile"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"mobile",children:(0,t.jsx)(s.EmIcons,{icon:"MobileOutlined",component:o.icons$MobileOutlined})})})]})})})})},gi=({form:e,elementSettings:i,handleChangeValues:r})=>{const{__:a}=s.useI18n(),l=(0,d.useRef)(),{token:n}=(0,o.ui_kit$useToken)(),[c,m]=(0,d.useState)(!1),[f,_]=(0,d.useState)(!1),[k,b]=(0,d.useState)(!1),[h,y]=(0,d.useState)(!1),[x,E]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let N=new URL("https://emailmaker.ru/?"+i.countdown);m(N.searchParams.get("font1").endsWith("-b")||N.searchParams.get("font1").endsWith("-bi")),_(N.searchParams.get("font1").endsWith("-i")||N.searchParams.get("font1").endsWith("-bi")),b(N.searchParams.get("font2").endsWith("-b")||N.searchParams.get("font2").endsWith("-bi")),y(N.searchParams.get("font2").endsWith("-i")||N.searchParams.get("font2").endsWith("-bi")),E(N.searchParams.get("tp")==="true")},[i]);const w=[{value:"-12",label:a("-12:00 Apia")},{value:"-11",label:a("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:a("-10:00 Honolulu, Anchorage")},{value:"-9",label:a("-9:00 Anchorage, Yukon")},{value:"-8",label:a("-8:00 Los Angeles, Vancouver")},{value:"-7",label:a("-7:00 Denver, Phoenix")},{value:"-6",label:a("-6:00 Mexico City, Guadalajara")},{value:"-5",label:a("-5:00 New York, Toronto, Havana")},{value:"-4",label:a("-4:00 Caracas, Santo Domingo")},{value:"-3",label:a("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:a("-2:00 South Georgia, Saint Helena")},{value:"-1",label:a("-1:00 Azores, Cape Verde")},{value:"0",label:a("+0:00 London, Lisbon, Dublin")},{value:"1",label:a("+1:00 Paris, Berlin, Rome")},{value:"2",label:a("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:a("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:a("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:a("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:a("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:a("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:a("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:a("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:a("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:a("+11:00 Honiara, Nuku'alofa, Apia")}],I=[{value:"20",label:a("20 s")},{value:"40",label:a("40 s")},{value:"60",label:a("60 s")}],A=[{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"}],v=N=>N&&N<(0,$t.default)().endOf("day")-864e5,P=N=>{E(N)},C=()=>{const N=!c;e.setFieldValue("countdownNumbersStrong",N),r({countdownNumbersStrong:N}),m(N)},Y=()=>{const N=!f;e.setFieldValue("countdownNumbersItalic",N),r({countdownNumbersItalic:N}),_(N)},W=()=>{const N=!k;e.setFieldValue("countdownLabelsStrong",N),r({countdownLabelsStrong:N}),b(N)},F=()=>{const N=!h;e.setFieldValue("countdownLabelsItalic",N),r({countdownLabelsItalic:N}),y(N)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("End time"),name:"countdownTime",children:(0,t.jsx)(o.ui_kit$DatePicker,{ref:l,format:"MM/DD/YYYY HH:mm",disabledDate:v,showTime:!0,placement:"bottomRight",getPopupContainer:N=>{const T=N?.closest(".blocks-app");return T||(N?.ownerDocument?.body??document.body)},allowClear:!1,allowEmpty:!1})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("Time zone"),name:"countdownTimeZone",style:{width:"100%"},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:a("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:w.map(N=>(0,t.jsx)(o.ui_kit$Select.Option,{value:N.value,children:N.label},N.value))})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("Background color"),name:"countdownBackgroundColor",className:"countdown-color",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:a("Background color"),usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29},children:(0,t.jsx)(o.ui_kit$Switch,{id:"countdownTransparency",label:a("Transparency"),labelSize:"small",size:"small",onChange:P})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:a("Countdown font settings"),compact:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersFont",style:{marginBottom:n.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:A})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:n.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersFontSize",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:12,placeholder:a("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a("Strong"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersStrong",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:C,children:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a("Italic"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersItalic",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":f}),onClick:Y,children:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:a("Time units font settings"),compact:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsFont",style:{marginBottom:n.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:A})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:n.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsFontSize",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:8,placeholder:a("Font size"),addonAfter:"px",prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a("Strong"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsStrong",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k}),onClick:W,children:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a("Italic"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsItalic",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":h}),onClick:F,children:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("Language"),name:"countdownLanguage",style:{width:"100%"},children:(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("Duration"),name:"countdownDuration",style:{width:"100%"},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:I})})})]})]})};gi.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var _i=({form:e,elementSettings:i})=>{const{__:r}=s.useI18n(),{token:a}=(0,o.ui_kit$useToken)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("URL of the video clip."),placement:"right",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:["video","source"],className:"selected-image-form__alt",children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:r("Video URL"),prefix:(0,t.jsx)(s.EmIcons,{icon:"VideoCameraOutlined",component:o.icons$VideoCameraOutlined})})})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("Play button"),name:["video","playButton"],style:{width:"100%",marginBottom:a.formItemMarginBottomMD+4},children:(0,t.jsxs)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:[(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_red",children:[(0,t.jsx)(s.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined,style:{color:"#FF0000"}})," ",r("Youtube Red")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_black",children:[(0,t.jsx)(s.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined})," ",r("Youtube Black")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_white",children:[(0,t.jsx)(s.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined,style:{color:"#aaa"}})," ",r("Youtube White")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"vimeo",children:[(0,t.jsx)(s.EmIcons,{icon:"Vimeo",component:o.icons$Vimeo})," ",r("Vimeo")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"white_circle",children:[(0,t.jsx)(s.EmIcons,{icon:"PlayCircleOutlined",component:o.icons$PlayCircleOutlined,style:{color:"#aaa"}})," ",r("White circle")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"black_circle",children:[(0,t.jsx)(s.EmIcons,{icon:"PlayCircleOutlined",component:o.icons$PlayCircleOutlined})," ",r("Black circle")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"white_circle_outlined",children:[(0,t.jsx)(s.EmIcons,{icon:"RightCircleOutlined",component:o.icons$RightCircleOutlined,style:{color:"#aaa"}})," ",r("White circle outlined")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"black_circle_outlined",children:[(0,t.jsx)(s.EmIcons,{icon:"RightCircleOutlined",component:o.icons$RightCircleOutlined})," ",r("Black circle outlined")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"none",children:[" ",r("Without button")]})]})})]})};_i.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var wn={marginBottom:10},Pt=()=>{const{__:e}=s.useI18n();return(0,t.jsx)(o.ui_kit$Row,{gutter:20,style:wn,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"ampShow",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$Radio.Group,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Radio.Button,{value:"all",children:e("Both")}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:e("AMP"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"amp",children:"AMP"})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:e("HTML"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"html",children:"HTML"})})]})})})})})},{Option:xi}=o.ui_kit$Select,{mobileBorderRadiusAll:jn,mobileBorderRadiusTopLeft:ki,mobileBorderRadiusBottomLeft:Ei,mobileBorderRadiusTopRight:Bi,mobileBorderRadiusBottomRight:Ti,borderRadiusBottomRight:Si,borderRadiusTopRight:yi,borderRadiusBottomLeft:Ri,borderRadiusTopLeft:wi,alt:vn,src:In,title:Cn,link:no,borderRadiusAll:Wr,imgReplacer:Pn,expanded:An}={link:"link",borderRadiusBottomRight:"borderRadiusBottomRight",borderRadiusTopRight:"borderRadiusTopRight",borderRadiusBottomLeft:"borderRadiusBottomLeft",borderRadiusTopLeft:"borderRadiusTopLeft",mobileBorderRadiusAll:"mobileBorderRadiusAll",mobileBorderRadiusTopLeft:"mobileBorderRadiusTopLeft",mobileBorderRadiusBottomLeft:"mobileBorderRadiusBottomLeft",mobileBorderRadiusTopRight:"mobileBorderRadiusTopRight",mobileBorderRadiusBottomRight:"mobileBorderRadiusBottomRight",alt:"alt",imgReplacer:"imgReplacer",src:"src",title:"title",borderRadiusAll:"borderRadiusAll",expanded:"expanded"},eo=({linkProtocol:e})=>{switch(e){case"https://":return(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined});case"mailto:":return(0,t.jsx)(s.EmIcons,{icon:"MailOutlined",component:o.icons$MailOutlined});case"tel:":return(0,t.jsx)(s.EmIcons,{icon:"PhoneOutlined",component:o.icons$PhoneOutlined});case"sms:":return(0,t.jsx)(s.EmIcons,{icon:"CommentOutlined",component:o.icons$CommentOutlined});case"ftp://":return(0,t.jsx)(s.EmIcons,{icon:"FileOutlined",component:o.icons$FileOutlined});case"#":return(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined});default:return(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined})}},Nn=e=>[{value:"https://",label:e("Site")},{value:"mailto:",label:e("E-mail")},{value:"tel:",label:e("Phone")},{value:"sms:",label:e("SMS")},{value:"ftp://",label:e("File")},{value:"#",label:e("Anchor")},{value:"",label:e("Other")}],to=({handleLinkProtocolsChange:e,linkProtocol:i,__:r})=>{const a=d.default.useMemo(()=>Nn(r),[r]);return(0,t.jsx)(o.ui_kit$Select,{style:{width:90,textAlign:"left"},value:i,onChange:e,options:a})},oo=({show:e,__:i,style:r,className:a})=>{const l=d.default.useMemo(()=>({marginBottom:8,...r}),[r]);return e?(0,t.jsx)(o.ui_kit$Alert,{className:a,title:i("Anchor links do not work in Outlook, Gmail, and several other email clients."),type:"warning",showIcon:!0,style:l}):null},ji=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),Ln=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,On=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function io(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const r=i.match(Ln);if(r)i=r[2];else{const a=i.match(On);a&&(i=a[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var zo=(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://":ji(e)?"#":"":i,Gt=(e,i)=>{const r=zo(e,"");return i(r),r},zr=e=>{if(!e||!e.startsWith("mailto:"))return{subject:"",body:"",baseEmail:e||""};try{const i=new URL(e),r=e.split("?")[0];return{subject:i.searchParams.get("subject")||"",body:i.searchParams.get("body")||"",baseEmail:r}}catch{return{subject:"",body:"",baseEmail:e.split("?")[0]}}},vi=(e,i,r)=>{if(!e||!e.startsWith("mailto:"))return e;const a=e.split("?")[0],l=[];return i&&l.push(`subject=${encodeURIComponent(i)}`),r&&l.push(`body=${encodeURIComponent(r)}`),l.length>0?`${a}?${l.join("&")}`:a},u=e=>e||(e===0?"0":""),pt=e=>e&&e!=="auto"?e:e===0?"0":"",Gr=(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 Ii(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 r={};e.carouselImages?.map((a,l)=>(Object.keys(a).forEach(n=>{r[n+"_"+l]=a[n]}),!0)),i.images=r}if(e.sections?.length>0){const r=[];e.sections?.map((a,l)=>(r.push({[`expanded_${l}`]:a.expanded}),!0)),i.sections=r}return i}function Yr(e,i,r){const a=r.hasOwnProperty("images"),l=r.hasOwnProperty("sections"),n=Object.keys(a?r.images:l?r.sections:r)[0],c=a?r.images:l?r.sections:r;let m={};const f=i.getFieldsValue(!0);switch(n.split("_")[0]){case Cn:case In:case vn:case Pn:if(a){const k=[...e.carouselImages];k[n.split("_")[1]][n.split("_")[0]]=c[n],m={carouselImages:k}}else m=c;break;case An:if(l){const k=[...e.sections];k[n.split("_")[1]][n.split("_")[0]]=c[n],m={sections:k}}break;case no:let _=io(c[n]);e.type===s.ELEMENT_TYPES.CAROUSEL?(m.carouselImages=e.carouselImages,a?(i.setFieldValue(["images",[no+"_"+n.split("_")[1]]],_),m.carouselImages[n.split("_")[1]].link=_,m.link="",i.setFieldValue(no,"")):(e.carouselImages.forEach((k,b)=>{i.setFieldValue(["images",no+"_"+b],_),m.carouselImages[b].link=_,m.link=_}),i.setFieldValue(no,_))):(i.setFieldValue(no,_),m.link=_);break;case Wr:m={borderRadius:{...e.borderRadius,[H.BORDER_RADIUS_POSITION[wi]]:f[wi],[H.BORDER_RADIUS_POSITION[Ri]]:f[Ri],[H.BORDER_RADIUS_POSITION[yi]]:f[yi],[H.BORDER_RADIUS_POSITION[Si]]:f[Si],[H.BORDER_RADIUS_POSITION[n]]:+c[n]}};break;case wi:case Ri:case yi:case Si:m={borderRadius:{...e.borderRadius,[H.BORDER_RADIUS_POSITION[Wr]]:null,[H.BORDER_RADIUS_POSITION[n]]:+c[n]}};break;case jn:case ki:case Ei:case Bi:case Ti:m={mobileBorderRadius:{...e.mobileBorderRadius,[H.MOBILE_BORDER_RADIUS_POSITION[ki]]:f[ki],[H.MOBILE_BORDER_RADIUS_POSITION[Ei]]:f[Ei],[H.MOBILE_BORDER_RADIUS_POSITION[Bi]]:f[Bi],[H.MOBILE_BORDER_RADIUS_POSITION[Ti]]:f[Ti],[H.MOBILE_BORDER_RADIUS_POSITION[n]]:c[n],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[n]+"-"}};break;default:m=c}return{...e,...m}}var Mt=(0,t.jsxs)(o.ui_kit$Select,{className:"select-after",children:[(0,t.jsx)(xi,{value:"px",children:"px"}),(0,t.jsx)(xi,{value:"%",children:"%"})]}),Fn=(0,t.jsx)(o.ui_kit$Select,{className:"select-after",children:(0,t.jsx)(xi,{value:"px",children:"px"})}),Xr=({form:e,elementSettings:i,boxShadow:r,bordersShow:a,borderRadiusShow:l,boxShadowShow:n,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,hasLink:f,hasAlt:_,hasTitle:k,isOpenSrcReplacer:b,mergeTagItems:h,mergeMenuOpen:y,setMergeMenuOpen:x,cascaderRef:E,linkInputRef:w,linkButtonRef:I,altInputRef:A,altButtonRef:v,titleInputRef:P,titleButtonRef:C,srcReplacerInputRef:Y,srcReplacerButtonRef:W,linkProtocol:F,handleLinkProtocolsChange:N,linkButtonHandler:T,linkInputHandler:J,altButtonHandler:Z,altInputHandler:se,titleButtonHandler:te,titleInputHandler:ne,srcReplacerButtonHandler:_e,srcInputHandler:le,handleSelect:fe,onChange:Ae,filter:ce,renderSearchOption:$e,handleChangeValues:Ce,toggleShowBorderHandler:ie,toggleShowBorderRadiusHandler:Be,toggleShowBoxShadowHandler:ae})=>{const{__:oe}=s.useI18n(),{token:me}=(0,o.ui_kit$useToken)(),de=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:i,imgParent:!0})}),de.formImageFieldVerticalAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,align:"right",children:(0,t.jsx)(Vt,{form:e,elementSettings:i})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(gi,{form:e,elementSettings:i,handleChangeValues:Ce}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),de.mergeTagsShow&&h&&(0,t.jsx)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(s.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:y?"none":"inline-flex"},onClick:()=>x(!0),children:oe("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:E,classNames:{popup:{root:"merge-tags"}},options:h,placeholder:oe("Start typing the title"),showSearch:{filter:ce,render:$e},spellCheck:"false",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),onChange:Ae,style:{display:y?"block":"none"},open:y,onKeyDown:Q=>{Q.key==="Escape"&&x(!1)}})]})}),i.type==="video"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_i,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Ot,{form:e,label:oe("Image path"),name:"src",placeholder:oe("Image path"),elementSettings:i,tooltipTitle:""})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,style:{marginBottom:!_&&!f&&!k&&!b?me.formItemMarginBottomMD+4:me.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:_||oe("Alternative text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),onClick:Z,ref:v,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),de.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:k||oe("Tooltip text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),onClick:te,ref:C,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:f||oe("Hyperlink URL"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!f}),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:T,ref:I})}),de.formImageFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:oe("Image replacer"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":b}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:_e,ref:W})})]}),(!!f||!!_||!!k||!!b)&&(0,t.jsxs)("div",{style:{marginBottom:me.formItemMarginBottomMD+4},children:[!!f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oo,{show:F==="#",__:oe,style:{marginBottom:me.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:me.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:F,handleLinkProtocolsChange:N,__:oe}),placeholder:oe("Hyperlink URL"),allowClear:!0,ref:w,onChange:J,onSelect:fe,prefix:(0,t.jsx)(eo,{linkProtocol:F})})})})]}),!!_&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:me.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:oe("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:se,ref:A,onSelect:fe})})}),de.formFieldImageTitleEnabled&&!!k&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:me.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:oe("Enter the title of the image"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:ne,ref:P,onSelect:fe})})}),!!b&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Image src"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:me.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:oe("Code that will replace the image `src`"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:oe("Image src")}),onChange:le,ref:Y,onSelect:fe})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Size"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:de.formImageFieldHeightEnabled,showMinMax:!1,gutter:me.marginSM,rowStyle:{marginBottom:de.formImageFieldHeightEnabled?4:24},labels:{width:oe("Width"),height:oe("Height"),minWidth:oe("Minimum width"),maxWidth:oe("Maximum width")}})}),de.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Borders"),collapsible:!0,open:a,onToggle:ie,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),de.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Border radius"),collapsible:!0,open:l,onToggle:Be,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,elementSettings:i})}),de.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Box shadow"),collapsible:!0,open:n,onToggle:ae,dividerTop:!0,children:(0,t.jsx)(It,{})}),de.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),de.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Xr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,isOpenSrcReplacer:g.default.oneOfType([g.default.bool,g.default.number]),mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,srcReplacerInputRef:g.default.object,srcReplacerButtonRef:g.default.object,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,linkButtonHandler:g.default.func,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,srcReplacerButtonHandler:g.default.func,srcInputHandler:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,handleChangeValues:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func};var Yt=({form:e,name:i,elementSettings:r,isPicture:a,tooltipTitle:l})=>{const{__:n}=s.useI18n(),c=s.useSendPostMessage(),m=(0,d.useRef)(),[f,_]=(0,d.useState)(r[i]?.value==="auto"),{token:k}=(0,o.ui_kit$useToken)(),[b,h]=(0,d.useState)(""),y=E=>{m.current.value=null,e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),_(w=>!w),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:f?null:"auto",dim:""}}})},x=E=>{_(!1),h(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:l,placement:"bottom",children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{ref:m,min:0,max:b,placeholder:n("Width"),onChange:x,prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:Mt})})})})}),!a&&(0,t.jsx)(o.ui_kit$Switch,{id:"auto-width",label:n("Auto"),labelSize:"small",size:"small",checked:f,onChange:y})]})};Yt.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var ro=({form:e,name:i,elementSettings:r,isPicture:a,tooltipTitle:l})=>{const{__:n}=s.useI18n(),c=s.useSendPostMessage(),m=(0,d.useRef)(),[f,_]=(0,d.useState)(r.mobileHeight?.value==="auto"),{token:k}=(0,o.ui_kit$useToken)(),b=y=>{m.current.value=null,e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),_(x=>!x),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:f?null:"auto",dim:""}}})},h=y=>{_(!1)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:l,placement:"bottom",children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{ref:m,min:0,placeholder:n("Height"),onChange:h,prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!a&&(0,t.jsx)(o.ui_kit$Switch,{id:"auto-height",label:n("Auto"),labelSize:"small",size:"small",checked:f,onChange:b})]})};ro.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var Kr=({form:e,elementSettings:i,boxShadow:r,mobileBordersShow:a,mobileBorderRadiusShow:l,mobileBoxShadowShow:n,mobileSizeShow:c,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:f,hasLink:_,hasAlt:k,hasTitle:b,linkInputRef:h,linkButtonRef:y,altInputRef:x,altButtonRef:E,titleInputRef:w,titleButtonRef:I,linkInputHandler:A,altButtonHandler:v,altInputHandler:P,titleButtonHandler:C,titleInputHandler:Y,linkButtonHandler:W,toggleShowMobileBorderHandler:F,toggleShowMobileBorderRadiusHandler:N,toggleShowMobileBoxShadowHandler:T,toggleShowMobileSizeHandler:J})=>{const{__:Z}=s.useI18n(),{token:se}=(0,o.ui_kit$useToken)(),te=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:30,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),te.formImageFieldVerticalAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,align:"right",children:(0,t.jsx)(Vt,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(gi,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),i.type==="video"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_i,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Ot,{form:e,label:Z("Image path"),name:"src",placeholder:Z("Image path"),elementSettings:i,tooltipTitle:""})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,style:{marginBottom:!k&&!_&&!b?se.formItemMarginBottomMD+4:se.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:k||Z("Alternative text"),placement:"bottom",getPopupContainer:ne=>ne.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),onClick:v,ref:E,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),te.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:b||Z("Tooltip text"),placement:"bottom",getPopupContainer:ne=>ne.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:C,ref:I,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:_||Z("Hyperlink URL"),placement:"bottom",getPopupContainer:ne=>ne.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:W,ref:y})})]}),(!!_||!!k||!!b)&&(0,t.jsxs)("div",{style:{marginBottom:se.formItemMarginBottomMD+4},children:[!!_&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Z("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:se.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{ref:h,allowClear:!0,placeholder:Z("Hyperlink URL"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined}),onChange:A})})}),!!k&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Z("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:se.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Z("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:P,ref:x})})}),te.formFieldImageTitleEnabled&&!!b&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Z("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:se.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Z("Tooltip text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:Y,ref:w})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Size"),collapsible:!0,open:c,onToggle:J,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:24},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:Z("Width")})}),te.formImageFieldHeightEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:Z("Height")})})]})}),te.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Borders"),collapsible:!0,open:a,onToggle:F,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),te.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Border radius"),collapsible:!0,open:l,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:m,setOneBorderRadiusValue:f,elementSettings:i,typeOfForm:"mobile"})}),te.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Box shadow"),collapsible:!0,open:n,onToggle:T,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile"})}),te.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),te.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Kr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,linkButtonHandler:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func};var $n=e=>typeof e=="object"&&e!==null?e.path:void 0;function Dt(){const e=(0,d.useRef)(!1),i=(0,d.useRef)(null),r=(0,d.useCallback)(l=>{e.current=!l},[]),a=(0,d.useCallback)((l,n)=>{const c=JSON.stringify($n(l)??null);return i.current!==c&&(i.current=c,e.current=!1),n?e.current:(e.current=!1,!1)},[]);return(0,d.useMemo)(()=>({markBorderToggled:r,isStaleBorderSnapshot:a}),[r,a])}function co(e){const i=(0,d.useRef)(null),r=(0,d.useRef)(e);return r.current=e,{remember:(0,d.useCallback)(a=>{i.current=a},[]),fillFields:(0,d.useCallback)((a,l)=>{r.current!==i.current&&a.setFieldsValue(l)},[])}}var Mn=1e3,Dn=2e4,qr="https://useblocks.io/app/",Jr=({elementSettings:e})=>{const{__:i}=s.useI18n(),[r]=o.ui_kit$Form.useForm(),a=Dt(),l=Dt();let n=s.useDispatch();const c=s.useAppConfig(),m=s.useEditorProjectId(),f=s.useNotification(),_=s.useSendPostMessage(),k=s.useSendPostMessageEx(),{openImagePicker:b}=s.useImagePicker(),h=s.useSelector(s.selectEmailViewType),y=s.useSelector(s.selectMobileViewActive),x=s.useCurrentUser(),E=s.useSelector(s.selectIsCodeMode),w=s.useSelector(s.selectCodeModeDirection),[I]=s.useUploadImageMutation(),[A,v]=s.useSendShortLinkMutation(),[P,C]=(0,d.useState)({name:"",counter:0}),Y=(0,d.useRef)(null),W=(0,d.useRef)(null),F=(0,d.useRef)(null),N=(0,d.useRef)(null),T=(0,d.useRef)(null),J=(0,d.useRef)(null),Z=(0,d.useRef)(null),se=(0,d.useRef)(null),te=(0,d.useRef)(null),[ne,_e]=(0,d.useState)({}),[le,fe]=(0,d.useState)(!0),[Ae,ce]=(0,d.useState)(!0),[$e,Ce]=(0,d.useState)(""),[ie,Be]=(0,d.useState)(""),[ae,oe]=(0,d.useState)(""),[me,de]=(0,d.useState)(!1),[Q,q]=(0,d.useState)(!1),[z,G]=(0,d.useState)(!1),[re,ke]=(0,d.useState)(!1),[he,Pe]=(0,d.useState)(!1),[ye,V]=(0,d.useState)(!1),[ee,we]=(0,d.useState)(!1),[je,K]=(0,d.useState)(!1),[ve,Re]=(0,d.useState)("https://"),Le=(0,d.useRef)(!1),Ue=(0,d.useRef)(),Me=e,He=(0,d.useRef)(Me);He.current=Me;const O=(0,d.useCallback)(()=>r.getFieldsValue(!0).video,[r]),[xe,D]=(0,d.useState)(),[ue,ge]=(0,d.useState)(!1),[Oe,Ge]=(0,d.useState)(null),[Ye,Xe]=(0,d.useState)({start:0,end:0}),[R,X]=(0,d.useState)(!1),[j,M]=(0,d.useState)(!1),[Ee,Fe]=(0,d.useState)(!1),[tt,qe]=(0,d.useState)(!1),ct=(0,d.useRef)(void 0),Ze=(0,d.useRef)(null),ut=(0,d.useRef)(null),Bt=tt||Ee||je;(0,d.useEffect)(()=>()=>clearTimeout(ct.current),[]);const B=(0,d.useRef)(null);(0,d.useEffect)(()=>{const L=B.current,Ie=L?.firstElementChild??null;if(!Bt||!L||!Ie)return;const Te=[];for(let ot=L.parentElement;ot;ot=ot.parentElement)getComputedStyle(ot).overflowY!=="visible"&&Te.push(ot);let be=0,Ne="";const Ke=()=>{const ot=L.getBoundingClientRect(),Qe=L.offsetHeight>0?ot.height/L.offsetHeight:1;let ht=Math.max(ot.top,0),lt=Math.min(ot.bottom,window.innerHeight);Te.forEach(Zt=>{const xo=Zt.getBoundingClientRect();ht=Math.max(ht,xo.top),lt=Math.min(lt,xo.bottom)});const gt=(ht-ot.top)/(Qe||1),Nt=Math.max(lt-ht,0)/(Qe||1),vt=`${Math.round(gt)}/${Math.round(Nt)}`;vt!==Ne&&(Ne=vt,Ie.style.top=`${gt}px`,Ie.style.height=`${Nt}px`),be=requestAnimationFrame(Ke)};return Ke(),()=>cancelAnimationFrame(be)},[Bt]);const S=()=>{const L=Ze.current;ut.current=L?.isConnected&&typeof L.selectionStart=="number"?{element:L,start:L.selectionStart,end:L.selectionEnd??L.selectionStart}:null},p=E&&w!=="bottom",$=s.useElementEntityKind();(0,d.useEffect)(()=>{ue&&te.current&&te.current.focus()},[ue]);const U=(L,Ie)=>{const Te=document.getElementById(Ie);if(Te){const be=Ie.substring(Ie.indexOf("selected_image_form_")+20),Ne=Te.value?.substring(0,Ye.start),Ke=Te.value?.substring(Ye.end);_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[be]:Ne+L+Ke}}),r.setFieldValue(be,Ne+L+Ke),Te.focus(),setTimeout(()=>{Te.selectionStart=Ye.start,Te.selectionEnd=Ye.start+L.length},400),X(!0)}},Se=s.useAppConfig().mergeTags;(0,d.useEffect)(()=>{Se?.items?.length&&D(s.mapMargeTags(Se.items,i,(L,Ie)=>{ge(!1),k(s.EVENT_TYPES.SANDBOX_ADD_MERGETAG,L),Ie.stopPropagation(),Ie.preventDefault()}))},[Se,D,i,ge,k]);const pe=(L,Ie)=>{if(ge(!1),L){const Te=Se.syntax.length>1?xe.findIndex(Ne=>Ne.key===Ie[0].key):0,be=Se.syntax[Te].replace("%value%",L[L.length-1]);Oe?.getAttribute("id")==="selected_image_form_title"||Oe?.getAttribute("id")==="selected_image_form_alt"||Oe?.getAttribute("id")==="selected_image_form_link"||Oe?.getAttribute("id")==="selected_image_form_imgReplacer"?U(be,Oe?.getAttribute("id")):(r.setFieldValue("imgReplacer",be),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:be}}))}},ze=(L,Ie)=>Ie.some(Te=>Te.label.toLowerCase().indexOf(L.toLowerCase())>-1),dt=(L,Ie)=>{const Te=Ie.map((be,Ne)=>{const Ke=be.label.split(new RegExp(`(${L})`,"gi"));return(0,t.jsxs)("span",{children:[Ne!==0&&(0,t.jsx)("span",{children:" / "}),Ke.map((ot,Qe)=>ot.toLowerCase()===L.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:ot},Qe):ot)]},be.value)});return(0,t.jsx)("div",{title:Ie.map(be=>be.label).join(" / "),children:Te})},at=s.useRootElement();(0,d.useEffect)(()=>{const L=({target:be})=>{be.closest('[id="merge_tags_wrapper"]')||(Ze.current=be,Ge(be))},Ie=({target:be})=>{!be.closest(".merge-tags")&&!be.closest("#merge_tags_button")&&ge(!1)},Te=new De.Disposable;return Te.addDisposable(s.addWindowListenerFromShadow(at,"focusin",L)),Te.addDisposable(s.addWindowListenerFromShadow(at,"click",Ie)),()=>{Te.dispose()}},[at]);const mt=({target:L})=>{if(L&&!R){const{selectionStart:Ie,selectionEnd:Te}=L;Xe({start:Ie,end:Te})}X(!1)},Et=e.border,Qt=e.mobileBorder,At=Object.keys(Et).find(L=>Et[L]?.width||Et[L]?.style||Et[L]?.color),Tt=Object.keys(Qt).find(L=>Qt[L]?.width||Qt[L]?.style||Qt[L]?.color),st=L=>L&&(L?.width||L?.style||L?.color)?L:"",{remember:jt,fillFields:Ht}=co(e);(0,d.useEffect)(()=>{if(e){e.src!==Ue.current&&(Ue.current=e.src,Le.current=!1);const L=e.boxShadow;if(_e(L),e.link&&Re(zo(e.link,"https://")),Ht(r,{...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:st(e.mobileBorder.all)||!(st(e.mobileBorder.top)||st(e.mobileBorder.bottom)||st(e.mobileBorder.right)||st(e.mobileBorder.left))&&st(e.border.all),mobileBorderTop:st(e.mobileBorder.top)||!st(e.mobileBorder.all)&&st(e.border.top),mobileBorderBottom:st(e.mobileBorder.bottom)||!st(e.mobileBorder.all)&&st(e.border.bottom),mobileBorderRight:st(e.mobileBorder.right)||!st(e.mobileBorder.all)&&st(e.border.right),mobileBorderLeft:st(e.mobileBorder.left)||!st(e.mobileBorder.all)&&st(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:pt(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:pt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:pt(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:pt(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",...Me.video}}),e.countdown){let be=new URL("https://emailmaker.ru/?"+e.countdown),Ne=be.searchParams.get("font1"),Ke=!1,ot=!1;Ne.endsWith("-b")?(Ne=Ne.substring(0,Ne.length-2),Ke=!0):Ne.endsWith("-i")?(Ne=Ne.substring(0,Ne.length-2),ot=!0):Ne.endsWith("-bi")&&(Ne=Ne.substring(0,Ne.length-3),Ke=!0,ot=!0);let Qe=be.searchParams.get("font2"),ht=!1,lt=!1;Qe.endsWith("-b")?(Qe=Qe.substring(0,Qe.length-2),ht=!0):Qe.endsWith("-i")?(Qe=Qe.substring(0,Qe.length-2),lt=!0):Qe.endsWith("-bi")&&(Qe=Qe.substring(0,Qe.length-3),ht=!0,lt=!0),Ht(r,{countdownTime:(0,$t.default)(new Date(Date.parse(be.searchParams.get("time"))+be.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:be.searchParams.get("frames")||20,countdownTimeZone:be.searchParams.get("timezone"),countdownLanguage:be.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+be.searchParams.get("bg"),countdownTransparency:be.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:Ne,countdownNumbersFontSize:be.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+be.searchParams.get("color1"),countdownLabelsFont:Qe,countdownLabelsFontSize:be.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+be.searchParams.get("color2"),countdownNumbersStrong:Ke,countdownNumbersItalic:ot,countdownLabelsStrong:ht,countdownLabelsItalic:lt})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?fe(!1):fe(!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))?ce(!1):ce(!0);const Ie=a.isStaleBorderSnapshot(e,!!At),Te=l.isStaleBorderSnapshot(e,!!Tt);Ie&&r.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Te||Ie&&!Tt)&&r.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),de(be=>At&&!Ie?!0:be),q(be=>At&&!Ie||Tt&&!Te?!0:be),G(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ke(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Pe(!!e.boxShadow),V(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),we(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?Ce(e.link):Ce(Le.current?"...":""),Be(e.alt),oe(e.title),M(e.imgReplacer?.length)}},[r,e,Ht,Me,At,Tt,a,l]),(0,d.useEffect)(()=>{if(Bt)return;const L=ut.current;ut.current=null,!(!L||!L.element.isConnected||L.element.disabled)&&Ze.current===L.element&&(L.element.focus(),L.element.setSelectionRange(L.start,L.end))},[Bt]);const xt=async(L,Ie,Te)=>{const be={};be.user_id=x.id,be.folder=L,Ie&&(Ie=await s.prepareImageForEditorUpload(Ie,c),be.file=Ie),Te&&(be.page_url=Te);const Ne=await I(be);if(Ne.error)f.fromError("IMAGE_UPLOAD_ERROR",Ie,Ne.error,!0);else{const Ke=Kl.extractUploadResult(Ne.data);if(Ke.error)return;if(Ke.file_url)return Ke.file_url}},Wt=(L,Ie)=>new Promise((Te,be)=>{const Ne=new Image,Ke=new Image;Ne.crossOrigin="Anonymous",Ke.crossOrigin="Anonymous";let ot=Ie?2:1;const Qe=()=>{clearTimeout(lt),be(new Error("video preview images are not loaded"))},ht=()=>{ot-=1,ot===0&&(clearTimeout(lt),Te({frame:Ne,button:Ie?Ke:null}))},lt=setTimeout(Qe,Dn);Ne.onload=ht,Ne.onerror=Qe,Ne.src=L,Ie&&(Ke.onload=ht,Ke.onerror=Qe,Ke.src=Ie)}),No=(L,Ie,Te,be)=>{const Ne=document.createElement("canvas"),Ke=Ne.getContext("2d");if(Ne.width=L.width,Ne.height=L.height,Ke.clearRect(0,0,Ne.width,Ne.height),Ke.drawImage(L,0,0,L.width,L.height),!Ie)return Ne;const ot=Math.min(Ne.width,Ne.height);let Qe;if(L.height>L.width)Qe=.3;else{const xo=L.width/L.height;Qe=Math.min(be,.3+(xo-1)/(Te-1)*.1)}const ht=ot*Qe,lt=Ie.width/Ie.height;let gt,Nt;lt>=1?(gt=ht,Nt=ht/lt):(Nt=ht,gt=ht*lt);const vt=(Ne.width-gt)/2,Zt=(Ne.height-Nt)/2;return Ke.drawImage(Ie,vt,Zt,gt,Nt),Ne},Ft=L=>new Promise(Ie=>{L.toBlob(Te=>Ie(Te?new File([Te],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),Lo=async L=>{const Ie=r.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!L||!Ie||Ie==="none"||Ee)){S(),Fe(!0);try{const{frame:Te,button:be}=await Wt(L,`${qr}${Ie}.png`),Ne=await Ft(No(Te,be,2,.4)),Ke=Ne&&await xt(m,Ne);if(!Ke)return;_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:He.current.type,settings:{src:Ke}}),Fo({...He.current,src:Ke,video:O()||He.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{r.setFieldValue("src",Ke)},100)}catch{}finally{Fe(!1)}}},wr=async()=>{const L=O(),Ie=L?.source,Te=L?.playButton;if(!Ie)return;const be=()=>O()?.source!==Ie;S(),qe(!0);try{const Ne=await xt("tmp",null,Ie);if(!Ne||be())return;const{frame:Ke,button:ot}=await Wt(Ne,Te&&Te!=="none"?`${qr}${Te}.png`:null);if(be())return;const Qe=await Ft(No(Ke,ot,2.5,.35)),ht=Qe&&await xt(m,Qe);ht&&!be()&&jr(ht)}catch{}finally{qe(!1)}},Oo=L=>{clearTimeout(ct.current),ct.current=setTimeout(()=>{L()},Mn)},pi=()=>{const L=r.getFieldsValue(!0);let Ie=new URL("https://cdt3.useblocks.io/rndt?"+e.countdown),Te=L.countdownNumbersFont;L.countdownNumbersStrong&&L.countdownNumbersItalic?Te+="-bi":L.countdownNumbersStrong?Te+="-b":L.countdownNumbersItalic&&(Te+="-i");let be=L.countdownLabelsFont;L.countdownLabelsStrong&&L.countdownLabelsItalic?be+="-bi":L.countdownLabelsStrong?be+="-b":L.countdownLabelsItalic&&(be+="-i"),Ie.searchParams.set("time",new Date(L.countdownTime.$d-L.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Ie.searchParams.set("bg",L.countdownBackgroundColor.substring(1)||"#FFFFFF"),Ie.searchParams.set("tp",!!L.countdownTransparency),Ie.searchParams.set("font1",Te),Ie.searchParams.set("size1",L.countdownNumbersFontSize*2||12),Ie.searchParams.set("color1",L.countdownNumbersColor.substring(1)||"#000000"),Ie.searchParams.set("font2",be),Ie.searchParams.set("size2",L.countdownLabelsFontSize*2||8),Ie.searchParams.set("color2",L.countdownLabelsColor.substring(1)||"#959595"),Ie.searchParams.set("spacing",Math.round(L.countdownNumbersFontSize*.4)||5),Ie.searchParams.set("locale",L.countdownLanguage.replace("_","-")),Ie.searchParams.set("timezone",L.countdownTimeZone),Ie.searchParams.set("frames",L.countdownDuration),A({link:JSON.stringify({target:Ie.href})}),S(),K(!0)},Fo=(0,d.useCallback)(L=>{jt(L),n($==="email"?s.setElementSettings$1(L):s.setElementSettings(L))},[n,$,jt]),jr=(0,d.useCallback)((L,Ie)=>{const Te=He.current,be=kt(Te.src||"")===kt(L||"");(!be||L!==Te.src)&&(_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Te.type,settings:{src:L}}),Fo({...Te,src:L,...Te.type==="video"?{video:O()||Te.video}:{},activateSection:null,changeKey:"src"}),r.setFieldValue("src",L)),Ie?.mode==="save"&&be&&(C(Ne=>({name:"src",counter:Ne.counter+1})),_({operation:s.EVENT_TYPES.SANDBOX_IMAGE_RESET,url:String(L)}))},[r,O,Fo,_]),$o=(0,d.useCallback)(async L=>{const Ie=e.src||"",Te=kt(Ie),be=await b({kind:"img",currentUrl:Uo(Te)?"":Te,entryModal:L});be?.url&&jr(be.url,be.meta)},[jr,e.src,b]),Vl=(L,...Ie)=>{const Te=r.getFieldsValue(!0),be=Object.keys(L)[0];let Ne;switch(be){case"link":let Ke=io(L[be]);Ke!==L[be]&&r.setFieldValue("link",Ke),Ne={link:Ke};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ne={boxShadow:{hOffset:Te.boxShadowHOffset,vOffset:Te.boxShadowVOffset,blurRadius:Te.boxShadowBlurRadius,spreadRadius:Te.boxShadowSpreadRadius,color:Te.boxShadowColor,inset:Te.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":Te.borderPosition==="borderAll"?(Ne={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...Te.borderAll}}},r.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):Te.borderAll?.width||Te.borderAll?.style||Te.borderAll?.color?(Ne={border:{all:null,left:Te.borderAll,right:Te.borderAll,top:Te.borderAll,bottom:Te.borderAll,[H.REVERSE_BORDER_POSITIONS[be]]:{...Te[be],...L[be]}}},r.setFieldsValue({borderAll:null,borderLeft:Te.borderAll,borderRight:Te.borderAll,borderTop:Te.borderAll,borderBottom:Te.borderAll,[be]:{...Te[be],...L[be]}})):(Ne={border:{all:null,left:Te.borderLeft,right:Te.borderRight,top:Te.borderTop,bottom:Te.borderBottom,[H.REVERSE_BORDER_POSITIONS[be]]:{...Te[be],...L[be]}}},r.setFieldsValue({border:Ne.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(Te.mobileBorderPosition==="mobileBorderAll")Ne={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...Te.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[be]+"-"}}},r.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const lt=H.MOBILE_REVERSE_BORDER_POSITIONS[be],gt={...Te[be],...L[be]},Nt=!gt?.width&&!gt?.style&&!gt?.color;if(Te.mobileBorder?.all?.width||Te.mobileBorder?.all?.style||Te.mobileBorder?.all?.color){const vt=Te.mobileBorderAll;Ne={mobileBorder:{all:null,left:vt,right:vt,top:vt,bottom:vt,[lt]:Nt?null:{...gt,classNamePrefix:"em-mob-border_"+lt+"-"}}},r.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:vt,mobileBorderRight:vt,mobileBorderTop:vt,mobileBorderBottom:vt,[be]:gt})}else{const vt=e.mobileBorder||{},Zt=xo=>{const Mo=vt[xo];return Mo&&(Mo?.width||Mo?.style||Mo?.color)?Mo:null};Ne={mobileBorder:{all:null,left:lt==="left"?Nt?null:{...gt,classNamePrefix:"em-mob-border_left-"}:Zt("left"),right:lt==="right"?Nt?null:{...gt,classNamePrefix:"em-mob-border_right-"}:Zt("right"),top:lt==="top"?Nt?null:{...gt,classNamePrefix:"em-mob-border_top-"}:Zt("top"),bottom:lt==="bottom"?Nt?null:{...gt,classNamePrefix:"em-mob-border_bottom-"}:Zt("bottom")}},r.setFieldsValue({[be]:gt})}}break;case"width":Ne={[be]:{value:L[be],dim:Te.widthDim}};break;case"widthDim":Ne={width:{value:Te.width,dim:L[be]}};break;case"height":Ne={[be]:{value:L[be],dim:Te.heightDim}};break;case"heightDim":Ne={height:{value:Te.height,dim:L[be]}};break;case"borderRadiusAll":Ne={borderRadius:{[H.BORDER_RADIUS_POSITION[be]]:+L[be]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ne={borderRadius:{topLeft:Te.borderRadiusTopLeft,bottomLeft:Te.borderRadiusBottomLeft,topRight:Te.borderRadiusTopRight,bottomRight:Te.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[be]]:+L[be]}};break;case"mobileWidth":Ne={[be]:{classNamePrefix:"em-mob-width-",value:L[be],dim:Te.mobileWidthDim}};break;case"mobileWidthDim":Ne={mobileWidth:{classNamePrefix:"em-mob-width-",value:Te.mobileWidth||100,dim:L[be]}};break;case"mobileHeight":Ne={[be]:{classNamePrefix:"em-mob-height-",value:L[be],dim:Te.mobileHeightDim}};break;case"mobileHeightDim":Ne={mobileHeight:{classNamePrefix:"em-mob-height-",value:Te.mobileHeight,dim:L[be]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ne={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[be]]:L[be],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[be]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ne={mobileBoxShadow:{hOffset:Te.mobileBoxShadowHOffset,vOffset:Te.mobileBoxShadowVOffset,blurRadius:Te.mobileBoxShadowBlurRadius,spreadRadius:Te.mobileBoxShadowSpreadRadius,color:Te.mobileBoxShadowColor,inset:Te.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Ne={[be]:{classNamePrefix:"em-mob-text_align-",value:L[be]}};break;case"mobileVerticalAlign":Ne={[be]:{classNamePrefix:"em-mob-vertical_align-",value:L[be]}};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":Oo(pi);break;case"video":{const lt={...e.video,...Te.video,...L.video},gt=lt.source??Te.link;Oo(wr),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:lt,link:gt}}),Fo({...e,video:lt,link:gt,activateSection:null,changeKey:"video"});break}case"src":const ot=L[be],Qe=e.src,ht=Te.video?.playButton||e.video?.playButton;if(e.type==="video"&&ht&&ht!=="none"&&!Ee&&ot&&(!Qe||ot!==Qe)){Oo(()=>Lo(ot));return}Ne=L;break;default:Ne=L}be!=="borderPosition"&&be!=="mobileBorderPosition"&&be.indexOf("countdown")===-1&&be!=="video"&&(_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ne}),be!=="video"&&be.indexOf("countdown")===-1&&be!=="mobileBorderRadiusAll"&&be!=="mobileBorderRadiusTopLeft"&&be!=="mobileBorderRadiusTopRight"&&be!=="mobileBorderRadiusBottomLeft"&&be!=="mobileBorderRadiusBottomRight"&&Fo({...e,...Ne,mobileBorderRadius:{...e.mobileBorderRadius,...Ne?.mobileBorderRadius},activateSection:null,changeKey:be}))};(0,d.useEffect)(()=>{v.isError&&(f.error(v),K(!1))},[v]),(0,d.useEffect)(()=>{if(v.isSuccess&&je){if(v.data.data?.status===400)f.error({title:v.data.code,description:v.data.message});else{let L=new URL(v.data.target),Ie={countdown:{link:v.data.link,params:L.search.substring(1)}};_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ie})}K(!1)}},[v,je,e,f,_]);const tp=L=>{const Ie=L.data.operation;Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_AI):Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_GIF):Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Ie===s.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(n(s.closeSecondModal()),n(s.closeModal$1()))};s.useListenPostMessage(tp);const op=()=>{const L=r.getFieldsValue(!0);a.markBorderToggled(!me),setTimeout(()=>{de(Ie=>!Ie),me?(L.borderAll=H.NULL_BORDER,L.borderTop=H.NULL_BORDER,L.borderBottom=H.NULL_BORDER,L.borderRight=H.NULL_BORDER,L.borderLeft=H.NULL_BORDER):L.borderAll={width:1,color:"#E5E5E5",style:"solid"},_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:L.borderAll.color,style:L.borderAll.style,width:L.borderAll.width}}}})})},ip=()=>{const L=r.getFieldsValue(!0);l.markBorderToggled(!Q),setTimeout(()=>{q(Ie=>!Ie),Q?(L.mobileBorderAll=H.NULL_BORDER,L.mobileBorderTop=H.NULL_BORDER,L.mobileBorderBottom=H.NULL_BORDER,L.mobileBorderRight=H.NULL_BORDER,L.mobileBorderLeft=H.NULL_BORDER):L.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:L.mobileBorderAll.color,style:L.mobileBorderAll.style,width:L.mobileBorderAll.width}}}})})},rp=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{G(Ie=>!Ie),z?(L.borderRadiusAll=0,fe(!0)):L.borderRadiusAll=5,_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:L.borderRadiusAll}}})})},sp=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{ke(Ie=>!Ie),re?(L.mobileBorderRadiusAll=null,ce(!0)):L.mobileBorderRadiusAll=5,_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:L.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ap=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{Pe(Ie=>!Ie),he?(L.boxShadowInset=!1,L.boxShadowHOffset=null,L.boxShadowVOffset=null,L.boxShadowBlurRadius=null,L.boxShadowSpreadRadius=null,L.boxShadowColor=""):(L.boxShadowInset=!1,L.boxShadowHOffset=5,L.boxShadowVOffset=5,L.boxShadowBlurRadius=10,L.boxShadowSpreadRadius=-5,L.boxShadowColor="#000000"),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:L.boxShadowBlurRadius,color:L.boxShadowColor,hOffset:L.boxShadowHOffset,inset:L.boxShadowInset,spreadRadius:L.boxShadowSpreadRadius,vOffset:L.boxShadowVOffset}}})})},lp=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{V(Ie=>!Ie),ye?(L.mobileBoxShadowInset=!1,L.mobileBoxShadowHOffset=null,L.mobileBoxShadowVOffset=null,L.mobileBoxShadowBlurRadius=null,L.mobileBoxShadowSpreadRadius=null,L.mobileBoxShadowColor=""):(L.mobileBoxShadowInset=!1,L.mobileBoxShadowHOffset=5,L.mobileBoxShadowVOffset=5,L.mobileBoxShadowBlurRadius=10,L.mobileBoxShadowSpreadRadius=-5,L.mobileBoxShadowColor="#000000"),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:L.mobileBoxShadowBlurRadius,color:L.mobileBoxShadowColor,hOffset:L.mobileBoxShadowHOffset,inset:L.mobileBoxShadowInset,spreadRadius:L.mobileBoxShadowSpreadRadius,vOffset:L.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},np=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{we(Ie=>!Ie),ee&&(L.mobileWidth="",L.mobileHeight="",_({operation:s.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-"}}}))})},Ul=()=>{$e?(Le.current=!1,Ce(""),r.setFieldValue("link",""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Le.current=!0,Ce(Y.current&&Y.current.input.value?Y.current.input.value:"..."),setTimeout(()=>{Y.current.focus()}))},Hl=L=>{L.target.value===""?Ce("..."):(W.current.classList.add("selected-td-form__button--active"),Ce(L.target.value)),Gt(L.target.value,Re)},Wl=()=>{const L=r.getFieldsValue(!0);ie?(Be(""),L.alt="",_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(Be(F.current&&F.current.input.value?F.current.input.value:"..."),setTimeout(()=>{F.current.focus()}))},zl=L=>{L.target.value===""?Be("..."):(N.current.classList.add("selected-td-form__button--active"),Be(L.target.value))},Gl=()=>{const L=r.getFieldsValue(!0);ae?(oe(""),L.title="",_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(oe(T.current&&T.current.input.value?T.current.input.value:"..."),setTimeout(()=>{T.current.focus()}))},dp=()=>{M(!j),j?(r.setFieldValue("imgReplacer",""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>Z.current.focus())},cp=L=>{L.target.value!==""&&se.current.classList.add("selected-td-form__button--active")},Yl=L=>{L.target.value===""?oe("..."):(J.current.classList.add("selected-td-form__button--active"),oe(L.target.value))},up=L=>{r.setFieldValue("link",L!=="mergetag"?L:""),Re(L)};return(0,t.jsxs)(o.ui_kit$Form,{form:r,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[At]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[Tt]||"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:Vl,autoComplete:"off",disabled:Bt,className:Bt?"element-controls selected-image-form_busy":"element-controls",children:[Bt&&(0,t.jsx)("div",{className:"selected-image-form__loader",ref:B,children:(0,t.jsxs)("div",{className:"selected-image-form__loader-body",children:[(0,t.jsx)(o.ui_kit$Spin,{size:"large"}),(0,t.jsx)("div",{className:"selected-image-form__loader-title",children:Me.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!p&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),h==="mobile"&&y.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(Kr,{form:r,elementSettings:e,boxShadow:ne,mobileBordersShow:Q,mobileBorderRadiusShow:re,mobileBoxShadowShow:ye,mobileSizeShow:ee,oneMobileBorderRadiusValue:Ae,setOneMobileBorderRadiusValue:ce,hasLink:$e,hasAlt:ie,hasTitle:ae,linkInputRef:Y,linkButtonRef:W,altInputRef:F,altButtonRef:N,titleInputRef:T,titleButtonRef:J,linkInputHandler:Hl,altButtonHandler:Wl,altInputHandler:zl,titleButtonHandler:Gl,titleInputHandler:Yl,linkButtonHandler:Ul,toggleShowMobileBorderHandler:ip,toggleShowMobileBorderRadiusHandler:sp,toggleShowMobileBoxShadowHandler:lp,toggleShowMobileSizeHandler:np})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Xr,{form:r,elementSettings:e,boxShadow:ne,bordersShow:me,borderRadiusShow:z,boxShadowShow:he,oneBorderRadiusValue:le,setOneBorderRadiusValue:fe,hasLink:$e,hasAlt:ie,hasTitle:ae,isOpenSrcReplacer:j,mergeTagItems:xe,mergeMenuOpen:ue,setMergeMenuOpen:ge,cascaderRef:te,linkInputRef:Y,linkButtonRef:W,altInputRef:F,altButtonRef:N,titleInputRef:T,titleButtonRef:J,srcReplacerInputRef:Z,srcReplacerButtonRef:se,linkProtocol:ve,handleLinkProtocolsChange:up,linkButtonHandler:Ul,linkInputHandler:Hl,altButtonHandler:Wl,altInputHandler:zl,titleButtonHandler:Gl,titleInputHandler:Yl,srcReplacerButtonHandler:dp,srcInputHandler:cp,handleSelect:mt,onChange:pe,filter:ze,renderSearchOption:dt,handleChangeValues:Vl,toggleShowBorderHandler:op,toggleShowBorderRadiusHandler:rp,toggleShowBoxShadowHandler:ap})})]})};Jr.propTypes={elementSettings:g.default.object.isRequired};var Qr=()=>{const{__:e}=s.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})},so=({form:e,elementSettings:i,imgParent:r=!1,name:a="align",setAlignStateHandle:l=()=>{},withHotKeys:n=!0})=>{const{__:c}=s.useI18n(),m=s.useSendPostMessage(),f=s.useAppConfig(),[_,k]=(0,d.useState)(null);(0,d.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&k(!0)},[]);const b=I=>{l(I),e.setFieldsValue({[a]:I}),m({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[a]:I}})},h=n?{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,y=n?{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,x=n?_?h:y:void 0,E=i[a],w=typeof E=="string"?E:"";return(0,t.jsx)(o.ui_kit$Form.Item,{name:a,children:(0,t.jsx)(o.ui_kit$FormAlignTextControl,{value:w,onChange:b,disabled:r&&!i.parent,strokeWidth:f?.iconStrokeWidth,labels:x})})},Je=({form:e,elementSettings:i,name:r,icon:a,tooltipTitle:l=null,showTooltip:n=!0,forceInactive:c=!1})=>{const{__:m}=s.useI18n(),f=e.getFieldValue(r),_=s.useSendPostMessage(),[k,b]=(0,d.useState)(i[r]);(0,d.useEffect)(()=>{i[r]!==e.getFieldValue(r)&&(e.setFieldValue(r,i[r]),b(i[r]))},[i,e,r]),(0,d.useEffect)(()=>{k!==f&&b(f)},[f,k,r]);const h=()=>{const y={[r]:!k};e.setFieldValue(r,!k),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:y}),r==="textSuperscript"?e.setFieldValue("textSubscript",!1):r==="textSubscript"&&e.setFieldValue("textSuperscript",!1),b(x=>!x)};return(0,t.jsx)(o.ui_kit$Form.Item,{name:r,children:n?(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l||m(r.substring(4)),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:h,children:a})}):(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:h,children:a})})};Je.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string,imgParent:g.default.bool};var Zr=()=>{const{__:e}=s.useI18n();return[{symbol:"•",code:"&bull;",description:e("Bullet")},{symbol:"+",code:"&plus;",description:e("Plus")},{symbol:"»",code:"&raquo;",description:e("Double quotation")},{symbol:"×",code:"&times;",description:e("Cross")},{symbol:"–",code:"&mdash;",description:e("Dash")},{symbol:"›",code:"&rsaquo;",description:e("Single quotation")},{symbol:"→",code:"&rarr;",description:e("Arrow")},{symbol:"⇒",code:"&rArr;",description:e("Double arrow")},{symbol:"►",code:"&blacktriangleright;",description:e("Pointer")},{symbol:"−",code:"&minus;",description:e("Minus")},{symbol:"∗",code:"&lowast;",description:e("Star")},{symbol:"♦",code:"&diams;",description:e("Diamond")}]},Vn=(e,i="#c6c3c3",r={},a)=>{const{symbolSize:l="25px",marginRight:n="5px",marginBottom:c="5px",textStyle:m={whiteSpace:"normal",lineHeight:"1.2"}}=r;return e.map(f=>({value:f.code,label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,t.jsx)("span",{style:{color:i||"#c6c3c3",marginRight:n,marginBottom:c,fontSize:l,lineHeight:"0.7",width:l,textAlign:"center",...m},children:f.symbol}),(0,t.jsx)("span",{style:m,children:f.description})]})}))},Bo=({form:e,fillFields:i,elementSettings:r,showAddParagraph:a=!0,isButton:l=!1,linkProtocol:n,setLinkProtocol:c,linkTarget:m,isBulletFontColorChecked:f=!1,setIsBulletFontColorChecked:_=()=>{},showTopDivider:k=!0})=>{const{__:b}=s.useI18n(),h=H.useGoogleFontsLoader(),{token:y}=(0,o.ui_kit$useToken)(),x=s.useNotification(),E=s.useSendPostMessage(),w=s.useSendPostMessageEx(),I=s.useAppConfig(),A=(0,d.useRef)(),v=(0,d.useRef)(null),P=(0,d.useRef)(null),C=(0,d.useRef)(null),Y=(0,d.useRef)(!1),W=r,[F,N]=(0,d.useState)(!!W.textReplacer?.length),[T,J]=(0,d.useState)(!!W.textAnchor?.length),[Z,se]=(0,d.useState)(null),[te,ne]=(0,d.useState)({start:0,end:0}),[_e,le]=(0,d.useState)(!1),[fe,Ae]=(0,d.useState)([]),[ce,$e]=(0,d.useState)(W.list?.bulletsColor),[Ce,ie]=(0,d.useState)(r);r!==Ce&&(ie(r),$e(W.list?.bulletsColor),N(!!W.textReplacer?.length),J(!!W.textAnchor?.length));const[Be,ae]=(0,d.useState)(!1),[oe,me]=(0,d.useState)(!1),de=(0,d.useRef)(null),Q=(0,d.useRef)(""),q=Zr(),z=(0,d.useMemo)(()=>q,[]),G={textColor:o.ui_kit$Form.useWatch("textColor",e),textLink:o.ui_kit$Form.useWatch("textLink",e),linkHref:o.ui_kit$Form.useWatch("linkHref",e),listUL:o.ui_kit$Form.useWatch("listUL",e),listOL:o.ui_kit$Form.useWatch("listOL",e)};(0,d.useEffect)(()=>{l&&r?.textColor!==void 0&&e.setFieldValue("textColor",r.textColor)},[l,r?.textColor,e]);let re=null;(0,d.useEffect)(()=>{if(G?.textColor&&f){const R=e.getFieldValue("textColor");E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{ColorBullets:R}})}},[G?.textColor]),(0,d.useEffect)(()=>{const R=e.getFieldValue("textLink");typeof r.linkHref=="string"&&ae(!0),de&&!R&&(ae(!1),e.setFieldsValue({linkHref:null})),de.current=R||null},[G?.textLink,G?.linkHref,r.linkHref,e]),(0,d.useEffect)(()=>{const R=e.getFieldValue("listUL"),X=e.getFieldValue("listOL");R&&Q.current!=="listUL"?(e.setFieldValue("listOL",!1),Q.current="listUL"):X&&Q.current!=="listOL"&&(e.setFieldValue("listUL",!1),Q.current="listOL"),!R&&!X&&(Q.current="")},[G?.listUL,G?.listOL,e]);const ke=R=>{R.data.operation===s.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&se(null)};s.useListenPostMessage(ke);const[he,Pe]=(0,d.useState)(null);(0,d.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Pe(!0)},[]);const ye=(0,d.useRef)(null);function V(R){const X=R.key.toLowerCase();let j=!1;return((re==="control"||re==="meta")&&(X==="a"||X==="A")||(re==="a"||re==="A")&&(X==="control"||X==="meta"))&&(j=!0),re=X,X!=="control"&&X!=="a"&&X!=="A"&&X!=="meta"&&(re=null),j}const ee=R=>{E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:R,locale:"en_US"}),x.success({title:b("It`s done!")})},we=[{key:"1",label:b("This element"),onClick:()=>ee("typograf")},{key:"2",label:b("The whole email"),onClick:()=>ee("typograf_all")}],[je,K]=(0,d.useState)(),[ve,Re]=(0,d.useState)(!1);(0,d.useEffect)(()=>{const R=Vn(z,ce,{});Ae(R)},[z,ce]),(0,d.useEffect)(()=>{const R=r.linkHref||r.href;R&&Gt(R,c);const X=r.linkHref||r.href,j=X&&ji(X)?X.slice(1):X||"https://";(i??((M,Ee)=>M.setFieldsValue(Ee)))(e,{linkHref:j})},[e,r,c,i]);const Le=s.useAppConfig().mergeTags;(0,d.useEffect)(()=>{Le?.items?.length&&K(s.mapMargeTags(Le.items,b,(R,X)=>{Re(!1),w(s.EVENT_TYPES.SANDBOX_ADD_MERGETAG,R),X.stopPropagation(),X.preventDefault()}))},[Le,K,b,Re,w]);const Ue=R=>{e.setFieldValue("linkHref",R!=="mergetag"?R:""),c(R)},Me=(R,X)=>{if(Re(!1),R){const j=Le.syntax.length>1?je.findIndex(Ee=>Ee.key===X[0].key):0,M=Le.syntax[j].replace("%value%",R[R.length-1]);if(Z?.getAttribute("id")==="selected_button_form_href"||Z?.getAttribute("id")==="selected_text_form_linkHref"||Z?.getAttribute("id")==="selected_text_form_textReplacer")ue(M,Z?.getAttribute("id"));else{e.setFieldValue("textReplacer",M);const Ee=Date.now();E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{textReplacer:`${M}~~${Ee}`}})}}},He=(R,X)=>X.some(j=>j.label.toLowerCase().indexOf(R.toLowerCase())>-1),O=(R,X)=>{const j=X.map((M,Ee)=>{const Fe=M.label.split(new RegExp(`(${R})`,"gi"));return(0,t.jsxs)("span",{children:[Ee!==0&&(0,t.jsx)("span",{children:" / "}),Fe.map((tt,qe)=>tt.toLowerCase()===R.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:tt},qe):tt)]},M.value)});return(0,t.jsx)("div",{title:X.map(M=>M.label).join(" / "),children:j})};(0,d.useEffect)(()=>{ve&&ye.current&&ye.current.focus()},[ve]);const xe=s.useRootElement();(0,d.useEffect)(()=>{const R=({target:M})=>{M.closest('[id="merge_tags_wrapper"]')||se(M)},X=({target:M})=>{!M.closest(".merge-tags")&&!M.closest("#merge_tags_button")&&Re(!1)},j=new De.Disposable;return j.addDisposable(s.addWindowListenerFromShadow(xe,"focusin",R)),j.addDisposable(s.addWindowListenerFromShadow(xe,"click",X)),()=>{j.dispose()}},[xe]),(0,d.useEffect)(()=>{const R=v?.current||document,X=()=>{window.getSelection().toString().length>0&&(Y.current=!0)};return R.addEventListener("dblclick",X),()=>{R.removeEventListener("dblclick",X)}},[v]);const D=(0,d.useCallback)(({target:R})=>{if(R&&!_e){const{selectionStart:X,selectionEnd:j}=R;ne({start:X,end:j})}le(!1)},[_e]);(0,d.useEffect)(()=>D({target:m?.target}),[m,D]);const ue=(R,X)=>{const j=document.getElementById(X);if(j){const M=j.value?.substring(0,te.start),Ee=j.value?.substring(te.end),Fe=X.substring(X.lastIndexOf("_")+1);E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{[Fe]:M+R+Ee}}),e.setFieldValue(Fe,M+R+Ee),j.focus(),setTimeout(()=>{j.selectionStart=te.start,j.selectionEnd=te.start+R.length},400),le(!0)}},ge=()=>{N(!F),F?(e.setFieldValue("textReplacer",""),E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{textReplacer:""}})):setTimeout(()=>v.current.focus())},Oe=R=>{R.target.value!==""&&P.current?.classList.add("selected-td-form__button--active")},Ge=(R="unknown")=>{J(!T),T?(e.setFieldValue("textAnchor",""),E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{textAnchor:""}})):setTimeout(()=>C.current?.focus())},Ye=R=>{const X=R.target,j=X.value,M=X.selectionStart,Ee=V(R);if(Y.current&&M===0&&E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{textReplacer:`${j}~`}}),Y.current=Ee,M===0&&R.key===" "){R.preventDefault();return}if(R.key===" "){if(M!==j.length){R.preventDefault();return}j.endsWith(" ")&&R.preventDefault()}},Xe=R=>{$e(R),f&&_(!1)};return(0,t.jsxs)(t.Fragment,{children:[a&&!r.showOnMobile&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,gutter:20,children:(0,t.jsx)(so,{form:e,elementSettings:r,name:"textAlign"})})})}),I.formTextFieldTypografEnabled&&!l||I.mergeTagsShow&&je?(0,t.jsx)(o.ui_kit$FormSection,{title:null,dividerTop:k,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[I.formTextFieldTypografEnabled&&!l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:y.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"AddImage",component:o.icons$AddImage}),onClick:()=>ee("add_img"),style:{width:"100%"},children:b("Add image")})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:y.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,menu:{items:we},trigger:["hover"],placement:"bottom",getPopupContainer:R=>R.closest(".selected-element-panel"),children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),onClick:()=>ee("typograf"),style:{width:"100%"},children:b("Typography")})})})})]}),I.mergeTagsShow&&je&&(0,t.jsxs)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:y.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(s.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:ve?"none":"inline-flex"},onClick:()=>Re(!0),children:b("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:ye,classNames:{popup:{root:"merge-tags"}},options:je,placeholder:b("Start typing the title"),showSearch:{filter:He,render:O},spellCheck:"false",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),onChange:Me,style:{display:ve?"block":"none",width:"100%"},open:ve,onKeyDown:R=>{R.key==="Escape"&&Re(!1)}})]})]})}):null,(0,t.jsxs)(o.ui_kit$FormSection,{title:null,dividerTop:k||I.formTextFieldTypografEnabled&&!l,bodyStyle:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text font"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper")})})}),!r.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:b("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:b("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,t.jsxs)(o.ui_kit$Col,{span:24,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)("div",{className:"selected-text-common-form__format-toolbar",children:[(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textStrong",tooltipTitle:b(he?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textItalic",tooltipTitle:b(he?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textUnderline",tooltipTitle:b(he?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})]})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:r.usedColors})})})})]}),!l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textStrong",tooltipTitle:b(he?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textItalic",tooltipTitle:b(he?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textUnderline",tooltipTitle:b(he?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),r?.list?.isList&&(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textStrikethrough",tooltipTitle:b(he?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!r?.list?.isList&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"listUL",tooltipTitle:b("Unordered list"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnorderedListOutlined",component:o.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:D})}),!r?.list?.isList&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"listOL",tooltipTitle:b("Ordered list"),icon:(0,t.jsx)(s.EmIcons,{icon:"OrderedListOutlined",component:o.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:D})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textSuperscript",tooltipTitle:b("Text superscript"),icon:(0,t.jsx)(s.EmIcons,{icon:"Superscript",component:o.icons$Superscript})})}),r?.list?.isList&&(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,t.jsx)(s.EmIcons,{icon:"Subscript",component:o.icons$Subscript})})]}),a&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,className:(0,Ve.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof r.linkHref=="string"}),elementSettings:r,name:"textLink",forceInactive:!!r.textAnchor,tooltipTitle:b("Link"),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:D})}),r?.list?.isList&&I.formTextFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":F}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ge,ref:P})})}),(!r?.list?.isList||a&&r?.list?.isList)&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:b("More options"),placement:"bottom",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":oe||T}),icon:(0,t.jsx)(s.EmIcons,{icon:"DotsHoriz",component:o.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>me(!oe)})})})]})]}),!l&&oe&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[!r?.list?.isList&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textStrikethrough",tooltipTitle:b(he?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,t.jsx)(s.EmIcons,{icon:"Subscript",component:o.icons$Subscript})})]}),I.formTextFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":F}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ge,ref:P})})})]}),a&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:b("Anchor"),placement:"bottom",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":T}),icon:(0,t.jsx)(s.EmIcons,{icon:"Anchor",component:o.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:R=>{R.preventDefault(),Ge("mouseDown")}})})})]}),a&&typeof r.linkHref=="string"&&Be&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oo,{show:n==="#",__:b,style:{marginBottom:y.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b(n==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:n==="mailto:"?y.formItemMarginBottomXS:""},children:(0,t.jsx)(o.ui_kit$Input,{ref:A,addonBefore:(0,t.jsx)(to,{linkProtocol:n,handleLinkProtocolsChange:Ue,__:b}),allowClear:!0,placeholder:b(n==="#"?"Anchor name":"Hyperlink URL"),autoFocus:r?.isNewLink,onSelect:D,prefix:(0,t.jsx)(eo,{linkProtocol:n})})})}),n==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",style:{marginBottom:y.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:b("Subject"),onSelect:D})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:y.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:b("Body"),onSelect:D})})]})]}),a&&T&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Anchor name"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textAnchor",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:b("Anchor name"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:b("Anchor"),"aria-hidden":!0,children:(0,t.jsx)(s.EmIcons,{icon:"Anchor",component:o.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:C,onSelect:D,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||J(!1)}})})}),!l&&F&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textReplacer",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:b("The code that will replace this text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:b("Text")}),onChange:Oe,onKeyDown:Ye,ref:v,onSelect:D})})})]})}),!l&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:r.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text background"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:b("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:b("Background color"),usedColors:r.usedColors})})})})]})]}),!l&&r?.list?.isList&&(0,t.jsxs)(o.ui_kit$FormSection,{title:b("List settings"),dividerTop:!0,children:[r?.list?.listType==="OL"&&(0,t.jsx)(o.ui_kit$Row,{children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,t.jsx)(o.ui_kit$Row,{gutter:[10],children:r?.list?.listType==="UL"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets type"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,t.jsx)(o.ui_kit$Select,{size:"medium",placeholder:b("Bullets type"),onClick:R=>R.stopPropagation(),options:fe})})})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:[10],children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"ColorBullets",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:b("Bullets color"),usedColors:r.usedColors,disabled:f,onChange:Xe,externalValue:f?G?.textColor:void 0})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletsSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:r?.list?.bulletFontSize,placeholder:b("Bullets size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),r?.list?.listType==="OL"&&(0,t.jsxs)(o.ui_kit$Row,{children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"BulletTextStrong",tooltipTitle:b(he?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"BulletTextItalic",tooltipTitle:b(he?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"BulletTextStrikethrough",tooltipTitle:b(he?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"BulletTextUnderline",tooltipTitle:b(he?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Between list items"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:b("Between list items"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Between bullets and text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:b("Between bullets and text"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Ci=({form:e,elementSettings:i,showAddParagraph:r=!0,isButton:a=!1})=>{const{__:l}=s.useI18n(),n=H.useGoogleFontsLoader(),c=s.useSendPostMessage(),m=s.useDispatch(),f=s.useElementEntityKind(),_=s.useAppConfig(),[k,b]=(0,d.useState)(null);(0,d.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&b(!0)},[]);const h=A=>{c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:A,locale:"en_US"})},[y,x]=(0,d.useState)(i.textAlign),[E,w]=(0,d.useState)(i.linkHref),I=A=>x(A);return(0,d.useEffect)(()=>{x(i.textAlign),w(i.linkHref)},[i]),(0,t.jsx)("div",{className:"selected_text_common_form_mobile",children:(0,t.jsxs)(o.ui_kit$Space,{size:"8",separator:(0,t.jsx)(o.ui_kit$Divider,{orientation:"vertical"}),children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)("div",{style:{width:190},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Text font"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:n,getPopupContainer:A=>A.closest(".selected_text_common_form_mobile")})})})}),(0,t.jsx)("div",{style:{width:90},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:l("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)("div",{style:{width:90},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:l("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(k?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(k?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(k?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(k?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-td-form__icon-radius"})})]}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Text color"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:l("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors,getPopupContainer:A=>A.closest(".selected_text_common_form_mobile")})})}),!a&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Text background"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:l("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]}),r&&(0,t.jsx)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:(0,t.jsxs)(t.Fragment,{children:[typeof E=="string"?(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:l("Hyperlink URL"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.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:A=>A.closest(".selected_text_common_form_mobile"),children:(0,t.jsx)("div",{children:(0,t.jsx)(Je,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:i,name:"textLink",icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),showTooltip:!1})})}):(0,t.jsx)(Je,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:l("Link"),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,t.jsx)(so,{form:e,elementSettings:i,name:"textAlign",setAlignStateHandle:I}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:615,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:A=>A.closest(".selected_text_common_form_mobile"),children:(0,t.jsx)(o.ui_kit$Button,{icon:y==="right"?(0,t.jsx)(s.EmIcons,{icon:"AlignRightOutlined",component:o.icons$AlignRightOutlined,size:18,strokeWidth:_.iconStrokeWidth}):y==="center"?(0,t.jsx)(s.EmIcons,{icon:"AlignCenterOutlined",component:o.icons$AlignCenterOutlined,size:18,strokeWidth:_.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"AlignLeftOutlined",component:o.icons$AlignLeftOutlined,size:18,strokeWidth:_.iconStrokeWidth}),className:"selected-td-form__button"})})]})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[r&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Add paragraph"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"Paragraph",component:o.icons$Paragraph}),onClick:()=>h("add_p"),className:"selected-td-form__button"})}),!a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Add inline image"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"ImageAdd",component:o.icons$ImageAdd,size:16,strokeWidth:_.iconStrokeWidth}),onClick:()=>h("add_img"),className:"selected-td-form__button"})}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),className:"selected-td-form__button"})]}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"CloseOutlined",component:o.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),m(s.resetToLastActiveSettingsTab()),setTimeout(()=>{m(f==="block"?s.setElementSettings({type:null}):s.setElementSettings$1({type:null}))},300)}})]})]})})},Go=({elementSettings:e,imgParent:i=!1,name:r="mobileAlign"})=>{const{__:a}=s.useI18n(),l=s.useAppConfig();return(0,t.jsx)(o.ui_kit$Form.Item,{name:r,children:(0,t.jsx)(o.ui_kit$FormAlignTextControl,{disabled:i&&!e.parent,strokeWidth:l?.iconStrokeWidth,labels:{alignLeft:a("Text align left"),alignCenter:a("Text align center"),alignRight:a("Text align right"),alignJustify:a("Text align justify")}})})};Go.propTypes={elementSettings:g.default.object.isRequired,imgParent:g.default.bool,name:g.default.string};var Un=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useDispatch(),a=s.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),n=s.useSelector(s.selectEmailViewType),c=s.useSelector(s.selectMobileViewActive),m=s.useSelector(s.selectIsCodeMode),f=s.useSelector(s.selectCodeModeDirection),_=m&&f!=="bottom",[k,b]=(0,d.useState)("https://"),[h,y]=(0,d.useState)(!1),x=Zr(),E=(0,d.useMemo)(()=>x,[]),w=s.useElementEntityKind(),{remember:I,fillFields:A}=co(e),v=(0,d.useCallback)(C=>{I(C),r(w==="email"?s.setElementSettings$1(C):s.setElementSettings(C))},[r,w,I]);(0,d.useEffect)(()=>{if(e){const{subject:C,body:Y,baseEmail:W}=zr(e.linkHref),F=e.linkHref,N=typeof F=="string"&&ji(F),T=typeof F=="string"&&F.startsWith("mailto:")?W:N?F.slice(1):typeof F=="string"?F:"https://";b(zo(F||"","https://")),A(l,{...e,lineHeight:u(e.lineHeight),linkHref:T,subject:C,body:Y,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:Gr(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:h,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:E.find(J=>J.symbol===e?.list?.bulletType)?.code??E[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[l,e]);const P=C=>{const Y=l.getFieldsValue(!0),W=Object.keys(C)[0];let F;switch(W){case"mobileFontSize":F={[W]:{classNamePrefix:"em-mob-font_size-",value:C[W],dim:Y.mobileFontSizeDim}};break;case"mobileLineHeight":F={[W]:{classNamePrefix:"em-mob-line_height-",value:C[W],dim:Y.mobileLineHeightDim}};break;case"mobileTextAlign":F={[W]:{classNamePrefix:"em-mob-text_align-",value:C[W]}};break;case"linkHref":let N=io(C[W]);if(N!==C[W]&&l.setFieldValue("linkHref",N),k==="#"&&N&&!N.startsWith("#")&&(N="#"+N),N.startsWith("mailto:")){const J=l.getFieldValue("subject"),Z=l.getFieldValue("body");F={[W]:vi(N,J,Z)}}else F={[W]:N};Gt(N,b);break;case"subject":case"body":const T=l.getFieldValue("linkHref")||"";if(T.substring(0,7)==="mailto:"){const J=T.split("?")[0],Z=W==="subject"?C[W]:l.getFieldValue("subject"),se=W==="body"?C[W]:l.getFieldValue("body"),te=[];Z&&te.push(`subject=${encodeURIComponent(Z)}`),se&&te.push(`body=${encodeURIComponent(se)}`),F={linkHref:te.length>0?`${J}?${te.join("&")}`:J}}else return;break;default:F=C}a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:F}),v({...e,list:{...e.list,bulletsColor:l.getFieldValue("ColorBullets"),bulletFontFamily:l.getFieldValue("BulletsFontFamily"),bulletFontSize:l.getFieldValue("BulletsSize"),betweenParagraphs:l.getFieldValue("SpacingBetweenParagraphs"),betweenRowCell:l.getFieldValue("SpacingBetweenBulletsAndText"),bulletType:E.find(N=>N.code===l.getFieldValue("BulletType"))?.symbol??E[0].symbol},...F,activateSection:null,changeKey:W})};return(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:P,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:[!_&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(n==="mobile"&&!_&&c.styles)&&(0,t.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:_?(0,t.jsx)(Ci,{form:l,elementSettings:e}):(0,t.jsx)(Bo,{form:l,fillFields:A,elementSettings:e,linkProtocol:k,setLinkProtocol:b,isBulletFontColorChecked:h,setIsBulletFontColorChecked:y})}),!_&&(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:n==="mobile"&&c.styles?"block":"none"},children:[(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Go,{form:l,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,t.jsx)(Bo,{form:l,fillFields:A,elementSettings:e,linkProtocol:k,setLinkProtocol:b}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Qr,{})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileLineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})]})]})]})},Pi=(e,i)=>{const{__:r}=s.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{title:r("During export, the element is converted into an image."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$Switch,{id:"convert-in-image",label:r("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})})},"exportAsPicture")},es={marginBottom:10},ts={position:"relative",top:2};function Hn(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var ao=({form:e,showRounding:i=!1,showBackground:r=!1})=>{const{__:a}=s.useI18n(),l=Hn(o.ui_kit$Form.useWatch("backgroundImage",e));return(0,t.jsxs)(t.Fragment,{children:[i&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Adds bulletproof VML markup so the button keeps rounded corners in Outlook."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"outlookRounding",valuePropName:"checked",className:"form-item-margin-xs",style:es,children:(0,t.jsx)(o.ui_kit$Switch,{id:"outlook-rounding",label:a("Rounded corners in Outlook (VML)"),size:"small",labelStyle:ts})})},"outlookRounding"),r&&l&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Adds VML markup so the background image is visible in Outlook."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"outlookBackground",valuePropName:"checked",className:"form-item-margin-xs",style:es,children:(0,t.jsx)(o.ui_kit$Switch,{id:"outlook-background",label:a("Background image in Outlook (VML)"),size:"small",labelStyle:ts})})},"outlookBackground")]})};ao.propTypes={form:g.default.object,showRounding:g.default.bool,showBackground:g.default.bool};var os=({form:e,elementSettings:i,boxShadow:r,bordersShow:a,borderRadiusShow:l,boxShadowShow:n,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:f,backgroundSizeOptions:_,sizeShow:k,modificationShow:b,oneBorderRadiusValue:h,setOneBorderRadiusValue:y,toggleShowBorderHandler:x,toggleShowBorderRadiusHandler:E,toggleShowBoxShadowHandler:w,toggleShowSizeHandler:I,toggleShowBackgroundHandler:A,toggleShowModificationHandler:v})=>{const{__:P}=s.useI18n(),C=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(zt,{form:e,elementSettings:i,tooltipTitle:P("The align attribute sets the horizontal alignment of the table.")})}),(0,t.jsx)(o.ui_kit$FormSection,{title:P("Size"),collapsible:!0,open:k,onToggle:I,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:Mt,minWidthDimensionSelect:Mt,maxWidthDimensionSelect:Mt,rowStyle:{marginBottom:4},labels:{width:P("Width"),height:P("Height"),minWidth:P("Minimum width"),maxWidth:P("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:P("Background"),collapsible:!0,open:c,onToggle:A,dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{imageEnabled:C.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:m,usedColors:i.usedColors,colorPlaceholder:P("Background color"),horizontalPositionPlaceholder:P("Horizontal position"),horizontalPositionTooltip:P("Horizontal position"),verticalPositionPlaceholder:P("Vertical position"),verticalPositionTooltip:P("Vertical position"),backgroundRepeatTooltip:P("Background image repeat"),backgroundSizeTooltip:P("Background image size"),selectPlaceholder:P("Please choose"),backgroundRepeatOptions:f,backgroundSizeOptions:_,imageUploadSlot:C.formTableFieldBackgroundImageEnabled?(0,t.jsx)(Ot,{form:e,label:P("Background image"),name:"backgroundImage",tooltipTitle:P("Background image"),placeholder:P("Background image link/route")}):void 0}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),C.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Borders"),collapsible:!0,open:a,onToggle:x,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Border radius"),collapsible:!0,open:l,onToggle:E,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:y,elementSettings:i})}),C.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Box shadow"),collapsible:!0,open:n,onToggle:w,dividerTop:!0,children:(0,t.jsx)(It,{})}),C.formFieldExportAsPictureEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Export settings"),collapsible:!0,open:b,onToggle:v,dividerTop:!0,children:(0,t.jsx)(Pi,{form:e,elementSettings:i})}),C.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};os.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,sizeShow:g.default.bool,modificationShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func};var is=({form:e,elementSettings:i,label:r})=>{const{__:a}=s.useI18n();(0,d.useRef)();const[l,n]=(0,d.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,o.ui_kit$useToken)(),m=s.useSendPostMessage(),f=k=>{e.setFieldsValue({mobileBackgroundColor:""}),n(b=>!b),m({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:l?"":"none"}}})},_=k=>{n(!1)};return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Background color"),placement:"left",children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundColor",style:{marginBottom:c.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{onChange:_,placeholder:r,usedColors:i.usedColors})}),(0,t.jsx)(o.ui_kit$Switch,{id:"without-background-color",label:a("Without background color"),labelSize:"small",size:"small",checked:l,onChange:f})]})})};is.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired};var Yo={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"}]},Ai={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-"},uo="none",Wn=/^(https?:)?\/\//i,zn=/^(\d*\.?\d+)(%|px)$/;function Gn(e){return e in Ai}function rs(e){return Wn.test(e.trim())}function Ni(e,i){const r=Ai[e],a=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?a&&a!==uo&&!rs(a)?null:{[e]:[{classNamePrefix:r,value:a,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:r,value:a||uo}}:{[e]:{classNamePrefix:r,value:a}}}function To(e){const[i]=Object.keys(e??{});return!i||!Gn(i)?null:Ni(i,e[i])}function Yn(){return Object.keys(Ai).reduce((e,i)=>({...e,...Ni(i,"")}),{})}function ss(e){const i=(e??"").trim(),r=i.match(zn);return r?{position:r[1],unit:r[2]}:{position:i,unit:"px"}}function as(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Xt(e){const i=e??{},r=i.customTable??i;return{type:i.type,usedColors:i.usedColors,mobileBackgroundColor:r.mobileBackgroundColor,mobileBackgroundImage:r.mobileBackgroundImage,mobileBackgroundPositionX:r.mobileBackgroundPositionX,mobileBackgroundPositionY:r.mobileBackgroundPositionY,mobileBackgroundRepeat:r.mobileBackgroundRepeat,mobileBackgroundSize:r.mobileBackgroundSize}}function So(e){const i=e??{},r=i.customTable??i,a=r.backgroundSize??"";return{image:r.backgroundImage?.[0]?.value??"",positionX:r.backgroundPositionX??"",positionY:r.backgroundPositionY??"",repeat:r.backgroundRepeat??"",size:a==="auto"?"":a}}function mo(e){const i=Xt(e),r=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:r===uo?"":r,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||uo,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function yo(e){const i=Xt(e),r=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!r&&r!==uo||!!i.mobileBackgroundSize?.value}function Xn(e,i){return e===uo?!1:!!e||!!i}function Ro(e,i,r){e.setFieldsValue({...mo({}),mobileBackgroundColor:""}),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Xt(i).type,settings:Yn()})}var Kn=/^\d*\.?\d+$/,qn={bottom:"auto"},ls={marginBottom:0},Jn=(0,t.jsx)(s.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal}),Qn=(0,t.jsx)(s.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical}),Zn=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,ns=({value:e,onChange:i,inheritedValue:r,options:a,placeholder:l,prefix:n})=>{const c=e||r,[m,f]=(0,d.useState)(()=>ss(c));(0,d.useEffect)(()=>{f(h=>as(h.position,h.unit)===c?h:ss(c))},[c]);const _=(0,d.useCallback)((h,y)=>{f({position:h,unit:y});const x=a.some(E=>E.value===h);(h===""||x||Kn.test(h))&&i?.(as(h,y))},[i,a]),k=(0,d.useCallback)(h=>_(h,m.unit),[_,m.unit]),b=(0,d.useCallback)(h=>_(m.position,h),[_,m.position]);return(0,t.jsx)(o.ui_kit$InputSelect,{options:a,position:m.position,setPosition:k,unit:m.unit,setUnit:b,placeholder:l,prefix:n,dropdownStyle:qn,tooltipTitle:l,getTooltipPopupContainer:Zn})},ed=({desktopPositionX:e,desktopPositionY:i})=>{const{__:r}=s.useI18n(),{token:a}=(0,o.ui_kit$useToken)(),l=a.formItemMarginBottomXS,n=(0,d.useMemo)(()=>({marginBottom:l}),[l]);return(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:n,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundPositionX",style:ls,children:(0,t.jsx)(ns,{inheritedValue:e,options:Yo.horizontal,placeholder:r("Horizontal position"),prefix:Jn})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:ls,children:(0,t.jsx)(ns,{inheritedValue:i,options:Yo.vertical,placeholder:r("Vertical position"),prefix:Qn})})})]})},ds=["hover"],cs=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,us=({value:e,emptyValue:i,inheritedValue:r,...a})=>{const l=!!e&&e!==i,n=a.options.some(c=>c.value===r)?r:i;return(0,t.jsx)(o.ui_kit$Select,{...a,value:l?e:n})},td=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:r,desktopSize:a,backgroundRepeatOptions:l,backgroundSizeOptions:n})=>{const{__:c}=s.useI18n(),{token:m}=(0,o.ui_kit$useToken)(),f=m.formItemMarginBottomXS,_=(0,d.useMemo)(()=>({marginBottom:f}),[f]),k=(0,d.useMemo)(()=>({marginBottom:(f??0)*1.5}),[f]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ed,{desktopPositionX:e,desktopPositionY:i}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:k,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:ds,title:c("Background image repeat"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:_,children:(0,t.jsx)(us,{emptyValue:"none",inheritedValue:r,options:l,placeholder:c("Please choose"),getPopupContainer:cs})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:ds,title:c("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:_,children:(0,t.jsx)(us,{emptyValue:"",inheritedValue:a,options:n,placeholder:c("Please choose"),getPopupContainer:cs})})})})]})]})},od=fi,id=({value:e,inheritedImage:i,...r})=>(0,t.jsx)(od,{...r,value:e||i}),rd=e=>/^https?:\/\//i.test(e.trim()),sd=({form:e,name:i="mobileBackgroundImage",placeholder:r="",disabled:a=!1,elementSettings:l,inheritedImage:n="",isImageNone:c=!1,onImageNoneChange:m})=>{const{__:f}=s.useI18n(),{token:_}=(0,o.ui_kit$useToken)(),k=o.ui_kit$Form.useWatch(i,e),[b,h]=(0,d.useState)(""),y=k||n,x=_.formItemMarginBottomXS??0,E=(0,d.useMemo)(()=>({marginBottom:x/2}),[x]);(0,d.useEffect)(()=>{if(!y){h("");return}h(rd(y)?"validating":"success")},[y]);const w=!!k&&!rs(k),I=w?"error":b;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:I,help:w?f("Enter a URL starting with http:// or https://"):void 0,style:E,children:(0,t.jsx)(id,{inheritedImage:n,validateStatus:I,placeholder:r,name:i,disabled:a,elementSettings:l,imageInfo:l,onRemotePreviewValidate:h})}),(0,t.jsx)(o.ui_kit$Switch,{label:f("Without image"),labelSize:"small",size:"small",checked:c,onChange:m})]})},ad={image:"",positionX:"",positionY:"",repeat:"",size:""},wo=({elementSettings:e,imageEnabled:i=!1,desktopBackground:r=ad})=>{const{__:a}=s.useI18n(),{token:l}=(0,o.ui_kit$useToken)(),n=o.ui_kit$Form.useFormInstance(),c=l.formItemMarginBottomMD,m=s.useSendPostMessage(),f=e.mobileBackgroundImage?.[0]?.value,[_,k]=(0,d.useState)(f==="none"),b=o.ui_kit$Form.useWatch("mobileBackgroundImage",n);(0,d.useEffect)(()=>{k(f==="none")},[f]),(0,d.useEffect)(()=>{b&&k(!1)},[b]);const h=(0,d.useCallback)(P=>{k(P),n.setFieldsValue({mobileBackgroundImage:""}),m({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ni("mobileBackgroundImage",P?"none":"")})},[e.type,n,m]),y=(0,d.useMemo)(()=>[{label:a("Not defined"),value:"none"},{label:a("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:a("Repeat background (repeat)"),value:"repeat"},{label:a("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:a("Repeat background vertically (repeat-y)"),value:"repeat-y"}],[a]),x=(0,d.useMemo)(()=>[{label:a("Not defined"),value:""},{label:a("Contain"),value:"contain"},{label:a("Cover"),value:"cover"}],[a]),E=Xn(_?"none":b,r.image),w=(0,d.useMemo)(()=>({marginBottom:E?c:0}),[c,E]),I=(0,d.useMemo)(()=>(0,t.jsx)("div",{style:w,children:(0,t.jsx)(is,{form:n,elementSettings:e,label:a("Background color")})}),[a,e,n,w]),A=(0,d.useMemo)(()=>(0,t.jsx)("div",{style:w,children:(0,t.jsx)(sd,{form:n,placeholder:a("Background image"),elementSettings:e,inheritedImage:_?"":r.image,isImageNone:_,onImageNoneChange:h})}),[a,r.image,e,n,h,_,w]),v=(0,d.useMemo)(()=>(0,t.jsx)(td,{desktopPositionX:r.positionX,desktopPositionY:r.positionY,desktopRepeat:r.repeat,desktopSize:r.size,backgroundRepeatOptions:y,backgroundSizeOptions:x}),[y,x,r.positionX,r.positionY,r.repeat,r.size]);return(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:I,imageEnabled:i,backgroundImageEmpty:!E,imageUploadSlot:A,imageControlsSlot:v,usedColors:e.usedColors})},ms=({form:e,elementSettings:i,mobileBoxShadow:r,mobileBordersShow:a,mobileBorderRadiusShow:l,mobileBoxShadowShow:n,mobileSizeShow:c,mobileBackgroundShow:m,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:_,toggleShowMobileBorderHandler:k,toggleShowMobileBorderRadiusHandler:b,toggleShowMobileBoxShadowHandler:h,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:x})=>{const{__:E}=s.useI18n(),{token:w}=(0,o.ui_kit$useToken)(),I=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(zt,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,t.jsx)(o.ui_kit$FormSection,{title:E("Size"),collapsible:!0,open:c,onToggle:y,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:E("Table width"),placement:"left",children:(0,t.jsx)("div",{style:{marginBottom:w.formItemMarginBottomMD+4},children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,t.jsx)(o.ui_kit$FormSection,{title:E("Background"),collapsible:!0,open:m,onToggle:x,dividerTop:!0,children:(0,t.jsx)(wo,{elementSettings:Xt(i),imageEnabled:I.formTableFieldBackgroundImageEnabled,desktopBackground:So(i)})}),I.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("Borders"),collapsible:!0,open:a,onToggle:k,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),I.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("Border radius"),collapsible:!0,open:l,onToggle:b,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:f,setOneBorderRadiusValue:_,elementSettings:i})}),I.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("Box shadow"),collapsible:!0,open:n,onToggle:h,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile",form:e,elementSettings:i})}),I.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),I.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};ms.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func};var ps=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=Dt(),n=Dt(),c=s.useDispatch(),m=s.useElementEntityKind(),[f,_]=(0,d.useState)({}),[k,b]=(0,d.useState)(!0),[h,y]=(0,d.useState)({}),[x,E]=(0,d.useState)(!0),w=s.useSelector(s.selectEmailViewType),I=s.useSelector(s.selectMobileViewActive);s.useAppConfig();const[A,v]=(0,d.useState)(e.backgroundImage[0].value===""),P=s.useSelector(s.selectIsCodeMode),C=s.useSelector(s.selectCodeModeDirection),Y=P&&C!=="bottom",[W,F]=(0,d.useState)(!1),[N,T]=(0,d.useState)(!1),[J,Z]=(0,d.useState)(!1),[se,te]=(0,d.useState)(!1),[ne,_e]=(0,d.useState)(!1),[le,fe]=(0,d.useState)(!1),[Ae,ce]=(0,d.useState)(!1),[$e,Ce]=(0,d.useState)(!1),[ie,Be]=(0,d.useState)(!1),[ae,oe]=(0,d.useState)(!1),[me,de]=(0,d.useState)(!1),Q=[{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"}],q=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],z=D=>D&&(D?.width||D?.style||D?.color)?D:"",G=e.border,re=e.mobileBorder,ke=Object.keys(G).find(D=>G[D]?.width||G[D]?.style||G[D]?.color),he=Object.keys(re).find(D=>re[D]?.width||re[D]?.style||re[D]?.color),{remember:Pe,fillFields:ye}=co(e);(0,d.useEffect)(()=>{if(e){const D=e.boxShadow,ue=e.mobileBoxShadow;_(D),y(ue),ye(a,{...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:pt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:z(e.mobileBorder.all)||!(z(e.mobileBorder.top)||z(e.mobileBorder.bottom)||z(e.mobileBorder.right)||z(e.mobileBorder.left))&&z(e.border.all),mobileBorderTop:z(e.mobileBorder.top)||!z(e.mobileBorder.all)&&z(e.border.top),mobileBorderBottom:z(e.mobileBorder.bottom)||!z(e.mobileBorder.all)&&z(e.border.bottom),mobileBorderRight:z(e.mobileBorder.right)||!z(e.mobileBorder.all)&&z(e.border.right),mobileBorderLeft:z(e.mobileBorder.left)||!z(e.mobileBorder.all)&&z(e.border.left),mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...mo(e),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?b(!1):b(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?E(!1):E(!0),v(e.backgroundImage[0].value==="");const ge=l.isStaleBorderSnapshot(e,!!ke),Oe=n.isStaleBorderSnapshot(e,!!he);ge&&a.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Oe||ge&&!he)&&a.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),F(Ge=>ke&&!ge?!0:Ge),T(Ge=>ke&&!ge||he&&!Oe?!0:Ge),Z(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),te(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),_e(!!e.boxShadow),fe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ce(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Ce(!!e.mobileWidth.value),Be(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),oe(yo(e)),de(!!e.exportAsPicture)}},[a,e,ke,he,l,n]);const V=(0,d.useCallback)(D=>{Pe(D),c(m==="email"?s.setElementSettings$1(D):s.setElementSettings(D))},[c,m,Pe]),ee=D=>{const ue=a.getFieldsValue(!0),ge=Object.keys(D)[0];let Oe;switch(ge){case"exportAsPicture":Oe={exportAsPicture:ue.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Oe={boxShadow:{hOffset:ue.boxShadowHOffset,vOffset:ue.boxShadowVOffset,blurRadius:ue.boxShadowBlurRadius,spreadRadius:ue.boxShadowSpreadRadius,color:ue.boxShadowColor,inset:ue.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ue.borderPosition==="borderAll"?(Oe={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...ue.borderAll}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):ue.borderAll?.width||ue.borderAll?.style||ue.borderAll?.color?(Oe={border:{all:null,left:ue.borderAll,right:ue.borderAll,top:ue.borderAll,bottom:ue.borderAll,[H.REVERSE_BORDER_POSITIONS[ge]]:{...ue[ge],...D[ge]}}},a.setFieldsValue({borderAll:null,borderLeft:ue.borderAll,borderRight:ue.borderAll,borderTop:ue.borderAll,borderBottom:ue.borderAll,[ge]:{...ue[ge],...D[ge]}})):(Oe={border:{all:null,left:ue.borderLeft,right:ue.borderRight,top:ue.borderTop,bottom:ue.borderBottom,[H.REVERSE_BORDER_POSITIONS[ge]]:{...ue[ge],...D[ge]}}},a.setFieldsValue({border:Oe.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ue.mobileBorderPosition==="mobileBorderAll")Oe={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...ue.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[ge]+"-"}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const Ge=H.MOBILE_REVERSE_BORDER_POSITIONS[ge],Ye={...ue[ge],...D[ge]},Xe=!Ye?.width&&!Ye?.style&&!Ye?.color;if(ue.mobileBorder?.all?.width||ue.mobileBorder?.all?.style||ue.mobileBorder?.all?.color){const R=ue.mobileBorderAll;Oe={mobileBorder:{all:null,left:R,right:R,top:R,bottom:R,[Ge]:Xe?null:{...Ye,classNamePrefix:"em-mob-border_"+Ge+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:R,mobileBorderRight:R,mobileBorderTop:R,mobileBorderBottom:R,[ge]:Ye})}else{const R=e.mobileBorder||{},X=j=>{const M=R[j];return M&&(M?.width||M?.style||M?.color)?M:null};Oe={mobileBorder:{all:null,left:Ge==="left"?Xe?null:{...Ye,classNamePrefix:"em-mob-border_left-"}:X("left"),right:Ge==="right"?Xe?null:{...Ye,classNamePrefix:"em-mob-border_right-"}:X("right"),top:Ge==="top"?Xe?null:{...Ye,classNamePrefix:"em-mob-border_top-"}:X("top"),bottom:Ge==="bottom"?Xe?null:{...Ye,classNamePrefix:"em-mob-border_bottom-"}:X("bottom")}},a.setFieldsValue({[ge]:Ye})}}break;case"width":Oe={[ge]:{value:D[ge],dim:ue.widthDim}};break;case"widthDim":Oe={width:{value:ue.width,dim:D[ge]}};break;case"maxWidth":Oe={[ge]:{value:D[ge],dim:ue.maxWidthDim}};break;case"maxWidthDim":Oe={maxWidth:{value:ue.maxWidth,dim:D[ge]}};break;case"minWidth":Oe={[ge]:{value:D[ge],dim:ue.minWidthDim}};break;case"minWidthDim":Oe={minWidth:{value:ue.minWidth,dim:D[ge]}};break;case"backgroundImage":v(D[ge]===""),Oe={[ge]:[{...e.backgroundImage[0],value:D[ge]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Oe={borderRadius:{[H.BORDER_RADIUS_POSITION[ge]]:+D[ge]}};break;case"mobileWidth":Oe={[ge]:{classNamePrefix:"em-mob-width-",value:D[ge],dim:ue.mobileWidthDim}};break;case"mobileWidthDim":Oe={mobileWidth:{classNamePrefix:"em-mob-width-",value:ue.mobileWidth||100,dim:D[ge]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Oe={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[ge]]:D[ge],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[ge]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Oe={mobileBoxShadow:{hOffset:ue.mobileBoxShadowHOffset,vOffset:ue.mobileBoxShadowVOffset,blurRadius:ue.mobileBoxShadowBlurRadius,spreadRadius:ue.mobileBoxShadowSpreadRadius,color:ue.mobileBoxShadowColor,inset:ue.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Oe=To(D),!Oe)return;break;case"mobileAlign":Oe={[ge]:{classNamePrefix:"em-mob-table_align-",value:D[ge]}};break;default:Oe=D}ge!=="borderPosition"&&ge!=="mobileBorderPosition"&&(r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Oe}),ge!=="mobileBorderRadiusAll"&&ge!=="mobileBorderRadiusTopLeft"&&ge!=="mobileBorderRadiusTopRight"&&ge!=="mobileBorderRadiusBottomLeft"&&ge!=="mobileBorderRadiusBottomRight"&&V({...e,...Oe,mobileBorderRadius:{...e.mobileBorderRadius,...Oe?.mobileBorderRadius},activateSection:null,changeKey:ge}))},we=()=>{const D=a.getFieldsValue(!0);l.markBorderToggled(!W),setTimeout(()=>{F(ue=>!ue),W?(D.borderAll=H.NULL_BORDER,D.borderTop=H.NULL_BORDER,D.borderBottom=H.NULL_BORDER,D.borderRight=H.NULL_BORDER,D.borderLeft=H.NULL_BORDER):D.borderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:D.borderAll.color,style:D.borderAll.style,width:D.borderAll.width}}}})})},je=()=>{const D=a.getFieldsValue(!0);n.markBorderToggled(!N),setTimeout(()=>{T(ue=>!ue),N?(D.mobileBorderAll=H.NULL_BORDER,D.mobileBorderTop=H.NULL_BORDER,D.mobileBorderBottom=H.NULL_BORDER,D.mobileBorderRight=H.NULL_BORDER,D.mobileBorderLeft=H.NULL_BORDER):D.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:D.mobileBorderAll.color,style:D.mobileBorderAll.style,width:D.mobileBorderAll.width}}}})})},K=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{Z(ue=>!ue),J?(D.borderRadiusAll=0,b(!0)):D.borderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:D.borderRadiusAll}}})})},ve=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{te(ue=>!ue),se?(D.mobileBorderRadiusAll=null,E(!0)):D.mobileBorderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:D.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Re=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{_e(ue=>!ue),ne?(D.boxShadowInset=!1,D.boxShadowHOffset=null,D.boxShadowVOffset=null,D.boxShadowBlurRadius=null,D.boxShadowSpreadRadius=null,D.boxShadowColor=""):(D.boxShadowInset=!1,D.boxShadowHOffset=5,D.boxShadowVOffset=5,D.boxShadowBlurRadius=10,D.boxShadowSpreadRadius=-5,D.boxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:D.boxShadowBlurRadius,color:D.boxShadowColor,hOffset:D.boxShadowHOffset,inset:D.boxShadowInset,spreadRadius:D.boxShadowSpreadRadius,vOffset:D.boxShadowVOffset}}})})},Le=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{fe(ue=>!ue),le?(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=null,D.mobileBoxShadowVOffset=null,D.mobileBoxShadowBlurRadius=null,D.mobileBoxShadowSpreadRadius=null,D.mobileBoxShadowColor=""):(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=5,D.mobileBoxShadowVOffset=5,D.mobileBoxShadowBlurRadius=10,D.mobileBoxShadowSpreadRadius=-5,D.mobileBoxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:D.mobileBoxShadowBlurRadius,color:D.mobileBoxShadowColor,hOffset:D.mobileBoxShadowHOffset,inset:D.mobileBoxShadowInset,spreadRadius:D.mobileBoxShadowSpreadRadius,vOffset:D.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Ue=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{ce(ue=>!ue),Ae&&(D.width="",D.minWidth="",D.maxWidth="",r({operation:s.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"}}}))})},Me=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{Ce(ue=>!ue),$e&&(D.mobileWidth="",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},He=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{Be(ue=>!ue),ie?(D.backgroundColor="",D.backgroundImage="",D.backgroundPositionX="",D.backgroundPositionY="",D.backgroundRepeat="none",D.backgroundSize="",v(!0)):(D.backgroundColor="#E5E5E5",D.backgroundSize="",D.backgroundRepeat="none"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:D.backgroundColor,backgroundImage:[{type:"url",value:D.backgroundImage}],backgroundPositionX:D.backgroundPositionX,backgroundPositionY:D.backgroundPositionY,backgroundRepeat:D.backgroundRepeat,backgroundSize:D.backgroundSize}})})},O=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{oe(ue=>!ue),ae?D.mobileBackgroundColor="":D.mobileBackgroundColor="#E5E5E5",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:D.mobileBackgroundColor}}}),ae&&Ro(a,e,r)})},xe=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{de(ue=>!ue),me&&(D.exportAsPicture=!1,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})};return(0,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_table_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:H.BORDER_POSITIONS[ke]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[he]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:ee,autoComplete:"off",className:"element-controls",children:[!Y&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),w==="mobile"&&I.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(ms,{form:a,elementSettings:e,mobileBoxShadow:h,mobileBordersShow:N,mobileBorderRadiusShow:se,mobileBoxShadowShow:le,mobileSizeShow:$e,mobileBackgroundShow:ae,oneMobileBorderRadiusValue:x,setOneMobileBorderRadiusValue:E,toggleShowMobileBorderHandler:je,toggleShowMobileBorderRadiusHandler:ve,toggleShowMobileBoxShadowHandler:Le,toggleShowMobileSizeHandler:Me,toggleShowMobileBackgroundHandler:O})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(os,{form:a,elementSettings:e,boxShadow:f,bordersShow:W,borderRadiusShow:J,boxShadowShow:ne,backgroundShow:ie,backgroundImageEmpty:A,backgroundRepeatOptions:Q,backgroundSizeOptions:q,sizeShow:Ae,modificationShow:me,oneBorderRadiusValue:k,setOneBorderRadiusValue:b,toggleShowBorderHandler:we,toggleShowBorderRadiusHandler:K,toggleShowBoxShadowHandler:Re,toggleShowSizeHandler:Ue,toggleShowBackgroundHandler:He,toggleShowModificationHandler:xe})})]})};ps.propTypes={elementSettings:g.default.object.isRequired};var hs=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=s.useAppConfig(),n=s.useSelector(s.selectIsCodeMode),c=s.useSelector(s.selectCodeModeDirection),[m,f]=(0,d.useState)({}),[_,k]=(0,d.useState)("https://"),b=({target:x})=>{const{selectionStart:E,selectionEnd:w}=x;x&&f({target:x,selection:{start:E,end:w}})};(0,d.useEffect)(()=>{if(e){let x="",E="",w=e.href==null?"https://":e.href;if(w&&w.substring(0,7)==="mailto:"){const I=new URL(e.href);x=I.searchParams.get("subject")||"",E=I.searchParams.get("body")||"",w=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(""));a.setFieldsValue({...e,href:w,subject:x,body:E})}},[a,e]);const h=x=>{const E=Object.keys(x)[0];let w=x;if(E==="href"){const I=io(x[E]);if(I!==x[E]&&a.setFieldValue("href",I),I.substring(0,7)==="mailto:"){const A=a.getFieldValue("subject"),v=a.getFieldValue("body"),P=[];A&&P.push(`subject=${encodeURIComponent(A)}`),v&&P.push(`body=${encodeURIComponent(v)}`),w={href:P.length>0?`${I}?${P.join("&")}`:I}}else w={href:I}}if(E==="subject"||E==="body"){const I=a.getFieldValue("href")||"";if(I.substring(0,7)==="mailto:"){const A=I.split("?")[0],v=E==="subject"?x[E]:a.getFieldValue("subject"),P=E==="body"?x[E]:a.getFieldValue("body"),C=[];v&&C.push(`subject=${encodeURIComponent(v)}`),P&&C.push(`body=${encodeURIComponent(P)}`),w={href:C.length>0?`${A}?${C.join("&")}`:A}}else return}r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:w})},y=x=>{r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:x})};return(0,t.jsx)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:h,autoComplete:"off",className:"element-controls",children:!n||c==="bottom"?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined}),onSelect:b})})}),l.formLinkFieldInsertImageEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:i("Actions with the chosen text"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"PicLeftOutlined",component:o.icons$PicLeftOutlined}),onClick:()=>y("add_img"),children:i("Add inline image")})})}),(0,t.jsx)(Bo,{form:a,elementSettings:e,showAddParagraph:!1,linkTarget:m,linkProtocol:_,setLinkProtocol:k})]}):(0,t.jsx)(Ci,{form:a,elementSettings:e,showAddParagraph:!1})})};hs.propTypes={elementSettings:g.default.object.isRequired};var bs=()=>{const{__:e}=s.useI18n();return(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:14,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"height",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:e("Indent height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})};bs.propTypes={};var fs=({form:e,elementSettings:i})=>(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i})})});fs.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var gs=({elementSettings:e})=>{const{__:i}=s.useI18n(),[r]=o.ui_kit$Form.useForm(),a=s.useDispatch(),l=s.useSendPostMessage(),n=s.useSelector(s.selectEmailViewType),c=s.useSelector(s.selectMobileViewActive),m=s.useSelector(s.selectIsCodeMode),f=s.useSelector(s.selectCodeModeDirection),_=m&&f!=="bottom",k=s.useElementEntityKind(),{remember:b,fillFields:h}=co(e);(0,d.useEffect)(()=>{e&&h(r,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:pt(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[r,e]);const y=(0,d.useCallback)(E=>{b(E),a(k==="email"?s.setElementSettings$1(E):s.setElementSettings(E))},[a,k,b]),x=E=>{const w=r.getFieldsValue(!0),I=Object.keys(E)[0];let A;switch(I){case"height":A={[I]:{value:E[I],dim:w.heightDim}};break;case"heightDim":A={height:{value:w.height,dim:E[I]}};break;case"mobileHeight":A={[I]:{classNamePrefix:"em-mob-height-",value:E[I],dim:w.mobileHeightDim}};break;case"mobileHeightDim":A={mobileHeight:{classNamePrefix:"em-mob-height-",value:w.mobileHeight,dim:E[I]}};break;default:A=E}l({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:A}),y({...e,...A,activateSection:null,changeKey:I})};return(0,t.jsxs)(o.ui_kit$Form,{form:r,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:x,autoComplete:"off",children:[!_&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),n==="mobile"&&c.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:n==="mobile"&&c.styles?"block":"none",marginBottom:10},children:(0,t.jsx)(fs,{form:r,elementSettings:e})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",style:{display:n==="mobile"&&c.styles?"none":"block"},children:(0,t.jsx)(bs,{})})]})};gs.propTypes={elementSettings:g.default.object.isRequired};var Xo=({form:e,elementSettings:i,typeOfForm:r="desktop"})=>{const a=s.useSendPostMessage(),l=r==="mobile",n=l?"mobileDirection":"direction",c=f=>{e.setFieldsValue({[n]:f}),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[n]:f}})},m=l?i.mobileDirection?.value??"":i.direction??"";return(0,t.jsx)(o.ui_kit$Form.Item,{name:n,className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$FormDirectionControl,{value:m,onChange:c})})},Ko=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,Li=({form:e,backgroundImageEmpty:i,appConfig:r,token:a,elementSettings:l,backgroundRepeatOptions:n,handleChangeValues:c})=>{const{__:m}=s.useI18n(),[f,_]=(0,d.useState)(""),[k,b]=(0,d.useState)("px"),[h,y]=(0,d.useState)(""),[x,E]=(0,d.useState)("px"),w=[{label:m("Not defined"),value:""},{label:m("Contain"),value:"contain"},{label:m("Cover"),value:"cover"}],I=P=>{if(!P||typeof P!="string")return{value:"",unit:"px"};P=P.trim();const C=P.match(/^(\d*\.?\d+)(%|px)$/);return C?{value:C[1],unit:C[2]}:{value:P,unit:"px"}};(0,d.useEffect)(()=>{const P=e.getFieldValue("backgroundPositionX"),C=e.getFieldValue("backgroundPositionY"),Y=I(P),W=I(C);_(String(Y.value)),b(Y.unit),y(String(W.value)),E(W.unit)},[e]);const A=(P,C)=>{_(String(P)),b(C),c&&c({backgroundPositionX:{position:P,unit:C}})},v=(P,C)=>{y(String(P)),E(C),c&&c({backgroundPositionY:{position:P,unit:C}})};return(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:m("Background color"),placement:"bottom",getPopupContainer:Ko,children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:a.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:m("Background color"),usedColors:l.usedColors,placement:"bottomLeft"})})})})}),r.formCellFieldBackgroundImageEnabled&&(0,t.jsxs)(o.ui_kit$Col,{span:i?12:24,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image"),placement:"bottom",getPopupContainer:Ko,children:(0,t.jsx)("div",{children:(0,t.jsx)(Ot,{form:e,label:m("Background image"),name:"backgroundImage",tooltipTitle:m("Background image"),placeholder:m("Background image link/route")})})}),!i&&(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:a.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$InputSelect,{options:Yo.horizontal,position:f,setPosition:P=>A(P,k),unit:k,setUnit:P=>A(f,P),placeholder:m("Horizontal position"),prefix:(0,t.jsx)(s.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Horizontal position"),getTooltipPopupContainer:Ko})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$InputSelect,{options:Yo.vertical,position:h,setPosition:P=>v(P,x),unit:x,setUnit:P=>v(h,P),placeholder:m("Vertical position"),prefix:(0,t.jsx)(s.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Vertical position"),getTooltipPopupContainer:Ko})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image repeat"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:a.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:m("Please choose"),options:n,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:a.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:m("Please choose"),options:w,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},ld=({form:e,elementSettings:i,__:r,appConfig:a})=>{const l=H.useGoogleFontsLoader(),[n,c]=(0,d.useState)(null);return(0,d.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,t.jsxs)("div",{style:{marginBottom:"-15px"},children:[a.formTextFieldTypografEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Text font"),placement:"bottom",zIndex:1,getPopupContainer:m=>m.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:l,getPopupContainer:m=>m.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:r("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:r("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:r(n?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:r(n?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:r(n?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:r(n?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Text color"),placement:"bottom",zIndex:2,getPopupContainer:m=>m.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:r("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:r("Color"),usedColors:i.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Text background"),placement:"bottom",zIndex:2,getPopupContainer:m=>m.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:r("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:r("Background color"),usedColors:i.usedColors})})})})]})]})},_s=({form:e,elementSettings:i,boxShadow:r,bordersShow:a,borderRadiusShow:l,boxShadowShow:n,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:f,sizeShow:_,maxWidthValue:k,modificationShow:b,paddingsExt:h,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,elementListShow:E,togglePaddingHandler:w,toggleShowBorderHandler:I,toggleShowBorderRadiusHandler:A,toggleShowBoxShadowHandler:v,toggleShowSizeHandler:P,toggleShowBackgroundHandler:C,toggleShowModificationHandler:Y,handleChangeValues:W})=>{const{__:F}=s.useI18n(),{token:N}=(0,o.ui_kit$useToken)(),T=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(so,{form:e,elementSettings:i})}),T.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:i})})]}),T.formCellFieldPaddingsEnabled&&(0,t.jsxs)(t.Fragment,{children:[E&&(0,t.jsx)("div",{style:{marginTop:"15px"},children:(0,t.jsx)(ld,{form:e,elementSettings:i,appConfig:T,__:F})}),(0,t.jsx)(o.ui_kit$FormSection,{title:F("Padding"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:w,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"&&T.formCellFieldSizeEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Size"),collapsible:!0,open:_,onToggle:P,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:k,dimensionSelect:Mt,rowStyle:{paddingBottom:4},labels:{width:F("Width"),height:F("Height"),minWidth:F("Minimum width"),maxWidth:F("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:F("Background"),collapsible:!0,open:c,onToggle:C,dividerTop:!0,children:[(0,t.jsx)(Li,{form:e,backgroundImageEmpty:m,appConfig:T,token:N,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:W}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),T.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Borders"),collapsible:!0,open:a,onToggle:I,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),T.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Border radius"),collapsible:!0,open:l,onToggle:A,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,elementSettings:i})}),T.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Box shadow"),collapsible:!0,open:n,onToggle:v,dividerTop:!0,children:(0,t.jsx)(It,{})}),T.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,t.jsxs)(o.ui_kit$FormSection,{title:F("Settings"),collapsible:!0,open:b,onToggle:Y,dividerTop:!0,children:[i.type==="structure"&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Form.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0},children:(0,t.jsx)(o.ui_kit$Switch,{id:"contrast-colors",label:F("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,t.jsx)(Pi,{form:e,elementSettings:i})]}),T.formFieldVisibilityEnabled&&i.type!=="column"&&(0,t.jsx)(o.ui_kit$FormSection,{title:F(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,t.jsx)(Xo,{elementSettings:i,form:e}):void 0})}),T.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};_s.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,elementListShow:g.default.bool,togglePaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var qo=({form:e,elementSettings:i,mobilePaddingsExt:r,setMobilePaddingsExt:a,rowStyle:l})=>{const{__:n}=s.useI18n(),c=s.useSendPostMessage(),m=()=>{a(_=>!_);const f=e.getFieldsValue(!0);r||(f.mobilePaddingLeftRight=f.mobilePaddingLeft,f.mobilePaddingTopBottom=f.mobilePaddingTop,f.mobilePaddingRight=f.mobilePaddingLeft,f.mobilePaddingBottom=f.mobilePaddingTop,c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:f.mobilePaddingTop!==""?f.mobilePaddingTop:null,bottom:f.mobilePaddingTopBottom!==""?f.mobilePaddingTopBottom:null,left:f.mobilePaddingLeft!==""?f.mobilePaddingLeft:null,right:f.mobilePaddingRight!==""?f.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,t.jsx)(o.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:r,onToggleExtended:m,showHorizontal:!0,gutter:10,rowStyle:l,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")}})};qo.propTypes={form:g.default.shape({getFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,mobilePaddingsExt:g.default.bool.isRequired,setMobilePaddingsExt:g.default.func.isRequired,rowStyle:g.default.object};var xs=({form:e,elementSettings:i,boxShadow:r,mobileBordersShow:a,mobileBorderRadiusShow:l,mobileBoxShadowShow:n,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:f,mobilePaddingsExt:_,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:y,toggleShowMobileBorderRadiusHandler:x,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:I,toggleShowMobilePaddingHandler:A})=>{const{__:v}=s.useI18n(),P=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),P.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),P.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Padding"),collapsible:!0,open:f,onToggle:A,dividerTop:!0,children:(0,t.jsx)(qo,{form:e,elementSettings:i,mobilePaddingsExt:_,setMobilePaddingsExt:k,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&P.formCellFieldSizeEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Size"),collapsible:!0,open:c,onToggle:w,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:15},children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:15},children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:v("Background"),collapsible:!0,open:m,onToggle:I,dividerTop:!0,children:(0,t.jsx)(wo,{elementSettings:Xt(i),imageEnabled:P.formCellFieldBackgroundImageEnabled,desktopBackground:So(i)})}),P.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Borders"),collapsible:!0,open:a,onToggle:y,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Border radius"),collapsible:!0,open:l,onToggle:x,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i,typeOfForm:"mobile"})}),P.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Box shadow"),collapsible:!0,open:n,onToggle:E,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile"})}),P.formFieldVisibilityEnabled&&i.type!=="column"&&(0,t.jsx)(o.ui_kit$FormSection,{title:v(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,t.jsx)(Xo,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),P.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};xs.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var ks=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),a=s.useDispatch(),[l]=o.ui_kit$Form.useForm(),n=Dt(),c=Dt(),[m,f]=(0,d.useState)(""),[_,k]=(0,d.useState)({}),[b,h]=(0,d.useState)(!0),[y,x]=(0,d.useState)(!0),E=s.useSelector(s.selectEmailViewType),w=s.useSelector(s.selectMobileViewActive);s.useAppConfig();const[I,A]=(0,d.useState)(e.backgroundImage[0].value===""),v=s.useSelector(s.selectIsCodeMode),P=s.useSelector(s.selectCodeModeDirection),C=v&&P!=="bottom",[Y,W]=(0,d.useState)(!1),[F,N]=(0,d.useState)(!1),[T,J]=(0,d.useState)(!1),[Z,se]=(0,d.useState)(!1),[te,ne]=(0,d.useState)(!1),[_e,le]=(0,d.useState)(!1),[fe,Ae]=(0,d.useState)(!1),[ce,$e]=(0,d.useState)(!1),[Ce,ie]=(0,d.useState)(!1),[Be,ae]=(0,d.useState)(!1),[oe,me]=(0,d.useState)(!1),[de,Q]=(0,d.useState)(!1),[q,z]=(0,d.useState)(!1),[G,re]=(0,d.useState)(!1),[ke,he]=(0,d.useState)(!1),Pe=s.useElementEntityKind(),ye=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],V=e.border,ee=e.mobileBorder,we=Object.keys(V).find(j=>V[j]?.width||V[j]?.style||V[j]?.color),je=Object.keys(ee).find(j=>ee[j]?.width||ee[j]?.style||ee[j]?.color),K=j=>j&&(j?.width||j?.style||j?.color)?j:"",{remember:ve,fillFields:Re}=co(e);(0,d.useEffect)(()=>{if(e){const j=e.boxShadow;k(j),Re(l,{...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:K(e.mobileBorder.all)||!(K(e.mobileBorder.top)||K(e.mobileBorder.bottom)||K(e.mobileBorder.right)||K(e.mobileBorder.left))&&K(e.border.all),mobileBorderTop:K(e.mobileBorder.top)||!K(e.mobileBorder.all)&&K(e.border.top),mobileBorderBottom:K(e.mobileBorder.bottom)||!K(e.mobileBorder.all)&&K(e.border.bottom),mobileBorderRight:K(e.mobileBorder.right)||!K(e.mobileBorder.all)&&K(e.border.right),mobileBorderLeft:K(e.mobileBorder.left)||!K(e.mobileBorder.all)&&K(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:pt(e.mobileWidth?.value)||pt(e.width?.value),mobileWidthDim:pt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:pt(e.mobileHeight?.value)||pt(e.height?.value),mobileHeightDim:pt(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||""),...mo(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))?h(!1):h(!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))?x(!1):x(!0),A(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)?W(!1):W(!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)?N(!1):N(!0);const M=n.isStaleBorderSnapshot(e,!!we),Ee=c.isStaleBorderSnapshot(e,!!je);M&&l.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ee||M&&!je)&&l.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),J(Fe=>we&&!M?!0:Fe),se(Fe=>we&&!M||je&&!Ee?!0:Fe),ne(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),le(!!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),$e(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ie(!!e.width.value&&e.type!=="column"||!!e.height.value),ae(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),me(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),yo(e)&&Q(!0),z(!!e.exportAsPicture||!!e.isContrastBlock),re(!!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"?he(!0):he(!1)}},[l,e,we,je,n,c]);const Le=(0,d.useCallback)(j=>{ve(j),a(Pe==="email"?s.setElementSettings$1(j):s.setElementSettings(j))},[a,Pe,ve]),Ue=j=>{const M=l.getFieldsValue(!0),Ee=Object.keys(j)[0];let Fe;switch(f(l.getFieldsValue(!0).widthDim==="%"?100:""),Ee){case"exportAsPicture":Fe={exportAsPicture:M.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Fe={boxShadow:{hOffset:M.boxShadowHOffset,vOffset:M.boxShadowVOffset,blurRadius:M.boxShadowBlurRadius,spreadRadius:M.boxShadowSpreadRadius,color:M.boxShadowColor,inset:M.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":M.borderPosition==="borderAll"?(Fe={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...M.borderAll}}},l.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):M.borderAll?.width||M.borderAll?.style||M.borderAll?.color?(Fe={border:{all:null,left:M.borderAll,right:M.borderAll,top:M.borderAll,bottom:M.borderAll,[H.REVERSE_BORDER_POSITIONS[Ee]]:{...M[Ee],...j[Ee]}}},l.setFieldsValue({borderAll:null,borderLeft:M.borderAll,borderRight:M.borderAll,borderTop:M.borderAll,borderBottom:M.borderAll,[Ee]:{...M[Ee],...j[Ee]}})):(Fe={border:{all:null,left:M.borderLeft,right:M.borderRight,top:M.borderTop,bottom:M.borderBottom,[H.REVERSE_BORDER_POSITIONS[Ee]]:{...M[Ee],...j[Ee]}}},l.setFieldsValue({border:Fe.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(M.mobileBorderPosition==="mobileBorderAll")Fe={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...M.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[Ee]+"-"}}},l.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const tt=H.MOBILE_REVERSE_BORDER_POSITIONS[Ee],qe={...M[Ee],...j[Ee]},ct=!qe?.width&&!qe?.style&&!qe?.color;if(M.mobileBorder?.all?.width||M.mobileBorder?.all?.style||M.mobileBorder?.all?.color){const Ze=M.mobileBorderAll;Fe={mobileBorder:{all:null,left:Ze,right:Ze,top:Ze,bottom:Ze,[tt]:ct?null:{...qe,classNamePrefix:"em-mob-border_"+tt+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Ze,mobileBorderRight:Ze,mobileBorderTop:Ze,mobileBorderBottom:Ze,[Ee]:qe})}else{const Ze=e.mobileBorder||{},ut=Bt=>{const B=Ze[Bt];return B&&(B?.width||B?.style||B?.color)?B:null};Fe={mobileBorder:{all:null,left:tt==="left"?ct?null:{...qe,classNamePrefix:"em-mob-border_left-"}:ut("left"),right:tt==="right"?ct?null:{...qe,classNamePrefix:"em-mob-border_right-"}:ut("right"),top:tt==="top"?ct?null:{...qe,classNamePrefix:"em-mob-border_top-"}:ut("top"),bottom:tt==="bottom"?ct?null:{...qe,classNamePrefix:"em-mob-border_bottom-"}:ut("bottom")}},l.setFieldsValue({[Ee]:qe})}}break;case"width":Fe={[Ee]:{value:j[Ee],dim:M.widthDim}};break;case"height":Fe={[Ee]:{value:j[Ee],dim:M.heightDim}};break;case"widthDim":Fe={width:{value:M.width,dim:j[Ee]}};break;case"heightDim":Fe={height:{value:M.height,dim:j[Ee]}};break;case"backgroundImage":A(j[Ee]===""),Fe={[Ee]:[{...e.backgroundImage[0],value:j[Ee]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Fe={padding:{left:M.paddingLeft,right:M.paddingRight,top:M.paddingTop,bottom:M.paddingBottom,[H.PADDING_POSITION[Ee]]:+j[Ee]}};break;case"paddingTopBottom":Fe={padding:{left:M.paddingLeft,right:M.paddingRight,top:+j[Ee],bottom:+j[Ee]}},M.paddingTop=M.paddingBottom=+j[Ee];break;case"paddingLeftRight":Fe={padding:{top:M.paddingTop,bottom:M.paddingBottom,left:+j[Ee],right:+j[Ee]}},M.paddingLeft=M.paddingRight=+j[Ee];break;case"borderRadiusAll":Fe={borderRadius:{[H.BORDER_RADIUS_POSITION[Ee]]:+j[Ee]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Fe={borderRadius:{topLeft:M.borderRadiusTopLeft,bottomLeft:M.borderRadiusBottomLeft,topRight:M.borderRadiusTopRight,bottomRight:M.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[Ee]]:+j[Ee]}};break;case"mobileWidth":Fe={[Ee]:{classNamePrefix:"em-mob-width-",value:j[Ee],dim:M.mobileWidthDim}};break;case"mobileWidthDim":Fe={mobileWidth:{classNamePrefix:"em-mob-width-",value:M.mobileWidth||100,dim:j[Ee]}};break;case"mobileHeight":Fe={[Ee]:{classNamePrefix:"em-mob-height-",value:j[Ee],dim:M.mobileHeightDim}};break;case"mobileHeightDim":Fe={mobileHeight:{classNamePrefix:"em-mob-height-",value:M.mobileHeight,dim:j[Ee]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Fe={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[Ee]]:j[Ee],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[Ee]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Fe={mobileBoxShadow:{hOffset:M.mobileBoxShadowHOffset,vOffset:M.mobileBoxShadowVOffset,blurRadius:M.mobileBoxShadowBlurRadius,spreadRadius:M.mobileBoxShadowSpreadRadius,color:M.mobileBoxShadowColor,inset:M.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Fe={[Ee]:{classNamePrefix:"em-mob-text_align-",value:j[Ee]}};break;case"mobileVerticalAlign":Fe={[Ee]:{classNamePrefix:"em-mob-vertical_align-",value:j[Ee]}};break;case"mobileDirection":Fe={[Ee]:{classNamePrefix:"em-mob-direction-",value:j[Ee]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Fe=To(j),!Fe)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Fe={mobilePadding:{all:null,top:M.mobilePaddingTop!==""?M.mobilePaddingTop:null,right:M.mobilePaddingRight!==""?M.mobilePaddingRight:null,bottom:M.mobilePaddingBottom!==""?M.mobilePaddingBottom:null,left:M.mobilePaddingLeft!==""?M.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":M.mobilePaddingTop=M.mobilePaddingBottom=j[Ee],Fe={mobilePadding:{all:null,top:M.mobilePaddingTop!==""?M.mobilePaddingTop:null,right:M.mobilePaddingRight!==""?M.mobilePaddingRight:null,bottom:M.mobilePaddingBottom!==""?M.mobilePaddingBottom:null,left:M.mobilePaddingLeft!==""?M.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":M.mobilePaddingLeft=M.mobilePaddingRight=j[Ee],Fe={mobilePadding:{all:null,top:M.mobilePaddingTop!==""?M.mobilePaddingTop:null,right:M.mobilePaddingRight!==""?M.mobilePaddingRight:null,bottom:M.mobilePaddingBottom!==""?M.mobilePaddingBottom:null,left:M.mobilePaddingLeft!==""?M.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":Fe={[Ee]:isNaN(parseFloat(j[Ee].position))?j[Ee].position:j[Ee].position+j[Ee].unit};break;default:Fe=j}Ee!=="borderPosition"&&Ee!=="mobileBorderPosition"&&(r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Fe}),Ee!=="mobileBorderRadiusAll"&&Ee!=="mobileBorderRadiusTopLeft"&&Ee!=="mobileBorderRadiusTopRight"&&Ee!=="mobileBorderRadiusBottomLeft"&&Ee!=="mobileBorderRadiusBottomRight"&&Le({...e,...Fe,mobileBorderRadius:{...e.mobileBorderRadius,...Fe?.mobileBorderRadius},activateSection:null,changeKey:Ee}))},Me=()=>{W(M=>!M);const j=l.getFieldsValue(!0);Y||(j.paddingLeftRight=j.paddingLeft,j.paddingTopBottom=j.paddingTop,j.paddingRight=j.paddingLeft,j.paddingBottom=j.paddingTop,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:j.paddingTopBottom,bottom:j.paddingTopBottom,left:j.paddingLeftRight,right:j.paddingLeftRight}}}))},He=()=>{const j=l.getFieldsValue(!0);n.markBorderToggled(!T),setTimeout(()=>{J(M=>!M),T?(j.borderAll=H.NULL_BORDER,j.borderTop=H.NULL_BORDER,j.borderBottom=H.NULL_BORDER,j.borderRight=H.NULL_BORDER,j.borderLeft=H.NULL_BORDER):j.borderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:j.borderAll.color,style:j.borderAll.style,width:j.borderAll.width}}}})})},O=()=>{const j=l.getFieldsValue(!0);c.markBorderToggled(!Z),setTimeout(()=>{se(M=>!M),Z?(j.mobileBorderAll=H.NULL_BORDER,j.mobileBorderTop=H.NULL_BORDER,j.mobileBorderBottom=H.NULL_BORDER,j.mobileBorderRight=H.NULL_BORDER,j.mobileBorderLeft=H.NULL_BORDER):j.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:j.mobileBorderAll.color,style:j.mobileBorderAll.style,width:j.mobileBorderAll.width}}}})})},xe=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{ne(M=>!M),te?(j.borderRadiusAll=0,h(!0)):j.borderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:j.borderRadiusAll}}})})},D=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{le(M=>!M),_e?(j.mobileBorderRadiusAll=null,x(!0)):j.mobileBorderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:j.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ue=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{Ae(M=>!M),fe?(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"),r({operation:s.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}}})})},ge=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{$e(M=>!M),ce?(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"),r({operation:s.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-"}}})})},Oe=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{ie(M=>!M),Ce&&(j.width="",j.height="",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},Ge=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{ae(M=>!M),Be&&(j.mobileWidth="",j.mobileHeight="",r({operation:s.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 j=l.getFieldsValue(!0);setTimeout(()=>{me(M=>!M),oe?(j.backgroundColor="",j.backgroundImage="",j.backgroundPositionX="",j.backgroundPositionY="",j.backgroundRepeat="none",j.backgroundSize="",A(!0)):(j.backgroundColor="#E5E5E5",j.backgroundSize="",j.backgroundRepeat="none"),r({operation:s.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}})})},Xe=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{Q(M=>!M),de?j.mobileBackgroundColor="":j.mobileBackgroundColor="#E5E5E5",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:j.mobileBackgroundColor}}}),de&&Ro(l,e,r)})},R=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{z(M=>!M),q&&(j.exportAsPicture=!1,j.isContrastBlock=!1,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},X=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{re(M=>!M),G&&(j.mobilePaddingLeftRight="",j.mobilePaddingLeft="",j.mobilePaddingRight="",j.mobilePaddingTopBottom="",j.mobilePaddingTop="",j.mobilePaddingBottom="",r({operation:s.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,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_td_form",initialValues:{horizontalPosition:"",horizontalUnit:"px",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",show:"all",borderPosition:H.BORDER_POSITIONS[we]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[je]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",boxShadowInset:"",boxShadowHOffset:"",boxShadowVOffset:"",boxShadowBlurRadius:"",boxShadowSpreadRadius:"",boxShadowColor:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1},onValuesChange:Ue,autoComplete:"off",className:"element-controls",children:E==="mobile"&&w.styles?(0,t.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:E==="mobile"&&w.styles?"flex":"none"},children:[(0,t.jsx)("div",{className:"selected_form-mobile-props-header",children:!C&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})})}),(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(xs,{form:l,elementSettings:e,boxShadow:_,mobileBordersShow:Z,mobileBorderRadiusShow:_e,mobileBoxShadowShow:ce,mobileSizeShow:Be,mobileBackgroundShow:de,mobilePaddingShow:G,mobilePaddingsExt:F,setMobilePaddingsExt:N,oneMobileBorderRadiusValue:y,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:O,toggleShowMobileBorderRadiusHandler:D,toggleShowMobileBoxShadowHandler:ge,toggleShowMobileSizeHandler:Ge,toggleShowMobileBackgroundHandler:Xe,toggleShowMobilePaddingHandler:X})})]}):(0,t.jsxs)(t.Fragment,{children:[!C&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(_s,{form:l,elementSettings:e,boxShadow:_,bordersShow:T,borderRadiusShow:te,boxShadowShow:fe,backgroundShow:oe,backgroundImageEmpty:I,backgroundRepeatOptions:ye,sizeShow:Ce,maxWidthValue:m,modificationShow:q,paddingsExt:Y,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementListShow:ke,togglePaddingHandler:Me,toggleShowBorderHandler:He,toggleShowBorderRadiusHandler:xe,toggleShowBoxShadowHandler:ue,toggleShowSizeHandler:Oe,toggleShowBackgroundHandler:Ye,toggleShowModificationHandler:R,handleChangeValues:Ue})})]})})};ks.propTypes={elementSettings:g.default.object.isRequired};var Es=({form:e,elementSettings:i,boxShadow:r,bordersShow:a,borderRadiusShow:l,boxShadowShow:n,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:f,sizeShow:_,maxWidthValue:k,modificationShow:b,paddingShow:h,paddingsExt:y,oneBorderRadiusValue:x,setOneBorderRadiusValue:E,togglePaddingHandler:w,toggleShowPaddingHandler:I,toggleShowBorderHandler:A,toggleShowBorderRadiusHandler:v,toggleShowBoxShadowHandler:P,toggleShowSizeHandler:C,toggleShowBackgroundHandler:Y,toggleShowModificationHandler:W,handleChangeValues:F})=>{const{__:N}=s.useI18n(),{token:T}=(0,o.ui_kit$useToken)(),J=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:N("Appearance on mobile devices"),type:"info"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(so,{form:e,elementSettings:i})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:i})})]}),J.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Padding"),collapsible:!0,open:h,onToggle:I,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:y,onToggleExtended:w,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,t.jsx)(o.ui_kit$FormSection,{title:N("Size"),collapsible:!0,open:_,onToggle:C,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:k,dimensionSelect:Mt,showMinMax:!0,minWidthDimensionSelect:Mt,maxWidthDimensionSelect:Mt,labels:{width:N("Width"),height:N("Height"),minWidth:N("Minimum width"),maxWidth:N("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:N("Background"),collapsible:!0,open:c,onToggle:Y,dividerTop:!0,children:[(0,t.jsx)(Li,{form:e,backgroundImageEmpty:m,appConfig:J,token:T,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:F}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),J.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Borders"),collapsible:!0,open:a,onToggle:A,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),J.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Border radius"),collapsible:!0,open:l,onToggle:v,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:x,setOneBorderRadiusValue:E,elementSettings:i})}),J.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Box shadow"),collapsible:!0,open:n,onToggle:P,dividerTop:!0,children:(0,t.jsx)(It,{})}),J.formFieldExportAsPictureEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Export settings"),collapsible:!0,open:b,onToggle:W,dividerTop:!0,children:(0,t.jsx)(Pi,{form:e,elementSettings:i})}),J.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Display control & Direction"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e,directionControl:(0,t.jsx)(Xo,{elementSettings:i,form:e})})}),J.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Es.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var Bs=({form:e,elementSettings:i,mobileBoxShadow:r,mobileBordersShow:a,mobileBorderRadiusShow:l,mobileBoxShadowShow:n,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:f,mobilePaddingsExt:_,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:y,toggleShowMobileBorderRadiusHandler:x,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:I,toggleShowMobilePaddingHandler:A})=>{const{__:v}=s.useI18n(),{token:P}=(0,o.ui_kit$useToken)(),C=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Go,{form:e,elementSettings:i,imgParent:!0})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),C.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Padding"),collapsible:!0,open:f,onToggle:A,dividerTop:!0,children:(0,t.jsx)(qo,{form:e,elementSettings:i,mobilePaddingsExt:_,setMobilePaddingsExt:k})}),(0,t.jsx)(o.ui_kit$FormSection,{title:v("Size"),collapsible:!0,open:c,onToggle:w,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:8},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:P.formItemMarginBottomXS*2},children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:P.formItemMarginBottomXS},children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:v("Background"),collapsible:!0,open:m,onToggle:I,dividerTop:!0,children:(0,t.jsx)(wo,{elementSettings:Xt(i),imageEnabled:C.formDivFieldBackgroundImageEnabled,desktopBackground:So(i)})}),C.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Borders"),collapsible:!0,open:a,onToggle:y,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Border radius"),collapsible:!0,open:l,onToggle:x,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i})}),C.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Box shadow"),collapsible:!0,open:n,onToggle:E,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile",form:e,elementSettings:i})}),C.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Display control & Direction"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e,directionControl:(0,t.jsx)(Xo,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Bs.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var Ts=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=Dt(),n=Dt(),[c,m]=(0,d.useState)({}),[f,_]=(0,d.useState)(!0),[k,b]=(0,d.useState)({}),[h,y]=(0,d.useState)(!0),x=s.useSelector(s.selectEmailViewType),E=s.useSelector(s.selectMobileViewActive);s.useAppConfig();const[w,I]=(0,d.useState)(e.backgroundImage[0].value===""),A=s.useSelector(s.selectIsCodeMode),v=s.useSelector(s.selectCodeModeDirection),P=A&&v!=="bottom",[C,Y]=(0,d.useState)(!1),[W,F]=(0,d.useState)(!1),[N,T]=(0,d.useState)(!1),[J,Z]=(0,d.useState)(!1),[se,te]=(0,d.useState)(!1),[ne,_e]=(0,d.useState)(!1),[le,fe]=(0,d.useState)(!1),[Ae,ce]=(0,d.useState)(!1),[$e,Ce]=(0,d.useState)(!1),[ie,Be]=(0,d.useState)(!1),[ae,oe]=(0,d.useState)(!1),[me,de]=(0,d.useState)(!1),[Q,q]=(0,d.useState)(!1),[z,G]=(0,d.useState)(!1),[re,ke]=(0,d.useState)(!1),[he,Pe]=(0,d.useState)(""),ye=[{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 V=e.border,ee=e.mobileBorder,we=Object.keys(V).find(R=>V[R]?.width||V[R]?.style||V[R]?.color),je=Object.keys(ee).find(R=>ee[R]?.width||ee[R]?.style||ee[R]?.color),K=R=>R&&(R?.width||R?.style||R?.color)?R:"";(0,d.useEffect)(()=>{if(e){const R=e.boxShadow,X=e.mobileBoxShadow;m(R),b(X),a.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:K(e.mobileBorder.all)||!(K(e.mobileBorder.top)||K(e.mobileBorder.bottom)||K(e.mobileBorder.right)||K(e.mobileBorder.left))&&K(e.border.all),mobileBorderTop:K(e.mobileBorder.top)||!K(e.mobileBorder.all)&&K(e.border.top),mobileBorderBottom:K(e.mobileBorder.bottom)||!K(e.mobileBorder.all)&&K(e.border.bottom),mobileBorderRight:K(e.mobileBorder.right)||!K(e.mobileBorder.all)&&K(e.border.right),mobileBorderLeft:K(e.mobileBorder.left)||!K(e.mobileBorder.all)&&K(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:pt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:pt(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:""),...mo(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))?_(!1):_(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?y(!1):y(!0),I(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?Y(!1):Y(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)?F(!1):F(!0);const j=l.isStaleBorderSnapshot(e,!!we),M=n.isStaleBorderSnapshot(e,!!je);j&&a.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(M||j&&!je)&&a.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),T(Ee=>we&&!j?!0:Ee),Z(Ee=>we&&!j||je&&!M?!0:Ee),te(!!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),fe(!!e.boxShadow),ce(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),Ce(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),Be(!!e.mobileWidth.value||!!e.mobileHeight.value),oe(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),de(yo(e)),q(!!e.exportAsPicture),G(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),ke(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[a,e,we,je,l,n]);const ve=R=>{const X=a.getFieldsValue(!0),j=Object.keys(R)[0];let M;switch(Pe(a.getFieldsValue(!0).widthDim==="%"?100:""),j){case"exportAsPicture":M={exportAsPicture:X.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":M={boxShadow:{hOffset:X.boxShadowHOffset,vOffset:X.boxShadowVOffset,blurRadius:X.boxShadowBlurRadius,spreadRadius:X.boxShadowSpreadRadius,color:X.boxShadowColor,inset:X.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":X.borderPosition==="borderAll"?(M={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...X.borderAll}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):X.borderAll?.width||X.borderAll?.style||X.borderAll?.color?(M={border:{all:null,left:X.borderAll,right:X.borderAll,top:X.borderAll,bottom:X.borderAll,[H.REVERSE_BORDER_POSITIONS[j]]:{...X[j],...R[j]}}},a.setFieldsValue({borderAll:null,borderLeft:X.borderAll,borderRight:X.borderAll,borderTop:X.borderAll,borderBottom:X.borderAll,[j]:{...X[j],...R[j]}})):(M={border:{all:null,left:X.borderLeft,right:X.borderRight,top:X.borderTop,bottom:X.borderBottom,[H.REVERSE_BORDER_POSITIONS[j]]:{...X[j],...R[j]}}},a.setFieldsValue({border:M.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(X.mobileBorderPosition==="mobileBorderAll")M={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...X.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[j]+"-"}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const Ee=H.MOBILE_REVERSE_BORDER_POSITIONS[j],Fe={...X[j],...R[j]},tt=!Fe?.width&&!Fe?.style&&!Fe?.color;if(X.mobileBorder?.all?.width||X.mobileBorder?.all?.style||X.mobileBorder?.all?.color){const qe=X.mobileBorderAll;M={mobileBorder:{all:null,left:qe,right:qe,top:qe,bottom:qe,[Ee]:tt?null:{...Fe,classNamePrefix:"em-mob-border_"+Ee+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:qe,mobileBorderRight:qe,mobileBorderTop:qe,mobileBorderBottom:qe,[j]:Fe})}else{const qe=e.mobileBorder||{},ct=Ze=>{const ut=qe[Ze];return ut&&(ut?.width||ut?.style||ut?.color)?ut:null};M={mobileBorder:{all:null,left:Ee==="left"?tt?null:{...Fe,classNamePrefix:"em-mob-border_left-"}:ct("left"),right:Ee==="right"?tt?null:{...Fe,classNamePrefix:"em-mob-border_right-"}:ct("right"),top:Ee==="top"?tt?null:{...Fe,classNamePrefix:"em-mob-border_top-"}:ct("top"),bottom:Ee==="bottom"?tt?null:{...Fe,classNamePrefix:"em-mob-border_bottom-"}:ct("bottom")}},a.setFieldsValue({[j]:Fe})}}break;case"width":M={[j]:{value:R[j],dim:X.widthDim}};break;case"height":M={[j]:{value:R[j],dim:X.heightDim}};break;case"widthDim":M={width:{value:X.width,dim:R[j]}};break;case"heightDim":M={height:{value:X.height,dim:R[j]}};break;case"maxWidth":M={[j]:{value:R[j],dim:X.maxWidthDim}};break;case"maxWidthDim":M={maxWidth:{value:X.maxWidth,dim:R[j]}};break;case"minWidth":M={[j]:{value:R[j],dim:X.minWidthDim}};break;case"minWidthDim":M={minWidth:{value:X.minWidth,dim:R[j]}};break;case"backgroundImage":I(R[j]===""),M={[j]:[{...e.backgroundImage[0],value:R[j]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":M={padding:{[H.PADDING_POSITION[j]]:+R[j]}};break;case"paddingTopBottom":M={padding:{top:+R[j],bottom:+R[j]}},X.paddingTop=X.paddingBottom=+R[j];break;case"paddingLeftRight":M={padding:{left:+R[j],right:+R[j]}},X.paddingLeft=X.paddingRight=+R[j];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":M={borderRadius:{[H.BORDER_RADIUS_POSITION[j]]:+R[j]}};break;case"mobileWidth":M={[j]:{classNamePrefix:"em-mob-width-",value:R[j],dim:X.mobileWidthDim}};break;case"mobileWidthDim":M={mobileWidth:{classNamePrefix:"em-mob-width-",value:X.mobileWidth||100,dim:R[j]}};break;case"mobileHeight":M={[j]:{classNamePrefix:"em-mob-height-",value:R[j],dim:X.mobileHeightDim}};break;case"mobileHeightDim":M={mobileHeight:{classNamePrefix:"em-mob-height-",value:X.mobileHeight,dim:R[j]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":M={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[j]]:R[j],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[j]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":M={mobileBoxShadow:{hOffset:X.mobileBoxShadowHOffset,vOffset:X.mobileBoxShadowVOffset,blurRadius:X.mobileBoxShadowBlurRadius,spreadRadius:X.mobileBoxShadowSpreadRadius,color:X.mobileBoxShadowColor,inset:X.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":M={[j]:{classNamePrefix:"em-mob-text_align-",value:R[j]}};break;case"mobileVerticalAlign":M={[j]:{classNamePrefix:"em-mob-vertical_align-",value:R[j]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(M=To(R),!M)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":M={mobilePadding:{all:null,top:X.mobilePaddingTop!==""?X.mobilePaddingTop:null,right:X.mobilePaddingRight!==""?X.mobilePaddingRight:null,bottom:X.mobilePaddingBottom!==""?X.mobilePaddingBottom:null,left:X.mobilePaddingLeft!==""?X.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":X.mobilePaddingTop=X.mobilePaddingBottom=R[j],M={mobilePadding:{all:null,top:X.mobilePaddingTop!==""?X.mobilePaddingTop:null,right:X.mobilePaddingRight!==""?X.mobilePaddingRight:null,bottom:X.mobilePaddingBottom!==""?X.mobilePaddingBottom:null,left:X.mobilePaddingLeft!==""?X.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":X.mobilePaddingLeft=X.mobilePaddingRight=R[j],M={mobilePadding:{all:null,top:X.mobilePaddingTop!==""?X.mobilePaddingTop:null,right:X.mobilePaddingRight!==""?X.mobilePaddingRight:null,bottom:X.mobilePaddingBottom!==""?X.mobilePaddingBottom:null,left:X.mobilePaddingLeft!==""?X.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":M={[j]:{classNamePrefix:"em-mob-direction-",value:R[j]}};break;case"backgroundPositionX":case"backgroundPositionY":M={[j]:isNaN(parseFloat(R[j].position))?R[j].position:R[j].position+R[j].unit};break;default:M=R}j!=="borderPosition"&&j!=="mobileBorderPosition"&&r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:M})},Re=()=>{Y(X=>!X);const R=a.getFieldsValue(!0);C||(R.paddingLeftRight=R.paddingLeft,R.paddingTopBottom=R.paddingTop,R.paddingRight=R.paddingLeft,R.paddingBottom=R.paddingTop,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:R.paddingTopBottom,bottom:R.paddingTopBottom,left:R.paddingLeftRight,right:R.paddingLeftRight}}}))},Le=()=>{const R=a.getFieldsValue(!0);l.markBorderToggled(!N),setTimeout(()=>{T(X=>!X),N?(R.borderAll=H.NULL_BORDER,R.borderTop=H.NULL_BORDER,R.borderBottom=H.NULL_BORDER,R.borderRight=H.NULL_BORDER,R.borderLeft=H.NULL_BORDER):R.borderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:R.borderAll.color,style:R.borderAll.style,width:R.borderAll.width}}}})})},Ue=()=>{const R=a.getFieldsValue(!0);n.markBorderToggled(!J),setTimeout(()=>{Z(X=>!X),J?(R.mobileBorderAll=H.NULL_BORDER,R.mobileBorderTop=H.NULL_BORDER,R.mobileBorderBottom=H.NULL_BORDER,R.mobileBorderRight=H.NULL_BORDER,R.mobileBorderLeft=H.NULL_BORDER):R.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:R.mobileBorderAll.color,style:R.mobileBorderAll.style,width:R.mobileBorderAll.width}}}})})},Me=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{te(X=>!X),se?(R.borderRadiusAll=0,_(!0)):R.borderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:R.borderRadiusAll}}})})},He=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{_e(X=>!X),ne?(R.mobileBorderRadiusAll=null,y(!0)):R.mobileBorderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:R.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},O=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{fe(X=>!X),le?(R.boxShadowInset=!1,R.boxShadowHOffset=null,R.boxShadowVOffset=null,R.boxShadowBlurRadius=null,R.boxShadowSpreadRadius=null,R.boxShadowColor=""):(R.boxShadowInset=!1,R.boxShadowHOffset=5,R.boxShadowVOffset=5,R.boxShadowBlurRadius=10,R.boxShadowSpreadRadius=-5,R.boxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:R.boxShadowBlurRadius,color:R.boxShadowColor,hOffset:R.boxShadowHOffset,inset:R.boxShadowInset,spreadRadius:R.boxShadowSpreadRadius,vOffset:R.boxShadowVOffset}}})})},xe=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ce(X=>!X),Ae?(R.mobileBoxShadowInset=!1,R.mobileBoxShadowHOffset=null,R.mobileBoxShadowVOffset=null,R.mobileBoxShadowBlurRadius=null,R.mobileBoxShadowSpreadRadius=null,R.mobileBoxShadowColor=""):(R.mobileBoxShadowInset=!1,R.mobileBoxShadowHOffset=5,R.mobileBoxShadowVOffset=5,R.mobileBoxShadowBlurRadius=10,R.mobileBoxShadowSpreadRadius=-5,R.mobileBoxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:R.mobileBoxShadowBlurRadius,color:R.mobileBoxShadowColor,hOffset:R.mobileBoxShadowHOffset,inset:R.mobileBoxShadowInset,spreadRadius:R.mobileBoxShadowSpreadRadius,vOffset:R.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},D=()=>{setTimeout(()=>{Ce(R=>!R)})},ue=()=>{setTimeout(()=>{Be(R=>!R)})},ge=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{oe(X=>!X),ae?(R.backgroundColor="",R.backgroundImage="",R.backgroundPositionX="",R.backgroundPositionY="",R.backgroundRepeat="none",R.backgroundSize="",I(!0)):(R.backgroundColor="#E5E5E5",R.backgroundSize="",R.backgroundRepeat="none"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:R.backgroundColor,backgroundImage:[{type:"url",value:R.backgroundImage}],backgroundPositionX:R.backgroundPositionX,backgroundPositionY:R.backgroundPositionY,backgroundRepeat:R.backgroundRepeat,backgroundSize:R.backgroundSize}})})},Oe=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{de(X=>!X),me?R.mobileBackgroundColor="":R.mobileBackgroundColor="#E5E5E5",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:R.mobileBackgroundColor}}}),me&&Ro(a,e,r)})},Ge=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{q(X=>!X),Q&&(R.exportAsPicture=!1,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},Ye=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{G(X=>!X),z&&(R.paddingLeftRight="",R.paddingLeft="",R.paddingRight="",R.paddingTopBottom="",R.paddingTop="",R.paddingBottom="",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Xe=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ke(X=>!X),re&&(R.mobilePaddingLeftRight="",R.mobilePaddingLeft="",R.mobilePaddingRight="",R.mobilePaddingTopBottom="",R.mobilePaddingTop="",R.mobilePaddingBottom="",r({operation:s.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,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_div_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[we]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[je]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:""},onValuesChange:ve,autoComplete:"off",className:"element-controls",children:[!P&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),x==="mobile"&&E.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(Bs,{form:a,elementSettings:e,mobileBoxShadow:k,mobileBordersShow:J,mobileBorderRadiusShow:ne,mobileBoxShadowShow:Ae,mobileSizeShow:ie,mobileBackgroundShow:me,mobilePaddingShow:re,mobilePaddingsExt:W,setMobilePaddingsExt:F,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:y,toggleShowMobileBorderHandler:Ue,toggleShowMobileBorderRadiusHandler:He,toggleShowMobileBoxShadowHandler:xe,toggleShowMobileSizeHandler:ue,toggleShowMobileBackgroundHandler:Oe,toggleShowMobilePaddingHandler:Xe})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Es,{form:a,elementSettings:e,boxShadow:c,bordersShow:N,borderRadiusShow:se,boxShadowShow:le,backgroundShow:ae,backgroundImageEmpty:w,backgroundRepeatOptions:ye,sizeShow:$e,maxWidthValue:he,modificationShow:Q,paddingShow:z,paddingsExt:C,oneBorderRadiusValue:f,setOneBorderRadiusValue:_,togglePaddingHandler:Re,toggleShowPaddingHandler:Ye,toggleShowBorderHandler:Le,toggleShowBorderRadiusHandler:Me,toggleShowBoxShadowHandler:O,toggleShowSizeHandler:D,toggleShowBackgroundHandler:ge,toggleShowModificationHandler:Ge,handleChangeValues:ve})})]})};Ts.propTypes={elementSettings:g.default.object.isRequired};var Ss=({form:e,elementSettings:i})=>{const{__:r}=s.useI18n(),a=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Float block width"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"width",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:0,placeholder:r("Float block width"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:Mt})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Column gap"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:0,placeholder:r("Column gap"),prefix:(0,t.jsx)(s.EmIcons,{icon:"SplitCellsOutlined",component:o.icons$SplitCellsOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:Fn})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:r("Vertical alignment"),dividerTop:!0,children:(0,t.jsx)(Vt,{form:e,elementSettings:i})}),(0,t.jsx)(o.ui_kit$FormSection,{title:r("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),a.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:r("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Ss.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var ys=({form:e,elementSettings:i})=>{const{__:r}=s.useI18n(),a=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:r("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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:r("Appearance on mobile devices"),type:"info"})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})}),(0,t.jsx)(o.ui_kit$Col,{span:12})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:r("Alignments"),dividerTop:!0,children:(0,t.jsx)(Vt,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,t.jsx)(o.ui_kit$FormSection,{title:r("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),a.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:r("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};ys.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var Oi=0,Rs=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=s.useSelector(s.selectEmailViewType),n=s.useSelector(s.selectMobileViewActive),c=s.useSelector(s.selectIsCodeMode),m=s.useSelector(s.selectCodeModeDirection),f=c&&m!=="bottom";(0,d.useEffect)(()=>{e&&(a.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:pt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:pt(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Oi=e.width.value+e.gap.value)},[a,e]);const _=k=>{const b=a.getFieldsValue(!0),h=Object.keys(k)[0];let y;switch(h){case"width":Oi=k[h]+b.gap,y={[h]:{value:k[h],dim:b.widthDim},gap:{value:b.gap}};break;case"widthDim":y={width:{value:b.width,dim:k[h]},gap:{value:b.gap}};break;case"gap":b.width=Oi-k[h],y={[h]:{value:k[h],dim:"px"}};break;case"mobileWidth":y={[h]:{classNamePrefix:"em-mob-width-",value:k[h],dim:b.mobileWidthDim}};break;case"mobileWidthDim":y={mobileWidth:{classNamePrefix:"em-mob-width-",value:b.mobileWidth||100,dim:k[h]}};break;case"mobileContentWidth":y={[h]:{classNamePrefix:"em-mob-width-",value:k[h],dim:b.mobileContentWidthDim}};break;case"mobileContentWidthDim":y={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:k[h]}};break;case"mobileVerticalAlign":y={[h]:{classNamePrefix:"em-mob-vertical_align-",value:k[h]}};break;default:y=k}r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:y})};return(0,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:_,autoComplete:"off",className:"element-controls",children:[f&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),l==="mobile"&&n.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:l==="mobile"&&n.styles?"block":"none"},children:(0,t.jsx)(ys,{form:a,elementSettings:e})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Ss,{form:a,elementSettings:e})})]})};Rs.propTypes={elementSettings:g.default.object.isRequired};var ws=({form:e,fillFields:i,elementSettings:r,boxShadow:a,bordersShow:l,borderRadiusShow:n,boxShadowShow:c,backgroundShow:m,backgroundImageEmpty:f,backgroundRepeatOptions:_,paddingShow:k,paddingsExt:b,maxWidthValue:h,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,linkProtocol:E,linkTarget:w,isOpenTextReplacer:I,textReplacerButtonRef:A,textReplacerInputRef:v,handleLinkProtocolsChange:P,handleSelect:C,textReplacerInputHandler:Y,handleTextReplacerKeyDown:W,srcButtonHandler:F,togglePaddingHandler:N,toggleShowPaddingHandler:T,toggleShowBackgroundHandler:J,toggleShowBorderHandler:Z,toggleShowBorderRadiusHandler:se,toggleShowBoxShadowHandler:te,setLinkProtocol:ne,handleChangeValues:_e})=>{const{__:le}=s.useI18n(),{token:fe}=(0,o.ui_kit$useToken)(),Ae=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:le("Appearance on mobile devices"),type:"info"}),(0,t.jsxs)("div",{className:"selected_form-props-wrapper",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:r})}),Ae.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(so,{form:e,name:"textAlign",elementSettings:r})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,t.jsx)(oo,{show:E==="#",__:le,style:{marginBottom:fe.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:le("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:Ae.formButtonFieldReplacerEnabled?fe.formItemMarginBottomXS:fe.formItemMarginBottomMD+4},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:E,handleLinkProtocolsChange:P,__:le}),placeholder:le("Hyperlink URL"),allowClear:!0,onSelect:C,prefix:(0,t.jsx)(eo,{linkProtocol:E})})})}),E==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",style:{marginBottom:fe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:le("Subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:fe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:le("Body")})})]}),Ae.formButtonFieldReplacerEnabled&&(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:le("Text replacer"),placement:"bottom",getPopupContainer:ce=>ce.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":I}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:F,ref:A})})}),(0,t.jsx)(o.ui_kit$Col,{span:21,children:I&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:le("Text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textReplacer",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:le("The code that will replace this text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Text"}),onChange:Y,onKeyDown:W,ref:v,onSelect:C})})})})]})}),Ae.formButtonFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("Padding"),collapsible:!0,open:k,onToggle:T,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:b,onToggleExtended:N,gutter:fe.marginSM,labels:{horizontal:le("Horizontal padding"),vertical:le("Vertical padding"),left:le("Left padding"),right:le("Right padding"),top:le("Top padding"),bottom:le("Bottom padding"),individual:le("Individual padding")}})}),(0,t.jsx)(o.ui_kit$FormSection,{title:le("Size"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:h,dimensionSelect:Mt,gutter:fe.marginSM,labels:{width:le("Width"),height:le("Height"),minWidth:le("Minimum width"),maxWidth:le("Maximum width")}})}),(0,t.jsx)(Bo,{form:e,fillFields:i,elementSettings:r,showAddParagraph:!1,isButton:!0,setLinkProtocol:ne,linkProtocol:E,linkTarget:w}),(0,t.jsxs)(o.ui_kit$FormSection,{title:le("Background"),collapsible:!0,open:m,onToggle:J,dividerTop:!0,children:[(0,t.jsx)(Li,{form:e,backgroundImageEmpty:f,appConfig:Ae,token:fe,elementSettings:r,backgroundRepeatOptions:_,handleChangeValues:_e}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),Ae.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("Borders"),collapsible:!0,open:l,onToggle:Z,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:r})}),Ae.formFieldBorderRadiusEnabled&&(0,t.jsxs)(o.ui_kit$FormSection,{title:le("Border radius"),collapsible:!0,open:n,onToggle:se,dividerTop:!0,children:[(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,elementSettings:r}),(0,t.jsx)(ao,{form:e,showRounding:!0})]}),Ae.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("Box shadow"),collapsible:!0,open:c,onToggle:te,dividerTop:!0,children:(0,t.jsx)(It,{})}),Ae.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:r,form:e})}),Ae.formFieldAmpVisibilityEnabled&&r.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})]})};ws.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,paddingShow:g.default.bool,paddingsExt:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,linkTarget:g.default.object,isOpenTextReplacer:g.default.bool,textReplacerButtonRef:g.default.object,textReplacerInputRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,textReplacerInputHandler:g.default.func,handleTextReplacerKeyDown:g.default.func,srcButtonHandler:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,setLinkProtocol:g.default.func,handleChangeValues:g.default.func};var js=({form:e,fillFields:i,elementSettings:r,boxShadow:a,mobileBordersShow:l,mobileBorderRadiusShow:n,mobileBoxShadowShow:c,mobileSizeShow:m,mobileBackgroundShow:f,mobilePaddingShow:_,mobilePaddingsExt:k,setMobilePaddingsExt:b,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:y,linkProtocol:x,handleLinkProtocolsChange:E,setLinkProtocol:w,toggleShowMobileBorderHandler:I,toggleShowMobileBorderRadiusHandler:A,toggleShowMobileBoxShadowHandler:v,toggleShowMobileSizeHandler:P,toggleShowMobileBackgroundHandler:C,toggleShowMobilePaddingHandler:Y})=>{const{__:W}=s.useI18n(),{token:F}=(0,o.ui_kit$useToken)(),N=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:r,imgParent:!0,typeOfForm:"mobile"})}),N.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Go,{form:e,name:"mobileTextAlign",elementSettings:r,imgParent:!0})})]}),!!r.showOnMobile&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,t.jsx)(oo,{show:x==="#",__:W,style:{marginBottom:F.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:W("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:x==="mailto:"?F.formItemMarginBottomXS:F.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:x,handleLinkProtocolsChange:E,__:W}),placeholder:W("Hyperlink URL"),allowClear:!0,prefix:(0,t.jsx)(eo,{linkProtocol:x})})})}),x==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:W("Subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:F.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:W("Body")})})]})]}),!!r.showOnMobile&&(0,t.jsx)(Bo,{form:e,fillFields:i,elementSettings:r,setLinkProtocol:w,linkProtocol:x,showAddParagraph:!1,isButton:!0}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Qr,{})})}),N.formButtonFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("Padding"),collapsible:!0,open:_,onToggle:Y,dividerTop:!0,children:(0,t.jsx)(qo,{form:e,elementSettings:r,mobilePaddingsExt:k,setMobilePaddingsExt:b})}),(0,t.jsx)(o.ui_kit$FormSection,{title:W("Size"),collapsible:!0,open:m,onToggle:P,dividerTop:!0,bodyStyle:{paddingBottom:F.formItemMarginBottomMD},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:W("Width"),placement:"bottom",children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:r})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:W("Height"),placement:"bottom",children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:r})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:W("Background"),collapsible:!0,open:f,onToggle:C,dividerTop:!0,bodyStyle:{paddingBottom:F.formItemMarginBottomMD},children:(0,t.jsx)(wo,{elementSettings:Xt(r),imageEnabled:N.formButtonFieldBackgroundImageEnabled,desktopBackground:So(r)})}),N.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("Borders"),collapsible:!0,open:l,onToggle:I,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),N.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("Border radius"),collapsible:!0,open:n,onToggle:A,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:y,elementSettings:r,typeOfForm:"mobile"})}),N.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("Box shadow"),collapsible:!0,open:c,onToggle:v,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile"})}),N.formFieldAmpVisibilityEnabled&&r.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})}),N.formFieldAmpVisibilityEnabled&&r.isAmp&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};js.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,setLinkProtocol:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var vs=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=Dt(),n=Dt(),c=s.useDispatch(),[m,f]=(0,d.useState)({}),[_,k]=(0,d.useState)(!0),[b,h]=(0,d.useState)(!0),y=s.useSelector(s.selectEmailViewType),x=s.useSelector(s.selectMobileViewActive),[E,w]=(0,d.useState)(e.backgroundImage?.[0].value===""),I=s.useSelector(s.selectIsCodeMode),A=s.useSelector(s.selectCodeModeDirection),v=I&&A!=="bottom",P=(0,d.useRef)(null),C=(0,d.useRef)(null),[Y,W]=(0,d.useState)(!1),[F,N]=(0,d.useState)(!1),[T,J]=(0,d.useState)(!1),[Z,se]=(0,d.useState)(!1),[te,ne]=(0,d.useState)(!1),[_e,le]=(0,d.useState)(!1),[fe,Ae]=(0,d.useState)(!1),[ce,$e]=(0,d.useState)(!1),[Ce,ie]=(0,d.useState)(!1),[Be,ae]=(0,d.useState)(!1),[oe,me]=(0,d.useState)(!1),[de,Q]=(0,d.useState)(!1),[q,z]=(0,d.useState)(!1),[G,re]=(0,d.useState)(""),[ke,he]=(0,d.useState)("https://"),[Pe,ye]=(0,d.useState)({}),V=e,[ee,we]=(0,d.useState)(!!V.textReplacer?.length),[je,K]=(0,d.useState)(e);e!==je&&(K(e),we(!!V.textReplacer?.length));const ve=s.useElementEntityKind(),Re=[{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"}],Le=e.border,Ue=e.mobileBorder,Me=Object.keys(Le).find(S=>Le[S]?.width||Le[S]?.style||Le[S]?.color),He=Object.keys(Ue).find(S=>Ue[S]?.width||Ue[S]?.style||Ue[S]?.color),O=S=>S&&(S?.width||S?.style||S?.color)?S:"",{remember:xe,fillFields:D}=co(e);(0,d.useEffect)(()=>{if(e){const S=e.boxShadow||{},p=e.mobilePadding||{},$=e.mobileAlign||{};f(S);let U="",Se="",pe=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const at=zr(e.href);U=at.subject,Se=at.body,pe=at.baseEmail}Gt(e.href,he)}D(a,{...e,href:pe,subject:U,body:Se,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:O(e.mobileBorder.all)||!(O(e.mobileBorder.top)||O(e.mobileBorder.bottom)||O(e.mobileBorder.right)||O(e.mobileBorder.left))&&O(e.border.all),mobileBorderTop:O(e.mobileBorder.top)||!O(e.mobileBorder.all)&&O(e.border.top),mobileBorderBottom:O(e.mobileBorder.bottom)||!O(e.mobileBorder.all)&&O(e.border.bottom),mobileBorderRight:O(e.mobileBorder.right)||!O(e.mobileBorder.all)&&O(e.border.right),mobileBorderLeft:O(e.mobileBorder.left)||!O(e.mobileBorder.all)&&O(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:pt(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:pt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:pt(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:pt(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||""),...mo(e),mobilePaddingTop:u(p.all)||u(p.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(p.all)||u(p.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(p.all)||u(p.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(p.all)||u(p.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(p.top)||u(p.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(p.left)||u(p.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Gr(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))?h(!1):h(!0),w(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)?W(!1):W(!0),!u(p.all)&&(u(p.top)||u(p.right)||u(p.bottom)||u(p.left))&&(p.top!==p.bottom||p.right!==p.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)?N(!1):N(!0);const ze=l.isStaleBorderSnapshot(e,!!Me),dt=n.isStaleBorderSnapshot(e,!!He);ze&&a.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(dt||ze&&!He)&&a.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),J(at=>Me&&!ze?!0:at),se(at=>Me&&!ze||He&&!dt?!0:at),ne(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),le(!!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),$e(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),ie(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),ae(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),me(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),yo(e)&&me(!0),Q(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),z(!!e.mobilePadding?.all||!!e.mobilePadding?.top||!!e.mobilePadding?.bottom||!!e.mobilePadding?.left||!!e.mobilePadding?.right||!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right)}},[a,e,v,Me,He,l,n]);const ue=(0,d.useCallback)(S=>{xe(S),c(ve==="email"?s.setElementSettings$1(S):s.setElementSettings(S))},[c,ve,xe]),ge=S=>{const p=a.getFieldsValue(!0),$=Object.keys(S)[0];let U;switch(re(a.getFieldsValue(!0).widthDim==="%"?100:""),$){case"exportAsPicture":U={exportAsPicture:p.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":U={boxShadow:{hOffset:p.boxShadowHOffset,vOffset:p.boxShadowVOffset,blurRadius:p.boxShadowBlurRadius,spreadRadius:p.boxShadowSpreadRadius,color:p.boxShadowColor,inset:p.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":p.borderPosition==="borderAll"?(U={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...p.borderAll}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):p.borderAll?.width||p.borderAll?.style||p.borderAll?.color?(U={border:{all:null,left:p.borderAll,right:p.borderAll,top:p.borderAll,bottom:p.borderAll,[H.REVERSE_BORDER_POSITIONS[$]]:{...p[$],...S[$]}}},a.setFieldsValue({borderAll:null,borderLeft:p.borderAll,borderRight:p.borderAll,borderTop:p.borderAll,borderBottom:p.borderAll,[$]:{...p[$],...S[$]}})):(U={border:{all:null,left:p.borderLeft,right:p.borderRight,top:p.borderTop,bottom:p.borderBottom,[H.REVERSE_BORDER_POSITIONS[$]]:{...p[$],...S[$]}}},a.setFieldsValue({border:U.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(p.mobileBorderPosition==="mobileBorderAll")U={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...p.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[$]+"-"}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const ze=H.MOBILE_REVERSE_BORDER_POSITIONS[$],dt={...p[$],...S[$]},at=!dt?.width&&!dt?.style&&!dt?.color;if(p.mobileBorder?.all?.width||p.mobileBorder?.all?.style||p.mobileBorder?.all?.color){const mt=p.mobileBorderAll;U={mobileBorder:{all:null,left:mt,right:mt,top:mt,bottom:mt,[ze]:at?null:{...dt,classNamePrefix:"em-mob-border_"+ze+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:mt,mobileBorderRight:mt,mobileBorderTop:mt,mobileBorderBottom:mt,[$]:dt})}else{const mt=e.mobileBorder||{},Et=Qt=>{const At=mt[Qt];return At&&(At?.width||At?.style||At?.color)?At:null};U={mobileBorder:{all:null,left:ze==="left"?at?null:{...dt,classNamePrefix:"em-mob-border_left-"}:Et("left"),right:ze==="right"?at?null:{...dt,classNamePrefix:"em-mob-border_right-"}:Et("right"),top:ze==="top"?at?null:{...dt,classNamePrefix:"em-mob-border_top-"}:Et("top"),bottom:ze==="bottom"?at?null:{...dt,classNamePrefix:"em-mob-border_bottom-"}:Et("bottom")}},a.setFieldsValue({[$]:dt})}}break;case"width":U={[$]:{value:S[$],dim:p.widthDim}};break;case"height":U={[$]:{value:S[$],dim:p.heightDim}};break;case"widthDim":U={width:{value:p.width,dim:S[$]}};break;case"heightDim":U={height:{value:p.height,dim:S[$]}};break;case"backgroundImage":w(S[$]===""),U={[$]:[{...e.backgroundImage[0],value:S[$]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":U={padding:{left:p.paddingLeft,right:p.paddingRight,top:p.paddingTop,bottom:p.paddingBottom,[H.PADDING_POSITION[$]]:+S[$]}};break;case"paddingTopBottom":U={padding:{left:p.paddingLeft,right:p.paddingRight,top:+S[$],bottom:+S[$]}},p.paddingTop=p.paddingBottom=+S[$];break;case"paddingLeftRight":U={padding:{top:p.paddingTop,bottom:p.paddingBottom,left:+S[$],right:+S[$]}},p.paddingLeft=p.paddingRight=+S[$];break;case"borderRadiusAll":U={borderRadius:{[H.BORDER_RADIUS_POSITION[$]]:+S[$]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":U={borderRadius:{topLeft:p.borderRadiusTopLeft,bottomLeft:p.borderRadiusBottomLeft,topRight:p.borderRadiusTopRight,bottomRight:p.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[$]]:+S[$]}};break;case"mobileWidth":U={[$]:{classNamePrefix:"em-mob-width-",value:S[$],dim:p.mobileWidthDim}};break;case"mobileWidthDim":U={mobileWidth:{classNamePrefix:"em-mob-width-",value:p.mobileWidth||100,dim:S[$]}};break;case"mobileHeight":U={[$]:{classNamePrefix:"em-mob-height-",value:S[$],dim:p.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:S[$],dim:p.mobileHeightDim}};break;case"mobileHeightDim":U={mobileHeight:{classNamePrefix:"em-mob-height-",value:p.mobileHeight,dim:S[$]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":U={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[$]]:S[$],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[$]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":U={mobileBoxShadow:{hOffset:p.mobileBoxShadowHOffset,vOffset:p.mobileBoxShadowVOffset,blurRadius:p.mobileBoxShadowBlurRadius,spreadRadius:p.mobileBoxShadowSpreadRadius,color:p.mobileBoxShadowColor,inset:p.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":U={[$]:{classNamePrefix:"em-mob-table_align-",value:S[$]}};break;case"mobileTextAlign":U={[$]:{classNamePrefix:"em-mob-text_align-",value:S[$]}};break;case"mobileVerticalAlign":U={[$]:{classNamePrefix:"em-mob-vertical_align-",value:S[$]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(U=To(S),!U)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":U={mobilePadding:{all:null,top:p.mobilePaddingTop!==""?p.mobilePaddingTop:null,right:p.mobilePaddingRight!==""?p.mobilePaddingRight:null,bottom:p.mobilePaddingBottom!==""?p.mobilePaddingBottom:null,left:p.mobilePaddingLeft!==""?p.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":p.mobilePaddingTop=p.mobilePaddingBottom=S[$],U={mobilePadding:{all:null,top:p.mobilePaddingTop!==""?p.mobilePaddingTop:null,right:p.mobilePaddingRight!==""?p.mobilePaddingRight:null,bottom:p.mobilePaddingBottom!==""?p.mobilePaddingBottom:null,left:p.mobilePaddingLeft!==""?p.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":p.mobilePaddingLeft=p.mobilePaddingRight=S[$],U={mobilePadding:{all:null,top:p.mobilePaddingTop!==""?p.mobilePaddingTop:null,right:p.mobilePaddingRight!==""?p.mobilePaddingRight:null,bottom:p.mobilePaddingBottom!==""?p.mobilePaddingBottom:null,left:p.mobilePaddingLeft!==""?p.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":U={[$]:{classNamePrefix:"em-mob-font_size-",value:S[$],dim:p.mobileFontSizeDim}};break;case"href":let Se=io(S[$]);Se!==S[$]&&(a.setFieldValue("href",Se),p.href=Se),Se.startsWith("mailto:")?U={[$]:vi(Se,p.subject,p.body)}:U={[$]:Se},Gt(S[$],he);break;case"subject":case"body":const pe=p.href||"";if(pe.startsWith("mailto:")){const ze=$==="subject"?S[$]:p.subject,dt=$==="body"?S[$]:p.body;U={href:vi(pe,ze,dt)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":U={[$]:isNaN(parseFloat(S[$].position))?S[$].position:S[$].position+S[$].unit};break;default:U=S}$!=="borderPosition"&&$!=="mobileBorderPosition"&&(r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:U}),$!=="mobileBorderRadiusAll"&&$!=="mobileBorderRadiusTopLeft"&&$!=="mobileBorderRadiusTopRight"&&$!=="mobileBorderRadiusBottomLeft"&&$!=="mobileBorderRadiusBottomRight"&&ue({...e,...U,mobileBorderRadius:{...e.mobileBorderRadius,...U?.mobileBorderRadius},activateSection:null,changeKey:$}))},Oe=()=>{W(p=>!p);const S=a.getFieldsValue(!0);Y||(S.paddingLeftRight=S.paddingLeft,S.paddingTopBottom=S.paddingTop,S.paddingRight=S.paddingLeft,S.paddingBottom=S.paddingTop,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:S.paddingTopBottom,bottom:S.paddingTopBottom,left:S.paddingLeftRight,right:S.paddingLeftRight}}}))},Ge=()=>{const S=a.getFieldsValue(!0);l.markBorderToggled(!T),setTimeout(()=>{J(p=>!p),T?(S.borderAll=H.NULL_BORDER,S.borderTop=H.NULL_BORDER,S.borderBottom=H.NULL_BORDER,S.borderRight=H.NULL_BORDER,S.borderLeft=H.NULL_BORDER):S.borderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:S.borderAll.color,style:S.borderAll.style,width:S.borderAll.width}}}})})},Ye=()=>{const S=a.getFieldsValue(!0);n.markBorderToggled(!Z),setTimeout(()=>{se(p=>!p),Z?(S.mobileBorderAll=H.NULL_BORDER,S.mobileBorderTop=H.NULL_BORDER,S.mobileBorderBottom=H.NULL_BORDER,S.mobileBorderRight=H.NULL_BORDER,S.mobileBorderLeft=H.NULL_BORDER):S.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:S.mobileBorderAll.color,style:S.mobileBorderAll.style,width:S.mobileBorderAll.width}}}})})},Xe=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{ne(p=>!p),te?(S.borderRadiusAll=0,k(!0)):S.borderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:S.borderRadiusAll}}})})},R=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{le(p=>!p),_e?(S.mobileBorderRadiusAll=null,h(!0)):S.mobileBorderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:S.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},X=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{Ae(p=>!p),fe?(S.boxShadowInset=!1,S.boxShadowHOffset=null,S.boxShadowVOffset=null,S.boxShadowBlurRadius=null,S.boxShadowSpreadRadius=null,S.boxShadowColor=""):(S.boxShadowInset=!1,S.boxShadowHOffset=5,S.boxShadowVOffset=5,S.boxShadowBlurRadius=10,S.boxShadowSpreadRadius=-5,S.boxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:S.boxShadowBlurRadius,color:S.boxShadowColor,hOffset:S.boxShadowHOffset,inset:S.boxShadowInset,spreadRadius:S.boxShadowSpreadRadius,vOffset:S.boxShadowVOffset}}})})},j=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{$e(p=>!p),ce?(S.mobileBoxShadowInset=!1,S.mobileBoxShadowHOffset=null,S.mobileBoxShadowVOffset=null,S.mobileBoxShadowBlurRadius=null,S.mobileBoxShadowSpreadRadius=null,S.mobileBoxShadowColor=""):(S.mobileBoxShadowInset=!1,S.mobileBoxShadowHOffset=5,S.mobileBoxShadowVOffset=5,S.mobileBoxShadowBlurRadius=10,S.mobileBoxShadowSpreadRadius=-5,S.mobileBoxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:S.mobileBoxShadowBlurRadius,color:S.mobileBoxShadowColor,hOffset:S.mobileBoxShadowHOffset,inset:S.mobileBoxShadowInset,spreadRadius:S.mobileBoxShadowSpreadRadius,vOffset:S.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},M=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{ie(p=>!p),Ce&&(S.mobileWidth="",S.mobileHeight="",r({operation:s.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-"}}}))})},Ee=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{ae(p=>!p),Be?(S.backgroundColor="",S.backgroundImage="",S.backgroundPositionX="",S.backgroundPositionY="",S.backgroundRepeat="none",S.backgroundSize="",w(!0)):(S.backgroundColor="#E5E5E5",S.backgroundSize="",S.backgroundRepeat="none"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:S.backgroundColor,backgroundImage:[{type:"url",value:S.backgroundImage}],backgroundPositionX:S.backgroundPositionX,backgroundPositionY:S.backgroundPositionY,backgroundRepeat:S.backgroundRepeat,backgroundSize:S.backgroundSize}})})},Fe=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{me(p=>!p),oe?S.mobileBackgroundColor="":S.mobileBackgroundColor=e.commonStyles.buttons.backgroundColor||"#1C52DC",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:S.mobileBackgroundColor}}}),oe&&Ro(a,e,r)})},tt=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{Q(p=>!p),de&&(S.paddingLeftRight="",S.paddingLeft="",S.paddingRight="",S.paddingTopBottom="",S.paddingTop="",S.paddingBottom="",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},qe=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{z(p=>!p),q&&(S.mobilePaddingLeftRight="",S.mobilePaddingLeft="",S.mobilePaddingRight="",S.mobilePaddingTopBottom="",S.mobilePaddingTop="",S.mobilePaddingBottom="",r({operation:s.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_"}}}))})},ct=S=>{a.setFieldValue("href",S!=="mergetag"?S:""),he(S)},Ze=({target:S})=>{const{selectionStart:p,selectionEnd:$}=S;S&&ye({target:S,selection:{start:p,end:$}})},ut=S=>{S.target.value!==""&&C.current.classList.add("selected-td-form__button--active")},Bt=()=>{we(!ee),ee?(a.setFieldValue("textReplacer",""),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>P.current.focus())},B=S=>{const p=S.target,$=p.value,U=p.selectionStart;if(U===0&&S.key===" "){S.preventDefault();return}if(S.key===" "){if(U!==$.length){S.preventDefault();return}$.endsWith(" ")&&S.preventDefault()}};return(0,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_button_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[Me]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[He]||"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:ge,autoComplete:"off",className:"element-controls",children:[!v&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),v?(0,t.jsx)(Ci,{form:a,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,t.jsx)(t.Fragment,{children:y==="mobile"&&x.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(js,{form:a,fillFields:D,elementSettings:e,boxShadow:m,mobileBordersShow:Z,mobileBorderRadiusShow:_e,mobileBoxShadowShow:ce,mobileSizeShow:Ce,mobileBackgroundShow:oe,mobilePaddingShow:q,mobilePaddingsExt:F,setMobilePaddingsExt:N,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,linkProtocol:ke,handleLinkProtocolsChange:ct,setLinkProtocol:he,toggleShowMobileBorderHandler:Ye,toggleShowMobileBorderRadiusHandler:R,toggleShowMobileBoxShadowHandler:j,toggleShowMobileSizeHandler:M,toggleShowMobileBackgroundHandler:Fe,toggleShowMobilePaddingHandler:qe})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(ws,{form:a,fillFields:D,elementSettings:e,boxShadow:m,bordersShow:T,borderRadiusShow:te,boxShadowShow:fe,backgroundShow:Be,backgroundImageEmpty:E,backgroundRepeatOptions:Re,paddingShow:de,paddingsExt:Y,maxWidthValue:G,oneBorderRadiusValue:_,setOneBorderRadiusValue:k,linkProtocol:ke,linkTarget:Pe,isOpenTextReplacer:ee,textReplacerButtonRef:C,textReplacerInputRef:P,handleLinkProtocolsChange:ct,handleSelect:Ze,textReplacerInputHandler:ut,handleTextReplacerKeyDown:B,srcButtonHandler:Bt,togglePaddingHandler:Oe,toggleShowPaddingHandler:tt,toggleShowBackgroundHandler:Ee,toggleShowBorderHandler:Ge,toggleShowBorderRadiusHandler:Xe,toggleShowBoxShadowHandler:X,setLinkProtocol:he,handleChangeValues:ge})})})]})};vs.propTypes={elementSettings:g.default.object.isRequired};var Is=({elementSettings:e})=>{const{__:i}=s.useI18n(),[r]=o.ui_kit$Form.useForm(),a=s.useSendPostMessage();(0,d.useEffect)(()=>{e&&r.setFieldsValue({...e})},[r,e]);const l=n=>{a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:n})};return(0,t.jsx)(o.ui_kit$Form,{form:r,layout:"vertical",name:"selected_variable_form",initialValues:{value:""},onValuesChange:l,autoComplete:"off",children:(0,t.jsx)(o.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,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},style:{marginBottom:35},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:4,placeholder:i("Variable value")})})})};Is.propTypes={elementSettings:g.default.object.isRequired};var Cs=({elementSettings:e,setElementSettings:i,postfix:r="",form:a,handleSelect:l,previewReloadSignal:n})=>{const{__:c}=s.useI18n(),{token:m}=(0,o.ui_kit$useToken)(),f=s.useAppConfig(),_=s.useSendPostMessage(),k="src"+r,b="title"+r,h="alt"+r,y="link"+r,x="imgReplacer"+r,E=(0,d.useRef)(null),w=(0,d.useRef)(null),I=(0,d.useRef)(null),A=(0,d.useRef)(null),v=(0,d.useRef)(null),P=(0,d.useRef)(null),C=(0,d.useRef)(null),Y=(0,d.useRef)(null),[W,F]=(0,d.useState)(""),[N,T]=(0,d.useState)(""),[J,Z]=(0,d.useState)(""),[se,te]=(0,d.useState)(!1),[ne,_e]=(0,d.useState)("https://"),le=(0,d.useRef)(!1),fe=(0,d.useRef)(r);(0,d.useEffect)(()=>{r!==fe.current&&(fe.current=r,le.current=!1),T(e.images?.[h]),Z(e.images?.[b]);const Q=e.images?.[y];F(Q||(le.current?"...":""))},[e,h,b,y,r]);const Ae=()=>{W?(le.current=!1,F(""),a.setFieldValue(y,""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[y]:""}})):(le.current=!0,F(E.current&&E.current.input.value?E.current.input.value:"..."),setTimeout(()=>{E.current.focus()}))},ce=Q=>{Q.target.value===""?F("..."):(w.current.classList.add("selected-td-form__button--active"),F(Q.target.value));const q=Q.target.value;Gt(q,_e)},$e=()=>{N?(T(""),a.setFieldValue("alt",""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(T(I.current&&I.current.input.value?I.current.input.value:"..."),setTimeout(()=>{I.current.focus()}))},Ce=Q=>{Q.target.value===""?T("..."):(A.current.classList.add("selected-td-form__button--active"),T(Q.target.value))},ie=()=>{J?(Z(!1),a.setFieldValue("title",""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[b]:""}})):(Z(v.current&&v.current.input.value?v.current.input.value:"..."),setTimeout(()=>{v.current.focus()}))},Be=()=>{te(!se),se?(a.setFieldValue(x,""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[x]:""}})):setTimeout(()=>C.current.focus())},ae=Q=>{Q.target.value!==""&&Y.current.classList.add("selected-td-form__button--active")},oe=Q=>{Q.target.value===""?Z("..."):(P.current.classList.add("selected-td-form__button--active"),Z(Q.target.value))},me=Q=>{a.setFieldValue("LinkName",Q!=="mergetag"?Q:""),_e(Q)},de=Q=>{const q=a.getFieldsValue(!0),z=+r.substring(1),G=Object.keys(q?.images).reduce((ke,he)=>(he.includes(r)||(ke[he]=q[he]),ke),{}),re=e.carouselImages?.filter((ke,he)=>he!==z);i(ke=>({...ke,settings:{...ke.settings,carouselImages:re}})),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:re}}),a.setFieldsValue({images:G})};return(0,t.jsxs)(t.Fragment,{children:[(e.type==="img"||e.type==="video"||e.type==="carousel")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Ot,{form:a,label:c("Image path"),name:k,placeholder:c("Image path"),elementSettings:e,previewReloadSignal:n,tooltipTitle:""})}),(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:N||c("Alternative text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!N}),onClick:$e,ref:A,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),f.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:J||c("Tooltip text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!J}),onClick:ie,ref:P,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:W||c("Hyperlink URL"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!W}),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:Ae,ref:w})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":se}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Be,ref:Y})})]}),(0,t.jsx)(o.ui_kit$Space,{size:8,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:de,icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16})})})})]}),(!!W||!!N||!!J||!!se)&&(0,t.jsxs)("div",{children:[!!W&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oo,{show:ne==="#",__:c,style:{marginBottom:m.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:y,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:ne,handleLinkProtocolsChange:me,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:E,onChange:ce,onSelect:l,prefix:(0,t.jsx)(eo,{linkProtocol:ne})})})})]}),!!N&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Ce,ref:I,onSelect:l})})}),f.formFieldImageTitleEnabled&&!!J&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:b,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:oe,ref:v,onSelect:l})})}),!!se&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:x,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:ae,ref:C,onSelect:l})})})]})]})};Cs.propTypes={};var Ps=({form:e,elementSettings:i,formFields:r,setElementSettings:a,borderRadiusShow:l,oneBorderRadiusValue:n,setOneBorderRadiusValue:c,linkProtocol:m,mergeTagItems:f,mergeMenuOpen:_,setMergeMenuOpen:k,cascaderRef:b,handleLinkProtocolsChange:h,handleSelect:y,onChange:x,filter:E,renderSearchOption:w,toggleShowBorderRadiusHandler:I,setNewSlide:A})=>{const{__:v}=s.useI18n(),{token:P}=(0,o.ui_kit$useToken)(),C=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oo,{show:m==="#",__:v,style:{marginBottom:P.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:v("Link for all slides"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:m,handleLinkProtocolsChange:h,__:v}),placeholder:v("Link for all slides"),allowClear:!0,onSelect:y,prefix:(0,t.jsx)(eo,{linkProtocol:m})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),C.mergeTagsShow&&f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:P.formItemMarginBottomMD,marginTop:P.formItemMarginBottomMD},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(s.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:_?"none":"inline-flex"},onClick:()=>k(!0),children:v("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:b,classNames:{popup:{root:"merge-tags"}},options:f,placeholder:v("Start typing the title"),showSearch:{filter:E,render:w},spellCheck:"false",getPopupContainer:Y=>Y.closest(".email-pane__collapse-wrapper"),onChange:x,style:{display:_?"block":"none"},open:_,onKeyDown:Y=>{Y.key==="Escape"&&k(!1)}})]})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,t.jsx)(o.ui_kit$Form.List,{name:"images",initialValue:r?.images,children:()=>(0,t.jsx)("div",{style:{paddingTop:P.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((Y,W)=>(0,t.jsx)("div",{className:"carousel__slide",children:(0,t.jsx)(Cs,{elementSettings:r,setElementSettings:a,postfix:"_"+W,form:e,handleSelect:y})},W))})}),(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:P.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{id:"add_slide_button",icon:(0,t.jsx)(s.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),style:{width:"100%"},onClick:()=>A(),children:v("Add slide")})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginTop:P.formItemMarginBottomMD-10},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:P.formItemMarginBottomMD-6},children:(0,t.jsx)(o.ui_kit$Switch,{id:"Loop",label:v("Loop"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:P.formItemMarginBottomMD-6},children:(0,t.jsx)(o.ui_kit$Switch,{id:"Autoplay",label:v("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Border radius"),collapsible:!0,open:l,onToggle:I,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:n,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};Ps.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,formFields:g.default.object,setElementSettings:g.default.func,borderRadiusShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,toggleShowBorderRadiusHandler:g.default.func,setNewSlide:g.default.func};var As=()=>{const{__:e}=s.useI18n();return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("p",{children:e("No properties to edit.")})})};As.propTypes={};var Ns=2e3;function nd(e){const i=(0,d.useRef)([]),r=(0,d.useRef)(e);return r.current=e,{remember:(0,d.useCallback)(a=>{const l=Date.now(),n=i.current.filter(c=>l-c.at<Ns);n.push({key:JSON.stringify(r.current(a)),at:l}),i.current=n.slice(-10)},[]),isOwnEcho:(0,d.useCallback)(a=>{if(!a)return!1;const l=Date.now(),n=JSON.stringify(r.current(a));return i.current.some(c=>l-c.at<Ns&&c.key===n)},[])}}var dd={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 cd(e){const i={...Ii(e)};return delete i.parent,delete i.path,i}var Ls=({elementSettings:e})=>{const{__:i}=s.useI18n(),[r]=o.ui_kit$Form.useForm();let a=s.useDispatch();s.useAppConfig();const l=s.useSendPostMessageEx(),n=s.useSendPostMessage(),{openImagePicker:c}=s.useImagePicker(),m=s.useSelector(s.selectEmailViewType),f=s.useSelector(s.selectMobileViewActive),[_,k]=(0,d.useState)(!0),[b,h]=(0,d.useState)(!0),[y,x]=(0,d.useState)(!1),[E,w]=(0,d.useState)(!1),[I,A]=(0,d.useState)("https://"),[v,P]=(0,d.useState)(r?.getFieldsValue(!0)),[C,Y]=(0,d.useState)(e),{remember:W,isOwnEcho:F}=nd(cd),[N,T]=(0,d.useState)(e);e!==N&&(T(e),F(e?.settings)||Y(e));const[J,Z]=(0,d.useState)({name:"",counter:0}),[se,te]=(0,d.useState)(null),[ne,_e]=(0,d.useState)(),[le,fe]=(0,d.useState)(!1),[Ae,ce]=(0,d.useState)(!1),[$e,Ce]=(0,d.useState)({start:0,end:0}),ie=(0,d.useRef)(null),Be=`selected_${C.type}_form_link`,ae=s.useSelector(s.selectIsCodeMode),oe=s.useSelector(s.selectCodeModeDirection),me=ae&&oe!=="bottom";(0,d.useEffect)(()=>{le&&ie.current&&ie.current.focus()},[le]);const de=(K,ve)=>{const Re=document.getElementById(ve);if(Re){const Le=`selected_${C.type}_form_${ve.includes("__images_")?"_images":""}_`,Ue=ve.substring(ve.indexOf(Le)+Le.length),Me=Re.value?.substring(0,$e.start),He=Re.value?.substring($e.end);let O={[Ue]:Me+K+He};Ue.includes("_")?(O={carouselImages:[...C.settings?.carouselImages||[]]},O.carouselImages[Ue.split("_")[1]][Ue.split("_")[0]]=Me+K+He):C.type===s.ELEMENT_TYPES.CAROUSEL&&Be===ve&&(O={[Ue]:Me+K+He,carouselImages:[...C.settings?.carouselImages.map(xe=>({...xe,link:Me+K+He}))||[]]}),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,settings:{...C.settings,...O}}),Y(xe=>({...xe,settings:{...xe.settings,...O}})),r.setFieldValue(Ue,Me+K+He),Re.focus(),setTimeout(()=>{Re.selectionStart=$e.start,Re.selectionEnd=$e.start+K.length},400),ce(!0)}},Q=s.useAppConfig().mergeTags;(0,d.useEffect)(()=>{Q?.items?.length&&_e(s.mapMargeTags(Q.items,i,(K,ve)=>{fe(!1),l(s.EVENT_TYPES.SANDBOX_ADD_MERGETAG,K),ve.stopPropagation(),ve.preventDefault()}))},[Q,_e,i,fe,l]);const q=(K,ve)=>{if(fe(!1),K){const Re=Q.syntax.length>1?ne.findIndex(Me=>Me.key===ve[0].key):0,Le=Q.syntax[Re].replace("%value%",K[K.length-1]),Ue=`selected_${C.type}_form${C.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Me=>se?.getAttribute("id").includes(`${Ue}_${Me}`))||se?.getAttribute("id").includes(Be)?de(Le,se?.getAttribute("id")):(r.setFieldValue("imgReplacer",Le),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,settings:{...C.settings,imgReplacer:Le}}),Y(Me=>({...Me,settings:{...Me.settings,imgReplacer:Le}})))}},z=s.useRootElement();(0,d.useEffect)(()=>{const K=({target:Le})=>{Le.closest('[id="merge_tags_wrapper"]')||te(Le)},ve=({target:Le})=>{!Le.closest(".merge-tags")&&!Le.closest("#merge_tags_button")&&fe(!1)},Re=new De.Disposable;return Re.addDisposable(s.addWindowListenerFromShadow(z,"focusin",K)),Re.addDisposable(s.addWindowListenerFromShadow(z,"click",ve)),()=>{Re.dispose()}},[z]);const G=(K,ve)=>ve.some(Re=>Re.label.toLowerCase().indexOf(K.toLowerCase())>-1),re=(K,ve)=>{const Re=ve.map((Le,Ue)=>{const Me=Le.label.split(new RegExp(`(${K})`,"gi"));return(0,t.jsxs)("span",{children:[Ue!==0&&(0,t.jsx)("span",{children:" / "}),Me.map((He,O)=>He.toLowerCase()===K.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:He},O):He)]},Le.value)});return(0,t.jsx)("div",{title:ve.map(Le=>Le.label).join(" / "),children:Re})};(0,d.useEffect)(()=>{const K=r?.getFieldsValue(!0);P(K)},[r]);const ke=({target:K})=>{if(K&&!Ae){const{selectionStart:ve,selectionEnd:Re}=K;Ce({start:ve,end:Re})}ce(!1)};(0,d.useEffect)(()=>{if(C.settings){const K=C.settings,ve=Ii(K);r?.setFieldsValue(ve),P(ve),K.link&&A(zo(K.link,"https://")),u(K.borderRadius?.all)||(u(K.borderRadius?.topLeft)||u(K.borderRadius?.bottomLeft)||u(K.borderRadius?.topRight)||u(K.borderRadius?.bottomRight)?k(!1):u(K.borderRadius?.all)||k(!0)),u(K.mobileBorderRadius?.topLeft)||u(K.mobileBorderRadius?.bottomLeft)||u(K.mobileBorderRadius?.topRight)||u(K.mobileBorderRadius?.bottomRight)?h(!1):h(!0),x(!!K.borderRadius?.all||!!K.borderRadius?.topLeft||!!K.borderRadius?.bottomLeft||!!K.borderRadius?.topRight||!!K.borderRadius?.bottomRight),w(!!K.mobileBorderRadius?.all||!!K.mobileBorderRadius?.topLeft||!!K.mobileBorderRadius?.bottomLeft||!!K.mobileBorderRadius?.topRight||!!K.mobileBorderRadius?.bottomRight)}},[r,C]);const he=K=>{const ve=Yr(C.settings,r,K);n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,caption:ve.caption,settings:ve}),W({...C.settings,...ve}),Y(Re=>({...Re,settings:{...Re.settings,...ve}}))},Pe=(K,ve)=>{const Re=kt(C.settings?.src||"")===kt(K||"");(!Re||K!==C.settings?.src)&&he({src:K}),ve?.mode==="save"&&Re&&(Z(Le=>({name:"src",counter:Le.counter+1})),n({operation:s.EVENT_TYPES.SANDBOX_IMAGE_RESET,url:String(K)}))},ye=async K=>{const ve=C.settings?.src||"",Re=kt(ve),Le=await c({kind:"img",currentUrl:Uo(Re)?"":Re,entryModal:K});Le?.url&&Pe(Le.url,Le.meta)},V=K=>{const ve=K.data.operation;ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_AI):ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_EDIT):ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_GIF):ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_STOCK):ve===s.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(a(s.closeSecondModal()),a(s.closeModal$1()))};s.useListenPostMessage(V);const ee=()=>{setTimeout(()=>{x(K=>!K),r.setFieldValue("borderRadiusAll",y?0:5),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,settings:{...C.settings,borderRadius:{all:y?"":5}}}),Y(K=>({...K,settings:{...K.settings,borderRadius:{all:y?null:5}}}))})},we=K=>{r.setFieldValue("link",K!=="mergetag"?K:""),A(K)},je=()=>{const{width:K,height:ve,renderedWidth:Re,renderedHeight:Le}=C?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Ue={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:K.value,dim:"px"},height:{value:ve.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Re,renderedHeight:Le,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},Me=[...C?.settings?.carouselImages,Ue];n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,settings:{...C.settings,carouselImages:Me}}),Y(He=>({...He,settings:{...He.settings,carouselImages:Me}}))};return(0,t.jsxs)(o.ui_kit$Form,{form:r,layout:"vertical",name:"selected_carousel_form",initialValues:dd,onValuesChange:he,autoComplete:"off",className:"element-controls",children:[!me&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),m==="mobile"&&f.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(As,{})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Ps,{form:r,elementSettings:C,formFields:v,setElementSettings:Y,borderRadiusShow:y,oneBorderRadiusValue:_,setOneBorderRadiusValue:k,linkProtocol:I,mergeTagItems:ne,mergeMenuOpen:le,setMergeMenuOpen:fe,cascaderRef:ie,handleLinkProtocolsChange:we,handleSelect:ke,onChange:q,filter:G,renderSearchOption:re,toggleShowBorderRadiusHandler:ee,setNewSlide:je})})]})};Ls.propTypes={};var ud={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Os=({elementSettings:e})=>{const{__:i}=s.useI18n(),{token:r}=(0,o.ui_kit$useToken)(),[a]=o.ui_kit$Form.useForm(),l=s.useSendPostMessage(),n=s.useAppConfig(),[c,m]=(0,d.useState)(e),[f,_]=(0,d.useState)(e);e!==f&&(_(e),m(e)),(0,d.useEffect)(()=>{if(c.settings){const y=c.settings,x=Ii(y);a?.setFieldsValue(x)}},[a,c]);const k=y=>{const x=Yr(c.settings,a,y);l({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:x.caption,settings:x}),m(E=>({...E,settings:{...E.settings,...x}}))},b=()=>{m(y=>({...y,sections:c?.settings?.sections.push({expanded:!1})})),l({operation:s.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.")}})},h=y=>{m(x=>({...x,settings:{...x.settings,sections:c.settings.sections?.filter((E,w)=>w!==y)}})),l({operation:s.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:y}})};return(0,t.jsx)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_carousel_form",initialValues:ud,onValuesChange:k,autoComplete:"off",className:"element-controls",children:(0,t.jsxs)("div",{id:"selected_element_form_desktop_props",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:15,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"expandSingleSection",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"ExpandSingleSection",label:i("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,t.jsx)(o.ui_kit$Col,{span:9,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"animate",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"Animate",label:i("Animate"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsx)(o.ui_kit$Form.List,{name:"sections",children:()=>(0,t.jsx)("div",{style:{paddingTop:r.formItemMarginBottomMD+4},children:c?.settings?.sections?.map((y,x)=>(0,t.jsxs)(o.ui_kit$Row,{gutter:24,children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsxs)(o.ui_kit$Space,{size:10,align:"baseline",children:[(0,t.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(x+1)}),(0,t.jsx)(o.ui_kit$Form.Item,{name:`expanded_${x}`,valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:`expanded_${x}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,t.jsx)(o.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,t.jsx)(o.ui_kit$Button,{type:"text",icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>h(x)})})]},`expanded_${x}`))})}),(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:r.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,t.jsx)(s.EmIcons,{icon:"PlusCircleOutlined",component:o.icons$PlusCircleOutlined,size:16,strokeWidth:n.iconStrokeWidth}),onClick:()=>b(),children:i(" Add section")})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};Os.propTypes={};var{Text:md}=o.ui_kit$Typography,pd="blocks",Fs="text/plain",hd=(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),bd=(0,t.jsx)("span",{className:"addon-text-content",children:"Title"});function Lt(e){return e.closest(".email-pane__collapse-wrapper")}function Jo({form:e,name:i,placeholder:r,usedColors:a,onColorChange:l}){const n=o.ui_kit$Form.useWatch(i,e);return(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:r,usedColors:a,value:typeof n=="string"?n:"",onChange:c=>l(i,c)})}var fd=/^[a-z][a-z0-9+.-]*:/i;function $s(e){const i=io(typeof e=="string"?e:String(e??""));return i?fd.test(i)?i:`https://${i}`:""}function gd(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 _d(e){const i=$s(e);if(!i)return!1;try{const r=new URL(i);return!(r.protocol!=="http:"&&r.protocol!=="https:"||!r.hostname)}catch{return!1}}async function Ms(e,i){if(i===s.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&Uo(e)){try{const r=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,a=await fetch(r);if(a.ok){const l=await a.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((n,c)=>{const m=new FileReader;m.onload=()=>n(m.result),m.onerror=c,m.readAsDataURL(l)})}}}catch{}return{entryModal:s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function xd(){const e=s.useSelector(s.selectEditorThemeColor$1),[i,r]=(0,d.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,d.useEffect)(()=>{const a=()=>r(document.body.classList.contains("dark"));a();const l=new MutationObserver(a);return l.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>l.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function kd(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function Qo(e,i,r){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(r??"").trim()}}function Ds(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 Vs(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(a=>a.customIcon?"":String(a?.itemBorderColor??"").trim()),r=i[0];return i.every(a=>a===r)?r:""}function Zo(e,i){const r=String(e??"").trim(),a=String(i??"").trim();return a||r}function Ed(e,i){const r=String(e??"").trim(),a=String(i??"").trim();return!a||r&&a===r?"":a}function Bd(e,i,r){const a=String(e??"").trim(),l=String(i??"").trim(),n=String(r??"").trim();return n&&(!a||n!==a)?n:l}function Td(e,i){return(e||[]).map(r=>({...r,itemBorderColor:r.customIcon?"":i}))}function Sd(e,i,r){return(e||[]).map(a=>({...a,buttonBgColor:a.customIcon?"":Bd(i,r,a.buttonBgColor)}))}function yd(e,i){if(e==null)return;const r=(a,l)=>{if(!l||!Object.prototype.hasOwnProperty.call(l,"platform"))return;const n=l.platform;n==null||n===""||i(a,n)};if(Array.isArray(e))e.forEach((a,l)=>{r(l,a)});else if(typeof e=="object")for(const a of Object.keys(e)){const l=Number.parseInt(a,10);Number.isNaN(l)||r(l,e[a])}}function Us({__:e,form:i,fieldName:r,pushSettingsToIframe:a,onMetaActiveChange:l}){const{token:n}=(0,o.ui_kit$useToken)(),c=o.ui_kit$Form.useWatch(["items",r],i),m=c&&typeof c=="object"?c:{},f=typeof m.alt=="string"?m.alt:"",_=typeof m.title=="string"?m.title:"",[k,b]=(0,d.useState)(!1),[h,y]=(0,d.useState)(!1),x=(0,d.useRef)(null),E=(0,d.useRef)(null),w=(0,d.useMemo)(()=>({clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,d.useEffect)(()=>{f.trim()&&b(!0)},[f]);const I=!!(f.trim()||k),A=!!(_.trim()||h),v=I||A;(0,d.useLayoutEffect)(()=>{l(r,{alt:I,title:A})},[I,r,l,A]);const P=(0,d.useMemo)(()=>({marginBottom:v?n.formItemMarginBottomXS:0}),[v,n.formItemMarginBottomXS]),C=(0,d.useMemo)(()=>[r,"alt"],[r]),Y=(0,d.useMemo)(()=>[r,"title"],[r]),W=v?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",F=I?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",N=A?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",T=(0,d.useMemo)(()=>f.trim()?f.trim():e("Alternative text"),[e,f]),J=(0,d.useMemo)(()=>_.trim()?_.trim():e("Tooltip text"),[e,_]),Z=(0,d.useMemo)(()=>(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":I}),[I]),se=(0,d.useMemo)(()=>(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":A}),[A]),te=(0,d.useCallback)(le=>{setTimeout(()=>{const fe=le.current;if(fe){if(typeof fe.focus=="function"){fe.focus();return}fe.input&&typeof fe.input.focus=="function"&&fe.input.focus()}},0)},[]),ne=(0,d.useCallback)(()=>{I?(b(!1),f.trim()&&(i.setFieldValue(["items",r,"alt"],""),setTimeout(()=>a(),0))):(b(!0),te(x))},[I,f,r,te,i,a]),_e=(0,d.useCallback)(()=>{if(A)l(r,{title:!1}),y(!1),_.trim()&&(i.setFieldValue(["items",r,"title"],""),setTimeout(()=>a(),0));else{y(!0),l(r,{title:!0});const le=f.trim();i.setFieldValue(["items",r,"title"],le),setTimeout(()=>a(),0),te(E)}},[f,r,te,i,l,a,A,_]);return(0,t.jsxs)("div",{className:"selected-social-form__meta-block",children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected-social-form__meta-toggle-row",style:P,children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:T,placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Button,{type:"default",className:Z,onClick:ne,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:J,placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Button,{type:"default",className:se,onClick:_e,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,t.jsxs)("div",{className:W,children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:C,className:F,children:(0,t.jsx)(o.ui_kit$Input,{ref:x,placeholder:e("Alternative text"),allowClear:w,prefix:hd})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:Y,className:N,children:(0,t.jsx)(o.ui_kit$Input,{ref:E,placeholder:e("Social network name"),allowClear:w,prefix:bd})})]})]})}Us.propTypes={__:g.default.func.isRequired,form:g.default.object.isRequired,fieldName:g.default.oneOfType([g.default.number,g.default.string]).isRequired,pushSettingsToIframe:g.default.func.isRequired,onMetaActiveChange:g.default.func.isRequired};function Rd(e,i){if(!Array.isArray(e)||e.length===0)return i;let r=null;for(const a of e){const l=a.iconWidth;if(l==null||Number.isNaN(l)||l<=0)return i;if(r===null)r=l;else if(l!==r)return i}return r??i}function wd(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=kd(e),r=String(e?.hostCellBgForIconLuminance??"").trim(),a=Rd(e.items,e.iconSize??40),l=typeof e.buttonBorderWidth=="number"&&!Number.isNaN(e.buttonBorderWidth)?e.buttonBorderWidth:0,n=e.bgEnabled&&e.bgColor?String(e.bgColor).trim():"";return{align:e.align??"center",iconSize:a,borderRadius:e.borderRadius??0,gap:e.gap??8,globalBgColor:n,globalItemBorderColor:Vs(e.items),buttonBorderWidth:l,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const m=!!c.customIcon,f=m?"":Zo(n,c.buttonBgColor),_=c.platform&&!m?s.getSocialIconForBlockCell(c.platform,Qo(i,f,r)):null;return{...c,customIcon:m,title:String(c.title??"").trim(),..._?{iconSrc:_}:{},iconWidth:null,iconHeight:null,buttonBgColor:f,itemBorderColor:m?"":String(c.itemBorderColor??"").trim()}}):[]}}var Hs=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useAppConfig(),a=s.useDispatch(),[l]=o.ui_kit$Form.useForm(),n=s.useSendPostMessage(),{openImagePicker:c}=s.useImagePicker(),[m,f]=(0,d.useState)(e),[_,k]=(0,d.useState)(null),[b,h]=(0,d.useState)(null),y=(0,d.useRef)(null),x=(0,d.useRef)(null),E=(0,d.useRef)(null),w=(0,d.useRef)(Ds(e)),I=s.useSelector(s.selectEmailSettings),A=(0,d.useRef)(null),v=(0,d.useRef)(!1),P=(0,d.useRef)(""),C=(0,d.useRef)({}),Y=xd(),W=I?.usedColors??[],F=o.ui_kit$Form.useWatch("items",l)||[],N=(0,d.useCallback)(()=>{A.current&&(document.removeEventListener("dragover",A.current,!0),A.current=null)},[]),T=(0,d.useCallback)(()=>{if(A.current)return;const V=ee=>{ee.preventDefault(),ee.dataTransfer&&(ee.dataTransfer.dropEffect="move")};document.addEventListener("dragover",V,!0),A.current=V},[]),J=(0,d.useMemo)(()=>s.getSocialPresetsForBrand(pd).filter(V=>s.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[V.id]),[]),Z=(0,d.useMemo)(()=>J.map(V=>({value:V.id,label:(0,t.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,t.jsx)("img",{src:s.getSocialIcon(V.id,Y),alt:""}),(0,t.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(V.labelMsgid)})]})})),[i,J,Y]),se=(0,d.useCallback)((V,ee)=>{C.current={...C.current,[V]:{...C.current[V],...ee}}},[]);(0,d.useEffect)(()=>{const V=Ds(e);w.current!==V&&(w.current=V,C.current={},f(e))},[e]);const te=(0,d.useRef)(!1);(0,d.useEffect)(()=>{if(m?.settings){if(te.current){te.current=!1;return}const V=m.settings;P.current=V.bgEnabled&&V.bgColor?String(V.bgColor).trim():"",l.setFieldsValue(wd(m.settings))}},[m,l]),(0,d.useEffect)(()=>()=>N(),[N]);const ne=(0,d.useCallback)(()=>{const V=l.getFieldsValue(!0),ee=m.settings||{},we=String(ee.hostCellBgForIconLuminance??"").trim(),je=(V.globalBgColor||"").trim(),K=typeof V.iconSize=="number"&&!Number.isNaN(V.iconSize)?V.iconSize:ee.iconSize??40,ve=typeof V.borderRadius=="number"&&!Number.isNaN(V.borderRadius)?V.borderRadius:ee.borderRadius??0,Re=typeof V.gap=="number"&&!Number.isNaN(V.gap)?V.gap:ee.gap??8,Le={blockBgEnabled:!!je,blockBgColor:je},Ue=(V.globalItemBorderColor||"").trim();let Me=typeof V.buttonBorderWidth=="number"&&!Number.isNaN(V.buttonBorderWidth)?V.buttonBorderWidth:0;Me=Math.max(0,Math.min(24,Math.round(Me)));const He={...ee,type:"social",align:V.align??ee.align??"center",iconSize:K,borderRadius:ve,gap:Re,bgEnabled:!!je,bgColor:je,hostCellBgForIconLuminance:we,borderWidth:typeof ee.borderWidth=="number"?ee.borderWidth:0,borderColor:typeof ee.borderColor=="string"?ee.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Me,showLabel:V.showLabel,items:(V.items||[]).filter(Boolean).map((O,xe)=>{const D=!!O.customIcon,ue=C.current[xe]||{},ge=D?"":Ed(je,(O.buttonBgColor||"").trim()),Oe=typeof O.href=="string"?$s(O.href):O.href,Ge=D?"":Zo(je,ge),Ye=!D&&O.platform?s.getSocialIconForBlockCell(O.platform,Qo(Le,Ge,we)):null,Xe=D?"":Ue||String(O.itemBorderColor??"").trim(),R=gd(D?O.iconSrc||"":Ye||O.iconSrc||"");return{...O,customIcon:D,href:Oe,iconSrc:R,iconWidth:null,iconHeight:null,buttonBgColor:ge,itemBorderColor:Xe,title:ue.title?String(O.title??"").trim():""}})};n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.SOCIAL,caption:m.caption,settings:He}),P.current=je,te.current=!0,f(O=>({...O,settings:He}))},[m.caption,m.settings,l,n]),_e=(0,d.useCallback)(V=>{if(V==null||V==="")return-1;const ee=kt(String(V));return(l.getFieldValue("items")||[]).findIndex(we=>kt(we&&we.iconSrc||"")===ee)},[l]),le=(0,d.useCallback)((V,ee,we,je)=>{const K=[...l.getFieldValue("items")||[]];if(V<0||V>=K.length)return;const ve=kt(String(je||""))===kt(String(ee||""));(!ve||ee!==K[V]?.iconSrc)&&(K[V]={...K[V],iconSrc:ee,customIcon:!0,buttonBgColor:"",itemBorderColor:""},l.setFieldValue("items",K),setTimeout(()=>ne(),0)),we?.mode==="save"&&ve&&n({operation:s.EVENT_TYPES.SANDBOX_IMAGE_RESET,url:String(ee)})},[l,ne,n]),fe=(0,d.useCallback)(async(V,ee)=>{const we=kt(String(ee||"")),je=_e(ee);if(je<0)return;const K=(l.getFieldValue("items")||[])[je]?.iconSrc,{entryModal:ve,currentUrl:Re,imageDataUrl:Le}=await Ms(we,V),Ue=await c({kind:"img",currentUrl:Re,entryModal:ve,imageDataUrl:Le});Ue?.url&&le(je,Ue.url,Ue.meta,K)},[le,_e,l,c]),Ae=(0,d.useCallback)(async V=>{const ee=(l.getFieldValue("items")||[])[V];if(!ee)return;const{entryModal:we,currentUrl:je,imageDataUrl:K}=await Ms(kt(String(ee.iconSrc||"")),s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),ve=ee.iconSrc,Re=await c({kind:"img",currentUrl:je,entryModal:we,imageDataUrl:K});Re?.url&&le(V,Re.url,Re.meta,ve)},[le,l,c]),ce=(0,d.useCallback)(V=>{const ee=parseInt(V.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(ee)||Ae(ee)},[Ae]),$e=(0,d.useCallback)(V=>{const ee=V.data?.operation,we=V.data?.src;ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_AI,we):ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,we):ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_EDIT,we):ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_GIF,we):ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_STOCK,we):ee===s.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(a(s.closeSecondModal()),a(s.closeModal$1()))},[a,fe]);s.useListenPostMessage($e);const Ce=(0,d.useCallback)(()=>{const V=l.getFieldValue("items")||[],ee=J[0],we=(l.getFieldValue("globalItemBorderColor")||"").trim(),je=(l.getFieldValue("globalBgColor")||"").trim();if(!ee)l.setFieldsValue({items:[...V,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:je,itemBorderColor:we}]});else{const K=String(m?.settings?.hostCellBgForIconLuminance??"").trim(),ve=Zo(je,je),Re=s.getSocialIconForBlockCell(ee.id,Qo({blockBgEnabled:!!je,blockBgColor:je},ve,K)),Le=i(ee.labelMsgid);l.setFieldsValue({items:[...V,{platform:ee.id,customIcon:!1,href:"",alt:Le,title:"",iconSrc:Re,iconWidth:null,iconHeight:null,buttonBgColor:je,itemBorderColor:we}]})}setTimeout(()=>ne(),0)},[i,m?.settings?.hostCellBgForIconLuminance,l,J,ne]),ie=(0,d.useCallback)((V,ee)=>{V.dataTransfer.setData(Fs,String(ee)),V.dataTransfer.setData(s.DND_SOCIAL_LIST_REORDER_MIME,String(ee)),V.dataTransfer.effectAllowed="move",y.current=ee,k(ee),T()},[T]),Be=(0,d.useCallback)(()=>{N(),y.current=null,k(null),h(null)},[N]),ae=(0,d.useCallback)((V,ee,we)=>{if(we<2)return;V.preventDefault(),V.dataTransfer.dropEffect="move";const je=y.current;je!==null&&je!==ee&&h(ee)},[]),oe=(0,d.useCallback)((V,ee)=>{V.currentTarget.contains(V.relatedTarget)||h(we=>we===ee?null:we)},[]),me=(0,d.useCallback)((V,ee,we)=>{V.preventDefault(),h(null);const je=V.dataTransfer.getData(Fs),K=parseInt(je,10);if(Number.isNaN(K)||K===ee){N();return}we(K,ee),N(),setTimeout(()=>ne(),0)},[N,ne]),de=(0,d.useCallback)(V=>{const ee=V.currentTarget,we=parseInt(ee.dataset.itemIndex??"",10);Number.isNaN(we)||ie(V,we)},[ie]),Q=(0,d.useCallback)(V=>{const ee=V.currentTarget,we=parseInt(ee.dataset.itemIndex??"",10),je=parseInt(ee.dataset.listLength??"",10);Number.isNaN(we)||Number.isNaN(je)||je<2||(V.preventDefault(),V.dataTransfer&&(V.dataTransfer.dropEffect="move"))},[]),q=(0,d.useCallback)(V=>{const ee=V.currentTarget,we=parseInt(ee.dataset.itemIndex??"",10),je=parseInt(ee.dataset.listLength??"",10);Number.isNaN(we)||Number.isNaN(je)||ae(V,we,je)},[ae]),z=(0,d.useCallback)(V=>{const ee=parseInt(V.currentTarget.dataset.itemIndex??"",10);Number.isNaN(ee)||oe(V,ee)},[oe]),G=(0,d.useCallback)(V=>{const ee=parseInt(V.currentTarget.dataset.itemIndex??"",10),we=x.current;Number.isNaN(ee)||typeof we!="function"||me(V,ee,we)},[me]),re=(0,d.useCallback)(V=>{V.stopPropagation();const ee=parseInt(V.currentTarget.dataset.fieldName??"",10),we=E.current;Number.isNaN(ee)||typeof we!="function"||(we(ee),queueMicrotask(ne))},[ne]),ke=(0,d.useCallback)((V,ee)=>{const we=J.find(He=>He.id===ee);if(!we)return;const je=i(we.labelMsgid),K=C.current[V]||{},ve=String(l.getFieldValue(["items",V,"alt"])??"").trim();(K.alt||ve)&&l.setFieldValue(["items",V,"alt"],je),K.title&&l.setFieldValue(["items",V,"title"],je);const Re=(l.getFieldValue("globalBgColor")||"").trim(),Le=Zo(Re,(l.getFieldValue(["items",V,"buttonBgColor"])||"").trim()),Ue=String(m?.settings?.hostCellBgForIconLuminance??"").trim(),Me=s.getSocialIconForBlockCell(ee,Qo({blockBgEnabled:!!Re,blockBgColor:Re},Le,Ue));Me&&(l.setFieldValue(["items",V,"customIcon"],!1),l.setFieldValue(["items",V,"iconSrc"],Me))},[i,m?.settings?.hostCellBgForIconLuminance,l,J]),he=(0,d.useCallback)(V=>{if(Object.prototype.hasOwnProperty.call(V,"globalItemBorderColor")){if(!v.current){const ee=String(V.globalItemBorderColor??"").trim(),we=l.getFieldValue("items")||[];l.setFieldsValue({items:Td(we,ee)})}}else if(Object.prototype.hasOwnProperty.call(V,"globalBgColor")){const ee=P.current,we=String(V.globalBgColor??"").trim(),je=l.getFieldValue("items")||[];l.setFieldsValue({items:Sd(je,ee,we)})}else if(V?.items!=null){const ee=l.getFieldValue("items")||[],we=Vs(ee);we!==(l.getFieldValue("globalItemBorderColor")||"").trim()&&(v.current=!0,l.setFieldValue("globalItemBorderColor",we),queueMicrotask(()=>{v.current=!1}));const je=m.settings?.items||[];ee.forEach((K,ve)=>{const Re=K?.platform,Le=je[ve]?.platform;Re&&Re!==Le&&ke(ve,Re)})}yd(V?.items,ke),ne()},[m.settings?.items,l,ne,ke]),Pe=(0,d.useCallback)((V,ee)=>{if(l.setFieldValue(V,ee),Array.isArray(V)&&V[0]==="items"){he({items:{[V[1]]:{[V[2]]:ee}}});return}he({[V]:ee})},[l,he]),ye=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"selected-social-form__section",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:i("General settings")}),(0,t.jsx)("div",{className:"selected-social-form__align-block",children:(0,t.jsx)(zt,{form:l,elementSettings:{...m,type:s.ELEMENT_TYPES.SOCIAL}})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button size"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"iconSize",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:16,max:64,prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px",placeholder:i("Button size"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Corner radius"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"borderRadius",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,t.jsx)(s.EmIcons,{icon:"BorderRadius",component:o.icons$BorderRadius,className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:i("Corner radius"),className:"selected-social-form__input-full"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Spacing"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,t.jsx)(s.EmIcons,{icon:"PaddingLeftRight",component:o.icons$PaddingLeftRight}),addonAfter:"px",placeholder:i("Spacing"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,t.jsx)(Jo,{form:l,name:"globalBgColor",placeholder:i("Background color"),usedColors:W,onColorChange:Pe})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:24,prefix:(0,t.jsx)(s.EmIcons,{icon:"BorderOuterOutlined",component:o.icons$BorderOuterOutlined}),addonAfter:"px",placeholder:i("Border"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,t.jsx)(Jo,{form:l,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:W,onColorChange:Pe})})})})]})]}),(0,t.jsxs)("div",{className:"selected-social-form__section selected-social-form__section--bordered",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:i("Social buttons")}),(0,t.jsx)(o.ui_kit$Form.List,{name:"items",children:(V,{remove:ee,move:we})=>(x.current=we,E.current=ee,(0,t.jsx)("div",{className:"selected-social-form__items",children:V.map((je,K)=>{const ve=!!(F[K]?.customIcon??F[je.name]?.customIcon);return(0,t.jsxs)("div",{className:(0,Ve.default)("selected-social-form__card",_===K&&"selected-social-form__card--dragging",b===K&&_!==K&&"selected-social-form__card--drag-over"),"data-item-index":K,"data-list-length":V.length,onDragEnterCapture:Q,onDragOverCapture:q,onDragLeave:z,onDropCapture:G,children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head-main",children:[V.length>1?(0,t.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":K,onDragStart:de,onDragEnd:Be,role:"button",tabIndex:0,"aria-label":i("Drag to reorder"),children:(0,t.jsx)(s.EmIcons,{icon:"HolderOutlined",component:o.icons$HolderOutlined})}):null,(0,t.jsxs)(md,{className:"selected-social-form__card-title",children:[i("Button")," ",K+1]})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:r.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":je.name,onClick:re})})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"iconSrc"],hidden:!0,children:(0,t.jsx)(o.ui_kit$Input,{})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"customIcon"],valuePropName:"checked",hidden:!0,children:(0,t.jsx)(o.ui_kit$Checkbox,{})}),(0,t.jsxs)("div",{className:"selected-social-form__platform-row",children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:Z,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,t.jsx)(s.EmIcons,{icon:"ChevronDownCustom",component:o.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":K,icon:(0,t.jsx)(s.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,size:18,strokeWidth:r.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:ce})})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Re,Le)=>{const Ue=typeof Le=="string"?Le.trim():String(Le??"").trim();if(Ue&&!_d(Ue))throw new Error(i("Please enter the correct URL."))}}],children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"Link03",component:o.icons$Link03,className:"selected-social-form__field-icon"}),placeholder:i("Enter link"),allowClear:{clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})}})}),ve?null:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,t.jsx)(Jo,{form:l,name:["items",je.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:W,onColorChange:Pe})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,t.jsx)(Jo,{form:l,name:["items",je.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:W,onColorChange:Pe})})})})]}),(0,t.jsx)(Us,{__:i,form:l,fieldName:je.name,pushSettingsToIframe:ne,onMetaActiveChange:se})]},je.key)})}))}),(0,t.jsx)(o.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,t.jsx)(s.EmIcons,{icon:"PlusSquareOutlined",component:o.icons$PlusSquareOutlined}),onClick:Ce,children:i("Add button")})]})]});return(0,t.jsx)("div",{className:"selected-social-form",children:(0,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:he,autoComplete:"off",children:(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:ye})})})};Hs.propTypes={elementSettings:g.default.shape({settings:g.default.object,type:g.default.string,caption:g.default.string})};var Ws=s.BASIC_BORDER_COLOR,jd=(e,i,r,a,l,n,c="")=>{const m=e.getFieldsValue(!0),f=i?"cell_":c;setTimeout(()=>{i?a(_=>!_):r(_=>!_),l&&(m[f+"borderWidth"]=null,m[f+"borderColor"]="",m[f+"borderStyle"]=""),n(_=>({...s.RESET_BORDER_PARAMS,[m[f+"borderPosition"]]:{..._[m[f+"borderPosition"]],width:m[f+"borderWidth"],color:m[f+"borderColor"],style:m[f+"borderStyle"]}}))})},vd=(e,i,r,a,l,n,c)=>{const m=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),!r&&!a[m?.mobileBorderPosition]?.color&&(m.mobileBorderStyle="solid",m.mobileBorderWidth=1,m.mobileBorderColor=Ws,l(f=>({...a,[m?.mobileBorderPosition]:{color:Ws,style:"solid",width:1}}))),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,settings:{mobileBorder:{...a,[m?.mobileBorderPosition]:{color:m.mobileBorderColor,style:m.mobileBorderStyle,width:m.mobileBorderWidth}}}})})},Id=(e,i,r,a,l,n,c="")=>{const m=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),r?(m[c+"borderRadiusAll"]=0,a(!0)):m[c+"borderRadiusAll"]||(m[c+"borderRadiusAll"]=0),l({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:n.type,settings:{borderRadius:{all:m[c+"borderRadiusAll"]}}})})},Cd=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.mobileBorderRadiusAll&&!n.mobileBorderRadiusTopLeft&&!n.mobileBorderRadiusTopRight&&!n.mobileBorderRadiusBottomRight&&!n.mobileBorderRadiusBottomLeft&&(n.mobileBorderRadiusAll=0),["all","topLeft","topRight","bottomRight","bottomLeft"].forEach(c=>{if(!n.mobileBorderRadius?.[c])return;const m=`mobileBorderRadius${c[0].toUpperCase()}${c.slice(1)}`;a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileBorderRadius:{[c]:n[m],classNamePrefix:`em-mob-border_radius_${c}-`}}})})})},Pd=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.boxShadowColor?(n.boxShadowInset=!1,n.boxShadowHOffset=5,n.boxShadowVOffset=5,n.boxShadowBlurRadius=10,n.boxShadowSpreadRadius=-5,n.boxShadowColor="#000000"):r&&(n.boxShadowInset=!1,n.boxShadowHOffset=null,n.boxShadowVOffset=null,n.boxShadowBlurRadius=null,n.boxShadowSpreadRadius=null,n.boxShadowColor=""),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{boxShadow:{blurRadius:n.boxShadowBlurRadius,color:n.boxShadowColor,hOffset:n.boxShadowHOffset,inset:n.boxShadowInset,spreadRadius:n.boxShadowSpreadRadius,vOffset:n.boxShadowVOffset}}})})},Ad=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.mobileBoxShadowColor&&(n.mobileBoxShadowInset=!1,n.mobileBoxShadowHOffset=5,n.mobileBoxShadowVOffset=5,n.mobileBoxShadowBlurRadius=10,n.mobileBoxShadowSpreadRadius=-5,n.mobileBoxShadowColor="#000000"),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileBoxShadow:{blurRadius:n.mobileBoxShadowBlurRadius,color:n.mobileBoxShadowColor,hOffset:n.mobileBoxShadowHOffset,inset:n.mobileBoxShadowInset,spreadRadius:n.mobileBoxShadowSpreadRadius,vOffset:n.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Nd=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.mobileWidth&&(n.mobileWidth=""),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileWidth:{value:n.mobileWidth,dim:n.mobileWidthDim,classNamePrefix:"em-mob-width-"}}})})},Ld=e=>{setTimeout(()=>{e(i=>!i)})},Od=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.mobileBackgroundColor&&(n.mobileBackgroundColor="#E5E5E5"),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:n.mobileBackgroundColor}}}),r&&Ro(e,l,a)})},Fd=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),r&&(n.paddingLeftRight="",n.paddingLeft="",n.paddingRight="",n.paddingTopBottom="",n.paddingTop="",n.paddingBottom="",a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{padding:{all:0}}}))})},$d=(e,i,r,a,l)=>{i(c=>!c);const n=e.getFieldsValue(!0);r||(n.paddingLeftRight=n.paddingLeft,n.paddingTopBottom=n.paddingTop,n.paddingRight=n.paddingLeft,n.paddingBottom=n.paddingTop,a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{padding:{top:n.paddingTopBottom,bottom:n.paddingTopBottom,left:n.paddingLeftRight,right:n.paddingLeftRight}}}))},Md=e=>{setTimeout(()=>{e(i=>!i)})},Dd=(e,i,r,a,l)=>{i(c=>!c);const n=e.getFieldsValue(!0);r||(n.cell_paddingLeftRight=n.cell_paddingLeft,n.cell_paddingTopBottom=n.cell_paddingTop,n.cell_paddingRight=n.cell_paddingLeft,n.cell_paddingBottom=n.cell_paddingTop,a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{cell_padding:{top:n.cell_paddingTopBottom,bottom:n.cell_paddingTopBottom,left:n.cell_paddingLeftRight,right:n.cell_paddingLeftRight}}})),(r&&n.cell_paddingLeftRight||n.cell_paddingLeftRight===0)&&(n.cell_paddingLeft=n.cell_paddingLeftRight,n.cell_paddingRight=n.cell_paddingLeftRight),(r&&n.cell_paddingTopBottom||n.cell_paddingTopBottom===0)&&(n.cell_paddingTop=n.cell_paddingTopBottom,n.cell_paddingBottom=n.cell_paddingTopBottom)},Vd=({form:e,onBorderSideClear:i,formName:r,elementSettings:a,formValues:l,isMacOS:n,__:c,token:m,appConfig:f,typografItems:_,backgroundRepeatOptions:k,backgroundSizeOptions:b,sendAction:h,handleToggleShowPaddingCell:y,handleTogglePaddingCell:x,handleToggleBackground:E,handleToggleBorder:w,handleToggleBorderRadius:I,paddingCellShow:A,paddingsExt:v,backgroundShow:P,cellBordersShow:C,borderRadiusShow:Y,oneBorderRadiusValue:W,setOneBorderRadiusValue:F,textInputRef:N,linkProtocol:T,handleLinkProtocolsChange:J,backgroundImageEmpty:Z})=>{const se=H.useGoogleFontsLoader();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$FormSection,{title:c("Text"),dividerTop:!1,children:[f.formTextFieldTypografEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:m.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"AddImage",component:o.icons$AddImage}),onClick:()=>h("add_img"),style:{width:"100%"},children:c("Add image")})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:m.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,menu:{items:_},trigger:["hover"],placement:"bottom",getPopupContainer:te=>te.closest(".selected-element-panel"),children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),onClick:()=>h("typograf"),style:{width:"100%"},children:c("Typography")})})})})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Text font"),placement:"bottom",zIndex:1,getPopupContainer:te=>te.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:se,getPopupContainer:te=>te.closest(".email-pane__collapse-wrapper")})})}),!a.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:c("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:c("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:a,name:"textStrong",tooltipTitle:c(n?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:a,name:"textItalic",tooltipTitle:c(n?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:a,name:"textStrikethrough",tooltipTitle:c(n?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:a,name:"textUnderline",tooltipTitle:c(n?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,className:(0,Ve.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof a.linkHref=="string"}),elementSettings:a,name:"textLink",tooltipTitle:c("Link"),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),l?.textLink&&(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsxs)(o.ui_kit$Col,{span:24,children:[(0,t.jsx)(oo,{show:T==="#",__:c,style:{marginBottom:m.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",children:(0,t.jsx)(o.ui_kit$Input,{ref:N,addonBefore:(0,t.jsx)(to,{linkProtocol:T,handleLinkProtocolsChange:J,__:c}),allowClear:!0,placeholder:c("Hyperlink URL"),autoFocus:a?.customTable?.isNewLink,prefix:(0,t.jsx)(eo,{linkProtocol:T})})})})]})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Text color"),placement:"bottom",zIndex:2,getPopupContainer:te=>te.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:c("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:c("Color"),usedColors:a.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Text background"),placement:"bottom",zIndex:2,getPopupContainer:te=>te.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:c("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:c("Background color"),usedColors:a.usedColors})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(so,{form:e,elementSettings:a,name:"textAlign"})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:a,name:"valign",isNewIconType:!0})})]})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:c("Padding"),collapsible:!0,open:A,onToggle:y,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:v,onToggleExtended:x,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,t.jsx)(o.ui_kit$FormSection,{title:c("Background"),collapsible:!0,open:P,onToggle:E,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:f.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:Z,usedColors:a.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:b,imageUploadSlot:(f.formTableFieldBackgroundImageEnabled,void 0)})}),(0,t.jsx)(o.ui_kit$FormSection,{title:c("Borders"),collapsible:!0,open:C,onToggle:w,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,namePrefix:"cell_"})}),f.formFieldBorderRadiusEnabled&&!1]})},zs=({form:e,onBorderSideClear:i,elementSettings:r,paddingShow:a,paddingsExt:l,backgroundShow:n,bordersShow:c,borderRadiusShow:m,boxShadowShow:f,handleToggleShowPadding:_,handleTogglePadding:k,handleToggleBackground:b,handleToggleBorder:h,handleToggleBorderRadius:y,handleToggleBoxShadow:x,backgroundRepeatOptions:E,backgroundSizeOptions:w,backgroundImageEmpty:I,oneBorderRadiusValue:A,setOneBorderRadiusValue:v,boxShadow:P})=>{const{__:C}=s.useI18n(),Y=s.useAppConfig(),{token:W}=(0,o.ui_kit$useToken)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$FormSection,{title:C("Padding"),collapsible:!0,open:a,onToggle:_,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:l,onToggleExtended:k,gutter:W.marginSM,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,t.jsxs)(o.ui_kit$FormSection,{title:C("Background"),collapsible:!0,open:n,onToggle:b,dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{imageEnabled:Y.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:I,usedColors:r.usedColors,colorPlaceholder:C("Background color"),horizontalPositionPlaceholder:C("Horizontal position"),horizontalPositionTooltip:C("Horizontal position"),verticalPositionPlaceholder:C("Vertical position"),verticalPositionTooltip:C("Vertical position"),backgroundRepeatTooltip:C("Background image repeat"),backgroundSizeTooltip:C("Background image size"),selectPlaceholder:C("Please choose"),backgroundRepeatOptions:E,backgroundSizeOptions:w,imageUploadSlot:Y.formTableFieldBackgroundImageEnabled?(0,t.jsx)(Ot,{form:e,label:C("Background image"),name:"backgroundImage",tooltipTitle:C("Background image"),placeholder:C("Background image link/route")}):void 0}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:C("Borders"),collapsible:!0,open:c,onToggle:h,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,onBorderSideClear:i})}),Y.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Border radius"),collapsible:!0,open:m,onToggle:y,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:A,setOneBorderRadiusValue:v,elementSettings:r})}),Y.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Box shadow"),collapsible:!0,open:f,onToggle:x,dividerTop:!0,children:(0,t.jsx)(It,{})}),Y.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:r,form:e})})]})};zs.propTypes={form:g.default.object.isRequired,onBorderSideClear:g.default.func,elementSettings:g.default.object.isRequired,paddingShow:g.default.bool,paddingsExt:g.default.bool,backgroundShow:g.default.bool,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,handleToggleShowPadding:g.default.func,handleTogglePadding:g.default.func,handleToggleBackground:g.default.func,handleToggleBorder:g.default.func,handleToggleBorderRadius:g.default.func,handleToggleBoxShadow:g.default.func,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,backgroundImageEmpty:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,boxShadow:g.default.object};var Gs=({form:e,elementSettings:i,mobileSizeShow:r,mobileBackgroundShow:a,mobileBordersShow:l,mobileBorderRadiusShow:n,mobileBoxShadowShow:c,handleToggleMobileSize:m,handleToggleMobileBackground:f,handleToggleMobileBorder:_,handleToggleMobileBorderRadius:k,handleToggleMobileBoxShadow:b,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:y,mobileBorders:x,mobileBoxShadow:E})=>{const{__:w,_x:I}=s.useI18n(),A=s.useAppConfig(),{token:v}=(0,o.ui_kit$useToken)(),P=s.useSelector(s.selectEmailSettings);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$FormSection,{title:w("Size"),collapsible:!0,open:r,onToggle:m,dividerTop:!0,children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:w("Table width"),placement:"left",children:(0,t.jsx)("div",{style:{marginBottom:v.formItemMarginBottomMD+4},children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})})})})}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:v.formItemMarginBottomXS*2},children:(0,t.jsx)(o.ui_kit$Tooltip,{title:w("Height"),placement:"bottom",children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:w("Background"),collapsible:!0,open:a,onToggle:f,dividerTop:!0,children:(0,t.jsx)(wo,{elementSettings:Xt(i),imageEnabled:A.formTableFieldBackgroundImageEnabled,desktopBackground:So(i)})}),A.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:w("Borders"),collapsible:!0,open:l,onToggle:_,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:x,usedColors:P.usedColors,labels:{color:w("Color"),width:I("Width","border"),none:w("None"),solid:w("Solid"),dashed:w("Dashed"),dotted:w("Dotted"),above:w("Above"),below:w("Below"),onLeft:w("On the left"),onRight:w("On the right"),around:w("Around"),usedColors:w("Used"),recommendedColors:w("Recommended")}})}),A.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:w("Border radius"),collapsible:!0,open:n,onToggle:k,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:y,elementSettings:i})}),A.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:w("Box shadow"),collapsible:!0,open:c,onToggle:b,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),A.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:w("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})})]})};Gs.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,handleToggleMobileSize:g.default.func,handleToggleMobileBackground:g.default.func,handleToggleMobileBorder:g.default.func,handleToggleMobileBorderRadius:g.default.func,handleToggleMobileBoxShadow:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,mobileBorders:g.default.object,mobileBoxShadow:g.default.object};var Ud=({form:e,onBorderSideClear:i,elementViewType:r,mobileViewActive:a,elementSettings:l,paddingShow:n,paddingsExt:c,backgroundShow:m,bordersShow:f,borderRadiusShow:_,boxShadowShow:k,mobileSizeShow:b,mobileBackgroundShow:h,mobileBordersShow:y,mobileBorderRadiusShow:x,mobileBoxShadowShow:E,handleToggleShowPadding:w,handleTogglePadding:I,handleToggleBackground:A,handleToggleBorder:v,handleToggleBorderRadius:P,handleToggleBoxShadow:C,handleToggleMobileSize:Y,handleToggleMobileBackground:W,handleToggleMobileBorder:F,handleToggleMobileBorderRadius:N,handleToggleMobileBoxShadow:T,backgroundRepeatOptions:J,backgroundSizeOptions:Z,backgroundImageEmpty:se,oneBorderRadiusValue:te,setOneBorderRadiusValue:ne,oneMobileBorderRadiusValue:_e,setOneMobileBorderRadiusValue:le,boxShadow:fe,mobileBorders:Ae,mobileBoxShadow:ce})=>(0,t.jsx)(t.Fragment,{children:r==="mobile"&&a.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(Gs,{form:e,elementSettings:l,mobileSizeShow:b,mobileBackgroundShow:h,mobileBordersShow:y,mobileBorderRadiusShow:x,mobileBoxShadowShow:E,handleToggleMobileSize:Y,handleToggleMobileBackground:W,handleToggleMobileBorder:F,handleToggleMobileBorderRadius:N,handleToggleMobileBoxShadow:T,oneMobileBorderRadiusValue:_e,setOneMobileBorderRadiusValue:le,mobileBorders:Ae,mobileBoxShadow:ce})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(zs,{form:e,onBorderSideClear:i,elementSettings:l,paddingShow:n,paddingsExt:c,backgroundShow:m,bordersShow:f,borderRadiusShow:_,boxShadowShow:k,handleToggleShowPadding:w,handleTogglePadding:I,handleToggleBackground:A,handleToggleBorder:v,handleToggleBorderRadius:P,handleToggleBoxShadow:C,backgroundRepeatOptions:J,backgroundSizeOptions:Z,backgroundImageEmpty:se,oneBorderRadiusValue:te,setOneBorderRadiusValue:ne,boxShadow:fe})})}),Hd=["borderTop","borderBottom","borderLeft","borderRight"],Ys=({elementSettings:e,formName:i})=>{const{__:r}=s.useI18n(),a=s.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),{token:n}=(0,o.ui_kit$useToken)(),c=s.useAppConfig(),m=s.useSelector(s.selectEmailViewType),f=s.useSelector(s.selectMobileViewActive),_=s.useSelector(s.selectIsCodeMode),k=s.useSelector(s.selectCodeModeDirection),[b,h]=(0,d.useState)({}),[y,x]=(0,d.useState)(!0),[E,w]=(0,d.useState)({}),[I,A]=(0,d.useState)({}),[v,P]=(0,d.useState)(!0),[C,Y]=(0,d.useState)(e.customTable?.backgroundImage[0].value===""),[W,F]=(0,d.useState)(),[N,T]=(0,d.useState)(!1),[J,Z]=(0,d.useState)(!1),[se,te]=(0,d.useState)(!1),[ne,_e]=(0,d.useState)(!1),[le,fe]=(0,d.useState)(!1),[Ae,ce]=(0,d.useState)(!1),[$e,Ce]=(0,d.useState)(!1),[ie,Be]=(0,d.useState)(!1),[ae,oe]=(0,d.useState)(!0),[me,de]=(0,d.useState)(!0),[Q,q]=(0,d.useState)(!0),[z,G]=(0,d.useState)(!1),[re,ke]=(0,d.useState)("https://"),[he,Pe]=(0,d.useState)({}),[ye,V]=(0,d.useState)(!1),[ee,we]=(0,d.useState)(!1),[je,K]=(0,d.useState)(!1),[ve,Re]=(0,d.useState)({}),Le=(0,d.useRef)(null),Ue=(0,d.useRef)(),Me=o.ui_kit$Form.useWatch([],l),He=[{label:r("Not defined"),value:"none"},{label:r("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:r("Repeat background (repeat)"),value:"repeat"},{label:r("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:r("Repeat background vertically (repeat-y)"),value:"repeat-y"}],O=[{label:r("Not defined"),value:""},{label:r("Contain"),value:"contain"},{label:r("Cover"),value:"cover"}],xe={width:"",style:"",color:""},D=_&&k!=="bottom",ue=s.BASIC_BORDER_COLOR,ge=i==="Edit selected table cells"||!1,[Oe,Ge]=(0,d.useState)(null);(0,d.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Ge(!0)},[]);const Ye=U=>{a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:U,locale:"en_US"})},Xe=[{key:"1",label:r("This element"),onClick:()=>Ye("typograf")},{key:"2",label:r("The whole email"),onClick:()=>Ye("typograf_all")}];let R="";(0,d.useEffect)(()=>{if(e){yo(e)&&Be(!0);const U=e.border,Se=e.boxShadow,pe=e.customTable?.mobileBorder,ze=e.customTable?.mobileBoxShadow,dt=e.customTable?.cellBorders;Re(U),h(Se),w(pe),A(ze),Pe(dt);const at=ge?e?.customTable?.cell_borderPosition:e?.customTable?.borderPosition,mt=Object.keys(pe).find(Et=>pe[Et]?.width||pe[Et]?.style||pe[Et]?.color);l.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:mt||"all",mobileBorderWidth:pe[mt]?.width!==null?pe[mt]?.width:"",mobileBorderColor:pe[mt]?.color||"",mobileBorderStyle:pe[mt]?.style||"",...mo(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:at||"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:pt(e.customTable?.mobileWidth?.value),mobileWidthDim:e.customTable?.mobileWidth?.dim,mobileHeight:pt(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))?x(!1):x(!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)?P(!1):P(!0),Y(e.customTable?.backgroundImage[0].value===""),F(Et=>U[at]?.width||U[at]?.style||U[at]?.color?!0:Et),Z(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),_e(!!e.boxShadow),K(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),ce(!!e.customTable?.mobileWidth.value),we(!!e.exportAsPicture)}},[l,e]),(0,d.useEffect)(()=>{const U=l.getFieldValue("linkHref");typeof e.customTable?.linkHref=="string"&&V(!0),Le&&!U&&(V(!1),l.setFieldsValue({linkHref:null})),Le.current=U||null},[Me?.textLink,Me?.linkHref,e.customTable?.linkHref,l]),(0,d.useEffect)(()=>{e.customTable?.linkHref&&Gt(e.customTable?.linkHref||"",ke),l.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[l,e,ke]);const X=U=>{l.setFieldValue("linkHref",U!=="mergetag"?U:""),ke(U)},j=U=>{const Se=l.getFieldsValue(!0),pe=Object.keys(U)[0];let ze;const dt=Hd.includes(pe)&&Se[pe]?{...Se[pe],width:Se[pe].width===""?Se.borderAll?.width||"1":Se[pe].width,color:Se[pe].color===""?Se.borderAll?.color||ue:Se[pe].color,style:Se[pe].style===""?Se.borderAll?.style||"solid":Se[pe].style}:null,at=["top","right","bottom","left"],mt="em-mob-border_",Et=Tt=>({...s.RESET_BORDER_PARAMS[Tt],classNamePrefix:`${mt}${Tt}-`}),Qt=(Tt,st,jt,Ht)=>at.reduce((xt,Wt)=>(xt[Wt]={...Tt,[jt]:Wt===st?Ht:Tt[jt],classNamePrefix:`${mt}${Wt}-`},xt),{}),At=(Tt,st,jt,Ht)=>{const xt=Ht.mobileBorderPosition,Wt=xt==="all",No=st===""||st==null;let Ft;Wt?Ft={all:{...jt.all,[Tt]:No?null:st,classNamePrefix:`${mt}all-`},...at.reduce((Oo,pi)=>({...Oo,[pi]:Et(pi)}),{})}:No?Ft={...jt,[xt]:Et(xt),all:{...s.RESET_BORDER_PARAMS.all}}:jt.all?.color!=null&&jt.all?.width!=null&&jt.all?.style!=null?Ft={...Qt(jt.all,xt,Tt,st),all:{...s.RESET_BORDER_PARAMS.all}}:Ft={...jt,[xt]:{...jt[xt],[Tt]:st,classNamePrefix:`${mt}${xt}-`},all:{...s.RESET_BORDER_PARAMS.all}};const Lo=Wt?Ft.all:Ft[xt],wr={mobileBorderColor:Lo?.color??ue,mobileBorderWidth:Lo?.width??1,mobileBorderStyle:Lo?.style??"solid"};return{newBorders:Ft,sending:{mobileBorder:Ft},formUpdates:wr}};switch(pe){case"exportAsPicture":ze={exportAsPicture:Se.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":ze={boxShadow:{hOffset:Se.boxShadowHOffset,vOffset:Se.boxShadowVOffset,blurRadius:Se.boxShadowBlurRadius,spreadRadius:Se.boxShadowSpreadRadius,color:Se.boxShadowColor,inset:Se.boxShadowInset}};break;case"width":ze={[pe]:{value:U[pe],dim:Se.widthDim}};break;case"widthDim":ze={width:{value:Se.width,dim:U[pe]}};break;case"maxWidth":ze={[pe]:{value:U[pe],dim:Se.maxWidthDim}};break;case"maxWidthDim":ze={maxWidth:{value:Se.maxWidth,dim:U[pe]}};break;case"minWidth":ze={[pe]:{value:U[pe],dim:Se.minWidthDim}};break;case"minWidthDim":ze={minWidth:{value:Se.minWidth,dim:U[pe]}};break;case"backgroundImage":Y(U[pe]===""),ze={[pe]:[{...e.customTable?.backgroundImage[0],value:U[pe]}],backgroundSize:"cover"},l.setFieldsValue({backgroundColor:""});break;case"backgroundColor":Y(!0),ze=U,l.setFieldsValue({backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":ze={borderRadius:{[H.BORDER_RADIUS_POSITION[pe]]:+U[pe]}};break;case"mobileWidth":ze={[pe]:{classNamePrefix:"em-mob-width-",value:U[pe],dim:Se.mobileWidthDim}};break;case"mobileWidthDim":ze={mobileWidth:{classNamePrefix:"em-mob-width-",value:Se.mobileWidth||100,dim:U[pe]}};break;case"mobileHeight":ze={[pe]:{classNamePrefix:"em-mob-height-",value:U[pe],dim:Se.mobileHeightDim}};break;case"mobileBorderStyle":case"mobileBorderColor":case"mobileBorderWidth":const Tt={mobileBorderStyle:"style",mobileBorderColor:"color",mobileBorderWidth:"width"}[pe],{newBorders:st,sending:jt,formUpdates:Ht}=At(Tt,U[pe],E,Se);Object.assign(Se,Ht),w(st),ze=jt;break;case"mobileBorderPosition":l.setFieldsValue({mobileBorderWidth:E[U[pe]].width||"",mobileBorderColor:E[U[pe]].color||"",mobileBorderStyle:E[U[pe]].style||""});break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":ze={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[pe]]:U[pe],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[pe]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":ze={mobileBoxShadow:{hOffset:Se.mobileBoxShadowHOffset,vOffset:Se.mobileBoxShadowVOffset,blurRadius:Se.mobileBoxShadowBlurRadius,spreadRadius:Se.mobileBoxShadowSpreadRadius,color:Se.mobileBoxShadowColor,inset:Se.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(ze=To(U),!ze)return;break;case"mobileAlign":ze={[pe]:{classNamePrefix:"em-mob-table_align-",value:U[pe]}};break;case"borderPosition":ze=U,a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze});break;case"borderAll":U[pe]?.style===""?l.setFieldsValue({borderAll:xe}):l.setFieldsValue({borderTop:xe,borderBottom:xe,borderLeft:xe,borderRight:xe}),ze=U;break;case"borderTop":l.setFieldsValue({borderTop:dt}),U[pe]?.style===""?l.setFieldsValue({borderTop:xe}):l.setFieldsValue({borderAll:xe}),ze=U;break;case"borderBottom":l.setFieldsValue({borderBottom:dt}),U[pe]?.style===""?l.setFieldsValue({borderBottom:xe}):l.setFieldsValue({borderAll:xe}),ze=U;break;case"borderLeft":l.setFieldsValue({borderLeft:dt}),U[pe]?.style===""?l.setFieldsValue({borderLeft:xe}):l.setFieldsValue({borderAll:xe}),ze=U;break;case"borderRight":l.setFieldsValue({borderRight:dt}),U[pe]?.style===""?l.setFieldsValue({borderRight:xe}):l.setFieldsValue({borderAll:xe}),ze=U;break;case"cell_borderPosition":ze=U,a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze});break;case"fontSize":case"lineHeight":if(U[pe]===null||U[pe]===""||U[pe]===void 0)return;ze=U;break;case"linkHref":{const xt=io(U[pe]);xt!==U[pe]&&l.setFieldValue("linkHref",xt),ze={linkHref:xt},Gt(xt,ke);break}default:ze=U}pe!=="borderPosition"&&a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze})},M=(0,d.useCallback)(()=>{jd(l,ge,F,G,W,Re,R)},[l,ge,W,R]),Ee=(0,d.useCallback)(()=>{vd(l,T,N,E,w,a,e)},[l,N,E,a,e]),Fe=(0,d.useCallback)(()=>{Id(l,Z,J,x,a,e,R)},[l,J,x,a,e,R]),tt=(0,d.useCallback)(()=>{Cd(l,te,se,a,e)},[l,se,a,e]),qe=(0,d.useCallback)(()=>{Pd(l,_e,ne,a,e)},[l,ne,a,e]),ct=(0,d.useCallback)(()=>{Ad(l,fe,le,a,e)},[l,le,a,e]),Ze=(0,d.useCallback)(()=>{Nd(l,ce,Ae,a,e)},[l,Ae,a,e]),ut=(0,d.useCallback)(()=>{Ld(Ce)},[Ce]),Bt=(0,d.useCallback)(()=>{Od(l,Be,ie,a,e)},[l,ie,a,e]),B=(0,d.useCallback)(()=>{Fd(l,oe,ae,a,e)},[l,ae,a,e]),S=(0,d.useCallback)(()=>{$d(l,de,me,a,e)},[l,me,a,e]),p=(0,d.useCallback)(()=>{Md(q)},[q]),$=(0,d.useCallback)(()=>{Dd(l,de,me,a,e)},[l,me,a,e]);return(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:i,initialValues:{paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",cell_paddingTop:"",cell_paddingLeft:"",cell_paddingRight:"",cell_paddingBottom:"",cell_paddingLeftRight:"",cell_paddingTopBottom:"",borderAll:{width:"",style:"",color:""},borderTop:{width:"",style:"",color:""},borderBottom:{width:"",style:"",color:""},borderLeft:{width:"",style:"",color:""},borderRight:{width:"",style:"",color:""},cellBackgroundColor:"",backgroundImageForCell:"",cellBackgroundPositionX:"",cellBackgroundPositionY:"",cellBackgroundRepeat:"",cellBackgroundSize:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:"",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorder:"",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBorderAll:"",mobileBorderTop:"",mobileBorderBottom:"",mobileBorderLeft:"",mobileBorderRight:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:"",cell_border:"",cell_borderColor:"",cell_borderWidth:"",cell_borderStyle:"",cell_borderPosition:"cell_borderAll",cell_borderAll:{color:"",width:"",style:""},cell_borderTop:{color:"",width:"",style:""},cell_borderBottom:{color:"",width:"",style:""},cell_borderLeft:{color:"",width:"",style:""},cell_borderRight:{color:"",width:"",style:""},cell_borderRadiusAll:"",cell_RadiusTopLeft:"",cell_RadiusBottomLeft:"",cell_RadiusTopRight:"",cell_RadiusBottomRight:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",verticalAlign:"",textBackgroundColor:"",valign:""},onValuesChange:j,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!D&&(0,t.jsx)(o.ui_kit$Tooltip,{title:r("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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:r("Appearance on mobile devices"),type:"info"})}),ge?(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Vd,{form:l,onBorderSideClear:j,formValues:Me,elementSettings:e,appConfig:c,token:n,isMacOS:Oe,__:r,handleToggleShowPaddingCell:p,handleTogglePaddingCell:$,handleToggleBackground:ut,handleToggleBorder:M,handleToggleBorderRadius:Fe,paddingCellShow:Q,paddingsExt:me,backgroundShow:$e,cellBordersShow:z,borderRadiusShow:J,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,backgroundImageEmpty:C,backgroundRepeatOptions:He,backgroundSizeOptions:O,sendAction:Ye,typografItems:Xe,textInputRef:Ue,linkProtocol:re,handleLinkProtocolsChange:X,isCodeVision:D})}):(0,t.jsx)(Ud,{form:l,onBorderSideClear:j,elementSettings:e,handleToggleShowPadding:B,handleTogglePadding:S,handleToggleBackground:ut,handleToggleBorder:M,handleToggleBorderRadius:Fe,handleToggleBoxShadow:qe,handleToggleMobileSize:Ze,handleToggleMobileBackground:Bt,handleToggleMobileBorder:Ee,handleToggleMobileBorderRadius:tt,handleToggleMobileBoxShadow:ct,paddingShow:ae,paddingsExt:me,backgroundShow:$e,bordersShow:W,borderRadiusShow:J,boxShadowShow:ne,mobileSizeShow:Ae,mobileBackgroundShow:ie,mobileBordersShow:N,mobileBorderRadiusShow:se,mobileBoxShadowShow:le,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,oneMobileBorderRadiusValue:v,setOneMobileBorderRadiusValue:P,backgroundImageEmpty:C,backgroundRepeatOptions:He,backgroundSizeOptions:O,boxShadow:b,mobileBorders:E,mobileBoxShadow:I,elementViewType:m,mobileViewActive:f})," "]})};Ys.propTypes={elementSettings:g.default.object.isRequired};var po=({className:e=null,formSettings:i,emailElementType:r,formName:a})=>{const l=s.useDispatch(),n=St.useSendStyleToggleToIframe(),c=(0,d.useRef)(),m=s.useSelector(s.selectActiveSettingsTab),f=s.useSelector(s.selectElementSettings$1),_=s.useSelector(s.selectElementSettings),k=s.useContainer(),b=s.getComponentRegistry(k),h=r==="email"?f:_,y=h.type,x=y===s.ELEMENT_TYPES.CAROUSEL||y===s.ELEMENT_TYPES.IMG?i.settings:h,[E,w]=(0,d.useState)(x),[I,A]=(0,d.useState)(x);x!==I&&(A(x),w(x));const v=P=>{const C=P.data.operation,Y=P.data.action;if(C===s.EVENT_TYPES.APPLICATION_ACTION){let F=function(N,T=null){const J={[N]:T||!E[N]};n(J,E.type),l(s.setEmailSettings(J)),w(Z=>({...Z,...J}))};var W=F;Y==="toggle_strong"&&F("textStrong"),Y==="toggle_italic"&&F("textItalic"),Y==="toggle_underline"&&F("textUnderline"),Y==="toggle_strikethrough"&&F("textStrikethrough"),Y==="textAlign_left"&&F("textAlign","left"),Y==="textAlign_right"&&F("textAlign","right"),Y==="textAlign_center"&&F("textAlign","center")}};return s.useListenPostMessage(v),(0,t.jsx)("div",{className:"selected-element-panel",children:(0,t.jsx)(s.CSSTransition,{nodeRef:c,in:m===s.PROPERTIES,timeout:300,classNames:"transition",children:(0,t.jsxs)("div",{ref:c,className:(0,Ve.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,t.jsx)(d.Fragment,{children:b.getReactElement(i.content)},i.instanceKey):null,(h.type===s.ELEMENT_TYPES.IMG||h.type===s.ELEMENT_TYPES.COUNTDOWN||h.type===s.ELEMENT_TYPES.VIDEO)&&(0,t.jsx)(Jr,{elementSettings:h}),h.type===s.ELEMENT_TYPES.TEXT&&(0,t.jsx)(Un,{elementSettings:h}),h.type===s.ELEMENT_TYPES.LINK&&(0,t.jsx)(hs,{elementSettings:h}),h.type===s.ELEMENT_TYPES.TABLE&&(0,t.jsx)(ps,{elementSettings:h}),h.type===s.ELEMENT_TYPES.CUSTOM_TABLE&&(0,t.jsx)(Ys,{elementSettings:h,formName:a}),(h.type===s.ELEMENT_TYPES.TD||h.type===s.ELEMENT_TYPES.STRUCTURE||h.type===s.ELEMENT_TYPES.GROUP||h.type===s.ELEMENT_TYPES.COLUMN)&&(0,t.jsx)(ks,{elementSettings:h}),h.type===s.ELEMENT_TYPES.VAR&&(0,t.jsx)(Is,{elementSettings:h}),h.type===s.ELEMENT_TYPES.BUTTON&&(0,t.jsx)(vs,{elementSettings:h}),h.type===s.ELEMENT_TYPES.DIV&&(0,t.jsx)(Ts,{elementSettings:h}),h.type===s.ELEMENT_TYPES.VINDENT&&(0,t.jsx)(gs,{elementSettings:h}),h.type===s.ELEMENT_TYPES.FLOAT_BLOCK&&(0,t.jsx)(Rs,{elementSettings:h}),i.type===s.ELEMENT_TYPES.CAROUSEL&&(0,t.jsx)(Ls,{elementSettings:i}),i.type===s.ELEMENT_TYPES.ACCORDION&&(0,t.jsx)(Os,{elementSettings:i}),i.type===s.ELEMENT_TYPES.SOCIAL&&(0,t.jsx)(Hs,{elementSettings:i})]})})})};po.propTypes={className:g.default.string,formName:g.default.string};function Kt(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var Xs=({emailElementType:e,isSelectedElement:i=!1,selectedElement:r={parent:!1}})=>{const{__:a}=s.useI18n(),l=s.useDispatch(),n=s.useSendPostMessage(),[c]=o.ui_kit$Form.useForm(),m=(0,d.useRef)(),f=(0,d.useRef)(),_=s.useSelector(s.selectElementSettings$1),k=s.useSelector(s.selectElementSettings),b=s.useAppConfig(),h=r||(e==="email"?_:k),[y,x]=(0,d.useState)(h.floatBlocks?.wrap),[E,w]=(0,d.useState)(h.floatBlocks?.dirRevers),[I,A]=(0,d.useState)(null),[v,P]=(0,d.useState)(0),[C,Y]=(0,d.useState)([]),W=s.useSelector(s.selectEmailViewType),F=(0,d.useCallback)(ie=>{l(e==="email"?s.setElementSettings$1(ie):s.setElementSettings(ie))},[l,e]);(0,d.useEffect)(()=>{if(h&&JSON.stringify(h)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:h.floatBlocks?.gap,gapMobile:h.floatBlocks?.gapMobile,gapDim:"px",valign:h.floatBlocks?.valign}),h.floatBlocks?.items.length>0){let oe=function(me,de){if(me.length!==de.length)return!1;for(let Q=0;Q<me.length;Q++)if(me[Q]!==de[Q])return!1;return!0};var ie=oe;const Be=h.floatBlocks.items.reduce((me,de)=>me+de.width,0),ae=h.floatBlocks.items.map(me=>((me.width||0)/Be*100).toFixed(1));P(Be),!oe(ae,C)&&h.changeKey!=="gap"&&Y(ae),h.floatBlocks.items.forEach((me,de)=>c.setFieldsValue({["width-"+de]:me.width||0})),h.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")}x(h.floatBlocks?.wrap)}},[c,h,I,C]);let N=0;h.floatBlocks?.items.length>0&&(N=h.floatBlocks.items.length);const T=(ie,Be)=>{Object.keys(Be).forEach(ae=>{if(ae.includes("width")){const oe=parseInt(ae.match(/\d+/));c.setFieldsValue({[ae]:ie.items[oe]})}})},[J,Z]=(0,d.useState)(!1);(0,d.useEffect)(()=>{const ie=()=>Z(!0),Be=()=>Z(!1);return document.addEventListener("keyup",Be),document.addEventListener("keydown",ie),()=>{document.removeEventListener("keyup",Be),document.removeEventListener("keydown",ie)}},[]);const se=ie=>{f.current&&J&&clearTimeout(f.current),f.current=setTimeout(()=>Be(ie),50);function Be(ae){const oe=c.getFieldsValue(!0),me=Object.keys(ae)[0];if(A(me),me.includes("width")){if(oe[me]&&oe[me]>=30){let de={items:[],gap:oe.gap,valign:oe.valign,activateSection:i?void 0:"structure"},Q=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){Q=parseFloat(Object.keys(ae)[0].substring(Object.keys(ae)[0].length-1));const q=oe["width-"+(Q+1)]?Q+1:0;let z=v;Object.keys(oe).forEach(G=>{G.includes("width")&&G.indexOf("width-"+q)===-1&&(z-=oe[G])}),oe["width-"+q]=z}Object.keys(oe).forEach(q=>{q.includes("width")&&de.items.push(oe[q])}),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:de}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...de,items:h.floatBlocks.items.map((q,z)=>({...h.floatBlocks.items[z],width:de.items[z]}))},changeKey:me})}}else if(me==="gap"){const de={items:h.floatBlocks.items.map(G=>G.width),gap:h.floatBlocks.gap},Q=de.items.reduce((G,re)=>G+re,0)+(de.items.length-1)*de.gap,q=oe.gap,z=Q-(de.items.length-1)*q;if(z>de.items.length*30||h.floatBlocks.gap-ae>=0){const G=(Pe,ye)=>Math.round(ye*Pe/100);let re=de.items.map((Pe,ye)=>G(C[ye],z));const ke=Q-(re.reduce((Pe,ye)=>Pe+ye,0)+(de.items.length-1)*q);if(ke!==0){const Pe=re.length-Math.abs(ke);re=re.map((ye,V)=>Pe<=V?ye+(ke>0?1:-1):ye)}let he={items:re,gap:q||0};T(he,oe),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:he,editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...he,items:h.floatBlocks.items.map((Pe,ye)=>({...Pe,width:he.items[ye]}))},changeKey:me})}}else if(me==="valign"){let de={valign:oe.valign};n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:de,editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...de},changeKey:me})}else if(me==="gapMobile"){let de={mobileHeight:{classNamePrefix:"em-mob-height-",value:ae[me],dim:"px"}};n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:de}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,gapMobile:de.mobileHeight.value},changeKey:me})}setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),600)}},te=()=>{const ie=c.getFieldsValue(!0),Be=h.floatBlocks.items.map(z=>z.width);let ae={items:[],gap:ie.gap};const oe=Be.reduce((z,G)=>z+G,0),me=Be.length,de=Math.ceil(v/me)*me,Q=de/me,q=oe-de;if(ae.items=Array(me).fill(Q),q!==0){const z=Be.length-Math.abs(q);ae.items=ae.items.map((G,re)=>z<=re?G+(q>0?1:-1):G)}T(ae,ie),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:ae,editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ae,items:h.floatBlocks.items.map((z,G)=>({...z,width:ae.items[G]}))},changeKey:"width"})},ne=ie=>{const Be=c.getFieldsValue(!0),ae=h.floatBlocks.items.map(he=>he.width),oe=h.floatBlocks.gap||20,me=ie.cols-ae.length;let de=[],Q=ae.reduce((he,Pe)=>he+Pe,0);ie.cols>=ae.length?Q-=oe*me:Q+=oe*Math.abs(me);const q=Math.round(Q/ie.cols);function z(he,Pe){const ye=[];for(let V=0;V<he;V++)ye.push(ie.width?.[V]?Math.round(Q/100*ie.width?.[V]):Pe);return ye}de=z(ie.cols,q);const G=Q-de.reduce((he,Pe)=>he+Pe,0);if(G!==0){let he=de.map((ye,V)=>[V,ye]).filter(ye=>ye[1]>30);const Pe=he.length-Math.abs(G);he=he.map((ye,V)=>{const ee=Pe<=V?ye[1]+(G>0?1:-1):ye[1];return[ye[0],ee]}),he.map(ye=>(de[ye[0]]=ye[1],ye))}let re={items:de,gap:Be.gap||20};const ke=de.reduce((he,Pe)=>he+Pe,0);Y(de.map(he=>(he/ke*100).toFixed(1))),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:re,editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...re,items:re.items.map((he,Pe)=>({width:he,current:!1}))},changeKey:"width"})},_e=()=>{const ie=c.getFieldsValue(!0);if(N<8){const Be=h.floatBlocks.items.map(z=>z.width),ae=h.floatBlocks.gap,oe=Be.reduce((z,G)=>z+(G>30?G:0),0),me=(oe-30-ae)/oe,de=Be.map(z=>z>30?Math.round(z*me):z).reduce((z,G)=>z+(G>30?G:0),0);let Q=Be.map(z=>z>30?Math.round(z*me):z);Q.push(30);const q=oe-de-30-ae;if(q!==0){let z=Q.map((re,ke)=>[ke,re]).filter(re=>re[1]>30);const G=z.length-Math.abs(q);z=z.map((re,ke)=>{const he=G<=ke?re[1]+(q>0?1:-1):re[1];return[re[0],he]}),z.map(re=>(Q[re[0]]=re[1],re))}n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:ie.gap,gapMobile:ie.gapMobile,minWidth:30},editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:Q.map((z,G)=>({width:z,current:h.floatBlocks.items[G]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},le=ie=>{const Be=c.getFieldsValue(!0);let ae=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((he,Pe)=>{he===ie.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ae=Pe)});const oe=+h.floatBlocks.gap,me=+h.floatBlocks.items[ae].width+oe,de=h.floatBlocks.items.map(he=>+he.width),Q=(de.length-1)*oe,q=de.reduce((he,Pe)=>he+Pe,0)+Q,z=de.length-1,G=Math.floor(me/z);let re=de.filter((he,Pe)=>Pe!==ae).map(he=>he+G);const ke=q-(re.reduce((he,Pe)=>he+Pe,0)+(de.length-2)*oe);if(ke!==0){const he=re.length-Math.abs(ke);re=re.map((Pe,ye)=>he<=ye?Pe+(ke>0?1:-1):Pe)}n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:ae,gap:Be.gap},editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:re.map((he,Pe)=>({width:he,current:h.floatBlocks.items.filter((ye,V)=>V!==ae)[Pe].current}))},changeKey:"width"})},fe=ie=>{if(N>=8)return;const Be=c.getFieldsValue(!0);let ae=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((ye,V)=>{ye===ie.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ae=V)});const oe=parseFloat(Be.gap)||0,me=h.floatBlocks.items.map(ye=>+ye.width),de=me[ae],Q=me.reduce((ye,V)=>ye+V,0),q=Q-oe,z=Q+de,G=z>0?q/z:1;let re=[];const ke=[];me.forEach((ye,V)=>{re.push(Math.max(30,Math.round(ye*G))),ke.push(h.floatBlocks.items[V]?.current||!1),V===ae&&(re.push(Math.max(30,Math.round(de*G))),ke.push(!1))});const he=q-re.reduce((ye,V)=>ye+V,0);if(he!==0){let ye=re.map((ee,we)=>[we,ee]).filter(ee=>ee[1]>30);const V=ye.length-Math.abs(he);ye=ye.map((ee,we)=>[ee[0],V<=we?ee[1]+(he>0?1:-1):ee[1]]),ye.forEach(ee=>re[ee[0]]=ee[1])}n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:ae,gap:Be.gap,widths:re},editFromStructure:Kt()});const Pe=re.reduce((ye,V)=>ye+V,0);Y(re.map(ye=>(ye/Pe*100).toFixed(1))),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:re.map((ye,V)=>({width:ye,current:ke[V]||!1}))},changeKey:"width"})},Ae=(0,d.useCallback)(ie=>{const Be=".selected-element-panel__columns-settings__controls__column",ae=Array.from(document.querySelectorAll(Be)).indexOf(ie.target.closest(Be)),oe=ae-1;if(oe<0)return;const me=h.floatBlocks,de=me.items.map(({width:Q,current:q})=>({width:Q,current:q||!1}));[de[oe],de[ae]]=[de[ae],de[oe]],n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:oe,indexB:ae},editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...me,items:de},changeKey:"width"})},[h,F,i,n]),ce=ie=>{x(ie),n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!y}}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,wrap:!y},changeKey:"wrap"})},$e=ie=>{w(ie),n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!E}}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,dirRevert:!E},changeKey:"dir"})},Ce=()=>setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),300);return h.floatBlocks&&h.floatBlocks.items.length>0&&(0,t.jsx)(o.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:h.floatBlocks?.gap||0,gapDim:"px",gapMobile:h.floatBlocks?.gapMobile||0,valign:h.floatBlocks?.valign||"top",...h.floatBlocks?.items.reduce((ie,{width:Be},ae)=>(ie[`width-${ae}`]=Be,ie),{})},onValuesChange:se,onFieldsChange:Ce,className:"element-controls",children:(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:b.switchDesktopMobilePropsEnabled||b.stepToOtherElementEnabled||b.deleteButtonEnabled||h.type==="structure"?0:24},children:[h.floatBlocks.items.length===1&&(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:10},title:a('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"}),W!=="mobile"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__header",children:[(0,t.jsx)("span",{className:"selected-element-panel__columns-settings__header-title",children:a("Columns")}),(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__links",children:[(0,t.jsxs)("span",{className:"selected-element-panel__columns-settings__links__add",onClick:_e,children:[(0,t.jsx)(s.EmIcons,{icon:"PlusCircleOutlined",component:o.icons$PlusCircleOutlined,size:16,strokeWidth:b.iconStrokeWidth})," ",a("Add column")]}),h.floatBlocks.items.length>1&&(0,t.jsx)("span",{onClick:te,children:(0,t.jsxs)(o.ui_kit$Tooltip,{title:a("Make columns the same width."),children:[(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined})," ",a("Equalize")]})})]})]}),h.floatBlocks.items.length>1&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,t.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:h.floatBlocks.items.map((ie,Be)=>(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(ie.current?"current":""),style:{width:ie.width/v*100+"%"},children:[Be>0&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Swap columns"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:Ae,children:(0,t.jsx)(s.EmIcons,{icon:"SwapHorizontalIcon",component:o.icons$SwapHorizontalIcon,size:15,strokeWidth:b.iconStrokeWidth})})}),h.floatBlocks.items.length>1&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Delete column"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:le,children:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:15,strokeWidth:b.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),h.floatBlocks.items.length<8&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Copy column"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:fe,children:(0,t.jsx)(s.EmIcons,{icon:"CopyOutlined",component:o.icons$CopyOutlined,size:15,strokeWidth:b.iconStrokeWidth})})}),(0,t.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,t.jsx)(o.ui_kit$Form.Item,{label:"",name:"width-"+Be,children:(0,t.jsx)(o.ui_kit$InputNumber,{min:30,value:ie.width||0,placeholder:a("Width"),ref:I==="width-"+Be&&m})})})]},"floatblock-"+Be))})}),(0,t.jsxs)("div",{className:"columns-presets",children:[(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:1})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol1",component:o.icons$LayoutCol1})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:2})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol2",component:o.icons$LayoutCol2})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:2,width:[66,34]})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol2WideLeft",component:o.icons$LayoutCol2WideLeft})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:2,width:[34,66]})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol2WideRight",component:o.icons$LayoutCol2WideRight})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:3})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol3",component:o.icons$LayoutCol3})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:4})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol4",component:o.icons$LayoutCol4})})]})]}),h.floatBlocks.items.length>1&&(0,t.jsxs)(t.Fragment,{children:[W==="mobile"&&(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(o.ui_kit$Switch,{id:"column-wrap",label:a("Line break on mobile devices"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:y,onChange:ce,labelStyle:{position:"relative",top:2}})}),W!=="mobile"&&(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(o.ui_kit$Switch,{id:"column-dir-revers",label:a("Reverse order on desktop"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:E,onChange:$e,labelStyle:{position:"relative",top:2}})})]}),h.floatBlocks.items.length>1&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:a("Vertical alignment"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"valign",style:{marginBottom:0},children:(0,t.jsx)(o.ui_kit$FormVerticalAlignControl,{disabled:h.floatBlocks.items.length<=1,strokeWidth:b.iconStrokeWidth,labels:{alignTop:a("Align top"),alignMiddle:a("Center vertically"),alignBottom:a("Align bottom")}})})})}),(0,t.jsxs)(t.Fragment,{children:[W!=="mobile"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:a("Indent between columns"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:a("Indent between columns"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px",ref:I==="gap"&&m})})})}),W==="mobile"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:a("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:a("Indent in mobile"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};Xs.propTypes={selectedElement:g.default.shape({parent:g.default.string})};var Wd=()=>{},Ks=({email:e,formSettings:i={},onClosePanel:r=Wd})=>{const{__:a}=s.useI18n(),l=s.useRootElement(),n=s.useDispatch(),c=s.useSendPostMessage(),m=Object.prototype.hasOwnProperty.call(e,"type")?s.BLOCK:s.EMAIL,f=s.useSelector(s.selectElementSettings$1),_=s.useSelector(s.selectElementSettings),k=s.useSelector(s.selectPropertiesPanelKey),b=m==="email"?f:_,h=Object.keys(i).length>0?i.settings:b,y=i?.type==="advanced"&&!!i?.content,x=!!i?.extraTabs?.length,E=s.useAppConfig(),w=h.type==="customTable",I=!!h.type&&!!h.floatBlocks?.items.length>0&&!!h.floatBlocks?.items.filter(T=>!!T.width).length>0,A=(0,d.useRef)(null);(0,d.useEffect)(()=>{const T=Object.values(s.ELEMENT_TYPES),J=h.type&&T.includes(h.type)?`${h.type}-${JSON.stringify(h.path||[])}`:null;if(y||x){const Z=l.querySelector(".email-pane .panel-form__body");Z&&(Z.scrollTop=0),n(s.setPropertiesPanelKey(s.EDIT_SELECTED_ELEMENT))}else if(h.type&&T.includes(h.type)){const Z=A.current!==J;if(A.current=J,h.activateSection!=="structure"){if(Z){const se=l.querySelector(".email-pane .panel-form__body");se&&(se.scrollTop=0)}n(s.setPropertiesPanelKey(s.EDIT_SELECTED_ELEMENT))}else n(s.setPropertiesPanelKey(s.STRUCTURE))}else JSON.stringify(h)!=="{}"&&(A.current=null,n(s.setPropertiesPanelKey("")))},[h,n,l,y,x]);const v=(0,d.useMemo)(()=>{const T=[{key:s.EDIT_SELECTED_ELEMENT,label:(0,t.jsx)("span",{style:{textTransform:"capitalize"},children:h.caption?h.caption:a("Edit element")})}];return I&&T.push({key:s.STRUCTURE,label:a("Columns")}),T},[h.caption,I,a]),P=(0,d.useMemo)(()=>[{key:s.EDIT_SELECTED_ELEMENT,label:a("Cell")},{key:s.TABLE_PROPERTIES,label:a("Table")}],[a]),C=T=>{T.stopPropagation(),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),n(m==="email"?s.setElementSettings$1({}):s.setElementSettings({}))},Y=T=>{T.stopPropagation(),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},W=()=>{r(h),n(s.resetToLastActiveSettingsTab()),setTimeout(()=>{n(m==="block"?s.setElementSettings({type:null}):s.setElementSettings$1({type:null}))},300),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},F=(0,t.jsxs)(t.Fragment,{children:[E.deleteButtonEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Remove element by Delete Key"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:C,disabled:!h.deletable,icon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:E.iconStrokeWidth})})}),E.stepToOtherElementEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Up to parent element"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:Y,disabled:!h.parent,icon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"GoToParent",component:o.icons$GoToParent,size:18,strokeWidth:E.iconStrokeWidth})})})]}),N=E.switchDesktopMobilePropsEnabled||E.stepToOtherElementEnabled||E.deleteButtonEnabled;return(0,t.jsxs)(o.ui_kit$PanelForm,{children:[(0,t.jsx)(o.ui_kit$PanelForm.Header,{onClose:W,closeIcon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"Close",component:o.icons$Close,size:24,strokeWidth:E.iconStrokeWidth}),extra:N?F:void 0,children:(0,t.jsx)(o.ui_kit$Tabs,{items:w?P:v,activeKey:k,onChange:T=>n(s.setPropertiesPanelKey(T||""))})}),(0,t.jsx)(o.ui_kit$PanelForm.Body,{children:w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,t.jsx)(po,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${s.EDIT_SELECTED_TABLE_CELLS}`})}),(0,t.jsx)("div",{style:{display:k==="Table properties"?void 0:"none"},children:(0,t.jsx)(po,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${s.TABLE_PROPERTIES}`})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,t.jsx)(po,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m})}),I&&(0,t.jsx)("div",{style:{display:k==="Structure"?void 0:"none"},children:(0,t.jsx)(Xs,{selectedElement:h,emailElementType:m,isSelectedElement:!1})})]})})]})},zd=({taxonomy:e})=>{const{__:i,_x:r}=s.useI18n(),a=s.useDispatch(),[l]=o.ui_kit$Form.useForm(),n=(0,d.useRef)(null),c=s.useSelector(s.selectActiveModal$1)===s.MODALS.ADD_NEW_GROUP_MODAL,m=s.useNotification(),f=s.useProjectData(),_=(0,d.useCallback)(()=>{l.resetFields(),setTimeout(()=>n.current?.focus({cursor:"start"}),0)},[l]);(0,d.useEffect)(()=>{c&&_()},[c,_]);const k=()=>a(s.closeModal$1()),[b,h]=s.useAddTermMutation(),[y,x]=(0,d.useState)(!1),E=()=>{l.validateFields().then(({name:w})=>(x(!0),b({project:f,kind:"group",name:w}).then(I=>{if("error"in I){m.error(I);return}m.success({title:i("The group “")+I.data.name+r("” was successfully created.",e)}),k()}))).catch(w=>{}).finally(()=>x(!1))};return(0,t.jsx)(o.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:E,onCancel:k,className:"new-group-modal",footer:[(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"large",loading:h.isLoading||y,onClick:E,children:i("Create group")},"submit")],children:(0,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",name:"add_new_group_form",onFinish:E,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:i("Please enter the group name")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:h.isLoading,size:"large",placeholder:i("Enter the group name"),ref:n,style:{marginBottom:5}})})})})},Gd=({group:e,refetch:i})=>{const{__:r,_x:a}=s.useI18n(),l=s.useDispatch(),[n]=o.ui_kit$Form.useForm(),c=(0,d.useRef)(null),m=s.useSelector(s.selectActiveModal$1)===s.MODALS.EDIT_GROUP_NAME_MODAL,f=s.useNotification(),{id:_=null,name:k=""}=e,b=()=>l(s.closeModal$1()),[h,y]=s.useEditTermMutation();(0,d.useEffect)(()=>{m&&n.setFieldsValue({name:k})},[m,k,n]);const x=()=>{n.validateFields().then(({name:E})=>{h({kind:"group",id:_,name:E}).then(({data:w,error:I})=>{I?(f.error({error:I}),n.setFieldValue("name",E)):(i().then(({data:A})=>{if(A){const v=A[0]?.children?.find(P=>P.id===_)?.name;n.setFieldValue("name",v)}}),b(),f.success({title:r("The group “")+E+a("” was successfully changed to “","group")+w.name+r("”.")}))})})};return(0,t.jsx)(o.ui_kit$Modal,{title:r("Change group name"),open:m,onOk:x,onCancel:b,className:"new-group-name-modal",footer:[(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"large",loading:y.isLoading,onClick:x,children:r("Change name")},"submit")],children:(0,t.jsx)(o.ui_kit$Form,{form:n,layout:"vertical",name:"rename_group_form",onFinish:x,initialValues:{remember:!1,name:k},autoComplete:"off",style:{paddingTop:10},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:r("Please enter the group name")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:y.isLoading,size:"large",placeholder:r("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},Yd=({className:e,refetchProjectGroups:i,isLoading:r})=>{const{__:a,_x:l}=s.useI18n(),n=s.useDispatch(),c=s.useNotification(),{modal:m}=o.ui_kit$App.useApp(),{confirm:f}=m,{token:_}=(0,o.ui_kit$useToken)(),k=s.useSelector(s.selectProjectGroups),[b]=s.useDeleteTermMutation(),h=(A,v)=>{b({kind:"group",id:Number(A)}).unwrap().then(P=>{P?.deleted&&c.success({title:a("The group “")+v+l("” was successfully deleted.","recovery")})}).catch(P=>{c.error({error:P})})},y=(A,v)=>{f({mask:{closable:!0},centered:!0,title:l("Are you sure to delete “","group")+v+a("” group and all nested groups?"),icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:22,style:{color:o.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:a("Yes"),cancelText:a("No"),onOk:()=>h(String(A),v)})},x=(A,v)=>{n(s.openModal$1(s.MODALS.EDIT_GROUP_NAME_MODAL)),I({id:A,name:v})},E=A=>[{label:a("Rename"),key:"Rename",icon:(0,t.jsx)(s.EmIcons,{icon:"CopyOutlined",component:o.icons$CopyOutlined,size:16}),onClick:()=>x(A.id,A.name)},{label:a("Remove"),icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),key:"Remove",style:{color:"#ff4d4f"},onClick:()=>y(A.id,A.name)}],[w,I]=(0,d.useState)({id:null,name:""});return(0,t.jsxs)("div",{className:(0,Ve.default)("groups-management",{[e]:e}),children:[r?(0,t.jsx)(o.ui_kit$Skeleton,{active:!0}):(0,t.jsxs)(o.ui_kit$Row,{children:[!!k?.length&&k?.map((A,v)=>(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:`group_${A.id}`,style:{marginBottom:_.formItemMarginBottomMD},label:(0,t.jsxs)(o.ui_kit$Flex,{justify:"space-between",align:"center",style:{width:"100%"},children:[(0,t.jsx)("span",{children:A.name}),(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"groups-management__group_menu","data-group-id":A.id,size:"large",children:(0,t.jsx)(o.ui_kit$Dropdown,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:{items:E(A)},trigger:["hover"],children:(0,t.jsx)("span",{className:"groups-management__actions",children:(0,t.jsx)(s.EmIcons,{icon:"MoreOutlined",component:o.icons$MoreOutlined})})})})]}),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}],children:(0,t.jsx)(o.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:a("Type category here"),options:A.children?.map(P=>({label:P.name,value:String(P.id)})),tagRender:P=>{const{label:C,closable:Y,onClose:W}=P,F=N=>{N.preventDefault(),N.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:_.colorPrimary,onMouseDown:F,closable:Y,onClose:W,style:{borderRadius:6},children:C})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},A.id)),(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:_.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{id:"add_group_button",icon:(0,t.jsx)(s.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),style:{width:"100%"},onClick:()=>n(s.openModal$1(s.MODALS.ADD_NEW_GROUP_MODAL)),children:a("Add group")})})})]}),(0,t.jsx)(zd,{taxonomy:s.ELEMENT_TYPES.GROUP}),(0,t.jsx)(Gd,{group:w,refetch:i})]})},{title:Fi,description:ei,tags:ti,type:$i,is_template:Xd,group:Kd}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},qd={[Fi]:"",[ei]:"",[ti]:[],[Xd]:!1},Jd={[ei]:"",[ti]:[],[$i]:""};function Qd(e){const i=new Set;return e?.filter(r=>i.has(r.name)?!1:(i.add(r.name),!0))}var qs=({className:e="",element:i})=>{const{__:r}=s.useI18n();s.useEditorProjectId();const a=s.useDispatch(),l=s.useEmailAttributesWriter(),[n]=o.ui_kit$Form.useForm(),{token:c}=(0,o.ui_kit$useToken)(),m=s.useAppConfig(),f=s.useSelector(s.selectProjectGroups),{data:_}=s.useGetBlocksSchemaQuery(),k=s.useProjectData(),b=i.hasOwnProperty("type")?s.BLOCK:s.EMAIL,h=i.hasOwnProperty("type")?s.BLOCK_TAGS:s.EMAIL_TAGS,{data:y,refetch:x,isLoading:E,isFetching:w,isUninitialized:I,isSuccess:A}=s.useGetTermsQuery({project:k,kind:"group"},{skip:!k?.id});(0,d.useEffect)(()=>{y&&a(s.projectGroupsLoaded(y,b==="email"?i.group??[]:void 0))},[a,y,b,i.group]),(0,d.useEffect)(()=>{!I&&x()},[I,x]);const[v,P]=(0,d.useState)([]),[C,Y]=(0,d.useState)([]),[W,F]=(0,d.useState)(i.is_template||!1),N=s.useProjectData();(0,d.useEffect)(()=>{!I&&x()},[i.group,x,I]),(0,d.useEffect)(()=>{if(A&&i.is_template&&i.group.length){const se=i.group;let te={};se.length&&f.length&&se?.forEach(_e=>{f?.forEach(le=>{let fe=le.children.find(Ae=>Ae.id===_e);fe&&(te.hasOwnProperty(le.id)||(te[le.id]=[]),te[le.id].push({label:fe.name,value:fe.id}))})});let ne={};for(let _e in te)te.hasOwnProperty(+_e)&&(ne[`group_${_e}`]=te[_e].map(le=>({...le,value:String(le.value)})));n.setFieldsValue(ne)}},[n,f,i.is_template,i.group,A]);const{data:T}=s.useGetTermsQuery({project:N,kind:h},{skip:!N?.id});(0,d.useEffect)(()=>{Y(Qd(T)?.map(se=>({value:se.name,key:se.id})))},[T]),(0,d.useEffect)(()=>{if(i){const se=St.getTaxonomy(i,h)?.map(_e=>_e.name),te=i.emailtags||i.blocktags,ne=St.getTaxonomy(i,h)?.filter(_e=>te.includes(_e.id)).map(_e=>_e.name);n.setFieldsValue({title:i.title,description:i.description,tags:i.tags||ne||se,type:i.type})}},[n,i,h]);const J=se=>{const te=Object.keys(se)[0],ne=se,_e=te.split("_")[0];if(_e===Fi)l({title:ne[te]});else if(_e===ei)l({description:ne[te]});else if(_e===ti){const le=ne[te];l({tags:le?.map(fe=>fe.trim())})}else _e==="is"&&b==="email"&&l({is_template:ne[te]});switch(te.split("_")[0]){case Kd:a(s.setEmailGroups({[te.split("_")[1]]:se[te]}));break;case $i:a(s.blocksApi.util.updateQueryData("getBlock",i.id,le=>{Object.assign(le,{type:se[te]})}));break;default:return}};(0,d.useEffect)(()=>{if(_){const se=_.schema.properties.acf.properties.type.items.enum;let te=[];const ne={Applications:r("Apps"),Articles:r("Article"),Banners:r("Banners"),Buttons:r("Buttons"),"Call to Action":r("Call to Action"),Contacts:r("Contacts"),Content:r("Content"),"E-Commerce":r("E-Commerce"),Feature:r("Features"),Footer:r("Footers"),Header:r("Headers"),Lists:r("Lists"),Menu:r("Menus"),Other:r("Others"),Polls:r("Polls"),Promocodes:r("Promocodes"),Separators:r("Separators")};for(let _e in se)te.push({label:ne[se[_e]],value:se[_e]});P(te)}},[_,r]);const Z=se=>{F(se)};return(0,t.jsx)("div",{className:(0,Ve.default)("settings-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:n,layout:"vertical",name:"settings_panel_form",initialValues:b==="email"?{EmailInitialValues:qd}:Jd,onValuesChange:J,autoComplete:"off",children:[m.subjectEnabled&&b==="email"&&(0,t.jsx)(o.ui_kit$Form.Item,{label:r("Title"),name:Fi,tooltip:{title:r("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,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$TextArea,{placeholder:r("Type title here"),autoSize:{minRows:1}})}),m.descriptionEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:r("Description"),name:ei,tooltip:{title:r("Description is used in other sections of the service."),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$TextArea,{placeholder:r("Type your description here"),autoSize:{minRows:2}})}),m.tagsEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:r("Tags"),name:ti,tooltip:{title:r("Tags help you find the block in the list."),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:r("Please input tags!"),type:"array"}],children:(0,t.jsx)(o.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:r("Type your tags here"),options:C,tagRender:se=>{const{label:te,closable:ne,onClose:_e}=se,le=fe=>{fe.preventDefault(),fe.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:le,closable:ne,onClose:_e,style:{borderRadius:6},children:te})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),b==="email"&&m.isTemplateEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,t.jsx)(o.ui_kit$Tooltip,{title:i.isNew?r("Save email first."):r("Use this email as a template for creating future emails."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:W,children:(0,t.jsx)(o.ui_kit$Switch,{id:"setIsTemplate",label:r("Is a template"),size:"small",onChange:Z,disabled:i.isNew,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),W&&(0,t.jsx)(Yd,{element:i,refetchProjectGroups:x,isLoading:E||w}),b==="block"&&(0,t.jsx)(o.ui_kit$Form.Item,{name:$i,label:r("Type"),tooltip:{title:r("Select the block type to find any block on the list faster."),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:r("Please input type!")}],children:(0,t.jsx)(o.ui_kit$Select,{placeholder:r("Choose block type"),options:v,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};qs.propTypes={className:g.default.string,email:g.default.object};var{utm_source:Js,utm_medium:Qs,utm_campaign:Zs,utm_term:ea,utm_content:ta}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},Zd={[Js]:"",[Qs]:"",[Zs]:"",[ea]:"",[ta]:""},oa=({className:e="",email:i=void 0})=>{const{__:r}=s.useI18n(),a=s.useEmailAttributesWriter(),[l]=o.ui_kit$Form.useForm();(0,d.useEffect)(()=>{i&&l.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||""})},[l,i]);const n=c=>{const m=Object.keys(c)[0],f=c;a({utm_parameters:{...i?.utm_parameters,[m]:f[m]}})};return(0,t.jsx)("div",{className:(0,Ve.default)("settings-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:"settings_panel_form_utm",initialValues:Zd,onValuesChange:n,autoComplete:"off",children:[(0,t.jsx)(o.ui_kit$Alert,{title:r("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_source"),name:Js,tooltip:{title:r("Mandatory. Indicates the traffic source. Example: utm_source=google"),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("google")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_medium"),name:Qs,tooltip:{title:r("Identifies what type of link was used, such as cost per click or email. For example: utm_medium=cpc"),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("cpc")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_campaign"),name:Zs,tooltip:{title:r("Indicates a specific product promotion or a marketing campaign. Example: utm_campaign=spring_sale"),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("spring_sale")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_term"),name:ea,tooltip:{title:r("Identifies search terms. For example: utm_term=running+shoes"),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("running+shoes")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_content"),name:ta,tooltip:{title:r("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,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("textlink")})})]})})};oa.propTypes={className:g.default.string,email:g.default.object};var We={PRODUCT_CAROUSEL:"productCarousel",SINGLE_IMAGE_PREVIEW:"singleImagePreview",DEAL_ANNOTATION:"dealAnnotation",DEAL_CARD:"dealCard"},ia="emailmaker-gmail-annotations";function Mi(e){return/^[A-Za-z]{3}$/.test((e??"").trim())}function ec(e){return typeof e=="object"&&e!==null}function oi(e,i){const r=e[i];return typeof r=="string"?r:""}var tc=new Set(["PromotionCard","DiscountOffer","Organization"]);function ra(e){let i;try{i=JSON.parse(e)}catch{return!1}const r=Array.isArray(i)?i:[i];return r.length===0?!1:r.every(a=>typeof a=="object"&&a!==null&&tc.has(String(a["@type"])))}function oc(){let e=new Date().getTime(),i=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let a=Math.random()*16;return e>0?(a=(e+a)%16|0,e=Math.floor(e/16)):(a=(i+a)%16|0,i=Math.floor(i/16)),(r==="x"?a:a&3|8).toString(16)})}function ii(e){return e.annotationType||We.PRODUCT_CAROUSEL}function ho(e){return!!(e?.image||e?.url||e?.headline||e?.price||e?.priceCurrency||e?.discountValue)}function Di(e){return!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds}function ri(e){return typeof e=="string"&&e.trim().length>0}function Vi(e){return ri(e)?/^https?:\/\//i.test(e.trim()):!1}function sa(e){return ri(e?.image)&&Vi(e?.url)}function ic(e){switch(ii(e)){case We.SINGLE_IMAGE_PREVIEW:return sa(e.cards?.[0]);case We.DEAL_ANNOTATION:return!Di(e);case We.DEAL_CARD:return ri(e.description)&&(Vi(e.offerPageUrl)||Vi(e.merchantHomepageUrl));case We.PRODUCT_CAROUSEL:default:return!!e.cards?.some(sa)}}function rc(e){switch(ii(e)){case We.SINGLE_IMAGE_PREVIEW:return!ho(e.cards?.[0])&&!ri(e.discountCode);case We.DEAL_ANNOTATION:return Di(e);case We.DEAL_CARD:return Di(e)&&!e.offerPageUrl&&!e.merchantHomepageUrl;case We.PRODUCT_CAROUSEL:default:return!e.cards?.some(ho)}}function sc(e){switch(ii(e)){case We.DEAL_ANNOTATION:case We.DEAL_CARD:return!!(e.description||e.discountCode||e.availabilityStarts||e.availabilityEnds||e.offerPageUrl||e.merchantHomepageUrl);case We.SINGLE_IMAGE_PREVIEW:return ho(e.cards?.[0]);case We.PRODUCT_CAROUSEL:default:return e.logo?!0:!!e.cards?.some(ho)}}function ac(e){let i=typeof e.price=="string"||typeof e.price=="number"?String(e.price):"",r=typeof e.discountValue=="string"||typeof e.discountValue=="number"?String(e.discountValue):"";const a=typeof e.em_regularPrice=="string"||typeof e.em_regularPrice=="number"?String(e.em_regularPrice):"",l=typeof e.em_price=="string"||typeof e.em_price=="number"?String(e.em_price):"";if(!i&&a&&(i=a),!r&&i&&l){const n=parseFloat(i),c=parseFloat(l);!isNaN(n)&&!isNaN(c)&&n>=c&&(r=String(n-c))}return{id:oc(),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:r}}function aa(e,i){const r={"@context":"http://schema.org/","@type":"PromotionCard",image:e.image};if(e.url&&(r.url=e.url),e.headline&&(r.headline=e.headline),e.price&&(r.price=e.price),e.priceCurrency){const a=e.priceCurrency.trim();r.priceCurrency=Mi(a)?a.toUpperCase():a}return e.discountValue&&(r.discountValue=e.discountValue),i&&(r.position=i),r}function Ui(e){const i={"@context":"http://schema.org/","@type":"DiscountOffer"};for(const r of["description","discountCode","availabilityStarts","availabilityEnds","offerPageUrl","merchantHomepageUrl"]){const a=e[r];a&&(i[r]=a)}return i}function la(e){return{"@context":"http://schema.org/","@type":"Organization",logo:e}}function lc(e){const i=ii(e),r=[];if(i===We.DEAL_CARD)return[Ui(e)];if(i===We.DEAL_ANNOTATION){const a=[];return e.logo&&a.push(la(e.logo)),a.push(Ui(e)),a}if(e.logo&&r.push(la(e.logo)),i===We.SINGLE_IMAGE_PREVIEW){const a=e.cards?.[0];return e.discountCode?.trim()&&r.push(Ui(e)),a&&ho(a)&&r.push(aa(a)),r}return(e.cards||[]).filter(ho).forEach((a,l)=>{r.push(aa(a,l+1))}),r}function nc(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function dc(e){if(rc(e))return null;const i=nc(JSON.stringify(lc(e),null,2));return`<script type="application/ld+json" id="${ia}">
11
+ (function(){try{if(typeof document<"u"){var t='.blocks-app .upload-bg-image{margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px)}.blocks-app .upload-bg-image__inner-wrap{border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);border-radius:calc(var(--ub-borderRadius) * 1px);cursor:pointer;background-color:var(--ub-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(--ub-borderColorHover)}.blocks-app .upload-bg-image__uploader{width:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2 + 1) * 1px);height:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2) * 1px);border-radius:calc(var(--ub-borderRadius) * .8px);border:none;border-right:1px solid var(--ub-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(--ub-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(--ub-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(--ub-colorTextQuaternary)}.blocks-app .upload-bg-image__edit,.blocks-app .upload-bg-image__edit-menu{color:var(--ub-colorLink);right:calc((var(--ub-borderWidth) + 2) * 1px);padding:6px;line-height:1;position:absolute}.blocks-app .upload-bg-image__edit{right:calc((var(--ub-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(--ub-colorFillSecondary);border-radius:calc(var(--ub-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(--ub-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(--ub-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(--ub-colorBgContainer) 60%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);box-shadow:28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent), -28px 0 0 0 color-mix(in srgb, var(--ub-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(--ub-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(--ub-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;align-items:flex-start;gap:10px;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(--ub-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(--ub-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active:hover{background:var(--ub-colorPrimaryBgHover)!important;color:var(--ub-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(--ub-colorFillSecondaryDarken);width:34px;height:34px;top:0;left:0}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper{background:var(--ub-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(--ub-colorFillSecondaryDarken)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .selected_text_common_form_mobile .codemode-textalign-dropdown{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadius) * 1px);box-shadow:var(--ub-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(--ub-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(--ub-colorTextSecondary);background-color:var(--ub-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(--ub-colorError)}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-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(--ub-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(--ub-colorFillQuaternary);border-radius:calc(var(--ub-borderRadius) * 1px);margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px);border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-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(--ub-colorBorderSecondary,#f0f0f0);margin-top:16px;padding-top:16px}.blocks-app .selected-social-form .selected-social-form__section-title{color:var(--ub-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(--ub-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(--ub-colorBorderSecondary,#f0f0f0);background:var(--ub-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(--ub-colorPrimary);box-shadow:0 0 0 1px var(--ub-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(--ub-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(--ub-colorText,#000000e0);background:var(--ub-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(--ub-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(--ub-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(--ub-colorText,#000000e0);background:var(--ub-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(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-title{min-width:0;color:var(--ub-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(--ub-formControlHeight) * 1px);min-width:calc(var(--ub-formControlHeight) * 1px);max-width:calc(var(--ub-formControlHeight) * 1px);height:calc(var(--ub-formControlHeight) * 1px);min-height:calc(var(--ub-formControlHeight) * 1px);max-height:calc(var(--ub-formControlHeight) * 1px);line-height:calc((var(--ub-formControlHeight) - 2) * 1px);color:var(--ub-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(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:focus-visible{outline:2px solid var(--ub-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(--ub-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(--ub-colorFillTertiary,#f8f8f8);height:32px;color:var(--ub-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(--ub-colorFillSecondary,#f0f0f0);color:var(--ub-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(--ub-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(--ub-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(--ub-boxShadowSecondary);border-radius:calc(var(--ub-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(--ub-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(--ub-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(--ub-colorBorder);z-index:100;background-color:var(--ub-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(--ub-colorPrimary)}.blocks-app .selected-element-panel__mobile-switch.ant-switch-checked{background-color:var(--ub-colorInfo)}.blocks-app #selected_element_form_desktop_props .ant-alert-info .ant-alert-title{color:var(--ub-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{--ub-colorPrimaryBorder:var(--ub-colorInfo);--ub-controlOutline:var(--ub-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(--ub-colorInfo);box-shadow:0 0 0 calc(var(--ub-controlOutlineWidth) * 1px) var(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-btn-background-ghost.ant-btn-primary{color:var(--ub-colorInfo);border-color:var(--ub-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(--ub-colorInfoBg)!important;color:var(--ub-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(--ub-colorInfoTextActive)}.blocks-app .ant-app .selected_form-mobile-props .ant-switch.ant-switch-checked:hover:not(.ant-switch-disabled){background-color:var(--ub-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(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info{background-color:var(--ub-colorInfoBg);border:none}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info .ant-alert-title{color:var(--ub-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(--ub-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(--ub-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(--ub-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(--ub-colorTextSecondary,#8c8c8c);margin-top:16px;font-size:12px;font-weight:300;line-height:1.4}.blocks-app .annotations-panel__section-hint{color:var(--ub-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(--ub-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(--ub-colorInfo)}.blocks-app .ant-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-user{background:var(--ub-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 .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(--ub-colorBorderSecondary);background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -25px}.blocks-app .optimise.ant-collapse>.ant-collapse-item{border-bottom:1px solid var(--ub-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(--ub-colorSuccessText)}.blocks-app .optimise .error{white-space:nowrap;color:var(--ub-colorErrorText)}.blocks-app .optimise .warning{white-space:nowrap;color:var(--ub-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(--ub-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(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-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(--ub-borderRadius) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-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(--ub-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(--ub-colorWarningText)}.blocks-app .optimise .errors{color:var(--ub-colorErrorText)}.blocks-app .optimise .valid{color:var(--ub-colorSuccessText)}.blocks-app .optimise__button.warnings{border-color:var(--ub-colorWarningBorder);background:var(--ub-colorWarningBg)}.blocks-app .optimise__button.warnings:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorWarningBorderHover);color:var(--ub-colorWarningTextHover);background:var(--ub-colorWarningBgHover)}.blocks-app .optimise__button.warnings_active{color:#fff;background-color:var(--ub-colorWarningActive);border-color:var(--ub-colorWarningActive)}.blocks-app .optimise__button.errors{border-color:var(--ub-colorErrorBorder);background:var(--ub-colorErrorBg)}.blocks-app .optimise__button.errors:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorErrorBorderHover);color:var(--ub-colorErrorTextHover);background:var(--ub-colorErrorBgHover)}.blocks-app .optimise__button.errors_active{color:#fff;background-color:var(--ub-colorErrorActive);border-color:var(--ub-colorErrorActive)}.blocks-app .optimise__button.valid{border-color:var(--ub-colorSuccessBorder);background:var(--ub-colorSuccessBg)}.blocks-app .optimise__button.valid:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorSuccessBorderHover);color:var(--ub-colorSuccessTextHover);background:var(--ub-colorSuccessBgHover)}.blocks-app .optimise__button.valid_active{color:#fff;background-color:var(--ub-colorSuccessActive);border-color:var(--ub-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(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-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(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-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(--ub-colorTextSecondary);text-align:left;margin-bottom:12px;line-height:1.2;list-style:none}.blocks-app .blocks-search__type-wrapper li.active{color:var(--ub-colorLink)}.blocks-app .blocks-search__type-wrapper li:hover{color:var(--ub-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(--ub-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(--ub-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(--ub-colorBgElevated);border:1px solid var(--ub-colorBorder);border-radius:calc(var(--ub-borderRadiusSM) * 1px);text-align:center;cursor:grab;background-color:var(--ub-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(--ub-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(--ub-controlTmpOutline)}.blocks-app .blocks-search .em-ghost-element{border-radius:calc(var(--ub-borderRadiusXL) * 1px);overflow:hidden;background-color:var(--ub-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(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-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(--ub-colorTextSecondary);padding:8px 15px;font-size:14px}.blocks-app .block-search__preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-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(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-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(--ub-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(--ub-colorFillQuaternary)}.blocks-app .history-panel__list .ant-btn.ant-btn-sm{border:none;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(--ub-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.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),o=t;if(!e.sheets[o]){var p=!1;try{if(typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&document.adoptedStyleSheets){var l=new CSSStyleSheet;l.replaceSync(t),document.adoptedStyleSheets=document.adoptedStyleSheets.concat([l]),e.sheets[o]=l,e.order.push(o),p=!0}}catch{p=!1}if(!p){var a=document.createElement("style");a.setAttribute("data-useblocks","true"),a.appendChild(document.createTextNode(t)),document.head.appendChild(a),e.sheets[o]=a,e.order.push(o)}}}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
12
+ __useblocks__.define("static/core/3df10afa.js",["require","exports","module","static/core/2ff39ddf.js","static/core/ca13058e.js","static/core/b2b19022.js","static/core/f72a1b7d.js","static/core/4d23db03.js","static/core/b6d27bcf.js","static/core/e02ef34c.js","static/core/4cda85e3.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(bt,nt,mp){const it=bt("./2ff39ddf.js"),De=bt("./ca13058e.js"),s=bt("./b2b19022.js"),St=bt("./f72a1b7d.js"),hi=bt("./4d23db03.js"),Kl=bt("./b6d27bcf.js"),H=bt("./e02ef34c.js"),yt=bt("./4cda85e3.js");let d=bt("react");d=it.__toESM(d);let t=bt("react/jsx-runtime"),o=bt("__delivery__/libs"),ql=bt("react-dom"),Do=bt("vite/preload-helper"),Ve=bt("classnames");Ve=it.__toESM(Ve);let $t=bt("dayjs");$t=it.__toESM($t);var g=it.__toESM(s.require_prop_types());async function vr(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,r)=>{const a=URL.createObjectURL(e),l=new Image;l.onload=()=>{URL.revokeObjectURL(a);const n=l.naturalWidth||l.width,c=l.naturalHeight||l.height;n>0&&c>0?i({width:n,height:c}):r(new Error("Could not read image dimensions"))},l.onerror=()=>{URL.revokeObjectURL(a),r(new Error("Could not decode image"))},l.src=a})}function ko(e){return e.trim()}var Jl=67108864,Ql=2e3;function Vo(e){e.abandonTimer!==void 0&&(clearTimeout(e.abandonTimer),e.abandonTimer=void 0)}function Ir(e,i){return i?new Promise((r,a)=>{if(i.aborted){a(new DOMException("Aborted","AbortError"));return}const l=()=>{a(new DOMException("Aborted","AbortError"))};i.addEventListener("abort",l,{once:!0}),e.then(n=>{i.removeEventListener("abort",l),r(n)},n=>{i.removeEventListener("abort",l),a(n)})}):e}function Zl(e={}){const i=e.maxCacheBytes??Jl,r=e.abandonDelayMs??Ql,a=new Map,l=new Map;let n=0;function c(x){const E=a.get(x);E&&(n-=E.size,a.delete(x))}function m(x,E){if(c(x),!(E.size>i)){a.set(x,E),n+=E.size;for(const w of a.keys()){if(n<=i)break;c(w)}}}function f(x){const E=l.get(x);E&&(Vo(E),l.delete(x))}function _(x,E){E.waiters-=1,!(E.waiters>0||E.abandonTimer!==void 0||l.get(x)!==E)&&(E.abandonTimer=setTimeout(()=>{E.abandonTimer=void 0,!(l.get(x)!==E||E.waiters>0)&&(l.delete(x),E.controller.abort())},r))}function k(x,E,w){return E.waiters+=1,Vo(E),w.then(()=>_(x,E),()=>_(x,E)),w}async function b(x,E,w){const I=ko(x);if(!I)throw new Error("Empty image URL");const A=a.get(I);if(A){if(E?.aborted)throw new DOMException("Aborted","AbortError");return a.delete(I),a.set(I,A),A}const v=l.get(I);if(v)return k(I,v,Ir(v.promise,E));const P=new AbortController,C={promise:w(I,P.signal).then(Y=>(f(I),m(I,Y),Y)).catch(Y=>{throw f(I),Y}),controller:P,waiters:0,abandonTimer:void 0};return l.set(I,C),k(I,C,Ir(C.promise,E))}function h(x){const E=ko(x);if(!E)return;const w=l.get(E);w&&(Vo(w),w.controller.abort(),l.delete(E)),c(E)}function y(){for(const[,x]of l)Vo(x),x.controller.abort();l.clear(),a.clear(),n=0}return{resolve:b,abandonKey:h,invalidateAll:y}}async function Cr(e,i){if(!e||typeof e.findFileByUrl!="function")return null;const r=await e.findFileByUrl(i);if(!r)return null;const a=typeof e.getFileById=="function"&&r.id&&await e.getFileById(r.id)||r,l=a.url||i,n=a.thumbnailUrl||a.thumbnail||l||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(a):"")||"";return n?{file:a,previewUrl:n}:null}var bi="em_version";function kt(e){if(!e||!e.includes("em_version"))return e;try{const i=typeof document<"u"?document.baseURI:"http://localhost/",r=new URL(e,i);return r.searchParams.has("em_version")?(r.searchParams.delete(bi),/^https?:\/\//i.test(e)||e.startsWith("//")?r.href:r.pathname+r.search+r.hash):e}catch{return e}}function en(e){try{const i=typeof document<"u"?document.baseURI:"http://localhost/",r=new URL(e,i);return r.searchParams.set(bi,String(Date.now())),/^https?:\/\//i.test(e)||e.startsWith("//")?r.href:r.pathname+r.search+r.hash}catch{return`${e}${e.includes("?")?"&":"?"}${bi}=${Date.now()}`}}function Uo(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 tn(e){if(!(e instanceof Blob)||e.size===0)throw new yt.e("Failed to download file from the URL.","UploadUrlDownloadFailed");const i=e.type?.split(";")[0]?.trim()||"image/png";if(!i.startsWith("image/"))throw new yt.e("Content type at the URL is not allowed.","UploadUrlContentTypeNotAllowed");return{blob:e,mimeType:i}}async function on(e,i){const r=await fetch(e,i);if(!r.ok)throw new Error(`Server returned ${r.status}`);return r.blob()}async function rn(e,i,r){const a=r?{signal:r}:void 0,{blob:l}=await yt.ie(e,{handleFileProxy:async n=>{const c=await i.fireFileProxy(n);return s.pickFileProxyBlobFromFireResults(c)??null},handleProxyUrl:async n=>{const c=await i.fireProxyUrl(n);return s.pickProxyUrlOverrideFromFireResults(c,n)},fetchWithProxy:(n,c,m)=>De.fetchWithResourceProxy(n,{config:i.appConfig,standalone:i.isStandalone,intent:m?.intent||"downloadBlob",validateBlob:async f=>!f.type||f.type.startsWith("image/"),init:c})},n=>on(n,a),tn,{fetchInit:a});return l}function Pr(){const e=s.useAppConfig(),i=s.useIsStandalone(),r=s.useProjectData(),a=s.useEditorProjectId(),l=r?.id!==void 0?String(r.id):a||"",n=s.useEventEmitter(De.events.FILE_PROXY_EVENT_ID),c=s.useEventEmitter(De.events.PROXY_URL_EVENT_ID);return(0,d.useCallback)(async(m,f)=>rn(m,{appConfig:e,isStandalone:i,fireFileProxy:_=>n.fire({url:_,project:l}),fireProxyUrl:_=>c.fire({url:_,project:l})},f),[e,l,i,n,c])}function sn(e){return De.getContainer(e).getOrCreateInstance(De.IMAGE_BLOB_RESOLVER_ID,()=>Zl())}function Ar(){const e=s.useStore();return(0,d.useMemo)(()=>sn(e),[e])}var ft=class Xl extends Error{code;status;details;get httpStatus(){return this.status}constructor(i,r,a,l){super(i),this.name="FileManagerApiError",this.code=r,this.status=a,this.details=l,Error.captureStackTrace&&Error.captureStackTrace(this,Xl)}},an="Edited",ln=1e4;function Ho(e,i="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 409:return"FolderAlreadyExists";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return i}}var Nr={file_too_large:"FileTooLarge",file_size_exceeded:"FileTooLarge",file_size_limit:"FileTooLarge",invalid_file_name:"FileInvalidName",file_name_invalid:"FileInvalidName",invalid_name:"FileInvalidName",invalid_folder_name:"FolderInvalidName",folder_name_invalid:"FolderInvalidName",folder_invalid_name:"FolderInvalidName",file_type_not_allowed:"FileTypeNotAllowed",unsupported_type:"FileTypeNotAllowed",invalid_format:"FileTypeNotAllowed",batch_limit_exceeded:"BatchItemLimitExceeded",exceeded_max_files:"BatchItemLimitExceeded",file_count_exceeded:"BatchItemLimitExceeded",upload_limit_exceeded:"BatchItemLimitExceeded",too_many_files:"BatchItemLimitExceeded"};function nn(e){if(typeof e=="string")return e;if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&"400x400"in e){const i=e["400x400"];return typeof i=="string"?i:void 0}}function dn(e){const i=e.is_folder;if(i===!0||i===1)return!0;if(i===!1||i===0)return!1;if(typeof i=="string"){const a=i.trim().toLowerCase();if(a==="true"||a==="1"||a==="yes")return!0;if(a==="false"||a==="0"||a==="no"||a==="")return!1}if(String(e.item_type??"").toLowerCase()==="folder")return!0;const r=String(e.type??"").toLowerCase();return!!(r==="folder"||r==="directory"||r==="dir"||r==="inode/directory"||r==="application/x-directory"||r==="httpd/unix-directory"||r.endsWith("/directory"))}function Eo(e){if(!e)return["",""];const i=e.replaceAll("\\","/").split("/").filter(Boolean),r=i.pop()||"";return[i.join("/"),r]}function cn(e,i){if(!e)return"";const r=new RegExp(`^/?${i}/?`);return e.replace(r,"")}function un(e){return new Promise((i,r)=>{const a=new FileReader;a.onload=()=>{const l=a.result.toString().split(",")[1];i(l)},a.onerror=r,a.readAsDataURL(e)})}var mn=class{_api;_projectId;i18n;pathPostfix;appConfig;isStandalone;pathMode=!0;rootId="";trashPath="trash";tempPath=an;constructor(e){this._api=e.restApi,this._projectId=e.projectId,this.i18n=e.i18n||s.defaultI18nContext,this.pathPostfix=e.pathPostfix,this.appConfig=e.appConfig,this.isStandalone=!!e.isStandalone}removePrefix(e){let i=cn(e,this._projectId);if(this.pathPostfix){const r=new RegExp(`^/?${this.pathPostfix}/?`);i=i.replace(r,"")}return i}handleError(e,i){const{__:r}=this.i18n;if(e instanceof Error)throw e instanceof ft?e:new ft(e.message,i||"BackendError");const a=e.data,l=a?.message||r("Unknown error"),n=a?.data?.status??a?.status,c=a?.code,m=i||(c?Nr[c]:void 0)||(typeof n=="number"?Ho(n):void 0)||"BackendError";throw new ft(l,m,n)}convertRestError(e,i){const{__:r}=this.i18n;if(e instanceof ft||e instanceof Error)return e;if(e&&typeof e=="object"&&"data"in e&&!(e instanceof Error)){const a=e.data,l=a?.message||r("Unknown error"),n=a?.data?.status??a?.status,c=a?.code;return{message:l,code:i||(c?Nr[c]:void 0)||(n?Ho(n):void 0)||"BackendError",status:n,raw:e}}return e??{message:r("Unknown error")}}async getFolders({parentId:e}){const i=await this._api.folders_list({project_id:this._projectId,path_folder:e,per_page:ln},{type:De.ContentType.Json});if(i.error){if(this.isPathFolderNotFound(i.error))return[];this.handleError(i.error)}return await i.data.folders.map(r=>({id:this.removePrefix(r.full_path),name:r.name,folderId:this.removePrefix(r.parent_folder),childrenCount:r.files_count+r.folders_count,isFolder:!0}))}async getItems(e){if(e.limit===void 0&&(e.limit=Number.MAX_SAFE_INTEGER),e.itemType==="folder")return{items:await this.getFolders({parentId:e.folderId})};let i;try{i=await this._api.files_list({project_id:this._projectId,path_folder:e.folderId,filter_name:e.search,sort_by:e.sortBy,sort_order:e.sortOrder,per_page:e.limit,page:e.page})}catch(c){if(this.isPathFolderNotFound(c)||c?.status===404)return{items:[],pagination:{limit:e.limit,page:1,total:0,totalPages:0}};throw c}const r=i,a=!r.ok&&r.status===404||this.isPathFolderNotFound(i.error);if(i.error||!r.ok){if(a)return{items:[],pagination:{limit:e.limit,page:1,total:0,totalPages:0}};i.error&&this.handleError(i.error)}const l=i.data;let n=(l?.files||[]).map(c=>{const m=c.thumbnail,f=dn(c);return{...c,id:`${this.removePrefix(c.folder)}/${c.name}`,size:Number(c.size),date:c.date||new Date().toISOString(),folderId:this.removePrefix(c.folder),selected:!1,isFolder:f,thumbnail:nn(m)}});return l.total===Number.MAX_SAFE_INTEGER&&(l.total=n.length),e.itemType==="file"&&(n=n.filter(c=>!c.isFolder)),{items:n,pagination:{limit:l.per_page,page:l.page,total:l.total,totalPages:l.total_pages}}}async getFile(e){const i=await De.fetchWithResourceProxy(De.buildCdnFileUrl(this.appConfig,[this._projectId,e]),{config:this.appConfig,standalone:this.isStandalone,resourceType:"cdn",intent:"downloadBlob"});if(i.ok)return i.blob();{const r=await i.text(),a=Ho(i.status,"FileReadError"),{__:l}=this.i18n,n=r||l("Failed to get file: %s").replace("%s",i.statusText);throw new ft(n,a,i.status)}}getFileData=async(e,i)=>{const r=e.url||(typeof this.getUrl=="function"?this.getUrl(e):""),a=await De.fetchWithResourceProxy(r,{config:this.appConfig,standalone:this.isStandalone,resourceType:De.isCdnUrl(r,this.appConfig)?"cdn":"generic",intent:"downloadBlob",init:i?.forceReload?{cache:"no-store"}:void 0});if(a.ok)return a.blob();const l=await a.text(),n=Ho(a.status,"FileReadError"),{__:c}=this.i18n,m=l||c("Failed to get file: %s").replace("%s",a.statusText);throw new ft(m,n,a.status)};isPathFolderNotFound(e){if(!e||typeof e!="object"||e instanceof Error)return!1;const i=e;return i.code==="path_folder_not_found"||i.data?.code==="path_folder_not_found"||i.data?.data?.status===404}async deleteItem(e,i){if(e.isFolder){const r=await this._api.folders_delete({path_folder:e.id,project_id:this._projectId,force:i.permanent},{type:De.ContentType.Json});if(r.error){if(this.isPathFolderNotFound(r.error)){await this.clearCache(e.folderId??void 0);return}this.handleError(r.error,"FolderNotFound")}await this.clearCache(e.folderId??void 0)}else{const r=await this._api.files_delete({project_id:this._projectId,path_folder:e.folderId??"",file_name:[e.name],force:i.permanent},{type:De.ContentType.Json});r.error&&this.handleError(r.error,"FileNotFound")}}async deleteItems(e,i){try{if(e.length===0)return{success:!0};const r=e.filter(l=>l.isFolder),a=e.filter(l=>!l.isFolder);if(r.length>0){const l=new Set(r.map(m=>m.id)),n=r.filter(m=>{const f=m.folderId??"";return!l.has(f)}).map(m=>m.id),c=await this._api.folders_delete({project_id:this._projectId,path_folder:n.length===1?n[0]:n,force:i.permanent},{type:De.ContentType.Json});if(c.error&&!this.isPathFolderNotFound(c.error))return{success:!1,error:this.convertRestError(c.error)};for(const m of r)try{await this.clearCache(m.folderId??void 0)}catch{}}if(a.length>0){const l=new Map;for(const n of a){const c=n.folderId??"";l.has(c)||l.set(c,[]),l.get(c).push(n)}for(const[n,c]of l){const m=await this._api.files_delete({project_id:this._projectId,path_folder:n,file_name:c.map(f=>f.name),force:i.permanent},{type:De.ContentType.Json});if(m.error)return{success:!1,error:this.convertRestError(m.error)}}}return{success:!0}}catch(r){return{success:!1,error:r}}}async createFolder(e,i,r){const{__:a}=this.i18n;if(!e)throw new ft(a("Folder name is required"),"FolderInvalidName");const l=await this._api.folders_create({name:e,project_id:this._projectId,path_folder:i,is_force_create:r},{type:De.ContentType.Json});return l.error&&this.handleError(l.error),{id:this.removePrefix(l.data.full_path),name:l.data.name,folderId:this.removePrefix(l.data.parent_folder),childrenCount:l.data.files_count|l.data.folders_count,isFolder:!0}}async _uploadFile(e){const{__:i}=this.i18n;if(!e.name||!e.data)throw new ft(i("Invalid file data"),"ValidationError");const r=await this._api.files_create({file:e.data instanceof File?e.data:new File([e.data],e.name,{type:e.type}),path_folder:e.folderId,project_id:this._projectId},{type:De.ContentType.FormData});r.error&&this.handleError(r.error);const a=r.data instanceof Array?r.data[0]:r.data;if(!a)throw new ft(i("File upload failed"),"ValidationError");return{...a,id:this.removePrefix(a.folder)+"/"+a.name,size:Number(a.size),folderId:this.removePrefix(a.folder),date:a.date||new Date().toISOString(),selected:!1,isFolder:!1,thumbnail:a.thumbnail?.["400x400"]}}async uploadFiles(e){try{const i=e.items.map(a=>{if(a.data instanceof File)return a.data;const l=a.name||"file",n=a.data.type||a.type||"application/octet-stream";return new File([a.data],l,{type:n})}),r=await this._api.files_create({project_id:this._projectId,path_folder:e.folderId,file:i},{type:De.ContentType.FormData});return r.error?{success:!1,error:this.convertRestError(r.error)}:{success:!0,detailed:(Array.isArray(r.data)?r.data:[r.data]).map(a=>({success:!0,data:{id:[this.removePrefix(a.folder),a.name].filter(Boolean).join("/"),name:a.name,size:Number(a.size),folderId:this.removePrefix(a.folder),type:a.type,date:a.date||new Date().toISOString(),selected:!1,isFolder:!1,thumbnail:a.thumbnail?.["400x400"]}}))}}catch(i){return{success:!1,error:i}}}async renameItem(e,i){const{__:r}=this.i18n;if(!i){const m=e.isFolder?"FolderInvalidName":"FileInvalidName",f=e.isFolder?r("New folder name is required"):r("New file name is required");throw new ft(f,m)}const[a,l]=Eo(e.id),n=await this._api.files_rename_partial_update({file_name:l,new_name:i,path_folder:a,project_id:this._projectId,is_folder:e.isFolder},{type:De.ContentType.Json});n.error&&this.handleError(n.error);const c=n.data;return{id:this.removePrefix(c.folder)+"/"+c.name,name:c.name,folderId:this.removePrefix(c.folder)}}async moveItems(e,i){try{const r=e.map(l=>Eo(l.id)),a=await this._api.items_move_partial_update({file_name:r.map(l=>l[1]),target_folder:i,path_folder:r[0][0],project_id:this._projectId},{type:De.ContentType.Json});return a.error?{success:!1,error:this.convertRestError(a.error)}:{success:!0,detailed:a.data.results.map(l=>({success:l.success,error:this.convertRestError(l.error),data:{id:[this.removePrefix(l.new_path||""),l.item_name].filter(n=>n).join("/")}}))}}catch(r){return this.convertRestError(r),{success:!1,error:r}}}async copyItem(e,i){const[r,a]=Eo(e.id),l=await this._api.items_move_partial_update({file_name:a,target_folder:i,path_folder:r,project_id:this._projectId,is_copy:!0},{type:De.ContentType.Json});return l.error&&this.handleError(l.error),{id:[i,a].filter(n=>n).join("/")}}async copyItems(e,i){try{const r=e.map(l=>Eo(l.id)),a=await this._api.items_move_partial_update({file_name:r.map(l=>l[1]),target_folder:i,path_folder:r[0][0],project_id:this._projectId,is_copy:!0},{type:De.ContentType.Json});return a.error?{success:!1,error:this.convertRestError(a.error)}:{success:!0,detailed:a.data.results.map((l,n)=>({success:l.success,error:this.convertRestError(l.error),requestId:e[n].id,data:{id:[this.removePrefix(l.new_path||""),l.item_name].filter(c=>c).join("/")}}))}}catch(r){return{success:!1,error:this.convertRestError(r)}}}async uploadFileByUrl(e,i,r){const a=s.toAbsoluteUrl(e);try{if(a.startsWith("http://localhost")||a.startsWith("https://localhost")||this.appConfig?.resourceProxy||this.isStandalone){const c=await(await De.fetchWithResourceProxy(a,{config:this.appConfig,standalone:this.isStandalone,resourceType:r?.eventSource==="imageStock"?"stockImages":"generic",intent:"downloadBlob"})).blob();return this._uploadFile({name:a.split("/").pop()||"file",size:c.size,folderId:i,data:c,type:await s.getMimeType(a)||"application/octet-stream"})}const l=await this._api.files_upload_by_url_create({url:a,path_folder:i,project_id:this._projectId},{type:De.ContentType.Json});l.error&&this.handleError(l.error);const n=l.data instanceof Array?l.data[0]:l.data;return{id:`${this.removePrefix(n.folder)}/${n.name}`,name:n.name,size:Number(n.size),type:n.type,folderId:this.removePrefix(n.folder)||null,date:n.date||new Date().toISOString(),url:n.url}}catch(l){throw l}}async updateFile(e,i){const[r,a]=Eo(e.id),l=await this._api.files_partial_update({file_name:a,project_id:this._projectId,path_folder:r,updates:{data:typeof i.data=="string"?i.data:await un(i.data),name:i.name}},{type:De.ContentType.Json});if(l.error)this.handleError(l.error);else{const n=l.data;return{...n,id:`${this.removePrefix(n.folder)}/${n.name}`,size:Number(n.size),folderId:this.removePrefix(n.folder),date:n.date||new Date().toISOString(),thumbnail:n.thumbnail?.["400x400"],selected:!1}}}findFileByUrl(e,i){const r=De.unwrapResourceProxyUrl(e,this.appConfig),a=De.buildCdnFileUrl(this.appConfig,[]);if(a&&s.normalizeUrl(r).startsWith(s.normalizeUrl(a))){const l=r.replace(s.normalizeUrl(a)+"/","").split("/").filter(Boolean);if(l[0]===this._projectId){const n=this.removePrefix(l.slice(1,-1).join("/")),c=l[l.length-1];if(!i||n===this.removePrefix(i))return{id:[n,c].filter(Boolean).join("/"),name:c,folderId:n,isFolder:!1,url:r}}}}async clearCache(e){const i={project_id:this._projectId,path_folder:e||void 0},r=await this._api.cache_clear_create(i);r.error&&this.handleError(r.error)}getUrl=e=>De.buildCdnFileUrl(this.appConfig,[this._projectId,this.pathPostfix,e.folderId,e.name]);getThumbnailUrl=e=>{const i=e.name.lastIndexOf("."),r=i>0?e.name.slice(0,i):e.name,a=i>0?e.name.slice(i+1):"";return De.buildCdnFileUrl(this.appConfig,[this._projectId,this.pathPostfix,".thumbs",e.folderId,r,r+"-400x400."+a])};async cleanTrash(){try{const e=await this._api.empty_trash_create({project_id:this._projectId},{type:De.ContentType.UrlEncoded});e.error&&this.handleError(e.error,"BackendError");const i=e.data;return{success:i?.success??!0,deletedCount:i?.deleted_count??0}}catch(e){if(e instanceof ft)throw e;const{__:i}=this.i18n;throw new ft(i("Failed to clean trash"),"BackendError")}}};function Lr(e){return e.replace(/\/+$/,"")}function pn(e,i){const r=Lr(De.buildCdnFileUrl(i??{},[])),a=Lr(e);if(!(!r||!a.startsWith(`${r}/`)))return a.slice(r.length+1).split("/").filter(Boolean)[0]}function hn(e,i={}){const r=i.projectId?.trim();if(!r)return!1;const a=De.unwrapResourceProxyUrl(e,i.appConfig,i.isStandalone);return De.isCdnUrl(a,i.appConfig)?pn(a,i.appConfig)===r:!1}function bn(e,i={}){return De.unwrapResourceProxyUrl(e,i.appConfig,i.isStandalone)}var Or={"platform.validation":"ValidationError","platform.malformed_body":"ValidationError","platform.invalid_uuid":"ValidationError","platform.invalid_field_value":"ValidationError","platform.unauthorized":"AuthenticationFailed","platform.forbidden":"AuthorizationFailed","platform.not_found":"FileNotFound","platform.conflict":"FolderAlreadyExists","platform.payload_too_large":"PayloadTooLarge","platform.unsupported_media_type":"FileTypeNotAllowed","platform.too_many_requests":"RateLimitExceeded","platform.unavailable":"ServiceUnavailable","platform.internal":"BackendError","filemanager.file_not_found":"FileNotFound","filemanager.folder_not_found":"FolderNotFound","filemanager.file_exists":"FileAlreadyExists","filemanager.folder_exists":"FolderAlreadyExists","filemanager.invalid_file_name":"FileInvalidName","filemanager.invalid_folder_name":"FolderInvalidName","filemanager.item_not_found":"FileNotFound","filemanager.no_project_access":"AuthorizationFailed","filemanager.project_required":"ValidationError","filemanager.invalid_project_id":"ValidationError","filemanager.file_too_large":"FileTooLarge","filemanager.upload_too_large":"PayloadTooLarge","filemanager.no_files":"ValidationError","filemanager.batch_limit_exceeded":"BatchItemLimitExceeded","filemanager.too_many_items":"BatchItemLimitExceeded","filemanager.items_required":"ValidationError","filemanager.unsupported_file_type":"FileTypeNotAllowed","filemanager.upload_url_rejected":"UploadUrlInvalid","filemanager.transfer_into_descendant":"MoveIntoDescendant","filemanager.legacy_file_unsupported":"UnsupportedOperation","filemanager.backfill_unsupported":"UnsupportedOperation","filemanager.backfill_already_done":"UnsupportedOperation","filemanager.storage_unavailable":"ServiceUnavailable"};function Fr(e){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 409:return"FolderAlreadyExists";case 413:return"PayloadTooLarge";case 415:return"FileTypeNotAllowed";case 429:return"RateLimitExceeded";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return"BackendError"}}function fn(e,i){return(e?Or[e]:void 0)??Fr(i)}function gn(e){return(e?Or[e]:void 0)??"FileWriteError"}var $r=2e3,Mr=30,_n=$r*Mr;function xn(e){return typeof e?.watchThumbnail=="function"}var Dr=200,kn=class lo{pathMode=!1;rootId="";trashPath=yt._;useSoftDelete=!1;api;projectId;i18n;appConfig;isStandalone;onIndexingStateChange;pendingThumbnails=new Map;thumbWatchers=new Map;resolveSystemFolderByPath;constructor(i){this.api=i.restApi,this.projectId=i.projectId,this.i18n=i.i18n??s.defaultI18nContext,this.appConfig=i.appConfig,this.isStandalone=i.isStandalone,this.onIndexingStateChange=i.onIndexingStateChange,this.resolveSystemFolderByPath=yt.b({Trash:{id:yt._,folderId:this.rootId}})}async getItems(i){const r=i.folderId===yt._;if(i.itemType==="folder")return{items:await this.listFolders(i.folderId,r)};const a=i.itemType==="all"&&(i.page??1)<=1,[l,n]=await Promise.all([a?this.listFolders(i.folderId,r,i.search):[],this.listFiles(i,r)]);return{items:[...l,...n.items],pagination:n.pagination}}async listFolders(i,r,a){const l=await this.api.folders.foldersList({project_id:this.projectId,parent_id:r?void 0:this.normalizeFolderId(i),trashed:r||void 0});try{this.assertOk(l)}catch(c){if(lo.isNotFound(c))return[];throw c}let n=(l.data.items??[]).map(c=>this.mapFolder(c,i));if(a){const c=a.toLowerCase();n=n.filter(m=>m.name.toLowerCase().includes(c))}return n}async listFiles(i,r){const a=Math.min(i.limit??Dr,Dr),l=Math.max(i.page??1,1),n=await this.api.files.filesList({project_id:this.projectId,folder_id:r?void 0:this.normalizeFolderId(i.folderId),search:i.search||void 0,sort_by:i.sortBy,sort_order:i.sortOrder,limit:a,offset:(l-1)*a,trashed:r||void 0});try{this.assertOk(n)}catch(m){if(lo.isNotFound(m))return{items:[],pagination:{page:1,limit:a,total:0,totalPages:0,hasNext:!1,hasPrev:!1}};throw m}this.onIndexingStateChange?.(!!n.data.indexing);const c=r?yt._:this.normalizeFolderId(i.folderId)??this.rootId;return{items:(n.data.data??[]).map(m=>this.mapFile(m,c)),pagination:this.mapPagination(n.data.page,a)}}async createFolder(i,r){const a=await this.api.folders.foldersCreate({project_id:this.projectId,name:i,parent_id:this.normalizeFolderId(r)});return this.assertOk(a),this.mapFolder(a.data.folder??{},r)}async uploadFileByUrl(i,r){const a=await this.api.files.uploadByUrlCreate({project_id:this.projectId,url:i,folder_id:this.normalizeFolderId(r)});return this.assertOk(a),this.mapFile(a.data.file??{},this.normalizeFolderId(r)??this.rootId)}async uploadFiles(i){if(i.items.length===0)return{success:!0,detailed:[]};const r=new Map;i.items.forEach((n,c)=>{const m=this.normalizeFolderId(n.folderId??i.folderId??void 0)??this.rootId,f=n.requestId??`item-${c}`,_=r.get(m)??[];_.push({item:n,requestId:f}),r.set(m,_)});const a=[];for(const[n,c]of r){const m=new FormData;m.append("project_id",this.projectId),n!==this.rootId&&m.append("folder_id",n);for(const{item:k,requestId:b}of c)m.append("request_id",b),m.append("file",k.data,k.name);let f;try{f=await this.api.request({path:"/files",method:"POST",body:m,type:s.ContentType.FormData,format:"json",secure:!0}),this.assertOk(f)}catch(k){for(const{requestId:b}of c)a.push({requestId:b,success:!1,error:lo.toErrorInfo(k)});continue}const _=new Map((f.data.items??[]).map(k=>[k.request_id,k]));c.forEach(({requestId:k},b)=>{const h=_.get(k)??f.data.items?.[b];h?.file?a.push({requestId:k,success:!0,data:this.mapFile(h.file,n)}):a.push({requestId:k,success:!1,error:this.mapItemFail(h?.error)})})}const l=a.filter(n=>!n.success);return{success:l.length===0,error:l[0]?.error,detailed:a}}async uploadFile(i){const r=(await this.uploadFiles({items:[{name:i.name,size:i.size,type:i.type,folderId:i.folderId,data:i.data}]})).detailed?.[0];if(!r?.success||!r.data){const a=r?.error;throw a instanceof ft?a:new ft(String(a?.message??this.i18n.__("Unknown error")),a?.code||"FileWriteError",typeof a?.status=="number"?a.status:void 0)}return r.data}async updateFile(i,r){let a={id:i.id};if(r.data!==void 0){const l=typeof r.data=="string"?lo.base64ToBlob(r.data,i.type):r.data,n=new FormData;n.append("project_id",this.projectId),n.append("file",l,i.name);const c=await this.api.request({path:`/files/${i.id}/content`,method:"PUT",body:n,type:s.ContentType.FormData,format:"json",secure:!0});this.assertOk(c);const m=c.data.file??{};a={...a,size:m.size,type:m.mime,url:m.url,thumbnail:m.thumbnail_url,thumbnailUrl:m.thumbnail_url,lastEdited:m.updated_at}}if(r.name&&r.name!==i.name){const l=await this.renameItem(i,r.name);a={...a,...l}}return a}getFileData=async(i,r)=>{const{__:a}=this.i18n;if(!i.url)throw new ft(a("Failed to get file: %s").replace("%s",i.name),"FileReadError");const l=await De.fetchWithResourceProxy(i.url,{config:this.appConfig,standalone:this.isStandalone,resourceType:De.isCdnUrl(i.url,this.appConfig)?"cdn":"generic",intent:"downloadBlob",init:r?.forceReload?{cache:"no-store"}:void 0});if(l.ok)return l.blob();const n=await l.text();throw new ft(n||a("Failed to get file: %s").replace("%s",l.statusText),Fr(l.status),l.status)};static base64ToBlob(i,r){const a=i.includes(",")?i.slice(i.indexOf(",")+1):i,l=atob(a),n=new Uint8Array(l.length);for(let c=0;c<l.length;c+=1)n[c]=l.charCodeAt(c);return new Blob([n],r?{type:r}:void 0)}mapItemFail(i){const{__:r}=this.i18n;return{message:i?.message||r("Unknown error"),code:gn(i?.code)}}async renameItem(i,r){if(i.isFolder){const n=await this.api.folders.foldersPartialUpdate({id:i.id},{project_id:this.projectId,name:r});this.assertOk(n);const c=n.data.folder??{};return{id:i.id,name:c.name??r,folderId:c.parent_id??i.folderId,isFolder:!0,lastEdited:c.updated_at}}const a=await this.api.files.filesPartialUpdate({id:i.id},{project_id:this.projectId,name:r,mode:"replace"});this.assertOk(a);const l=a.data.file??{};return{id:i.id,name:l.name??r,folderId:l.folder_id??i.folderId,isFolder:!1,url:l.url,thumbnail:l.thumbnail_url,thumbnailUrl:l.thumbnail_url,extension:l.ext,type:l.mime,lastEdited:l.updated_at}}async deleteItem(i,r){try{if(i.isFolder){const a=await this.api.folders.foldersDelete({id:i.id,project_id:this.projectId,permanent:r.permanent||void 0});this.assertOk(a)}else{const a=await this.api.files.filesDelete({id:i.id,project_id:this.projectId,permanent:r.permanent||void 0});this.assertOk(a)}}catch(a){if(!lo.isNotFound(a))throw a}}async deleteItems(i,r){if(i.length===0)return{success:!0};const a=new Set(i.filter(m=>m.isFolder).map(m=>m.id)),l=new Set(i.filter(m=>a.has(m.folderId))),n=[];for(const m of i){if(l.has(m)){n.push({requestId:m.id,success:!0});continue}try{await this.deleteItem(m,r),n.push({requestId:m.id,success:!0})}catch(f){n.push({requestId:m.id,success:!1,error:lo.toErrorInfo(f)})}}const c=n.filter(m=>!m.success);return{success:c.length===0,error:c[0]?.error,detailed:n}}async moveItems(i,r){if(i.length===0)return{success:!0,detailed:[]};const a=i.filter(m=>m.folderId===yt._),l=i.filter(m=>m.folderId!==yt._),n=[];if(a.length>0){const m=await this.api.trash.restoreCreate({project_id:this.projectId,ids:a.map(f=>f.id),target_folder_id:this.normalizeFolderId(r),on_conflict:"keep_both"});this.assertOk(m),n.push(...this.mapTransferResults(m.data.items,a))}if(l.length>0){const m=await this.api.items.moveCreate({project_id:this.projectId,ids:l.map(f=>f.id),target_folder_id:this.normalizeFolderId(r)});this.assertOk(m),n.push(...this.mapTransferResults(m.data.items,l))}const c=n.filter(m=>!m.success);return{success:c.length===0,error:c[0]?.error,detailed:n}}async moveItem(i,r){return this.unwrapSingleTransfer(await this.moveItems([i],r),i)}async copyItems(i,r){if(i.length===0)return{success:!0,detailed:[]};const a=await this.api.items.copyCreate({project_id:this.projectId,ids:i.map(c=>c.id),target_folder_id:this.normalizeFolderId(r)});this.assertOk(a);const l=this.mapTransferResults(a.data.items,i),n=l.filter(c=>!c.success);return{success:n.length===0,error:n[0]?.error,detailed:l}}async copyItem(i,r){return this.unwrapSingleTransfer(await this.copyItems([i],r),i)}async cleanTrash(){const i=await this.api.trash.emptyCreate({project_id:this.projectId});return this.assertOk(i),{success:!0,deletedCount:(i.data.deleted_files??0)+(i.data.deleted_folders??0)}}async clearCache(i){}findItemByPath(i){return this.resolveSystemFolderByPath(i)}async findFileByUrl(i,r){const a={appConfig:this.appConfig,isStandalone:this.isStandalone,projectId:this.projectId};if(!hn(i,a))return;const l=bn(i,a),n=s.decodeFileNameFromUrl(l);if(!n)return;const{items:c}=await this.listFiles({folderId:r,search:n},!1);return c.find(m=>m.url===i||m.url===l)}mapTransferResults(i,r){const a=new Map(r.map(l=>[l.id,l]));return(i??[]).map((l,n)=>{const c=l.id??r[n]?.id,m=c?a.get(c):r[n];return l.error?{requestId:c,success:!1,error:this.mapItemFail(l.error)}:{requestId:c,success:!0,data:l.file?this.mapFile(l.file,l.file.folder_id??this.rootId):l.folder?this.mapFolder(l.folder):m?{id:m.id}:{id:c??""}}})}unwrapSingleTransfer(i,r){const a=i.detailed?.[0];if(!a?.success){const l=a?.error??i.error;throw l instanceof ft?l:new ft(String(l?.message??this.i18n.__("Unknown error")),l?.code||"BackendError",typeof l?.status=="number"?l.status:void 0)}return a.data??{id:r.id}}mapFile(i,r){return this.trackThumbnailReadiness(i),{id:i.id??"",name:i.name??"",folderId:i.folder_id??r,isFolder:!1,size:i.size,date:i.created_at,lastEdited:i.updated_at,type:i.mime,extension:i.ext,url:i.url,thumbnail:i.thumbnail_url,thumbnailUrl:i.thumbnail_url,dimensions:i.width&&i.height?`${i.width}x${i.height}`:void 0,aspectRatio:i.width&&i.height?String(i.width/i.height):void 0,selected:!1}}trackThumbnailReadiness(i){if(!i.id||!i.url||!i.mime?.startsWith("image/"))return;if(i.thumbnail_url){this.pendingThumbnails.delete(i.url);return}const r=i.created_at?new Date(i.created_at).getTime():NaN;Number.isFinite(r)&&Date.now()-r<_n?this.pendingThumbnails.set(i.url,i.id):this.pendingThumbnails.delete(i.url)}watchThumbnail(i,r){const a=this.pendingThumbnails.get(i);if(!a)return()=>{};const l=this.thumbWatchers.get(a);if(l)return l.listeners.add(r),()=>l.listeners.delete(r);const n={listeners:new Set([r]),cancelled:!1};return this.thumbWatchers.set(a,n),this.pollThumbnail(a,i,n),()=>{n.listeners.delete(r),n.listeners.size===0&&(n.cancelled=!0,this.thumbWatchers.delete(a))}}async pollThumbnail(i,r,a){for(let l=0;l<Mr;l+=1){if(await new Promise(c=>setTimeout(c,$r)),a.cancelled)return;let n;try{const c=await this.api.files.filesDetail({id:i,project_id:this.projectId});c.ok&&!c.error&&(n=c.data.file?.thumbnail_url)}catch{}if(a.cancelled)return;if(n){this.pendingThumbnails.delete(r),this.thumbWatchers.delete(i),a.listeners.forEach(c=>c(n));return}}this.thumbWatchers.delete(i),this.pendingThumbnails.delete(r)}mapFolder(i,r){return{id:i.id??"",name:i.name??"",folderId:i.parent_id??this.normalizeFolderId(r)??this.rootId,isFolder:!0,date:i.created_at,lastEdited:i.updated_at,selected:!1}}mapPagination(i,r){const a=i?.limit??r,l=i?.offset??0,n=i?.total??0,c=a>0?Math.floor(l/a)+1:1,m=a>0?Math.ceil(n/a):0;return{page:c,limit:a,total:n,totalPages:m,hasNext:c<m,hasPrev:c>1}}normalizeFolderId(i){if(!(!i||i===this.rootId))return i}assertOk(i){if(i.ok&&!i.error)return;const{__:r}=this.i18n,a=i.error?.error,l=fn(a?.code,i.status);throw new ft(a?.message||r("Unknown error"),l,i.status)}static isNotFound(i){return i instanceof ft&&(i.code==="FileNotFound"||i.code==="FolderNotFound")}static toErrorInfo(i){return i instanceof ft||i instanceof Error?i:{message:String(i),raw:i}}};function Vr({storageProvider:e,projectId:i,restApi:r,restApiV2:a,i18n:l,pathPostfix:n,appConfig:c,isStandalone:m,onIndexingStateChange:f}){const _=c?.fileManager,k=_?{..._,enablePagination:_.enablePagination===!1?!!_.clientSidePaging:_.enablePagination}:void 0,b=!!a&&s.isFileManagerV2Enabled(c),h=e||(b&&a?new kn({projectId:i,restApi:a,i18n:l,appConfig:c,isStandalone:m,onIndexingStateChange:f}):new mn({projectId:i,restApi:r,i18n:l,pathPostfix:n,appConfig:c,isStandalone:m})),y=h.pathMode?new yt.ne(h,h.rootId??"",yt._,h.trashPath,!0):null;return{storageProvider:h,pathProxy:y,dataProvider:new yt.Z(y??h,k,{...h,trashPath:h.pathMode?"trash":h.trashPath,rootId:h.pathMode?"":h.rootId??""},{fetchWithProxy:(x,E)=>De.fetchWithResourceProxy(x,{config:c,standalone:m,intent:"downloadBlob",init:E})}),usesBuiltInStorage:!e}}function Wo(e){const i=String(e??"").split(";")[0].trim();if(!i)return"";const r=i.toLowerCase(),a=r.indexOf("/");if(a===-1)return r;const l=r.slice(a+1);return l==="svg+xml"?"svg":l}var Ur=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),fi=({onChange:e,value:i,validateStatus:r,placeholder:a,disabled:l,name:n,elementSettings:c,imageInfo:m,previewReloadSignal:f,onRemotePreviewValidate:_})=>{const k=s.useCurrentUser(),b=s.useProjectData(),h=s.useAppConfig(),y=s.useIsStandalone(),{__:x}=s.useI18n(),E=s.useSendPostMessage(),{openImagePicker:w}=s.useImagePicker(),I=s.useStorageProvider(),A=s.useRestClient(),v=b?.id!==void 0?String(b?.id):"",P=k?.id!=="0"?String(k.id):"",{dataProvider:C}=(0,d.useMemo)(()=>Vr({storageProvider:I,projectId:v,restApi:A,i18n:{__:x},pathPostfix:P,appConfig:h,isStandalone:y}),[h,y,v,A,I,P,x]),Y=Pr(),[W]=s.useLazyGetImageInfoQuery(),[F,N]=(0,d.useState)({width:"",height:"",size:""}),[T,J]=(0,d.useState)(!1),[Z,se]=(0,d.useState)(0),[te,ne]=(0,d.useState)(""),_e=(0,d.useRef)(""),le=(0,d.useRef)(f?.counter||0),fe=Ar(),Ae=(0,d.useRef)(""),ce=(0,d.useRef)(""),[$e,Ce]=(0,d.useState)(0),ie=s.usePlanFeatureGate("image_editor"),Be=()=>{Ae.current&&(URL.revokeObjectURL(Ae.current),Ae.current="")};(0,d.useEffect)(()=>{if(!i){N({width:"",height:"",size:"",format:""}),_e.current="",ne(""),Be();return}if(i.startsWith("data:")||i.startsWith("blob:")){Be(),_e.current=i,ne(i),N({width:"",height:"",size:"",format:""});return}const Q=kt(i);ce.current=Q;const q=ko(Q),z=new AbortController;let G=!1;const re=async he=>{Be();const Pe=$e?en(he):he;_e.current=Pe,ne(Pe);try{const{data:ye}=await W(Q);return G||!ye?!1:(N({width:ye?.width,height:ye?.height,size:ye?.fileSize!=null?(ye.fileSize/1024).toFixed(0):"",format:Wo(ye?.format)}),!0)}catch{return!1}},ke=async()=>{const he=await fe.resolve(q,z.signal,Y);if(G)return;const{width:Pe,height:ye}=await vr(he);if(G)return;Be();const V=URL.createObjectURL(he);Ae.current=V,_e.current=V,ne(V),N({width:Pe,height:ye,size:(he.size/1024).toFixed(0),format:Wo(he.type)})};return(async()=>{try{if(!y){const he=await Cr(C,Q);if(he?.previewUrl&&await re(he.previewUrl))return}await ke()}catch{G||(Be(),_e.current="",ne(""),N({width:"",height:"",size:"",format:""}))}})(),()=>{G=!0,z.abort()}},[i,C,Y,W,y,fe,$e]);const ae=(0,d.useCallback)(()=>{const Q=ce.current;Q&&fe.abandonKey(ko(Q)),Ce(Date.now())},[fe]);(0,d.useEffect)(()=>{!f?.counter||f.name!==n||f.counter!==le.current&&(le.current=f.counter,ae())},[n,f,ae]),(0,d.useEffect)(()=>()=>Be(),[]);const oe=async(Q=null)=>{const q=n.startsWith("src"),z=Q||(q?s.MODALS.UPLOAD_IMAGE_MODAL:s.MODALS.UPLOAD_BACKGROUND_MODAL),G=kt(i||""),re=await w({kind:q?"img":"background",currentUrl:Uo(G)?"":G,entryModal:z});if(!re?.url)return;const ke=G===kt(re.url);(!ke||re.url!==i)&&e(re.url),re.meta?.mode==="save"&&ke&&(ae(),q&&E({operation:s.EVENT_TYPES.SANDBOX_IMAGE_RESET,url:String(re.url)}))},me=[{label:x("Upload"),key:"Upload",onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:s.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];h.imageCenterStockEnabled&&me.push({label:x("Stock"),key:"Stock",onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_STOCK:s.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),h.imageCenterGifEnabled&&me.push({label:x("GIF"),key:"GIF",onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_GIF:s.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),h.elementAIimageEnabled&&me.push({label:x("AI"),key:"AI",onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_AI:s.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const de=()=>{J(!1)};return(0,t.jsxs)("div",{className:(0,Ve.default)("upload-bg-image",{"upload-bg-image_disabled":l}),children:[i?(0,t.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:Q=>{Q.target?.closest(".upload-bg-image__edit")||Q.target?.closest(".upload-bg-image__edit-menu")||Q.target?.closest(".upload-bg-image__menu")||Q.target?.closest(".inputGroup")||oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:s.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>h.imagePathDropdownEnabled?(0,t.jsx)("div",{className:"inputGroup",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"Image",component:o.icons$Image,size:20,strokeWidth:h.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:a,name:n,disabled:l,className:"upload-bg-image__input"})}):(0,t.jsx)(t.Fragment,{}),classNames:{root:"upload-bg-image__dropdown-overlay"},styles:{root:{top:32,marginTop:"8px",width:347,left:0}},trigger:["hover"],placement:"bottom",getPopupContainer:Q=>Q.closest(".upload-bg-image__inner-wrap"),children:(0,t.jsxs)("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"},children:[(0,t.jsx)("div",{className:"upload-bg-image__uploader",children:(0,t.jsx)("div",{className:"upload-bg-image__uploader-content",children:(0,t.jsxs)("div",{className:"upload-bg-image__uploader-content-inner",children:[(0,t.jsx)("div",{className:"upload-bg-image__uploader-img-wrap",children:te?(0,t.jsx)("img",{className:"upload-bg-image__uploader-img",src:te,alt:"",onLoad:()=>{_&&Ur(kt(i||""))&&_("success")},onError:()=>{const Q=ce.current,q=kt(te||""),z=kt(Q||"");if(Q&&q!==z){_e.current=Q,ne(Q);return}_&&Ur(z)&&_("error")}}):(0,t.jsx)("div",{className:"upload-bg-image__uploader-img-placeholder","aria-hidden":!0})}),(0,t.jsx)("div",{className:"upload-bg-image__uploader-icons-wrap",children:(0,t.jsx)("div",{className:"upload-bg-image__uploader-content"})})]})})}),F.width&&F.height?(0,t.jsxs)("div",{className:"image-size",children:[F.width," × ",F.height,!!c&&(c.type===s.ELEMENT_TYPES.IMG||c.type===s.ELEMENT_TYPES.CAROUSEL)&&" → "+m.renderedWidth+" × "+m.renderedHeight,(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsxs)("span",{children:[F.size," ",x("kB")]}),F.format&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsx)("span",{className:"image-size-format",children:F.format})]})]}):(0,t.jsx)(o.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:a})]})}),(0,t.jsx)("div",{style:{flexGrow:1}}),F.format!=="gif"&&h.imageCenterEditorEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:x("Edit"),children:(0,t.jsx)(o.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,t.jsx)(s.EmIcons,{icon:"Edit",component:o.icons$Edit,size:16,strokeWidth:h.iconStrokeWidth,onClick:()=>{ie.isLocked?(J(!0),se(s.FEATURE_UPSELL_SLIDE.image_editor)):oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_EDIT:s.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT)}})})}),(0,t.jsx)(o.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:me},classNames:{root:"upload-bg-image__menu"},children:(0,t.jsx)(o.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,t.jsx)(s.EmIcons,{size:16,strokeWidth:h.iconStrokeWidth,icon:"SyncOutlined",component:o.icons$SyncOutlined,onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:s.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):x("Upload")})},"Actions")]}):(0,t.jsx)(o.ui_kit$Button,{type:"default",block:!0,onClick:()=>oe(n.startsWith("src")?s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:s.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,t.jsx)(s.EmIcons,{icon:"Image",component:o.icons$Image,size:16,strokeWidth:h.iconStrokeWidth}),children:x("Add image")}),(0,t.jsx)(s.PlanUpgradePrompt,{open:T,onCancel:de,initialSlide:Z})]})};fi.propTypes={};var En=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),Bn=(e,i,r)=>i||(r?.type===s.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Hr=e=>Array.isArray(e)?e.join("_"):e,Ot=({form:e,label:i,name:r,watchPath:a,disabled:l=!1,elementSettings:n,previewReloadSignal:c=void 0})=>{const{token:m}=(0,o.ui_kit$useToken)(),[f,_]=(0,d.useState)("success"),k=(0,d.useMemo)(()=>({marginBottom:m.formItemMarginBottomXS}),[m.formItemMarginBottomXS]),b=o.ui_kit$Form.useWatch(Bn(r,a,n),e);return(0,d.useEffect)(()=>{if(!b){_("");return}if(typeof b=="string"&&(b.startsWith("data:")||b.startsWith("blob:"))){_("success");return}if(En(b)){_("validating");return}_("success")},[b]),(0,t.jsx)(o.ui_kit$Form.Item,{name:r,validateStatus:f,style:k,children:(0,t.jsx)(fi,{validateStatus:f,placeholder:i,name:Hr(r),disabled:l,elementSettings:n,imageInfo:n?.type===s.ELEMENT_TYPES.CAROUSEL?n?.carouselImages?.[Hr(r).split("_")[1]]:n,previewReloadSignal:c,onRemotePreviewValidate:_})})};Ot.propTypes={label:g.default.string.isRequired,name:g.default.oneOfType([g.default.string,g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number]))]).isRequired,watchPath:g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number])),tooltipTitle:g.default.string,disabled:g.default.bool,previewReloadSignal:g.default.shape({name:g.default.string,counter:g.default.number}),form:g.default.shape({getFieldValue:g.default.func.isRequired}).isRequired},Ot.defaulProps={disabled:!1,previewReloadSignal:null};var Rt=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:r,elementSettings:a,namePrefix:l="",typeOfForm:n="desktop"})=>{const c=s.useSendPostMessage(),m=n==="mobile",f=m?"mobileBorderRadius":"borderRadius",_=m?"mobileBorderRadiusAll":"borderRadiusAll",k=m?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",b=m?"mobileBorderRadiusTopRight":"borderRadiusTopRight",h=m?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",y=m?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",x=m?H.MOBILE_BORDER_RADIUS_POSITION:H.BORDER_RADIUS_POSITION,E=()=>{const w=e.getFieldsValue(!0);let I;i?(e.setFieldsValue({[k]:w[_]||null,[y]:w[_]||null,[b]:w[_]||null,[h]:w[_]||null}),I={[f]:{[x[k]]:w[_]||0,[x[y]]:w[_]||0,[x[b]]:w[_]||0,[x[h]]:w[_]||0}}):w[k]===w[y]&&w[k]===w[b]&&w[k]===w[h]?(e.setFieldsValue({[_]:w[k]}),I={[f]:{[x[_]]:w[k]}}):(e.setFieldsValue({[k]:null,[y]:null,[b]:null,[h]:null}),I={[f]:{[x[_]]:0,[x[k]]:0,[x[y]]:0,[x[b]]:0,[x[h]]:0}});const A=m?{mobileBorderRadius:{all:w.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${l}${f}`]:{...a[`${l}${f}`],...I[`${l}${f}`]}};c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:A}),r(v=>!v)};return(0,t.jsx)(o.ui_kit$FormBorderRadiusInputs,{namePrefix:l,typeOfForm:n,oneBorderRadiusValue:i,onToggle:E,borderRadiusIcon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"BorderRadius",component:o.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};Rt.displayName="SelectedElementFormBorderRadius";var Tn="em-mob-text_align-",Sn=({value:e,onChange:i,onSync:r,fieldName:a,...l})=>{const n=(typeof e=="object"?e?.value:e)??"",c=m=>{const f={classNamePrefix:Tn,value:m};i?.(f),r?.({[a]:f})};return(0,t.jsx)(o.ui_kit$FormAlignControl,{value:n,onChange:c,...l})},zt=({form:e,elementSettings:i,imgParent:r=!1,name:a="align",tooltipTitle:l,typeOfForm:n="desktop"})=>{const c=s.useSendPostMessage(),m=s.useAppConfig(),f=n==="mobile",_=f?"mobileAlign":a;if(f){const k=b=>{c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:b})};return(0,t.jsx)(o.ui_kit$Form.Item,{name:_,children:(0,t.jsx)(Sn,{fieldName:_,onSync:k,disabled:r&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:l})})}return(0,t.jsx)(o.ui_kit$Form.Item,{name:_,children:(0,t.jsx)(o.ui_kit$FormAlignControl,{disabled:r&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:l})})},Vt=({form:e,elementSettings:i,tooltipTitle:r,disabled:a=!1,isNewIconType:l=!1,typeOfForm:n="desktop"})=>{const c=s.useSendPostMessage(),m=s.useAppConfig(),f=n==="mobile",_=f?"mobileVerticalAlign":"valign",k=b=>{e.setFieldsValue({[_]:b}),f||c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[_]:b}})};return(0,t.jsx)(o.ui_kit$Form.Item,{name:_,children:(0,t.jsx)(o.ui_kit$FormVerticalAlignControl,{...!f&&{value:i.valign,onChange:k},disabled:a,isNewIconType:l,strokeWidth:m.iconStrokeWidth})})},yn=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],Rn=({form:e,elementSettings:i,enableSwitch:r,usedColors:a,withoutShadowLabel:l})=>{const n=s.useSendPostMessage(),c=i.mobileBoxShadow,[m,f]=(0,d.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),_=o.ui_kit$Form.useWatch(yn,e);(0,d.useEffect)(()=>{if(!_)return;const[b,h,y,x,E,w]=_;(b===0||b===void 0||b===null)&&(h===0||h===void 0||h===null)&&(y===0||y===void 0||y===null)&&(x===0||x===void 0||x===null)&&(E===""||E===void 0||E===null)&&(w===!1||w===void 0)||f(!1)},[_]);const k=()=>{f(b=>!b),e.setFieldsValue({mobileBoxShadowHOffset:m?"":0,mobileBoxShadowVOffset:m?"":0,mobileBoxShadowBlurRadius:m?"":0,mobileBoxShadowSpreadRadius:m?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),n({operation:s.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,t.jsxs)(t.Fragment,{children:[r&&(0,t.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,t.jsx)(o.ui_kit$Switch,{id:"without-shadow",label:l,labelSize:"small",size:"small",checked:m,onChange:k})}),(0,t.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,t.jsx)(o.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:a})]})},It=({typeOfForm:e="desktop",form:i,elementSettings:r,enableSwitch:a=!0})=>{const{__:l}=s.useI18n(),n=s.useSelector(s.selectEmailSettings).usedColors;return e==="mobile"&&i&&r?(0,t.jsx)(Rn,{form:i,elementSettings:r,enableSwitch:a,usedColors:n,withoutShadowLabel:l("Without shadow")}):(0,t.jsx)(o.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:n})};It.displayName="SelectedElementFormBoxShadow";var Ct=({form:e,elementSettings:i,directionControl:r})=>{const{__:a}=s.useI18n();return(0,t.jsx)(o.ui_kit$FormDisplayControl,{directionControl:r,className:"selected-element-form-show",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"show",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$Radio.Group,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Radio.Button,{value:"all",children:a("Both")}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:a("Desktop"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"desktop",children:(0,t.jsx)(s.EmIcons,{icon:"DesktopOutlined",component:o.icons$DesktopOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:a("Mobile"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"mobile",children:(0,t.jsx)(s.EmIcons,{icon:"MobileOutlined",component:o.icons$MobileOutlined})})})]})})})})},gi=({form:e,elementSettings:i,handleChangeValues:r})=>{const{__:a}=s.useI18n(),l=(0,d.useRef)(),{token:n}=(0,o.ui_kit$useToken)(),[c,m]=(0,d.useState)(!1),[f,_]=(0,d.useState)(!1),[k,b]=(0,d.useState)(!1),[h,y]=(0,d.useState)(!1),[x,E]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let N=new URL("https://emailmaker.ru/?"+i.countdown);m(N.searchParams.get("font1").endsWith("-b")||N.searchParams.get("font1").endsWith("-bi")),_(N.searchParams.get("font1").endsWith("-i")||N.searchParams.get("font1").endsWith("-bi")),b(N.searchParams.get("font2").endsWith("-b")||N.searchParams.get("font2").endsWith("-bi")),y(N.searchParams.get("font2").endsWith("-i")||N.searchParams.get("font2").endsWith("-bi")),E(N.searchParams.get("tp")==="true")},[i]);const w=[{value:"-12",label:a("-12:00 Apia")},{value:"-11",label:a("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:a("-10:00 Honolulu, Anchorage")},{value:"-9",label:a("-9:00 Anchorage, Yukon")},{value:"-8",label:a("-8:00 Los Angeles, Vancouver")},{value:"-7",label:a("-7:00 Denver, Phoenix")},{value:"-6",label:a("-6:00 Mexico City, Guadalajara")},{value:"-5",label:a("-5:00 New York, Toronto, Havana")},{value:"-4",label:a("-4:00 Caracas, Santo Domingo")},{value:"-3",label:a("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:a("-2:00 South Georgia, Saint Helena")},{value:"-1",label:a("-1:00 Azores, Cape Verde")},{value:"0",label:a("+0:00 London, Lisbon, Dublin")},{value:"1",label:a("+1:00 Paris, Berlin, Rome")},{value:"2",label:a("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:a("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:a("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:a("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:a("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:a("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:a("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:a("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:a("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:a("+11:00 Honiara, Nuku'alofa, Apia")}],I=[{value:"20",label:a("20 s")},{value:"40",label:a("40 s")},{value:"60",label:a("60 s")}],A=[{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"}],v=N=>N&&N<(0,$t.default)().endOf("day")-864e5,P=N=>{E(N)},C=()=>{const N=!c;e.setFieldValue("countdownNumbersStrong",N),r({countdownNumbersStrong:N}),m(N)},Y=()=>{const N=!f;e.setFieldValue("countdownNumbersItalic",N),r({countdownNumbersItalic:N}),_(N)},W=()=>{const N=!k;e.setFieldValue("countdownLabelsStrong",N),r({countdownLabelsStrong:N}),b(N)},F=()=>{const N=!h;e.setFieldValue("countdownLabelsItalic",N),r({countdownLabelsItalic:N}),y(N)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("End time"),name:"countdownTime",children:(0,t.jsx)(o.ui_kit$DatePicker,{ref:l,format:"MM/DD/YYYY HH:mm",disabledDate:v,showTime:!0,placement:"bottomRight",getPopupContainer:N=>{const T=N?.closest(".blocks-app");return T||(N?.ownerDocument?.body??document.body)},allowClear:!1,allowEmpty:!1})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("Time zone"),name:"countdownTimeZone",style:{width:"100%"},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:a("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:w.map(N=>(0,t.jsx)(o.ui_kit$Select.Option,{value:N.value,children:N.label},N.value))})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("Background color"),name:"countdownBackgroundColor",className:"countdown-color",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:a("Background color"),usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29},children:(0,t.jsx)(o.ui_kit$Switch,{id:"countdownTransparency",label:a("Transparency"),labelSize:"small",size:"small",onChange:P})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:a("Countdown font settings"),compact:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersFont",style:{marginBottom:n.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:A})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:n.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersFontSize",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:12,placeholder:a("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a("Strong"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersStrong",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:C,children:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a("Italic"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersItalic",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":f}),onClick:Y,children:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:a("Time units font settings"),compact:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsFont",style:{marginBottom:n.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:A})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:n.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsFontSize",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:8,placeholder:a("Font size"),addonAfter:"px",prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a("Strong"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsStrong",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k}),onClick:W,children:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a("Italic"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsItalic",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":h}),onClick:F,children:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("Language"),name:"countdownLanguage",style:{width:"100%"},children:(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:a("Duration"),name:"countdownDuration",style:{width:"100%"},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:I})})})]})]})};gi.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var _i=({form:e,elementSettings:i})=>{const{__:r}=s.useI18n(),{token:a}=(0,o.ui_kit$useToken)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("URL of the video clip."),placement:"right",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:["video","source"],className:"selected-image-form__alt",children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:r("Video URL"),prefix:(0,t.jsx)(s.EmIcons,{icon:"VideoCameraOutlined",component:o.icons$VideoCameraOutlined})})})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("Play button"),name:["video","playButton"],style:{width:"100%",marginBottom:a.formItemMarginBottomMD+4},children:(0,t.jsxs)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:[(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_red",children:[(0,t.jsx)(s.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined,style:{color:"#FF0000"}})," ",r("Youtube Red")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_black",children:[(0,t.jsx)(s.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined})," ",r("Youtube Black")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_white",children:[(0,t.jsx)(s.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined,style:{color:"#aaa"}})," ",r("Youtube White")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"vimeo",children:[(0,t.jsx)(s.EmIcons,{icon:"Vimeo",component:o.icons$Vimeo})," ",r("Vimeo")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"white_circle",children:[(0,t.jsx)(s.EmIcons,{icon:"PlayCircleOutlined",component:o.icons$PlayCircleOutlined,style:{color:"#aaa"}})," ",r("White circle")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"black_circle",children:[(0,t.jsx)(s.EmIcons,{icon:"PlayCircleOutlined",component:o.icons$PlayCircleOutlined})," ",r("Black circle")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"white_circle_outlined",children:[(0,t.jsx)(s.EmIcons,{icon:"RightCircleOutlined",component:o.icons$RightCircleOutlined,style:{color:"#aaa"}})," ",r("White circle outlined")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"black_circle_outlined",children:[(0,t.jsx)(s.EmIcons,{icon:"RightCircleOutlined",component:o.icons$RightCircleOutlined})," ",r("Black circle outlined")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"none",children:[" ",r("Without button")]})]})})]})};_i.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var wn={marginBottom:10},Pt=()=>{const{__:e}=s.useI18n();return(0,t.jsx)(o.ui_kit$Row,{gutter:20,style:wn,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"ampShow",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$Radio.Group,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Radio.Button,{value:"all",children:e("Both")}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:e("AMP"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"amp",children:"AMP"})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:e("HTML"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"html",children:"HTML"})})]})})})})})},{Option:xi}=o.ui_kit$Select,{mobileBorderRadiusAll:jn,mobileBorderRadiusTopLeft:ki,mobileBorderRadiusBottomLeft:Ei,mobileBorderRadiusTopRight:Bi,mobileBorderRadiusBottomRight:Ti,borderRadiusBottomRight:Si,borderRadiusTopRight:yi,borderRadiusBottomLeft:Ri,borderRadiusTopLeft:wi,alt:vn,src:In,title:Cn,link:no,borderRadiusAll:Wr,imgReplacer:Pn,expanded:An}={link:"link",borderRadiusBottomRight:"borderRadiusBottomRight",borderRadiusTopRight:"borderRadiusTopRight",borderRadiusBottomLeft:"borderRadiusBottomLeft",borderRadiusTopLeft:"borderRadiusTopLeft",mobileBorderRadiusAll:"mobileBorderRadiusAll",mobileBorderRadiusTopLeft:"mobileBorderRadiusTopLeft",mobileBorderRadiusBottomLeft:"mobileBorderRadiusBottomLeft",mobileBorderRadiusTopRight:"mobileBorderRadiusTopRight",mobileBorderRadiusBottomRight:"mobileBorderRadiusBottomRight",alt:"alt",imgReplacer:"imgReplacer",src:"src",title:"title",borderRadiusAll:"borderRadiusAll",expanded:"expanded"},eo=({linkProtocol:e})=>{switch(e){case"https://":return(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined});case"mailto:":return(0,t.jsx)(s.EmIcons,{icon:"MailOutlined",component:o.icons$MailOutlined});case"tel:":return(0,t.jsx)(s.EmIcons,{icon:"PhoneOutlined",component:o.icons$PhoneOutlined});case"sms:":return(0,t.jsx)(s.EmIcons,{icon:"CommentOutlined",component:o.icons$CommentOutlined});case"ftp://":return(0,t.jsx)(s.EmIcons,{icon:"FileOutlined",component:o.icons$FileOutlined});case"#":return(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined});default:return(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined})}},Nn=e=>[{value:"https://",label:e("Site")},{value:"mailto:",label:e("E-mail")},{value:"tel:",label:e("Phone")},{value:"sms:",label:e("SMS")},{value:"ftp://",label:e("File")},{value:"#",label:e("Anchor")},{value:"",label:e("Other")}],to=({handleLinkProtocolsChange:e,linkProtocol:i,__:r})=>{const a=d.default.useMemo(()=>Nn(r),[r]);return(0,t.jsx)(o.ui_kit$Select,{style:{width:90,textAlign:"left"},value:i,onChange:e,options:a})},oo=({show:e,__:i,style:r,className:a})=>{const l=d.default.useMemo(()=>({marginBottom:8,...r}),[r]);return e?(0,t.jsx)(o.ui_kit$Alert,{className:a,title:i("Anchor links do not work in Outlook, Gmail, and several other email clients."),type:"warning",showIcon:!0,style:l}):null},ji=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),Ln=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,On=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function io(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const r=i.match(Ln);if(r)i=r[2];else{const a=i.match(On);a&&(i=a[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var zo=(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://":ji(e)?"#":"":i,Gt=(e,i)=>{const r=zo(e,"");return i(r),r},zr=e=>{if(!e||!e.startsWith("mailto:"))return{subject:"",body:"",baseEmail:e||""};try{const i=new URL(e),r=e.split("?")[0];return{subject:i.searchParams.get("subject")||"",body:i.searchParams.get("body")||"",baseEmail:r}}catch{return{subject:"",body:"",baseEmail:e.split("?")[0]}}},vi=(e,i,r)=>{if(!e||!e.startsWith("mailto:"))return e;const a=e.split("?")[0],l=[];return i&&l.push(`subject=${encodeURIComponent(i)}`),r&&l.push(`body=${encodeURIComponent(r)}`),l.length>0?`${a}?${l.join("&")}`:a},u=e=>e||(e===0?"0":""),pt=e=>e&&e!=="auto"?e:e===0?"0":"",Gr=(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 Ii(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 r={};e.carouselImages?.map((a,l)=>(Object.keys(a).forEach(n=>{r[n+"_"+l]=a[n]}),!0)),i.images=r}if(e.sections?.length>0){const r=[];e.sections?.map((a,l)=>(r.push({[`expanded_${l}`]:a.expanded}),!0)),i.sections=r}return i}function Yr(e,i,r){const a=r.hasOwnProperty("images"),l=r.hasOwnProperty("sections"),n=Object.keys(a?r.images:l?r.sections:r)[0],c=a?r.images:l?r.sections:r;let m={};const f=i.getFieldsValue(!0);switch(n.split("_")[0]){case Cn:case In:case vn:case Pn:if(a){const k=[...e.carouselImages];k[n.split("_")[1]][n.split("_")[0]]=c[n],m={carouselImages:k}}else m=c;break;case An:if(l){const k=[...e.sections];k[n.split("_")[1]][n.split("_")[0]]=c[n],m={sections:k}}break;case no:let _=io(c[n]);e.type===s.ELEMENT_TYPES.CAROUSEL?(m.carouselImages=e.carouselImages,a?(i.setFieldValue(["images",[no+"_"+n.split("_")[1]]],_),m.carouselImages[n.split("_")[1]].link=_,m.link="",i.setFieldValue(no,"")):(e.carouselImages.forEach((k,b)=>{i.setFieldValue(["images",no+"_"+b],_),m.carouselImages[b].link=_,m.link=_}),i.setFieldValue(no,_))):(i.setFieldValue(no,_),m.link=_);break;case Wr:m={borderRadius:{...e.borderRadius,[H.BORDER_RADIUS_POSITION[wi]]:f[wi],[H.BORDER_RADIUS_POSITION[Ri]]:f[Ri],[H.BORDER_RADIUS_POSITION[yi]]:f[yi],[H.BORDER_RADIUS_POSITION[Si]]:f[Si],[H.BORDER_RADIUS_POSITION[n]]:+c[n]}};break;case wi:case Ri:case yi:case Si:m={borderRadius:{...e.borderRadius,[H.BORDER_RADIUS_POSITION[Wr]]:null,[H.BORDER_RADIUS_POSITION[n]]:+c[n]}};break;case jn:case ki:case Ei:case Bi:case Ti:m={mobileBorderRadius:{...e.mobileBorderRadius,[H.MOBILE_BORDER_RADIUS_POSITION[ki]]:f[ki],[H.MOBILE_BORDER_RADIUS_POSITION[Ei]]:f[Ei],[H.MOBILE_BORDER_RADIUS_POSITION[Bi]]:f[Bi],[H.MOBILE_BORDER_RADIUS_POSITION[Ti]]:f[Ti],[H.MOBILE_BORDER_RADIUS_POSITION[n]]:c[n],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[n]+"-"}};break;default:m=c}return{...e,...m}}var Mt=(0,t.jsxs)(o.ui_kit$Select,{className:"select-after",children:[(0,t.jsx)(xi,{value:"px",children:"px"}),(0,t.jsx)(xi,{value:"%",children:"%"})]}),Fn=(0,t.jsx)(o.ui_kit$Select,{className:"select-after",children:(0,t.jsx)(xi,{value:"px",children:"px"})}),Xr=({form:e,elementSettings:i,boxShadow:r,bordersShow:a,borderRadiusShow:l,boxShadowShow:n,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,hasLink:f,hasAlt:_,hasTitle:k,isOpenSrcReplacer:b,mergeTagItems:h,mergeMenuOpen:y,setMergeMenuOpen:x,cascaderRef:E,linkInputRef:w,linkButtonRef:I,altInputRef:A,altButtonRef:v,titleInputRef:P,titleButtonRef:C,srcReplacerInputRef:Y,srcReplacerButtonRef:W,linkProtocol:F,handleLinkProtocolsChange:N,linkButtonHandler:T,linkInputHandler:J,altButtonHandler:Z,altInputHandler:se,titleButtonHandler:te,titleInputHandler:ne,srcReplacerButtonHandler:_e,srcInputHandler:le,handleSelect:fe,onChange:Ae,filter:ce,renderSearchOption:$e,handleChangeValues:Ce,toggleShowBorderHandler:ie,toggleShowBorderRadiusHandler:Be,toggleShowBoxShadowHandler:ae})=>{const{__:oe}=s.useI18n(),{token:me}=(0,o.ui_kit$useToken)(),de=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:i,imgParent:!0})}),de.formImageFieldVerticalAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,align:"right",children:(0,t.jsx)(Vt,{form:e,elementSettings:i})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(gi,{form:e,elementSettings:i,handleChangeValues:Ce}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),de.mergeTagsShow&&h&&(0,t.jsx)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(s.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:y?"none":"inline-flex"},onClick:()=>x(!0),children:oe("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:E,classNames:{popup:{root:"merge-tags"}},options:h,placeholder:oe("Start typing the title"),showSearch:{filter:ce,render:$e},spellCheck:"false",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),onChange:Ae,style:{display:y?"block":"none"},open:y,onKeyDown:Q=>{Q.key==="Escape"&&x(!1)}})]})}),i.type==="video"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_i,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Ot,{form:e,label:oe("Image path"),name:"src",placeholder:oe("Image path"),elementSettings:i,tooltipTitle:""})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,style:{marginBottom:!_&&!f&&!k&&!b?me.formItemMarginBottomMD+4:me.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:_||oe("Alternative text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),onClick:Z,ref:v,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),de.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:k||oe("Tooltip text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),onClick:te,ref:C,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:f||oe("Hyperlink URL"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!f}),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:T,ref:I})}),de.formImageFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:oe("Image replacer"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":b}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:_e,ref:W})})]}),(!!f||!!_||!!k||!!b)&&(0,t.jsxs)("div",{style:{marginBottom:me.formItemMarginBottomMD+4},children:[!!f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oo,{show:F==="#",__:oe,style:{marginBottom:me.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:me.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:F,handleLinkProtocolsChange:N,__:oe}),placeholder:oe("Hyperlink URL"),allowClear:!0,ref:w,onChange:J,onSelect:fe,prefix:(0,t.jsx)(eo,{linkProtocol:F})})})})]}),!!_&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:me.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:oe("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:se,ref:A,onSelect:fe})})}),de.formFieldImageTitleEnabled&&!!k&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:me.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:oe("Enter the title of the image"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:ne,ref:P,onSelect:fe})})}),!!b&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Image src"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:me.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:oe("Code that will replace the image `src`"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:oe("Image src")}),onChange:le,ref:Y,onSelect:fe})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Size"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:de.formImageFieldHeightEnabled,showMinMax:!1,gutter:me.marginSM,rowStyle:{marginBottom:de.formImageFieldHeightEnabled?4:24},labels:{width:oe("Width"),height:oe("Height"),minWidth:oe("Minimum width"),maxWidth:oe("Maximum width")}})}),de.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Borders"),collapsible:!0,open:a,onToggle:ie,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),de.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Border radius"),collapsible:!0,open:l,onToggle:Be,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,elementSettings:i})}),de.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Box shadow"),collapsible:!0,open:n,onToggle:ae,dividerTop:!0,children:(0,t.jsx)(It,{})}),de.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),de.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Xr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,isOpenSrcReplacer:g.default.oneOfType([g.default.bool,g.default.number]),mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,srcReplacerInputRef:g.default.object,srcReplacerButtonRef:g.default.object,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,linkButtonHandler:g.default.func,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,srcReplacerButtonHandler:g.default.func,srcInputHandler:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,handleChangeValues:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func};var Yt=({form:e,name:i,elementSettings:r,isPicture:a,tooltipTitle:l})=>{const{__:n}=s.useI18n(),c=s.useSendPostMessage(),m=(0,d.useRef)(),[f,_]=(0,d.useState)(r[i]?.value==="auto"),{token:k}=(0,o.ui_kit$useToken)(),[b,h]=(0,d.useState)(""),y=E=>{m.current.value=null,e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),_(w=>!w),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:f?null:"auto",dim:""}}})},x=E=>{_(!1),h(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:l,placement:"bottom",children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{ref:m,min:0,max:b,placeholder:n("Width"),onChange:x,prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:Mt})})})})}),!a&&(0,t.jsx)(o.ui_kit$Switch,{id:"auto-width",label:n("Auto"),labelSize:"small",size:"small",checked:f,onChange:y})]})};Yt.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var ro=({form:e,name:i,elementSettings:r,isPicture:a,tooltipTitle:l})=>{const{__:n}=s.useI18n(),c=s.useSendPostMessage(),m=(0,d.useRef)(),[f,_]=(0,d.useState)(r.mobileHeight?.value==="auto"),{token:k}=(0,o.ui_kit$useToken)(),b=y=>{m.current.value=null,e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),_(x=>!x),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:f?null:"auto",dim:""}}})},h=y=>{_(!1)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:l,placement:"bottom",children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{ref:m,min:0,placeholder:n("Height"),onChange:h,prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!a&&(0,t.jsx)(o.ui_kit$Switch,{id:"auto-height",label:n("Auto"),labelSize:"small",size:"small",checked:f,onChange:b})]})};ro.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var Kr=({form:e,elementSettings:i,boxShadow:r,mobileBordersShow:a,mobileBorderRadiusShow:l,mobileBoxShadowShow:n,mobileSizeShow:c,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:f,hasLink:_,hasAlt:k,hasTitle:b,linkInputRef:h,linkButtonRef:y,altInputRef:x,altButtonRef:E,titleInputRef:w,titleButtonRef:I,linkInputHandler:A,altButtonHandler:v,altInputHandler:P,titleButtonHandler:C,titleInputHandler:Y,linkButtonHandler:W,toggleShowMobileBorderHandler:F,toggleShowMobileBorderRadiusHandler:N,toggleShowMobileBoxShadowHandler:T,toggleShowMobileSizeHandler:J})=>{const{__:Z}=s.useI18n(),{token:se}=(0,o.ui_kit$useToken)(),te=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:30,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),te.formImageFieldVerticalAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,align:"right",children:(0,t.jsx)(Vt,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(gi,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),i.type==="video"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_i,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Ot,{form:e,label:Z("Image path"),name:"src",placeholder:Z("Image path"),elementSettings:i,tooltipTitle:""})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,style:{marginBottom:!k&&!_&&!b?se.formItemMarginBottomMD+4:se.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:k||Z("Alternative text"),placement:"bottom",getPopupContainer:ne=>ne.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),onClick:v,ref:E,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),te.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:b||Z("Tooltip text"),placement:"bottom",getPopupContainer:ne=>ne.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:C,ref:I,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:_||Z("Hyperlink URL"),placement:"bottom",getPopupContainer:ne=>ne.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:W,ref:y})})]}),(!!_||!!k||!!b)&&(0,t.jsxs)("div",{style:{marginBottom:se.formItemMarginBottomMD+4},children:[!!_&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Z("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:se.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{ref:h,allowClear:!0,placeholder:Z("Hyperlink URL"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined}),onChange:A})})}),!!k&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Z("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:se.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Z("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:P,ref:x})})}),te.formFieldImageTitleEnabled&&!!b&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Z("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:se.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Z("Tooltip text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:Y,ref:w})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Size"),collapsible:!0,open:c,onToggle:J,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:24},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:Z("Width")})}),te.formImageFieldHeightEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:Z("Height")})})]})}),te.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Borders"),collapsible:!0,open:a,onToggle:F,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),te.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Border radius"),collapsible:!0,open:l,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:m,setOneBorderRadiusValue:f,elementSettings:i,typeOfForm:"mobile"})}),te.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Box shadow"),collapsible:!0,open:n,onToggle:T,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile"})}),te.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),te.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:Z("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Kr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,linkButtonHandler:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func};var $n=e=>typeof e=="object"&&e!==null?e.path:void 0;function Dt(){const e=(0,d.useRef)(!1),i=(0,d.useRef)(null),r=(0,d.useCallback)(l=>{e.current=!l},[]),a=(0,d.useCallback)((l,n)=>{const c=JSON.stringify($n(l)??null);return i.current!==c&&(i.current=c,e.current=!1),n?e.current:(e.current=!1,!1)},[]);return(0,d.useMemo)(()=>({markBorderToggled:r,isStaleBorderSnapshot:a}),[r,a])}function co(e){const i=(0,d.useRef)(null),r=(0,d.useRef)(e);return r.current=e,{remember:(0,d.useCallback)(a=>{i.current=a},[]),fillFields:(0,d.useCallback)((a,l)=>{r.current!==i.current&&a.setFieldsValue(l)},[])}}var Mn=1e3,Dn=2e4,qr="https://useblocks.io/app/",Jr=({elementSettings:e})=>{const{__:i}=s.useI18n(),[r]=o.ui_kit$Form.useForm(),a=Dt(),l=Dt();let n=s.useDispatch();const c=s.useAppConfig(),m=s.useEditorProjectId(),f=s.useNotification(),_=s.useSendPostMessage(),k=s.useSendPostMessageEx(),{openImagePicker:b}=s.useImagePicker(),h=s.useSelector(s.selectEmailViewType),y=s.useSelector(s.selectMobileViewActive),x=s.useCurrentUser(),E=s.useSelector(s.selectIsCodeMode),w=s.useSelector(s.selectCodeModeDirection),[I]=s.useUploadImageMutation(),[A,v]=s.useSendShortLinkMutation(),[P,C]=(0,d.useState)({name:"",counter:0}),Y=(0,d.useRef)(null),W=(0,d.useRef)(null),F=(0,d.useRef)(null),N=(0,d.useRef)(null),T=(0,d.useRef)(null),J=(0,d.useRef)(null),Z=(0,d.useRef)(null),se=(0,d.useRef)(null),te=(0,d.useRef)(null),[ne,_e]=(0,d.useState)({}),[le,fe]=(0,d.useState)(!0),[Ae,ce]=(0,d.useState)(!0),[$e,Ce]=(0,d.useState)(""),[ie,Be]=(0,d.useState)(""),[ae,oe]=(0,d.useState)(""),[me,de]=(0,d.useState)(!1),[Q,q]=(0,d.useState)(!1),[z,G]=(0,d.useState)(!1),[re,ke]=(0,d.useState)(!1),[he,Pe]=(0,d.useState)(!1),[ye,V]=(0,d.useState)(!1),[ee,we]=(0,d.useState)(!1),[je,K]=(0,d.useState)(!1),[ve,Re]=(0,d.useState)("https://"),Le=(0,d.useRef)(!1),Ue=(0,d.useRef)(),Me=e,He=(0,d.useRef)(Me);He.current=Me;const O=(0,d.useCallback)(()=>r.getFieldsValue(!0).video,[r]),[xe,D]=(0,d.useState)(),[ue,ge]=(0,d.useState)(!1),[Oe,Ge]=(0,d.useState)(null),[Ye,Xe]=(0,d.useState)({start:0,end:0}),[R,X]=(0,d.useState)(!1),[j,M]=(0,d.useState)(!1),[Ee,Fe]=(0,d.useState)(!1),[tt,qe]=(0,d.useState)(!1),ct=(0,d.useRef)(void 0),Ze=(0,d.useRef)(null),ut=(0,d.useRef)(null),Bt=tt||Ee||je;(0,d.useEffect)(()=>()=>clearTimeout(ct.current),[]);const B=(0,d.useRef)(null);(0,d.useEffect)(()=>{const L=B.current,Ie=L?.firstElementChild??null;if(!Bt||!L||!Ie)return;const Te=[];for(let ot=L.parentElement;ot;ot=ot.parentElement)getComputedStyle(ot).overflowY!=="visible"&&Te.push(ot);let be=0,Ne="";const Ke=()=>{const ot=L.getBoundingClientRect(),Qe=L.offsetHeight>0?ot.height/L.offsetHeight:1;let ht=Math.max(ot.top,0),lt=Math.min(ot.bottom,window.innerHeight);Te.forEach(Zt=>{const xo=Zt.getBoundingClientRect();ht=Math.max(ht,xo.top),lt=Math.min(lt,xo.bottom)});const gt=(ht-ot.top)/(Qe||1),Nt=Math.max(lt-ht,0)/(Qe||1),vt=`${Math.round(gt)}/${Math.round(Nt)}`;vt!==Ne&&(Ne=vt,Ie.style.top=`${gt}px`,Ie.style.height=`${Nt}px`),be=requestAnimationFrame(Ke)};return Ke(),()=>cancelAnimationFrame(be)},[Bt]);const S=()=>{const L=Ze.current;ut.current=L?.isConnected&&typeof L.selectionStart=="number"?{element:L,start:L.selectionStart,end:L.selectionEnd??L.selectionStart}:null},p=E&&w!=="bottom",$=s.useElementEntityKind();(0,d.useEffect)(()=>{ue&&te.current&&te.current.focus()},[ue]);const U=(L,Ie)=>{const Te=document.getElementById(Ie);if(Te){const be=Ie.substring(Ie.indexOf("selected_image_form_")+20),Ne=Te.value?.substring(0,Ye.start),Ke=Te.value?.substring(Ye.end);_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[be]:Ne+L+Ke}}),r.setFieldValue(be,Ne+L+Ke),Te.focus(),setTimeout(()=>{Te.selectionStart=Ye.start,Te.selectionEnd=Ye.start+L.length},400),X(!0)}},Se=s.useAppConfig().mergeTags;(0,d.useEffect)(()=>{Se?.items?.length&&D(s.mapMargeTags(Se.items,i,(L,Ie)=>{ge(!1),k(s.EVENT_TYPES.SANDBOX_ADD_MERGETAG,L),Ie.stopPropagation(),Ie.preventDefault()}))},[Se,D,i,ge,k]);const pe=(L,Ie)=>{if(ge(!1),L){const Te=Se.syntax.length>1?xe.findIndex(Ne=>Ne.key===Ie[0].key):0,be=Se.syntax[Te].replace("%value%",L[L.length-1]);Oe?.getAttribute("id")==="selected_image_form_title"||Oe?.getAttribute("id")==="selected_image_form_alt"||Oe?.getAttribute("id")==="selected_image_form_link"||Oe?.getAttribute("id")==="selected_image_form_imgReplacer"?U(be,Oe?.getAttribute("id")):(r.setFieldValue("imgReplacer",be),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:be}}))}},ze=(L,Ie)=>Ie.some(Te=>Te.label.toLowerCase().indexOf(L.toLowerCase())>-1),dt=(L,Ie)=>{const Te=Ie.map((be,Ne)=>{const Ke=be.label.split(new RegExp(`(${L})`,"gi"));return(0,t.jsxs)("span",{children:[Ne!==0&&(0,t.jsx)("span",{children:" / "}),Ke.map((ot,Qe)=>ot.toLowerCase()===L.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:ot},Qe):ot)]},be.value)});return(0,t.jsx)("div",{title:Ie.map(be=>be.label).join(" / "),children:Te})},at=s.useRootElement();(0,d.useEffect)(()=>{const L=({target:be})=>{be.closest('[id="merge_tags_wrapper"]')||(Ze.current=be,Ge(be))},Ie=({target:be})=>{!be.closest(".merge-tags")&&!be.closest("#merge_tags_button")&&ge(!1)},Te=new De.Disposable;return Te.addDisposable(s.addWindowListenerFromShadow(at,"focusin",L)),Te.addDisposable(s.addWindowListenerFromShadow(at,"click",Ie)),()=>{Te.dispose()}},[at]);const mt=({target:L})=>{if(L&&!R){const{selectionStart:Ie,selectionEnd:Te}=L;Xe({start:Ie,end:Te})}X(!1)},Et=e.border,Qt=e.mobileBorder,At=Object.keys(Et).find(L=>Et[L]?.width||Et[L]?.style||Et[L]?.color),Tt=Object.keys(Qt).find(L=>Qt[L]?.width||Qt[L]?.style||Qt[L]?.color),st=L=>L&&(L?.width||L?.style||L?.color)?L:"",{remember:jt,fillFields:Ht}=co(e);(0,d.useEffect)(()=>{if(e){e.src!==Ue.current&&(Ue.current=e.src,Le.current=!1);const L=e.boxShadow;if(_e(L),e.link&&Re(zo(e.link,"https://")),Ht(r,{...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:st(e.mobileBorder.all)||!(st(e.mobileBorder.top)||st(e.mobileBorder.bottom)||st(e.mobileBorder.right)||st(e.mobileBorder.left))&&st(e.border.all),mobileBorderTop:st(e.mobileBorder.top)||!st(e.mobileBorder.all)&&st(e.border.top),mobileBorderBottom:st(e.mobileBorder.bottom)||!st(e.mobileBorder.all)&&st(e.border.bottom),mobileBorderRight:st(e.mobileBorder.right)||!st(e.mobileBorder.all)&&st(e.border.right),mobileBorderLeft:st(e.mobileBorder.left)||!st(e.mobileBorder.all)&&st(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:pt(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:pt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:pt(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:pt(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",...Me.video}}),e.countdown){let be=new URL("https://emailmaker.ru/?"+e.countdown),Ne=be.searchParams.get("font1"),Ke=!1,ot=!1;Ne.endsWith("-b")?(Ne=Ne.substring(0,Ne.length-2),Ke=!0):Ne.endsWith("-i")?(Ne=Ne.substring(0,Ne.length-2),ot=!0):Ne.endsWith("-bi")&&(Ne=Ne.substring(0,Ne.length-3),Ke=!0,ot=!0);let Qe=be.searchParams.get("font2"),ht=!1,lt=!1;Qe.endsWith("-b")?(Qe=Qe.substring(0,Qe.length-2),ht=!0):Qe.endsWith("-i")?(Qe=Qe.substring(0,Qe.length-2),lt=!0):Qe.endsWith("-bi")&&(Qe=Qe.substring(0,Qe.length-3),ht=!0,lt=!0),Ht(r,{countdownTime:(0,$t.default)(new Date(Date.parse(be.searchParams.get("time"))+be.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:be.searchParams.get("frames")||20,countdownTimeZone:be.searchParams.get("timezone"),countdownLanguage:be.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+be.searchParams.get("bg"),countdownTransparency:be.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:Ne,countdownNumbersFontSize:be.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+be.searchParams.get("color1"),countdownLabelsFont:Qe,countdownLabelsFontSize:be.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+be.searchParams.get("color2"),countdownNumbersStrong:Ke,countdownNumbersItalic:ot,countdownLabelsStrong:ht,countdownLabelsItalic:lt})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?fe(!1):fe(!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))?ce(!1):ce(!0);const Ie=a.isStaleBorderSnapshot(e,!!At),Te=l.isStaleBorderSnapshot(e,!!Tt);Ie&&r.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Te||Ie&&!Tt)&&r.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),de(be=>At&&!Ie?!0:be),q(be=>At&&!Ie||Tt&&!Te?!0:be),G(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ke(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Pe(!!e.boxShadow),V(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),we(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?Ce(e.link):Ce(Le.current?"...":""),Be(e.alt),oe(e.title),M(e.imgReplacer?.length)}},[r,e,Ht,Me,At,Tt,a,l]),(0,d.useEffect)(()=>{if(Bt)return;const L=ut.current;ut.current=null,!(!L||!L.element.isConnected||L.element.disabled)&&Ze.current===L.element&&(L.element.focus(),L.element.setSelectionRange(L.start,L.end))},[Bt]);const xt=async(L,Ie,Te)=>{const be={};be.user_id=x.id,be.folder=L,Ie&&(Ie=await s.prepareImageForEditorUpload(Ie,c),be.file=Ie),Te&&(be.page_url=Te);const Ne=await I(be);if(Ne.error)f.fromError("IMAGE_UPLOAD_ERROR",Ie,Ne.error,!0);else{const Ke=Kl.extractUploadResult(Ne.data);if(Ke.error)return;if(Ke.file_url)return Ke.file_url}},Wt=(L,Ie)=>new Promise((Te,be)=>{const Ne=new Image,Ke=new Image;Ne.crossOrigin="Anonymous",Ke.crossOrigin="Anonymous";let ot=Ie?2:1;const Qe=()=>{clearTimeout(lt),be(new Error("video preview images are not loaded"))},ht=()=>{ot-=1,ot===0&&(clearTimeout(lt),Te({frame:Ne,button:Ie?Ke:null}))},lt=setTimeout(Qe,Dn);Ne.onload=ht,Ne.onerror=Qe,Ne.src=L,Ie&&(Ke.onload=ht,Ke.onerror=Qe,Ke.src=Ie)}),No=(L,Ie,Te,be)=>{const Ne=document.createElement("canvas"),Ke=Ne.getContext("2d");if(Ne.width=L.width,Ne.height=L.height,Ke.clearRect(0,0,Ne.width,Ne.height),Ke.drawImage(L,0,0,L.width,L.height),!Ie)return Ne;const ot=Math.min(Ne.width,Ne.height);let Qe;if(L.height>L.width)Qe=.3;else{const xo=L.width/L.height;Qe=Math.min(be,.3+(xo-1)/(Te-1)*.1)}const ht=ot*Qe,lt=Ie.width/Ie.height;let gt,Nt;lt>=1?(gt=ht,Nt=ht/lt):(Nt=ht,gt=ht*lt);const vt=(Ne.width-gt)/2,Zt=(Ne.height-Nt)/2;return Ke.drawImage(Ie,vt,Zt,gt,Nt),Ne},Ft=L=>new Promise(Ie=>{L.toBlob(Te=>Ie(Te?new File([Te],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),Lo=async L=>{const Ie=r.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!L||!Ie||Ie==="none"||Ee)){S(),Fe(!0);try{const{frame:Te,button:be}=await Wt(L,`${qr}${Ie}.png`),Ne=await Ft(No(Te,be,2,.4)),Ke=Ne&&await xt(m,Ne);if(!Ke)return;_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:He.current.type,settings:{src:Ke}}),Fo({...He.current,src:Ke,video:O()||He.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{r.setFieldValue("src",Ke)},100)}catch{}finally{Fe(!1)}}},wr=async()=>{const L=O(),Ie=L?.source,Te=L?.playButton;if(!Ie)return;const be=()=>O()?.source!==Ie;S(),qe(!0);try{const Ne=await xt("tmp",null,Ie);if(!Ne||be())return;const{frame:Ke,button:ot}=await Wt(Ne,Te&&Te!=="none"?`${qr}${Te}.png`:null);if(be())return;const Qe=await Ft(No(Ke,ot,2.5,.35)),ht=Qe&&await xt(m,Qe);ht&&!be()&&jr(ht)}catch{}finally{qe(!1)}},Oo=L=>{clearTimeout(ct.current),ct.current=setTimeout(()=>{L()},Mn)},pi=()=>{const L=r.getFieldsValue(!0);let Ie=new URL("https://cdt3.useblocks.io/rndt?"+e.countdown),Te=L.countdownNumbersFont;L.countdownNumbersStrong&&L.countdownNumbersItalic?Te+="-bi":L.countdownNumbersStrong?Te+="-b":L.countdownNumbersItalic&&(Te+="-i");let be=L.countdownLabelsFont;L.countdownLabelsStrong&&L.countdownLabelsItalic?be+="-bi":L.countdownLabelsStrong?be+="-b":L.countdownLabelsItalic&&(be+="-i"),Ie.searchParams.set("time",new Date(L.countdownTime.$d-L.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Ie.searchParams.set("bg",L.countdownBackgroundColor.substring(1)||"#FFFFFF"),Ie.searchParams.set("tp",!!L.countdownTransparency),Ie.searchParams.set("font1",Te),Ie.searchParams.set("size1",L.countdownNumbersFontSize*2||12),Ie.searchParams.set("color1",L.countdownNumbersColor.substring(1)||"#000000"),Ie.searchParams.set("font2",be),Ie.searchParams.set("size2",L.countdownLabelsFontSize*2||8),Ie.searchParams.set("color2",L.countdownLabelsColor.substring(1)||"#959595"),Ie.searchParams.set("spacing",Math.round(L.countdownNumbersFontSize*.4)||5),Ie.searchParams.set("locale",L.countdownLanguage.replace("_","-")),Ie.searchParams.set("timezone",L.countdownTimeZone),Ie.searchParams.set("frames",L.countdownDuration),A({link:JSON.stringify({target:Ie.href})}),S(),K(!0)},Fo=(0,d.useCallback)(L=>{jt(L),n($==="email"?s.setElementSettings$1(L):s.setElementSettings(L))},[n,$,jt]),jr=(0,d.useCallback)((L,Ie)=>{const Te=He.current,be=kt(Te.src||"")===kt(L||"");(!be||L!==Te.src)&&(_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Te.type,settings:{src:L}}),Fo({...Te,src:L,...Te.type==="video"?{video:O()||Te.video}:{},activateSection:null,changeKey:"src"}),r.setFieldValue("src",L)),Ie?.mode==="save"&&be&&(C(Ne=>({name:"src",counter:Ne.counter+1})),_({operation:s.EVENT_TYPES.SANDBOX_IMAGE_RESET,url:String(L)}))},[r,O,Fo,_]),$o=(0,d.useCallback)(async L=>{const Ie=e.src||"",Te=kt(Ie),be=await b({kind:"img",currentUrl:Uo(Te)?"":Te,entryModal:L});be?.url&&jr(be.url,be.meta)},[jr,e.src,b]),Vl=(L,...Ie)=>{const Te=r.getFieldsValue(!0),be=Object.keys(L)[0];let Ne;switch(be){case"link":let Ke=io(L[be]);Ke!==L[be]&&r.setFieldValue("link",Ke),Ne={link:Ke};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ne={boxShadow:{hOffset:Te.boxShadowHOffset,vOffset:Te.boxShadowVOffset,blurRadius:Te.boxShadowBlurRadius,spreadRadius:Te.boxShadowSpreadRadius,color:Te.boxShadowColor,inset:Te.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":Te.borderPosition==="borderAll"?(Ne={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...Te.borderAll}}},r.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):Te.borderAll?.width||Te.borderAll?.style||Te.borderAll?.color?(Ne={border:{all:null,left:Te.borderAll,right:Te.borderAll,top:Te.borderAll,bottom:Te.borderAll,[H.REVERSE_BORDER_POSITIONS[be]]:{...Te[be],...L[be]}}},r.setFieldsValue({borderAll:null,borderLeft:Te.borderAll,borderRight:Te.borderAll,borderTop:Te.borderAll,borderBottom:Te.borderAll,[be]:{...Te[be],...L[be]}})):(Ne={border:{all:null,left:Te.borderLeft,right:Te.borderRight,top:Te.borderTop,bottom:Te.borderBottom,[H.REVERSE_BORDER_POSITIONS[be]]:{...Te[be],...L[be]}}},r.setFieldsValue({border:Ne.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(Te.mobileBorderPosition==="mobileBorderAll")Ne={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...Te.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[be]+"-"}}},r.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const lt=H.MOBILE_REVERSE_BORDER_POSITIONS[be],gt={...Te[be],...L[be]},Nt=!gt?.width&&!gt?.style&&!gt?.color;if(Te.mobileBorder?.all?.width||Te.mobileBorder?.all?.style||Te.mobileBorder?.all?.color){const vt=Te.mobileBorderAll;Ne={mobileBorder:{all:null,left:vt,right:vt,top:vt,bottom:vt,[lt]:Nt?null:{...gt,classNamePrefix:"em-mob-border_"+lt+"-"}}},r.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:vt,mobileBorderRight:vt,mobileBorderTop:vt,mobileBorderBottom:vt,[be]:gt})}else{const vt=e.mobileBorder||{},Zt=xo=>{const Mo=vt[xo];return Mo&&(Mo?.width||Mo?.style||Mo?.color)?Mo:null};Ne={mobileBorder:{all:null,left:lt==="left"?Nt?null:{...gt,classNamePrefix:"em-mob-border_left-"}:Zt("left"),right:lt==="right"?Nt?null:{...gt,classNamePrefix:"em-mob-border_right-"}:Zt("right"),top:lt==="top"?Nt?null:{...gt,classNamePrefix:"em-mob-border_top-"}:Zt("top"),bottom:lt==="bottom"?Nt?null:{...gt,classNamePrefix:"em-mob-border_bottom-"}:Zt("bottom")}},r.setFieldsValue({[be]:gt})}}break;case"width":Ne={[be]:{value:L[be],dim:Te.widthDim}};break;case"widthDim":Ne={width:{value:Te.width,dim:L[be]}};break;case"height":Ne={[be]:{value:L[be],dim:Te.heightDim}};break;case"heightDim":Ne={height:{value:Te.height,dim:L[be]}};break;case"borderRadiusAll":Ne={borderRadius:{[H.BORDER_RADIUS_POSITION[be]]:+L[be]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ne={borderRadius:{topLeft:Te.borderRadiusTopLeft,bottomLeft:Te.borderRadiusBottomLeft,topRight:Te.borderRadiusTopRight,bottomRight:Te.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[be]]:+L[be]}};break;case"mobileWidth":Ne={[be]:{classNamePrefix:"em-mob-width-",value:L[be],dim:Te.mobileWidthDim}};break;case"mobileWidthDim":Ne={mobileWidth:{classNamePrefix:"em-mob-width-",value:Te.mobileWidth||100,dim:L[be]}};break;case"mobileHeight":Ne={[be]:{classNamePrefix:"em-mob-height-",value:L[be],dim:Te.mobileHeightDim}};break;case"mobileHeightDim":Ne={mobileHeight:{classNamePrefix:"em-mob-height-",value:Te.mobileHeight,dim:L[be]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ne={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[be]]:L[be],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[be]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ne={mobileBoxShadow:{hOffset:Te.mobileBoxShadowHOffset,vOffset:Te.mobileBoxShadowVOffset,blurRadius:Te.mobileBoxShadowBlurRadius,spreadRadius:Te.mobileBoxShadowSpreadRadius,color:Te.mobileBoxShadowColor,inset:Te.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Ne={[be]:{classNamePrefix:"em-mob-text_align-",value:L[be]}};break;case"mobileVerticalAlign":Ne={[be]:{classNamePrefix:"em-mob-vertical_align-",value:L[be]}};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":Oo(pi);break;case"video":{const lt={...e.video,...Te.video,...L.video},gt=lt.source??Te.link;Oo(wr),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:lt,link:gt}}),Fo({...e,video:lt,link:gt,activateSection:null,changeKey:"video"});break}case"src":const ot=L[be],Qe=e.src,ht=Te.video?.playButton||e.video?.playButton;if(e.type==="video"&&ht&&ht!=="none"&&!Ee&&ot&&(!Qe||ot!==Qe)){Oo(()=>Lo(ot));return}Ne=L;break;default:Ne=L}be!=="borderPosition"&&be!=="mobileBorderPosition"&&be.indexOf("countdown")===-1&&be!=="video"&&(_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ne}),be!=="video"&&be.indexOf("countdown")===-1&&be!=="mobileBorderRadiusAll"&&be!=="mobileBorderRadiusTopLeft"&&be!=="mobileBorderRadiusTopRight"&&be!=="mobileBorderRadiusBottomLeft"&&be!=="mobileBorderRadiusBottomRight"&&Fo({...e,...Ne,mobileBorderRadius:{...e.mobileBorderRadius,...Ne?.mobileBorderRadius},activateSection:null,changeKey:be}))};(0,d.useEffect)(()=>{v.isError&&(f.error(v),K(!1))},[v]),(0,d.useEffect)(()=>{if(v.isSuccess&&je){if(v.data.data?.status===400)f.error({title:v.data.code,description:v.data.message});else{let L=new URL(v.data.target),Ie={countdown:{link:v.data.link,params:L.search.substring(1)}};_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ie})}K(!1)}},[v,je,e,f,_]);const tp=L=>{const Ie=L.data.operation;Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_AI):Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_GIF):Ie===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?$o(s.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Ie===s.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(n(s.closeSecondModal()),n(s.closeModal$1()))};s.useListenPostMessage(tp);const op=()=>{const L=r.getFieldsValue(!0);a.markBorderToggled(!me),setTimeout(()=>{de(Ie=>!Ie),me?(L.borderAll=H.NULL_BORDER,L.borderTop=H.NULL_BORDER,L.borderBottom=H.NULL_BORDER,L.borderRight=H.NULL_BORDER,L.borderLeft=H.NULL_BORDER):L.borderAll={width:1,color:"#E5E5E5",style:"solid"},_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:L.borderAll.color,style:L.borderAll.style,width:L.borderAll.width}}}})})},ip=()=>{const L=r.getFieldsValue(!0);l.markBorderToggled(!Q),setTimeout(()=>{q(Ie=>!Ie),Q?(L.mobileBorderAll=H.NULL_BORDER,L.mobileBorderTop=H.NULL_BORDER,L.mobileBorderBottom=H.NULL_BORDER,L.mobileBorderRight=H.NULL_BORDER,L.mobileBorderLeft=H.NULL_BORDER):L.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:L.mobileBorderAll.color,style:L.mobileBorderAll.style,width:L.mobileBorderAll.width}}}})})},rp=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{G(Ie=>!Ie),z?(L.borderRadiusAll=0,fe(!0)):L.borderRadiusAll=5,_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:L.borderRadiusAll}}})})},sp=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{ke(Ie=>!Ie),re?(L.mobileBorderRadiusAll=null,ce(!0)):L.mobileBorderRadiusAll=5,_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:L.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ap=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{Pe(Ie=>!Ie),he?(L.boxShadowInset=!1,L.boxShadowHOffset=null,L.boxShadowVOffset=null,L.boxShadowBlurRadius=null,L.boxShadowSpreadRadius=null,L.boxShadowColor=""):(L.boxShadowInset=!1,L.boxShadowHOffset=5,L.boxShadowVOffset=5,L.boxShadowBlurRadius=10,L.boxShadowSpreadRadius=-5,L.boxShadowColor="#000000"),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:L.boxShadowBlurRadius,color:L.boxShadowColor,hOffset:L.boxShadowHOffset,inset:L.boxShadowInset,spreadRadius:L.boxShadowSpreadRadius,vOffset:L.boxShadowVOffset}}})})},lp=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{V(Ie=>!Ie),ye?(L.mobileBoxShadowInset=!1,L.mobileBoxShadowHOffset=null,L.mobileBoxShadowVOffset=null,L.mobileBoxShadowBlurRadius=null,L.mobileBoxShadowSpreadRadius=null,L.mobileBoxShadowColor=""):(L.mobileBoxShadowInset=!1,L.mobileBoxShadowHOffset=5,L.mobileBoxShadowVOffset=5,L.mobileBoxShadowBlurRadius=10,L.mobileBoxShadowSpreadRadius=-5,L.mobileBoxShadowColor="#000000"),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:L.mobileBoxShadowBlurRadius,color:L.mobileBoxShadowColor,hOffset:L.mobileBoxShadowHOffset,inset:L.mobileBoxShadowInset,spreadRadius:L.mobileBoxShadowSpreadRadius,vOffset:L.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},np=()=>{const L=r.getFieldsValue(!0);setTimeout(()=>{we(Ie=>!Ie),ee&&(L.mobileWidth="",L.mobileHeight="",_({operation:s.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-"}}}))})},Ul=()=>{$e?(Le.current=!1,Ce(""),r.setFieldValue("link",""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Le.current=!0,Ce(Y.current&&Y.current.input.value?Y.current.input.value:"..."),setTimeout(()=>{Y.current.focus()}))},Hl=L=>{L.target.value===""?Ce("..."):(W.current.classList.add("selected-td-form__button--active"),Ce(L.target.value)),Gt(L.target.value,Re)},Wl=()=>{const L=r.getFieldsValue(!0);ie?(Be(""),L.alt="",_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(Be(F.current&&F.current.input.value?F.current.input.value:"..."),setTimeout(()=>{F.current.focus()}))},zl=L=>{L.target.value===""?Be("..."):(N.current.classList.add("selected-td-form__button--active"),Be(L.target.value))},Gl=()=>{const L=r.getFieldsValue(!0);ae?(oe(""),L.title="",_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(oe(T.current&&T.current.input.value?T.current.input.value:"..."),setTimeout(()=>{T.current.focus()}))},dp=()=>{M(!j),j?(r.setFieldValue("imgReplacer",""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>Z.current.focus())},cp=L=>{L.target.value!==""&&se.current.classList.add("selected-td-form__button--active")},Yl=L=>{L.target.value===""?oe("..."):(J.current.classList.add("selected-td-form__button--active"),oe(L.target.value))},up=L=>{r.setFieldValue("link",L!=="mergetag"?L:""),Re(L)};return(0,t.jsxs)(o.ui_kit$Form,{form:r,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[At]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[Tt]||"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:Vl,autoComplete:"off",disabled:Bt,className:Bt?"element-controls selected-image-form_busy":"element-controls",children:[Bt&&(0,t.jsx)("div",{className:"selected-image-form__loader",ref:B,children:(0,t.jsxs)("div",{className:"selected-image-form__loader-body",children:[(0,t.jsx)(o.ui_kit$Spin,{size:"large"}),(0,t.jsx)("div",{className:"selected-image-form__loader-title",children:Me.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!p&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),h==="mobile"&&y.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(Kr,{form:r,elementSettings:e,boxShadow:ne,mobileBordersShow:Q,mobileBorderRadiusShow:re,mobileBoxShadowShow:ye,mobileSizeShow:ee,oneMobileBorderRadiusValue:Ae,setOneMobileBorderRadiusValue:ce,hasLink:$e,hasAlt:ie,hasTitle:ae,linkInputRef:Y,linkButtonRef:W,altInputRef:F,altButtonRef:N,titleInputRef:T,titleButtonRef:J,linkInputHandler:Hl,altButtonHandler:Wl,altInputHandler:zl,titleButtonHandler:Gl,titleInputHandler:Yl,linkButtonHandler:Ul,toggleShowMobileBorderHandler:ip,toggleShowMobileBorderRadiusHandler:sp,toggleShowMobileBoxShadowHandler:lp,toggleShowMobileSizeHandler:np})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Xr,{form:r,elementSettings:e,boxShadow:ne,bordersShow:me,borderRadiusShow:z,boxShadowShow:he,oneBorderRadiusValue:le,setOneBorderRadiusValue:fe,hasLink:$e,hasAlt:ie,hasTitle:ae,isOpenSrcReplacer:j,mergeTagItems:xe,mergeMenuOpen:ue,setMergeMenuOpen:ge,cascaderRef:te,linkInputRef:Y,linkButtonRef:W,altInputRef:F,altButtonRef:N,titleInputRef:T,titleButtonRef:J,srcReplacerInputRef:Z,srcReplacerButtonRef:se,linkProtocol:ve,handleLinkProtocolsChange:up,linkButtonHandler:Ul,linkInputHandler:Hl,altButtonHandler:Wl,altInputHandler:zl,titleButtonHandler:Gl,titleInputHandler:Yl,srcReplacerButtonHandler:dp,srcInputHandler:cp,handleSelect:mt,onChange:pe,filter:ze,renderSearchOption:dt,handleChangeValues:Vl,toggleShowBorderHandler:op,toggleShowBorderRadiusHandler:rp,toggleShowBoxShadowHandler:ap})})]})};Jr.propTypes={elementSettings:g.default.object.isRequired};var Qr=()=>{const{__:e}=s.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})},so=({form:e,elementSettings:i,imgParent:r=!1,name:a="align",setAlignStateHandle:l=()=>{},withHotKeys:n=!0})=>{const{__:c}=s.useI18n(),m=s.useSendPostMessage(),f=s.useAppConfig(),[_,k]=(0,d.useState)(null);(0,d.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&k(!0)},[]);const b=I=>{l(I),e.setFieldsValue({[a]:I}),m({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[a]:I}})},h=n?{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,y=n?{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,x=n?_?h:y:void 0,E=i[a],w=typeof E=="string"?E:"";return(0,t.jsx)(o.ui_kit$Form.Item,{name:a,children:(0,t.jsx)(o.ui_kit$FormAlignTextControl,{value:w,onChange:b,disabled:r&&!i.parent,strokeWidth:f?.iconStrokeWidth,labels:x})})},Je=({form:e,elementSettings:i,name:r,icon:a,tooltipTitle:l=null,showTooltip:n=!0,forceInactive:c=!1})=>{const{__:m}=s.useI18n(),f=e.getFieldValue(r),_=s.useSendPostMessage(),[k,b]=(0,d.useState)(i[r]);(0,d.useEffect)(()=>{i[r]!==e.getFieldValue(r)&&(e.setFieldValue(r,i[r]),b(i[r]))},[i,e,r]),(0,d.useEffect)(()=>{k!==f&&b(f)},[f,k,r]);const h=()=>{const y={[r]:!k};e.setFieldValue(r,!k),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:y}),r==="textSuperscript"?e.setFieldValue("textSubscript",!1):r==="textSubscript"&&e.setFieldValue("textSuperscript",!1),b(x=>!x)};return(0,t.jsx)(o.ui_kit$Form.Item,{name:r,children:n?(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l||m(r.substring(4)),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:h,children:a})}):(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:h,children:a})})};Je.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string,imgParent:g.default.bool};var Zr=()=>{const{__:e}=s.useI18n();return[{symbol:"•",code:"&bull;",description:e("Bullet")},{symbol:"+",code:"&plus;",description:e("Plus")},{symbol:"»",code:"&raquo;",description:e("Double quotation")},{symbol:"×",code:"&times;",description:e("Cross")},{symbol:"–",code:"&mdash;",description:e("Dash")},{symbol:"›",code:"&rsaquo;",description:e("Single quotation")},{symbol:"→",code:"&rarr;",description:e("Arrow")},{symbol:"⇒",code:"&rArr;",description:e("Double arrow")},{symbol:"►",code:"&blacktriangleright;",description:e("Pointer")},{symbol:"−",code:"&minus;",description:e("Minus")},{symbol:"∗",code:"&lowast;",description:e("Star")},{symbol:"♦",code:"&diams;",description:e("Diamond")}]},Vn=(e,i="#c6c3c3",r={},a)=>{const{symbolSize:l="25px",marginRight:n="5px",marginBottom:c="5px",textStyle:m={whiteSpace:"normal",lineHeight:"1.2"}}=r;return e.map(f=>({value:f.code,label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,t.jsx)("span",{style:{color:i||"#c6c3c3",marginRight:n,marginBottom:c,fontSize:l,lineHeight:"0.7",width:l,textAlign:"center",...m},children:f.symbol}),(0,t.jsx)("span",{style:m,children:f.description})]})}))},Bo=({form:e,fillFields:i,elementSettings:r,showAddParagraph:a=!0,isButton:l=!1,linkProtocol:n,setLinkProtocol:c,linkTarget:m,isBulletFontColorChecked:f=!1,setIsBulletFontColorChecked:_=()=>{},showTopDivider:k=!0})=>{const{__:b}=s.useI18n(),h=H.useGoogleFontsLoader(),{token:y}=(0,o.ui_kit$useToken)(),x=s.useNotification(),E=s.useSendPostMessage(),w=s.useSendPostMessageEx(),I=s.useAppConfig(),A=(0,d.useRef)(),v=(0,d.useRef)(null),P=(0,d.useRef)(null),C=(0,d.useRef)(null),Y=(0,d.useRef)(!1),W=r,[F,N]=(0,d.useState)(!!W.textReplacer?.length),[T,J]=(0,d.useState)(!!W.textAnchor?.length),[Z,se]=(0,d.useState)(null),[te,ne]=(0,d.useState)({start:0,end:0}),[_e,le]=(0,d.useState)(!1),[fe,Ae]=(0,d.useState)([]),[ce,$e]=(0,d.useState)(W.list?.bulletsColor),[Ce,ie]=(0,d.useState)(r);r!==Ce&&(ie(r),$e(W.list?.bulletsColor),N(!!W.textReplacer?.length),J(!!W.textAnchor?.length));const[Be,ae]=(0,d.useState)(!1),[oe,me]=(0,d.useState)(!1),de=(0,d.useRef)(null),Q=(0,d.useRef)(""),q=Zr(),z=(0,d.useMemo)(()=>q,[]),G={textColor:o.ui_kit$Form.useWatch("textColor",e),textLink:o.ui_kit$Form.useWatch("textLink",e),linkHref:o.ui_kit$Form.useWatch("linkHref",e),listUL:o.ui_kit$Form.useWatch("listUL",e),listOL:o.ui_kit$Form.useWatch("listOL",e)};(0,d.useEffect)(()=>{l&&r?.textColor!==void 0&&e.setFieldValue("textColor",r.textColor)},[l,r?.textColor,e]);let re=null;(0,d.useEffect)(()=>{if(G?.textColor&&f){const R=e.getFieldValue("textColor");E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{ColorBullets:R}})}},[G?.textColor]),(0,d.useEffect)(()=>{const R=e.getFieldValue("textLink");typeof r.linkHref=="string"&&ae(!0),de&&!R&&(ae(!1),e.setFieldsValue({linkHref:null})),de.current=R||null},[G?.textLink,G?.linkHref,r.linkHref,e]),(0,d.useEffect)(()=>{const R=e.getFieldValue("listUL"),X=e.getFieldValue("listOL");R&&Q.current!=="listUL"?(e.setFieldValue("listOL",!1),Q.current="listUL"):X&&Q.current!=="listOL"&&(e.setFieldValue("listUL",!1),Q.current="listOL"),!R&&!X&&(Q.current="")},[G?.listUL,G?.listOL,e]);const ke=R=>{R.data.operation===s.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&se(null)};s.useListenPostMessage(ke);const[he,Pe]=(0,d.useState)(null);(0,d.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Pe(!0)},[]);const ye=(0,d.useRef)(null);function V(R){const X=R.key.toLowerCase();let j=!1;return((re==="control"||re==="meta")&&(X==="a"||X==="A")||(re==="a"||re==="A")&&(X==="control"||X==="meta"))&&(j=!0),re=X,X!=="control"&&X!=="a"&&X!=="A"&&X!=="meta"&&(re=null),j}const ee=R=>{E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:R,locale:"en_US"}),x.success({title:b("It`s done!")})},we=[{key:"1",label:b("This element"),onClick:()=>ee("typograf")},{key:"2",label:b("The whole email"),onClick:()=>ee("typograf_all")}],[je,K]=(0,d.useState)(),[ve,Re]=(0,d.useState)(!1);(0,d.useEffect)(()=>{const R=Vn(z,ce,{});Ae(R)},[z,ce]),(0,d.useEffect)(()=>{const R=r.linkHref||r.href;R&&Gt(R,c);const X=r.linkHref||r.href,j=X&&ji(X)?X.slice(1):X||"https://";(i??((M,Ee)=>M.setFieldsValue(Ee)))(e,{linkHref:j})},[e,r,c,i]);const Le=s.useAppConfig().mergeTags;(0,d.useEffect)(()=>{Le?.items?.length&&K(s.mapMargeTags(Le.items,b,(R,X)=>{Re(!1),w(s.EVENT_TYPES.SANDBOX_ADD_MERGETAG,R),X.stopPropagation(),X.preventDefault()}))},[Le,K,b,Re,w]);const Ue=R=>{e.setFieldValue("linkHref",R!=="mergetag"?R:""),c(R)},Me=(R,X)=>{if(Re(!1),R){const j=Le.syntax.length>1?je.findIndex(Ee=>Ee.key===X[0].key):0,M=Le.syntax[j].replace("%value%",R[R.length-1]);if(Z?.getAttribute("id")==="selected_button_form_href"||Z?.getAttribute("id")==="selected_text_form_linkHref"||Z?.getAttribute("id")==="selected_text_form_textReplacer")ue(M,Z?.getAttribute("id"));else{e.setFieldValue("textReplacer",M);const Ee=Date.now();E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{textReplacer:`${M}~~${Ee}`}})}}},He=(R,X)=>X.some(j=>j.label.toLowerCase().indexOf(R.toLowerCase())>-1),O=(R,X)=>{const j=X.map((M,Ee)=>{const Fe=M.label.split(new RegExp(`(${R})`,"gi"));return(0,t.jsxs)("span",{children:[Ee!==0&&(0,t.jsx)("span",{children:" / "}),Fe.map((tt,qe)=>tt.toLowerCase()===R.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:tt},qe):tt)]},M.value)});return(0,t.jsx)("div",{title:X.map(M=>M.label).join(" / "),children:j})};(0,d.useEffect)(()=>{ve&&ye.current&&ye.current.focus()},[ve]);const xe=s.useRootElement();(0,d.useEffect)(()=>{const R=({target:M})=>{M.closest('[id="merge_tags_wrapper"]')||se(M)},X=({target:M})=>{!M.closest(".merge-tags")&&!M.closest("#merge_tags_button")&&Re(!1)},j=new De.Disposable;return j.addDisposable(s.addWindowListenerFromShadow(xe,"focusin",R)),j.addDisposable(s.addWindowListenerFromShadow(xe,"click",X)),()=>{j.dispose()}},[xe]),(0,d.useEffect)(()=>{const R=v?.current||document,X=()=>{window.getSelection().toString().length>0&&(Y.current=!0)};return R.addEventListener("dblclick",X),()=>{R.removeEventListener("dblclick",X)}},[v]);const D=(0,d.useCallback)(({target:R})=>{if(R&&!_e){const{selectionStart:X,selectionEnd:j}=R;ne({start:X,end:j})}le(!1)},[_e]);(0,d.useEffect)(()=>D({target:m?.target}),[m,D]);const ue=(R,X)=>{const j=document.getElementById(X);if(j){const M=j.value?.substring(0,te.start),Ee=j.value?.substring(te.end),Fe=X.substring(X.lastIndexOf("_")+1);E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{[Fe]:M+R+Ee}}),e.setFieldValue(Fe,M+R+Ee),j.focus(),setTimeout(()=>{j.selectionStart=te.start,j.selectionEnd=te.start+R.length},400),le(!0)}},ge=()=>{N(!F),F?(e.setFieldValue("textReplacer",""),E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{textReplacer:""}})):setTimeout(()=>v.current.focus())},Oe=R=>{R.target.value!==""&&P.current?.classList.add("selected-td-form__button--active")},Ge=(R="unknown")=>{J(!T),T?(e.setFieldValue("textAnchor",""),E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{textAnchor:""}})):setTimeout(()=>C.current?.focus())},Ye=R=>{const X=R.target,j=X.value,M=X.selectionStart,Ee=V(R);if(Y.current&&M===0&&E({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{textReplacer:`${j}~`}}),Y.current=Ee,M===0&&R.key===" "){R.preventDefault();return}if(R.key===" "){if(M!==j.length){R.preventDefault();return}j.endsWith(" ")&&R.preventDefault()}},Xe=R=>{$e(R),f&&_(!1)};return(0,t.jsxs)(t.Fragment,{children:[a&&!r.showOnMobile&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,gutter:20,children:(0,t.jsx)(so,{form:e,elementSettings:r,name:"textAlign"})})})}),I.formTextFieldTypografEnabled&&!l||I.mergeTagsShow&&je?(0,t.jsx)(o.ui_kit$FormSection,{title:null,dividerTop:k,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[I.formTextFieldTypografEnabled&&!l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:y.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"AddImage",component:o.icons$AddImage}),onClick:()=>ee("add_img"),style:{width:"100%"},children:b("Add image")})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:y.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,menu:{items:we},trigger:["hover"],placement:"bottom",getPopupContainer:R=>R.closest(".selected-element-panel"),children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),onClick:()=>ee("typograf"),style:{width:"100%"},children:b("Typography")})})})})]}),I.mergeTagsShow&&je&&(0,t.jsxs)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:y.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(s.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:ve?"none":"inline-flex"},onClick:()=>Re(!0),children:b("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:ye,classNames:{popup:{root:"merge-tags"}},options:je,placeholder:b("Start typing the title"),showSearch:{filter:He,render:O},spellCheck:"false",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),onChange:Me,style:{display:ve?"block":"none",width:"100%"},open:ve,onKeyDown:R=>{R.key==="Escape"&&Re(!1)}})]})]})}):null,(0,t.jsxs)(o.ui_kit$FormSection,{title:null,dividerTop:k||I.formTextFieldTypografEnabled&&!l,bodyStyle:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text font"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper")})})}),!r.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:b("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:b("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,t.jsxs)(o.ui_kit$Col,{span:24,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)("div",{className:"selected-text-common-form__format-toolbar",children:[(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textStrong",tooltipTitle:b(he?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textItalic",tooltipTitle:b(he?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textUnderline",tooltipTitle:b(he?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})]})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:r.usedColors})})})})]}),!l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textStrong",tooltipTitle:b(he?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textItalic",tooltipTitle:b(he?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textUnderline",tooltipTitle:b(he?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),r?.list?.isList&&(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textStrikethrough",tooltipTitle:b(he?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!r?.list?.isList&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"listUL",tooltipTitle:b("Unordered list"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnorderedListOutlined",component:o.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:D})}),!r?.list?.isList&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"listOL",tooltipTitle:b("Ordered list"),icon:(0,t.jsx)(s.EmIcons,{icon:"OrderedListOutlined",component:o.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:D})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textSuperscript",tooltipTitle:b("Text superscript"),icon:(0,t.jsx)(s.EmIcons,{icon:"Superscript",component:o.icons$Superscript})})}),r?.list?.isList&&(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,t.jsx)(s.EmIcons,{icon:"Subscript",component:o.icons$Subscript})})]}),a&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,className:(0,Ve.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof r.linkHref=="string"}),elementSettings:r,name:"textLink",forceInactive:!!r.textAnchor,tooltipTitle:b("Link"),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:D})}),r?.list?.isList&&I.formTextFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":F}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ge,ref:P})})}),(!r?.list?.isList||a&&r?.list?.isList)&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:b("More options"),placement:"bottom",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":oe||T}),icon:(0,t.jsx)(s.EmIcons,{icon:"DotsHoriz",component:o.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>me(!oe)})})})]})]}),!l&&oe&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[!r?.list?.isList&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textStrikethrough",tooltipTitle:b(he?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(Je,{form:e,elementSettings:r,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,t.jsx)(s.EmIcons,{icon:"Subscript",component:o.icons$Subscript})})]}),I.formTextFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":F}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ge,ref:P})})})]}),a&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:b("Anchor"),placement:"bottom",getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":T}),icon:(0,t.jsx)(s.EmIcons,{icon:"Anchor",component:o.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:R=>{R.preventDefault(),Ge("mouseDown")}})})})]}),a&&typeof r.linkHref=="string"&&Be&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oo,{show:n==="#",__:b,style:{marginBottom:y.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b(n==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:n==="mailto:"?y.formItemMarginBottomXS:""},children:(0,t.jsx)(o.ui_kit$Input,{ref:A,addonBefore:(0,t.jsx)(to,{linkProtocol:n,handleLinkProtocolsChange:Ue,__:b}),allowClear:!0,placeholder:b(n==="#"?"Anchor name":"Hyperlink URL"),autoFocus:r?.isNewLink,onSelect:D,prefix:(0,t.jsx)(eo,{linkProtocol:n})})})}),n==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",style:{marginBottom:y.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:b("Subject"),onSelect:D})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:y.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:b("Body"),onSelect:D})})]})]}),a&&T&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Anchor name"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textAnchor",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:b("Anchor name"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:b("Anchor"),"aria-hidden":!0,children:(0,t.jsx)(s.EmIcons,{icon:"Anchor",component:o.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:C,onSelect:D,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||J(!1)}})})}),!l&&F&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textReplacer",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:b("The code that will replace this text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:b("Text")}),onChange:Oe,onKeyDown:Ye,ref:v,onSelect:D})})})]})}),!l&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:r.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Text background"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:b("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:b("Background color"),usedColors:r.usedColors})})})})]})]}),!l&&r?.list?.isList&&(0,t.jsxs)(o.ui_kit$FormSection,{title:b("List settings"),dividerTop:!0,children:[r?.list?.listType==="OL"&&(0,t.jsx)(o.ui_kit$Row,{children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:R=>R.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,t.jsx)(o.ui_kit$Row,{gutter:[10],children:r?.list?.listType==="UL"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets type"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,t.jsx)(o.ui_kit$Select,{size:"medium",placeholder:b("Bullets type"),onClick:R=>R.stopPropagation(),options:fe})})})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:[10],children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:R=>R.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"ColorBullets",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:b("Bullets color"),usedColors:r.usedColors,disabled:f,onChange:Xe,externalValue:f?G?.textColor:void 0})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletsSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:r?.list?.bulletFontSize,placeholder:b("Bullets size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),r?.list?.listType==="OL"&&(0,t.jsxs)(o.ui_kit$Row,{children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"BulletTextStrong",tooltipTitle:b(he?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"BulletTextItalic",tooltipTitle:b(he?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"BulletTextStrikethrough",tooltipTitle:b(he?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:r,name:"BulletTextUnderline",tooltipTitle:b(he?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Between list items"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:b("Between list items"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:b("Between bullets and text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:b("Between bullets and text"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Ci=({form:e,elementSettings:i,showAddParagraph:r=!0,isButton:a=!1})=>{const{__:l}=s.useI18n(),n=H.useGoogleFontsLoader(),c=s.useSendPostMessage(),m=s.useDispatch(),f=s.useElementEntityKind(),_=s.useAppConfig(),[k,b]=(0,d.useState)(null);(0,d.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&b(!0)},[]);const h=A=>{c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:A,locale:"en_US"})},[y,x]=(0,d.useState)(i.textAlign),[E,w]=(0,d.useState)(i.linkHref),I=A=>x(A);return(0,d.useEffect)(()=>{x(i.textAlign),w(i.linkHref)},[i]),(0,t.jsx)("div",{className:"selected_text_common_form_mobile",children:(0,t.jsxs)(o.ui_kit$Space,{size:"8",separator:(0,t.jsx)(o.ui_kit$Divider,{orientation:"vertical"}),children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)("div",{style:{width:190},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Text font"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:n,getPopupContainer:A=>A.closest(".selected_text_common_form_mobile")})})})}),(0,t.jsx)("div",{style:{width:90},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:l("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)("div",{style:{width:90},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:l("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(k?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(k?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(k?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(k?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-td-form__icon-radius"})})]}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Text color"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:l("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors,getPopupContainer:A=>A.closest(".selected_text_common_form_mobile")})})}),!a&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Text background"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:l("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]}),r&&(0,t.jsx)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:(0,t.jsxs)(t.Fragment,{children:[typeof E=="string"?(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:l("Hyperlink URL"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.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:A=>A.closest(".selected_text_common_form_mobile"),children:(0,t.jsx)("div",{children:(0,t.jsx)(Je,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:i,name:"textLink",icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),showTooltip:!1})})}):(0,t.jsx)(Je,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:l("Link"),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,t.jsx)(so,{form:e,elementSettings:i,name:"textAlign",setAlignStateHandle:I}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:615,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:A=>A.closest(".selected_text_common_form_mobile"),children:(0,t.jsx)(o.ui_kit$Button,{icon:y==="right"?(0,t.jsx)(s.EmIcons,{icon:"AlignRightOutlined",component:o.icons$AlignRightOutlined,size:18,strokeWidth:_.iconStrokeWidth}):y==="center"?(0,t.jsx)(s.EmIcons,{icon:"AlignCenterOutlined",component:o.icons$AlignCenterOutlined,size:18,strokeWidth:_.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"AlignLeftOutlined",component:o.icons$AlignLeftOutlined,size:18,strokeWidth:_.iconStrokeWidth}),className:"selected-td-form__button"})})]})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[r&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Add paragraph"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"Paragraph",component:o.icons$Paragraph}),onClick:()=>h("add_p"),className:"selected-td-form__button"})}),!a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Add inline image"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"ImageAdd",component:o.icons$ImageAdd,size:16,strokeWidth:_.iconStrokeWidth}),onClick:()=>h("add_img"),className:"selected-td-form__button"})}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),className:"selected-td-form__button"})]}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"CloseOutlined",component:o.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),m(s.resetToLastActiveSettingsTab()),setTimeout(()=>{m(f==="block"?s.setElementSettings({type:null}):s.setElementSettings$1({type:null}))},300)}})]})]})})},Go=({elementSettings:e,imgParent:i=!1,name:r="mobileAlign"})=>{const{__:a}=s.useI18n(),l=s.useAppConfig();return(0,t.jsx)(o.ui_kit$Form.Item,{name:r,children:(0,t.jsx)(o.ui_kit$FormAlignTextControl,{disabled:i&&!e.parent,strokeWidth:l?.iconStrokeWidth,labels:{alignLeft:a("Text align left"),alignCenter:a("Text align center"),alignRight:a("Text align right"),alignJustify:a("Text align justify")}})})};Go.propTypes={elementSettings:g.default.object.isRequired,imgParent:g.default.bool,name:g.default.string};var Un=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useDispatch(),a=s.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),n=s.useSelector(s.selectEmailViewType),c=s.useSelector(s.selectMobileViewActive),m=s.useSelector(s.selectIsCodeMode),f=s.useSelector(s.selectCodeModeDirection),_=m&&f!=="bottom",[k,b]=(0,d.useState)("https://"),[h,y]=(0,d.useState)(!1),x=Zr(),E=(0,d.useMemo)(()=>x,[]),w=s.useElementEntityKind(),{remember:I,fillFields:A}=co(e),v=(0,d.useCallback)(C=>{I(C),r(w==="email"?s.setElementSettings$1(C):s.setElementSettings(C))},[r,w,I]);(0,d.useEffect)(()=>{if(e){const{subject:C,body:Y,baseEmail:W}=zr(e.linkHref),F=e.linkHref,N=typeof F=="string"&&ji(F),T=typeof F=="string"&&F.startsWith("mailto:")?W:N?F.slice(1):typeof F=="string"?F:"https://";b(zo(F||"","https://")),A(l,{...e,lineHeight:u(e.lineHeight),linkHref:T,subject:C,body:Y,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:Gr(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:h,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:E.find(J=>J.symbol===e?.list?.bulletType)?.code??E[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[l,e]);const P=C=>{const Y=l.getFieldsValue(!0),W=Object.keys(C)[0];let F;switch(W){case"mobileFontSize":F={[W]:{classNamePrefix:"em-mob-font_size-",value:C[W],dim:Y.mobileFontSizeDim}};break;case"mobileLineHeight":F={[W]:{classNamePrefix:"em-mob-line_height-",value:C[W],dim:Y.mobileLineHeightDim}};break;case"mobileTextAlign":F={[W]:{classNamePrefix:"em-mob-text_align-",value:C[W]}};break;case"linkHref":let N=io(C[W]);if(N!==C[W]&&l.setFieldValue("linkHref",N),k==="#"&&N&&!N.startsWith("#")&&(N="#"+N),N.startsWith("mailto:")){const J=l.getFieldValue("subject"),Z=l.getFieldValue("body");F={[W]:vi(N,J,Z)}}else F={[W]:N};Gt(N,b);break;case"subject":case"body":const T=l.getFieldValue("linkHref")||"";if(T.substring(0,7)==="mailto:"){const J=T.split("?")[0],Z=W==="subject"?C[W]:l.getFieldValue("subject"),se=W==="body"?C[W]:l.getFieldValue("body"),te=[];Z&&te.push(`subject=${encodeURIComponent(Z)}`),se&&te.push(`body=${encodeURIComponent(se)}`),F={linkHref:te.length>0?`${J}?${te.join("&")}`:J}}else return;break;default:F=C}a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:F}),v({...e,list:{...e.list,bulletsColor:l.getFieldValue("ColorBullets"),bulletFontFamily:l.getFieldValue("BulletsFontFamily"),bulletFontSize:l.getFieldValue("BulletsSize"),betweenParagraphs:l.getFieldValue("SpacingBetweenParagraphs"),betweenRowCell:l.getFieldValue("SpacingBetweenBulletsAndText"),bulletType:E.find(N=>N.code===l.getFieldValue("BulletType"))?.symbol??E[0].symbol},...F,activateSection:null,changeKey:W})};return(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:P,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:[!_&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(n==="mobile"&&!_&&c.styles)&&(0,t.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:_?(0,t.jsx)(Ci,{form:l,elementSettings:e}):(0,t.jsx)(Bo,{form:l,fillFields:A,elementSettings:e,linkProtocol:k,setLinkProtocol:b,isBulletFontColorChecked:h,setIsBulletFontColorChecked:y})}),!_&&(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:n==="mobile"&&c.styles?"block":"none"},children:[(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Go,{form:l,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,t.jsx)(Bo,{form:l,fillFields:A,elementSettings:e,linkProtocol:k,setLinkProtocol:b}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Qr,{})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileLineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})]})]})]})},Pi=(e,i)=>{const{__:r}=s.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{title:r("During export, the element is converted into an image."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$Switch,{id:"convert-in-image",label:r("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})})},"exportAsPicture")},es={marginBottom:10},ts={position:"relative",top:2};function Hn(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var ao=({form:e,showRounding:i=!1,showBackground:r=!1})=>{const{__:a}=s.useI18n(),l=Hn(o.ui_kit$Form.useWatch("backgroundImage",e));return(0,t.jsxs)(t.Fragment,{children:[i&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Adds bulletproof VML markup so the button keeps rounded corners in Outlook."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"outlookRounding",valuePropName:"checked",className:"form-item-margin-xs",style:es,children:(0,t.jsx)(o.ui_kit$Switch,{id:"outlook-rounding",label:a("Rounded corners in Outlook (VML)"),size:"small",labelStyle:ts})})},"outlookRounding"),r&&l&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Adds VML markup so the background image is visible in Outlook."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"outlookBackground",valuePropName:"checked",className:"form-item-margin-xs",style:es,children:(0,t.jsx)(o.ui_kit$Switch,{id:"outlook-background",label:a("Background image in Outlook (VML)"),size:"small",labelStyle:ts})})},"outlookBackground")]})};ao.propTypes={form:g.default.object,showRounding:g.default.bool,showBackground:g.default.bool};var os=({form:e,elementSettings:i,boxShadow:r,bordersShow:a,borderRadiusShow:l,boxShadowShow:n,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:f,backgroundSizeOptions:_,sizeShow:k,modificationShow:b,oneBorderRadiusValue:h,setOneBorderRadiusValue:y,toggleShowBorderHandler:x,toggleShowBorderRadiusHandler:E,toggleShowBoxShadowHandler:w,toggleShowSizeHandler:I,toggleShowBackgroundHandler:A,toggleShowModificationHandler:v})=>{const{__:P}=s.useI18n(),C=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(zt,{form:e,elementSettings:i,tooltipTitle:P("The align attribute sets the horizontal alignment of the table.")})}),(0,t.jsx)(o.ui_kit$FormSection,{title:P("Size"),collapsible:!0,open:k,onToggle:I,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:Mt,minWidthDimensionSelect:Mt,maxWidthDimensionSelect:Mt,rowStyle:{marginBottom:4},labels:{width:P("Width"),height:P("Height"),minWidth:P("Minimum width"),maxWidth:P("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:P("Background"),collapsible:!0,open:c,onToggle:A,dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{imageEnabled:C.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:m,usedColors:i.usedColors,colorPlaceholder:P("Background color"),horizontalPositionPlaceholder:P("Horizontal position"),horizontalPositionTooltip:P("Horizontal position"),verticalPositionPlaceholder:P("Vertical position"),verticalPositionTooltip:P("Vertical position"),backgroundRepeatTooltip:P("Background image repeat"),backgroundSizeTooltip:P("Background image size"),selectPlaceholder:P("Please choose"),backgroundRepeatOptions:f,backgroundSizeOptions:_,imageUploadSlot:C.formTableFieldBackgroundImageEnabled?(0,t.jsx)(Ot,{form:e,label:P("Background image"),name:"backgroundImage",tooltipTitle:P("Background image"),placeholder:P("Background image link/route")}):void 0}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),C.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Borders"),collapsible:!0,open:a,onToggle:x,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Border radius"),collapsible:!0,open:l,onToggle:E,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:y,elementSettings:i})}),C.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Box shadow"),collapsible:!0,open:n,onToggle:w,dividerTop:!0,children:(0,t.jsx)(It,{})}),C.formFieldExportAsPictureEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Export settings"),collapsible:!0,open:b,onToggle:v,dividerTop:!0,children:(0,t.jsx)(Pi,{form:e,elementSettings:i})}),C.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};os.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,sizeShow:g.default.bool,modificationShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func};var is=({form:e,elementSettings:i,label:r})=>{const{__:a}=s.useI18n();(0,d.useRef)();const[l,n]=(0,d.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,o.ui_kit$useToken)(),m=s.useSendPostMessage(),f=k=>{e.setFieldsValue({mobileBackgroundColor:""}),n(b=>!b),m({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:l?"":"none"}}})},_=k=>{n(!1)};return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Background color"),placement:"left",children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundColor",style:{marginBottom:c.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{onChange:_,placeholder:r,usedColors:i.usedColors})}),(0,t.jsx)(o.ui_kit$Switch,{id:"without-background-color",label:a("Without background color"),labelSize:"small",size:"small",checked:l,onChange:f})]})})};is.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired};var Yo={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"}]},Ai={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-"},uo="none",Wn=/^(https?:)?\/\//i,zn=/^(\d*\.?\d+)(%|px)$/;function Gn(e){return e in Ai}function rs(e){return Wn.test(e.trim())}function Ni(e,i){const r=Ai[e],a=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?a&&a!==uo&&!rs(a)?null:{[e]:[{classNamePrefix:r,value:a,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:r,value:a||uo}}:{[e]:{classNamePrefix:r,value:a}}}function To(e){const[i]=Object.keys(e??{});return!i||!Gn(i)?null:Ni(i,e[i])}function Yn(){return Object.keys(Ai).reduce((e,i)=>({...e,...Ni(i,"")}),{})}function ss(e){const i=(e??"").trim(),r=i.match(zn);return r?{position:r[1],unit:r[2]}:{position:i,unit:"px"}}function as(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Xt(e){const i=e??{},r=i.customTable??i;return{type:i.type,usedColors:i.usedColors,mobileBackgroundColor:r.mobileBackgroundColor,mobileBackgroundImage:r.mobileBackgroundImage,mobileBackgroundPositionX:r.mobileBackgroundPositionX,mobileBackgroundPositionY:r.mobileBackgroundPositionY,mobileBackgroundRepeat:r.mobileBackgroundRepeat,mobileBackgroundSize:r.mobileBackgroundSize}}function So(e){const i=e??{},r=i.customTable??i,a=r.backgroundSize??"";return{image:r.backgroundImage?.[0]?.value??"",positionX:r.backgroundPositionX??"",positionY:r.backgroundPositionY??"",repeat:r.backgroundRepeat??"",size:a==="auto"?"":a}}function mo(e){const i=Xt(e),r=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:r===uo?"":r,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||uo,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function yo(e){const i=Xt(e),r=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!r&&r!==uo||!!i.mobileBackgroundSize?.value}function Xn(e,i){return e===uo?!1:!!e||!!i}function Ro(e,i,r){e.setFieldsValue({...mo({}),mobileBackgroundColor:""}),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Xt(i).type,settings:Yn()})}var Kn=/^\d*\.?\d+$/,qn={bottom:"auto"},ls={marginBottom:0},Jn=(0,t.jsx)(s.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal}),Qn=(0,t.jsx)(s.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical}),Zn=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,ns=({value:e,onChange:i,inheritedValue:r,options:a,placeholder:l,prefix:n})=>{const c=e||r,[m,f]=(0,d.useState)(()=>ss(c));(0,d.useEffect)(()=>{f(h=>as(h.position,h.unit)===c?h:ss(c))},[c]);const _=(0,d.useCallback)((h,y)=>{f({position:h,unit:y});const x=a.some(E=>E.value===h);(h===""||x||Kn.test(h))&&i?.(as(h,y))},[i,a]),k=(0,d.useCallback)(h=>_(h,m.unit),[_,m.unit]),b=(0,d.useCallback)(h=>_(m.position,h),[_,m.position]);return(0,t.jsx)(o.ui_kit$InputSelect,{options:a,position:m.position,setPosition:k,unit:m.unit,setUnit:b,placeholder:l,prefix:n,dropdownStyle:qn,tooltipTitle:l,getTooltipPopupContainer:Zn})},ed=({desktopPositionX:e,desktopPositionY:i})=>{const{__:r}=s.useI18n(),{token:a}=(0,o.ui_kit$useToken)(),l=a.formItemMarginBottomXS,n=(0,d.useMemo)(()=>({marginBottom:l}),[l]);return(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:n,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundPositionX",style:ls,children:(0,t.jsx)(ns,{inheritedValue:e,options:Yo.horizontal,placeholder:r("Horizontal position"),prefix:Jn})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:ls,children:(0,t.jsx)(ns,{inheritedValue:i,options:Yo.vertical,placeholder:r("Vertical position"),prefix:Qn})})})]})},ds=["hover"],cs=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,us=({value:e,emptyValue:i,inheritedValue:r,...a})=>{const l=!!e&&e!==i,n=a.options.some(c=>c.value===r)?r:i;return(0,t.jsx)(o.ui_kit$Select,{...a,value:l?e:n})},td=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:r,desktopSize:a,backgroundRepeatOptions:l,backgroundSizeOptions:n})=>{const{__:c}=s.useI18n(),{token:m}=(0,o.ui_kit$useToken)(),f=m.formItemMarginBottomXS,_=(0,d.useMemo)(()=>({marginBottom:f}),[f]),k=(0,d.useMemo)(()=>({marginBottom:(f??0)*1.5}),[f]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ed,{desktopPositionX:e,desktopPositionY:i}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:k,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:ds,title:c("Background image repeat"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:_,children:(0,t.jsx)(us,{emptyValue:"none",inheritedValue:r,options:l,placeholder:c("Please choose"),getPopupContainer:cs})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:ds,title:c("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:_,children:(0,t.jsx)(us,{emptyValue:"",inheritedValue:a,options:n,placeholder:c("Please choose"),getPopupContainer:cs})})})})]})]})},od=fi,id=({value:e,inheritedImage:i,...r})=>(0,t.jsx)(od,{...r,value:e||i}),rd=e=>/^https?:\/\//i.test(e.trim()),sd=({form:e,name:i="mobileBackgroundImage",placeholder:r="",disabled:a=!1,elementSettings:l,inheritedImage:n="",isImageNone:c=!1,onImageNoneChange:m})=>{const{__:f}=s.useI18n(),{token:_}=(0,o.ui_kit$useToken)(),k=o.ui_kit$Form.useWatch(i,e),[b,h]=(0,d.useState)(""),y=k||n,x=_.formItemMarginBottomXS??0,E=(0,d.useMemo)(()=>({marginBottom:x/2}),[x]);(0,d.useEffect)(()=>{if(!y){h("");return}h(rd(y)?"validating":"success")},[y]);const w=!!k&&!rs(k),I=w?"error":b;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:I,help:w?f("Enter a URL starting with http:// or https://"):void 0,style:E,children:(0,t.jsx)(id,{inheritedImage:n,validateStatus:I,placeholder:r,name:i,disabled:a,elementSettings:l,imageInfo:l,onRemotePreviewValidate:h})}),(0,t.jsx)(o.ui_kit$Switch,{label:f("Without image"),labelSize:"small",size:"small",checked:c,onChange:m})]})},ad={image:"",positionX:"",positionY:"",repeat:"",size:""},wo=({elementSettings:e,imageEnabled:i=!1,desktopBackground:r=ad})=>{const{__:a}=s.useI18n(),{token:l}=(0,o.ui_kit$useToken)(),n=o.ui_kit$Form.useFormInstance(),c=l.formItemMarginBottomMD,m=s.useSendPostMessage(),f=e.mobileBackgroundImage?.[0]?.value,[_,k]=(0,d.useState)(f==="none"),b=o.ui_kit$Form.useWatch("mobileBackgroundImage",n);(0,d.useEffect)(()=>{k(f==="none")},[f]),(0,d.useEffect)(()=>{b&&k(!1)},[b]);const h=(0,d.useCallback)(P=>{k(P),n.setFieldsValue({mobileBackgroundImage:""}),m({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ni("mobileBackgroundImage",P?"none":"")})},[e.type,n,m]),y=(0,d.useMemo)(()=>[{label:a("Not defined"),value:"none"},{label:a("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:a("Repeat background (repeat)"),value:"repeat"},{label:a("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:a("Repeat background vertically (repeat-y)"),value:"repeat-y"}],[a]),x=(0,d.useMemo)(()=>[{label:a("Not defined"),value:""},{label:a("Contain"),value:"contain"},{label:a("Cover"),value:"cover"}],[a]),E=Xn(_?"none":b,r.image),w=(0,d.useMemo)(()=>({marginBottom:E?c:0}),[c,E]),I=(0,d.useMemo)(()=>(0,t.jsx)("div",{style:w,children:(0,t.jsx)(is,{form:n,elementSettings:e,label:a("Background color")})}),[a,e,n,w]),A=(0,d.useMemo)(()=>(0,t.jsx)("div",{style:w,children:(0,t.jsx)(sd,{form:n,placeholder:a("Background image"),elementSettings:e,inheritedImage:_?"":r.image,isImageNone:_,onImageNoneChange:h})}),[a,r.image,e,n,h,_,w]),v=(0,d.useMemo)(()=>(0,t.jsx)(td,{desktopPositionX:r.positionX,desktopPositionY:r.positionY,desktopRepeat:r.repeat,desktopSize:r.size,backgroundRepeatOptions:y,backgroundSizeOptions:x}),[y,x,r.positionX,r.positionY,r.repeat,r.size]);return(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:I,imageEnabled:i,backgroundImageEmpty:!E,imageUploadSlot:A,imageControlsSlot:v,usedColors:e.usedColors})},ms=({form:e,elementSettings:i,mobileBoxShadow:r,mobileBordersShow:a,mobileBorderRadiusShow:l,mobileBoxShadowShow:n,mobileSizeShow:c,mobileBackgroundShow:m,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:_,toggleShowMobileBorderHandler:k,toggleShowMobileBorderRadiusHandler:b,toggleShowMobileBoxShadowHandler:h,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:x})=>{const{__:E}=s.useI18n(),{token:w}=(0,o.ui_kit$useToken)(),I=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(zt,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,t.jsx)(o.ui_kit$FormSection,{title:E("Size"),collapsible:!0,open:c,onToggle:y,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:E("Table width"),placement:"left",children:(0,t.jsx)("div",{style:{marginBottom:w.formItemMarginBottomMD+4},children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,t.jsx)(o.ui_kit$FormSection,{title:E("Background"),collapsible:!0,open:m,onToggle:x,dividerTop:!0,children:(0,t.jsx)(wo,{elementSettings:Xt(i),imageEnabled:I.formTableFieldBackgroundImageEnabled,desktopBackground:So(i)})}),I.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("Borders"),collapsible:!0,open:a,onToggle:k,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),I.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("Border radius"),collapsible:!0,open:l,onToggle:b,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:f,setOneBorderRadiusValue:_,elementSettings:i})}),I.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("Box shadow"),collapsible:!0,open:n,onToggle:h,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile",form:e,elementSettings:i})}),I.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),I.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:E("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};ms.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func};var ps=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=Dt(),n=Dt(),c=s.useDispatch(),m=s.useElementEntityKind(),[f,_]=(0,d.useState)({}),[k,b]=(0,d.useState)(!0),[h,y]=(0,d.useState)({}),[x,E]=(0,d.useState)(!0),w=s.useSelector(s.selectEmailViewType),I=s.useSelector(s.selectMobileViewActive);s.useAppConfig();const[A,v]=(0,d.useState)(e.backgroundImage[0].value===""),P=s.useSelector(s.selectIsCodeMode),C=s.useSelector(s.selectCodeModeDirection),Y=P&&C!=="bottom",[W,F]=(0,d.useState)(!1),[N,T]=(0,d.useState)(!1),[J,Z]=(0,d.useState)(!1),[se,te]=(0,d.useState)(!1),[ne,_e]=(0,d.useState)(!1),[le,fe]=(0,d.useState)(!1),[Ae,ce]=(0,d.useState)(!1),[$e,Ce]=(0,d.useState)(!1),[ie,Be]=(0,d.useState)(!1),[ae,oe]=(0,d.useState)(!1),[me,de]=(0,d.useState)(!1),Q=[{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"}],q=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],z=D=>D&&(D?.width||D?.style||D?.color)?D:"",G=e.border,re=e.mobileBorder,ke=Object.keys(G).find(D=>G[D]?.width||G[D]?.style||G[D]?.color),he=Object.keys(re).find(D=>re[D]?.width||re[D]?.style||re[D]?.color),{remember:Pe,fillFields:ye}=co(e);(0,d.useEffect)(()=>{if(e){const D=e.boxShadow,ue=e.mobileBoxShadow;_(D),y(ue),ye(a,{...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:pt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:z(e.mobileBorder.all)||!(z(e.mobileBorder.top)||z(e.mobileBorder.bottom)||z(e.mobileBorder.right)||z(e.mobileBorder.left))&&z(e.border.all),mobileBorderTop:z(e.mobileBorder.top)||!z(e.mobileBorder.all)&&z(e.border.top),mobileBorderBottom:z(e.mobileBorder.bottom)||!z(e.mobileBorder.all)&&z(e.border.bottom),mobileBorderRight:z(e.mobileBorder.right)||!z(e.mobileBorder.all)&&z(e.border.right),mobileBorderLeft:z(e.mobileBorder.left)||!z(e.mobileBorder.all)&&z(e.border.left),mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...mo(e),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?b(!1):b(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?E(!1):E(!0),v(e.backgroundImage[0].value==="");const ge=l.isStaleBorderSnapshot(e,!!ke),Oe=n.isStaleBorderSnapshot(e,!!he);ge&&a.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Oe||ge&&!he)&&a.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),F(Ge=>ke&&!ge?!0:Ge),T(Ge=>ke&&!ge||he&&!Oe?!0:Ge),Z(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),te(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),_e(!!e.boxShadow),fe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ce(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Ce(!!e.mobileWidth.value),Be(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),oe(yo(e)),de(!!e.exportAsPicture)}},[a,e,ke,he,l,n]);const V=(0,d.useCallback)(D=>{Pe(D),c(m==="email"?s.setElementSettings$1(D):s.setElementSettings(D))},[c,m,Pe]),ee=D=>{const ue=a.getFieldsValue(!0),ge=Object.keys(D)[0];let Oe;switch(ge){case"exportAsPicture":Oe={exportAsPicture:ue.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Oe={boxShadow:{hOffset:ue.boxShadowHOffset,vOffset:ue.boxShadowVOffset,blurRadius:ue.boxShadowBlurRadius,spreadRadius:ue.boxShadowSpreadRadius,color:ue.boxShadowColor,inset:ue.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ue.borderPosition==="borderAll"?(Oe={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...ue.borderAll}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):ue.borderAll?.width||ue.borderAll?.style||ue.borderAll?.color?(Oe={border:{all:null,left:ue.borderAll,right:ue.borderAll,top:ue.borderAll,bottom:ue.borderAll,[H.REVERSE_BORDER_POSITIONS[ge]]:{...ue[ge],...D[ge]}}},a.setFieldsValue({borderAll:null,borderLeft:ue.borderAll,borderRight:ue.borderAll,borderTop:ue.borderAll,borderBottom:ue.borderAll,[ge]:{...ue[ge],...D[ge]}})):(Oe={border:{all:null,left:ue.borderLeft,right:ue.borderRight,top:ue.borderTop,bottom:ue.borderBottom,[H.REVERSE_BORDER_POSITIONS[ge]]:{...ue[ge],...D[ge]}}},a.setFieldsValue({border:Oe.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ue.mobileBorderPosition==="mobileBorderAll")Oe={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...ue.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[ge]+"-"}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const Ge=H.MOBILE_REVERSE_BORDER_POSITIONS[ge],Ye={...ue[ge],...D[ge]},Xe=!Ye?.width&&!Ye?.style&&!Ye?.color;if(ue.mobileBorder?.all?.width||ue.mobileBorder?.all?.style||ue.mobileBorder?.all?.color){const R=ue.mobileBorderAll;Oe={mobileBorder:{all:null,left:R,right:R,top:R,bottom:R,[Ge]:Xe?null:{...Ye,classNamePrefix:"em-mob-border_"+Ge+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:R,mobileBorderRight:R,mobileBorderTop:R,mobileBorderBottom:R,[ge]:Ye})}else{const R=e.mobileBorder||{},X=j=>{const M=R[j];return M&&(M?.width||M?.style||M?.color)?M:null};Oe={mobileBorder:{all:null,left:Ge==="left"?Xe?null:{...Ye,classNamePrefix:"em-mob-border_left-"}:X("left"),right:Ge==="right"?Xe?null:{...Ye,classNamePrefix:"em-mob-border_right-"}:X("right"),top:Ge==="top"?Xe?null:{...Ye,classNamePrefix:"em-mob-border_top-"}:X("top"),bottom:Ge==="bottom"?Xe?null:{...Ye,classNamePrefix:"em-mob-border_bottom-"}:X("bottom")}},a.setFieldsValue({[ge]:Ye})}}break;case"width":Oe={[ge]:{value:D[ge],dim:ue.widthDim}};break;case"widthDim":Oe={width:{value:ue.width,dim:D[ge]}};break;case"maxWidth":Oe={[ge]:{value:D[ge],dim:ue.maxWidthDim}};break;case"maxWidthDim":Oe={maxWidth:{value:ue.maxWidth,dim:D[ge]}};break;case"minWidth":Oe={[ge]:{value:D[ge],dim:ue.minWidthDim}};break;case"minWidthDim":Oe={minWidth:{value:ue.minWidth,dim:D[ge]}};break;case"backgroundImage":v(D[ge]===""),Oe={[ge]:[{...e.backgroundImage[0],value:D[ge]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Oe={borderRadius:{[H.BORDER_RADIUS_POSITION[ge]]:+D[ge]}};break;case"mobileWidth":Oe={[ge]:{classNamePrefix:"em-mob-width-",value:D[ge],dim:ue.mobileWidthDim}};break;case"mobileWidthDim":Oe={mobileWidth:{classNamePrefix:"em-mob-width-",value:ue.mobileWidth||100,dim:D[ge]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Oe={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[ge]]:D[ge],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[ge]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Oe={mobileBoxShadow:{hOffset:ue.mobileBoxShadowHOffset,vOffset:ue.mobileBoxShadowVOffset,blurRadius:ue.mobileBoxShadowBlurRadius,spreadRadius:ue.mobileBoxShadowSpreadRadius,color:ue.mobileBoxShadowColor,inset:ue.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Oe=To(D),!Oe)return;break;case"mobileAlign":Oe={[ge]:{classNamePrefix:"em-mob-table_align-",value:D[ge]}};break;default:Oe=D}ge!=="borderPosition"&&ge!=="mobileBorderPosition"&&(r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Oe}),ge!=="mobileBorderRadiusAll"&&ge!=="mobileBorderRadiusTopLeft"&&ge!=="mobileBorderRadiusTopRight"&&ge!=="mobileBorderRadiusBottomLeft"&&ge!=="mobileBorderRadiusBottomRight"&&V({...e,...Oe,mobileBorderRadius:{...e.mobileBorderRadius,...Oe?.mobileBorderRadius},activateSection:null,changeKey:ge}))},we=()=>{const D=a.getFieldsValue(!0);l.markBorderToggled(!W),setTimeout(()=>{F(ue=>!ue),W?(D.borderAll=H.NULL_BORDER,D.borderTop=H.NULL_BORDER,D.borderBottom=H.NULL_BORDER,D.borderRight=H.NULL_BORDER,D.borderLeft=H.NULL_BORDER):D.borderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:D.borderAll.color,style:D.borderAll.style,width:D.borderAll.width}}}})})},je=()=>{const D=a.getFieldsValue(!0);n.markBorderToggled(!N),setTimeout(()=>{T(ue=>!ue),N?(D.mobileBorderAll=H.NULL_BORDER,D.mobileBorderTop=H.NULL_BORDER,D.mobileBorderBottom=H.NULL_BORDER,D.mobileBorderRight=H.NULL_BORDER,D.mobileBorderLeft=H.NULL_BORDER):D.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:D.mobileBorderAll.color,style:D.mobileBorderAll.style,width:D.mobileBorderAll.width}}}})})},K=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{Z(ue=>!ue),J?(D.borderRadiusAll=0,b(!0)):D.borderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:D.borderRadiusAll}}})})},ve=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{te(ue=>!ue),se?(D.mobileBorderRadiusAll=null,E(!0)):D.mobileBorderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:D.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Re=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{_e(ue=>!ue),ne?(D.boxShadowInset=!1,D.boxShadowHOffset=null,D.boxShadowVOffset=null,D.boxShadowBlurRadius=null,D.boxShadowSpreadRadius=null,D.boxShadowColor=""):(D.boxShadowInset=!1,D.boxShadowHOffset=5,D.boxShadowVOffset=5,D.boxShadowBlurRadius=10,D.boxShadowSpreadRadius=-5,D.boxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:D.boxShadowBlurRadius,color:D.boxShadowColor,hOffset:D.boxShadowHOffset,inset:D.boxShadowInset,spreadRadius:D.boxShadowSpreadRadius,vOffset:D.boxShadowVOffset}}})})},Le=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{fe(ue=>!ue),le?(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=null,D.mobileBoxShadowVOffset=null,D.mobileBoxShadowBlurRadius=null,D.mobileBoxShadowSpreadRadius=null,D.mobileBoxShadowColor=""):(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=5,D.mobileBoxShadowVOffset=5,D.mobileBoxShadowBlurRadius=10,D.mobileBoxShadowSpreadRadius=-5,D.mobileBoxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:D.mobileBoxShadowBlurRadius,color:D.mobileBoxShadowColor,hOffset:D.mobileBoxShadowHOffset,inset:D.mobileBoxShadowInset,spreadRadius:D.mobileBoxShadowSpreadRadius,vOffset:D.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Ue=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{ce(ue=>!ue),Ae&&(D.width="",D.minWidth="",D.maxWidth="",r({operation:s.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"}}}))})},Me=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{Ce(ue=>!ue),$e&&(D.mobileWidth="",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},He=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{Be(ue=>!ue),ie?(D.backgroundColor="",D.backgroundImage="",D.backgroundPositionX="",D.backgroundPositionY="",D.backgroundRepeat="none",D.backgroundSize="",v(!0)):(D.backgroundColor="#E5E5E5",D.backgroundSize="",D.backgroundRepeat="none"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:D.backgroundColor,backgroundImage:[{type:"url",value:D.backgroundImage}],backgroundPositionX:D.backgroundPositionX,backgroundPositionY:D.backgroundPositionY,backgroundRepeat:D.backgroundRepeat,backgroundSize:D.backgroundSize}})})},O=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{oe(ue=>!ue),ae?D.mobileBackgroundColor="":D.mobileBackgroundColor="#E5E5E5",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:D.mobileBackgroundColor}}}),ae&&Ro(a,e,r)})},xe=()=>{const D=a.getFieldsValue(!0);setTimeout(()=>{de(ue=>!ue),me&&(D.exportAsPicture=!1,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})};return(0,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_table_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:H.BORDER_POSITIONS[ke]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[he]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:ee,autoComplete:"off",className:"element-controls",children:[!Y&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),w==="mobile"&&I.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(ms,{form:a,elementSettings:e,mobileBoxShadow:h,mobileBordersShow:N,mobileBorderRadiusShow:se,mobileBoxShadowShow:le,mobileSizeShow:$e,mobileBackgroundShow:ae,oneMobileBorderRadiusValue:x,setOneMobileBorderRadiusValue:E,toggleShowMobileBorderHandler:je,toggleShowMobileBorderRadiusHandler:ve,toggleShowMobileBoxShadowHandler:Le,toggleShowMobileSizeHandler:Me,toggleShowMobileBackgroundHandler:O})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(os,{form:a,elementSettings:e,boxShadow:f,bordersShow:W,borderRadiusShow:J,boxShadowShow:ne,backgroundShow:ie,backgroundImageEmpty:A,backgroundRepeatOptions:Q,backgroundSizeOptions:q,sizeShow:Ae,modificationShow:me,oneBorderRadiusValue:k,setOneBorderRadiusValue:b,toggleShowBorderHandler:we,toggleShowBorderRadiusHandler:K,toggleShowBoxShadowHandler:Re,toggleShowSizeHandler:Ue,toggleShowBackgroundHandler:He,toggleShowModificationHandler:xe})})]})};ps.propTypes={elementSettings:g.default.object.isRequired};var hs=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=s.useAppConfig(),n=s.useSelector(s.selectIsCodeMode),c=s.useSelector(s.selectCodeModeDirection),[m,f]=(0,d.useState)({}),[_,k]=(0,d.useState)("https://"),b=({target:x})=>{const{selectionStart:E,selectionEnd:w}=x;x&&f({target:x,selection:{start:E,end:w}})};(0,d.useEffect)(()=>{if(e){let x="",E="",w=e.href==null?"https://":e.href;if(w&&w.substring(0,7)==="mailto:"){const I=new URL(e.href);x=I.searchParams.get("subject")||"",E=I.searchParams.get("body")||"",w=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(""));a.setFieldsValue({...e,href:w,subject:x,body:E})}},[a,e]);const h=x=>{const E=Object.keys(x)[0];let w=x;if(E==="href"){const I=io(x[E]);if(I!==x[E]&&a.setFieldValue("href",I),I.substring(0,7)==="mailto:"){const A=a.getFieldValue("subject"),v=a.getFieldValue("body"),P=[];A&&P.push(`subject=${encodeURIComponent(A)}`),v&&P.push(`body=${encodeURIComponent(v)}`),w={href:P.length>0?`${I}?${P.join("&")}`:I}}else w={href:I}}if(E==="subject"||E==="body"){const I=a.getFieldValue("href")||"";if(I.substring(0,7)==="mailto:"){const A=I.split("?")[0],v=E==="subject"?x[E]:a.getFieldValue("subject"),P=E==="body"?x[E]:a.getFieldValue("body"),C=[];v&&C.push(`subject=${encodeURIComponent(v)}`),P&&C.push(`body=${encodeURIComponent(P)}`),w={href:C.length>0?`${A}?${C.join("&")}`:A}}else return}r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:w})},y=x=>{r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:x})};return(0,t.jsx)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:h,autoComplete:"off",className:"element-controls",children:!n||c==="bottom"?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined}),onSelect:b})})}),l.formLinkFieldInsertImageEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:i("Actions with the chosen text"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"PicLeftOutlined",component:o.icons$PicLeftOutlined}),onClick:()=>y("add_img"),children:i("Add inline image")})})}),(0,t.jsx)(Bo,{form:a,elementSettings:e,showAddParagraph:!1,linkTarget:m,linkProtocol:_,setLinkProtocol:k})]}):(0,t.jsx)(Ci,{form:a,elementSettings:e,showAddParagraph:!1})})};hs.propTypes={elementSettings:g.default.object.isRequired};var bs=()=>{const{__:e}=s.useI18n();return(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:14,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"height",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:e("Indent height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})};bs.propTypes={};var fs=({form:e,elementSettings:i})=>(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i})})});fs.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var gs=({elementSettings:e})=>{const{__:i}=s.useI18n(),[r]=o.ui_kit$Form.useForm(),a=s.useDispatch(),l=s.useSendPostMessage(),n=s.useSelector(s.selectEmailViewType),c=s.useSelector(s.selectMobileViewActive),m=s.useSelector(s.selectIsCodeMode),f=s.useSelector(s.selectCodeModeDirection),_=m&&f!=="bottom",k=s.useElementEntityKind(),{remember:b,fillFields:h}=co(e);(0,d.useEffect)(()=>{e&&h(r,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:pt(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[r,e]);const y=(0,d.useCallback)(E=>{b(E),a(k==="email"?s.setElementSettings$1(E):s.setElementSettings(E))},[a,k,b]),x=E=>{const w=r.getFieldsValue(!0),I=Object.keys(E)[0];let A;switch(I){case"height":A={[I]:{value:E[I],dim:w.heightDim}};break;case"heightDim":A={height:{value:w.height,dim:E[I]}};break;case"mobileHeight":A={[I]:{classNamePrefix:"em-mob-height-",value:E[I],dim:w.mobileHeightDim}};break;case"mobileHeightDim":A={mobileHeight:{classNamePrefix:"em-mob-height-",value:w.mobileHeight,dim:E[I]}};break;default:A=E}l({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:A}),y({...e,...A,activateSection:null,changeKey:I})};return(0,t.jsxs)(o.ui_kit$Form,{form:r,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:x,autoComplete:"off",children:[!_&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),n==="mobile"&&c.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:n==="mobile"&&c.styles?"block":"none",marginBottom:10},children:(0,t.jsx)(fs,{form:r,elementSettings:e})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",style:{display:n==="mobile"&&c.styles?"none":"block"},children:(0,t.jsx)(bs,{})})]})};gs.propTypes={elementSettings:g.default.object.isRequired};var Xo=({form:e,elementSettings:i,typeOfForm:r="desktop"})=>{const a=s.useSendPostMessage(),l=r==="mobile",n=l?"mobileDirection":"direction",c=f=>{e.setFieldsValue({[n]:f}),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[n]:f}})},m=l?i.mobileDirection?.value??"":i.direction??"";return(0,t.jsx)(o.ui_kit$Form.Item,{name:n,className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$FormDirectionControl,{value:m,onChange:c})})},Ko=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,Li=({form:e,backgroundImageEmpty:i,appConfig:r,token:a,elementSettings:l,backgroundRepeatOptions:n,handleChangeValues:c})=>{const{__:m}=s.useI18n(),[f,_]=(0,d.useState)(""),[k,b]=(0,d.useState)("px"),[h,y]=(0,d.useState)(""),[x,E]=(0,d.useState)("px"),w=[{label:m("Not defined"),value:""},{label:m("Contain"),value:"contain"},{label:m("Cover"),value:"cover"}],I=P=>{if(!P||typeof P!="string")return{value:"",unit:"px"};P=P.trim();const C=P.match(/^(\d*\.?\d+)(%|px)$/);return C?{value:C[1],unit:C[2]}:{value:P,unit:"px"}};(0,d.useEffect)(()=>{const P=e.getFieldValue("backgroundPositionX"),C=e.getFieldValue("backgroundPositionY"),Y=I(P),W=I(C);_(String(Y.value)),b(Y.unit),y(String(W.value)),E(W.unit)},[e]);const A=(P,C)=>{_(String(P)),b(C),c&&c({backgroundPositionX:{position:P,unit:C}})},v=(P,C)=>{y(String(P)),E(C),c&&c({backgroundPositionY:{position:P,unit:C}})};return(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:m("Background color"),placement:"bottom",getPopupContainer:Ko,children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:a.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:m("Background color"),usedColors:l.usedColors,placement:"bottomLeft"})})})})}),r.formCellFieldBackgroundImageEnabled&&(0,t.jsxs)(o.ui_kit$Col,{span:i?12:24,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image"),placement:"bottom",getPopupContainer:Ko,children:(0,t.jsx)("div",{children:(0,t.jsx)(Ot,{form:e,label:m("Background image"),name:"backgroundImage",tooltipTitle:m("Background image"),placeholder:m("Background image link/route")})})}),!i&&(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:a.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$InputSelect,{options:Yo.horizontal,position:f,setPosition:P=>A(P,k),unit:k,setUnit:P=>A(f,P),placeholder:m("Horizontal position"),prefix:(0,t.jsx)(s.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Horizontal position"),getTooltipPopupContainer:Ko})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$InputSelect,{options:Yo.vertical,position:h,setPosition:P=>v(P,x),unit:x,setUnit:P=>v(h,P),placeholder:m("Vertical position"),prefix:(0,t.jsx)(s.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Vertical position"),getTooltipPopupContainer:Ko})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image repeat"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:a.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:m("Please choose"),options:n,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:a.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:m("Please choose"),options:w,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},ld=({form:e,elementSettings:i,__:r,appConfig:a})=>{const l=H.useGoogleFontsLoader(),[n,c]=(0,d.useState)(null);return(0,d.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,t.jsxs)("div",{style:{marginBottom:"-15px"},children:[a.formTextFieldTypografEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Text font"),placement:"bottom",zIndex:1,getPopupContainer:m=>m.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:l,getPopupContainer:m=>m.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:r("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:r("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:r(n?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:r(n?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:r(n?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:r(n?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Text color"),placement:"bottom",zIndex:2,getPopupContainer:m=>m.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:r("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:r("Color"),usedColors:i.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Text background"),placement:"bottom",zIndex:2,getPopupContainer:m=>m.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:r("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:r("Background color"),usedColors:i.usedColors})})})})]})]})},_s=({form:e,elementSettings:i,boxShadow:r,bordersShow:a,borderRadiusShow:l,boxShadowShow:n,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:f,sizeShow:_,maxWidthValue:k,modificationShow:b,paddingsExt:h,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,elementListShow:E,togglePaddingHandler:w,toggleShowBorderHandler:I,toggleShowBorderRadiusHandler:A,toggleShowBoxShadowHandler:v,toggleShowSizeHandler:P,toggleShowBackgroundHandler:C,toggleShowModificationHandler:Y,handleChangeValues:W})=>{const{__:F}=s.useI18n(),{token:N}=(0,o.ui_kit$useToken)(),T=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(so,{form:e,elementSettings:i})}),T.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:i})})]}),T.formCellFieldPaddingsEnabled&&(0,t.jsxs)(t.Fragment,{children:[E&&(0,t.jsx)("div",{style:{marginTop:"15px"},children:(0,t.jsx)(ld,{form:e,elementSettings:i,appConfig:T,__:F})}),(0,t.jsx)(o.ui_kit$FormSection,{title:F("Padding"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:w,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"&&T.formCellFieldSizeEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Size"),collapsible:!0,open:_,onToggle:P,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:k,dimensionSelect:Mt,rowStyle:{paddingBottom:4},labels:{width:F("Width"),height:F("Height"),minWidth:F("Minimum width"),maxWidth:F("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:F("Background"),collapsible:!0,open:c,onToggle:C,dividerTop:!0,children:[(0,t.jsx)(Li,{form:e,backgroundImageEmpty:m,appConfig:T,token:N,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:W}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),T.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Borders"),collapsible:!0,open:a,onToggle:I,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),T.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Border radius"),collapsible:!0,open:l,onToggle:A,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,elementSettings:i})}),T.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Box shadow"),collapsible:!0,open:n,onToggle:v,dividerTop:!0,children:(0,t.jsx)(It,{})}),T.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,t.jsxs)(o.ui_kit$FormSection,{title:F("Settings"),collapsible:!0,open:b,onToggle:Y,dividerTop:!0,children:[i.type==="structure"&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Form.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0},children:(0,t.jsx)(o.ui_kit$Switch,{id:"contrast-colors",label:F("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,t.jsx)(Pi,{form:e,elementSettings:i})]}),T.formFieldVisibilityEnabled&&i.type!=="column"&&(0,t.jsx)(o.ui_kit$FormSection,{title:F(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,t.jsx)(Xo,{elementSettings:i,form:e}):void 0})}),T.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};_s.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,elementListShow:g.default.bool,togglePaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var qo=({form:e,elementSettings:i,mobilePaddingsExt:r,setMobilePaddingsExt:a,rowStyle:l})=>{const{__:n}=s.useI18n(),c=s.useSendPostMessage(),m=()=>{a(_=>!_);const f=e.getFieldsValue(!0);r||(f.mobilePaddingLeftRight=f.mobilePaddingLeft,f.mobilePaddingTopBottom=f.mobilePaddingTop,f.mobilePaddingRight=f.mobilePaddingLeft,f.mobilePaddingBottom=f.mobilePaddingTop,c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:f.mobilePaddingTop!==""?f.mobilePaddingTop:null,bottom:f.mobilePaddingTopBottom!==""?f.mobilePaddingTopBottom:null,left:f.mobilePaddingLeft!==""?f.mobilePaddingLeft:null,right:f.mobilePaddingRight!==""?f.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,t.jsx)(o.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:r,onToggleExtended:m,showHorizontal:!0,gutter:10,rowStyle:l,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")}})};qo.propTypes={form:g.default.shape({getFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,mobilePaddingsExt:g.default.bool.isRequired,setMobilePaddingsExt:g.default.func.isRequired,rowStyle:g.default.object};var xs=({form:e,elementSettings:i,boxShadow:r,mobileBordersShow:a,mobileBorderRadiusShow:l,mobileBoxShadowShow:n,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:f,mobilePaddingsExt:_,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:y,toggleShowMobileBorderRadiusHandler:x,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:I,toggleShowMobilePaddingHandler:A})=>{const{__:v}=s.useI18n(),P=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),P.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),P.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Padding"),collapsible:!0,open:f,onToggle:A,dividerTop:!0,children:(0,t.jsx)(qo,{form:e,elementSettings:i,mobilePaddingsExt:_,setMobilePaddingsExt:k,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&P.formCellFieldSizeEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Size"),collapsible:!0,open:c,onToggle:w,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:15},children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:15},children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:v("Background"),collapsible:!0,open:m,onToggle:I,dividerTop:!0,children:(0,t.jsx)(wo,{elementSettings:Xt(i),imageEnabled:P.formCellFieldBackgroundImageEnabled,desktopBackground:So(i)})}),P.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Borders"),collapsible:!0,open:a,onToggle:y,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Border radius"),collapsible:!0,open:l,onToggle:x,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i,typeOfForm:"mobile"})}),P.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Box shadow"),collapsible:!0,open:n,onToggle:E,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile"})}),P.formFieldVisibilityEnabled&&i.type!=="column"&&(0,t.jsx)(o.ui_kit$FormSection,{title:v(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,t.jsx)(Xo,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),P.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};xs.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var ks=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),a=s.useDispatch(),[l]=o.ui_kit$Form.useForm(),n=Dt(),c=Dt(),[m,f]=(0,d.useState)(""),[_,k]=(0,d.useState)({}),[b,h]=(0,d.useState)(!0),[y,x]=(0,d.useState)(!0),E=s.useSelector(s.selectEmailViewType),w=s.useSelector(s.selectMobileViewActive);s.useAppConfig();const[I,A]=(0,d.useState)(e.backgroundImage[0].value===""),v=s.useSelector(s.selectIsCodeMode),P=s.useSelector(s.selectCodeModeDirection),C=v&&P!=="bottom",[Y,W]=(0,d.useState)(!1),[F,N]=(0,d.useState)(!1),[T,J]=(0,d.useState)(!1),[Z,se]=(0,d.useState)(!1),[te,ne]=(0,d.useState)(!1),[_e,le]=(0,d.useState)(!1),[fe,Ae]=(0,d.useState)(!1),[ce,$e]=(0,d.useState)(!1),[Ce,ie]=(0,d.useState)(!1),[Be,ae]=(0,d.useState)(!1),[oe,me]=(0,d.useState)(!1),[de,Q]=(0,d.useState)(!1),[q,z]=(0,d.useState)(!1),[G,re]=(0,d.useState)(!1),[ke,he]=(0,d.useState)(!1),Pe=s.useElementEntityKind(),ye=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],V=e.border,ee=e.mobileBorder,we=Object.keys(V).find(j=>V[j]?.width||V[j]?.style||V[j]?.color),je=Object.keys(ee).find(j=>ee[j]?.width||ee[j]?.style||ee[j]?.color),K=j=>j&&(j?.width||j?.style||j?.color)?j:"",{remember:ve,fillFields:Re}=co(e);(0,d.useEffect)(()=>{if(e){const j=e.boxShadow;k(j),Re(l,{...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:K(e.mobileBorder.all)||!(K(e.mobileBorder.top)||K(e.mobileBorder.bottom)||K(e.mobileBorder.right)||K(e.mobileBorder.left))&&K(e.border.all),mobileBorderTop:K(e.mobileBorder.top)||!K(e.mobileBorder.all)&&K(e.border.top),mobileBorderBottom:K(e.mobileBorder.bottom)||!K(e.mobileBorder.all)&&K(e.border.bottom),mobileBorderRight:K(e.mobileBorder.right)||!K(e.mobileBorder.all)&&K(e.border.right),mobileBorderLeft:K(e.mobileBorder.left)||!K(e.mobileBorder.all)&&K(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:pt(e.mobileWidth?.value)||pt(e.width?.value),mobileWidthDim:pt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:pt(e.mobileHeight?.value)||pt(e.height?.value),mobileHeightDim:pt(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||""),...mo(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))?h(!1):h(!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))?x(!1):x(!0),A(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)?W(!1):W(!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)?N(!1):N(!0);const M=n.isStaleBorderSnapshot(e,!!we),Ee=c.isStaleBorderSnapshot(e,!!je);M&&l.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ee||M&&!je)&&l.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),J(Fe=>we&&!M?!0:Fe),se(Fe=>we&&!M||je&&!Ee?!0:Fe),ne(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),le(!!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),$e(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ie(!!e.width.value&&e.type!=="column"||!!e.height.value),ae(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),me(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),yo(e)&&Q(!0),z(!!e.exportAsPicture||!!e.isContrastBlock),re(!!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"?he(!0):he(!1)}},[l,e,we,je,n,c]);const Le=(0,d.useCallback)(j=>{ve(j),a(Pe==="email"?s.setElementSettings$1(j):s.setElementSettings(j))},[a,Pe,ve]),Ue=j=>{const M=l.getFieldsValue(!0),Ee=Object.keys(j)[0];let Fe;switch(f(l.getFieldsValue(!0).widthDim==="%"?100:""),Ee){case"exportAsPicture":Fe={exportAsPicture:M.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Fe={boxShadow:{hOffset:M.boxShadowHOffset,vOffset:M.boxShadowVOffset,blurRadius:M.boxShadowBlurRadius,spreadRadius:M.boxShadowSpreadRadius,color:M.boxShadowColor,inset:M.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":M.borderPosition==="borderAll"?(Fe={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...M.borderAll}}},l.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):M.borderAll?.width||M.borderAll?.style||M.borderAll?.color?(Fe={border:{all:null,left:M.borderAll,right:M.borderAll,top:M.borderAll,bottom:M.borderAll,[H.REVERSE_BORDER_POSITIONS[Ee]]:{...M[Ee],...j[Ee]}}},l.setFieldsValue({borderAll:null,borderLeft:M.borderAll,borderRight:M.borderAll,borderTop:M.borderAll,borderBottom:M.borderAll,[Ee]:{...M[Ee],...j[Ee]}})):(Fe={border:{all:null,left:M.borderLeft,right:M.borderRight,top:M.borderTop,bottom:M.borderBottom,[H.REVERSE_BORDER_POSITIONS[Ee]]:{...M[Ee],...j[Ee]}}},l.setFieldsValue({border:Fe.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(M.mobileBorderPosition==="mobileBorderAll")Fe={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...M.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[Ee]+"-"}}},l.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const tt=H.MOBILE_REVERSE_BORDER_POSITIONS[Ee],qe={...M[Ee],...j[Ee]},ct=!qe?.width&&!qe?.style&&!qe?.color;if(M.mobileBorder?.all?.width||M.mobileBorder?.all?.style||M.mobileBorder?.all?.color){const Ze=M.mobileBorderAll;Fe={mobileBorder:{all:null,left:Ze,right:Ze,top:Ze,bottom:Ze,[tt]:ct?null:{...qe,classNamePrefix:"em-mob-border_"+tt+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Ze,mobileBorderRight:Ze,mobileBorderTop:Ze,mobileBorderBottom:Ze,[Ee]:qe})}else{const Ze=e.mobileBorder||{},ut=Bt=>{const B=Ze[Bt];return B&&(B?.width||B?.style||B?.color)?B:null};Fe={mobileBorder:{all:null,left:tt==="left"?ct?null:{...qe,classNamePrefix:"em-mob-border_left-"}:ut("left"),right:tt==="right"?ct?null:{...qe,classNamePrefix:"em-mob-border_right-"}:ut("right"),top:tt==="top"?ct?null:{...qe,classNamePrefix:"em-mob-border_top-"}:ut("top"),bottom:tt==="bottom"?ct?null:{...qe,classNamePrefix:"em-mob-border_bottom-"}:ut("bottom")}},l.setFieldsValue({[Ee]:qe})}}break;case"width":Fe={[Ee]:{value:j[Ee],dim:M.widthDim}};break;case"height":Fe={[Ee]:{value:j[Ee],dim:M.heightDim}};break;case"widthDim":Fe={width:{value:M.width,dim:j[Ee]}};break;case"heightDim":Fe={height:{value:M.height,dim:j[Ee]}};break;case"backgroundImage":A(j[Ee]===""),Fe={[Ee]:[{...e.backgroundImage[0],value:j[Ee]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Fe={padding:{left:M.paddingLeft,right:M.paddingRight,top:M.paddingTop,bottom:M.paddingBottom,[H.PADDING_POSITION[Ee]]:+j[Ee]}};break;case"paddingTopBottom":Fe={padding:{left:M.paddingLeft,right:M.paddingRight,top:+j[Ee],bottom:+j[Ee]}},M.paddingTop=M.paddingBottom=+j[Ee];break;case"paddingLeftRight":Fe={padding:{top:M.paddingTop,bottom:M.paddingBottom,left:+j[Ee],right:+j[Ee]}},M.paddingLeft=M.paddingRight=+j[Ee];break;case"borderRadiusAll":Fe={borderRadius:{[H.BORDER_RADIUS_POSITION[Ee]]:+j[Ee]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Fe={borderRadius:{topLeft:M.borderRadiusTopLeft,bottomLeft:M.borderRadiusBottomLeft,topRight:M.borderRadiusTopRight,bottomRight:M.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[Ee]]:+j[Ee]}};break;case"mobileWidth":Fe={[Ee]:{classNamePrefix:"em-mob-width-",value:j[Ee],dim:M.mobileWidthDim}};break;case"mobileWidthDim":Fe={mobileWidth:{classNamePrefix:"em-mob-width-",value:M.mobileWidth||100,dim:j[Ee]}};break;case"mobileHeight":Fe={[Ee]:{classNamePrefix:"em-mob-height-",value:j[Ee],dim:M.mobileHeightDim}};break;case"mobileHeightDim":Fe={mobileHeight:{classNamePrefix:"em-mob-height-",value:M.mobileHeight,dim:j[Ee]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Fe={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[Ee]]:j[Ee],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[Ee]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Fe={mobileBoxShadow:{hOffset:M.mobileBoxShadowHOffset,vOffset:M.mobileBoxShadowVOffset,blurRadius:M.mobileBoxShadowBlurRadius,spreadRadius:M.mobileBoxShadowSpreadRadius,color:M.mobileBoxShadowColor,inset:M.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Fe={[Ee]:{classNamePrefix:"em-mob-text_align-",value:j[Ee]}};break;case"mobileVerticalAlign":Fe={[Ee]:{classNamePrefix:"em-mob-vertical_align-",value:j[Ee]}};break;case"mobileDirection":Fe={[Ee]:{classNamePrefix:"em-mob-direction-",value:j[Ee]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Fe=To(j),!Fe)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Fe={mobilePadding:{all:null,top:M.mobilePaddingTop!==""?M.mobilePaddingTop:null,right:M.mobilePaddingRight!==""?M.mobilePaddingRight:null,bottom:M.mobilePaddingBottom!==""?M.mobilePaddingBottom:null,left:M.mobilePaddingLeft!==""?M.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":M.mobilePaddingTop=M.mobilePaddingBottom=j[Ee],Fe={mobilePadding:{all:null,top:M.mobilePaddingTop!==""?M.mobilePaddingTop:null,right:M.mobilePaddingRight!==""?M.mobilePaddingRight:null,bottom:M.mobilePaddingBottom!==""?M.mobilePaddingBottom:null,left:M.mobilePaddingLeft!==""?M.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":M.mobilePaddingLeft=M.mobilePaddingRight=j[Ee],Fe={mobilePadding:{all:null,top:M.mobilePaddingTop!==""?M.mobilePaddingTop:null,right:M.mobilePaddingRight!==""?M.mobilePaddingRight:null,bottom:M.mobilePaddingBottom!==""?M.mobilePaddingBottom:null,left:M.mobilePaddingLeft!==""?M.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":Fe={[Ee]:isNaN(parseFloat(j[Ee].position))?j[Ee].position:j[Ee].position+j[Ee].unit};break;default:Fe=j}Ee!=="borderPosition"&&Ee!=="mobileBorderPosition"&&(r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Fe}),Ee!=="mobileBorderRadiusAll"&&Ee!=="mobileBorderRadiusTopLeft"&&Ee!=="mobileBorderRadiusTopRight"&&Ee!=="mobileBorderRadiusBottomLeft"&&Ee!=="mobileBorderRadiusBottomRight"&&Le({...e,...Fe,mobileBorderRadius:{...e.mobileBorderRadius,...Fe?.mobileBorderRadius},activateSection:null,changeKey:Ee}))},Me=()=>{W(M=>!M);const j=l.getFieldsValue(!0);Y||(j.paddingLeftRight=j.paddingLeft,j.paddingTopBottom=j.paddingTop,j.paddingRight=j.paddingLeft,j.paddingBottom=j.paddingTop,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:j.paddingTopBottom,bottom:j.paddingTopBottom,left:j.paddingLeftRight,right:j.paddingLeftRight}}}))},He=()=>{const j=l.getFieldsValue(!0);n.markBorderToggled(!T),setTimeout(()=>{J(M=>!M),T?(j.borderAll=H.NULL_BORDER,j.borderTop=H.NULL_BORDER,j.borderBottom=H.NULL_BORDER,j.borderRight=H.NULL_BORDER,j.borderLeft=H.NULL_BORDER):j.borderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:j.borderAll.color,style:j.borderAll.style,width:j.borderAll.width}}}})})},O=()=>{const j=l.getFieldsValue(!0);c.markBorderToggled(!Z),setTimeout(()=>{se(M=>!M),Z?(j.mobileBorderAll=H.NULL_BORDER,j.mobileBorderTop=H.NULL_BORDER,j.mobileBorderBottom=H.NULL_BORDER,j.mobileBorderRight=H.NULL_BORDER,j.mobileBorderLeft=H.NULL_BORDER):j.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:j.mobileBorderAll.color,style:j.mobileBorderAll.style,width:j.mobileBorderAll.width}}}})})},xe=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{ne(M=>!M),te?(j.borderRadiusAll=0,h(!0)):j.borderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:j.borderRadiusAll}}})})},D=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{le(M=>!M),_e?(j.mobileBorderRadiusAll=null,x(!0)):j.mobileBorderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:j.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ue=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{Ae(M=>!M),fe?(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"),r({operation:s.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}}})})},ge=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{$e(M=>!M),ce?(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"),r({operation:s.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-"}}})})},Oe=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{ie(M=>!M),Ce&&(j.width="",j.height="",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},Ge=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{ae(M=>!M),Be&&(j.mobileWidth="",j.mobileHeight="",r({operation:s.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 j=l.getFieldsValue(!0);setTimeout(()=>{me(M=>!M),oe?(j.backgroundColor="",j.backgroundImage="",j.backgroundPositionX="",j.backgroundPositionY="",j.backgroundRepeat="none",j.backgroundSize="",A(!0)):(j.backgroundColor="#E5E5E5",j.backgroundSize="",j.backgroundRepeat="none"),r({operation:s.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}})})},Xe=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{Q(M=>!M),de?j.mobileBackgroundColor="":j.mobileBackgroundColor="#E5E5E5",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:j.mobileBackgroundColor}}}),de&&Ro(l,e,r)})},R=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{z(M=>!M),q&&(j.exportAsPicture=!1,j.isContrastBlock=!1,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},X=()=>{const j=l.getFieldsValue(!0);setTimeout(()=>{re(M=>!M),G&&(j.mobilePaddingLeftRight="",j.mobilePaddingLeft="",j.mobilePaddingRight="",j.mobilePaddingTopBottom="",j.mobilePaddingTop="",j.mobilePaddingBottom="",r({operation:s.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,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_td_form",initialValues:{horizontalPosition:"",horizontalUnit:"px",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",show:"all",borderPosition:H.BORDER_POSITIONS[we]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[je]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",boxShadowInset:"",boxShadowHOffset:"",boxShadowVOffset:"",boxShadowBlurRadius:"",boxShadowSpreadRadius:"",boxShadowColor:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1},onValuesChange:Ue,autoComplete:"off",className:"element-controls",children:E==="mobile"&&w.styles?(0,t.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:E==="mobile"&&w.styles?"flex":"none"},children:[(0,t.jsx)("div",{className:"selected_form-mobile-props-header",children:!C&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})})}),(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(xs,{form:l,elementSettings:e,boxShadow:_,mobileBordersShow:Z,mobileBorderRadiusShow:_e,mobileBoxShadowShow:ce,mobileSizeShow:Be,mobileBackgroundShow:de,mobilePaddingShow:G,mobilePaddingsExt:F,setMobilePaddingsExt:N,oneMobileBorderRadiusValue:y,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:O,toggleShowMobileBorderRadiusHandler:D,toggleShowMobileBoxShadowHandler:ge,toggleShowMobileSizeHandler:Ge,toggleShowMobileBackgroundHandler:Xe,toggleShowMobilePaddingHandler:X})})]}):(0,t.jsxs)(t.Fragment,{children:[!C&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(_s,{form:l,elementSettings:e,boxShadow:_,bordersShow:T,borderRadiusShow:te,boxShadowShow:fe,backgroundShow:oe,backgroundImageEmpty:I,backgroundRepeatOptions:ye,sizeShow:Ce,maxWidthValue:m,modificationShow:q,paddingsExt:Y,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementListShow:ke,togglePaddingHandler:Me,toggleShowBorderHandler:He,toggleShowBorderRadiusHandler:xe,toggleShowBoxShadowHandler:ue,toggleShowSizeHandler:Oe,toggleShowBackgroundHandler:Ye,toggleShowModificationHandler:R,handleChangeValues:Ue})})]})})};ks.propTypes={elementSettings:g.default.object.isRequired};var Es=({form:e,elementSettings:i,boxShadow:r,bordersShow:a,borderRadiusShow:l,boxShadowShow:n,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:f,sizeShow:_,maxWidthValue:k,modificationShow:b,paddingShow:h,paddingsExt:y,oneBorderRadiusValue:x,setOneBorderRadiusValue:E,togglePaddingHandler:w,toggleShowPaddingHandler:I,toggleShowBorderHandler:A,toggleShowBorderRadiusHandler:v,toggleShowBoxShadowHandler:P,toggleShowSizeHandler:C,toggleShowBackgroundHandler:Y,toggleShowModificationHandler:W,handleChangeValues:F})=>{const{__:N}=s.useI18n(),{token:T}=(0,o.ui_kit$useToken)(),J=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:N("Appearance on mobile devices"),type:"info"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(so,{form:e,elementSettings:i})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:i})})]}),J.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Padding"),collapsible:!0,open:h,onToggle:I,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:y,onToggleExtended:w,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,t.jsx)(o.ui_kit$FormSection,{title:N("Size"),collapsible:!0,open:_,onToggle:C,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:k,dimensionSelect:Mt,showMinMax:!0,minWidthDimensionSelect:Mt,maxWidthDimensionSelect:Mt,labels:{width:N("Width"),height:N("Height"),minWidth:N("Minimum width"),maxWidth:N("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:N("Background"),collapsible:!0,open:c,onToggle:Y,dividerTop:!0,children:[(0,t.jsx)(Li,{form:e,backgroundImageEmpty:m,appConfig:J,token:T,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:F}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),J.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Borders"),collapsible:!0,open:a,onToggle:A,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),J.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Border radius"),collapsible:!0,open:l,onToggle:v,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:x,setOneBorderRadiusValue:E,elementSettings:i})}),J.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Box shadow"),collapsible:!0,open:n,onToggle:P,dividerTop:!0,children:(0,t.jsx)(It,{})}),J.formFieldExportAsPictureEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Export settings"),collapsible:!0,open:b,onToggle:W,dividerTop:!0,children:(0,t.jsx)(Pi,{form:e,elementSettings:i})}),J.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("Display control & Direction"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e,directionControl:(0,t.jsx)(Xo,{elementSettings:i,form:e})})}),J.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:N("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Es.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var Bs=({form:e,elementSettings:i,mobileBoxShadow:r,mobileBordersShow:a,mobileBorderRadiusShow:l,mobileBoxShadowShow:n,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:f,mobilePaddingsExt:_,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:y,toggleShowMobileBorderRadiusHandler:x,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:I,toggleShowMobilePaddingHandler:A})=>{const{__:v}=s.useI18n(),{token:P}=(0,o.ui_kit$useToken)(),C=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Go,{form:e,elementSettings:i,imgParent:!0})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),C.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Padding"),collapsible:!0,open:f,onToggle:A,dividerTop:!0,children:(0,t.jsx)(qo,{form:e,elementSettings:i,mobilePaddingsExt:_,setMobilePaddingsExt:k})}),(0,t.jsx)(o.ui_kit$FormSection,{title:v("Size"),collapsible:!0,open:c,onToggle:w,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:8},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:P.formItemMarginBottomXS*2},children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:P.formItemMarginBottomXS},children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:v("Background"),collapsible:!0,open:m,onToggle:I,dividerTop:!0,children:(0,t.jsx)(wo,{elementSettings:Xt(i),imageEnabled:C.formDivFieldBackgroundImageEnabled,desktopBackground:So(i)})}),C.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Borders"),collapsible:!0,open:a,onToggle:y,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Border radius"),collapsible:!0,open:l,onToggle:x,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i})}),C.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Box shadow"),collapsible:!0,open:n,onToggle:E,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile",form:e,elementSettings:i})}),C.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Display control & Direction"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e,directionControl:(0,t.jsx)(Xo,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Bs.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var Ts=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=Dt(),n=Dt(),[c,m]=(0,d.useState)({}),[f,_]=(0,d.useState)(!0),[k,b]=(0,d.useState)({}),[h,y]=(0,d.useState)(!0),x=s.useSelector(s.selectEmailViewType),E=s.useSelector(s.selectMobileViewActive);s.useAppConfig();const[w,I]=(0,d.useState)(e.backgroundImage[0].value===""),A=s.useSelector(s.selectIsCodeMode),v=s.useSelector(s.selectCodeModeDirection),P=A&&v!=="bottom",[C,Y]=(0,d.useState)(!1),[W,F]=(0,d.useState)(!1),[N,T]=(0,d.useState)(!1),[J,Z]=(0,d.useState)(!1),[se,te]=(0,d.useState)(!1),[ne,_e]=(0,d.useState)(!1),[le,fe]=(0,d.useState)(!1),[Ae,ce]=(0,d.useState)(!1),[$e,Ce]=(0,d.useState)(!1),[ie,Be]=(0,d.useState)(!1),[ae,oe]=(0,d.useState)(!1),[me,de]=(0,d.useState)(!1),[Q,q]=(0,d.useState)(!1),[z,G]=(0,d.useState)(!1),[re,ke]=(0,d.useState)(!1),[he,Pe]=(0,d.useState)(""),ye=[{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 V=e.border,ee=e.mobileBorder,we=Object.keys(V).find(R=>V[R]?.width||V[R]?.style||V[R]?.color),je=Object.keys(ee).find(R=>ee[R]?.width||ee[R]?.style||ee[R]?.color),K=R=>R&&(R?.width||R?.style||R?.color)?R:"";(0,d.useEffect)(()=>{if(e){const R=e.boxShadow,X=e.mobileBoxShadow;m(R),b(X),a.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:K(e.mobileBorder.all)||!(K(e.mobileBorder.top)||K(e.mobileBorder.bottom)||K(e.mobileBorder.right)||K(e.mobileBorder.left))&&K(e.border.all),mobileBorderTop:K(e.mobileBorder.top)||!K(e.mobileBorder.all)&&K(e.border.top),mobileBorderBottom:K(e.mobileBorder.bottom)||!K(e.mobileBorder.all)&&K(e.border.bottom),mobileBorderRight:K(e.mobileBorder.right)||!K(e.mobileBorder.all)&&K(e.border.right),mobileBorderLeft:K(e.mobileBorder.left)||!K(e.mobileBorder.all)&&K(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:pt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:pt(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:""),...mo(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))?_(!1):_(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?y(!1):y(!0),I(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?Y(!1):Y(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)?F(!1):F(!0);const j=l.isStaleBorderSnapshot(e,!!we),M=n.isStaleBorderSnapshot(e,!!je);j&&a.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(M||j&&!je)&&a.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),T(Ee=>we&&!j?!0:Ee),Z(Ee=>we&&!j||je&&!M?!0:Ee),te(!!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),fe(!!e.boxShadow),ce(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),Ce(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),Be(!!e.mobileWidth.value||!!e.mobileHeight.value),oe(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),de(yo(e)),q(!!e.exportAsPicture),G(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),ke(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[a,e,we,je,l,n]);const ve=R=>{const X=a.getFieldsValue(!0),j=Object.keys(R)[0];let M;switch(Pe(a.getFieldsValue(!0).widthDim==="%"?100:""),j){case"exportAsPicture":M={exportAsPicture:X.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":M={boxShadow:{hOffset:X.boxShadowHOffset,vOffset:X.boxShadowVOffset,blurRadius:X.boxShadowBlurRadius,spreadRadius:X.boxShadowSpreadRadius,color:X.boxShadowColor,inset:X.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":X.borderPosition==="borderAll"?(M={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...X.borderAll}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):X.borderAll?.width||X.borderAll?.style||X.borderAll?.color?(M={border:{all:null,left:X.borderAll,right:X.borderAll,top:X.borderAll,bottom:X.borderAll,[H.REVERSE_BORDER_POSITIONS[j]]:{...X[j],...R[j]}}},a.setFieldsValue({borderAll:null,borderLeft:X.borderAll,borderRight:X.borderAll,borderTop:X.borderAll,borderBottom:X.borderAll,[j]:{...X[j],...R[j]}})):(M={border:{all:null,left:X.borderLeft,right:X.borderRight,top:X.borderTop,bottom:X.borderBottom,[H.REVERSE_BORDER_POSITIONS[j]]:{...X[j],...R[j]}}},a.setFieldsValue({border:M.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(X.mobileBorderPosition==="mobileBorderAll")M={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...X.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[j]+"-"}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const Ee=H.MOBILE_REVERSE_BORDER_POSITIONS[j],Fe={...X[j],...R[j]},tt=!Fe?.width&&!Fe?.style&&!Fe?.color;if(X.mobileBorder?.all?.width||X.mobileBorder?.all?.style||X.mobileBorder?.all?.color){const qe=X.mobileBorderAll;M={mobileBorder:{all:null,left:qe,right:qe,top:qe,bottom:qe,[Ee]:tt?null:{...Fe,classNamePrefix:"em-mob-border_"+Ee+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:qe,mobileBorderRight:qe,mobileBorderTop:qe,mobileBorderBottom:qe,[j]:Fe})}else{const qe=e.mobileBorder||{},ct=Ze=>{const ut=qe[Ze];return ut&&(ut?.width||ut?.style||ut?.color)?ut:null};M={mobileBorder:{all:null,left:Ee==="left"?tt?null:{...Fe,classNamePrefix:"em-mob-border_left-"}:ct("left"),right:Ee==="right"?tt?null:{...Fe,classNamePrefix:"em-mob-border_right-"}:ct("right"),top:Ee==="top"?tt?null:{...Fe,classNamePrefix:"em-mob-border_top-"}:ct("top"),bottom:Ee==="bottom"?tt?null:{...Fe,classNamePrefix:"em-mob-border_bottom-"}:ct("bottom")}},a.setFieldsValue({[j]:Fe})}}break;case"width":M={[j]:{value:R[j],dim:X.widthDim}};break;case"height":M={[j]:{value:R[j],dim:X.heightDim}};break;case"widthDim":M={width:{value:X.width,dim:R[j]}};break;case"heightDim":M={height:{value:X.height,dim:R[j]}};break;case"maxWidth":M={[j]:{value:R[j],dim:X.maxWidthDim}};break;case"maxWidthDim":M={maxWidth:{value:X.maxWidth,dim:R[j]}};break;case"minWidth":M={[j]:{value:R[j],dim:X.minWidthDim}};break;case"minWidthDim":M={minWidth:{value:X.minWidth,dim:R[j]}};break;case"backgroundImage":I(R[j]===""),M={[j]:[{...e.backgroundImage[0],value:R[j]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":M={padding:{[H.PADDING_POSITION[j]]:+R[j]}};break;case"paddingTopBottom":M={padding:{top:+R[j],bottom:+R[j]}},X.paddingTop=X.paddingBottom=+R[j];break;case"paddingLeftRight":M={padding:{left:+R[j],right:+R[j]}},X.paddingLeft=X.paddingRight=+R[j];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":M={borderRadius:{[H.BORDER_RADIUS_POSITION[j]]:+R[j]}};break;case"mobileWidth":M={[j]:{classNamePrefix:"em-mob-width-",value:R[j],dim:X.mobileWidthDim}};break;case"mobileWidthDim":M={mobileWidth:{classNamePrefix:"em-mob-width-",value:X.mobileWidth||100,dim:R[j]}};break;case"mobileHeight":M={[j]:{classNamePrefix:"em-mob-height-",value:R[j],dim:X.mobileHeightDim}};break;case"mobileHeightDim":M={mobileHeight:{classNamePrefix:"em-mob-height-",value:X.mobileHeight,dim:R[j]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":M={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[j]]:R[j],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[j]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":M={mobileBoxShadow:{hOffset:X.mobileBoxShadowHOffset,vOffset:X.mobileBoxShadowVOffset,blurRadius:X.mobileBoxShadowBlurRadius,spreadRadius:X.mobileBoxShadowSpreadRadius,color:X.mobileBoxShadowColor,inset:X.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":M={[j]:{classNamePrefix:"em-mob-text_align-",value:R[j]}};break;case"mobileVerticalAlign":M={[j]:{classNamePrefix:"em-mob-vertical_align-",value:R[j]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(M=To(R),!M)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":M={mobilePadding:{all:null,top:X.mobilePaddingTop!==""?X.mobilePaddingTop:null,right:X.mobilePaddingRight!==""?X.mobilePaddingRight:null,bottom:X.mobilePaddingBottom!==""?X.mobilePaddingBottom:null,left:X.mobilePaddingLeft!==""?X.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":X.mobilePaddingTop=X.mobilePaddingBottom=R[j],M={mobilePadding:{all:null,top:X.mobilePaddingTop!==""?X.mobilePaddingTop:null,right:X.mobilePaddingRight!==""?X.mobilePaddingRight:null,bottom:X.mobilePaddingBottom!==""?X.mobilePaddingBottom:null,left:X.mobilePaddingLeft!==""?X.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":X.mobilePaddingLeft=X.mobilePaddingRight=R[j],M={mobilePadding:{all:null,top:X.mobilePaddingTop!==""?X.mobilePaddingTop:null,right:X.mobilePaddingRight!==""?X.mobilePaddingRight:null,bottom:X.mobilePaddingBottom!==""?X.mobilePaddingBottom:null,left:X.mobilePaddingLeft!==""?X.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":M={[j]:{classNamePrefix:"em-mob-direction-",value:R[j]}};break;case"backgroundPositionX":case"backgroundPositionY":M={[j]:isNaN(parseFloat(R[j].position))?R[j].position:R[j].position+R[j].unit};break;default:M=R}j!=="borderPosition"&&j!=="mobileBorderPosition"&&r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:M})},Re=()=>{Y(X=>!X);const R=a.getFieldsValue(!0);C||(R.paddingLeftRight=R.paddingLeft,R.paddingTopBottom=R.paddingTop,R.paddingRight=R.paddingLeft,R.paddingBottom=R.paddingTop,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:R.paddingTopBottom,bottom:R.paddingTopBottom,left:R.paddingLeftRight,right:R.paddingLeftRight}}}))},Le=()=>{const R=a.getFieldsValue(!0);l.markBorderToggled(!N),setTimeout(()=>{T(X=>!X),N?(R.borderAll=H.NULL_BORDER,R.borderTop=H.NULL_BORDER,R.borderBottom=H.NULL_BORDER,R.borderRight=H.NULL_BORDER,R.borderLeft=H.NULL_BORDER):R.borderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:R.borderAll.color,style:R.borderAll.style,width:R.borderAll.width}}}})})},Ue=()=>{const R=a.getFieldsValue(!0);n.markBorderToggled(!J),setTimeout(()=>{Z(X=>!X),J?(R.mobileBorderAll=H.NULL_BORDER,R.mobileBorderTop=H.NULL_BORDER,R.mobileBorderBottom=H.NULL_BORDER,R.mobileBorderRight=H.NULL_BORDER,R.mobileBorderLeft=H.NULL_BORDER):R.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:R.mobileBorderAll.color,style:R.mobileBorderAll.style,width:R.mobileBorderAll.width}}}})})},Me=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{te(X=>!X),se?(R.borderRadiusAll=0,_(!0)):R.borderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:R.borderRadiusAll}}})})},He=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{_e(X=>!X),ne?(R.mobileBorderRadiusAll=null,y(!0)):R.mobileBorderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:R.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},O=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{fe(X=>!X),le?(R.boxShadowInset=!1,R.boxShadowHOffset=null,R.boxShadowVOffset=null,R.boxShadowBlurRadius=null,R.boxShadowSpreadRadius=null,R.boxShadowColor=""):(R.boxShadowInset=!1,R.boxShadowHOffset=5,R.boxShadowVOffset=5,R.boxShadowBlurRadius=10,R.boxShadowSpreadRadius=-5,R.boxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:R.boxShadowBlurRadius,color:R.boxShadowColor,hOffset:R.boxShadowHOffset,inset:R.boxShadowInset,spreadRadius:R.boxShadowSpreadRadius,vOffset:R.boxShadowVOffset}}})})},xe=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ce(X=>!X),Ae?(R.mobileBoxShadowInset=!1,R.mobileBoxShadowHOffset=null,R.mobileBoxShadowVOffset=null,R.mobileBoxShadowBlurRadius=null,R.mobileBoxShadowSpreadRadius=null,R.mobileBoxShadowColor=""):(R.mobileBoxShadowInset=!1,R.mobileBoxShadowHOffset=5,R.mobileBoxShadowVOffset=5,R.mobileBoxShadowBlurRadius=10,R.mobileBoxShadowSpreadRadius=-5,R.mobileBoxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:R.mobileBoxShadowBlurRadius,color:R.mobileBoxShadowColor,hOffset:R.mobileBoxShadowHOffset,inset:R.mobileBoxShadowInset,spreadRadius:R.mobileBoxShadowSpreadRadius,vOffset:R.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},D=()=>{setTimeout(()=>{Ce(R=>!R)})},ue=()=>{setTimeout(()=>{Be(R=>!R)})},ge=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{oe(X=>!X),ae?(R.backgroundColor="",R.backgroundImage="",R.backgroundPositionX="",R.backgroundPositionY="",R.backgroundRepeat="none",R.backgroundSize="",I(!0)):(R.backgroundColor="#E5E5E5",R.backgroundSize="",R.backgroundRepeat="none"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:R.backgroundColor,backgroundImage:[{type:"url",value:R.backgroundImage}],backgroundPositionX:R.backgroundPositionX,backgroundPositionY:R.backgroundPositionY,backgroundRepeat:R.backgroundRepeat,backgroundSize:R.backgroundSize}})})},Oe=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{de(X=>!X),me?R.mobileBackgroundColor="":R.mobileBackgroundColor="#E5E5E5",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:R.mobileBackgroundColor}}}),me&&Ro(a,e,r)})},Ge=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{q(X=>!X),Q&&(R.exportAsPicture=!1,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},Ye=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{G(X=>!X),z&&(R.paddingLeftRight="",R.paddingLeft="",R.paddingRight="",R.paddingTopBottom="",R.paddingTop="",R.paddingBottom="",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Xe=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ke(X=>!X),re&&(R.mobilePaddingLeftRight="",R.mobilePaddingLeft="",R.mobilePaddingRight="",R.mobilePaddingTopBottom="",R.mobilePaddingTop="",R.mobilePaddingBottom="",r({operation:s.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,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_div_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[we]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[je]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:""},onValuesChange:ve,autoComplete:"off",className:"element-controls",children:[!P&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),x==="mobile"&&E.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(Bs,{form:a,elementSettings:e,mobileBoxShadow:k,mobileBordersShow:J,mobileBorderRadiusShow:ne,mobileBoxShadowShow:Ae,mobileSizeShow:ie,mobileBackgroundShow:me,mobilePaddingShow:re,mobilePaddingsExt:W,setMobilePaddingsExt:F,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:y,toggleShowMobileBorderHandler:Ue,toggleShowMobileBorderRadiusHandler:He,toggleShowMobileBoxShadowHandler:xe,toggleShowMobileSizeHandler:ue,toggleShowMobileBackgroundHandler:Oe,toggleShowMobilePaddingHandler:Xe})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Es,{form:a,elementSettings:e,boxShadow:c,bordersShow:N,borderRadiusShow:se,boxShadowShow:le,backgroundShow:ae,backgroundImageEmpty:w,backgroundRepeatOptions:ye,sizeShow:$e,maxWidthValue:he,modificationShow:Q,paddingShow:z,paddingsExt:C,oneBorderRadiusValue:f,setOneBorderRadiusValue:_,togglePaddingHandler:Re,toggleShowPaddingHandler:Ye,toggleShowBorderHandler:Le,toggleShowBorderRadiusHandler:Me,toggleShowBoxShadowHandler:O,toggleShowSizeHandler:D,toggleShowBackgroundHandler:ge,toggleShowModificationHandler:Ge,handleChangeValues:ve})})]})};Ts.propTypes={elementSettings:g.default.object.isRequired};var Ss=({form:e,elementSettings:i})=>{const{__:r}=s.useI18n(),a=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Float block width"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"width",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:0,placeholder:r("Float block width"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:Mt})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:r("Column gap"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:0,placeholder:r("Column gap"),prefix:(0,t.jsx)(s.EmIcons,{icon:"SplitCellsOutlined",component:o.icons$SplitCellsOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:Fn})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:r("Vertical alignment"),dividerTop:!0,children:(0,t.jsx)(Vt,{form:e,elementSettings:i})}),(0,t.jsx)(o.ui_kit$FormSection,{title:r("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),a.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:r("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};Ss.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var ys=({form:e,elementSettings:i})=>{const{__:r}=s.useI18n(),a=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:r("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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:r("Appearance on mobile devices"),type:"info"})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})}),(0,t.jsx)(o.ui_kit$Col,{span:12})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:r("Alignments"),dividerTop:!0,children:(0,t.jsx)(Vt,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,t.jsx)(o.ui_kit$FormSection,{title:r("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})}),a.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:r("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};ys.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var Oi=0,Rs=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=s.useSelector(s.selectEmailViewType),n=s.useSelector(s.selectMobileViewActive),c=s.useSelector(s.selectIsCodeMode),m=s.useSelector(s.selectCodeModeDirection),f=c&&m!=="bottom";(0,d.useEffect)(()=>{e&&(a.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:pt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:pt(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Oi=e.width.value+e.gap.value)},[a,e]);const _=k=>{const b=a.getFieldsValue(!0),h=Object.keys(k)[0];let y;switch(h){case"width":Oi=k[h]+b.gap,y={[h]:{value:k[h],dim:b.widthDim},gap:{value:b.gap}};break;case"widthDim":y={width:{value:b.width,dim:k[h]},gap:{value:b.gap}};break;case"gap":b.width=Oi-k[h],y={[h]:{value:k[h],dim:"px"}};break;case"mobileWidth":y={[h]:{classNamePrefix:"em-mob-width-",value:k[h],dim:b.mobileWidthDim}};break;case"mobileWidthDim":y={mobileWidth:{classNamePrefix:"em-mob-width-",value:b.mobileWidth||100,dim:k[h]}};break;case"mobileContentWidth":y={[h]:{classNamePrefix:"em-mob-width-",value:k[h],dim:b.mobileContentWidthDim}};break;case"mobileContentWidthDim":y={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:k[h]}};break;case"mobileVerticalAlign":y={[h]:{classNamePrefix:"em-mob-vertical_align-",value:k[h]}};break;default:y=k}r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:y})};return(0,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:_,autoComplete:"off",className:"element-controls",children:[f&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),l==="mobile"&&n.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:l==="mobile"&&n.styles?"block":"none"},children:(0,t.jsx)(ys,{form:a,elementSettings:e})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Ss,{form:a,elementSettings:e})})]})};Rs.propTypes={elementSettings:g.default.object.isRequired};var ws=({form:e,fillFields:i,elementSettings:r,boxShadow:a,bordersShow:l,borderRadiusShow:n,boxShadowShow:c,backgroundShow:m,backgroundImageEmpty:f,backgroundRepeatOptions:_,paddingShow:k,paddingsExt:b,maxWidthValue:h,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,linkProtocol:E,linkTarget:w,isOpenTextReplacer:I,textReplacerButtonRef:A,textReplacerInputRef:v,handleLinkProtocolsChange:P,handleSelect:C,textReplacerInputHandler:Y,handleTextReplacerKeyDown:W,srcButtonHandler:F,togglePaddingHandler:N,toggleShowPaddingHandler:T,toggleShowBackgroundHandler:J,toggleShowBorderHandler:Z,toggleShowBorderRadiusHandler:se,toggleShowBoxShadowHandler:te,setLinkProtocol:ne,handleChangeValues:_e})=>{const{__:le}=s.useI18n(),{token:fe}=(0,o.ui_kit$useToken)(),Ae=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:le("Appearance on mobile devices"),type:"info"}),(0,t.jsxs)("div",{className:"selected_form-props-wrapper",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:r})}),Ae.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(so,{form:e,name:"textAlign",elementSettings:r})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,t.jsx)(oo,{show:E==="#",__:le,style:{marginBottom:fe.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:le("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:Ae.formButtonFieldReplacerEnabled?fe.formItemMarginBottomXS:fe.formItemMarginBottomMD+4},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:E,handleLinkProtocolsChange:P,__:le}),placeholder:le("Hyperlink URL"),allowClear:!0,onSelect:C,prefix:(0,t.jsx)(eo,{linkProtocol:E})})})}),E==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",style:{marginBottom:fe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:le("Subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:fe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:le("Body")})})]}),Ae.formButtonFieldReplacerEnabled&&(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:le("Text replacer"),placement:"bottom",getPopupContainer:ce=>ce.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":I}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:F,ref:A})})}),(0,t.jsx)(o.ui_kit$Col,{span:21,children:I&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:le("Text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textReplacer",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:le("The code that will replace this text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Text"}),onChange:Y,onKeyDown:W,ref:v,onSelect:C})})})})]})}),Ae.formButtonFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("Padding"),collapsible:!0,open:k,onToggle:T,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:b,onToggleExtended:N,gutter:fe.marginSM,labels:{horizontal:le("Horizontal padding"),vertical:le("Vertical padding"),left:le("Left padding"),right:le("Right padding"),top:le("Top padding"),bottom:le("Bottom padding"),individual:le("Individual padding")}})}),(0,t.jsx)(o.ui_kit$FormSection,{title:le("Size"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:h,dimensionSelect:Mt,gutter:fe.marginSM,labels:{width:le("Width"),height:le("Height"),minWidth:le("Minimum width"),maxWidth:le("Maximum width")}})}),(0,t.jsx)(Bo,{form:e,fillFields:i,elementSettings:r,showAddParagraph:!1,isButton:!0,setLinkProtocol:ne,linkProtocol:E,linkTarget:w}),(0,t.jsxs)(o.ui_kit$FormSection,{title:le("Background"),collapsible:!0,open:m,onToggle:J,dividerTop:!0,children:[(0,t.jsx)(Li,{form:e,backgroundImageEmpty:f,appConfig:Ae,token:fe,elementSettings:r,backgroundRepeatOptions:_,handleChangeValues:_e}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),Ae.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("Borders"),collapsible:!0,open:l,onToggle:Z,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:r})}),Ae.formFieldBorderRadiusEnabled&&(0,t.jsxs)(o.ui_kit$FormSection,{title:le("Border radius"),collapsible:!0,open:n,onToggle:se,dividerTop:!0,children:[(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,elementSettings:r}),(0,t.jsx)(ao,{form:e,showRounding:!0})]}),Ae.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("Box shadow"),collapsible:!0,open:c,onToggle:te,dividerTop:!0,children:(0,t.jsx)(It,{})}),Ae.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:r,form:e})}),Ae.formFieldAmpVisibilityEnabled&&r.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:le("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})]})};ws.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,paddingShow:g.default.bool,paddingsExt:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,linkTarget:g.default.object,isOpenTextReplacer:g.default.bool,textReplacerButtonRef:g.default.object,textReplacerInputRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,textReplacerInputHandler:g.default.func,handleTextReplacerKeyDown:g.default.func,srcButtonHandler:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,setLinkProtocol:g.default.func,handleChangeValues:g.default.func};var js=({form:e,fillFields:i,elementSettings:r,boxShadow:a,mobileBordersShow:l,mobileBorderRadiusShow:n,mobileBoxShadowShow:c,mobileSizeShow:m,mobileBackgroundShow:f,mobilePaddingShow:_,mobilePaddingsExt:k,setMobilePaddingsExt:b,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:y,linkProtocol:x,handleLinkProtocolsChange:E,setLinkProtocol:w,toggleShowMobileBorderHandler:I,toggleShowMobileBorderRadiusHandler:A,toggleShowMobileBoxShadowHandler:v,toggleShowMobileSizeHandler:P,toggleShowMobileBackgroundHandler:C,toggleShowMobilePaddingHandler:Y})=>{const{__:W}=s.useI18n(),{token:F}=(0,o.ui_kit$useToken)(),N=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(zt,{form:e,elementSettings:r,imgParent:!0,typeOfForm:"mobile"})}),N.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Go,{form:e,name:"mobileTextAlign",elementSettings:r,imgParent:!0})})]}),!!r.showOnMobile&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,t.jsx)(oo,{show:x==="#",__:W,style:{marginBottom:F.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:W("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:x==="mailto:"?F.formItemMarginBottomXS:F.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:x,handleLinkProtocolsChange:E,__:W}),placeholder:W("Hyperlink URL"),allowClear:!0,prefix:(0,t.jsx)(eo,{linkProtocol:x})})})}),x==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:W("Subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:F.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:W("Body")})})]})]}),!!r.showOnMobile&&(0,t.jsx)(Bo,{form:e,fillFields:i,elementSettings:r,setLinkProtocol:w,linkProtocol:x,showAddParagraph:!1,isButton:!0}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Qr,{})})}),N.formButtonFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("Padding"),collapsible:!0,open:_,onToggle:Y,dividerTop:!0,children:(0,t.jsx)(qo,{form:e,elementSettings:r,mobilePaddingsExt:k,setMobilePaddingsExt:b})}),(0,t.jsx)(o.ui_kit$FormSection,{title:W("Size"),collapsible:!0,open:m,onToggle:P,dividerTop:!0,bodyStyle:{paddingBottom:F.formItemMarginBottomMD},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:W("Width"),placement:"bottom",children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:r})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:W("Height"),placement:"bottom",children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:r})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:W("Background"),collapsible:!0,open:f,onToggle:C,dividerTop:!0,bodyStyle:{paddingBottom:F.formItemMarginBottomMD},children:(0,t.jsx)(wo,{elementSettings:Xt(r),imageEnabled:N.formButtonFieldBackgroundImageEnabled,desktopBackground:So(r)})}),N.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("Borders"),collapsible:!0,open:l,onToggle:I,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),N.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("Border radius"),collapsible:!0,open:n,onToggle:A,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:y,elementSettings:r,typeOfForm:"mobile"})}),N.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("Box shadow"),collapsible:!0,open:c,onToggle:v,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile"})}),N.formFieldAmpVisibilityEnabled&&r.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})}),N.formFieldAmpVisibilityEnabled&&r.isAmp&&(0,t.jsx)(o.ui_kit$FormSection,{title:W("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(Pt,{})})]})};js.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,setLinkProtocol:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var vs=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),l=Dt(),n=Dt(),c=s.useDispatch(),[m,f]=(0,d.useState)({}),[_,k]=(0,d.useState)(!0),[b,h]=(0,d.useState)(!0),y=s.useSelector(s.selectEmailViewType),x=s.useSelector(s.selectMobileViewActive),[E,w]=(0,d.useState)(e.backgroundImage?.[0].value===""),I=s.useSelector(s.selectIsCodeMode),A=s.useSelector(s.selectCodeModeDirection),v=I&&A!=="bottom",P=(0,d.useRef)(null),C=(0,d.useRef)(null),[Y,W]=(0,d.useState)(!1),[F,N]=(0,d.useState)(!1),[T,J]=(0,d.useState)(!1),[Z,se]=(0,d.useState)(!1),[te,ne]=(0,d.useState)(!1),[_e,le]=(0,d.useState)(!1),[fe,Ae]=(0,d.useState)(!1),[ce,$e]=(0,d.useState)(!1),[Ce,ie]=(0,d.useState)(!1),[Be,ae]=(0,d.useState)(!1),[oe,me]=(0,d.useState)(!1),[de,Q]=(0,d.useState)(!1),[q,z]=(0,d.useState)(!1),[G,re]=(0,d.useState)(""),[ke,he]=(0,d.useState)("https://"),[Pe,ye]=(0,d.useState)({}),V=e,[ee,we]=(0,d.useState)(!!V.textReplacer?.length),[je,K]=(0,d.useState)(e);e!==je&&(K(e),we(!!V.textReplacer?.length));const ve=s.useElementEntityKind(),Re=[{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"}],Le=e.border,Ue=e.mobileBorder,Me=Object.keys(Le).find(S=>Le[S]?.width||Le[S]?.style||Le[S]?.color),He=Object.keys(Ue).find(S=>Ue[S]?.width||Ue[S]?.style||Ue[S]?.color),O=S=>S&&(S?.width||S?.style||S?.color)?S:"",{remember:xe,fillFields:D}=co(e);(0,d.useEffect)(()=>{if(e){const S=e.boxShadow||{},p=e.mobilePadding||{},$=e.mobileAlign||{};f(S);let U="",Se="",pe=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const at=zr(e.href);U=at.subject,Se=at.body,pe=at.baseEmail}Gt(e.href,he)}D(a,{...e,href:pe,subject:U,body:Se,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:O(e.mobileBorder.all)||!(O(e.mobileBorder.top)||O(e.mobileBorder.bottom)||O(e.mobileBorder.right)||O(e.mobileBorder.left))&&O(e.border.all),mobileBorderTop:O(e.mobileBorder.top)||!O(e.mobileBorder.all)&&O(e.border.top),mobileBorderBottom:O(e.mobileBorder.bottom)||!O(e.mobileBorder.all)&&O(e.border.bottom),mobileBorderRight:O(e.mobileBorder.right)||!O(e.mobileBorder.all)&&O(e.border.right),mobileBorderLeft:O(e.mobileBorder.left)||!O(e.mobileBorder.all)&&O(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:pt(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:pt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:pt(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:pt(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||""),...mo(e),mobilePaddingTop:u(p.all)||u(p.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(p.all)||u(p.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(p.all)||u(p.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(p.all)||u(p.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(p.top)||u(p.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(p.left)||u(p.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Gr(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))?h(!1):h(!0),w(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)?W(!1):W(!0),!u(p.all)&&(u(p.top)||u(p.right)||u(p.bottom)||u(p.left))&&(p.top!==p.bottom||p.right!==p.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)?N(!1):N(!0);const ze=l.isStaleBorderSnapshot(e,!!Me),dt=n.isStaleBorderSnapshot(e,!!He);ze&&a.setFieldsValue({border:s.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(dt||ze&&!He)&&a.setFieldsValue({mobileBorder:s.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),J(at=>Me&&!ze?!0:at),se(at=>Me&&!ze||He&&!dt?!0:at),ne(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),le(!!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),$e(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),ie(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),ae(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),me(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),yo(e)&&me(!0),Q(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),z(!!e.mobilePadding?.all||!!e.mobilePadding?.top||!!e.mobilePadding?.bottom||!!e.mobilePadding?.left||!!e.mobilePadding?.right||!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right)}},[a,e,v,Me,He,l,n]);const ue=(0,d.useCallback)(S=>{xe(S),c(ve==="email"?s.setElementSettings$1(S):s.setElementSettings(S))},[c,ve,xe]),ge=S=>{const p=a.getFieldsValue(!0),$=Object.keys(S)[0];let U;switch(re(a.getFieldsValue(!0).widthDim==="%"?100:""),$){case"exportAsPicture":U={exportAsPicture:p.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":U={boxShadow:{hOffset:p.boxShadowHOffset,vOffset:p.boxShadowVOffset,blurRadius:p.boxShadowBlurRadius,spreadRadius:p.boxShadowSpreadRadius,color:p.boxShadowColor,inset:p.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":p.borderPosition==="borderAll"?(U={border:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...p.borderAll}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):p.borderAll?.width||p.borderAll?.style||p.borderAll?.color?(U={border:{all:null,left:p.borderAll,right:p.borderAll,top:p.borderAll,bottom:p.borderAll,[H.REVERSE_BORDER_POSITIONS[$]]:{...p[$],...S[$]}}},a.setFieldsValue({borderAll:null,borderLeft:p.borderAll,borderRight:p.borderAll,borderTop:p.borderAll,borderBottom:p.borderAll,[$]:{...p[$],...S[$]}})):(U={border:{all:null,left:p.borderLeft,right:p.borderRight,top:p.borderTop,bottom:p.borderBottom,[H.REVERSE_BORDER_POSITIONS[$]]:{...p[$],...S[$]}}},a.setFieldsValue({border:U.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(p.mobileBorderPosition==="mobileBorderAll")U={mobileBorder:{...s.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...p.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[$]+"-"}}},a.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const ze=H.MOBILE_REVERSE_BORDER_POSITIONS[$],dt={...p[$],...S[$]},at=!dt?.width&&!dt?.style&&!dt?.color;if(p.mobileBorder?.all?.width||p.mobileBorder?.all?.style||p.mobileBorder?.all?.color){const mt=p.mobileBorderAll;U={mobileBorder:{all:null,left:mt,right:mt,top:mt,bottom:mt,[ze]:at?null:{...dt,classNamePrefix:"em-mob-border_"+ze+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:mt,mobileBorderRight:mt,mobileBorderTop:mt,mobileBorderBottom:mt,[$]:dt})}else{const mt=e.mobileBorder||{},Et=Qt=>{const At=mt[Qt];return At&&(At?.width||At?.style||At?.color)?At:null};U={mobileBorder:{all:null,left:ze==="left"?at?null:{...dt,classNamePrefix:"em-mob-border_left-"}:Et("left"),right:ze==="right"?at?null:{...dt,classNamePrefix:"em-mob-border_right-"}:Et("right"),top:ze==="top"?at?null:{...dt,classNamePrefix:"em-mob-border_top-"}:Et("top"),bottom:ze==="bottom"?at?null:{...dt,classNamePrefix:"em-mob-border_bottom-"}:Et("bottom")}},a.setFieldsValue({[$]:dt})}}break;case"width":U={[$]:{value:S[$],dim:p.widthDim}};break;case"height":U={[$]:{value:S[$],dim:p.heightDim}};break;case"widthDim":U={width:{value:p.width,dim:S[$]}};break;case"heightDim":U={height:{value:p.height,dim:S[$]}};break;case"backgroundImage":w(S[$]===""),U={[$]:[{...e.backgroundImage[0],value:S[$]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":U={padding:{left:p.paddingLeft,right:p.paddingRight,top:p.paddingTop,bottom:p.paddingBottom,[H.PADDING_POSITION[$]]:+S[$]}};break;case"paddingTopBottom":U={padding:{left:p.paddingLeft,right:p.paddingRight,top:+S[$],bottom:+S[$]}},p.paddingTop=p.paddingBottom=+S[$];break;case"paddingLeftRight":U={padding:{top:p.paddingTop,bottom:p.paddingBottom,left:+S[$],right:+S[$]}},p.paddingLeft=p.paddingRight=+S[$];break;case"borderRadiusAll":U={borderRadius:{[H.BORDER_RADIUS_POSITION[$]]:+S[$]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":U={borderRadius:{topLeft:p.borderRadiusTopLeft,bottomLeft:p.borderRadiusBottomLeft,topRight:p.borderRadiusTopRight,bottomRight:p.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[$]]:+S[$]}};break;case"mobileWidth":U={[$]:{classNamePrefix:"em-mob-width-",value:S[$],dim:p.mobileWidthDim}};break;case"mobileWidthDim":U={mobileWidth:{classNamePrefix:"em-mob-width-",value:p.mobileWidth||100,dim:S[$]}};break;case"mobileHeight":U={[$]:{classNamePrefix:"em-mob-height-",value:S[$],dim:p.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:S[$],dim:p.mobileHeightDim}};break;case"mobileHeightDim":U={mobileHeight:{classNamePrefix:"em-mob-height-",value:p.mobileHeight,dim:S[$]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":U={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[$]]:S[$],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[$]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":U={mobileBoxShadow:{hOffset:p.mobileBoxShadowHOffset,vOffset:p.mobileBoxShadowVOffset,blurRadius:p.mobileBoxShadowBlurRadius,spreadRadius:p.mobileBoxShadowSpreadRadius,color:p.mobileBoxShadowColor,inset:p.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":U={[$]:{classNamePrefix:"em-mob-table_align-",value:S[$]}};break;case"mobileTextAlign":U={[$]:{classNamePrefix:"em-mob-text_align-",value:S[$]}};break;case"mobileVerticalAlign":U={[$]:{classNamePrefix:"em-mob-vertical_align-",value:S[$]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(U=To(S),!U)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":U={mobilePadding:{all:null,top:p.mobilePaddingTop!==""?p.mobilePaddingTop:null,right:p.mobilePaddingRight!==""?p.mobilePaddingRight:null,bottom:p.mobilePaddingBottom!==""?p.mobilePaddingBottom:null,left:p.mobilePaddingLeft!==""?p.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":p.mobilePaddingTop=p.mobilePaddingBottom=S[$],U={mobilePadding:{all:null,top:p.mobilePaddingTop!==""?p.mobilePaddingTop:null,right:p.mobilePaddingRight!==""?p.mobilePaddingRight:null,bottom:p.mobilePaddingBottom!==""?p.mobilePaddingBottom:null,left:p.mobilePaddingLeft!==""?p.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":p.mobilePaddingLeft=p.mobilePaddingRight=S[$],U={mobilePadding:{all:null,top:p.mobilePaddingTop!==""?p.mobilePaddingTop:null,right:p.mobilePaddingRight!==""?p.mobilePaddingRight:null,bottom:p.mobilePaddingBottom!==""?p.mobilePaddingBottom:null,left:p.mobilePaddingLeft!==""?p.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":U={[$]:{classNamePrefix:"em-mob-font_size-",value:S[$],dim:p.mobileFontSizeDim}};break;case"href":let Se=io(S[$]);Se!==S[$]&&(a.setFieldValue("href",Se),p.href=Se),Se.startsWith("mailto:")?U={[$]:vi(Se,p.subject,p.body)}:U={[$]:Se},Gt(S[$],he);break;case"subject":case"body":const pe=p.href||"";if(pe.startsWith("mailto:")){const ze=$==="subject"?S[$]:p.subject,dt=$==="body"?S[$]:p.body;U={href:vi(pe,ze,dt)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":U={[$]:isNaN(parseFloat(S[$].position))?S[$].position:S[$].position+S[$].unit};break;default:U=S}$!=="borderPosition"&&$!=="mobileBorderPosition"&&(r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:U}),$!=="mobileBorderRadiusAll"&&$!=="mobileBorderRadiusTopLeft"&&$!=="mobileBorderRadiusTopRight"&&$!=="mobileBorderRadiusBottomLeft"&&$!=="mobileBorderRadiusBottomRight"&&ue({...e,...U,mobileBorderRadius:{...e.mobileBorderRadius,...U?.mobileBorderRadius},activateSection:null,changeKey:$}))},Oe=()=>{W(p=>!p);const S=a.getFieldsValue(!0);Y||(S.paddingLeftRight=S.paddingLeft,S.paddingTopBottom=S.paddingTop,S.paddingRight=S.paddingLeft,S.paddingBottom=S.paddingTop,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:S.paddingTopBottom,bottom:S.paddingTopBottom,left:S.paddingLeftRight,right:S.paddingLeftRight}}}))},Ge=()=>{const S=a.getFieldsValue(!0);l.markBorderToggled(!T),setTimeout(()=>{J(p=>!p),T?(S.borderAll=H.NULL_BORDER,S.borderTop=H.NULL_BORDER,S.borderBottom=H.NULL_BORDER,S.borderRight=H.NULL_BORDER,S.borderLeft=H.NULL_BORDER):S.borderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:S.borderAll.color,style:S.borderAll.style,width:S.borderAll.width}}}})})},Ye=()=>{const S=a.getFieldsValue(!0);n.markBorderToggled(!Z),setTimeout(()=>{se(p=>!p),Z?(S.mobileBorderAll=H.NULL_BORDER,S.mobileBorderTop=H.NULL_BORDER,S.mobileBorderBottom=H.NULL_BORDER,S.mobileBorderRight=H.NULL_BORDER,S.mobileBorderLeft=H.NULL_BORDER):S.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:S.mobileBorderAll.color,style:S.mobileBorderAll.style,width:S.mobileBorderAll.width}}}})})},Xe=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{ne(p=>!p),te?(S.borderRadiusAll=0,k(!0)):S.borderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:S.borderRadiusAll}}})})},R=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{le(p=>!p),_e?(S.mobileBorderRadiusAll=null,h(!0)):S.mobileBorderRadiusAll=5,r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:S.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},X=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{Ae(p=>!p),fe?(S.boxShadowInset=!1,S.boxShadowHOffset=null,S.boxShadowVOffset=null,S.boxShadowBlurRadius=null,S.boxShadowSpreadRadius=null,S.boxShadowColor=""):(S.boxShadowInset=!1,S.boxShadowHOffset=5,S.boxShadowVOffset=5,S.boxShadowBlurRadius=10,S.boxShadowSpreadRadius=-5,S.boxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:S.boxShadowBlurRadius,color:S.boxShadowColor,hOffset:S.boxShadowHOffset,inset:S.boxShadowInset,spreadRadius:S.boxShadowSpreadRadius,vOffset:S.boxShadowVOffset}}})})},j=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{$e(p=>!p),ce?(S.mobileBoxShadowInset=!1,S.mobileBoxShadowHOffset=null,S.mobileBoxShadowVOffset=null,S.mobileBoxShadowBlurRadius=null,S.mobileBoxShadowSpreadRadius=null,S.mobileBoxShadowColor=""):(S.mobileBoxShadowInset=!1,S.mobileBoxShadowHOffset=5,S.mobileBoxShadowVOffset=5,S.mobileBoxShadowBlurRadius=10,S.mobileBoxShadowSpreadRadius=-5,S.mobileBoxShadowColor="#000000"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:S.mobileBoxShadowBlurRadius,color:S.mobileBoxShadowColor,hOffset:S.mobileBoxShadowHOffset,inset:S.mobileBoxShadowInset,spreadRadius:S.mobileBoxShadowSpreadRadius,vOffset:S.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},M=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{ie(p=>!p),Ce&&(S.mobileWidth="",S.mobileHeight="",r({operation:s.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-"}}}))})},Ee=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{ae(p=>!p),Be?(S.backgroundColor="",S.backgroundImage="",S.backgroundPositionX="",S.backgroundPositionY="",S.backgroundRepeat="none",S.backgroundSize="",w(!0)):(S.backgroundColor="#E5E5E5",S.backgroundSize="",S.backgroundRepeat="none"),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:S.backgroundColor,backgroundImage:[{type:"url",value:S.backgroundImage}],backgroundPositionX:S.backgroundPositionX,backgroundPositionY:S.backgroundPositionY,backgroundRepeat:S.backgroundRepeat,backgroundSize:S.backgroundSize}})})},Fe=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{me(p=>!p),oe?S.mobileBackgroundColor="":S.mobileBackgroundColor=e.commonStyles.buttons.backgroundColor||"#1C52DC",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:S.mobileBackgroundColor}}}),oe&&Ro(a,e,r)})},tt=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{Q(p=>!p),de&&(S.paddingLeftRight="",S.paddingLeft="",S.paddingRight="",S.paddingTopBottom="",S.paddingTop="",S.paddingBottom="",r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},qe=()=>{const S=a.getFieldsValue(!0);setTimeout(()=>{z(p=>!p),q&&(S.mobilePaddingLeftRight="",S.mobilePaddingLeft="",S.mobilePaddingRight="",S.mobilePaddingTopBottom="",S.mobilePaddingTop="",S.mobilePaddingBottom="",r({operation:s.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_"}}}))})},ct=S=>{a.setFieldValue("href",S!=="mergetag"?S:""),he(S)},Ze=({target:S})=>{const{selectionStart:p,selectionEnd:$}=S;S&&ye({target:S,selection:{start:p,end:$}})},ut=S=>{S.target.value!==""&&C.current.classList.add("selected-td-form__button--active")},Bt=()=>{we(!ee),ee?(a.setFieldValue("textReplacer",""),r({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>P.current.focus())},B=S=>{const p=S.target,$=p.value,U=p.selectionStart;if(U===0&&S.key===" "){S.preventDefault();return}if(S.key===" "){if(U!==$.length){S.preventDefault();return}$.endsWith(" ")&&S.preventDefault()}};return(0,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_button_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[Me]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[He]||"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:ge,autoComplete:"off",className:"element-controls",children:[!v&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),v?(0,t.jsx)(Ci,{form:a,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,t.jsx)(t.Fragment,{children:y==="mobile"&&x.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(js,{form:a,fillFields:D,elementSettings:e,boxShadow:m,mobileBordersShow:Z,mobileBorderRadiusShow:_e,mobileBoxShadowShow:ce,mobileSizeShow:Ce,mobileBackgroundShow:oe,mobilePaddingShow:q,mobilePaddingsExt:F,setMobilePaddingsExt:N,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,linkProtocol:ke,handleLinkProtocolsChange:ct,setLinkProtocol:he,toggleShowMobileBorderHandler:Ye,toggleShowMobileBorderRadiusHandler:R,toggleShowMobileBoxShadowHandler:j,toggleShowMobileSizeHandler:M,toggleShowMobileBackgroundHandler:Fe,toggleShowMobilePaddingHandler:qe})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(ws,{form:a,fillFields:D,elementSettings:e,boxShadow:m,bordersShow:T,borderRadiusShow:te,boxShadowShow:fe,backgroundShow:Be,backgroundImageEmpty:E,backgroundRepeatOptions:Re,paddingShow:de,paddingsExt:Y,maxWidthValue:G,oneBorderRadiusValue:_,setOneBorderRadiusValue:k,linkProtocol:ke,linkTarget:Pe,isOpenTextReplacer:ee,textReplacerButtonRef:C,textReplacerInputRef:P,handleLinkProtocolsChange:ct,handleSelect:Ze,textReplacerInputHandler:ut,handleTextReplacerKeyDown:B,srcButtonHandler:Bt,togglePaddingHandler:Oe,toggleShowPaddingHandler:tt,toggleShowBackgroundHandler:Ee,toggleShowBorderHandler:Ge,toggleShowBorderRadiusHandler:Xe,toggleShowBoxShadowHandler:X,setLinkProtocol:he,handleChangeValues:ge})})})]})};vs.propTypes={elementSettings:g.default.object.isRequired};var Is=({elementSettings:e})=>{const{__:i}=s.useI18n(),[r]=o.ui_kit$Form.useForm(),a=s.useSendPostMessage();(0,d.useEffect)(()=>{e&&r.setFieldsValue({...e})},[r,e]);const l=n=>{a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:n})};return(0,t.jsx)(o.ui_kit$Form,{form:r,layout:"vertical",name:"selected_variable_form",initialValues:{value:""},onValuesChange:l,autoComplete:"off",children:(0,t.jsx)(o.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,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},style:{marginBottom:35},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:4,placeholder:i("Variable value")})})})};Is.propTypes={elementSettings:g.default.object.isRequired};var Cs=({elementSettings:e,setElementSettings:i,postfix:r="",form:a,handleSelect:l,previewReloadSignal:n})=>{const{__:c}=s.useI18n(),{token:m}=(0,o.ui_kit$useToken)(),f=s.useAppConfig(),_=s.useSendPostMessage(),k="src"+r,b="title"+r,h="alt"+r,y="link"+r,x="imgReplacer"+r,E=(0,d.useRef)(null),w=(0,d.useRef)(null),I=(0,d.useRef)(null),A=(0,d.useRef)(null),v=(0,d.useRef)(null),P=(0,d.useRef)(null),C=(0,d.useRef)(null),Y=(0,d.useRef)(null),[W,F]=(0,d.useState)(""),[N,T]=(0,d.useState)(""),[J,Z]=(0,d.useState)(""),[se,te]=(0,d.useState)(!1),[ne,_e]=(0,d.useState)("https://"),le=(0,d.useRef)(!1),fe=(0,d.useRef)(r);(0,d.useEffect)(()=>{r!==fe.current&&(fe.current=r,le.current=!1),T(e.images?.[h]),Z(e.images?.[b]);const Q=e.images?.[y];F(Q||(le.current?"...":""))},[e,h,b,y,r]);const Ae=()=>{W?(le.current=!1,F(""),a.setFieldValue(y,""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[y]:""}})):(le.current=!0,F(E.current&&E.current.input.value?E.current.input.value:"..."),setTimeout(()=>{E.current.focus()}))},ce=Q=>{Q.target.value===""?F("..."):(w.current.classList.add("selected-td-form__button--active"),F(Q.target.value));const q=Q.target.value;Gt(q,_e)},$e=()=>{N?(T(""),a.setFieldValue("alt",""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(T(I.current&&I.current.input.value?I.current.input.value:"..."),setTimeout(()=>{I.current.focus()}))},Ce=Q=>{Q.target.value===""?T("..."):(A.current.classList.add("selected-td-form__button--active"),T(Q.target.value))},ie=()=>{J?(Z(!1),a.setFieldValue("title",""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[b]:""}})):(Z(v.current&&v.current.input.value?v.current.input.value:"..."),setTimeout(()=>{v.current.focus()}))},Be=()=>{te(!se),se?(a.setFieldValue(x,""),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[x]:""}})):setTimeout(()=>C.current.focus())},ae=Q=>{Q.target.value!==""&&Y.current.classList.add("selected-td-form__button--active")},oe=Q=>{Q.target.value===""?Z("..."):(P.current.classList.add("selected-td-form__button--active"),Z(Q.target.value))},me=Q=>{a.setFieldValue("LinkName",Q!=="mergetag"?Q:""),_e(Q)},de=Q=>{const q=a.getFieldsValue(!0),z=+r.substring(1),G=Object.keys(q?.images).reduce((ke,he)=>(he.includes(r)||(ke[he]=q[he]),ke),{}),re=e.carouselImages?.filter((ke,he)=>he!==z);i(ke=>({...ke,settings:{...ke.settings,carouselImages:re}})),_({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:re}}),a.setFieldsValue({images:G})};return(0,t.jsxs)(t.Fragment,{children:[(e.type==="img"||e.type==="video"||e.type==="carousel")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Ot,{form:a,label:c("Image path"),name:k,placeholder:c("Image path"),elementSettings:e,previewReloadSignal:n,tooltipTitle:""})}),(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:N||c("Alternative text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!N}),onClick:$e,ref:A,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),f.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:J||c("Tooltip text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!J}),onClick:ie,ref:P,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:W||c("Hyperlink URL"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":!!W}),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:Ae,ref:w})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":se}),icon:(0,t.jsx)(s.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Be,ref:Y})})]}),(0,t.jsx)(o.ui_kit$Space,{size:8,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:de,icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16})})})})]}),(!!W||!!N||!!J||!!se)&&(0,t.jsxs)("div",{children:[!!W&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oo,{show:ne==="#",__:c,style:{marginBottom:m.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:y,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:ne,handleLinkProtocolsChange:me,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:E,onChange:ce,onSelect:l,prefix:(0,t.jsx)(eo,{linkProtocol:ne})})})})]}),!!N&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Ce,ref:I,onSelect:l})})}),f.formFieldImageTitleEnabled&&!!J&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:b,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:oe,ref:v,onSelect:l})})}),!!se&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:x,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:ae,ref:C,onSelect:l})})})]})]})};Cs.propTypes={};var Ps=({form:e,elementSettings:i,formFields:r,setElementSettings:a,borderRadiusShow:l,oneBorderRadiusValue:n,setOneBorderRadiusValue:c,linkProtocol:m,mergeTagItems:f,mergeMenuOpen:_,setMergeMenuOpen:k,cascaderRef:b,handleLinkProtocolsChange:h,handleSelect:y,onChange:x,filter:E,renderSearchOption:w,toggleShowBorderRadiusHandler:I,setNewSlide:A})=>{const{__:v}=s.useI18n(),{token:P}=(0,o.ui_kit$useToken)(),C=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oo,{show:m==="#",__:v,style:{marginBottom:P.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:v("Link for all slides"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(to,{linkProtocol:m,handleLinkProtocolsChange:h,__:v}),placeholder:v("Link for all slides"),allowClear:!0,onSelect:y,prefix:(0,t.jsx)(eo,{linkProtocol:m})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),C.mergeTagsShow&&f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:P.formItemMarginBottomMD,marginTop:P.formItemMarginBottomMD},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(s.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:_?"none":"inline-flex"},onClick:()=>k(!0),children:v("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:b,classNames:{popup:{root:"merge-tags"}},options:f,placeholder:v("Start typing the title"),showSearch:{filter:E,render:w},spellCheck:"false",getPopupContainer:Y=>Y.closest(".email-pane__collapse-wrapper"),onChange:x,style:{display:_?"block":"none"},open:_,onKeyDown:Y=>{Y.key==="Escape"&&k(!1)}})]})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,t.jsx)(o.ui_kit$Form.List,{name:"images",initialValue:r?.images,children:()=>(0,t.jsx)("div",{style:{paddingTop:P.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((Y,W)=>(0,t.jsx)("div",{className:"carousel__slide",children:(0,t.jsx)(Cs,{elementSettings:r,setElementSettings:a,postfix:"_"+W,form:e,handleSelect:y})},W))})}),(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:P.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{id:"add_slide_button",icon:(0,t.jsx)(s.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),style:{width:"100%"},onClick:()=>A(),children:v("Add slide")})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginTop:P.formItemMarginBottomMD-10},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:P.formItemMarginBottomMD-6},children:(0,t.jsx)(o.ui_kit$Switch,{id:"Loop",label:v("Loop"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:P.formItemMarginBottomMD-6},children:(0,t.jsx)(o.ui_kit$Switch,{id:"Autoplay",label:v("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:v("Border radius"),collapsible:!0,open:l,onToggle:I,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:n,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};Ps.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,formFields:g.default.object,setElementSettings:g.default.func,borderRadiusShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,toggleShowBorderRadiusHandler:g.default.func,setNewSlide:g.default.func};var As=()=>{const{__:e}=s.useI18n();return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("p",{children:e("No properties to edit.")})})};As.propTypes={};var Ns=2e3;function nd(e){const i=(0,d.useRef)([]),r=(0,d.useRef)(e);return r.current=e,{remember:(0,d.useCallback)(a=>{const l=Date.now(),n=i.current.filter(c=>l-c.at<Ns);n.push({key:JSON.stringify(r.current(a)),at:l}),i.current=n.slice(-10)},[]),isOwnEcho:(0,d.useCallback)(a=>{if(!a)return!1;const l=Date.now(),n=JSON.stringify(r.current(a));return i.current.some(c=>l-c.at<Ns&&c.key===n)},[])}}var dd={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 cd(e){const i={...Ii(e)};return delete i.parent,delete i.path,i}var Ls=({elementSettings:e})=>{const{__:i}=s.useI18n(),[r]=o.ui_kit$Form.useForm();let a=s.useDispatch();s.useAppConfig();const l=s.useSendPostMessageEx(),n=s.useSendPostMessage(),{openImagePicker:c}=s.useImagePicker(),m=s.useSelector(s.selectEmailViewType),f=s.useSelector(s.selectMobileViewActive),[_,k]=(0,d.useState)(!0),[b,h]=(0,d.useState)(!0),[y,x]=(0,d.useState)(!1),[E,w]=(0,d.useState)(!1),[I,A]=(0,d.useState)("https://"),[v,P]=(0,d.useState)(r?.getFieldsValue(!0)),[C,Y]=(0,d.useState)(e),{remember:W,isOwnEcho:F}=nd(cd),[N,T]=(0,d.useState)(e);e!==N&&(T(e),F(e?.settings)||Y(e));const[J,Z]=(0,d.useState)({name:"",counter:0}),[se,te]=(0,d.useState)(null),[ne,_e]=(0,d.useState)(),[le,fe]=(0,d.useState)(!1),[Ae,ce]=(0,d.useState)(!1),[$e,Ce]=(0,d.useState)({start:0,end:0}),ie=(0,d.useRef)(null),Be=`selected_${C.type}_form_link`,ae=s.useSelector(s.selectIsCodeMode),oe=s.useSelector(s.selectCodeModeDirection),me=ae&&oe!=="bottom";(0,d.useEffect)(()=>{le&&ie.current&&ie.current.focus()},[le]);const de=(K,ve)=>{const Re=document.getElementById(ve);if(Re){const Le=`selected_${C.type}_form_${ve.includes("__images_")?"_images":""}_`,Ue=ve.substring(ve.indexOf(Le)+Le.length),Me=Re.value?.substring(0,$e.start),He=Re.value?.substring($e.end);let O={[Ue]:Me+K+He};Ue.includes("_")?(O={carouselImages:[...C.settings?.carouselImages||[]]},O.carouselImages[Ue.split("_")[1]][Ue.split("_")[0]]=Me+K+He):C.type===s.ELEMENT_TYPES.CAROUSEL&&Be===ve&&(O={[Ue]:Me+K+He,carouselImages:[...C.settings?.carouselImages.map(xe=>({...xe,link:Me+K+He}))||[]]}),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,settings:{...C.settings,...O}}),Y(xe=>({...xe,settings:{...xe.settings,...O}})),r.setFieldValue(Ue,Me+K+He),Re.focus(),setTimeout(()=>{Re.selectionStart=$e.start,Re.selectionEnd=$e.start+K.length},400),ce(!0)}},Q=s.useAppConfig().mergeTags;(0,d.useEffect)(()=>{Q?.items?.length&&_e(s.mapMargeTags(Q.items,i,(K,ve)=>{fe(!1),l(s.EVENT_TYPES.SANDBOX_ADD_MERGETAG,K),ve.stopPropagation(),ve.preventDefault()}))},[Q,_e,i,fe,l]);const q=(K,ve)=>{if(fe(!1),K){const Re=Q.syntax.length>1?ne.findIndex(Me=>Me.key===ve[0].key):0,Le=Q.syntax[Re].replace("%value%",K[K.length-1]),Ue=`selected_${C.type}_form${C.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Me=>se?.getAttribute("id").includes(`${Ue}_${Me}`))||se?.getAttribute("id").includes(Be)?de(Le,se?.getAttribute("id")):(r.setFieldValue("imgReplacer",Le),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,settings:{...C.settings,imgReplacer:Le}}),Y(Me=>({...Me,settings:{...Me.settings,imgReplacer:Le}})))}},z=s.useRootElement();(0,d.useEffect)(()=>{const K=({target:Le})=>{Le.closest('[id="merge_tags_wrapper"]')||te(Le)},ve=({target:Le})=>{!Le.closest(".merge-tags")&&!Le.closest("#merge_tags_button")&&fe(!1)},Re=new De.Disposable;return Re.addDisposable(s.addWindowListenerFromShadow(z,"focusin",K)),Re.addDisposable(s.addWindowListenerFromShadow(z,"click",ve)),()=>{Re.dispose()}},[z]);const G=(K,ve)=>ve.some(Re=>Re.label.toLowerCase().indexOf(K.toLowerCase())>-1),re=(K,ve)=>{const Re=ve.map((Le,Ue)=>{const Me=Le.label.split(new RegExp(`(${K})`,"gi"));return(0,t.jsxs)("span",{children:[Ue!==0&&(0,t.jsx)("span",{children:" / "}),Me.map((He,O)=>He.toLowerCase()===K.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:He},O):He)]},Le.value)});return(0,t.jsx)("div",{title:ve.map(Le=>Le.label).join(" / "),children:Re})};(0,d.useEffect)(()=>{const K=r?.getFieldsValue(!0);P(K)},[r]);const ke=({target:K})=>{if(K&&!Ae){const{selectionStart:ve,selectionEnd:Re}=K;Ce({start:ve,end:Re})}ce(!1)};(0,d.useEffect)(()=>{if(C.settings){const K=C.settings,ve=Ii(K);r?.setFieldsValue(ve),P(ve),K.link&&A(zo(K.link,"https://")),u(K.borderRadius?.all)||(u(K.borderRadius?.topLeft)||u(K.borderRadius?.bottomLeft)||u(K.borderRadius?.topRight)||u(K.borderRadius?.bottomRight)?k(!1):u(K.borderRadius?.all)||k(!0)),u(K.mobileBorderRadius?.topLeft)||u(K.mobileBorderRadius?.bottomLeft)||u(K.mobileBorderRadius?.topRight)||u(K.mobileBorderRadius?.bottomRight)?h(!1):h(!0),x(!!K.borderRadius?.all||!!K.borderRadius?.topLeft||!!K.borderRadius?.bottomLeft||!!K.borderRadius?.topRight||!!K.borderRadius?.bottomRight),w(!!K.mobileBorderRadius?.all||!!K.mobileBorderRadius?.topLeft||!!K.mobileBorderRadius?.bottomLeft||!!K.mobileBorderRadius?.topRight||!!K.mobileBorderRadius?.bottomRight)}},[r,C]);const he=K=>{const ve=Yr(C.settings,r,K);n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,caption:ve.caption,settings:ve}),W({...C.settings,...ve}),Y(Re=>({...Re,settings:{...Re.settings,...ve}}))},Pe=(K,ve)=>{const Re=kt(C.settings?.src||"")===kt(K||"");(!Re||K!==C.settings?.src)&&he({src:K}),ve?.mode==="save"&&Re&&(Z(Le=>({name:"src",counter:Le.counter+1})),n({operation:s.EVENT_TYPES.SANDBOX_IMAGE_RESET,url:String(K)}))},ye=async K=>{const ve=C.settings?.src||"",Re=kt(ve),Le=await c({kind:"img",currentUrl:Uo(Re)?"":Re,entryModal:K});Le?.url&&Pe(Le.url,Le.meta)},V=K=>{const ve=K.data.operation;ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_AI):ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_EDIT):ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_GIF):ve===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?ye(s.MODALS.UPLOAD_IMAGE_MODAL_STOCK):ve===s.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(a(s.closeSecondModal()),a(s.closeModal$1()))};s.useListenPostMessage(V);const ee=()=>{setTimeout(()=>{x(K=>!K),r.setFieldValue("borderRadiusAll",y?0:5),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,settings:{...C.settings,borderRadius:{all:y?"":5}}}),Y(K=>({...K,settings:{...K.settings,borderRadius:{all:y?null:5}}}))})},we=K=>{r.setFieldValue("link",K!=="mergetag"?K:""),A(K)},je=()=>{const{width:K,height:ve,renderedWidth:Re,renderedHeight:Le}=C?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Ue={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:K.value,dim:"px"},height:{value:ve.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Re,renderedHeight:Le,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},Me=[...C?.settings?.carouselImages,Ue];n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.CAROUSEL,settings:{...C.settings,carouselImages:Me}}),Y(He=>({...He,settings:{...He.settings,carouselImages:Me}}))};return(0,t.jsxs)(o.ui_kit$Form,{form:r,layout:"vertical",name:"selected_carousel_form",initialValues:dd,onValuesChange:he,autoComplete:"off",className:"element-controls",children:[!me&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),m==="mobile"&&f.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(As,{})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Ps,{form:r,elementSettings:C,formFields:v,setElementSettings:Y,borderRadiusShow:y,oneBorderRadiusValue:_,setOneBorderRadiusValue:k,linkProtocol:I,mergeTagItems:ne,mergeMenuOpen:le,setMergeMenuOpen:fe,cascaderRef:ie,handleLinkProtocolsChange:we,handleSelect:ke,onChange:q,filter:G,renderSearchOption:re,toggleShowBorderRadiusHandler:ee,setNewSlide:je})})]})};Ls.propTypes={};var ud={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Os=({elementSettings:e})=>{const{__:i}=s.useI18n(),{token:r}=(0,o.ui_kit$useToken)(),[a]=o.ui_kit$Form.useForm(),l=s.useSendPostMessage(),n=s.useAppConfig(),[c,m]=(0,d.useState)(e),[f,_]=(0,d.useState)(e);e!==f&&(_(e),m(e)),(0,d.useEffect)(()=>{if(c.settings){const y=c.settings,x=Ii(y);a?.setFieldsValue(x)}},[a,c]);const k=y=>{const x=Yr(c.settings,a,y);l({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:x.caption,settings:x}),m(E=>({...E,settings:{...E.settings,...x}}))},b=()=>{m(y=>({...y,sections:c?.settings?.sections.push({expanded:!1})})),l({operation:s.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.")}})},h=y=>{m(x=>({...x,settings:{...x.settings,sections:c.settings.sections?.filter((E,w)=>w!==y)}})),l({operation:s.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:y}})};return(0,t.jsx)(o.ui_kit$Form,{form:a,layout:"vertical",name:"selected_carousel_form",initialValues:ud,onValuesChange:k,autoComplete:"off",className:"element-controls",children:(0,t.jsxs)("div",{id:"selected_element_form_desktop_props",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:15,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"expandSingleSection",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"ExpandSingleSection",label:i("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,t.jsx)(o.ui_kit$Col,{span:9,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"animate",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"Animate",label:i("Animate"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsx)(o.ui_kit$Form.List,{name:"sections",children:()=>(0,t.jsx)("div",{style:{paddingTop:r.formItemMarginBottomMD+4},children:c?.settings?.sections?.map((y,x)=>(0,t.jsxs)(o.ui_kit$Row,{gutter:24,children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsxs)(o.ui_kit$Space,{size:10,align:"baseline",children:[(0,t.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(x+1)}),(0,t.jsx)(o.ui_kit$Form.Item,{name:`expanded_${x}`,valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:`expanded_${x}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,t.jsx)(o.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,t.jsx)(o.ui_kit$Button,{type:"text",icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>h(x)})})]},`expanded_${x}`))})}),(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:r.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,t.jsx)(s.EmIcons,{icon:"PlusCircleOutlined",component:o.icons$PlusCircleOutlined,size:16,strokeWidth:n.iconStrokeWidth}),onClick:()=>b(),children:i(" Add section")})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};Os.propTypes={};var{Text:md}=o.ui_kit$Typography,pd="blocks",Fs="text/plain",hd=(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),bd=(0,t.jsx)("span",{className:"addon-text-content",children:"Title"});function Lt(e){return e.closest(".email-pane__collapse-wrapper")}function Jo({form:e,name:i,placeholder:r,usedColors:a,onColorChange:l}){const n=o.ui_kit$Form.useWatch(i,e);return(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:r,usedColors:a,value:typeof n=="string"?n:"",onChange:c=>l(i,c)})}var fd=/^[a-z][a-z0-9+.-]*:/i;function $s(e){const i=io(typeof e=="string"?e:String(e??""));return i?fd.test(i)?i:`https://${i}`:""}function gd(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 _d(e){const i=$s(e);if(!i)return!1;try{const r=new URL(i);return!(r.protocol!=="http:"&&r.protocol!=="https:"||!r.hostname)}catch{return!1}}async function Ms(e,i){if(i===s.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&Uo(e)){try{const r=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,a=await fetch(r);if(a.ok){const l=await a.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((n,c)=>{const m=new FileReader;m.onload=()=>n(m.result),m.onerror=c,m.readAsDataURL(l)})}}}catch{}return{entryModal:s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function xd(){const e=s.useSelector(s.selectEditorThemeColor$1),[i,r]=(0,d.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,d.useEffect)(()=>{const a=()=>r(document.body.classList.contains("dark"));a();const l=new MutationObserver(a);return l.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>l.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function kd(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function Qo(e,i,r){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(r??"").trim()}}function Ds(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 Vs(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(a=>a.customIcon?"":String(a?.itemBorderColor??"").trim()),r=i[0];return i.every(a=>a===r)?r:""}function Zo(e,i){const r=String(e??"").trim(),a=String(i??"").trim();return a||r}function Ed(e,i){const r=String(e??"").trim(),a=String(i??"").trim();return!a||r&&a===r?"":a}function Bd(e,i,r){const a=String(e??"").trim(),l=String(i??"").trim(),n=String(r??"").trim();return n&&(!a||n!==a)?n:l}function Td(e,i){return(e||[]).map(r=>({...r,itemBorderColor:r.customIcon?"":i}))}function Sd(e,i,r){return(e||[]).map(a=>({...a,buttonBgColor:a.customIcon?"":Bd(i,r,a.buttonBgColor)}))}function yd(e,i){if(e==null)return;const r=(a,l)=>{if(!l||!Object.prototype.hasOwnProperty.call(l,"platform"))return;const n=l.platform;n==null||n===""||i(a,n)};if(Array.isArray(e))e.forEach((a,l)=>{r(l,a)});else if(typeof e=="object")for(const a of Object.keys(e)){const l=Number.parseInt(a,10);Number.isNaN(l)||r(l,e[a])}}function Us({__:e,form:i,fieldName:r,pushSettingsToIframe:a,onMetaActiveChange:l}){const{token:n}=(0,o.ui_kit$useToken)(),c=o.ui_kit$Form.useWatch(["items",r],i),m=c&&typeof c=="object"?c:{},f=typeof m.alt=="string"?m.alt:"",_=typeof m.title=="string"?m.title:"",[k,b]=(0,d.useState)(!1),[h,y]=(0,d.useState)(!1),x=(0,d.useRef)(null),E=(0,d.useRef)(null),w=(0,d.useMemo)(()=>({clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,d.useEffect)(()=>{f.trim()&&b(!0)},[f]);const I=!!(f.trim()||k),A=!!(_.trim()||h),v=I||A;(0,d.useLayoutEffect)(()=>{l(r,{alt:I,title:A})},[I,r,l,A]);const P=(0,d.useMemo)(()=>({marginBottom:v?n.formItemMarginBottomXS:0}),[v,n.formItemMarginBottomXS]),C=(0,d.useMemo)(()=>[r,"alt"],[r]),Y=(0,d.useMemo)(()=>[r,"title"],[r]),W=v?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",F=I?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",N=A?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",T=(0,d.useMemo)(()=>f.trim()?f.trim():e("Alternative text"),[e,f]),J=(0,d.useMemo)(()=>_.trim()?_.trim():e("Tooltip text"),[e,_]),Z=(0,d.useMemo)(()=>(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":I}),[I]),se=(0,d.useMemo)(()=>(0,Ve.default)("selected-td-form__button",{"selected-td-form__button--active":A}),[A]),te=(0,d.useCallback)(le=>{setTimeout(()=>{const fe=le.current;if(fe){if(typeof fe.focus=="function"){fe.focus();return}fe.input&&typeof fe.input.focus=="function"&&fe.input.focus()}},0)},[]),ne=(0,d.useCallback)(()=>{I?(b(!1),f.trim()&&(i.setFieldValue(["items",r,"alt"],""),setTimeout(()=>a(),0))):(b(!0),te(x))},[I,f,r,te,i,a]),_e=(0,d.useCallback)(()=>{if(A)l(r,{title:!1}),y(!1),_.trim()&&(i.setFieldValue(["items",r,"title"],""),setTimeout(()=>a(),0));else{y(!0),l(r,{title:!0});const le=f.trim();i.setFieldValue(["items",r,"title"],le),setTimeout(()=>a(),0),te(E)}},[f,r,te,i,l,a,A,_]);return(0,t.jsxs)("div",{className:"selected-social-form__meta-block",children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected-social-form__meta-toggle-row",style:P,children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:T,placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Button,{type:"default",className:Z,onClick:ne,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:J,placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Button,{type:"default",className:se,onClick:_e,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,t.jsxs)("div",{className:W,children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:C,className:F,children:(0,t.jsx)(o.ui_kit$Input,{ref:x,placeholder:e("Alternative text"),allowClear:w,prefix:hd})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:Y,className:N,children:(0,t.jsx)(o.ui_kit$Input,{ref:E,placeholder:e("Social network name"),allowClear:w,prefix:bd})})]})]})}Us.propTypes={__:g.default.func.isRequired,form:g.default.object.isRequired,fieldName:g.default.oneOfType([g.default.number,g.default.string]).isRequired,pushSettingsToIframe:g.default.func.isRequired,onMetaActiveChange:g.default.func.isRequired};function Rd(e,i){if(!Array.isArray(e)||e.length===0)return i;let r=null;for(const a of e){const l=a.iconWidth;if(l==null||Number.isNaN(l)||l<=0)return i;if(r===null)r=l;else if(l!==r)return i}return r??i}function wd(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=kd(e),r=String(e?.hostCellBgForIconLuminance??"").trim(),a=Rd(e.items,e.iconSize??40),l=typeof e.buttonBorderWidth=="number"&&!Number.isNaN(e.buttonBorderWidth)?e.buttonBorderWidth:0,n=e.bgEnabled&&e.bgColor?String(e.bgColor).trim():"";return{align:e.align??"center",iconSize:a,borderRadius:e.borderRadius??0,gap:e.gap??8,globalBgColor:n,globalItemBorderColor:Vs(e.items),buttonBorderWidth:l,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const m=!!c.customIcon,f=m?"":Zo(n,c.buttonBgColor),_=c.platform&&!m?s.getSocialIconForBlockCell(c.platform,Qo(i,f,r)):null;return{...c,customIcon:m,title:String(c.title??"").trim(),..._?{iconSrc:_}:{},iconWidth:null,iconHeight:null,buttonBgColor:f,itemBorderColor:m?"":String(c.itemBorderColor??"").trim()}}):[]}}var Hs=({elementSettings:e})=>{const{__:i}=s.useI18n(),r=s.useAppConfig(),a=s.useDispatch(),[l]=o.ui_kit$Form.useForm(),n=s.useSendPostMessage(),{openImagePicker:c}=s.useImagePicker(),[m,f]=(0,d.useState)(e),[_,k]=(0,d.useState)(null),[b,h]=(0,d.useState)(null),y=(0,d.useRef)(null),x=(0,d.useRef)(null),E=(0,d.useRef)(null),w=(0,d.useRef)(Ds(e)),I=s.useSelector(s.selectEmailSettings),A=(0,d.useRef)(null),v=(0,d.useRef)(!1),P=(0,d.useRef)(""),C=(0,d.useRef)({}),Y=xd(),W=I?.usedColors??[],F=o.ui_kit$Form.useWatch("items",l)||[],N=(0,d.useCallback)(()=>{A.current&&(document.removeEventListener("dragover",A.current,!0),A.current=null)},[]),T=(0,d.useCallback)(()=>{if(A.current)return;const V=ee=>{ee.preventDefault(),ee.dataTransfer&&(ee.dataTransfer.dropEffect="move")};document.addEventListener("dragover",V,!0),A.current=V},[]),J=(0,d.useMemo)(()=>s.getSocialPresetsForBrand(pd).filter(V=>s.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[V.id]),[]),Z=(0,d.useMemo)(()=>J.map(V=>({value:V.id,label:(0,t.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,t.jsx)("img",{src:s.getSocialIcon(V.id,Y),alt:""}),(0,t.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(V.labelMsgid)})]})})),[i,J,Y]),se=(0,d.useCallback)((V,ee)=>{C.current={...C.current,[V]:{...C.current[V],...ee}}},[]);(0,d.useEffect)(()=>{const V=Ds(e);w.current!==V&&(w.current=V,C.current={},f(e))},[e]);const te=(0,d.useRef)(!1);(0,d.useEffect)(()=>{if(m?.settings){if(te.current){te.current=!1;return}const V=m.settings;P.current=V.bgEnabled&&V.bgColor?String(V.bgColor).trim():"",l.setFieldsValue(wd(m.settings))}},[m,l]),(0,d.useEffect)(()=>()=>N(),[N]);const ne=(0,d.useCallback)(()=>{const V=l.getFieldsValue(!0),ee=m.settings||{},we=String(ee.hostCellBgForIconLuminance??"").trim(),je=(V.globalBgColor||"").trim(),K=typeof V.iconSize=="number"&&!Number.isNaN(V.iconSize)?V.iconSize:ee.iconSize??40,ve=typeof V.borderRadius=="number"&&!Number.isNaN(V.borderRadius)?V.borderRadius:ee.borderRadius??0,Re=typeof V.gap=="number"&&!Number.isNaN(V.gap)?V.gap:ee.gap??8,Le={blockBgEnabled:!!je,blockBgColor:je},Ue=(V.globalItemBorderColor||"").trim();let Me=typeof V.buttonBorderWidth=="number"&&!Number.isNaN(V.buttonBorderWidth)?V.buttonBorderWidth:0;Me=Math.max(0,Math.min(24,Math.round(Me)));const He={...ee,type:"social",align:V.align??ee.align??"center",iconSize:K,borderRadius:ve,gap:Re,bgEnabled:!!je,bgColor:je,hostCellBgForIconLuminance:we,borderWidth:typeof ee.borderWidth=="number"?ee.borderWidth:0,borderColor:typeof ee.borderColor=="string"?ee.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Me,showLabel:V.showLabel,items:(V.items||[]).filter(Boolean).map((O,xe)=>{const D=!!O.customIcon,ue=C.current[xe]||{},ge=D?"":Ed(je,(O.buttonBgColor||"").trim()),Oe=typeof O.href=="string"?$s(O.href):O.href,Ge=D?"":Zo(je,ge),Ye=!D&&O.platform?s.getSocialIconForBlockCell(O.platform,Qo(Le,Ge,we)):null,Xe=D?"":Ue||String(O.itemBorderColor??"").trim(),R=gd(D?O.iconSrc||"":Ye||O.iconSrc||"");return{...O,customIcon:D,href:Oe,iconSrc:R,iconWidth:null,iconHeight:null,buttonBgColor:ge,itemBorderColor:Xe,title:ue.title?String(O.title??"").trim():""}})};n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.ELEMENT_TYPES.SOCIAL,caption:m.caption,settings:He}),P.current=je,te.current=!0,f(O=>({...O,settings:He}))},[m.caption,m.settings,l,n]),_e=(0,d.useCallback)(V=>{if(V==null||V==="")return-1;const ee=kt(String(V));return(l.getFieldValue("items")||[]).findIndex(we=>kt(we&&we.iconSrc||"")===ee)},[l]),le=(0,d.useCallback)((V,ee,we,je)=>{const K=[...l.getFieldValue("items")||[]];if(V<0||V>=K.length)return;const ve=kt(String(je||""))===kt(String(ee||""));(!ve||ee!==K[V]?.iconSrc)&&(K[V]={...K[V],iconSrc:ee,customIcon:!0,buttonBgColor:"",itemBorderColor:""},l.setFieldValue("items",K),setTimeout(()=>ne(),0)),we?.mode==="save"&&ve&&n({operation:s.EVENT_TYPES.SANDBOX_IMAGE_RESET,url:String(ee)})},[l,ne,n]),fe=(0,d.useCallback)(async(V,ee)=>{const we=kt(String(ee||"")),je=_e(ee);if(je<0)return;const K=(l.getFieldValue("items")||[])[je]?.iconSrc,{entryModal:ve,currentUrl:Re,imageDataUrl:Le}=await Ms(we,V),Ue=await c({kind:"img",currentUrl:Re,entryModal:ve,imageDataUrl:Le});Ue?.url&&le(je,Ue.url,Ue.meta,K)},[le,_e,l,c]),Ae=(0,d.useCallback)(async V=>{const ee=(l.getFieldValue("items")||[])[V];if(!ee)return;const{entryModal:we,currentUrl:je,imageDataUrl:K}=await Ms(kt(String(ee.iconSrc||"")),s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),ve=ee.iconSrc,Re=await c({kind:"img",currentUrl:je,entryModal:we,imageDataUrl:K});Re?.url&&le(V,Re.url,Re.meta,ve)},[le,l,c]),ce=(0,d.useCallback)(V=>{const ee=parseInt(V.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(ee)||Ae(ee)},[Ae]),$e=(0,d.useCallback)(V=>{const ee=V.data?.operation,we=V.data?.src;ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_AI,we):ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,we):ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_EDIT,we):ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_GIF,we):ee===s.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?fe(s.MODALS.UPLOAD_IMAGE_MODAL_STOCK,we):ee===s.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(a(s.closeSecondModal()),a(s.closeModal$1()))},[a,fe]);s.useListenPostMessage($e);const Ce=(0,d.useCallback)(()=>{const V=l.getFieldValue("items")||[],ee=J[0],we=(l.getFieldValue("globalItemBorderColor")||"").trim(),je=(l.getFieldValue("globalBgColor")||"").trim();if(!ee)l.setFieldsValue({items:[...V,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:je,itemBorderColor:we}]});else{const K=String(m?.settings?.hostCellBgForIconLuminance??"").trim(),ve=Zo(je,je),Re=s.getSocialIconForBlockCell(ee.id,Qo({blockBgEnabled:!!je,blockBgColor:je},ve,K)),Le=i(ee.labelMsgid);l.setFieldsValue({items:[...V,{platform:ee.id,customIcon:!1,href:"",alt:Le,title:"",iconSrc:Re,iconWidth:null,iconHeight:null,buttonBgColor:je,itemBorderColor:we}]})}setTimeout(()=>ne(),0)},[i,m?.settings?.hostCellBgForIconLuminance,l,J,ne]),ie=(0,d.useCallback)((V,ee)=>{V.dataTransfer.setData(Fs,String(ee)),V.dataTransfer.setData(s.DND_SOCIAL_LIST_REORDER_MIME,String(ee)),V.dataTransfer.effectAllowed="move",y.current=ee,k(ee),T()},[T]),Be=(0,d.useCallback)(()=>{N(),y.current=null,k(null),h(null)},[N]),ae=(0,d.useCallback)((V,ee,we)=>{if(we<2)return;V.preventDefault(),V.dataTransfer.dropEffect="move";const je=y.current;je!==null&&je!==ee&&h(ee)},[]),oe=(0,d.useCallback)((V,ee)=>{V.currentTarget.contains(V.relatedTarget)||h(we=>we===ee?null:we)},[]),me=(0,d.useCallback)((V,ee,we)=>{V.preventDefault(),h(null);const je=V.dataTransfer.getData(Fs),K=parseInt(je,10);if(Number.isNaN(K)||K===ee){N();return}we(K,ee),N(),setTimeout(()=>ne(),0)},[N,ne]),de=(0,d.useCallback)(V=>{const ee=V.currentTarget,we=parseInt(ee.dataset.itemIndex??"",10);Number.isNaN(we)||ie(V,we)},[ie]),Q=(0,d.useCallback)(V=>{const ee=V.currentTarget,we=parseInt(ee.dataset.itemIndex??"",10),je=parseInt(ee.dataset.listLength??"",10);Number.isNaN(we)||Number.isNaN(je)||je<2||(V.preventDefault(),V.dataTransfer&&(V.dataTransfer.dropEffect="move"))},[]),q=(0,d.useCallback)(V=>{const ee=V.currentTarget,we=parseInt(ee.dataset.itemIndex??"",10),je=parseInt(ee.dataset.listLength??"",10);Number.isNaN(we)||Number.isNaN(je)||ae(V,we,je)},[ae]),z=(0,d.useCallback)(V=>{const ee=parseInt(V.currentTarget.dataset.itemIndex??"",10);Number.isNaN(ee)||oe(V,ee)},[oe]),G=(0,d.useCallback)(V=>{const ee=parseInt(V.currentTarget.dataset.itemIndex??"",10),we=x.current;Number.isNaN(ee)||typeof we!="function"||me(V,ee,we)},[me]),re=(0,d.useCallback)(V=>{V.stopPropagation();const ee=parseInt(V.currentTarget.dataset.fieldName??"",10),we=E.current;Number.isNaN(ee)||typeof we!="function"||(we(ee),queueMicrotask(ne))},[ne]),ke=(0,d.useCallback)((V,ee)=>{const we=J.find(He=>He.id===ee);if(!we)return;const je=i(we.labelMsgid),K=C.current[V]||{},ve=String(l.getFieldValue(["items",V,"alt"])??"").trim();(K.alt||ve)&&l.setFieldValue(["items",V,"alt"],je),K.title&&l.setFieldValue(["items",V,"title"],je);const Re=(l.getFieldValue("globalBgColor")||"").trim(),Le=Zo(Re,(l.getFieldValue(["items",V,"buttonBgColor"])||"").trim()),Ue=String(m?.settings?.hostCellBgForIconLuminance??"").trim(),Me=s.getSocialIconForBlockCell(ee,Qo({blockBgEnabled:!!Re,blockBgColor:Re},Le,Ue));Me&&(l.setFieldValue(["items",V,"customIcon"],!1),l.setFieldValue(["items",V,"iconSrc"],Me))},[i,m?.settings?.hostCellBgForIconLuminance,l,J]),he=(0,d.useCallback)(V=>{if(Object.prototype.hasOwnProperty.call(V,"globalItemBorderColor")){if(!v.current){const ee=String(V.globalItemBorderColor??"").trim(),we=l.getFieldValue("items")||[];l.setFieldsValue({items:Td(we,ee)})}}else if(Object.prototype.hasOwnProperty.call(V,"globalBgColor")){const ee=P.current,we=String(V.globalBgColor??"").trim(),je=l.getFieldValue("items")||[];l.setFieldsValue({items:Sd(je,ee,we)})}else if(V?.items!=null){const ee=l.getFieldValue("items")||[],we=Vs(ee);we!==(l.getFieldValue("globalItemBorderColor")||"").trim()&&(v.current=!0,l.setFieldValue("globalItemBorderColor",we),queueMicrotask(()=>{v.current=!1}));const je=m.settings?.items||[];ee.forEach((K,ve)=>{const Re=K?.platform,Le=je[ve]?.platform;Re&&Re!==Le&&ke(ve,Re)})}yd(V?.items,ke),ne()},[m.settings?.items,l,ne,ke]),Pe=(0,d.useCallback)((V,ee)=>{if(l.setFieldValue(V,ee),Array.isArray(V)&&V[0]==="items"){he({items:{[V[1]]:{[V[2]]:ee}}});return}he({[V]:ee})},[l,he]),ye=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"selected-social-form__section",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:i("General settings")}),(0,t.jsx)("div",{className:"selected-social-form__align-block",children:(0,t.jsx)(zt,{form:l,elementSettings:{...m,type:s.ELEMENT_TYPES.SOCIAL}})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button size"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"iconSize",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:16,max:64,prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px",placeholder:i("Button size"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Corner radius"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"borderRadius",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,t.jsx)(s.EmIcons,{icon:"BorderRadius",component:o.icons$BorderRadius,className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:i("Corner radius"),className:"selected-social-form__input-full"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Spacing"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,t.jsx)(s.EmIcons,{icon:"PaddingLeftRight",component:o.icons$PaddingLeftRight}),addonAfter:"px",placeholder:i("Spacing"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,t.jsx)(Jo,{form:l,name:"globalBgColor",placeholder:i("Background color"),usedColors:W,onColorChange:Pe})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:24,prefix:(0,t.jsx)(s.EmIcons,{icon:"BorderOuterOutlined",component:o.icons$BorderOuterOutlined}),addonAfter:"px",placeholder:i("Border"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,t.jsx)(Jo,{form:l,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:W,onColorChange:Pe})})})})]})]}),(0,t.jsxs)("div",{className:"selected-social-form__section selected-social-form__section--bordered",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:i("Social buttons")}),(0,t.jsx)(o.ui_kit$Form.List,{name:"items",children:(V,{remove:ee,move:we})=>(x.current=we,E.current=ee,(0,t.jsx)("div",{className:"selected-social-form__items",children:V.map((je,K)=>{const ve=!!(F[K]?.customIcon??F[je.name]?.customIcon);return(0,t.jsxs)("div",{className:(0,Ve.default)("selected-social-form__card",_===K&&"selected-social-form__card--dragging",b===K&&_!==K&&"selected-social-form__card--drag-over"),"data-item-index":K,"data-list-length":V.length,onDragEnterCapture:Q,onDragOverCapture:q,onDragLeave:z,onDropCapture:G,children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head-main",children:[V.length>1?(0,t.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":K,onDragStart:de,onDragEnd:Be,role:"button",tabIndex:0,"aria-label":i("Drag to reorder"),children:(0,t.jsx)(s.EmIcons,{icon:"HolderOutlined",component:o.icons$HolderOutlined})}):null,(0,t.jsxs)(md,{className:"selected-social-form__card-title",children:[i("Button")," ",K+1]})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:r.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":je.name,onClick:re})})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"iconSrc"],hidden:!0,children:(0,t.jsx)(o.ui_kit$Input,{})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"customIcon"],valuePropName:"checked",hidden:!0,children:(0,t.jsx)(o.ui_kit$Checkbox,{})}),(0,t.jsxs)("div",{className:"selected-social-form__platform-row",children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:Z,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,t.jsx)(s.EmIcons,{icon:"ChevronDownCustom",component:o.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":K,icon:(0,t.jsx)(s.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,size:18,strokeWidth:r.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:ce})})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Re,Le)=>{const Ue=typeof Le=="string"?Le.trim():String(Le??"").trim();if(Ue&&!_d(Ue))throw new Error(i("Please enter the correct URL."))}}],children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"Link03",component:o.icons$Link03,className:"selected-social-form__field-icon"}),placeholder:i("Enter link"),allowClear:{clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})}})}),ve?null:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,t.jsx)(Jo,{form:l,name:["items",je.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:W,onColorChange:Pe})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Lt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:[je.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,t.jsx)(Jo,{form:l,name:["items",je.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:W,onColorChange:Pe})})})})]}),(0,t.jsx)(Us,{__:i,form:l,fieldName:je.name,pushSettingsToIframe:ne,onMetaActiveChange:se})]},je.key)})}))}),(0,t.jsx)(o.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,t.jsx)(s.EmIcons,{icon:"PlusSquareOutlined",component:o.icons$PlusSquareOutlined}),onClick:Ce,children:i("Add button")})]})]});return(0,t.jsx)("div",{className:"selected-social-form",children:(0,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:he,autoComplete:"off",children:(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:ye})})})};Hs.propTypes={elementSettings:g.default.shape({settings:g.default.object,type:g.default.string,caption:g.default.string})};var Ws=s.BASIC_BORDER_COLOR,jd=(e,i,r,a,l,n,c="")=>{const m=e.getFieldsValue(!0),f=i?"cell_":c;setTimeout(()=>{i?a(_=>!_):r(_=>!_),l&&(m[f+"borderWidth"]=null,m[f+"borderColor"]="",m[f+"borderStyle"]=""),n(_=>({...s.RESET_BORDER_PARAMS,[m[f+"borderPosition"]]:{..._[m[f+"borderPosition"]],width:m[f+"borderWidth"],color:m[f+"borderColor"],style:m[f+"borderStyle"]}}))})},vd=(e,i,r,a,l,n,c)=>{const m=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),!r&&!a[m?.mobileBorderPosition]?.color&&(m.mobileBorderStyle="solid",m.mobileBorderWidth=1,m.mobileBorderColor=Ws,l(f=>({...a,[m?.mobileBorderPosition]:{color:Ws,style:"solid",width:1}}))),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,settings:{mobileBorder:{...a,[m?.mobileBorderPosition]:{color:m.mobileBorderColor,style:m.mobileBorderStyle,width:m.mobileBorderWidth}}}})})},Id=(e,i,r,a,l,n,c="")=>{const m=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),r?(m[c+"borderRadiusAll"]=0,a(!0)):m[c+"borderRadiusAll"]||(m[c+"borderRadiusAll"]=0),l({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:n.type,settings:{borderRadius:{all:m[c+"borderRadiusAll"]}}})})},Cd=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.mobileBorderRadiusAll&&!n.mobileBorderRadiusTopLeft&&!n.mobileBorderRadiusTopRight&&!n.mobileBorderRadiusBottomRight&&!n.mobileBorderRadiusBottomLeft&&(n.mobileBorderRadiusAll=0),["all","topLeft","topRight","bottomRight","bottomLeft"].forEach(c=>{if(!n.mobileBorderRadius?.[c])return;const m=`mobileBorderRadius${c[0].toUpperCase()}${c.slice(1)}`;a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileBorderRadius:{[c]:n[m],classNamePrefix:`em-mob-border_radius_${c}-`}}})})})},Pd=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.boxShadowColor?(n.boxShadowInset=!1,n.boxShadowHOffset=5,n.boxShadowVOffset=5,n.boxShadowBlurRadius=10,n.boxShadowSpreadRadius=-5,n.boxShadowColor="#000000"):r&&(n.boxShadowInset=!1,n.boxShadowHOffset=null,n.boxShadowVOffset=null,n.boxShadowBlurRadius=null,n.boxShadowSpreadRadius=null,n.boxShadowColor=""),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{boxShadow:{blurRadius:n.boxShadowBlurRadius,color:n.boxShadowColor,hOffset:n.boxShadowHOffset,inset:n.boxShadowInset,spreadRadius:n.boxShadowSpreadRadius,vOffset:n.boxShadowVOffset}}})})},Ad=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.mobileBoxShadowColor&&(n.mobileBoxShadowInset=!1,n.mobileBoxShadowHOffset=5,n.mobileBoxShadowVOffset=5,n.mobileBoxShadowBlurRadius=10,n.mobileBoxShadowSpreadRadius=-5,n.mobileBoxShadowColor="#000000"),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileBoxShadow:{blurRadius:n.mobileBoxShadowBlurRadius,color:n.mobileBoxShadowColor,hOffset:n.mobileBoxShadowHOffset,inset:n.mobileBoxShadowInset,spreadRadius:n.mobileBoxShadowSpreadRadius,vOffset:n.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Nd=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.mobileWidth&&(n.mobileWidth=""),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileWidth:{value:n.mobileWidth,dim:n.mobileWidthDim,classNamePrefix:"em-mob-width-"}}})})},Ld=e=>{setTimeout(()=>{e(i=>!i)})},Od=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!r&&!n.mobileBackgroundColor&&(n.mobileBackgroundColor="#E5E5E5"),a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:n.mobileBackgroundColor}}}),r&&Ro(e,l,a)})},Fd=(e,i,r,a,l)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),r&&(n.paddingLeftRight="",n.paddingLeft="",n.paddingRight="",n.paddingTopBottom="",n.paddingTop="",n.paddingBottom="",a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{padding:{all:0}}}))})},$d=(e,i,r,a,l)=>{i(c=>!c);const n=e.getFieldsValue(!0);r||(n.paddingLeftRight=n.paddingLeft,n.paddingTopBottom=n.paddingTop,n.paddingRight=n.paddingLeft,n.paddingBottom=n.paddingTop,a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{padding:{top:n.paddingTopBottom,bottom:n.paddingTopBottom,left:n.paddingLeftRight,right:n.paddingLeftRight}}}))},Md=e=>{setTimeout(()=>{e(i=>!i)})},Dd=(e,i,r,a,l)=>{i(c=>!c);const n=e.getFieldsValue(!0);r||(n.cell_paddingLeftRight=n.cell_paddingLeft,n.cell_paddingTopBottom=n.cell_paddingTop,n.cell_paddingRight=n.cell_paddingLeft,n.cell_paddingBottom=n.cell_paddingTop,a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{cell_padding:{top:n.cell_paddingTopBottom,bottom:n.cell_paddingTopBottom,left:n.cell_paddingLeftRight,right:n.cell_paddingLeftRight}}})),(r&&n.cell_paddingLeftRight||n.cell_paddingLeftRight===0)&&(n.cell_paddingLeft=n.cell_paddingLeftRight,n.cell_paddingRight=n.cell_paddingLeftRight),(r&&n.cell_paddingTopBottom||n.cell_paddingTopBottom===0)&&(n.cell_paddingTop=n.cell_paddingTopBottom,n.cell_paddingBottom=n.cell_paddingTopBottom)},Vd=({form:e,onBorderSideClear:i,formName:r,elementSettings:a,formValues:l,isMacOS:n,__:c,token:m,appConfig:f,typografItems:_,backgroundRepeatOptions:k,backgroundSizeOptions:b,sendAction:h,handleToggleShowPaddingCell:y,handleTogglePaddingCell:x,handleToggleBackground:E,handleToggleBorder:w,handleToggleBorderRadius:I,paddingCellShow:A,paddingsExt:v,backgroundShow:P,cellBordersShow:C,borderRadiusShow:Y,oneBorderRadiusValue:W,setOneBorderRadiusValue:F,textInputRef:N,linkProtocol:T,handleLinkProtocolsChange:J,backgroundImageEmpty:Z})=>{const se=H.useGoogleFontsLoader();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$FormSection,{title:c("Text"),dividerTop:!1,children:[f.formTextFieldTypografEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:m.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"AddImage",component:o.icons$AddImage}),onClick:()=>h("add_img"),style:{width:"100%"},children:c("Add image")})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:m.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,menu:{items:_},trigger:["hover"],placement:"bottom",getPopupContainer:te=>te.closest(".selected-element-panel"),children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),onClick:()=>h("typograf"),style:{width:"100%"},children:c("Typography")})})})})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Text font"),placement:"bottom",zIndex:1,getPopupContainer:te=>te.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:se,getPopupContainer:te=>te.closest(".email-pane__collapse-wrapper")})})}),!a.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:c("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:c("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:a,name:"textStrong",tooltipTitle:c(n?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:a,name:"textItalic",tooltipTitle:c(n?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:a,name:"textStrikethrough",tooltipTitle:c(n?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(s.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,elementSettings:a,name:"textUnderline",tooltipTitle:c(n?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(Je,{form:e,className:(0,Ve.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof a.linkHref=="string"}),elementSettings:a,name:"textLink",tooltipTitle:c("Link"),icon:(0,t.jsx)(s.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),l?.textLink&&(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsxs)(o.ui_kit$Col,{span:24,children:[(0,t.jsx)(oo,{show:T==="#",__:c,style:{marginBottom:m.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",children:(0,t.jsx)(o.ui_kit$Input,{ref:N,addonBefore:(0,t.jsx)(to,{linkProtocol:T,handleLinkProtocolsChange:J,__:c}),allowClear:!0,placeholder:c("Hyperlink URL"),autoFocus:a?.customTable?.isNewLink,prefix:(0,t.jsx)(eo,{linkProtocol:T})})})})]})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Text color"),placement:"bottom",zIndex:2,getPopupContainer:te=>te.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:c("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:c("Color"),usedColors:a.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Text background"),placement:"bottom",zIndex:2,getPopupContainer:te=>te.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:c("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:c("Background color"),usedColors:a.usedColors})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(so,{form:e,elementSettings:a,name:"textAlign"})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Vt,{form:e,elementSettings:a,name:"valign",isNewIconType:!0})})]})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:c("Padding"),collapsible:!0,open:A,onToggle:y,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:v,onToggleExtended:x,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,t.jsx)(o.ui_kit$FormSection,{title:c("Background"),collapsible:!0,open:P,onToggle:E,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:f.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:Z,usedColors:a.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:b,imageUploadSlot:(f.formTableFieldBackgroundImageEnabled,void 0)})}),(0,t.jsx)(o.ui_kit$FormSection,{title:c("Borders"),collapsible:!0,open:C,onToggle:w,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,namePrefix:"cell_"})}),f.formFieldBorderRadiusEnabled&&!1]})},zs=({form:e,onBorderSideClear:i,elementSettings:r,paddingShow:a,paddingsExt:l,backgroundShow:n,bordersShow:c,borderRadiusShow:m,boxShadowShow:f,handleToggleShowPadding:_,handleTogglePadding:k,handleToggleBackground:b,handleToggleBorder:h,handleToggleBorderRadius:y,handleToggleBoxShadow:x,backgroundRepeatOptions:E,backgroundSizeOptions:w,backgroundImageEmpty:I,oneBorderRadiusValue:A,setOneBorderRadiusValue:v,boxShadow:P})=>{const{__:C}=s.useI18n(),Y=s.useAppConfig(),{token:W}=(0,o.ui_kit$useToken)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$FormSection,{title:C("Padding"),collapsible:!0,open:a,onToggle:_,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:l,onToggleExtended:k,gutter:W.marginSM,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,t.jsxs)(o.ui_kit$FormSection,{title:C("Background"),collapsible:!0,open:n,onToggle:b,dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{imageEnabled:Y.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:I,usedColors:r.usedColors,colorPlaceholder:C("Background color"),horizontalPositionPlaceholder:C("Horizontal position"),horizontalPositionTooltip:C("Horizontal position"),verticalPositionPlaceholder:C("Vertical position"),verticalPositionTooltip:C("Vertical position"),backgroundRepeatTooltip:C("Background image repeat"),backgroundSizeTooltip:C("Background image size"),selectPlaceholder:C("Please choose"),backgroundRepeatOptions:E,backgroundSizeOptions:w,imageUploadSlot:Y.formTableFieldBackgroundImageEnabled?(0,t.jsx)(Ot,{form:e,label:C("Background image"),name:"backgroundImage",tooltipTitle:C("Background image"),placeholder:C("Background image link/route")}):void 0}),(0,t.jsx)(ao,{form:e,showBackground:!0})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:C("Borders"),collapsible:!0,open:c,onToggle:h,dividerTop:!0,children:(0,t.jsx)(H.SelectedElementFormBorder,{form:e,onBorderSideClear:i})}),Y.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Border radius"),collapsible:!0,open:m,onToggle:y,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:A,setOneBorderRadiusValue:v,elementSettings:r})}),Y.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Box shadow"),collapsible:!0,open:f,onToggle:x,dividerTop:!0,children:(0,t.jsx)(It,{})}),Y.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:r,form:e})})]})};zs.propTypes={form:g.default.object.isRequired,onBorderSideClear:g.default.func,elementSettings:g.default.object.isRequired,paddingShow:g.default.bool,paddingsExt:g.default.bool,backgroundShow:g.default.bool,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,handleToggleShowPadding:g.default.func,handleTogglePadding:g.default.func,handleToggleBackground:g.default.func,handleToggleBorder:g.default.func,handleToggleBorderRadius:g.default.func,handleToggleBoxShadow:g.default.func,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,backgroundImageEmpty:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,boxShadow:g.default.object};var Gs=({form:e,elementSettings:i,mobileSizeShow:r,mobileBackgroundShow:a,mobileBordersShow:l,mobileBorderRadiusShow:n,mobileBoxShadowShow:c,handleToggleMobileSize:m,handleToggleMobileBackground:f,handleToggleMobileBorder:_,handleToggleMobileBorderRadius:k,handleToggleMobileBoxShadow:b,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:y,mobileBorders:x,mobileBoxShadow:E})=>{const{__:w,_x:I}=s.useI18n(),A=s.useAppConfig(),{token:v}=(0,o.ui_kit$useToken)(),P=s.useSelector(s.selectEmailSettings);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$FormSection,{title:w("Size"),collapsible:!0,open:r,onToggle:m,dividerTop:!0,children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:w("Table width"),placement:"left",children:(0,t.jsx)("div",{style:{marginBottom:v.formItemMarginBottomMD+4},children:(0,t.jsx)(Yt,{form:e,name:"mobileWidth",elementSettings:i})})})})}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:v.formItemMarginBottomXS*2},children:(0,t.jsx)(o.ui_kit$Tooltip,{title:w("Height"),placement:"bottom",children:(0,t.jsx)(ro,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:w("Background"),collapsible:!0,open:a,onToggle:f,dividerTop:!0,children:(0,t.jsx)(wo,{elementSettings:Xt(i),imageEnabled:A.formTableFieldBackgroundImageEnabled,desktopBackground:So(i)})}),A.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:w("Borders"),collapsible:!0,open:l,onToggle:_,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:x,usedColors:P.usedColors,labels:{color:w("Color"),width:I("Width","border"),none:w("None"),solid:w("Solid"),dashed:w("Dashed"),dotted:w("Dotted"),above:w("Above"),below:w("Below"),onLeft:w("On the left"),onRight:w("On the right"),around:w("Around"),usedColors:w("Used"),recommendedColors:w("Recommended")}})}),A.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:w("Border radius"),collapsible:!0,open:n,onToggle:k,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:y,elementSettings:i})}),A.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:w("Box shadow"),collapsible:!0,open:c,onToggle:b,dividerTop:!0,children:(0,t.jsx)(It,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),A.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:w("Display control"),dividerTop:!0,children:(0,t.jsx)(Ct,{elementSettings:i,form:e})})]})};Gs.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,handleToggleMobileSize:g.default.func,handleToggleMobileBackground:g.default.func,handleToggleMobileBorder:g.default.func,handleToggleMobileBorderRadius:g.default.func,handleToggleMobileBoxShadow:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,mobileBorders:g.default.object,mobileBoxShadow:g.default.object};var Ud=({form:e,onBorderSideClear:i,elementViewType:r,mobileViewActive:a,elementSettings:l,paddingShow:n,paddingsExt:c,backgroundShow:m,bordersShow:f,borderRadiusShow:_,boxShadowShow:k,mobileSizeShow:b,mobileBackgroundShow:h,mobileBordersShow:y,mobileBorderRadiusShow:x,mobileBoxShadowShow:E,handleToggleShowPadding:w,handleTogglePadding:I,handleToggleBackground:A,handleToggleBorder:v,handleToggleBorderRadius:P,handleToggleBoxShadow:C,handleToggleMobileSize:Y,handleToggleMobileBackground:W,handleToggleMobileBorder:F,handleToggleMobileBorderRadius:N,handleToggleMobileBoxShadow:T,backgroundRepeatOptions:J,backgroundSizeOptions:Z,backgroundImageEmpty:se,oneBorderRadiusValue:te,setOneBorderRadiusValue:ne,oneMobileBorderRadiusValue:_e,setOneMobileBorderRadiusValue:le,boxShadow:fe,mobileBorders:Ae,mobileBoxShadow:ce})=>(0,t.jsx)(t.Fragment,{children:r==="mobile"&&a.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(Gs,{form:e,elementSettings:l,mobileSizeShow:b,mobileBackgroundShow:h,mobileBordersShow:y,mobileBorderRadiusShow:x,mobileBoxShadowShow:E,handleToggleMobileSize:Y,handleToggleMobileBackground:W,handleToggleMobileBorder:F,handleToggleMobileBorderRadius:N,handleToggleMobileBoxShadow:T,oneMobileBorderRadiusValue:_e,setOneMobileBorderRadiusValue:le,mobileBorders:Ae,mobileBoxShadow:ce})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(zs,{form:e,onBorderSideClear:i,elementSettings:l,paddingShow:n,paddingsExt:c,backgroundShow:m,bordersShow:f,borderRadiusShow:_,boxShadowShow:k,handleToggleShowPadding:w,handleTogglePadding:I,handleToggleBackground:A,handleToggleBorder:v,handleToggleBorderRadius:P,handleToggleBoxShadow:C,backgroundRepeatOptions:J,backgroundSizeOptions:Z,backgroundImageEmpty:se,oneBorderRadiusValue:te,setOneBorderRadiusValue:ne,boxShadow:fe})})}),Hd=["borderTop","borderBottom","borderLeft","borderRight"],Ys=({elementSettings:e,formName:i})=>{const{__:r}=s.useI18n(),a=s.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),{token:n}=(0,o.ui_kit$useToken)(),c=s.useAppConfig(),m=s.useSelector(s.selectEmailViewType),f=s.useSelector(s.selectMobileViewActive),_=s.useSelector(s.selectIsCodeMode),k=s.useSelector(s.selectCodeModeDirection),[b,h]=(0,d.useState)({}),[y,x]=(0,d.useState)(!0),[E,w]=(0,d.useState)({}),[I,A]=(0,d.useState)({}),[v,P]=(0,d.useState)(!0),[C,Y]=(0,d.useState)(e.customTable?.backgroundImage[0].value===""),[W,F]=(0,d.useState)(),[N,T]=(0,d.useState)(!1),[J,Z]=(0,d.useState)(!1),[se,te]=(0,d.useState)(!1),[ne,_e]=(0,d.useState)(!1),[le,fe]=(0,d.useState)(!1),[Ae,ce]=(0,d.useState)(!1),[$e,Ce]=(0,d.useState)(!1),[ie,Be]=(0,d.useState)(!1),[ae,oe]=(0,d.useState)(!0),[me,de]=(0,d.useState)(!0),[Q,q]=(0,d.useState)(!0),[z,G]=(0,d.useState)(!1),[re,ke]=(0,d.useState)("https://"),[he,Pe]=(0,d.useState)({}),[ye,V]=(0,d.useState)(!1),[ee,we]=(0,d.useState)(!1),[je,K]=(0,d.useState)(!1),[ve,Re]=(0,d.useState)({}),Le=(0,d.useRef)(null),Ue=(0,d.useRef)(),Me=o.ui_kit$Form.useWatch([],l),He=[{label:r("Not defined"),value:"none"},{label:r("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:r("Repeat background (repeat)"),value:"repeat"},{label:r("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:r("Repeat background vertically (repeat-y)"),value:"repeat-y"}],O=[{label:r("Not defined"),value:""},{label:r("Contain"),value:"contain"},{label:r("Cover"),value:"cover"}],xe={width:"",style:"",color:""},D=_&&k!=="bottom",ue=s.BASIC_BORDER_COLOR,ge=i==="Edit selected table cells"||!1,[Oe,Ge]=(0,d.useState)(null);(0,d.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Ge(!0)},[]);const Ye=U=>{a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:U,locale:"en_US"})},Xe=[{key:"1",label:r("This element"),onClick:()=>Ye("typograf")},{key:"2",label:r("The whole email"),onClick:()=>Ye("typograf_all")}];let R="";(0,d.useEffect)(()=>{if(e){yo(e)&&Be(!0);const U=e.border,Se=e.boxShadow,pe=e.customTable?.mobileBorder,ze=e.customTable?.mobileBoxShadow,dt=e.customTable?.cellBorders;Re(U),h(Se),w(pe),A(ze),Pe(dt);const at=ge?e?.customTable?.cell_borderPosition:e?.customTable?.borderPosition,mt=Object.keys(pe).find(Et=>pe[Et]?.width||pe[Et]?.style||pe[Et]?.color);l.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:mt||"all",mobileBorderWidth:pe[mt]?.width!==null?pe[mt]?.width:"",mobileBorderColor:pe[mt]?.color||"",mobileBorderStyle:pe[mt]?.style||"",...mo(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:at||"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:pt(e.customTable?.mobileWidth?.value),mobileWidthDim:e.customTable?.mobileWidth?.dim,mobileHeight:pt(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))?x(!1):x(!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)?P(!1):P(!0),Y(e.customTable?.backgroundImage[0].value===""),F(Et=>U[at]?.width||U[at]?.style||U[at]?.color?!0:Et),Z(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),_e(!!e.boxShadow),K(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),ce(!!e.customTable?.mobileWidth.value),we(!!e.exportAsPicture)}},[l,e]),(0,d.useEffect)(()=>{const U=l.getFieldValue("linkHref");typeof e.customTable?.linkHref=="string"&&V(!0),Le&&!U&&(V(!1),l.setFieldsValue({linkHref:null})),Le.current=U||null},[Me?.textLink,Me?.linkHref,e.customTable?.linkHref,l]),(0,d.useEffect)(()=>{e.customTable?.linkHref&&Gt(e.customTable?.linkHref||"",ke),l.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[l,e,ke]);const X=U=>{l.setFieldValue("linkHref",U!=="mergetag"?U:""),ke(U)},j=U=>{const Se=l.getFieldsValue(!0),pe=Object.keys(U)[0];let ze;const dt=Hd.includes(pe)&&Se[pe]?{...Se[pe],width:Se[pe].width===""?Se.borderAll?.width||"1":Se[pe].width,color:Se[pe].color===""?Se.borderAll?.color||ue:Se[pe].color,style:Se[pe].style===""?Se.borderAll?.style||"solid":Se[pe].style}:null,at=["top","right","bottom","left"],mt="em-mob-border_",Et=Tt=>({...s.RESET_BORDER_PARAMS[Tt],classNamePrefix:`${mt}${Tt}-`}),Qt=(Tt,st,jt,Ht)=>at.reduce((xt,Wt)=>(xt[Wt]={...Tt,[jt]:Wt===st?Ht:Tt[jt],classNamePrefix:`${mt}${Wt}-`},xt),{}),At=(Tt,st,jt,Ht)=>{const xt=Ht.mobileBorderPosition,Wt=xt==="all",No=st===""||st==null;let Ft;Wt?Ft={all:{...jt.all,[Tt]:No?null:st,classNamePrefix:`${mt}all-`},...at.reduce((Oo,pi)=>({...Oo,[pi]:Et(pi)}),{})}:No?Ft={...jt,[xt]:Et(xt),all:{...s.RESET_BORDER_PARAMS.all}}:jt.all?.color!=null&&jt.all?.width!=null&&jt.all?.style!=null?Ft={...Qt(jt.all,xt,Tt,st),all:{...s.RESET_BORDER_PARAMS.all}}:Ft={...jt,[xt]:{...jt[xt],[Tt]:st,classNamePrefix:`${mt}${xt}-`},all:{...s.RESET_BORDER_PARAMS.all}};const Lo=Wt?Ft.all:Ft[xt],wr={mobileBorderColor:Lo?.color??ue,mobileBorderWidth:Lo?.width??1,mobileBorderStyle:Lo?.style??"solid"};return{newBorders:Ft,sending:{mobileBorder:Ft},formUpdates:wr}};switch(pe){case"exportAsPicture":ze={exportAsPicture:Se.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":ze={boxShadow:{hOffset:Se.boxShadowHOffset,vOffset:Se.boxShadowVOffset,blurRadius:Se.boxShadowBlurRadius,spreadRadius:Se.boxShadowSpreadRadius,color:Se.boxShadowColor,inset:Se.boxShadowInset}};break;case"width":ze={[pe]:{value:U[pe],dim:Se.widthDim}};break;case"widthDim":ze={width:{value:Se.width,dim:U[pe]}};break;case"maxWidth":ze={[pe]:{value:U[pe],dim:Se.maxWidthDim}};break;case"maxWidthDim":ze={maxWidth:{value:Se.maxWidth,dim:U[pe]}};break;case"minWidth":ze={[pe]:{value:U[pe],dim:Se.minWidthDim}};break;case"minWidthDim":ze={minWidth:{value:Se.minWidth,dim:U[pe]}};break;case"backgroundImage":Y(U[pe]===""),ze={[pe]:[{...e.customTable?.backgroundImage[0],value:U[pe]}],backgroundSize:"cover"},l.setFieldsValue({backgroundColor:""});break;case"backgroundColor":Y(!0),ze=U,l.setFieldsValue({backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":ze={borderRadius:{[H.BORDER_RADIUS_POSITION[pe]]:+U[pe]}};break;case"mobileWidth":ze={[pe]:{classNamePrefix:"em-mob-width-",value:U[pe],dim:Se.mobileWidthDim}};break;case"mobileWidthDim":ze={mobileWidth:{classNamePrefix:"em-mob-width-",value:Se.mobileWidth||100,dim:U[pe]}};break;case"mobileHeight":ze={[pe]:{classNamePrefix:"em-mob-height-",value:U[pe],dim:Se.mobileHeightDim}};break;case"mobileBorderStyle":case"mobileBorderColor":case"mobileBorderWidth":const Tt={mobileBorderStyle:"style",mobileBorderColor:"color",mobileBorderWidth:"width"}[pe],{newBorders:st,sending:jt,formUpdates:Ht}=At(Tt,U[pe],E,Se);Object.assign(Se,Ht),w(st),ze=jt;break;case"mobileBorderPosition":l.setFieldsValue({mobileBorderWidth:E[U[pe]].width||"",mobileBorderColor:E[U[pe]].color||"",mobileBorderStyle:E[U[pe]].style||""});break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":ze={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[pe]]:U[pe],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[pe]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":ze={mobileBoxShadow:{hOffset:Se.mobileBoxShadowHOffset,vOffset:Se.mobileBoxShadowVOffset,blurRadius:Se.mobileBoxShadowBlurRadius,spreadRadius:Se.mobileBoxShadowSpreadRadius,color:Se.mobileBoxShadowColor,inset:Se.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(ze=To(U),!ze)return;break;case"mobileAlign":ze={[pe]:{classNamePrefix:"em-mob-table_align-",value:U[pe]}};break;case"borderPosition":ze=U,a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze});break;case"borderAll":U[pe]?.style===""?l.setFieldsValue({borderAll:xe}):l.setFieldsValue({borderTop:xe,borderBottom:xe,borderLeft:xe,borderRight:xe}),ze=U;break;case"borderTop":l.setFieldsValue({borderTop:dt}),U[pe]?.style===""?l.setFieldsValue({borderTop:xe}):l.setFieldsValue({borderAll:xe}),ze=U;break;case"borderBottom":l.setFieldsValue({borderBottom:dt}),U[pe]?.style===""?l.setFieldsValue({borderBottom:xe}):l.setFieldsValue({borderAll:xe}),ze=U;break;case"borderLeft":l.setFieldsValue({borderLeft:dt}),U[pe]?.style===""?l.setFieldsValue({borderLeft:xe}):l.setFieldsValue({borderAll:xe}),ze=U;break;case"borderRight":l.setFieldsValue({borderRight:dt}),U[pe]?.style===""?l.setFieldsValue({borderRight:xe}):l.setFieldsValue({borderAll:xe}),ze=U;break;case"cell_borderPosition":ze=U,a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze});break;case"fontSize":case"lineHeight":if(U[pe]===null||U[pe]===""||U[pe]===void 0)return;ze=U;break;case"linkHref":{const xt=io(U[pe]);xt!==U[pe]&&l.setFieldValue("linkHref",xt),ze={linkHref:xt},Gt(xt,ke);break}default:ze=U}pe!=="borderPosition"&&a({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze})},M=(0,d.useCallback)(()=>{jd(l,ge,F,G,W,Re,R)},[l,ge,W,R]),Ee=(0,d.useCallback)(()=>{vd(l,T,N,E,w,a,e)},[l,N,E,a,e]),Fe=(0,d.useCallback)(()=>{Id(l,Z,J,x,a,e,R)},[l,J,x,a,e,R]),tt=(0,d.useCallback)(()=>{Cd(l,te,se,a,e)},[l,se,a,e]),qe=(0,d.useCallback)(()=>{Pd(l,_e,ne,a,e)},[l,ne,a,e]),ct=(0,d.useCallback)(()=>{Ad(l,fe,le,a,e)},[l,le,a,e]),Ze=(0,d.useCallback)(()=>{Nd(l,ce,Ae,a,e)},[l,Ae,a,e]),ut=(0,d.useCallback)(()=>{Ld(Ce)},[Ce]),Bt=(0,d.useCallback)(()=>{Od(l,Be,ie,a,e)},[l,ie,a,e]),B=(0,d.useCallback)(()=>{Fd(l,oe,ae,a,e)},[l,ae,a,e]),S=(0,d.useCallback)(()=>{$d(l,de,me,a,e)},[l,me,a,e]),p=(0,d.useCallback)(()=>{Md(q)},[q]),$=(0,d.useCallback)(()=>{Dd(l,de,me,a,e)},[l,me,a,e]);return(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:i,initialValues:{paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",cell_paddingTop:"",cell_paddingLeft:"",cell_paddingRight:"",cell_paddingBottom:"",cell_paddingLeftRight:"",cell_paddingTopBottom:"",borderAll:{width:"",style:"",color:""},borderTop:{width:"",style:"",color:""},borderBottom:{width:"",style:"",color:""},borderLeft:{width:"",style:"",color:""},borderRight:{width:"",style:"",color:""},cellBackgroundColor:"",backgroundImageForCell:"",cellBackgroundPositionX:"",cellBackgroundPositionY:"",cellBackgroundRepeat:"",cellBackgroundSize:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:"",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorder:"",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBorderAll:"",mobileBorderTop:"",mobileBorderBottom:"",mobileBorderLeft:"",mobileBorderRight:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:"",cell_border:"",cell_borderColor:"",cell_borderWidth:"",cell_borderStyle:"",cell_borderPosition:"cell_borderAll",cell_borderAll:{color:"",width:"",style:""},cell_borderTop:{color:"",width:"",style:""},cell_borderBottom:{color:"",width:"",style:""},cell_borderLeft:{color:"",width:"",style:""},cell_borderRight:{color:"",width:"",style:""},cell_borderRadiusAll:"",cell_RadiusTopLeft:"",cell_RadiusBottomLeft:"",cell_RadiusTopRight:"",cell_RadiusBottomRight:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",verticalAlign:"",textBackgroundColor:"",valign:""},onValuesChange:j,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!D&&(0,t.jsx)(o.ui_kit$Tooltip,{title:r("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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:r("Appearance on mobile devices"),type:"info"})}),ge?(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Vd,{form:l,onBorderSideClear:j,formValues:Me,elementSettings:e,appConfig:c,token:n,isMacOS:Oe,__:r,handleToggleShowPaddingCell:p,handleTogglePaddingCell:$,handleToggleBackground:ut,handleToggleBorder:M,handleToggleBorderRadius:Fe,paddingCellShow:Q,paddingsExt:me,backgroundShow:$e,cellBordersShow:z,borderRadiusShow:J,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,backgroundImageEmpty:C,backgroundRepeatOptions:He,backgroundSizeOptions:O,sendAction:Ye,typografItems:Xe,textInputRef:Ue,linkProtocol:re,handleLinkProtocolsChange:X,isCodeVision:D})}):(0,t.jsx)(Ud,{form:l,onBorderSideClear:j,elementSettings:e,handleToggleShowPadding:B,handleTogglePadding:S,handleToggleBackground:ut,handleToggleBorder:M,handleToggleBorderRadius:Fe,handleToggleBoxShadow:qe,handleToggleMobileSize:Ze,handleToggleMobileBackground:Bt,handleToggleMobileBorder:Ee,handleToggleMobileBorderRadius:tt,handleToggleMobileBoxShadow:ct,paddingShow:ae,paddingsExt:me,backgroundShow:$e,bordersShow:W,borderRadiusShow:J,boxShadowShow:ne,mobileSizeShow:Ae,mobileBackgroundShow:ie,mobileBordersShow:N,mobileBorderRadiusShow:se,mobileBoxShadowShow:le,oneBorderRadiusValue:y,setOneBorderRadiusValue:x,oneMobileBorderRadiusValue:v,setOneMobileBorderRadiusValue:P,backgroundImageEmpty:C,backgroundRepeatOptions:He,backgroundSizeOptions:O,boxShadow:b,mobileBorders:E,mobileBoxShadow:I,elementViewType:m,mobileViewActive:f})," "]})};Ys.propTypes={elementSettings:g.default.object.isRequired};var po=({className:e=null,formSettings:i,emailElementType:r,formName:a})=>{const l=s.useDispatch(),n=St.useSendStyleToggleToIframe(),c=(0,d.useRef)(),m=s.useSelector(s.selectActiveSettingsTab),f=s.useSelector(s.selectElementSettings$1),_=s.useSelector(s.selectElementSettings),k=s.useContainer(),b=s.getComponentRegistry(k),h=r==="email"?f:_,y=h.type,x=y===s.ELEMENT_TYPES.CAROUSEL||y===s.ELEMENT_TYPES.IMG?i.settings:h,[E,w]=(0,d.useState)(x),[I,A]=(0,d.useState)(x);x!==I&&(A(x),w(x));const v=P=>{const C=P.data.operation,Y=P.data.action;if(C===s.EVENT_TYPES.APPLICATION_ACTION){let F=function(N,T=null){const J={[N]:T||!E[N]};n(J,E.type),l(s.setEmailSettings(J)),w(Z=>({...Z,...J}))};var W=F;Y==="toggle_strong"&&F("textStrong"),Y==="toggle_italic"&&F("textItalic"),Y==="toggle_underline"&&F("textUnderline"),Y==="toggle_strikethrough"&&F("textStrikethrough"),Y==="textAlign_left"&&F("textAlign","left"),Y==="textAlign_right"&&F("textAlign","right"),Y==="textAlign_center"&&F("textAlign","center")}};return s.useListenPostMessage(v),(0,t.jsx)("div",{className:"selected-element-panel",children:(0,t.jsx)(s.CSSTransition,{nodeRef:c,in:m===s.PROPERTIES,timeout:300,classNames:"transition",children:(0,t.jsxs)("div",{ref:c,className:(0,Ve.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,t.jsx)(d.Fragment,{children:b.getReactElement(i.content)},i.instanceKey):null,(h.type===s.ELEMENT_TYPES.IMG||h.type===s.ELEMENT_TYPES.COUNTDOWN||h.type===s.ELEMENT_TYPES.VIDEO)&&(0,t.jsx)(Jr,{elementSettings:h}),h.type===s.ELEMENT_TYPES.TEXT&&(0,t.jsx)(Un,{elementSettings:h}),h.type===s.ELEMENT_TYPES.LINK&&(0,t.jsx)(hs,{elementSettings:h}),h.type===s.ELEMENT_TYPES.TABLE&&(0,t.jsx)(ps,{elementSettings:h}),h.type===s.ELEMENT_TYPES.CUSTOM_TABLE&&(0,t.jsx)(Ys,{elementSettings:h,formName:a}),(h.type===s.ELEMENT_TYPES.TD||h.type===s.ELEMENT_TYPES.STRUCTURE||h.type===s.ELEMENT_TYPES.GROUP||h.type===s.ELEMENT_TYPES.COLUMN)&&(0,t.jsx)(ks,{elementSettings:h}),h.type===s.ELEMENT_TYPES.VAR&&(0,t.jsx)(Is,{elementSettings:h}),h.type===s.ELEMENT_TYPES.BUTTON&&(0,t.jsx)(vs,{elementSettings:h}),h.type===s.ELEMENT_TYPES.DIV&&(0,t.jsx)(Ts,{elementSettings:h}),h.type===s.ELEMENT_TYPES.VINDENT&&(0,t.jsx)(gs,{elementSettings:h}),h.type===s.ELEMENT_TYPES.FLOAT_BLOCK&&(0,t.jsx)(Rs,{elementSettings:h}),i.type===s.ELEMENT_TYPES.CAROUSEL&&(0,t.jsx)(Ls,{elementSettings:i}),i.type===s.ELEMENT_TYPES.ACCORDION&&(0,t.jsx)(Os,{elementSettings:i}),i.type===s.ELEMENT_TYPES.SOCIAL&&(0,t.jsx)(Hs,{elementSettings:i})]})})})};po.propTypes={className:g.default.string,formName:g.default.string};function Kt(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var Xs=({emailElementType:e,isSelectedElement:i=!1,selectedElement:r={parent:!1}})=>{const{__:a}=s.useI18n(),l=s.useDispatch(),n=s.useSendPostMessage(),[c]=o.ui_kit$Form.useForm(),m=(0,d.useRef)(),f=(0,d.useRef)(),_=s.useSelector(s.selectElementSettings$1),k=s.useSelector(s.selectElementSettings),b=s.useAppConfig(),h=r||(e==="email"?_:k),[y,x]=(0,d.useState)(h.floatBlocks?.wrap),[E,w]=(0,d.useState)(h.floatBlocks?.dirRevers),[I,A]=(0,d.useState)(null),[v,P]=(0,d.useState)(0),[C,Y]=(0,d.useState)([]),W=s.useSelector(s.selectEmailViewType),F=(0,d.useCallback)(ie=>{l(e==="email"?s.setElementSettings$1(ie):s.setElementSettings(ie))},[l,e]);(0,d.useEffect)(()=>{if(h&&JSON.stringify(h)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:h.floatBlocks?.gap,gapMobile:h.floatBlocks?.gapMobile,gapDim:"px",valign:h.floatBlocks?.valign}),h.floatBlocks?.items.length>0){let oe=function(me,de){if(me.length!==de.length)return!1;for(let Q=0;Q<me.length;Q++)if(me[Q]!==de[Q])return!1;return!0};var ie=oe;const Be=h.floatBlocks.items.reduce((me,de)=>me+de.width,0),ae=h.floatBlocks.items.map(me=>((me.width||0)/Be*100).toFixed(1));P(Be),!oe(ae,C)&&h.changeKey!=="gap"&&Y(ae),h.floatBlocks.items.forEach((me,de)=>c.setFieldsValue({["width-"+de]:me.width||0})),h.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")}x(h.floatBlocks?.wrap)}},[c,h,I,C]);let N=0;h.floatBlocks?.items.length>0&&(N=h.floatBlocks.items.length);const T=(ie,Be)=>{Object.keys(Be).forEach(ae=>{if(ae.includes("width")){const oe=parseInt(ae.match(/\d+/));c.setFieldsValue({[ae]:ie.items[oe]})}})},[J,Z]=(0,d.useState)(!1);(0,d.useEffect)(()=>{const ie=()=>Z(!0),Be=()=>Z(!1);return document.addEventListener("keyup",Be),document.addEventListener("keydown",ie),()=>{document.removeEventListener("keyup",Be),document.removeEventListener("keydown",ie)}},[]);const se=ie=>{f.current&&J&&clearTimeout(f.current),f.current=setTimeout(()=>Be(ie),50);function Be(ae){const oe=c.getFieldsValue(!0),me=Object.keys(ae)[0];if(A(me),me.includes("width")){if(oe[me]&&oe[me]>=30){let de={items:[],gap:oe.gap,valign:oe.valign,activateSection:i?void 0:"structure"},Q=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){Q=parseFloat(Object.keys(ae)[0].substring(Object.keys(ae)[0].length-1));const q=oe["width-"+(Q+1)]?Q+1:0;let z=v;Object.keys(oe).forEach(G=>{G.includes("width")&&G.indexOf("width-"+q)===-1&&(z-=oe[G])}),oe["width-"+q]=z}Object.keys(oe).forEach(q=>{q.includes("width")&&de.items.push(oe[q])}),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:de}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...de,items:h.floatBlocks.items.map((q,z)=>({...h.floatBlocks.items[z],width:de.items[z]}))},changeKey:me})}}else if(me==="gap"){const de={items:h.floatBlocks.items.map(G=>G.width),gap:h.floatBlocks.gap},Q=de.items.reduce((G,re)=>G+re,0)+(de.items.length-1)*de.gap,q=oe.gap,z=Q-(de.items.length-1)*q;if(z>de.items.length*30||h.floatBlocks.gap-ae>=0){const G=(Pe,ye)=>Math.round(ye*Pe/100);let re=de.items.map((Pe,ye)=>G(C[ye],z));const ke=Q-(re.reduce((Pe,ye)=>Pe+ye,0)+(de.items.length-1)*q);if(ke!==0){const Pe=re.length-Math.abs(ke);re=re.map((ye,V)=>Pe<=V?ye+(ke>0?1:-1):ye)}let he={items:re,gap:q||0};T(he,oe),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:he,editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...he,items:h.floatBlocks.items.map((Pe,ye)=>({...Pe,width:he.items[ye]}))},changeKey:me})}}else if(me==="valign"){let de={valign:oe.valign};n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:de,editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...de},changeKey:me})}else if(me==="gapMobile"){let de={mobileHeight:{classNamePrefix:"em-mob-height-",value:ae[me],dim:"px"}};n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:de}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,gapMobile:de.mobileHeight.value},changeKey:me})}setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),600)}},te=()=>{const ie=c.getFieldsValue(!0),Be=h.floatBlocks.items.map(z=>z.width);let ae={items:[],gap:ie.gap};const oe=Be.reduce((z,G)=>z+G,0),me=Be.length,de=Math.ceil(v/me)*me,Q=de/me,q=oe-de;if(ae.items=Array(me).fill(Q),q!==0){const z=Be.length-Math.abs(q);ae.items=ae.items.map((G,re)=>z<=re?G+(q>0?1:-1):G)}T(ae,ie),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:ae,editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ae,items:h.floatBlocks.items.map((z,G)=>({...z,width:ae.items[G]}))},changeKey:"width"})},ne=ie=>{const Be=c.getFieldsValue(!0),ae=h.floatBlocks.items.map(he=>he.width),oe=h.floatBlocks.gap||20,me=ie.cols-ae.length;let de=[],Q=ae.reduce((he,Pe)=>he+Pe,0);ie.cols>=ae.length?Q-=oe*me:Q+=oe*Math.abs(me);const q=Math.round(Q/ie.cols);function z(he,Pe){const ye=[];for(let V=0;V<he;V++)ye.push(ie.width?.[V]?Math.round(Q/100*ie.width?.[V]):Pe);return ye}de=z(ie.cols,q);const G=Q-de.reduce((he,Pe)=>he+Pe,0);if(G!==0){let he=de.map((ye,V)=>[V,ye]).filter(ye=>ye[1]>30);const Pe=he.length-Math.abs(G);he=he.map((ye,V)=>{const ee=Pe<=V?ye[1]+(G>0?1:-1):ye[1];return[ye[0],ee]}),he.map(ye=>(de[ye[0]]=ye[1],ye))}let re={items:de,gap:Be.gap||20};const ke=de.reduce((he,Pe)=>he+Pe,0);Y(de.map(he=>(he/ke*100).toFixed(1))),n({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:re,editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...re,items:re.items.map((he,Pe)=>({width:he,current:!1}))},changeKey:"width"})},_e=()=>{const ie=c.getFieldsValue(!0);if(N<8){const Be=h.floatBlocks.items.map(z=>z.width),ae=h.floatBlocks.gap,oe=Be.reduce((z,G)=>z+(G>30?G:0),0),me=(oe-30-ae)/oe,de=Be.map(z=>z>30?Math.round(z*me):z).reduce((z,G)=>z+(G>30?G:0),0);let Q=Be.map(z=>z>30?Math.round(z*me):z);Q.push(30);const q=oe-de-30-ae;if(q!==0){let z=Q.map((re,ke)=>[ke,re]).filter(re=>re[1]>30);const G=z.length-Math.abs(q);z=z.map((re,ke)=>{const he=G<=ke?re[1]+(q>0?1:-1):re[1];return[re[0],he]}),z.map(re=>(Q[re[0]]=re[1],re))}n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:ie.gap,gapMobile:ie.gapMobile,minWidth:30},editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:Q.map((z,G)=>({width:z,current:h.floatBlocks.items[G]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},le=ie=>{const Be=c.getFieldsValue(!0);let ae=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((he,Pe)=>{he===ie.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ae=Pe)});const oe=+h.floatBlocks.gap,me=+h.floatBlocks.items[ae].width+oe,de=h.floatBlocks.items.map(he=>+he.width),Q=(de.length-1)*oe,q=de.reduce((he,Pe)=>he+Pe,0)+Q,z=de.length-1,G=Math.floor(me/z);let re=de.filter((he,Pe)=>Pe!==ae).map(he=>he+G);const ke=q-(re.reduce((he,Pe)=>he+Pe,0)+(de.length-2)*oe);if(ke!==0){const he=re.length-Math.abs(ke);re=re.map((Pe,ye)=>he<=ye?Pe+(ke>0?1:-1):Pe)}n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:ae,gap:Be.gap},editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:re.map((he,Pe)=>({width:he,current:h.floatBlocks.items.filter((ye,V)=>V!==ae)[Pe].current}))},changeKey:"width"})},fe=ie=>{if(N>=8)return;const Be=c.getFieldsValue(!0);let ae=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((ye,V)=>{ye===ie.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ae=V)});const oe=parseFloat(Be.gap)||0,me=h.floatBlocks.items.map(ye=>+ye.width),de=me[ae],Q=me.reduce((ye,V)=>ye+V,0),q=Q-oe,z=Q+de,G=z>0?q/z:1;let re=[];const ke=[];me.forEach((ye,V)=>{re.push(Math.max(30,Math.round(ye*G))),ke.push(h.floatBlocks.items[V]?.current||!1),V===ae&&(re.push(Math.max(30,Math.round(de*G))),ke.push(!1))});const he=q-re.reduce((ye,V)=>ye+V,0);if(he!==0){let ye=re.map((ee,we)=>[we,ee]).filter(ee=>ee[1]>30);const V=ye.length-Math.abs(he);ye=ye.map((ee,we)=>[ee[0],V<=we?ee[1]+(he>0?1:-1):ee[1]]),ye.forEach(ee=>re[ee[0]]=ee[1])}n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:ae,gap:Be.gap,widths:re},editFromStructure:Kt()});const Pe=re.reduce((ye,V)=>ye+V,0);Y(re.map(ye=>(ye/Pe*100).toFixed(1))),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:re.map((ye,V)=>({width:ye,current:ke[V]||!1}))},changeKey:"width"})},Ae=(0,d.useCallback)(ie=>{const Be=".selected-element-panel__columns-settings__controls__column",ae=Array.from(document.querySelectorAll(Be)).indexOf(ie.target.closest(Be)),oe=ae-1;if(oe<0)return;const me=h.floatBlocks,de=me.items.map(({width:Q,current:q})=>({width:Q,current:q||!1}));[de[oe],de[ae]]=[de[ae],de[oe]],n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:oe,indexB:ae},editFromStructure:Kt()}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...me,items:de},changeKey:"width"})},[h,F,i,n]),ce=ie=>{x(ie),n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!y}}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,wrap:!y},changeKey:"wrap"})},$e=ie=>{w(ie),n({operation:s.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!E}}),F({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,dirRevert:!E},changeKey:"dir"})},Ce=()=>setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),300);return h.floatBlocks&&h.floatBlocks.items.length>0&&(0,t.jsx)(o.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:h.floatBlocks?.gap||0,gapDim:"px",gapMobile:h.floatBlocks?.gapMobile||0,valign:h.floatBlocks?.valign||"top",...h.floatBlocks?.items.reduce((ie,{width:Be},ae)=>(ie[`width-${ae}`]=Be,ie),{})},onValuesChange:se,onFieldsChange:Ce,className:"element-controls",children:(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:b.switchDesktopMobilePropsEnabled||b.stepToOtherElementEnabled||b.deleteButtonEnabled||h.type==="structure"?0:24},children:[h.floatBlocks.items.length===1&&(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:10},title:a('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"}),W!=="mobile"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__header",children:[(0,t.jsx)("span",{className:"selected-element-panel__columns-settings__header-title",children:a("Columns")}),(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__links",children:[(0,t.jsxs)("span",{className:"selected-element-panel__columns-settings__links__add",onClick:_e,children:[(0,t.jsx)(s.EmIcons,{icon:"PlusCircleOutlined",component:o.icons$PlusCircleOutlined,size:16,strokeWidth:b.iconStrokeWidth})," ",a("Add column")]}),h.floatBlocks.items.length>1&&(0,t.jsx)("span",{onClick:te,children:(0,t.jsxs)(o.ui_kit$Tooltip,{title:a("Make columns the same width."),children:[(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined})," ",a("Equalize")]})})]})]}),h.floatBlocks.items.length>1&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,t.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:h.floatBlocks.items.map((ie,Be)=>(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(ie.current?"current":""),style:{width:ie.width/v*100+"%"},children:[Be>0&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Swap columns"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:Ae,children:(0,t.jsx)(s.EmIcons,{icon:"SwapHorizontalIcon",component:o.icons$SwapHorizontalIcon,size:15,strokeWidth:b.iconStrokeWidth})})}),h.floatBlocks.items.length>1&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Delete column"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:le,children:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:15,strokeWidth:b.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),h.floatBlocks.items.length<8&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Copy column"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:fe,children:(0,t.jsx)(s.EmIcons,{icon:"CopyOutlined",component:o.icons$CopyOutlined,size:15,strokeWidth:b.iconStrokeWidth})})}),(0,t.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,t.jsx)(o.ui_kit$Form.Item,{label:"",name:"width-"+Be,children:(0,t.jsx)(o.ui_kit$InputNumber,{min:30,value:ie.width||0,placeholder:a("Width"),ref:I==="width-"+Be&&m})})})]},"floatblock-"+Be))})}),(0,t.jsxs)("div",{className:"columns-presets",children:[(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:1})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol1",component:o.icons$LayoutCol1})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:2})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol2",component:o.icons$LayoutCol2})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:2,width:[66,34]})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol2WideLeft",component:o.icons$LayoutCol2WideLeft})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:2,width:[34,66]})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol2WideRight",component:o.icons$LayoutCol2WideRight})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:3})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol3",component:o.icons$LayoutCol3})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{ne({cols:4})},children:(0,t.jsx)(s.EmIcons,{icon:"LayoutCol4",component:o.icons$LayoutCol4})})]})]}),h.floatBlocks.items.length>1&&(0,t.jsxs)(t.Fragment,{children:[W==="mobile"&&(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(o.ui_kit$Switch,{id:"column-wrap",label:a("Line break on mobile devices"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:y,onChange:ce,labelStyle:{position:"relative",top:2}})}),W!=="mobile"&&(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(o.ui_kit$Switch,{id:"column-dir-revers",label:a("Reverse order on desktop"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:E,onChange:$e,labelStyle:{position:"relative",top:2}})})]}),h.floatBlocks.items.length>1&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:a("Vertical alignment"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"valign",style:{marginBottom:0},children:(0,t.jsx)(o.ui_kit$FormVerticalAlignControl,{disabled:h.floatBlocks.items.length<=1,strokeWidth:b.iconStrokeWidth,labels:{alignTop:a("Align top"),alignMiddle:a("Center vertically"),alignBottom:a("Align bottom")}})})})}),(0,t.jsxs)(t.Fragment,{children:[W!=="mobile"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:a("Indent between columns"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:a("Indent between columns"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px",ref:I==="gap"&&m})})})}),W==="mobile"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:a("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:a("Indent in mobile"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};Xs.propTypes={selectedElement:g.default.shape({parent:g.default.string})};var Wd=()=>{},Ks=({email:e,formSettings:i={},onClosePanel:r=Wd})=>{const{__:a}=s.useI18n(),l=s.useRootElement(),n=s.useDispatch(),c=s.useSendPostMessage(),m=Object.prototype.hasOwnProperty.call(e,"type")?s.BLOCK:s.EMAIL,f=s.useSelector(s.selectElementSettings$1),_=s.useSelector(s.selectElementSettings),k=s.useSelector(s.selectPropertiesPanelKey),b=m==="email"?f:_,h=Object.keys(i).length>0?i.settings:b,y=i?.type==="advanced"&&!!i?.content,x=!!i?.extraTabs?.length,E=s.useAppConfig(),w=h.type==="customTable",I=!!h.type&&!!h.floatBlocks?.items.length>0&&!!h.floatBlocks?.items.filter(T=>!!T.width).length>0,A=(0,d.useRef)(null);(0,d.useEffect)(()=>{const T=Object.values(s.ELEMENT_TYPES),J=h.type&&T.includes(h.type)?`${h.type}-${JSON.stringify(h.path||[])}`:null;if(y||x){const Z=l.querySelector(".email-pane .panel-form__body");Z&&(Z.scrollTop=0),n(s.setPropertiesPanelKey(s.EDIT_SELECTED_ELEMENT))}else if(h.type&&T.includes(h.type)){const Z=A.current!==J;if(A.current=J,h.activateSection!=="structure"){if(Z){const se=l.querySelector(".email-pane .panel-form__body");se&&(se.scrollTop=0)}n(s.setPropertiesPanelKey(s.EDIT_SELECTED_ELEMENT))}else n(s.setPropertiesPanelKey(s.STRUCTURE))}else JSON.stringify(h)!=="{}"&&(A.current=null,n(s.setPropertiesPanelKey("")))},[h,n,l,y,x]);const v=(0,d.useMemo)(()=>{const T=[{key:s.EDIT_SELECTED_ELEMENT,label:(0,t.jsx)("span",{style:{textTransform:"capitalize"},children:h.caption?h.caption:a("Edit element")})}];return I&&T.push({key:s.STRUCTURE,label:a("Columns")}),T},[h.caption,I,a]),P=(0,d.useMemo)(()=>[{key:s.EDIT_SELECTED_ELEMENT,label:a("Cell")},{key:s.TABLE_PROPERTIES,label:a("Table")}],[a]),C=T=>{T.stopPropagation(),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),n(m==="email"?s.setElementSettings$1({}):s.setElementSettings({}))},Y=T=>{T.stopPropagation(),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},W=()=>{r(h),n(s.resetToLastActiveSettingsTab()),setTimeout(()=>{n(m==="block"?s.setElementSettings({type:null}):s.setElementSettings$1({type:null}))},300),c({operation:s.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},F=(0,t.jsxs)(t.Fragment,{children:[E.deleteButtonEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Remove element by Delete Key"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:C,disabled:!h.deletable,icon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:E.iconStrokeWidth})})}),E.stepToOtherElementEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:a("Up to parent element"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:Y,disabled:!h.parent,icon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"GoToParent",component:o.icons$GoToParent,size:18,strokeWidth:E.iconStrokeWidth})})})]}),N=E.switchDesktopMobilePropsEnabled||E.stepToOtherElementEnabled||E.deleteButtonEnabled;return(0,t.jsxs)(o.ui_kit$PanelForm,{children:[(0,t.jsx)(o.ui_kit$PanelForm.Header,{onClose:W,closeIcon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"Close",component:o.icons$Close,size:24,strokeWidth:E.iconStrokeWidth}),extra:N?F:void 0,children:(0,t.jsx)(o.ui_kit$Tabs,{items:w?P:v,activeKey:k,onChange:T=>n(s.setPropertiesPanelKey(T||""))})}),(0,t.jsx)(o.ui_kit$PanelForm.Body,{children:w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,t.jsx)(po,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${s.EDIT_SELECTED_TABLE_CELLS}`})}),(0,t.jsx)("div",{style:{display:k==="Table properties"?void 0:"none"},children:(0,t.jsx)(po,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${s.TABLE_PROPERTIES}`})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,t.jsx)(po,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m})}),I&&(0,t.jsx)("div",{style:{display:k==="Structure"?void 0:"none"},children:(0,t.jsx)(Xs,{selectedElement:h,emailElementType:m,isSelectedElement:!1})})]})})]})},zd=({taxonomy:e})=>{const{__:i,_x:r}=s.useI18n(),a=s.useDispatch(),[l]=o.ui_kit$Form.useForm(),n=(0,d.useRef)(null),c=s.useSelector(s.selectActiveModal$1)===s.MODALS.ADD_NEW_GROUP_MODAL,m=s.useNotification(),f=s.useProjectData(),_=(0,d.useCallback)(()=>{l.resetFields(),setTimeout(()=>n.current?.focus({cursor:"start"}),0)},[l]);(0,d.useEffect)(()=>{c&&_()},[c,_]);const k=()=>a(s.closeModal$1()),[b,h]=s.useAddTermMutation(),[y,x]=(0,d.useState)(!1),E=()=>{l.validateFields().then(({name:w})=>(x(!0),b({project:f,kind:"group",name:w}).then(I=>{if("error"in I){m.error(I);return}m.success({title:i("The group “")+I.data.name+r("” was successfully created.",e)}),k()}))).catch(w=>{}).finally(()=>x(!1))};return(0,t.jsx)(o.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:E,onCancel:k,className:"new-group-modal",footer:[(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"large",loading:h.isLoading||y,onClick:E,children:i("Create group")},"submit")],children:(0,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",name:"add_new_group_form",onFinish:E,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:i("Please enter the group name")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:h.isLoading,size:"large",placeholder:i("Enter the group name"),ref:n,style:{marginBottom:5}})})})})},Gd=({group:e,refetch:i})=>{const{__:r,_x:a}=s.useI18n(),l=s.useDispatch(),[n]=o.ui_kit$Form.useForm(),c=(0,d.useRef)(null),m=s.useSelector(s.selectActiveModal$1)===s.MODALS.EDIT_GROUP_NAME_MODAL,f=s.useNotification(),{id:_=null,name:k=""}=e,b=()=>l(s.closeModal$1()),[h,y]=s.useEditTermMutation();(0,d.useEffect)(()=>{m&&n.setFieldsValue({name:k})},[m,k,n]);const x=()=>{n.validateFields().then(({name:E})=>{h({kind:"group",id:_,name:E}).then(({data:w,error:I})=>{I?(f.error({error:I}),n.setFieldValue("name",E)):(i().then(({data:A})=>{if(A){const v=A[0]?.children?.find(P=>P.id===_)?.name;n.setFieldValue("name",v)}}),b(),f.success({title:r("The group “")+E+a("” was successfully changed to “","group")+w.name+r("”.")}))})})};return(0,t.jsx)(o.ui_kit$Modal,{title:r("Change group name"),open:m,onOk:x,onCancel:b,className:"new-group-name-modal",footer:[(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"large",loading:y.isLoading,onClick:x,children:r("Change name")},"submit")],children:(0,t.jsx)(o.ui_kit$Form,{form:n,layout:"vertical",name:"rename_group_form",onFinish:x,initialValues:{remember:!1,name:k},autoComplete:"off",style:{paddingTop:10},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:r("Please enter the group name")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:y.isLoading,size:"large",placeholder:r("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},Yd=({className:e,refetchProjectGroups:i,isLoading:r})=>{const{__:a,_x:l}=s.useI18n(),n=s.useDispatch(),c=s.useNotification(),{modal:m}=o.ui_kit$App.useApp(),{confirm:f}=m,{token:_}=(0,o.ui_kit$useToken)(),k=s.useSelector(s.selectProjectGroups),[b]=s.useDeleteTermMutation(),h=(A,v)=>{b({kind:"group",id:Number(A)}).unwrap().then(P=>{P?.deleted&&c.success({title:a("The group “")+v+l("” was successfully deleted.","recovery")})}).catch(P=>{c.error({error:P})})},y=(A,v)=>{f({mask:{closable:!0},centered:!0,title:l("Are you sure to delete “","group")+v+a("” group and all nested groups?"),icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:22,style:{color:o.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:a("Yes"),cancelText:a("No"),onOk:()=>h(String(A),v)})},x=(A,v)=>{n(s.openModal$1(s.MODALS.EDIT_GROUP_NAME_MODAL)),I({id:A,name:v})},E=A=>[{label:a("Rename"),key:"Rename",icon:(0,t.jsx)(s.EmIcons,{icon:"CopyOutlined",component:o.icons$CopyOutlined,size:16}),onClick:()=>x(A.id,A.name)},{label:a("Remove"),icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),key:"Remove",style:{color:"#ff4d4f"},onClick:()=>y(A.id,A.name)}],[w,I]=(0,d.useState)({id:null,name:""});return(0,t.jsxs)("div",{className:(0,Ve.default)("groups-management",{[e]:e}),children:[r?(0,t.jsx)(o.ui_kit$Skeleton,{active:!0}):(0,t.jsxs)(o.ui_kit$Row,{children:[!!k?.length&&k?.map((A,v)=>(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:`group_${A.id}`,style:{marginBottom:_.formItemMarginBottomMD},label:(0,t.jsxs)(o.ui_kit$Flex,{justify:"space-between",align:"center",style:{width:"100%"},children:[(0,t.jsx)("span",{children:A.name}),(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"groups-management__group_menu","data-group-id":A.id,size:"large",children:(0,t.jsx)(o.ui_kit$Dropdown,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:{items:E(A)},trigger:["hover"],children:(0,t.jsx)("span",{className:"groups-management__actions",children:(0,t.jsx)(s.EmIcons,{icon:"MoreOutlined",component:o.icons$MoreOutlined})})})})]}),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}],children:(0,t.jsx)(o.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:a("Type category here"),options:A.children?.map(P=>({label:P.name,value:String(P.id)})),tagRender:P=>{const{label:C,closable:Y,onClose:W}=P,F=N=>{N.preventDefault(),N.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:_.colorPrimary,onMouseDown:F,closable:Y,onClose:W,style:{borderRadius:6},children:C})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},A.id)),(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:_.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{id:"add_group_button",icon:(0,t.jsx)(s.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),style:{width:"100%"},onClick:()=>n(s.openModal$1(s.MODALS.ADD_NEW_GROUP_MODAL)),children:a("Add group")})})})]}),(0,t.jsx)(zd,{taxonomy:s.ELEMENT_TYPES.GROUP}),(0,t.jsx)(Gd,{group:w,refetch:i})]})},{title:Fi,description:ei,tags:ti,type:$i,is_template:Xd,group:Kd}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},qd={[Fi]:"",[ei]:"",[ti]:[],[Xd]:!1},Jd={[ei]:"",[ti]:[],[$i]:""};function Qd(e){const i=new Set;return e?.filter(r=>i.has(r.name)?!1:(i.add(r.name),!0))}var qs=({className:e="",element:i})=>{const{__:r}=s.useI18n();s.useEditorProjectId();const a=s.useDispatch(),l=s.useEmailAttributesWriter(),[n]=o.ui_kit$Form.useForm(),{token:c}=(0,o.ui_kit$useToken)(),m=s.useAppConfig(),f=s.useSelector(s.selectProjectGroups),{data:_}=s.useGetBlocksSchemaQuery(),k=s.useProjectData(),b=i.hasOwnProperty("type")?s.BLOCK:s.EMAIL,h=i.hasOwnProperty("type")?s.BLOCK_TAGS:s.EMAIL_TAGS,{data:y,refetch:x,isLoading:E,isFetching:w,isUninitialized:I,isSuccess:A}=s.useGetTermsQuery({project:k,kind:"group"},{skip:!k?.id});(0,d.useEffect)(()=>{y&&a(s.projectGroupsLoaded(y,b==="email"?i.group??[]:void 0))},[a,y,b,i.group]),(0,d.useEffect)(()=>{!I&&x()},[I,x]);const[v,P]=(0,d.useState)([]),[C,Y]=(0,d.useState)([]),[W,F]=(0,d.useState)(i.is_template||!1),N=s.useProjectData();(0,d.useEffect)(()=>{!I&&x()},[i.group,x,I]),(0,d.useEffect)(()=>{if(A&&i.is_template&&i.group.length){const se=i.group;let te={};se.length&&f.length&&se?.forEach(_e=>{f?.forEach(le=>{let fe=le.children.find(Ae=>Ae.id===_e);fe&&(te.hasOwnProperty(le.id)||(te[le.id]=[]),te[le.id].push({label:fe.name,value:fe.id}))})});let ne={};for(let _e in te)te.hasOwnProperty(+_e)&&(ne[`group_${_e}`]=te[_e].map(le=>({...le,value:String(le.value)})));n.setFieldsValue(ne)}},[n,f,i.is_template,i.group,A]);const{data:T}=s.useGetTermsQuery({project:N,kind:h},{skip:!N?.id});(0,d.useEffect)(()=>{Y(Qd(T)?.map(se=>({value:se.name,key:se.id})))},[T]),(0,d.useEffect)(()=>{if(i){const se=St.getTaxonomy(i,h)?.map(_e=>_e.name),te=i.emailtags||i.blocktags,ne=St.getTaxonomy(i,h)?.filter(_e=>te.includes(_e.id)).map(_e=>_e.name);n.setFieldsValue({title:i.title,description:i.description,tags:i.tags||ne||se,type:i.type})}},[n,i,h]);const J=se=>{const te=Object.keys(se)[0],ne=se,_e=te.split("_")[0];if(_e===Fi)l({title:ne[te]});else if(_e===ei)l({description:ne[te]});else if(_e===ti){const le=ne[te];l({tags:le?.map(fe=>fe.trim())})}else _e==="is"&&b==="email"&&l({is_template:ne[te]});switch(te.split("_")[0]){case Kd:a(s.setEmailGroups({[te.split("_")[1]]:se[te]}));break;case $i:a(s.blocksApi.util.updateQueryData("getBlock",i.id,le=>{Object.assign(le,{type:se[te]})}));break;default:return}};(0,d.useEffect)(()=>{if(_){const se=_.schema.properties.acf.properties.type.items.enum;let te=[];const ne={Applications:r("Apps"),Articles:r("Article"),Banners:r("Banners"),Buttons:r("Buttons"),"Call to Action":r("Call to Action"),Contacts:r("Contacts"),Content:r("Content"),"E-Commerce":r("E-Commerce"),Feature:r("Features"),Footer:r("Footers"),Header:r("Headers"),Lists:r("Lists"),Menu:r("Menus"),Other:r("Others"),Polls:r("Polls"),Promocodes:r("Promocodes"),Separators:r("Separators")};for(let _e in se)te.push({label:ne[se[_e]],value:se[_e]});P(te)}},[_,r]);const Z=se=>{F(se)};return(0,t.jsx)("div",{className:(0,Ve.default)("settings-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:n,layout:"vertical",name:"settings_panel_form",initialValues:b==="email"?{EmailInitialValues:qd}:Jd,onValuesChange:J,autoComplete:"off",children:[m.subjectEnabled&&b==="email"&&(0,t.jsx)(o.ui_kit$Form.Item,{label:r("Title"),name:Fi,tooltip:{title:r("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,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$TextArea,{placeholder:r("Type title here"),autoSize:{minRows:1}})}),m.descriptionEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:r("Description"),name:ei,tooltip:{title:r("Description is used in other sections of the service."),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$TextArea,{placeholder:r("Type your description here"),autoSize:{minRows:2}})}),m.tagsEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:r("Tags"),name:ti,tooltip:{title:r("Tags help you find the block in the list."),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:r("Please input tags!"),type:"array"}],children:(0,t.jsx)(o.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:r("Type your tags here"),options:C,tagRender:se=>{const{label:te,closable:ne,onClose:_e}=se,le=fe=>{fe.preventDefault(),fe.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:le,closable:ne,onClose:_e,style:{borderRadius:6},children:te})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),b==="email"&&m.isTemplateEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,t.jsx)(o.ui_kit$Tooltip,{title:i.isNew?r("Save email first."):r("Use this email as a template for creating future emails."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:W,children:(0,t.jsx)(o.ui_kit$Switch,{id:"setIsTemplate",label:r("Is a template"),size:"small",onChange:Z,disabled:i.isNew,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),W&&(0,t.jsx)(Yd,{element:i,refetchProjectGroups:x,isLoading:E||w}),b==="block"&&(0,t.jsx)(o.ui_kit$Form.Item,{name:$i,label:r("Type"),tooltip:{title:r("Select the block type to find any block on the list faster."),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:r("Please input type!")}],children:(0,t.jsx)(o.ui_kit$Select,{placeholder:r("Choose block type"),options:v,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};qs.propTypes={className:g.default.string,email:g.default.object};var{utm_source:Js,utm_medium:Qs,utm_campaign:Zs,utm_term:ea,utm_content:ta}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},Zd={[Js]:"",[Qs]:"",[Zs]:"",[ea]:"",[ta]:""},oa=({className:e="",email:i=void 0})=>{const{__:r}=s.useI18n(),a=s.useEmailAttributesWriter(),[l]=o.ui_kit$Form.useForm();(0,d.useEffect)(()=>{i&&l.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||""})},[l,i]);const n=c=>{const m=Object.keys(c)[0],f=c;a({utm_parameters:{...i?.utm_parameters,[m]:f[m]}})};return(0,t.jsx)("div",{className:(0,Ve.default)("settings-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:"settings_panel_form_utm",initialValues:Zd,onValuesChange:n,autoComplete:"off",children:[(0,t.jsx)(o.ui_kit$Alert,{title:r("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_source"),name:Js,tooltip:{title:r("Mandatory. Indicates the traffic source. Example: utm_source=google"),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("google")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_medium"),name:Qs,tooltip:{title:r("Identifies what type of link was used, such as cost per click or email. For example: utm_medium=cpc"),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("cpc")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_campaign"),name:Zs,tooltip:{title:r("Indicates a specific product promotion or a marketing campaign. Example: utm_campaign=spring_sale"),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("spring_sale")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_term"),name:ea,tooltip:{title:r("Identifies search terms. For example: utm_term=running+shoes"),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("running+shoes")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:r("utm_content"),name:ta,tooltip:{title:r("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,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:r("textlink")})})]})})};oa.propTypes={className:g.default.string,email:g.default.object};var We={PRODUCT_CAROUSEL:"productCarousel",SINGLE_IMAGE_PREVIEW:"singleImagePreview",DEAL_ANNOTATION:"dealAnnotation",DEAL_CARD:"dealCard"},ia="emailmaker-gmail-annotations";function Mi(e){return/^[A-Za-z]{3}$/.test((e??"").trim())}function ec(e){return typeof e=="object"&&e!==null}function oi(e,i){const r=e[i];return typeof r=="string"?r:""}var tc=new Set(["PromotionCard","DiscountOffer","Organization"]);function ra(e){let i;try{i=JSON.parse(e)}catch{return!1}const r=Array.isArray(i)?i:[i];return r.length===0?!1:r.every(a=>typeof a=="object"&&a!==null&&tc.has(String(a["@type"])))}function oc(){let e=new Date().getTime(),i=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let a=Math.random()*16;return e>0?(a=(e+a)%16|0,e=Math.floor(e/16)):(a=(i+a)%16|0,i=Math.floor(i/16)),(r==="x"?a:a&3|8).toString(16)})}function ii(e){return e.annotationType||We.PRODUCT_CAROUSEL}function ho(e){return!!(e?.image||e?.url||e?.headline||e?.price||e?.priceCurrency||e?.discountValue)}function Di(e){return!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds}function ri(e){return typeof e=="string"&&e.trim().length>0}function Vi(e){return ri(e)?/^https?:\/\//i.test(e.trim()):!1}function sa(e){return ri(e?.image)&&Vi(e?.url)}function ic(e){switch(ii(e)){case We.SINGLE_IMAGE_PREVIEW:return sa(e.cards?.[0]);case We.DEAL_ANNOTATION:return!Di(e);case We.DEAL_CARD:return ri(e.description)&&(Vi(e.offerPageUrl)||Vi(e.merchantHomepageUrl));case We.PRODUCT_CAROUSEL:default:return!!e.cards?.some(sa)}}function rc(e){switch(ii(e)){case We.SINGLE_IMAGE_PREVIEW:return!ho(e.cards?.[0])&&!ri(e.discountCode);case We.DEAL_ANNOTATION:return Di(e);case We.DEAL_CARD:return Di(e)&&!e.offerPageUrl&&!e.merchantHomepageUrl;case We.PRODUCT_CAROUSEL:default:return!e.cards?.some(ho)}}function sc(e){switch(ii(e)){case We.DEAL_ANNOTATION:case We.DEAL_CARD:return!!(e.description||e.discountCode||e.availabilityStarts||e.availabilityEnds||e.offerPageUrl||e.merchantHomepageUrl);case We.SINGLE_IMAGE_PREVIEW:return ho(e.cards?.[0]);case We.PRODUCT_CAROUSEL:default:return e.logo?!0:!!e.cards?.some(ho)}}function ac(e){let i=typeof e.price=="string"||typeof e.price=="number"?String(e.price):"",r=typeof e.discountValue=="string"||typeof e.discountValue=="number"?String(e.discountValue):"";const a=typeof e.em_regularPrice=="string"||typeof e.em_regularPrice=="number"?String(e.em_regularPrice):"",l=typeof e.em_price=="string"||typeof e.em_price=="number"?String(e.em_price):"";if(!i&&a&&(i=a),!r&&i&&l){const n=parseFloat(i),c=parseFloat(l);!isNaN(n)&&!isNaN(c)&&n>=c&&(r=String(n-c))}return{id:oc(),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:r}}function aa(e,i){const r={"@context":"http://schema.org/","@type":"PromotionCard",image:e.image};if(e.url&&(r.url=e.url),e.headline&&(r.headline=e.headline),e.price&&(r.price=e.price),e.priceCurrency){const a=e.priceCurrency.trim();r.priceCurrency=Mi(a)?a.toUpperCase():a}return e.discountValue&&(r.discountValue=e.discountValue),i&&(r.position=i),r}function Ui(e){const i={"@context":"http://schema.org/","@type":"DiscountOffer"};for(const r of["description","discountCode","availabilityStarts","availabilityEnds","offerPageUrl","merchantHomepageUrl"]){const a=e[r];a&&(i[r]=a)}return i}function la(e){return{"@context":"http://schema.org/","@type":"Organization",logo:e}}function lc(e){const i=ii(e),r=[];if(i===We.DEAL_CARD)return[Ui(e)];if(i===We.DEAL_ANNOTATION){const a=[];return e.logo&&a.push(la(e.logo)),a.push(Ui(e)),a}if(e.logo&&r.push(la(e.logo)),i===We.SINGLE_IMAGE_PREVIEW){const a=e.cards?.[0];return e.discountCode?.trim()&&r.push(Ui(e)),a&&ho(a)&&r.push(aa(a)),r}return(e.cards||[]).filter(ho).forEach((a,l)=>{r.push(aa(a,l+1))}),r}function nc(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function dc(e){if(rc(e))return null;const i=nc(JSON.stringify(lc(e),null,2));return`<script type="application/ld+json" id="${ia}">
13
13
  ${i}
14
14
  <\/script>`}function na(e,i){const r=e.toLowerCase().indexOf("<\/script>",i);return r===-1?-1:r+9}function da(e,i,r,a){return{range:{start:i,end:a},contentRange:{start:r,end:a-9}}}function Hi(e){const i=new RegExp(`<script\\b[^>]*\\bid=["']${ia}["']`,"i").exec(e);if(i?.index!==void 0){const l=e.indexOf(">",i.index)+1;if(l<=0)return null;const n=na(e,l);if(n!==-1)return da(e,i.index,l,n)}const r=/<script\b[^>]*type=["']application\/ld\+json["'][^>]*>/gi;let a;for(;(a=r.exec(e))!==null;){const l=a.index+a[0].length,n=na(e,l);if(n!==-1&&ra(e.slice(l,n-9)))return da(e,a.index,l,n)}return null}function cc(e){const i=e.indexOf(">")+1,r=e.toLowerCase().lastIndexOf("<\/script>");return i<=0||r===-1?e:e.slice(i,r)}function uc(e){const i=/<\/head>/i.exec(e);if(i?.index!==void 0)return i.index;const r=/<head\b[^>]*>/i.exec(e);if(r?.index!==void 0)return r.index+r[0].length;const a=/<body\b[^>]*>/i.exec(e);return a?.index!==void 0?a.index:e.length}function ca(e,i){let{start:r,end:a}=i;return r>0&&e[r-1]===`
15
15
  `?r-=1:a<e.length&&e[a]===`
@@ -21,7 +21,7 @@ ${i}
21
21
  `)}function Lc(e){if(!e)return"";const i=document.createElement("textarea");return i.innerHTML=e,i.value.replace(/\u00A0/g," ").trim()}var Oc=["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 bo(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 jo(e,i=2){return String(Number(e.toFixed(i)))}function vo(e){const i=bo(e);return i!==null&&i>0&&i<=100?i:null}function fa(e,i){const r=bo(e),a=vo(i);return r===null||r<=0||a===null?"":jo(r*a/100)}function Fc(e,i){if(i?.includes("%")){const c=vo(i);return c===null?"":jo(c)}const r=bo(e),a=bo(i);if(r===null||r<=0||a===null||a<=0)return"";const l=a/r*100,n=jo(a);for(const c of[0,1,2]){const m=jo(l,c);if(fa(e,m)===n)return m}return jo(l)}function si(){return{id:De.generateUUID(),image:"",url:"",headline:"",price:"",priceCurrency:"",discountPercent:""}}function $c({discountValue:e,...i}){return{...i,discountPercent:Fc(i.price,e)}}function ga(e,i){return i?.length?i.map($c):e===We.PRODUCT_CAROUSEL||e===We.SINGLE_IMAGE_PREVIEW?[si()]:[]}function _a(e=We.PRODUCT_CAROUSEL){return{annotationType:e,annotationLogo:"",description:"",discountCode:"",availabilityStarts:null,availabilityEnds:null,offerPageUrl:"",merchantHomepageUrl:"",cards:ga(e)}}function Mc(e){const i=e.annotationType||We.PRODUCT_CAROUSEL;return{annotationType:i,annotationLogo:e.logo||"",description:e.description||"",discountCode:e.discountCode||"",availabilityStarts:e.availabilityStarts?(0,$t.default)(e.availabilityStarts):null,availabilityEnds:e.availabilityEnds?(0,$t.default)(e.availabilityEnds):null,offerPageUrl:e.offerPageUrl||"",merchantHomepageUrl:e.merchantHomepageUrl||"",cards:ga(i,e.cards)}}function xa(e){const i=e.cards||[];return{annotationType:typeof e.annotationType=="string"?e.annotationType:We.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&&$t.default.isDayjs(e.availabilityStarts)?e.availabilityStarts.toISOString():void 0,availabilityEnds:e.availabilityEnds&&$t.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(r=>({id:r.id||De.generateUUID(),image:r.image||"",url:r.url||"",headline:r.headline||"",price:r.price||"",priceCurrency:r.priceCurrency||"",discountValue:fa(r.price,r.discountPercent)}))}}function Dc(e,i){const r=e.getValue();if(!r)return!1;const a=mc(r,i);if(!a||r.slice(a.range.start,a.range.end)===a.text)return!1;const l=e.getPositionAt(a.range.start),n=e.getPositionAt(a.range.end);return e.pushEditOperations([],[{range:{startLineNumber:l.lineNumber,startColumn:l.column,endLineNumber:n.lineNumber,endColumn:n.column},text:a.text}],()=>null),!0}function Vc(e,i){return e?e.emailId!==i.emailId||e.markup!==i.markup:!0}function Uc(e){const i=e.getValue(),r=pc(i);if(r===i)return!1;const a=e.getPositionAt(i.length);return e.pushEditOperations([],[{range:{startLineNumber:1,startColumn:1,endLineNumber:a.lineNumber,endColumn:a.column},text:r}],()=>null),!0}function Xi(e){return!!e&&/^https?:\/\//i.test(e.trim())}function Hc(e,i){const r=e.annotationType??We.PRODUCT_CAROUSEL,a=[];return r===We.PRODUCT_CAROUSEL||r===We.SINGLE_IMAGE_PREVIEW?(e.cards?.some(l=>!!l.image&&Xi(l.url))||a.push(i("At least one card needs an image and a link starting with https://")),e.cards?.some(l=>!!l.priceCurrency?.trim()&&!Mi(l.priceCurrency))&&a.push(i("Price currency must be a three-letter ISO 4217 code, for example USD")),a):r===We.DEAL_CARD?(e.description?.trim()||a.push(i("Discount description is required")),!Xi(e.offerPageUrl)&&!Xi(e.merchantHomepageUrl)&&a.push(i("Offer page or merchant homepage link starting with https:// is required")),a):(!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds&&a.push(i("Fill in at least one offer field")),a)}function Wc(e,i){const r=[],a=e.filter(l=>!!l.discountPercent?.trim());return a.some(l=>vo(l.discountPercent)===null)&&r.push(i("Discount must be a percentage greater than 0 and up to 100")),a.some(l=>{const n=bo(l.price);return vo(l.discountPercent)!==null&&(n===null||n<=0)})&&r.push(i("Enter the price as a number to calculate the discount")),r}var{Text:zc}=o.ui_kit$Typography,Gc=10,Yc=1,ka={width:"100%"},Xc="https://developers.google.com/workspace/gmail/promotab",wt=["hover"],Kc=["annotationLogo"],Ea=["cards",0,"price"],qc=["cards",0,"discountPercent"],Jc=["cards",0,"priceCurrency"];function _t(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Ut={clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})},Qc={optionFilterProp:"label"};function Zc(e){return{value:e||void 0}}var eu=Oc.map(e=>{const i=ma(e);return{value:e,label:i===e?e:`${e} (${i})`}}),Ba=({name:e,pricePath:i,iconStrokeWidth:r})=>{const{__:a}=s.useI18n(),l=(0,d.useMemo)(()=>[i],[i]),n=(0,d.useMemo)(()=>[({getFieldValue:c})=>({validator:async(m,f)=>{const _=typeof f=="string"?f.trim():"";if(!_)return;if(vo(_)===null)throw new Error(a("Discount must be a percentage greater than 0 and up to 100"));const k=bo(c(i));if(k===null||k<=0)throw new Error(a("Enter the price as a number to calculate the discount"))}})],[a,i]);return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:a("Discount, %"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:e,dependencies:l,rules:n,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"Percent02Icon",component:o.icons$Percent02Icon,size:16,strokeWidth:r}),placeholder:a("Discount, %"),inputMode:"decimal",allowClear:Ut})})})},Ta=({name:e,iconStrokeWidth:i})=>{const{__:r}=s.useI18n(),a=(0,d.useMemo)(()=>[{validator:async(l,n)=>{const c=typeof n=="string"?n.trim():"";if(c&&!Mi(c))throw new Error(r("Price currency must be a three-letter ISO 4217 code, for example USD"))}}],[r]);return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:r("Price currency"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:e,rules:a,getValueProps:Zc,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:eu,placeholder:r("Price currency"),prefix:(0,t.jsx)(s.EmIcons,{icon:"Globe02Icon",component:o.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:Qc,allowClear:!0,getPopupContainer:_t})})})},tu=({onAdd:e})=>{const{__:i}=s.useI18n(),r=(0,d.useCallback)(()=>e(si()),[e]);return(0,t.jsx)(o.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,t.jsx)(s.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),onClick:r,children:i("Add card")})},ou=({field:e,index:i,form:r,isSingleImagePreview:a,onRemove:l})=>{const{__:n}=s.useI18n(),c=s.useAppConfig(),m=(0,d.useMemo)(()=>[e.name,"image"],[e.name]),f=(0,d.useMemo)(()=>["cards",e.name,"image"],[e.name]),_=(0,d.useMemo)(()=>[e.name,"headline"],[e.name]),k=(0,d.useMemo)(()=>[e.name,"url"],[e.name]),b=(0,d.useMemo)(()=>[e.name,"price"],[e.name]),h=(0,d.useMemo)(()=>["cards",e.name,"price"],[e.name]),y=(0,d.useMemo)(()=>[e.name,"discountPercent"],[e.name]),x=(0,d.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),E=(0,d.useMemo)(()=>[e.name,"id"],[e.name]),w=(0,d.useMemo)(()=>[{validator:async(A,v)=>{const P=typeof v=="string"?v.trim():"";if(P&&!/^https?:\/\//i.test(P))throw new Error(n("Please enter the correct URL."))}}],[n]),I=(0,d.useCallback)(()=>l(e.name),[l,e.name]);return(0,t.jsxs)("div",{className:"selected-social-form__card",children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,t.jsx)(zc,{className:"selected-social-form__card-title",children:a?n("Single image preview"):`${n("Card")} ${i+1}`}),!a&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:n("Delete"),placement:"top",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:c.iconStrokeWidth}),"aria-label":n("Delete"),onClick:I})})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:n("Image"),placement:"top",getPopupContainer:_t,children:(0,t.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,t.jsx)(Ot,{form:r,label:n("Image"),name:m,watchPath:f})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:n("Headline"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:_,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"ElementTitle",component:o.icons$ElementTitle,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:n("Headline"),allowClear:Ut})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:n("Link"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:k,className:"selected-social-form__card-field",rules:w,children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"Link03",component:o.icons$Link03,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:n("Enter link"),allowClear:Ut})})}),!a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:n("Price"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:b,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"CreditCard02Icon",component:o.icons$CreditCard02Icon,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:n("Price"),allowClear:Ut})})}),(0,t.jsx)(Ba,{name:y,pricePath:h,iconStrokeWidth:c.iconStrokeWidth}),(0,t.jsx)(Ta,{name:x,iconStrokeWidth:c.iconStrokeWidth})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:E,hidden:!0,children:(0,t.jsx)(o.ui_kit$Input,{})})]})};function Sa({iconStrokeWidth:e}){const{__:i}=s.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:i("Discount code"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"discountCode",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"Sale04Icon",component:o.icons$Sale04Icon,size:16,strokeWidth:e}),placeholder:i("Discount code"),allowClear:Ut})})})}var iu=({className:e="",isActive:i=!0,email:r})=>{const{__:a}=s.useI18n(),l=s.useAppConfig(),n=s.useModel(),c=s.useNotification(),[m]=o.ui_kit$Form.useForm(),f=(0,d.useRef)(null),_=(0,d.useRef)(!1),k=(0,d.useRef)(null),[b,h]=(0,d.useState)(!1),y=o.ui_kit$Form.useWatch("annotationType",m),x=o.ui_kit$Form.useWatch("annotationLogo",m),E=o.ui_kit$Form.useWatch("description",m),w=o.ui_kit$Form.useWatch("discountCode",m),I=o.ui_kit$Form.useWatch("availabilityStarts",m),A=o.ui_kit$Form.useWatch("availabilityEnds",m),v=o.ui_kit$Form.useWatch("offerPageUrl",m),P=o.ui_kit$Form.useWatch("merchantHomepageUrl",m),C=o.ui_kit$Form.useWatch("cards",m),Y=JSON.stringify(C??[]),W=(0,d.useMemo)(()=>JSON.parse(Y)??[],[Y]),F=y||We.PRODUCT_CAROUSEL,N=F===We.PRODUCT_CAROUSEL||F===We.SINGLE_IMAGE_PREVIEW,T=F===We.DEAL_ANNOTATION||F===We.DEAL_CARD,J=F===We.DEAL_CARD,Z=F===We.DEAL_ANNOTATION,se=F===We.SINGLE_IMAGE_PREVIEW,te=F===We.SINGLE_IMAGE_PREVIEW?Yc:Gc,ne=(0,d.useMemo)(()=>[{value:We.PRODUCT_CAROUSEL,label:a("Product carousel")},{value:We.SINGLE_IMAGE_PREVIEW,label:a("Single image preview")},{value:We.DEAL_ANNOTATION,label:a("Deal Annotation")},{value:We.DEAL_CARD,label:a("Deal Card")}],[a]),_e=(0,d.useMemo)(()=>{let ae="";n?ae=n.getValue():r?.html&&(ae=r.html);const oe=ae.match(/<title[^>]*>([\s\S]*?)<\/title>/i),me=oe?oe[1].trim():r?.title||r?.subject||"";return Lc(me)},[n,r?.html,r?.title,r?.subject]),le=(0,d.useMemo)(()=>xa({annotationType:F,annotationLogo:x,description:E,discountCode:w,availabilityStarts:I,availabilityEnds:A,offerPageUrl:v,merchantHomepageUrl:P,cards:W}),[F,x,E,w,I,A,v,P,W]),fe=(0,d.useMemo)(()=>N?Wc(W,a):[],[N,W,a]),Ae=(0,d.useMemo)(()=>ic(le)&&fe.length===0,[le,fe]),ce=(0,d.useMemo)(()=>[...Hc(le,a),...fe],[le,fe,a]),$e=(0,d.useMemo)(()=>a("Learn more about %s").split("%s"),[a]),Ce=(0,d.useCallback)(()=>{!n||!Uc(n)||(m.setFieldsValue(_a(F)),k.current={emailId:r?.id,markup:null},h(!1),c.success(a("Gmail annotations were removed from the template code.")))},[n,m,F,r?.id,c,a]);(0,d.useEffect)(()=>{if(!N)return;const ae=m.getFieldValue("cards")??[];if(F===We.SINGLE_IMAGE_PREVIEW){if(ae.length>1){m.setFieldsValue({cards:[ae[0]]});return}ae.length===0&&m.setFieldsValue({cards:[si()]});return}ae.length===0&&m.setFieldsValue({cards:[si()]})},[m,N,F,W]);const ie=(0,d.useCallback)(ae=>{if(!ae||!_.current||!n)return!1;const oe=Dc(n,xa(ae));if(oe){const me=ua(ba(n.getValue()));k.current={emailId:r?.id,markup:me},h(me!==null)}return oe},[n,r?.id]),Be=(0,d.useCallback)(()=>{ie(m.getFieldsValue(!0))&&c.success(a("Gmail annotation was successfully applied to the template code."))},[ie,m,c,a]);return(0,d.useEffect)(()=>{if(!i)return;const ae=ba(n?.getValue()||r?.html||""),oe={emailId:r?.id,markup:ae?ua(ae):null};if(h(oe.markup!==null),!Vc(k.current,oe))return;k.current=oe,_.current=!1;const me=ae?hc(ae):null;m.setFieldsValue(me?Mc(me):_a()),_.current=!0},[i,r?.id,r?.html,n,m]),(0,t.jsxs)("div",{className:(0,Ve.default)("selected-social-form","annotations-panel",e),ref:f,children:[(0,t.jsx)(Nc,{data:le,subjectLine:_e,parentRef:f,overlayTargetSelector:"#pane-content-iframe",onApply:Be,applyDisabled:!Ae,applyBlockers:ce,onRemove:b?Ce:void 0,visible:i}),(0,t.jsxs)(o.ui_kit$Form,{form:m,layout:"vertical",className:"selected-social-form__form element-controls",autoComplete:"off",children:[(0,t.jsxs)("div",{className:"selected-social-form__section",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:a("General settings")}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:a("Annotation type"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"annotationType",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:ne,placeholder:a("Annotation type"),getPopupContainer:_t})})}),!J&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:a("Organization logo"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,t.jsx)(Ot,{form:m,label:a("Organization logo"),name:"annotationLogo",watchPath:Kc})})}),(se||Z)&&(0,t.jsx)(Sa,{iconStrokeWidth:l.iconStrokeWidth}),se&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:a("Price"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:Ea,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"CreditCard02Icon",component:o.icons$CreditCard02Icon,size:16,strokeWidth:l.iconStrokeWidth}),placeholder:a("Price"),allowClear:Ut})})}),(0,t.jsx)(Ba,{name:qc,pricePath:Ea,iconStrokeWidth:l.iconStrokeWidth}),(0,t.jsx)(Ta,{name:Jc,iconStrokeWidth:l.iconStrokeWidth})]}),T&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:a("Discount description"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"description",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"CommentOutlined",component:o.icons$CommentOutlined,size:16,strokeWidth:l.iconStrokeWidth}),placeholder:a("Discount description"),allowClear:Ut})})}),J&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Sa,{iconStrokeWidth:l.iconStrokeWidth}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:a("Offer page URL"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"offerPageUrl",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"Link03",component:o.icons$Link03,size:16,strokeWidth:l.iconStrokeWidth}),placeholder:a("Offer page URL"),allowClear:Ut})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:a("Merchant homepage URL"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"merchantHomepageUrl",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(s.EmIcons,{icon:"Link03",component:o.icons$Link03,size:16,strokeWidth:l.iconStrokeWidth}),placeholder:a("Merchant homepage URL"),allowClear:Ut})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:a("Starts"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"availabilityStarts",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DatePicker,{showTime:!0,placeholder:a("Starts"),style:ka,getPopupContainer:_t})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:wt,title:a("Ends"),placement:"bottom",getPopupContainer:_t,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"availabilityEnds",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DatePicker,{showTime:!0,placeholder:a("Ends"),style:ka,getPopupContainer:_t})})})})]})]})]}),N&&(0,t.jsxs)("div",{className:(0,Ve.default)("selected-social-form__section",{"selected-social-form__section--bordered":!se,"annotations-panel__cards-section":se}),children:[F===We.PRODUCT_CAROUSEL&&(0,t.jsxs)("div",{className:"selected-social-form__section-title",children:[a("Promotion cards"),(0,t.jsx)("span",{className:"annotations-panel__section-hint",children:a("max 10")})]}),(0,t.jsx)(o.ui_kit$Form.List,{name:"cards",children:(ae,{add:oe,remove:me})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"selected-social-form__items",children:ae.map((de,Q)=>(0,t.jsx)(ou,{field:de,index:Q,form:m,isSingleImagePreview:se,onRemove:me},de.key))}),!se&&W.length<te&&(0,t.jsx)(tu,{onAdd:oe})]})})]}),(0,t.jsxs)("div",{className:"annotations-panel__docs-hint",children:[$e[0],(0,t.jsx)("a",{href:Xc,target:"_blank",rel:"noopener noreferrer",children:a("Gmail annotations")}),$e[1]]})]})]})},Ki=({email:e})=>{const{__:i}=s.useI18n(),r=e.hasOwnProperty("type")?s.BLOCK:s.EMAIL,[a,l]=(0,d.useState)(s.SETTINGS),n=s.useAppConfig(),c=y=>l(y||""),m=n.settingsTabEnabled,f=n.UTMEnabled&&r==="email",_=n.annotationsEnabled&&r==="email",k=[m&&"Settings",f&&"UTM parameters",_&&"Annotations parameters"].filter(Boolean),b=k.includes(a)?a:k[0],h=(0,d.useMemo)(()=>{const y=[];return m&&y.push({label:(0,t.jsx)(t.Fragment,{children:i("Settings")}),key:s.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(qs,{className:"email-settings__collapse-panel-content",element:e})}),f&&y.push({label:(0,t.jsx)(t.Fragment,{children:i("UTM parameters")}),key:s.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(oa,{className:"email-settings__collapse-panel-content",email:e})}),_&&y.push({label:(0,t.jsx)(t.Fragment,{children:i("Annotations")}),key:s.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(iu,{className:"email-settings__collapse-panel-content",email:e,isActive:b===s.ANNOTATIONS_PARAMETERS})}),y},[i,e,m,f,_,b]);return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:b,onChange:c,items:h})})};Ki.propTypes={};var ya=320,ru=1200,su=350,{backgroundColor:Ra,backgroundImage:qi,backgroundPositionX:Ji,backgroundPositionY:Qi,backgroundRepeat:ai,backgroundSize:Zi,responsive:au,backgroundColorContent:lu,width:er}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},nu={[Ra]:"",[qi]:"",[Ji]:"",[Qi]:"",[ai]:"checked",[Zi]:"",[lu]:"",[er]:""};function tr(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var wa=({className:e=""})=>{const{__:i}=s.useI18n(),{token:r}=(0,o.ui_kit$useToken)(),a=s.useDispatch(),l=s.useAppConfig(),[n]=o.ui_kit$Form.useForm(),c=s.useSendPostMessage(),m=s.useEmailAttribute("common_styles"),f=s.useSelector(s.selectEmailSettings),_=s.useSelector(s.selectIsSettingsDisabled$1),k=s.useSelector(s.selectActiveSettingsTab),b=s.useSelector(s.selectIsNeedUpdateAppearance),[h,y]=(0,d.useState)(!0),x=(0,d.useRef)(!1),E=(0,d.useRef)(null),w=i("Email not yet loaded or global container not found.");(0,d.useEffect)(()=>{b&&(a(s.setIsNeedUpdateAppearance(!1)),c({operation:s.EVENT_TYPES.INIT_PREVIEW}))},[n,b,a,c,m]),(0,d.useEffect)(()=>()=>{E.current&&clearTimeout(E.current)},[]);const I=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],A=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,d.useEffect)(()=>{const{width:T,...J}=f,Z={...J,backgroundImage:f.backgroundImage?f.backgroundImage[0]?.value:"",backgroundRepeat:f[ai]===""?"repeat":f[ai],backgroundSize:f[Zi],responsive:f.responsive?.shutdown};x.current||(Z.width=T?.value,Z.widthDim=T?.dim),n.setFieldsValue(Z),y(!f.backgroundImage)},[f,n]);const v=(0,d.useCallback)(T=>{const J=tr(T);!J||J.value<ya||c({operation:s.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:J}})},[c]),P=(0,d.useCallback)(T=>{const J=tr(T);J&&a(s.setEmailSettings({...f,width:J}))},[a,f]),C=(0,d.useCallback)(T=>{E.current&&clearTimeout(E.current),P(T),E.current=setTimeout(()=>{v(T)},su)},[v,P]),Y=T=>{const J=n.getFieldsValue(!0),Z=Object.keys(T)[0];switch(Z){case er:C(T[Z]);break;case Ji:case Qi:c({operation:s.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Z]:T[Z]===""?"none":T[Z]}});break;case qi:y(T[Z]===""),c({operation:s.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Z]:[{...f?.backgroundImage?.[0],type:"url",value:T[Z]}],backgroundSize:"cover"}});break;case au:{const se=tr(J.width);c({operation:s.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:T[Z],styles:T[Z]},...se?{width:se}:{}}});break}default:c({operation:s.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:T})}},W=T=>{a(s.setMobileViewActive({shutdown:T,styles:T})),c({operation:s.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},F=()=>{x.current=!0},N=()=>{E.current&&(clearTimeout(E.current),E.current=null);const T=n.getFieldValue(er);P(T),v(T),requestAnimationFrame(()=>{x.current=!1})};return(0,t.jsx)("div",{className:(0,Ve.default)("appearance-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:n,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...nu},onValuesChange:Y,autoComplete:"off",className:"element-controls",children:[_?(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:"24px"},title:w,type:"error"}):null,(0,t.jsx)(o.ui_kit$FormSection,{title:i("Email layout width"),dividerTop:!1,children:(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:f.width?.value?i("This field sets the width of the email."):i("Couldn`t determine the email width"),placement:"right",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"width",style:{marginBottom:r.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$InputNumber,{min:ya,max:ru,placeholder:i("Width"),disabled:!f.width?.value,addonAfter:"px",onFocus:F,onBlur:N})})})})})}),l.emailResponsiveControlEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"responsive",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"responsive",label:i("Responsive email"),size:"small",name:"responsive",disabled:f.responsive?.shutdown===void 0,onChange:W})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:i("Email background color"),dividerTop:!l.emailResponsiveControlEnabled,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:h?16:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:Ra,style:{marginBottom:r.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:f.usedColors,disabled:_})})})}),(0,t.jsx)(o.ui_kit$Col,{span:h?12:24,children:l.formEmailFieldBackgroundImageEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Ot,{form:n,label:i("Background image"),name:qi,tooltipTitle:i("Background image"),disabled:_||k!=="Styles",elementSettings:f}),!h&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:Ji,style:{marginBottom:r.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:i("Horizontal position"),prefix:(0,t.jsx)(s.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Vertical position"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:Qi,style:{marginBottom:r.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:i("Vertical position"),prefix:(0,t.jsx)(s.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical})})})})})]})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image repeat"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:ai,children:(0,t.jsx)(o.ui_kit$Select,{placeholder:i("Please select"),disabled:_,options:I})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:Zi,children:(0,t.jsx)(o.ui_kit$Select,{placeholder:i("Please select"),disabled:_,options:A})})})})]})]})]})})]})})]})})};wa.propTypes={className:g.default.string};var{Option:ja}=o.ui_kit$Select,{width:va,widthDim:du}={width:"width",widthDim:"widthDim"},cu={[va]:"",[du]:""},Ia=({className:e=""})=>{const{__:i}=s.useI18n(),r=s.useSelector(s.selectBlockSettings),a=s.useSelector(s.selectIsSettingsDisabled),[l]=o.ui_kit$Form.useForm(),n=s.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,d.useEffect)(()=>{l.setFieldsValue({width:r.width.value,widthDim:r.width.dim})},[r,l]);const m=f=>{const _=l.getFieldsValue(!0),k=Object.keys(f)[0];let b;switch(k){case"width":b={[k]:{value:f[k],dim:_.widthDim}};break;case"widthDim":b={width:{value:_.width,dim:f[k]}};break;default:return}n({operation:s.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:b})};return(0,t.jsx)("div",{className:(0,Ve.default)("block-appearance-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...cu},onValuesChange:m,autoComplete:"off",children:[a?(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,t.jsx)(o.ui_kit$Form.Item,{label:i("Container width"),name:va,tooltip:{title:i("Specifies the block width."),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:i("Please input container width")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:a,placeholder:i("Container width"),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:(0,t.jsxs)(o.ui_kit$Select,{className:"select-after",children:[(0,t.jsx)(ja,{value:"px",children:"px"}),(0,t.jsx)(ja,{value:"%",children:"%"})]})})})})]})})};Ia.propTypes={className:g.default.string};var uu=()=>{};function Ca(){const e=s.useContainer(),i=(0,d.useCallback)(a=>{if(!e)return uu;const l=s.provideDefaultCommonStyles(e).watch(a);return()=>l.dispose()},[e]),r=(0,d.useCallback)(()=>s.getDefaultCommonStyles(e),[e]);return(0,d.useSyncExternalStore)(i,r,r)}function Pa(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function or(e,i){const r={...e};for(const a of Object.keys(i)){const l=i[a],n=e[a];Pa(l)&&Pa(n)?r[a]=or(n,l):l!==void 0&&(r[a]=l)}return r}function Aa(e,i){const r=s.COMMON_STYLES;if(typeof e=="string"){const a=e.trim();if(a.startsWith("{"))try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&Object.keys(l).length>0)return or(r,l)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?or(r,i):r}var Na=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||"#1890ff",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||"#1890ff",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||"#1890ff",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}),mu={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},pu={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},hu={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},bu=({className:e})=>{const{__:i}=s.useI18n(),r=H.useGoogleFontsLoader(),a=s.useDispatch(),l=s.useSendPostMessage(),[n]=o.ui_kit$Form.useForm(),c=s.useSelector(s.selectEmailSettings),m=s.useSelector(s.selectIsNeedUpdateContentAppearance),f=Ca(),_=s.useEmailAttribute("common_styles"),k=s.useAppConfig(),{token:b}=(0,o.ui_kit$useToken)(),[h,y]=(0,d.useState)({}),[x,E]=(0,d.useState)({}),[w,I]=(0,d.useState)(!0),[A,v]=(0,d.useState)(!0),[P,C]=(0,d.useState)(!1),[Y,W]=(0,d.useState)(!1),F={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},N=Aa(_,f),[T,J]=(0,d.useState)(N.headings.bold),[Z,se]=(0,d.useState)(N.headings.italic),[te,ne]=(0,d.useState)(N.links.underline),[_e,le]=(0,d.useState)(N.buttons.bold),[fe,Ae]=(0,d.useState)(N.buttons.italic),[ce,$e]=(0,d.useState)(null),Ce=s.useSelector(s.selectIsPanelHistoryCollapsed);(0,d.useEffect)(()=>{Ce||$e(null)},[N,$e,Ce]),(0,d.useEffect)(()=>{Ce&&!ce&&$e(Na(N))},[N,ce,Ce]),(0,d.useEffect)(()=>{m&&(a(s.setIsNeedUpdateContentAppearance(!1)),n.setFieldsValue(Na(N)))},[n,m,a,N]);const[ie,Be]=(0,d.useState)(Math.min(N.headings.fontSize-1,19)),[ae,oe]=(0,d.useState)(Math.max(N.text.fontSize+1,20));(0,d.useEffect)(()=>{if(ce){const q=ce.buttonsBorder;y(q);const z=Object.keys(q).find(ke=>q[ke]?.width||q[ke]?.style||q[ke]?.color),G=ce.cardsBorder;E(G);const re=Object.keys(G).find(ke=>G[ke]?.width||G[ke]?.style||G[ke]?.color);n.setFieldsValue({buttons_borderPosition:z||"all",buttons_borderWidth:q[z]?.width!==null?q[z]?.width:"",buttons_borderColor:q[z]?.color||"",buttons_borderStyle:q[z]?.style||"",cards_borderPosition:re||"all",cards_borderWidth:G[re]?.width!==null?G[re]?.width:"",cards_borderColor:G[re]?.color||"",cards_borderStyle:G[re]?.style||"",buttons_borderRadiusAll:u(ce.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(ce.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(ce.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(ce.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(ce.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(ce.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(ce.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(ce.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(ce.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(ce.cardsBorderRadius.bottomRight),blockPaddingAll:u(ce.blockPaddingAll),blockPaddingTop:u(ce.blockPaddingTop),blockPaddingRight:u(ce.blockPaddingRight),blockPaddingBottom:u(ce.blockPaddingBottom),blockPaddingLeft:u(ce.blockPaddingLeft),blockPaddingLeftRight:u(ce.blockPaddingRight)||u(ce.blockPaddingLeft),blockPaddingTopBottom:u(ce.blockPaddingTop)||u(ce.blockPaddingBottom)}),!u(ce.blockPaddingAll)&&(u(ce.blockPaddingTop)||u(ce.blockPaddingRight)||u(ce.blockPaddingBottom)||u(ce.blockPaddingLeft))&&(ce.blockPaddingTop!==ce.blockPaddingBottom||ce.blockPaddingRight!==ce.blockPaddingLeft)?W(!1):W(!0),!u(ce.buttonsBorderRadius.all)&&(u(ce.buttonsBorderRadius.topLeft)||u(ce.buttonsBorderRadius.bottomLeft)||u(ce.buttonsBorderRadius.topRight)||u(ce.buttonsBorderRadius.bottomRight))?I(!1):I(!0),ce.buttonsPadding&&!u(ce.buttonsPadding.all)&&(u(ce.buttonsPadding.bottom)||u(ce.buttonsPadding.right)||u(ce.buttonsPadding.left)||u(ce.buttonsPadding.top))&&C(!1),!u(ce.cardsBorderRadius?.all)&&(u(ce.cardsBorderRadius?.topLeft)||u(ce.cardsBorderRadius?.bottomLeft)||u(ce.cardsBorderRadius?.topRight)||u(ce.cardsBorderRadius?.bottomRight))?v(!1):v(!0)}},[n,ce]);const me=()=>{W(z=>!z);const q=n.getFieldsValue(!0);if(!Y){q.blockPaddingLeftRight=q.blockPaddingLeft,q.blockPaddingTopBottom=q.blockPaddingTop,q.blockPaddingRight=q.blockPaddingLeft,q.blockPaddingBottom=q.blockPaddingTop;const z=Number(q.blockPaddingTopBottom),G=Number(q.blockPaddingLeftRight);l({operation:s.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(z)?z:0,bottom:Number.isFinite(z)?z:0,left:Number.isFinite(G)?G:0,right:Number.isFinite(G)?G:0}}})}},de=q=>{const z=q.target.closest("button");if(!z)return;const G=z.name,re=z.classList.contains("selected-td-form__button--active");z.className=re?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{z.blur()}catch{}G==="headingBold"?J(!re):G==="headingItalic"?se(!re):G==="linkUnderline"?ne(!re):G==="buttonsBold"?le(!re):G==="buttonsItalic"&&Ae(!re),l({operation:s.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[G]:!re}})},Q=q=>{const z=n.getFieldsValue(!0),G=Object.keys(q)[0];let re={};switch(G){case"headingFontSize":Be(Math.min(z.headingFontSize-1,19)),re=q;break;case"textFontSize":oe(Math.max(z.textFontSize+1,20)),re=q;break;case"buttons_borderStyle":re={buttonsBorder:{[z.buttons_borderPosition]:{...h[z.buttons_borderPosition],style:q[G]}}},z.buttons_borderPosition==="all"?y(ke=>({...s.RESET_BORDER_PARAMS,[z.buttons_borderPosition]:{...ke[z.buttons_borderPosition],style:q[G]}})):y(ke=>({...ke,[z.buttons_borderPosition]:{...ke[z.buttons_borderPosition],style:q[G]}}));break;case"buttons_borderColor":re={buttonsBorder:{[z.buttons_borderPosition]:{...h[z.buttonsBorderPosition],color:q[G]}}},z.buttons_borderPosition==="all"?y(ke=>({...s.RESET_BORDER_PARAMS,[z.buttons_borderPosition]:{...ke[z.buttons_borderPosition],color:q[G]}})):y(ke=>({...ke,[z.buttons_borderPosition]:{...ke[z.buttons_borderPosition],color:q[G]}}));break;case"buttons_borderWidth":re={buttonsBorder:{[z.buttons_borderPosition]:{...h[z.buttons_borderPosition],width:q[G]}}},z.buttonsBorderPosition==="all"?y(ke=>({...s.RESET_BORDER_PARAMS,[z.buttons_borderPosition]:{...ke[z.buttons_borderPosition],width:q[G]}})):y(ke=>({...ke,[z.buttons_borderPosition]:{...ke[z.buttons_borderPosition],width:q[G]}}));break;case"buttons_borderPosition":n.setFieldsValue({buttons_borderWidth:h[q[G]]?.width||"",buttons_borderColor:h[q[G]]?.color||"",buttons_borderStyle:h[q[G]]?.style||""});break;case"cards_borderStyle":re={cardsBorder:{[z.cards_borderPosition]:{...x[z.cards_borderPosition],style:q[G]}}},z.cards_borderPosition==="all"?E(ke=>({...s.RESET_BORDER_PARAMS,[z.cards_borderPosition]:{...ke[z.cards_borderPosition],style:q[G]}})):E(ke=>({...ke,[z.cards_borderPosition]:{...ke[z.cards_borderPosition],style:q[G]}}));break;case"cards_borderColor":re={cardsBorder:{[z.cards_borderPosition]:{...x[z.cardsBorderPosition],color:q[G]}}},z.cards_borderPosition==="all"?E(ke=>({...s.RESET_BORDER_PARAMS,[z.cards_borderPosition]:{...ke[z.cards_borderPosition],color:q[G]}})):E(ke=>({...ke,[z.cards_borderPosition]:{...ke[z.cards_borderPosition],color:q[G]}}));break;case"cards_borderWidth":re={cardsBorder:{[z.cards_borderPosition]:{...x[z.cards_borderPosition],width:q[G]}}},z.cardsBorderPosition==="all"?E(ke=>({...s.RESET_BORDER_PARAMS,[z.cards_borderPosition]:{...ke[z.cards_borderPosition],width:q[G]}})):E(ke=>({...ke,[z.cards_borderPosition]:{...ke[z.cards_borderPosition],width:q[G]}}));break;case"cards_borderPosition":n.setFieldsValue({cards_borderWidth:x[q[G]]?.width||"",cards_borderColor:x[q[G]]?.color||"",cards_borderStyle:x[q[G]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":re={buttonsBorderRadius:{[mu[G]]:+q[G]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":re={cardsBorderRadius:{[pu[G]]:+q[G]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":P?(re={padding:{all:+q[G]}},n.setFieldsValue({paddingTop:q[G],paddingLeft:q[G],paddingRight:q[G],paddingBottom:q[G]})):re={buttonsPadding:{[F[G]]:+q[G]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":re={blockPadding:{[hu[G]]:+q[G]}};break;case"blockPaddingTopBottom":re={blockPadding:{top:+q[G],bottom:+q[G]}},z.blockPaddingTop=z.blockPaddingBottom=+q[G];break;case"blockPaddingLeftRight":re={blockPadding:{left:+q[G],right:+q[G]}},z.blockPaddingLeft=z.blockPaddingRight=+q[G];break;default:re=q}G!=="buttons_borderPosition"&&l({operation:s.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:re})};return ce&&(0,t.jsx)("div",{className:(0,Ve.default)("appearance-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:n,layout:"vertical",name:"content_appearance_panel_form",initialValues:ce,onValuesChange:Q,autoComplete:"off",className:"element-controls",children:[null,(0,t.jsxs)(o.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:b.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:b.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:Y,onToggleExtended:me,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,t.jsxs)(o.ui_kit$FormSection,{title:i("General text"),dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Font of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textFontFamily",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{loadGoogleFonts:r,getPopupContainer:q=>q.closest(".email-pane__content-col")})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Font size of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textFontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:15,max:ie,placeholder:i("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Line height of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textLineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Color of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textContrastColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textPaddingBottom",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,t.jsx)(s.EmIcons,{icon:"PaddingBottom",component:o.icons$PaddingBottom}),addonAfter:"px"})})})})})]}),(0,t.jsxs)(o.ui_kit$FormSection,{title:i("Headings"),dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingFontFamily",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{loadGoogleFonts:r,getPopupContainer:q=>q.closest(".email-pane__content-col")})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingFontSize",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:ae,max:40,placeholder:i("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(s.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)(o.ui_kit$Space,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)({"selected-td-form__button--active":T}),type:"default",name:"headingBold",onClick:de,children:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)({"selected-td-form__button--active":Z}),type:"default",name:"headingItalic",onClick:de,children:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined})})})]})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block header color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingContrastColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Top padding"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingPaddingTop",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top padding"),prefix:(0,t.jsx)(s.EmIcons,{icon:"PaddingTop",component:o.icons$PaddingTop}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingPaddingBottom",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,t.jsx)(s.EmIcons,{icon:"PaddingBottom",component:o.icons$PaddingBottom}),addonAfter:"px"})})})})]})]}),(0,t.jsxs)(o.ui_kit$FormSection,{title:i("Links"),dividerTop:!0,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Underline"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)({"selected-td-form__button--active":te}),type:"default",name:"linkUnderline",onClick:de,children:(0,t.jsx)(s.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color in contrasting blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkContrastColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})})})]}),(0,t.jsxs)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Text & background")]}),dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsFontFamily",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{loadGoogleFonts:r,getPopupContainer:q=>q.closest(".email-pane__content-col")})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsFontSize",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Font size"),prefix:(0,t.jsx)(s.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons letter spacing"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsLetterSpacing",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,t.jsx)(s.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button text color in contrasting blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsContrastColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsBackgroundColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button background color in contrasting blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsContrastBackgroundColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),k.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(so,{form:n,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign",withHotKeys:!1})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)(o.ui_kit$Space,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)({"selected-td-form__button--active":_e}),type:"default",name:"buttonsBold",onClick:de,children:(0,t.jsx)(s.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,Ve.default)({"selected-td-form__button--active":fe}),type:"default",name:"buttonsItalic",onClick:de,children:(0,t.jsx)(s.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined})})})]})})]})]}),k.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(H.SelectedElementFormBorder,{form:n,borders:h,namePrefix:"buttons_"})})}),k.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Rt,{form:n,oneBorderRadiusValue:w,setOneBorderRadiusValue:I,elementSettings:ce,namePrefix:"buttons_"})})}),(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,t.jsx)(s.EmIcons,{icon:"PaddingTop",component:o.icons$PaddingTop}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,t.jsx)(s.EmIcons,{icon:"PaddingBottom",component:o.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Cards")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Base background color"),usedColors:c.usedColors})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:i("Contrasting colors"),compact:!0,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Contrasting background color"),usedColors:c.usedColors})})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Base text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsBaseTextColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Base text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsContrastTextColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Contrasting text color"),usedColors:c.usedColors})})})})]})]}),k.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Cards")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(H.SelectedElementFormBorder,{form:n,borders:x,namePrefix:"cards_"})})}),k.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Cards")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Rt,{form:n,oneBorderRadiusValue:A,setOneBorderRadiusValue:v,elementSettings:ce,namePrefix:"cards_"})})})]})})},ir=({email:e})=>{const{__:i}=s.useI18n(),r=e.hasOwnProperty("type")?s.BLOCK:s.EMAIL,[a,l]=(0,d.useState)(s.APPEARANCE),n=s.useAppConfig(),c=_=>l(_||"");e.common_styles&&e.common_styles;const m=r==="email"&&n.commonStylesEnabled&&!0;let f=[{label:(0,t.jsx)(t.Fragment,{children:i(r==="email"?"Global styles":"Block styles")}),key:s.APPEARANCE,forceRender:!0,className:"email-settings__collapse-panel",children:r==="email"?(0,t.jsx)(wa,{className:"email-settings__collapse-panel-content"}):(0,t.jsx)(Ia,{className:"email-settings__collapse-panel-content"})}];return m&&f.push({label:(0,t.jsx)(t.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(bu,{className:"email-settings__collapse-panel-content"})}),(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse appearance-panel__content-styles",size:"large",activeKey:a,onChange:c,items:f})})};ir.propTypes={};var fu=it.__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((r,a)=>(r[a.toLowerCase()]=a,r),{});e.CASE_SENSITIVE_TAG_NAMES_MAP=i}));function gu(e){return e.type===et.Tag||e.type===et.Script||e.type===et.Style}var et,_u,xu,ku,Eu,Bu,Tu,Su,yu,Ru,La=it.__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"})(et||(et={})),_u=et.Root,xu=et.Text,ku=et.Directive,Eu=et.Comment,Bu=et.Script,Tu=et.Style,Su=et.Tag,yu=et.CDATA,Ru=et.Doctype}));function Oa(e){return gu(e)}function Fa(e){return e.type===et.CDATA}function $a(e){return e.type===et.Text}function Ma(e){return e.type===et.Comment}function Da(e){return e.type===et.Directive}function Va(e){return e.type===et.Root}function wu(e){return Object.hasOwn(e,"children")}function rr(e,i=!1){let r;if($a(e))r=new Co(e.data);else if(Ma(e))r=new ni(e.data);else if(Oa(e)){const a=i?sr(e.children):[],l=new ui(e.name,{...e.attribs},a);for(const n of a)n.parent=l;e.namespace!=null&&(l.namespace=e.namespace),e["x-attribsNamespace"]&&(l["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(l["x-attribsPrefix"]={...e["x-attribsPrefix"]}),r=l}else if(Fa(e)){const a=i?sr(e.children):[],l=new ci(a);for(const n of a)n.parent=l;r=l}else if(Va(e)){const a=i?sr(e.children):[],l=new Ao(a);for(const n of a)n.parent=l;e["x-mode"]&&(l["x-mode"]=e["x-mode"]),r=l}else if(Da(e)){const a=new di(e.name,e.data);e["x-name"]!=null&&(a["x-name"]=e["x-name"],a["x-publicId"]=e["x-publicId"],a["x-systemId"]=e["x-systemId"]),r=a}else throw new Error(`Not implemented yet: ${e.type}`);return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}function sr(e){const i=e.map(r=>rr(r,!0));for(let r=1;r<i.length;r++)i[r].prev=i[r-1],i[r-1].next=i[r];return i}var li,Io,Co,ni,di,Po,ci,Ao,ui,Ua=it.__esmMin((()=>{La(),li=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 rr(this,e)}},Io=class extends li{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},Co=class extends Io{type=et.Text;get nodeType(){return 3}},ni=class extends Io{type=et.Comment;get nodeType(){return 8}},di=class extends Io{type=et.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},Po=class extends li{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}},ci=class extends Po{type=et.CDATA;get nodeType(){return 4}},Ao=class extends Po{type=et.Root;get nodeType(){return 9}},ui=class extends Po{name;attribs;type;constructor(e,i,r=[],a=e==="script"?et.Script:e==="style"?et.Style:et.Tag){super(r),this.name=e,this.attribs=i,this.type=a}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"}})),ar=it.__exportAll({CDATA:()=>ci,Comment:()=>ni,DataNode:()=>Io,Document:()=>Ao,DomHandler:()=>nr,Element:()=>ui,Node:()=>li,NodeWithChildren:()=>Po,ProcessingInstruction:()=>di,Text:()=>Co,cloneNode:()=>rr,default:()=>nr,hasChildren:()=>wu,isCDATA:()=>Fa,isComment:()=>Ma,isDirective:()=>Da,isDocument:()=>Va,isTag:()=>Oa,isText:()=>$a}),lr,nr,dr=it.__esmMin((()=>{La(),Ua(),Ua(),lr={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},nr=class{dom=[];root=new Ao(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,r){typeof i=="function"&&(r=i,i=lr),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??lr,this.elementCB=r??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new Ao(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 r=this.options.xmlMode?et.Tag:void 0,a=new ui(e,i,void 0,r);this.addNode(a),this.tagStack.push(a)}ontext(e){const{lastNode:i}=this;if(i&&i.type===et.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const r=new Co(e);this.addNode(r),this.lastNode=r}}oncomment(e){if(this.lastNode&&this.lastNode.type===et.Comment){this.lastNode.data+=e;return}const i=new ni(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new Co(""),i=new ci([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const r=new di(e,i);this.addNode(r)}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],r=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),r&&(e.prev=r,r.next=e),e.parent=i,this.lastNode=null}}})),Ha=it.__commonJSMin((e=>{var i=fu(),r=(dr(),it.__toCommonJS(ar)),a="\r",l=new RegExp(a,"g"),n=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(n,"g");function m(x){return i.CASE_SENSITIVE_TAG_NAMES_MAP[x]}function f(x){const E={};let w=0;const I=x.length;for(;w<I;w++){const A=x[w];E[A.name]=A.value}return E}function _(x){x=x.toLowerCase();const E=m(x);return E||x}function k(x,E){const w="<"+E,I=x.toLowerCase().indexOf(w);if(I===-1)return!1;const A=x[I+w.length];return A===">"||A===" "||A===" "||A===`
22
22
  `||A==="\r"||A==="/"}function b(x){return x.replace(l,n)}function h(x){return x.replace(c,a)}function y(x,E=null,w){const I=[];let A,v=0;const P=x.length;for(;v<P;v++){const C=x[v];switch(C.nodeType){case 1:{const W=_(C.nodeName);A=new r.Element(W,f(C.attributes)),A.children=y(W==="template"?C.content.childNodes:C.childNodes,A);break}case 3:A=new r.Text(h(C.nodeValue??""));break;case 8:A=new r.Comment(C.nodeValue??"");break;default:continue}const Y=I[v-1]??null;Y&&(Y.next=A),A.parent=E,A.prev=Y,A.next=null,I.push(A)}return w&&(A=new r.ProcessingInstruction(w.substring(0,w.indexOf(" ")).toLowerCase(),w),A.next=I[0]??null,A.parent=E,I.unshift(A),I[1]&&(I[1].prev=I[0])),I}e.escapeSpecialCharacters=b,e.formatDOM=y,e.hasOpenTag=k})),ju=it.__commonJSMin((e=>{var i=Ha(),r="html",a="head",l="body",n=/<([a-zA-Z]+[0-9]?)/;function c(x,E){return E?E.createHTML(x):x}var m=(x,E,w)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},f=(x,E,w)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},_=typeof window=="object"&&window.DOMParser;if(typeof _=="function"){const x=new _,E="text/html";f=(w,I,A)=>(I&&(w=`<${I}>${w}</${I}>`),x.parseFromString(w,E)),m=f}if(typeof document=="object"&&document.implementation){const x=document.implementation.createHTMLDocument();m=function(E,w,I){if(w){const A=x.documentElement.querySelector(w);return A&&(A.innerHTML=c(E,I)),x}return x.documentElement.innerHTML=c(E,I),x}}var k=typeof document=="object"&&document.createElement("template"),b;k&&k.content&&(b=(x,E)=>(k.innerHTML=c(x,E),k.content.childNodes));var h=()=>document.createDocumentFragment().childNodes;function y(x,E){x=i.escapeSpecialCharacters(x);const w=n.exec(x)?.[1]?.toLowerCase();switch(w){case r:{const I=f(x);if(!i.hasOpenTag(x,a)){const A=I.querySelector(a);A?.parentNode?.removeChild(A)}if(!i.hasOpenTag(x,l)){const A=I.querySelector(l);A?.parentNode?.removeChild(A)}return I.querySelectorAll(r)}case a:case l:{const I=m(x,void 0,E).querySelectorAll(w);return i.hasOpenTag(x,l)&&i.hasOpenTag(x,a)?I[0].parentNode?.childNodes??h():I}default:return b?b(x,E):m(x,l,E).querySelector(l)?.childNodes??h()}}e.default=y})),vu=it.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=Ha(),r=ju(),a=/<(![a-zA-Z\s]+)>/;function l(n,c){if(typeof n!="string")throw new TypeError("First argument must be a string");if(!n)return[];const m=a.exec(n),f=m?m[1]:void 0;return i.formatDOM(r.default(n,c?.trustedTypePolicy),null,f)}e.default=l})),Iu=it.__commonJSMin((e=>{var i=0;e.SAME=i;var r=1;e.CAMELCASE=r,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}})),Cu=it.__commonJSMin((e=>{var i=0,r=1,a=2,l=3,n=4,c=5,m=6;function f(v){return k.hasOwnProperty(v)?k[v]:null}function _(v,P,C,Y,W,F,N){this.acceptsBooleans=P===a||P===l||P===n,this.attributeName=Y,this.attributeNamespace=W,this.mustUseProperty=C,this.propertyName=v,this.type=P,this.sanitizeURL=F,this.removeEmptyString=N}var k={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(v=>{k[v]=new _(v,i,!1,v,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([v,P])=>{k[v]=new _(v,r,!1,P,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(v=>{k[v]=new _(v,a,!1,v.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(v=>{k[v]=new _(v,a,!1,v,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(v=>{k[v]=new _(v,l,!1,v.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(v=>{k[v]=new _(v,l,!0,v,null,!1,!1)}),["capture","download"].forEach(v=>{k[v]=new _(v,n,!1,v,null,!1,!1)}),["cols","rows","size","span"].forEach(v=>{k[v]=new _(v,m,!1,v,null,!1,!1)}),["rowSpan","start"].forEach(v=>{k[v]=new _(v,c,!1,v.toLowerCase(),null,!1,!1)});var b=/[\-\:]([a-z])/g,h=v=>v[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(v=>{const P=v.replace(b,h);k[P]=new _(P,r,!1,v,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(v=>{const P=v.replace(b,h);k[P]=new _(P,r,!1,v,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(v=>{const P=v.replace(b,h);k[P]=new _(P,r,!1,v,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(v=>{k[v]=new _(v,r,!1,v.toLowerCase(),null,!1,!1)});var y="xlinkHref";k[y]=new _("xlinkHref",r,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(v=>{k[v]=new _(v,r,!1,v.toLowerCase(),null,!0,!0)});var{CAMELCASE:x,SAME:E,possibleStandardNames:w}=Iu(),I=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),A=Object.keys(w).reduce((v,P)=>{const C=w[P];return C===E?v[P]=P:C===x?v[P.toLowerCase()]=P:v[P]=C,v},{});e.BOOLEAN=l,e.BOOLEANISH_STRING=a,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=n,e.POSITIVE_NUMERIC=m,e.RESERVED=i,e.STRING=r,e.getPropertyInfo=f,e.isCustomAttribute=I,e.possibleStandardNames=A}));function Pu(e,i){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];i=i||{};var r=1,a=1;function l(x){var E=x.match(za);E&&(r+=E.length);var w=x.lastIndexOf(Qa);a=~w?x.length-w:a+x.length}function n(){var x={line:r,column:a};return function(E){return E.position=new c(x),_(),E}}function c(x){this.start=x,this.end={line:r,column:a},this.source=i.source}c.prototype.content=e;function m(x){var E=new Error(i.source+":"+r+":"+a+": "+x);if(E.reason=x,E.filename=i.source,E.line=r,E.column=a,E.source=e,!i.silent)throw E}function f(x){var E=x.exec(e);if(E){var w=E[0];return l(w),e=e.slice(w.length),E}}function _(){f(Ga)}function k(x){var E;for(x=x||[];E=b();)E!==!1&&x.push(E);return x}function b(){var x=n();if(!(ur!=e.charAt(0)||mr!=e.charAt(1))){for(var E=2;Jt!=e.charAt(E)&&(mr!=e.charAt(E)||ur!=e.charAt(E+1));)++E;if(E+=2,Jt===e.charAt(E-1))return m("End of comment missing");var w=e.slice(2,E-2);return a+=2,l(w),e=e.slice(E),a+=2,x({type:Za,comment:w})}}function h(){var x=n(),E=f(Ya);if(E){if(b(),!f(Xa))return m("property missing ':'");var w=f(Ka),I=x({type:el,property:Wa(E[0].replace(cr,Jt)),value:w?Wa(w[0].replace(cr,Jt)):Jt});return f(qa),I}}function y(){var x=[];k(x);for(var E;E=h();)E!==!1&&(x.push(E),k(x));return x}return _(),y()}function Wa(e){return e?e.replace(Ja,Jt):Jt}var cr,za,Ga,Ya,Xa,Ka,qa,Ja,Qa,ur,mr,Jt,Za,el,Au=it.__esmMin((()=>{cr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,za=/\n/g,Ga=/^\s*/,Ya=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Xa=/^:\s*/,Ka=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,qa=/^[;\s]*/,Ja=/^\s+|\s+$/g,Qa=`
23
23
  `,ur="/",mr="*",Jt="",Za="comment",el="declaration"}));function Nu(e,i){let r=null;if(!e||typeof e!="string")return r;const a=Pu(e),l=typeof i=="function";return a.forEach(n=>{if(n.type!=="declaration")return;const{property:c,value:m}=n;l?i(c,m,n):m&&(r=r??{},r[c]=m)}),r}var Lu=it.__esmMin((()=>{Au()})),Ou=it.__exportAll({default:()=>Fu});function Fu(e,i){const r={};return!e||typeof e!="string"||Nu(e,(a,l)=>{a&&l&&(r[nl(a,i)]=l)}),r}var tl,ol,il,rl,sl,al,ll,pr,nl,$u=it.__esmMin((()=>{Lu(),tl=/^--[a-zA-Z0-9_-]+$/,ol=/-([a-z])/g,il=/^[^-]+$/,rl=/^-(webkit|moz|ms|o|khtml)-/,sl=/^-(ms)-/,al=e=>!e||il.test(e)||tl.test(e),ll=(e,i)=>i.toUpperCase(),pr=(e,i)=>`${i}-`,nl=(e,i={})=>al(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(sl,pr):e=e.replace(rl,pr),e.replace(ol,ll))})),dl=it.__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=n,e.setStyleProp=m;var r=bt("react"),a=i(($u(),it.__toCommonJS(Ou))),l=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function n(k,b){return k.includes("-")?!l.has(k):!!(b&&typeof b.is=="string")}var c={reactCompat:!0};function m(k,b){if(typeof k=="string"){if(!k.trim()){b.style={};return}try{b.style=(0,a.default)(k,c)}catch{b.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(r.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var f=k=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(k.name);e.canTextBeChildOfNode=f;var _=k=>k;e.returnFirstArg=_})),cl=it.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=Cu(),r=dl(),a=["checked","value"],l=["input","select","textarea"],n={reset:!0,submit:!0};function c(f={},_){const k={},b=!!(f.type&&n[f.type]);for(const h in f){const y=f[h];if((0,i.isCustomAttribute)(h)){k[h]=y;continue}const x=h.toLowerCase();let E=m(x);if(E){const w=(0,i.getPropertyInfo)(E);switch(a.includes(E)&&l.includes(_)&&!b&&(E=m("default"+x)),k[E]=y,w?.type){case i.BOOLEAN:k[E]=!0;break;case i.OVERLOADED_BOOLEAN:y===""&&(k[E]=!0)}continue}r.PRESERVE_CUSTOM_ATTRIBUTES&&(k[h]=y)}return(0,r.setStyleProp)(f.style,k),k}function m(f){return i.possibleStandardNames[f]}})),Mu=it.__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 r=(dr(),it.__toCommonJS(ar)),a=bt("react"),l=i(cl()),n=dl(),c={cloneElement:a.cloneElement,createElement:a.createElement,isValidElement:a.isValidElement};function m(k,b={}){var h,y,x,E,w;const I=[],A=typeof b.replace=="function",v=(h=b.transform)!==null&&h!==void 0?h:n.returnFirstArg,{cloneElement:P,createElement:C,isValidElement:Y}=(y=b.library)!==null&&y!==void 0?y:c,W=k.length;f(k);for(let F=0;F<W;F++){const N=k[F];if(A){let se=(x=b.replace)===null||x===void 0?void 0:x.call(b,N,F);if(Y(se)){W>1&&(se=P(se,{key:(E=se.key)!==null&&E!==void 0?E:F})),I.push(v(se,N,F));continue}}if(N.type==="text"){const se=!N.data.trim().length;if(se&&N.parent&&!(0,n.canTextBeChildOfNode)(N.parent)||b.trim&&se)continue;I.push(v(N.data,N,F));continue}const T=N;let J={};_(T)?((0,n.setStyleProp)(T.attribs.style,T.attribs),J=T.attribs):T.attribs&&(J=(0,l.default)(T.attribs,T.name));let Z;switch(N.type){case"script":case"style":N.children[0]&&(J.dangerouslySetInnerHTML={__html:N.children[0].data});break;case"tag":N.name==="textarea"&&N.children[0]?J.defaultValue=N.children[0].data:!((w=N.children)===null||w===void 0)&&w.length&&(Z=m(N.children,b));break;default:continue}W>1&&(J.key=F),I.push(v(C(N.name,J,Z),N,F))}return I.length===1?I[0]:I}function f(k){for(const b of k)(b.type==="tag"||b.type==="script"||b.type==="style")&&(Object.setPrototypeOf(b,r.Element.prototype),f(b.children))}function _(k){return n.PRESERVE_CUSTOM_ATTRIBUTES&&k.type==="tag"&&(0,n.isCustomComponent)(k.name,k.attribs)}})),Du=it.__commonJSMin((e=>{var i=e&&e.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};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 r=i(vu());e.htmlToDOM=r.default;var a=i(cl());e.attributesToProps=a.default;var l=i(Mu());e.domToReact=l.default;var n=(dr(),it.__toCommonJS(ar));Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return n.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return n.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return n.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return n.Text}});var c={lowerCaseAttributeNames:!1};function m(f,_){var k;if(typeof f!="string")throw new TypeError("First argument must be a string");if(!f)return[];const b=Object.assign(Object.assign({},(k=_?.htmlparser2)!==null&&k!==void 0?k:c),{trustedTypePolicy:_?.trustedTypePolicy});return(0,l.default)((0,r.default)(f,b),_)}})),fo=it.__toESM(Du(),1),Vu=fo.default.default||fo.default,Uu={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function ul(e,i,r){r.document&&(s.writeEmailAttributes(r.document,{[e]:i}),r.pushToDataLayer({event:"submit",action:Uu[e],entity_type:r.entityType,entity_id:r.entityId,project_id:r.projectId,context:"editor"}))}function Hu(){const{document:e}=s.useDocumentSessionContext(),i=(0,d.useCallback)(a=>e?e.subscribe(a):()=>{},[e]),r=(0,d.useCallback)(()=>e?.get().serverId??void 0,[e]);return(0,d.useSyncExternalStore)(i,r)}function hr({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function ml({limitsInPlugin:e,hostedAiActive:i,counter:r,limit:a}){return hr({limitsInPlugin:e,hostedAiActive:i})?a>0&&r>=a:!1}function pl(e,i){if(!i||typeof e!="string")return i||e;const r=i.trim();if(!r)return e;if(/^\s*<!DOCTYPE/i.test(r)||/^\s*<\s*html[\s>]/i.test(r))return i;try{const a=new DOMParser().parseFromString(e,"text/html"),l=a.querySelector("editor");if(l){l.innerHTML=i;const n=e.match(/^[\s\uFEFF]*<!DOCTYPE[^>]*>/i);return`${n?`${n[0]}
24
- `:""}${a.documentElement.outerHTML}`}}catch{}return i}var Wu=e=>{const{__:i}=s.useI18n();return[{key:"📧",label:(0,t.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["📧 ",i("Subject line & preheader generator")]})},{key:"🌎",label:(0,t.jsxs)("div",{onClick:()=>{e("translator")},children:["🌎 ",i("Translator")]})},{key:"📄",label:(0,t.jsxs)("div",{onClick:()=>{e("writer")},children:["📄 ",i("Copywriter")]})},{key:"🔎",label:(0,t.jsxs)("div",{onClick:()=>{e("corrector")},children:["🔎 ",i("Proofreader")]})},{key:"🧠",label:(0,t.jsxs)("div",{onClick:()=>{e("psychologist")},children:["🧠 ",i("Psychologist")]})},{key:"📈",label:(0,t.jsxs)("div",{onClick:()=>{e("marketolog")},children:["📈 ",i("Marketer")]})},{key:"✨",label:(0,t.jsxs)("div",{onClick:()=>{e("email-generator")},children:["✨ ",i("Email generator")]})}]},zu={background:s.emCssVar("colorInfo"),color:"#ffffff"},hl=({messages:e,newEmailAiGeneratorRef:i})=>{const r=s.useElementEntityKind(),{document:a}=s.useDocumentSessionContext(),l=s.useContentReader(),n=s.useContentReplacer(),{__:c,_n:m}=s.useI18n(),f=s.useDispatch(),_=s.useAppNavigate(),k=(0,d.useRef)(null),b=s.useAppConfig(),h=s.useNotification(),y=s.useEditorProjectId(),x=Hu(),E=s.usePushToDataLayer(),w={document:a,pushToDataLayer:E,entityType:r==="block"?"block":"email",entityId:x,projectId:y},I=s.useEventEmitter(De.events.ON_LIMIT_ID),[A,v]=(0,d.useState)(null),[P,C]=(0,d.useState)(0),[Y,W]=(0,d.useState)(!1),[F,N]=(0,d.useState)(""),[T,J]=(0,d.useState)([]),[Z,se]=(0,d.useState)(!1),[te,ne]=(0,d.useState)(!1),[_e,le]=(0,d.useState)(null),[fe,Ae]=(0,d.useState)(0),[ce,$e]=(0,d.useState)(null),Ce=s.useEmailAttribute("subject"),ie=s.useEmailAttribute("preheader"),Be=s.useCurrentUser(),ae=s.toLanguageCode(s.useInterfaceLocale()),oe=Be.avatar_urls?.[24],me=[Be.first_name,Be.last_name].filter(Boolean).join(" ")||Be.username,de=s.useMessageService(),[Q]=s.useLazyGetDialogQuery(),q=s.useSendPostMessage(),[z,G]=s.useSendMessageMutation(),[re,{reset:ke}]=s.useGetAiGenerateStatusMutation(),[he,{data:Pe=[]}]=s.useLazyGetGeneratedContentQuery(),[ye]=s.useLazyGetLimitsStatsByTypeQuery(),V={cursor:Y?"not-allowed":"default",pointerEvents:Y?"none":"auto"};(0,d.useEffect)(()=>{ce&&Z&&(i.current=!0),Z||(i.current=!1)},[ce,Z]);const ee=!!(b.limits&&b.counters)&&!0,{limits:we}=b.limits?b:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:je,ai_generator_limit:K}=we,ve=s.useEventEmitter(De.events.AI_TEXT_REQUEST_ID).hasListeners(),Re=hr({limitsInPlugin:ee,hostedAiActive:ve}),Le=ml({limitsInPlugin:ee,hostedAiActive:ve,counter:P,limit:je}),Ue=ml({limitsInPlugin:ee,hostedAiActive:ve,counter:fe,limit:K}),Me=(0,d.useCallback)(()=>{I.fire({name:"AiChatCount",count:P+1})},[I,P]),He=(0,d.useCallback)(()=>{I.fire({name:"AiGeneratorCount",count:fe+1})},[I,fe]),O=(0,d.useCallback)(async B=>!0,[c,ye,h]);(0,d.useEffect)(()=>{ee&&(C(b?.counters?.ai_counter||0),Ae(b?.counters?.ai_generator_counter||0))},[b,ee]),(0,d.useEffect)(()=>{$e(T.length<=0?!1:T.toReversed().find(S=>S.data?.context)?.data.context==="email-generator")},[T]);const xe=(0,d.useCallback)(async()=>await de.sendAsync(s.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[de]),D=(0,d.useCallback)(()=>{const B=k.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{B?.scrollTo({top:B.scrollHeight,behavior:"smooth"})},0)},[k]),ue=(0,d.useCallback)(()=>{s.swallowPromiseRejection(Q({entity_id:x}).then(B=>{J(B.data.documents),D()}))},[x,Q,J,D]),ge=(0,d.useCallback)(B=>{if(!B?.data?._eventResult)return!1;const{aiMessage:S,aiHtml:p}=B.data;if(J($=>{const U=[...$];for(let Se=U.length-1;Se>=0;Se--)if(U[Se]?.data?.isLoading&&U[Se]?.data?.role==="assistant"){U[Se]={data:{role:"assistant",message:S,isLoading:!1}};break}return U}),p){const $=pl(l(),String(p));n($,{undoable:!0})}return D(),!0},[l,n,D]),Oe=(0,d.useCallback)(B=>{J(S=>{for(let p=S.length-1;p>=0;p--)if(S[p]?.data?.isLoading&&S[p]?.data?.role==="assistant"){const $=[...S];return B?$[p]={data:{role:"assistant",message:B}}:$.splice(p,1),$}return S})},[]),Ge=(0,d.useCallback)(B=>{const S=B?.message==="ERROR"?void 0:B?.message;return[B?.data?.message,S].find(p=>typeof p=="string"&&p)||c("Something went wrong.")},[c]),Ye=s.useEventEmitter(De.events.AI_TEXT_PROGRESS_ID);(0,d.useEffect)(()=>{const B=Ye.event(({progress:S,status:p})=>{const $=p||`${Math.round(S)}%`;J(U=>{const Se=[...U];for(let pe=Se.length-1;pe>=0;pe--)if(Se[pe]?.data?.isLoading&&Se[pe]?.data?.role==="assistant"){Se[pe]={data:{...Se[pe].data,message:$}};break}return Se})});return()=>B.dispose()},[Ye]);const Xe=s.useEventEmitter(De.events.AI_TEXT_STREAM_ID);(0,d.useEffect)(()=>{const B=Xe.event(({partialHtml:S})=>{const p=pl(l(),String(S));n(p,{undoable:!0})});return()=>B.dispose()},[Xe,l,n,f]);const R=(0,d.useCallback)(B=>{se(!0),W(!0),s.swallowPromiseRejection(re({task_id:B||A,entity_id:x,status:"started"}).then(()=>{ue()}))},[x,re,A,ue]),X=(0,d.useCallback)(()=>{re({task_id:A,entity_id:x,status:"completed"}).then(B=>{B.data.status===403&&ke(),ue()}).catch(B=>{}),W(!1),se(!1)},[x,re,A,ue,ke]);(0,d.useEffect)(()=>{let B;if(Z){const S=Pe[Pe.length-1]?.processing?.email;if(S){let p=Pe[Pe.length-1].status;n(String(S),{undoable:!0}),p===0&&X()}_e&&(clearInterval(B),se(!1),le(!1))}return()=>{clearInterval(B)}},[n,_e,f,Pe,Z,Ce,ie,x,A,ue,re,G,X]),(0,d.useEffect)(D,[D]),(0,d.useEffect)(()=>{e?.length>0&&J(e),q({operation:s.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,q]),(0,d.useEffect)(()=>{const B=de.onInit(()=>{de.send({operation:s.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:Y}),de.send({operation:s.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:Y})});return()=>B.dispose()},[Y,de]);const j=async()=>{if(F){const B=F.replaceAll(/\n/g,"<br>"),S={project_id:y,connection:"chat",entity_id:x,message:B,locale:ae,subject:Ce||"",preheader:ie||"",textContent:hi.extractDocumentTextContent(l())};if(ce&&Ue||Le){h.error({title:c(ce?"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 p={data:{role:"assistant",message:c(ce?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};J($=>[...$,p])}else{if(!await O(ce?"email_generate":"ai")){N("");return}Re&&(ce&&fe!==K?(He(),Ae($=>$+1)):P!==je&&(Me(),C($=>$+1))),E({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:S.entity_id,project_id:S.project_id});const p=[{data:{role:"user",message:B,userInfo:{display_name:me,avatar_url:oe}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];J($=>[...$,...p]),z({body:S}).then($=>{if($?.error)throw $.error;if(!$?.data||$.data.status===401)throw new Error(s.ERROR);if(!ge($)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:r==="block"?"block":"email",entity_id:x,project_id:y,context:"editor"}),$.data.task_id){let U=$.data.task_id;v(U),he({id:U,setError:le}),s.swallowPromiseRejection(xe().then(Se=>{Se?R(U):ne(!0)}))}ue()}}).catch($=>{const U=Ge($);h.error({title:$?.data?.code||c("Error"),description:U}),Oe(U)})}N("")}},M=async B=>{const S={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};J($=>[...$,S]);const p={project_id:y,connection:"chat",entity_id:x,context:B,locale:ae,subject:Ce||"",preheader:ie||"",textContent:hi.extractDocumentTextContent(l())};if(Re&&(ce&&fe!==K?(He(),Ae($=>$+1)):P!==je&&(Me(),C($=>$+1))),Le)h.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),Oe(c("You have reached the limit of AI chat usage."));else{if(!await O("ai")){Oe();return}E({event:"select",action:"select_ai_assistant_role",context:p.context,entity_id:p.entity_id,project_id:p.project_id}),z({body:p}).then($=>{if($?.error)throw $.error;if(!$?.data||$.data.status===401)throw new Error(s.ERROR);ge($)||ue()}).catch($=>{const U=Ge($);h.error({title:$?.data?.code||c("Error"),description:U}),Oe(U)})}},Ee=(0,d.useCallback)(async B=>{const S={data:{role:"user",message:B,userInfo:{display_name:me,avatar_url:oe}}},p={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};J(U=>[...U,S,p]);const $={project_id:y,connection:"chat",entity_id:x,message:B,locale:ae,subject:Ce||"",preheader:ie||"",textContent:hi.extractDocumentTextContent(l())};if(Ue)h.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),Oe(c("You have reached the limit of AI chat usage."));else{if(!await O(ce?"email_generate":"ai")){Oe();return}z({body:$}).then(U=>{if(U?.error)throw U.error;if(!U?.data||U.data.status===401)throw new Error(s.ERROR);if(!ge(U)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:r==="block"?"block":"email",entity_id:x,project_id:y,context:"editor"}),U.data.task_id){let Se=U.data.task_id;v(Se),he({id:Se,setError:le}),s.swallowPromiseRejection(xe().then(pe=>{pe?R(Se):ne(!0)}))}Re&&(ce&&fe!==K?(He(),Ae(Se=>Se+1)):P!==je&&(Me(),C(Se=>Se+1))),ue()}}).catch(U=>{const Se=Ge(U);h.error({title:U?.data?.code||c("Error"),description:Se}),Oe(Se)})}},[c,P,fe,oe,xe,Oe,R,Ge,me,je,K,Be,Ce,ie,x,ce,Ue,ae,Me,He,Re,l,h,O,y,z,he,ue]);(0,d.useEffect)(()=>{const B=new De.Disposable,S=window.localStorage.getItem(s.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&S&&x){const p={project_id:y,connection:"chat",entity_id:x,context:"email-generator",locale:ae};s.runOnceInFlight(`discuss-ai-generator-context:${x}`,()=>{if(ve){window.localStorage.removeItem(s.LOCAL_STORAGE_ITEMS.em_ai_settings),Ee(S);return}s.swallowPromiseRejection(z({body:p}).then(()=>{window.localStorage.removeItem(s.LOCAL_STORAGE_ITEMS.em_ai_settings),B.isDisposed()||Ee(S)}))})}return()=>B.dispose()},[e,Ee,x,ae,y,z,ve]);const Fe=B=>{typeof B.target.className=="string"&&B.target.className.includes("ai-response-change-context")&&(G.isLoading||M(B.target.role))},tt=B=>{const S=B.children[0].data??"";ul("subject",S,w),h.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:S})},qe=B=>{const S=B.children[0].data??"";ul("preheader",S,w),h.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:S,duration:300})},ct=B=>{const S=B.children[0].data;navigator.clipboard.writeText(S).then(()=>{h.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:S})}).catch(p=>{})},Ze={replace:B=>{if(B.attribs?.class?.split(" ").includes("ai-response-title"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Replace the title"),children:(0,t.jsx)("div",{onClick:()=>tt(B),children:(0,t.jsx)("span",{className:"ai-response-title",children:(0,fo.domToReact)(B.children,Ze)})})});if(B.attribs?.class?.split(" ").includes("ai-response-preheader"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Replace the preheader"),children:(0,t.jsx)("div",{onClick:()=>qe(B),children:(0,t.jsx)("span",{className:"ai-response-preheader",children:(0,fo.domToReact)(B.children,Ze)})})});if(B.attribs?.class?.split(" ").includes("ai-response-copy"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Copy to clipboard"),children:(0,t.jsx)("div",{onClick:()=>ct(B),children:(0,t.jsx)("span",{className:"ai-response-copy",children:(0,fo.domToReact)(B.children,Ze)})})});if(B.attribs?.class?.split(" ").includes("ai-response-user-message")){const S=B.attribs?.data||B.children?.[0]?.data;return(0,t.jsx)("li",{className:B.attribs?.class,data:B.attribs?.data,onClick:()=>Ee(S),children:(0,fo.domToReact)(B.children,Ze)})}}},ut=()=>{R(),ne(!1)},Bt=()=>{X(),ne(!1)};return(0,t.jsxs)("div",{ref:k,className:"discuss-main",children:[T.length>0&&(0,t.jsx)(o.ui_kit$List,{onClick:Fe,className:"comment-list",itemLayout:"horizontal",dataSource:T,renderItem:B=>(0,t.jsx)("li",{id:B._id,children:(0,t.jsx)(o.ui_kit$Comment,{className:B.data.userInfo?"":"ai-comment",avatar:B.data.role==="assistant"?(0,t.jsx)(s.EmIcons,{icon:"ChatGpt",component:o.icons$ChatGpt,className:"anticon-robot",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}):B.data.userInfo&&B.data._modified?B.data.userInfo.avatar_url:oe||(0,t.jsx)(s.EmIcons,{icon:"UserOutlined",component:o.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,t.jsx)("div",{style:V,children:B?.data?.role==="user"?Be?.username||c("User"):c("AI Assistant")}),datetime:B._created?(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:St.formatDate(s.parseISO(B._created),m,!0)}}):null,content:B.data.isLoading?(0,t.jsx)("div",{className:"spin",children:(0,t.jsx)(s.EmIcons,{icon:"LoadingOutlined",component:o.icons$LoadingOutlined,style:{fontSize:24},spin:!0})}):(0,t.jsx)("div",{style:V,children:Vu(B.data.message,Ze)})})},B._id)}),ee&&(ce?(0,t.jsx)(o.ui_kit$LimitsCounter,{text:`${fe} ${c("of")} ${K>0?K:"∞"} ${c("mail generator")} ${m("was used","were used",fe)}`,exceeded:K>0&&fe>=K,style:{marginTop:-25},extra:(0,t.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>_(b.billingPageUrl||s.APP_ROUTES.billing),children:c("Need more?")})}):(0,t.jsx)(o.ui_kit$LimitsCounter,{text:`${P} ${c("of")} ${je>0?je:"∞"} ${c("messeges")} ${m("was used","were used",P)}`,exceeded:je>0&&P>=je,style:{marginTop:-25},extra:(0,t.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>_(b.billingPageUrl||s.APP_ROUTES.billing),children:c("Need more?")})})),(0,t.jsxs)(o.ui_kit$Form,{onFinish:j,className:"addMode",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{disabled:Y,value:F,onChange:B=>N(B.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:B=>B.key==="Enter"&&B.ctrlKey&&j(),spellCheck:"false"})}),(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Button,{disabled:G.isLoading||Y,type:"default",style:zu,className:"button-target",children:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"top",disabled:Y,arrow:{pointAtCenter:!0},menu:{items:Wu(M)},children:(0,t.jsxs)("div",{disabled:Y,style:{margin:0,padding:0,color:"#ffffff",display:"inline-flex",alignItems:"center"},children:[(0,t.jsx)(s.EmIcons,{icon:"ChatGpt",component:o.icons$ChatGpt,style:{marginRight:5}}),c("Role")]})},"Export")}),(0,t.jsxs)(o.ui_kit$Button,{disabled:G.isLoading||Y,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,t.jsx)(s.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]})]})})]}),(0,t.jsx)(o.ui_kit$Modal,{title:c("Warning"),open:te,onOk:ut,onCancel:Bt,children:(0,t.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},Gu=[s.VALID,s.ERRORS,s.WARNINGS],bl=({summary:e,__:i,selectedTags:r,setSelectedTags:a})=>{const l=(0,d.useCallback)((c,m)=>{a(m?r.length===2?[]:[...r,c]:r.filter(f=>f!==c))},[r,a]),n=(0,d.useCallback)(c=>i(c==="valid"?"Valid":c==="warnings"?"Warnings":"Errors"),[i]);return(0,t.jsx)(o.ui_kit$Title,{level:5,className:"optimise__valid-title",children:(0,t.jsx)(o.ui_kit$Space,{className:"optimise__valid-title-space",size:8,children:Gu.map((c,m)=>(0,t.jsxs)(o.ui_kit$CheckableTag,{checked:r?.includes(c),onChange:f=>l(c,f),className:(0,Ve.default)(`${c} optimise__button`,{[`${c}_active`]:r.includes(c)}),children:[n(c),": ",e?.[c]||0]},c+m))})})},{LINKS:Yu}=s.OPTIMISE_TABS,fl=(0,d.memo)(({__:e,activeTab:i,validateLinksResult:r,validateLinks:a,selectedTags:l,setSelectedTags:n,isLoading:c,disabled:m,iconStrokeWidth:f,onValidate:_,goToLinkHandler:k})=>i!==Yu||!r?.links?null:r.links.length===0?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No links found."),type:"info"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-14",children:(0,t.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,t.jsx)(bl,{__:e,summary:r.summary,setSelectedTags:n,selectedTags:l}),(0,t.jsx)(o.ui_kit$Button,{disabled:m,loading:c,onClick:_,icon:(0,t.jsx)(s.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:f}),children:e("Refresh")})]})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:a,renderItem:(b,h)=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{avatar:b.status==="valid"?(0,t.jsx)(s.EmIcons,{icon:"CheckCircleFilled",component:o.icons$CheckCircleFilled,className:s.VALID}):b.status==="warnings"?(0,t.jsx)(s.EmIcons,{icon:"CheckCircleFilled",component:o.icons$CheckCircleFilled,className:s.WARNINGS}):(0,t.jsx)(s.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:s.ERRORS}),title:(0,t.jsx)(o.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(b.linkId,600>(b.statusCode||0)&&(b.statusCode||0)>399||!b.statusCode),children:b.url===""?e("empty link"):b.url}),description:(0,t.jsxs)(t.Fragment,{children:[!!b.text?.length&&(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:b.text}),b.page?.title&&b.page.title,b.page?.secure&&b.status==="valid"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"valid",children:e("secure")})]}),!b.resolvedUrl&&!b.statusCode&&b.type==="url"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},h+"_"+b.linkId)})})})]}));fl.displayName="LinksSection";var{IMAGES:Xu}=s.OPTIMISE_TABS,gl=(0,d.memo)(({__:e,activeTab:i,validateImagesResult:r,validateImages:a,selectedTags:l,setSelectedTags:n,isLoading:c,disabled:m,iconStrokeWidth:f,onValidate:_,goToImageHandler:k,showImgPreviewHandler:b,hideBlockPreviewHandler:h})=>i!==Xu||!r?.images?null:r.images.length===0?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,t.jsx)(o.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,t.jsxs)("div",{className:"optimise__summary",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[r.images.length," "]}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[r.summaryTime?.value,r.summaryTime?.name]}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...r.images.map(y=>y.image.responseTime))/1e3).toFixed(2)+e("s")}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("time to load")})]})]}),type:"warning"})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,t.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,t.jsx)(bl,{__:e,summary:r.summary,setSelectedTags:n,selectedTags:l}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:f}),disabled:m,loading:c,onClick:_,children:e("Refresh")})]})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:a,renderItem:(y,x)=>(0,t.jsx)(o.ui_kit$List.Item,{className:`optimise__image-item image-item ${o.ui_kit$LIST_ITEM_BORDERLESS_CLASS}`,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{className:(0,Ve.default)("image-item__meta",{"image-item__meta_fail":!y.resolvedUrl&&!y.statusCode}),avatar:(0,t.jsx)(o.ui_kit$Image,{className:(0,Ve.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!y.resolvedUrl||!y.valid}),width:92,height:"auto",src:y.resolvedUrl||"",preview:!1,onMouseEnter:()=>b(y.url,y.image.dimensions?.width),onMouseLeave:()=>h()}),title:y.url?(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:y.message,children:(0,t.jsx)(o.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(y.imageId,600>(y.statusCode||0)&&(y.statusCode||0)>399||!y.statusCode),children:y?.url===""?e("empty src"):y.url})}):y.message,description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"image-size",children:[y.image.dimensions&&(0,t.jsxs)(t.Fragment,{children:[y.image.dimensions.width+" × "+y.image.dimensions.height,(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsxs)("span",{children:[Math.round(y.image.bytes/1024),e("kB")]}),(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsxs)("span",{children:[y.image.responseTime,e("ms")]}),(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsx)("span",{className:"image-size-format",children:Wo(y.image.contentType)})]}),y.image.secure&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsx)("span",{className:"valid",children:e("secure")})]}),y.resolvedUrl&&!y.valid&&(0,t.jsx)(o.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!y.resolvedUrl&&!y.statusCode&&(0,t.jsx)(o.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},x)})})})]}));gl.displayName="ImagesSection";var{SPAM_ASSASSIN:Ku}=s.OPTIMISE_TABS,_l=(0,d.memo)(({__:e,activeTab:i,validateSpamResult:r,isLoading:a,disabled:l,iconStrokeWidth:n,onValidate:c})=>{const m=r?.report?.length||Object.prototype.hasOwnProperty.call(r,"spamScore");if(i!==Ku||!m)return null;const f=r.spamScore||0,_=r.baseSpamScore||0,k=f<2||!r.spamScore||f<=_-1?"success":f<_-1?"warning":"danger";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:[(0,t.jsxs)("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam",children:[(0,t.jsxs)(o.ui_kit$Title,{level:1,className:"optimise__spam-score-title",type:k,children:[(0,t.jsx)("span",{className:"optimise__spam-score-value",children:f}),(0,t.jsx)(o.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,t.jsx)(o.ui_kit$Button,{disabled:l,icon:(0,t.jsx)(s.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:n}),loading:a,onClick:c,children:e("Refresh")})]}),f>_-1&&(0,t.jsx)(o.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(_-1)+"."})]}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(r.report?.length||0)>0?(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:r.report,renderItem:b=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{title:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Text,{className:"optimise__spam-report-score",children:b.score}),(0,t.jsx)("span",{className:"optimise__spam-report-description",children:b.description})]})})})}):(0,t.jsx)(t.Fragment,{children:r.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});_l.displayName="SpamSection";var{PROBLEMS:qu}=s.OPTIMISE_TABS,xl=(0,d.memo)(({__:e,activeTab:i,problemsList:r,onSetMonacoPosition:a})=>i!==qu?null:r?.length?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:r,renderItem:l=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{avatar:l.severity<6?(0,t.jsx)(s.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:s.WARNINGS}):(0,t.jsx)(s.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:s.ERRORS}),title:(0,t.jsxs)(o.ui_kit$Text,{onClick:()=>a(l),className:(0,Ve.default)("optimise__text-clickable",{warning:l.severity<6,error:l.severity>=6}),children:["Line: ",l.startLineNumber," ",l.startLineNumber!==l.endLineNumber&&" – "+l.endLineNumber]}),description:(0,t.jsx)(o.ui_kit$Text,{children:l.message})})})})})}):(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No problems found."),type:"info"})}));xl.displayName="ProblemsSection";var Ju={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,linkCheckCounter:0,imageCheckCounter:0,spamCheckCounter:0,validateLinksResult:{},validateImagesResult:{}},Qu=(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}},mi={link_check:"link_check_counter",image_check:"image_check_counter",spam_check:"spam_check_counter"},br={link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},Zu=(e,i)=>{const r=Object.values(mi),a=Object.values(br);return r.some(l=>e?.[l]!==void 0)||a.some(l=>i?.[l]!==void 0)||r.some(l=>i?.[l]!==void 0)||a.some(l=>e?.[l]!==void 0)},go=(e,i,r=0)=>{const a=e?.[i];return typeof a=="number"&&!Number.isNaN(a)?a:r},em=(e,i)=>({counter:e,limit:i,disabled:i>0&&e>=i}),tm=({appConfig:e,data:i,isSuccess:r,optimisationCounter:a,linkCheckCounter:l,imageCheckCounter:n,spamCheckCounter:c,setOptimisationCounter:m,setLinkCheckCounter:f,setImageCheckCounter:_,setSpamCheckCounter:k})=>{const b=(0,d.useMemo)(()=>!!(e.limits&&e.counters)&&!0,[e]),h=(0,d.useMemo)(()=>e.counters,[e,i]),y=(0,d.useMemo)(()=>e.limits,[e,i]),x=(0,d.useMemo)(()=>b&&Zu(h,y),[b,h,y]),E=(0,d.useMemo)(()=>go(y,"optimization_limit",0),[y]),w=(0,d.useMemo)(()=>!x&&a>=E&&E>0,[x,a,E]),I=(0,d.useMemo)(()=>{const v={link_check:l,image_check:n,spam_check:c};return Object.keys(br).reduce((P,C)=>{const Y=br[C],W=x?go(y,Y,0):E,F=x?v[C]:a;return P[C]=em(F,W),P},{})},[x,y,E,l,n,c,a]),A=v=>x?I[v].disabled:w;return(0,d.useEffect)(()=>{if(!b){const v=i?.counters;r&&v?.optimization_counter&&m(v.optimization_counter);return}m(go(h,"optimization_counter",0)),x&&(f(go(h,mi.link_check,0)),_(go(h,mi.image_check,0)),k(go(h,mi.spam_check,0)))},[b,x,i,r,h,m,f,_,k]),{limitsInPlugin:b,perTypeAvailable:x,currentBillingOptimisationLimits:E,disableFields:w,typeLimits:I,isTypeDisabled:A}},om=()=>{const e=(0,d.useRef)(null);return{showImgPreviewHandler:(0,d.useCallback)((i,r)=>{e.current&&clearTimeout(e.current);let a=document.querySelector(".img-preview"),l=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(a=document.createElement("div"),a.classList.add("img-preview"),l=document.createElement("div"),l.classList.add("img-preview-content"),a.append(l),document.querySelector(".email-pane__col_settings-inner")?.append(a)),l&&(l.innerHTML=`<table cellspacing="0" cellpadding="0" border="0" width="100%"><img height="auto" width=${(r||0)+"px"} alt="" style="max-width: 100%; object-fit: contain" src=${i}></table>`),a&&a.style.opacity!=="1"&&setTimeout(()=>{a&&(a.style.opacity="1",a.style.transform="translateX(-100%)")},10)},[]),hideBlockPreviewHandler:(0,d.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:im,IMAGES:rm}=s.OPTIMISE_TABS,sm=({activeTab:e,selectedTags:i,validateLinksResult:r,validateImagesResult:a,setValidateLinks:l,setValidateImages:n})=>{(0,d.useEffect)(()=>{e===im&&r.links&&l(i.length>0?r.links.filter(c=>i.includes(c.status)):r.links),e===rm&&a.images&&n(i.length>0?a.images.filter(c=>i.includes(c.status)):a.images)},[r.links,a.images,i,e,l,n])},am=e=>(e.statusCode!==null?e.statusCode<300&&(e.page?.secure??!0):e.type!=="invalid")?s.VALID:(e.statusCode&&e.statusCode<400||e.statusCode===200&&(e.page?.secure??!0))&&e.type!=="invalid"?s.WARNINGS:s.ERRORS,kl=e=>e.statusCode!==null&&e.statusCode<300?s.VALID:e.statusCode<400&&e.statusCode>=300||e.statusCode===200&&!e.valid?s.WARNINGS:s.ERRORS,El=e=>({valid:e.filter(i=>i.status===s.VALID).length,warnings:e.filter(i=>i.status===s.WARNINGS).length,errors:e.filter(i=>i.status===s.ERRORS).length}),{LINKS:fr,IMAGES:gr,SPAM_ASSASSIN:Bl,PROBLEMS:_r}=s.OPTIMISE_TABS,Tl={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},lm={link_check:"LinkCheckCount",image_check:"ImageCheckCount",spam_check:"SpamCheckCount"},nm={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},Sl=(e,i,r,a)=>`${e} ${r("of")} ${i>0?i:"∞"} ${a("test","tests",i>0?i:e)} ${a("was used","were used",e)}`,yl=()=>{const{__:e,_n:i}=s.useI18n(),r=s.useDispatch(),a=s.useOpenPlanCatalog(),l=s.useAppNavigate(),n=s.useNotification(),c=s.useContentReader(),m=s.useAppConfig(),f=s.useEditorProjectId(),_=s.useRouteEmailId(),{email:k}=s.useOpenEmail(),b=_||(k?.id!=null?String(k.id):void 0),h=f||(k?.project!=null?String(k.project):void 0),[y,x]=(0,d.useState)(null),E=(0,d.useRef)(!1),w=(0,d.useRef)({link_check:!1,image_check:!1,spam_check:!1}),I=s.useProjectPlanLimitPreflight(),A=(0,d.useCallback)(O=>{x(O)},[]),v=(0,d.useCallback)((O,xe)=>O?.status===401&&O?.data?.code==="usage_limit_exceeded"?(A({presetId:{link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"}[xe],previousDisplay:e("—"),nextDisplay:s.presetLimitDisplay("infinity")}),r(s.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0):!1,[r,e,A]),P=(0,d.useCallback)((O,xe)=>{v(O,xe)||n.error({error:O})},[v,n]),C=(0,d.useCallback)(async O=>!0,[r,I,A]),Y=s.useMessageService(),W=s.useSelector(s.selectProblemsList),F=s.useEventEmitter(De.events.ON_LIMIT_ID),N=s.usePushToDataLayer(),[T,J]=(0,d.useReducer)(Qu,Ju),[Z,se]=s.useEditSpamMutation(),[te,ne]=s.useEditLinksMutation(),[_e,le]=s.useEditImagesMutation(),{data:fe,isSuccess:Ae}=s.useGetProjectQuery(+(h||0),{skip:!0}),ce=s.useInvalidateProject(),$e=(0,d.useCallback)(O=>J({type:"SET_OPTIMISATION_COUNTER",payload:O}),[]),Ce=(0,d.useCallback)(O=>J({type:"SET_LINK_CHECK_COUNTER",payload:O}),[]),ie=(0,d.useCallback)(O=>J({type:"SET_IMAGE_CHECK_COUNTER",payload:O}),[]),Be=(0,d.useCallback)(O=>J({type:"SET_SPAM_CHECK_COUNTER",payload:O}),[]),ae=(0,d.useCallback)(O=>J({type:"SET_VALIDATE_LINKS",payload:O}),[]),oe=(0,d.useCallback)(O=>J({type:"SET_VALIDATE_IMAGES",payload:O}),[]),me=(0,d.useCallback)(O=>J({type:"SET_SELECTED_TAGS",payload:O}),[]),{limitsInPlugin:de,perTypeAvailable:Q,currentBillingOptimisationLimits:q,disableFields:z,typeLimits:G,isTypeDisabled:re}=tm({appConfig:m,data:fe,isSuccess:Ae,optimisationCounter:T.optimisationCounter,linkCheckCounter:T.linkCheckCounter,imageCheckCounter:T.imageCheckCounter,spamCheckCounter:T.spamCheckCounter,setOptimisationCounter:$e,setLinkCheckCounter:Ce,setImageCheckCounter:ie,setSpamCheckCounter:Be});sm({activeTab:T.activeTab,selectedTags:T.selectedTags,validateLinksResult:T.validateLinksResult,validateImagesResult:T.validateImagesResult,setValidateLinks:ae,setValidateImages:oe});const{showImgPreviewHandler:ke,hideBlockPreviewHandler:he}=om(),Pe=(0,d.useCallback)(O=>O==="link_check"?T.linkCheckCounter:O==="image_check"?T.imageCheckCounter:T.spamCheckCounter,[T.linkCheckCounter,T.imageCheckCounter,T.spamCheckCounter]),ye=(0,d.useCallback)(O=>{if(de){if(Q){J({type:{link_check:"INCREMENT_LINK_CHECK_COUNTER",image_check:"INCREMENT_IMAGE_CHECK_COUNTER",spam_check:"INCREMENT_SPAM_CHECK_COUNTER"}[O]}),F.fire({name:lm[O],count:Pe(O)+1});return}J({type:"INCREMENT_OPTIMISATION_COUNTER"}),F.fire({name:"OptimizationCount",count:T.optimisationCounter+1})}},[de,Q,F,Pe,T.optimisationCounter]),V=(0,d.useCallback)(O=>{if(Q){const{limit:xe}=G[O];A({presetId:nm[O],previousDisplay:xe>0?xe:s.presetLimitDisplay("infinity"),nextDisplay:s.presetLimitDisplay("infinity")});return}A({presetId:"optimization_exceeded",previousDisplay:q,nextDisplay:s.presetLimitDisplay("infinity")})},[Q,G,A,q]),ee=(0,d.useCallback)(()=>{l(m.billingPageUrl||s.APP_ROUTES.billing)},[m.billingPageUrl,l]),we=O=>{if(!de||!Q)return null;const{counter:xe,limit:D,disabled:ue}=G[O];return(0,t.jsx)(o.ui_kit$LimitsCounter,{text:Sl(xe,D,e,i),exceeded:ue,extra:(0,t.jsx)("button",{type:"button",style:Tl,onClick:ee,children:e("Need more?")})})},je=(0,d.useCallback)((O,xe)=>{Y.send({operation:s.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:O,isError:xe}})},[Y]),K=(0,d.useCallback)((O,xe)=>{Y.send({operation:s.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:O,isError:xe}})},[Y]),ve=(0,d.useCallback)(O=>{const xe={startColumn:O.startColumn,startLineNumber:O.startLineNumber,endColumn:O.endColumn,endLineNumber:O.endLineNumber};r(s.setActiveProblemRange(xe))},[r]),Re=(0,d.useCallback)(O=>{J({type:"SET_ACTIVE_TAB",payload:O}),J({type:"RESET_SELECTED_TAGS"}),O===_r&&W?.length>0&&N({event:"check",action:"check_email_code",email_id:b,project_id:h,problems_count:W?.length||0})},[W,N,b,h]),Le=(0,d.useCallback)(async()=>{if(!b){n.error({title:"Save the mail first."});return}if(re("link_check")){V("link_check");return}if(!await C("link_check"))return;ye("link_check");const O=c(),xe=new DOMParser().parseFromString(O,"text/html"),D={},ue={};xe.querySelectorAll("a[href]").forEach((ge,Oe)=>{D[`link_${Oe}`]=ge.getAttribute("href"),ue[`link_${Oe}`]=ge.textContent||""}),Y.send({operation:"sandbox_set_attr_to_links"}),te({entity_id:b,data:D}).then(({data:ge,error:Oe})=>{if(Oe)P(Oe,"link_check");else if(ge?.result){const Ge=[...ge.result];Ge?.sort((R,X)=>R.linkId-X.linkId);const Ye=Ge.map(R=>({...R,text:ue[R.linkId],status:am(R)})),Xe={links:Ye,summary:El(Ye)};J({type:"SET_VALIDATE_LINKS_RESULT",payload:Xe}),n.success(e("Links validation was successfully completed")),ge.limit_warning&&ge.limit_remaining!=null&&n.warning({title:`${e("Approaching usage limit. Remaining")}: ${ge.limit_remaining}`}),N({event:"check",action:"check_email_links",email_id:b,project_id:h,links_count:Xe.links?.length||0})}else ge.statusCode>300||!ge.success?n.error({error:{data:ge}}):n.error({title:e("Something went wrong.")}),!T.validateLinksResult.links&&Re("")}).catch(ge=>{P(ge,"link_check")})},[b,re,V,C,ye,c,Y,te,n,e,N,h,ce,T.validateLinksResult.links,P,Re]),Ue=(0,d.useCallback)(async()=>{if(!b){n.error({title:"Save the mail first."});return}if(re("image_check")){V("image_check");return}if(!await C("image_check"))return;ye("image_check");const O=c(),xe=new DOMParser().parseFromString(O,"text/html"),D={};xe.querySelectorAll("img").forEach((ue,ge)=>D[`image_${ge}`]=ue.src),Y.send({operation:"sandbox_set_attr_to_images"}),_e({entity_id:b,data:D}).then(({data:ue,error:ge})=>{let Oe;if(ge)P(ge,"image_check");else if(ue?.result){const Ge=Object.values(ue.result);Ge.sort((Xe,R)=>Xe.imageId-R.imageId);const Ye=Ge.reduce((Xe,R)=>Xe+Math.round(R.image.bytes/1024),0);Oe={images:Ge.map(Xe=>({...Xe,status:kl(Xe)}))||[],summary:El(Ge.map(Xe=>({...Xe,status:kl(Xe)}))),summaryTime:{value:(Ye>1200?Ye/1e3:Ye).toFixed(1),name:Ye>1200?e("MB"):e("KB")}},Oe&&J({type:"SET_VALIDATE_IMAGES_RESULT",payload:Oe}),n.success(e("Images validation was successfully completed")),ue.limit_warning&&ue.limit_remaining!=null&&n.warning({title:`${e("Approaching usage limit. Remaining")}: ${ue.limit_remaining}`}),N({event:"check",action:"check_email_images",email_id:b,project_id:h,images_count:Oe.images?.length||0})}else ue.statusCode>300||!ue.success?n.error({error:{data:ue}}):n.error({title:e("Something went wrong.")}),!T.validateImagesResult?.images?.length&&Re("")}).catch(ue=>{P(ue,"image_check")})},[b,re,V,C,ye,c,Y,_e,n,e,N,h,ce,T.validateImagesResult,P,Re]),Me=(0,d.useCallback)(async()=>{if(!b){n.error({title:"Save the mail first."});return}if(re("spam_check")){V("spam_check");return}await C("spam_check")&&(ye("spam_check"),Z({entity_id:b,data:{html:c()}}).then(({data:O,error:xe})=>{if(xe)P(xe,"spam_check");else if(O&&O.success){const D=!!O.result.report&&Object.values(O.result.report);D?(D.sort((ue,ge)=>ue.score-ge.score),J({type:"SET_VALIDATE_SPAM_RESULT",payload:{...O.result,report:D}})):O.result&&J({type:"SET_VALIDATE_SPAM_RESULT",payload:{...O.result,report:D}}),n.success(e("Spam validation was successfully completed")),O.limit_warning&&O.limit_remaining!=null&&n.warning({title:`${e("Approaching usage limit. Remaining")}: ${O.limit_remaining}`}),N({event:"check",action:"check_email_spam",email_id:b,project_id:h,spam_score:O.result?.spamScore||0})}else O.statusCode>300||!O.success?n.error({error:{data:O}}):n.error({title:e("Something went wrong.")}),!T.validateSpamResult?.report?.length&&Re("")}).catch(O=>{P(O,"spam_check")}))},[b,re,V,C,ye,c,Z,n,e,N,h,ce,T.validateSpamResult,P,Re]);(0,d.useEffect)(()=>{if(de){if(Q){["link_check","image_check","spam_check"].forEach(O=>{const{limit:xe,counter:D,disabled:ue}=G[O];if(!ue){w.current[O]=!1;return}w.current[O]||xe>0&&D>=xe&&(w.current[O]=!0,V(O))});return}if(!(q>0&&T.optimisationCounter>=q)){E.current=!1;return}E.current||(E.current=!0,V("link_check"))}},[de,Q,G,T.optimisationCounter,q,V]);const He=y?s.getLimitUpgradePresetDefinition(y.presetId):null;return(0,t.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[He&&y?(0,t.jsx)(yt.LimitUpgradeModal,{open:!0,onClose:()=>x(null),title:e(He.titleKey),subtitle:e(He.subtitleKey),usageResource:He.usageResource,previousDisplay:y.previousDisplay,nextDisplay:y.nextDisplay,onChangePlan:()=>{x(null),a()}}):null,de&&!Q&&(0,t.jsx)(o.ui_kit$LimitsCounter,{text:Sl(T.optimisationCounter,q,e,i),exceeded:z,extra:(0,t.jsx)("button",{type:"button",style:Tl,onClick:ee,children:e("Need more?")})}),m.optimizeLinksEnabled&&(0,t.jsxs)(t.Fragment,{children:[we("link_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Links validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:O=>O.preventDefault(),onClick:()=>{Re(fr),!T.validateLinksResult?.links?.length&&T.activeTab!==fr&&Le()},loading:ne.isLoading,disabled:re("link_check")&&!T.validateLinksResult?.links?.length,children:!ne.isLoading&&(T.activeTab===fr?(0,t.jsx)(s.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,t.jsx)(fl,{__:e,activeTab:T.activeTab,validateLinksResult:T.validateLinksResult,validateLinks:T.validateLinks,selectedTags:T.selectedTags,setSelectedTags:me,isLoading:ne.isLoading,disabled:re("link_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:Le,goToLinkHandler:je})]}),m.optimizeImagesEnabled&&(0,t.jsxs)(t.Fragment,{children:[we("image_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Images validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:O=>O.preventDefault(),onClick:()=>{Re(gr),!T.validateImagesResult?.images?.length&&T.activeTab!==gr&&Ue()},loading:le.isLoading,children:!le.isLoading&&(T.activeTab===gr?(0,t.jsx)(s.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,t.jsx)(gl,{__:e,activeTab:T.activeTab,validateImagesResult:T.validateImagesResult,validateImages:T.validateImages,selectedTags:T.selectedTags,setSelectedTags:me,isLoading:le.isLoading,disabled:re("image_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:Ue,goToImageHandler:K,showImgPreviewHandler:ke,hideBlockPreviewHandler:he})]}),m.optimizeSpamAssassinEnabled&&(0,t.jsxs)(t.Fragment,{children:[we("spam_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("SpamAssassin")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:O=>O.preventDefault(),loading:se.isLoading,onClick:()=>{Re(Bl),T.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(T.validateSpamResult,"spamScore")||Me()},disabled:re("spam_check")&&!(T.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(T.validateSpamResult,"spamScore")),children:!se.isLoading&&(T.activeTab===Bl?(0,t.jsx)(s.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,t.jsx)(_l,{__:e,activeTab:T.activeTab,validateSpamResult:T.validateSpamResult,isLoading:se.isLoading,disabled:re("spam_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:Me})]}),m.optimizeCheckCodeEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:O=>O.preventDefault(),onClick:()=>Re(_r),children:T.activeTab===_r?(0,t.jsx)(s.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth})})})]}),(0,t.jsx)(xl,{__:e,activeTab:T.activeTab,problemsList:W,onSetMonacoPosition:ve})]})]})},dm=({state:e,onCancel:i,onRetry:r,onDismiss:a})=>{const{__:l}=s.useI18n();return e.kind==="hidden"?null:(0,t.jsx)("div",{className:"indexing-tray",role:"status","aria-live":"polite",children:(0,t.jsx)(o.ui_kit$Card,{size:"small",variant:"borderless",className:"indexing-tray__card",children:(0,t.jsxs)(o.ui_kit$Flex,{vertical:!0,gap:8,children:[cm(e,l),(0,t.jsx)(o.ui_kit$Flex,{justify:"flex-end",children:um(e,{onCancel:i,onRetry:r,onDismiss:a},l)})]})})})};function cm(e,i){switch(e.kind){case"scanning":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Flex,{align:"center",gap:8,children:[(0,t.jsx)(o.ui_kit$Spin,{size:"small"}),(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Moving files from old storage…")})]}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:i("Found so far: %s").replace("%s",String(e.scanned))}),(0,t.jsx)(o.ui_kit$Progress,{percent:100,status:"active",showInfo:!1,strokeColor:s.emCssVar("colorPrimary")})]});case"indexing":{const r=e.total>0?Math.min(100,Math.round(e.scanned/e.total*100)):0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Indexing files…")}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:`${e.scanned} / ${e.total}`}),(0,t.jsx)(o.ui_kit$Progress,{percent:r,status:"active",strokeColor:s.emCssVar("colorPrimary")})]})}case"done":return(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Could not move files from old storage")});case"cancelled":return(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Move stopped")});default:return null}}function um(e,i,r){switch(e.kind){case"scanning":case"indexing":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onCancel,disabled:e.cancelling,children:e.cancelling?r("Stopping…"):r("Cancel")});case"failed":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:r("Retry")});case"cancelled":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:r("Resume")});case"done":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onDismiss,children:r("Close")});default:return null}}var mm=2500,Rl=48,pm=4e3;function hm(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 bm(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function fm({projectId:e,api:i,triggered:r,onCompleted:a}){const[l,n]=(0,d.useState)({kind:"hidden"}),c=(0,d.useRef)(!1),m=(0,d.useRef)(!0),f=(0,d.useRef)(e);f.current=e;const _=(0,d.useRef)(r);_.current=r;const k=(0,d.useRef)(a);k.current=a,(0,d.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]),(0,d.useEffect)(()=>{n({kind:"hidden"})},[e]);const b=(0,d.useCallback)(async()=>{try{const y=await i.files.backfillList({project_id:e});return!y.ok||y.error?null:hm(y.data)}catch{return null}},[i,e]),h=(0,d.useCallback)(async()=>{if(c.current)return;c.current=!0;const y=f.current;let x=0;try{for(;m.current&&f.current===y&&_.current;){const E=await b();if(!m.current)break;if(E)if(E.kind==="hidden"){if(x+=1,x>=Rl){n({kind:"failed"});break}}else{if(x=0,n(E),E.kind==="done")try{await k.current?.()}catch{}if(bm(E))break}else if(x+=1,x>=Rl){n({kind:"failed"});break}await new Promise(w=>setTimeout(w,mm))}}finally{c.current=!1}},[b]);return(0,d.useEffect)(()=>{r&&h()},[r,h]),(0,d.useEffect)(()=>{if(l.kind!=="done")return;const y=setTimeout(()=>{m.current&&n({kind:"hidden"})},pm);return()=>clearTimeout(y)},[l.kind]),{state:l,cancel:(0,d.useCallback)(()=>{n(y=>y.kind==="scanning"||y.kind==="indexing"?{...y,cancelling:!0}:y),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,d.useCallback)(()=>{_.current=!0,i.files.backfillCreate({project_id:e}),h()},[i,e,h]),dismiss:(0,d.useCallback)(()=>n({kind:"hidden"}),[])}}var gm=s.lazyRoute(()=>(0,Do.__vitePreload)(()=>Promise.resolve().then(()=>bt("./ea93d0cd.js")),void 0,{}.url)),_m=s.lazyRoute(()=>(0,Do.__vitePreload)(()=>Promise.resolve().then(()=>bt("./77d63e01.js")),void 0,{}.url)),wl={height:"100%"};function xm(e){(e?(0,Do.__vitePreload)(()=>Promise.resolve().then(()=>bt("./fdfb1e94.js")),void 0,{}.url):(0,Do.__vitePreload)(()=>Promise.resolve().then(()=>bt("./78b1e678.js")),void 0,{}.url)).catch(()=>{})}var km=({storageProvider:e,dataProvider:i,pathProxy:r,usesBuiltInStorage:a,contentKey:l})=>{const n=s.useAppConfig(),c=s.isImageEditModal(s.useSelector(s.selectActiveModal$1)),m=!!n.imageCenterFileManagerView;(0,d.useEffect)(()=>{c&&xm(m)},[c,m]);let f=(0,t.jsx)(o.ui_kit$PageLoader,{style:wl});return e&&i&&n.imageCenterFileManagerView?f=(0,t.jsx)(gm,{storageProvider:e,dataProvider:i,pathProxy:r},l):e&&i&&(f=(0,t.jsx)(_m,{dataProvider:i,usesBuiltInStorage:a},l)),(0,t.jsx)(d.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{style:wl}),children:f})},Em=class{http;constructor(e){this.http=e}cache_clear_create=(e,i={})=>this.http.request({path:"/em-files/v1/cache/clear",method:"POST",body:e,type:De.ContentType.UrlEncoded,...i})},Bm=class{http;constructor(e){this.http=e}empty_trash_create=(e,i={})=>this.http.request({path:"/em-files/v1/empty-trash",method:"POST",body:e,type:De.ContentType.UrlEncoded,...i})},Tm=class{http;constructor(e){this.http=e}files_list=(e,i={})=>this.http.request({path:"/em-files/v1/files",method:"GET",query:e,format:"json",...i});files_create=(e,i={})=>this.http.request({path:"/em-files/v1/files",method:"POST",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});files_delete=(e,i={})=>this.http.request({path:"/em-files/v1/files",method:"DELETE",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});files_partial_update=(e,i={})=>this.http.request({path:"/em-files/v1/files",method:"PATCH",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});files_upload_by_url_create=(e,i={})=>this.http.request({path:"/em-files/v1/files/upload-by-url",method:"POST",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});files_rename_partial_update=(e,i={})=>this.http.request({path:"/em-files/v1/files/rename",method:"PATCH",body:e,type:De.ContentType.UrlEncoded,format:"json",...i})},Sm=class{http;constructor(e){this.http=e}folders_list=(e,i={})=>this.http.request({path:"/em-files/v1/folders",method:"GET",query:e,format:"json",...i});folders_create=(e,i={})=>this.http.request({path:"/em-files/v1/folders",method:"POST",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});folders_delete=(e,i={})=>this.http.request({path:"/em-files/v1/folders",method:"DELETE",body:e,type:De.ContentType.UrlEncoded,format:"json",...i})},ym=class{http;constructor(e){this.http=e}items_move_partial_update=(e,i={})=>this.http.request({path:"/em-files/v1/items/move",method:"PATCH",body:e,type:De.ContentType.UrlEncoded,format:"json",...i})},Rm=[Em,Bm,Tm,Sm,ym];function wm(){const e=s.useAppConfig(),i=s.useIsStandalone(),r=s.useStorageProvider(),a=s.useProjectData(),l=s.useRestClient(Rm),n=s.useStore(),c=(0,d.useMemo)(()=>s.createRestClientV2(n),[n]),m=s.useI18n(),f=s.useCurrentUser(),_=a?.id?String(a.id):"",k=f?.id!=="0"?String(f.id):"",b=s.isFileManagerV2Enabled(e),[h,y]=(0,d.useState)(null),x=b&&!!_&&h===_,[E,w]=(0,d.useState)(0),[I,A]=(0,d.useState)(0),v=(0,d.useRef)(_);(0,d.useEffect)(()=>{v.current!==_&&(v.current=_,y(null))},[_]);const P=(0,d.useCallback)(F=>{F&&_&&y(_)},[_]),C=(0,d.useMemo)(()=>Vr({storageProvider:r,projectId:_,restApi:l,restApiV2:c,i18n:m,pathPostfix:k,appConfig:e,isStandalone:i,onIndexingStateChange:P}),[e,P,m,i,_,E,l,c,r,k]),Y=(0,d.useCallback)(async()=>{try{typeof C.dataProvider?.clearCache=="function"&&await C.dataProvider.clearCache()}catch{}y(null),w(F=>F+1),A(F=>F+1)},[C.dataProvider]),W=(0,d.useCallback)(()=>{_&&y(_)},[_]);return{...C,projectId:_,restApiV2:c,v2Enabled:b,backfillTriggered:x,contentKey:`${_}:${I}`,handleIndexingCompleted:Y,markIndexingStarted:W}}var jm={height:"100%"},jl=()=>{const{storageProvider:e,dataProvider:i,pathProxy:r,usesBuiltInStorage:a,projectId:l,restApiV2:n,v2Enabled:c,backfillTriggered:m,contentKey:f,handleIndexingCompleted:_,markIndexingStarted:k}=wm(),b=s.useSelector(s.selectActiveModal$1),h=s.isImageCenterModal(b),{state:y,cancel:x,retry:E,dismiss:w}=fm({projectId:l,api:n,triggered:m,onCompleted:_}),I=d.default.useCallback(()=>{k(),E()},[k,E]);return(0,t.jsxs)(t.Fragment,{children:[h&&(0,t.jsx)(d.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{style:jm}),children:(0,t.jsx)(km,{storageProvider:e,dataProvider:i,pathProxy:r,usesBuiltInStorage:a,contentKey:f})}),c&&(0,t.jsx)(dm,{state:y,onCancel:x,onRetry:I,onDismiss:w})]})},vm=(function(){var e=window.__useblocks__;if(e&&e.assetUrl)return e.assetUrl("static/media/icon-menu-block-welcome.png");if(e&&e.publicPath)try{return new URL("static/media/static/media/icon-menu-block-welcome.png",e.publicPath).href}catch{}try{return new URL("/static/media/static/media/icon-menu-block-welcome.png",typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"").href}catch{return"/static/media/static/media/icon-menu-block-welcome.png"}})();function Im(e){return!!(e?.global_block??e?.acf?.global_block)}var Cm=({className:e,size:i=16})=>{const r=s.useAppConfig(),{__:a}=s.useI18n(),l=a("Global block");return(0,t.jsx)(o.ui_kit$Tooltip,{title:l,placement:"top",trigger:["hover"],children:(0,t.jsx)("span",{className:(0,Ve.default)("block-global-badge",e),"aria-label":l,role:"img",children:(0,t.jsx)(s.EmIcons,{icon:"Globe02Icon",component:o.icons$Globe02Icon,size:i,strokeWidth:r.iconStrokeWidth})})})},vl=new Map;function Il(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function xr(e,i){const r=i??"";if(e===void 0)return s.sanitizeHtml(Il(r));const a=String(e),l=vl.get(a);if(l&&l.source===r)return l.markup;const n=s.sanitizeHtml(Il(r));return vl.set(a,{source:r,markup:n}),n}var{name:kr,type:Cl,tags:Pl}={name:"name",type:"type",tags:"tags"},Al={[kr]:"",[Cl]:[],[Pl]:[]},_o={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},Er=({parentEmailId:e,blocksTab:i,search:r,reloadBlockScreens:a,setIsShowAddAllBlocksModal:l})=>{const n=s.parentEmailSource(e),c=s.useEditorProjectId(),m=St.useSetHtmlElementInIframeHandler(),f=St.useDragStartBlockToIframeHandler(),[_]=o.ui_kit$Form.useForm(),{data:k}=s.useGetBlocksSchemaQuery(),{token:b}=(0,o.ui_kit$useToken)(),{__:h,_x:y}=s.useI18n(),x=s.useNotification(),{modal:E}=o.ui_kit$App.useApp(),{confirm:w}=E;s.useRoutePathname();const I=s.useSelector(s.selectParentBlocks),A=Ca(),v=(0,d.useRef)(null),P=(0,d.useRef)(null),C=s.useRootElement(),Y=640,W=207/Y,F=B=>Im(B)?(0,t.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,t.jsx)(Cm,{className:"block-global-badge--tile",size:14})}):null,N=s.useEmailAttribute("common_styles"),T=(0,d.useMemo)(()=>Aa(N,A),[N,A]),J=(0,d.useRef)(null),Z=(0,d.useRef)(null),se=(0,d.useRef)(null),te=s.useStore();(0,d.useEffect)(()=>{P.current?.scrollTo({top:0})},[i,r]);const ne=s.useProjectData(),{data:_e}=s.useGetTermsQuery({project:ne,kind:s.BLOCK_TAGS},{skip:!ne?.id}),[le,fe]=(0,d.useState)(()=>s.projectBlocksArgs(c));(0,d.useEffect)(()=>{r||(_.setFieldsValue(Al),O({type:null,name:null}),a())},[r,_,a]),(0,d.useEffect)(()=>{if(k){const B=k.schema.properties.acf.properties.type.items.enum;let S=[];for(let p in B)S.push({label:h(s.TYPES_TRANSLATE[B[p]]),value:B[p]})}},[k,h]);const{isSuccess:Ae,isError:ce,isLoading:$e,isFetching:Ce,data:ie,refetch:Be,error:ae}=s.useGetBlocksQuery({...le,page:1}),oe=(0,d.useMemo)(()=>{if(Ae&&ie)return[...ie].sort((B,S)=>_o[B.type]-_o[S.type])},[Ae,ie]),[me,de]=(0,d.useState)([]);s.usePrevious(B=>{B!==ce&&x.fromError("BLOCK_GET_ERROR",{},ae,!0)},[ce,ae,x]);const[Q,q]=(0,d.useState)(()=>s.parentEmailBlocksArgs(n)),{isSuccess:z,isError:G,isLoading:re,isFetching:ke}=s.useGetParentEmailBlocksQuery({...Q,emailId:n,page:1},{skip:!n||I.length}),he=(0,d.useMemo)(()=>{if(z||I.length)return[...I].sort((B,S)=>_o[B.type]-_o[S.type])},[z,I]),[Pe,ye]=(0,d.useState)([]);(0,d.useEffect)(()=>{const B=new Set;if(I.length&&he){for(const S of he)S.type&&B.add(S.type);ye(Array.from(B))}else ye([])},[I,he]);const[V,ee]=(0,d.useState)(s.templateBlocksArgs),{isSuccess:we,isError:je,isLoading:K,isFetching:ve,data:Re=[]}=s.useGetTemplateBlocksQuery({...V,page:1}),Le=(0,d.useMemo)(()=>{if(Re.length)return[...Re].sort((B,S)=>_o[B.type]-_o[S.type])},[Re]),[Ue,Me]=(0,d.useState)([]);(0,d.useEffect)(()=>{const B=new Set;if(Le&&Re.length){for(const S of Le)S.type&&B.add(S.type);Me(Array.from(B))}},[Re.length,Le]);const He=(0,d.useMemo)(()=>{const B=new Set;for(const S of me)B.add(S);for(const S of Pe)B.add(S);for(const S of Ue)B.add(S);return Array.from(B)},[Ue,Pe,me]),O=B=>{fe(S=>({...S,...B,page:1})),q(S=>({...S,...B,page:1})),ee(S=>({...S,...B,page:1}))},xe=s.useFitBlockPreviewHeight(W),D=(0,d.useCallback)(()=>{C.querySelector(".blocks-search__result-wrapper.is_search")&&(C.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),C.querySelector(".blocks-search__result-wrapper").style.opacity=0,s.measureBlockPreviews(C,207/Y),C.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",C.querySelectorAll(".blocks-search__result-wrapper").forEach(B=>B.style.opacity=1))},[Y,C]);(0,d.useEffect)(()=>{!(ve||K)&&we&&i!=="template"&&(r?D():a())},[ve,K,we,D,le.name,a,r,i]),(0,d.useEffect)(()=>{const B=new Set;if(Ae&&oe){for(const S of oe)S.type&&B.add(S.type);de(Array.from(B))}},[Ae,oe]);const ue=B=>{const S=Object.keys(B)[0],p=_.getFieldsValue(!0);switch(S){case Pl:const $=(_e||[]).filter(U=>B[S].includes(U.name)).map(U=>U.id)||null;O({tags:$});break;case Cl:O({type:p.type||null});break;case kr:v.current&&window.clearTimeout(v.current),v.current=window.setTimeout(function(){O({name:p.name||null})},300)}},ge=B=>{a(),B.target.getAttribute("data-type")?(B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(S=>S.style.display="none"),B.target.closest(".blocks-search").querySelectorAll(`[data-type="${B.target.getAttribute("data-type")}"]`).forEach(S=>S.style.display="block")):B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(S=>S.style.display="block"),B.target.parentElement.querySelector(".active").classList.remove("active"),B.target.classList.add("active")};let Oe=null;const Ge=B=>{clearTimeout(Oe);let S=C.querySelector(".block-search__preview")?C.querySelector(".block-search__preview"):null,p=C.querySelector(".block-search__preview-title")?C.querySelector(".block-search__preview-title"):null,$=C.querySelector(".block-search__preview-content")?C.querySelector(".block-search__preview-content"):null;C.querySelector(".block-search__preview")||(S=document.createElement("div"),S.classList.add("block-search__preview"),p=document.createElement("div"),p.classList.add("block-search__preview-title"),$=document.createElement("div"),$.classList.add("block-search__preview-content"),S.append($),S.append(p),C.querySelector(".email-pane__col_settings-inner").append(S)),p.innerHTML="",$.innerHTML="",p.innerHTML=B.title;let U=B.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();$.innerHTML=s.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+U+"</table>"),S.style.opacity!=="1"&&setTimeout(function(){S.style.opacity="1",S.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},Ye=()=>{let B=C.querySelector(".block-search__preview");B&&(Oe=setTimeout(()=>{B.style.opacity="0",B.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){B.remove()},300)},300))};(0,d.useEffect)(()=>{C.querySelectorAll(".blocks-search__result").forEach(B=>{B.style.display="block"})},[i]);const Xe=!ie?.length&&(!n||!I?.length)&&!Re?.length&&(le.tags||le.name||le.type)&&!($e||Ce),R=B=>te.dispatch(s.blocksApi.endpoints.deleteBlock.initiate(B.id)).then(S=>{S.error&&x.fromError("BLOCK_REMOVING_ERROR",s.getBlockDesc(B),S.error),x.success({id:"BLOCK_REMOVING_SUCCESS",data:s.getBlockDesc(B),title:h('The block "')+S.data.title+y('" was successfully removed.',"block")}),Be()});(0,d.useEffect)(()=>{!$e&&!Ce&&a()},[$e,Ce,a]),(0,d.useEffect)(()=>{(i==="common"||r)&&setTimeout(a,50)},[ie,a,i,r]);const X=B=>{w({mask:{closable:!0},centered:!0,title:y("Are you sure you want to delete the “","block")+B.title+h("” block?"),icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:22,style:{color:o.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:h("Yes"),cancelText:h("No"),onOk:()=>R(B)})},j=B=>[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:b.colorError},onClick:()=>X(B)}],M=B=>{let S=B.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(S.replaceChildren(...s.parseFromString(B.html)),Object.keys(T).length!==0&&(S.querySelectorAll(".em-contrast-card").forEach(p=>{T.cards?.contrastBackgroundColor&&(p.getAttribute("bgcolor")?T.cards.contrastBackgroundColor?p.setAttribute("bgcolor",T.cards.contrastBackgroundColor):p.removeAttribute("bgcolor"):T.cards.contrastBackgroundColor?p.style.backgroundColor=T.cards.contrastBackgroundColor:p.style.removeProperty("background-color")),T.cards?.contrastTextColor&&p.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach($=>{if(Fe($.style.color).toLowerCase()!=="#ffffff"){let U=$.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.cards.contrastTextColor};`);$.setAttribute("style",U)}})}),S.querySelectorAll(".em-card").forEach(p=>{T.cards?.baseBackgroundColor&&(p.getAttribute("bgcolor")?T.cards.baseBackgroundColor?p.setAttribute("bgcolor",T.cards.baseBackgroundColor):p.removeAttribute("bgcolor"):T.cards.baseBackgroundColor?p.style.backgroundColor=T.cards.baseBackgroundColor:p.style.removeProperty("background-color")),T.cards?.baseTextColor&&p.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach($=>{if(Fe($.style.color).toLowerCase()!=="#ffffff"){let U=$.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.cards.baseTextColor};`);$.setAttribute("style",U)}})}),S.querySelectorAll(".em-card, .em-contrast-card").forEach(p=>{T.cards?.border&&qe({settings:{border:T.cards?.border},elem:p}),T.cards?.borderRadius?.all?(p.style.borderBottomLeftRadius&&p.style.borderBottomLeftRadius!=="0px"&&(p.style.borderBottomLeftRadius=T.cards?.borderRadius.all+"px"),p.style.borderBottomRightRadius&&p.style.borderBottomRightRadius!=="0px"&&(p.style.borderBottomRightRadius=T.cards?.borderRadius.all+"px"),p.style.borderTopLeftRadius&&p.style.borderTopLeftRadius!=="0px"&&(p.style.borderTopLeftRadius=T.cards?.borderRadius.all+"px"),p.style.borderTopRightRadius&&p.style.borderTopRightRadius!=="0px"&&(p.style.borderTopRightRadius=T.cards?.borderRadius.all+"px")):T.cards?.borderRadius?.all===""?p.style.removeProperty("border-radius"):(T.cards?.borderRadius?.topLeft&&p.style.borderTopLeftRadius&&p.style.borderTopLeftRadius!=="0px"?p.style.borderTopLeftRadius=T.cards?.borderRadius.topLeft+"px":T.cards?.borderRadius?.topLeft===""&&p.style.removeProperty("border-top-left-radius"),T.cards?.borderRadius?.topRight&&p.style.borderTopRightRadius&&p.style.borderTopRightRadius!=="0px"?p.style.borderTopRightRadius=T.cards?.borderRadius.topRight+"px":T.cards?.borderRadius?.topRight===""&&p.style.removeProperty("border-top-right-radius"),T.cards?.borderRadius?.bottomRight&&p.style.borderBottomRightRadius&&p.style.borderBottomRightRadius!=="0px"?p.style.borderBottomRightRadius=T.cards?.borderRadius.bottomRight+"px":T.cards?.borderRadius?.bottomRight===""&&p.style.removeProperty("border-bottom-right-radius"),T.cards?.borderRadius?.bottomLeft&&p.style.borderBottomLeftRadius&&p.style.borderBottomLeftRadius!=="0px"?p.style.borderBottomLeftRadius=T.cards?.borderRadius.bottomLeft+"px":T.cards?.borderRadius?.bottomLeft===""&&p.style.removeProperty("border-bottom-left-radius"))}),S.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(p=>{if(!p.style.display&&parseFloat(p.style.fontSize)<=20){let $="",U=T.text.fontFamily;if(parseFloat(p.style.fontSize)>14&&($=p.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${T.text.lineHeight}px`),p.setAttribute("style",$)),!p.closest(".em-contrast-card, .em-card")&&Fe(p.style.color).toLowerCase()!=="#ffffff"&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.color};`),p.setAttribute("style",$)),p.closest(".em-contrast-block")&&!p.closest(".em-contrast-card, .em-card")&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.contrastColor};`),p.setAttribute("style",$)),U[0]==="Safe Fonts"?(p.style.fontFamily=U[1],Ee({elem:S})):U[0]==="Google Fonts"&&(U[1]==="Sans Serif"?p.style.fontFamily="Helvetica, Arial, sans-serif":U[1]==="Serif"&&(p.style.fontFamily='"Times New Roman", Times, serif'),p.classList.remove(...[...p.classList].filter(Se=>Se.startsWith("em-font"))),p.classList.add(`em-font-${U[2].replace(/\s/g,"")}-${U[3].replace(/\s/g,"")}`),tt({elem:S,fontFamilyArray:U})),p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingBottom)p.closest('[em="atom"] > tr > td').style.paddingBottom=T.text.paddingBottom+"px";else if(p.nextElementSibling||p.closest("table")&&p.closest("table").nextElementSibling){let Se=p.nextElementSibling??p.closest("table").nextElementSibling;Se&&Se.tagName==="TABLE"&&(Se.classList.contains("em-vindent-table")||Se.querySelector("td").innerHTML==="")&&Se.querySelector("td").setAttribute("height",T.text.paddingBottom)}}else if(!p.style.display&&parseFloat(p.style.fontSize)>=20&&Fe(p.style.color).toLowerCase()!=="#eb3737"){let $="",U=T.headings.fontFamily;parseFloat(p.style.fontSize)<40&&($=p.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${T.headings.lineHeight}px`),p.setAttribute("style",$)),!p.closest(".em-contrast-card, .em-card")&&Fe(p.style.color).toLowerCase()!=="#ffffff"&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.headings.color};`),p.setAttribute("style",$)),p.closest(".em-contrast-block")&&!p.closest(".em-contrast-card, .em-card")&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.headings.contrastColor};`),p.setAttribute("style",$)),U[0]==="Safe Fonts"?(p.style.fontFamily=U[1],Ee({elem:S})):U[0]==="Google Fonts"&&(U[1]==="Sans Serif"?p.style.fontFamily="Helvetica, Arial, sans-serif":U[1]==="Serif"&&(p.style.fontFamily='"Times New Roman", Times, serif'),p.classList.remove(...[...p.classList].filter(pe=>pe.startsWith("em-font"))),p.classList.add(`em-font-${U[2].replace(/\s/g,"")}-${U[3].replace(/\s/g,"")}`),tt({elem:S,fontFamilyArray:U}));let Se="";if(T.headings.letterSpacing>0?Se=p.style.letterSpacing?p.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${T.headings.letterSpacing}px`):p.getAttribute("style")+` letter-spacing: ${T.headings.letterSpacing}px;`:Se=p.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),p.setAttribute("style",Se),T.headings.bold?p.querySelector("b")?p.querySelector("b").replaceWith(...p.querySelector("b").childNodes):p.querySelector("strong")||(p.innerHTML="<strong>"+p.innerHTML+"</strong>"):p.querySelector("strong")?p.querySelector("strong").replaceWith(...p.querySelector("strong").childNodes):p.querySelector("b")&&p.querySelector("b").replaceWith(...p.querySelector("b").childNodes),p.style.fontWeight){let pe=p.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");p.setAttribute("style",pe)}if(T.headings.italic?p.querySelector("i")?p.querySelector("i").replaceWith(...p.querySelector("i").childNodes):p.querySelector("em")||(p.innerHTML="<em>"+p.innerHTML+"</em>"):p.querySelector("em")?p.querySelector("em").replaceWith(...p.querySelector("em").childNodes):p.querySelector("i")&&p.querySelector("i").replaceWith(...p.querySelector("i").childNodes),p.style.fontStyle){let pe=p.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");p.setAttribute("style",pe)}if(p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingTop)p.closest('[em="atom"] > tr > td').style.paddingTop=T.headings.paddingTop+"px";else if(p.previousElementSibling){let pe=p.previousElementSibling;pe&&pe.tagName==="TABLE"&&(pe.classList.contains("em-vindent-table")||pe.querySelector("td").innerHTML==="")&&pe.querySelector("td").setAttribute("height",T.headings.paddingTop)}if(p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingBottom)p.closest('[em="atom"] > tr > td').style.paddingBottom=T.headings.paddingBottom+"px";else if(p.nextElementSibling){let pe=p.nextElementSibling;pe&&pe.tagName==="TABLE"&&(pe.classList.contains("em-vindent-table")||pe.querySelector("td").innerHTML==="")&&pe.querySelector("td").setAttribute("height",T.headings.paddingBottom)}}}),S.querySelectorAll('a[style*="color"]').forEach(p=>{if(p.style.display){if(p.style.display&&p.style.display==="block"){let $="";if($=p.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.buttons.fontSize}px`),p.setAttribute("style",$),p.closest("td").style.backgroundColor&&!p.closest("td").style.borderWidth&&!p.closest(".em-contrast-card"))if(p.closest(".em-contrast-block")?$=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastColor};`):$=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.color};`),p.setAttribute("style",$),p.closest(".em-contrast-block"))if(T.buttons.contrastBackgroundColor){let pe=p.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${T.buttons.contrastBackgroundColor};`);p.closest("td").setAttribute("style",pe)}else p.closest("td").style.removeProperty("background-color");else if(T.buttons.backgroundColor){let pe=p.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${T.buttons.backgroundColor};`);p.closest("td").setAttribute("style",pe)}else p.closest("td").style.removeProperty("background-color");else if(p.closest("td").style.borderWidth)if(Object.values(T.buttons.border).every(pe=>pe===null)){if(p.closest(".em-contrast-block")){if(T.buttons.contrastBackgroundColor){let pe=p.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ze=>ze.replace(/#[A-Fa-f0-9]{6}/,`${T.buttons.contrastBackgroundColor}`));p.closest("td").setAttribute("style",pe),$=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastBackgroundColor};`),p.setAttribute("style",$)}}else if(T.buttons.backgroundColor){let pe=p.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ze=>ze.replace(/#[A-Fa-f0-9]{6}/,`${T.buttons.backgroundColor}`));p.closest("td").setAttribute("style",pe),$=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.backgroundColor};`),p.setAttribute("style",$)}}else for(const pe in T.buttons.border)T.buttons.border[pe]&&T.buttons.border[pe].color!==void 0&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.border[pe].color};`),p.setAttribute("style",$));else p.closest(".em-contrast-block")?T.buttons.contrastBackgroundColor&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastBackgroundColor};`),p.setAttribute("style",$)):T.buttons.backgroundColor&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.backgroundColor};`),p.setAttribute("style",$));let U=T.buttons.fontFamily;U[0]==="Safe Fonts"?(p.style.fontFamily=U[1],Ee({elem:S})):U[0]==="Google Fonts"&&(U[1]==="Sans Serif"?p.style.fontFamily="Helvetica, Arial, sans-serif":U[1]==="Serif"&&(p.style.fontFamily='"Times New Roman", Times, serif'),p.classList.remove(...[...p.classList].filter(pe=>pe.startsWith("em-font"))),p.classList.add(`em-font-${U[2].replace(/\s/g,"")}-${U[3].replace(/\s/g,"")}`),tt({elem:S,fontFamilyArray:U})),p.closest("td").setAttribute("align",T.buttons.textAlign);let Se="";if(T.buttons.letterSpacing>0?Se=p.style.letterSpacing?p.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${T.buttons.letterSpacing}px`):p.getAttribute("style")+` letter-spacing: ${T.buttons.letterSpacing}px;`:Se=p.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),p.setAttribute("style",Se),T.buttons.bold?p.querySelector("b")?p.querySelector("b").replaceWith(...p.querySelector("b").childNodes):p.querySelector("strong")||(p.innerHTML="<strong>"+p.innerHTML+"</strong>"):p.querySelector("strong")?p.querySelector("strong").replaceWith(...p.querySelector("strong").childNodes):p.querySelector("b")&&p.querySelector("b").replaceWith(...p.querySelector("b").childNodes),p.style.fontWeight){let pe=p.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");p.setAttribute("style",pe)}if(T.buttons.italic?p.querySelector("i")?p.querySelector("i").replaceWith(...p.querySelector("i").childNodes):p.querySelector("em")||(p.innerHTML="<em>"+p.innerHTML+"</em>"):p.querySelector("em")?p.querySelector("em").replaceWith(...p.querySelector("em").childNodes):p.querySelector("i")&&p.querySelector("i").replaceWith(...p.querySelector("i").childNodes),p.style.fontStyle){let pe=p.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");p.setAttribute("style",pe)}if(p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingTop)p.closest('[em="atom"] > tr > td').style.paddingTop=T.buttons.marginTop+"px";else if(p.closest("table").previousElementSibling){let pe=p.closest("table").previousElementSibling;pe&&pe.tagName==="TABLE"&&(pe.classList.contains("em-vindent-table")||pe.querySelector("td").innerHTML==="")&&pe.querySelector("td").setAttribute("height",T.buttons.marginTop)}if(p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingBottom)p.closest('[em="atom"] > tr > td').style.paddingBottom=T.buttons.marginBottom+"px";else if(p.closest("table").previousElementSibling){let pe=p.closest("table").nextElementSibling;pe&&pe.tagName==="TABLE"&&(pe.classList.contains("em-vindent-table")||pe.querySelector("td").innerHTML==="")&&pe.querySelector("td").setAttribute("height",T.buttons.marginBottom)}T.buttons.padding.all&&(p.style.padding=T.buttons.padding.all+"px"),T.buttons.padding.top&&(p.style.paddingTop=T.buttons.padding.top+"px"),T.buttons.padding.right&&(p.style.paddingRight=T.buttons.padding.right+"px"),T.buttons.padding.bottom&&(p.style.paddingBottom=T.buttons.padding.bottom+"px"),T.buttons.padding.left&&(p.style.paddingLeft=T.buttons.padding.left+"px"),qe({settings:{border:T.buttons.border},elem:p.closest("td")}),ct({settings:{borderRadius:T.buttons.borderRadius},elem:p.closest("td")})}}else{let $=T.text.fontFamily;if(Fe(p.style.color).toLowerCase()==="#1c52dc"){let Se=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.links.color};`);p.setAttribute("style",Se)}else{let Se=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.color};`);p.setAttribute("style",Se)}if(p.closest(".em-contrast-block")){let Se=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.links.contrastColor};`);p.setAttribute("style",Se)}let U="";T.links.underline?U=p.style.textDecoration?p.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):p.getAttribute("style")+" text-decoration: underline;":U=p.style.textDecoration?p.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):p.getAttribute("style")+" text-decoration: none;",p.setAttribute("style",U),$[0]==="Safe Fonts"?(p.style.fontFamily=$[1],Ee({elem:S})):$[0]==="Google Fonts"&&($[1]==="Sans Serif"?p.style.fontFamily="Helvetica, Arial, sans-serif":$[1]==="Serif"&&(p.style.fontFamily='"Times New Roman", Times, serif'),p.classList.remove(...[...p.classList].filter(Se=>Se.startsWith("em-font"))),p.classList.add(`em-font-${$[2].replace(/\s/g,"")}-${$[3].replace(/\s/g,"")}`),tt({elem:S,fontFamilyArray:$}))}}),S.querySelector('[em="block"]'))){const p=S.querySelectorAll('[em="block"]');T.block?.backgroundColor&&p.forEach($=>{$.querySelectorAll(":scope > td").forEach(U=>{U.setAttribute("bgcolor",T.block.backgroundColor)})}),T.block?.padding&&p.forEach($=>{$.querySelectorAll(":scope > td").forEach(U=>{U.style.paddingTop=T.block.padding.top+"px",U.style.paddingRight=T.block.padding.right+"px",U.style.paddingBottom=T.block.padding.bottom+"px",U.style.paddingLeft=T.block.padding.left+"px"})})}return S.tagName==="DIV"?s.getElementInnerHTML(S):s.getElementInnerHTML(S.querySelector("tbody"))},Ee=B=>{B.elem.querySelectorAll("link[em-class]").forEach(S=>{B.elem.querySelector("."+S.getAttribute("em-class"))||S.remove()})};function Fe(B){if(B&&B.charAt(0)==="r"){if(B.charAt(3)==="a")return B=B.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),B&&B.length===4?"#"+("0"+parseInt(B[1],10).toString(16)).slice(-2)+("0"+parseInt(B[2],10).toString(16)).slice(-2)+("0"+parseInt(B[3],10).toString(16)).slice(-2):"";{B=B.replace("rgb(","").replace(")","").split(",");let S=parseInt(B[0],10).toString(16),p=parseInt(B[1],10).toString(16),$=parseInt(B[2],10).toString(16);return S=S.length===1?"0"+S:S,p=p.length===1?"0"+p:p,$=$.length===1?"0"+$:$,"#"+S+p+$}}else if(B&&B.charAt(0)==="#")return B}const tt=B=>{const S=B.elem.querySelectorAll("link"),p=`em-font-${B.fontFamilyArray[2].replace(/\s/g,"")}-${B.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(S)?.find(U=>U.getAttribute("em-class")===p)){let U=document.createElement("link");U.setAttribute("rel","stylesheet"),U.setAttribute("href",`https://fonts.googleapis.com/css2?family=${B.fontFamilyArray[2]}:ital,wght@${Ze[B.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${Ze[B.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),U.setAttribute("em-class",p),B.elem.insertAdjacentElement("afterbegin",U)}Bt({elem:B.elem});let $=`font-family: '${B.fontFamilyArray[2]}', ${ut[B.fontFamilyArray[1]]}!important;`;$+=` font-weight: ${Ze[B.fontFamilyArray[3]].replaceAll("i","")}!important;`,Ze[B.fontFamilyArray[3]].indexOf("i")>-1&&($+=" font-style: italic!important;"),B.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
24
+ `:""}${a.documentElement.outerHTML}`}}catch{}return i}var Wu=e=>{const{__:i}=s.useI18n();return[{key:"📧",label:(0,t.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["📧 ",i("Subject line & preheader generator")]})},{key:"🌎",label:(0,t.jsxs)("div",{onClick:()=>{e("translator")},children:["🌎 ",i("Translator")]})},{key:"📄",label:(0,t.jsxs)("div",{onClick:()=>{e("writer")},children:["📄 ",i("Copywriter")]})},{key:"🔎",label:(0,t.jsxs)("div",{onClick:()=>{e("corrector")},children:["🔎 ",i("Proofreader")]})},{key:"🧠",label:(0,t.jsxs)("div",{onClick:()=>{e("psychologist")},children:["🧠 ",i("Psychologist")]})},{key:"📈",label:(0,t.jsxs)("div",{onClick:()=>{e("marketolog")},children:["📈 ",i("Marketer")]})},{key:"✨",label:(0,t.jsxs)("div",{onClick:()=>{e("email-generator")},children:["✨ ",i("Email generator")]})}]},zu={background:s.emCssVar("colorInfo"),color:"#ffffff"},hl=({messages:e,newEmailAiGeneratorRef:i})=>{const r=s.useElementEntityKind(),{document:a}=s.useDocumentSessionContext(),l=s.useContentReader(),n=s.useContentReplacer(),{__:c,_n:m}=s.useI18n(),f=s.useDispatch(),_=s.useAppNavigate(),k=(0,d.useRef)(null),b=s.useAppConfig(),h=s.useNotification(),y=s.useEditorProjectId(),x=Hu(),E=s.usePushToDataLayer(),w={document:a,pushToDataLayer:E,entityType:r==="block"?"block":"email",entityId:x,projectId:y},I=s.useEventEmitter(De.events.ON_LIMIT_ID),[A,v]=(0,d.useState)(null),[P,C]=(0,d.useState)(0),[Y,W]=(0,d.useState)(!1),[F,N]=(0,d.useState)(""),[T,J]=(0,d.useState)([]),[Z,se]=(0,d.useState)(!1),[te,ne]=(0,d.useState)(!1),[_e,le]=(0,d.useState)(null),[fe,Ae]=(0,d.useState)(0),[ce,$e]=(0,d.useState)(null),Ce=s.useEmailAttribute("subject"),ie=s.useEmailAttribute("preheader"),Be=s.useCurrentUser(),ae=s.toLanguageCode(s.useInterfaceLocale()),oe=Be.avatar_urls?.[24],me=[Be.first_name,Be.last_name].filter(Boolean).join(" ")||Be.username,de=s.useMessageService(),[Q]=s.useLazyGetDialogQuery(),q=s.useSendPostMessage(),[z,G]=s.useSendMessageMutation(),[re,{reset:ke}]=s.useGetAiGenerateStatusMutation(),[he,{data:Pe=[]}]=s.useLazyGetGeneratedContentQuery(),[ye]=s.useLazyGetLimitsStatsByTypeQuery(),V={cursor:Y?"not-allowed":"default",pointerEvents:Y?"none":"auto"};(0,d.useEffect)(()=>{ce&&Z&&(i.current=!0),Z||(i.current=!1)},[ce,Z]);const ee=!!(b.limits&&b.counters)&&!0,{limits:we}=b.limits?b:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:je,ai_generator_limit:K}=we,ve=s.useEventEmitter(De.events.AI_TEXT_REQUEST_ID).hasListeners(),Re=hr({limitsInPlugin:ee,hostedAiActive:ve}),Le=ml({limitsInPlugin:ee,hostedAiActive:ve,counter:P,limit:je}),Ue=ml({limitsInPlugin:ee,hostedAiActive:ve,counter:fe,limit:K}),Me=(0,d.useCallback)(()=>{I.fire({name:"AiChatCount",count:P+1})},[I,P]),He=(0,d.useCallback)(()=>{I.fire({name:"AiGeneratorCount",count:fe+1})},[I,fe]),O=(0,d.useCallback)(async B=>!0,[c,ye,h]);(0,d.useEffect)(()=>{ee&&(C(b?.counters?.ai_counter||0),Ae(b?.counters?.ai_generator_counter||0))},[b,ee]),(0,d.useEffect)(()=>{$e(T.length<=0?!1:T.toReversed().find(S=>S.data?.context)?.data.context==="email-generator")},[T]);const xe=(0,d.useCallback)(async()=>await de.sendAsync(s.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[de]),D=(0,d.useCallback)(()=>{const B=k.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{B?.scrollTo({top:B.scrollHeight,behavior:"smooth"})},0)},[k]),ue=(0,d.useCallback)(()=>{s.swallowPromiseRejection(Q({entity_id:x}).then(B=>{J(B.data.documents),D()}))},[x,Q,J,D]),ge=(0,d.useCallback)(B=>{if(!B?.data?._eventResult)return!1;const{aiMessage:S,aiHtml:p}=B.data;if(J($=>{const U=[...$];for(let Se=U.length-1;Se>=0;Se--)if(U[Se]?.data?.isLoading&&U[Se]?.data?.role==="assistant"){U[Se]={data:{role:"assistant",message:S,isLoading:!1}};break}return U}),p){const $=pl(l(),String(p));n($,{undoable:!0})}return D(),!0},[l,n,D]),Oe=(0,d.useCallback)(B=>{J(S=>{for(let p=S.length-1;p>=0;p--)if(S[p]?.data?.isLoading&&S[p]?.data?.role==="assistant"){const $=[...S];return B?$[p]={data:{role:"assistant",message:B}}:$.splice(p,1),$}return S})},[]),Ge=(0,d.useCallback)(B=>{const S=B?.message==="ERROR"?void 0:B?.message;return[B?.data?.message,S].find(p=>typeof p=="string"&&p)||c("Something went wrong.")},[c]),Ye=s.useEventEmitter(De.events.AI_TEXT_PROGRESS_ID);(0,d.useEffect)(()=>{const B=Ye.event(({progress:S,status:p})=>{const $=p||`${Math.round(S)}%`;J(U=>{const Se=[...U];for(let pe=Se.length-1;pe>=0;pe--)if(Se[pe]?.data?.isLoading&&Se[pe]?.data?.role==="assistant"){Se[pe]={data:{...Se[pe].data,message:$}};break}return Se})});return()=>B.dispose()},[Ye]);const Xe=s.useEventEmitter(De.events.AI_TEXT_STREAM_ID);(0,d.useEffect)(()=>{const B=Xe.event(({partialHtml:S})=>{const p=pl(l(),String(S));n(p,{undoable:!0})});return()=>B.dispose()},[Xe,l,n,f]);const R=(0,d.useCallback)(B=>{se(!0),W(!0),s.swallowPromiseRejection(re({task_id:B||A,entity_id:x,status:"started"}).then(()=>{ue()}))},[x,re,A,ue]),X=(0,d.useCallback)(()=>{re({task_id:A,entity_id:x,status:"completed"}).then(B=>{B.data.status===403&&ke(),ue()}).catch(B=>{}),W(!1),se(!1)},[x,re,A,ue,ke]);(0,d.useEffect)(()=>{let B;if(Z){const S=Pe[Pe.length-1]?.processing?.email;if(S){let p=Pe[Pe.length-1].status;n(String(S),{undoable:!0}),p===0&&X()}_e&&(clearInterval(B),se(!1),le(!1))}return()=>{clearInterval(B)}},[n,_e,f,Pe,Z,Ce,ie,x,A,ue,re,G,X]),(0,d.useEffect)(D,[D]),(0,d.useEffect)(()=>{e?.length>0&&J(e),q({operation:s.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,q]),(0,d.useEffect)(()=>{const B=de.onInit(()=>{de.send({operation:s.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:Y}),de.send({operation:s.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:Y})});return()=>B.dispose()},[Y,de]);const j=async()=>{if(F){const B=F.replaceAll(/\n/g,"<br>"),S={project_id:y,connection:"chat",entity_id:x,message:B,locale:ae,subject:Ce||"",preheader:ie||"",textContent:hi.extractDocumentTextContent(l())};if(ce&&Ue||Le){h.error({title:c(ce?"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 p={data:{role:"assistant",message:c(ce?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};J($=>[...$,p])}else{if(!await O(ce?"email_generate":"ai")){N("");return}Re&&(ce&&fe!==K?(He(),Ae($=>$+1)):P!==je&&(Me(),C($=>$+1))),E({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:S.entity_id,project_id:S.project_id});const p=[{data:{role:"user",message:B,userInfo:{display_name:me,avatar_url:oe}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];J($=>[...$,...p]),z({body:S}).then($=>{if($?.error)throw $.error;if(!$?.data||$.data.status===401)throw new Error(s.ERROR);if(!ge($)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:r==="block"?"block":"email",entity_id:x,project_id:y,context:"editor"}),$.data.task_id){let U=$.data.task_id;v(U),he({id:U,setError:le}),s.swallowPromiseRejection(xe().then(Se=>{Se?R(U):ne(!0)}))}ue()}}).catch($=>{const U=Ge($);h.error({title:$?.data?.code||c("Error"),description:U}),Oe(U)})}N("")}},M=async B=>{const S={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};J($=>[...$,S]);const p={project_id:y,connection:"chat",entity_id:x,context:B,locale:ae,subject:Ce||"",preheader:ie||"",textContent:hi.extractDocumentTextContent(l())};if(Re&&(ce&&fe!==K?(He(),Ae($=>$+1)):P!==je&&(Me(),C($=>$+1))),Le)h.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),Oe(c("You have reached the limit of AI chat usage."));else{if(!await O("ai")){Oe();return}E({event:"select",action:"select_ai_assistant_role",context:p.context,entity_id:p.entity_id,project_id:p.project_id}),z({body:p}).then($=>{if($?.error)throw $.error;if(!$?.data||$.data.status===401)throw new Error(s.ERROR);ge($)||ue()}).catch($=>{const U=Ge($);h.error({title:$?.data?.code||c("Error"),description:U}),Oe(U)})}},Ee=(0,d.useCallback)(async B=>{const S={data:{role:"user",message:B,userInfo:{display_name:me,avatar_url:oe}}},p={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};J(U=>[...U,S,p]);const $={project_id:y,connection:"chat",entity_id:x,message:B,locale:ae,subject:Ce||"",preheader:ie||"",textContent:hi.extractDocumentTextContent(l())};if(Ue)h.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),Oe(c("You have reached the limit of AI chat usage."));else{if(!await O(ce?"email_generate":"ai")){Oe();return}z({body:$}).then(U=>{if(U?.error)throw U.error;if(!U?.data||U.data.status===401)throw new Error(s.ERROR);if(!ge(U)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:r==="block"?"block":"email",entity_id:x,project_id:y,context:"editor"}),U.data.task_id){let Se=U.data.task_id;v(Se),he({id:Se,setError:le}),s.swallowPromiseRejection(xe().then(pe=>{pe?R(Se):ne(!0)}))}Re&&(ce&&fe!==K?(He(),Ae(Se=>Se+1)):P!==je&&(Me(),C(Se=>Se+1))),ue()}}).catch(U=>{const Se=Ge(U);h.error({title:U?.data?.code||c("Error"),description:Se}),Oe(Se)})}},[c,P,fe,oe,xe,Oe,R,Ge,me,je,K,Be,Ce,ie,x,ce,Ue,ae,Me,He,Re,l,h,O,y,z,he,ue]);(0,d.useEffect)(()=>{const B=new De.Disposable,S=window.localStorage.getItem(s.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&S&&x){const p={project_id:y,connection:"chat",entity_id:x,context:"email-generator",locale:ae};s.runOnceInFlight(`discuss-ai-generator-context:${x}`,()=>{if(ve){window.localStorage.removeItem(s.LOCAL_STORAGE_ITEMS.em_ai_settings),Ee(S);return}s.swallowPromiseRejection(z({body:p}).then(()=>{window.localStorage.removeItem(s.LOCAL_STORAGE_ITEMS.em_ai_settings),B.isDisposed()||Ee(S)}))})}return()=>B.dispose()},[e,Ee,x,ae,y,z,ve]);const Fe=B=>{typeof B.target.className=="string"&&B.target.className.includes("ai-response-change-context")&&(G.isLoading||M(B.target.role))},tt=B=>{const S=B.children[0].data??"";ul("subject",S,w),h.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:S})},qe=B=>{const S=B.children[0].data??"";ul("preheader",S,w),h.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:S,duration:300})},ct=B=>{const S=B.children[0].data;navigator.clipboard.writeText(S).then(()=>{h.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:S})}).catch(p=>{})},Ze={replace:B=>{if(B.attribs?.class?.split(" ").includes("ai-response-title"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Replace the title"),children:(0,t.jsx)("div",{onClick:()=>tt(B),children:(0,t.jsx)("span",{className:"ai-response-title",children:(0,fo.domToReact)(B.children,Ze)})})});if(B.attribs?.class?.split(" ").includes("ai-response-preheader"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Replace the preheader"),children:(0,t.jsx)("div",{onClick:()=>qe(B),children:(0,t.jsx)("span",{className:"ai-response-preheader",children:(0,fo.domToReact)(B.children,Ze)})})});if(B.attribs?.class?.split(" ").includes("ai-response-copy"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Copy to clipboard"),children:(0,t.jsx)("div",{onClick:()=>ct(B),children:(0,t.jsx)("span",{className:"ai-response-copy",children:(0,fo.domToReact)(B.children,Ze)})})});if(B.attribs?.class?.split(" ").includes("ai-response-user-message")){const S=B.attribs?.data||B.children?.[0]?.data;return(0,t.jsx)("li",{className:B.attribs?.class,data:B.attribs?.data,onClick:()=>Ee(S),children:(0,fo.domToReact)(B.children,Ze)})}}},ut=()=>{R(),ne(!1)},Bt=()=>{X(),ne(!1)};return(0,t.jsxs)("div",{ref:k,className:"discuss-main",children:[T.length>0&&(0,t.jsx)(o.ui_kit$List,{onClick:Fe,className:"comment-list",itemLayout:"horizontal",dataSource:T,renderItem:B=>(0,t.jsx)("li",{id:B._id,children:(0,t.jsx)(o.ui_kit$Comment,{className:B.data.userInfo?"":"ai-comment",avatar:B.data.role==="assistant"?(0,t.jsx)(s.EmIcons,{icon:"ChatGpt",component:o.icons$ChatGpt,className:"anticon-robot",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}):B.data.userInfo&&B.data._modified?B.data.userInfo.avatar_url:oe||(0,t.jsx)(s.EmIcons,{icon:"UserOutlined",component:o.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,t.jsx)("div",{style:V,children:B?.data?.role==="user"?Be?.username||c("User"):c("AI Assistant")}),datetime:B._created?(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:St.formatDate(s.parseISO(B._created),m,!0)}}):null,content:B.data.isLoading?(0,t.jsx)("div",{className:"spin",children:(0,t.jsx)(s.EmIcons,{icon:"LoadingOutlined",component:o.icons$LoadingOutlined,style:{fontSize:24},spin:!0})}):(0,t.jsx)("div",{style:V,children:Vu(B.data.message,Ze)})})},B._id)}),ee&&(ce?(0,t.jsx)(o.ui_kit$LimitsCounter,{text:`${fe} ${c("of")} ${K>0?K:"∞"} ${c("mail generator")} ${m("was used","were used",fe)}`,exceeded:K>0&&fe>=K,style:{marginTop:-25},extra:(0,t.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>_(b.billingPageUrl||s.APP_ROUTES.billing),children:c("Need more?")})}):(0,t.jsx)(o.ui_kit$LimitsCounter,{text:`${P} ${c("of")} ${je>0?je:"∞"} ${c("messeges")} ${m("was used","were used",P)}`,exceeded:je>0&&P>=je,style:{marginTop:-25},extra:(0,t.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>_(b.billingPageUrl||s.APP_ROUTES.billing),children:c("Need more?")})})),(0,t.jsxs)(o.ui_kit$Form,{onFinish:j,className:"addMode",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{disabled:Y,value:F,onChange:B=>N(B.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:B=>B.key==="Enter"&&B.ctrlKey&&j(),spellCheck:"false"})}),(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Button,{disabled:G.isLoading||Y,type:"default",style:zu,className:"button-target",children:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"top",disabled:Y,arrow:{pointAtCenter:!0},menu:{items:Wu(M)},children:(0,t.jsxs)("div",{disabled:Y,style:{margin:0,padding:0,color:"#ffffff",display:"inline-flex",alignItems:"center"},children:[(0,t.jsx)(s.EmIcons,{icon:"ChatGpt",component:o.icons$ChatGpt,style:{marginRight:5}}),c("Role")]})},"Export")}),(0,t.jsxs)(o.ui_kit$Button,{disabled:G.isLoading||Y,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,t.jsx)(s.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]})]})})]}),(0,t.jsx)(o.ui_kit$Modal,{title:c("Warning"),open:te,onOk:ut,onCancel:Bt,children:(0,t.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},Gu=[s.VALID,s.ERRORS,s.WARNINGS],bl=({summary:e,__:i,selectedTags:r,setSelectedTags:a})=>{const l=(0,d.useCallback)((c,m)=>{a(m?r.length===2?[]:[...r,c]:r.filter(f=>f!==c))},[r,a]),n=(0,d.useCallback)(c=>i(c==="valid"?"Valid":c==="warnings"?"Warnings":"Errors"),[i]);return(0,t.jsx)(o.ui_kit$Title,{level:5,className:"optimise__valid-title",children:(0,t.jsx)(o.ui_kit$Space,{className:"optimise__valid-title-space",size:8,children:Gu.map((c,m)=>(0,t.jsxs)(o.ui_kit$CheckableTag,{checked:r?.includes(c),onChange:f=>l(c,f),className:(0,Ve.default)(`${c} optimise__button`,{[`${c}_active`]:r.includes(c)}),children:[n(c),": ",e?.[c]||0]},c+m))})})},{LINKS:Yu}=s.OPTIMISE_TABS,fl=(0,d.memo)(({__:e,activeTab:i,validateLinksResult:r,validateLinks:a,selectedTags:l,setSelectedTags:n,isLoading:c,disabled:m,iconStrokeWidth:f,onValidate:_,goToLinkHandler:k})=>i!==Yu||!r?.links?null:r.links.length===0?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No links found."),type:"info"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-14",children:(0,t.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,t.jsx)(bl,{__:e,summary:r.summary,setSelectedTags:n,selectedTags:l}),(0,t.jsx)(o.ui_kit$Button,{disabled:m,loading:c,onClick:_,icon:(0,t.jsx)(s.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:f}),children:e("Refresh")})]})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:a,renderItem:(b,h)=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{avatar:b.status==="valid"?(0,t.jsx)(s.EmIcons,{icon:"CheckCircleFilled",component:o.icons$CheckCircleFilled,className:s.VALID}):b.status==="warnings"?(0,t.jsx)(s.EmIcons,{icon:"CheckCircleFilled",component:o.icons$CheckCircleFilled,className:s.WARNINGS}):(0,t.jsx)(s.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:s.ERRORS}),title:(0,t.jsx)(o.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(b.linkId,600>(b.statusCode||0)&&(b.statusCode||0)>399||!b.statusCode),children:b.url===""?e("empty link"):b.url}),description:(0,t.jsxs)(t.Fragment,{children:[!!b.text?.length&&(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:b.text}),b.page?.title&&b.page.title,b.page?.secure&&b.status==="valid"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"valid",children:e("secure")})]}),!b.resolvedUrl&&!b.statusCode&&b.type==="url"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},h+"_"+b.linkId)})})})]}));fl.displayName="LinksSection";var{IMAGES:Xu}=s.OPTIMISE_TABS,gl=(0,d.memo)(({__:e,activeTab:i,validateImagesResult:r,validateImages:a,selectedTags:l,setSelectedTags:n,isLoading:c,disabled:m,iconStrokeWidth:f,onValidate:_,goToImageHandler:k,showImgPreviewHandler:b,hideBlockPreviewHandler:h})=>i!==Xu||!r?.images?null:r.images.length===0?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,t.jsx)(o.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,t.jsxs)("div",{className:"optimise__summary",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[r.images.length," "]}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[r.summaryTime?.value,r.summaryTime?.name]}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...r.images.map(y=>y.image.responseTime))/1e3).toFixed(2)+e("s")}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("time to load")})]})]}),type:"warning"})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,t.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,t.jsx)(bl,{__:e,summary:r.summary,setSelectedTags:n,selectedTags:l}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(s.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:f}),disabled:m,loading:c,onClick:_,children:e("Refresh")})]})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:a,renderItem:(y,x)=>(0,t.jsx)(o.ui_kit$List.Item,{className:`optimise__image-item image-item ${o.ui_kit$LIST_ITEM_BORDERLESS_CLASS}`,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{className:(0,Ve.default)("image-item__meta",{"image-item__meta_fail":!y.resolvedUrl&&!y.statusCode}),avatar:(0,t.jsx)(o.ui_kit$Image,{className:(0,Ve.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!y.resolvedUrl||!y.valid}),width:92,height:"auto",src:y.resolvedUrl||"",preview:!1,onMouseEnter:()=>b(y.url,y.image.dimensions?.width),onMouseLeave:()=>h()}),title:y.url?(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:y.message,children:(0,t.jsx)(o.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(y.imageId,600>(y.statusCode||0)&&(y.statusCode||0)>399||!y.statusCode),children:y?.url===""?e("empty src"):y.url})}):y.message,description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"image-size",children:[y.image.dimensions&&(0,t.jsxs)(t.Fragment,{children:[y.image.dimensions.width+" × "+y.image.dimensions.height,(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsxs)("span",{children:[Math.round(y.image.bytes/1024),e("kB")]}),(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsxs)("span",{children:[y.image.responseTime,e("ms")]}),(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsx)("span",{className:"image-size-format",children:Wo(y.image.contentType)})]}),y.image.secure&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,t.jsx)("span",{className:"valid",children:e("secure")})]}),y.resolvedUrl&&!y.valid&&(0,t.jsx)(o.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!y.resolvedUrl&&!y.statusCode&&(0,t.jsx)(o.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},x)})})})]}));gl.displayName="ImagesSection";var{SPAM_ASSASSIN:Ku}=s.OPTIMISE_TABS,_l=(0,d.memo)(({__:e,activeTab:i,validateSpamResult:r,isLoading:a,disabled:l,iconStrokeWidth:n,onValidate:c})=>{const m=r?.report?.length||Object.prototype.hasOwnProperty.call(r,"spamScore");if(i!==Ku||!m)return null;const f=r.spamScore||0,_=r.baseSpamScore||0,k=f<2||!r.spamScore||f<=_-1?"success":f<_-1?"warning":"danger";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:[(0,t.jsxs)("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam",children:[(0,t.jsxs)(o.ui_kit$Title,{level:1,className:"optimise__spam-score-title",type:k,children:[(0,t.jsx)("span",{className:"optimise__spam-score-value",children:f}),(0,t.jsx)(o.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,t.jsx)(o.ui_kit$Button,{disabled:l,icon:(0,t.jsx)(s.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:n}),loading:a,onClick:c,children:e("Refresh")})]}),f>_-1&&(0,t.jsx)(o.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(_-1)+"."})]}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(r.report?.length||0)>0?(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:r.report,renderItem:b=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{title:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Text,{className:"optimise__spam-report-score",children:b.score}),(0,t.jsx)("span",{className:"optimise__spam-report-description",children:b.description})]})})})}):(0,t.jsx)(t.Fragment,{children:r.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});_l.displayName="SpamSection";var{PROBLEMS:qu}=s.OPTIMISE_TABS,xl=(0,d.memo)(({__:e,activeTab:i,problemsList:r,onSetMonacoPosition:a})=>i!==qu?null:r?.length?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:r,renderItem:l=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{avatar:l.severity<6?(0,t.jsx)(s.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:s.WARNINGS}):(0,t.jsx)(s.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:s.ERRORS}),title:(0,t.jsxs)(o.ui_kit$Text,{onClick:()=>a(l),className:(0,Ve.default)("optimise__text-clickable",{warning:l.severity<6,error:l.severity>=6}),children:["Line: ",l.startLineNumber," ",l.startLineNumber!==l.endLineNumber&&" – "+l.endLineNumber]}),description:(0,t.jsx)(o.ui_kit$Text,{children:l.message})})})})})}):(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No problems found."),type:"info"})}));xl.displayName="ProblemsSection";var Ju={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,linkCheckCounter:0,imageCheckCounter:0,spamCheckCounter:0,validateLinksResult:{},validateImagesResult:{}},Qu=(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}},mi={link_check:"link_check_counter",image_check:"image_check_counter",spam_check:"spam_check_counter"},br={link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},Zu=(e,i)=>{const r=Object.values(mi),a=Object.values(br);return r.some(l=>e?.[l]!==void 0)||a.some(l=>i?.[l]!==void 0)||r.some(l=>i?.[l]!==void 0)||a.some(l=>e?.[l]!==void 0)},go=(e,i,r=0)=>{const a=e?.[i];return typeof a=="number"&&!Number.isNaN(a)?a:r},em=(e,i)=>({counter:e,limit:i,disabled:i>0&&e>=i}),tm=({appConfig:e,data:i,isSuccess:r,optimisationCounter:a,linkCheckCounter:l,imageCheckCounter:n,spamCheckCounter:c,setOptimisationCounter:m,setLinkCheckCounter:f,setImageCheckCounter:_,setSpamCheckCounter:k})=>{const b=(0,d.useMemo)(()=>!!(e.limits&&e.counters)&&!0,[e]),h=(0,d.useMemo)(()=>e.counters,[e,i]),y=(0,d.useMemo)(()=>e.limits,[e,i]),x=(0,d.useMemo)(()=>b&&Zu(h,y),[b,h,y]),E=(0,d.useMemo)(()=>go(y,"optimization_limit",0),[y]),w=(0,d.useMemo)(()=>!x&&a>=E&&E>0,[x,a,E]),I=(0,d.useMemo)(()=>{const v={link_check:l,image_check:n,spam_check:c};return Object.keys(br).reduce((P,C)=>{const Y=br[C],W=x?go(y,Y,0):E,F=x?v[C]:a;return P[C]=em(F,W),P},{})},[x,y,E,l,n,c,a]),A=v=>x?I[v].disabled:w;return(0,d.useEffect)(()=>{if(!b){const v=i?.counters;r&&v?.optimization_counter&&m(v.optimization_counter);return}m(go(h,"optimization_counter",0)),x&&(f(go(h,mi.link_check,0)),_(go(h,mi.image_check,0)),k(go(h,mi.spam_check,0)))},[b,x,i,r,h,m,f,_,k]),{limitsInPlugin:b,perTypeAvailable:x,currentBillingOptimisationLimits:E,disableFields:w,typeLimits:I,isTypeDisabled:A}},om=()=>{const e=(0,d.useRef)(null);return{showImgPreviewHandler:(0,d.useCallback)((i,r)=>{e.current&&clearTimeout(e.current);let a=document.querySelector(".img-preview"),l=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(a=document.createElement("div"),a.classList.add("img-preview"),l=document.createElement("div"),l.classList.add("img-preview-content"),a.append(l),document.querySelector(".email-pane__col_settings-inner")?.append(a)),l&&(l.innerHTML=`<table cellspacing="0" cellpadding="0" border="0" width="100%"><img height="auto" width=${(r||0)+"px"} alt="" style="max-width: 100%; object-fit: contain" src=${i}></table>`),a&&a.style.opacity!=="1"&&setTimeout(()=>{a&&(a.style.opacity="1",a.style.transform="translateX(-100%)")},10)},[]),hideBlockPreviewHandler:(0,d.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:im,IMAGES:rm}=s.OPTIMISE_TABS,sm=({activeTab:e,selectedTags:i,validateLinksResult:r,validateImagesResult:a,setValidateLinks:l,setValidateImages:n})=>{(0,d.useEffect)(()=>{e===im&&r.links&&l(i.length>0?r.links.filter(c=>i.includes(c.status)):r.links),e===rm&&a.images&&n(i.length>0?a.images.filter(c=>i.includes(c.status)):a.images)},[r.links,a.images,i,e,l,n])},am=e=>(e.statusCode!==null?e.statusCode<300&&(e.page?.secure??!0):e.type!=="invalid")?s.VALID:(e.statusCode&&e.statusCode<400||e.statusCode===200&&(e.page?.secure??!0))&&e.type!=="invalid"?s.WARNINGS:s.ERRORS,kl=e=>e.statusCode!==null&&e.statusCode<300?s.VALID:e.statusCode<400&&e.statusCode>=300||e.statusCode===200&&!e.valid?s.WARNINGS:s.ERRORS,El=e=>({valid:e.filter(i=>i.status===s.VALID).length,warnings:e.filter(i=>i.status===s.WARNINGS).length,errors:e.filter(i=>i.status===s.ERRORS).length}),{LINKS:fr,IMAGES:gr,SPAM_ASSASSIN:Bl,PROBLEMS:_r}=s.OPTIMISE_TABS,Tl={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},lm={link_check:"LinkCheckCount",image_check:"ImageCheckCount",spam_check:"SpamCheckCount"},nm={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},Sl=(e,i,r,a)=>`${e} ${r("of")} ${i>0?i:"∞"} ${a("test","tests",i>0?i:e)} ${a("was used","were used",e)}`,yl=()=>{const{__:e,_n:i}=s.useI18n(),r=s.useDispatch(),a=s.useOpenPlanCatalog(),l=s.useAppNavigate(),n=s.useNotification(),c=s.useContentReader(),m=s.useAppConfig(),f=s.useEditorProjectId(),_=s.useRouteEmailId(),{email:k}=s.useOpenEmail(),b=_||(k?.id!=null?String(k.id):void 0),h=f||(k?.project!=null?String(k.project):void 0),[y,x]=(0,d.useState)(null),E=(0,d.useRef)(!1),w=(0,d.useRef)({link_check:!1,image_check:!1,spam_check:!1}),I=s.useProjectPlanLimitPreflight(),A=(0,d.useCallback)(O=>{x(O)},[]),v=(0,d.useCallback)((O,xe)=>O?.status===401&&O?.data?.code==="usage_limit_exceeded"?(A({presetId:{link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"}[xe],previousDisplay:e("—"),nextDisplay:s.presetLimitDisplay("infinity")}),r(s.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0):!1,[r,e,A]),P=(0,d.useCallback)((O,xe)=>{v(O,xe)||n.error({error:O})},[v,n]),C=(0,d.useCallback)(async O=>!0,[r,I,A]),Y=s.useMessageService(),W=s.useSelector(s.selectProblemsList),F=s.useEventEmitter(De.events.ON_LIMIT_ID),N=s.usePushToDataLayer(),[T,J]=(0,d.useReducer)(Qu,Ju),[Z,se]=s.useEditSpamMutation(),[te,ne]=s.useEditLinksMutation(),[_e,le]=s.useEditImagesMutation(),{data:fe,isSuccess:Ae}=s.useGetProjectQuery(+(h||0),{skip:!0}),ce=s.useInvalidateProject(),$e=(0,d.useCallback)(O=>J({type:"SET_OPTIMISATION_COUNTER",payload:O}),[]),Ce=(0,d.useCallback)(O=>J({type:"SET_LINK_CHECK_COUNTER",payload:O}),[]),ie=(0,d.useCallback)(O=>J({type:"SET_IMAGE_CHECK_COUNTER",payload:O}),[]),Be=(0,d.useCallback)(O=>J({type:"SET_SPAM_CHECK_COUNTER",payload:O}),[]),ae=(0,d.useCallback)(O=>J({type:"SET_VALIDATE_LINKS",payload:O}),[]),oe=(0,d.useCallback)(O=>J({type:"SET_VALIDATE_IMAGES",payload:O}),[]),me=(0,d.useCallback)(O=>J({type:"SET_SELECTED_TAGS",payload:O}),[]),{limitsInPlugin:de,perTypeAvailable:Q,currentBillingOptimisationLimits:q,disableFields:z,typeLimits:G,isTypeDisabled:re}=tm({appConfig:m,data:fe,isSuccess:Ae,optimisationCounter:T.optimisationCounter,linkCheckCounter:T.linkCheckCounter,imageCheckCounter:T.imageCheckCounter,spamCheckCounter:T.spamCheckCounter,setOptimisationCounter:$e,setLinkCheckCounter:Ce,setImageCheckCounter:ie,setSpamCheckCounter:Be});sm({activeTab:T.activeTab,selectedTags:T.selectedTags,validateLinksResult:T.validateLinksResult,validateImagesResult:T.validateImagesResult,setValidateLinks:ae,setValidateImages:oe});const{showImgPreviewHandler:ke,hideBlockPreviewHandler:he}=om(),Pe=(0,d.useCallback)(O=>O==="link_check"?T.linkCheckCounter:O==="image_check"?T.imageCheckCounter:T.spamCheckCounter,[T.linkCheckCounter,T.imageCheckCounter,T.spamCheckCounter]),ye=(0,d.useCallback)(O=>{if(de){if(Q){J({type:{link_check:"INCREMENT_LINK_CHECK_COUNTER",image_check:"INCREMENT_IMAGE_CHECK_COUNTER",spam_check:"INCREMENT_SPAM_CHECK_COUNTER"}[O]}),F.fire({name:lm[O],count:Pe(O)+1});return}J({type:"INCREMENT_OPTIMISATION_COUNTER"}),F.fire({name:"OptimizationCount",count:T.optimisationCounter+1})}},[de,Q,F,Pe,T.optimisationCounter]),V=(0,d.useCallback)(O=>{if(Q){const{limit:xe}=G[O];A({presetId:nm[O],previousDisplay:xe>0?xe:s.presetLimitDisplay("infinity"),nextDisplay:s.presetLimitDisplay("infinity")});return}A({presetId:"optimization_exceeded",previousDisplay:q,nextDisplay:s.presetLimitDisplay("infinity")})},[Q,G,A,q]),ee=(0,d.useCallback)(()=>{l(m.billingPageUrl||s.APP_ROUTES.billing)},[m.billingPageUrl,l]),we=O=>{if(!de||!Q)return null;const{counter:xe,limit:D,disabled:ue}=G[O];return(0,t.jsx)(o.ui_kit$LimitsCounter,{text:Sl(xe,D,e,i),exceeded:ue,extra:(0,t.jsx)("button",{type:"button",style:Tl,onClick:ee,children:e("Need more?")})})},je=(0,d.useCallback)((O,xe)=>{Y.send({operation:s.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:O,isError:xe}})},[Y]),K=(0,d.useCallback)((O,xe)=>{Y.send({operation:s.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:O,isError:xe}})},[Y]),ve=(0,d.useCallback)(O=>{const xe={startColumn:O.startColumn,startLineNumber:O.startLineNumber,endColumn:O.endColumn,endLineNumber:O.endLineNumber};r(s.setActiveProblemRange(xe))},[r]),Re=(0,d.useCallback)(O=>{J({type:"SET_ACTIVE_TAB",payload:O}),J({type:"RESET_SELECTED_TAGS"}),O===_r&&W?.length>0&&N({event:"check",action:"check_email_code",email_id:b,project_id:h,problems_count:W?.length||0})},[W,N,b,h]),Le=(0,d.useCallback)(async()=>{if(!b){n.error({title:"Save the mail first."});return}if(re("link_check")){V("link_check");return}if(!await C("link_check"))return;ye("link_check");const O=c(),xe=new DOMParser().parseFromString(O,"text/html"),D={},ue={};xe.querySelectorAll("a[href]").forEach((ge,Oe)=>{D[`link_${Oe}`]=ge.getAttribute("href"),ue[`link_${Oe}`]=ge.textContent||""}),Y.send({operation:"sandbox_set_attr_to_links"}),te({entity_id:b,data:D}).then(({data:ge,error:Oe})=>{if(Oe)P(Oe,"link_check");else if(ge?.result){const Ge=[...ge.result];Ge?.sort((R,X)=>R.linkId-X.linkId);const Ye=Ge.map(R=>({...R,text:ue[R.linkId],status:am(R)})),Xe={links:Ye,summary:El(Ye)};J({type:"SET_VALIDATE_LINKS_RESULT",payload:Xe}),n.success(e("Links validation was successfully completed")),ge.limit_warning&&ge.limit_remaining!=null&&n.warning({title:`${e("Approaching usage limit. Remaining")}: ${ge.limit_remaining}`}),N({event:"check",action:"check_email_links",email_id:b,project_id:h,links_count:Xe.links?.length||0})}else ge.statusCode>300||!ge.success?n.error({error:{data:ge}}):n.error({title:e("Something went wrong.")}),!T.validateLinksResult.links&&Re("")}).catch(ge=>{P(ge,"link_check")})},[b,re,V,C,ye,c,Y,te,n,e,N,h,ce,T.validateLinksResult.links,P,Re]),Ue=(0,d.useCallback)(async()=>{if(!b){n.error({title:"Save the mail first."});return}if(re("image_check")){V("image_check");return}if(!await C("image_check"))return;ye("image_check");const O=c(),xe=new DOMParser().parseFromString(O,"text/html"),D={};xe.querySelectorAll("img").forEach((ue,ge)=>D[`image_${ge}`]=ue.src),Y.send({operation:"sandbox_set_attr_to_images"}),_e({entity_id:b,data:D}).then(({data:ue,error:ge})=>{let Oe;if(ge)P(ge,"image_check");else if(ue?.result){const Ge=Object.values(ue.result);Ge.sort((Xe,R)=>Xe.imageId-R.imageId);const Ye=Ge.reduce((Xe,R)=>Xe+Math.round(R.image.bytes/1024),0);Oe={images:Ge.map(Xe=>({...Xe,status:kl(Xe)}))||[],summary:El(Ge.map(Xe=>({...Xe,status:kl(Xe)}))),summaryTime:{value:(Ye>1200?Ye/1e3:Ye).toFixed(1),name:Ye>1200?e("MB"):e("KB")}},Oe&&J({type:"SET_VALIDATE_IMAGES_RESULT",payload:Oe}),n.success(e("Images validation was successfully completed")),ue.limit_warning&&ue.limit_remaining!=null&&n.warning({title:`${e("Approaching usage limit. Remaining")}: ${ue.limit_remaining}`}),N({event:"check",action:"check_email_images",email_id:b,project_id:h,images_count:Oe.images?.length||0})}else ue.statusCode>300||!ue.success?n.error({error:{data:ue}}):n.error({title:e("Something went wrong.")}),!T.validateImagesResult?.images?.length&&Re("")}).catch(ue=>{P(ue,"image_check")})},[b,re,V,C,ye,c,Y,_e,n,e,N,h,ce,T.validateImagesResult,P,Re]),Me=(0,d.useCallback)(async()=>{if(!b){n.error({title:"Save the mail first."});return}if(re("spam_check")){V("spam_check");return}await C("spam_check")&&(ye("spam_check"),Z({entity_id:b,data:{html:c()}}).then(({data:O,error:xe})=>{if(xe)P(xe,"spam_check");else if(O&&O.success){const D=!!O.result.report&&Object.values(O.result.report);D?(D.sort((ue,ge)=>ue.score-ge.score),J({type:"SET_VALIDATE_SPAM_RESULT",payload:{...O.result,report:D}})):O.result&&J({type:"SET_VALIDATE_SPAM_RESULT",payload:{...O.result,report:D}}),n.success(e("Spam validation was successfully completed")),O.limit_warning&&O.limit_remaining!=null&&n.warning({title:`${e("Approaching usage limit. Remaining")}: ${O.limit_remaining}`}),N({event:"check",action:"check_email_spam",email_id:b,project_id:h,spam_score:O.result?.spamScore||0})}else O.statusCode>300||!O.success?n.error({error:{data:O}}):n.error({title:e("Something went wrong.")}),!T.validateSpamResult?.report?.length&&Re("")}).catch(O=>{P(O,"spam_check")}))},[b,re,V,C,ye,c,Z,n,e,N,h,ce,T.validateSpamResult,P,Re]);(0,d.useEffect)(()=>{if(de){if(Q){["link_check","image_check","spam_check"].forEach(O=>{const{limit:xe,counter:D,disabled:ue}=G[O];if(!ue){w.current[O]=!1;return}w.current[O]||xe>0&&D>=xe&&(w.current[O]=!0,V(O))});return}if(!(q>0&&T.optimisationCounter>=q)){E.current=!1;return}E.current||(E.current=!0,V("link_check"))}},[de,Q,G,T.optimisationCounter,q,V]);const He=y?s.getLimitUpgradePresetDefinition(y.presetId):null;return(0,t.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[He&&y?(0,t.jsx)(yt.LimitUpgradeModal,{open:!0,onClose:()=>x(null),title:e(He.titleKey),subtitle:e(He.subtitleKey),usageResource:He.usageResource,previousDisplay:y.previousDisplay,nextDisplay:y.nextDisplay,onChangePlan:()=>{x(null),a()}}):null,de&&!Q&&(0,t.jsx)(o.ui_kit$LimitsCounter,{text:Sl(T.optimisationCounter,q,e,i),exceeded:z,extra:(0,t.jsx)("button",{type:"button",style:Tl,onClick:ee,children:e("Need more?")})}),m.optimizeLinksEnabled&&(0,t.jsxs)(t.Fragment,{children:[we("link_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Links validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:O=>O.preventDefault(),onClick:()=>{Re(fr),!T.validateLinksResult?.links?.length&&T.activeTab!==fr&&Le()},loading:ne.isLoading,disabled:re("link_check")&&!T.validateLinksResult?.links?.length,children:!ne.isLoading&&(T.activeTab===fr?(0,t.jsx)(s.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,t.jsx)(fl,{__:e,activeTab:T.activeTab,validateLinksResult:T.validateLinksResult,validateLinks:T.validateLinks,selectedTags:T.selectedTags,setSelectedTags:me,isLoading:ne.isLoading,disabled:re("link_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:Le,goToLinkHandler:je})]}),m.optimizeImagesEnabled&&(0,t.jsxs)(t.Fragment,{children:[we("image_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Images validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:O=>O.preventDefault(),onClick:()=>{Re(gr),!T.validateImagesResult?.images?.length&&T.activeTab!==gr&&Ue()},loading:le.isLoading,children:!le.isLoading&&(T.activeTab===gr?(0,t.jsx)(s.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,t.jsx)(gl,{__:e,activeTab:T.activeTab,validateImagesResult:T.validateImagesResult,validateImages:T.validateImages,selectedTags:T.selectedTags,setSelectedTags:me,isLoading:le.isLoading,disabled:re("image_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:Ue,goToImageHandler:K,showImgPreviewHandler:ke,hideBlockPreviewHandler:he})]}),m.optimizeSpamAssassinEnabled&&(0,t.jsxs)(t.Fragment,{children:[we("spam_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("SpamAssassin")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:O=>O.preventDefault(),loading:se.isLoading,onClick:()=>{Re(Bl),T.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(T.validateSpamResult,"spamScore")||Me()},disabled:re("spam_check")&&!(T.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(T.validateSpamResult,"spamScore")),children:!se.isLoading&&(T.activeTab===Bl?(0,t.jsx)(s.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,t.jsx)(_l,{__:e,activeTab:T.activeTab,validateSpamResult:T.validateSpamResult,isLoading:se.isLoading,disabled:re("spam_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:Me})]}),m.optimizeCheckCodeEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:O=>O.preventDefault(),onClick:()=>Re(_r),children:T.activeTab===_r?(0,t.jsx)(s.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,t.jsx)(s.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth})})})]}),(0,t.jsx)(xl,{__:e,activeTab:T.activeTab,problemsList:W,onSetMonacoPosition:ve})]})]})},dm=({state:e,onCancel:i,onRetry:r,onDismiss:a})=>{const{__:l}=s.useI18n();return e.kind==="hidden"?null:(0,t.jsx)("div",{className:"indexing-tray",role:"status","aria-live":"polite",children:(0,t.jsx)(o.ui_kit$Card,{size:"small",variant:"borderless",className:"indexing-tray__card",children:(0,t.jsxs)(o.ui_kit$Flex,{vertical:!0,gap:8,children:[cm(e,l),(0,t.jsx)(o.ui_kit$Flex,{justify:"flex-end",children:um(e,{onCancel:i,onRetry:r,onDismiss:a},l)})]})})})};function cm(e,i){switch(e.kind){case"scanning":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Flex,{align:"center",gap:8,children:[(0,t.jsx)(o.ui_kit$Spin,{size:"small"}),(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Moving files from old storage…")})]}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:i("Found so far: %s").replace("%s",String(e.scanned))}),(0,t.jsx)(o.ui_kit$Progress,{percent:100,status:"active",showInfo:!1,strokeColor:s.emCssVar("colorPrimary")})]});case"indexing":{const r=e.total>0?Math.min(100,Math.round(e.scanned/e.total*100)):0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Indexing files…")}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:`${e.scanned} / ${e.total}`}),(0,t.jsx)(o.ui_kit$Progress,{percent:r,status:"active",strokeColor:s.emCssVar("colorPrimary")})]})}case"done":return(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Could not move files from old storage")});case"cancelled":return(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Move stopped")});default:return null}}function um(e,i,r){switch(e.kind){case"scanning":case"indexing":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onCancel,disabled:e.cancelling,children:e.cancelling?r("Stopping…"):r("Cancel")});case"failed":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:r("Retry")});case"cancelled":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:r("Resume")});case"done":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onDismiss,children:r("Close")});default:return null}}var mm=2500,Rl=48,pm=4e3;function hm(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 bm(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function fm({projectId:e,api:i,triggered:r,onCompleted:a}){const[l,n]=(0,d.useState)({kind:"hidden"}),c=(0,d.useRef)(!1),m=(0,d.useRef)(!0),f=(0,d.useRef)(e);f.current=e;const _=(0,d.useRef)(r);_.current=r;const k=(0,d.useRef)(a);k.current=a,(0,d.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]),(0,d.useEffect)(()=>{n({kind:"hidden"})},[e]);const b=(0,d.useCallback)(async()=>{try{const y=await i.files.backfillList({project_id:e});return!y.ok||y.error?null:hm(y.data)}catch{return null}},[i,e]),h=(0,d.useCallback)(async()=>{if(c.current)return;c.current=!0;const y=f.current;let x=0;try{for(;m.current&&f.current===y&&_.current;){const E=await b();if(!m.current)break;if(E)if(E.kind==="hidden"){if(x+=1,x>=Rl){n({kind:"failed"});break}}else{if(x=0,n(E),E.kind==="done")try{await k.current?.()}catch{}if(bm(E))break}else if(x+=1,x>=Rl){n({kind:"failed"});break}await new Promise(w=>setTimeout(w,mm))}}finally{c.current=!1}},[b]);return(0,d.useEffect)(()=>{r&&h()},[r,h]),(0,d.useEffect)(()=>{if(l.kind!=="done")return;const y=setTimeout(()=>{m.current&&n({kind:"hidden"})},pm);return()=>clearTimeout(y)},[l.kind]),{state:l,cancel:(0,d.useCallback)(()=>{n(y=>y.kind==="scanning"||y.kind==="indexing"?{...y,cancelling:!0}:y),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,d.useCallback)(()=>{_.current=!0,i.files.backfillCreate({project_id:e}),h()},[i,e,h]),dismiss:(0,d.useCallback)(()=>n({kind:"hidden"}),[])}}var gm=s.lazyRoute(()=>(0,Do.__vitePreload)(()=>Promise.resolve().then(()=>bt("./f8d889a1.js")),void 0,{}.url)),_m=s.lazyRoute(()=>(0,Do.__vitePreload)(()=>Promise.resolve().then(()=>bt("./7c047ede.js")),void 0,{}.url)),wl={height:"100%"};function xm(e){(e?(0,Do.__vitePreload)(()=>Promise.resolve().then(()=>bt("./1afe0f9c.js")),void 0,{}.url):(0,Do.__vitePreload)(()=>Promise.resolve().then(()=>bt("./fa60c7fb.js")),void 0,{}.url)).catch(()=>{})}var km=({storageProvider:e,dataProvider:i,pathProxy:r,usesBuiltInStorage:a,contentKey:l})=>{const n=s.useAppConfig(),c=s.isImageEditModal(s.useSelector(s.selectActiveModal$1)),m=!!n.imageCenterFileManagerView;(0,d.useEffect)(()=>{c&&xm(m)},[c,m]);let f=(0,t.jsx)(o.ui_kit$PageLoader,{style:wl});return e&&i&&n.imageCenterFileManagerView?f=(0,t.jsx)(gm,{storageProvider:e,dataProvider:i,pathProxy:r},l):e&&i&&(f=(0,t.jsx)(_m,{dataProvider:i,usesBuiltInStorage:a},l)),(0,t.jsx)(d.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{style:wl}),children:f})},Em=class{http;constructor(e){this.http=e}cache_clear_create=(e,i={})=>this.http.request({path:"/em-files/v1/cache/clear",method:"POST",body:e,type:De.ContentType.UrlEncoded,...i})},Bm=class{http;constructor(e){this.http=e}empty_trash_create=(e,i={})=>this.http.request({path:"/em-files/v1/empty-trash",method:"POST",body:e,type:De.ContentType.UrlEncoded,...i})},Tm=class{http;constructor(e){this.http=e}files_list=(e,i={})=>this.http.request({path:"/em-files/v1/files",method:"GET",query:e,format:"json",...i});files_create=(e,i={})=>this.http.request({path:"/em-files/v1/files",method:"POST",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});files_delete=(e,i={})=>this.http.request({path:"/em-files/v1/files",method:"DELETE",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});files_partial_update=(e,i={})=>this.http.request({path:"/em-files/v1/files",method:"PATCH",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});files_upload_by_url_create=(e,i={})=>this.http.request({path:"/em-files/v1/files/upload-by-url",method:"POST",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});files_rename_partial_update=(e,i={})=>this.http.request({path:"/em-files/v1/files/rename",method:"PATCH",body:e,type:De.ContentType.UrlEncoded,format:"json",...i})},Sm=class{http;constructor(e){this.http=e}folders_list=(e,i={})=>this.http.request({path:"/em-files/v1/folders",method:"GET",query:e,format:"json",...i});folders_create=(e,i={})=>this.http.request({path:"/em-files/v1/folders",method:"POST",body:e,type:De.ContentType.UrlEncoded,format:"json",...i});folders_delete=(e,i={})=>this.http.request({path:"/em-files/v1/folders",method:"DELETE",body:e,type:De.ContentType.UrlEncoded,format:"json",...i})},ym=class{http;constructor(e){this.http=e}items_move_partial_update=(e,i={})=>this.http.request({path:"/em-files/v1/items/move",method:"PATCH",body:e,type:De.ContentType.UrlEncoded,format:"json",...i})},Rm=[Em,Bm,Tm,Sm,ym];function wm(){const e=s.useAppConfig(),i=s.useIsStandalone(),r=s.useStorageProvider(),a=s.useProjectData(),l=s.useRestClient(Rm),n=s.useStore(),c=(0,d.useMemo)(()=>s.createRestClientV2(n),[n]),m=s.useI18n(),f=s.useCurrentUser(),_=a?.id?String(a.id):"",k=f?.id!=="0"?String(f.id):"",b=s.isFileManagerV2Enabled(e),[h,y]=(0,d.useState)(null),x=b&&!!_&&h===_,[E,w]=(0,d.useState)(0),[I,A]=(0,d.useState)(0),v=(0,d.useRef)(_);(0,d.useEffect)(()=>{v.current!==_&&(v.current=_,y(null))},[_]);const P=(0,d.useCallback)(F=>{F&&_&&y(_)},[_]),C=(0,d.useMemo)(()=>Vr({storageProvider:r,projectId:_,restApi:l,restApiV2:c,i18n:m,pathPostfix:k,appConfig:e,isStandalone:i,onIndexingStateChange:P}),[e,P,m,i,_,E,l,c,r,k]),Y=(0,d.useCallback)(async()=>{try{typeof C.dataProvider?.clearCache=="function"&&await C.dataProvider.clearCache()}catch{}y(null),w(F=>F+1),A(F=>F+1)},[C.dataProvider]),W=(0,d.useCallback)(()=>{_&&y(_)},[_]);return{...C,projectId:_,restApiV2:c,v2Enabled:b,backfillTriggered:x,contentKey:`${_}:${I}`,handleIndexingCompleted:Y,markIndexingStarted:W}}var jm={height:"100%"},jl=()=>{const{storageProvider:e,dataProvider:i,pathProxy:r,usesBuiltInStorage:a,projectId:l,restApiV2:n,v2Enabled:c,backfillTriggered:m,contentKey:f,handleIndexingCompleted:_,markIndexingStarted:k}=wm(),b=s.useSelector(s.selectActiveModal$1),h=s.isImageCenterModal(b),{state:y,cancel:x,retry:E,dismiss:w}=fm({projectId:l,api:n,triggered:m,onCompleted:_}),I=d.default.useCallback(()=>{k(),E()},[k,E]);return(0,t.jsxs)(t.Fragment,{children:[h&&(0,t.jsx)(d.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{style:jm}),children:(0,t.jsx)(km,{storageProvider:e,dataProvider:i,pathProxy:r,usesBuiltInStorage:a,contentKey:f})}),c&&(0,t.jsx)(dm,{state:y,onCancel:x,onRetry:I,onDismiss:w})]})},vm=(function(){var e=window.__useblocks__;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 Im(e){return!!(e?.global_block??e?.acf?.global_block)}var Cm=({className:e,size:i=16})=>{const r=s.useAppConfig(),{__:a}=s.useI18n(),l=a("Global block");return(0,t.jsx)(o.ui_kit$Tooltip,{title:l,placement:"top",trigger:["hover"],children:(0,t.jsx)("span",{className:(0,Ve.default)("block-global-badge",e),"aria-label":l,role:"img",children:(0,t.jsx)(s.EmIcons,{icon:"Globe02Icon",component:o.icons$Globe02Icon,size:i,strokeWidth:r.iconStrokeWidth})})})},vl=new Map;function Il(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function xr(e,i){const r=i??"";if(e===void 0)return s.sanitizeHtml(Il(r));const a=String(e),l=vl.get(a);if(l&&l.source===r)return l.markup;const n=s.sanitizeHtml(Il(r));return vl.set(a,{source:r,markup:n}),n}var{name:kr,type:Cl,tags:Pl}={name:"name",type:"type",tags:"tags"},Al={[kr]:"",[Cl]:[],[Pl]:[]},_o={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},Er=({parentEmailId:e,blocksTab:i,search:r,reloadBlockScreens:a,setIsShowAddAllBlocksModal:l})=>{const n=s.parentEmailSource(e),c=s.useEditorProjectId(),m=St.useSetHtmlElementInIframeHandler(),f=St.useDragStartBlockToIframeHandler(),[_]=o.ui_kit$Form.useForm(),{data:k}=s.useGetBlocksSchemaQuery(),{token:b}=(0,o.ui_kit$useToken)(),{__:h,_x:y}=s.useI18n(),x=s.useNotification(),{modal:E}=o.ui_kit$App.useApp(),{confirm:w}=E;s.useRoutePathname();const I=s.useSelector(s.selectParentBlocks),A=Ca(),v=(0,d.useRef)(null),P=(0,d.useRef)(null),C=s.useRootElement(),Y=640,W=207/Y,F=B=>Im(B)?(0,t.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,t.jsx)(Cm,{className:"block-global-badge--tile",size:14})}):null,N=s.useEmailAttribute("common_styles"),T=(0,d.useMemo)(()=>Aa(N,A),[N,A]),J=(0,d.useRef)(null),Z=(0,d.useRef)(null),se=(0,d.useRef)(null),te=s.useStore();(0,d.useEffect)(()=>{P.current?.scrollTo({top:0})},[i,r]);const ne=s.useProjectData(),{data:_e}=s.useGetTermsQuery({project:ne,kind:s.BLOCK_TAGS},{skip:!ne?.id}),[le,fe]=(0,d.useState)(()=>s.projectBlocksArgs(c));(0,d.useEffect)(()=>{r||(_.setFieldsValue(Al),O({type:null,name:null}),a())},[r,_,a]),(0,d.useEffect)(()=>{if(k){const B=k.schema.properties.acf.properties.type.items.enum;let S=[];for(let p in B)S.push({label:h(s.TYPES_TRANSLATE[B[p]]),value:B[p]})}},[k,h]);const{isSuccess:Ae,isError:ce,isLoading:$e,isFetching:Ce,data:ie,refetch:Be,error:ae}=s.useGetBlocksQuery({...le,page:1}),oe=(0,d.useMemo)(()=>{if(Ae&&ie)return[...ie].sort((B,S)=>_o[B.type]-_o[S.type])},[Ae,ie]),[me,de]=(0,d.useState)([]);s.usePrevious(B=>{B!==ce&&x.fromError("BLOCK_GET_ERROR",{},ae,!0)},[ce,ae,x]);const[Q,q]=(0,d.useState)(()=>s.parentEmailBlocksArgs(n)),{isSuccess:z,isError:G,isLoading:re,isFetching:ke}=s.useGetParentEmailBlocksQuery({...Q,emailId:n,page:1},{skip:!n||I.length}),he=(0,d.useMemo)(()=>{if(z||I.length)return[...I].sort((B,S)=>_o[B.type]-_o[S.type])},[z,I]),[Pe,ye]=(0,d.useState)([]);(0,d.useEffect)(()=>{const B=new Set;if(I.length&&he){for(const S of he)S.type&&B.add(S.type);ye(Array.from(B))}else ye([])},[I,he]);const[V,ee]=(0,d.useState)(s.templateBlocksArgs),{isSuccess:we,isError:je,isLoading:K,isFetching:ve,data:Re=[]}=s.useGetTemplateBlocksQuery({...V,page:1}),Le=(0,d.useMemo)(()=>{if(Re.length)return[...Re].sort((B,S)=>_o[B.type]-_o[S.type])},[Re]),[Ue,Me]=(0,d.useState)([]);(0,d.useEffect)(()=>{const B=new Set;if(Le&&Re.length){for(const S of Le)S.type&&B.add(S.type);Me(Array.from(B))}},[Re.length,Le]);const He=(0,d.useMemo)(()=>{const B=new Set;for(const S of me)B.add(S);for(const S of Pe)B.add(S);for(const S of Ue)B.add(S);return Array.from(B)},[Ue,Pe,me]),O=B=>{fe(S=>({...S,...B,page:1})),q(S=>({...S,...B,page:1})),ee(S=>({...S,...B,page:1}))},xe=s.useFitBlockPreviewHeight(W),D=(0,d.useCallback)(()=>{C.querySelector(".blocks-search__result-wrapper.is_search")&&(C.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),C.querySelector(".blocks-search__result-wrapper").style.opacity=0,s.measureBlockPreviews(C,207/Y),C.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",C.querySelectorAll(".blocks-search__result-wrapper").forEach(B=>B.style.opacity=1))},[Y,C]);(0,d.useEffect)(()=>{!(ve||K)&&we&&i!=="template"&&(r?D():a())},[ve,K,we,D,le.name,a,r,i]),(0,d.useEffect)(()=>{const B=new Set;if(Ae&&oe){for(const S of oe)S.type&&B.add(S.type);de(Array.from(B))}},[Ae,oe]);const ue=B=>{const S=Object.keys(B)[0],p=_.getFieldsValue(!0);switch(S){case Pl:const $=(_e||[]).filter(U=>B[S].includes(U.name)).map(U=>U.id)||null;O({tags:$});break;case Cl:O({type:p.type||null});break;case kr:v.current&&window.clearTimeout(v.current),v.current=window.setTimeout(function(){O({name:p.name||null})},300)}},ge=B=>{a(),B.target.getAttribute("data-type")?(B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(S=>S.style.display="none"),B.target.closest(".blocks-search").querySelectorAll(`[data-type="${B.target.getAttribute("data-type")}"]`).forEach(S=>S.style.display="block")):B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(S=>S.style.display="block"),B.target.parentElement.querySelector(".active").classList.remove("active"),B.target.classList.add("active")};let Oe=null;const Ge=B=>{clearTimeout(Oe);let S=C.querySelector(".block-search__preview")?C.querySelector(".block-search__preview"):null,p=C.querySelector(".block-search__preview-title")?C.querySelector(".block-search__preview-title"):null,$=C.querySelector(".block-search__preview-content")?C.querySelector(".block-search__preview-content"):null;C.querySelector(".block-search__preview")||(S=document.createElement("div"),S.classList.add("block-search__preview"),p=document.createElement("div"),p.classList.add("block-search__preview-title"),$=document.createElement("div"),$.classList.add("block-search__preview-content"),S.append($),S.append(p),C.querySelector(".email-pane__col_settings-inner").append(S)),p.innerHTML="",$.innerHTML="",p.innerHTML=B.title;let U=B.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();$.innerHTML=s.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+U+"</table>"),S.style.opacity!=="1"&&setTimeout(function(){S.style.opacity="1",S.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},Ye=()=>{let B=C.querySelector(".block-search__preview");B&&(Oe=setTimeout(()=>{B.style.opacity="0",B.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){B.remove()},300)},300))};(0,d.useEffect)(()=>{C.querySelectorAll(".blocks-search__result").forEach(B=>{B.style.display="block"})},[i]);const Xe=!ie?.length&&(!n||!I?.length)&&!Re?.length&&(le.tags||le.name||le.type)&&!($e||Ce),R=B=>te.dispatch(s.blocksApi.endpoints.deleteBlock.initiate(B.id)).then(S=>{S.error&&x.fromError("BLOCK_REMOVING_ERROR",s.getBlockDesc(B),S.error),x.success({id:"BLOCK_REMOVING_SUCCESS",data:s.getBlockDesc(B),title:h('The block "')+S.data.title+y('" was successfully removed.',"block")}),Be()});(0,d.useEffect)(()=>{!$e&&!Ce&&a()},[$e,Ce,a]),(0,d.useEffect)(()=>{(i==="common"||r)&&setTimeout(a,50)},[ie,a,i,r]);const X=B=>{w({mask:{closable:!0},centered:!0,title:y("Are you sure you want to delete the “","block")+B.title+h("” block?"),icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:22,style:{color:o.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:h("Yes"),cancelText:h("No"),onOk:()=>R(B)})},j=B=>[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:b.colorError},onClick:()=>X(B)}],M=B=>{let S=B.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(S.replaceChildren(...s.parseFromString(B.html)),Object.keys(T).length!==0&&(S.querySelectorAll(".em-contrast-card").forEach(p=>{T.cards?.contrastBackgroundColor&&(p.getAttribute("bgcolor")?T.cards.contrastBackgroundColor?p.setAttribute("bgcolor",T.cards.contrastBackgroundColor):p.removeAttribute("bgcolor"):T.cards.contrastBackgroundColor?p.style.backgroundColor=T.cards.contrastBackgroundColor:p.style.removeProperty("background-color")),T.cards?.contrastTextColor&&p.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach($=>{if(Fe($.style.color).toLowerCase()!=="#ffffff"){let U=$.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.cards.contrastTextColor};`);$.setAttribute("style",U)}})}),S.querySelectorAll(".em-card").forEach(p=>{T.cards?.baseBackgroundColor&&(p.getAttribute("bgcolor")?T.cards.baseBackgroundColor?p.setAttribute("bgcolor",T.cards.baseBackgroundColor):p.removeAttribute("bgcolor"):T.cards.baseBackgroundColor?p.style.backgroundColor=T.cards.baseBackgroundColor:p.style.removeProperty("background-color")),T.cards?.baseTextColor&&p.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach($=>{if(Fe($.style.color).toLowerCase()!=="#ffffff"){let U=$.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.cards.baseTextColor};`);$.setAttribute("style",U)}})}),S.querySelectorAll(".em-card, .em-contrast-card").forEach(p=>{T.cards?.border&&qe({settings:{border:T.cards?.border},elem:p}),T.cards?.borderRadius?.all?(p.style.borderBottomLeftRadius&&p.style.borderBottomLeftRadius!=="0px"&&(p.style.borderBottomLeftRadius=T.cards?.borderRadius.all+"px"),p.style.borderBottomRightRadius&&p.style.borderBottomRightRadius!=="0px"&&(p.style.borderBottomRightRadius=T.cards?.borderRadius.all+"px"),p.style.borderTopLeftRadius&&p.style.borderTopLeftRadius!=="0px"&&(p.style.borderTopLeftRadius=T.cards?.borderRadius.all+"px"),p.style.borderTopRightRadius&&p.style.borderTopRightRadius!=="0px"&&(p.style.borderTopRightRadius=T.cards?.borderRadius.all+"px")):T.cards?.borderRadius?.all===""?p.style.removeProperty("border-radius"):(T.cards?.borderRadius?.topLeft&&p.style.borderTopLeftRadius&&p.style.borderTopLeftRadius!=="0px"?p.style.borderTopLeftRadius=T.cards?.borderRadius.topLeft+"px":T.cards?.borderRadius?.topLeft===""&&p.style.removeProperty("border-top-left-radius"),T.cards?.borderRadius?.topRight&&p.style.borderTopRightRadius&&p.style.borderTopRightRadius!=="0px"?p.style.borderTopRightRadius=T.cards?.borderRadius.topRight+"px":T.cards?.borderRadius?.topRight===""&&p.style.removeProperty("border-top-right-radius"),T.cards?.borderRadius?.bottomRight&&p.style.borderBottomRightRadius&&p.style.borderBottomRightRadius!=="0px"?p.style.borderBottomRightRadius=T.cards?.borderRadius.bottomRight+"px":T.cards?.borderRadius?.bottomRight===""&&p.style.removeProperty("border-bottom-right-radius"),T.cards?.borderRadius?.bottomLeft&&p.style.borderBottomLeftRadius&&p.style.borderBottomLeftRadius!=="0px"?p.style.borderBottomLeftRadius=T.cards?.borderRadius.bottomLeft+"px":T.cards?.borderRadius?.bottomLeft===""&&p.style.removeProperty("border-bottom-left-radius"))}),S.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(p=>{if(!p.style.display&&parseFloat(p.style.fontSize)<=20){let $="",U=T.text.fontFamily;if(parseFloat(p.style.fontSize)>14&&($=p.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${T.text.lineHeight}px`),p.setAttribute("style",$)),!p.closest(".em-contrast-card, .em-card")&&Fe(p.style.color).toLowerCase()!=="#ffffff"&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.color};`),p.setAttribute("style",$)),p.closest(".em-contrast-block")&&!p.closest(".em-contrast-card, .em-card")&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.contrastColor};`),p.setAttribute("style",$)),U[0]==="Safe Fonts"?(p.style.fontFamily=U[1],Ee({elem:S})):U[0]==="Google Fonts"&&(U[1]==="Sans Serif"?p.style.fontFamily="Helvetica, Arial, sans-serif":U[1]==="Serif"&&(p.style.fontFamily='"Times New Roman", Times, serif'),p.classList.remove(...[...p.classList].filter(Se=>Se.startsWith("em-font"))),p.classList.add(`em-font-${U[2].replace(/\s/g,"")}-${U[3].replace(/\s/g,"")}`),tt({elem:S,fontFamilyArray:U})),p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingBottom)p.closest('[em="atom"] > tr > td').style.paddingBottom=T.text.paddingBottom+"px";else if(p.nextElementSibling||p.closest("table")&&p.closest("table").nextElementSibling){let Se=p.nextElementSibling??p.closest("table").nextElementSibling;Se&&Se.tagName==="TABLE"&&(Se.classList.contains("em-vindent-table")||Se.querySelector("td").innerHTML==="")&&Se.querySelector("td").setAttribute("height",T.text.paddingBottom)}}else if(!p.style.display&&parseFloat(p.style.fontSize)>=20&&Fe(p.style.color).toLowerCase()!=="#eb3737"){let $="",U=T.headings.fontFamily;parseFloat(p.style.fontSize)<40&&($=p.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${T.headings.lineHeight}px`),p.setAttribute("style",$)),!p.closest(".em-contrast-card, .em-card")&&Fe(p.style.color).toLowerCase()!=="#ffffff"&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.headings.color};`),p.setAttribute("style",$)),p.closest(".em-contrast-block")&&!p.closest(".em-contrast-card, .em-card")&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.headings.contrastColor};`),p.setAttribute("style",$)),U[0]==="Safe Fonts"?(p.style.fontFamily=U[1],Ee({elem:S})):U[0]==="Google Fonts"&&(U[1]==="Sans Serif"?p.style.fontFamily="Helvetica, Arial, sans-serif":U[1]==="Serif"&&(p.style.fontFamily='"Times New Roman", Times, serif'),p.classList.remove(...[...p.classList].filter(pe=>pe.startsWith("em-font"))),p.classList.add(`em-font-${U[2].replace(/\s/g,"")}-${U[3].replace(/\s/g,"")}`),tt({elem:S,fontFamilyArray:U}));let Se="";if(T.headings.letterSpacing>0?Se=p.style.letterSpacing?p.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${T.headings.letterSpacing}px`):p.getAttribute("style")+` letter-spacing: ${T.headings.letterSpacing}px;`:Se=p.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),p.setAttribute("style",Se),T.headings.bold?p.querySelector("b")?p.querySelector("b").replaceWith(...p.querySelector("b").childNodes):p.querySelector("strong")||(p.innerHTML="<strong>"+p.innerHTML+"</strong>"):p.querySelector("strong")?p.querySelector("strong").replaceWith(...p.querySelector("strong").childNodes):p.querySelector("b")&&p.querySelector("b").replaceWith(...p.querySelector("b").childNodes),p.style.fontWeight){let pe=p.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");p.setAttribute("style",pe)}if(T.headings.italic?p.querySelector("i")?p.querySelector("i").replaceWith(...p.querySelector("i").childNodes):p.querySelector("em")||(p.innerHTML="<em>"+p.innerHTML+"</em>"):p.querySelector("em")?p.querySelector("em").replaceWith(...p.querySelector("em").childNodes):p.querySelector("i")&&p.querySelector("i").replaceWith(...p.querySelector("i").childNodes),p.style.fontStyle){let pe=p.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");p.setAttribute("style",pe)}if(p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingTop)p.closest('[em="atom"] > tr > td').style.paddingTop=T.headings.paddingTop+"px";else if(p.previousElementSibling){let pe=p.previousElementSibling;pe&&pe.tagName==="TABLE"&&(pe.classList.contains("em-vindent-table")||pe.querySelector("td").innerHTML==="")&&pe.querySelector("td").setAttribute("height",T.headings.paddingTop)}if(p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingBottom)p.closest('[em="atom"] > tr > td').style.paddingBottom=T.headings.paddingBottom+"px";else if(p.nextElementSibling){let pe=p.nextElementSibling;pe&&pe.tagName==="TABLE"&&(pe.classList.contains("em-vindent-table")||pe.querySelector("td").innerHTML==="")&&pe.querySelector("td").setAttribute("height",T.headings.paddingBottom)}}}),S.querySelectorAll('a[style*="color"]').forEach(p=>{if(p.style.display){if(p.style.display&&p.style.display==="block"){let $="";if($=p.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.buttons.fontSize}px`),p.setAttribute("style",$),p.closest("td").style.backgroundColor&&!p.closest("td").style.borderWidth&&!p.closest(".em-contrast-card"))if(p.closest(".em-contrast-block")?$=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastColor};`):$=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.color};`),p.setAttribute("style",$),p.closest(".em-contrast-block"))if(T.buttons.contrastBackgroundColor){let pe=p.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${T.buttons.contrastBackgroundColor};`);p.closest("td").setAttribute("style",pe)}else p.closest("td").style.removeProperty("background-color");else if(T.buttons.backgroundColor){let pe=p.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${T.buttons.backgroundColor};`);p.closest("td").setAttribute("style",pe)}else p.closest("td").style.removeProperty("background-color");else if(p.closest("td").style.borderWidth)if(Object.values(T.buttons.border).every(pe=>pe===null)){if(p.closest(".em-contrast-block")){if(T.buttons.contrastBackgroundColor){let pe=p.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ze=>ze.replace(/#[A-Fa-f0-9]{6}/,`${T.buttons.contrastBackgroundColor}`));p.closest("td").setAttribute("style",pe),$=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastBackgroundColor};`),p.setAttribute("style",$)}}else if(T.buttons.backgroundColor){let pe=p.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ze=>ze.replace(/#[A-Fa-f0-9]{6}/,`${T.buttons.backgroundColor}`));p.closest("td").setAttribute("style",pe),$=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.backgroundColor};`),p.setAttribute("style",$)}}else for(const pe in T.buttons.border)T.buttons.border[pe]&&T.buttons.border[pe].color!==void 0&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.border[pe].color};`),p.setAttribute("style",$));else p.closest(".em-contrast-block")?T.buttons.contrastBackgroundColor&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastBackgroundColor};`),p.setAttribute("style",$)):T.buttons.backgroundColor&&($=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.backgroundColor};`),p.setAttribute("style",$));let U=T.buttons.fontFamily;U[0]==="Safe Fonts"?(p.style.fontFamily=U[1],Ee({elem:S})):U[0]==="Google Fonts"&&(U[1]==="Sans Serif"?p.style.fontFamily="Helvetica, Arial, sans-serif":U[1]==="Serif"&&(p.style.fontFamily='"Times New Roman", Times, serif'),p.classList.remove(...[...p.classList].filter(pe=>pe.startsWith("em-font"))),p.classList.add(`em-font-${U[2].replace(/\s/g,"")}-${U[3].replace(/\s/g,"")}`),tt({elem:S,fontFamilyArray:U})),p.closest("td").setAttribute("align",T.buttons.textAlign);let Se="";if(T.buttons.letterSpacing>0?Se=p.style.letterSpacing?p.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${T.buttons.letterSpacing}px`):p.getAttribute("style")+` letter-spacing: ${T.buttons.letterSpacing}px;`:Se=p.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),p.setAttribute("style",Se),T.buttons.bold?p.querySelector("b")?p.querySelector("b").replaceWith(...p.querySelector("b").childNodes):p.querySelector("strong")||(p.innerHTML="<strong>"+p.innerHTML+"</strong>"):p.querySelector("strong")?p.querySelector("strong").replaceWith(...p.querySelector("strong").childNodes):p.querySelector("b")&&p.querySelector("b").replaceWith(...p.querySelector("b").childNodes),p.style.fontWeight){let pe=p.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");p.setAttribute("style",pe)}if(T.buttons.italic?p.querySelector("i")?p.querySelector("i").replaceWith(...p.querySelector("i").childNodes):p.querySelector("em")||(p.innerHTML="<em>"+p.innerHTML+"</em>"):p.querySelector("em")?p.querySelector("em").replaceWith(...p.querySelector("em").childNodes):p.querySelector("i")&&p.querySelector("i").replaceWith(...p.querySelector("i").childNodes),p.style.fontStyle){let pe=p.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");p.setAttribute("style",pe)}if(p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingTop)p.closest('[em="atom"] > tr > td').style.paddingTop=T.buttons.marginTop+"px";else if(p.closest("table").previousElementSibling){let pe=p.closest("table").previousElementSibling;pe&&pe.tagName==="TABLE"&&(pe.classList.contains("em-vindent-table")||pe.querySelector("td").innerHTML==="")&&pe.querySelector("td").setAttribute("height",T.buttons.marginTop)}if(p.closest('[em="atom"] > tr > td')&&p.closest('[em="atom"] > tr > td').style.paddingBottom)p.closest('[em="atom"] > tr > td').style.paddingBottom=T.buttons.marginBottom+"px";else if(p.closest("table").previousElementSibling){let pe=p.closest("table").nextElementSibling;pe&&pe.tagName==="TABLE"&&(pe.classList.contains("em-vindent-table")||pe.querySelector("td").innerHTML==="")&&pe.querySelector("td").setAttribute("height",T.buttons.marginBottom)}T.buttons.padding.all&&(p.style.padding=T.buttons.padding.all+"px"),T.buttons.padding.top&&(p.style.paddingTop=T.buttons.padding.top+"px"),T.buttons.padding.right&&(p.style.paddingRight=T.buttons.padding.right+"px"),T.buttons.padding.bottom&&(p.style.paddingBottom=T.buttons.padding.bottom+"px"),T.buttons.padding.left&&(p.style.paddingLeft=T.buttons.padding.left+"px"),qe({settings:{border:T.buttons.border},elem:p.closest("td")}),ct({settings:{borderRadius:T.buttons.borderRadius},elem:p.closest("td")})}}else{let $=T.text.fontFamily;if(Fe(p.style.color).toLowerCase()==="#1c52dc"){let Se=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.links.color};`);p.setAttribute("style",Se)}else{let Se=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.color};`);p.setAttribute("style",Se)}if(p.closest(".em-contrast-block")){let Se=p.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.links.contrastColor};`);p.setAttribute("style",Se)}let U="";T.links.underline?U=p.style.textDecoration?p.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):p.getAttribute("style")+" text-decoration: underline;":U=p.style.textDecoration?p.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):p.getAttribute("style")+" text-decoration: none;",p.setAttribute("style",U),$[0]==="Safe Fonts"?(p.style.fontFamily=$[1],Ee({elem:S})):$[0]==="Google Fonts"&&($[1]==="Sans Serif"?p.style.fontFamily="Helvetica, Arial, sans-serif":$[1]==="Serif"&&(p.style.fontFamily='"Times New Roman", Times, serif'),p.classList.remove(...[...p.classList].filter(Se=>Se.startsWith("em-font"))),p.classList.add(`em-font-${$[2].replace(/\s/g,"")}-${$[3].replace(/\s/g,"")}`),tt({elem:S,fontFamilyArray:$}))}}),S.querySelector('[em="block"]'))){const p=S.querySelectorAll('[em="block"]');T.block?.backgroundColor&&p.forEach($=>{$.querySelectorAll(":scope > td").forEach(U=>{U.setAttribute("bgcolor",T.block.backgroundColor)})}),T.block?.padding&&p.forEach($=>{$.querySelectorAll(":scope > td").forEach(U=>{U.style.paddingTop=T.block.padding.top+"px",U.style.paddingRight=T.block.padding.right+"px",U.style.paddingBottom=T.block.padding.bottom+"px",U.style.paddingLeft=T.block.padding.left+"px"})})}return S.tagName==="DIV"?s.getElementInnerHTML(S):s.getElementInnerHTML(S.querySelector("tbody"))},Ee=B=>{B.elem.querySelectorAll("link[em-class]").forEach(S=>{B.elem.querySelector("."+S.getAttribute("em-class"))||S.remove()})};function Fe(B){if(B&&B.charAt(0)==="r"){if(B.charAt(3)==="a")return B=B.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),B&&B.length===4?"#"+("0"+parseInt(B[1],10).toString(16)).slice(-2)+("0"+parseInt(B[2],10).toString(16)).slice(-2)+("0"+parseInt(B[3],10).toString(16)).slice(-2):"";{B=B.replace("rgb(","").replace(")","").split(",");let S=parseInt(B[0],10).toString(16),p=parseInt(B[1],10).toString(16),$=parseInt(B[2],10).toString(16);return S=S.length===1?"0"+S:S,p=p.length===1?"0"+p:p,$=$.length===1?"0"+$:$,"#"+S+p+$}}else if(B&&B.charAt(0)==="#")return B}const tt=B=>{const S=B.elem.querySelectorAll("link"),p=`em-font-${B.fontFamilyArray[2].replace(/\s/g,"")}-${B.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(S)?.find(U=>U.getAttribute("em-class")===p)){let U=document.createElement("link");U.setAttribute("rel","stylesheet"),U.setAttribute("href",`https://fonts.googleapis.com/css2?family=${B.fontFamilyArray[2]}:ital,wght@${Ze[B.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${Ze[B.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),U.setAttribute("em-class",p),B.elem.insertAdjacentElement("afterbegin",U)}Bt({elem:B.elem});let $=`font-family: '${B.fontFamilyArray[2]}', ${ut[B.fontFamilyArray[1]]}!important;`;$+=` font-weight: ${Ze[B.fontFamilyArray[3]].replaceAll("i","")}!important;`,Ze[B.fontFamilyArray[3]].indexOf("i")>-1&&($+=" font-style: italic!important;"),B.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
25
25
  .em-font-${B.fontFamilyArray[2].replace(/\s/g,"")}-${B.fontFamilyArray[3].replace(/\s/g,"")} { ${$} }`),setTimeout(()=>Ee({elem:B.elem}),0)},qe=B=>{B.settings.border.all?B.settings.border.all.width!=null&&(B.settings.border.all.style||B.settings.border.all.color)?(B.elem.style.borderWidth=B.settings.border.all.width+"px",B.elem.style.borderStyle=B.settings.border.all.style,B.elem.style.borderColor=B.settings.border.all.color):B.elem.style.removeProperty("border"):(B.settings.border.top&&(B.settings.border.top.width!=null&&(B.settings.border.top.style||B.settings.border.top.color)?(B.elem.style.borderTopWidth=B.settings.border.top.width+"px",B.elem.style.borderTopStyle=B.settings.border.top.style,B.elem.style.borderTopColor=B.settings.border.top.color):B.elem.style.removeProperty("border-top")),B.settings.border.right&&(B.settings.border.right.width!=null&&(B.settings.border.right.style||B.settings.border.right.color)?(B.elem.style.borderRightWidth=B.settings.border.right.width+"px",B.elem.style.borderRightStyle=B.settings.border.right.style,B.elem.style.borderRightColor=B.settings.border.right.color):B.elem.style.removeProperty("border-right")),B.settings.border.bottom&&(B.settings.border.bottom.width!=null&&(B.settings.border.bottom.style||B.settings.border.bottom.color)?(B.elem.style.borderBottomWidth=B.settings.border.bottom.width+"px",B.elem.style.borderBottomStyle=B.settings.border.bottom.style,B.elem.style.borderBottomColor=B.settings.border.bottom.color):B.elem.style.removeProperty("border-bottom")),B.settings.border.left&&(B.settings.border.left.width!=null&&(B.settings.border.left.style||B.settings.border.left.color)?(B.elem.style.borderLeftWidth=B.settings.border.left.width+"px",B.elem.style.borderLeftStyle=B.settings.border.left.style,B.elem.style.borderLeftColor=B.settings.border.left.color):B.elem.style.removeProperty("border-left")))},ct=B=>{B.settings.borderRadius.all?B.elem.style.borderRadius=B.settings.borderRadius.all+"px":B.settings.borderRadius.all===""?B.elem.style.removeProperty("border-radius"):(B.settings.borderRadius.topLeft?B.elem.style.borderTopLeftRadius=B.settings.borderRadius.topLeft+"px":B.settings.borderRadius.topLeft===""&&B.elem.style.removeProperty("border-top-left-radius"),B.settings.borderRadius.topRight?B.elem.style.borderTopRightRadius=B.settings.borderRadius.topRight+"px":B.settings.borderRadius.topRight===""&&B.elem.style.removeProperty("border-top-right-radius"),B.settings.borderRadius.bottomRight?B.elem.style.borderBottomRightRadius=B.settings.borderRadius.bottomRight+"px":B.settings.borderRadius.bottomRight===""&&B.elem.style.removeProperty("border-bottom-right-radius"),B.settings.borderRadius.bottomLeft?B.elem.style.borderBottomLeftRadius=B.settings.borderRadius.bottomLeft+"px":B.settings.borderRadius.bottomLeft===""&&B.elem.style.removeProperty("border-bottom-left-radius"))},Ze={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"},ut={"Sans Serif":"sans-serif",Serif:"serif"};function Bt(B){if(!B.elem.querySelector('style[em="styles"]')){let S=document.createElement("style");S.setAttribute("em","styles"),B.elem.append(S)}}return(0,t.jsxs)("div",{className:(0,Ve.default)("blocks-search",{is_search:r}),children:[(0,t.jsx)(o.ui_kit$Form,{className:(0,Ve.default)("blocks-search__form",{is_search:r}),form:_,layout:"vertical",name:"blocks_search_form",initialValues:{...Al},onValuesChange:ue,autoComplete:"off",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:kr,children:(0,t.jsx)(o.ui_kit$SearchInput,{placeholder:h("Search by title"),allowClear:!0,enterButton:!1})})}),(ce||G||je)&&(0,t.jsx)(o.ui_kit$Alert,{title:h("Error"),description:h("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),r&&!Xe&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:ge,children:h("All")},"search_All"),He.map(B=>(0,t.jsx)("li",{"data-type":B,onClick:ge,children:h(s.TYPES_TRANSLATE[B])},"search_"+B))]})}),(0,t.jsxs)("div",{ref:P,className:(0,Ve.default)("blocks-search__result-wrapper",{is_search:r}),children:[(i==="project"||r)&&(0,t.jsxs)(t.Fragment,{children:[!!me.length&&!r&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:ge,children:h("All")},"blocksSections_All"),me.map(B=>(0,t.jsx)("li",{"data-type":B,onClick:ge,children:h(s.TYPES_TRANSLATE[B])},"blocksSections_"+B))]})}),(0,t.jsxs)("div",{className:(0,Ve.default)("blocks-search__blocks-wrapper",{is_search:r}),ref:J,children:[(0,t.jsx)("div",{className:"blocks-search__result-holder project",children:!($e||Ce)&&(oe?.length?oe.map((B,S)=>{const p=xr(B.id,B.html);return(0,t.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"leftTop",menu:{items:j(B)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,t.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:$=>m($,B.html,"project",B.title,B),onDragStart:$=>f($,B.html,"project",B.title,B),onMouseEnter:()=>Ge({html:B.html,title:B.title}),onMouseLeave:Ye,children:[F(B),(0,t.jsx)(s.BlockPreviewShadow,{className:"blocks-search__result-html",html:p,onContentLoad:xe,style:{transform:`scale(${W})`}})]})},"commenMenu")},B.id+S.toString())}):!(le.tags||le.name||le.type)&&Ae&&!($e||Ce)&&!r&&(0,t.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,t.jsxs)("div",{style:{width:"110%"},children:[(0,t.jsx)("h3",{style:{lineHeight:"1.2"},children:h("You don`t have any saved blocks yet.")}),h("To add a block from the dashboard click the"),' "',h("Save to Blocks button."),'" ',(0,t.jsx)(s.EmIcons,{icon:"SaveBlock",component:o.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,t.jsx)("br",{}),(0,t.jsx)("br",{}),h("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,t.jsx)("br",{}),(0,t.jsx)("br",{}),(0,t.jsx)(o.ui_kit$Flex,{justify:"left",children:(0,t.jsx)(o.ui_kit$Button,{type:"primary",onClick:()=>l(!0),style:{cursor:"pointer"},children:h("Save all blocks")})})]}),(0,t.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,t.jsx)("img",{src:vm,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),($e||Ce)&&(0,t.jsx)(o.ui_kit$Skeleton,{active:!0})]})]}),r&&ie?.length>0&&I?.length>0&&(0,t.jsx)(o.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||r)&&(0,t.jsxs)(t.Fragment,{children:[!!Pe.length&&!r&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:ge,children:h("All")},"templateBlocksSections_All"),Pe.map(B=>(0,t.jsx)("li",{"data-type":B,onClick:ge,children:h(s.TYPES_TRANSLATE[B])},"templateBlocksSections_"+B))]})}),(0,t.jsxs)("div",{className:(0,Ve.default)("blocks-search__blocks-wrapper",{is_search:r}),ref:Z,children:[(0,t.jsxs)("div",{className:"blocks-search__result-holder template",children:[I&&!(re||ke)&&he?.length?(0,t.jsx)(t.Fragment,{children:he.map((B,S)=>{const p=xr(B.id,B.html);return(0,t.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,t.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:$=>m($,B.html,"template",B.title,B),onDragStart:$=>f($,B.html,"template",B.title,B),onMouseEnter:()=>Ge({html:B.html,title:B.title}),onMouseLeave:()=>Ye(),children:[F(B),(0,t.jsx)(s.BlockPreviewShadow,{className:"blocks-search__result-html",html:p,onContentLoad:xe,style:{transform:`scale(${W})`}})]})},B.id+S.toString())})}):!r&&!K&&!ke&&(0,t.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("No related blocks found.")})," "]}),(re||ke)&&(0,t.jsx)(o.ui_kit$Skeleton,{active:!0})]})]}),r&&I?.length>0&&Re?.length>0&&(0,t.jsx)(o.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||r)&&(0,t.jsxs)(t.Fragment,{children:[!!Ue?.length&&!r&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:ge,children:h("All")},"commonBlocksSections_All"),Ue.map(B=>(0,t.jsx)("li",{"data-type":B,onClick:ge,children:h(s.TYPES_TRANSLATE[B])},"commonBlocksSections_"+B))]})}),(0,t.jsxs)("div",{className:(0,Ve.default)("blocks-search__blocks-wrapper",{is_search:r}),ref:se,children:[(0,t.jsxs)("div",{className:"blocks-search__result-holder common",children:[we&&!!Le?.length&&!(ve||K)&&(0,t.jsx)(t.Fragment,{children:Le.map((B,S)=>{const p=M({html:xr(B.id,B.html)});return(0,t.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,t.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:$=>m($,M({html:B.html}),"common",B.title,B),onDragStart:$=>f($,M({html:B.html}),"common",B.title,B),onMouseEnter:()=>Ge({html:M({html:s.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+B.html+"</table>")}),title:B.title}),onMouseLeave:()=>Ye(),children:[F(B),(0,t.jsx)(s.BlockPreviewShadow,{className:"blocks-search__result-html",html:p,onContentLoad:xe,style:{transform:`scale(${W})`}})]})},B.id+S.toString())})})," "]}),(K||ve)&&(0,t.jsx)(o.ui_kit$Skeleton,{active:!0})]})]}),Xe&&(0,t.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("There are no blocks for this request.")})]})]})};Er.propTypes={};var Nl=({comments:e,subjectId:i,isLoggedIn:r,projectTitle:a="",emailElementType:l,email:n})=>{const{__:c,_n:m}=s.useI18n(),f=s.useSendPostMessage(),_=s.useNotification(),{token:k}=(0,o.ui_kit$useToken)(),b=s.useAppConfig(),h=s.usePushToDataLayer(),y=(0,d.useRef)(null),[x,E]=(0,d.useState)(""),[w,I]=(0,d.useState)("ADD"),[A,v]=(0,d.useState)(!1),[P,C]=(0,d.useState)(null),[Y,W]=(0,d.useState)(null),[F,N]=(0,d.useState)(""),[T,J]=(0,d.useState)(""),[Z,se]=(0,d.useState)(!1),[te,ne]=(0,d.useState)(""),[_e,le]=s.useAddCommentMutation(),[fe,Ae]=s.useDeleteCommentMutation(),[ce,$e]=s.useEditCommentMutation(),[Ce,ie]=s.useDeleteTargetMutation(),[Be]=s.useAutoSaveBlockMutation(),ae=s.useDispatch(),oe=s.useStore(),me=s.useCurrentUser(),de=s.useCurrentProjectRequested(),Q=s.useContentReader(),q=O=>{const xe=s.getEmailDocuments(De.getContainer(oe));xe.save("anchor",{project:O}).then(D=>{const ue=D?xe.revisionFacts()?.lastRevisionAt:void 0;ue!==void 0&&n?.id!=null&&ae(s.rememberAutosaveTime({emailId:n.id,modified:new Date(ue).toISOString()}))})},z=()=>{const O=de;if(l==="email"){q(O);return}const xe={...n?.meta!==void 0?{meta:n.meta}:{},title:n?.title,emailId:n?.id,project:O,html:Q(),excerpt:n?.date_gmt};Be({blockId:n?.id,body:xe}).catch(D=>{})};function G(O){se(!1),ne(""),f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:te}),v(!0),f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function re(){W(P),e.filter(O=>O.parent===P).length?ce({commentId:P,status:"deleted"}).unwrap():fe(P),document.querySelector('.discuss-main li[id="'+P+'"] .comment-icon-target')?.getAttribute("target-id")&&f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+P+'"] .comment-icon-target')?.getAttribute("target-id")}),z(),ne("")}function ke(O){W(P);const xe=e.find(ue=>ue.id?.toString()===P),D=xe?.target_id?.toString()||"";se(!!D),ne(D),J(xe?.content?.slice(3,-5)?.toString()),I("EDIT")}function he(O){W(P),N(""),I("REPLY")}const Pe=()=>{_.error({mask:{closable:!0},centered:!0,title:c("Please log in"),content:(s.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 "))+`${a}.`,okText:c("Okay. I'll log in.")})};async function ye(){r?(await ce({commentId:Y,content:T,targetId:te}).unwrap(),I("ADD"),J(""),W(0),se(!1),v(!1),ne(""),f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Pe()}const V=O=>{I("ADD"),J(""),W(0),se(!1),v(!1),ne(""),f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},ee=async()=>{r?((x||F)&&await _e({subjectId:i,author:me.id,parent:w==="ADD"?"0":Y,content:x||F,author_name:me.name,author_email:me.email,targetId:te}).then(O=>{O.error?_.error({title:O.error.data.code,description:O.error.data.message}):h({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:n?.id,project_id:n?.project,context:"editor"})}),ne(""),I("ADD"),N(""),E(""),W(0),se(!1),v(!1),f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Pe()};function we(){Z?(v(!1),se(!1),f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:te})):(v(!A),f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!A}),A&&se(!1))}function je(O){let xe=JSON.parse(JSON.stringify(O));if(!xe||!xe.length)return[];let D=[],ue=new Map;for(let ge=0,Oe=xe.length;ge<Oe;++ge){let Ge=xe[ge],Ye=ue.get(Ge.id);if((!Ye||Array.isArray(Ye))&&(Ye&&(Ge.children=Ye),ue.set(Ge.id,Ge)),String(Ge.parent)==="0")D.push(Ge);else{let Xe=ue.get(Ge.parent);Xe?(Array.isArray(Xe)?Xe:Xe.children=Xe.children||[]).push(Ge):ue.set(Ge.parent,[Ge])}}return D.forEach(ge=>{ge.status==="deleted"&&!ge.children&&(Ae.isUninitialized||Ae.isSuccess)&&fe(ge.id).unwrap().catch(Oe=>{})}),D}const K=O=>{const xe=O.data.operation;if(xe===s.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(ne(O.data.settings.value),O.data.settings.value!==""?(se(!0),v(!1)):(se(!1),v(!0))),xe===s.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&z(),xe===s.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+O.data.settings.targetId+'"]')){let D=document.querySelector('.comment-icon-target[target-id="'+O.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,D.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,D.offsetTop),D.classList.add("active"),setTimeout(()=>{D.classList.remove("active")},2e3)}else f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:O.data.settings.targetId}),_.error({title:c("There's no such comment.")});xe===s.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&_.error({title:c("There's no such element in the email.")})};s.useListenPostMessage(K);const ve=O=>{f({operation:s.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:O})},Re=O=>(O?.sort((xe,D)=>xe.date>D.date?1:-1),(0,t.jsx)(t.Fragment,{children:O&&!!O.length&&(0,t.jsx)(o.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:O,renderItem:xe=>(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("li",{id:xe.id,children:(0,t.jsxs)(t.Fragment,{children:[xe.status==="deleted"&&xe.clildren&&(0,t.jsx)(o.ui_kit$Comment,{className:"deletedComment",content:(0,t.jsx)(o.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Re(xe.children)}),xe.status!=="deleted"&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Comment,{author_id:xe.author_id,author:xe.author_name,avatar:xe.author_avatar_urls&&xe.author_avatar_urls[48]||"",className:(0,Ve.default)(xe.target_id&&"targetted-comment-item",(!xe.author_avatar_urls||!xe.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>C(xe.id),menu:{items:xe.author===me.id?Me:He},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,t.jsx)("div",{onClick:()=>xe.target_id&&ve(xe.target_id),dangerouslySetInnerHTML:{__html:xe.content}})},"commenMenu"),datetime:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:xe.date&&St.formatDate(St.tryParseISO(xe.date),m,!0)}}),xe.target_id&&(0,t.jsx)("span",{className:"comment-icon-target","target-id":xe.target_id,onClick:()=>ve(xe.target_id),children:(0,t.jsx)(s.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,t.jsxs)(t.Fragment,{children:[w==="REPLY"&&Y===xe.id&&Ue,w==="EDIT"&&Y===xe.id&&Le,Re(xe.children)]})})})]})})})})})),Le=(0,t.jsxs)(o.ui_kit$Form,{onFinish:ye,className:"commentForm",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{className:"textarea-reply",value:T,onChange:O=>J(O.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:O=>O.key==="Escape"&&V(),onPressEnter:O=>O.key==="Enter"&&O.ctrlKey&&ye(),ref:y})}),(0,t.jsx)(o.ui_kit$Form.Item,{className:"buttons",children:(0,t.jsxs)(o.ui_kit$Space,{children:[Z?(0,t.jsx)(o.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:G,children:(0,t.jsx)(o.ui_kit$Button,{loading:ie.isLoading,type:A||Z&&w==="EDIT"&&te!==""?"primary":"default",className:"button-target "+(A&&!Z?"button-target_choose":""),style:Z&&w==="EDIT"&&te!==""?{background:k.colorInfo}:{},children:(0,t.jsx)(s.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,className:"icon-target"})})}):(0,t.jsx)(o.ui_kit$Button,{onClick:we,loading:ie.isLoading,type:A||Z&&w==="EDIT"&&te!==""?"primary":"default",className:"button-target "+(A&&!Z?"button-target_choose":""),style:Z&&w==="EDIT"&&te!==""?{background:k.colorInfo}:{},children:(0,t.jsx)(s.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,className:"icon-target"})}),(0,t.jsxs)(o.ui_kit$Button,{className:"button-reply",type:"primary",loading:$e.isLoading,htmlType:"submit",children:[c("Save")," ",(0,t.jsx)(s.EmIcons,{icon:"SaveOutlined",component:o.icons$SaveOutlined,size:16,strokeWidth:b.iconStrokeWidth})]}),(0,t.jsx)(o.ui_kit$Button,{onClick:V,className:"button-reply",children:c("Cancel")})]})})]}),Ue=(0,t.jsxs)(o.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:ee,children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{className:"textarea-reply",value:F,onChange:O=>N(O.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:O=>O.key==="Escape"&&V(),onPressEnter:O=>O.key==="Enter"&&O.ctrlKey&&ee(),ref:y})}),(0,t.jsx)(o.ui_kit$Form.Item,{hidden:!0,name:"targetId",children:(0,t.jsx)(o.ui_kit$Input,{type:"hidden"})}),(0,t.jsx)(o.ui_kit$Form.Item,{className:"buttons",children:(0,t.jsxs)(o.ui_kit$Space,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,t.jsx)(o.ui_kit$Button,{onClick:we,type:A||Z&&w==="REPLY"&&te!==""?"primary":"default",className:"button-target "+(A&&!Z?"button-target_choose":""),style:Z&&w==="REPLY"&&te!==""?{background:k.colorInfo}:{},children:(0,t.jsx)(s.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,className:"icon-target"})})}),(0,t.jsxs)(o.ui_kit$Button,{className:"button-reply",type:"primary",loading:w==="REPLY"&&le.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,t.jsx)(s.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]}),(0,t.jsx)(o.ui_kit$Button,{onClick:V,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,d.useEffect)(()=>{w==="REPLY"&&y.current.focus({cursor:"start"}),w==="EDIT"&&y.current.focus({cursor:"end"})},[w]);let Me=[];Me.push({key:"Reply to comment",icon:(0,t.jsx)(s.EmIcons,{icon:"RollbackOutlined",component:o.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:he},{key:"Edit comment",icon:(0,t.jsx)(s.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:ke},{key:"Delete comment",icon:(0,t.jsx)(s.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:k.colorError},onClick:re});let He=[];return He.push({key:"Reply to comment",icon:(0,t.jsx)(s.EmIcons,{icon:"RollbackOutlined",component:o.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:he}),(0,t.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,t.jsx)(o.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:je(e),renderItem:O=>(0,t.jsxs)("li",{id:O.id,children:[O.comment_status==="deleted"&&(0,t.jsx)(o.ui_kit$Comment,{className:"deletedComment",content:(0,t.jsx)(o.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Re(O.children)}),O.comment_status!=="deleted"&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Comment,{author_id:O.author_id,author:O.author_name,avatar:O.author_avatar_urls&&O.author_avatar_urls[48]||"",className:(0,Ve.default)(O.target_id&&"targetted-comment-item",(!O.author_avatar_urls||!O.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>C(O.id),menu:{items:O.author===me.id?Me:He},styles:{root:{minWidth:"auto"}},children:(0,t.jsx)("div",{onClick:()=>O.target_id&&ve(O.target_id),dangerouslySetInnerHTML:{__html:O.content}})},"commenMenu"),datetime:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:O.date&&St.formatDate(St.tryParseISO(O.date),m,!0)}}),O.target_id&&(0,t.jsx)("span",{className:"comment-icon-target","target-id":O.target_id,onClick:()=>ve(O.target_id),children:(0,t.jsx)(s.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,t.jsxs)(t.Fragment,{children:[w==="REPLY"&&Y===O.id&&Ue,w==="EDIT"&&Y===O.id&&Le,Re(O.children)]})})})]})}),(0,t.jsxs)(o.ui_kit$Form,{onFinish:ee,className:w==="ADD"?"addMode":"replyEditMode",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{value:x,onChange:O=>E(O.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:O=>O.key==="Enter"&&O.ctrlKey&&ee()})}),(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,t.jsx)(o.ui_kit$Button,{onClick:we,type:A||Z&&w==="ADD"&&te!==""?"primary":"default",className:"button-target "+(A&&!Z?"button-target_choose":""),style:Z&&w==="ADD"&&te!==""?{background:k.colorInfo}:{},icon:(0,t.jsx)(s.EmIcons,{icon:"Target",component:o.icons$Target,size:16,strokeWidth:b.iconStrokeWidth,className:"icon-target"})})}),(0,t.jsxs)(o.ui_kit$Button,{className:"button-add",type:"primary",loading:w==="ADD"&&le.isLoading,htmlType:"submit",children:[c("Send")," ",(0,t.jsx)(s.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]})]})})]})]})},Pm=["common_styles","subject","preheader","meta"];function Am(e,i){s.writeSourceReport(e,s.fromRevision(i))}function Nm(e){if(!e)return null;const i=e.get().attributes??{},r={};for(const a of Pm)i[a]!==void 0&&(r[a]=i[a]);return{content:e.getContent(),attributes:r}}function Ll(e,i){i&&s.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var Br=({emailElement:e})=>{const{__:i}=s.useI18n(),r=s.useSendPostMessage(),a=s.useDispatch(),l=s.useEditorProjectId(),n=s.useEmailAttributesWriter(),c=s.useContentReplacer(),{document:m}=s.useDocumentSessionContext(),f=s.useSelector(s.selectHistoryData),_=s.useDocumentHistoryReader(),k=s.useSelector(s.selectElementHistoryHasMore),b=s.useSelector(s.selectIsPanelHistoryCollapsed),[h,y]=(0,d.useState)(!0),[x,E]=(0,d.useState)(!1),[w,I]=(0,d.useState)([]),[A,v]=(0,d.useState)([]),P=Ce=>a(s.switchIsPanelHistoryCollapsed(Ce)),C=(0,d.useCallback)(Ce=>{if(!Ce?.html)return;const ie=s.fromRevision(Ce);ie?.attributes&&n(ie.attributes),a(s.markAppearanceNeedsUpdate()),c(Ce.html,{undoable:!0})},[c,a,n]),Y=(0,d.useCallback)(Ce=>{Am(m,Ce),a(s.markAppearanceNeedsUpdate())},[m,a]),{data:W}=s.projectsApi.useGetProjectQuery(Number(l),{skip:!l}),[F,N]=(0,d.useState)([]);(0,d.useEffect)(()=>{if(W){const{owner:Ce,admins:ie,users:Be}=W?.members;N([Ce&&{...Ce},ie&&Array.isArray(ie)&&ie.map(ae=>({...ae})),Be&&Array.isArray(Be)&&Be.map(ae=>({...ae}))].filter(ae=>ae).flat(1).map(ae=>({id:ae.ID,display_name:ae.display_name})))}},[W,W?.members,i]);const[T,J]=(0,d.useState)(1),[Z,se]=(0,d.useState)(!1);(0,d.useEffect)(()=>{const Ce=Array.isArray(f)&&f.length&&f?.map(ie=>({key:ie.id,author:ie.author,date:St.formatDate(St.tryParseISO(ie.date||ie.modified),i),title:ie.title,html:ie.html,common_styles:ie.common_styles,loading:!1,isAutosave:ie.slug?.includes("autosave")}));v(Ce||[]),I(Ce),y(!1),k||se(!0)},[f,k,i]);const te=()=>{E(!0),v(w.concat([...new Array(3)].map(()=>({loading:!0})))),_(e.id,T+1).then(Ce=>{const{data:ie,hasMore:Be}=Ce.data,ae=Array.isArray(ie)&&ie?.map(me=>({key:me.id,author:me.author,date:St.formatDate(St.tryParseISO(me.date||me.modified),i),title:me.title,html:me.html,loading:!1})),oe=w.concat(ae);v(oe),I(oe),E(!1),window.dispatchEvent(new Event("resize")),Be||se(!0),J(T+1)})},ne=!h&&!x&&!Z?(0,t.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,t.jsx)(o.ui_kit$Button,{onClick:te,children:i("loading more")})}):null,[_e,le]=(0,d.useState)(),[fe,Ae]=(0,d.useState)(null),ce=(0,d.useCallback)(Ce=>{C(Ce),le(null),Ae(null),r({operation:s.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),a(s.resetToLastActiveSettingsTab())},[C,r,a]);(0,d.useEffect)(()=>{!b&&!fe&&Ae(Nm(m))},[b,Ae,m,fe]),(0,d.useEffect)(()=>{b&&fe&&(Ll(m,fe),a(s.markAppearanceNeedsUpdate()),Ae(null))},[b,fe,m,a]);const $e=s.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse secondary-tabs_unset_scroll",size:"large",activeKey:s.HISTORY,items:[{label:(0,t.jsx)(t.Fragment,{children:i("Version history")}),key:s.HISTORY,forceRender:!0,className:"email-settings__collapse-panel",style:{height:"100%"},children:(0,t.jsx)(o.ui_kit$List,{className:"history-panel__list",loading:h,itemLayout:"horizontal",loadMore:ne,dataSource:A,header:(0,t.jsxs)("div",{className:"history-panel__list-header",children:[(0,t.jsx)("div",{className:"history-panel__list-date",children:i("Time")}),(0,t.jsx)("div",{className:"history-panel__list-author",children:i("Author")}),(0,t.jsx)("div",{className:"history-panel__restore",children:"Set"})]}),renderItem:(Ce,ie)=>(0,t.jsx)(o.ui_kit$List.Item,{onClick:()=>{ie!==_e&&(le(ie),Y(w[ie])),a(s.setBlockSettingsDisable(!0))},className:(0,Ve.default)("history-panel__item",{"history-panel__item_active":ie===_e}),children:(0,t.jsxs)(o.ui_kit$Skeleton,{title:!1,loading:Ce.loading||!1,active:!0,children:[(0,t.jsx)("div",{className:"history-panel__list-date",children:Ce.date}),(0,t.jsx)("div",{className:"history-panel__list-author",children:$e.revisionService?Ce.author:F.find(Be=>Be.id?.toString()===Ce.author?.toString())?.display_name||"–"}),Ce.isAutosave&&_e!==ie&&(0,t.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!Ce.isAutosave&&(0,t.jsx)(o.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",onClick:Be=>{_e===ie&&Be.stopPropagation(),ce(w[ie])},children:i("Set")}),Ce.isAutosave&&_e===ie&&(0,t.jsx)(o.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",onClick:Be=>{_e===ie&&Be.stopPropagation(),ce(w[ie])},children:i("Set")})]})})})}]}),(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{a(s.resetToLastActiveSettingsTab()),fe&&Ll(m,fe),Ae(null),P(!0),r({operation:s.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,t.jsx)(s.EmIcons,{icon:"Close",component:o.icons$Close})})]})};Br.propTypes={};var Ol=async({blockTags:e,projectTagsArray:i,addTerm:r,project:a,notification:l})=>{if(!e||e.length===0)return[];const n=e.map(c=>{const m=i.find(f=>f.name===c);return m?Promise.resolve(m.id):r({project:a,kind:s.BLOCK_TAGS,name:c}).then(({error:f,data:_})=>{if(f?.status===400)return s.existingTermIdFromError(f);if(_)return _.id;if(f)return l.fromError("TAG_CREATING_ERROR",c,f),null})});return(await Promise.all(n)).filter(c=>c!=null)},Fl=()=>{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/640+"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))},Lm=async e=>{const{block:i,form:r,projectData:a,projectTagsArray:l,projectId:n,addBlock:c,editBlock:m,editProject:f,addTerm:_,notification:k,__:b,handleCloseModal:h,htmlContent:y,refetchBlocks:x,reloadBlockScreens:E,onGlobalBlockTemplateSynced:w}=e;try{const{valid:I,values:A,blockTags:v}=await $l({form:r,notification:k,__:b});if(!I)return;const P=await Ol({blockTags:v,projectTagsArray:l,addTerm:_,project:a,notification:k});await Dl({block:i,form:r,projectId:n,htmlContent:y,values:A,tagIds:P,addBlock:c,editBlock:m,editProject:f,notification:k,refetchBlocks:x,reloadBlockScreens:E,projectTagsArray:l,__:b,handleCloseModal:h,onGlobalBlockTemplateSynced:w})}catch{}},$l=async({form:e,notification:i,__:r})=>{let a=!0;const l=await e.validateFields(),n=l.tags;return n?.length>10&&(i.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:s.getBlockDesc(l),title:r("Maximum 10 tags available.")}),a=!1),{valid:a,values:l,blockTags:n}};function Ml(e){if(e!==null&&typeof e=="object"&&"data"in e){const i=e.data;return{code:i?.code,message:i?.message}}return{}}async function Om(e){const{created:i,blockData:r,editBlock:a,onGlobalBlockTemplateSynced:l}=e;if(!i.id)return;const n=new Date,c=s.formatEmBlockVersion(n);if(a){const m=i.html??r.html??"",f=s.injectEmBlockIdIntoBlockHtml(m,String(i.id),n);f!==m&&await a({blockId:String(i.id),html:f})}l?.(String(i.id),c)}function Fm(e){const{block:i,projectId:r,htmlContent:a,values:l}=e;return i?{title:i.blockTitle,project:i.projectId,html:i.htmlContent,type:i.blockType||"Other",global_block:!1}:{title:l?.title??"",project:r,html:a||"",type:l?.type||"Other",...l?.global_block===!0?{global_block:!0}:{}}}var Dl=async({block:e,form:i,projectId:r,htmlContent:a,values:l,tagIds:n,addBlock:c,editBlock:m,editProject:f,notification:_,refetchBlocks:k,reloadBlockScreens:b,projectTagsArray:h,__:y,handleCloseModal:x,onGlobalBlockTemplateSynced:E})=>{const w=Fm({block:e,projectId:r,htmlContent:a,values:l}),I=await c({...w,blocktags:n.join(",")});if(I.error){const C=Ml(I.error);throw _.error({id:"BLOCK_CREATING_ERROR",data:{title:w.title,code:w.html},innerException:I.error,message:C.code,description:C.message}),i.resetFields(),x(),new Error("Ошибка создания блока")}const A=I.data;!e&&l?.global_block===!0&&A?.id&&await Om({created:A,blockData:w,editBlock:m,onGlobalBlockTemplateSynced:E}),e||(i.resetFields(),x());const v=h.map(C=>C.id),P=await f({projectId:r,blocktags:[...new Set([...v,...n])].join(",")});if(P.error){const C=Ml(P.error);_.error({message:C.message,code:C.code})}else!e&&k&&(_.success({id:"BLOCK_CREATING_SUCCESS",data:s.getBlockDesc(I.data),message:y("The block “")+String(I.data?.title??"")+y("” was successfully created.")}),k());return!e&&b&&b(),I.data},Tr=({isModalVisible:e,htmlContent:i,projectId:r,setIsShowAddAllBlocksModal:a,setIsShowAddAllBlocksModalForNewEmail:l})=>{const{__:n}=s.useI18n(),c=s.useDispatch(),[m]=o.ui_kit$Form.useForm(),[f,_]=(0,d.useState)([]),[k,b]=s.useAddBlockMutation(),[h]=s.useEditBlockMutation(),{data:y}=s.useGetBlocksSchemaQuery(),x=s.useNotification(),E=s.useAppConfig(),[w,I]=(0,d.useState)([]),A=s.useProjectData(),{refetch:v}=s.useGetBlocksQuery(s.projectBlocksArgs(r)),[P,C]=s.useAddTermMutation(),[Y,W]=s.useEditProjectMutation(),F=s.useSendPostMessage(),N=(0,d.useCallback)((te,ne)=>{F({operation:s.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:te,...ne?{emBlockVersion:ne}:{}}})},[F]),{data:T}=s.useGetTermsQuery({project:A,kind:s.BLOCK_TAGS},{skip:!A?.id});(0,d.useEffect)(()=>{I((T||[]).map(te=>({value:te.name})))},[T]),(0,d.useEffect)(()=>{if(y){const te=y.schema.properties.acf.properties.type.items.enum;let ne=[];for(let _e in te)ne.push({label:n(s.TYPES_TRANSLATE[te[_e]]),value:te[_e]});_(ne)}},[y,n]);const J=()=>{c(s.closeModal())},Z=()=>{a(!0),l(!1),J()},se=async()=>{await Lm({form:m,projectData:A,projectTagsArray:T||[],projectId:r,addBlock:k,editBlock:h,editProject:Y,addTerm:P,notification:x,__:n,handleCloseModal:J,htmlContent:i,refetchBlocks:v,reloadBlockScreens:Fl,onGlobalBlockTemplateSynced:N})};return(0,t.jsx)(o.ui_kit$Modal,{title:(0,t.jsx)("div",{className:"ant-modal-title",children:n("Save block")}),open:e,onOk:()=>Z(),onCancel:J,footer:(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"8px 0"},children:[(0,t.jsx)(o.ui_kit$Button,{size:"large",onClick:Z,children:n("Save all blocks")},"create-all-blocks"),(0,t.jsx)(o.ui_kit$Button,{className:"add-new-block-modal__save-btn",size:"large",type:"primary",loading:b.isLoading,onClick:se,icon:(0,t.jsx)(s.EmIcons,{icon:"CreateBlock",component:o.icons$CreateBlock,style:{fontSize:22}}),children:n("Save block")},"submit")]}),children:(0,t.jsxs)(o.ui_kit$Form,{form:m,layout:"vertical",name:"add_new_block_form",onFinish:se,initialValues:{title:"",type:"",tags:[],global_block:!1},autoComplete:"off",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:16,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:n("Block name"),name:"title",rules:[{required:!0,message:n("Please input block name")}],style:{marginBottom:15},children:(0,t.jsx)(o.ui_kit$Input,{disabled:b.isLoading||C.isLoading||W.isLoading,size:"large",placeholder:n("Enter block name"),spellCheck:"false"})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:n("Type"),name:"type",rules:[{required:!0,message:n("Please choose block type")}],style:{marginBottom:15},children:(0,t.jsx)(o.ui_kit$Select,{disabled:b.isLoading||C.isLoading||W.isLoading,size:"large",placeholder:n("Choose block type"),options:f})})})]}),E.tagsEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:n("Tags"),name:"tags",children:(0,t.jsx)(o.ui_kit$Select,{size:"large",mode:"tags",placeholder:n("Add some tags"),tooltip:{title:n("Tags help you find the block in the list."),icon:(0,t.jsx)(s.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},disabled:b.isLoading||C.isLoading||W.isLoading,options:w})}),E.globalBlockCheckboxEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{name:"global_block",valuePropName:"checked",style:{marginBottom:15},children:(0,t.jsx)(o.ui_kit$Switch,{label:n("Global block"),disabled:b.isLoading||C.isLoading||W.isLoading})})]})})};Tr.propTypes={};var $m="https://app.useblocks.io/api".replace(/\/+$/,""),Mm=`${$m}/wp-json/ai-generator/v1/identificate_blocks`,Dm=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function Vm(e){return await e.getInstance(De.TOKEN_ID)}async function Um(e,i,r,a,l){const n={blocks:a,types:Dm,locale:i};r.current=n;try{const c=await Vm(l),m=await fetch(Mm,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(n)});if(!m.ok||m.status!==200)throw new Error(`${m.statusText}`);return await m.json()}catch(c){throw c}}var Hm=(e,i="block")=>{const r=new DOMParser,a=r.parseFromString(e,"text/html"),l=a.querySelectorAll(`[em="${i}"]`),n=a.querySelectorAll("link");return{parser:r,document:a,blockElements:l,styleElement:a.querySelector('[em="styles"]'),linksElements:n}};function Wm(e){return Array.from(e).map(i=>i.outerHTML).join("")}var zm=(e,i="block",r=!1)=>{if(!e?.html)return[];const{document:a,blockElements:l,styleElement:n,linksElements:c}=Hm(e.html,i),m=Wm(c);if(!(l instanceof NodeList))return[];const f=a.querySelector("head"),_=f?f.innerHTML:"";return Array.from(l).map((k,b)=>{if(!(k instanceof Element)||!k.outerHTML)return null;const h=n?n.outerHTML:"";return{id:`${e.id}-${b}`,html:r?`<!DOCTYPE html>
26
26
  <html>
27
27
  <head>${_}</head>