diff --git a/build/Automation_Rules/assets/css/style-automation-rule-editor.css b/build/Automation_Rules/assets/css/style-automation-rule-editor.css index 3b0f851d..08c57865 100644 --- a/build/Automation_Rules/assets/css/style-automation-rule-editor.css +++ b/build/Automation_Rules/assets/css/style-automation-rule-editor.css @@ -1 +1 @@ -.noptin-email-campaigns__editor--add-new__button{float:left}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:left;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image{height:auto;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%}.components-base-control__field{max-width:600px} +.noptin-email-campaigns__editor--add-new__button{float:left}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:left;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image-wrapper{flex-grow:1;max-height:300px;width:100%}.noptin-selectable-card .noptin-template-preview__image{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%}.components-base-control__field{max-width:600px} diff --git a/build/Automation_Rules/assets/css/style-automation-rules.css b/build/Automation_Rules/assets/css/style-automation-rules.css index 75be8b12..f5be0184 100644 --- a/build/Automation_Rules/assets/css/style-automation-rules.css +++ b/build/Automation_Rules/assets/css/style-automation-rules.css @@ -1 +1 @@ -.noptin-email-campaigns__editor--add-new__button{float:left}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:left;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image{height:auto;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%}.noptin-automation-rules__editor--add-new__button{float:left}@media screen and (max-width:782px){.noptin-automation-rules__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-automation-rules__editor--add-new__button .components-button{height:30px}}.noptin-fade-out{opacity:.3;transition:opacity 1s ease-out}.noptin-toggle-button .components-toggle-control__label{display:none}#noptin-automation-rules-table td{vertical-align:middle}@media screen and (min-width:960px){#noptin-automation-rules-table .column-created_at,#noptin-automation-rules-table .column-times_run,#noptin-automation-rules-table .column-updated_at{width:100px}#noptin-automation-rules-table .column-actions{text-align:right;width:160px}}#noptin-automation-rules-table .noptin-rule-action,#noptin-automation-rules-table .noptin-rule-trigger{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}#noptin-automation-rules-table .noptin-rule-name{flex:1;font-weight:600}#noptin-automation-rules-table .noptin-rule-name .noptin-rule-description{color:#646970;font-weight:400;margin-top:.5rem}#noptin-automation-rules-table .noptin-rule-name .row-actions{font-weight:400}#noptin-automation-rules-table .noptin-rule-image{align-items:center;border-radius:50%;display:flex;height:40px;justify-content:center;width:40px}#noptin-automation-rules-table .noptin-rule-image img{border-radius:4px;height:auto;max-height:100%;-o-object-fit:cover;object-fit:cover;width:100%}#noptin-automation-rules-table .noptin-rule-image .dashicons{font-size:40px;height:40px;width:40px}#noptin-automation-rules-table .noptin-rule-meta{display:block;margin-bottom:.4rem}#noptin-automation-rules-table .noptin-rule-meta:last-child{margin-bottom:0}#noptin-automation-rules-table .noptin-rule-meta.noptin-rule-meta__delay{color:green;font-weight:700}#noptin-automation-rules-table .noptin-rule-meta.noptin-rule-meta__delay .noptin-rule-meta-key{font-weight:700}#noptin-automation-rules-table .noptin-rule-meta-key{font-weight:600}#noptin-automation-rules-table .noptin-rule-error{color:#b32d2e;display:block;margin-top:.8rem} +.noptin-email-campaigns__editor--add-new__button{float:left}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:left;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image-wrapper{flex-grow:1;max-height:300px;width:100%}.noptin-selectable-card .noptin-template-preview__image{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%}.noptin-automation-rules__editor--add-new__button{float:left}@media screen and (max-width:782px){.noptin-automation-rules__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-automation-rules__editor--add-new__button .components-button{height:30px}}.noptin-fade-out{opacity:.3;transition:opacity 1s ease-out}.noptin-toggle-button .components-toggle-control__label{display:none}#noptin-automation-rules-table td{vertical-align:middle}@media screen and (min-width:960px){#noptin-automation-rules-table .column-created_at,#noptin-automation-rules-table .column-times_run,#noptin-automation-rules-table .column-updated_at{width:100px}#noptin-automation-rules-table .column-actions{text-align:right;width:160px}}#noptin-automation-rules-table .noptin-rule-action,#noptin-automation-rules-table .noptin-rule-trigger{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}#noptin-automation-rules-table .noptin-rule-name{flex:1;font-weight:600}#noptin-automation-rules-table .noptin-rule-name .noptin-rule-description{color:#646970;font-weight:400;margin-top:.5rem}#noptin-automation-rules-table .noptin-rule-name .row-actions{font-weight:400}#noptin-automation-rules-table .noptin-rule-image{align-items:center;border-radius:50%;display:flex;height:40px;justify-content:center;width:40px}#noptin-automation-rules-table .noptin-rule-image img{border-radius:4px;height:auto;max-height:100%;-o-object-fit:cover;object-fit:cover;width:100%}#noptin-automation-rules-table .noptin-rule-image .dashicons{font-size:40px;height:40px;width:40px}#noptin-automation-rules-table .noptin-rule-meta{display:block;margin-bottom:.4rem}#noptin-automation-rules-table .noptin-rule-meta:last-child{margin-bottom:0}#noptin-automation-rules-table .noptin-rule-meta.noptin-rule-meta__delay{color:green;font-weight:700}#noptin-automation-rules-table .noptin-rule-meta.noptin-rule-meta__delay .noptin-rule-meta-key{font-weight:700}#noptin-automation-rules-table .noptin-rule-meta-key{font-weight:600}#noptin-automation-rules-table .noptin-rule-error{color:#b32d2e;display:block;margin-top:.8rem} diff --git a/build/Automation_Rules/assets/js/automation-rule-editor.asset.php b/build/Automation_Rules/assets/js/automation-rule-editor.asset.php index b672a2ad..8a056b73 100644 --- a/build/Automation_Rules/assets/js/automation-rule-editor.asset.php +++ b/build/Automation_Rules/assets/js/automation-rule-editor.asset.php @@ -1 +1 @@ - array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-url'), 'version' => 'cb6096e9693d53184b8a'); + array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-url'), 'version' => '2fab91412005bdb1cbf5'); diff --git a/build/Automation_Rules/assets/js/automation-rule-editor.js b/build/Automation_Rules/assets/js/automation-rule-editor.js index 6426800e..11ad1a26 100644 --- a/build/Automation_Rules/assets/js/automation-rule-editor.js +++ b/build/Automation_Rules/assets/js/automation-rule-editor.js @@ -36,4 +36,4 @@ `,Ct=bt.div` direction: ltr; display: flex; -`,St=({value:e,onChange:t,...n})=>{const{baseControlProps:a,controlProps:o}=(0,i.useBaseControlProps)(n),l=e?e.split(":"):["07","00"],[c,u]=(0,r.useState)(l[0]),[m,p]=(0,r.useState)(l[1]),d=(e,t="00")=>(e=Number(e),isNaN(e)?t:e<10?`0${e}`:e),f=`${d(c)}:${d(m)}`;return(0,r.useEffect)((()=>{e!==f&&t(f)}),[f]),(0,r.createElement)(i.BaseControl,{...a},(0,r.createElement)(i.__experimentalHStack,null,(0,r.createElement)(Ct,null,(0,r.createElement)(wt,{value:d(c),onChange:u,min:0,max:23,step:1,...o,label:(0,s.__)("Hours"),spinControls:"none",isDragEnabled:!1,isShiftStepEnabled:!1,isPressEnterToChange:!0,hideLabelFromVision:!0,__next40pxDefaultSize:!0,__unstableStateReducer:yt(2)}),(0,r.createElement)(Et,{"aria-hidden":"true"},":"),(0,r.createElement)(kt,{value:d(m),onChange:p,min:0,max:59,step:1,label:(0,s.__)("Minutes"),spinControls:"none",isDragEnabled:!1,isShiftStepEnabled:!1,isPressEnterToChange:!0,hideLabelFromVision:!0,__next40pxDefaultSize:!0,__unstableStateReducer:yt(2)})),(0,r.createElement)(xt,null)))},At=[{label:(0,s.__)("Only run if","newsletter-optin-box"),value:"allow"},{label:(0,s.__)("Do not run if","newsletter-optin-box"),value:"prevent"}],Tt=[{label:(0,s.__)("all","newsletter-optin-box"),value:"all"},{label:(0,s.__)("any","newsletter-optin-box"),value:"any"}];function Pt(e,t){return(0,r.useMemo)((()=>[{label:t,value:"",disabled:!0},...e]),[e,t])}function Mt({type:e,action:t,ruleCount:n,setConditionalLogicAttribute:a}){const o=n>1;return(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0},(0,r.createElement)(i.SelectControl,{label:(0,s.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"allow",options:At,onChange:e=>a("action",e),size:"default",__nextHasNoMarginBottom:!0}),o&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.SelectControl,{label:(0,s.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:e||"all",options:Tt,onChange:e=>a("type",e),size:"default",__nextHasNoMarginBottom:!0}),(0,r.createElement)(i.__experimentalText,null,(0,s.__)("of the following rules are true:","newsletter-optin-box"))))}function Ot({rule:e,comparisons:t,availableSmartTags:n,mergeTagsArray:a,index:o,updateRule:l,removeRule:c}){var u;const m=e=>l(o,{value:e}),p=null!==(u=e.full)&&void 0!==u?u:e.type?`[[${e.type}]]`:"",d=p.indexOf("]]"),f=p.indexOf("[[",d),g=-1===d||-1!==f&&f>d,_=e=>{const t={full:e};if(e){const n=e.match(/\[\[([^\s\]]+)/)?.[1]||"";n&&(t.type=n.replace("[[","").replace("]]",""))}l(o,t)},h=Ut({availableSmartTags:a,onMergeTagClick:e=>{_(p?`${p} ${e}`.trim():e)}}),b=Ut({availableSmartTags:a,onMergeTagClick:t=>{m(e.value?`${e.value} ${t}`.trim():t)}}),y=(0,r.useMemo)((()=>{const t=e.type;if(void 0!==n[t])return n[t];const r=t.replace("_",".",1);if(void 0!==n[r])return n[r];for(const[e,r]of Object.entries(n)){if(-1!==e.indexOf(".")&&e.split(".").slice(1).join(".")===t)return r;const n=e=>Array.isArray(e)?e:e.split(/[\s,]+/);if(r.deprecated&&n(r.deprecated).includes(t))return r}return null}),[e.type,n]),v=Pt((x=y?.options,(0,r.useMemo)((()=>x?Array.isArray(x)?x.map(((e,t)=>({label:e,value:t}))):Object.keys(x).map((e=>({label:x[e],value:e}))):[]),[x])),(0,s.__)("Select a value","newsletter-optin-box"));var x;const E=!g&&v.length>1,w=g?"string":y?.conditional_logic||"string",k=Pt((0,r.useMemo)((()=>{const e=[];return Object.keys(t).forEach((n=>{let r=t[n].type;if(E){if("string"===w&&"is"!=n&&"is_not"!=n)return;if("is_empty"===n||"is_not_empty"===n||"is_between"===n)return}"any"!==r&&r!=w||e.push({label:t[n].name,value:n})})),e}),[w,t]),(0,s.__)("Select a comparison","newsletter-optin-box")),C="is_empty"===e.condition||"is_not_empty"===e.condition;return(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0,expanded:!0},(0,r.createElement)("div",{style:{minWidth:320}},(0,r.createElement)(i.__experimentalInputControl,{type:"text",label:(0,s.__)("Smart Tag","newsletter-optin-box"),hideLabelFromVision:!0,placeholder:(0,s.__)("Enter a smart tag","newsletter-optin-box"),value:p,onChange:_,autoComplete:"off",suffix:h,__next40pxDefaultSize:!0})),(0,r.createElement)("div",{style:{width:150}},(0,r.createElement)(i.SelectControl,{label:(0,s.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:e.condition?e.condition:"is",options:k,onChange:e=>l(o,{condition:e}),size:"default",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})),!C&&(0,r.createElement)("div",{style:{minWidth:320}},E&&(0,r.createElement)(i.SelectControl,{label:(0,s.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:e.value?e.value:"",options:v,onChange:m,size:"default",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),!E&&(0,r.createElement)(i.__experimentalInputControl,{type:"number"===w?"number":"text",label:(0,s.__)("Value","newsletter-optin-box"),placeholder:(0,s.__)("Enter a value","newsletter-optin-box"),hideLabelFromVision:!0,value:e.value?e.value:"",onChange:m,suffix:b,__next40pxDefaultSize:!0})),(0,r.createElement)(i.Button,{onClick:()=>c(o),icon:"trash",variant:"tertiary",isDestructive:!0}))}function Nt({rules:e,comparisons:t,availableSmartTags:n,setConditionalLogicAttribute:a,disableTags:o,disableProps:l,closeModal:c}){const u=(0,r.useMemo)((()=>Array.isArray(e)?e.filter((e=>e.type&&""!==e.type)):[]),[e]),m=(0,r.useMemo)((()=>{const e={};return n.forEach((t=>{t.conditional_logic&&(e[t.smart_tag]={...t,key:t.smart_tag,type:t.conditional_logic,isPremium:Array.isArray(o)&&o.some((e=>t.smart_tag.startsWith(e)))||Array.isArray(l)&&l.some((e=>!!t[e]))})})),e}),[n]),p=(0,r.useCallback)((e=>{const t=[...u];t.splice(e,1),a("rules",t)}),[u,a]),d=(0,r.useCallback)(((e,t)=>{const n=[...u];n[e]={...n[e],...t},a("rules",n)}),[u,a]),f=(0,r.useMemo)((()=>Object.values(m)),[m]),g=(0,r.useCallback)(((e,t)=>{const n=m[e],r=n?.options||[],o=n?.placeholder||"";let l=Array.isArray(r)&&r.length?Object.keys(r)[0]:o;n?.default&&(l=n.default);const i=[...u];i.push({type:e,condition:"is",full:t,value:l}),a("rules",i)}),[u]),_=0===u.length?(0,s.__)("Add a conditional logic rule","newsletter-optin-box"):(0,s.__)("Add another rule","newsletter-optin-box"),h=Ut({availableSmartTags:f,onMergeTagClick:g,raw:!0,icon:"plus",label:_,text:_,toggleProps:{variant:"primary"}});return(0,r.createElement)(r.Fragment,null,u.map(((e,n)=>(0,r.createElement)(Ot,{key:n,rule:e,index:n,updateRule:d,removeRule:p,comparisons:t,availableSmartTags:m,mergeTagsArray:f}))),(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0},h,c&&(0,r.createElement)(i.Button,{onClick:c,variant:"secondary"},(0,s.__)("Return to editor","newsletter-optin-box"))))}function Bt({onChange:e,value:t,comparisons:n,toggleText:a,availableSmartTags:o,className:l,inModal:c=!1,...u}){const[m,p]=(0,r.useState)(!1),d=(0,r.useMemo)((()=>"object"!=typeof t?{enabled:!1,action:"allow",rules:[],type:"all"}:t),[t]),f=(0,r.useCallback)(((t,n)=>{e({...d,[t]:n})}),[e,d]),g=(0,r.createElement)(i.__experimentalVStack,{spacing:5},(0,r.createElement)(Mt,{ruleCount:Array.isArray(d.rules)?d.rules.length:0,type:d.type,action:d.action,setConditionalLogicAttribute:f}),(0,r.createElement)(Nt,{rules:d.rules,comparisons:n,availableSmartTags:o,setConditionalLogicAttribute:f,closeModal:c&&(()=>p(!1)),...u}));return(0,r.createElement)(i.__experimentalVStack,{spacing:5,className:l},(0,r.createElement)(i.ToggleControl,{checked:!!d.enabled,onChange:e=>f("enabled",e),label:a||(0,s.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),d.enabled&&(0,r.createElement)(r.Fragment,null,c?(0,r.createElement)(r.Fragment,null,m&&(0,r.createElement)(i.Modal,{title:(0,s.__)("Conditional Logic","newsletter-optin-box"),onRequestClose:()=>p(!1),isFullScreen:!0},g),(0,r.createElement)(i.Button,{variant:"secondary",className:"noptin-block-button",onClick:()=>p(!0)},(0,s.__)("Edit Conditional Logic","newsletter-optin-box"))):(0,r.createElement)(r.Fragment,null,g)))}const Rt={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>ee<=t,includes:(e,t)=>e.includes(t),"!includes":(e,t)=>!e.includes(t),"^includes":(e,t)=>t.includes(e),"^!includes":(e,t)=>!t.includes(e),empty:(e,t)=>!t,"!empty":(e,t)=>t},$t=(e,t,n)=>!!Rt[t]&&Rt[t](e,"boolean"==typeof e&&void 0===n?Boolean(n):n),zt=["number","search","email","password","tel","url","date"];function It({setting:e,availableSmartTags:t,isPressEnterToChange:n,...a}){void 0===n&&(n=!0);const o=Ut({availableSmartTags:t,onMergeTagClick:(0,r.useCallback)((e=>{a.onChange&&a.onChange(a.value?`${a.value} ${e}`.trim():e)}),[a.value,a.onChange])});return"string"==typeof a.suffix||a.suffix instanceof String?a.suffix=(0,r.createElement)(i.__experimentalInputControlSuffixWrapper,null,a.suffix):e.disabled||!o||a.suffix||(a.suffix=o),"datetime-local"===e.type&&(a.suffix=(0,r.createElement)(i.__experimentalInputControlSuffixWrapper,null,(0,r.createElement)(i.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:e,onToggle:t})=>(0,r.createElement)(i.Button,{onClick:t,"aria-expanded":e,icon:H}),renderContent:()=>(0,r.createElement)(i.DateTimePicker,{currentDate:a.value,onChange:e=>{e&&(e=(0,W.format)("c",e)),a.onChange(e||"")}})}))),e.disabled&&(a.readOnly=!0,a.onFocus=e=>e.target.select(),e.value&&(a.value=e.value)),("string"==typeof a.prefix||a.prefix instanceof String)&&(a.prefix=(0,r.createElement)(i.__experimentalInputControlPrefixWrapper,null,a.prefix)),(0,r.createElement)(i.__experimentalInputControl,{...a,type:zt.includes(e.type)?e.type:"text",placeholder:e.placeholder?e.placeholder:"",isPressEnterToChange:n,__next40pxDefaultSize:!0})}function Dt({value:e,onChange:t,...n}){const{baseControlProps:a,controlProps:o}=(0,i.useBaseControlProps)({...n});return(0,r.createElement)(i.BaseControl,{...a},(0,r.createElement)(i.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:t,onToggle:n})=>(0,r.createElement)(i.Button,{onClick:n,"aria-expanded":t},(0,r.createElement)(i.ColorIndicator,{colorValue:e})),renderContent:()=>(0,r.createElement)(i.ColorPicker,{color:e,onChange:t}),...o}))}function Ft({availableSmartTags:e,autoGrow:t=!1,label:n,id:a,setting:o,...l}){const s=Ut({availableSmartTags:e,onMergeTagClick:(0,r.useCallback)((e=>{l.onChange&&l.onChange(l.value?`${l.value} ${e}`.trim():e)}),[l.value,l.onChange]),toggleProps:{size:"small"}}),c=!o.disabled&&s?(0,r.createElement)(i.__experimentalHStack,null,(0,r.createElement)("span",null,n),s):n,u=a||(0,U.useInstanceId)(Ft,"noptin-textarea");return(0,r.useEffect)((()=>{if(t){const e=document.getElementById(u);e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)}}),[l.value,t,u]),o.disabled&&(l.readOnly=!0,l.onFocus=e=>e.target.select(),o.value&&(l.value=o.value)),(0,r.createElement)(i.TextareaControl,{...l,id:u,label:c,__nextHasNoMarginBottom:!0})}function jt({options:e,...t}){return(0,r.createElement)(i.__experimentalToggleGroupControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,isBlock:!0,...t},e.map(((e,t)=>(0,r.createElement)(i.__experimentalToggleGroupControlOption,{key:t,...e}))))}function Lt({options:e,...t}){const[n,a]=(0,r.useState)(e);return(0,r.createElement)(i.ComboboxControl,{...t,options:n,onFilterValueChange:t=>{a(t?e.filter((e=>!e.disabled&&""!==e.value&&(e.search?e.search.toLowerCase():e.label.toLowerCase()).includes(t.toLowerCase()))):e)},__experimentalRenderItem:({item:e,...t})=>e.render?"string"==typeof e.render?(0,r.createElement)("div",{...t,dangerouslySetInnerHTML:{__html:e.render}}):e.render:e.label,autocomplete:"off"})}function Ht({options:e,value:t,onChange:n,...a}){const o=Array.isArray(t)?t:[],l=(0,r.useMemo)((()=>e.map((e=>e.label))),[e]),s=(0,r.useCallback)((e=>l.includes(e)),[l]),c=(0,r.useMemo)((()=>o.map((t=>{const n=e.find((e=>e.value===t));return n?n.label:t}))),[t,e]),u=(0,r.useCallback)((t=>{const r=new Set;for(const n of t){const t=e.find((e=>e.label===n));t&&r.add(t.value)}n(Array.from(r))}),[n,e]),m=(0,r.useCallback)((t=>{const n=e.find((e=>e.label===t.item));return n&&n.render?(0,r.createElement)(L.RawHTML,null,n.render):(0,r.createElement)(r.Fragment,null,t.item)}),[e]);return(0,r.createElement)(i.FormTokenField,{value:c,suggestions:l,onChange:u,__experimentalShowHowTo:!1,__experimentalExpandOnFocus:!0,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalValidateInput:s,__experimentalRenderItem:m,...a})}const Vt=[{id:"key",label:(0,s.__)("Key","noptin-addons-pack"),type:"text"},{id:"value",label:(0,s.__)("Value","noptin-addons-pack"),type:"text"}];function Ut({availableSmartTags:e=[],onMergeTagClick:t=((e,t)=>{}),raw:n=!1,icon:a="shortcode",label:o=(0,s.__)("Insert merge tag","newsletter-optin-box"),...l}){const c=function(e){return(0,r.useMemo)((()=>{if(!Array.isArray(e))return{};const t={};return e.forEach((e=>{const n=e.group?e.group:(0,s.__)("General","newsletter-optin-box");Array.isArray(t[n])||(t[n]=[]),t[n].push(e)})),t}),[e])}(e),u=Object.keys(c).length;let m=null;return u>0&&(m=(0,r.createElement)(i.DropdownMenu,{icon:a,label:o,...l},(({onClose:e})=>(0,r.createElement)(r.Fragment,null,Object.keys(c).map(((a,o)=>(0,r.createElement)(i.MenuGroup,{label:u>1?a:void 0,key:o},c[a].map((a=>(0,r.createElement)(i.MenuItem,{icon:a.isPremium?w:a.icon||V,iconPosition:"left",disabled:a.isPremium,onClick:()=>{if(!a.isPremium){if(t){const e=n?a.smart_tag:`[[${Gt(a)}]]`;t(e,`[[${Gt(a)}]]`)}e()}},key:a.smart_tag},(0,r.createElement)(L.RawHTML,null,a.isPremium?`${a.label} - Premium`:a.label))))))))))),m}function Gt(e){return e.example?e.example:e.default?`${e.smart_tag} default="${e.default}"`:`${e.smart_tag}`}function Wt({availableSmartTags:e,value:t,onChange:n,button:a,fields:o,openModal:l,prepend:c,disable:u,disabled:m,onDisable:p,cardProps:d,repeaterKey:f,id:g,defaultItem:_,...h}){const[b,y]=(0,r.useState)(!1),v=Array.isArray(t)?t:[],x=g||(0,U.useInstanceId)(Wt,"noptin-repeater"),{baseControlProps:E,controlProps:w}=(0,i.useBaseControlProps)({...h,id:x}),k=_||{};if(f?.newOnly&&(k.new=!0),!o)return console.warn("No fields provided to repeater control."),null;Object.keys(o).forEach((e=>{void 0!==o[e].default&&(k[e]=o[e].default)}));const C=!!l,S=(e,t)=>e.key?e.key:f?.to&&Jt(e,f.to)?Jt(e,f.to):t,A=(0,r.createElement)(i.__experimentalVStack,null,c,v.map(((t,a)=>(0,r.createElement)(i.Card,{size:"small",className:"noptin-no-shadow",id:`${x}__item-${S(t,a)}`,"data-index":a,borderBottom:!0,borderLeft:!0,borderRight:!0,borderTop:!0,...d||{},key:S(t,a)},(0,r.createElement)(qt,{id:`${x}__item-${S(t,a)}`,fields:o,value:t,availableSmartTags:e,onChange:e=>{let t={...e};if(f?.to&&f.from&&Jt(t,f.from)&&(!f.newOnly||t.new)){const e=Jt(t,f.from).toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");t=Zt(t,f.to,e.substring(0,f.maxLength||64)),v.find(((e,n)=>a!==n&&Jt(e,f.to)===Jt(t,f.to)))&&(t=Zt(t,f.to,`${Jt(t,f.to)}_${a}`))}const r=[...v];r[a]=t,n(r)},onDelete:()=>{const e=[...v];e.splice(a,1),n(e)},onMoveUp:a>0?()=>{const e=[...v],t=e[a];e.splice(a,1),e.splice(a-1,0,t),n(e)}:null,onMoveDown:a{const e=[...v],t=e[a];e.splice(a,1),e.splice(a+1,0,t),n(e)}:null,repeaterKey:f})))),(0,r.createElement)(i.__experimentalHStack,null,(0,r.createElement)(i.Button,{onClick:()=>{const e=[...v],t=Date.now().toString(36),r=Math.random().toString(36).substring(2,8);e.push({key:`${t}_${r}`,...k}),n(e)},variant:"primary"},a||(0,s.__)("Add Item","newsletter-optin-box")),C&&(0,r.createElement)(i.Button,{onClick:()=>y(!1),variant:"secondary"},(0,s.__)("Go Back","newsletter-optin-box")))),T=!u||!m;return(0,r.createElement)(i.BaseControl,{...E},(0,r.createElement)("div",{...w},C&&(0,r.createElement)(i.__experimentalVStack,null,u&&(0,r.createElement)(i.ToggleControl,{label:u,checked:m,onChange:e=>{p&&p(e)}}),T&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.Button,{onClick:()=>y(!0),variant:"secondary"},l||(0,s.__)("Set Items","newsletter-optin-box")),b&&(0,r.createElement)(i.Modal,{title:h.label||l||(0,s.__)("Set Items","newsletter-optin-box"),onRequestClose:()=>y(!1),size:"medium"},A))),!C&&A))}function qt({fields:e,availableSmartTags:t,value:n,onChange:a,repeaterKey:o,onDelete:l,onMoveUp:c,onMoveDown:u,id:m}){const[p,d]=(0,r.useState)(!o?.from),f=(0,r.useCallback)((()=>{d(!p)}),[p]),g=!p&&o?.from;let _=null;if(o){const e=!1!==o.display&&o.to&&n?.[o.to]?(0,r.createElement)("code",null,(0,s.sprintf)(o.display||"%s",n?.[o.to])):null,t={paddingLeft:16,paddingRight:16,height:48},a=Jt(n,o.from)||Jt(n,o.fallback);_=(0,r.createElement)(i.CardHeader,{style:{padding:0}},(0,r.createElement)(i.Flex,{as:i.Button,onClick:f,style:t,"aria-controls":`${m}__body`,"aria-expanded":!g,type:"button"},(0,r.createElement)(i.__experimentalHStack,{as:i.FlexBlock},(0,r.createElement)(i.__experimentalText,{weight:600},a||(0,s.__)("(new)","newsletter-optin-box"))),(0,r.createElement)(i.FlexItem,null,(0,r.createElement)(i.__experimentalHStack,null,e,(0,r.createElement)(i.Icon,{icon:p?"arrow-up-alt2":"arrow-down-alt2"})))))}return(0,r.createElement)(r.Fragment,null,_,!g&&(0,r.createElement)(i.CardBody,{id:`${m}__body`,hidden:g},(0,r.createElement)(i.__experimentalVStack,null,Object.keys(e).map((o=>(0,r.createElement)(en,{key:o,settingKey:o,availableSmartTags:t,setting:e[o],saved:n,setAttributes:e=>{a({...n,...e})}}))),(0,r.createElement)(i.__experimentalHStack,{className:"noptin-repeater-item__actions",justify:"flex-start"},!n?.predefined&&(0,r.createElement)(i.Button,{variant:"link",onClick:l,text:(0,s.__)("Remove Item","newsletter-optin-box"),isDestructive:!0}),c&&(0,r.createElement)(i.Button,{onClick:c,icon:"arrow-up-alt",text:(0,s.__)("Move Up","newsletter-optin-box"),size:"small",iconSize:16}),u&&(0,r.createElement)(i.Button,{onClick:u,icon:"arrow-down-alt",text:(0,s.__)("Move Down","newsletter-optin-box"),size:"small",iconSize:16})))))}function Kt({setting:e,availableSmartTags:t,value:n,onChange:a,...o}){const{baseControlProps:l,controlProps:c}=(0,i.useBaseControlProps)(o);Array.isArray(n)||(n=[]);const u=(0,r.useCallback)((({item:e,index:o})=>(0,r.createElement)(i.Flex,{className:"noptin-repeater-item",wrap:!0},Vt.map(((l,i)=>(0,r.createElement)(Qt,{key:i,availableSmartTags:t,field:l,value:void 0===e[l.id]?"":e[l.id],onChange:e=>{const t=[...n];t[o][l.id]=e,a(t)}}))),(0,r.createElement)(i.FlexItem,null,(0,r.createElement)(i.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,s.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:()=>{const e=[...n];e.splice(o,1),a(e)},isDestructive:!0})))),[n,a]);return(0,r.createElement)(i.BaseControl,{...l},(0,r.createElement)("div",{...c},n.map(((e,t)=>(0,r.createElement)(u,{key:t,item:e,index:t}))),(0,r.createElement)(i.Button,{onClick:()=>{const e=[...n];e.push({}),a(e)},variant:"secondary"},e.add_field?e.add_field:(0,s.__)("Add","newsletter-optin-box"))))}function Qt({field:e,availableSmartTags:t,value:n,onChange:a}){const o=Ut({availableSmartTags:t,onMergeTagClick:(0,r.useCallback)((e=>{a&&a(n?`${n} ${e}`.trim():e)}),[n,a])});return(0,r.createElement)(i.FlexBlock,null,(0,r.createElement)(i.__experimentalInputControl,{label:e.label,type:e.type,value:n,placeholder:(0,s.sprintf)((0,s.__)("Enter %s","noptin-addons-pack"),e.label),className:"noptin-component__field noptin-condition-field",suffix:o,onChange:a,isPressEnterToChange:!0,__next40pxDefaultSize:!0}))}function Xt({setting:e,value:t,options:n,onChange:a,...o}){const{baseControlProps:l,controlProps:s}=(0,i.useBaseControlProps)(o);return Array.isArray(t)||(t=[]),(0,r.createElement)(i.BaseControl,{...l},(0,r.createElement)("div",{...s},n.map(((e,n)=>(0,r.createElement)(i.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:n=>{a(n?[...t,e.value]:t.filter((t=>t!==e.value)))}})))))}function Yt({value:e,onChange:t,id:n,...a}){const{baseControlProps:o,controlProps:l}=(0,i.useBaseControlProps)({...a,id:n,__nextHasNoMarginBottom:!0}),{wp:s,tinymce:c}=window,u=(0,r.useRef)(!1),m=(0,r.useRef)(null);return(0,r.useEffect)((()=>{if(!u.current)return;const t=t=>{t?.target?.classList?.contains("wp-switch-editor")&&setTimeout((()=>{const t=c?.get(n);t&&(t.setContent(e||""),t._lastChange=e)}),50)};return m.current?.addEventListener("click",t),()=>{m.current?.removeEventListener("click",t)}}),[m.current,e]),(0,r.useEffect)((()=>{if(!u.current)return;const e=c?.get(n);e&&e._lastChange}),[e]),(0,r.useEffect)((()=>{function r(){s.oldEditor.initialize(n,{tinymce:!!window.tinymce&&{content_css:!1,theme_advanced_buttons:"bold,italic,underline,|,bullist,numlist,blockquote,|,link,unlink,|,spellchecker,fullscreen,|,formatselect,styleselect",drag_drop_upload:!0,toolbar1:"formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,spellchecker,wp_adv,dfw",toolbar2:"strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help",min_height:400,wpautop:!1,setup(n){e&&n.on("loadContent",(()=>n.setContent(e))),n.on("blur",(()=>(t(n.getContent()),!1)));const r=(0,U.debounce)((()=>{const e=n.getContent();e!==n._lastChange&&(n._lastChange=e,t(e))}),250);n.on("Paste Change input Undo Redo",r),n.on("remove",r.cancel),n.on("keydown",(e=>{G.isKeyboardEvent.primary(e,"z")&&e.stopPropagation(),G.isKeyboardEvent.primary(e,"s")&&r.flush();const{altKey:t}=e;t&&e.keyCode===G.F10&&e.stopPropagation()})),u.current=!0},...window?.tinyMCEPreInit?.mceInit[n]||{}},mediaButtons:!0,quicktags:{buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,close"}})}function a(){"complete"===document.readyState&&r()}return c?.execCommand("mceRemoveEditor",!0,n),"complete"===document.readyState?r():document.addEventListener("readystatechange",a),()=>{document.removeEventListener("readystatechange",a),s.oldEditor.remove(n)}}),[]),(0,r.createElement)(i.BaseControl,{...o},(0,r.createElement)("div",{ref:m},(0,r.createElement)("textarea",{...l,className:"wp-editor-area",style:{width:"100%"},value:e,onChange:e=>t(e.target.value),rows:10})))}const Jt=(e,t)=>{if(!t||0===t.length)return;if("string"==typeof t&&(t=t.split(".")),0===t.length||!e||"object"!=typeof e)return;const[n,...r]=t;return 0===r.length?e[n]:Jt(e[n],r)},Zt=(e,t,n)=>{if(!t||0===t.length)return e;"string"==typeof t&&(t=t.split("."));const[r,...a]=t;return 0===a.length?{...e,[r]:n}:{...e,[r]:Zt(e[r]||{},a,n)}};function en({settingKey:e,setting:t,availableSmartTags:n,prop:a,saved:o,setAttributes:l}){const c=(a?`${a}.${e}`:e).split("."),u=t.sanitize?t.sanitize:e=>e,m=(0,r.useCallback)((e=>{if(Jt(o,c)===e)return;const[t,...n]=c;return 0===n.length?l(u({[t]:e})):l(u({[t]:Zt(o[t]||{},n,e)}))}),[o,c,l,u]);if(t.if||t.restrict){const e=t.restrict?t.restrict.split("."):t.if.split(".");if(!Jt(o,e))return null}if(Array.isArray(t.conditions)&&!t.conditions.every((e=>{const t=e.key.split("."),n=e.operator?e.operator:"==";return $t(e.value,n,Jt(o,t))})))return null;if(t.condition&&!t.condition(o))return null;let p=Jt(o,c);(void 0===p||t.disabled)&&(p=t.default);const d=void 0!==p&&""!==p&&null!==p;let f=[];t.options&&(f=Array.isArray(t.options)?[...t.options]:Object.keys(t.options).map((e=>({label:t.options?.[e],value:e}))));const g=`noptin-component__field-${e}`,_="string"==typeof t.description?(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:t.description}}):t.description,h=t.customAttributes?t.customAttributes:{},b={label:t.label,value:d?p:"",onChange:m,className:g,help:_,...h};if(t.tooltip&&(b.label=(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start"},(0,r.createElement)("span",null,t.label),(0,r.createElement)(i.Tooltip,{delay:0,placement:"top",text:t.tooltip},(0,r.createElement)("span",null,(0,r.createElement)(i.Icon,{icon:"info",style:{color:"#454545"}}))))),t.type&&!t.el&&(t.el=t.type,["toggle","switch","checkbox","checkbox_alt","text","number","email","tel","date","color","image"].includes(t.type)&&(t.el="input")),"button"===t.el)return(0,r.createElement)("div",null,(0,r.createElement)(i.Button,{...t.buttonProps||{}}));if("toggle_group"===t.el)return(0,r.createElement)(jt,{...b,options:f});if("select"===t.el)return t.multiple?(0,r.createElement)(Ht,{...b,options:f}):(f.find((e=>""===e?.value))||f.unshift({label:t.placeholder?t.placeholder:(0,s.__)("Select an option","newsletter-optin-box"),value:"",disabled:!t.canSelectPlaceholder}),(0,r.createElement)(i.SelectControl,{...b,options:f,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}));if("combobox"===t.el)return f.unshift({label:t.placeholder?t.placeholder:(0,s.__)("Select an option","newsletter-optin-box"),value:"",disabled:!t.canSelectPlaceholder}),(0,r.createElement)(Lt,{...b,options:f,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0});if("form_token"===t.el||"token"===t.el)return(0,r.createElement)(i.FormTokenField,{...b,value:Array.isArray(b.value)?b.value:[],suggestions:Array.isArray(t.suggestions)?t.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalShowHowTo:!1,__experimentalExpandOnFocus:!0,tokenizeOnBlur:!0});if("multi_checkbox"===t.el||"multi_checkbox_alt"===t.el)return(0,r.createElement)(Xt,{...b,options:f});if("conditional_logic"===t.el)return(0,r.createElement)(Bt,{...b,availableSmartTags:n,comparisons:t.comparisons,toggleText:t.toggle_text,inModal:t.in_modal});if("time"===t.el)return(0,r.createElement)(St,{...b});if("color"===t.el||"input"===t.el&&"color"===t.type)return(0,r.createElement)(Dt,{...b,__nextHasNoMarginBottom:!0});if("unit"===t.el)return(0,r.createElement)(i.__experimentalUnitControl,{labelPosition:"edge",__unstableInputWidth:"80px",__next40pxDefaultSize:!0,isPressEnterToChange:!0,...b});if("input"===t.el){if(t.type&&["toggle","switch","checkbox","checkbox_alt"].includes(t.type))return(0,r.createElement)(i.ToggleControl,{...b,checked:!!d&&p});if("number"===t.type){const e=e=>{if(e)return"string"==typeof e||e instanceof String?(0,r.createElement)(i.__experimentalInputControlSuffixWrapper,null,e):e},n=e=>{if(e)return"string"==typeof e||e instanceof String?(0,r.createElement)(i.__experimentalInputControlPrefixWrapper,null,e):e};return Array.isArray(b.suffix)?b.suffix=e(1===p||"1"===p?b.suffix[0]:b.suffix[1]):b.suffix=e(b.suffix),Array.isArray(b.prefix)?b.prefix=n(1===p||"1"===p?b.prefix[0]:b.prefix[1]):b.prefix=n(b.prefix),(0,r.createElement)(i.__experimentalNumberControl,{...b,placeholder:t.placeholder?t.placeholder:"",__next40pxDefaultSize:!0})}return"image"===t.type&&(b.suffix=(0,r.createElement)(i.Button,{onClick:()=>{var e=window.wp.media({title:(0,s.__)("Upload Image","newsletter-optin-box"),multiple:!1,library:{type:"image"}}).open().on("select",(t=>{let n=e.state().get("selection").first();m(n.toJSON().sizes.full.url)}))},icon:"upload",label:(0,s.__)("Upload Image","newsletter-optin-box"),showTooltip:!0})),(0,r.createElement)(It,{...b,setting:t,availableSmartTags:"trigger_settings"===a?[]:n,isPressEnterToChange:!t.isInputToChange})}return"textarea"===t.el?(0,r.createElement)(Ft,{...b,setting:t,placeholder:t.placeholder?t.placeholder:"",availableSmartTags:"trigger_settings"===a?[]:n}):"tinymce"===t.el?(0,r.createElement)(Yt,{...b}):"paragraph"===t.el?(0,r.createElement)("div",{className:g},(0,r.createElement)(i.Tip,null,t.raw?(0,r.createElement)(L.RawHTML,null,t.content):t.content)):"hero"===t.el?(0,r.createElement)("div",{className:g},(0,r.createElement)("h3",null,t.content)):"key_value_repeater"===t.el||"webhook_key_value_repeater"===t.el?(0,r.createElement)(Kt,{...b,setting:t,availableSmartTags:"trigger_settings"===a?[]:n}):"repeater"===t.el?(0,r.createElement)(Wt,{...b,availableSmartTags:"trigger_settings"===a?[]:n}):(console.log(t),e)}const tn=(0,r.createContext)([]),nn=()=>(0,r.useContext)(tn),rn=({children:e})=>{const{automationRule:{trigger_settings:t,smartTags:n}}=h(),a=(0,r.useMemo)((()=>function(e,t){const n=[];return e?(Object.keys(e).forEach((r=>{const a=e[r];if(a.hidden)return;if(a.conditions&&!a.conditions.every((e=>{let n=!1;return n=Array.isArray(e.value)?e.value.some((n=>n==t[e.key])):e.value==t[e.key],n===("is"===e.operator)})))return;let o=r;a.label?o=a.label:a.description&&(o=a.description),n.push({...a,smart_tag:r,label:o,example:a.example?a.example:"",description:a.description?a.description:"",placeholder:a.placeholder?a.placeholder:"",conditional_logic:!!a.conditional_logic&&a.conditional_logic,options:a.options?a.options:[]})})),n):n}(n,t||{})),[n,t]);return(0,r.createElement)(tn.Provider,{value:a},e)};function an({sectionKey:e,label:t,prop:n,settings:a}){const o=nn(),l=Object.keys(a);if(!l.length)return null;const{automationRule:s,setAttributes:c}=h();return(0,r.createElement)(j,null,(0,r.createElement)(m,{title:t,className:`noptin-automation-rule-editor__section noptin-automation-rule-editor__section-${e}`},(0,r.createElement)(i.__experimentalVStack,{spacing:5,as:i.CardBody},l.map((e=>(0,r.createElement)(en,{key:e,settingKey:e,prop:n,availableSmartTags:o,saved:s,setAttributes:c,setting:a[e]}))))))}function on(){const{error:e,success:t,resetMessages:n,automationRule:{settings:a}}=h(),o=(0,r.createElement)(r.Fragment,null,e&&(0,r.createElement)(i.Notice,{status:"error",onDismiss:n},e),t&&(0,r.createElement)(i.Notice,{status:"success",onDismiss:n},t));if(!a)return o;const l=Object.keys(a);return l.length?(0,r.createElement)(i.__experimentalVStack,{className:"noptin-automation-rule-editor__sections"},o,(0,r.createElement)(j,null,l.map((e=>(0,r.createElement)(an,{key:e,sectionKey:e,...a[e]}))))):o}const ln=window.noptinEmailSettingsMisc||{};function sn(e,t){const n={};Array.isArray(e)||Object.entries(e).forEach((([e,r])=>{if("email"!==e){if(!r.category){if(!ln.isTest)return;r.category="Deprecated"}n[r.category]||(n[r.category]={}),n[r.category][e]={...r,selectText:"triggers"===t?(0,s.__)("Use trigger","newsletter-optin-box"):(0,s.__)("Set-up","newsletter-optin-box"),forcePremium:I(e,r.category)},r.image&&r.image.icon&&["category","editor-table"].includes(r.image.icon)&&(n[r.category][e].forcePremium=!0),r.alt_category&&(n[r.alt_category]||(n[r.alt_category]={}),n[r.alt_category][e]=n[r.category][e])}})),Array.isArray(ln.integrations)&&ln.integrations.forEach((r=>{r.plan&&"free"!==r.plan&&r[t]&&!Array.isArray(r[t])&&Object.entries(r[t]).forEach((([t,a])=>{a.forEach((({id:a,label:o,description:l,premium:i=!1})=>{if("premium"===r.plan||i)if(e[a]){const t=e[a].category;t&&n[t][a]&&(n[t][a].forcePremium=!0)}else n[t]||(n[t]={}),n[t][a]={name:a,label:o,description:l,category:t,image:r.icon_url,forcePremium:!0,is_installed:!1,installation:r.installation}}))}))}));const r={},a=(0,s.__)("General","newsletter-optin-box");return n.hasOwnProperty(a)&&(r[a]=n[a]),Object.keys(n).sort().forEach((e=>{e!==a&&(r[e]=n[e])})),r}ln.license;const cn={"noptin-trigger":{title:(0,s.__)("Select a trigger for your automation rule","newsletter-optin-box"),show:!0,arg:"noptin-trigger",cardGroups:sn(ln.data?.triggers||{},"triggers")},"noptin-action":{title:(0,s.__)("Select an action for your automation rule","newsletter-optin-box"),show:!0,arg:"noptin-action",cardGroups:sn(ln.data?.actions||{},"actions")}},un=(0,r.createContext)(void 0),mn=({children:e})=>{const[t,n]=(0,r.useState)(ln.data?.add_new||(0,k.addQueryArgs)(window.location.href,{noptin_edit_automation_rule:"0"})),a=(0,r.useMemo)((()=>{let e="";const r={};for(const[n,a]of Object.entries(cn)){const o=a.arg?(0,k.getQueryArg)(t,a.arg):"";if(!o){e=n;break}r[n]=o}return{currentTitle:cn[e]?.title||"",currentStep:e,isLastStep:e===Object.keys(cn).pop(),isFirstStep:e===Object.keys(cn)[0],hasSteps:Object.keys(cn).length>0,stepValues:r,steps:cn,campaign:"automation-rules",removeQueryArgs:(...e)=>{n((0,k.removeQueryArgs)(t,...e))},addQueryArg:(e,r)=>{n((0,k.addQueryArgs)(t,{[e]:r}))},withQueryArg:(e,n)=>(0,k.addQueryArgs)(t,{[e]:n}),url:t}}),[t,n]);return(0,r.createElement)(un.Provider,{value:a},e)},pn=({title:e,isOpen:t,closeModal:n,back:a,...o})=>{const l=(0,r.createElement)(r.Fragment,null,a&&(0,r.createElement)(i.Button,{icon:"arrow-left-alt",onClick:a,label:(0,s.__)("Back","newsletter-optin-box"),showTooltip:!0}));return(0,r.createElement)(r.Fragment,null,t&&(0,r.createElement)(i.Modal,{title:e,onRequestClose:n,headerActions:l,isFullScreen:!0},(0,r.createElement)(En,{...o})))},dn={borderRadius:"5px"},fn=({categories:e,selectedCategory:t,onClickCategory:n})=>{const a="noptin-campaign-explorer__sidebar",o=(0,U.useViewportMatch)("medium","<");return(0,r.createElement)(i.__experimentalSurface,{className:a,variant:o?"primary":"secondary",style:dn},!o&&(0,r.createElement)(i.__experimentalElevation,{value:2}),(0,r.createElement)(i.NavigableMenu,{className:`${a}__categories-list`,orientation:o?"horizontal":"vertical",onNavigate:t=>n(e[t])},e.map((e=>(0,r.createElement)(i.Button,{key:e,label:e,text:e,className:`${a}__categories-list__item`,isPressed:t===e,onClick:()=>n(e)})))))},gn=({image:e,title:t})=>{if("string"==typeof e&&e.startsWith("http"))return(0,r.createElement)("img",{src:e,width:24,alt:t,style:{maxWidth:24,height:"auto"}});if(e&&"string"==typeof e)return(0,r.createElement)(i.Icon,{size:24,icon:e,style:{color:"#424242"}});if(e&&"object"==typeof e){const t=e.fill||"#008000",n=e.path||"",a=e.viewBox||"0 0 24 24";return e.path?(0,r.createElement)(i.SVG,{viewBox:a,xmlns:"http://www.w3.org/2000/svg",style:{maxWidth:24}},(0,r.createElement)(i.Path,{fill:t,d:n})):(0,r.createElement)(i.Icon,{size:24,style:{color:t},icon:e.icon})}return(0,r.createElement)(i.Icon,{size:24,icon:"email",style:{color:"#424242"}})},hn=({learnMoreUrl:e,previewURL:t,action:n})=>{const[a,o]=(0,r.useState)(!1),[l,c]=(0,r.useState)(!0),u=()=>o(!1);return e?(0,r.createElement)(i.Button,{variant:"secondary",href:e,target:"_blank"},(0,r.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,s.__)("Learn More"))," ",(0,r.createElement)(i.Icon,{size:16,icon:"arrow-right-alt"})):t?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.Button,{variant:"secondary",onClick:()=>o(!0)},(0,r.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,s.__)("Preview"))," ",(0,r.createElement)(i.Icon,{size:16,icon:"visibility"})),a&&(0,r.createElement)(i.Modal,{title:(0,s.__)("Preview"),onRequestClose:u,className:"noptin-preview-modal",headerActions:(0,r.createElement)(i.__experimentalHStack,{justify:"flex-end",wrap:!0},n,(0,r.createElement)(i.Button,{variant:n?"secondary":"primary",onClick:u},(0,s.__)("Back to templates"))),isDismissible:!1,isFullScreen:!0},l&&(0,r.createElement)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},(0,r.createElement)(i.Spinner,null)),(0,r.createElement)("iframe",{src:t,style:{width:"100%",height:"100%",border:"none",display:l?"none":"block"},onLoad:()=>c(!1)}))):null},bn=({name:e,label:t,description:n,image:a,useValue:o,onSelect:l,hrefCallback:c,href:m,isTemplate:p,...d})=>{const f=void 0===o?e:o,g=(e=>{if(e.forcePremium?!1!==e.is_installed&&e?.licenseDetails?.key:!1!==e.is_installed){const t=e.primary||(0,r.createElement)(i.Button,{variant:"primary",onClick:e.onClick,href:e.href},(0,r.createElement)("span",{className:"noptin-selectable-card__label"},e.selectText||(0,s.__)("Select"))," ",(0,r.createElement)(i.Icon,{size:16,icon:"arrow-right-alt"}));return{upgradeText:null,button:t,secondaryButton:(0,r.createElement)(hn,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:t})}}const t=(t,n)=>!1===e.is_installed&&e.installation?.[t]?e.installation?.[t]:e.licenseDetails[t]||n,n=t("install_desc",(0,s.__)("Activate your license key to unlock","newsletter-optin-box")),a=t("install_text",(0,s.__)("View Pricing","newsletter-optin-box")),o=t("install_url",(0,k.addQueryArgs)("https://noptin.com/pricing/",{utm_source:e.name||"license",utm_campaign:e.campaign||"noptin",utm_medium:"plugin-dashboard"})),l=(0,r.createElement)(i.Button,{variant:"primary",href:o,target:"_blank"},(0,r.createElement)("span",{className:"noptin-selectable-card-action__label"},a)," ",(0,r.createElement)(i.Icon,{size:16,icon:"lock"})),c=!e.licenseDetails?.key&&(0,r.createElement)(i.Button,{variant:"secondary",href:e.licenseDetails?.activate_url},(0,r.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,s.__)("Activate"))," ",(0,r.createElement)(i.Icon,{size:16,icon:"unlock"}));return{upgradeText:n,button:l,secondaryButton:e.licenseDetails?.key||e.previewURL?(0,r.createElement)(hn,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:[l,c]}):c}})({onClick:(0,r.useCallback)((()=>l?l(f):null),[f,l]),name:e.replace("automation_rule_",""),href:c?c(f):m,...d}),_=u("noptin-selectable-card",`noptin-selectable-card__${f}`,p&&"noptin-selectable-card--template");return(0,r.createElement)(i.Card,{className:_,size:"small"},(0,r.createElement)(i.CardHeader,null,(0,r.createElement)(i.__experimentalHeading,{level:4,numberOfLines:1},t),(0,r.createElement)(gn,{image:a,title:t})),p&&a?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{style:{width:"100%",flexGrow:1}},(0,r.createElement)("img",{src:a,alt:t,className:"noptin-template-preview__image"})),(0,r.createElement)(i.CardBody,null,g.upgradeText&&(0,r.createElement)(i.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))):(0,r.createElement)(i.CardBody,{style:{flexGrow:1}},(0,r.createElement)(i.__experimentalVStack,{spacing:4},n&&(0,r.createElement)(i.__experimentalText,{as:"p",variant:"muted"},n),p&&!a&&(0,r.createElement)(i.__experimentalText,{as:"em",variant:"muted"},(0,s.__)("No preview available","newsletter-optin-box")),g.upgradeText&&(0,r.createElement)(i.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))),(0,r.createElement)(i.CardFooter,{isBorderless:!0,justify:g.secondaryButton?"space-between":"flex-end"},g.secondaryButton,g.button),(0,r.createElement)(i.__experimentalElevation,{value:1,hover:3}))},yn=["xhuge","huge","wide","xlarge","medium"],vn=({showTitle:e,showSidebar:t,selectedCategory:n,cards:a,...o})=>{const l=yn.map((e=>(0,U.useViewportMatch)(e,">="))).filter((e=>e)).length||1,s="noptin-campaign-explorer";let c=Object.entries(a);c.some((([,e])=>e.isTemplate))||c.sort(((e,t)=>{const n=["latest_posts_digest","periodic","manual_recipients"],r=n.includes(e[0])||e[1].orderFirst,a=n.includes(t[0])||t[1].orderFirst;return r&&!a?-1:!r&&a?1:e[1].label.localeCompare(t[1].label)}));const u=c.reduce(((e,[t,n])=>(n.forcePremium&&!o.licenseDetails?.key?e[1].push([t,n]):e[0].push([t,n]),e)),[[],[]]);return(0,r.createElement)(i.FlexBlock,{className:`${s}__list`},e&&(0,r.createElement)(i.__experimentalHeading,{level:2,lineHeight:"48px",className:`${s}__category-name`},n),(0,r.createElement)(i.__experimentalGrid,{role:"listbox",className:`${s}-list`,columns:t&&l>1?l-1:l,rowGap:32,columnGap:32},u[0].map((([e,t])=>(0,r.createElement)(bn,{key:e,name:e,...o,...t}))),u[1].map((([e,t])=>(0,r.createElement)(bn,{key:e,name:e,...o,...t})))))},xn=({children:e,showSidebar:t,...n})=>{const a=(0,U.useViewportMatch)("medium","<");return t?a?(0,r.createElement)(i.__experimentalVStack,{spacing:4,...n},e):(0,r.createElement)(i.__experimentalHStack,{spacing:4,...n,justify:"stretch",alignment:"start",style:{maxHeight:"100%"}},e):(0,r.createElement)("div",{...n},e)},En=({cardGroups:e,...t})=>{const n=(0,r.useMemo)((()=>Object.keys(e)),[e]),a=n.length,[o,l]=(0,r.useState)(n[0]||"");(0,r.useEffect)((()=>{a>0&&!e[o]&&l(Object.keys(e)[0])}),[e,o]);const i=a>1,s=(0,r.useMemo)((()=>e[o]||{}),[e,o]),c=u("noptin-campaign-explorer",{"noptin-campaign-explorer--show-sidebar":i});return(0,r.createElement)(xn,{className:c,showSidebar:i},i&&(0,r.createElement)(fn,{selectedCategory:o,categories:n,onClickCategory:l}),(0,r.createElement)(vn,{showTitle:i,showSidebar:i,selectedCategory:o,cards:s,...t}))},wn=e=>{if(!e.isOpen)return null;const t=e.steps[e.currentStep];if(t.modal)return(0,r.createElement)(i.Modal,{onRequestClose:e.closeModal,...t.modal.props},t.modal.content);if(t.cardGroups){const n=[...Object.keys(e.stepValues)].pop(),a=e.isLastStep?void 0:n=>{t.arg&&e.addQueryArg(t.arg,n)};return(0,r.createElement)(pn,{title:e.currentTitle,closeModal:e.closeModal,isOpen:e.isOpen,back:n&&!e.isFirstStep?()=>e.removeQueryArgs(e.steps[n]?.arg||""):void 0,cardGroups:"function"==typeof t.cardGroups?t.cardGroups(e.stepValues):t.cardGroups,licenseDetails:e.licenseDetails,onSelect:a,hrefCallback:t.arg&&e.isLastStep?n=>e.withQueryArg(t.arg,n):void 0,campaign:e.campaign,key:t.title})}return null},kn=({buttonProps:e,...t})=>{const[n,a]=(0,r.useState)(!1),o=(0,r.useCallback)((()=>{a(!0)}),[a]),l=(0,r.useCallback)((()=>{a(!1)}),[a]),s=t.currentStep&&t.hasSteps,c={...e,onClick:s?o:void 0,href:s?void 0:t.url};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.Button,{...c}),(0,r.createElement)(wn,{isOpen:n,closeModal:l,...t}))},Cn=({text:e})=>{const t=(()=>{const e=(0,r.useContext)(un);if(!e)throw new Error("useModal must be used within a ModalProvider");return e})();return(0,r.createElement)(kn,{licenseDetails:ln.license||{},buttonProps:{variant:"primary",type:"button",text:e||(0,s.__)("Add New Automation","newsletter-optin-box")},...t})},Sn=({text:e})=>(0,r.createElement)(mn,null,(0,r.createElement)(Cn,{text:e})),An=({children:e})=>{const{automationRule:{trigger_id:t}}=h(),n=I(t,window.noptinEmailSettingsMisc?.triggers?.[t]?.category),[r,a]=P({heading:(0,s.__)("Unlock Premium Feature","newsletter-optin-box"),helpText:(0,s.__)("This automation trigger is only available to premium license holders.","newsletter-optin-box"),needsAddonsPack:!1,slug:"automation-rule-trigger-"+t});return!r&&n?a:e};function Tn(){const{automationRule:{id:e}}=h(),t=!!(e&&e>0);return(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start"},(0,r.createElement)(i.__experimentalText,{as:"h1",size:23,weight:500},t?(0,s.__)("Edit Automation Rule","newsletter-optin-box"):(0,s.__)("Add Automation Rule","newsletter-optin-box")),t&&(0,r.createElement)(Sn,{text:(0,s.__)("Add New","newsletter-optin-box")}))}function Pn({automationRule:e}){return(0,r.createElement)("div",{className:"noptin-automation-rule__editor"},(0,r.createElement)(j,null,(0,r.createElement)(i.SlotFillProvider,null,(0,r.createElement)(b,{automationRule:e},(0,r.createElement)(An,null,(0,r.createElement)(rn,null,(0,r.createElement)(i.__experimentalVStack,{spacing:4},(0,r.createElement)(Tn,null),(0,r.createElement)(i.Flex,{wrap:!0,align:"top"},(0,r.createElement)(i.FlexBlock,{className:"noptin-es6-editor__main"},(0,r.createElement)(on,null)),(0,r.createElement)(i.FlexItem,{className:"noptin-component-editor__sidebar"},(0,r.createElement)(i.__experimentalVStack,null,(0,r.createElement)(D,null),(0,r.createElement)(v,null)))))))))))}var Mn=n(338);const On=e=>{const t=window.noptinEmailSettingsMisc?.data?.app||{};return(0,r.createElement)(L.StrictMode,null,(0,r.createElement)(j,null,(0,r.createElement)(Pn,{...e,...t})))};l()((()=>{((e,t)=>{if(t){const n=t.getAttribute("data-app"),a=n?JSON.parse(n):{};(0,Mn.H)(t).render((0,r.createElement)(e,{...a}))}})(On,document.getElementById("noptin-automation-rule__editor-app"))}))},338:(e,t,n)=>{var r=n(795);t.H=r.createRoot,r.hydrateRoot},20:(e,t,n)=>{var r=n(609),a=Symbol.for("react.element"),o=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,n){var r,s={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,r)&&!i.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===s[r]&&(s[r]=t[r]);return{$$typeof:a,type:e,key:c,ref:u,props:s,_owner:l.current}}},848:(e,t,n)=>{e.exports=n(20)},609:e=>{e.exports=window.React},795:e=>{e.exports=window.ReactDOM}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.m=t,e=[],r.O=(t,n,a,o)=>{if(!n){var l=1/0;for(u=0;u=o)&&Object.keys(r.O).every((e=>r.O[e](n[s])))?n.splice(s--,1):(i=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,a,o]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={180:0,856:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var a,o,l=n[0],i=n[1],s=n[2],c=0;if(l.some((t=>0!==e[t]))){for(a in i)r.o(i,a)&&(r.m[a]=i[a]);if(s)var u=s(r)}for(t&&t(n);cr(750)));a=r.O(a)})(); \ No newline at end of file +`,St=({value:e,onChange:t,...n})=>{const{baseControlProps:a,controlProps:o}=(0,i.useBaseControlProps)(n),l=e?e.split(":"):["07","00"],[c,u]=(0,r.useState)(l[0]),[m,p]=(0,r.useState)(l[1]),d=(e,t="00")=>(e=Number(e),isNaN(e)?t:e<10?`0${e}`:e),f=`${d(c)}:${d(m)}`;return(0,r.useEffect)((()=>{e!==f&&t(f)}),[f]),(0,r.createElement)(i.BaseControl,{...a},(0,r.createElement)(i.__experimentalHStack,null,(0,r.createElement)(Ct,null,(0,r.createElement)(wt,{value:d(c),onChange:u,min:0,max:23,step:1,...o,label:(0,s.__)("Hours"),spinControls:"none",isDragEnabled:!1,isShiftStepEnabled:!1,isPressEnterToChange:!0,hideLabelFromVision:!0,__next40pxDefaultSize:!0,__unstableStateReducer:yt(2)}),(0,r.createElement)(Et,{"aria-hidden":"true"},":"),(0,r.createElement)(kt,{value:d(m),onChange:p,min:0,max:59,step:1,label:(0,s.__)("Minutes"),spinControls:"none",isDragEnabled:!1,isShiftStepEnabled:!1,isPressEnterToChange:!0,hideLabelFromVision:!0,__next40pxDefaultSize:!0,__unstableStateReducer:yt(2)})),(0,r.createElement)(xt,null)))},At=[{label:(0,s.__)("Only run if","newsletter-optin-box"),value:"allow"},{label:(0,s.__)("Do not run if","newsletter-optin-box"),value:"prevent"}],Tt=[{label:(0,s.__)("all","newsletter-optin-box"),value:"all"},{label:(0,s.__)("any","newsletter-optin-box"),value:"any"}];function Pt(e,t){return(0,r.useMemo)((()=>[{label:t,value:"",disabled:!0},...e]),[e,t])}function Mt({type:e,action:t,ruleCount:n,setConditionalLogicAttribute:a}){const o=n>1;return(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0},(0,r.createElement)(i.SelectControl,{label:(0,s.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"allow",options:At,onChange:e=>a("action",e),size:"default",__nextHasNoMarginBottom:!0}),o&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.SelectControl,{label:(0,s.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:e||"all",options:Tt,onChange:e=>a("type",e),size:"default",__nextHasNoMarginBottom:!0}),(0,r.createElement)(i.__experimentalText,null,(0,s.__)("of the following rules are true:","newsletter-optin-box"))))}function Ot({rule:e,comparisons:t,availableSmartTags:n,mergeTagsArray:a,index:o,updateRule:l,removeRule:c}){var u;const m=e=>l(o,{value:e}),p=null!==(u=e.full)&&void 0!==u?u:e.type?`[[${e.type}]]`:"",d=p.indexOf("]]"),f=p.indexOf("[[",d),g=-1===d||-1!==f&&f>d,_=e=>{const t={full:e};if(e){const n=e.match(/\[\[([^\s\]]+)/)?.[1]||"";n&&(t.type=n.replace("[[","").replace("]]",""))}l(o,t)},h=Ut({availableSmartTags:a,onMergeTagClick:e=>{_(p?`${p} ${e}`.trim():e)}}),b=Ut({availableSmartTags:a,onMergeTagClick:t=>{m(e.value?`${e.value} ${t}`.trim():t)}}),y=(0,r.useMemo)((()=>{const t=e.type;if(void 0!==n[t])return n[t];const r=t.replace("_",".",1);if(void 0!==n[r])return n[r];for(const[e,r]of Object.entries(n)){if(-1!==e.indexOf(".")&&e.split(".").slice(1).join(".")===t)return r;const n=e=>Array.isArray(e)?e:e.split(/[\s,]+/);if(r.deprecated&&n(r.deprecated).includes(t))return r}return null}),[e.type,n]),v=Pt((x=y?.options,(0,r.useMemo)((()=>x?Array.isArray(x)?x.map(((e,t)=>({label:e,value:t}))):Object.keys(x).map((e=>({label:x[e],value:e}))):[]),[x])),(0,s.__)("Select a value","newsletter-optin-box"));var x;const E=!g&&v.length>1,w=g?"string":y?.conditional_logic||"string",k=Pt((0,r.useMemo)((()=>{const e=[];return Object.keys(t).forEach((n=>{let r=t[n].type;if(E){if("string"===w&&"is"!=n&&"is_not"!=n)return;if("is_empty"===n||"is_not_empty"===n||"is_between"===n)return}"any"!==r&&r!=w||e.push({label:t[n].name,value:n})})),e}),[w,t]),(0,s.__)("Select a comparison","newsletter-optin-box")),C="is_empty"===e.condition||"is_not_empty"===e.condition;return(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0,expanded:!0},(0,r.createElement)("div",{style:{minWidth:320}},(0,r.createElement)(i.__experimentalInputControl,{type:"text",label:(0,s.__)("Smart Tag","newsletter-optin-box"),hideLabelFromVision:!0,placeholder:(0,s.__)("Enter a smart tag","newsletter-optin-box"),value:p,onChange:_,autoComplete:"off",suffix:h,__next40pxDefaultSize:!0})),(0,r.createElement)("div",{style:{width:150}},(0,r.createElement)(i.SelectControl,{label:(0,s.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:e.condition?e.condition:"is",options:k,onChange:e=>l(o,{condition:e}),size:"default",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})),!C&&(0,r.createElement)("div",{style:{minWidth:320}},E&&(0,r.createElement)(i.SelectControl,{label:(0,s.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:e.value?e.value:"",options:v,onChange:m,size:"default",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),!E&&(0,r.createElement)(i.__experimentalInputControl,{type:"number"===w?"number":"text",label:(0,s.__)("Value","newsletter-optin-box"),placeholder:(0,s.__)("Enter a value","newsletter-optin-box"),hideLabelFromVision:!0,value:e.value?e.value:"",onChange:m,suffix:b,__next40pxDefaultSize:!0})),(0,r.createElement)(i.Button,{onClick:()=>c(o),icon:"trash",variant:"tertiary",isDestructive:!0}))}function Nt({rules:e,comparisons:t,availableSmartTags:n,setConditionalLogicAttribute:a,disableTags:o,disableProps:l,closeModal:c}){const u=(0,r.useMemo)((()=>Array.isArray(e)?e.filter((e=>e.type&&""!==e.type)):[]),[e]),m=(0,r.useMemo)((()=>{const e={};return n.forEach((t=>{t.conditional_logic&&(e[t.smart_tag]={...t,key:t.smart_tag,type:t.conditional_logic,isPremium:Array.isArray(o)&&o.some((e=>t.smart_tag.startsWith(e)))||Array.isArray(l)&&l.some((e=>!!t[e]))})})),e}),[n]),p=(0,r.useCallback)((e=>{const t=[...u];t.splice(e,1),a("rules",t)}),[u,a]),d=(0,r.useCallback)(((e,t)=>{const n=[...u];n[e]={...n[e],...t},a("rules",n)}),[u,a]),f=(0,r.useMemo)((()=>Object.values(m)),[m]),g=(0,r.useCallback)(((e,t)=>{const n=m[e],r=n?.options||[],o=n?.placeholder||"";let l=Array.isArray(r)&&r.length?Object.keys(r)[0]:o;n?.default&&(l=n.default);const i=[...u];i.push({type:e,condition:"is",full:t,value:l}),a("rules",i)}),[u]),_=0===u.length?(0,s.__)("Add a conditional logic rule","newsletter-optin-box"):(0,s.__)("Add another rule","newsletter-optin-box"),h=Ut({availableSmartTags:f,onMergeTagClick:g,raw:!0,icon:"plus",label:_,text:_,toggleProps:{variant:"primary"}});return(0,r.createElement)(r.Fragment,null,u.map(((e,n)=>(0,r.createElement)(Ot,{key:n,rule:e,index:n,updateRule:d,removeRule:p,comparisons:t,availableSmartTags:m,mergeTagsArray:f}))),(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0},h,c&&(0,r.createElement)(i.Button,{onClick:c,variant:"secondary"},(0,s.__)("Return to editor","newsletter-optin-box"))))}function Bt({onChange:e,value:t,comparisons:n,toggleText:a,availableSmartTags:o,className:l,inModal:c=!1,...u}){const[m,p]=(0,r.useState)(!1),d=(0,r.useMemo)((()=>"object"!=typeof t?{enabled:!1,action:"allow",rules:[],type:"all"}:t),[t]),f=(0,r.useCallback)(((t,n)=>{e({...d,[t]:n})}),[e,d]),g=(0,r.createElement)(i.__experimentalVStack,{spacing:5},(0,r.createElement)(Mt,{ruleCount:Array.isArray(d.rules)?d.rules.length:0,type:d.type,action:d.action,setConditionalLogicAttribute:f}),(0,r.createElement)(Nt,{rules:d.rules,comparisons:n,availableSmartTags:o,setConditionalLogicAttribute:f,closeModal:c&&(()=>p(!1)),...u}));return(0,r.createElement)(i.__experimentalVStack,{spacing:5,className:l},(0,r.createElement)(i.ToggleControl,{checked:!!d.enabled,onChange:e=>f("enabled",e),label:a||(0,s.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),d.enabled&&(0,r.createElement)(r.Fragment,null,c?(0,r.createElement)(r.Fragment,null,m&&(0,r.createElement)(i.Modal,{title:(0,s.__)("Conditional Logic","newsletter-optin-box"),onRequestClose:()=>p(!1),isFullScreen:!0},g),(0,r.createElement)(i.Button,{variant:"secondary",className:"noptin-block-button",onClick:()=>p(!0)},(0,s.__)("Edit Conditional Logic","newsletter-optin-box"))):(0,r.createElement)(r.Fragment,null,g)))}const Rt={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>ee<=t,includes:(e,t)=>e.includes(t),"!includes":(e,t)=>!e.includes(t),"^includes":(e,t)=>t.includes(e),"^!includes":(e,t)=>!t.includes(e),empty:(e,t)=>!t,"!empty":(e,t)=>t},$t=(e,t,n)=>!!Rt[t]&&Rt[t](e,"boolean"==typeof e&&void 0===n?Boolean(n):n),zt=["number","search","email","password","tel","url","date"];function It({setting:e,availableSmartTags:t,isPressEnterToChange:n,...a}){void 0===n&&(n=!0);const o=Ut({availableSmartTags:t,onMergeTagClick:(0,r.useCallback)((e=>{a.onChange&&a.onChange(a.value?`${a.value} ${e}`.trim():e)}),[a.value,a.onChange])});return"string"==typeof a.suffix||a.suffix instanceof String?a.suffix=(0,r.createElement)(i.__experimentalInputControlSuffixWrapper,null,a.suffix):e.disabled||!o||a.suffix||(a.suffix=o),"datetime-local"===e.type&&(a.suffix=(0,r.createElement)(i.__experimentalInputControlSuffixWrapper,null,(0,r.createElement)(i.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:e,onToggle:t})=>(0,r.createElement)(i.Button,{onClick:t,"aria-expanded":e,icon:H}),renderContent:()=>(0,r.createElement)(i.DateTimePicker,{currentDate:a.value,onChange:e=>{e&&(e=(0,W.format)("c",e)),a.onChange(e||"")}})}))),e.disabled&&(a.readOnly=!0,a.onFocus=e=>e.target.select(),e.value&&(a.value=e.value)),("string"==typeof a.prefix||a.prefix instanceof String)&&(a.prefix=(0,r.createElement)(i.__experimentalInputControlPrefixWrapper,null,a.prefix)),(0,r.createElement)(i.__experimentalInputControl,{...a,type:zt.includes(e.type)?e.type:"text",placeholder:e.placeholder?e.placeholder:"",isPressEnterToChange:n,__next40pxDefaultSize:!0})}function Dt({value:e,onChange:t,...n}){const{baseControlProps:a,controlProps:o}=(0,i.useBaseControlProps)({...n});return(0,r.createElement)(i.BaseControl,{...a},(0,r.createElement)(i.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:t,onToggle:n})=>(0,r.createElement)(i.Button,{onClick:n,"aria-expanded":t},(0,r.createElement)(i.ColorIndicator,{colorValue:e})),renderContent:()=>(0,r.createElement)(i.ColorPicker,{color:e,onChange:t}),...o}))}function Ft({availableSmartTags:e,autoGrow:t=!1,label:n,id:a,setting:o,...l}){const s=Ut({availableSmartTags:e,onMergeTagClick:(0,r.useCallback)((e=>{l.onChange&&l.onChange(l.value?`${l.value} ${e}`.trim():e)}),[l.value,l.onChange]),toggleProps:{size:"small"}}),c=!o.disabled&&s?(0,r.createElement)(i.__experimentalHStack,null,(0,r.createElement)("span",null,n),s):n,u=a||(0,U.useInstanceId)(Ft,"noptin-textarea");return(0,r.useEffect)((()=>{if(t){const e=document.getElementById(u);e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)}}),[l.value,t,u]),o.disabled&&(l.readOnly=!0,l.onFocus=e=>e.target.select(),o.value&&(l.value=o.value)),(0,r.createElement)(i.TextareaControl,{...l,id:u,label:c,__nextHasNoMarginBottom:!0})}function jt({options:e,...t}){return(0,r.createElement)(i.__experimentalToggleGroupControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,isBlock:!0,...t},e.map(((e,t)=>(0,r.createElement)(i.__experimentalToggleGroupControlOption,{key:t,...e}))))}function Lt({options:e,...t}){const[n,a]=(0,r.useState)(e);return(0,r.createElement)(i.ComboboxControl,{...t,options:n,onFilterValueChange:t=>{a(t?e.filter((e=>!e.disabled&&""!==e.value&&(e.search?e.search.toLowerCase():e.label.toLowerCase()).includes(t.toLowerCase()))):e)},__experimentalRenderItem:({item:e,...t})=>e.render?"string"==typeof e.render?(0,r.createElement)("div",{...t,dangerouslySetInnerHTML:{__html:e.render}}):e.render:e.label,autocomplete:"off"})}function Ht({options:e,value:t,onChange:n,...a}){const o=Array.isArray(t)?t:[],l=(0,r.useMemo)((()=>e.map((e=>e.label))),[e]),s=(0,r.useCallback)((e=>l.includes(e)),[l]),c=(0,r.useMemo)((()=>o.map((t=>{const n=e.find((e=>e.value===t));return n?n.label:t}))),[t,e]),u=(0,r.useCallback)((t=>{const r=new Set;for(const n of t){const t=e.find((e=>e.label===n));t&&r.add(t.value)}n(Array.from(r))}),[n,e]),m=(0,r.useCallback)((t=>{const n=e.find((e=>e.label===t.item));return n&&n.render?(0,r.createElement)(L.RawHTML,null,n.render):(0,r.createElement)(r.Fragment,null,t.item)}),[e]);return(0,r.createElement)(i.FormTokenField,{value:c,suggestions:l,onChange:u,__experimentalShowHowTo:!1,__experimentalExpandOnFocus:!0,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalValidateInput:s,__experimentalRenderItem:m,...a})}const Vt=[{id:"key",label:(0,s.__)("Key","noptin-addons-pack"),type:"text"},{id:"value",label:(0,s.__)("Value","noptin-addons-pack"),type:"text"}];function Ut({availableSmartTags:e=[],onMergeTagClick:t=((e,t)=>{}),raw:n=!1,icon:a="shortcode",label:o=(0,s.__)("Insert merge tag","newsletter-optin-box"),...l}){const c=function(e){return(0,r.useMemo)((()=>{if(!Array.isArray(e))return{};const t={};return e.forEach((e=>{const n=e.group?e.group:(0,s.__)("General","newsletter-optin-box");Array.isArray(t[n])||(t[n]=[]),t[n].push(e)})),t}),[e])}(e),u=Object.keys(c).length;let m=null;return u>0&&(m=(0,r.createElement)(i.DropdownMenu,{icon:a,label:o,...l},(({onClose:e})=>(0,r.createElement)(r.Fragment,null,Object.keys(c).map(((a,o)=>(0,r.createElement)(i.MenuGroup,{label:u>1?a:void 0,key:o},c[a].map((a=>(0,r.createElement)(i.MenuItem,{icon:a.isPremium?w:a.icon||V,iconPosition:"left",disabled:a.isPremium,onClick:()=>{if(!a.isPremium){if(t){const e=n?a.smart_tag:`[[${Gt(a)}]]`;t(e,`[[${Gt(a)}]]`)}e()}},key:a.smart_tag},(0,r.createElement)(L.RawHTML,null,a.isPremium?`${a.label} - Premium`:a.label))))))))))),m}function Gt(e){return e.example?e.example:e.default?`${e.smart_tag} default="${e.default}"`:`${e.smart_tag}`}function Wt({availableSmartTags:e,value:t,onChange:n,button:a,fields:o,openModal:l,prepend:c,disable:u,disabled:m,onDisable:p,cardProps:d,repeaterKey:f,id:g,defaultItem:_,...h}){const[b,y]=(0,r.useState)(!1),v=Array.isArray(t)?t:[],x=g||(0,U.useInstanceId)(Wt,"noptin-repeater"),{baseControlProps:E,controlProps:w}=(0,i.useBaseControlProps)({...h,id:x}),k=_||{};if(f?.newOnly&&(k.new=!0),!o)return console.warn("No fields provided to repeater control."),null;Object.keys(o).forEach((e=>{void 0!==o[e].default&&(k[e]=o[e].default)}));const C=!!l,S=(e,t)=>e.key?e.key:f?.to&&Jt(e,f.to)?Jt(e,f.to):t,A=(0,r.createElement)(i.__experimentalVStack,null,c,v.map(((t,a)=>(0,r.createElement)(i.Card,{size:"small",className:"noptin-no-shadow",id:`${x}__item-${S(t,a)}`,"data-index":a,borderBottom:!0,borderLeft:!0,borderRight:!0,borderTop:!0,...d||{},key:S(t,a)},(0,r.createElement)(qt,{id:`${x}__item-${S(t,a)}`,fields:o,value:t,availableSmartTags:e,onChange:e=>{let t={...e};if(f?.to&&f.from&&Jt(t,f.from)&&(!f.newOnly||t.new)){const e=Jt(t,f.from).toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");t=Zt(t,f.to,e.substring(0,f.maxLength||64)),v.find(((e,n)=>a!==n&&Jt(e,f.to)===Jt(t,f.to)))&&(t=Zt(t,f.to,`${Jt(t,f.to)}_${a}`))}const r=[...v];r[a]=t,n(r)},onDelete:()=>{const e=[...v];e.splice(a,1),n(e)},onMoveUp:a>0?()=>{const e=[...v],t=e[a];e.splice(a,1),e.splice(a-1,0,t),n(e)}:null,onMoveDown:a{const e=[...v],t=e[a];e.splice(a,1),e.splice(a+1,0,t),n(e)}:null,repeaterKey:f})))),(0,r.createElement)(i.__experimentalHStack,null,(0,r.createElement)(i.Button,{onClick:()=>{const e=[...v],t=Date.now().toString(36),r=Math.random().toString(36).substring(2,8);e.push({key:`${t}_${r}`,...k}),n(e)},variant:"primary"},a||(0,s.__)("Add Item","newsletter-optin-box")),C&&(0,r.createElement)(i.Button,{onClick:()=>y(!1),variant:"secondary"},(0,s.__)("Go Back","newsletter-optin-box")))),T=!u||!m;return(0,r.createElement)(i.BaseControl,{...E},(0,r.createElement)("div",{...w},C&&(0,r.createElement)(i.__experimentalVStack,null,u&&(0,r.createElement)(i.ToggleControl,{label:u,checked:m,onChange:e=>{p&&p(e)}}),T&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.Button,{onClick:()=>y(!0),variant:"secondary"},l||(0,s.__)("Set Items","newsletter-optin-box")),b&&(0,r.createElement)(i.Modal,{title:h.label||l||(0,s.__)("Set Items","newsletter-optin-box"),onRequestClose:()=>y(!1),size:"medium"},A))),!C&&A))}function qt({fields:e,availableSmartTags:t,value:n,onChange:a,repeaterKey:o,onDelete:l,onMoveUp:c,onMoveDown:u,id:m}){const[p,d]=(0,r.useState)(!o?.from),f=(0,r.useCallback)((()=>{d(!p)}),[p]),g=!p&&o?.from;let _=null;if(o){const e=!1!==o.display&&o.to&&n?.[o.to]?(0,r.createElement)("code",null,(0,s.sprintf)(o.display||"%s",n?.[o.to])):null,t={paddingLeft:16,paddingRight:16,height:48},a=Jt(n,o.from)||Jt(n,o.fallback);_=(0,r.createElement)(i.CardHeader,{style:{padding:0}},(0,r.createElement)(i.Flex,{as:i.Button,onClick:f,style:t,"aria-controls":`${m}__body`,"aria-expanded":!g,type:"button"},(0,r.createElement)(i.__experimentalHStack,{as:i.FlexBlock},(0,r.createElement)(i.__experimentalText,{weight:600},a||(0,s.__)("(new)","newsletter-optin-box"))),(0,r.createElement)(i.FlexItem,null,(0,r.createElement)(i.__experimentalHStack,null,e,(0,r.createElement)(i.Icon,{icon:p?"arrow-up-alt2":"arrow-down-alt2"})))))}return(0,r.createElement)(r.Fragment,null,_,!g&&(0,r.createElement)(i.CardBody,{id:`${m}__body`,hidden:g},(0,r.createElement)(i.__experimentalVStack,null,Object.keys(e).map((o=>(0,r.createElement)(en,{key:o,settingKey:o,availableSmartTags:t,setting:e[o],saved:n,setAttributes:e=>{a({...n,...e})}}))),(0,r.createElement)(i.__experimentalHStack,{className:"noptin-repeater-item__actions",justify:"flex-start"},!n?.predefined&&(0,r.createElement)(i.Button,{variant:"link",onClick:l,text:(0,s.__)("Remove Item","newsletter-optin-box"),isDestructive:!0}),c&&(0,r.createElement)(i.Button,{onClick:c,icon:"arrow-up-alt",text:(0,s.__)("Move Up","newsletter-optin-box"),size:"small",iconSize:16}),u&&(0,r.createElement)(i.Button,{onClick:u,icon:"arrow-down-alt",text:(0,s.__)("Move Down","newsletter-optin-box"),size:"small",iconSize:16})))))}function Kt({setting:e,availableSmartTags:t,value:n,onChange:a,...o}){const{baseControlProps:l,controlProps:c}=(0,i.useBaseControlProps)(o);Array.isArray(n)||(n=[]);const u=(0,r.useCallback)((({item:e,index:o})=>(0,r.createElement)(i.Flex,{className:"noptin-repeater-item",wrap:!0},Vt.map(((l,i)=>(0,r.createElement)(Qt,{key:i,availableSmartTags:t,field:l,value:void 0===e[l.id]?"":e[l.id],onChange:e=>{const t=[...n];t[o][l.id]=e,a(t)}}))),(0,r.createElement)(i.FlexItem,null,(0,r.createElement)(i.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,s.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:()=>{const e=[...n];e.splice(o,1),a(e)},isDestructive:!0})))),[n,a]);return(0,r.createElement)(i.BaseControl,{...l},(0,r.createElement)("div",{...c},n.map(((e,t)=>(0,r.createElement)(u,{key:t,item:e,index:t}))),(0,r.createElement)(i.Button,{onClick:()=>{const e=[...n];e.push({}),a(e)},variant:"secondary"},e.add_field?e.add_field:(0,s.__)("Add","newsletter-optin-box"))))}function Qt({field:e,availableSmartTags:t,value:n,onChange:a}){const o=Ut({availableSmartTags:t,onMergeTagClick:(0,r.useCallback)((e=>{a&&a(n?`${n} ${e}`.trim():e)}),[n,a])});return(0,r.createElement)(i.FlexBlock,null,(0,r.createElement)(i.__experimentalInputControl,{label:e.label,type:e.type,value:n,placeholder:(0,s.sprintf)((0,s.__)("Enter %s","noptin-addons-pack"),e.label),className:"noptin-component__field noptin-condition-field",suffix:o,onChange:a,isPressEnterToChange:!0,__next40pxDefaultSize:!0}))}function Xt({setting:e,value:t,options:n,onChange:a,...o}){const{baseControlProps:l,controlProps:s}=(0,i.useBaseControlProps)(o);return Array.isArray(t)||(t=[]),(0,r.createElement)(i.BaseControl,{...l},(0,r.createElement)("div",{...s},n.map(((e,n)=>(0,r.createElement)(i.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:n=>{a(n?[...t,e.value]:t.filter((t=>t!==e.value)))}})))))}function Yt({value:e,onChange:t,id:n,...a}){const{baseControlProps:o,controlProps:l}=(0,i.useBaseControlProps)({...a,id:n,__nextHasNoMarginBottom:!0}),{wp:s,tinymce:c}=window,u=(0,r.useRef)(!1),m=(0,r.useRef)(null);return(0,r.useEffect)((()=>{if(!u.current)return;const t=t=>{t?.target?.classList?.contains("wp-switch-editor")&&setTimeout((()=>{const t=c?.get(n);t&&(t.setContent(e||""),t._lastChange=e)}),50)};return m.current?.addEventListener("click",t),()=>{m.current?.removeEventListener("click",t)}}),[m.current,e]),(0,r.useEffect)((()=>{if(!u.current)return;const e=c?.get(n);e&&e._lastChange}),[e]),(0,r.useEffect)((()=>{function r(){s.oldEditor.initialize(n,{tinymce:!!window.tinymce&&{content_css:!1,theme_advanced_buttons:"bold,italic,underline,|,bullist,numlist,blockquote,|,link,unlink,|,spellchecker,fullscreen,|,formatselect,styleselect",drag_drop_upload:!0,toolbar1:"formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,spellchecker,wp_adv,dfw",toolbar2:"strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help",min_height:400,wpautop:!1,setup(n){e&&n.on("loadContent",(()=>n.setContent(e))),n.on("blur",(()=>(t(n.getContent()),!1)));const r=(0,U.debounce)((()=>{const e=n.getContent();e!==n._lastChange&&(n._lastChange=e,t(e))}),250);n.on("Paste Change input Undo Redo",r),n.on("remove",r.cancel),n.on("keydown",(e=>{G.isKeyboardEvent.primary(e,"z")&&e.stopPropagation(),G.isKeyboardEvent.primary(e,"s")&&r.flush();const{altKey:t}=e;t&&e.keyCode===G.F10&&e.stopPropagation()})),u.current=!0},...window?.tinyMCEPreInit?.mceInit[n]||{}},mediaButtons:!0,quicktags:{buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,close"}})}function a(){"complete"===document.readyState&&r()}return c?.execCommand("mceRemoveEditor",!0,n),"complete"===document.readyState?r():document.addEventListener("readystatechange",a),()=>{document.removeEventListener("readystatechange",a),s.oldEditor.remove(n)}}),[]),(0,r.createElement)(i.BaseControl,{...o},(0,r.createElement)("div",{ref:m},(0,r.createElement)("textarea",{...l,className:"wp-editor-area",style:{width:"100%"},value:e,onChange:e=>t(e.target.value),rows:10})))}const Jt=(e,t)=>{if(!t||0===t.length)return;if("string"==typeof t&&(t=t.split(".")),0===t.length||!e||"object"!=typeof e)return;const[n,...r]=t;return 0===r.length?e[n]:Jt(e[n],r)},Zt=(e,t,n)=>{if(!t||0===t.length)return e;"string"==typeof t&&(t=t.split("."));const[r,...a]=t;return 0===a.length?{...e,[r]:n}:{...e,[r]:Zt(e[r]||{},a,n)}};function en({settingKey:e,setting:t,availableSmartTags:n,prop:a,saved:o,setAttributes:l}){const c=(a?`${a}.${e}`:e).split("."),u=t.sanitize?t.sanitize:e=>e,m=(0,r.useCallback)((e=>{if(Jt(o,c)===e)return;const[t,...n]=c;return 0===n.length?l(u({[t]:e})):l(u({[t]:Zt(o[t]||{},n,e)}))}),[o,c,l,u]);if(t.if||t.restrict){const e=t.restrict?t.restrict.split("."):t.if.split(".");if(!Jt(o,e))return null}if(Array.isArray(t.conditions)&&!t.conditions.every((e=>{const t=e.key.split("."),n=e.operator?e.operator:"==";return $t(e.value,n,Jt(o,t))})))return null;if(t.condition&&!t.condition(o))return null;let p=Jt(o,c);(void 0===p||t.disabled)&&(p=t.default);const d=void 0!==p&&""!==p&&null!==p;let f=[];t.options&&(f=Array.isArray(t.options)?[...t.options]:Object.keys(t.options).map((e=>({label:t.options?.[e],value:e}))));const g=`noptin-component__field-${e}`,_="string"==typeof t.description?(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:t.description}}):t.description,h=t.customAttributes?t.customAttributes:{},b={label:t.label,value:d?p:"",onChange:m,className:g,help:_,...h};if(t.tooltip&&(b.label=(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start"},(0,r.createElement)("span",null,t.label),(0,r.createElement)(i.Tooltip,{delay:0,placement:"top",text:t.tooltip},(0,r.createElement)("span",null,(0,r.createElement)(i.Icon,{icon:"info",style:{color:"#454545"}}))))),t.type&&!t.el&&(t.el=t.type,["toggle","switch","checkbox","checkbox_alt","text","number","email","tel","date","color","image"].includes(t.type)&&(t.el="input")),"button"===t.el)return(0,r.createElement)("div",null,(0,r.createElement)(i.Button,{...t.buttonProps||{}}));if("toggle_group"===t.el)return(0,r.createElement)(jt,{...b,options:f});if("select"===t.el)return t.multiple?(0,r.createElement)(Ht,{...b,options:f}):(f.find((e=>""===e?.value))||f.unshift({label:t.placeholder?t.placeholder:(0,s.__)("Select an option","newsletter-optin-box"),value:"",disabled:!t.canSelectPlaceholder}),(0,r.createElement)(i.SelectControl,{...b,options:f,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}));if("combobox"===t.el)return f.unshift({label:t.placeholder?t.placeholder:(0,s.__)("Select an option","newsletter-optin-box"),value:"",disabled:!t.canSelectPlaceholder}),(0,r.createElement)(Lt,{...b,options:f,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0});if("form_token"===t.el||"token"===t.el)return(0,r.createElement)(i.FormTokenField,{...b,value:Array.isArray(b.value)?b.value:[],suggestions:Array.isArray(t.suggestions)?t.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalShowHowTo:!1,__experimentalExpandOnFocus:!0,tokenizeOnBlur:!0});if("multi_checkbox"===t.el||"multi_checkbox_alt"===t.el)return(0,r.createElement)(Xt,{...b,options:f});if("conditional_logic"===t.el)return(0,r.createElement)(Bt,{...b,availableSmartTags:n,comparisons:t.comparisons,toggleText:t.toggle_text,inModal:t.in_modal});if("time"===t.el)return(0,r.createElement)(St,{...b});if("color"===t.el||"input"===t.el&&"color"===t.type)return(0,r.createElement)(Dt,{...b,__nextHasNoMarginBottom:!0});if("unit"===t.el)return(0,r.createElement)(i.__experimentalUnitControl,{labelPosition:"edge",__unstableInputWidth:"80px",__next40pxDefaultSize:!0,isPressEnterToChange:!0,...b});if("input"===t.el){if(t.type&&["toggle","switch","checkbox","checkbox_alt"].includes(t.type))return(0,r.createElement)(i.ToggleControl,{...b,checked:!!d&&p});if("number"===t.type){const e=e=>{if(e)return"string"==typeof e||e instanceof String?(0,r.createElement)(i.__experimentalInputControlSuffixWrapper,null,e):e},n=e=>{if(e)return"string"==typeof e||e instanceof String?(0,r.createElement)(i.__experimentalInputControlPrefixWrapper,null,e):e};return Array.isArray(b.suffix)?b.suffix=e(1===p||"1"===p?b.suffix[0]:b.suffix[1]):b.suffix=e(b.suffix),Array.isArray(b.prefix)?b.prefix=n(1===p||"1"===p?b.prefix[0]:b.prefix[1]):b.prefix=n(b.prefix),(0,r.createElement)(i.__experimentalNumberControl,{...b,placeholder:t.placeholder?t.placeholder:"",__next40pxDefaultSize:!0})}return"image"===t.type&&(b.suffix=(0,r.createElement)(i.Button,{onClick:()=>{var e=window.wp.media({title:(0,s.__)("Upload Image","newsletter-optin-box"),multiple:!1,library:{type:"image"}}).open().on("select",(t=>{let n=e.state().get("selection").first();m(n.toJSON().sizes.full.url)}))},icon:"upload",label:(0,s.__)("Upload Image","newsletter-optin-box"),showTooltip:!0})),(0,r.createElement)(It,{...b,setting:t,availableSmartTags:"trigger_settings"===a?[]:n,isPressEnterToChange:!t.isInputToChange})}return"textarea"===t.el?(0,r.createElement)(Ft,{...b,setting:t,placeholder:t.placeholder?t.placeholder:"",availableSmartTags:"trigger_settings"===a?[]:n}):"tinymce"===t.el?(0,r.createElement)(Yt,{...b}):"paragraph"===t.el?(0,r.createElement)("div",{className:g},(0,r.createElement)(i.Tip,null,t.raw?(0,r.createElement)(L.RawHTML,null,t.content):t.content)):"hero"===t.el?(0,r.createElement)("div",{className:g},(0,r.createElement)("h3",null,t.content)):"key_value_repeater"===t.el||"webhook_key_value_repeater"===t.el?(0,r.createElement)(Kt,{...b,setting:t,availableSmartTags:"trigger_settings"===a?[]:n}):"repeater"===t.el?(0,r.createElement)(Wt,{...b,availableSmartTags:"trigger_settings"===a?[]:n}):(console.log(t),e)}const tn=(0,r.createContext)([]),nn=()=>(0,r.useContext)(tn),rn=({children:e})=>{const{automationRule:{trigger_settings:t,smartTags:n}}=h(),a=(0,r.useMemo)((()=>function(e,t){const n=[];return e?(Object.keys(e).forEach((r=>{const a=e[r];if(a.hidden)return;if(a.conditions&&!a.conditions.every((e=>{let n=!1;return n=Array.isArray(e.value)?e.value.some((n=>n==t[e.key])):e.value==t[e.key],n===("is"===e.operator)})))return;let o=r;a.label?o=a.label:a.description&&(o=a.description),n.push({...a,smart_tag:r,label:o,example:a.example?a.example:"",description:a.description?a.description:"",placeholder:a.placeholder?a.placeholder:"",conditional_logic:!!a.conditional_logic&&a.conditional_logic,options:a.options?a.options:[]})})),n):n}(n,t||{})),[n,t]);return(0,r.createElement)(tn.Provider,{value:a},e)};function an({sectionKey:e,label:t,prop:n,settings:a}){const o=nn(),l=Object.keys(a);if(!l.length)return null;const{automationRule:s,setAttributes:c}=h();return(0,r.createElement)(j,null,(0,r.createElement)(m,{title:t,className:`noptin-automation-rule-editor__section noptin-automation-rule-editor__section-${e}`},(0,r.createElement)(i.__experimentalVStack,{spacing:5,as:i.CardBody},l.map((e=>(0,r.createElement)(en,{key:e,settingKey:e,prop:n,availableSmartTags:o,saved:s,setAttributes:c,setting:a[e]}))))))}function on(){const{error:e,success:t,resetMessages:n,automationRule:{settings:a}}=h(),o=(0,r.createElement)(r.Fragment,null,e&&(0,r.createElement)(i.Notice,{status:"error",onDismiss:n},e),t&&(0,r.createElement)(i.Notice,{status:"success",onDismiss:n},t));if(!a)return o;const l=Object.keys(a);return l.length?(0,r.createElement)(i.__experimentalVStack,{className:"noptin-automation-rule-editor__sections"},o,(0,r.createElement)(j,null,l.map((e=>(0,r.createElement)(an,{key:e,sectionKey:e,...a[e]}))))):o}const ln=window.noptinEmailSettingsMisc||{};function sn(e,t){const n={};Array.isArray(e)||Object.entries(e).forEach((([e,r])=>{if("email"!==e){if(!r.category){if(!ln.isTest)return;r.category="Deprecated"}n[r.category]||(n[r.category]={}),n[r.category][e]={...r,selectText:"triggers"===t?(0,s.__)("Use trigger","newsletter-optin-box"):(0,s.__)("Set-up","newsletter-optin-box"),forcePremium:I(e,r.category)},r.image&&r.image.icon&&["category","editor-table"].includes(r.image.icon)&&(n[r.category][e].forcePremium=!0),r.alt_category&&(n[r.alt_category]||(n[r.alt_category]={}),n[r.alt_category][e]=n[r.category][e])}})),Array.isArray(ln.integrations)&&ln.integrations.forEach((r=>{r.plan&&"free"!==r.plan&&r[t]&&!Array.isArray(r[t])&&Object.entries(r[t]).forEach((([t,a])=>{a.forEach((({id:a,label:o,description:l,premium:i=!1})=>{if("premium"===r.plan||i)if(e[a]){const t=e[a].category;t&&n[t][a]&&(n[t][a].forcePremium=!0)}else n[t]||(n[t]={}),n[t][a]={name:a,label:o,description:l,category:t,image:r.icon_url,forcePremium:!0,is_installed:!1,installation:r.installation}}))}))}));const r={},a=(0,s.__)("General","newsletter-optin-box");return n.hasOwnProperty(a)&&(r[a]=n[a]),Object.keys(n).sort().forEach((e=>{e!==a&&(r[e]=n[e])})),r}ln.license;const cn={"noptin-trigger":{title:(0,s.__)("Select a trigger for your automation rule","newsletter-optin-box"),show:!0,arg:"noptin-trigger",cardGroups:sn(ln.data?.triggers||{},"triggers")},"noptin-action":{title:(0,s.__)("Select an action for your automation rule","newsletter-optin-box"),show:!0,arg:"noptin-action",cardGroups:sn(ln.data?.actions||{},"actions")}},un=(0,r.createContext)(void 0),mn=({children:e})=>{const[t,n]=(0,r.useState)(ln.data?.add_new||(0,k.addQueryArgs)(window.location.href,{noptin_edit_automation_rule:"0"})),a=(0,r.useMemo)((()=>{let e="";const r={};for(const[n,a]of Object.entries(cn)){const o=a.arg?(0,k.getQueryArg)(t,a.arg):"";if(!o){e=n;break}r[n]=o}return{currentTitle:cn[e]?.title||"",currentStep:e,isLastStep:e===Object.keys(cn).pop(),isFirstStep:e===Object.keys(cn)[0],hasSteps:Object.keys(cn).length>0,stepValues:r,steps:cn,campaign:"automation-rules",removeQueryArgs:(...e)=>{n((0,k.removeQueryArgs)(t,...e))},addQueryArg:(e,r)=>{n((0,k.addQueryArgs)(t,{[e]:r}))},withQueryArg:(e,n)=>(0,k.addQueryArgs)(t,{[e]:n}),url:t}}),[t,n]);return(0,r.createElement)(un.Provider,{value:a},e)},pn=({title:e,isOpen:t,closeModal:n,back:a,...o})=>{const l=(0,r.createElement)(r.Fragment,null,a&&(0,r.createElement)(i.Button,{icon:"arrow-left-alt",onClick:a,label:(0,s.__)("Back","newsletter-optin-box"),showTooltip:!0}));return(0,r.createElement)(r.Fragment,null,t&&(0,r.createElement)(i.Modal,{title:e,onRequestClose:n,headerActions:l,isFullScreen:!0},(0,r.createElement)(En,{...o})))},dn={borderRadius:"5px"},fn=({categories:e,selectedCategory:t,onClickCategory:n})=>{const a="noptin-campaign-explorer__sidebar",o=(0,U.useViewportMatch)("medium","<");return(0,r.createElement)(i.__experimentalSurface,{className:a,variant:o?"primary":"secondary",style:dn},!o&&(0,r.createElement)(i.__experimentalElevation,{value:2}),(0,r.createElement)(i.NavigableMenu,{className:`${a}__categories-list`,orientation:o?"horizontal":"vertical",onNavigate:t=>n(e[t])},e.map((e=>(0,r.createElement)(i.Button,{key:e,label:e,text:e,className:`${a}__categories-list__item`,isPressed:t===e,onClick:()=>n(e)})))))},gn=({image:e,title:t})=>{if("string"==typeof e&&e.startsWith("http"))return(0,r.createElement)("img",{src:e,width:24,alt:t,style:{maxWidth:24,height:"auto"}});if(e&&"string"==typeof e)return(0,r.createElement)(i.Icon,{size:24,icon:e,style:{color:"#424242"}});if(e&&"object"==typeof e){const t=e.fill||"#008000",n=e.path||"",a=e.viewBox||"0 0 24 24";return e.path?(0,r.createElement)(i.SVG,{viewBox:a,xmlns:"http://www.w3.org/2000/svg",style:{maxWidth:24}},(0,r.createElement)(i.Path,{fill:t,d:n})):(0,r.createElement)(i.Icon,{size:24,style:{color:t},icon:e.icon})}return(0,r.createElement)(i.Icon,{size:24,icon:"email",style:{color:"#424242"}})},hn=({learnMoreUrl:e,previewURL:t,action:n})=>{const[a,o]=(0,r.useState)(!1),[l,c]=(0,r.useState)(!0),u=()=>o(!1);return e?(0,r.createElement)(i.Button,{variant:"secondary",href:e,target:"_blank"},(0,r.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,s.__)("Learn More"))," ",(0,r.createElement)(i.Icon,{size:16,icon:"arrow-right-alt"})):t?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.Button,{variant:"secondary",onClick:()=>o(!0)},(0,r.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,s.__)("Preview"))," ",(0,r.createElement)(i.Icon,{size:16,icon:"visibility"})),a&&(0,r.createElement)(i.Modal,{title:(0,s.__)("Preview"),onRequestClose:u,className:"noptin-preview-modal",headerActions:(0,r.createElement)(i.__experimentalHStack,{justify:"flex-end",wrap:!0},n,(0,r.createElement)(i.Button,{variant:n?"secondary":"primary",onClick:u},(0,s.__)("Back to templates"))),isDismissible:!1,isFullScreen:!0},l&&(0,r.createElement)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},(0,r.createElement)(i.Spinner,null)),(0,r.createElement)("iframe",{src:t,style:{width:"100%",height:"100%",border:"none",display:l?"none":"block"},onLoad:()=>c(!1)}))):null},bn=({name:e,label:t,description:n,image:a,useValue:o,onSelect:l,hrefCallback:c,href:m,isTemplate:p,...d})=>{const f=void 0===o?e:o,g=(e=>{if(e.forcePremium?!1!==e.is_installed&&e?.licenseDetails?.key:!1!==e.is_installed){const t=e.primary||(0,r.createElement)(i.Button,{variant:"primary",onClick:e.onClick,href:e.href},(0,r.createElement)("span",{className:"noptin-selectable-card__label"},e.selectText||(0,s.__)("Select"))," ",(0,r.createElement)(i.Icon,{size:16,icon:"arrow-right-alt"}));return{upgradeText:null,button:t,secondaryButton:(0,r.createElement)(hn,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:t})}}const t=(t,n)=>!1===e.is_installed&&e.installation?.[t]?e.installation?.[t]:e.licenseDetails[t]||n,n=t("install_desc",(0,s.__)("Activate your license key to unlock","newsletter-optin-box")),a=t("install_text",(0,s.__)("View Pricing","newsletter-optin-box")),o=t("install_url",(0,k.addQueryArgs)("https://noptin.com/pricing/",{utm_source:e.name||"license",utm_campaign:e.campaign||"noptin",utm_medium:"plugin-dashboard"})),l=(0,r.createElement)(i.Button,{variant:"primary",href:o,target:"_blank"},(0,r.createElement)("span",{className:"noptin-selectable-card-action__label"},a)," ",(0,r.createElement)(i.Icon,{size:16,icon:"lock"})),c=!e.licenseDetails?.key&&(0,r.createElement)(i.Button,{variant:"secondary",href:e.licenseDetails?.activate_url},(0,r.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,s.__)("Activate"))," ",(0,r.createElement)(i.Icon,{size:16,icon:"unlock"}));return{upgradeText:n,button:l,secondaryButton:e.licenseDetails?.key||e.previewURL?(0,r.createElement)(hn,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:[l,c]}):c}})({onClick:(0,r.useCallback)((()=>l?l(f):null),[f,l]),name:e.replace("automation_rule_",""),href:c?c(f):m,...d}),_=u("noptin-selectable-card",`noptin-selectable-card__${f}`,p&&"noptin-selectable-card--template");return(0,r.createElement)(i.Card,{className:_,size:"small"},(0,r.createElement)(i.CardHeader,null,(0,r.createElement)(i.__experimentalHeading,{level:4,numberOfLines:1},t),(0,r.createElement)(gn,{image:a,title:t})),p&&a?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"noptin-template-preview__image-wrapper"},(0,r.createElement)("img",{src:a,alt:t,className:"noptin-template-preview__image"})),(0,r.createElement)(i.CardBody,null,g.upgradeText&&(0,r.createElement)(i.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))):(0,r.createElement)(i.CardBody,{style:{flexGrow:1}},(0,r.createElement)(i.__experimentalVStack,{spacing:4},n&&(0,r.createElement)(i.__experimentalText,{as:"p",variant:"muted"},n),p&&!a&&(0,r.createElement)(i.__experimentalText,{as:"em",variant:"muted"},(0,s.__)("No preview available","newsletter-optin-box")),g.upgradeText&&(0,r.createElement)(i.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))),(0,r.createElement)(i.CardFooter,{isBorderless:!0,justify:g.secondaryButton?"space-between":"flex-end"},g.secondaryButton,g.button),(0,r.createElement)(i.__experimentalElevation,{value:1,hover:3}))},yn=["xhuge","huge","wide","xlarge","medium"],vn=({showTitle:e,showSidebar:t,selectedCategory:n,cards:a,...o})=>{const l=yn.map((e=>(0,U.useViewportMatch)(e,">="))).filter((e=>e)).length||1,s="noptin-campaign-explorer";let c=Object.entries(a);c.some((([,e])=>e.isTemplate))||c.sort(((e,t)=>{const n=["latest_posts_digest","periodic","manual_recipients"],r=n.includes(e[0])||e[1].orderFirst,a=n.includes(t[0])||t[1].orderFirst;return r&&!a?-1:!r&&a?1:e[1].label.localeCompare(t[1].label)}));const u=c.reduce(((e,[t,n])=>(n.forcePremium&&!o.licenseDetails?.key?e[1].push([t,n]):e[0].push([t,n]),e)),[[],[]]);return(0,r.createElement)(i.FlexBlock,{className:`${s}__list`},e&&(0,r.createElement)(i.__experimentalHeading,{level:2,lineHeight:"48px",className:`${s}__category-name`},n),(0,r.createElement)(i.__experimentalGrid,{role:"listbox",className:`${s}-list`,columns:t&&l>1?l-1:l,rowGap:32,columnGap:32},u[0].map((([e,t])=>(0,r.createElement)(bn,{key:e,name:e,...o,...t}))),u[1].map((([e,t])=>(0,r.createElement)(bn,{key:e,name:e,...o,...t})))))},xn=({children:e,showSidebar:t,...n})=>{const a=(0,U.useViewportMatch)("medium","<");return t?a?(0,r.createElement)(i.__experimentalVStack,{spacing:4,...n},e):(0,r.createElement)(i.__experimentalHStack,{spacing:4,...n,justify:"stretch",alignment:"start",style:{maxHeight:"100%"}},e):(0,r.createElement)("div",{...n},e)},En=({cardGroups:e,...t})=>{const n=(0,r.useMemo)((()=>Object.keys(e)),[e]),a=n.length,[o,l]=(0,r.useState)(n[0]||"");(0,r.useEffect)((()=>{a>0&&!e[o]&&l(Object.keys(e)[0])}),[e,o]);const i=a>1,s=(0,r.useMemo)((()=>e[o]||{}),[e,o]),c=u("noptin-campaign-explorer",{"noptin-campaign-explorer--show-sidebar":i});return(0,r.createElement)(xn,{className:c,showSidebar:i},i&&(0,r.createElement)(fn,{selectedCategory:o,categories:n,onClickCategory:l}),(0,r.createElement)(vn,{showTitle:i,showSidebar:i,selectedCategory:o,cards:s,...t}))},wn=e=>{if(!e.isOpen)return null;const t=e.steps[e.currentStep];if(t.modal)return(0,r.createElement)(i.Modal,{onRequestClose:e.closeModal,...t.modal.props},t.modal.content);if(t.cardGroups){const n=[...Object.keys(e.stepValues)].pop(),a=e.isLastStep?void 0:n=>{t.arg&&e.addQueryArg(t.arg,n)};return(0,r.createElement)(pn,{title:e.currentTitle,closeModal:e.closeModal,isOpen:e.isOpen,back:n&&!e.isFirstStep?()=>e.removeQueryArgs(e.steps[n]?.arg||""):void 0,cardGroups:"function"==typeof t.cardGroups?t.cardGroups(e.stepValues):t.cardGroups,licenseDetails:e.licenseDetails,onSelect:a,hrefCallback:t.arg&&e.isLastStep?n=>e.withQueryArg(t.arg,n):void 0,campaign:e.campaign,key:t.title})}return null},kn=({buttonProps:e,...t})=>{const[n,a]=(0,r.useState)(!1),o=(0,r.useCallback)((()=>{a(!0)}),[a]),l=(0,r.useCallback)((()=>{a(!1)}),[a]),s=t.currentStep&&t.hasSteps,c={...e,onClick:s?o:void 0,href:s?void 0:t.url};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.Button,{...c}),(0,r.createElement)(wn,{isOpen:n,closeModal:l,...t}))},Cn=({text:e})=>{const t=(()=>{const e=(0,r.useContext)(un);if(!e)throw new Error("useModal must be used within a ModalProvider");return e})();return(0,r.createElement)(kn,{licenseDetails:ln.license||{},buttonProps:{variant:"primary",type:"button",text:e||(0,s.__)("Add New Automation","newsletter-optin-box")},...t})},Sn=({text:e})=>(0,r.createElement)(mn,null,(0,r.createElement)(Cn,{text:e})),An=({children:e})=>{const{automationRule:{trigger_id:t}}=h(),n=I(t,window.noptinEmailSettingsMisc?.triggers?.[t]?.category),[r,a]=P({heading:(0,s.__)("Unlock Premium Feature","newsletter-optin-box"),helpText:(0,s.__)("This automation trigger is only available to premium license holders.","newsletter-optin-box"),needsAddonsPack:!1,slug:"automation-rule-trigger-"+t});return!r&&n?a:e};function Tn(){const{automationRule:{id:e}}=h(),t=!!(e&&e>0);return(0,r.createElement)(i.__experimentalHStack,{justify:"flex-start"},(0,r.createElement)(i.__experimentalText,{as:"h1",size:23,weight:500},t?(0,s.__)("Edit Automation Rule","newsletter-optin-box"):(0,s.__)("Add Automation Rule","newsletter-optin-box")),t&&(0,r.createElement)(Sn,{text:(0,s.__)("Add New","newsletter-optin-box")}))}function Pn({automationRule:e}){return(0,r.createElement)("div",{className:"noptin-automation-rule__editor"},(0,r.createElement)(j,null,(0,r.createElement)(i.SlotFillProvider,null,(0,r.createElement)(b,{automationRule:e},(0,r.createElement)(An,null,(0,r.createElement)(rn,null,(0,r.createElement)(i.__experimentalVStack,{spacing:4},(0,r.createElement)(Tn,null),(0,r.createElement)(i.Flex,{wrap:!0,align:"top"},(0,r.createElement)(i.FlexBlock,{className:"noptin-es6-editor__main"},(0,r.createElement)(on,null)),(0,r.createElement)(i.FlexItem,{className:"noptin-component-editor__sidebar"},(0,r.createElement)(i.__experimentalVStack,null,(0,r.createElement)(D,null),(0,r.createElement)(v,null)))))))))))}var Mn=n(338);const On=e=>{const t=window.noptinEmailSettingsMisc?.data?.app||{};return(0,r.createElement)(L.StrictMode,null,(0,r.createElement)(j,null,(0,r.createElement)(Pn,{...e,...t})))};l()((()=>{((e,t)=>{if(t){const n=t.getAttribute("data-app"),a=n?JSON.parse(n):{};(0,Mn.H)(t).render((0,r.createElement)(e,{...a}))}})(On,document.getElementById("noptin-automation-rule__editor-app"))}))},338:(e,t,n)=>{var r=n(795);t.H=r.createRoot,r.hydrateRoot},20:(e,t,n)=>{var r=n(609),a=Symbol.for("react.element"),o=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,n){var r,s={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,r)&&!i.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===s[r]&&(s[r]=t[r]);return{$$typeof:a,type:e,key:c,ref:u,props:s,_owner:l.current}}},848:(e,t,n)=>{e.exports=n(20)},609:e=>{e.exports=window.React},795:e=>{e.exports=window.ReactDOM}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.m=t,e=[],r.O=(t,n,a,o)=>{if(!n){var l=1/0;for(u=0;u=o)&&Object.keys(r.O).every((e=>r.O[e](n[s])))?n.splice(s--,1):(i=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,a,o]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={180:0,856:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var a,o,l=n[0],i=n[1],s=n[2],c=0;if(l.some((t=>0!==e[t]))){for(a in i)r.o(i,a)&&(r.m[a]=i[a]);if(s)var u=s(r)}for(t&&t(n);cr(750)));a=r.O(a)})(); \ No newline at end of file diff --git a/build/Automation_Rules/assets/js/automation-rules.asset.php b/build/Automation_Rules/assets/js/automation-rules.asset.php index dff56cce..ab992814 100644 --- a/build/Automation_Rules/assets/js/automation-rules.asset.php +++ b/build/Automation_Rules/assets/js/automation-rules.asset.php @@ -1 +1 @@ - array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '1bc71736fdedfdf67332'); + array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '50cd83e185ba05c793cb'); diff --git a/build/Automation_Rules/assets/js/automation-rules.js b/build/Automation_Rules/assets/js/automation-rules.js index b2766e46..ed4bd276 100644 --- a/build/Automation_Rules/assets/js/automation-rules.js +++ b/build/Automation_Rules/assets/js/automation-rules.js @@ -1 +1 @@ -(()=>{"use strict";var e,t={475:(e,t,r)=>{const n=window.wp.domReady;var a=r.n(n);const l=window.React,o=window.wp.i18n,i=window.noptinEmailSettingsMisc||{},s=(i.license,window.wp.url),c=window.wp.components,m=window.noptinEmailEditorSettings||{},u=window.noptinEmailSettingsMisc||{},p=(u.license,m.types||{}),d=(Object.keys(p).map((e=>({value:e,label:p[e].label}))),Object.keys(m.templates||{}).map((e=>({value:e,label:m.templates[e]}))),u.license||{}),_=(d.is_usable&&d.key,/_published|_unpublished|_deleted|_user_role$/),g=["noptin_subscriber_","delete_user","new_user","update_user","wp_login","after_password_reset","create_or_update_"],y=[["woocommerce","subscription"],["latest_","_digest"]],b=["WordPress Users"],w=["latest_posts_digest"],E=["periodic"],h=(e,t=void 0)=>{if(!e||w.includes(e))return!1;if(E.includes(e))return!0;if(t&&b.includes(t))return!0;if(y.some((t=>t.every((t=>e.includes(t))))))return!0;const r=e.replace(/^automation_rule_/,"");return _.test(r)?"post_published"!==r:g.some((e=>r.startsWith(e)))};function f(e,t){const r={};Array.isArray(e)||Object.entries(e).forEach((([e,n])=>{if("email"!==e){if(!n.category){if(!i.isTest)return;n.category="Deprecated"}r[n.category]||(r[n.category]={}),r[n.category][e]={...n,selectText:"triggers"===t?(0,o.__)("Use trigger","newsletter-optin-box"):(0,o.__)("Set-up","newsletter-optin-box"),forcePremium:h(e,n.category)},n.image&&n.image.icon&&["category","editor-table"].includes(n.image.icon)&&(r[n.category][e].forcePremium=!0),n.alt_category&&(r[n.alt_category]||(r[n.alt_category]={}),r[n.alt_category][e]=r[n.category][e])}})),Array.isArray(i.integrations)&&i.integrations.forEach((n=>{n.plan&&"free"!==n.plan&&n[t]&&!Array.isArray(n[t])&&Object.entries(n[t]).forEach((([t,a])=>{a.forEach((({id:a,label:l,description:o,premium:i=!1})=>{if("premium"===n.plan||i)if(e[a]){const t=e[a].category;t&&r[t][a]&&(r[t][a].forcePremium=!0)}else r[t]||(r[t]={}),r[t][a]={name:a,label:l,description:o,category:t,image:n.icon_url,forcePremium:!0,is_installed:!1,installation:n.installation}}))}))}));const n={},a=(0,o.__)("General","newsletter-optin-box");return r.hasOwnProperty(a)&&(n[a]=r[a]),Object.keys(r).sort().forEach((e=>{e!==a&&(n[e]=r[e])})),n}const x={"noptin-trigger":{title:(0,o.__)("Select a trigger for your automation rule","newsletter-optin-box"),show:!0,arg:"noptin-trigger",cardGroups:f(i.data?.triggers||{},"triggers")},"noptin-action":{title:(0,o.__)("Select an action for your automation rule","newsletter-optin-box"),show:!0,arg:"noptin-action",cardGroups:f(i.data?.actions||{},"actions")}},v=(0,l.createContext)(void 0),k=({children:e})=>{const[t,r]=(0,l.useState)(i.data?.add_new||(0,s.addQueryArgs)(window.location.href,{noptin_edit_automation_rule:"0"})),n=(0,l.useMemo)((()=>{let e="";const n={};for(const[r,a]of Object.entries(x)){const l=a.arg?(0,s.getQueryArg)(t,a.arg):"";if(!l){e=r;break}n[r]=l}return{currentTitle:x[e]?.title||"",currentStep:e,isLastStep:e===Object.keys(x).pop(),isFirstStep:e===Object.keys(x)[0],hasSteps:Object.keys(x).length>0,stepValues:n,steps:x,campaign:"automation-rules",removeQueryArgs:(...e)=>{r((0,s.removeQueryArgs)(t,...e))},addQueryArg:(e,n)=>{r((0,s.addQueryArgs)(t,{[e]:n}))},withQueryArg:(e,r)=>(0,s.addQueryArgs)(t,{[e]:r}),url:t}}),[t,r]);return(0,l.createElement)(v.Provider,{value:n},e)},S=({title:e,isOpen:t,closeModal:r,back:n,...a})=>{const i=(0,l.createElement)(l.Fragment,null,n&&(0,l.createElement)(c.Button,{icon:"arrow-left-alt",onClick:n,label:(0,o.__)("Back","newsletter-optin-box"),showTooltip:!0}));return(0,l.createElement)(l.Fragment,null,t&&(0,l.createElement)(c.Modal,{title:e,onRequestClose:r,headerActions:i,isFullScreen:!0},(0,l.createElement)(R,{...a})))};function C(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t{const n="noptin-campaign-explorer__sidebar",a=(0,A.useViewportMatch)("medium","<");return(0,l.createElement)(c.__experimentalSurface,{className:n,variant:a?"primary":"secondary",style:B},!a&&(0,l.createElement)(c.__experimentalElevation,{value:2}),(0,l.createElement)(c.NavigableMenu,{className:`${n}__categories-list`,orientation:a?"horizontal":"vertical",onNavigate:t=>r(e[t])},e.map((e=>(0,l.createElement)(c.Button,{key:e,label:e,text:e,className:`${n}__categories-list__item`,isPressed:t===e,onClick:()=>r(e)})))))},T=(window.wp.element,({image:e,title:t})=>{if("string"==typeof e&&e.startsWith("http"))return(0,l.createElement)("img",{src:e,width:24,alt:t,style:{maxWidth:24,height:"auto"}});if(e&&"string"==typeof e)return(0,l.createElement)(c.Icon,{size:24,icon:e,style:{color:"#424242"}});if(e&&"object"==typeof e){const t=e.fill||"#008000",r=e.path||"",n=e.viewBox||"0 0 24 24";return e.path?(0,l.createElement)(c.SVG,{viewBox:n,xmlns:"http://www.w3.org/2000/svg",style:{maxWidth:24}},(0,l.createElement)(c.Path,{fill:t,d:r})):(0,l.createElement)(c.Icon,{size:24,style:{color:t},icon:e.icon})}return(0,l.createElement)(c.Icon,{size:24,icon:"email",style:{color:"#424242"}})}),j=({learnMoreUrl:e,previewURL:t,action:r})=>{const[n,a]=(0,l.useState)(!1),[i,s]=(0,l.useState)(!0),m=()=>a(!1);return e?(0,l.createElement)(c.Button,{variant:"secondary",href:e,target:"_blank"},(0,l.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,o.__)("Learn More"))," ",(0,l.createElement)(c.Icon,{size:16,icon:"arrow-right-alt"})):t?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(c.Button,{variant:"secondary",onClick:()=>a(!0)},(0,l.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,o.__)("Preview"))," ",(0,l.createElement)(c.Icon,{size:16,icon:"visibility"})),n&&(0,l.createElement)(c.Modal,{title:(0,o.__)("Preview"),onRequestClose:m,className:"noptin-preview-modal",headerActions:(0,l.createElement)(c.__experimentalHStack,{justify:"flex-end",wrap:!0},r,(0,l.createElement)(c.Button,{variant:r?"secondary":"primary",onClick:m},(0,o.__)("Back to templates"))),isDismissible:!1,isFullScreen:!0},i&&(0,l.createElement)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},(0,l.createElement)(c.Spinner,null)),(0,l.createElement)("iframe",{src:t,style:{width:"100%",height:"100%",border:"none",display:i?"none":"block"},onLoad:()=>s(!1)}))):null},N=({name:e,label:t,description:r,image:n,useValue:a,onSelect:i,hrefCallback:m,href:u,isTemplate:p,...d})=>{const _=void 0===a?e:a,g=(e=>{if(e.forcePremium?!1!==e.is_installed&&e?.licenseDetails?.key:!1!==e.is_installed){const t=e.primary||(0,l.createElement)(c.Button,{variant:"primary",onClick:e.onClick,href:e.href},(0,l.createElement)("span",{className:"noptin-selectable-card__label"},e.selectText||(0,o.__)("Select"))," ",(0,l.createElement)(c.Icon,{size:16,icon:"arrow-right-alt"}));return{upgradeText:null,button:t,secondaryButton:(0,l.createElement)(j,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:t})}}const t=(t,r)=>!1===e.is_installed&&e.installation?.[t]?e.installation?.[t]:e.licenseDetails[t]||r,r=t("install_desc",(0,o.__)("Activate your license key to unlock","newsletter-optin-box")),n=t("install_text",(0,o.__)("View Pricing","newsletter-optin-box")),a=t("install_url",(0,s.addQueryArgs)("https://noptin.com/pricing/",{utm_source:e.name||"license",utm_campaign:e.campaign||"noptin",utm_medium:"plugin-dashboard"})),i=(0,l.createElement)(c.Button,{variant:"primary",href:a,target:"_blank"},(0,l.createElement)("span",{className:"noptin-selectable-card-action__label"},n)," ",(0,l.createElement)(c.Icon,{size:16,icon:"lock"})),m=!e.licenseDetails?.key&&(0,l.createElement)(c.Button,{variant:"secondary",href:e.licenseDetails?.activate_url},(0,l.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,o.__)("Activate"))," ",(0,l.createElement)(c.Icon,{size:16,icon:"unlock"}));return{upgradeText:r,button:i,secondaryButton:e.licenseDetails?.key||e.previewURL?(0,l.createElement)(j,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:[i,m]}):m}})({onClick:(0,l.useCallback)((()=>i?i(_):null),[_,i]),name:e.replace("automation_rule_",""),href:m?m(_):u,...d}),y=O("noptin-selectable-card",`noptin-selectable-card__${_}`,p&&"noptin-selectable-card--template");return(0,l.createElement)(c.Card,{className:y,size:"small"},(0,l.createElement)(c.CardHeader,null,(0,l.createElement)(c.__experimentalHeading,{level:4,numberOfLines:1},t),(0,l.createElement)(T,{image:n,title:t})),p&&n?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{style:{width:"100%",flexGrow:1}},(0,l.createElement)("img",{src:n,alt:t,className:"noptin-template-preview__image"})),(0,l.createElement)(c.CardBody,null,g.upgradeText&&(0,l.createElement)(c.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))):(0,l.createElement)(c.CardBody,{style:{flexGrow:1}},(0,l.createElement)(c.__experimentalVStack,{spacing:4},r&&(0,l.createElement)(c.__experimentalText,{as:"p",variant:"muted"},r),p&&!n&&(0,l.createElement)(c.__experimentalText,{as:"em",variant:"muted"},(0,o.__)("No preview available","newsletter-optin-box")),g.upgradeText&&(0,l.createElement)(c.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))),(0,l.createElement)(c.CardFooter,{isBorderless:!0,justify:g.secondaryButton?"space-between":"flex-end"},g.secondaryButton,g.button),(0,l.createElement)(c.__experimentalElevation,{value:1,hover:3}))},D=["xhuge","huge","wide","xlarge","medium"],P=({showTitle:e,showSidebar:t,selectedCategory:r,cards:n,...a})=>{const o=D.map((e=>(0,A.useViewportMatch)(e,">="))).filter((e=>e)).length||1,i="noptin-campaign-explorer";let s=Object.entries(n);s.some((([,e])=>e.isTemplate))||s.sort(((e,t)=>{const r=["latest_posts_digest","periodic","manual_recipients"],n=r.includes(e[0])||e[1].orderFirst,a=r.includes(t[0])||t[1].orderFirst;return n&&!a?-1:!n&&a?1:e[1].label.localeCompare(t[1].label)}));const m=s.reduce(((e,[t,r])=>(r.forcePremium&&!a.licenseDetails?.key?e[1].push([t,r]):e[0].push([t,r]),e)),[[],[]]);return(0,l.createElement)(c.FlexBlock,{className:`${i}__list`},e&&(0,l.createElement)(c.__experimentalHeading,{level:2,lineHeight:"48px",className:`${i}__category-name`},r),(0,l.createElement)(c.__experimentalGrid,{role:"listbox",className:`${i}-list`,columns:t&&o>1?o-1:o,rowGap:32,columnGap:32},m[0].map((([e,t])=>(0,l.createElement)(N,{key:e,name:e,...a,...t}))),m[1].map((([e,t])=>(0,l.createElement)(N,{key:e,name:e,...a,...t})))))},I=({children:e,showSidebar:t,...r})=>{const n=(0,A.useViewportMatch)("medium","<");return t?n?(0,l.createElement)(c.__experimentalVStack,{spacing:4,...r},e):(0,l.createElement)(c.__experimentalHStack,{spacing:4,...r,justify:"stretch",alignment:"start",style:{maxHeight:"100%"}},e):(0,l.createElement)("div",{...r},e)},R=({cardGroups:e,...t})=>{const r=(0,l.useMemo)((()=>Object.keys(e)),[e]),n=r.length,[a,o]=(0,l.useState)(r[0]||"");(0,l.useEffect)((()=>{n>0&&!e[a]&&o(Object.keys(e)[0])}),[e,a]);const i=n>1,s=(0,l.useMemo)((()=>e[a]||{}),[e,a]),c=O("noptin-campaign-explorer",{"noptin-campaign-explorer--show-sidebar":i});return(0,l.createElement)(I,{className:c,showSidebar:i},i&&(0,l.createElement)(M,{selectedCategory:a,categories:r,onClickCategory:o}),(0,l.createElement)(P,{showTitle:i,showSidebar:i,selectedCategory:a,cards:s,...t}))},z=e=>{if(!e.isOpen)return null;const t=e.steps[e.currentStep];if(t.modal)return(0,l.createElement)(c.Modal,{onRequestClose:e.closeModal,...t.modal.props},t.modal.content);if(t.cardGroups){const r=[...Object.keys(e.stepValues)].pop(),n=e.isLastStep?void 0:r=>{t.arg&&e.addQueryArg(t.arg,r)};return(0,l.createElement)(S,{title:e.currentTitle,closeModal:e.closeModal,isOpen:e.isOpen,back:r&&!e.isFirstStep?()=>e.removeQueryArgs(e.steps[r]?.arg||""):void 0,cardGroups:"function"==typeof t.cardGroups?t.cardGroups(e.stepValues):t.cardGroups,licenseDetails:e.licenseDetails,onSelect:n,hrefCallback:t.arg&&e.isLastStep?r=>e.withQueryArg(t.arg,r):void 0,campaign:e.campaign,key:t.title})}return null},L=({buttonProps:e,...t})=>{const[r,n]=(0,l.useState)(!1),a=(0,l.useCallback)((()=>{n(!0)}),[n]),o=(0,l.useCallback)((()=>{n(!1)}),[n]),i=t.currentStep&&t.hasSteps,s={...e,onClick:i?a:void 0,href:i?void 0:t.url};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(c.Button,{...s}),(0,l.createElement)(z,{isOpen:r,closeModal:o,...t}))},F=({text:e})=>{const t=(()=>{const e=(0,l.useContext)(v);if(!e)throw new Error("useModal must be used within a ModalProvider");return e})();return(0,l.createElement)(L,{licenseDetails:i.license||{},buttonProps:{variant:"primary",type:"button",text:e||(0,o.__)("Add New Automation","newsletter-optin-box")},...t})},G=({text:e})=>(0,l.createElement)(k,null,(0,l.createElement)(F,{text:e})),H=()=>(0,l.createElement)(c.__experimentalVStack,{alignment:"center",justify:"center",spacing:6,style:{minHeight:320}},(0,l.createElement)(c.Icon,{icon:"admin-generic",size:100,style:{color:"#646970"}}),(0,l.createElement)(c.__experimentalText,{align:"center",color:"#646970",size:16,isBlock:!0},(0,o.__)('Automation rules are simple "if this, then that" commands. Trigger an action when a product is purchased, a user creates an account, someone is tagged, etc.',"newsletter-optin-box")),(0,l.createElement)(G,{text:(0,o.__)("Create your first automation rule","newsletter-optin-box")}),(0,l.createElement)(c.__experimentalText,{align:"center",size:14,isBlock:!0},(0,l.createElement)("a",{href:"https://noptin.com/guide/automation-rules/",style:{color:"#646970"},target:"_blank"},(0,o.__)("Or Learn more","newsletter-optin-box")))),U=window.wp.apiFetch;var V=r.n(U);const Q=({ruleId:e})=>{const[t,r]=(0,l.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(c.Button,{icon:"trash",size:"compact",showTooltip:!0,label:(0,o.__)("Delete","newsletter-optin-box"),type:"button",onClick:()=>r(!0),isDestructive:!0}),t&&(0,l.createElement)(c.Modal,{onRequestClose:()=>r(!1),title:(0,o.__)("Delete Rule","newsletter-optin-box"),size:"small"},(0,l.createElement)(c.__experimentalVStack,{spacing:4},(0,l.createElement)(c.__experimentalText,null,(0,o.__)("Are you sure you want to delete this automation rule?","newsletter-optin-box")),(0,l.createElement)(c.__experimentalHStack,{spacing:4,justify:"flex-start",alignment:"flex-start"},(0,l.createElement)(c.Button,{variant:"primary",text:(0,o.__)("Delete","newsletter-optin-box"),type:"button",onClick:()=>{r(!1);const t=document.querySelector(`.noptin_automation_rule_${e}`);t&&t.classList.add("noptin-fade-out"),V()({path:`/noptin/v1/automation_rules/${e}`,method:"DELETE"}).then((e=>(t&&t.remove(),e))).catch((e=>{alert(e.message),t&&t.classList.remove("noptin-fade-out")}))},isDestructive:!0}),(0,l.createElement)(c.Button,{variant:"secondary",text:(0,o.__)("Cancel","newsletter-optin-box"),type:"button",onClick:()=>r(!1)})))))},$=({ruleId:e,status:t})=>{const[r,n]=(0,l.useState)(t);return(0,l.createElement)(c.ToggleControl,{checked:r,label:r?(0,o.__)("Active","newsletter-optin-box"):(0,o.__)("Inactive","newsletter-optin-box"),className:"noptin-toggle-button",onChange:()=>{n(!r),V()({path:`/noptin/v1/automation_rules/${e}`,method:"PATCH",data:{status:!r}}).catch((e=>{alert(e.message),n(r)}))},__nextHasNoMarginBottom:!0})},q=e=>(0,l.createElement)(c.__experimentalHStack,{alignment:"center",justify:"flex-end",spacing:1},(0,l.createElement)(c.Button,{href:e.editUrl,label:(0,o.__)("Edit","newsletter-optin-box"),size:"compact",icon:"edit",showTooltip:!0}),(0,l.createElement)(Q,{ruleId:e.ruleId}),(0,l.createElement)($,{ruleId:e.ruleId,status:e.status}));var W=r(338);const J=(e,t)=>{if(t){const r=t.getAttribute("data-app"),n=r?JSON.parse(r):{};(0,W.H)(t).render((0,l.createElement)(e,{...n}))}};a()((()=>{J(H,document.getElementById("noptin-automation-rules__editor--add-new__in-table")),document.querySelectorAll(".noptin-automation-rules__editor--add-new__button").forEach((e=>{J(G,e)})),document.querySelectorAll(".noptin-automation-rule-actions__app").forEach((e=>{J(q,e)}))}))},338:(e,t,r)=>{var n=r(795);t.H=n.createRoot,n.hydrateRoot},795:e=>{e.exports=window.ReactDOM}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var l=r[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,r,a,l)=>{if(!r){var o=1/0;for(m=0;m=l)&&Object.keys(n.O).every((e=>n.O[e](r[s])))?r.splice(s--,1):(i=!1,l0&&e[m-1][2]>l;m--)e[m]=e[m-1];e[m]=[r,a,l]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={229:0,833:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var a,l,o=r[0],i=r[1],s=r[2],c=0;if(o.some((t=>0!==e[t]))){for(a in i)n.o(i,a)&&(n.m[a]=i[a]);if(s)var m=s(n)}for(t&&t(r);cn(475)));a=n.O(a)})(); \ No newline at end of file +(()=>{"use strict";var e,t={475:(e,t,r)=>{const a=window.wp.domReady;var n=r.n(a);const l=window.React,i=window.wp.i18n,o=window.noptinEmailSettingsMisc||{},s=(o.license,window.wp.url),c=window.wp.components,m=window.noptinEmailEditorSettings||{},u=window.noptinEmailSettingsMisc||{},p=(u.license,m.types||{}),d=(Object.keys(p).map((e=>({value:e,label:p[e].label}))),Object.keys(m.templates||{}).map((e=>({value:e,label:m.templates[e]}))),u.license||{}),_=(d.is_usable&&d.key,/_published|_unpublished|_deleted|_user_role$/),g=["noptin_subscriber_","delete_user","new_user","update_user","wp_login","after_password_reset","create_or_update_"],y=[["woocommerce","subscription"],["latest_","_digest"]],b=["WordPress Users"],w=["latest_posts_digest"],E=["periodic"],h=(e,t=void 0)=>{if(!e||w.includes(e))return!1;if(E.includes(e))return!0;if(t&&b.includes(t))return!0;if(y.some((t=>t.every((t=>e.includes(t))))))return!0;const r=e.replace(/^automation_rule_/,"");return _.test(r)?"post_published"!==r:g.some((e=>r.startsWith(e)))};function f(e,t){const r={};Array.isArray(e)||Object.entries(e).forEach((([e,a])=>{if("email"!==e){if(!a.category){if(!o.isTest)return;a.category="Deprecated"}r[a.category]||(r[a.category]={}),r[a.category][e]={...a,selectText:"triggers"===t?(0,i.__)("Use trigger","newsletter-optin-box"):(0,i.__)("Set-up","newsletter-optin-box"),forcePremium:h(e,a.category)},a.image&&a.image.icon&&["category","editor-table"].includes(a.image.icon)&&(r[a.category][e].forcePremium=!0),a.alt_category&&(r[a.alt_category]||(r[a.alt_category]={}),r[a.alt_category][e]=r[a.category][e])}})),Array.isArray(o.integrations)&&o.integrations.forEach((a=>{a.plan&&"free"!==a.plan&&a[t]&&!Array.isArray(a[t])&&Object.entries(a[t]).forEach((([t,n])=>{n.forEach((({id:n,label:l,description:i,premium:o=!1})=>{if("premium"===a.plan||o)if(e[n]){const t=e[n].category;t&&r[t][n]&&(r[t][n].forcePremium=!0)}else r[t]||(r[t]={}),r[t][n]={name:n,label:l,description:i,category:t,image:a.icon_url,forcePremium:!0,is_installed:!1,installation:a.installation}}))}))}));const a={},n=(0,i.__)("General","newsletter-optin-box");return r.hasOwnProperty(n)&&(a[n]=r[n]),Object.keys(r).sort().forEach((e=>{e!==n&&(a[e]=r[e])})),a}const v={"noptin-trigger":{title:(0,i.__)("Select a trigger for your automation rule","newsletter-optin-box"),show:!0,arg:"noptin-trigger",cardGroups:f(o.data?.triggers||{},"triggers")},"noptin-action":{title:(0,i.__)("Select an action for your automation rule","newsletter-optin-box"),show:!0,arg:"noptin-action",cardGroups:f(o.data?.actions||{},"actions")}},x=(0,l.createContext)(void 0),k=({children:e})=>{const[t,r]=(0,l.useState)(o.data?.add_new||(0,s.addQueryArgs)(window.location.href,{noptin_edit_automation_rule:"0"})),a=(0,l.useMemo)((()=>{let e="";const a={};for(const[r,n]of Object.entries(v)){const l=n.arg?(0,s.getQueryArg)(t,n.arg):"";if(!l){e=r;break}a[r]=l}return{currentTitle:v[e]?.title||"",currentStep:e,isLastStep:e===Object.keys(v).pop(),isFirstStep:e===Object.keys(v)[0],hasSteps:Object.keys(v).length>0,stepValues:a,steps:v,campaign:"automation-rules",removeQueryArgs:(...e)=>{r((0,s.removeQueryArgs)(t,...e))},addQueryArg:(e,a)=>{r((0,s.addQueryArgs)(t,{[e]:a}))},withQueryArg:(e,r)=>(0,s.addQueryArgs)(t,{[e]:r}),url:t}}),[t,r]);return(0,l.createElement)(x.Provider,{value:a},e)},S=({title:e,isOpen:t,closeModal:r,back:a,...n})=>{const o=(0,l.createElement)(l.Fragment,null,a&&(0,l.createElement)(c.Button,{icon:"arrow-left-alt",onClick:a,label:(0,i.__)("Back","newsletter-optin-box"),showTooltip:!0}));return(0,l.createElement)(l.Fragment,null,t&&(0,l.createElement)(c.Modal,{title:e,onRequestClose:r,headerActions:o,isFullScreen:!0},(0,l.createElement)(R,{...n})))};function C(e){var t,r,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t{const a="noptin-campaign-explorer__sidebar",n=(0,A.useViewportMatch)("medium","<");return(0,l.createElement)(c.__experimentalSurface,{className:a,variant:n?"primary":"secondary",style:B},!n&&(0,l.createElement)(c.__experimentalElevation,{value:2}),(0,l.createElement)(c.NavigableMenu,{className:`${a}__categories-list`,orientation:n?"horizontal":"vertical",onNavigate:t=>r(e[t])},e.map((e=>(0,l.createElement)(c.Button,{key:e,label:e,text:e,className:`${a}__categories-list__item`,isPressed:t===e,onClick:()=>r(e)})))))},T=(window.wp.element,({image:e,title:t})=>{if("string"==typeof e&&e.startsWith("http"))return(0,l.createElement)("img",{src:e,width:24,alt:t,style:{maxWidth:24,height:"auto"}});if(e&&"string"==typeof e)return(0,l.createElement)(c.Icon,{size:24,icon:e,style:{color:"#424242"}});if(e&&"object"==typeof e){const t=e.fill||"#008000",r=e.path||"",a=e.viewBox||"0 0 24 24";return e.path?(0,l.createElement)(c.SVG,{viewBox:a,xmlns:"http://www.w3.org/2000/svg",style:{maxWidth:24}},(0,l.createElement)(c.Path,{fill:t,d:r})):(0,l.createElement)(c.Icon,{size:24,style:{color:t},icon:e.icon})}return(0,l.createElement)(c.Icon,{size:24,icon:"email",style:{color:"#424242"}})}),j=({learnMoreUrl:e,previewURL:t,action:r})=>{const[a,n]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!0),m=()=>n(!1);return e?(0,l.createElement)(c.Button,{variant:"secondary",href:e,target:"_blank"},(0,l.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,i.__)("Learn More"))," ",(0,l.createElement)(c.Icon,{size:16,icon:"arrow-right-alt"})):t?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(c.Button,{variant:"secondary",onClick:()=>n(!0)},(0,l.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,i.__)("Preview"))," ",(0,l.createElement)(c.Icon,{size:16,icon:"visibility"})),a&&(0,l.createElement)(c.Modal,{title:(0,i.__)("Preview"),onRequestClose:m,className:"noptin-preview-modal",headerActions:(0,l.createElement)(c.__experimentalHStack,{justify:"flex-end",wrap:!0},r,(0,l.createElement)(c.Button,{variant:r?"secondary":"primary",onClick:m},(0,i.__)("Back to templates"))),isDismissible:!1,isFullScreen:!0},o&&(0,l.createElement)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},(0,l.createElement)(c.Spinner,null)),(0,l.createElement)("iframe",{src:t,style:{width:"100%",height:"100%",border:"none",display:o?"none":"block"},onLoad:()=>s(!1)}))):null},N=({name:e,label:t,description:r,image:a,useValue:n,onSelect:o,hrefCallback:m,href:u,isTemplate:p,...d})=>{const _=void 0===n?e:n,g=(e=>{if(e.forcePremium?!1!==e.is_installed&&e?.licenseDetails?.key:!1!==e.is_installed){const t=e.primary||(0,l.createElement)(c.Button,{variant:"primary",onClick:e.onClick,href:e.href},(0,l.createElement)("span",{className:"noptin-selectable-card__label"},e.selectText||(0,i.__)("Select"))," ",(0,l.createElement)(c.Icon,{size:16,icon:"arrow-right-alt"}));return{upgradeText:null,button:t,secondaryButton:(0,l.createElement)(j,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:t})}}const t=(t,r)=>!1===e.is_installed&&e.installation?.[t]?e.installation?.[t]:e.licenseDetails[t]||r,r=t("install_desc",(0,i.__)("Activate your license key to unlock","newsletter-optin-box")),a=t("install_text",(0,i.__)("View Pricing","newsletter-optin-box")),n=t("install_url",(0,s.addQueryArgs)("https://noptin.com/pricing/",{utm_source:e.name||"license",utm_campaign:e.campaign||"noptin",utm_medium:"plugin-dashboard"})),o=(0,l.createElement)(c.Button,{variant:"primary",href:n,target:"_blank"},(0,l.createElement)("span",{className:"noptin-selectable-card-action__label"},a)," ",(0,l.createElement)(c.Icon,{size:16,icon:"lock"})),m=!e.licenseDetails?.key&&(0,l.createElement)(c.Button,{variant:"secondary",href:e.licenseDetails?.activate_url},(0,l.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,i.__)("Activate"))," ",(0,l.createElement)(c.Icon,{size:16,icon:"unlock"}));return{upgradeText:r,button:o,secondaryButton:e.licenseDetails?.key||e.previewURL?(0,l.createElement)(j,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:[o,m]}):m}})({onClick:(0,l.useCallback)((()=>o?o(_):null),[_,o]),name:e.replace("automation_rule_",""),href:m?m(_):u,...d}),y=O("noptin-selectable-card",`noptin-selectable-card__${_}`,p&&"noptin-selectable-card--template");return(0,l.createElement)(c.Card,{className:y,size:"small"},(0,l.createElement)(c.CardHeader,null,(0,l.createElement)(c.__experimentalHeading,{level:4,numberOfLines:1},t),(0,l.createElement)(T,{image:a,title:t})),p&&a?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"noptin-template-preview__image-wrapper"},(0,l.createElement)("img",{src:a,alt:t,className:"noptin-template-preview__image"})),(0,l.createElement)(c.CardBody,null,g.upgradeText&&(0,l.createElement)(c.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))):(0,l.createElement)(c.CardBody,{style:{flexGrow:1}},(0,l.createElement)(c.__experimentalVStack,{spacing:4},r&&(0,l.createElement)(c.__experimentalText,{as:"p",variant:"muted"},r),p&&!a&&(0,l.createElement)(c.__experimentalText,{as:"em",variant:"muted"},(0,i.__)("No preview available","newsletter-optin-box")),g.upgradeText&&(0,l.createElement)(c.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))),(0,l.createElement)(c.CardFooter,{isBorderless:!0,justify:g.secondaryButton?"space-between":"flex-end"},g.secondaryButton,g.button),(0,l.createElement)(c.__experimentalElevation,{value:1,hover:3}))},D=["xhuge","huge","wide","xlarge","medium"],P=({showTitle:e,showSidebar:t,selectedCategory:r,cards:a,...n})=>{const i=D.map((e=>(0,A.useViewportMatch)(e,">="))).filter((e=>e)).length||1,o="noptin-campaign-explorer";let s=Object.entries(a);s.some((([,e])=>e.isTemplate))||s.sort(((e,t)=>{const r=["latest_posts_digest","periodic","manual_recipients"],a=r.includes(e[0])||e[1].orderFirst,n=r.includes(t[0])||t[1].orderFirst;return a&&!n?-1:!a&&n?1:e[1].label.localeCompare(t[1].label)}));const m=s.reduce(((e,[t,r])=>(r.forcePremium&&!n.licenseDetails?.key?e[1].push([t,r]):e[0].push([t,r]),e)),[[],[]]);return(0,l.createElement)(c.FlexBlock,{className:`${o}__list`},e&&(0,l.createElement)(c.__experimentalHeading,{level:2,lineHeight:"48px",className:`${o}__category-name`},r),(0,l.createElement)(c.__experimentalGrid,{role:"listbox",className:`${o}-list`,columns:t&&i>1?i-1:i,rowGap:32,columnGap:32},m[0].map((([e,t])=>(0,l.createElement)(N,{key:e,name:e,...n,...t}))),m[1].map((([e,t])=>(0,l.createElement)(N,{key:e,name:e,...n,...t})))))},I=({children:e,showSidebar:t,...r})=>{const a=(0,A.useViewportMatch)("medium","<");return t?a?(0,l.createElement)(c.__experimentalVStack,{spacing:4,...r},e):(0,l.createElement)(c.__experimentalHStack,{spacing:4,...r,justify:"stretch",alignment:"start",style:{maxHeight:"100%"}},e):(0,l.createElement)("div",{...r},e)},R=({cardGroups:e,...t})=>{const r=(0,l.useMemo)((()=>Object.keys(e)),[e]),a=r.length,[n,i]=(0,l.useState)(r[0]||"");(0,l.useEffect)((()=>{a>0&&!e[n]&&i(Object.keys(e)[0])}),[e,n]);const o=a>1,s=(0,l.useMemo)((()=>e[n]||{}),[e,n]),c=O("noptin-campaign-explorer",{"noptin-campaign-explorer--show-sidebar":o});return(0,l.createElement)(I,{className:c,showSidebar:o},o&&(0,l.createElement)(M,{selectedCategory:n,categories:r,onClickCategory:i}),(0,l.createElement)(P,{showTitle:o,showSidebar:o,selectedCategory:n,cards:s,...t}))},z=e=>{if(!e.isOpen)return null;const t=e.steps[e.currentStep];if(t.modal)return(0,l.createElement)(c.Modal,{onRequestClose:e.closeModal,...t.modal.props},t.modal.content);if(t.cardGroups){const r=[...Object.keys(e.stepValues)].pop(),a=e.isLastStep?void 0:r=>{t.arg&&e.addQueryArg(t.arg,r)};return(0,l.createElement)(S,{title:e.currentTitle,closeModal:e.closeModal,isOpen:e.isOpen,back:r&&!e.isFirstStep?()=>e.removeQueryArgs(e.steps[r]?.arg||""):void 0,cardGroups:"function"==typeof t.cardGroups?t.cardGroups(e.stepValues):t.cardGroups,licenseDetails:e.licenseDetails,onSelect:a,hrefCallback:t.arg&&e.isLastStep?r=>e.withQueryArg(t.arg,r):void 0,campaign:e.campaign,key:t.title})}return null},L=({buttonProps:e,...t})=>{const[r,a]=(0,l.useState)(!1),n=(0,l.useCallback)((()=>{a(!0)}),[a]),i=(0,l.useCallback)((()=>{a(!1)}),[a]),o=t.currentStep&&t.hasSteps,s={...e,onClick:o?n:void 0,href:o?void 0:t.url};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(c.Button,{...s}),(0,l.createElement)(z,{isOpen:r,closeModal:i,...t}))},F=({text:e})=>{const t=(()=>{const e=(0,l.useContext)(x);if(!e)throw new Error("useModal must be used within a ModalProvider");return e})();return(0,l.createElement)(L,{licenseDetails:o.license||{},buttonProps:{variant:"primary",type:"button",text:e||(0,i.__)("Add New Automation","newsletter-optin-box")},...t})},G=({text:e})=>(0,l.createElement)(k,null,(0,l.createElement)(F,{text:e})),H=()=>(0,l.createElement)(c.__experimentalVStack,{alignment:"center",justify:"center",spacing:6,style:{minHeight:320}},(0,l.createElement)(c.Icon,{icon:"admin-generic",size:100,style:{color:"#646970"}}),(0,l.createElement)(c.__experimentalText,{align:"center",color:"#646970",size:16,isBlock:!0},(0,i.__)('Automation rules are simple "if this, then that" commands. Trigger an action when a product is purchased, a user creates an account, someone is tagged, etc.',"newsletter-optin-box")),(0,l.createElement)(G,{text:(0,i.__)("Create your first automation rule","newsletter-optin-box")}),(0,l.createElement)(c.__experimentalText,{align:"center",size:14,isBlock:!0},(0,l.createElement)("a",{href:"https://noptin.com/guide/automation-rules/",style:{color:"#646970"},target:"_blank"},(0,i.__)("Or Learn more","newsletter-optin-box")))),U=window.wp.apiFetch;var V=r.n(U);const Q=({ruleId:e})=>{const[t,r]=(0,l.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(c.Button,{icon:"trash",size:"compact",showTooltip:!0,label:(0,i.__)("Delete","newsletter-optin-box"),type:"button",onClick:()=>r(!0),isDestructive:!0}),t&&(0,l.createElement)(c.Modal,{onRequestClose:()=>r(!1),title:(0,i.__)("Delete Rule","newsletter-optin-box"),size:"small"},(0,l.createElement)(c.__experimentalVStack,{spacing:4},(0,l.createElement)(c.__experimentalText,null,(0,i.__)("Are you sure you want to delete this automation rule?","newsletter-optin-box")),(0,l.createElement)(c.__experimentalHStack,{spacing:4,justify:"flex-start",alignment:"flex-start"},(0,l.createElement)(c.Button,{variant:"primary",text:(0,i.__)("Delete","newsletter-optin-box"),type:"button",onClick:()=>{r(!1);const t=document.querySelector(`.noptin_automation_rule_${e}`);t&&t.classList.add("noptin-fade-out"),V()({path:`/noptin/v1/automation_rules/${e}`,method:"DELETE"}).then((e=>(t&&t.remove(),e))).catch((e=>{alert(e.message),t&&t.classList.remove("noptin-fade-out")}))},isDestructive:!0}),(0,l.createElement)(c.Button,{variant:"secondary",text:(0,i.__)("Cancel","newsletter-optin-box"),type:"button",onClick:()=>r(!1)})))))},$=({ruleId:e,status:t})=>{const[r,a]=(0,l.useState)(t);return(0,l.createElement)(c.ToggleControl,{checked:r,label:r?(0,i.__)("Active","newsletter-optin-box"):(0,i.__)("Inactive","newsletter-optin-box"),className:"noptin-toggle-button",onChange:()=>{a(!r),V()({path:`/noptin/v1/automation_rules/${e}`,method:"PATCH",data:{status:!r}}).catch((e=>{alert(e.message),a(r)}))},__nextHasNoMarginBottom:!0})},q=e=>(0,l.createElement)(c.__experimentalHStack,{alignment:"center",justify:"flex-end",spacing:1},(0,l.createElement)(c.Button,{href:e.editUrl,label:(0,i.__)("Edit","newsletter-optin-box"),size:"compact",icon:"edit",showTooltip:!0}),(0,l.createElement)(Q,{ruleId:e.ruleId}),(0,l.createElement)($,{ruleId:e.ruleId,status:e.status}));var W=r(338);const J=(e,t)=>{if(t){const r=t.getAttribute("data-app"),a=r?JSON.parse(r):{};(0,W.H)(t).render((0,l.createElement)(e,{...a}))}};n()((()=>{J(H,document.getElementById("noptin-automation-rules__editor--add-new__in-table")),document.querySelectorAll(".noptin-automation-rules__editor--add-new__button").forEach((e=>{J(G,e)})),document.querySelectorAll(".noptin-automation-rule-actions__app").forEach((e=>{J(q,e)}))}))},338:(e,t,r)=>{var a=r(795);t.H=a.createRoot,a.hydrateRoot},795:e=>{e.exports=window.ReactDOM}},r={};function a(e){var n=r[e];if(void 0!==n)return n.exports;var l=r[e]={exports:{}};return t[e](l,l.exports,a),l.exports}a.m=t,e=[],a.O=(t,r,n,l)=>{if(!r){var i=1/0;for(m=0;m=l)&&Object.keys(a.O).every((e=>a.O[e](r[s])))?r.splice(s--,1):(o=!1,l0&&e[m-1][2]>l;m--)e[m]=e[m-1];e[m]=[r,n,l]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={229:0,833:0};a.O.j=t=>0===e[t];var t=(t,r)=>{var n,l,i=r[0],o=r[1],s=r[2],c=0;if(i.some((t=>0!==e[t]))){for(n in o)a.o(o,n)&&(a.m[n]=o[n]);if(s)var m=s(a)}for(t&&t(r);ca(475)));n=a.O(n)})(); \ No newline at end of file diff --git a/build/Emails/Admin/Main.php b/build/Emails/Admin/Main.php index 4fb4d75f..58226052 100644 --- a/build/Emails/Admin/Main.php +++ b/build/Emails/Admin/Main.php @@ -453,6 +453,7 @@ public static function enqueue_scripts( $hook ) { ), get_noptin_email_senders( true ) ), + 'assets_url' => plugins_url( 'static/images/', __DIR__ ), ), $script ) diff --git a/build/Emails/Templates.php b/build/Emails/Templates.php index 9470276e..fe8a4989 100644 --- a/build/Emails/Templates.php +++ b/build/Emails/Templates.php @@ -82,12 +82,14 @@ public static function add_templates( $settings, $script ) { } $local_templates = array(); - foreach ( self::get_local_templates() as $template ) { - $local_templates[] = array( - 'id' => $template->id, - 'slug' => $template->name, - 'name' => empty( $template->name ) ? $template->subject : $template->name, - ); + if ( apply_filters( 'noptin_show_local_templates', true ) ) { + foreach ( self::get_local_templates() as $template ) { + $local_templates[] = array( + 'id' => $template->id, + 'slug' => $template->name, + 'name' => empty( $template->name ) ? $template->subject : $template->name, + ); + } } if ( ! empty( $local_templates ) ) { diff --git a/build/Emails/assets/css/style-view-campaigns.css b/build/Emails/assets/css/style-view-campaigns.css index 3b6f5fbf..c902a938 100644 --- a/build/Emails/assets/css/style-view-campaigns.css +++ b/build/Emails/assets/css/style-view-campaigns.css @@ -1 +1 @@ -.noptin-email-campaigns__editor--add-new__button{float:left}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:left;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image{height:auto;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%} +.noptin-email-campaigns__editor--add-new__button{float:left}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:left;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image-wrapper{flex-grow:1;max-height:300px;width:100%}.noptin-selectable-card .noptin-template-preview__image{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%} diff --git a/build/Emails/assets/js/blocks.asset.php b/build/Emails/assets/js/blocks.asset.php index d2db45da..12eea643 100644 --- a/build/Emails/assets/js/blocks.asset.php +++ b/build/Emails/assets/js/blocks.asset.php @@ -1 +1 @@ - array('lodash', 'react', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => 'b4d0db18860ed170b319'); + array('lodash', 'react', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => '2abdf18fd63c77537da5'); diff --git a/build/Emails/assets/js/blocks.js b/build/Emails/assets/js/blocks.js index 30957d85..40056476 100644 --- a/build/Emails/assets/js/blocks.js +++ b/build/Emails/assets/js/blocks.js @@ -1,18 +1,18 @@ -(()=>{"use strict";var e={20:(e,t,n)=>{var o=n(609),r=Symbol.for("react.element"),l=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,n){var o,s={},c=null,u=null;for(o in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)l.call(t,o)&&!i.hasOwnProperty(o)&&(s[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===s[o]&&(s[o]=t[o]);return{$$typeof:r,type:e,key:c,ref:u,props:s,_owner:a.current}}},848:(e,t,n)=>{e.exports=n(20)},609:e=>{e.exports=window.React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const o=window.wp.blocks,r=window.wp.i18n;var l=n(609),a=n.n(l);const i=window.wp.components,s=window.wp.blockEditor,c=(e,t)=>!0===e||(Array.isArray(e)?e.includes(t):"object"==typeof e&&!0===e[t]),u=(e,t,n,o={})=>{const r="object"==typeof o;return[e?.style?.noptin?.[n]||o,t&&(0,l.useCallback)((l=>{t({style:{...e.style||{},noptin:{...e.style?.noptin||{},[n]:r?{...e.style?.noptin?.[n]||o||{},...l}:l}}})}),[e,t,n]),t&&(0,l.useCallback)((()=>{t({style:{...e.style||{},noptin:{...e.style?.noptin||{},[n]:o}}})}),[e,t,n])]},p=["Arial, Helvetica, sans-serif","Verdana, Geneva, sans-serif","Times New Roman, Times, serif","Georgia, serif","Courier New, Courier, monospace","Tahoma, Geneva, sans-serif","Calibri, Arial, sans-serif","Trebuchet MS, sans-serif","Lucida Grande, sans-serif","Palatino, serif"],d=({value:e,onChange:t})=>{const n=p.map((n=>({title:(0,l.createElement)("span",{style:{fontFamily:n}},(0,l.createElement)(i.__experimentalTruncate,{limit:25,ellipsizeMode:"tail"},n)),onClick:()=>t(n),isActive:e===n,label:n})));return(0,l.createElement)(i.__experimentalInputControlSuffixWrapper,null,(0,l.createElement)(i.DropdownMenu,{icon:"admin-customizer",label:(0,r.__)("Font family","newsletter-optin-box"),controls:n,noIcons:!0}))},m=({value:e,onChange:t})=>(0,l.createElement)(i.__experimentalInputControl,{label:(0,r.__)("Font family","newsletter-optin-box"),value:e,onChange:t,suffix:(0,l.createElement)(d,{value:e,onChange:t})}),g={fontFamily:!1,fontSize:!0,fontAppearance:!1,lineHeight:!1,letterSpacing:!1,textTransform:!1,textDecoration:!1},h=[{name:(0,r.__)("Small"),slug:"small",size:13},{name:(0,r.__)("Normal"),slug:"normal",size:16},{name:(0,r.__)("Medium"),slug:"medium",size:20},{name:(0,r.__)("Large"),slug:"large",size:36},{name:(0,r.__)("Huge"),slug:"huge",size:42}];function b({attributes:e={style:{noptin:{typography:{}}}},setAttributes:t,settings:n,panelId:o,defaultControls:a=g}){const[p,d,b]=u(e,t,"typography"),_=c(n,"fontFamily"),f=p.fontFamily,y=e=>d({fontFamily:e}),v=c(n,"fontSize"),x=p.fontSize,k=e=>d({fontSize:e}),w=c(n,"fontStyle"),E=c(n,"fontWeight"),C=w||E,S=p.fontStyle,B=p.fontWeight,I=({fontStyle:e,fontWeight:t})=>d({fontStyle:e,fontWeight:t}),T=c(n,"lineHeight"),M=p.lineHeight,z=e=>d({lineHeight:e}),A=c(n,"letterSpacing"),N=p.letterSpacing,P=e=>d({letterSpacing:e}),H=c(n,"textTransform"),L=p.textTransform,V=e=>d({textTransform:e}),$=c(n,"textDecoration"),R=p.textDecoration,D=e=>d({textDecoration:e});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Typography"),resetAll:b,panelId:o,className:"typography-block-support-panel"},_&&(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Font family"),hasValue:()=>!!f,onDeselect:()=>y(void 0),isShownByDefault:a.fontFamily,panelId:o},(0,l.createElement)(m,{value:f||"",onChange:y})),v&&(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Font size"),hasValue:()=>!!x,onDeselect:()=>k(void 0),isShownByDefault:a.fontSize,panelId:o},(0,l.createElement)(i.FontSizePicker,{value:x,onChange:k,fontSizes:h,disableCustomFontSizes:!1,withReset:!1,units:["px","em","rem"],withSlider:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0})),C&&(0,l.createElement)(i.__experimentalToolsPanelItem,{className:"single-column",label:(0,r.__)("Appearance"),hasValue:()=>!!S||!!B,onDeselect:()=>{I({fontStyle:void 0,fontWeight:void 0})},isShownByDefault:a.fontAppearance,panelId:o},(0,l.createElement)(s.__experimentalFontAppearanceControl,{value:{fontStyle:S,fontWeight:B},onChange:I,hasFontStyles:w,hasFontWeights:E,size:"__unstable-large",__nextHasNoMarginBottom:!0})),T&&(0,l.createElement)(i.__experimentalToolsPanelItem,{className:"single-column",label:(0,r.__)("Line height"),hasValue:()=>!!M,onDeselect:()=>z(void 0),isShownByDefault:a.lineHeight,panelId:o},(0,l.createElement)(s.LineHeightControl,{__nextHasNoMarginBottom:!0,__unstableInputWidth:"auto",value:M,onChange:z,size:"__unstable-large"})),A&&(0,l.createElement)(i.__experimentalToolsPanelItem,{className:"single-column",label:(0,r.__)("Letter spacing"),hasValue:()=>!!N,onDeselect:()=>P(void 0),isShownByDefault:a.letterSpacing,panelId:o},(0,l.createElement)(s.__experimentalLetterSpacingControl,{value:N,onChange:P,size:"__unstable-large",__unstableInputWidth:"auto"})),$&&(0,l.createElement)(i.__experimentalToolsPanelItem,{className:"single-column",label:(0,r.__)("Text decoration"),hasValue:()=>!!R,onDeselect:()=>D(void 0),isShownByDefault:a.textDecoration,panelId:o},(0,l.createElement)(s.__experimentalTextDecorationControl,{value:R,onChange:D,size:"__unstable-large",__unstableInputWidth:"auto"})),H&&(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Letter case"),hasValue:()=>!!L,onDeselect:()=>V(void 0),isShownByDefault:a.textTransform,panelId:o},(0,l.createElement)(s.__experimentalTextTransformControl,{value:L,onChange:V,showNone:!0,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0}))))}const _=e=>{const[t]=u(e,null,"typography");return t},f=()=>window.noptinEmailEditorSettings.settings?.__experimentalFeatures?.color?.palette?.theme||[];function y({attributes:e={style:{noptin:{border:{}}}},setAttributes:t=(e=>e),settings:n,panelId:o}){const[a,p,d]=u(e,t,"border"),m=f();return(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Border"),resetAll:d,panelId:o,className:"border-block-support-panel"},c(n,"border")&&(0,l.createElement)(i.__experimentalToolsPanelItem,{hasValue:()=>(0,i.__experimentalIsDefinedBorder)(a?.border),label:(0,r.__)("Border"),onDeselect:()=>p({border:void 0}),isShownByDefault:!0,panelId:o},(0,l.createElement)(i.__experimentalBorderBoxControl,{colors:m,onChange:e=>p({border:e}),popoverOffset:40,popoverPlacement:"left-start",value:a?.border,__experimentalIsRenderedInSidebar:!0,size:"__unstable-large"})),c(n,"radius")&&(0,l.createElement)(i.__experimentalToolsPanelItem,{hasValue:()=>{const e=a?.radius;return"object"==typeof e?Object.entries(e).some(Boolean):!!e},label:(0,r.__)("Radius"),onDeselect:()=>p({radius:void 0}),isShownByDefault:!0,panelId:o},(0,l.createElement)(s.__experimentalBorderRadiusControl,{values:a?.radius,onChange:e=>p({radius:e})})))}const v=e=>{const[t]=u(e,null,"border");if(!t)return{};const n=(e,t)=>{if(!e)return{};const n={};return["style","width","color"].forEach((o=>{const r=e[o],l=`${t}${o.charAt(0).toUpperCase()+o.slice(1)}`;r&&(n[l]=r)})),n[`${t}Width`]&&!n[`${t}Style`]&&(n[`${t}Style`]="solid"),n},o=e?.style?.noptin?.border;return{...(0,i.__experimentalIsDefinedBorder)(o?.border)?(e=>{if(!(0,i.__experimentalHasSplitBorders)(e))return n(e,"border");let t={};return["top","right","bottom","left"].forEach((o=>{const r=e[o],l=`border${o.charAt(0).toUpperCase()+o.slice(1)}`;t={...t,...n(r,l)}})),t})(o?.border):{},...(r=t.radius,r&&"object"==typeof r?{borderRadius:["topLeft","topRight","bottomRight","bottomLeft"].reduce(((e,t)=>{const n=r[t];return n&&(e=`${e} ${n}`),e}),"")}:{borderRadius:r})};var r};function x(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(i.__experimentalZStack,{isLayered:!1,offset:-8},e.map(((e,t)=>(0,l.createElement)(i.Flex,{key:t,expanded:!1},(0,l.createElement)(i.ColorIndicator,{colorValue:e}))))),(0,l.createElement)(i.FlexItem,{className:"block-editor-panel-color-gradient-settings__color-name",title:t},t));function A({isGradient:e,inheritedValue:t,userValue:n,setValue:o,colorGradientControlSettings:r}){return(0,l.createElement)(s.__experimentalColorGradientControl,{...r,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,colorValue:e?void 0:t,gradientValue:e?t:void 0,onColorChange:e?void 0:o,onGradientChange:e?o:void 0,clearable:t===n,headingLevel:3})}function N({label:e,hasValue:t,resetValue:n,isShownByDefault:o,indicators:a,tabs:s,colorGradientControlSettings:c,panelId:u,isFirst:p=!1,isLast:d=!1}){const m=s.map((({key:e,label:t})=>({name:e,title:t}))),g=k("block-editor-tools-panel-color-gradient-settings__item",{first:p,last:d});return(0,l.createElement)(i.__experimentalToolsPanelItem,{className:g,hasValue:t,label:e,onDeselect:n,isShownByDefault:o,panelId:u},(0,l.createElement)(i.Dropdown,{popoverProps:M,className:"block-editor-tools-panel-color-gradient-settings__dropdown",renderToggle:({onToggle:t,isOpen:n})=>{const o={onClick:t,className:k("block-editor-panel-color-gradient-settings__dropdown",{"is-open":n}),"aria-expanded":n,"aria-label":(0,r.sprintf)(/* translators: %s is the type of color property, e.g., "background" */ /* translators: %s is the type of color property, e.g., "background" */ -(0,r.__)("Color %s styles"),e)};return(0,l.createElement)(i.Button,{...o},(0,l.createElement)(z,{indicators:a,label:e}))},renderContent:()=>(0,l.createElement)(i.__experimentalDropdownContentWrapper,{paddingSize:"none"},(0,l.createElement)("div",{className:"block-editor-panel-color-gradient-settings__dropdown-content"},1===s.length&&(0,l.createElement)(A,{...s[0],colorGradientControlSettings:c}),s.length>1&&(0,l.createElement)(i.TabPanel,{tabs:m},(e=>{const t=s.find((t=>t.key===e.name));return t?(0,l.createElement)(A,{...t,colorGradientControlSettings:c}):null}))))}))}const P={text:!0,background:!0,link:!0,heading:!0,button:!0},H={text:{label:(0,r.__)("Text"),prepare:(e,t)=>{t?.text&&(e.style.color=t.text)}},background:{label:(0,r.__)("Background"),prepare:(e,t)=>{t?.background&&(e.style.backgroundColor=t.background)}},link:{label:(0,r.__)("Link"),prepare:(e,t,n)=>{t?.link&&(e.css=`${e.css} ${n} a { color: ${t.link} }`)}},heading:{label:(0,r.__)("Heading"),tabs:[{key:"heading",label:(0,r.__)("Text")},{key:"headingBackground",label:(0,r.__)("Background")}],prepare:(e,t,n)=>{t?.heading&&(e.css=`${e.css} ${n} h1,\n${n} h2,\n${n} h3,\n${n} h4,\n${n} h5,\n${n} h6 { color: ${t.heading} }`),t?.headingBackground&&(e.css=`${e.css} ${n} h1,\n${n} h2,\n${n} h3,\n${n} h4,\n${n} h5,\n${n} h6 { background-color: ${t.headingBackground} }`)}},button:{label:(0,r.__)("Button"),tabs:[{key:"buttonBackground",label:(0,r.__)("Background")},{key:"button",label:(0,r.__)("Text")}],prepare:(e,t,n)=>{t?.button&&(e.css=`${e.css} ${n} .noptin-button-link,\n${n} .noptin-button-link__wrapper { color: ${t.button} }`),t?.buttonBackground&&(e.css=`${e.css} ${n} .noptin-button-link,\n${n} .noptin-button-link__wrapper { background-color: ${t.buttonBackground} }`)}}};function L({settings:e,panelId:t,defaultControls:n=P,children:o=null,attributes:a,setAttributes:s}){const[p,d,m]=u(a,s,"color"),g=f(),h=(0,w.compact)(Object.keys(H).map((t=>{if(!c(e,t))return!1;const o=H[t].tabs||[{key:t,label:H[t].label}];return{key:t,label:H[t].label,hasValue:()=>!!p[t],resetValue:()=>d({[t]:void 0}),isShownByDefault:n[t],indicators:[p?.[t]],tabs:o.map((({key:e,label:t})=>({key:e,label:t,setValue:t=>d({[e]:t}),userValue:p?.[e]})))}}))),b=h.length;return(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Color"),resetAll:m,panelId:t,className:"color-block-support-panel"},(0,l.createElement)("div",{className:"color-block-support-panel__inner-wrapper",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0px, 1fr))",gap:"calc(16px) calc(8px)",gridColumn:"1 / -1",rowGap:0}},h.map(((e,n)=>(0,l.createElement)(N,{...e,colorGradientControlSettings:{colors:g,disableCustomColors:!1},panelId:t,isFirst:0===n,isLast:n===b-1}))),o))}const V=(e,t)=>{const[n]=u(e,null,"color"),o={style:{},css:""};return n?(Object.values(H).forEach((r=>{r.prepare(o,n,`#noptin-email-content .${t||e.anchor}`)})),o):{style:{},css:""}},$=["none","left","center","right"],R=e=>{const[t]=u(e,null,"align","none");return"none"===t?void 0:t},D=window.noptinEmailEditorSettings||{},O={},j=Object.keys(D.objects||{}).map((e=>{const t=`noptin/${D.objects[e].name.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}`;return O[t]=D.objects[e].label,t})),F=({settings:e,...t})=>(e.edit=(0,E.createHigherOrderComponent)((e=>t=>{const{closestCollection:n,closestCollectionId:o}=(0,S.useSelect)((e=>{const{getBlockParents:n,getBlockName:o}=e(s.store),r=n(t.clientId).find((e=>j.includes(o(e))));return{closestCollection:r?o(r):null,closestCollectionId:r}}),[t.clientId]),{selectBlock:a}=(0,S.useDispatch)(s.store),c=n&&O[n];return(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,null,(0,l.createElement)(i.Button,{variant:"secondary",onClick:()=>a(o),className:"noptin-components-button__is-block",__next40pxDefaultSize:!0},(0,l.createElement)(i.Icon,{icon:"filter"}),(0,r.sprintf)( +(()=>{"use strict";var e={20:(e,t,n)=>{var o=n(609),r=Symbol.for("react.element"),l=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,n){var o,s={},c=null,u=null;for(o in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)l.call(t,o)&&!i.hasOwnProperty(o)&&(s[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===s[o]&&(s[o]=t[o]);return{$$typeof:r,type:e,key:c,ref:u,props:s,_owner:a.current}}},848:(e,t,n)=>{e.exports=n(20)},609:e=>{e.exports=window.React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const o=window.wp.blocks,r=window.wp.i18n;var l=n(609),a=n.n(l);const i=window.wp.components,s=window.wp.blockEditor,c=(e,t)=>!0===e||(Array.isArray(e)?e.includes(t):"object"==typeof e&&!0===e[t]),u=(e,t,n,o={})=>{const r="object"==typeof o;return[e?.style?.noptin?.[n]||o,t&&(0,l.useCallback)((l=>{t({style:{...e.style||{},noptin:{...e.style?.noptin||{},[n]:r?{...e.style?.noptin?.[n]||o||{},...l}:l}}})}),[e,t,n]),t&&(0,l.useCallback)((()=>{t({style:{...e.style||{},noptin:{...e.style?.noptin||{},[n]:o}}})}),[e,t,n])]},p=["Arial, Helvetica, sans-serif","Verdana, Geneva, sans-serif","Times New Roman, Times, serif","Georgia, serif","Courier New, Courier, monospace","Tahoma, Geneva, sans-serif","Calibri, Arial, sans-serif","Trebuchet MS, sans-serif","Lucida Grande, sans-serif","Palatino, serif"],d=({value:e,onChange:t})=>{const n=p.map((n=>({title:(0,l.createElement)("span",{style:{fontFamily:n}},(0,l.createElement)(i.__experimentalTruncate,{limit:25,ellipsizeMode:"tail"},n)),onClick:()=>t(n),isActive:e===n,label:n})));return(0,l.createElement)(i.__experimentalInputControlSuffixWrapper,null,(0,l.createElement)(i.DropdownMenu,{icon:"admin-customizer",label:(0,r.__)("Font family","newsletter-optin-box"),controls:n,noIcons:!0}))},m=({value:e,onChange:t})=>(0,l.createElement)(i.__experimentalInputControl,{label:(0,r.__)("Font family","newsletter-optin-box"),value:e,onChange:t,suffix:(0,l.createElement)(d,{value:e,onChange:t})}),g={fontFamily:!1,fontSize:!0,fontAppearance:!1,lineHeight:!1,letterSpacing:!1,textTransform:!1,textDecoration:!1},h=[{name:(0,r.__)("Small"),slug:"small",size:13},{name:(0,r.__)("Normal"),slug:"normal",size:16},{name:(0,r.__)("Medium"),slug:"medium",size:20},{name:(0,r.__)("Large"),slug:"large",size:36},{name:(0,r.__)("Huge"),slug:"huge",size:42}];function b({attributes:e={style:{noptin:{typography:{}}}},setAttributes:t,settings:n,panelId:o,defaultControls:a=g}){const[p,d,b]=u(e,t,"typography"),_=c(n,"fontFamily"),f=p.fontFamily,y=e=>d({fontFamily:e}),v=c(n,"fontSize"),x=p.fontSize,k=e=>d({fontSize:e}),w=c(n,"fontStyle"),E=c(n,"fontWeight"),C=w||E,S=p.fontStyle,B=p.fontWeight,I=({fontStyle:e,fontWeight:t})=>d({fontStyle:e,fontWeight:t}),T=c(n,"lineHeight"),M=p.lineHeight,z=e=>d({lineHeight:e}),A=c(n,"letterSpacing"),P=p.letterSpacing,N=e=>d({letterSpacing:e}),H=c(n,"textTransform"),L=p.textTransform,V=e=>d({textTransform:e}),$=c(n,"textDecoration"),R=p.textDecoration,D=e=>d({textDecoration:e});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Typography"),resetAll:b,panelId:o,className:"typography-block-support-panel"},_&&(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Font family"),hasValue:()=>!!f,onDeselect:()=>y(void 0),isShownByDefault:a.fontFamily,panelId:o},(0,l.createElement)(m,{value:f||"",onChange:y})),v&&(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Font size"),hasValue:()=>!!x,onDeselect:()=>k(void 0),isShownByDefault:a.fontSize,panelId:o},(0,l.createElement)(i.FontSizePicker,{value:x,onChange:k,fontSizes:h,disableCustomFontSizes:!1,withReset:!1,units:["px","em","rem"],withSlider:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0})),C&&(0,l.createElement)(i.__experimentalToolsPanelItem,{className:"single-column",label:(0,r.__)("Appearance"),hasValue:()=>!!S||!!B,onDeselect:()=>{I({fontStyle:void 0,fontWeight:void 0})},isShownByDefault:a.fontAppearance,panelId:o},(0,l.createElement)(s.__experimentalFontAppearanceControl,{value:{fontStyle:S,fontWeight:B},onChange:I,hasFontStyles:w,hasFontWeights:E,size:"__unstable-large",__nextHasNoMarginBottom:!0})),T&&(0,l.createElement)(i.__experimentalToolsPanelItem,{className:"single-column",label:(0,r.__)("Line height"),hasValue:()=>!!M,onDeselect:()=>z(void 0),isShownByDefault:a.lineHeight,panelId:o},(0,l.createElement)(s.LineHeightControl,{__nextHasNoMarginBottom:!0,__unstableInputWidth:"auto",value:M,onChange:z,size:"__unstable-large"})),A&&(0,l.createElement)(i.__experimentalToolsPanelItem,{className:"single-column",label:(0,r.__)("Letter spacing"),hasValue:()=>!!P,onDeselect:()=>N(void 0),isShownByDefault:a.letterSpacing,panelId:o},(0,l.createElement)(s.__experimentalLetterSpacingControl,{value:P,onChange:N,size:"__unstable-large",__unstableInputWidth:"auto"})),$&&(0,l.createElement)(i.__experimentalToolsPanelItem,{className:"single-column",label:(0,r.__)("Text decoration"),hasValue:()=>!!R,onDeselect:()=>D(void 0),isShownByDefault:a.textDecoration,panelId:o},(0,l.createElement)(s.__experimentalTextDecorationControl,{value:R,onChange:D,size:"__unstable-large",__unstableInputWidth:"auto"})),H&&(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Letter case"),hasValue:()=>!!L,onDeselect:()=>V(void 0),isShownByDefault:a.textTransform,panelId:o},(0,l.createElement)(s.__experimentalTextTransformControl,{value:L,onChange:V,showNone:!0,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0}))))}const _=e=>{const[t]=u(e,null,"typography");return t},f=()=>window.noptinEmailEditorSettings.settings?.__experimentalFeatures?.color?.palette?.theme||[];function y({attributes:e={style:{noptin:{border:{}}}},setAttributes:t=(e=>e),settings:n,panelId:o}){const[a,p,d]=u(e,t,"border"),m=f();return(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Border"),resetAll:d,panelId:o,className:"border-block-support-panel"},c(n,"border")&&(0,l.createElement)(i.__experimentalToolsPanelItem,{hasValue:()=>(0,i.__experimentalIsDefinedBorder)(a?.border),label:(0,r.__)("Border"),onDeselect:()=>p({border:void 0}),isShownByDefault:!0,panelId:o},(0,l.createElement)(i.__experimentalBorderBoxControl,{colors:m,onChange:e=>p({border:e}),popoverOffset:40,popoverPlacement:"left-start",value:a?.border,__experimentalIsRenderedInSidebar:!0,size:"__unstable-large"})),c(n,"radius")&&(0,l.createElement)(i.__experimentalToolsPanelItem,{hasValue:()=>{const e=a?.radius;return"object"==typeof e?Object.entries(e).some(Boolean):!!e},label:(0,r.__)("Radius"),onDeselect:()=>p({radius:void 0}),isShownByDefault:!0,panelId:o},(0,l.createElement)(s.__experimentalBorderRadiusControl,{values:a?.radius,onChange:e=>p({radius:e})})))}const v=e=>{const[t]=u(e,null,"border");if(!t)return{};const n=(e,t)=>{if(!e)return{};const n={};return["style","width","color"].forEach((o=>{const r=e[o],l=`${t}${o.charAt(0).toUpperCase()+o.slice(1)}`;r&&(n[l]=r)})),n[`${t}Width`]&&!n[`${t}Style`]&&(n[`${t}Style`]="solid"),n},o=e?.style?.noptin?.border;return{...(0,i.__experimentalIsDefinedBorder)(o?.border)?(e=>{if(!(0,i.__experimentalHasSplitBorders)(e))return n(e,"border");let t={};return["top","right","bottom","left"].forEach((o=>{const r=e[o],l=`border${o.charAt(0).toUpperCase()+o.slice(1)}`;t={...t,...n(r,l)}})),t})(o?.border):{},...(r=t.radius,r&&"object"==typeof r?{borderRadius:["topLeft","topRight","bottomRight","bottomLeft"].reduce(((e,t)=>{const n=r[t];return n&&(e=`${e} ${n}`),e}),"")}:{borderRadius:r})};var r};function x(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(i.__experimentalZStack,{isLayered:!1,offset:-8},e.map(((e,t)=>(0,l.createElement)(i.Flex,{key:t,expanded:!1},(0,l.createElement)(i.ColorIndicator,{colorValue:e}))))),(0,l.createElement)(i.FlexItem,{className:"block-editor-panel-color-gradient-settings__color-name",title:t},t));function A({isGradient:e,inheritedValue:t,userValue:n,setValue:o,colorGradientControlSettings:r}){return(0,l.createElement)(s.__experimentalColorGradientControl,{...r,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,colorValue:e?void 0:t,gradientValue:e?t:void 0,onColorChange:e?void 0:o,onGradientChange:e?o:void 0,clearable:t===n,headingLevel:3})}function P({label:e,hasValue:t,resetValue:n,isShownByDefault:o,indicators:a,tabs:s,colorGradientControlSettings:c,panelId:u,isFirst:p=!1,isLast:d=!1}){const m=s.map((({key:e,label:t})=>({name:e,title:t}))),g=k("block-editor-tools-panel-color-gradient-settings__item",{first:p,last:d});return(0,l.createElement)(i.__experimentalToolsPanelItem,{className:g,hasValue:t,label:e,onDeselect:n,isShownByDefault:o,panelId:u},(0,l.createElement)(i.Dropdown,{popoverProps:M,className:"block-editor-tools-panel-color-gradient-settings__dropdown",renderToggle:({onToggle:t,isOpen:n})=>{const o={onClick:t,className:k("block-editor-panel-color-gradient-settings__dropdown",{"is-open":n}),"aria-expanded":n,"aria-label":(0,r.sprintf)(/* translators: %s is the type of color property, e.g., "background" */ /* translators: %s is the type of color property, e.g., "background" */ +(0,r.__)("Color %s styles"),e)};return(0,l.createElement)(i.Button,{...o},(0,l.createElement)(z,{indicators:a,label:e}))},renderContent:()=>(0,l.createElement)(i.__experimentalDropdownContentWrapper,{paddingSize:"none"},(0,l.createElement)("div",{className:"block-editor-panel-color-gradient-settings__dropdown-content"},1===s.length&&(0,l.createElement)(A,{...s[0],colorGradientControlSettings:c}),s.length>1&&(0,l.createElement)(i.TabPanel,{tabs:m},(e=>{const t=s.find((t=>t.key===e.name));return t?(0,l.createElement)(A,{...t,colorGradientControlSettings:c}):null}))))}))}const N={text:!0,background:!0,link:!0,heading:!0,button:!0},H={text:{label:(0,r.__)("Text"),prepare:(e,t)=>{t?.text&&(e.style.color=t.text)}},background:{label:(0,r.__)("Background"),prepare:(e,t)=>{t?.background&&(e.style.backgroundColor=t.background)}},link:{label:(0,r.__)("Link"),prepare:(e,t,n)=>{t?.link&&(e.css=`${e.css} ${n} a { color: ${t.link} }`)}},heading:{label:(0,r.__)("Heading"),tabs:[{key:"heading",label:(0,r.__)("Text")},{key:"headingBackground",label:(0,r.__)("Background")}],prepare:(e,t,n)=>{t?.heading&&(e.css=`${e.css} ${n} h1,\n${n} h2,\n${n} h3,\n${n} h4,\n${n} h5,\n${n} h6 { color: ${t.heading} }`),t?.headingBackground&&(e.css=`${e.css} ${n} h1,\n${n} h2,\n${n} h3,\n${n} h4,\n${n} h5,\n${n} h6 { background-color: ${t.headingBackground} }`)}},button:{label:(0,r.__)("Button"),tabs:[{key:"buttonBackground",label:(0,r.__)("Background")},{key:"button",label:(0,r.__)("Text")}],prepare:(e,t,n)=>{t?.button&&(e.css=`${e.css} ${n} .noptin-button-link,\n${n} .noptin-button-link__wrapper { color: ${t.button} }`),t?.buttonBackground&&(e.css=`${e.css} ${n} .noptin-button-link,\n${n} .noptin-button-link__wrapper { background-color: ${t.buttonBackground} }`)}}};function L({settings:e,panelId:t,defaultControls:n=N,children:o=null,attributes:a,setAttributes:s}){const[p,d,m]=u(a,s,"color"),g=f(),h=(0,w.compact)(Object.keys(H).map((t=>{if(!c(e,t))return!1;const o=H[t].tabs||[{key:t,label:H[t].label}];return{key:t,label:H[t].label,hasValue:()=>!!p[t],resetValue:()=>d({[t]:void 0}),isShownByDefault:n[t],indicators:[p?.[t]],tabs:o.map((({key:e,label:t})=>({key:e,label:t,setValue:t=>d({[e]:t}),userValue:p?.[e]})))}}))),b=h.length;return(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Color"),resetAll:m,panelId:t,className:"color-block-support-panel"},(0,l.createElement)("div",{className:"color-block-support-panel__inner-wrapper",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0px, 1fr))",gap:"calc(16px) calc(8px)",gridColumn:"1 / -1",rowGap:0}},h.map(((e,n)=>(0,l.createElement)(P,{...e,colorGradientControlSettings:{colors:g,disableCustomColors:!1},panelId:t,isFirst:0===n,isLast:n===b-1}))),o))}const V=(e,t)=>{const[n]=u(e,null,"color"),o={style:{},css:""};return n?(Object.values(H).forEach((r=>{r.prepare(o,n,`#noptin-email-content .${t||e.anchor}`)})),o):{style:{},css:""}},$=["none","left","center","right"],R=e=>{const[t]=u(e,null,"align","none");return"none"===t?void 0:t},D=window.noptinEmailEditorSettings||{},O={},j=Object.keys(D.objects||{}).map((e=>{const t=`noptin/${D.objects[e].name.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}`;return O[t]=D.objects[e].label,t})),F=({settings:e,...t})=>(e.edit=(0,E.createHigherOrderComponent)((e=>t=>{const{closestCollection:n,closestCollectionId:o}=(0,S.useSelect)((e=>{const{getBlockParents:n,getBlockName:o}=e(s.store),r=n(t.clientId).find((e=>j.includes(o(e))));return{closestCollection:r?o(r):null,closestCollectionId:r}}),[t.clientId]),{selectBlock:a}=(0,S.useDispatch)(s.store),c=n&&O[n];return(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,null,(0,l.createElement)(i.Button,{variant:"secondary",onClick:()=>a(o),className:"noptin-components-button__is-block",__next40pxDefaultSize:!0},(0,l.createElement)(i.Icon,{icon:"filter"}),(0,r.sprintf)( // translators: %s: filter label. // translators: %s: filter label. (0,r.__)("Filter %s","newsletter-optin-box"),c)))),(0,l.createElement)(e,{...t}))}),"withSelectCollection")(e.edit),{settings:e,...t}),U=["core/html","noptin/missing","noptin/shortcode"],W=[...U,"noptin/social-link","noptin/spacer","noptin/social-links","noptin/separator","core/image","noptin/button"];function G(e){if(!e)return;if(U.includes(e.name)){const t=F(e);return(0,o.registerBlockType)({name:t.name,...t.metadata},t.settings)}if(e.metadata.attributes=e.metadata.attributes||{},W.includes(e.name)||e.metadata.attributes?.anchor||(e.metadata.attributes.anchor={type:"string"}),e.metadata?.noptin&&!e.metadata.attributes?.style&&(e.metadata.attributes=e.metadata.attributes||{},e.metadata.attributes.style={type:"object",default:{}}),e.settings?.icon?.icon){let t={src:e.settings.icon.icon,foreground:e.settings.icon.fill||void 0};e.settings.icon=t}const{metadata:t,settings:n,name:r}=F((({metadata:e,settings:t,...n})=>(e?.noptin?.color&&(t.edit=(0,E.createHigherOrderComponent)((t=>n=>{const[o,r]=(()=>{const[e,t]=(0,C.useEntityProp)("postType",(0,S.useSelect)((e=>e(B.store).getCurrentPostType()),[]),"meta"),n=e||{},o=n.campaign_data?.block_css||{};return[o,(e,r)=>{const l={...o,[e]:r};Object.keys(l).forEach((e=>{l[e]||delete l[e]})),t({...n,campaign_data:{...n.campaign_data||{},block_css:l}})}]})(),a=n.attributes?.anchor,i=!W.includes(n.name),c=(0,l.useMemo)((()=>{if(!i)return a;if(!a||I[a]&&I[a]!==n.clientId){const t=e.name.replace("/","-")+"-"+(1e5*Math.random()).toFixed(0);return I[t]=n.clientId,T[n.clientId]=t,t}return I[a]=n.clientId,T[n.clientId]=a,a}),[i,a,n.clientId,e.name]),u=c&&o[c]||"",p=(0,l.useMemo)((()=>i?V(n.attributes,c).css:""),[n.attributes,i,c]);return(0,l.useEffect)((()=>{if(!c||!i)return;const e=T[n.clientId];u!==p?(r(c,p),e&&e!==a&&n.setAttributes({anchor:e})):a&&e&&e!==a&&n.setAttributes({anchor:e})}),[c,u,p,i,r,n.clientId]),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,{group:"styles"},(0,l.createElement)(L,{panelId:n.clientId,attributes:n.attributes,setAttributes:n.setAttributes,settings:e.noptin.color})),(0,l.createElement)(t,{...n}))}),"withNoptinColors")(t.edit)),{metadata:e,settings:t,...n}))((({metadata:e,settings:t,...n})=>(e?.noptin?.align&&(t.edit=(0,E.createHigherOrderComponent)((e=>t=>{const[n,o]=u(t.attributes,t.setAttributes,"align","none");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(s.BlockAlignmentControl,{value:n,onChange:o,controls:$})),(0,l.createElement)(e,{...t}))}),"withNoptinAlignmentSupport")(t.edit)),{metadata:e,settings:t,...n}))((({metadata:e,settings:t,...n})=>{if(e?.noptin?.typography){const n=t.edit;t.edit=t=>{const o=c(e.noptin.typography,"textAlign"),[r,a]=u(t.attributes,t.setAttributes,"typography");return(0,l.createElement)(l.Fragment,null,o&&(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(s.AlignmentControl,{value:r.textAlign,onChange:e=>a({textAlign:e})})),(0,l.createElement)(s.InspectorControls,{group:"styles"},(0,l.createElement)(b,{panelId:t.clientId,attributes:t.attributes,setAttributes:t.setAttributes,settings:e.noptin.typography})),n(t))}}return{metadata:e,settings:t,...n}})((({metadata:e,settings:t,...n})=>{if(e?.noptin?.border){const n=t.edit;t.edit=t=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,{group:"styles"},(0,l.createElement)(y,{panelId:t.clientId,attributes:t.attributes,setAttributes:t.setAttributes,settings:e.noptin.border})),n(t))}return{metadata:e,settings:t,...n}})(e)))));return(0,o.registerBlockType)({name:r,...t},n)}const q=e=>{const t={margin:{},padding:{}};return e?(Object.entries(e).forEach((([e,n])=>{e.startsWith("margin")?t.margin[e]=n:e.startsWith("padding")&&(t.padding[e]=n)})),t):t},Z=(e,t=!1)=>{const n=(0,s.__experimentalGetSpacingClassesAndStyles)(e),o=n?.style||{};return t?q(o):o};Z.save=(e,t=!1)=>{const n=(0,s.__experimentalGetSpacingClassesAndStyles)(e),o=n?.style||{};return t?q(o):o};const K=window.wp.keycodes;function Y(e){const{batch:t}=(0,S.useRegistry)(),{moveBlocksToPosition:n,replaceInnerBlocks:r,duplicateBlocks:a,insertBlock:i}=(0,S.useDispatch)(s.store),{getBlockRootClientId:c,getBlockIndex:u,getBlockOrder:p,getBlockName:d,getBlock:m,getNextBlockClientId:g,canInsertBlockType:h}=(0,S.useSelect)(s.store),b=(0,l.useRef)(e);return b.current=e,(0,E.useRefEffect)((e=>{function l(e){if(e.defaultPrevented)return;if(e.keyCode!==K.ENTER)return;const{content:l,clientId:s}=b.current;if(l.length)return;const _=c(s);if(!(0,o.hasBlockSupport)(d(_),"__experimentalOnEnter",!1))return;const f=p(_),y=f.indexOf(s);if(y===f.length-1){let t=_;for(;!h(d(s),c(t));)t=c(t);return void("string"==typeof t&&(e.preventDefault(),n([s],_,c(t),u(t)+1)))}const v=(0,o.getDefaultBlockName)();if(!h(v,c(_)))return;e.preventDefault();const x=m(_);t((()=>{a([_]);const e=u(_);r(_,x.innerBlocks.slice(0,y)),r(g(_),x.innerBlocks.slice(y+1)),i((0,o.createBlock)(v),e+1,c(_),!0)}))}return e.addEventListener("keydown",l),()=>{e.removeEventListener("keydown",l)}}),[])}const X={apiVersion:3,name:"core/paragraph",title:(0,r.__)("Paragraph"),category:"content",description:(0,r.__)("Start with the basic building block of all narrative."),keywords:["text"],attributes:{content:{type:"string",source:"html",selector:"p",default:"",role:"content"},placeholder:{type:"string"}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0,link:!0}},supports:{anchor:!1,className:!0,splitting:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!1}},__experimentalSelector:"p",__unstablePasteTextInline:!0}},Q={from:[{type:"raw",priority:20,selector:"p",schema:({phrasingContentSchema:e,isPaste:t})=>({p:{children:e,attributes:t?[]:["style","id"]}}),transform(e){const t=(0,o.getBlockAttributes)("core/paragraph",e.outerHTML),{textAlign:n}=e.style||{};return"left"!==n&&"center"!==n&&"right"!==n||(t.style={...t.style||{},noptin:{...t.style?.noptin||{},typography:{...t.style?.noptin?.typography||{},textAlign:n}}}),(0,o.createBlock)("core/paragraph",t)}}]},J=Q,{name:ee}=X,te={icon:"editor-paragraph",example:{attributes:{content:(0,r.__)("In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.")}},__experimentalLabel(e,{context:t}){const n=e?.metadata?.name;if("list-view"===t&&n)return n;if("accessibility"===t){if(n)return n;const{content:t}=e;return t&&0!==t.length?t:(0,r.__)("Empty")}},transforms:J,merge:(e,t)=>({content:(e.content||"")+(t.content||"")}),edit:function({attributes:e,mergeBlocks:t,onReplace:n,onRemove:o,setAttributes:a,clientId:i}){const{content:c,placeholder:u}=e,p=(0,s.useBlockProps)({ref:Y({clientId:i,content:c}),style:{..._(e),...v(e),...Z(e),...V(e).style}});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.RichText,{identifier:"content",tagName:"p",...p,value:c,onChange:e=>a({content:e}),onMerge:t,onReplace:n,onRemove:o,"aria-label":c?(0,r.__)("Block: Paragraph"):(0,r.__)("Empty block; start writing or type forward slash to choose a block"),"data-empty":!c,placeholder:u||(0,r.__)("Start writing or type / to choose a block","newsletter-optin-box"),"data-custom-placeholder":!!u||void 0,__unstableAllowPrefixTransformations:!0}))},save:function({attributes:e}){const{content:t}=e,n=s.useBlockProps.save({style:{..._(e),...v(e),...Z.save(e),...V(e).style}});return(0,l.createElement)("p",{...n},(0,l.createElement)(s.RichText.Content,{value:t}))}},ne={apiVersion:3,name:"core/heading",title:(0,r.__)("Heading"),category:"content",description:(0,r.__)("Introduce new sections and organize content to help readers understand the structure of your content."),keywords:["title","subtitle"],attributes:{content:{type:"string",source:"html",selector:"h1,h2,h3,h4,h5,h6",default:"",role:"content"},level:{type:"number",default:2},placeholder:{type:"string"}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0,link:!0}},supports:{anchor:!1,className:!0,splitting:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!1}},__unstablePasteTextInline:!0,__experimentalSlashInserter:!0}},oe={from:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>e.map((({content:e,className:t,style:n})=>(0,o.createBlock)("core/heading",{content:e,className:t,style:n})))},{type:"raw",selector:"h1,h2,h3,h4,h5,h6",schema:({phrasingContentSchema:e,isPaste:t})=>{const n={children:e,attributes:t?[]:["style","id"]};return{h1:n,h2:n,h3:n,h4:n,h5:n,h6:n}},transform(e){const t=(0,o.getBlockAttributes)("core/heading",e.outerHTML),{textAlign:n}=e.style||{};var r;return t.level=(r=e.nodeName,Number(r.substr(1))),"left"!==n&&"center"!==n&&"right"!==n||(t.style={...t.style||{},noptin:{...t.style?.noptin||{},typography:{...t.style?.noptin?.typography||{},textAlign:n}}}),(0,o.createBlock)("core/heading",t)}},...[1,2,3,4,5,6].map((e=>({type:"prefix",prefix:Array(e+1).join("#"),transform:t=>(0,o.createBlock)("core/heading",{level:e,content:t})}))),...[1,2,3,4,5,6].map((e=>({type:"enter",regExp:new RegExp(`^/(h|H)${e}$`),transform:()=>(0,o.createBlock)("core/heading",{level:e})})))],to:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>e.map((({content:e,className:t,style:n})=>(0,o.createBlock)("core/paragraph",{content:e,className:t,style:n})))}]},re=oe,{name:le}=ne,ae={icon:"heading",example:{attributes:{content:(0,r.__)("Code is Poetry"),level:2}},__experimentalLabel(e,{context:t}){const{content:n,level:o}=e,l=e?.metadata?.name;return"list-view"===t&&(l||n)?e?.metadata?.name||n:"accessibility"===t?n&&0!==n.length?(0,r.sprintf)(/* translators: accessibility text. 1: heading level. 2: heading content. */ /* translators: accessibility text. 1: heading level. 2: heading content. */ (0,r.__)("Level %1$s. %2$s"),o,n):(0,r.sprintf)(/* translators: accessibility text. %s: heading level. */ /* translators: accessibility text. %s: heading level. */ -(0,r.__)("Level %s. Empty."),o):void 0},transforms:re,merge:(e,t)=>({content:(e.content||"")+(t.content||"")}),edit:function({attributes:e,setAttributes:t,mergeBlocks:n,onReplace:o}){const{placeholder:a,content:i,level:c}=e,u=(0,s.useBlockProps)({style:{..._(e),...v(e),...Z(e),...V(e).style}});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(s.HeadingLevelDropdown,{value:c,onChange:e=>t({level:e})})),(0,l.createElement)(s.RichText,{identifier:"content",tagName:"h"+c,value:i,onChange:e=>{t({content:e})},onMerge:n,onReplace:o,onRemove:()=>o([]),placeholder:a||(0,r.__)("Heading"),...u}))},save:function({attributes:e}){const{content:t,level:n}=e,o="h"+n,r=s.useBlockProps.save({style:{..._(e),...v(e),...Z.save(e),...V(e).style}});return(0,l.createElement)(o,{...r},(0,l.createElement)(s.RichText.Content,{value:t}))}},ie=window.wp.primitives;var se=n(848);const ce=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})}),ue=window.wp.blob,pe=window.wp.notices,de=window.wp.url,me=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6 5.5h12a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5ZM4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6Zm4 10h2v-1.5H8V16Zm5 0h-2v-1.5h2V16Zm1 0h2v-1.5h-2V16Z"})}),ge=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M18 20v-2h2v-1.5H7.75a.25.25 0 0 1-.25-.25V4H6v2H4v1.5h2v8.75c0 .966.784 1.75 1.75 1.75h8.75v2H18ZM9.273 7.5h6.977a.25.25 0 0 1 .25.25v6.977H18V7.75A1.75 1.75 0 0 0 16.25 6H9.273v1.5Z"})}),he=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})}),be="none",_e="media",fe="attachment",ye="custom",ve=["image"],xe=({href:e,children:t})=>e?(0,l.createElement)("a",{href:e,onClick:e=>e.preventDefault(),"aria-disabled":!0,style:{pointerEvents:"none",cursor:"default",display:"block",textDecoration:"none",maxWidth:"100%",lineHeight:0}},t):t;function ke({temporaryURL:e,attributes:t,setAttributes:n,isSelected:a,insertBlocksAfter:c,onSelectImage:u,onSelectURL:p,onUploadError:d,containerRef:m,clientId:g,blockEditingMode:h}){const{url:b="",alt:_,caption:f,id:y,href:v,rel:x,linkClass:k,linkDestination:w,width:B,height:I,scale:T,sizeSlug:M}=t,z=R(t),A=B?parseInt(B,10):void 0,N=I?parseInt(I,10):void 0,P=(0,l.useRef)(),H=(0,E.usePrevious)(f),[L,V]=(0,l.useState)(!!f),{image:$,multiImageSelection:D}=(0,S.useSelect)((e=>{const{getMedia:t}=e(C.store),{getMultiSelectedBlockClientIds:n,getBlockName:o}=e(s.store),r=n();return{image:y&&a?t(y,{context:"view"}):null,multiImageSelection:r.length&&r.every((e=>"core/image"===o(e)))}}),[y,a]),{imageEditing:O,imageSizes:j,mediaUpload:F}=(0,S.useSelect)((e=>{const{getSettings:t}=e(s.store),n=t();return{imageEditing:n.imageEditing,imageSizes:n.imageSizes,mediaUpload:n.mediaUpload}}),[g]),{createErrorNotice:U,createSuccessNotice:W}=(0,S.useDispatch)(pe.store),[{loadedNaturalWidth:G,loadedNaturalHeight:q},Z]=(0,l.useState)({loadedNaturalWidth:void 0,loadedNaturalHeight:void 0}),[K,Y]=(0,l.useState)(!1),[X,Q]=(0,l.useState)(),J=function(e,t){const[n,o]=(0,l.useState)();function r(){o(e.current?.clientWidth)}return(0,l.useEffect)(r,t),(0,l.useEffect)((()=>{const{defaultView:t}=e.current.ownerDocument;return t.addEventListener("resize",r),()=>{t.removeEventListener("resize",r)}}),[]),n}(m,[z]),ee="default"===h,te=j.filter((({slug:e})=>$?.media_details?.sizes?.[e]?.source_url)).map((({name:e,slug:t})=>({value:t,label:e}))),ne=!!F;(0,l.useEffect)((()=>{we(y,b)&&a&&ne?X||window.fetch(b.includes("?")?b:b+"?").then((e=>e.blob())).then((e=>Q(e))).catch((()=>{})):Q(void 0)}),[y,b,a,X,ne]),(0,l.useEffect)((()=>{f&&!H&&V(!0)}),[f,H]);const oe=(0,l.useCallback)((e=>{e&&!f&&e.focus()}),[f]),{naturalWidth:re,naturalHeight:le}=(0,l.useMemo)((()=>({naturalWidth:P.current?.naturalWidth||G||void 0,naturalHeight:P.current?.naturalHeight||q||void 0})),[G,q,P.current?.complete]);(0,l.useEffect)((()=>{a||(Y(!1),f||V(!1))}),[a,f]);const ae=y&&re&&le&&O,ie=!D&&ae&&!K,se=()=>{n({width:void 0,height:void 0,scale:void 0})},ce=(0,i.__experimentalUseCustomUnits)({availableUnits:["px"]}),be=(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Width"),isShownByDefault:!0,hasValue:()=>!!B,onDeselect:()=>n({width:void 0}),panelId:g,style:{gridColumn:"span 1"}},(0,l.createElement)(s.__experimentalUnitControl,{label:(0,r.__)("Width"),placeholder:(0,r.__)("Auto"),labelPosition:"top",min:0,value:B||"",onChange:e=>n({width:e?`${e}`:void 0}),size:"__unstable-large"})),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Height"),isShownByDefault:!0,hasValue:()=>!!I,onDeselect:()=>n({height:void 0}),panelId:g,style:{gridColumn:"span 1"}},(0,l.createElement)(s.__experimentalUnitControl,{label:(0,r.__)("Height"),placeholder:(0,r.__)("Auto"),labelPosition:"top",units:ce,min:0,value:I||"",onChange:e=>n({height:e}),size:"__unstable-large"}))),_e=(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},ee&&(0,l.createElement)(i.ToolbarButton,{onClick:()=>{V(!L),L&&f&&n({caption:void 0})},icon:me,isPressed:L,label:L?(0,r.__)("Remove caption"):(0,r.__)("Add caption")}),!D&&!K&&(0,l.createElement)(s.__experimentalImageURLInputUI,{url:v||"",onChangeUrl:n,linkDestination:w,mediaUrl:$&&$.source_url||b,mediaLink:$&&$.link,linkClass:k,rel:x}),ie&&(0,l.createElement)(i.ToolbarButton,{onClick:()=>Y(!0),icon:ge,label:(0,r.__)("Crop")})),!D&&!K&&(0,l.createElement)(s.BlockControls,{group:"other"},(0,l.createElement)(s.MediaReplaceFlow,{mediaId:y,mediaURL:b,allowedTypes:ve,accept:"image/*",onSelect:u,onSelectURL:p,onError:d})),!D&&X&&(0,l.createElement)(s.BlockControls,null,(0,l.createElement)(i.ToolbarGroup,null,(0,l.createElement)(i.ToolbarButton,{onClick:function(){F({filesList:[X],onFileChange([e]){u(e),(0,ue.isBlobURL)(e.url)||(Q(void 0),W((0,r.__)("Image uploaded."),{type:"snackbar"}))},allowedTypes:ve,onError(e){U(e,{type:"snackbar"})}})},icon:he,label:(0,r.__)("Upload external image")}))),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Settings"),panelId:g,resetAll:se},!D&&(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Alternative text"),isShownByDefault:!0,hasValue:()=>""!==_,panelId:g,onDeselect:()=>n({alt:void 0})},(0,l.createElement)(i.TextareaControl,{label:(0,r.__)("Alternative text"),value:_,onChange:e=>n({alt:e}),help:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,r.__)("Describe the purpose of the image.")),(0,l.createElement)("br",null),(0,r.__)("Leave empty if decorative.")),__nextHasNoMarginBottom:!0})),ee&&(0,l.createElement)(l.Fragment,null,te.length>0?(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Image size"),isShownByDefault:!0,hasValue:()=>"large"!==M,panelId:g,onDeselect:()=>n({sizeSlug:"large"})},(0,l.createElement)(i.SelectControl,{label:(0,r.__)("Image size"),value:M,options:te,onChange:function(e){const t=$?.media_details?.sizes?.[e]?.source_url;if(!t)return null;n({url:t,sizeSlug:e,height:void 0})},className:"noptin-field-control",__nextHasNoMarginBottom:!0})):null,be)))),fe=(0,de.getFilename)(b);let ye;ye=_||(fe?(0,r.sprintf)(/* translators: %s: file name */ /* translators: %s: file name */ -(0,r.__)("This image has an empty alt attribute; its file name is %s"),fe):(0,r.__)("This image has an empty alt attribute"));const ke=P.current?.width||J,Ee=ae&&K,Ce=(0,l.createElement)(xe,{href:v},Ee?(0,l.createElement)(s.__experimentalImageEditor,{id:y,url:b,width:A,height:N,clientWidth:ke,naturalHeight:le,naturalWidth:re,onSaveImage:e=>n(e),onFinishEditing:()=>{Y(!1)}}):(0,l.createElement)(l.Fragment,null,(0,l.createElement)("img",{src:e||b,alt:ye,onLoad:e=>{Z({loadedNaturalWidth:e.target?.naturalWidth,loadedNaturalHeight:e.target?.naturalHeight})},ref:P,style:{width:!B&&I?"auto":B,height:I,objectFit:T,maxWidth:"100%"}}),e&&(0,l.createElement)(i.Spinner,null)));return b||e?(0,l.createElement)(l.Fragment,null,!e&&_e,Ce,L&&(!s.RichText.isEmpty(f)||a)&&(0,l.createElement)(s.RichText,{identifier:"caption",ref:oe,className:"wp-block-image__caption",tagName:"div","aria-label":(0,r.__)("Image caption text"),placeholder:(0,r.__)("Add caption"),value:f,onChange:e=>n({caption:e}),inlineToolbar:!0,__unstableOnSplitAtEnd:()=>c((0,o.createBlock)((0,o.getDefaultBlockName)())),style:{fontSize:"12px",textAlign:z,marginTop:"12px"}})):(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Settings"),panelId:g,resetAll:se},ee&&be))}const we=(e,t)=>t&&!e&&!(0,ue.isBlobURL)(t);function Ee(e,t){var n,o;return"url"in(null!==(n=e?.sizes?.[t])&&void 0!==n?n:{})||"source_url"in(null!==(o=e?.media_details?.sizes?.[t])&&void 0!==o?o:{})}const Ce={apiVersion:3,name:"core/image",title:(0,r.__)("Image"),category:"content",description:(0,r.__)("Insert an image to make a visual statement."),keywords:["img","picture","media","photo"],attributes:{blob:{type:"string",role:"local"},url:{type:"string",source:"attribute",selector:"img",attribute:"src",role:"content"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:"",role:"content"},caption:{type:"string",source:"html",selector:".wp-block-image__caption",role:"content"},href:{type:"string",source:"attribute",selector:"a",attribute:"href",role:"content"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"a",attribute:"class"},id:{type:"number",role:"content"},width:{type:"string"},height:{type:"string"},scale:{type:"string"},sizeSlug:{type:"string",default:"large"},linkDestination:{type:"string"},link:{type:"string"}},supports:{anchor:!1,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0}}},noptin:{border:!0,align:!0},selectors:{border:".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder"}};function Se(e,t){const{body:n}=document.implementation.createHTMLDocument("");n.innerHTML=e;const{firstElementChild:o}=n;if(o&&"A"===o.nodeName)return o.getAttribute(t)||void 0}const Be={img:{attributes:["src","alt"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+$/]}},Ie={from:[{type:"raw",isMatch:e=>"FIGURE"===e.nodeName&&!!e.querySelector("img"),schema:({phrasingContentSchema:e})=>({figure:{require:["img"],children:{...Be,a:{attributes:["href","rel"],children:Be},figcaption:{children:e}}}}),transform:e=>{const t=e.className+" "+e.querySelector("img").className,n=/(?:^|\s)align(left|center|right)(?:$|\s)/.exec(t),r=""===e.id?void 0:e.id,l=n?n[1]:void 0,a=/(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(t),i=a?Number(a[1]):void 0,s=e.querySelector("a"),c=s&&s.href?"custom":void 0,u=s&&s.href?s.href:void 0,p=s&&s.rel?s.rel:void 0,d=s&&s.className?s.className:void 0,m=(0,o.getBlockAttributes)("core/image",e.outerHTML,{id:i,linkDestination:c,href:u,rel:p,linkClass:d,anchor:r,style:{noptin:{align:l}}});return(0,o.createBlock)("core/image",m)}},{type:"shortcode",tag:"caption",attributes:{url:{type:"string",source:"attribute",attribute:"src",selector:"img"},alt:{type:"string",source:"attribute",attribute:"alt",selector:"img"},caption:{shortcode:function(e,{shortcode:t}){const{body:n}=document.implementation.createHTMLDocument("");n.innerHTML=t.content;let o=n.querySelector("img");for(;o&&o.parentNode&&o.parentNode!==n;)o=o.parentNode;return o&&o.parentNode.removeChild(o),n.innerHTML.trim()}},href:{shortcode:(e,{shortcode:t})=>Se(t.content,"href")},rel:{shortcode:(e,{shortcode:t})=>Se(t.content,"rel")},linkClass:{shortcode:(e,{shortcode:t})=>Se(t.content,"class")},id:{type:"number",shortcode:({named:{id:e}})=>{if(e)return parseInt(e.replace("attachment_",""),10)}}}}]},Te=Ie;window?.wp?.media?.view?.settings?.defaultProps&&Object.entries(window.wp.media.view.settings.defaultProps).forEach((([e,t])=>{Ce.attributes[e]&&(Ce.attributes[e].default=t)}));const{name:Me}=Ce,ze={icon:ce,example:{attributes:{sizeSlug:"large",url:"https://s.w.org/images/core/5.3/MtBlanc1.jpg",caption:"Mont Blanc appears—still, snowy, and serene."}},__experimentalLabel(e,{context:t}){if("accessibility"===t){const{caption:t,alt:n,url:o}=e;return o?n?n+(t?". "+t:""):t||"":(0,r.__)("Empty")}},transforms:Te,edit:function({attributes:e,setAttributes:t,isSelected:n,className:o,insertBlocksAfter:a,onReplace:c,context:u,clientId:p}){const{url:d="",alt:m,caption:g,id:h,width:b,height:_,sizeSlug:f}=e,[y,x]=(0,l.useState)(e.blob);(0,l.useEffect)((()=>{b&&/^\d+$/.test(b)&&t({width:`${b}px`})}),[b]);const w=R(e),E=(0,l.useRef)();(0,l.useEffect)((()=>{E.current=m}),[m]);const C=(0,l.useRef)();(0,l.useEffect)((()=>{C.current=g}),[g]);const B=(0,l.useRef)(),I=(0,s.useBlockEditingMode)(),{createErrorNotice:T}=(0,S.useDispatch)(pe.store);function M(e){T(e,{type:"snackbar"}),t({src:void 0,id:void 0,url:void 0,blob:void 0})}function z(n){if(!n||!n.url)return t({url:void 0,alt:void 0,id:void 0,title:void 0,caption:void 0,blob:void 0}),void x(void 0);if((0,ue.isBlobURL)(n.url))return void x(n.url);let o="full";f&&Ee(n,f)?o=f:Ee(n,"large")&&(o="large");let r,l=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption","width","url"].includes(e)))),o=["width","url"];return e?.sizes?.[t]?o.forEach((o=>{e.sizes[t][o]&&(n[o]=e.sizes[t][o])})):e?.media_details?.sizes?.[t]&&o.forEach((o=>{e.media_details.sizes[t][o]?n[o]=e.media_details.sizes[t][o]:e.media_details.sizes[t][`source_${o}`]&&(n[o]=e.media_details.sizes[t][`source_${o}`])})),n.width&&(n.width=`${n.width}`),n.height=void 0,n})(n,o);if(C.current&&!l.caption){const{caption:e,...t}=l;l=t}r=n.id&&n.id===h?{url:d}:{sizeSlug:o};let a,i=e.linkDestination;if(!i)switch(window?.wp?.media?.view?.settings?.defaultProps?.link||be){case"file":case _e:i=_e;break;case"post":case fe:i=fe;break;case ye:i=ye;break;case be:i=be}switch(i){case _e:a=n.url;break;case fe:a=n.link}l.href=a,t({blob:void 0,...l,...r,width:void 0,linkDestination:i}),x(void 0)}function A(e){e!==d&&(t({blob:void 0,url:e,id:void 0,sizeSlug:"large"}),x(void 0))}!function(e={}){const t=(0,l.useRef)(e),n=(0,l.useRef)(!1),{getSettings:o}=(0,S.useSelect)(s.store,[]);(0,l.useLayoutEffect)((()=>{t.current=e})),(0,l.useEffect)((()=>{if(n.current)return;if(!t.current.url||!(0,ue.isBlobURL)(t.current.url))return;const e=(0,ue.getBlobByURL)(t.current.url);if(!e)return;const{url:r,allowedTypes:l,onChange:a,onError:i}=t.current,{mediaUpload:s}=o();n.current=!0,s({filesList:[e],allowedTypes:l,onFileChange:([e])=>{(0,ue.isBlobURL)(e?.url)||((0,ue.revokeBlobURL)(r),a(e),n.current=!1)},onError:e=>{(0,ue.revokeBlobURL)(r),i(e),n.current=!1}})}),[o])}({url:y,allowedTypes:ve,onChange:z,onError:M});const N=we(h,d)?d:void 0,P=!!d&&(0,l.createElement)("img",{alt:(0,r.__)("Edit image"),title:(0,r.__)("Edit image"),className:"edit-image-preview",src:d}),H={className:k(o,"noptin-image-block__wrapper",{"is-transient":!!y,"is-resized":!!b||!!_,[`size-${f}`]:f}),border:0,cellPadding:"0",cellSpacing:"0",role:"presentation"};"left"!==w&&"right"!==w||(H.align=w,H.className+=" noptin-image-block__wrapper-is-aligned");const L=(0,s.useBlockProps)({ref:B,...H}),V={...v(e),...Z(e),display:e.width?"inline-block":"block",maxWidth:"100%"};return(0,l.createElement)("table",{...L},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:w},(0,l.createElement)("div",{className:k("noptin-block__margin-wrapper",{"is-selected":n}),style:V},(0,l.createElement)(ke,{temporaryURL:y,attributes:e,setAttributes:t,isSelected:n,insertBlocksAfter:a,onReplace:c,onSelectImage:z,onSelectURL:A,onUploadError:M,containerRef:B,context:u,clientId:p,blockEditingMode:I}),(0,l.createElement)(s.MediaPlaceholder,{icon:(0,l.createElement)(s.BlockIcon,{icon:ce}),onSelect:z,onSelectURL:A,onError:M,placeholder:e=>(0,l.createElement)(i.Placeholder,{className:"block-editor-media-placeholder",withIllustration:!n,icon:ce,label:(0,r.__)("Image"),instructions:(0,r.__)("Upload an image file, pick one from your media library, or add one with a URL."),style:{width:b,height:_}},e),accept:"image/*",allowedTypes:["image"],handleUpload:e=>1===e.length,value:{id:h,src:N},mediaPreview:P,disableMediaButtons:y||d}))))))},save:function({attributes:e}){const{url:t,alt:n,caption:o,href:r,rel:a,linkClass:i,width:c,height:u}=e,p=R(e),d=(0,l.createElement)("img",{src:t,alt:n,width:c&&c.endsWith("px")?c.slice(0,-2):void 0,border:"0",style:{width:!c&&u?"auto":c,height:u,maxWidth:"100%"}}),m={...v(e),...Z.save(e),display:"inline-block",maxWidth:"100%"},g=(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:m},r?(0,l.createElement)("a",{className:i,href:r,rel:a||void 0,style:{display:"block",textDecoration:"none",maxWidth:"100%",lineHeight:0}},d):d,!s.RichText.isEmpty(o)&&(0,l.createElement)(s.RichText.Content,{className:"wp-block-image__caption",tagName:"div",value:o,style:{fontSize:"12px",textAlign:"center",marginTop:"12px"}})),h={className:"noptin-image-block__wrapper",border:0,cellPadding:"0",cellSpacing:"0",role:"presentation"};return"left"!==p&&"right"!==p||(h.align=p,h.className+=" noptin-image-block__wrapper-is-aligned"),(0,l.createElement)("table",{...s.useBlockProps.save(h)},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:p},g))))}};function Ae(e){return e.replace(/<\/?a[^>]*>/g,"")}const Ne=(e,t="")=>{const[n]=u(e,null,"color"),o={style:{},vmlOpen:"",vmlClose:""};if(!e.style?.background?.backgroundImage?.url)return o;o.style.backgroundImage=`url("${e.style.background.backgroundImage.url}")`,o.style.backgroundSize=e.style.background.backgroundSize||"contain",o.style.backgroundPosition=e.style.background.backgroundPosition||"center center",o.style.backgroundRepeat=e.style.background.backgroundRepeat||"no-repeat";const r=n?.background||"#ffffff";return o.vmlOpen=`\n\t\t\x3c!--[if gte mso 9]>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\n\t\t\t\t\n\t\t\t\n\t\tt({url:e}),__nextHasNoMarginBottom:!0}),(0,l.createElement)(i.__experimentalToggleGroupControl,{label:(0,r.__)("Button width"),className:"noptin-toggle-group-control",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isAdaptiveWidth:!0,isBlock:!0,isDeselectable:!0,onChange:function(n){const o=e.width===n?void 0:n;t({width:o})}},[25,50,75,100].map((e=>(0,l.createElement)(i.__experimentalToggleGroupControlOption,{key:e,label:`${e}%`,value:e})))))}const He={apiVersion:3,name:"noptin/button",title:(0,r.__)("Button"),category:"content",description:(0,r.__)("Prompt readers to take action with a button-style link.","newsletter-optin-box"),keywords:["link","cta"],attributes:{url:{type:"string",source:"attribute",selector:"a",attribute:"href",role:"content"},title:{type:"string",source:"attribute",selector:"a",attribute:"title",role:"content"},text:{type:"string",source:"html",selector:"a",role:"content"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel",role:"content",default:"noopener noreferrer"},placeholder:{type:"string"},style:{type:"object",default:{noptin:{border:{radius:"5px"},typography:{textTransform:"none",textDecoration:"none",textAlign:"center"}}}},width:{type:"number"}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0},align:!0},supports:{anchor:!1,reusable:!1,shadow:!1,splitting:!0,background:{__experimentalSkipSerialization:!0,backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0,__experimentalDefaultControls:{backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0}},spacing:{__experimentalSkipSerialization:!0,padding:["horizontal","vertical"],margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}}},Le=window.wp.element,{name:Ve}=He,$e={icon:"button",example:{attributes:{text:(0,r.__)("Call to Action")}},edit:function(e){const{attributes:t,setAttributes:n,isSelected:a,onReplace:c,mergeBlocks:u,clientId:p}=e,{placeholder:d,rel:m,text:g,width:h}=t,b=R(t),f=_(t),[y,x]=(0,l.useState)(null),k=Ne(t),w=v(t),C=V(t).style,B=Z(t,!0),I=(0,l.useRef)(),T=(0,l.useRef)(),M=(0,s.useBlockProps)({ref:(0,E.useMergeRefs)([x,I]),width:"100%",border:0,cellPadding:0,cellSpacing:0,role:"presentation",className:"noptin-button-block__wrapper"}),[z,A]=(0,l.useState)(!0);(0,l.useEffect)((()=>{a&&A(!0)}),[a]);const N=function(e){const{replaceBlocks:t,selectionChange:n}=(0,S.useDispatch)(s.store),{getBlock:r,getBlockRootClientId:a,getBlockIndex:i}=(0,S.useSelect)(s.store),c=(0,l.useRef)(e);return c.current=e,(0,E.useRefEffect)((e=>{function l(e){if(e.defaultPrevented||e.keyCode!==K.ENTER)return;const{content:l,clientId:s}=c.current;if(l.length)return;e.preventDefault();const u=r(a(s)),p=i(s),d=(0,o.cloneBlock)({...u,innerBlocks:u.innerBlocks.slice(0,p)}),m=(0,o.createBlock)((0,o.getDefaultBlockName)()),g=u.innerBlocks.slice(p+1),h=g.length?[(0,o.cloneBlock)({...u,innerBlocks:g})]:[];t(u.clientId,[d,m,...h],1),n(m.clientId)}return e.addEventListener("keydown",l),()=>{e.removeEventListener("keydown",l)}}),[])}({content:g,clientId:p}),P=(0,E.useMergeRefs)([N,T]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("table",{...M},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:b},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:B.margin},(0,l.createElement)("table",{width:h?`${h}%`:void 0},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{bgcolor:C.backgroundColor,role:"presentation",valign:"middle",className:"noptin-button-link__wrapper",style:{backgroundColor:C.backgroundColor,...k.style,textAlign:f?.textAlign,cursor:"auto",...w}},(0,l.createElement)(s.RichText,{ref:P,tagName:"span","aria-label":(0,r.__)("Button text"),placeholder:d||(0,r.__)("Add text…"),value:g,onChange:e=>n({text:Ae(e)}),withoutInteractiveFormatting:!0,className:"noptin-button-link",style:{...B.padding,...f||{},color:C.color,margin:"0px",display:"block"},onReplace:c,onMerge:u,identifier:"text"})))))))))),a&&z&&(0,l.createElement)(i.Popover,{placement:"bottom",onClose:()=>{A(!1),T.current?.focus()},anchor:y,focusOnMount:!1,__unstableSlotName:"__unstable-block-tools-after",shift:!0},(0,l.createElement)(s.URLInput,{label:(0,r.__)("Button URL"),help:(0,r.__)("The URL to link to."),className:"block-editor-link-control__field noptin-link-control-popover__field",value:t.url||"",onChange:e=>n({url:e}),__nextHasNoMarginBottom:!0})),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(Pe,{attributes:t,setAttributes:n})),(0,l.createElement)(s.InspectorControls,{group:"advanced"},(0,l.createElement)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Link rel"),value:m||"",onChange:e=>n({rel:e})})))},save:function({attributes:e}){const{rel:t,text:n,title:o,url:r,width:a}=e,i=R(e),c=v(e),u=V(e),p=Ne(e,a),d=u?.style?.backgroundColor,m=u?.style?.color,g=Z.save(e,!0),h={...g.padding,..._(e),borderRadius:c?.borderRadius,margin:"0px",display:"block",color:m,wordBreak:"break-word"},b=s.useBlockProps.save({width:"100%",border:0,cellPadding:0,cellSpacing:0,role:"presentation",className:"noptin-button-block__wrapper"});if(!n)return null;const f={...p.style};return f.backgroundImage?f.backgroundColor=d:f.background=d,(0,l.createElement)("table",{...b},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:i},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:g.margin},p.vmlOpen&&(0,l.createElement)(Le.RawHTML,{children:p.vmlOpen}),(0,l.createElement)("table",{width:a?`${a}%`:void 0},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{bgcolor:d,role:"presentation",valign:"middle",className:"noptin-button-link__wrapper",style:{...f,textAlign:h.textAlign,cursor:"auto",...c}},(0,l.createElement)(s.RichText.Content,{tagName:"a",className:"noptin-button-link",href:r,title:o,style:h,value:n,rel:t}))))),p.vmlClose&&(0,l.createElement)(Le.RawHTML,{children:p.vmlClose}))))))},merge:(e,{text:t=""})=>({...e,text:(e.text||"")+t})},Re=["noptin/social-link"],De=[{name:"facebook",color:"#3b5998",title:"Facebook"},{name:"twitter",color:"#55acee",title:"Twitter"},{name:"youtube",color:"#eb3323",title:"YouTube"}],Oe=De.map((({name:e,title:t,color:n})=>["noptin/social-link",{img:`https://www.mailjet.com/images/theme/v1/icons/ico-social/${e}.png`,url:"#",label:t,style:{noptin:{border:{radius:"50%"},color:{background:n}}}}])),je={iconSize:{label:(0,r.__)("Icon size"),options:{"20px":(0,r.__)("S"),"32px":(0,r.__)("M"),"48px":(0,r.__)("L"),"64px":(0,r.__)("XL")}},iconSpacing:{label:(0,r.__)("Icon spacing"),options:{"0px":(0,r.__)("None"),"4px":(0,r.__)("S"),"16px":(0,r.__)("M"),"24px":(0,r.__)("L")}},iconPadding:{label:(0,r.__)("Icon padding"),options:{"0px":(0,r.__)("None"),"4px":(0,r.__)("S"),"16px":(0,r.__)("M"),"24px":(0,r.__)("L")}}};function Fe({attributes:e,setAttributes:t}){return(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},Object.entries(je).map((([n,o])=>(0,l.createElement)(i.__experimentalToggleGroupControl,{key:n,label:o.label,value:e[n],onChange:e=>t({[n]:e}),className:"noptin-field-control",__nextHasNoMarginBottom:!0,isAdaptiveWidth:!0,isBlock:!0,isDeselectable:!0},Object.entries(o.options).map((([e,t])=>(0,l.createElement)(i.__experimentalToggleGroupControlOption,{key:`${n}__${e}`,label:t,value:e})))))))}const Ue={apiVersion:3,name:"noptin/social-links",title:(0,r.__)("Social Icons"),category:"content",description:(0,r.__)("Display icons linking to your social media profiles or sites."),keywords:["links"],attributes:{iconSize:{type:"string",default:"20px"},iconSpacing:{type:"string",default:"4px"},iconPadding:{type:"string",default:"4px"}},providesContext:{"noptin/social-links/iconSize":"iconSize"},noptin:{border:!0,color:{background:!0},align:!0},supports:{anchor:!1,__experimentalExposeControlsToChildren:!0,spacing:{margin:!0,padding:!0,units:["px","em","rem"],__experimentalSkipSerialization:!0,__experimentalDefaultControls:{margin:!0,padding:!1}}}},{name:We}=Ue,Ge={example:{innerBlocks:De.map((({name:e,title:t,color:n})=>({name:"noptin/social-link",attributes:{img:`https://www.mailjet.com/images/theme/v1/icons/ico-social/${e}.png`,url:"#",label:t,style:{noptin:{border:{radius:"50%"},color:{background:n}}}}})))},icon:"share",edit:function({attributes:e,setAttributes:t}){const{iconSpacing:n,iconPadding:o}=e,r=R(e),a=Z(e,!0),i=v(e),c=(0,s.useBlockProps)({style:a.margin,className:"noptin-block__margin-wrapper"}),u=(0,s.useInnerBlocksProps)({},{allowedBlocks:Re,template:Oe,templateLock:!1,orientation:"horizontal",__experimentalAppenderTagName:"td"}),p={lineHeight:"100%",width:"100%",borderCollapse:"separate",...V(e).style,...i};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(Fe,{attributes:e,setAttributes:t})),(0,l.createElement)("div",{...c},(0,l.createElement)("table",{role:"presentation",cellPadding:0,cellSpacing:0,border:0,width:"100%",style:p},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:r,style:a.padding,border:"0",role:"presentation",valign:"middle"},(0,l.createElement)("table",{align:r,cellPadding:o||0,cellSpacing:n||0,style:{borderCollapse:"separate"}},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",{...u})))))))))},save:({attributes:e})=>{const{iconSpacing:t,iconPadding:n}=e,o=R(e),r=Z.save(e,!0),a=v(e),i=s.useBlockProps.save({style:r.margin,className:"noptin-block__margin-wrapper"}),c={lineHeight:"100%",width:"100%",borderCollapse:"separate",...V(e).style,...a};return(0,l.createElement)("div",{...i},(0,l.createElement)("table",{role:"presentation",cellPadding:0,cellSpacing:0,border:0,width:"100%",style:c},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:o,style:r.padding,border:"0",role:"presentation",valign:"middle"},(0,l.createElement)("table",{align:o,cellPadding:n||0,cellSpacing:t||0,style:{borderCollapse:"separate"}},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)(s.InnerBlocks.Content,null)))))))))}},qe={apiVersion:3,name:"noptin/social-link",title:(0,r.__)("Social Icon"),category:"content",parent:["noptin/social-links"],description:(0,r.__)("Display an icon linking to a social media profile or site."),attributes:{iconSize:{type:"string",default:"20px"},url:{type:"string"},img:{type:"string"},label:{type:"string"},rel:{type:"string",default:"noopener noreferrer"}},usesContext:["noptin/social-links/iconSize"],noptin:{border:!0,color:{background:!0}},supports:{reusable:!1,anchor:!1,html:!1}},Ze=[{name:"facebook",color:"#3b5998",title:"Facebook"},{name:"twitter",color:"#55acee",title:"Twitter"},{name:"google-plus",color:"#dc4e41",title:"Google Plus",icon:"google"},{name:"pinterest",color:"#bd081c",title:"Pinterest"},{name:"linkedin",color:"#0077b5",title:"linkedIn"},{name:"instagram",color:"#3f729b",title:"Instagram"},{name:"youtube",color:"#eb3323",title:"YouTube"},{name:"tumblr",color:"#344356",title:"Tumblr",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z"}))},{name:"github",color:"#000000",title:"GitHub",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"}))},{name:"xing",color:"#296366",title:"Xing"},{name:"vimeo",color:"#53B4E7",title:"Vimeo",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M22.396,7.164c-0.093,2.026-1.507,4.799-4.245,8.32C15.322,19.161,12.928,21,10.97,21c-1.214,0-2.24-1.119-3.079-3.359 c-0.56-2.053-1.119-4.106-1.68-6.159C5.588,9.243,4.921,8.122,4.206,8.122c-0.156,0-0.701,0.328-1.634,0.98L1.594,7.841 c1.027-0.902,2.04-1.805,3.037-2.708C6.001,3.95,7.03,3.327,7.715,3.264c1.619-0.156,2.616,0.951,2.99,3.321 c0.404,2.557,0.685,4.147,0.841,4.769c0.467,2.121,0.981,3.181,1.542,3.181c0.435,0,1.09-0.688,1.963-2.065 c0.871-1.376,1.338-2.422,1.401-3.142c0.125-1.187-0.343-1.782-1.401-1.782c-0.498,0-1.012,0.115-1.541,0.341 c1.023-3.35,2.977-4.977,5.862-4.884C21.511,3.066,22.52,4.453,22.396,7.164z"}))},{name:"medium",color:"#000000",title:"Medium",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M20.962,7.257l-5.457,8.867l-3.923-6.375l3.126-5.08c0.112-0.182,0.319-0.286,0.527-0.286c0.05,0,0.1,0.008,0.149,0.02 c0.039,0.01,0.078,0.023,0.114,0.041l5.43,2.715l0.006,0.003c0.004,0.002,0.007,0.006,0.011,0.008 C20.971,7.191,20.98,7.227,20.962,7.257z M9.86,8.592v5.783l5.14,2.57L9.86,8.592z M15.772,17.331l4.231,2.115 C20.554,19.721,21,19.529,21,19.016V8.835L15.772,17.331z M8.968,7.178L3.665,4.527C3.569,4.479,3.478,4.456,3.395,4.456 C3.163,4.456,3,4.636,3,4.938v11.45c0,0.306,0.224,0.669,0.498,0.806l4.671,2.335c0.12,0.06,0.234,0.088,0.337,0.088 c0.29,0,0.494-0.225,0.494-0.602V7.231C9,7.208,8.988,7.188,8.968,7.178z"}))},{name:"soundcloud",color:"#EF7F31",title:"SoundCloud",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M8.9,16.1L9,14L8.9,9.5c0-0.1,0-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1c-0.1,0-0.1,0-0.1,0.1c0,0-0.1,0.1-0.1,0.1L8.3,14l0.1,2.1 c0,0.1,0,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1C8.8,16.3,8.9,16.3,8.9,16.1z M11.4,15.9l0.1-1.8L11.4,9c0-0.1,0-0.2-0.1-0.2 c0,0-0.1,0-0.1,0s-0.1,0-0.1,0c-0.1,0-0.1,0.1-0.1,0.2l0,0.1l-0.1,5c0,0,0,0.7,0.1,2v0c0,0.1,0,0.1,0.1,0.1c0.1,0.1,0.1,0.1,0.2,0.1 c0.1,0,0.1,0,0.2-0.1c0.1,0,0.1-0.1,0.1-0.2L11.4,15.9z M2.4,12.9L2.5,14l-0.2,1.1c0,0.1,0,0.1-0.1,0.1c0,0-0.1,0-0.1-0.1L2.1,14 l0.1-1.1C2.2,12.9,2.3,12.9,2.4,12.9C2.3,12.9,2.4,12.9,2.4,12.9z M3.1,12.2L3.3,14l-0.2,1.8c0,0.1,0,0.1-0.1,0.1 c-0.1,0-0.1,0-0.1-0.1L2.8,14L3,12.2C3,12.2,3,12.2,3.1,12.2C3.1,12.2,3.1,12.2,3.1,12.2z M3.9,11.9L4.1,14l-0.2,2.1 c0,0.1,0,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L3.5,14l0.2-2.1c0-0.1,0-0.1,0.1-0.1C3.9,11.8,3.9,11.8,3.9,11.9z M4.7,11.9L4.9,14 l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L4.3,14l0.2-2.2c0-0.1,0-0.1,0.1-0.1C4.7,11.7,4.7,11.8,4.7,11.9z M5.6,12 l0.2,2l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c0,0-0.1,0-0.1,0c0,0,0-0.1,0-0.1L5.1,14l0.2-2c0,0,0-0.1,0-0.1s0.1,0,0.1,0 C5.5,11.9,5.5,11.9,5.6,12L5.6,12z M6.4,10.7L6.6,14l-0.2,2.1c0,0,0,0.1,0,0.1c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.2L5.9,14 l0.2-3.3c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0C6.4,10.7,6.4,10.7,6.4,10.7z M7.2,10l0.2,4.1l-0.2,2.1c0,0,0,0.1,0,0.1 c0,0-0.1,0-0.1,0c-0.1,0-0.2-0.1-0.2-0.2l-0.1-2.1L6.8,10c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0S7.2,9.9,7.2,10z M8,9.6L8.2,14 L8,16.1c0,0.1-0.1,0.2-0.2,0.2c-0.1,0-0.2-0.1-0.2-0.2L7.5,14l0.1-4.4c0-0.1,0-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1c0.1,0,0.1,0,0.1,0.1 C8,9.6,8,9.6,8,9.6z M11.4,16.1L11.4,16.1L11.4,16.1z M9.7,9.6L9.8,14l-0.1,2.1c0,0.1,0,0.1-0.1,0.2s-0.1,0.1-0.2,0.1 c-0.1,0-0.1,0-0.1-0.1s-0.1-0.1-0.1-0.2L9.2,14l0.1-4.4c0-0.1,0-0.1,0.1-0.2s0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S9.7,9.5,9.7,9.6 L9.7,9.6z M10.6,9.8l0.1,4.3l-0.1,2c0,0.1,0,0.1-0.1,0.2c0,0-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c0,0-0.1-0.1-0.1-0.2L10,14 l0.1-4.3c0-0.1,0-0.1,0.1-0.2c0,0,0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S10.6,9.7,10.6,9.8z M12.4,14l-0.1,2c0,0.1,0,0.1-0.1,0.2 c-0.1,0.1-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2l-0.1-1l-0.1-1l0.1-5.5v0c0-0.1,0-0.2,0.1-0.2 c0.1,0,0.1-0.1,0.2-0.1c0,0,0.1,0,0.1,0c0.1,0,0.1,0.1,0.1,0.2L12.4,14z M22.1,13.9c0,0.7-0.2,1.3-0.7,1.7c-0.5,0.5-1.1,0.7-1.7,0.7 h-6.8c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2V8.2c0-0.1,0.1-0.2,0.2-0.3c0.5-0.2,1-0.3,1.6-0.3c1.1,0,2.1,0.4,2.9,1.1 c0.8,0.8,1.3,1.7,1.4,2.8c0.3-0.1,0.6-0.2,1-0.2c0.7,0,1.3,0.2,1.7,0.7C21.8,12.6,22.1,13.2,22.1,13.9L22.1,13.9z"}))},{name:"dribbble",color:"#D95988",title:"Dribbble",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M12,22C6.486,22,2,17.514,2,12S6.486,2,12,2c5.514,0,10,4.486,10,10S17.514,22,12,22z M20.434,13.369 c-0.292-0.092-2.644-0.794-5.32-0.365c1.117,3.07,1.572,5.57,1.659,6.09C18.689,17.798,20.053,15.745,20.434,13.369z M15.336,19.876c-0.127-0.749-0.623-3.361-1.822-6.477c-0.019,0.006-0.038,0.013-0.056,0.019c-4.818,1.679-6.547,5.02-6.701,5.334 c1.448,1.129,3.268,1.803,5.243,1.803C13.183,20.555,14.311,20.313,15.336,19.876z M5.654,17.724 c0.193-0.331,2.538-4.213,6.943-5.637c0.111-0.036,0.224-0.07,0.337-0.102c-0.214-0.485-0.448-0.971-0.692-1.45 c-4.266,1.277-8.405,1.223-8.778,1.216c-0.003,0.087-0.004,0.174-0.004,0.261C3.458,14.207,4.29,16.21,5.654,17.724z M3.639,10.264 c0.382,0.005,3.901,0.02,7.897-1.041c-1.415-2.516-2.942-4.631-3.167-4.94C5.979,5.41,4.193,7.613,3.639,10.264z M9.998,3.709 c0.236,0.316,1.787,2.429,3.187,5c3.037-1.138,4.323-2.867,4.477-3.085C16.154,4.286,14.17,3.471,12,3.471 C11.311,3.471,10.641,3.554,9.998,3.709z M18.612,6.612C18.432,6.855,17,8.69,13.842,9.979c0.199,0.407,0.389,0.821,0.567,1.237 c0.063,0.148,0.124,0.295,0.184,0.441c2.842-0.357,5.666,0.215,5.948,0.275C20.522,9.916,19.801,8.065,18.612,6.612z"}))}].map((({name:e,title:t,color:n,icon:o})=>{return{isDefault:"facebook"===e,name:e,title:t,attributes:(r=`https://www.mailjet.com/images/theme/v1/icons/ico-social/${e}.png`,l=t,a=n,{img:r,label:l,style:{noptin:{border:{radius:"50%"},color:{background:a}}}}),icon:o||e,isActive:(t,n)=>t.img&&t.img.includes(e)||t.label&&t.label.includes(e)||t.url&&t.url.includes(e)};var r,l,a})),{name:Ke}=qe,Ye={icon:"share",edit:({attributes:e,context:t,setAttributes:n,isSelected:o})=>{const{img:a,label:c,rel:u,iconSize:p}=e,[d,m]=(0,l.useState)(!0),[g,h]=(0,l.useState)(null),b=t["noptin/social-links/iconSize"];(0,l.useEffect)((()=>{p!==b&&n({iconSize:b})}),[b,p]),(0,l.useEffect)((()=>{o&&m(!0)}),[o]);const _=V(e),f=_?.style?.backgroundColor,y=(0,s.useBlockProps)({ref:h,style:{color:f,backgroundColor:f,boxSizing:"border-box",align:"center",borderCollapse:"separate",...v(e)}});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings"),initialOpen:!0},(0,l.createElement)(i.PanelRow,null,(0,l.createElement)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Image URL"),help:(0,r.__)("Enter the URL of the image to use as an icon."),value:a||"",onChange:e=>n({img:e})})),(0,l.createElement)(i.PanelRow,null,(0,l.createElement)(s.URLInput,{label:(0,r.__)("Social URL"),help:(0,r.__)("The URL to link to."),className:"block-editor-link-control__field noptin-link-control__field",value:e.url||"",hasBorder:!0,isFullWidth:!0,onChange:e=>n({url:e}),__nextHasNoMarginBottom:!0})),(0,l.createElement)(i.PanelRow,null,(0,l.createElement)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Social Network"),help:(0,r.__)("The name of the social network."),value:c||"",onChange:e=>n({label:e})})))),(0,l.createElement)(s.InspectorControls,{group:"advanced"},(0,l.createElement)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Link rel"),value:u||"",onChange:e=>n({rel:e})})),o&&d&&(0,l.createElement)(i.Popover,{placement:"bottom",onClose:()=>{m(!1)},anchor:g,focusOnMount:!1,__unstableSlotName:"__unstable-block-tools-after",shift:!0},(0,l.createElement)(s.URLInput,{label:(0,r.__)("Social URL"),help:(0,r.__)("The URL to link to."),className:"block-editor-link-control__field noptin-link-control-popover__field",value:e.url||"",onChange:e=>n({url:e}),__nextHasNoMarginBottom:!0})),(0,l.createElement)("td",{...y,width:p},(0,l.createElement)("img",{src:a||"https://placehold.co/30x30@2x.png",alt:c,width:p,height:p})))},save:function({attributes:e}){const{url:t,img:n,label:o,rel:r,iconSize:a}=e,i=V(e),c=i?.style?.backgroundColor,u=s.useBlockProps.save({width:a,style:{color:c,backgroundColor:c,borderCollapse:"separate",...v(e)}});return(0,l.createElement)("td",{...u,width:a},(0,l.createElement)("a",{href:t,rel:r||void 0,style:{display:"inline-block",textDecoration:"none"}},(0,l.createElement)("img",{src:n||"https://placehold.co/30x30@2x.png",alt:o,width:a,height:a})))},variations:Ze},Xe=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})}),Qe=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM15.4697 14.9697L18.4393 12L15.4697 9.03033L16.5303 7.96967L20.0303 11.4697L20.5607 12L20.0303 12.5303L16.5303 16.0303L15.4697 14.9697Z"})}),Je=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-4-4.6l-4 4 4 4 1-1-3-3 3-3-1-1z"})}),et=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})}),tt=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})}),nt=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M3.8 15.8h8.9v-1.5H3.8v1.5zm0-7h8.9V7.2H3.8v1.6zm14.7-2.1V10h1V5.3l-2.2.7.3 1 .9-.3zm1.2 6.1c-.5-.6-1.2-.5-1.7-.4-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5H20v-1h-.9c.3-.6.8-1.4.9-2.1 0-.3 0-.8-.3-1.1z"})}),ot=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM5 6.7V10h1V5.3L3.8 6l.4 1 .8-.3zm-.4 5.7c-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5h2.7v-1h-1c.3-.6.8-1.4.9-2.1.1-.3 0-.8-.2-1.1-.5-.6-1.3-.5-1.7-.4z"})}),rt=({setAttributes:e,reversed:t,start:n,type:o})=>(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,r.__)("List style"),options:[{label:(0,r.__)("Numbers"),value:"decimal"},{label:(0,r.__)("Uppercase letters"),value:"upper-alpha"},{label:(0,r.__)("Lowercase letters"),value:"lower-alpha"},{label:(0,r.__)("Uppercase Roman numerals"),value:"upper-roman"},{label:(0,r.__)("Lowercase Roman numerals"),value:"lower-roman"}],value:o,onChange:t=>e({type:t})}),(0,l.createElement)(i.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,r.__)("Start value"),type:"number",onChange:t=>{const n=parseInt(t,10);e({start:isNaN(n)?void 0:n})},value:Number.isInteger(n)?n.toString(10):"",step:"1"}),(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Reverse order"),checked:t||!1,onChange:t=>{e({reversed:t||void 0})}}))),lt={name:"noptin/list-item"},at=[["noptin/list-item"]];function it({clientId:e}){const t=function(e){const{replaceBlocks:t,selectionChange:n}=(0,S.useDispatch)(s.store),{getBlockRootClientId:r,getBlockAttributes:a,getBlock:i}=(0,S.useSelect)(s.store);return(0,l.useCallback)((()=>{const l=r(e),s=a(l),c=(0,o.createBlock)("noptin/list-item",s),{innerBlocks:u}=i(e);t([l],[c,...u]),n(u[u.length-1].clientId)}),[e])}(e),n=(0,S.useSelect)((t=>{const{getBlockRootClientId:n,getBlockName:o}=t(s.store);return"noptin/list-item"===o(n(e))}),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?Qe:Je,title:(0,r.__)("Outdent"),description:(0,r.__)("Outdent list item"),disabled:!n,onClick:t}))}const st={apiVersion:3,name:"noptin/list",title:(0,r.__)("List"),category:"content",allowedBlocks:["noptin/list-item"],description:(0,r.__)("An organized collection of items displayed in a specific order."),keywords:["bullet list","ordered list","numbered list"],attributes:{ordered:{type:"boolean",default:!1,role:"content"},type:{type:"string"},start:{type:"number"},reversed:{type:"boolean"},placeholder:{type:"string"}},noptin:{typography:["fontFamily","fontSize","fontStyle","fontWeight","lineHeight","letterSpacing","textTransform","textDecoration"],border:!0,color:{text:!0,background:!0,link:!0}},supports:{anchor:!1,html:!1,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!1}},__unstablePasteTextInline:!0,__experimentalOnMerge:!0,__experimentalSlashInserter:!0},selectors:{border:".wp-block-noptin-list:not(.wp-block-noptin-list .wp-block-noptin-list)"}},ct=window.wp.richText,ut={A:"upper-alpha",a:"lower-alpha",I:"upper-roman",i:"lower-roman"};function pt({phrasingContentSchema:e}){const t={...e,ul:{},ol:{attributes:["type","start","reversed"]}};return["ul","ol"].forEach((e=>{t[e].children={li:{children:t}}})),t}function dt(e){return e.flatMap((({name:e,attributes:t,innerBlocks:n=[]})=>"noptin/list-item"===e?[t.content,...dt(n)]:dt(n)))}const mt={from:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph","core/heading"],transform:e=>{let t=[];if(e.length>1)t=e.map((({content:e})=>(0,o.createBlock)("noptin/list-item",{content:e})));else if(1===e.length){const n=(0,ct.create)({html:e[0].content});t=(0,ct.split)(n,"\n").map((e=>(0,o.createBlock)("noptin/list-item",{content:(0,ct.toHTMLString)({value:e})})))}return(0,o.createBlock)("noptin/list",{anchor:e.anchor},t)}},{type:"raw",selector:"ol,ul",schema:e=>({ol:pt(e).ol,ul:pt(e).ul}),transform:function e(t){const n=t.getAttribute("type"),r={ordered:"OL"===t.tagName,anchor:""===t.id?void 0:t.id,start:t.getAttribute("start")?parseInt(t.getAttribute("start"),10):void 0,reversed:!!t.hasAttribute("reversed")||void 0,type:n&&ut[n]?ut[n]:void 0},l=Array.from(t.children).map((t=>{const n=Array.from(t.childNodes).filter((e=>e.nodeType!==e.TEXT_NODE||0!==e.textContent.trim().length));n.reverse();const[r,...l]=n;if("UL"!==r?.tagName&&"OL"!==r?.tagName)return(0,o.createBlock)("noptin/list-item",{content:t.innerHTML});const a=l.map((e=>e.nodeType===e.TEXT_NODE?e.textContent:e.outerHTML));a.reverse();const i={content:a.join("").trim()},s=[e(r)];return(0,o.createBlock)("noptin/list-item",i,s)}));return(0,o.createBlock)("noptin/list",r,l)}},...["*","-"].map((e=>({type:"prefix",prefix:e,transform:e=>(0,o.createBlock)("noptin/list",{},[(0,o.createBlock)("noptin/list-item",{content:e})])}))),...["1.","1)"].map((e=>({type:"prefix",prefix:e,transform:e=>(0,o.createBlock)("noptin/list",{ordered:!0},[(0,o.createBlock)("noptin/list-item",{content:e})])})))],to:[...["core/paragraph","core/heading"].map((e=>({type:"block",blocks:[e],transform:(t,n)=>dt(n).map((t=>(0,o.createBlock)(e,{content:t})))})))]},gt=mt,{name:ht}=st,bt={icon:Xe,example:{innerBlocks:[{name:"noptin/list-item",attributes:{content:"Alice."}},{name:"noptin/list-item",attributes:{content:"The White Rabbit."}},{name:"noptin/list-item",attributes:{content:"The Cheshire Cat."}},{name:"noptin/list-item",attributes:{content:"The Mad Hatter."}},{name:"noptin/list-item",attributes:{content:"The Queen of Hearts."}}]},transforms:gt,edit:function({attributes:e,setAttributes:t,clientId:n}){const{ordered:o,type:a,reversed:c,start:u}=e,p=V(e).style,d=_(e),m=d?.fontSize||16,g=(0,s.useBlockProps)({reversed:c,start:u,className:"noptin-block__margin-wrapper",style:{listStyleType:o&&"decimal"!==a?a:void 0,...v(e),...p,...p.backgroundColor?{padding:`${m.toString().match(/^\d+$/)?`${m}px`:m} 32px`}:{},...d,...Z(e)}}),h=(0,s.useInnerBlocksProps)(g,{defaultBlock:lt,directInsert:!0,template:at,templateLock:!1,templateInsertUpdatesSelection:!0,__experimentalCaptureToolbars:!0}),b=(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?et:tt,title:(0,r.__)("Unordered"),description:(0,r.__)("Convert to unordered list"),isActive:!1===o,onClick:()=>{t({ordered:!1})}}),(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?nt:ot,title:(0,r.__)("Ordered"),description:(0,r.__)("Convert to ordered list"),isActive:!0===o,onClick:()=>{t({ordered:!0})}}),(0,l.createElement)(it,{clientId:n})),f=o?"ol":"ul";return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(f,{...h}),b,o&&(0,l.createElement)(rt,{setAttributes:t,reversed:c,start:u,type:a}))},save:function({attributes:e}){const{ordered:t,type:n,reversed:o,start:r}=e,a=t?"ol":"ul",i=V(e).style,c=_(e),u=c?.fontSize||16;return(0,l.createElement)(a,{...s.useBlockProps.save({reversed:o,start:r,className:"noptin-block__margin-wrapper",style:{listStyleType:t&&"decimal"!==n?n:void 0,...v(e),...i,...i.backgroundColor?{padding:`${u.toString().match(/^\d+$/)?`${u}px`:u} 32px`}:{},...c,...Z.save(e)}})},(0,l.createElement)(s.InnerBlocks.Content,null))}},_t=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M12 11v1.5h8V11h-8zm-6-1c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})}),ft=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM20.0303 9.03033L17.0607 12L20.0303 14.9697L18.9697 16.0303L15.4697 12.5303L14.9393 12L15.4697 11.4697L18.9697 7.96967L20.0303 9.03033Z"})}),yt=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-8-3.5l3 3-3 3 1 1 4-4-4-4-1 1z"})});function vt(){const e=(0,S.useRegistry)(),{moveBlocksToPosition:t,removeBlock:n,insertBlock:r,updateBlockListSettings:l}=(0,S.useDispatch)(s.store),{getBlockRootClientId:a,getBlockName:i,getBlockOrder:c,getBlockIndex:u,getSelectedBlockClientIds:p,getBlock:d,getBlockListSettings:m}=(0,S.useSelect)(s.store);return(0,Le.useCallback)(((s=p())=>{if(Array.isArray(s)||(s=[s]),!s.length)return;const g=s[0];if("noptin/list-item"!==i(g))return;const h=function(e){const t=a(e),n=a(t);if(n&&"noptin/list-item"===i(n))return n}(g);if(!h)return;const b=a(g),_=s[s.length-1],f=c(b).slice(u(_)+1);return e.batch((()=>{if(f.length){let e=c(g)[0];if(!e){const t=(0,o.cloneBlock)(d(b),{},[]);e=t.clientId,r(t,0,g,!1),l(e,m(b))}t(f,b,e)}t(s,b,a(h),u(h)+1),c(b).length||n(b,!1)})),!0}),[])}function xt(e){const{replaceBlocks:t,selectionChange:n,multiSelect:r}=(0,S.useDispatch)(s.store),{getBlock:l,getPreviousBlockClientId:a,getSelectionStart:i,getSelectionEnd:c,hasMultiSelection:u,getMultiSelectedBlockClientIds:p}=(0,S.useSelect)(s.store);return(0,Le.useCallback)((()=>{const s=u(),d=s?p():[e],m=d.map((e=>(0,o.cloneBlock)(l(e)))),g=a(e),h=(0,o.cloneBlock)(l(g));h.innerBlocks?.length||(h.innerBlocks=[(0,o.createBlock)("noptin/list")]),h.innerBlocks[h.innerBlocks.length-1].innerBlocks.push(...m);const b=i(),_=c();return t([g,...d],[h]),s?r(m[0].clientId,m[m.length-1].clientId):n(m[0].clientId,_.attributeKey,_.clientId===b.clientId?b.offset:_.offset,_.offset),!0}),[e])}function kt(e,t){const n=(0,S.useRegistry)(),{getPreviousBlockClientId:o,getNextBlockClientId:r,getBlockOrder:l,getBlockRootClientId:a,getBlockName:i}=(0,S.useSelect)(s.store),{mergeBlocks:c,moveBlocksToPosition:u}=(0,S.useDispatch)(s.store),p=vt();function d(e){const t=l(e);return t.length?d(t[t.length-1]):e}function m(e){const t=a(e),n=a(t);if(n&&"noptin/list-item"===i(n))return n}function g(e){const t=r(e);if(t)return t;const n=m(e);return n?g(n):void 0}function h(e){const t=l(e);return t.length?l(t[0])[0]:g(e)}return r=>{function i(e,t){n.batch((()=>{const[n]=l(t);n&&(o(t)!==e||l(e).length?u(l(n),n,a(e)):u([n],t,e)),c(e,t)}))}if(r){const n=h(e);if(!n)return void t(r);m(n)?p(n):i(e,n)}else{const n=o(e);m(e)?p(e):n?i(d(n),e):t(r)}}}function wt({clientId:e}){const t=xt(e),n=vt(),{canIndent:o,canOutdent:a}=(0,S.useSelect)((t=>{const{getBlockIndex:n,getBlockRootClientId:o,getBlockName:r}=t(s.store);return{canIndent:n(e)>0,canOutdent:"noptin/list-item"===r(o(o(e)))}}),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?Qe:Je,title:(0,r.__)("Outdent"),description:(0,r.__)("Outdent list item"),disabled:!a,onClick:()=>n()}),(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?ft:yt,title:(0,r.__)("Indent"),description:(0,r.__)("Indent list item"),disabled:!o,onClick:()=>t()}))}const Et={apiVersion:3,name:"noptin/list-item",title:(0,r.__)("List item"),category:"content",parent:["noptin/list"],allowedBlocks:["noptin/list"],description:(0,r.__)("An individual item within a list."),attributes:{placeholder:{type:"string"},content:{type:"rich-text",source:"rich-text",selector:"li",role:"content"}},noptin:{typography:["fontFamily","fontSize","fontStyle","fontWeight","lineHeight","letterSpacing","textTransform","textDecoration"],border:!0,color:{text:!0,background:!0,link:!0}},supports:{anchor:!1,className:!1,splitting:!0,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}}},selectors:{root:".wp-block-noptin-list > li",border:".wp-block-noptin-list:not(.wp-block-noptin-list .wp-block-noptin-list) > li"}},Ct={to:[{type:"block",blocks:["core/paragraph"],transform:(e,t=[])=>[(0,o.createBlock)("core/paragraph",e),...t.map((e=>(0,o.cloneBlock)(e)))]}]},St=Ct,{name:Bt}=Et,It={icon:_t,edit:function({attributes:e,setAttributes:t,clientId:n,mergeBlocks:a}){const{placeholder:i,content:c}=e,u=(0,s.useBlockProps)({style:{...v(e),...V(e).style,..._(e),...Z(e)}}),p=(0,s.useInnerBlocksProps)(u,{renderAppender:!1,__unstableDisableDropZone:!0}),d=function(e){const{replaceBlocks:t,selectionChange:n}=(0,S.useDispatch)(s.store),{getBlock:r,getBlockRootClientId:l,getBlockIndex:a,getBlockName:i}=(0,S.useSelect)(s.store),c=(0,Le.useRef)(e);c.current=e;const u=vt();return(0,E.useRefEffect)((e=>{function s(e){if(e.defaultPrevented||e.keyCode!==K.ENTER)return;const{content:s,clientId:p}=c.current;if(s.length)return;if(e.preventDefault(),"noptin/list-item"===i(l(l(c.current.clientId))))return void u();const d=r(l(p)),m=a(p),g=(0,o.cloneBlock)({...d,innerBlocks:d.innerBlocks.slice(0,m)}),h=(0,o.createBlock)((0,o.getDefaultBlockName)()),b=[...d.innerBlocks[m].innerBlocks[0]?.innerBlocks||[],...d.innerBlocks.slice(m+1)],_=b.length?[(0,o.cloneBlock)({...d,innerBlocks:b})]:[];t(d.clientId,[g,h,..._],1),n(h.clientId)}return e.addEventListener("keydown",s),()=>{e.removeEventListener("keydown",s)}}),[])}({content:c,clientId:n}),m=function(e){const{getSelectionStart:t,getSelectionEnd:n,getBlockIndex:o}=(0,S.useSelect)(s.store),r=xt(e),l=vt();return(0,E.useRefEffect)((a=>{function i(a){const{keyCode:i,shiftKey:s,altKey:c,metaKey:u,ctrlKey:p}=a;if(a.defaultPrevented||i!==K.SPACE&&i!==K.TAB||c||u||p)return;const d=t(),m=n();0===d.offset&&0===m.offset&&(s?i===K.TAB&&l()&&a.preventDefault():0!==o(e)&&r()&&a.preventDefault())}return a.addEventListener("keydown",i),()=>{a.removeEventListener("keydown",i)}}),[e,r])}(n),g=kt(n,a);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("li",{...p},(0,l.createElement)(s.RichText,{ref:(0,E.useMergeRefs)([d,m]),identifier:"content",tagName:"div",onChange:e=>t({content:e}),value:c,"aria-label":(0,r.__)("List text"),placeholder:i||(0,r.__)("List"),onMerge:g}),p.children),(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(wt,{clientId:n})))},save:function({attributes:e}){return(0,l.createElement)("li",{...s.useBlockProps.save({style:{...v(e),...V(e).style,..._(e),...Z.save(e)}})},(0,l.createElement)(s.RichText.Content,{value:e.content}),(0,l.createElement)(s.InnerBlocks.Content,null))},merge:(e,t)=>({...e,content:e.content+t.content}),transforms:St},Tt={apiVersion:3,name:"core/html",title:(0,r.__)("Custom HTML"),category:"content",description:(0,r.__)("Add custom HTML code and preview it as you edit."),keywords:["code","raw"],attributes:{content:{type:"string",source:"raw"}},supports:{customClassName:!1,className:!1,html:!1,anchor:!1}},{name:Mt}=Tt,zt={icon:"editor-code",example:{attributes:{content:""+(0,r.__)("Welcome to the wonderful world of blocks…")+""}},edit:function({attributes:e,setAttributes:t}){const[n,o]=(0,Le.useState)(!1),a=(0,Le.useContext)(i.Disabled.Context),c=(0,Le.useId)(),u=(0,s.useBlockProps)({className:"block-library-html__edit","aria-describedby":n?c:void 0});return(0,l.createElement)("div",{...u},(0,l.createElement)(s.BlockControls,null,(0,l.createElement)(i.ToolbarGroup,null,(0,l.createElement)(i.ToolbarButton,{className:"components-tab-button",isPressed:!n,onClick:function(){o(!1)}},"HTML"),(0,l.createElement)(i.ToolbarButton,{className:"components-tab-button",isPressed:n,onClick:function(){o(!0)}},(0,r.__)("Preview")))),n||a?(0,l.createElement)(Le.RawHTML,null,e.content):(0,l.createElement)(s.PlainText,{value:e.content,onChange:e=>t({content:e}),placeholder:(0,r.__)("Write HTML…"),"aria-label":(0,r.__)("HTML")}))},save:function({attributes:e}){return(0,l.createElement)(Le.RawHTML,null,e.content)}},At=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z"})}),Nt={apiVersion:3,name:"noptin/group",title:(0,r.__)("Section","newsletter-optin-box"),category:"design",description:(0,r.__)("Gather blocks in a layout container."),keywords:["container","wrapper","row","section"],attributes:{templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]},allowedBlocks:{type:"array"},style:{type:"object",default:{noptin:{align:"center",color:{background:"#ffffff"}}}},width:{type:"string",default:"600px"}},noptin:{typography:!0,border:!0,color:!0,align:!0},supports:{__experimentalOnEnter:!0,__experimentalOnMerge:!0,__experimentalSettings:!0,anchor:!1,html:!1,background:{__experimentalSkipSerialization:!0,backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0,__experimentalDefaultControls:{backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0}},spacing:{__experimentalSkipSerialization:!0,margin:["top","bottom"],padding:!0,__experimentalDefaultControls:{margin:!0,padding:!0}}}},Pt={from:[{type:"block",isMultiBlock:!0,blocks:["*"],__experimentalConvert(e){const t=e.map((e=>(0,o.createBlock)(e.name,e.attributes,e.innerBlocks)));return(0,o.createBlock)("noptin/group",{},t)}}]},Ht=Pt,{name:Lt}=Nt,Vt={icon:At,example:{attributes:{style:{color:{text:"#000000",background:"#ffffff"}}},innerBlocks:[{name:"core/paragraph",attributes:{customTextColor:"#cf2e2e",fontSize:"large",content:(0,r.__)("One.")}},{name:"core/paragraph",attributes:{customTextColor:"#ff6900",fontSize:"large",content:(0,r.__)("Two.")}},{name:"core/paragraph",attributes:{customTextColor:"#fcb900",fontSize:"large",content:(0,r.__)("Three.")}},{name:"core/paragraph",attributes:{customTextColor:"#00d084",fontSize:"large",content:(0,r.__)("Four.")}},{name:"core/paragraph",attributes:{customTextColor:"#0693e3",fontSize:"large",content:(0,r.__)("Five.")}},{name:"core/paragraph",attributes:{customTextColor:"#9b51e0",fontSize:"large",content:(0,r.__)("Six.")}}]},transforms:Ht,edit:({attributes:e,setAttributes:t})=>{const{width:n}=e,o=R(e),a=Z(e,!0),c={width:n,maxWidth:"100%",borderCollapse:"separate",...v(e),...V(e).style,...Ne(e).style},u=(0,s.useInnerBlocksProps)({style:_(e)},{templateLock:e.templateLock,allowedBlocks:e.allowedBlocks}),p=(0,i.__experimentalUseCustomUnits)({availableUnits:["%","px","em","rem","vw"]});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",min:10,value:n||"",onChange:e=>t({width:e}),units:p}))),(0,l.createElement)("div",{...(0,s.useBlockProps)({style:a.margin})},(0,l.createElement)("table",{width:n,align:o,cellPadding:0,cellSpacing:0,role:"presentation",style:c},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{className:"noptin-block-group__inner",style:a.padding,align:o},(0,l.createElement)("table",{border:0,cellPadding:0,cellSpacing:0,width:"100%"},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{...u}))))))))))},save:({attributes:e})=>{const{width:t}=e,n=Z.save(e,!0),o=Ne(e,t),r=R(e),a={width:t,maxWidth:"100%",borderCollapse:"separate",...v(e),...V(e).style,...o.style},i={..._(e),...o.vmlOpen?{backgroundColor:"transparent"}:V(e).style};return(0,l.createElement)("div",{...s.useBlockProps.save({style:n.margin})},o.vmlOpen&&(0,l.createElement)(Le.RawHTML,{children:o.vmlOpen}),(0,l.createElement)("table",{width:t,align:r,cellPadding:0,cellSpacing:0,role:"presentation",style:a},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{className:"noptin-block-group__inner",style:n.padding,align:r},(0,l.createElement)("table",{border:"0",cellPadding:"0",cellSpacing:"0",width:"100%"},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{style:i},(0,l.createElement)(s.InnerBlocks.Content,null))))))))),o.vmlClose&&(0,l.createElement)(Le.RawHTML,{children:o.vmlClose}))}},$t=e=>{const t=parseFloat(e);return Number.isFinite(t)?parseFloat(t.toFixed(2)):void 0};function Rt(e,t){const{width:n=100/t}=e.attributes;return $t(n)}function Dt(e,t,n=e.length){const o=function(e,t=e.length){return e.reduce(((e,n)=>e+Rt(n,t)),0)}(e,n);return Object.fromEntries(Object.entries(function(e,t=e.length){return e.reduce(((e,n)=>{const o=Rt(n,t);return Object.assign(e,{[n.clientId]:o})}),{})}(e,n)).map((([e,n])=>[e,$t(t*n/o)])))}function Ot(e,t){return e.map((e=>({...e,attributes:{...e.attributes,width:`${t[e.clientId]}%`}})))}const jt=["noptin/column"];function Ft({attributes:e,setAttributes:t,clientId:n}){const{isStackedOnMobile:a,verticalAlignment:c,templateLock:u}=e,{replaceInnerBlocks:p}=(0,S.useDispatch)(s.store),{count:d,canInsertColumnBlock:m,minCount:g,innerBlocks:h}=(0,S.useSelect)((e=>{const{canInsertBlockType:t,canRemoveBlock:o,getBlocks:r,getBlockCount:l}=e(s.store),a=r(n),i=a.reduce(((e,t,n)=>(o(t.clientId)||e.push(n),e)),[]);return{count:l(n),canInsertColumnBlock:t("noptin/column",n),minCount:Math.max(...i)+1,innerBlocks:a}}),[n]),b=(0,s.useBlockProps)({className:k("noptin-columns noptin-columns__wrapper",{"noptin-is-stacked-on-mobile":a}),style:{..._(e),...v(e),...Z(e),...V(e).style}}),f=(0,s.useInnerBlocksProps)(b,{allowedBlocks:jt,orientation:"horizontal",renderAppender:!1,templateLock:u});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,null,(0,l.createElement)(s.BlockVerticalAlignmentToolbar,{onChange:e=>t({verticalAlignment:e}),value:c})),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,null,m&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,r.__)("Columns"),value:d,onChange:e=>((e,t)=>{let r=[...h];const l=h.every((e=>{const t=e.attributes.width;return Number.isFinite(t?.endsWith?.("%")?parseFloat(t):t)})),a=t>e;if(a&&l){const n=$t(100/t),l=Dt(h,100-n);r=[...Ot(h,l),...Array.from({length:t-e}).map((()=>(0,o.createBlock)("noptin/column",{width:`${n}%`})))]}else if(a)r=[...h,...Array.from({length:t-e}).map((()=>(0,o.createBlock)("noptin/column")))];else if(tt({isStackedOnMobile:!a})}))),(0,l.createElement)("div",{...f}))}function Ut({clientId:e,name:t,setAttributes:n}){const{blockType:a,defaultVariation:i,variations:c}=(0,S.useSelect)((e=>{const{getBlockVariations:n,getBlockType:r,getDefaultBlockVariation:l}=e(o.store);return{blockType:r(t),defaultVariation:l(t,"block"),variations:n(t,"block")}}),[t]),{replaceInnerBlocks:u}=(0,S.useDispatch)(s.store),p=(0,s.useBlockProps)();return(0,l.createElement)("div",{...p},(0,l.createElement)(s.__experimentalBlockVariationPicker,{icon:a?.icon?.src,label:a?.title,variations:c,instructions:(0,r.__)("Divide into columns. Select a layout:"),onSelect:(t=i)=>{t.attributes&&n(t.attributes),t.innerBlocks&&u(e,(0,o.createBlocksFromInnerBlocksTemplate)(t.innerBlocks),!0)},allowSkip:!0}))}const Wt={apiVersion:3,name:"noptin/columns",title:(0,r.__)("Columns"),category:"design",description:(0,r.__)("Display content in multiple columns, with blocks added to each column."),attributes:{verticalAlignment:{type:"string",default:"top"},isStackedOnMobile:{type:"boolean",default:!0},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]}},providesContext:{"noptin/columns/verticalAlignment":"verticalAlignment","noptin/columns/isStackedOnMobile":"isStackedOnMobile"},noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,__experimentalExposeControlsToChildren:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,__experimentalDefaultControls:{margin:!0}}}};function Gt(e,t=!1){return`\n ${t?"\x3c!--[if !true]>\x3c!--\x3e":"\x3c!--[if true]>"}\n ${e}\n ${t?"\x3c!--{const t=+(100/e.length).toFixed(2),n=e.map((({name:e,attributes:n,innerBlocks:o})=>["noptin/column",{width:`${t}%`},[[e,{...n},o]]]));return(0,o.createBlock)("noptin/columns",{},(0,o.createBlocksFromInnerBlocksTemplate)(n))},isMatch:({length:e},t)=>(1!==t.length||"noptin/columns"!==t[0].name)&&e&&e<=6}],ungroup:(e,t)=>t.flatMap((e=>e.innerBlocks))},{name:Kt}=Wt,Yt={icon:"columns",variations:qt,edit:e=>{const{clientId:t}=e,n=(0,S.useSelect)((e=>e(s.store).getBlocks(t).length>0),[t])?Ft:Ut;return(0,l.createElement)(n,{...e})},save:function({attributes:e}){const{isStackedOnMobile:t}=e,n={..._(e),...v(e),...Z.save(e),...V(e).style},o=s.useBlockProps.save({className:k("noptin-columns noptin-columns__wrapper",{"noptin-is-stacked-on-mobile":t}),style:n}),r=Gt(``),a=Gt("
");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Le.RawHTML,{children:`${r}\x3c!--[if !true]>\x3c!--\x3e`}),(0,l.createElement)("div",{...o},(0,l.createElement)(Le.RawHTML,{children:"\x3c!--\x3c!--\x3e"})),(0,l.createElement)(Le.RawHTML,{children:`\x3c!--"center"===e?"middle":e||void 0,Jt={apiVersion:3,name:"noptin/column",title:(0,r.__)("Column"),category:"design",parent:["noptin/columns"],description:(0,r.__)("A single column within a columns block."),attributes:{verticalAlignment:{type:"string",default:"top"},isStackedOnMobile:{type:"boolean",default:!0},width:{type:"string"},allowedBlocks:{type:"array"},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]}},usesContext:["noptin/columns/verticalAlignment","noptin/columns/isStackedOnMobile"],noptin:{typography:!0,border:!0,color:!0},supports:{__experimentalOnEnter:!0,anchor:!1,reusable:!1,html:!1,background:{__experimentalSkipSerialization:!0,backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0,__experimentalDefaultControls:{backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0}},spacing:{__experimentalSkipSerialization:!0,padding:!0,margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}}},{name:en}=Jt,tn={icon:Xt,edit:function({attributes:{width:e,templateLock:t,verticalAlignment:n,isStackedOnMobile:o,allowedBlocks:a,...c},setAttributes:u,clientId:p,context:d}){const m=d["noptin/columns/verticalAlignment"];(0,l.useEffect)((()=>{n!==m&&u({verticalAlignment:m})}),[m,n]);const g=d["noptin/columns/isStackedOnMobile"];(0,l.useEffect)((()=>{o!==g&&u({isStackedOnMobile:g})}),[g,o]);const h=(0,i.__experimentalUseCustomUnits)({availableUnits:["%","px","em","rem","vw"]}),b=(0,S.useSelect)((e=>e(s.store).getBlockOrder(p).length>0),[p]),f={verticalAlign:Qt(n)};if(e&&/\d/.test(e)){let t=Number.isFinite(e)?e+"%":e;if(!Number.isFinite(e)&&e?.endsWith("%")){const n=1e12;t=Math.round(Number.parseFloat(e)*n)/n+"%"}f.width=t}const y=(0,s.useBlockProps)({className:k("noptin-column",{"noptin-is-stacked-on-mobile":o}),style:f}),x={..._(c),...v(c),...Z(c),...V(c).style,...Ne(c).style};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:e||"",onChange:e=>{e=0>parseFloat(e)?"0":e,u({width:e})},units:h}))),(0,l.createElement)("div",{...y},(0,l.createElement)("div",{className:"noptin-column__inner",style:x},(0,l.createElement)(s.InnerBlocks,{templateLock:t,allowedBlocks:a,renderAppender:b?void 0:s.InnerBlocks.ButtonBlockAppender}))))},save:function({attributes:e}){const{width:t,verticalAlignment:n,isStackedOnMobile:o}=e,r={verticalAlign:Qt(n)};if(t&&/\d/.test(t)){let e=Number.isFinite(t)?t+"%":t;if(!Number.isFinite(t)&&t?.endsWith("%")){const n=1e12;e=Math.round(Number.parseFloat(t)*n)/n+"%"}r.width=e}const a=Ne(e,t),i=s.useBlockProps.save({className:k("noptin-column",{"noptin-is-stacked-on-mobile":o}),style:r}),c=Gt(``),u=Gt(""),p={..._(e),...v(e),...Z.save(e),...V(e).style,...a.style};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Le.RawHTML,{children:`${c}\x3c!--[if !true]>\x3c!--\x3e`}),(0,l.createElement)("div",{...i},(0,l.createElement)(Le.RawHTML,{children:"\x3c!--\x3c!--\x3e"})),(0,l.createElement)(Le.RawHTML,{children:`\x3c!--(0,o.createBlock)("noptin/separator")},{type:"raw",selector:"hr",schema:{hr:{}}}]},{name:ln}=on,an={icon:nn,transforms:rn,edit:function({attributes:e,setAttributes:t}){const{width:n,height:o}=e,a=V(e),c=a?.style?.backgroundColor,u=(0,i.__experimentalUseCustomUnits)({availableUnits:["%","px","em","rem"]});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:n||"",onChange:e=>{e=0>parseFloat(e)?"0":e,t({width:e})},units:u}),(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Height"),labelPosition:"edge",__unstableInputWidth:"80px",value:o||"",onChange:e=>{e=e?0>parseFloat(e)?"0":e:"1em",t({height:e})},units:u}))),(0,l.createElement)("hr",{...(0,s.useBlockProps)({style:{color:c,backgroundColor:c,borderWidth:0,height:o||"1em",width:n||"100%",maxWidth:"100%",...Z(e)},align:R(e)})}))},save:function({attributes:e}){const{width:t,height:n}=e,o=V(e),r=o?.style?.backgroundColor;return(0,l.createElement)("hr",{...s.useBlockProps.save({style:{color:r,backgroundColor:r,borderWidth:0,height:n||"1em",width:t||"100%",maxWidth:"100%",...Z.save(e)},align:R(e)})})}},sn=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M7 18h4.5v1.5h-7v-7H6V17L17 6h-4.5V4.5h7v7H18V7L7 18Z"})}),cn={apiVersion:3,name:"noptin/spacer",title:(0,r.__)("Spacer"),category:"design",description:(0,r.__)("Add a blank space between blocks and customize its height."),attributes:{height:{type:"string",default:"100px"}},noptin:{color:{background:!0}},supports:{anchor:!1,spacing:{__experimentalSkipSerialization:!0,margin:["top","bottom"],__experimentalDefaultControls:{margin:!0}}}},{name:un}=cn,pn={icon:sn,edit:({attributes:e,isSelected:t,setAttributes:n})=>{const{height:o}=e,a=V(e),c=a?.style?.backgroundColor,u={backgroundColor:c||(t?"#95a5a6":void 0),height:o,...Z(e)},p=(0,i.__experimentalUseCustomUnits)({availableUnits:["px","em","rem"],defaultValues:{px:100,em:10,rem:10}});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{...(0,s.useBlockProps)({style:u})}," "),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Height"),labelPosition:"edge",__unstableInputWidth:"80px",value:o||"",onChange:e=>{e=e?0>parseFloat(e)?"0px":e:"0px",n({height:e})},units:p,min:0}))))},save:function({attributes:e}){const{height:t}=e,n=V(e),o=n?.style?.backgroundColor;return(0,l.createElement)("div",{...s.useBlockProps.save({style:{color:o,backgroundColor:o,height:t||"100px",lineHeight:t||"100px",...Z.save(e)}})}," ")}},dn=window.wp.dom,mn=(0,S.withDispatch)(((e,{clientId:t,attributes:n})=>{const{replaceBlock:r}=e(s.store);return{convertToHTML(){r(t,(0,o.createBlock)("core/html",{content:n.originalUndelimitedContent}))}}}))((function({attributes:e,convertToHTML:t,clientId:n}){const{originalName:o,originalUndelimitedContent:a}=e,c=!!a,{hasHTMLBlock:u}=(0,S.useSelect)((e=>{const{canInsertBlockType:t,getBlockRootClientId:o}=e(s.store);return{hasHTMLBlock:t("core/html",o(n))}}),[n]),p=[];let d;const m=(0,l.createElement)(i.Button,{key:"convert",onClick:t,variant:"primary"},(0,r.__)("Keep as HTML"));return c&&u?(d=(0,r.sprintf)('Your site doesn\'t include support for the "%s" block. You can leave this block intact, convert its content to a RAW block, or remove it entirely.',o),p.push(m)):d=(0,r.sprintf)('Your site doesn’t include support for the "%s" block. You can leave this block intact or remove it entirely.',o),(0,l.createElement)("div",{...(0,s.useBlockProps)({className:"has-warning"})},(0,l.createElement)(s.Warning,{actions:p},d),(0,l.createElement)(Le.RawHTML,null,(0,dn.safeHTML)(a)))})),gn={apiVersion:3,name:"core/missing",title:(0,r.__)("Unsupported"),category:"content",description:(0,r.__)("Your site doesn’t include support for this block."),attributes:{originalName:{type:"string"},originalUndelimitedContent:{type:"string"},originalContent:{type:"string",source:"raw"}},supports:{className:!1,customClassName:!1,inserter:!1,html:!1,reusable:!1,anchor:!1}},{name:hn}=gn,bn={name:hn,edit:mn,save:function({attributes:e}){return(0,l.createElement)(Le.RawHTML,null,e.originalContent)}},fn={apiVersion:3,name:"noptin/shortcode",title:(0,r.__)("Merge Tag","newsletter-optin-box"),category:"dynamic",description:(0,r.__)("Insert additional custom elements with a WordPress shortcode or Noptin Merge tag.","newsletter-optin-box"),keywords:["merge tag","smart tag","shortcode","noptin"],attributes:{text:{type:"string",source:"raw"}},supports:{customClassName:!1,className:!1,html:!1,anchor:!1}},yn=window.wp.autop,vn={from:[{type:"shortcode",tag:"[a-z][a-z0-9_.-]*",attributes:{text:{type:"string",shortcode:(e,{content:t})=>(0,yn.removep)((0,yn.autop)(t))}},priority:20}]},{name:xn}=fn,kn={icon:"shortcode",transforms:vn,edit:function({attributes:e,setAttributes:t}){const n=`blocks-shortcode-input-${(0,l.useId)()}`;return(0,l.createElement)("div",{...(0,s.useBlockProps)({className:"components-placeholder"})},(0,l.createElement)("label",{htmlFor:n,className:"components-placeholder__label"},(0,l.createElement)(i.Icon,{icon:"shortcode"}),(0,r.__)("Merge tag / Shortcode","newsletter-optin-box")),(0,l.createElement)(s.PlainText,{className:"blocks-shortcode__textarea",id:n,value:e.text,"aria-label":(0,r.__)("Shortcode text"),placeholder:(0,r.__)("Write merge tag or shortcode here…"),onChange:e=>t({text:e})}))},save:function({attributes:e}){return(0,l.createElement)(Le.RawHTML,null,e.text)}},wn=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"})}),En=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z"})}),Cn=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z"})}),Sn=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z"})}),Bn=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M6.656 6.464h2.88v2.88h1.408v-2.88h2.88V5.12h-2.88V2.24H9.536v2.88h-2.88zM0 17.92V0h20.48v17.92H0zm7.68-2.56h5.12v-3.84H7.68v3.84zm-6.4 0H6.4v-3.84H1.28v3.84zM19.2 1.28H1.28v9.024H19.2V1.28zm0 10.24h-5.12v3.84h5.12v-3.84zM6.656 6.464h2.88v2.88h1.408v-2.88h2.88V5.12h-2.88V2.24H9.536v2.88h-2.88zM0 17.92V0h20.48v17.92H0zm7.68-2.56h5.12v-3.84H7.68v3.84zm-6.4 0H6.4v-3.84H1.28v3.84zM19.2 1.28H1.28v9.024H19.2V1.28zm0 10.24h-5.12v3.84h5.12v-3.84z"})}),In=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M13.824 10.176h-2.88v-2.88H9.536v2.88h-2.88v1.344h2.88v2.88h1.408v-2.88h2.88zM0 17.92V0h20.48v17.92H0zM6.4 1.28H1.28v3.84H6.4V1.28zm6.4 0H7.68v3.84h5.12V1.28zm6.4 0h-5.12v3.84h5.12V1.28zm0 5.056H1.28v9.024H19.2V6.336z"})}),Tn=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M17.728 11.456L14.592 8.32l3.2-3.2-1.536-1.536-3.2 3.2L9.92 3.648 8.384 5.12l3.2 3.2-3.264 3.264 1.536 1.536 3.264-3.264 3.136 3.136 1.472-1.536zM0 17.92V0h20.48v17.92H0zm19.2-6.4h-.448l-1.28-1.28H19.2V6.4h-1.792l1.28-1.28h.512V1.28H1.28v3.84h6.208l1.28 1.28H1.28v3.84h7.424l-1.28 1.28H1.28v3.84H19.2v-3.84z"})}),Mn=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M6.4 3.776v3.648H2.752v1.792H6.4v3.648h1.728V9.216h3.712V7.424H8.128V3.776zM0 17.92V0h20.48v17.92H0zM12.8 1.28H1.28v14.08H12.8V1.28zm6.4 0h-5.12v3.84h5.12V1.28zm0 5.12h-5.12v3.84h5.12V6.4zm0 5.12h-5.12v3.84h5.12v-3.84z"})}),zn=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M14.08 12.864V9.216h3.648V7.424H14.08V3.776h-1.728v3.648H8.64v1.792h3.712v3.648zM0 17.92V0h20.48v17.92H0zM6.4 1.28H1.28v3.84H6.4V1.28zm0 5.12H1.28v3.84H6.4V6.4zm0 5.12H1.28v3.84H6.4v-3.84zM19.2 1.28H7.68v14.08H19.2V1.28z"})}),An=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M6.4 9.98L7.68 8.7v-.256L6.4 7.164V9.98zm6.4-1.532l1.28-1.28V9.92L12.8 8.64v-.192zm7.68 9.472V0H0v17.92h20.48zm-1.28-2.56h-5.12v-1.024l-.256.256-1.024-1.024v1.792H7.68v-1.792l-1.024 1.024-.256-.256v1.024H1.28V1.28H6.4v2.368l.704-.704.576.576V1.216h5.12V3.52l.96-.96.32.32V1.216h5.12V15.36zm-5.76-2.112l-3.136-3.136-3.264 3.264-1.536-1.536 3.264-3.264L5.632 5.44l1.536-1.536 3.136 3.136 3.2-3.2 1.536 1.536-3.2 3.2 3.136 3.136-1.536 1.536z"})}),Nn=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M4 6v11.5h16V6H4zm1.5 1.5h6V11h-6V7.5zm0 8.5v-3.5h6V16h-6zm13 0H13v-3.5h5.5V16zM13 11V7.5h5.5V11H13z"})}),Pn=["align"];function Hn(e,t,n){if(!t)return e;const o=Object.fromEntries(Object.entries(e).filter((([e])=>["head","body","foot"].includes(e)))),{sectionName:r,rowIndex:l}=t;return Object.fromEntries(Object.entries(o).map((([e,o])=>r&&r!==e?[e,o]:[e,o.map(((o,r)=>l&&l!==r?o:{cells:o.cells.map(((o,l)=>function(e,t){if(!e||!t)return!1;switch(t.type){case"column":return"column"===t.type&&e.columnIndex===t.columnIndex;case"cell":return"cell"===t.type&&e.sectionName===t.sectionName&&e.columnIndex===t.columnIndex&&e.rowIndex===t.rowIndex}}({sectionName:e,columnIndex:l,rowIndex:r},t)?n(o):o))}))])))}function Ln(e,{sectionName:t,rowIndex:n,columnCount:o}){const r=function(e){return $n(e.head)?$n(e.body)?$n(e.foot)?void 0:e.foot[0]:e.body[0]:e.head[0]}(e),l=void 0===o?r?.cells?.length:o;return l?{[t]:[...e[t].slice(0,n),{cells:Array.from({length:l}).map(((e,n)=>{var o;const l=null!==(o=r?.cells?.[n])&&void 0!==o?o:{};return{...Object.fromEntries(Object.entries(l).filter((([e])=>Pn.includes(e)))),content:"",tag:"head"===t?"th":"td"}}))},...e[t].slice(n)]}:e}function Vn(e,t){var n;return $n(e[t])?Ln(e,{sectionName:t,rowIndex:0,columnCount:null!==(n=e.body?.[0]?.cells?.length)&&void 0!==n?n:1}):{[t]:[]}}function $n(e){return!e||!e.length||e.every(Rn)}function Rn(e){return!(e.cells&&e.cells.length)}const Dn=[{icon:En,title:(0,r.__)("Align column left"),align:"left"},{icon:Cn,title:(0,r.__)("Align column center"),align:"center"},{icon:Sn,title:(0,r.__)("Align column right"),align:"right"}],On={head:(0,r.__)("Header cell text"),body:(0,r.__)("Body cell text"),foot:(0,r.__)("Footer cell text")},jn={head:(0,r.__)("Header label"),foot:(0,r.__)("Footer label")};function Fn({name:e,...t}){const n=`t${e}`;return(0,l.createElement)(n,{...t})}const Un={apiVersion:3,name:"noptin/table",title:(0,r.__)("Table"),category:"design",description:(0,r.__)("Create structured content in rows and columns to display information."),attributes:{hasFixedLayout:{type:"boolean",default:!0},head:{type:"array",default:[],source:"query",selector:"thead tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"rich-text",source:"rich-text"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"},colspan:{type:"string",source:"attribute",attribute:"colspan"},rowspan:{type:"string",source:"attribute",attribute:"rowspan"}}}}},body:{type:"array",default:[],source:"query",selector:"tbody tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"rich-text",source:"rich-text"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"},colspan:{type:"string",source:"attribute",attribute:"colspan"},rowspan:{type:"string",source:"attribute",attribute:"rowspan"}}}}},foot:{type:"array",default:[],source:"query",selector:"tfoot tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"rich-text",source:"rich-text"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"},colspan:{type:"string",source:"attribute",attribute:"colspan"},rowspan:{type:"string",source:"attribute",attribute:"rowspan"}}}}}},supports:{anchor:!1,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!0}},__experimentalSelector:".wp-block-noptin-table > table"},noptin:{typography:["fontFamily","fontSize","fontStyle","fontWeight","lineHeight","letterSpacing","textTransform","textDecoration"],border:!0,color:!0,align:!0}};function Wn(e){const t=parseInt(e,10);if(Number.isInteger(t))return t<0||1===t?void 0:t.toString()}const Gn=({phrasingContentSchema:e})=>({tr:{allowEmpty:!0,children:{th:{allowEmpty:!0,children:e,attributes:["scope","colspan","rowspan"]},td:{allowEmpty:!0,children:e,attributes:["colspan","rowspan"]}}}}),qn={from:[{type:"raw",selector:"table",schema:e=>({table:{children:{thead:{allowEmpty:!0,children:Gn(e)},tfoot:{allowEmpty:!0,children:Gn(e)},tbody:{allowEmpty:!0,children:Gn(e)}}}}),transform:e=>{const t=Array.from(e.children).reduce(((e,t)=>{if(!t.children.length)return e;const n=t.nodeName.toLowerCase().slice(1),o=Array.from(t.children).reduce(((e,t)=>{if(!t.children.length)return e;const n=Array.from(t.children).reduce(((e,t)=>{const n=Wn(t.getAttribute("rowspan")),o=Wn(t.getAttribute("colspan"));return e.push({tag:t.nodeName.toLowerCase(),content:t.innerHTML,rowspan:n,colspan:o}),e}),[]);return e.push({cells:n}),e}),[]);return e[n]=o,e}),{});return(0,o.createBlock)("noptin/table",t)}}]},Zn=qn,{name:Kn}=Un,Yn={icon:wn,example:{attributes:{head:[{cells:[{content:"Version",tag:"th"},{content:"Jazz Musician",tag:"th"},{content:"Release Date",tag:"th"}]}],body:[{cells:[{content:"5.2",tag:"td"},{content:"Jaco Pastorius",tag:"td"},{content:"May 7, 2019",tag:"td"}]},{cells:[{content:"5.1",tag:"td"},{content:"Betty Carter",tag:"td"},{content:"February 21, 2019",tag:"td"}]},{cells:[{content:"5.0",tag:"td"},{content:"Bebo Valdés",tag:"td"},{content:"December 6, 2018",tag:"td"}]}]},viewportWidth:450},transforms:Zn,edit:function({attributes:e,setAttributes:t,isSelected:n}){const{hasFixedLayout:o,head:a,foot:c}=e,[u,p]=(0,l.useState)(2),[d,m]=(0,l.useState)(2),[g,h]=(0,l.useState)(),b=(0,l.useRef)(null),[f,y]=(0,l.useState)(!1);function x(n){g&&t(Hn(e,g,(e=>({...e,content:n}))))}function k(n){if(!g)return;const{sectionName:o,rowIndex:r}=g,l=r+n;t(Ln(e,{sectionName:o,rowIndex:l,columnCount:void 0})),h({sectionName:o,rowIndex:l,columnIndex:0,type:"cell"})}function w(n=0){if(!g)return;const{columnIndex:o,sectionName:r}=g,l=o+n;t(function(e,{columnIndex:t}){const n=Object.fromEntries(Object.entries(e).filter((([e])=>["head","body","foot"].includes(e))));return Object.fromEntries(Object.entries(n).map((([e,n])=>$n(n)?[e,n]:[e,n.map((n=>Rn(n)||n.cells.length{n||h(void 0)}),[n]),(0,l.useEffect)((()=>{f&&(b?.current?.querySelector('td div[contentEditable="true"]')?.focus(),y(!1))}),[f]);const E=["head","body","foot"].filter((t=>!$n(e[t]))),C=[{icon:Bn,title:(0,r.__)("Insert row before"),isDisabled:!g,onClick:function(){k(0)}},{icon:In,title:(0,r.__)("Insert row after"),isDisabled:!g,onClick:function(){k(1)}},{icon:Tn,title:(0,r.__)("Delete row"),isDisabled:!g,onClick:function(){if(!g)return;const{sectionName:n,rowIndex:o}=g;h(void 0),t(function(e,{sectionName:t,rowIndex:n}){return{[t]:e[t].filter(((e,t)=>t!==n))}}(e,{sectionName:n,rowIndex:o}))}},{icon:Mn,title:(0,r.__)("Insert column before"),isDisabled:!g,onClick:function(){w(0)}},{icon:zn,title:(0,r.__)("Insert column after"),isDisabled:!g,onClick:function(){w(1)}},{icon:An,title:(0,r.__)("Delete column"),isDisabled:!g,onClick:function(){if(!g)return;const{columnIndex:n}=g;h(void 0),t(function(e,{columnIndex:t}){const n=Object.fromEntries(Object.entries(e).filter((([e])=>["head","body","foot"].includes(e))));return Object.fromEntries(Object.entries(n).map((([e,n])=>$n(n)?[e,n]:[e,n.map((e=>({cells:e.cells.length>=t?e.cells.filter(((e,n)=>n!==t)):e.cells}))).filter((e=>e.cells.length))])))}(e,{columnIndex:n}))}}],S=R(e),B=v(e),I=B.borderColor,T=V(e).style,M={borderCollapse:"collapse",...B,...T};S||(M.width="100%"),e.hasFixedLayout&&(M.tableLayout="fixed");const z=_(e),A=E.map((t=>{const n={..."head"===t?{borderBottom:`3px solid ${I||"currentcolor"}`}:void 0,..."foot"===t?{borderTop:`3px solid ${I||"currentcolor"}`}:void 0};return(0,l.createElement)(Fn,{name:t,key:t,style:n},e[t].map((({cells:n},o)=>(0,l.createElement)("tr",{key:o},n.map((({content:n,tag:r,scope:a,align:i,colspan:c,rowspan:u},p)=>(0,l.createElement)(r,{key:p,scope:"th"===r?a:void 0,colSpan:c,rowSpan:u,style:{textAlign:i,border:`1px solid ${I||"currentcolor"}`,padding:"0.5em",...e.hasFixedLayout?{wordBreak:"break-word"}:void 0,...z}},(0,l.createElement)(s.RichText,{value:n,onChange:x,onFocus:()=>{h({sectionName:t,rowIndex:o,columnIndex:p,type:"cell"})},"aria-label":On[t],placeholder:jn[t]}))))))))})),N=!E.length,P=(0,s.useBlockProps)({ref:b,className:"noptin-block__margin-wrapper",style:{...Z(e),...T,overflowX:"auto"}});return(0,l.createElement)("div",{...P},!N&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(s.AlignmentControl,{label:(0,r.__)("Change column alignment"),alignmentControls:Dn,value:function(){if(g)return function(e,t,n){const{sectionName:o,rowIndex:r,columnIndex:l}=t;return e[o]?.[r]?.cells?.[l]?.align}(e,g)}(),onChange:n=>function(n){if(!g)return;const o={type:"column",columnIndex:g.columnIndex},r=Hn(e,o,(e=>({...e,align:n})));t(r)}(n)})),(0,l.createElement)(s.BlockControls,{group:"other"},(0,l.createElement)(i.ToolbarDropdownMenu,{hasArrowIndicator:!0,icon:Nn,label:(0,r.__)("Edit table"),controls:C}))),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings"),className:"blocks-table-settings"},(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Fixed width table cells"),checked:!!o,onChange:function(){t({hasFixedLayout:!o})}}),!N&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Header section"),checked:!(!a||!a.length),onChange:function(){t(Vn(e,"head"))}}),(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Footer section"),checked:!(!c||!c.length),onChange:function(){t(Vn(e,"foot"))}})))),!N&&(0,l.createElement)("table",{align:S,style:M},A),N&&(0,l.createElement)(i.Placeholder,{label:(0,r.__)("Table"),icon:(0,l.createElement)(s.BlockIcon,{icon:wn,showColors:!0}),instructions:(0,r.__)("Insert a table for sharing data.")},(0,l.createElement)(i.__experimentalHStack,{as:"form",className:"blocks-table__placeholder-form",onSubmit:function(e){e.preventDefault(),t(function({rowCount:e,columnCount:t}){return{body:Array.from({length:e}).map((()=>({cells:Array.from({length:t}).map((()=>({content:"",tag:"td"})))})))}}({rowCount:parseInt(u,10)||2,columnCount:parseInt(d,10)||2})),y(!0)},alignment:"flex-end",style:{flexDirection:"row",alignItems:"flex-end"},spacing:4,wrap:!0},(0,l.createElement)(i.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,r.__)("Column count"),value:d,onChange:function(e){m(e)},min:1,className:"blocks-table__placeholder-input"}),(0,l.createElement)(i.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,r.__)("Row count"),value:u,onChange:function(e){p(e)},min:1,className:"blocks-table__placeholder-input"}),(0,l.createElement)(i.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit"},(0,r.__)("Create Table")))))},save:function({attributes:e}){const{head:t,body:n,foot:o}=e;if(!t.length&&!n.length&&!o.length)return null;const r=R(e),a=v(e),i=a.borderColor,c=V(e).style,u={borderCollapse:"collapse",...a,...c};r||(u.width="100%"),e.hasFixedLayout&&(u.tableLayout="fixed");const p=_(e),d=({type:t,rows:n})=>{if(!n.length)return null;const o=`t${t}`,r={..."head"===t?{borderBottom:`3px solid ${i||"currentcolor"}`}:void 0,..."foot"===t?{borderTop:`3px solid ${i||"currentcolor"}`}:void 0};return(0,l.createElement)(o,{style:r},n.map((({cells:t},n)=>(0,l.createElement)("tr",{key:n},t.map((({content:t,tag:n,scope:o,align:r,colspan:a,rowspan:c},u)=>(0,l.createElement)(s.RichText.Content,{"data-align":r,style:{textAlign:r,border:`1px solid ${i||"currentcolor"}`,padding:"0.5em",...e.hasFixedLayout?{wordBreak:"break-word"}:void 0,...p},tagName:n,value:t,key:u,scope:"th"===n?o:void 0,colSpan:a,rowSpan:c})))))))},m=s.useBlockProps.save({className:"noptin-block__margin-wrapper",style:{...Z.save(e),...c,overflowX:"auto"}});return(0,l.createElement)("div",{...m},(0,l.createElement)("table",{align:r,style:u},(0,l.createElement)(d,{type:"head",rows:t}),(0,l.createElement)(d,{type:"body",rows:n}),(0,l.createElement)(d,{type:"foot",rows:o})))}},Xn=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"})}),Qn=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z"})}),Jn=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"})}),eo=window.wp.date;function to(){return to=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?mo(wo,--xo):0,yo--,10===ko&&(yo=1,fo--),ko}function Bo(){return ko=xo2||zo(ko)>3?"":" "}function Lo(e,t){for(;--t&&Bo()&&!(ko<48||ko>102||ko>57&&ko<65||ko>70&&ko<97););return Mo(e,To()+(t<6&&32==Io()&&32==Bo()))}function Vo(e){for(;Bo();)switch(ko){case e:return xo;case 34:case 39:34!==e&&39!==e&&Vo(ko);break;case 40:41===e&&Vo(e);break;case 92:Bo()}return xo}function $o(e,t){for(;Bo()&&e+ko!==57&&(e+ko!==84||47!==Io()););return"/*"+Mo(t,xo-1)+"*"+io(47===e?e:Bo())}function Ro(e){for(;!zo(Io());)Bo();return Mo(e,xo)}var Do="-ms-",Oo="-moz-",jo="-webkit-",Fo="comm",Uo="rule",Wo="decl",Go="@keyframes";function qo(e,t){for(var n="",o=bo(e),r=0;r0&&ho(w)-p&&_o(m>32?Jo(w+";",o,n,p-1):Jo(uo(w," ","")+";",o,n,p-2),s);break;case 59:w+=";";default:if(_o(k=Xo(w,t,n,c,u,r,i,y,v=[],x=[],p),l),123===f)if(0===u)Yo(w,t,k,k,v,l,p,i,x);else switch(99===d&&110===mo(w,3)?100:d){case 100:case 108:case 109:case 115:Yo(e,k,k,o&&_o(Xo(e,k,k,0,0,r,i,y,r,v=[],p),x),r,x,p,i,o?v:x);break;default:Yo(w,k,k,k,[""],x,0,i,x)}}c=u=m=0,h=_=1,y=w="",p=a;break;case 58:p=1+ho(w),m=g;default:if(h<1)if(123==f)--h;else if(125==f&&0==h++&&125==So())continue;switch(w+=io(f),f*h){case 38:_=u>0?1:(w+="\f",-1);break;case 44:i[c++]=(ho(w)-1)*_,_=1;break;case 64:45===Io()&&(w+=Po(Bo())),d=Io(),u=p=ho(y=w+=Ro(To())),f++;break;case 45:45===g&&2==ho(w)&&(h=0)}}return l}function Xo(e,t,n,o,r,l,a,i,s,c,u){for(var p=r-1,d=0===r?l:[""],m=bo(d),g=0,h=0,b=0;g0?d[_]+" "+f:uo(f,/&\f/g,d[_])))&&(s[b++]=y);return Eo(e,t,n,0===r?Uo:i,s,c,u)}function Qo(e,t,n){return Eo(e,t,n,Fo,io(ko),go(e,2,-2),0)}function Jo(e,t,n,o){return Eo(e,t,n,Wo,go(e,0,o),go(e,o+1,-1),o)}var er=function(e,t,n){for(var o=0,r=0;o=r,r=Io(),38===o&&12===r&&(t[n]=1),!zo(r);)Bo();return Mo(e,xo)},tr=new WeakMap,nr=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,o=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||tr.get(n))&&!o){tr.set(e,!0);for(var r=[],l=function(e,t){return No(function(e,t){var n=-1,o=44;do{switch(zo(o)){case 0:38===o&&12===Io()&&(t[n]=1),e[n]+=er(xo-1,t,n);break;case 2:e[n]+=Po(o);break;case 4:if(44===o){e[++n]=58===Io()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=io(o)}}while(o=Bo());return e}(Ao(e),t))}(t,r),a=n.props,i=0,s=0;i6)switch(mo(e,t+1)){case 109:if(45!==mo(e,t+4))break;case 102:return uo(e,/(.+:)(.+)-([^]+)/,"$1"+jo+"$2-$3$1"+Oo+(108==mo(e,t+3)?"$3":"$2-$3"))+e;case 115:return~po(e,"stretch")?rr(uo(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==mo(e,t+1))break;case 6444:switch(mo(e,ho(e)-3-(~po(e,"!important")&&10))){case 107:return uo(e,":",":"+jo)+e;case 101:return uo(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+jo+(45===mo(e,14)?"inline-":"")+"box$3$1"+jo+"$2$3$1"+Do+"$2box$3")+e}break;case 5936:switch(mo(e,t+11)){case 114:return jo+e+Do+uo(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return jo+e+Do+uo(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return jo+e+Do+uo(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return jo+e+Do+e+e}return e}var lr=[function(e,t,n,o){if(e.length>-1&&!e.return)switch(e.type){case Wo:e.return=rr(e.value,e.length);break;case Go:return qo([Co(e,{value:uo(e.value,"@","@"+jo)})],o);case Uo:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return qo([Co(e,{props:[uo(t,/:(read-\w+)/,":-moz-$1")]})],o);case"::placeholder":return qo([Co(e,{props:[uo(t,/:(plac\w+)/,":"+jo+"input-$1")]}),Co(e,{props:[uo(t,/:(plac\w+)/,":-moz-$1")]}),Co(e,{props:[uo(t,/:(plac\w+)/,Do+"input-$1")]})],o)}return""}))}}],ar=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var o,r,l=e.stylisPlugins||lr,a={},i=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n96?kr:wr},Cr=function(e,t,n){var o;if(t){var r=t.shouldForwardProp;o=e.__emotion_forwardProp&&r?function(t){return e.__emotion_forwardProp(t)&&r(t)}:r}return"function"!=typeof o&&n&&(o=e.__emotion_forwardProp),o},Sr=function(e){var t=e.cache,n=e.serialized,o=e.isStringTag;return xr(t,n,o),fr((function(){return function(e,t,n){xr(e,t,n);var o=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var r=t;do{e.insert(t===r?"."+o:"",r,e.sheet,!0),r=r.next}while(void 0!==r)}}(t,n,o)})),null},Br=function e(t,n){var o,r,a=t.__emotion_real===t,i=a&&t.__emotion_base||t;void 0!==n&&(o=n.label,r=n.target);var s=Cr(t,n,a),c=s||Er(i),u=!c("as");return function(){var p=arguments,d=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==o&&d.push("label:"+o+";"),null==p[0]||void 0===p[0].raw)d.push.apply(d,p);else{d.push(p[0][0]);for(var m=p.length,g=1;g=4;++o,r-=4)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(r)+s;return{name:c,styles:r,next:hr}}(d.concat(b),t.registered,_);h+=t.key+"-"+y.name,void 0!==r&&(h+=" "+r);var v=u&&void 0===s?Er(g):c,x={};for(var k in e)u&&"as"===k||v(k)&&(x[k]=e[k]);return x.className=h,x.ref=n,l.createElement(l.Fragment,null,l.createElement(Sr,{cache:t,serialized:y,isStringTag:"string"==typeof g}),l.createElement(g,x))},(0,l.forwardRef)((function(e,t){var n=(0,l.useContext)(yr);return h(e,n,t)})));return b.displayName=void 0!==o?o:"Styled("+("string"==typeof i?i:i.displayName||i.name||"Component")+")",b.defaultProps=t.defaultProps,b.__emotion_real=b,b.__emotion_base=i,b.__emotion_styles=d,b.__emotion_forwardProp=s,Object.defineProperty(b,"toString",{value:function(){return"."+r}}),b.withComponent=function(t,o){return e(t,to({},n,o,{shouldForwardProp:Cr(b,o,!0)})).apply(void 0,d)},b}}.bind();function Ir(e){return(t,n)=>{const o={...t};return"COMMIT"!==n.type&&"PRESS_UP"!==n.type&&"PRESS_DOWN"!==n.type||void 0!==o.value&&(o.value=o.value.toString().padStart(e,"0")),o}}["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Br[e]=Br(e)}));const Tr=Br.div` +(0,r.__)("Level %s. Empty."),o):void 0},transforms:re,merge:(e,t)=>({content:(e.content||"")+(t.content||"")}),edit:function({attributes:e,setAttributes:t,mergeBlocks:n,onReplace:o}){const{placeholder:a,content:i,level:c}=e,u=(0,s.useBlockProps)({style:{..._(e),...v(e),...Z(e),...V(e).style}});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(s.HeadingLevelDropdown,{value:c,onChange:e=>t({level:e})})),(0,l.createElement)(s.RichText,{identifier:"content",tagName:"h"+c,value:i,onChange:e=>{t({content:e})},onMerge:n,onReplace:o,onRemove:()=>o([]),placeholder:a||(0,r.__)("Heading"),...u}))},save:function({attributes:e}){const{content:t,level:n}=e,o="h"+n,r=s.useBlockProps.save({style:{..._(e),...v(e),...Z.save(e),...V(e).style}});return(0,l.createElement)(o,{...r},(0,l.createElement)(s.RichText.Content,{value:t}))}},ie=window.wp.primitives;var se=n(848);const ce=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})}),ue=window.wp.blob,pe=window.wp.notices,de=window.wp.url,me=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6 5.5h12a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5ZM4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6Zm4 10h2v-1.5H8V16Zm5 0h-2v-1.5h2V16Zm1 0h2v-1.5h-2V16Z"})}),ge=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M18 20v-2h2v-1.5H7.75a.25.25 0 0 1-.25-.25V4H6v2H4v1.5h2v8.75c0 .966.784 1.75 1.75 1.75h8.75v2H18ZM9.273 7.5h6.977a.25.25 0 0 1 .25.25v6.977H18V7.75A1.75 1.75 0 0 0 16.25 6H9.273v1.5Z"})}),he=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})}),be="none",_e="media",fe="attachment",ye="custom",ve=["image"],xe=({href:e,children:t})=>e?(0,l.createElement)("a",{href:e,onClick:e=>e.preventDefault(),"aria-disabled":!0,style:{pointerEvents:"none",cursor:"default",display:"block",textDecoration:"none",maxWidth:"100%",lineHeight:0}},t):t;function ke({temporaryURL:e,attributes:t,setAttributes:n,isSelected:a,insertBlocksAfter:c,onSelectImage:u,onSelectURL:p,onUploadError:d,containerRef:m,clientId:g,blockEditingMode:h}){const{url:b="",alt:_,caption:f,id:y,href:v,rel:x,linkClass:k,linkDestination:w,width:B,height:I,scale:T,sizeSlug:M}=t,z=R(t),A=B?parseInt(B,10):void 0,P=I?parseInt(I,10):void 0,N=(0,l.useRef)(),H=(0,E.usePrevious)(f),[L,V]=(0,l.useState)(!!f),{image:$,multiImageSelection:D}=(0,S.useSelect)((e=>{const{getMedia:t}=e(C.store),{getMultiSelectedBlockClientIds:n,getBlockName:o}=e(s.store),r=n();return{image:y&&a?t(y,{context:"view"}):null,multiImageSelection:r.length&&r.every((e=>"core/image"===o(e)))}}),[y,a]),{imageEditing:O,imageSizes:j,mediaUpload:F}=(0,S.useSelect)((e=>{const{getSettings:t}=e(s.store),n=t();return{imageEditing:n.imageEditing,imageSizes:n.imageSizes,mediaUpload:n.mediaUpload}}),[g]),{createErrorNotice:U,createSuccessNotice:W}=(0,S.useDispatch)(pe.store),[{loadedNaturalWidth:G,loadedNaturalHeight:q},Z]=(0,l.useState)({loadedNaturalWidth:void 0,loadedNaturalHeight:void 0}),[K,Y]=(0,l.useState)(!1),[X,Q]=(0,l.useState)(),J=function(e,t){const[n,o]=(0,l.useState)();function r(){o(e.current?.clientWidth)}return(0,l.useEffect)(r,t),(0,l.useEffect)((()=>{const{defaultView:t}=e.current.ownerDocument;return t.addEventListener("resize",r),()=>{t.removeEventListener("resize",r)}}),[]),n}(m,[z]),ee="default"===h,te=j.filter((({slug:e})=>$?.media_details?.sizes?.[e]?.source_url)).map((({name:e,slug:t})=>({value:t,label:e}))),ne=!!F;(0,l.useEffect)((()=>{we(y,b)&&a&&ne?X||window.fetch(b.includes("?")?b:b+"?").then((e=>e.blob())).then((e=>Q(e))).catch((()=>{})):Q(void 0)}),[y,b,a,X,ne]),(0,l.useEffect)((()=>{f&&!H&&V(!0)}),[f,H]);const oe=(0,l.useCallback)((e=>{e&&!f&&e.focus()}),[f]),{naturalWidth:re,naturalHeight:le}=(0,l.useMemo)((()=>({naturalWidth:N.current?.naturalWidth||G||void 0,naturalHeight:N.current?.naturalHeight||q||void 0})),[G,q,N.current?.complete]);(0,l.useEffect)((()=>{a||(Y(!1),f||V(!1))}),[a,f]);const ae=y&&re&&le&&O,ie=!D&&ae&&!K,se=()=>{n({width:void 0,height:void 0,scale:void 0})},ce=(0,i.__experimentalUseCustomUnits)({availableUnits:["px"]}),be=(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Width"),isShownByDefault:!0,hasValue:()=>!!B,onDeselect:()=>n({width:void 0}),panelId:g,style:{gridColumn:"span 1"}},(0,l.createElement)(s.__experimentalUnitControl,{label:(0,r.__)("Width"),placeholder:(0,r.__)("Auto"),labelPosition:"top",min:0,value:B||"",onChange:e=>n({width:e?`${e}`:void 0}),size:"__unstable-large"})),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Height"),isShownByDefault:!0,hasValue:()=>!!I,onDeselect:()=>n({height:void 0}),panelId:g,style:{gridColumn:"span 1"}},(0,l.createElement)(s.__experimentalUnitControl,{label:(0,r.__)("Height"),placeholder:(0,r.__)("Auto"),labelPosition:"top",units:ce,min:0,value:I||"",onChange:e=>n({height:e}),size:"__unstable-large"}))),_e=(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},ee&&(0,l.createElement)(i.ToolbarButton,{onClick:()=>{V(!L),L&&f&&n({caption:void 0})},icon:me,isPressed:L,label:L?(0,r.__)("Remove caption"):(0,r.__)("Add caption")}),!D&&!K&&(0,l.createElement)(s.__experimentalImageURLInputUI,{url:v||"",onChangeUrl:n,linkDestination:w,mediaUrl:$&&$.source_url||b,mediaLink:$&&$.link,linkClass:k,rel:x}),ie&&(0,l.createElement)(i.ToolbarButton,{onClick:()=>Y(!0),icon:ge,label:(0,r.__)("Crop")})),!D&&!K&&(0,l.createElement)(s.BlockControls,{group:"other"},(0,l.createElement)(s.MediaReplaceFlow,{mediaId:y,mediaURL:b,allowedTypes:ve,accept:"image/*",onSelect:u,onSelectURL:p,onError:d})),!D&&X&&(0,l.createElement)(s.BlockControls,null,(0,l.createElement)(i.ToolbarGroup,null,(0,l.createElement)(i.ToolbarButton,{onClick:function(){F({filesList:[X],onFileChange([e]){u(e),(0,ue.isBlobURL)(e.url)||(Q(void 0),W((0,r.__)("Image uploaded."),{type:"snackbar"}))},allowedTypes:ve,onError(e){U(e,{type:"snackbar"})}})},icon:he,label:(0,r.__)("Upload external image")}))),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Settings"),panelId:g,resetAll:se},!D&&(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Alternative text"),isShownByDefault:!0,hasValue:()=>""!==_,panelId:g,onDeselect:()=>n({alt:void 0})},(0,l.createElement)(i.TextareaControl,{label:(0,r.__)("Alternative text"),value:_,onChange:e=>n({alt:e}),help:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,r.__)("Describe the purpose of the image.")),(0,l.createElement)("br",null),(0,r.__)("Leave empty if decorative.")),__nextHasNoMarginBottom:!0})),ee&&(0,l.createElement)(l.Fragment,null,te.length>0?(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Image size"),isShownByDefault:!0,hasValue:()=>"large"!==M,panelId:g,onDeselect:()=>n({sizeSlug:"large"})},(0,l.createElement)(i.SelectControl,{label:(0,r.__)("Image size"),value:M,options:te,onChange:function(e){const t=$?.media_details?.sizes?.[e]?.source_url;if(!t)return null;n({url:t,sizeSlug:e,height:void 0})},className:"noptin-field-control",__nextHasNoMarginBottom:!0})):null,be)))),fe=(0,de.getFilename)(b);let ye;ye=_||(fe?(0,r.sprintf)(/* translators: %s: file name */ /* translators: %s: file name */ +(0,r.__)("This image has an empty alt attribute; its file name is %s"),fe):(0,r.__)("This image has an empty alt attribute"));const ke=N.current?.width||J,Ee=ae&&K,Ce=(0,l.createElement)(xe,{href:v},Ee?(0,l.createElement)(s.__experimentalImageEditor,{id:y,url:b,width:A,height:P,clientWidth:ke,naturalHeight:le,naturalWidth:re,onSaveImage:e=>n(e),onFinishEditing:()=>{Y(!1)}}):(0,l.createElement)(l.Fragment,null,(0,l.createElement)("img",{src:e||b,alt:ye,onLoad:e=>{Z({loadedNaturalWidth:e.target?.naturalWidth,loadedNaturalHeight:e.target?.naturalHeight})},ref:N,style:{width:!B&&I?"auto":B,height:I,objectFit:T,maxWidth:"100%"}}),e&&(0,l.createElement)(i.Spinner,null)));return b||e?(0,l.createElement)(l.Fragment,null,!e&&_e,Ce,L&&(!s.RichText.isEmpty(f)||a)&&(0,l.createElement)(s.RichText,{identifier:"caption",ref:oe,className:"wp-block-image__caption",tagName:"div","aria-label":(0,r.__)("Image caption text"),placeholder:(0,r.__)("Add caption"),value:f,onChange:e=>n({caption:e}),inlineToolbar:!0,__unstableOnSplitAtEnd:()=>c((0,o.createBlock)((0,o.getDefaultBlockName)())),style:{fontSize:"12px",textAlign:z,marginTop:"12px"}})):(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Settings"),panelId:g,resetAll:se},ee&&be))}const we=(e,t)=>t&&!e&&!(0,ue.isBlobURL)(t);function Ee(e,t){var n,o;return"url"in(null!==(n=e?.sizes?.[t])&&void 0!==n?n:{})||"source_url"in(null!==(o=e?.media_details?.sizes?.[t])&&void 0!==o?o:{})}const Ce={apiVersion:3,name:"core/image",title:(0,r.__)("Image"),category:"content",description:(0,r.__)("Insert an image to make a visual statement."),keywords:["img","picture","media","photo"],attributes:{blob:{type:"string",role:"local"},url:{type:"string",source:"attribute",selector:"img",attribute:"src",role:"content"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:"",role:"content"},caption:{type:"string",source:"html",selector:".wp-block-image__caption",role:"content"},href:{type:"string",source:"attribute",selector:"a",attribute:"href",role:"content"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"a",attribute:"class"},id:{type:"number",role:"content"},width:{type:"string"},height:{type:"string"},scale:{type:"string"},sizeSlug:{type:"string",default:"large"},linkDestination:{type:"string"},link:{type:"string"}},supports:{anchor:!1,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0}}},noptin:{border:!0,align:!0},selectors:{border:".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder"}};function Se(e,t){const{body:n}=document.implementation.createHTMLDocument("");n.innerHTML=e;const{firstElementChild:o}=n;if(o&&"A"===o.nodeName)return o.getAttribute(t)||void 0}const Be={img:{attributes:["src","alt"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+$/]}},Ie={from:[{type:"raw",isMatch:e=>"FIGURE"===e.nodeName&&!!e.querySelector("img"),schema:({phrasingContentSchema:e})=>({figure:{require:["img"],children:{...Be,a:{attributes:["href","rel"],children:Be},figcaption:{children:e}}}}),transform:e=>{const t=e.className+" "+e.querySelector("img").className,n=/(?:^|\s)align(left|center|right)(?:$|\s)/.exec(t),r=""===e.id?void 0:e.id,l=n?n[1]:void 0,a=/(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(t),i=a?Number(a[1]):void 0,s=e.querySelector("a"),c=s&&s.href?"custom":void 0,u=s&&s.href?s.href:void 0,p=s&&s.rel?s.rel:void 0,d=s&&s.className?s.className:void 0,m=(0,o.getBlockAttributes)("core/image",e.outerHTML,{id:i,linkDestination:c,href:u,rel:p,linkClass:d,anchor:r,style:{noptin:{align:l}}});return(0,o.createBlock)("core/image",m)}},{type:"shortcode",tag:"caption",attributes:{url:{type:"string",source:"attribute",attribute:"src",selector:"img"},alt:{type:"string",source:"attribute",attribute:"alt",selector:"img"},caption:{shortcode:function(e,{shortcode:t}){const{body:n}=document.implementation.createHTMLDocument("");n.innerHTML=t.content;let o=n.querySelector("img");for(;o&&o.parentNode&&o.parentNode!==n;)o=o.parentNode;return o&&o.parentNode.removeChild(o),n.innerHTML.trim()}},href:{shortcode:(e,{shortcode:t})=>Se(t.content,"href")},rel:{shortcode:(e,{shortcode:t})=>Se(t.content,"rel")},linkClass:{shortcode:(e,{shortcode:t})=>Se(t.content,"class")},id:{type:"number",shortcode:({named:{id:e}})=>{if(e)return parseInt(e.replace("attachment_",""),10)}}}}]},Te=Ie;window?.wp?.media?.view?.settings?.defaultProps&&Object.entries(window.wp.media.view.settings.defaultProps).forEach((([e,t])=>{Ce.attributes[e]&&(Ce.attributes[e].default=t)}));const{name:Me}=Ce,ze={icon:ce,example:{attributes:{sizeSlug:"large",url:"https://s.w.org/images/core/5.3/MtBlanc1.jpg",caption:"Mont Blanc appears—still, snowy, and serene."}},__experimentalLabel(e,{context:t}){if("accessibility"===t){const{caption:t,alt:n,url:o}=e;return o?n?n+(t?". "+t:""):t||"":(0,r.__)("Empty")}},transforms:Te,edit:function({attributes:e,setAttributes:t,isSelected:n,className:o,insertBlocksAfter:a,onReplace:c,context:u,clientId:p}){const{url:d="",alt:m,caption:g,id:h,width:b,height:_,sizeSlug:f}=e,[y,x]=(0,l.useState)(e.blob);(0,l.useEffect)((()=>{b&&/^\d+$/.test(b)&&t({width:`${b}px`})}),[b]);const w=R(e),E=(0,l.useRef)();(0,l.useEffect)((()=>{E.current=m}),[m]);const C=(0,l.useRef)();(0,l.useEffect)((()=>{C.current=g}),[g]);const B=(0,l.useRef)(),I=(0,s.useBlockEditingMode)(),{createErrorNotice:T}=(0,S.useDispatch)(pe.store);function M(e){T(e,{type:"snackbar"}),t({src:void 0,id:void 0,url:void 0,blob:void 0})}function z(n){if(!n||!n.url)return t({url:void 0,alt:void 0,id:void 0,title:void 0,caption:void 0,blob:void 0}),void x(void 0);if((0,ue.isBlobURL)(n.url))return void x(n.url);let o="full";f&&Ee(n,f)?o=f:Ee(n,"large")&&(o="large");let r,l=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption","width","url"].includes(e)))),o=["width","url"];return e?.sizes?.[t]?o.forEach((o=>{e.sizes[t][o]&&(n[o]=e.sizes[t][o])})):e?.media_details?.sizes?.[t]&&o.forEach((o=>{e.media_details.sizes[t][o]?n[o]=e.media_details.sizes[t][o]:e.media_details.sizes[t][`source_${o}`]&&(n[o]=e.media_details.sizes[t][`source_${o}`])})),n.width&&(n.width=`${n.width}`),n.height=void 0,n})(n,o);if(C.current&&!l.caption){const{caption:e,...t}=l;l=t}r=n.id&&n.id===h?{url:d}:{sizeSlug:o};let a,i=e.linkDestination;if(!i)switch(window?.wp?.media?.view?.settings?.defaultProps?.link||be){case"file":case _e:i=_e;break;case"post":case fe:i=fe;break;case ye:i=ye;break;case be:i=be}switch(i){case _e:a=n.url;break;case fe:a=n.link}l.href=a,t({blob:void 0,...l,...r,width:void 0,linkDestination:i}),x(void 0)}function A(e){e!==d&&(t({blob:void 0,url:e,id:void 0,sizeSlug:"large"}),x(void 0))}!function(e={}){const t=(0,l.useRef)(e),n=(0,l.useRef)(!1),{getSettings:o}=(0,S.useSelect)(s.store,[]);(0,l.useLayoutEffect)((()=>{t.current=e})),(0,l.useEffect)((()=>{if(n.current)return;if(!t.current.url||!(0,ue.isBlobURL)(t.current.url))return;const e=(0,ue.getBlobByURL)(t.current.url);if(!e)return;const{url:r,allowedTypes:l,onChange:a,onError:i}=t.current,{mediaUpload:s}=o();n.current=!0,s({filesList:[e],allowedTypes:l,onFileChange:([e])=>{(0,ue.isBlobURL)(e?.url)||((0,ue.revokeBlobURL)(r),a(e),n.current=!1)},onError:e=>{(0,ue.revokeBlobURL)(r),i(e),n.current=!1}})}),[o])}({url:y,allowedTypes:ve,onChange:z,onError:M});const P=we(h,d)?d:void 0,N=!!d&&(0,l.createElement)("img",{alt:(0,r.__)("Edit image"),title:(0,r.__)("Edit image"),className:"edit-image-preview",src:d}),H={className:k(o,"noptin-image-block__wrapper",{"is-transient":!!y,"is-resized":!!b||!!_,[`size-${f}`]:f}),border:0,cellPadding:"0",cellSpacing:"0",role:"presentation"};"left"!==w&&"right"!==w||(H.align=w,H.className+=" noptin-image-block__wrapper-is-aligned");const L=(0,s.useBlockProps)({ref:B,...H}),V={...v(e),...Z(e),display:e.width?"inline-block":"block",maxWidth:"100%"};return(0,l.createElement)("table",{...L},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:w},(0,l.createElement)("div",{className:k("noptin-block__margin-wrapper",{"is-selected":n}),style:V},(0,l.createElement)(ke,{temporaryURL:y,attributes:e,setAttributes:t,isSelected:n,insertBlocksAfter:a,onReplace:c,onSelectImage:z,onSelectURL:A,onUploadError:M,containerRef:B,context:u,clientId:p,blockEditingMode:I}),(0,l.createElement)(s.MediaPlaceholder,{icon:(0,l.createElement)(s.BlockIcon,{icon:ce}),onSelect:z,onSelectURL:A,onError:M,placeholder:e=>(0,l.createElement)(i.Placeholder,{className:"block-editor-media-placeholder",withIllustration:!n,icon:ce,label:(0,r.__)("Image"),instructions:(0,r.__)("Upload an image file, pick one from your media library, or add one with a URL."),style:{width:b,height:_}},e),accept:"image/*",allowedTypes:["image"],handleUpload:e=>1===e.length,value:{id:h,src:P},mediaPreview:N,disableMediaButtons:y||d}))))))},save:function({attributes:e}){const{url:t,alt:n,caption:o,href:r,rel:a,linkClass:i,width:c,height:u}=e,p=R(e),d=(0,l.createElement)("img",{src:t,alt:n,width:c&&c.endsWith("px")?c.slice(0,-2):void 0,border:"0",style:{width:!c&&u?"auto":c,height:u,maxWidth:"100%"}}),m={...v(e),...Z.save(e),display:"inline-block",maxWidth:"100%"},g=(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:m},r?(0,l.createElement)("a",{className:i,href:r,rel:a||void 0,style:{display:"block",textDecoration:"none",maxWidth:"100%",lineHeight:0}},d):d,!s.RichText.isEmpty(o)&&(0,l.createElement)(s.RichText.Content,{className:"wp-block-image__caption",tagName:"div",value:o,style:{fontSize:"12px",textAlign:"center",marginTop:"12px"}})),h={className:"noptin-image-block__wrapper",border:0,cellPadding:"0",cellSpacing:"0",role:"presentation"};return"left"!==p&&"right"!==p||(h.align=p,h.className+=" noptin-image-block__wrapper-is-aligned"),(0,l.createElement)("table",{...s.useBlockProps.save(h)},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:p},g))))}};function Ae(e){return e.replace(/<\/?a[^>]*>/g,"")}const Pe=(e,t="")=>{const[n]=u(e,null,"color"),o={style:{},vmlOpen:"",vmlClose:""};if(!e.style?.background?.backgroundImage?.url)return o;o.style.backgroundImage=`url("${e.style.background.backgroundImage.url}")`,o.style.backgroundSize=e.style.background.backgroundSize||"contain",o.style.backgroundPosition=e.style.background.backgroundPosition||"center center",o.style.backgroundRepeat=e.style.background.backgroundRepeat||"no-repeat";const r=n?.background||"#ffffff";return o.vmlOpen=`\n\t\t\x3c!--[if gte mso 9]>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\n\t\t\t\t\n\t\t\t\n\t\tt({url:e}),__nextHasNoMarginBottom:!0}),(0,l.createElement)(i.__experimentalToggleGroupControl,{label:(0,r.__)("Button width"),className:"noptin-toggle-group-control",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isAdaptiveWidth:!0,isBlock:!0,isDeselectable:!0,onChange:function(n){const o=e.width===n?void 0:n;t({width:o})}},[25,50,75,100].map((e=>(0,l.createElement)(i.__experimentalToggleGroupControlOption,{key:e,label:`${e}%`,value:e})))))}const He={apiVersion:3,name:"noptin/button",title:(0,r.__)("Button"),category:"content",description:(0,r.__)("Prompt readers to take action with a button-style link.","newsletter-optin-box"),keywords:["link","cta"],attributes:{url:{type:"string",source:"attribute",selector:"a",attribute:"href",role:"content"},title:{type:"string",source:"attribute",selector:"a",attribute:"title",role:"content"},text:{type:"string",source:"html",selector:"a",role:"content"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel",role:"content",default:"noopener noreferrer"},placeholder:{type:"string"},style:{type:"object",default:{noptin:{border:{radius:"5px"},typography:{textTransform:"none",textDecoration:"none",textAlign:"center"}}}},width:{type:"number"}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0},align:!0},supports:{anchor:!1,reusable:!1,shadow:!1,splitting:!0,background:{__experimentalSkipSerialization:!0,backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0,__experimentalDefaultControls:{backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0}},spacing:{__experimentalSkipSerialization:!0,padding:["horizontal","vertical"],margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}}},Le=window.wp.element,{name:Ve}=He,$e={icon:"button",example:{attributes:{text:(0,r.__)("Call to Action")}},edit:function(e){const{attributes:t,setAttributes:n,isSelected:a,onReplace:c,mergeBlocks:u,clientId:p}=e,{placeholder:d,rel:m,text:g,width:h}=t,b=R(t),f=_(t),[y,x]=(0,l.useState)(null),k=Pe(t),w=v(t),C=V(t).style,B=Z(t,!0),I=(0,l.useRef)(),T=(0,l.useRef)(),M=(0,s.useBlockProps)({ref:(0,E.useMergeRefs)([x,I]),width:"100%",border:0,cellPadding:0,cellSpacing:0,role:"presentation",className:"noptin-button-block__wrapper"}),[z,A]=(0,l.useState)(!0);(0,l.useEffect)((()=>{a&&A(!0)}),[a]);const P=function(e){const{replaceBlocks:t,selectionChange:n}=(0,S.useDispatch)(s.store),{getBlock:r,getBlockRootClientId:a,getBlockIndex:i}=(0,S.useSelect)(s.store),c=(0,l.useRef)(e);return c.current=e,(0,E.useRefEffect)((e=>{function l(e){if(e.defaultPrevented||e.keyCode!==K.ENTER)return;const{content:l,clientId:s}=c.current;if(l.length)return;e.preventDefault();const u=r(a(s)),p=i(s),d=(0,o.cloneBlock)({...u,innerBlocks:u.innerBlocks.slice(0,p)}),m=(0,o.createBlock)((0,o.getDefaultBlockName)()),g=u.innerBlocks.slice(p+1),h=g.length?[(0,o.cloneBlock)({...u,innerBlocks:g})]:[];t(u.clientId,[d,m,...h],1),n(m.clientId)}return e.addEventListener("keydown",l),()=>{e.removeEventListener("keydown",l)}}),[])}({content:g,clientId:p}),N=(0,E.useMergeRefs)([P,T]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("table",{...M},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:b},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:B.margin},(0,l.createElement)("table",{width:h?`${h}%`:void 0},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{bgcolor:C.backgroundColor,role:"presentation",valign:"middle",className:"noptin-button-link__wrapper",style:{backgroundColor:C.backgroundColor,...k.style,textAlign:f?.textAlign,cursor:"auto",...w}},(0,l.createElement)(s.RichText,{ref:N,tagName:"span","aria-label":(0,r.__)("Button text"),placeholder:d||(0,r.__)("Add text…"),value:g,onChange:e=>n({text:Ae(e)}),withoutInteractiveFormatting:!0,className:"noptin-button-link",style:{...B.padding,...f||{},color:C.color,margin:"0px",display:"block"},onReplace:c,onMerge:u,identifier:"text"})))))))))),a&&z&&(0,l.createElement)(i.Popover,{placement:"bottom",onClose:()=>{A(!1),T.current?.focus()},anchor:y,focusOnMount:!1,__unstableSlotName:"__unstable-block-tools-after",shift:!0},(0,l.createElement)(s.URLInput,{label:(0,r.__)("Button URL"),help:(0,r.__)("The URL to link to."),className:"block-editor-link-control__field noptin-link-control-popover__field",value:t.url||"",onChange:e=>n({url:e}),__nextHasNoMarginBottom:!0})),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(Ne,{attributes:t,setAttributes:n})),(0,l.createElement)(s.InspectorControls,{group:"advanced"},(0,l.createElement)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Link rel"),value:m||"",onChange:e=>n({rel:e})})))},save:function({attributes:e}){const{rel:t,text:n,title:o,url:r,width:a}=e,i=R(e),c=v(e),u=V(e),p=Pe(e,a),d=u?.style?.backgroundColor,m=u?.style?.color,g=Z.save(e,!0),h={...g.padding,..._(e),borderRadius:c?.borderRadius,margin:"0px",display:"block",color:m,wordBreak:"break-word"},b=s.useBlockProps.save({width:"100%",border:0,cellPadding:0,cellSpacing:0,role:"presentation",className:"noptin-button-block__wrapper"});if(!n)return null;const f={...p.style};return f.backgroundImage?f.backgroundColor=d:f.background=d,(0,l.createElement)("table",{...b},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:i},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:g.margin},p.vmlOpen&&(0,l.createElement)(Le.RawHTML,{children:p.vmlOpen}),(0,l.createElement)("table",{width:a?`${a}%`:void 0},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{bgcolor:d,role:"presentation",valign:"middle",className:"noptin-button-link__wrapper",style:{...f,textAlign:h.textAlign,cursor:"auto",...c}},(0,l.createElement)(s.RichText.Content,{tagName:"a",className:"noptin-button-link",href:r,title:o,style:h,value:n,rel:t}))))),p.vmlClose&&(0,l.createElement)(Le.RawHTML,{children:p.vmlClose}))))))},merge:(e,{text:t=""})=>({...e,text:(e.text||"")+t})},Re=["noptin/social-link"],De=[{name:"facebook",color:"#3b5998",title:"Facebook"},{name:"twitter",color:"#55acee",title:"Twitter"},{name:"youtube",color:"#eb3323",title:"YouTube"}],Oe=window.noptinEmailSettingsMisc?.assets_url||"https://www.mailjet.com/images/theme/v1/icons/ico-social/",je=De.map((({name:e,title:t,color:n})=>["noptin/social-link",{img:`${Oe}${e}.png`,url:"#",label:t,style:{noptin:{border:{radius:"50%"},color:{background:n}}}}])),Fe={iconSize:{label:(0,r.__)("Icon size"),options:{"20px":(0,r.__)("S"),"32px":(0,r.__)("M"),"48px":(0,r.__)("L"),"64px":(0,r.__)("XL")}},iconSpacing:{label:(0,r.__)("Icon spacing"),options:{"0px":(0,r.__)("None"),"4px":(0,r.__)("S"),"16px":(0,r.__)("M"),"24px":(0,r.__)("L")}},iconPadding:{label:(0,r.__)("Icon padding"),options:{"0px":(0,r.__)("None"),"4px":(0,r.__)("S"),"16px":(0,r.__)("M"),"24px":(0,r.__)("L")}}};function Ue({attributes:e,setAttributes:t,clientId:n}){return(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Settings"),panelId:n,resetAll:()=>{t({iconSize:"32px",iconSpacing:"4px",iconPadding:"4px"})}},Object.entries(Fe).map((([o,r])=>{const a=Object.keys(r.options)[0];return(0,l.createElement)(i.__experimentalToolsPanelItem,{key:o,label:r.label,isShownByDefault:!0,hasValue:()=>!!e[o],panelId:n,onDeselect:()=>t({[o]:a})},(0,l.createElement)(i.__experimentalToggleGroupControl,{label:r.label,value:e[o],onChange:e=>t({[o]:e}),className:"noptin-field-control",__nextHasNoMarginBottom:!0,isAdaptiveWidth:!0,isBlock:!0,isDeselectable:!0},Object.entries(r.options).map((([e,t])=>(0,l.createElement)(i.__experimentalToggleGroupControlOption,{key:`${o}__${e}`,label:t,value:e})))))})))}const We={apiVersion:3,name:"noptin/social-links",title:(0,r.__)("Social Icons"),category:"content",description:(0,r.__)("Display icons linking to your social media profiles or sites."),keywords:["links"],attributes:{iconSize:{type:"string",default:"32px"},iconSpacing:{type:"string",default:"4px"},iconPadding:{type:"string",default:"4px"}},providesContext:{"noptin/social-links/iconSize":"iconSize"},noptin:{border:!0,color:{background:!0},align:!0},supports:{anchor:!1,__experimentalExposeControlsToChildren:!0,spacing:{margin:!0,padding:!0,units:["px","em","rem"],__experimentalSkipSerialization:!0,__experimentalDefaultControls:{margin:!0,padding:!1}}}},{name:Ge}=We,qe={example:{innerBlocks:De.map((({name:e,title:t,color:n})=>({name:"noptin/social-link",attributes:{img:`https://www.mailjet.com/images/theme/v1/icons/ico-social/${e}.png`,url:"#",label:t,style:{noptin:{border:{radius:"50%"},color:{background:n}}}}})))},icon:"share",edit:function({attributes:e,setAttributes:t}){const{iconSpacing:n,iconPadding:o}=e,r=R(e),a=Z(e,!0),i=v(e),c=(0,s.useBlockProps)({style:a.margin,className:"noptin-block__margin-wrapper"}),u=(0,s.useInnerBlocksProps)({},{allowedBlocks:Re,template:je,templateLock:!1,orientation:"horizontal",__experimentalAppenderTagName:"td"}),p={lineHeight:"100%",width:"100%",borderCollapse:"separate",...V(e).style,...i};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(Ue,{attributes:e,setAttributes:t})),(0,l.createElement)("div",{...c},(0,l.createElement)("table",{role:"presentation",cellPadding:0,cellSpacing:0,border:0,width:"100%",style:p},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:r,style:a.padding,border:"0",role:"presentation",valign:"middle"},(0,l.createElement)("table",{align:r,cellPadding:o||0,cellSpacing:n||0,style:{borderCollapse:"separate"}},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",{...u})))))))))},save:({attributes:e})=>{const{iconSpacing:t,iconPadding:n}=e,o=R(e),r=Z.save(e,!0),a=v(e),i=s.useBlockProps.save({style:r.margin,className:"noptin-block__margin-wrapper"}),c={lineHeight:"100%",width:"100%",borderCollapse:"separate",...V(e).style,...a};return(0,l.createElement)("div",{...i},(0,l.createElement)("table",{role:"presentation",cellPadding:0,cellSpacing:0,border:0,width:"100%",style:c},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:o,style:r.padding,border:"0",role:"presentation",valign:"middle"},(0,l.createElement)("table",{align:o,cellPadding:n||0,cellSpacing:t||0,style:{borderCollapse:"separate"}},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)(s.InnerBlocks.Content,null)))))))))}},Ze=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"})}),Ke=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z"})}),Ye=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"})}),Xe=window.wp.date;function Qe(){return Qe=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?ct(yt,--_t):0,ht--,10===ft&&(ht=1,gt--),ft}function wt(){return ft=_t2||Bt(ft)>3?"":" "}function At(e,t){for(;--t&&wt()&&!(ft<48||ft>102||ft>57&&ft<65||ft>70&&ft<97););return St(e,Ct()+(t<6&&32==Et()&&32==wt()))}function Pt(e){for(;wt();)switch(ft){case e:return _t;case 34:case 39:34!==e&&39!==e&&Pt(ft);break;case 40:41===e&&Pt(e);break;case 92:wt()}return _t}function Nt(e,t){for(;wt()&&e+ft!==57&&(e+ft!==84||47!==Et()););return"/*"+St(t,_t-1)+"*"+rt(47===e?e:wt())}function Ht(e){for(;!Bt(Et());)wt();return St(e,_t)}var Lt="-ms-",Vt="-moz-",$t="-webkit-",Rt="comm",Dt="rule",Ot="decl",jt="@keyframes";function Ft(e,t){for(var n="",o=dt(e),r=0;r0&&pt(w)-p&&mt(m>32?Kt(w+";",o,n,p-1):Kt(it(w," ","")+";",o,n,p-2),s);break;case 59:w+=";";default:if(mt(k=qt(w,t,n,c,u,r,i,y,v=[],x=[],p),l),123===f)if(0===u)Gt(w,t,k,k,v,l,p,i,x);else switch(99===d&&110===ct(w,3)?100:d){case 100:case 108:case 109:case 115:Gt(e,k,k,o&&mt(qt(e,k,k,0,0,r,i,y,r,v=[],p),x),r,x,p,i,o?v:x);break;default:Gt(w,k,k,k,[""],x,0,i,x)}}c=u=m=0,h=_=1,y=w="",p=a;break;case 58:p=1+pt(w),m=g;default:if(h<1)if(123==f)--h;else if(125==f&&0==h++&&125==kt())continue;switch(w+=rt(f),f*h){case 38:_=u>0?1:(w+="\f",-1);break;case 44:i[c++]=(pt(w)-1)*_,_=1;break;case 64:45===Et()&&(w+=Mt(wt())),d=Et(),u=p=pt(y=w+=Ht(Ct())),f++;break;case 45:45===g&&2==pt(w)&&(h=0)}}return l}function qt(e,t,n,o,r,l,a,i,s,c,u){for(var p=r-1,d=0===r?l:[""],m=dt(d),g=0,h=0,b=0;g0?d[_]+" "+f:it(f,/&\f/g,d[_])))&&(s[b++]=y);return vt(e,t,n,0===r?Dt:i,s,c,u)}function Zt(e,t,n){return vt(e,t,n,Rt,rt(ft),ut(e,2,-2),0)}function Kt(e,t,n,o){return vt(e,t,n,Ot,ut(e,0,o),ut(e,o+1,-1),o)}var Yt=function(e,t,n){for(var o=0,r=0;o=r,r=Et(),38===o&&12===r&&(t[n]=1),!Bt(r);)wt();return St(e,_t)},Xt=new WeakMap,Qt=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,o=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Xt.get(n))&&!o){Xt.set(e,!0);for(var r=[],l=function(e,t){return Tt(function(e,t){var n=-1,o=44;do{switch(Bt(o)){case 0:38===o&&12===Et()&&(t[n]=1),e[n]+=Yt(_t-1,t,n);break;case 2:e[n]+=Mt(o);break;case 4:if(44===o){e[++n]=58===Et()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=rt(o)}}while(o=wt());return e}(It(e),t))}(t,r),a=n.props,i=0,s=0;i6)switch(ct(e,t+1)){case 109:if(45!==ct(e,t+4))break;case 102:return it(e,/(.+:)(.+)-([^]+)/,"$1"+$t+"$2-$3$1"+Vt+(108==ct(e,t+3)?"$3":"$2-$3"))+e;case 115:return~st(e,"stretch")?en(it(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==ct(e,t+1))break;case 6444:switch(ct(e,pt(e)-3-(~st(e,"!important")&&10))){case 107:return it(e,":",":"+$t)+e;case 101:return it(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+$t+(45===ct(e,14)?"inline-":"")+"box$3$1"+$t+"$2$3$1"+Lt+"$2box$3")+e}break;case 5936:switch(ct(e,t+11)){case 114:return $t+e+Lt+it(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return $t+e+Lt+it(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return $t+e+Lt+it(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return $t+e+Lt+e+e}return e}var tn=[function(e,t,n,o){if(e.length>-1&&!e.return)switch(e.type){case Ot:e.return=en(e.value,e.length);break;case jt:return Ft([xt(e,{value:it(e.value,"@","@"+$t)})],o);case Dt:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Ft([xt(e,{props:[it(t,/:(read-\w+)/,":-moz-$1")]})],o);case"::placeholder":return Ft([xt(e,{props:[it(t,/:(plac\w+)/,":"+$t+"input-$1")]}),xt(e,{props:[it(t,/:(plac\w+)/,":-moz-$1")]}),xt(e,{props:[it(t,/:(plac\w+)/,Lt+"input-$1")]})],o)}return""}))}}],nn=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var o,r,l=e.stylisPlugins||tn,a={},i=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n96?vn:xn},wn=function(e,t,n){var o;if(t){var r=t.shouldForwardProp;o=e.__emotion_forwardProp&&r?function(t){return e.__emotion_forwardProp(t)&&r(t)}:r}return"function"!=typeof o&&n&&(o=e.__emotion_forwardProp),o},En=function(e){var t=e.cache,n=e.serialized,o=e.isStringTag;return yn(t,n,o),hn((function(){return function(e,t,n){yn(e,t,n);var o=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var r=t;do{e.insert(t===r?"."+o:"",r,e.sheet,!0),r=r.next}while(void 0!==r)}}(t,n,o)})),null},Cn=function e(t,n){var o,r,a=t.__emotion_real===t,i=a&&t.__emotion_base||t;void 0!==n&&(o=n.label,r=n.target);var s=wn(t,n,a),c=s||kn(i),u=!c("as");return function(){var p=arguments,d=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==o&&d.push("label:"+o+";"),null==p[0]||void 0===p[0].raw)d.push.apply(d,p);else{d.push(p[0][0]);for(var m=p.length,g=1;g=4;++o,r-=4)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(r)+s;return{name:c,styles:r,next:dn}}(d.concat(b),t.registered,_);h+=t.key+"-"+y.name,void 0!==r&&(h+=" "+r);var v=u&&void 0===s?kn(g):c,x={};for(var k in e)u&&"as"===k||v(k)&&(x[k]=e[k]);return x.className=h,x.ref=n,l.createElement(l.Fragment,null,l.createElement(En,{cache:t,serialized:y,isStringTag:"string"==typeof g}),l.createElement(g,x))},(0,l.forwardRef)((function(e,t){var n=(0,l.useContext)(bn);return h(e,n,t)})));return b.displayName=void 0!==o?o:"Styled("+("string"==typeof i?i:i.displayName||i.name||"Component")+")",b.defaultProps=t.defaultProps,b.__emotion_real=b,b.__emotion_base=i,b.__emotion_styles=d,b.__emotion_forwardProp=s,Object.defineProperty(b,"toString",{value:function(){return"."+r}}),b.withComponent=function(t,o){return e(t,Qe({},n,o,{shouldForwardProp:wn(b,o,!0)})).apply(void 0,d)},b}}.bind();function Sn(e){return(t,n)=>{const o={...t};return"COMMIT"!==n.type&&"PRESS_UP"!==n.type&&"PRESS_DOWN"!==n.type||void 0!==o.value&&(o.value=o.value.toString().padStart(e,"0")),o}}["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Cn[e]=Cn(e)}));const Bn=Cn.div` text-decoration: underline dotted; -`,Mr=()=>{const{timezone:e}=(0,eo.getSettings)(),t=(new Date).getTimezoneOffset()/60*-1;if(Number(e.offset)===t)return null;const n=Number(e.offset)>=0?"+":"",o=""!==e.abbr&&isNaN(Number(e.abbr))?e.abbr:`UTC${n}${e.offset}`,a=e.string.replace("_"," "),s="UTC"===e.string?(0,r.__)("Coordinated Universal Time"):`(${o}) ${a}`;return 0===a.trim().length?(0,l.createElement)(Tr,{className:"components-datetime__timezone"},o):(0,l.createElement)(i.Tooltip,{placement:"top",text:s},(0,l.createElement)(Tr,{className:"components-datetime__timezone"},o))},zr=Br.span` +`,In=()=>{const{timezone:e}=(0,Xe.getSettings)(),t=(new Date).getTimezoneOffset()/60*-1;if(Number(e.offset)===t)return null;const n=Number(e.offset)>=0?"+":"",o=""!==e.abbr&&isNaN(Number(e.abbr))?e.abbr:`UTC${n}${e.offset}`,a=e.string.replace("_"," "),s="UTC"===e.string?(0,r.__)("Coordinated Universal Time"):`(${o}) ${a}`;return 0===a.trim().length?(0,l.createElement)(Bn,{className:"components-datetime__timezone"},o):(0,l.createElement)(i.Tooltip,{placement:"top",text:s},(0,l.createElement)(Bn,{className:"components-datetime__timezone"},o))},Tn=Cn.span` border-top: 1px solid #757575; border-bottom: 1px solid #757575; display: inline-flex; align-items: center; -`,Ar=Br(i.__experimentalNumberControl)` +`,Mn=Cn(i.__experimentalNumberControl)` width: 36px; &&& .components-input-control__input { @@ -26,7 +26,7 @@ border-top-right-radius: 0; border-bottom-right-radius: 0; } -`,Nr=Br(i.__experimentalNumberControl)` +`,zn=Cn(i.__experimentalNumberControl)` width: 36px; &&& .components-input-control__input { @@ -40,21 +40,21 @@ border-top-left-radius: 0; border-bottom-left-radius: 0; } -`,Pr=Br.div` +`,An=Cn.div` direction: ltr; display: flex; -`,Hr=({value:e,onChange:t,...n})=>{const{baseControlProps:o,controlProps:a}=(0,i.useBaseControlProps)(n),s=e?e.split(":"):["07","00"],[c,u]=(0,l.useState)(s[0]),[p,d]=(0,l.useState)(s[1]),m=(e,t="00")=>(e=Number(e),isNaN(e)?t:e<10?`0${e}`:e),g=`${m(c)}:${m(p)}`;return(0,l.useEffect)((()=>{e!==g&&t(g)}),[g]),(0,l.createElement)(i.BaseControl,{...o},(0,l.createElement)(i.__experimentalHStack,null,(0,l.createElement)(Pr,null,(0,l.createElement)(Ar,{value:m(c),onChange:u,min:0,max:23,step:1,...a,label:(0,r.__)("Hours"),spinControls:"none",isDragEnabled:!1,isShiftStepEnabled:!1,isPressEnterToChange:!0,hideLabelFromVision:!0,__next40pxDefaultSize:!0,__unstableStateReducer:Ir(2)}),(0,l.createElement)(zr,{"aria-hidden":"true"},":"),(0,l.createElement)(Nr,{value:m(p),onChange:d,min:0,max:59,step:1,label:(0,r.__)("Minutes"),spinControls:"none",isDragEnabled:!1,isShiftStepEnabled:!1,isPressEnterToChange:!0,hideLabelFromVision:!0,__next40pxDefaultSize:!0,__unstableStateReducer:Ir(2)})),(0,l.createElement)(Mr,null)))},Lr=[{label:(0,r.__)("Only run if","newsletter-optin-box"),value:"allow"},{label:(0,r.__)("Do not run if","newsletter-optin-box"),value:"prevent"}],Vr=[{label:(0,r.__)("all","newsletter-optin-box"),value:"all"},{label:(0,r.__)("any","newsletter-optin-box"),value:"any"}];function $r(e,t){return(0,l.useMemo)((()=>[{label:t,value:"",disabled:!0},...e]),[e,t])}function Rr({type:e,action:t,ruleCount:n,setConditionalLogicAttribute:o}){const a=n>1;return(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0},(0,l.createElement)(i.SelectControl,{label:(0,r.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"allow",options:Lr,onChange:e=>o("action",e),size:"default",__nextHasNoMarginBottom:!0}),a&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.SelectControl,{label:(0,r.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:e||"all",options:Vr,onChange:e=>o("type",e),size:"default",__nextHasNoMarginBottom:!0}),(0,l.createElement)(i.__experimentalText,null,(0,r.__)("of the following rules are true:","newsletter-optin-box"))))}function Dr({rule:e,comparisons:t,availableSmartTags:n,mergeTagsArray:o,index:a,updateRule:s,removeRule:c}){var u;const p=e=>s(a,{value:e}),d=null!==(u=e.full)&&void 0!==u?u:e.type?`[[${e.type}]]`:"",m=d.indexOf("]]"),g=d.indexOf("[[",m),h=-1===m||-1!==g&&g>m,b=e=>{const t={full:e};if(e){const n=e.match(/\[\[([^\s\]]+)/)?.[1]||"";n&&(t.type=n.replace("[[","").replace("]]",""))}s(a,t)},_=Jr({availableSmartTags:o,onMergeTagClick:e=>{b(d?`${d} ${e}`.trim():e)}}),f=Jr({availableSmartTags:o,onMergeTagClick:t=>{p(e.value?`${e.value} ${t}`.trim():t)}}),y=(0,l.useMemo)((()=>{const t=e.type;if(void 0!==n[t])return n[t];const o=t.replace("_",".",1);if(void 0!==n[o])return n[o];for(const[e,o]of Object.entries(n)){if(-1!==e.indexOf(".")&&e.split(".").slice(1).join(".")===t)return o;const n=e=>Array.isArray(e)?e:e.split(/[\s,]+/);if(o.deprecated&&n(o.deprecated).includes(t))return o}return null}),[e.type,n]),v=$r((x=y?.options,(0,l.useMemo)((()=>x?Array.isArray(x)?x.map(((e,t)=>({label:e,value:t}))):Object.keys(x).map((e=>({label:x[e],value:e}))):[]),[x])),(0,r.__)("Select a value","newsletter-optin-box"));var x;const k=!h&&v.length>1,w=h?"string":y?.conditional_logic||"string",E=$r((0,l.useMemo)((()=>{const e=[];return Object.keys(t).forEach((n=>{let o=t[n].type;if(k){if("string"===w&&"is"!=n&&"is_not"!=n)return;if("is_empty"===n||"is_not_empty"===n||"is_between"===n)return}"any"!==o&&o!=w||e.push({label:t[n].name,value:n})})),e}),[w,t]),(0,r.__)("Select a comparison","newsletter-optin-box")),C="is_empty"===e.condition||"is_not_empty"===e.condition;return(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0,expanded:!0},(0,l.createElement)("div",{style:{minWidth:320}},(0,l.createElement)(i.__experimentalInputControl,{type:"text",label:(0,r.__)("Smart Tag","newsletter-optin-box"),hideLabelFromVision:!0,placeholder:(0,r.__)("Enter a smart tag","newsletter-optin-box"),value:d,onChange:b,autoComplete:"off",suffix:_,__next40pxDefaultSize:!0})),(0,l.createElement)("div",{style:{width:150}},(0,l.createElement)(i.SelectControl,{label:(0,r.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:e.condition?e.condition:"is",options:E,onChange:e=>s(a,{condition:e}),size:"default",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})),!C&&(0,l.createElement)("div",{style:{minWidth:320}},k&&(0,l.createElement)(i.SelectControl,{label:(0,r.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:e.value?e.value:"",options:v,onChange:p,size:"default",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),!k&&(0,l.createElement)(i.__experimentalInputControl,{type:"number"===w?"number":"text",label:(0,r.__)("Value","newsletter-optin-box"),placeholder:(0,r.__)("Enter a value","newsletter-optin-box"),hideLabelFromVision:!0,value:e.value?e.value:"",onChange:p,suffix:f,__next40pxDefaultSize:!0})),(0,l.createElement)(i.Button,{onClick:()=>c(a),icon:"trash",variant:"tertiary",isDestructive:!0}))}function Or({rules:e,comparisons:t,availableSmartTags:n,setConditionalLogicAttribute:o,disableTags:a,disableProps:s,closeModal:c}){const u=(0,l.useMemo)((()=>Array.isArray(e)?e.filter((e=>e.type&&""!==e.type)):[]),[e]),p=(0,l.useMemo)((()=>{const e={};return n.forEach((t=>{t.conditional_logic&&(e[t.smart_tag]={...t,key:t.smart_tag,type:t.conditional_logic,isPremium:Array.isArray(a)&&a.some((e=>t.smart_tag.startsWith(e)))||Array.isArray(s)&&s.some((e=>!!t[e]))})})),e}),[n]),d=(0,l.useCallback)((e=>{const t=[...u];t.splice(e,1),o("rules",t)}),[u,o]),m=(0,l.useCallback)(((e,t)=>{const n=[...u];n[e]={...n[e],...t},o("rules",n)}),[u,o]),g=(0,l.useMemo)((()=>Object.values(p)),[p]),h=(0,l.useCallback)(((e,t)=>{const n=p[e],r=n?.options||[],l=n?.placeholder||"";let a=Array.isArray(r)&&r.length?Object.keys(r)[0]:l;n?.default&&(a=n.default);const i=[...u];i.push({type:e,condition:"is",full:t,value:a}),o("rules",i)}),[u]),b=0===u.length?(0,r.__)("Add a conditional logic rule","newsletter-optin-box"):(0,r.__)("Add another rule","newsletter-optin-box"),_=Jr({availableSmartTags:g,onMergeTagClick:h,raw:!0,icon:"plus",label:b,text:b,toggleProps:{variant:"primary"}});return(0,l.createElement)(l.Fragment,null,u.map(((e,n)=>(0,l.createElement)(Dr,{key:n,rule:e,index:n,updateRule:m,removeRule:d,comparisons:t,availableSmartTags:p,mergeTagsArray:g}))),(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0},_,c&&(0,l.createElement)(i.Button,{onClick:c,variant:"secondary"},(0,r.__)("Return to editor","newsletter-optin-box"))))}function jr({onChange:e,value:t,comparisons:n,toggleText:o,availableSmartTags:a,className:s,inModal:c=!1,...u}){const[p,d]=(0,l.useState)(!1),m=(0,l.useMemo)((()=>"object"!=typeof t?{enabled:!1,action:"allow",rules:[],type:"all"}:t),[t]),g=(0,l.useCallback)(((t,n)=>{e({...m,[t]:n})}),[e,m]),h=(0,l.createElement)(i.__experimentalVStack,{spacing:5},(0,l.createElement)(Rr,{ruleCount:Array.isArray(m.rules)?m.rules.length:0,type:m.type,action:m.action,setConditionalLogicAttribute:g}),(0,l.createElement)(Or,{rules:m.rules,comparisons:n,availableSmartTags:a,setConditionalLogicAttribute:g,closeModal:c&&(()=>d(!1)),...u}));return(0,l.createElement)(i.__experimentalVStack,{spacing:5,className:s},(0,l.createElement)(i.ToggleControl,{checked:!!m.enabled,onChange:e=>g("enabled",e),label:o||(0,r.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),m.enabled&&(0,l.createElement)(l.Fragment,null,c?(0,l.createElement)(l.Fragment,null,p&&(0,l.createElement)(i.Modal,{title:(0,r.__)("Conditional Logic","newsletter-optin-box"),onRequestClose:()=>d(!1),isFullScreen:!0},h),(0,l.createElement)(i.Button,{variant:"secondary",className:"noptin-block-button",onClick:()=>d(!0)},(0,r.__)("Edit Conditional Logic","newsletter-optin-box"))):(0,l.createElement)(l.Fragment,null,h)))}const Fr={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>ee<=t,includes:(e,t)=>e.includes(t),"!includes":(e,t)=>!e.includes(t),"^includes":(e,t)=>t.includes(e),"^!includes":(e,t)=>!t.includes(e),empty:(e,t)=>!t,"!empty":(e,t)=>t},Ur=(e,t,n)=>!!Fr[t]&&Fr[t](e,"boolean"==typeof e&&void 0===n?Boolean(n):n),Wr=["number","search","email","password","tel","url","date"];function Gr({setting:e,availableSmartTags:t,isPressEnterToChange:n,...o}){void 0===n&&(n=!0);const r=Jr({availableSmartTags:t,onMergeTagClick:(0,l.useCallback)((e=>{o.onChange&&o.onChange(o.value?`${o.value} ${e}`.trim():e)}),[o.value,o.onChange])});return"string"==typeof o.suffix||o.suffix instanceof String?o.suffix=(0,l.createElement)(i.__experimentalInputControlSuffixWrapper,null,o.suffix):e.disabled||!r||o.suffix||(o.suffix=r),"datetime-local"===e.type&&(o.suffix=(0,l.createElement)(i.__experimentalInputControlSuffixWrapper,null,(0,l.createElement)(i.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:e,onToggle:t})=>(0,l.createElement)(i.Button,{onClick:t,"aria-expanded":e,icon:Xn}),renderContent:()=>(0,l.createElement)(i.DateTimePicker,{currentDate:o.value,onChange:e=>{e&&(e=(0,eo.format)("c",e)),o.onChange(e||"")}})}))),e.disabled&&(o.readOnly=!0,o.onFocus=e=>e.target.select(),e.value&&(o.value=e.value)),("string"==typeof o.prefix||o.prefix instanceof String)&&(o.prefix=(0,l.createElement)(i.__experimentalInputControlPrefixWrapper,null,o.prefix)),(0,l.createElement)(i.__experimentalInputControl,{...o,type:Wr.includes(e.type)?e.type:"text",placeholder:e.placeholder?e.placeholder:"",isPressEnterToChange:n,__next40pxDefaultSize:!0})}function qr({value:e,onChange:t,...n}){const{baseControlProps:o,controlProps:r}=(0,i.useBaseControlProps)({...n});return(0,l.createElement)(i.BaseControl,{...o},(0,l.createElement)(i.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:t,onToggle:n})=>(0,l.createElement)(i.Button,{onClick:n,"aria-expanded":t},(0,l.createElement)(i.ColorIndicator,{colorValue:e})),renderContent:()=>(0,l.createElement)(i.ColorPicker,{color:e,onChange:t}),...r}))}function Zr({availableSmartTags:e,autoGrow:t=!1,label:n,id:o,setting:r,...a}){const s=Jr({availableSmartTags:e,onMergeTagClick:(0,l.useCallback)((e=>{a.onChange&&a.onChange(a.value?`${a.value} ${e}`.trim():e)}),[a.value,a.onChange]),toggleProps:{size:"small"}}),c=!r.disabled&&s?(0,l.createElement)(i.__experimentalHStack,null,(0,l.createElement)("span",null,n),s):n,u=o||(0,E.useInstanceId)(Zr,"noptin-textarea");return(0,l.useEffect)((()=>{if(t){const e=document.getElementById(u);e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)}}),[a.value,t,u]),r.disabled&&(a.readOnly=!0,a.onFocus=e=>e.target.select(),r.value&&(a.value=r.value)),(0,l.createElement)(i.TextareaControl,{...a,id:u,label:c,__nextHasNoMarginBottom:!0})}function Kr({options:e,...t}){return(0,l.createElement)(i.__experimentalToggleGroupControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,isBlock:!0,...t},e.map(((e,t)=>(0,l.createElement)(i.__experimentalToggleGroupControlOption,{key:t,...e}))))}function Yr({options:e,...t}){const[n,o]=(0,l.useState)(e);return(0,l.createElement)(i.ComboboxControl,{...t,options:n,onFilterValueChange:t=>{o(t?e.filter((e=>!e.disabled&&""!==e.value&&(e.search?e.search.toLowerCase():e.label.toLowerCase()).includes(t.toLowerCase()))):e)},__experimentalRenderItem:({item:e,...t})=>e.render?"string"==typeof e.render?(0,l.createElement)("div",{...t,dangerouslySetInnerHTML:{__html:e.render}}):e.render:e.label,autocomplete:"off"})}function Xr({options:e,value:t,onChange:n,...o}){const r=Array.isArray(t)?t:[],a=(0,l.useMemo)((()=>e.map((e=>e.label))),[e]),s=(0,l.useCallback)((e=>a.includes(e)),[a]),c=(0,l.useMemo)((()=>r.map((t=>{const n=e.find((e=>e.value===t));return n?n.label:t}))),[t,e]),u=(0,l.useCallback)((t=>{const o=new Set;for(const n of t){const t=e.find((e=>e.label===n));t&&o.add(t.value)}n(Array.from(o))}),[n,e]),p=(0,l.useCallback)((t=>{const n=e.find((e=>e.label===t.item));return n&&n.render?(0,l.createElement)(Le.RawHTML,null,n.render):(0,l.createElement)(l.Fragment,null,t.item)}),[e]);return(0,l.createElement)(i.FormTokenField,{value:c,suggestions:a,onChange:u,__experimentalShowHowTo:!1,__experimentalExpandOnFocus:!0,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalValidateInput:s,__experimentalRenderItem:p,...o})}const Qr=[{id:"key",label:(0,r.__)("Key","noptin-addons-pack"),type:"text"},{id:"value",label:(0,r.__)("Value","noptin-addons-pack"),type:"text"}];function Jr({availableSmartTags:e=[],onMergeTagClick:t=((e,t)=>{}),raw:n=!1,icon:o="shortcode",label:a=(0,r.__)("Insert merge tag","newsletter-optin-box"),...s}){const c=function(e){return(0,l.useMemo)((()=>{if(!Array.isArray(e))return{};const t={};return e.forEach((e=>{const n=e.group?e.group:(0,r.__)("General","newsletter-optin-box");Array.isArray(t[n])||(t[n]=[]),t[n].push(e)})),t}),[e])}(e),u=Object.keys(c).length;let p=null;return u>0&&(p=(0,l.createElement)(i.DropdownMenu,{icon:o,label:a,...s},(({onClose:e})=>(0,l.createElement)(l.Fragment,null,Object.keys(c).map(((o,r)=>(0,l.createElement)(i.MenuGroup,{label:u>1?o:void 0,key:r},c[o].map((o=>(0,l.createElement)(i.MenuItem,{icon:o.isPremium?Qn:o.icon||Jn,iconPosition:"left",disabled:o.isPremium,onClick:()=>{if(!o.isPremium){if(t){const e=n?o.smart_tag:`[[${el(o)}]]`;t(e,`[[${el(o)}]]`)}e()}},key:o.smart_tag},(0,l.createElement)(Le.RawHTML,null,o.isPremium?`${o.label} - Premium`:o.label))))))))))),p}function el(e){return e.example?e.example:e.default?`${e.smart_tag} default="${e.default}"`:`${e.smart_tag}`}function tl({availableSmartTags:e,value:t,onChange:n,button:o,fields:a,openModal:s,prepend:c,disable:u,disabled:p,onDisable:d,cardProps:m,repeaterKey:g,id:h,defaultItem:b,..._}){const[f,y]=(0,l.useState)(!1),v=Array.isArray(t)?t:[],x=h||(0,E.useInstanceId)(tl,"noptin-repeater"),{baseControlProps:k,controlProps:w}=(0,i.useBaseControlProps)({..._,id:x}),C=b||{};if(g?.newOnly&&(C.new=!0),!a)return console.warn("No fields provided to repeater control."),null;Object.keys(a).forEach((e=>{void 0!==a[e].default&&(C[e]=a[e].default)}));const S=!!s,B=(e,t)=>e.key?e.key:g?.to&&il(e,g.to)?il(e,g.to):t,I=(0,l.createElement)(i.__experimentalVStack,null,c,v.map(((t,o)=>(0,l.createElement)(i.Card,{size:"small",className:"noptin-no-shadow",id:`${x}__item-${B(t,o)}`,"data-index":o,borderBottom:!0,borderLeft:!0,borderRight:!0,borderTop:!0,...m||{},key:B(t,o)},(0,l.createElement)(nl,{id:`${x}__item-${B(t,o)}`,fields:a,value:t,availableSmartTags:e,onChange:e=>{let t={...e};if(g?.to&&g.from&&il(t,g.from)&&(!g.newOnly||t.new)){const e=il(t,g.from).toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");t=sl(t,g.to,e.substring(0,g.maxLength||64)),v.find(((e,n)=>o!==n&&il(e,g.to)===il(t,g.to)))&&(t=sl(t,g.to,`${il(t,g.to)}_${o}`))}const r=[...v];r[o]=t,n(r)},onDelete:()=>{const e=[...v];e.splice(o,1),n(e)},onMoveUp:o>0?()=>{const e=[...v],t=e[o];e.splice(o,1),e.splice(o-1,0,t),n(e)}:null,onMoveDown:o{const e=[...v],t=e[o];e.splice(o,1),e.splice(o+1,0,t),n(e)}:null,repeaterKey:g})))),(0,l.createElement)(i.__experimentalHStack,null,(0,l.createElement)(i.Button,{onClick:()=>{const e=[...v],t=Date.now().toString(36),o=Math.random().toString(36).substring(2,8);e.push({key:`${t}_${o}`,...C}),n(e)},variant:"primary"},o||(0,r.__)("Add Item","newsletter-optin-box")),S&&(0,l.createElement)(i.Button,{onClick:()=>y(!1),variant:"secondary"},(0,r.__)("Go Back","newsletter-optin-box")))),T=!u||!p;return(0,l.createElement)(i.BaseControl,{...k},(0,l.createElement)("div",{...w},S&&(0,l.createElement)(i.__experimentalVStack,null,u&&(0,l.createElement)(i.ToggleControl,{label:u,checked:p,onChange:e=>{d&&d(e)}}),T&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.Button,{onClick:()=>y(!0),variant:"secondary"},s||(0,r.__)("Set Items","newsletter-optin-box")),f&&(0,l.createElement)(i.Modal,{title:_.label||s||(0,r.__)("Set Items","newsletter-optin-box"),onRequestClose:()=>y(!1),size:"medium"},I))),!S&&I))}function nl({fields:e,availableSmartTags:t,value:n,onChange:o,repeaterKey:a,onDelete:s,onMoveUp:c,onMoveDown:u,id:p}){const[d,m]=(0,l.useState)(!a?.from),g=(0,l.useCallback)((()=>{m(!d)}),[d]),h=!d&&a?.from;let b=null;if(a){const e=!1!==a.display&&a.to&&n?.[a.to]?(0,l.createElement)("code",null,(0,r.sprintf)(a.display||"%s",n?.[a.to])):null,t={paddingLeft:16,paddingRight:16,height:48},o=il(n,a.from)||il(n,a.fallback);b=(0,l.createElement)(i.CardHeader,{style:{padding:0}},(0,l.createElement)(i.Flex,{as:i.Button,onClick:g,style:t,"aria-controls":`${p}__body`,"aria-expanded":!h,type:"button"},(0,l.createElement)(i.__experimentalHStack,{as:i.FlexBlock},(0,l.createElement)(i.__experimentalText,{weight:600},o||(0,r.__)("(new)","newsletter-optin-box"))),(0,l.createElement)(i.FlexItem,null,(0,l.createElement)(i.__experimentalHStack,null,e,(0,l.createElement)(i.Icon,{icon:d?"arrow-up-alt2":"arrow-down-alt2"})))))}return(0,l.createElement)(l.Fragment,null,b,!h&&(0,l.createElement)(i.CardBody,{id:`${p}__body`,hidden:h},(0,l.createElement)(i.__experimentalVStack,null,Object.keys(e).map((r=>(0,l.createElement)(cl,{key:r,settingKey:r,availableSmartTags:t,setting:e[r],saved:n,setAttributes:e=>{o({...n,...e})}}))),(0,l.createElement)(i.__experimentalHStack,{className:"noptin-repeater-item__actions",justify:"flex-start"},!n?.predefined&&(0,l.createElement)(i.Button,{variant:"link",onClick:s,text:(0,r.__)("Remove Item","newsletter-optin-box"),isDestructive:!0}),c&&(0,l.createElement)(i.Button,{onClick:c,icon:"arrow-up-alt",text:(0,r.__)("Move Up","newsletter-optin-box"),size:"small",iconSize:16}),u&&(0,l.createElement)(i.Button,{onClick:u,icon:"arrow-down-alt",text:(0,r.__)("Move Down","newsletter-optin-box"),size:"small",iconSize:16})))))}function ol({setting:e,availableSmartTags:t,value:n,onChange:o,...a}){const{baseControlProps:s,controlProps:c}=(0,i.useBaseControlProps)(a);Array.isArray(n)||(n=[]);const u=(0,l.useCallback)((({item:e,index:a})=>(0,l.createElement)(i.Flex,{className:"noptin-repeater-item",wrap:!0},Qr.map(((r,i)=>(0,l.createElement)(rl,{key:i,availableSmartTags:t,field:r,value:void 0===e[r.id]?"":e[r.id],onChange:e=>{const t=[...n];t[a][r.id]=e,o(t)}}))),(0,l.createElement)(i.FlexItem,null,(0,l.createElement)(i.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,r.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:()=>{const e=[...n];e.splice(a,1),o(e)},isDestructive:!0})))),[n,o]);return(0,l.createElement)(i.BaseControl,{...s},(0,l.createElement)("div",{...c},n.map(((e,t)=>(0,l.createElement)(u,{key:t,item:e,index:t}))),(0,l.createElement)(i.Button,{onClick:()=>{const e=[...n];e.push({}),o(e)},variant:"secondary"},e.add_field?e.add_field:(0,r.__)("Add","newsletter-optin-box"))))}function rl({field:e,availableSmartTags:t,value:n,onChange:o}){const a=Jr({availableSmartTags:t,onMergeTagClick:(0,l.useCallback)((e=>{o&&o(n?`${n} ${e}`.trim():e)}),[n,o])});return(0,l.createElement)(i.FlexBlock,null,(0,l.createElement)(i.__experimentalInputControl,{label:e.label,type:e.type,value:n,placeholder:(0,r.sprintf)((0,r.__)("Enter %s","noptin-addons-pack"),e.label),className:"noptin-component__field noptin-condition-field",suffix:a,onChange:o,isPressEnterToChange:!0,__next40pxDefaultSize:!0}))}function ll({setting:e,value:t,options:n,onChange:o,...r}){const{baseControlProps:a,controlProps:s}=(0,i.useBaseControlProps)(r);return Array.isArray(t)||(t=[]),(0,l.createElement)(i.BaseControl,{...a},(0,l.createElement)("div",{...s},n.map(((e,n)=>(0,l.createElement)(i.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:n=>{o(n?[...t,e.value]:t.filter((t=>t!==e.value)))}})))))}function al({value:e,onChange:t,id:n,...o}){const{baseControlProps:r,controlProps:a}=(0,i.useBaseControlProps)({...o,id:n,__nextHasNoMarginBottom:!0}),{wp:s,tinymce:c}=window,u=(0,l.useRef)(!1),p=(0,l.useRef)(null);return(0,l.useEffect)((()=>{if(!u.current)return;const t=t=>{t?.target?.classList?.contains("wp-switch-editor")&&setTimeout((()=>{const t=c?.get(n);t&&(t.setContent(e||""),t._lastChange=e)}),50)};return p.current?.addEventListener("click",t),()=>{p.current?.removeEventListener("click",t)}}),[p.current,e]),(0,l.useEffect)((()=>{if(!u.current)return;const e=c?.get(n);e&&e._lastChange}),[e]),(0,l.useEffect)((()=>{function o(){s.oldEditor.initialize(n,{tinymce:!!window.tinymce&&{content_css:!1,theme_advanced_buttons:"bold,italic,underline,|,bullist,numlist,blockquote,|,link,unlink,|,spellchecker,fullscreen,|,formatselect,styleselect",drag_drop_upload:!0,toolbar1:"formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,spellchecker,wp_adv,dfw",toolbar2:"strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help",min_height:400,wpautop:!1,setup(n){e&&n.on("loadContent",(()=>n.setContent(e))),n.on("blur",(()=>(t(n.getContent()),!1)));const o=(0,E.debounce)((()=>{const e=n.getContent();e!==n._lastChange&&(n._lastChange=e,t(e))}),250);n.on("Paste Change input Undo Redo",o),n.on("remove",o.cancel),n.on("keydown",(e=>{K.isKeyboardEvent.primary(e,"z")&&e.stopPropagation(),K.isKeyboardEvent.primary(e,"s")&&o.flush();const{altKey:t}=e;t&&e.keyCode===K.F10&&e.stopPropagation()})),u.current=!0},...window?.tinyMCEPreInit?.mceInit[n]||{}},mediaButtons:!0,quicktags:{buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,close"}})}function r(){"complete"===document.readyState&&o()}return c?.execCommand("mceRemoveEditor",!0,n),"complete"===document.readyState?o():document.addEventListener("readystatechange",r),()=>{document.removeEventListener("readystatechange",r),s.oldEditor.remove(n)}}),[]),(0,l.createElement)(i.BaseControl,{...r},(0,l.createElement)("div",{ref:p},(0,l.createElement)("textarea",{...a,className:"wp-editor-area",style:{width:"100%"},value:e,onChange:e=>t(e.target.value),rows:10})))}const il=(e,t)=>{if(!t||0===t.length)return;if("string"==typeof t&&(t=t.split(".")),0===t.length||!e||"object"!=typeof e)return;const[n,...o]=t;return 0===o.length?e[n]:il(e[n],o)},sl=(e,t,n)=>{if(!t||0===t.length)return e;"string"==typeof t&&(t=t.split("."));const[o,...r]=t;return 0===r.length?{...e,[o]:n}:{...e,[o]:sl(e[o]||{},r,n)}};function cl({settingKey:e,setting:t,availableSmartTags:n,prop:o,saved:a,setAttributes:s}){const c=(o?`${o}.${e}`:e).split("."),u=t.sanitize?t.sanitize:e=>e,p=(0,l.useCallback)((e=>{if(il(a,c)===e)return;const[t,...n]=c;return 0===n.length?s(u({[t]:e})):s(u({[t]:sl(a[t]||{},n,e)}))}),[a,c,s,u]);if(t.if||t.restrict){const e=t.restrict?t.restrict.split("."):t.if.split(".");if(!il(a,e))return null}if(Array.isArray(t.conditions)&&!t.conditions.every((e=>{const t=e.key.split("."),n=e.operator?e.operator:"==";return Ur(e.value,n,il(a,t))})))return null;if(t.condition&&!t.condition(a))return null;let d=il(a,c);(void 0===d||t.disabled)&&(d=t.default);const m=void 0!==d&&""!==d&&null!==d;let g=[];t.options&&(g=Array.isArray(t.options)?[...t.options]:Object.keys(t.options).map((e=>({label:t.options?.[e],value:e}))));const h=`noptin-component__field-${e}`,b="string"==typeof t.description?(0,l.createElement)("span",{dangerouslySetInnerHTML:{__html:t.description}}):t.description,_=t.customAttributes?t.customAttributes:{},f={label:t.label,value:m?d:"",onChange:p,className:h,help:b,..._};if(t.tooltip&&(f.label=(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)("span",null,t.label),(0,l.createElement)(i.Tooltip,{delay:0,placement:"top",text:t.tooltip},(0,l.createElement)("span",null,(0,l.createElement)(i.Icon,{icon:"info",style:{color:"#454545"}}))))),t.type&&!t.el&&(t.el=t.type,["toggle","switch","checkbox","checkbox_alt","text","number","email","tel","date","color","image"].includes(t.type)&&(t.el="input")),"button"===t.el)return(0,l.createElement)("div",null,(0,l.createElement)(i.Button,{...t.buttonProps||{}}));if("toggle_group"===t.el)return(0,l.createElement)(Kr,{...f,options:g});if("select"===t.el)return t.multiple?(0,l.createElement)(Xr,{...f,options:g}):(g.find((e=>""===e?.value))||g.unshift({label:t.placeholder?t.placeholder:(0,r.__)("Select an option","newsletter-optin-box"),value:"",disabled:!t.canSelectPlaceholder}),(0,l.createElement)(i.SelectControl,{...f,options:g,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}));if("combobox"===t.el)return g.unshift({label:t.placeholder?t.placeholder:(0,r.__)("Select an option","newsletter-optin-box"),value:"",disabled:!t.canSelectPlaceholder}),(0,l.createElement)(Yr,{...f,options:g,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0});if("form_token"===t.el||"token"===t.el)return(0,l.createElement)(i.FormTokenField,{...f,value:Array.isArray(f.value)?f.value:[],suggestions:Array.isArray(t.suggestions)?t.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalShowHowTo:!1,__experimentalExpandOnFocus:!0,tokenizeOnBlur:!0});if("multi_checkbox"===t.el||"multi_checkbox_alt"===t.el)return(0,l.createElement)(ll,{...f,options:g});if("conditional_logic"===t.el)return(0,l.createElement)(jr,{...f,availableSmartTags:n,comparisons:t.comparisons,toggleText:t.toggle_text,inModal:t.in_modal});if("time"===t.el)return(0,l.createElement)(Hr,{...f});if("color"===t.el||"input"===t.el&&"color"===t.type)return(0,l.createElement)(qr,{...f,__nextHasNoMarginBottom:!0});if("unit"===t.el)return(0,l.createElement)(i.__experimentalUnitControl,{labelPosition:"edge",__unstableInputWidth:"80px",__next40pxDefaultSize:!0,isPressEnterToChange:!0,...f});if("input"===t.el){if(t.type&&["toggle","switch","checkbox","checkbox_alt"].includes(t.type))return(0,l.createElement)(i.ToggleControl,{...f,checked:!!m&&d});if("number"===t.type){const e=e=>{if(e)return"string"==typeof e||e instanceof String?(0,l.createElement)(i.__experimentalInputControlSuffixWrapper,null,e):e},n=e=>{if(e)return"string"==typeof e||e instanceof String?(0,l.createElement)(i.__experimentalInputControlPrefixWrapper,null,e):e};return Array.isArray(f.suffix)?f.suffix=e(1===d||"1"===d?f.suffix[0]:f.suffix[1]):f.suffix=e(f.suffix),Array.isArray(f.prefix)?f.prefix=n(1===d||"1"===d?f.prefix[0]:f.prefix[1]):f.prefix=n(f.prefix),(0,l.createElement)(i.__experimentalNumberControl,{...f,placeholder:t.placeholder?t.placeholder:"",__next40pxDefaultSize:!0})}return"image"===t.type&&(f.suffix=(0,l.createElement)(i.Button,{onClick:()=>{var e=window.wp.media({title:(0,r.__)("Upload Image","newsletter-optin-box"),multiple:!1,library:{type:"image"}}).open().on("select",(t=>{let n=e.state().get("selection").first();p(n.toJSON().sizes.full.url)}))},icon:"upload",label:(0,r.__)("Upload Image","newsletter-optin-box"),showTooltip:!0})),(0,l.createElement)(Gr,{...f,setting:t,availableSmartTags:"trigger_settings"===o?[]:n,isPressEnterToChange:!t.isInputToChange})}return"textarea"===t.el?(0,l.createElement)(Zr,{...f,setting:t,placeholder:t.placeholder?t.placeholder:"",availableSmartTags:"trigger_settings"===o?[]:n}):"tinymce"===t.el?(0,l.createElement)(al,{...f}):"paragraph"===t.el?(0,l.createElement)("div",{className:h},(0,l.createElement)(i.Tip,null,t.raw?(0,l.createElement)(Le.RawHTML,null,t.content):t.content)):"hero"===t.el?(0,l.createElement)("div",{className:h},(0,l.createElement)("h3",null,t.content)):"key_value_repeater"===t.el||"webhook_key_value_repeater"===t.el?(0,l.createElement)(ol,{...f,setting:t,availableSmartTags:"trigger_settings"===o?[]:n}):"repeater"===t.el?(0,l.createElement)(tl,{...f,availableSmartTags:"trigger_settings"===o?[]:n}):(console.log(t),e)}const ul=[{label:(0,r.__)("Newest to oldest"),value:"date/desc"},{label:(0,r.__)("Oldest to newest"),value:"date/asc"},{ +`,Pn=({value:e,onChange:t,...n})=>{const{baseControlProps:o,controlProps:a}=(0,i.useBaseControlProps)(n),s=e?e.split(":"):["07","00"],[c,u]=(0,l.useState)(s[0]),[p,d]=(0,l.useState)(s[1]),m=(e,t="00")=>(e=Number(e),isNaN(e)?t:e<10?`0${e}`:e),g=`${m(c)}:${m(p)}`;return(0,l.useEffect)((()=>{e!==g&&t(g)}),[g]),(0,l.createElement)(i.BaseControl,{...o},(0,l.createElement)(i.__experimentalHStack,null,(0,l.createElement)(An,null,(0,l.createElement)(Mn,{value:m(c),onChange:u,min:0,max:23,step:1,...a,label:(0,r.__)("Hours"),spinControls:"none",isDragEnabled:!1,isShiftStepEnabled:!1,isPressEnterToChange:!0,hideLabelFromVision:!0,__next40pxDefaultSize:!0,__unstableStateReducer:Sn(2)}),(0,l.createElement)(Tn,{"aria-hidden":"true"},":"),(0,l.createElement)(zn,{value:m(p),onChange:d,min:0,max:59,step:1,label:(0,r.__)("Minutes"),spinControls:"none",isDragEnabled:!1,isShiftStepEnabled:!1,isPressEnterToChange:!0,hideLabelFromVision:!0,__next40pxDefaultSize:!0,__unstableStateReducer:Sn(2)})),(0,l.createElement)(In,null)))},Nn=[{label:(0,r.__)("Only run if","newsletter-optin-box"),value:"allow"},{label:(0,r.__)("Do not run if","newsletter-optin-box"),value:"prevent"}],Hn=[{label:(0,r.__)("all","newsletter-optin-box"),value:"all"},{label:(0,r.__)("any","newsletter-optin-box"),value:"any"}];function Ln(e,t){return(0,l.useMemo)((()=>[{label:t,value:"",disabled:!0},...e]),[e,t])}function Vn({type:e,action:t,ruleCount:n,setConditionalLogicAttribute:o}){const a=n>1;return(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0},(0,l.createElement)(i.SelectControl,{label:(0,r.__)("If","newsletter-optin-box"),hideLabelFromVision:!0,value:t||"allow",options:Nn,onChange:e=>o("action",e),size:"default",__nextHasNoMarginBottom:!0}),a&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.SelectControl,{label:(0,r.__)("all","newsletter-optin-box"),hideLabelFromVision:!0,value:e||"all",options:Hn,onChange:e=>o("type",e),size:"default",__nextHasNoMarginBottom:!0}),(0,l.createElement)(i.__experimentalText,null,(0,r.__)("of the following rules are true:","newsletter-optin-box"))))}function $n({rule:e,comparisons:t,availableSmartTags:n,mergeTagsArray:o,index:a,updateRule:s,removeRule:c}){var u;const p=e=>s(a,{value:e}),d=null!==(u=e.full)&&void 0!==u?u:e.type?`[[${e.type}]]`:"",m=d.indexOf("]]"),g=d.indexOf("[[",m),h=-1===m||-1!==g&&g>m,b=e=>{const t={full:e};if(e){const n=e.match(/\[\[([^\s\]]+)/)?.[1]||"";n&&(t.type=n.replace("[[","").replace("]]",""))}s(a,t)},_=Xn({availableSmartTags:o,onMergeTagClick:e=>{b(d?`${d} ${e}`.trim():e)}}),f=Xn({availableSmartTags:o,onMergeTagClick:t=>{p(e.value?`${e.value} ${t}`.trim():t)}}),y=(0,l.useMemo)((()=>{const t=e.type;if(void 0!==n[t])return n[t];const o=t.replace("_",".",1);if(void 0!==n[o])return n[o];for(const[e,o]of Object.entries(n)){if(-1!==e.indexOf(".")&&e.split(".").slice(1).join(".")===t)return o;const n=e=>Array.isArray(e)?e:e.split(/[\s,]+/);if(o.deprecated&&n(o.deprecated).includes(t))return o}return null}),[e.type,n]),v=Ln((x=y?.options,(0,l.useMemo)((()=>x?Array.isArray(x)?x.map(((e,t)=>({label:e,value:t}))):Object.keys(x).map((e=>({label:x[e],value:e}))):[]),[x])),(0,r.__)("Select a value","newsletter-optin-box"));var x;const k=!h&&v.length>1,w=h?"string":y?.conditional_logic||"string",E=Ln((0,l.useMemo)((()=>{const e=[];return Object.keys(t).forEach((n=>{let o=t[n].type;if(k){if("string"===w&&"is"!=n&&"is_not"!=n)return;if("is_empty"===n||"is_not_empty"===n||"is_between"===n)return}"any"!==o&&o!=w||e.push({label:t[n].name,value:n})})),e}),[w,t]),(0,r.__)("Select a comparison","newsletter-optin-box")),C="is_empty"===e.condition||"is_not_empty"===e.condition;return(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0,expanded:!0},(0,l.createElement)("div",{style:{minWidth:320}},(0,l.createElement)(i.__experimentalInputControl,{type:"text",label:(0,r.__)("Smart Tag","newsletter-optin-box"),hideLabelFromVision:!0,placeholder:(0,r.__)("Enter a smart tag","newsletter-optin-box"),value:d,onChange:b,autoComplete:"off",suffix:_,__next40pxDefaultSize:!0})),(0,l.createElement)("div",{style:{width:150}},(0,l.createElement)(i.SelectControl,{label:(0,r.__)("Comparison","newsletter-optin-box"),hideLabelFromVision:!0,value:e.condition?e.condition:"is",options:E,onChange:e=>s(a,{condition:e}),size:"default",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})),!C&&(0,l.createElement)("div",{style:{minWidth:320}},k&&(0,l.createElement)(i.SelectControl,{label:(0,r.__)("Value","newsletter-optin-box"),hideLabelFromVision:!0,value:e.value?e.value:"",options:v,onChange:p,size:"default",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),!k&&(0,l.createElement)(i.__experimentalInputControl,{type:"number"===w?"number":"text",label:(0,r.__)("Value","newsletter-optin-box"),placeholder:(0,r.__)("Enter a value","newsletter-optin-box"),hideLabelFromVision:!0,value:e.value?e.value:"",onChange:p,suffix:f,__next40pxDefaultSize:!0})),(0,l.createElement)(i.Button,{onClick:()=>c(a),icon:"trash",variant:"tertiary",isDestructive:!0}))}function Rn({rules:e,comparisons:t,availableSmartTags:n,setConditionalLogicAttribute:o,disableTags:a,disableProps:s,closeModal:c}){const u=(0,l.useMemo)((()=>Array.isArray(e)?e.filter((e=>e.type&&""!==e.type)):[]),[e]),p=(0,l.useMemo)((()=>{const e={};return n.forEach((t=>{t.conditional_logic&&(e[t.smart_tag]={...t,key:t.smart_tag,type:t.conditional_logic,isPremium:Array.isArray(a)&&a.some((e=>t.smart_tag.startsWith(e)))||Array.isArray(s)&&s.some((e=>!!t[e]))})})),e}),[n]),d=(0,l.useCallback)((e=>{const t=[...u];t.splice(e,1),o("rules",t)}),[u,o]),m=(0,l.useCallback)(((e,t)=>{const n=[...u];n[e]={...n[e],...t},o("rules",n)}),[u,o]),g=(0,l.useMemo)((()=>Object.values(p)),[p]),h=(0,l.useCallback)(((e,t)=>{const n=p[e],r=n?.options||[],l=n?.placeholder||"";let a=Array.isArray(r)&&r.length?Object.keys(r)[0]:l;n?.default&&(a=n.default);const i=[...u];i.push({type:e,condition:"is",full:t,value:a}),o("rules",i)}),[u]),b=0===u.length?(0,r.__)("Add a conditional logic rule","newsletter-optin-box"):(0,r.__)("Add another rule","newsletter-optin-box"),_=Xn({availableSmartTags:g,onMergeTagClick:h,raw:!0,icon:"plus",label:b,text:b,toggleProps:{variant:"primary"}});return(0,l.createElement)(l.Fragment,null,u.map(((e,n)=>(0,l.createElement)($n,{key:n,rule:e,index:n,updateRule:m,removeRule:d,comparisons:t,availableSmartTags:p,mergeTagsArray:g}))),(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start",wrap:!0},_,c&&(0,l.createElement)(i.Button,{onClick:c,variant:"secondary"},(0,r.__)("Return to editor","newsletter-optin-box"))))}function Dn({onChange:e,value:t,comparisons:n,toggleText:o,availableSmartTags:a,className:s,inModal:c=!1,...u}){const[p,d]=(0,l.useState)(!1),m=(0,l.useMemo)((()=>"object"!=typeof t?{enabled:!1,action:"allow",rules:[],type:"all"}:t),[t]),g=(0,l.useCallback)(((t,n)=>{e({...m,[t]:n})}),[e,m]),h=(0,l.createElement)(i.__experimentalVStack,{spacing:5},(0,l.createElement)(Vn,{ruleCount:Array.isArray(m.rules)?m.rules.length:0,type:m.type,action:m.action,setConditionalLogicAttribute:g}),(0,l.createElement)(Rn,{rules:m.rules,comparisons:n,availableSmartTags:a,setConditionalLogicAttribute:g,closeModal:c&&(()=>d(!1)),...u}));return(0,l.createElement)(i.__experimentalVStack,{spacing:5,className:s},(0,l.createElement)(i.ToggleControl,{checked:!!m.enabled,onChange:e=>g("enabled",e),label:o||(0,r.__)("Optionally enable/disable this trigger depending on specific conditions.","newsletter-optin-box"),__nextHasNoMarginBottom:!0}),m.enabled&&(0,l.createElement)(l.Fragment,null,c?(0,l.createElement)(l.Fragment,null,p&&(0,l.createElement)(i.Modal,{title:(0,r.__)("Conditional Logic","newsletter-optin-box"),onRequestClose:()=>d(!1),isFullScreen:!0},h),(0,l.createElement)(i.Button,{variant:"secondary",className:"noptin-block-button",onClick:()=>d(!0)},(0,r.__)("Edit Conditional Logic","newsletter-optin-box"))):(0,l.createElement)(l.Fragment,null,h)))}const On={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>ee<=t,includes:(e,t)=>e.includes(t),"!includes":(e,t)=>!e.includes(t),"^includes":(e,t)=>t.includes(e),"^!includes":(e,t)=>!t.includes(e),empty:(e,t)=>!t,"!empty":(e,t)=>t},jn=(e,t,n)=>!!On[t]&&On[t](e,"boolean"==typeof e&&void 0===n?Boolean(n):n),Fn=["number","search","email","password","tel","url","date"];function Un({setting:e,availableSmartTags:t,isPressEnterToChange:n,...o}){void 0===n&&(n=!0);const r=Xn({availableSmartTags:t,onMergeTagClick:(0,l.useCallback)((e=>{o.onChange&&o.onChange(o.value?`${o.value} ${e}`.trim():e)}),[o.value,o.onChange])});return"string"==typeof o.suffix||o.suffix instanceof String?o.suffix=(0,l.createElement)(i.__experimentalInputControlSuffixWrapper,null,o.suffix):e.disabled||!r||o.suffix||(o.suffix=r),"datetime-local"===e.type&&(o.suffix=(0,l.createElement)(i.__experimentalInputControlSuffixWrapper,null,(0,l.createElement)(i.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:e,onToggle:t})=>(0,l.createElement)(i.Button,{onClick:t,"aria-expanded":e,icon:Ze}),renderContent:()=>(0,l.createElement)(i.DateTimePicker,{currentDate:o.value,onChange:e=>{e&&(e=(0,Xe.format)("c",e)),o.onChange(e||"")}})}))),e.disabled&&(o.readOnly=!0,o.onFocus=e=>e.target.select(),e.value&&(o.value=e.value)),("string"==typeof o.prefix||o.prefix instanceof String)&&(o.prefix=(0,l.createElement)(i.__experimentalInputControlPrefixWrapper,null,o.prefix)),(0,l.createElement)(i.__experimentalInputControl,{...o,type:Fn.includes(e.type)?e.type:"text",placeholder:e.placeholder?e.placeholder:"",isPressEnterToChange:n,__next40pxDefaultSize:!0})}function Wn({value:e,onChange:t,...n}){const{baseControlProps:o,controlProps:r}=(0,i.useBaseControlProps)({...n});return(0,l.createElement)(i.BaseControl,{...o},(0,l.createElement)(i.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:t,onToggle:n})=>(0,l.createElement)(i.Button,{onClick:n,"aria-expanded":t},(0,l.createElement)(i.ColorIndicator,{colorValue:e})),renderContent:()=>(0,l.createElement)(i.ColorPicker,{color:e,onChange:t}),...r}))}function Gn({availableSmartTags:e,autoGrow:t=!1,label:n,id:o,setting:r,...a}){const s=Xn({availableSmartTags:e,onMergeTagClick:(0,l.useCallback)((e=>{a.onChange&&a.onChange(a.value?`${a.value} ${e}`.trim():e)}),[a.value,a.onChange]),toggleProps:{size:"small"}}),c=!r.disabled&&s?(0,l.createElement)(i.__experimentalHStack,null,(0,l.createElement)("span",null,n),s):n,u=o||(0,E.useInstanceId)(Gn,"noptin-textarea");return(0,l.useEffect)((()=>{if(t){const e=document.getElementById(u);e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)}}),[a.value,t,u]),r.disabled&&(a.readOnly=!0,a.onFocus=e=>e.target.select(),r.value&&(a.value=r.value)),(0,l.createElement)(i.TextareaControl,{...a,id:u,label:c,__nextHasNoMarginBottom:!0})}function qn({options:e,...t}){return(0,l.createElement)(i.__experimentalToggleGroupControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,isBlock:!0,...t},e.map(((e,t)=>(0,l.createElement)(i.__experimentalToggleGroupControlOption,{key:t,...e}))))}function Zn({options:e,...t}){const[n,o]=(0,l.useState)(e);return(0,l.createElement)(i.ComboboxControl,{...t,options:n,onFilterValueChange:t=>{o(t?e.filter((e=>!e.disabled&&""!==e.value&&(e.search?e.search.toLowerCase():e.label.toLowerCase()).includes(t.toLowerCase()))):e)},__experimentalRenderItem:({item:e,...t})=>e.render?"string"==typeof e.render?(0,l.createElement)("div",{...t,dangerouslySetInnerHTML:{__html:e.render}}):e.render:e.label,autocomplete:"off"})}function Kn({options:e,value:t,onChange:n,...o}){const r=Array.isArray(t)?t:[],a=(0,l.useMemo)((()=>e.map((e=>e.label))),[e]),s=(0,l.useCallback)((e=>a.includes(e)),[a]),c=(0,l.useMemo)((()=>r.map((t=>{const n=e.find((e=>e.value===t));return n?n.label:t}))),[t,e]),u=(0,l.useCallback)((t=>{const o=new Set;for(const n of t){const t=e.find((e=>e.label===n));t&&o.add(t.value)}n(Array.from(o))}),[n,e]),p=(0,l.useCallback)((t=>{const n=e.find((e=>e.label===t.item));return n&&n.render?(0,l.createElement)(Le.RawHTML,null,n.render):(0,l.createElement)(l.Fragment,null,t.item)}),[e]);return(0,l.createElement)(i.FormTokenField,{value:c,suggestions:a,onChange:u,__experimentalShowHowTo:!1,__experimentalExpandOnFocus:!0,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalValidateInput:s,__experimentalRenderItem:p,...o})}const Yn=[{id:"key",label:(0,r.__)("Key","noptin-addons-pack"),type:"text"},{id:"value",label:(0,r.__)("Value","noptin-addons-pack"),type:"text"}];function Xn({availableSmartTags:e=[],onMergeTagClick:t=((e,t)=>{}),raw:n=!1,icon:o="shortcode",label:a=(0,r.__)("Insert merge tag","newsletter-optin-box"),...s}){const c=function(e){return(0,l.useMemo)((()=>{if(!Array.isArray(e))return{};const t={};return e.forEach((e=>{const n=e.group?e.group:(0,r.__)("General","newsletter-optin-box");Array.isArray(t[n])||(t[n]=[]),t[n].push(e)})),t}),[e])}(e),u=Object.keys(c).length;let p=null;return u>0&&(p=(0,l.createElement)(i.DropdownMenu,{icon:o,label:a,...s},(({onClose:e})=>(0,l.createElement)(l.Fragment,null,Object.keys(c).map(((o,r)=>(0,l.createElement)(i.MenuGroup,{label:u>1?o:void 0,key:r},c[o].map((o=>(0,l.createElement)(i.MenuItem,{icon:o.isPremium?Ke:o.icon||Ye,iconPosition:"left",disabled:o.isPremium,onClick:()=>{if(!o.isPremium){if(t){const e=n?o.smart_tag:`[[${Qn(o)}]]`;t(e,`[[${Qn(o)}]]`)}e()}},key:o.smart_tag},(0,l.createElement)(Le.RawHTML,null,o.isPremium?`${o.label} - Premium`:o.label))))))))))),p}function Qn(e){return e.example?e.example:e.default?`${e.smart_tag} default="${e.default}"`:`${e.smart_tag}`}function Jn({availableSmartTags:e,value:t,onChange:n,button:o,fields:a,openModal:s,prepend:c,disable:u,disabled:p,onDisable:d,cardProps:m,repeaterKey:g,id:h,defaultItem:b,..._}){const[f,y]=(0,l.useState)(!1),v=Array.isArray(t)?t:[],x=h||(0,E.useInstanceId)(Jn,"noptin-repeater"),{baseControlProps:k,controlProps:w}=(0,i.useBaseControlProps)({..._,id:x}),C=b||{};if(g?.newOnly&&(C.new=!0),!a)return console.warn("No fields provided to repeater control."),null;Object.keys(a).forEach((e=>{void 0!==a[e].default&&(C[e]=a[e].default)}));const S=!!s,B=(e,t)=>e.key?e.key:g?.to&&lo(e,g.to)?lo(e,g.to):t,I=(0,l.createElement)(i.__experimentalVStack,null,c,v.map(((t,o)=>(0,l.createElement)(i.Card,{size:"small",className:"noptin-no-shadow",id:`${x}__item-${B(t,o)}`,"data-index":o,borderBottom:!0,borderLeft:!0,borderRight:!0,borderTop:!0,...m||{},key:B(t,o)},(0,l.createElement)(eo,{id:`${x}__item-${B(t,o)}`,fields:a,value:t,availableSmartTags:e,onChange:e=>{let t={...e};if(g?.to&&g.from&&lo(t,g.from)&&(!g.newOnly||t.new)){const e=lo(t,g.from).toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");t=ao(t,g.to,e.substring(0,g.maxLength||64)),v.find(((e,n)=>o!==n&&lo(e,g.to)===lo(t,g.to)))&&(t=ao(t,g.to,`${lo(t,g.to)}_${o}`))}const r=[...v];r[o]=t,n(r)},onDelete:()=>{const e=[...v];e.splice(o,1),n(e)},onMoveUp:o>0?()=>{const e=[...v],t=e[o];e.splice(o,1),e.splice(o-1,0,t),n(e)}:null,onMoveDown:o{const e=[...v],t=e[o];e.splice(o,1),e.splice(o+1,0,t),n(e)}:null,repeaterKey:g})))),(0,l.createElement)(i.__experimentalHStack,null,(0,l.createElement)(i.Button,{onClick:()=>{const e=[...v],t=Date.now().toString(36),o=Math.random().toString(36).substring(2,8);e.push({key:`${t}_${o}`,...C}),n(e)},variant:"primary"},o||(0,r.__)("Add Item","newsletter-optin-box")),S&&(0,l.createElement)(i.Button,{onClick:()=>y(!1),variant:"secondary"},(0,r.__)("Go Back","newsletter-optin-box")))),T=!u||!p;return(0,l.createElement)(i.BaseControl,{...k},(0,l.createElement)("div",{...w},S&&(0,l.createElement)(i.__experimentalVStack,null,u&&(0,l.createElement)(i.ToggleControl,{label:u,checked:p,onChange:e=>{d&&d(e)}}),T&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.Button,{onClick:()=>y(!0),variant:"secondary"},s||(0,r.__)("Set Items","newsletter-optin-box")),f&&(0,l.createElement)(i.Modal,{title:_.label||s||(0,r.__)("Set Items","newsletter-optin-box"),onRequestClose:()=>y(!1),size:"medium"},I))),!S&&I))}function eo({fields:e,availableSmartTags:t,value:n,onChange:o,repeaterKey:a,onDelete:s,onMoveUp:c,onMoveDown:u,id:p}){const[d,m]=(0,l.useState)(!a?.from),g=(0,l.useCallback)((()=>{m(!d)}),[d]),h=!d&&a?.from;let b=null;if(a){const e=!1!==a.display&&a.to&&n?.[a.to]?(0,l.createElement)("code",null,(0,r.sprintf)(a.display||"%s",n?.[a.to])):null,t={paddingLeft:16,paddingRight:16,height:48},o=lo(n,a.from)||lo(n,a.fallback);b=(0,l.createElement)(i.CardHeader,{style:{padding:0}},(0,l.createElement)(i.Flex,{as:i.Button,onClick:g,style:t,"aria-controls":`${p}__body`,"aria-expanded":!h,type:"button"},(0,l.createElement)(i.__experimentalHStack,{as:i.FlexBlock},(0,l.createElement)(i.__experimentalText,{weight:600},o||(0,r.__)("(new)","newsletter-optin-box"))),(0,l.createElement)(i.FlexItem,null,(0,l.createElement)(i.__experimentalHStack,null,e,(0,l.createElement)(i.Icon,{icon:d?"arrow-up-alt2":"arrow-down-alt2"})))))}return(0,l.createElement)(l.Fragment,null,b,!h&&(0,l.createElement)(i.CardBody,{id:`${p}__body`,hidden:h},(0,l.createElement)(i.__experimentalVStack,null,Object.keys(e).map((r=>(0,l.createElement)(io,{key:r,settingKey:r,availableSmartTags:t,setting:e[r],saved:n,setAttributes:e=>{o({...n,...e})}}))),(0,l.createElement)(i.__experimentalHStack,{className:"noptin-repeater-item__actions",justify:"flex-start"},!n?.predefined&&(0,l.createElement)(i.Button,{variant:"link",onClick:s,text:(0,r.__)("Remove Item","newsletter-optin-box"),isDestructive:!0}),c&&(0,l.createElement)(i.Button,{onClick:c,icon:"arrow-up-alt",text:(0,r.__)("Move Up","newsletter-optin-box"),size:"small",iconSize:16}),u&&(0,l.createElement)(i.Button,{onClick:u,icon:"arrow-down-alt",text:(0,r.__)("Move Down","newsletter-optin-box"),size:"small",iconSize:16})))))}function to({setting:e,availableSmartTags:t,value:n,onChange:o,...a}){const{baseControlProps:s,controlProps:c}=(0,i.useBaseControlProps)(a);Array.isArray(n)||(n=[]);const u=(0,l.useCallback)((({item:e,index:a})=>(0,l.createElement)(i.Flex,{className:"noptin-repeater-item",wrap:!0},Yn.map(((r,i)=>(0,l.createElement)(no,{key:i,availableSmartTags:t,field:r,value:void 0===e[r.id]?"":e[r.id],onChange:e=>{const t=[...n];t[a][r.id]=e,o(t)}}))),(0,l.createElement)(i.FlexItem,null,(0,l.createElement)(i.Button,{icon:"trash",variant:"tertiary",className:"noptin-component__field",label:(0,r.__)("Delete","noptin-addons-pack"),showTooltip:!0,onClick:()=>{const e=[...n];e.splice(a,1),o(e)},isDestructive:!0})))),[n,o]);return(0,l.createElement)(i.BaseControl,{...s},(0,l.createElement)("div",{...c},n.map(((e,t)=>(0,l.createElement)(u,{key:t,item:e,index:t}))),(0,l.createElement)(i.Button,{onClick:()=>{const e=[...n];e.push({}),o(e)},variant:"secondary"},e.add_field?e.add_field:(0,r.__)("Add","newsletter-optin-box"))))}function no({field:e,availableSmartTags:t,value:n,onChange:o}){const a=Xn({availableSmartTags:t,onMergeTagClick:(0,l.useCallback)((e=>{o&&o(n?`${n} ${e}`.trim():e)}),[n,o])});return(0,l.createElement)(i.FlexBlock,null,(0,l.createElement)(i.__experimentalInputControl,{label:e.label,type:e.type,value:n,placeholder:(0,r.sprintf)((0,r.__)("Enter %s","noptin-addons-pack"),e.label),className:"noptin-component__field noptin-condition-field",suffix:a,onChange:o,isPressEnterToChange:!0,__next40pxDefaultSize:!0}))}function oo({setting:e,value:t,options:n,onChange:o,...r}){const{baseControlProps:a,controlProps:s}=(0,i.useBaseControlProps)(r);return Array.isArray(t)||(t=[]),(0,l.createElement)(i.BaseControl,{...a},(0,l.createElement)("div",{...s},n.map(((e,n)=>(0,l.createElement)(i.CheckboxControl,{key:n,label:e.label,checked:t.includes(e.value),onChange:n=>{o(n?[...t,e.value]:t.filter((t=>t!==e.value)))}})))))}function ro({value:e,onChange:t,id:n,...o}){const{baseControlProps:r,controlProps:a}=(0,i.useBaseControlProps)({...o,id:n,__nextHasNoMarginBottom:!0}),{wp:s,tinymce:c}=window,u=(0,l.useRef)(!1),p=(0,l.useRef)(null);return(0,l.useEffect)((()=>{if(!u.current)return;const t=t=>{t?.target?.classList?.contains("wp-switch-editor")&&setTimeout((()=>{const t=c?.get(n);t&&(t.setContent(e||""),t._lastChange=e)}),50)};return p.current?.addEventListener("click",t),()=>{p.current?.removeEventListener("click",t)}}),[p.current,e]),(0,l.useEffect)((()=>{if(!u.current)return;const e=c?.get(n);e&&e._lastChange}),[e]),(0,l.useEffect)((()=>{function o(){s.oldEditor.initialize(n,{tinymce:!!window.tinymce&&{content_css:!1,theme_advanced_buttons:"bold,italic,underline,|,bullist,numlist,blockquote,|,link,unlink,|,spellchecker,fullscreen,|,formatselect,styleselect",drag_drop_upload:!0,toolbar1:"formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,spellchecker,wp_adv,dfw",toolbar2:"strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help",min_height:400,wpautop:!1,setup(n){e&&n.on("loadContent",(()=>n.setContent(e))),n.on("blur",(()=>(t(n.getContent()),!1)));const o=(0,E.debounce)((()=>{const e=n.getContent();e!==n._lastChange&&(n._lastChange=e,t(e))}),250);n.on("Paste Change input Undo Redo",o),n.on("remove",o.cancel),n.on("keydown",(e=>{K.isKeyboardEvent.primary(e,"z")&&e.stopPropagation(),K.isKeyboardEvent.primary(e,"s")&&o.flush();const{altKey:t}=e;t&&e.keyCode===K.F10&&e.stopPropagation()})),u.current=!0},...window?.tinyMCEPreInit?.mceInit[n]||{}},mediaButtons:!0,quicktags:{buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,close"}})}function r(){"complete"===document.readyState&&o()}return c?.execCommand("mceRemoveEditor",!0,n),"complete"===document.readyState?o():document.addEventListener("readystatechange",r),()=>{document.removeEventListener("readystatechange",r),s.oldEditor.remove(n)}}),[]),(0,l.createElement)(i.BaseControl,{...r},(0,l.createElement)("div",{ref:p},(0,l.createElement)("textarea",{...a,className:"wp-editor-area",style:{width:"100%"},value:e,onChange:e=>t(e.target.value),rows:10})))}const lo=(e,t)=>{if(!t||0===t.length)return;if("string"==typeof t&&(t=t.split(".")),0===t.length||!e||"object"!=typeof e)return;const[n,...o]=t;return 0===o.length?e[n]:lo(e[n],o)},ao=(e,t,n)=>{if(!t||0===t.length)return e;"string"==typeof t&&(t=t.split("."));const[o,...r]=t;return 0===r.length?{...e,[o]:n}:{...e,[o]:ao(e[o]||{},r,n)}};function io({settingKey:e,setting:t,availableSmartTags:n,prop:o,saved:a,setAttributes:s}){const c=(o?`${o}.${e}`:e).split("."),u=t.sanitize?t.sanitize:e=>e,p=(0,l.useCallback)((e=>{if(lo(a,c)===e)return;const[t,...n]=c;return 0===n.length?s(u({[t]:e})):s(u({[t]:ao(a[t]||{},n,e)}))}),[a,c,s,u]);if(t.if||t.restrict){const e=t.restrict?t.restrict.split("."):t.if.split(".");if(!lo(a,e))return null}if(Array.isArray(t.conditions)&&!t.conditions.every((e=>{const t=e.key.split("."),n=e.operator?e.operator:"==";return jn(e.value,n,lo(a,t))})))return null;if(t.condition&&!t.condition(a))return null;let d=lo(a,c);(void 0===d||t.disabled)&&(d=t.default);const m=void 0!==d&&""!==d&&null!==d;let g=[];t.options&&(g=Array.isArray(t.options)?[...t.options]:Object.keys(t.options).map((e=>({label:t.options?.[e],value:e}))));const h=`noptin-component__field-${e}`,b="string"==typeof t.description?(0,l.createElement)("span",{dangerouslySetInnerHTML:{__html:t.description}}):t.description,_=t.customAttributes?t.customAttributes:{},f={label:t.label,value:m?d:"",onChange:p,className:h,help:b,..._};if(t.tooltip&&(f.label=(0,l.createElement)(i.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)("span",null,t.label),(0,l.createElement)(i.Tooltip,{delay:0,placement:"top",text:t.tooltip},(0,l.createElement)("span",null,(0,l.createElement)(i.Icon,{icon:"info",style:{color:"#454545"}}))))),t.type&&!t.el&&(t.el=t.type,["toggle","switch","checkbox","checkbox_alt","text","number","email","tel","date","color","image"].includes(t.type)&&(t.el="input")),"button"===t.el)return(0,l.createElement)("div",null,(0,l.createElement)(i.Button,{...t.buttonProps||{}}));if("toggle_group"===t.el)return(0,l.createElement)(qn,{...f,options:g});if("select"===t.el)return t.multiple?(0,l.createElement)(Kn,{...f,options:g}):(g.find((e=>""===e?.value))||g.unshift({label:t.placeholder?t.placeholder:(0,r.__)("Select an option","newsletter-optin-box"),value:"",disabled:!t.canSelectPlaceholder}),(0,l.createElement)(i.SelectControl,{...f,options:g,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}));if("combobox"===t.el)return g.unshift({label:t.placeholder?t.placeholder:(0,r.__)("Select an option","newsletter-optin-box"),value:"",disabled:!t.canSelectPlaceholder}),(0,l.createElement)(Zn,{...f,options:g,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0});if("form_token"===t.el||"token"===t.el)return(0,l.createElement)(i.FormTokenField,{...f,value:Array.isArray(f.value)?f.value:[],suggestions:Array.isArray(t.suggestions)?t.suggestions:[],__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,__experimentalShowHowTo:!1,__experimentalExpandOnFocus:!0,tokenizeOnBlur:!0});if("multi_checkbox"===t.el||"multi_checkbox_alt"===t.el)return(0,l.createElement)(oo,{...f,options:g});if("conditional_logic"===t.el)return(0,l.createElement)(Dn,{...f,availableSmartTags:n,comparisons:t.comparisons,toggleText:t.toggle_text,inModal:t.in_modal});if("time"===t.el)return(0,l.createElement)(Pn,{...f});if("color"===t.el||"input"===t.el&&"color"===t.type)return(0,l.createElement)(Wn,{...f,__nextHasNoMarginBottom:!0});if("unit"===t.el)return(0,l.createElement)(i.__experimentalUnitControl,{labelPosition:"edge",__unstableInputWidth:"80px",__next40pxDefaultSize:!0,isPressEnterToChange:!0,...f});if("input"===t.el){if(t.type&&["toggle","switch","checkbox","checkbox_alt"].includes(t.type))return(0,l.createElement)(i.ToggleControl,{...f,checked:!!m&&d});if("number"===t.type){const e=e=>{if(e)return"string"==typeof e||e instanceof String?(0,l.createElement)(i.__experimentalInputControlSuffixWrapper,null,e):e},n=e=>{if(e)return"string"==typeof e||e instanceof String?(0,l.createElement)(i.__experimentalInputControlPrefixWrapper,null,e):e};return Array.isArray(f.suffix)?f.suffix=e(1===d||"1"===d?f.suffix[0]:f.suffix[1]):f.suffix=e(f.suffix),Array.isArray(f.prefix)?f.prefix=n(1===d||"1"===d?f.prefix[0]:f.prefix[1]):f.prefix=n(f.prefix),(0,l.createElement)(i.__experimentalNumberControl,{...f,placeholder:t.placeholder?t.placeholder:"",__next40pxDefaultSize:!0})}return"image"===t.type&&(f.suffix=(0,l.createElement)(i.Button,{onClick:()=>{var e=window.wp.media({title:(0,r.__)("Upload Image","newsletter-optin-box"),multiple:!1,library:{type:"image"}}).open().on("select",(t=>{let n=e.state().get("selection").first();p(n.toJSON().sizes.full.url)}))},icon:"upload",label:(0,r.__)("Upload Image","newsletter-optin-box"),showTooltip:!0})),(0,l.createElement)(Un,{...f,setting:t,availableSmartTags:"trigger_settings"===o?[]:n,isPressEnterToChange:!t.isInputToChange})}return"textarea"===t.el?(0,l.createElement)(Gn,{...f,setting:t,placeholder:t.placeholder?t.placeholder:"",availableSmartTags:"trigger_settings"===o?[]:n}):"tinymce"===t.el?(0,l.createElement)(ro,{...f}):"paragraph"===t.el?(0,l.createElement)("div",{className:h},(0,l.createElement)(i.Tip,null,t.raw?(0,l.createElement)(Le.RawHTML,null,t.content):t.content)):"hero"===t.el?(0,l.createElement)("div",{className:h},(0,l.createElement)("h3",null,t.content)):"key_value_repeater"===t.el||"webhook_key_value_repeater"===t.el?(0,l.createElement)(to,{...f,setting:t,availableSmartTags:"trigger_settings"===o?[]:n}):"repeater"===t.el?(0,l.createElement)(Jn,{...f,availableSmartTags:"trigger_settings"===o?[]:n}):(console.log(t),e)}const so={apiVersion:3,name:"noptin/social-link",title:(0,r.__)("Social Icon"),category:"content",parent:["noptin/social-links"],description:(0,r.__)("Display an icon linking to a social media profile or site."),attributes:{iconSize:{type:"string",default:"20px"},url:{type:"string"},img:{type:"string"},label:{type:"string"},rel:{type:"string",default:"noopener noreferrer"}},usesContext:["noptin/social-links/iconSize"],noptin:{border:!0,color:{background:!0}},supports:{reusable:!1,anchor:!1,html:!1}},co=window.noptinEmailSettingsMisc?.assets_url||"https://www.mailjet.com/images/theme/v1/icons/ico-social/",uo=[{name:"facebook",color:"#3b5998",title:"Facebook"},{name:"twitter",color:"#55acee",title:"Twitter"},{name:"google-plus",color:"#dc4e41",title:"Google Plus",icon:"google"},{name:"pinterest",color:"#bd081c",title:"Pinterest"},{name:"linkedin",color:"#0077b5",title:"linkedIn"},{name:"instagram",color:"#3f729b",title:"Instagram"},{name:"youtube",color:"#eb3323",title:"YouTube"},{name:"tumblr",color:"#344356",title:"Tumblr",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z"}))},{name:"github",color:"#000000",title:"GitHub",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"}))},{name:"xing",color:"#296366",title:"Xing"},{name:"vimeo",color:"#53B4E7",title:"Vimeo",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M22.396,7.164c-0.093,2.026-1.507,4.799-4.245,8.32C15.322,19.161,12.928,21,10.97,21c-1.214,0-2.24-1.119-3.079-3.359 c-0.56-2.053-1.119-4.106-1.68-6.159C5.588,9.243,4.921,8.122,4.206,8.122c-0.156,0-0.701,0.328-1.634,0.98L1.594,7.841 c1.027-0.902,2.04-1.805,3.037-2.708C6.001,3.95,7.03,3.327,7.715,3.264c1.619-0.156,2.616,0.951,2.99,3.321 c0.404,2.557,0.685,4.147,0.841,4.769c0.467,2.121,0.981,3.181,1.542,3.181c0.435,0,1.09-0.688,1.963-2.065 c0.871-1.376,1.338-2.422,1.401-3.142c0.125-1.187-0.343-1.782-1.401-1.782c-0.498,0-1.012,0.115-1.541,0.341 c1.023-3.35,2.977-4.977,5.862-4.884C21.511,3.066,22.52,4.453,22.396,7.164z"}))},{name:"medium",color:"#000000",title:"Medium",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M20.962,7.257l-5.457,8.867l-3.923-6.375l3.126-5.08c0.112-0.182,0.319-0.286,0.527-0.286c0.05,0,0.1,0.008,0.149,0.02 c0.039,0.01,0.078,0.023,0.114,0.041l5.43,2.715l0.006,0.003c0.004,0.002,0.007,0.006,0.011,0.008 C20.971,7.191,20.98,7.227,20.962,7.257z M9.86,8.592v5.783l5.14,2.57L9.86,8.592z M15.772,17.331l4.231,2.115 C20.554,19.721,21,19.529,21,19.016V8.835L15.772,17.331z M8.968,7.178L3.665,4.527C3.569,4.479,3.478,4.456,3.395,4.456 C3.163,4.456,3,4.636,3,4.938v11.45c0,0.306,0.224,0.669,0.498,0.806l4.671,2.335c0.12,0.06,0.234,0.088,0.337,0.088 c0.29,0,0.494-0.225,0.494-0.602V7.231C9,7.208,8.988,7.188,8.968,7.178z"}))},{name:"soundcloud",color:"#EF7F31",title:"SoundCloud",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M8.9,16.1L9,14L8.9,9.5c0-0.1,0-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1c-0.1,0-0.1,0-0.1,0.1c0,0-0.1,0.1-0.1,0.1L8.3,14l0.1,2.1 c0,0.1,0,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1C8.8,16.3,8.9,16.3,8.9,16.1z M11.4,15.9l0.1-1.8L11.4,9c0-0.1,0-0.2-0.1-0.2 c0,0-0.1,0-0.1,0s-0.1,0-0.1,0c-0.1,0-0.1,0.1-0.1,0.2l0,0.1l-0.1,5c0,0,0,0.7,0.1,2v0c0,0.1,0,0.1,0.1,0.1c0.1,0.1,0.1,0.1,0.2,0.1 c0.1,0,0.1,0,0.2-0.1c0.1,0,0.1-0.1,0.1-0.2L11.4,15.9z M2.4,12.9L2.5,14l-0.2,1.1c0,0.1,0,0.1-0.1,0.1c0,0-0.1,0-0.1-0.1L2.1,14 l0.1-1.1C2.2,12.9,2.3,12.9,2.4,12.9C2.3,12.9,2.4,12.9,2.4,12.9z M3.1,12.2L3.3,14l-0.2,1.8c0,0.1,0,0.1-0.1,0.1 c-0.1,0-0.1,0-0.1-0.1L2.8,14L3,12.2C3,12.2,3,12.2,3.1,12.2C3.1,12.2,3.1,12.2,3.1,12.2z M3.9,11.9L4.1,14l-0.2,2.1 c0,0.1,0,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L3.5,14l0.2-2.1c0-0.1,0-0.1,0.1-0.1C3.9,11.8,3.9,11.8,3.9,11.9z M4.7,11.9L4.9,14 l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L4.3,14l0.2-2.2c0-0.1,0-0.1,0.1-0.1C4.7,11.7,4.7,11.8,4.7,11.9z M5.6,12 l0.2,2l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c0,0-0.1,0-0.1,0c0,0,0-0.1,0-0.1L5.1,14l0.2-2c0,0,0-0.1,0-0.1s0.1,0,0.1,0 C5.5,11.9,5.5,11.9,5.6,12L5.6,12z M6.4,10.7L6.6,14l-0.2,2.1c0,0,0,0.1,0,0.1c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.2L5.9,14 l0.2-3.3c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0C6.4,10.7,6.4,10.7,6.4,10.7z M7.2,10l0.2,4.1l-0.2,2.1c0,0,0,0.1,0,0.1 c0,0-0.1,0-0.1,0c-0.1,0-0.2-0.1-0.2-0.2l-0.1-2.1L6.8,10c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0S7.2,9.9,7.2,10z M8,9.6L8.2,14 L8,16.1c0,0.1-0.1,0.2-0.2,0.2c-0.1,0-0.2-0.1-0.2-0.2L7.5,14l0.1-4.4c0-0.1,0-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1c0.1,0,0.1,0,0.1,0.1 C8,9.6,8,9.6,8,9.6z M11.4,16.1L11.4,16.1L11.4,16.1z M9.7,9.6L9.8,14l-0.1,2.1c0,0.1,0,0.1-0.1,0.2s-0.1,0.1-0.2,0.1 c-0.1,0-0.1,0-0.1-0.1s-0.1-0.1-0.1-0.2L9.2,14l0.1-4.4c0-0.1,0-0.1,0.1-0.2s0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S9.7,9.5,9.7,9.6 L9.7,9.6z M10.6,9.8l0.1,4.3l-0.1,2c0,0.1,0,0.1-0.1,0.2c0,0-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c0,0-0.1-0.1-0.1-0.2L10,14 l0.1-4.3c0-0.1,0-0.1,0.1-0.2c0,0,0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S10.6,9.7,10.6,9.8z M12.4,14l-0.1,2c0,0.1,0,0.1-0.1,0.2 c-0.1,0.1-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2l-0.1-1l-0.1-1l0.1-5.5v0c0-0.1,0-0.2,0.1-0.2 c0.1,0,0.1-0.1,0.2-0.1c0,0,0.1,0,0.1,0c0.1,0,0.1,0.1,0.1,0.2L12.4,14z M22.1,13.9c0,0.7-0.2,1.3-0.7,1.7c-0.5,0.5-1.1,0.7-1.7,0.7 h-6.8c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2V8.2c0-0.1,0.1-0.2,0.2-0.3c0.5-0.2,1-0.3,1.6-0.3c1.1,0,2.1,0.4,2.9,1.1 c0.8,0.8,1.3,1.7,1.4,2.8c0.3-0.1,0.6-0.2,1-0.2c0.7,0,1.3,0.2,1.7,0.7C21.8,12.6,22.1,13.2,22.1,13.9L22.1,13.9z"}))},{name:"dribbble",color:"#D95988",title:"Dribbble",icon:()=>(0,l.createElement)(ie.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,l.createElement)(ie.Path,{d:"M12,22C6.486,22,2,17.514,2,12S6.486,2,12,2c5.514,0,10,4.486,10,10S17.514,22,12,22z M20.434,13.369 c-0.292-0.092-2.644-0.794-5.32-0.365c1.117,3.07,1.572,5.57,1.659,6.09C18.689,17.798,20.053,15.745,20.434,13.369z M15.336,19.876c-0.127-0.749-0.623-3.361-1.822-6.477c-0.019,0.006-0.038,0.013-0.056,0.019c-4.818,1.679-6.547,5.02-6.701,5.334 c1.448,1.129,3.268,1.803,5.243,1.803C13.183,20.555,14.311,20.313,15.336,19.876z M5.654,17.724 c0.193-0.331,2.538-4.213,6.943-5.637c0.111-0.036,0.224-0.07,0.337-0.102c-0.214-0.485-0.448-0.971-0.692-1.45 c-4.266,1.277-8.405,1.223-8.778,1.216c-0.003,0.087-0.004,0.174-0.004,0.261C3.458,14.207,4.29,16.21,5.654,17.724z M3.639,10.264 c0.382,0.005,3.901,0.02,7.897-1.041c-1.415-2.516-2.942-4.631-3.167-4.94C5.979,5.41,4.193,7.613,3.639,10.264z M9.998,3.709 c0.236,0.316,1.787,2.429,3.187,5c3.037-1.138,4.323-2.867,4.477-3.085C16.154,4.286,14.17,3.471,12,3.471 C11.311,3.471,10.641,3.554,9.998,3.709z M18.612,6.612C18.432,6.855,17,8.69,13.842,9.979c0.199,0.407,0.389,0.821,0.567,1.237 c0.063,0.148,0.124,0.295,0.184,0.441c2.842-0.357,5.666,0.215,5.948,0.275C20.522,9.916,19.801,8.065,18.612,6.612z"}))}].map((({name:e,title:t,color:n,icon:o})=>{return{isDefault:"facebook"===e,name:e,title:t,attributes:(r=`${co}${e}.png`,l=t,a=n,{img:r,label:l,style:{noptin:{border:{radius:"50%"},color:{background:a}}}}),icon:o||e,isActive:(t,n)=>t.img&&t.img.includes(e)||t.label&&t.label.includes(e)||t.url&&t.url.includes(e)};var r,l,a})),{name:po}=so,mo={icon:"share",edit:({attributes:e,context:t,setAttributes:n,isSelected:o,clientId:a})=>{const{img:c,label:u,url:p,rel:d,iconSize:m}=e,[g,h]=(0,l.useState)(!0),[b,_]=(0,l.useState)(null),f=t["noptin/social-links/iconSize"];(0,l.useEffect)((()=>{m!==f&&n({iconSize:f})}),[f,m]),(0,l.useEffect)((()=>{o&&h(!0)}),[o]);const y=V(e),x=y?.style?.backgroundColor,k=(0,s.useBlockProps)({ref:_,style:{color:x,backgroundColor:x,boxSizing:"border-box",align:"center",borderCollapse:"separate",...v(e)}});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Settings"),panelId:a,resetAll:()=>{n({img:void 0,url:void 0,label:void 0})}},(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Image URL"),isShownByDefault:!0,hasValue:()=>!!c,panelId:a,onDeselect:()=>n({img:void 0})},(0,l.createElement)(io,{settingKey:"img",saved:e,setAttributes:n,setting:{el:"input",type:"text",label:(0,r.__)("Image URL"),description:(0,l.createElement)(i.ExternalLink,{href:"https://www.iconfinder.com/search/icons?price=free&category=social-media&q=social+media"},(0,r.__)("Enter the URL of the image to use as an icon."))}})),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Social URL"),isShownByDefault:!0,hasValue:()=>!!p,panelId:a,onDeselect:()=>n({url:void 0})},(0,l.createElement)(io,{settingKey:"url",saved:e,setAttributes:n,setting:{el:"input",type:"text",label:(0,r.__)("Social URL"),description:(0,r.__)("The URL to link to.")}})),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Social Network"),isShownByDefault:!0,hasValue:()=>!!u,panelId:a,onDeselect:()=>n({label:void 0})},(0,l.createElement)(io,{settingKey:"label",saved:e,setAttributes:n,setting:{el:"input",type:"text",label:(0,r.__)("Social Network"),description:(0,r.__)("The name of the social network.")}})))),(0,l.createElement)(s.InspectorControls,{group:"advanced"},(0,l.createElement)(i.__experimentalInputControl,{label:(0,r.__)("Link rel"),value:d||"",onChange:e=>n({rel:e}),__next40pxDefaultSize:!0})),o&&g&&(0,l.createElement)(i.Popover,{placement:"bottom",onClose:()=>{h(!1)},anchor:b,focusOnMount:!1,__unstableSlotName:"__unstable-block-tools-after",shift:!0},(0,l.createElement)(i.__experimentalInputControl,{label:(0,r.__)("Social URL"),help:(0,r.__)("The URL to link to."),className:"block-editor-link-control__field noptin-link-control-popover__field",value:e.url||"",onChange:e=>n({url:e})})),(0,l.createElement)("td",{...k,width:m},(0,l.createElement)("img",{src:c||"https://placehold.co/30x30@2x.png",alt:u,width:m,height:m})))},save:function({attributes:e}){const{url:t,img:n,label:o,rel:r,iconSize:a}=e,i=V(e),c=i?.style?.backgroundColor,u=s.useBlockProps.save({width:a,style:{color:c,backgroundColor:c,borderCollapse:"separate",...v(e)}});return(0,l.createElement)("td",{...u,width:a},(0,l.createElement)("a",{href:t,rel:r||void 0,style:{display:"inline-block",textDecoration:"none"}},(0,l.createElement)("img",{src:n||"https://placehold.co/30x30@2x.png",alt:o,width:a,height:a})))},variations:uo},go=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})}),ho=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM15.4697 14.9697L18.4393 12L15.4697 9.03033L16.5303 7.96967L20.0303 11.4697L20.5607 12L20.0303 12.5303L16.5303 16.0303L15.4697 14.9697Z"})}),bo=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-4-4.6l-4 4 4 4 1-1-3-3 3-3-1-1z"})}),_o=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})}),fo=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})}),yo=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M3.8 15.8h8.9v-1.5H3.8v1.5zm0-7h8.9V7.2H3.8v1.6zm14.7-2.1V10h1V5.3l-2.2.7.3 1 .9-.3zm1.2 6.1c-.5-.6-1.2-.5-1.7-.4-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5H20v-1h-.9c.3-.6.8-1.4.9-2.1 0-.3 0-.8-.3-1.1z"})}),vo=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM5 6.7V10h1V5.3L3.8 6l.4 1 .8-.3zm-.4 5.7c-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5h2.7v-1h-1c.3-.6.8-1.4.9-2.1.1-.3 0-.8-.2-1.1-.5-.6-1.3-.5-1.7-.4z"})}),xo=({setAttributes:e,reversed:t,start:n,type:o})=>(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,r.__)("List style"),options:[{label:(0,r.__)("Numbers"),value:"decimal"},{label:(0,r.__)("Uppercase letters"),value:"upper-alpha"},{label:(0,r.__)("Lowercase letters"),value:"lower-alpha"},{label:(0,r.__)("Uppercase Roman numerals"),value:"upper-roman"},{label:(0,r.__)("Lowercase Roman numerals"),value:"lower-roman"}],value:o,onChange:t=>e({type:t})}),(0,l.createElement)(i.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,r.__)("Start value"),type:"number",onChange:t=>{const n=parseInt(t,10);e({start:isNaN(n)?void 0:n})},value:Number.isInteger(n)?n.toString(10):"",step:"1"}),(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Reverse order"),checked:t||!1,onChange:t=>{e({reversed:t||void 0})}}))),ko={name:"noptin/list-item"},wo=[["noptin/list-item"]];function Eo({clientId:e}){const t=function(e){const{replaceBlocks:t,selectionChange:n}=(0,S.useDispatch)(s.store),{getBlockRootClientId:r,getBlockAttributes:a,getBlock:i}=(0,S.useSelect)(s.store);return(0,l.useCallback)((()=>{const l=r(e),s=a(l),c=(0,o.createBlock)("noptin/list-item",s),{innerBlocks:u}=i(e);t([l],[c,...u]),n(u[u.length-1].clientId)}),[e])}(e),n=(0,S.useSelect)((t=>{const{getBlockRootClientId:n,getBlockName:o}=t(s.store);return"noptin/list-item"===o(n(e))}),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?ho:bo,title:(0,r.__)("Outdent"),description:(0,r.__)("Outdent list item"),disabled:!n,onClick:t}))}const Co={apiVersion:3,name:"noptin/list",title:(0,r.__)("List"),category:"content",allowedBlocks:["noptin/list-item"],description:(0,r.__)("An organized collection of items displayed in a specific order."),keywords:["bullet list","ordered list","numbered list"],attributes:{ordered:{type:"boolean",default:!1,role:"content"},type:{type:"string"},start:{type:"number"},reversed:{type:"boolean"},placeholder:{type:"string"}},noptin:{typography:["fontFamily","fontSize","fontStyle","fontWeight","lineHeight","letterSpacing","textTransform","textDecoration"],border:!0,color:{text:!0,background:!0,link:!0}},supports:{anchor:!1,html:!1,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!1}},__unstablePasteTextInline:!0,__experimentalOnMerge:!0,__experimentalSlashInserter:!0},selectors:{border:".wp-block-noptin-list:not(.wp-block-noptin-list .wp-block-noptin-list)"}},So=window.wp.richText,Bo={A:"upper-alpha",a:"lower-alpha",I:"upper-roman",i:"lower-roman"};function Io({phrasingContentSchema:e}){const t={...e,ul:{},ol:{attributes:["type","start","reversed"]}};return["ul","ol"].forEach((e=>{t[e].children={li:{children:t}}})),t}function To(e){return e.flatMap((({name:e,attributes:t,innerBlocks:n=[]})=>"noptin/list-item"===e?[t.content,...To(n)]:To(n)))}const Mo={from:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph","core/heading"],transform:e=>{let t=[];if(e.length>1)t=e.map((({content:e})=>(0,o.createBlock)("noptin/list-item",{content:e})));else if(1===e.length){const n=(0,So.create)({html:e[0].content});t=(0,So.split)(n,"\n").map((e=>(0,o.createBlock)("noptin/list-item",{content:(0,So.toHTMLString)({value:e})})))}return(0,o.createBlock)("noptin/list",{anchor:e.anchor},t)}},{type:"raw",selector:"ol,ul",schema:e=>({ol:Io(e).ol,ul:Io(e).ul}),transform:function e(t){const n=t.getAttribute("type"),r={ordered:"OL"===t.tagName,anchor:""===t.id?void 0:t.id,start:t.getAttribute("start")?parseInt(t.getAttribute("start"),10):void 0,reversed:!!t.hasAttribute("reversed")||void 0,type:n&&Bo[n]?Bo[n]:void 0},l=Array.from(t.children).map((t=>{const n=Array.from(t.childNodes).filter((e=>e.nodeType!==e.TEXT_NODE||0!==e.textContent.trim().length));n.reverse();const[r,...l]=n;if("UL"!==r?.tagName&&"OL"!==r?.tagName)return(0,o.createBlock)("noptin/list-item",{content:t.innerHTML});const a=l.map((e=>e.nodeType===e.TEXT_NODE?e.textContent:e.outerHTML));a.reverse();const i={content:a.join("").trim()},s=[e(r)];return(0,o.createBlock)("noptin/list-item",i,s)}));return(0,o.createBlock)("noptin/list",r,l)}},...["*","-"].map((e=>({type:"prefix",prefix:e,transform:e=>(0,o.createBlock)("noptin/list",{},[(0,o.createBlock)("noptin/list-item",{content:e})])}))),...["1.","1)"].map((e=>({type:"prefix",prefix:e,transform:e=>(0,o.createBlock)("noptin/list",{ordered:!0},[(0,o.createBlock)("noptin/list-item",{content:e})])})))],to:[...["core/paragraph","core/heading"].map((e=>({type:"block",blocks:[e],transform:(t,n)=>To(n).map((t=>(0,o.createBlock)(e,{content:t})))})))]},zo=Mo,{name:Ao}=Co,Po={icon:go,example:{innerBlocks:[{name:"noptin/list-item",attributes:{content:"Alice."}},{name:"noptin/list-item",attributes:{content:"The White Rabbit."}},{name:"noptin/list-item",attributes:{content:"The Cheshire Cat."}},{name:"noptin/list-item",attributes:{content:"The Mad Hatter."}},{name:"noptin/list-item",attributes:{content:"The Queen of Hearts."}}]},transforms:zo,edit:function({attributes:e,setAttributes:t,clientId:n}){const{ordered:o,type:a,reversed:c,start:u}=e,p=V(e).style,d=_(e),m=d?.fontSize||16,g=(0,s.useBlockProps)({reversed:c,start:u,className:"noptin-block__margin-wrapper",style:{listStyleType:o&&"decimal"!==a?a:void 0,...v(e),...p,...p.backgroundColor?{padding:`${m.toString().match(/^\d+$/)?`${m}px`:m} 32px`}:{},...d,...Z(e)}}),h=(0,s.useInnerBlocksProps)(g,{defaultBlock:ko,directInsert:!0,template:wo,templateLock:!1,templateInsertUpdatesSelection:!0,__experimentalCaptureToolbars:!0}),b=(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?_o:fo,title:(0,r.__)("Unordered"),description:(0,r.__)("Convert to unordered list"),isActive:!1===o,onClick:()=>{t({ordered:!1})}}),(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?yo:vo,title:(0,r.__)("Ordered"),description:(0,r.__)("Convert to ordered list"),isActive:!0===o,onClick:()=>{t({ordered:!0})}}),(0,l.createElement)(Eo,{clientId:n})),f=o?"ol":"ul";return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(f,{...h}),b,o&&(0,l.createElement)(xo,{setAttributes:t,reversed:c,start:u,type:a}))},save:function({attributes:e}){const{ordered:t,type:n,reversed:o,start:r}=e,a=t?"ol":"ul",i=V(e).style,c=_(e),u=c?.fontSize||16;return(0,l.createElement)(a,{...s.useBlockProps.save({reversed:o,start:r,className:"noptin-block__margin-wrapper",style:{listStyleType:t&&"decimal"!==n?n:void 0,...v(e),...i,...i.backgroundColor?{padding:`${u.toString().match(/^\d+$/)?`${u}px`:u} 32px`}:{},...c,...Z.save(e)}})},(0,l.createElement)(s.InnerBlocks.Content,null))}},No=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M12 11v1.5h8V11h-8zm-6-1c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})}),Ho=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM20.0303 9.03033L17.0607 12L20.0303 14.9697L18.9697 16.0303L15.4697 12.5303L14.9393 12L15.4697 11.4697L18.9697 7.96967L20.0303 9.03033Z"})}),Lo=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-8-3.5l3 3-3 3 1 1 4-4-4-4-1 1z"})});function Vo(){const e=(0,S.useRegistry)(),{moveBlocksToPosition:t,removeBlock:n,insertBlock:r,updateBlockListSettings:l}=(0,S.useDispatch)(s.store),{getBlockRootClientId:a,getBlockName:i,getBlockOrder:c,getBlockIndex:u,getSelectedBlockClientIds:p,getBlock:d,getBlockListSettings:m}=(0,S.useSelect)(s.store);return(0,Le.useCallback)(((s=p())=>{if(Array.isArray(s)||(s=[s]),!s.length)return;const g=s[0];if("noptin/list-item"!==i(g))return;const h=function(e){const t=a(e),n=a(t);if(n&&"noptin/list-item"===i(n))return n}(g);if(!h)return;const b=a(g),_=s[s.length-1],f=c(b).slice(u(_)+1);return e.batch((()=>{if(f.length){let e=c(g)[0];if(!e){const t=(0,o.cloneBlock)(d(b),{},[]);e=t.clientId,r(t,0,g,!1),l(e,m(b))}t(f,b,e)}t(s,b,a(h),u(h)+1),c(b).length||n(b,!1)})),!0}),[])}function $o(e){const{replaceBlocks:t,selectionChange:n,multiSelect:r}=(0,S.useDispatch)(s.store),{getBlock:l,getPreviousBlockClientId:a,getSelectionStart:i,getSelectionEnd:c,hasMultiSelection:u,getMultiSelectedBlockClientIds:p}=(0,S.useSelect)(s.store);return(0,Le.useCallback)((()=>{const s=u(),d=s?p():[e],m=d.map((e=>(0,o.cloneBlock)(l(e)))),g=a(e),h=(0,o.cloneBlock)(l(g));h.innerBlocks?.length||(h.innerBlocks=[(0,o.createBlock)("noptin/list")]),h.innerBlocks[h.innerBlocks.length-1].innerBlocks.push(...m);const b=i(),_=c();return t([g,...d],[h]),s?r(m[0].clientId,m[m.length-1].clientId):n(m[0].clientId,_.attributeKey,_.clientId===b.clientId?b.offset:_.offset,_.offset),!0}),[e])}function Ro(e,t){const n=(0,S.useRegistry)(),{getPreviousBlockClientId:o,getNextBlockClientId:r,getBlockOrder:l,getBlockRootClientId:a,getBlockName:i}=(0,S.useSelect)(s.store),{mergeBlocks:c,moveBlocksToPosition:u}=(0,S.useDispatch)(s.store),p=Vo();function d(e){const t=l(e);return t.length?d(t[t.length-1]):e}function m(e){const t=a(e),n=a(t);if(n&&"noptin/list-item"===i(n))return n}function g(e){const t=r(e);if(t)return t;const n=m(e);return n?g(n):void 0}function h(e){const t=l(e);return t.length?l(t[0])[0]:g(e)}return r=>{function i(e,t){n.batch((()=>{const[n]=l(t);n&&(o(t)!==e||l(e).length?u(l(n),n,a(e)):u([n],t,e)),c(e,t)}))}if(r){const n=h(e);if(!n)return void t(r);m(n)?p(n):i(e,n)}else{const n=o(e);m(e)?p(e):n?i(d(n),e):t(r)}}}function Do({clientId:e}){const t=$o(e),n=Vo(),{canIndent:o,canOutdent:a}=(0,S.useSelect)((t=>{const{getBlockIndex:n,getBlockRootClientId:o,getBlockName:r}=t(s.store);return{canIndent:n(e)>0,canOutdent:"noptin/list-item"===r(o(o(e)))}}),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?ho:bo,title:(0,r.__)("Outdent"),description:(0,r.__)("Outdent list item"),disabled:!a,onClick:()=>n()}),(0,l.createElement)(i.ToolbarButton,{icon:(0,r.isRTL)()?Ho:Lo,title:(0,r.__)("Indent"),description:(0,r.__)("Indent list item"),disabled:!o,onClick:()=>t()}))}const Oo={apiVersion:3,name:"noptin/list-item",title:(0,r.__)("List item"),category:"content",parent:["noptin/list"],allowedBlocks:["noptin/list"],description:(0,r.__)("An individual item within a list."),attributes:{placeholder:{type:"string"},content:{type:"rich-text",source:"rich-text",selector:"li",role:"content"}},noptin:{typography:["fontFamily","fontSize","fontStyle","fontWeight","lineHeight","letterSpacing","textTransform","textDecoration"],border:!0,color:{text:!0,background:!0,link:!0}},supports:{anchor:!1,className:!1,splitting:!0,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}}},selectors:{root:".wp-block-noptin-list > li",border:".wp-block-noptin-list:not(.wp-block-noptin-list .wp-block-noptin-list) > li"}},jo={to:[{type:"block",blocks:["core/paragraph"],transform:(e,t=[])=>[(0,o.createBlock)("core/paragraph",e),...t.map((e=>(0,o.cloneBlock)(e)))]}]},Fo=jo,{name:Uo}=Oo,Wo={icon:No,edit:function({attributes:e,setAttributes:t,clientId:n,mergeBlocks:a}){const{placeholder:i,content:c}=e,u=(0,s.useBlockProps)({style:{...v(e),...V(e).style,..._(e),...Z(e)}}),p=(0,s.useInnerBlocksProps)(u,{renderAppender:!1,__unstableDisableDropZone:!0}),d=function(e){const{replaceBlocks:t,selectionChange:n}=(0,S.useDispatch)(s.store),{getBlock:r,getBlockRootClientId:l,getBlockIndex:a,getBlockName:i}=(0,S.useSelect)(s.store),c=(0,Le.useRef)(e);c.current=e;const u=Vo();return(0,E.useRefEffect)((e=>{function s(e){if(e.defaultPrevented||e.keyCode!==K.ENTER)return;const{content:s,clientId:p}=c.current;if(s.length)return;if(e.preventDefault(),"noptin/list-item"===i(l(l(c.current.clientId))))return void u();const d=r(l(p)),m=a(p),g=(0,o.cloneBlock)({...d,innerBlocks:d.innerBlocks.slice(0,m)}),h=(0,o.createBlock)((0,o.getDefaultBlockName)()),b=[...d.innerBlocks[m].innerBlocks[0]?.innerBlocks||[],...d.innerBlocks.slice(m+1)],_=b.length?[(0,o.cloneBlock)({...d,innerBlocks:b})]:[];t(d.clientId,[g,h,..._],1),n(h.clientId)}return e.addEventListener("keydown",s),()=>{e.removeEventListener("keydown",s)}}),[])}({content:c,clientId:n}),m=function(e){const{getSelectionStart:t,getSelectionEnd:n,getBlockIndex:o}=(0,S.useSelect)(s.store),r=$o(e),l=Vo();return(0,E.useRefEffect)((a=>{function i(a){const{keyCode:i,shiftKey:s,altKey:c,metaKey:u,ctrlKey:p}=a;if(a.defaultPrevented||i!==K.SPACE&&i!==K.TAB||c||u||p)return;const d=t(),m=n();0===d.offset&&0===m.offset&&(s?i===K.TAB&&l()&&a.preventDefault():0!==o(e)&&r()&&a.preventDefault())}return a.addEventListener("keydown",i),()=>{a.removeEventListener("keydown",i)}}),[e,r])}(n),g=Ro(n,a);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("li",{...p},(0,l.createElement)(s.RichText,{ref:(0,E.useMergeRefs)([d,m]),identifier:"content",tagName:"div",onChange:e=>t({content:e}),value:c,"aria-label":(0,r.__)("List text"),placeholder:i||(0,r.__)("List"),onMerge:g}),p.children),(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(Do,{clientId:n})))},save:function({attributes:e}){return(0,l.createElement)("li",{...s.useBlockProps.save({style:{...v(e),...V(e).style,..._(e),...Z.save(e)}})},(0,l.createElement)(s.RichText.Content,{value:e.content}),(0,l.createElement)(s.InnerBlocks.Content,null))},merge:(e,t)=>({...e,content:e.content+t.content}),transforms:Fo},Go={apiVersion:3,name:"core/html",title:(0,r.__)("Custom HTML"),category:"content",description:(0,r.__)("Add custom HTML code and preview it as you edit."),keywords:["code","raw"],attributes:{content:{type:"string",source:"raw"}},supports:{customClassName:!1,className:!1,html:!1,anchor:!1}},{name:qo}=Go,Zo={icon:"editor-code",example:{attributes:{content:""+(0,r.__)("Welcome to the wonderful world of blocks…")+""}},edit:function({attributes:e,setAttributes:t}){const[n,o]=(0,Le.useState)(!1),a=(0,Le.useContext)(i.Disabled.Context),c=(0,Le.useId)(),u=(0,s.useBlockProps)({className:"block-library-html__edit","aria-describedby":n?c:void 0});return(0,l.createElement)("div",{...u},(0,l.createElement)(s.BlockControls,null,(0,l.createElement)(i.ToolbarGroup,null,(0,l.createElement)(i.ToolbarButton,{className:"components-tab-button",isPressed:!n,onClick:function(){o(!1)}},"HTML"),(0,l.createElement)(i.ToolbarButton,{className:"components-tab-button",isPressed:n,onClick:function(){o(!0)}},(0,r.__)("Preview")))),n||a?(0,l.createElement)(Le.RawHTML,null,e.content):(0,l.createElement)(s.PlainText,{value:e.content,onChange:e=>t({content:e}),placeholder:(0,r.__)("Write HTML…"),"aria-label":(0,r.__)("HTML")}))},save:function({attributes:e}){return(0,l.createElement)(Le.RawHTML,null,e.content)}},Ko=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z"})}),Yo={apiVersion:3,name:"noptin/group",title:(0,r.__)("Section","newsletter-optin-box"),category:"design",description:(0,r.__)("Gather blocks in a layout container."),keywords:["container","wrapper","row","section"],attributes:{templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]},allowedBlocks:{type:"array"},style:{type:"object",default:{noptin:{align:"center",color:{background:"#ffffff"}}}},width:{type:"string",default:"600px"}},noptin:{typography:!0,border:!0,color:!0,align:!0},supports:{__experimentalOnEnter:!0,__experimentalOnMerge:!0,__experimentalSettings:!0,anchor:!1,html:!1,background:{__experimentalSkipSerialization:!0,backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0,__experimentalDefaultControls:{backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0}},spacing:{__experimentalSkipSerialization:!0,margin:["top","bottom"],padding:!0,__experimentalDefaultControls:{margin:!0,padding:!0}}}},Xo={from:[{type:"block",isMultiBlock:!0,blocks:["*"],__experimentalConvert(e){const t=e.map((e=>(0,o.createBlock)(e.name,e.attributes,e.innerBlocks)));return(0,o.createBlock)("noptin/group",{},t)}}]},Qo=Xo,{name:Jo}=Yo,er={icon:Ko,example:{attributes:{style:{color:{text:"#000000",background:"#ffffff"}}},innerBlocks:[{name:"core/paragraph",attributes:{customTextColor:"#cf2e2e",fontSize:"large",content:(0,r.__)("One.")}},{name:"core/paragraph",attributes:{customTextColor:"#ff6900",fontSize:"large",content:(0,r.__)("Two.")}},{name:"core/paragraph",attributes:{customTextColor:"#fcb900",fontSize:"large",content:(0,r.__)("Three.")}},{name:"core/paragraph",attributes:{customTextColor:"#00d084",fontSize:"large",content:(0,r.__)("Four.")}},{name:"core/paragraph",attributes:{customTextColor:"#0693e3",fontSize:"large",content:(0,r.__)("Five.")}},{name:"core/paragraph",attributes:{customTextColor:"#9b51e0",fontSize:"large",content:(0,r.__)("Six.")}}]},transforms:Qo,edit:({attributes:e,setAttributes:t})=>{const{width:n}=e,o=R(e),a=Z(e,!0),c={width:n,maxWidth:"100%",borderCollapse:"separate",...v(e),...V(e).style,...Pe(e).style},u=(0,s.useInnerBlocksProps)({style:_(e)},{templateLock:e.templateLock,allowedBlocks:e.allowedBlocks}),p=(0,i.__experimentalUseCustomUnits)({availableUnits:["%","px","em","rem","vw"]});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",min:10,value:n||"",onChange:e=>t({width:e}),units:p}))),(0,l.createElement)("div",{...(0,s.useBlockProps)({style:a.margin})},(0,l.createElement)("table",{width:n,align:o,cellPadding:0,cellSpacing:0,role:"presentation",style:c},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{className:"noptin-block-group__inner",style:a.padding,align:o},(0,l.createElement)("table",{border:0,cellPadding:0,cellSpacing:0,width:"100%"},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{...u}))))))))))},save:({attributes:e})=>{const{width:t}=e,n=Z.save(e,!0),o=Pe(e,t),r=R(e),a={width:t,maxWidth:"100%",borderCollapse:"separate",...v(e),...V(e).style,...o.style},i={..._(e),...o.vmlOpen?{backgroundColor:"transparent"}:V(e).style};return(0,l.createElement)("div",{...s.useBlockProps.save({style:n.margin})},o.vmlOpen&&(0,l.createElement)(Le.RawHTML,{children:o.vmlOpen}),(0,l.createElement)("table",{width:t,align:r,cellPadding:0,cellSpacing:0,role:"presentation",style:a},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{className:"noptin-block-group__inner",style:n.padding,align:r},(0,l.createElement)("table",{border:"0",cellPadding:"0",cellSpacing:"0",width:"100%"},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{style:i},(0,l.createElement)(s.InnerBlocks.Content,null))))))))),o.vmlClose&&(0,l.createElement)(Le.RawHTML,{children:o.vmlClose}))}},tr=e=>{const t=parseFloat(e);return Number.isFinite(t)?parseFloat(t.toFixed(2)):void 0};function nr(e,t){const{width:n=100/t}=e.attributes;return tr(n)}function or(e,t,n=e.length){const o=function(e,t=e.length){return e.reduce(((e,n)=>e+nr(n,t)),0)}(e,n);return Object.fromEntries(Object.entries(function(e,t=e.length){return e.reduce(((e,n)=>{const o=nr(n,t);return Object.assign(e,{[n.clientId]:o})}),{})}(e,n)).map((([e,n])=>[e,tr(t*n/o)])))}function rr(e,t){return e.map((e=>({...e,attributes:{...e.attributes,width:`${t[e.clientId]}%`}})))}const lr=["noptin/column"];function ar({attributes:e,setAttributes:t,clientId:n}){const{isStackedOnMobile:a,verticalAlignment:c,templateLock:u}=e,{replaceInnerBlocks:p}=(0,S.useDispatch)(s.store),{count:d,canInsertColumnBlock:m,minCount:g,innerBlocks:h}=(0,S.useSelect)((e=>{const{canInsertBlockType:t,canRemoveBlock:o,getBlocks:r,getBlockCount:l}=e(s.store),a=r(n),i=a.reduce(((e,t,n)=>(o(t.clientId)||e.push(n),e)),[]);return{count:l(n),canInsertColumnBlock:t("noptin/column",n),minCount:Math.max(...i)+1,innerBlocks:a}}),[n]),b=(0,s.useBlockProps)({className:k("noptin-columns noptin-columns__wrapper",{"noptin-is-stacked-on-mobile":a}),style:{..._(e),...v(e),...Z(e),...V(e).style}}),f=(0,s.useInnerBlocksProps)(b,{allowedBlocks:lr,orientation:"horizontal",renderAppender:!1,templateLock:u});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,null,(0,l.createElement)(s.BlockVerticalAlignmentToolbar,{onChange:e=>t({verticalAlignment:e}),value:c})),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,null,m&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,r.__)("Columns"),value:d,onChange:e=>((e,t)=>{let r=[...h];const l=h.every((e=>{const t=e.attributes.width;return Number.isFinite(t?.endsWith?.("%")?parseFloat(t):t)})),a=t>e;if(a&&l){const n=tr(100/t),l=or(h,100-n);r=[...rr(h,l),...Array.from({length:t-e}).map((()=>(0,o.createBlock)("noptin/column",{width:`${n}%`})))]}else if(a)r=[...h,...Array.from({length:t-e}).map((()=>(0,o.createBlock)("noptin/column")))];else if(tt({isStackedOnMobile:!a})}))),(0,l.createElement)("div",{...f}))}function ir({clientId:e,name:t,setAttributes:n}){const{blockType:a,defaultVariation:i,variations:c}=(0,S.useSelect)((e=>{const{getBlockVariations:n,getBlockType:r,getDefaultBlockVariation:l}=e(o.store);return{blockType:r(t),defaultVariation:l(t,"block"),variations:n(t,"block")}}),[t]),{replaceInnerBlocks:u}=(0,S.useDispatch)(s.store),p=(0,s.useBlockProps)();return(0,l.createElement)("div",{...p},(0,l.createElement)(s.__experimentalBlockVariationPicker,{icon:a?.icon?.src,label:a?.title,variations:c,instructions:(0,r.__)("Divide into columns. Select a layout:"),onSelect:(t=i)=>{t.attributes&&n(t.attributes),t.innerBlocks&&u(e,(0,o.createBlocksFromInnerBlocksTemplate)(t.innerBlocks),!0)},allowSkip:!0}))}const sr={apiVersion:3,name:"noptin/columns",title:(0,r.__)("Columns"),category:"design",description:(0,r.__)("Display content in multiple columns, with blocks added to each column."),attributes:{verticalAlignment:{type:"string",default:"top"},isStackedOnMobile:{type:"boolean",default:!0},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]}},providesContext:{"noptin/columns/verticalAlignment":"verticalAlignment","noptin/columns/isStackedOnMobile":"isStackedOnMobile"},noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,__experimentalExposeControlsToChildren:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,__experimentalDefaultControls:{margin:!0}}}};function cr(e,t=!1){return`\n ${t?"\x3c!--[if !true]>\x3c!--\x3e":"\x3c!--[if true]>"}\n ${e}\n ${t?"\x3c!--{const t=+(100/e.length).toFixed(2),n=e.map((({name:e,attributes:n,innerBlocks:o})=>["noptin/column",{width:`${t}%`},[[e,{...n},o]]]));return(0,o.createBlock)("noptin/columns",{},(0,o.createBlocksFromInnerBlocksTemplate)(n))},isMatch:({length:e},t)=>(1!==t.length||"noptin/columns"!==t[0].name)&&e&&e<=6}],ungroup:(e,t)=>t.flatMap((e=>e.innerBlocks))},{name:dr}=sr,mr={icon:"columns",variations:ur,edit:e=>{const{clientId:t}=e,n=(0,S.useSelect)((e=>e(s.store).getBlocks(t).length>0),[t])?ar:ir;return(0,l.createElement)(n,{...e})},save:function({attributes:e}){const{isStackedOnMobile:t}=e,n={..._(e),...v(e),...Z.save(e),...V(e).style},o=s.useBlockProps.save({className:k("noptin-columns noptin-columns__wrapper",{"noptin-is-stacked-on-mobile":t}),style:n}),r=cr(``),a=cr("
");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Le.RawHTML,{children:`${r}\x3c!--[if !true]>\x3c!--\x3e`}),(0,l.createElement)("div",{...o},(0,l.createElement)(Le.RawHTML,{children:"\x3c!--\x3c!--\x3e"})),(0,l.createElement)(Le.RawHTML,{children:`\x3c!--"center"===e?"middle":e||void 0,br={apiVersion:3,name:"noptin/column",title:(0,r.__)("Column"),category:"design",parent:["noptin/columns"],description:(0,r.__)("A single column within a columns block."),attributes:{verticalAlignment:{type:"string",default:"top"},isStackedOnMobile:{type:"boolean",default:!0},width:{type:"string"},allowedBlocks:{type:"array"},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]}},usesContext:["noptin/columns/verticalAlignment","noptin/columns/isStackedOnMobile"],noptin:{typography:!0,border:!0,color:!0},supports:{__experimentalOnEnter:!0,anchor:!1,reusable:!1,html:!1,background:{__experimentalSkipSerialization:!0,backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0,__experimentalDefaultControls:{backgroundImage:!0,backgroundSize:!0,backgroundRepeat:!0}},spacing:{__experimentalSkipSerialization:!0,padding:!0,margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}}},{name:_r}=br,fr={icon:gr,edit:function({attributes:{width:e,templateLock:t,verticalAlignment:n,isStackedOnMobile:o,allowedBlocks:a,...c},setAttributes:u,clientId:p,context:d}){const m=d["noptin/columns/verticalAlignment"];(0,l.useEffect)((()=>{n!==m&&u({verticalAlignment:m})}),[m,n]);const g=d["noptin/columns/isStackedOnMobile"];(0,l.useEffect)((()=>{o!==g&&u({isStackedOnMobile:g})}),[g,o]);const h=(0,i.__experimentalUseCustomUnits)({availableUnits:["%","px","em","rem","vw"]}),b=(0,S.useSelect)((e=>e(s.store).getBlockOrder(p).length>0),[p]),f={verticalAlign:hr(n)};if(e&&/\d/.test(e)){let t=Number.isFinite(e)?e+"%":e;if(!Number.isFinite(e)&&e?.endsWith("%")){const n=1e12;t=Math.round(Number.parseFloat(e)*n)/n+"%"}f.width=t}const y=(0,s.useBlockProps)({className:k("noptin-column",{"noptin-is-stacked-on-mobile":o}),style:f}),x={..._(c),...v(c),...Z(c),...V(c).style,...Pe(c).style};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:e||"",onChange:e=>{e=0>parseFloat(e)?"0":e,u({width:e})},units:h}))),(0,l.createElement)("div",{...y},(0,l.createElement)("div",{className:"noptin-column__inner",style:x},(0,l.createElement)(s.InnerBlocks,{templateLock:t,allowedBlocks:a,renderAppender:b?void 0:s.InnerBlocks.ButtonBlockAppender}))))},save:function({attributes:e}){const{width:t,verticalAlignment:n,isStackedOnMobile:o}=e,r={verticalAlign:hr(n)};if(t&&/\d/.test(t)){let e=Number.isFinite(t)?t+"%":t;if(!Number.isFinite(t)&&t?.endsWith("%")){const n=1e12;e=Math.round(Number.parseFloat(t)*n)/n+"%"}r.width=e}const a=Pe(e,t),i=s.useBlockProps.save({className:k("noptin-column",{"noptin-is-stacked-on-mobile":o}),style:r}),c=cr(``),u=cr(""),p={..._(e),...v(e),...Z.save(e),...V(e).style,...a.style};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Le.RawHTML,{children:`${c}\x3c!--[if !true]>\x3c!--\x3e`}),(0,l.createElement)("div",{...i},(0,l.createElement)(Le.RawHTML,{children:"\x3c!--\x3c!--\x3e"})),(0,l.createElement)(Le.RawHTML,{children:`\x3c!--(0,o.createBlock)("noptin/separator")},{type:"raw",selector:"hr",schema:{hr:{}}}]},{name:kr}=vr,wr={icon:yr,transforms:xr,edit:function({attributes:e,setAttributes:t}){const{width:n,height:o}=e,a=V(e),c=a?.style?.backgroundColor,u=(0,i.__experimentalUseCustomUnits)({availableUnits:["%","px","em","rem"]});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:n||"",onChange:e=>{e=0>parseFloat(e)?"0":e,t({width:e})},units:u}),(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Height"),labelPosition:"edge",__unstableInputWidth:"80px",value:o||"",onChange:e=>{e=e?0>parseFloat(e)?"0":e:"1em",t({height:e})},units:u}))),(0,l.createElement)("hr",{...(0,s.useBlockProps)({style:{color:c,backgroundColor:c,borderWidth:0,height:o||"1em",width:n||"100%",maxWidth:"100%",...Z(e)},align:R(e)})}))},save:function({attributes:e}){const{width:t,height:n}=e,o=V(e),r=o?.style?.backgroundColor;return(0,l.createElement)("hr",{...s.useBlockProps.save({style:{color:r,backgroundColor:r,borderWidth:0,height:n||"1em",width:t||"100%",maxWidth:"100%",...Z.save(e)},align:R(e)})})}},Er=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M7 18h4.5v1.5h-7v-7H6V17L17 6h-4.5V4.5h7v7H18V7L7 18Z"})}),Cr={apiVersion:3,name:"noptin/spacer",title:(0,r.__)("Spacer"),category:"design",description:(0,r.__)("Add a blank space between blocks and customize its height."),attributes:{height:{type:"string",default:"100px"}},noptin:{color:{background:!0}},supports:{anchor:!1,spacing:{__experimentalSkipSerialization:!0,margin:["top","bottom"],__experimentalDefaultControls:{margin:!0}}}},{name:Sr}=Cr,Br={icon:Er,edit:({attributes:e,isSelected:t,setAttributes:n})=>{const{height:o}=e,a=V(e),c=a?.style?.backgroundColor,u={backgroundColor:c||(t?"#95a5a6":void 0),height:o,...Z(e)},p=(0,i.__experimentalUseCustomUnits)({availableUnits:["px","em","rem"],defaultValues:{px:100,em:10,rem:10}});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{...(0,s.useBlockProps)({style:u})}," "),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.__experimentalUnitControl,{label:(0,r.__)("Height"),labelPosition:"edge",__unstableInputWidth:"80px",value:o||"",onChange:e=>{e=e?0>parseFloat(e)?"0px":e:"0px",n({height:e})},units:p,min:0}))))},save:function({attributes:e}){const{height:t}=e,n=V(e),o=n?.style?.backgroundColor;return(0,l.createElement)("div",{...s.useBlockProps.save({style:{color:o,backgroundColor:o,height:t||"100px",lineHeight:t||"100px",...Z.save(e)}})}," ")}},Ir=window.wp.dom,Tr=(0,S.withDispatch)(((e,{clientId:t,attributes:n})=>{const{replaceBlock:r}=e(s.store);return{convertToHTML(){r(t,(0,o.createBlock)("core/html",{content:n.originalUndelimitedContent}))}}}))((function({attributes:e,convertToHTML:t,clientId:n}){const{originalName:o,originalUndelimitedContent:a}=e,c=!!a,{hasHTMLBlock:u}=(0,S.useSelect)((e=>{const{canInsertBlockType:t,getBlockRootClientId:o}=e(s.store);return{hasHTMLBlock:t("core/html",o(n))}}),[n]),p=[];let d;const m=(0,l.createElement)(i.Button,{key:"convert",onClick:t,variant:"primary"},(0,r.__)("Keep as HTML"));return c&&u?(d=(0,r.sprintf)('Your site doesn\'t include support for the "%s" block. You can leave this block intact, convert its content to a RAW block, or remove it entirely.',o),p.push(m)):d=(0,r.sprintf)('Your site doesn’t include support for the "%s" block. You can leave this block intact or remove it entirely.',o),(0,l.createElement)("div",{...(0,s.useBlockProps)({className:"has-warning"})},(0,l.createElement)(s.Warning,{actions:p},d),(0,l.createElement)(Le.RawHTML,null,(0,Ir.safeHTML)(a)))})),Mr={apiVersion:3,name:"core/missing",title:(0,r.__)("Unsupported"),category:"content",description:(0,r.__)("Your site doesn’t include support for this block."),attributes:{originalName:{type:"string"},originalUndelimitedContent:{type:"string"},originalContent:{type:"string",source:"raw"}},supports:{className:!1,customClassName:!1,inserter:!1,html:!1,reusable:!1,anchor:!1}},{name:zr}=Mr,Ar={name:zr,edit:Tr,save:function({attributes:e}){return(0,l.createElement)(Le.RawHTML,null,e.originalContent)}},Pr={apiVersion:3,name:"noptin/shortcode",title:(0,r.__)("Merge Tag","newsletter-optin-box"),category:"dynamic",description:(0,r.__)("Insert additional custom elements with a WordPress shortcode or Noptin Merge tag.","newsletter-optin-box"),keywords:["merge tag","smart tag","shortcode","noptin"],attributes:{text:{type:"string",source:"raw"}},supports:{customClassName:!1,className:!1,html:!1,anchor:!1}},Nr=window.wp.autop,Hr={from:[{type:"shortcode",tag:"[a-z][a-z0-9_.-]*",attributes:{text:{type:"string",shortcode:(e,{content:t})=>(0,Nr.removep)((0,Nr.autop)(t))}},priority:20}]},{name:Lr}=Pr,Vr={icon:"shortcode",transforms:Hr,edit:function({attributes:e,setAttributes:t}){const n=`blocks-shortcode-input-${(0,l.useId)()}`;return(0,l.createElement)("div",{...(0,s.useBlockProps)({className:"components-placeholder"})},(0,l.createElement)("label",{htmlFor:n,className:"components-placeholder__label"},(0,l.createElement)(i.Icon,{icon:"shortcode"}),(0,r.__)("Merge tag / Shortcode","newsletter-optin-box")),(0,l.createElement)(s.PlainText,{className:"blocks-shortcode__textarea",id:n,value:e.text,"aria-label":(0,r.__)("Shortcode text"),placeholder:(0,r.__)("Write merge tag or shortcode here…"),onChange:e=>t({text:e})}))},save:function({attributes:e}){return(0,l.createElement)(Le.RawHTML,null,e.text)}},$r=(0,se.jsx)(ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,se.jsx)(ie.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"})}),Rr=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z"})}),Dr=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z"})}),Or=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z"})}),jr=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M6.656 6.464h2.88v2.88h1.408v-2.88h2.88V5.12h-2.88V2.24H9.536v2.88h-2.88zM0 17.92V0h20.48v17.92H0zm7.68-2.56h5.12v-3.84H7.68v3.84zm-6.4 0H6.4v-3.84H1.28v3.84zM19.2 1.28H1.28v9.024H19.2V1.28zm0 10.24h-5.12v3.84h5.12v-3.84zM6.656 6.464h2.88v2.88h1.408v-2.88h2.88V5.12h-2.88V2.24H9.536v2.88h-2.88zM0 17.92V0h20.48v17.92H0zm7.68-2.56h5.12v-3.84H7.68v3.84zm-6.4 0H6.4v-3.84H1.28v3.84zM19.2 1.28H1.28v9.024H19.2V1.28zm0 10.24h-5.12v3.84h5.12v-3.84z"})}),Fr=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M13.824 10.176h-2.88v-2.88H9.536v2.88h-2.88v1.344h2.88v2.88h1.408v-2.88h2.88zM0 17.92V0h20.48v17.92H0zM6.4 1.28H1.28v3.84H6.4V1.28zm6.4 0H7.68v3.84h5.12V1.28zm6.4 0h-5.12v3.84h5.12V1.28zm0 5.056H1.28v9.024H19.2V6.336z"})}),Ur=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M17.728 11.456L14.592 8.32l3.2-3.2-1.536-1.536-3.2 3.2L9.92 3.648 8.384 5.12l3.2 3.2-3.264 3.264 1.536 1.536 3.264-3.264 3.136 3.136 1.472-1.536zM0 17.92V0h20.48v17.92H0zm19.2-6.4h-.448l-1.28-1.28H19.2V6.4h-1.792l1.28-1.28h.512V1.28H1.28v3.84h6.208l1.28 1.28H1.28v3.84h7.424l-1.28 1.28H1.28v3.84H19.2v-3.84z"})}),Wr=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M6.4 3.776v3.648H2.752v1.792H6.4v3.648h1.728V9.216h3.712V7.424H8.128V3.776zM0 17.92V0h20.48v17.92H0zM12.8 1.28H1.28v14.08H12.8V1.28zm6.4 0h-5.12v3.84h5.12V1.28zm0 5.12h-5.12v3.84h5.12V6.4zm0 5.12h-5.12v3.84h5.12v-3.84z"})}),Gr=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M14.08 12.864V9.216h3.648V7.424H14.08V3.776h-1.728v3.648H8.64v1.792h3.712v3.648zM0 17.92V0h20.48v17.92H0zM6.4 1.28H1.28v3.84H6.4V1.28zm0 5.12H1.28v3.84H6.4V6.4zm0 5.12H1.28v3.84H6.4v-3.84zM19.2 1.28H7.68v14.08H19.2V1.28z"})}),qr=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,se.jsx)(ie.Path,{d:"M6.4 9.98L7.68 8.7v-.256L6.4 7.164V9.98zm6.4-1.532l1.28-1.28V9.92L12.8 8.64v-.192zm7.68 9.472V0H0v17.92h20.48zm-1.28-2.56h-5.12v-1.024l-.256.256-1.024-1.024v1.792H7.68v-1.792l-1.024 1.024-.256-.256v1.024H1.28V1.28H6.4v2.368l.704-.704.576.576V1.216h5.12V3.52l.96-.96.32.32V1.216h5.12V15.36zm-5.76-2.112l-3.136-3.136-3.264 3.264-1.536-1.536 3.264-3.264L5.632 5.44l1.536-1.536 3.136 3.136 3.2-3.2 1.536 1.536-3.2 3.2 3.136 3.136-1.536 1.536z"})}),Zr=(0,se.jsx)(ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,se.jsx)(ie.Path,{d:"M4 6v11.5h16V6H4zm1.5 1.5h6V11h-6V7.5zm0 8.5v-3.5h6V16h-6zm13 0H13v-3.5h5.5V16zM13 11V7.5h5.5V11H13z"})}),Kr=["align"];function Yr(e,t,n){if(!t)return e;const o=Object.fromEntries(Object.entries(e).filter((([e])=>["head","body","foot"].includes(e)))),{sectionName:r,rowIndex:l}=t;return Object.fromEntries(Object.entries(o).map((([e,o])=>r&&r!==e?[e,o]:[e,o.map(((o,r)=>l&&l!==r?o:{cells:o.cells.map(((o,l)=>function(e,t){if(!e||!t)return!1;switch(t.type){case"column":return"column"===t.type&&e.columnIndex===t.columnIndex;case"cell":return"cell"===t.type&&e.sectionName===t.sectionName&&e.columnIndex===t.columnIndex&&e.rowIndex===t.rowIndex}}({sectionName:e,columnIndex:l,rowIndex:r},t)?n(o):o))}))])))}function Xr(e,{sectionName:t,rowIndex:n,columnCount:o}){const r=function(e){return Jr(e.head)?Jr(e.body)?Jr(e.foot)?void 0:e.foot[0]:e.body[0]:e.head[0]}(e),l=void 0===o?r?.cells?.length:o;return l?{[t]:[...e[t].slice(0,n),{cells:Array.from({length:l}).map(((e,n)=>{var o;const l=null!==(o=r?.cells?.[n])&&void 0!==o?o:{};return{...Object.fromEntries(Object.entries(l).filter((([e])=>Kr.includes(e)))),content:"",tag:"head"===t?"th":"td"}}))},...e[t].slice(n)]}:e}function Qr(e,t){var n;return Jr(e[t])?Xr(e,{sectionName:t,rowIndex:0,columnCount:null!==(n=e.body?.[0]?.cells?.length)&&void 0!==n?n:1}):{[t]:[]}}function Jr(e){return!e||!e.length||e.every(el)}function el(e){return!(e.cells&&e.cells.length)}const tl=[{icon:Rr,title:(0,r.__)("Align column left"),align:"left"},{icon:Dr,title:(0,r.__)("Align column center"),align:"center"},{icon:Or,title:(0,r.__)("Align column right"),align:"right"}],nl={head:(0,r.__)("Header cell text"),body:(0,r.__)("Body cell text"),foot:(0,r.__)("Footer cell text")},ol={head:(0,r.__)("Header label"),foot:(0,r.__)("Footer label")};function rl({name:e,...t}){const n=`t${e}`;return(0,l.createElement)(n,{...t})}const ll={apiVersion:3,name:"noptin/table",title:(0,r.__)("Table"),category:"design",description:(0,r.__)("Create structured content in rows and columns to display information."),attributes:{hasFixedLayout:{type:"boolean",default:!0},head:{type:"array",default:[],source:"query",selector:"thead tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"rich-text",source:"rich-text"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"},colspan:{type:"string",source:"attribute",attribute:"colspan"},rowspan:{type:"string",source:"attribute",attribute:"rowspan"}}}}},body:{type:"array",default:[],source:"query",selector:"tbody tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"rich-text",source:"rich-text"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"},colspan:{type:"string",source:"attribute",attribute:"colspan"},rowspan:{type:"string",source:"attribute",attribute:"rowspan"}}}}},foot:{type:"array",default:[],source:"query",selector:"tfoot tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"rich-text",source:"rich-text"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"},colspan:{type:"string",source:"attribute",attribute:"colspan"},rowspan:{type:"string",source:"attribute",attribute:"rowspan"}}}}}},supports:{anchor:!1,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!0}},__experimentalSelector:".wp-block-noptin-table > table"},noptin:{typography:["fontFamily","fontSize","fontStyle","fontWeight","lineHeight","letterSpacing","textTransform","textDecoration"],border:!0,color:!0,align:!0}};function al(e){const t=parseInt(e,10);if(Number.isInteger(t))return t<0||1===t?void 0:t.toString()}const il=({phrasingContentSchema:e})=>({tr:{allowEmpty:!0,children:{th:{allowEmpty:!0,children:e,attributes:["scope","colspan","rowspan"]},td:{allowEmpty:!0,children:e,attributes:["colspan","rowspan"]}}}}),sl={from:[{type:"raw",selector:"table",schema:e=>({table:{children:{thead:{allowEmpty:!0,children:il(e)},tfoot:{allowEmpty:!0,children:il(e)},tbody:{allowEmpty:!0,children:il(e)}}}}),transform:e=>{const t=Array.from(e.children).reduce(((e,t)=>{if(!t.children.length)return e;const n=t.nodeName.toLowerCase().slice(1),o=Array.from(t.children).reduce(((e,t)=>{if(!t.children.length)return e;const n=Array.from(t.children).reduce(((e,t)=>{const n=al(t.getAttribute("rowspan")),o=al(t.getAttribute("colspan"));return e.push({tag:t.nodeName.toLowerCase(),content:t.innerHTML,rowspan:n,colspan:o}),e}),[]);return e.push({cells:n}),e}),[]);return e[n]=o,e}),{});return(0,o.createBlock)("noptin/table",t)}}]},cl=sl,{name:ul}=ll,pl={icon:$r,example:{attributes:{head:[{cells:[{content:"Version",tag:"th"},{content:"Jazz Musician",tag:"th"},{content:"Release Date",tag:"th"}]}],body:[{cells:[{content:"5.2",tag:"td"},{content:"Jaco Pastorius",tag:"td"},{content:"May 7, 2019",tag:"td"}]},{cells:[{content:"5.1",tag:"td"},{content:"Betty Carter",tag:"td"},{content:"February 21, 2019",tag:"td"}]},{cells:[{content:"5.0",tag:"td"},{content:"Bebo Valdés",tag:"td"},{content:"December 6, 2018",tag:"td"}]}]},viewportWidth:450},transforms:cl,edit:function({attributes:e,setAttributes:t,isSelected:n}){const{hasFixedLayout:o,head:a,foot:c}=e,[u,p]=(0,l.useState)(2),[d,m]=(0,l.useState)(2),[g,h]=(0,l.useState)(),b=(0,l.useRef)(null),[f,y]=(0,l.useState)(!1);function x(n){g&&t(Yr(e,g,(e=>({...e,content:n}))))}function k(n){if(!g)return;const{sectionName:o,rowIndex:r}=g,l=r+n;t(Xr(e,{sectionName:o,rowIndex:l,columnCount:void 0})),h({sectionName:o,rowIndex:l,columnIndex:0,type:"cell"})}function w(n=0){if(!g)return;const{columnIndex:o,sectionName:r}=g,l=o+n;t(function(e,{columnIndex:t}){const n=Object.fromEntries(Object.entries(e).filter((([e])=>["head","body","foot"].includes(e))));return Object.fromEntries(Object.entries(n).map((([e,n])=>Jr(n)?[e,n]:[e,n.map((n=>el(n)||n.cells.length{n||h(void 0)}),[n]),(0,l.useEffect)((()=>{f&&(b?.current?.querySelector('td div[contentEditable="true"]')?.focus(),y(!1))}),[f]);const E=["head","body","foot"].filter((t=>!Jr(e[t]))),C=[{icon:jr,title:(0,r.__)("Insert row before"),isDisabled:!g,onClick:function(){k(0)}},{icon:Fr,title:(0,r.__)("Insert row after"),isDisabled:!g,onClick:function(){k(1)}},{icon:Ur,title:(0,r.__)("Delete row"),isDisabled:!g,onClick:function(){if(!g)return;const{sectionName:n,rowIndex:o}=g;h(void 0),t(function(e,{sectionName:t,rowIndex:n}){return{[t]:e[t].filter(((e,t)=>t!==n))}}(e,{sectionName:n,rowIndex:o}))}},{icon:Wr,title:(0,r.__)("Insert column before"),isDisabled:!g,onClick:function(){w(0)}},{icon:Gr,title:(0,r.__)("Insert column after"),isDisabled:!g,onClick:function(){w(1)}},{icon:qr,title:(0,r.__)("Delete column"),isDisabled:!g,onClick:function(){if(!g)return;const{columnIndex:n}=g;h(void 0),t(function(e,{columnIndex:t}){const n=Object.fromEntries(Object.entries(e).filter((([e])=>["head","body","foot"].includes(e))));return Object.fromEntries(Object.entries(n).map((([e,n])=>Jr(n)?[e,n]:[e,n.map((e=>({cells:e.cells.length>=t?e.cells.filter(((e,n)=>n!==t)):e.cells}))).filter((e=>e.cells.length))])))}(e,{columnIndex:n}))}}],S=R(e),B=v(e),I=B.borderColor,T=V(e).style,M={borderCollapse:"collapse",...B,...T};S||(M.width="100%"),e.hasFixedLayout&&(M.tableLayout="fixed");const z=_(e),A=E.map((t=>{const n={..."head"===t?{borderBottom:`3px solid ${I||"currentcolor"}`}:void 0,..."foot"===t?{borderTop:`3px solid ${I||"currentcolor"}`}:void 0};return(0,l.createElement)(rl,{name:t,key:t,style:n},e[t].map((({cells:n},o)=>(0,l.createElement)("tr",{key:o},n.map((({content:n,tag:r,scope:a,align:i,colspan:c,rowspan:u},p)=>(0,l.createElement)(r,{key:p,scope:"th"===r?a:void 0,colSpan:c,rowSpan:u,style:{textAlign:i,border:`1px solid ${I||"currentcolor"}`,padding:"0.5em",...e.hasFixedLayout?{wordBreak:"break-word"}:void 0,...z}},(0,l.createElement)(s.RichText,{value:n,onChange:x,onFocus:()=>{h({sectionName:t,rowIndex:o,columnIndex:p,type:"cell"})},"aria-label":nl[t],placeholder:ol[t]}))))))))})),P=!E.length,N=(0,s.useBlockProps)({ref:b,className:"noptin-block__margin-wrapper",style:{...Z(e),...T,overflowX:"auto"}});return(0,l.createElement)("div",{...N},!P&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(s.AlignmentControl,{label:(0,r.__)("Change column alignment"),alignmentControls:tl,value:function(){if(g)return function(e,t,n){const{sectionName:o,rowIndex:r,columnIndex:l}=t;return e[o]?.[r]?.cells?.[l]?.align}(e,g)}(),onChange:n=>function(n){if(!g)return;const o={type:"column",columnIndex:g.columnIndex},r=Yr(e,o,(e=>({...e,align:n})));t(r)}(n)})),(0,l.createElement)(s.BlockControls,{group:"other"},(0,l.createElement)(i.ToolbarDropdownMenu,{hasArrowIndicator:!0,icon:Zr,label:(0,r.__)("Edit table"),controls:C}))),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings"),className:"blocks-table-settings"},(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Fixed width table cells"),checked:!!o,onChange:function(){t({hasFixedLayout:!o})}}),!P&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Header section"),checked:!(!a||!a.length),onChange:function(){t(Qr(e,"head"))}}),(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Footer section"),checked:!(!c||!c.length),onChange:function(){t(Qr(e,"foot"))}})))),!P&&(0,l.createElement)("table",{align:S,style:M},A),P&&(0,l.createElement)(i.Placeholder,{label:(0,r.__)("Table"),icon:(0,l.createElement)(s.BlockIcon,{icon:$r,showColors:!0}),instructions:(0,r.__)("Insert a table for sharing data.")},(0,l.createElement)(i.__experimentalHStack,{as:"form",className:"blocks-table__placeholder-form",onSubmit:function(e){e.preventDefault(),t(function({rowCount:e,columnCount:t}){return{body:Array.from({length:e}).map((()=>({cells:Array.from({length:t}).map((()=>({content:"",tag:"td"})))})))}}({rowCount:parseInt(u,10)||2,columnCount:parseInt(d,10)||2})),y(!0)},alignment:"flex-end",style:{flexDirection:"row",alignItems:"flex-end"},spacing:4,wrap:!0},(0,l.createElement)(i.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,r.__)("Column count"),value:d,onChange:function(e){m(e)},min:1,className:"blocks-table__placeholder-input"}),(0,l.createElement)(i.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,r.__)("Row count"),value:u,onChange:function(e){p(e)},min:1,className:"blocks-table__placeholder-input"}),(0,l.createElement)(i.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit"},(0,r.__)("Create Table")))))},save:function({attributes:e}){const{head:t,body:n,foot:o}=e;if(!t.length&&!n.length&&!o.length)return null;const r=R(e),a=v(e),i=a.borderColor,c=V(e).style,u={borderCollapse:"collapse",...a,...c};r||(u.width="100%"),e.hasFixedLayout&&(u.tableLayout="fixed");const p=_(e),d=({type:t,rows:n})=>{if(!n.length)return null;const o=`t${t}`,r={..."head"===t?{borderBottom:`3px solid ${i||"currentcolor"}`}:void 0,..."foot"===t?{borderTop:`3px solid ${i||"currentcolor"}`}:void 0};return(0,l.createElement)(o,{style:r},n.map((({cells:t},n)=>(0,l.createElement)("tr",{key:n},t.map((({content:t,tag:n,scope:o,align:r,colspan:a,rowspan:c},u)=>(0,l.createElement)(s.RichText.Content,{"data-align":r,style:{textAlign:r,border:`1px solid ${i||"currentcolor"}`,padding:"0.5em",...e.hasFixedLayout?{wordBreak:"break-word"}:void 0,...p},tagName:n,value:t,key:u,scope:"th"===n?o:void 0,colSpan:a,rowSpan:c})))))))},m=s.useBlockProps.save({className:"noptin-block__margin-wrapper",style:{...Z.save(e),...c,overflowX:"auto"}});return(0,l.createElement)("div",{...m},(0,l.createElement)("table",{align:r,style:u},(0,l.createElement)(d,{type:"head",rows:t}),(0,l.createElement)(d,{type:"body",rows:n}),(0,l.createElement)(d,{type:"foot",rows:o})))}},dl=[{label:(0,r.__)("Newest to oldest"),value:"date/desc"},{label:(0,r.__)("Oldest to newest"),value:"date/asc"},{ /* translators: label for ordering posts by title in ascending order */ label:(0,r.__)("A → Z"),value:"title/asc"},{ /* translators: label for ordering posts by title in descending order */ -label:(0,r.__)("Z → A"),value:"title/desc"}],pl=function({order:e,orderBy:t,onChange:n,options:o}){const a=o||ul;return(0,l.createElement)(i.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Order by"),value:`${t}/${e}`,options:a,onChange:e=>{const[t,o]=e.split("/");n({order:o,orderby:t})}})},dl={popoverProps:{placement:"left-start",offset:259}},ml=({filterKey:e,filter:t,query:n,setQuery:o})=>(0,l.createElement)(i.__experimentalToolsPanelItem,{label:t.label,hasValue:()=>!!n[e],onDeselect:()=>o({[e]:null}),isShownByDefault:!!t.show_by_default},(0,l.createElement)(cl,{settingKey:e,setting:t,saved:n,setAttributes:o})),gl=({type:e,label:t,orderOptions:n,filters:o,query_defaults:a})=>{const c=`noptin/${e.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}-template`,u=[c],p=[[c]],d={number:10,order:"desc",orderby:"date",...a||{}};o&&Object.keys(o).forEach((e=>{void 0!==o[e].default&&(d[e]=o[e].default)}));const m=({setAttributes:e,attributes:a})=>{const c=a.columns>1,{query:m}=a,g=(0,l.useCallback)((t=>{e({query:{...m,...t}})}),[m,e]),h=o&&Object.keys(o).length>0,b=(0,s.useBlockProps)({style:{..._(a),...v(a),...Z(a),...V(a).style}}),f=(0,s.useInnerBlocksProps)(b,{allowedBlocks:u,renderAppender:!1,template:p,templateLock:"all"});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(pl,{order:m.order,orderBy:m.orderby,options:n,onChange:g}),(0,l.createElement)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,r.sprintf)(/* translators: %s: plural name of the post type */ /* translators: %s: plural name of the post type */ +label:(0,r.__)("Z → A"),value:"title/desc"}],ml=function({order:e,orderBy:t,onChange:n,options:o}){const a=o||dl;return(0,l.createElement)(i.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Order by"),value:`${t}/${e}`,options:a,onChange:e=>{const[t,o]=e.split("/");n({order:o,orderby:t})}})},gl={popoverProps:{placement:"left-start",offset:259}},hl=({filterKey:e,filter:t,query:n,setQuery:o})=>(0,l.createElement)(i.__experimentalToolsPanelItem,{label:t.label,hasValue:()=>!!n[e],onDeselect:()=>o({[e]:null}),isShownByDefault:!!t.show_by_default},(0,l.createElement)(io,{settingKey:e,setting:t,saved:n,setAttributes:o})),bl=({type:e,label:t,orderOptions:n,filters:o,query_defaults:a})=>{const c=`noptin/${e.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}-template`,u=[c],p=[[c]],d={number:10,order:"desc",orderby:"date",...a||{}};o&&Object.keys(o).forEach((e=>{void 0!==o[e].default&&(d[e]=o[e].default)}));const m=({setAttributes:e,attributes:a})=>{const c=a.columns>1,{query:m}=a,g=(0,l.useCallback)((t=>{e({query:{...m,...t}})}),[m,e]),h=o&&Object.keys(o).length>0,b=(0,s.useBlockProps)({style:{..._(a),...v(a),...Z(a),...V(a).style}}),f=(0,s.useInnerBlocksProps)(b,{allowedBlocks:u,renderAppender:!1,template:p,templateLock:"all"});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(ml,{order:m.order,orderBy:m.orderby,options:n,onChange:g}),(0,l.createElement)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,r.sprintf)(/* translators: %s: plural name of the post type */ /* translators: %s: plural name of the post type */ (0,r.__)("Number of %s to show"),t),value:m.number,onChange:e=>g({number:e}),min:1,max:500}),(0,l.createElement)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,r.__)("Columns"),value:a.columns,onChange:t=>e({columns:t}),min:1,max:4}),c&&(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Stack on mobile"),checked:a.isStackedOnMobile,onChange:()=>e({isStackedOnMobile:!a.isStackedOnMobile})}),(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.sprintf)(/* translators: %s: plural name of the post type */ /* translators: %s: plural name of the post type */ (0,r.__)("Skip sending this email if no %s are found"),t.toLowerCase()),checked:a.skipOnEmpty,onChange:()=>e({skipOnEmpty:!a.skipOnEmpty})}),(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.sprintf)(/* translators: %s: plural name of the post type */ /* translators: %s: plural name of the post type */ -(0,r.__)("Hide parent section if no %s are found"),t.toLowerCase()),checked:a.hideParentSectionOnEmpty,onChange:()=>e({hideParentSectionOnEmpty:!a.hideParentSectionOnEmpty})}))),h&&(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.__experimentalToolsPanel,{className:"block-library-query-toolspanel__filters",label:(0,r.__)("Filters"),resetAll:()=>g(d),dropdownMenuProps:dl,as:"div"},Object.entries(o).map((([e,t])=>(0,l.createElement)(ml,{key:e,filterKey:e,filter:t,query:m,setQuery:g}))))),(0,l.createElement)("div",{...f}))};return e=>{const{clientId:t}=e,n=(0,S.useSelect)((e=>e(s.store).getBlocks(t).length>0),[t])?m:Ut;return(0,l.createElement)(n,{...e})}},hl=({name:e})=>({attributes:t})=>{const{isStackedOnMobile:n,skipOnEmpty:o,query:r,columns:a}=t,i={..._(t),...v(t),...Z.save(t),...V(t).style},c={...r};Object.keys(c).forEach((e=>{""===c[e]&&delete c[e],"boolean"==typeof c[e]&&(c[e]=c[e]?"true":"false")}));const u=`noptin_${e}_list`,p=(0,de.addQueryArgs)("",c),d=t.hideParentSectionOnEmpty?' hide_parent_section_on_empty="yes"':"";return(0,l.createElement)("div",{...s.useBlockProps.save({style:i})},`[${u} query="${p.slice(1)}" columns=${a} responsive=${n?"yes":"no"} skiponempty=${o?"yes":"no"}${d}]`,(0,l.createElement)(s.InnerBlocks.Content,null),`[/${u}]`)},bl=(e,t)=>{let n=t||"";const o=n.includes("/")?n:"core/heading";return[o,{anchor:`block-${e}__list-heading`,style:{noptin:{typography:{fontSize:20,lineHeight:"1.3"}},spacing:{margin:{bottom:"10px"}}},..."core/heading"===o?{content:n}:{}}]},_l=(e,t,n="left")=>{if(t)return[t,{anchor:`block-${e}__list-action`,style:{noptin:{border:{radius:"5px"},typography:{textTransform:"none",textDecoration:"none",textAlign:"center"},align:n}}}]},fl=(e,t,n)=>{if(!t)return;const o=n?"10px":"0px";return[t,{anchor:`block-${e}__list-featured-image`,width:n?"150px":"",caption:"",style:{noptin:{typography:{textTransform:"none",textDecoration:"none",textAlign:"center"}},spacing:{margin:{top:o,bottom:o,right:o,left:o},padding:{right:"0px",left:"0px"}}}}]},yl=({name:e,type:t,template:n={}})=>{const{image:o,heading:l,description:a,meta:i,button:s}=n,c=`noptin/${t.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}-template`;return[{name:"list",title:(0,r.__)("List"),icon:Xe,isDefault:!0,attributes:{isStackedOnMobile:!1,columns:1,anchor:`block-${e}__list`,style:{noptin:{border:{border:{bottom:void 0,right:void 0,top:{color:"#e0dede",style:"solid",width:"1px"},left:void 0},radius:void 0}}}},innerBlocks:[[c,{style:{noptin:{border:{border:{top:void 0,right:void 0,bottom:{color:"#e0dede",style:"solid",width:"1px"},left:void 0},radius:void 0},color:{link:"#111111"}},spacing:{margin:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}},anchor:`block-${e}__list-template`},[["noptin/columns",{verticalAlignment:"middle",isStackedOnMobile:!0,anchor:`block-${e}__list-columns`},(0,w.compact)([o&&["noptin/column",{width:"150px",verticalAlignment:"middle",anchor:`block-${e}__list-column__left`,style:{spacing:{margin:{right:"0px",left:"0px",top:"0px",bottom:"0px"},padding:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}}},[fl(e,o,!0)]],["noptin/column",{width:"",verticalAlignment:"middle",anchor:`block-${e}__list-column__right`,style:{spacing:{margin:{right:"10px",left:"10px",top:"10px",bottom:"10px"},padding:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}}},(0,w.compact)([bl(e,l),a&&["core/paragraph",{content:a,anchor:`block-${e}__list-description`,style:{noptin:{typography:{lineHeight:"1.4"}},spacing:{margin:{bottom:"10px"}}}}],i&&["core/paragraph",{content:i,anchor:`block-${e}__list-meta`,style:{noptin:{color:{text:"#666666"},typography:{fontSize:13}},spacing:{margin:{bottom:"10px"}}}}],_l(e,s)])]])]]]],scope:["block"]},{name:"grid",title:(0,r.__)("Grid"),icon:"grid-view",isDefault:!1,attributes:{isStackedOnMobile:!0,columns:2,anchor:`block-${e}__grid`},innerBlocks:[[c,{style:{noptin:{border:{border:{color:"#e0dede",style:"solid",width:"1px"},radius:void 0},typography:{textAlign:"center"},color:{link:"#111111"}},spacing:{margin:{bottom:"24px"}}},anchor:`block-${e}__grid__template`},(0,w.compact)([fl(e,o,!1),bl(e,l),a&&["core/paragraph",{content:a,anchor:`block-${e}__list-description`,style:{noptin:{typography:{lineHeight:"1.4"}},spacing:{margin:{bottom:"10px"}}}}],i&&["core/paragraph",{content:i,anchor:`block-${e}__list-meta`,style:{noptin:{color:{text:"#666666"},typography:{fontSize:13}},spacing:{margin:{bottom:"10px"}}}}],_l(e,s,"center")])]],scope:["block"]}]},vl=(0,l.memo)((function({blocks:e,isHidden:t,setActiveBlockContextId:n,style:o,className:r}){const a=(0,s.__experimentalUseBlockPreview)({blocks:e,props:{className:r}});return(0,l.createElement)("div",{...a,tabIndex:0,role:"button",onClick:n,onKeyPress:n,style:{...o,display:t?"none":void 0}})}));function xl(e){return(0,l.createElement)("div",{...(0,s.useInnerBlocksProps)(e,{templateLock:!1})})}const kl=({name:e,isStackedOnMobile:t,columns:n,totalRecords:o,attributes:r,clientId:i})=>{const c=(e=>{if(1===e)return"100%";const t=1e12;return Math.round(100/e*t)/t+"%"})(n),u=Array(o).fill(0),p=Array.from({length:n},(()=>[]));u.forEach(((e,t)=>{p[t%n].push(t)}));const[d,m]=(0,l.useState)("0.0"),g={..._(r),...v(r),...Z(r),...V(r).style},h=k("noptin-records__wrapper",`noptin-${e}__wrapper`,{[`noptin-columns noptin-columns__${n}`]:n>1,"noptin-is-stacked-on-mobile":n>1&&t}),b=k("noptin-records__column",`noptin-${e}__column`,{"noptin-column":n>1,"noptin-is-stacked-on-mobile":n>1&&t}),f=(0,S.useSelect)((e=>e(s.store).getBlocks(i)),[i]);return(0,l.createElement)("div",{...(0,s.useBlockProps)({className:h})},p.map(((e,t)=>(0,l.createElement)("div",{key:t,className:b,style:{width:c}},0===e.length&&(0,l.createElement)("span",null,"nbsp;"),e.map((e=>{const n=`${t}.${e}`;return(0,l.createElement)(a().Fragment,{key:n},n===d&&(0,l.createElement)(xl,{style:g,className:"noptin-record"}),f.length>0&&(0,l.createElement)(vl,{blocks:f,style:g,className:"noptin-record",setActiveBlockContextId:()=>m(n),isHidden:n===d}))}))))))},wl=({name:e})=>({attributes:t,context:n,clientId:o})=>{const r=n[`noptin/${e}/isStackedOnMobile`],a=n[`noptin/${e}/columns`]||1,i=n[`noptin/${e}/query`]?.number||10;return(0,l.createElement)(kl,{name:e,isStackedOnMobile:r,columns:a,totalRecords:i,attributes:t,clientId:o})},El=()=>({attributes:e})=>{const t={..._(e),...v(e),...Z.save(e),...V(e).style};return(0,l.createElement)("div",{...s.useBlockProps.save({style:t,className:"noptin-record"})},(0,l.createElement)(s.InnerBlocks.Content,null))},Cl={};window.RECORD_TEMPLATE_BLOCKS=Cl;function Sl({attributes:e,setAttributes:t,isSelected:n,insertBlocksAfter:a,clientId:c,settings:u}){const{alt:p,caption:d,href:m,width:g,height:h,scale:b}=e,_=(0,E.usePrevious)(d),[f,y]=(0,l.useState)(!!d);(0,l.useEffect)((()=>{d&&!_&&y(!0)}),[d,_]);const v=(0,l.useCallback)((e=>{e&&!d&&e.focus()}),[d]);(0,l.useEffect)((()=>{n||d||y(!1)}),[n,d]);const x=(0,i.__experimentalUseCustomUnits)({availableUnits:["px"]});let k;return k=g&&h?`https://placehold.co/${parseInt(g)}x${parseInt(h)}`:g?`https://placehold.co/${parseInt(g)}`:h?`https://placehold.co/${parseInt(h)}`:"https://placehold.co/600",(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(i.ToolbarButton,{onClick:()=>{y(!f),f&&d&&t({caption:void 0})},icon:me,isPressed:f,label:f?(0,r.__)("Remove caption"):(0,r.__)("Add caption")})),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Settings"),panelId:c,resetAll:()=>{t({width:void 0,height:void 0})}},(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Alternative text"),isShownByDefault:!0,hasValue:()=>""!==p,panelId:c,onDeselect:()=>t({alt:void 0})},(0,l.createElement)(cl,{settingKey:"alt",saved:e,setAttributes:t,setting:{el:"textarea",label:(0,r.__)("Alternative text"),description:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,r.__)("Describe the purpose of the image.")),(0,l.createElement)("br",null),(0,r.__)("Leave empty if decorative."))}})),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Link to"),isShownByDefault:!0,hasValue:()=>!!m,panelId:c,onDeselect:()=>t({href:void 0})},(0,l.createElement)(cl,{settingKey:"href",saved:e,setAttributes:t,setting:{el:"input",type:"text",label:(0,r.__)("Link to"),description:(0,r.__)("Enter URL to make the image a link.")}})),u&&Object.entries(u).map((([n,o])=>(0,l.createElement)(i.__experimentalToolsPanelItem,{label:o.label,isShownByDefault:!0,hasValue:()=>""!==e[n]&&void 0!==e[n],onDeselect:()=>t({key:void 0}),panelId:c,key:n},(0,l.createElement)(cl,{settingKey:n,prop:"settings",saved:e,setAttributes:t,setting:o})))),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Width"),isShownByDefault:!0,hasValue:()=>!!g,onDeselect:()=>t({width:void 0}),panelId:c,style:{gridColumn:"span 1"}},(0,l.createElement)(s.__experimentalUnitControl,{label:(0,r.__)("Width"),placeholder:(0,r.__)("Auto"),labelPosition:"top",min:0,value:g||"",onChange:e=>t({width:e}),size:"__unstable-large"})),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Height"),isShownByDefault:!0,hasValue:()=>!!h,onDeselect:()=>t({height:void 0}),panelId:c,style:{gridColumn:"span 1"}},(0,l.createElement)(s.__experimentalUnitControl,{label:(0,r.__)("Height"),placeholder:(0,r.__)("Auto"),labelPosition:"top",units:x,min:0,value:h||"",onChange:e=>t({height:e}),size:"__unstable-large"})))),(0,l.createElement)(xe,{href:m},(0,l.createElement)("img",{src:`${k}/31343c/fff.png?text=Placeholder`,alt:p||"Placeholder Image",style:{width:!g&&h?"auto":g,height:h,objectFit:b,maxWidth:"100%"}})),f&&(!s.RichText.isEmpty(d)||n)&&(0,l.createElement)(s.RichText,{identifier:"caption",ref:v,className:"wp-block-image__caption",tagName:"div","aria-label":(0,r.__)("Image caption text"),placeholder:(0,r.__)("Add caption"),value:d,onChange:e=>t({caption:e}),inlineToolbar:!0,__unstableOnSplitAtEnd:()=>a((0,o.createBlock)((0,o.getDefaultBlockName)())),style:{fontSize:"12px",textAlign:"center",marginTop:"12px"}}))}const Bl=({settings:e})=>function({attributes:t,setAttributes:n,isSelected:o,insertBlocksAfter:r,clientId:a}){const i=R(t);(0,l.useEffect)((()=>{t.width&&/^\d+$/.test(t.width)&&n({width:`${t.width}px`})}),[t.width]);const c={className:"noptin-image-block__wrapper",border:0,cellPadding:"0",cellSpacing:"0"};"left"!==i&&"right"!==i||(c.align=i,c.className+=" noptin-image-block__wrapper-is-aligned");const u=(0,s.useBlockProps)(c),p={...v(t),...Z(t),display:"inline-block",maxWidth:"100%"};return(0,l.createElement)("table",{...u},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:i,className:k({"is-selected":o})},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:p},(0,l.createElement)(Sl,{attributes:t,setAttributes:n,isSelected:o,insertBlocksAfter:r,clientId:a,settings:e}))))))},Il=(e,t)=>{let n="";return e&&Object.entries(e).forEach((([e,t])=>{if(t||0===t||!1===t){let o=t;"boolean"==typeof o&&(o=o?1:0),n+="number"==typeof o?` ${e}=${o}`:` ${e}="${o}"`}})),`[[${t}${n}]]`},Tl=({settings:e,attributes:t,setAttributes:n})=>e?(0,l.createElement)(l.Fragment,null,Object.entries(e).map((([e,o])=>(0,l.createElement)(cl,{key:e,settingKey:e,saved:t,prop:"settings",setAttributes:n,setting:o})))):null,Ml=({mergeTag:e,settings:t,linksTo:n})=>function({attributes:o,setAttributes:a}){const c=o.link&&!!n,u={..._(o),...v(o),...Z(o),...V(o).style},p=(0,s.useBlockProps)({style:c?{cursor:"pointer"}:u}),d="h"+o.level,m=Il(o.settings,e);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(s.HeadingLevelDropdown,{value:o.level,onChange:e=>a({level:e})}),n&&(0,l.createElement)(i.ToolbarButton,{icon:"admin-links",label:(0,r.__)("Link"),onClick:()=>a({link:!o.link}),isPressed:o.link,size:"compact"})),t&&(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,null,(0,l.createElement)(i.__experimentalVStack,null,(0,l.createElement)(Tl,{settings:t,attributes:o,setAttributes:a})))),(0,l.createElement)((()=>c?(0,l.createElement)(d,{...p},(0,l.createElement)("a",{href:`${n}`,onClick:e=>e.preventDefault(),style:u},m)):(0,l.createElement)(d,{...p},m)),null))},zl=({mergeTag:e})=>function({attributes:t}){const{alt:n,caption:o,href:r,width:a,height:i}=t,c=R(t),u=Il(t.settings,e),p=(0,l.createElement)("img",{src:u,alt:n,width:a&&a.endsWith("px")?a.slice(0,-2):void 0,border:"0",style:{width:!a&&i?"auto":a,height:i,maxWidth:"100%"}}),d={...v(t),...Z.save(t),display:"inline-block",maxWidth:"100%"},m=(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:d},r?(0,l.createElement)("a",{href:r,style:{display:"block",textDecoration:"none",maxWidth:"100%",lineHeight:0}},p):p,!s.RichText.isEmpty(o)&&(0,l.createElement)(s.RichText.Content,{className:"wp-block-image__caption",tagName:"div",value:o,style:{fontSize:"12px",textAlign:"center",marginTop:"12px"}})),g={className:"noptin-image-block__wrapper",border:0,cellPadding:"0",cellSpacing:"0",role:"presentation"};return"left"!==c&&"right"!==c||(g.align=c,g.className+=" noptin-image-block__wrapper-is-aligned"),(0,l.createElement)("table",{...s.useBlockProps.save(g)},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:c},m))))},Al=({mergeTag:e,linksTo:t})=>function({attributes:n}){const o="h"+n.level,r=Il(n.settings,e),a=n.link&&!!t,i={..._(n),...v(n),...Z.save(n),...V(n).style},c=s.useBlockProps.save({style:a?{cursor:"pointer"}:i});return a?(0,l.createElement)("a",{href:`${t}`,...c},(0,l.createElement)(o,{style:i},r)):(0,l.createElement)(o,{...c},r)},Nl=({mergeTag:e,settings:t})=>function({attributes:n,setAttributes:o}){const r=(0,s.useBlockProps)({className:"noptin-block__margin-wrapper",style:{..._(n),...v(n),...Z(n),...V(n).style}}),a=n.element||"p";return(0,l.createElement)(l.Fragment,null,t&&(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,null,(0,l.createElement)(i.__experimentalVStack,null,(0,l.createElement)(Tl,{attributes:n,setAttributes:o,settings:t})))),(0,l.createElement)(a,{...r},Il(n.settings,e)))},Pl=({mergeTag:e})=>function({attributes:t}){const n=s.useBlockProps.save({className:"noptin-block__margin-wrapper",style:{..._(t),...v(t),...Z.save(t),...V(t).style}}),o=t.element||"p";return(0,l.createElement)(o,{...n},Il(t.settings,e))},Hl={el:"input",type:"text",label:(0,r.__)("Button URL"),description:(0,r.__)("The URL to link to.")},Ll=({settings:e})=>function(t){const{attributes:n,setAttributes:a,isSelected:c,onReplace:u,mergeBlocks:p,clientId:d}=t,{placeholder:m,rel:g,text:h,width:b}=n,f=R(n),y=_(n),[x,k]=(0,l.useState)(null),w=v(n),C=V(n).style,B=Z(n,!0),I=(0,l.useRef)(),T=(0,l.useRef)(),M=(0,s.useBlockProps)({ref:(0,E.useMergeRefs)([k,I]),width:"100%",border:0,cellPadding:0,cellSpacing:0,role:"presentation",className:"noptin-button-block__wrapper"}),[z,A]=(0,l.useState)(!0);(0,l.useEffect)((()=>{c&&A(!0)}),[c]);const N=function(e){const{replaceBlocks:t,selectionChange:n}=(0,S.useDispatch)(s.store),{getBlock:r,getBlockRootClientId:a,getBlockIndex:i}=(0,S.useSelect)(s.store),c=(0,l.useRef)(e);return c.current=e,(0,E.useRefEffect)((e=>{function l(e){if(e.defaultPrevented||e.keyCode!==K.ENTER)return;const{content:l,clientId:s}=c.current;if(l.length)return;e.preventDefault();const u=r(a(s)),p=i(s),d=(0,o.cloneBlock)({...u,innerBlocks:u.innerBlocks.slice(0,p)}),m=(0,o.createBlock)((0,o.getDefaultBlockName)()),g=u.innerBlocks.slice(p+1),h=g.length?[(0,o.cloneBlock)({...u,innerBlocks:g})]:[];t(u.clientId,[d,m,...h],1),n(m.clientId)}return e.addEventListener("keydown",l),()=>{e.removeEventListener("keydown",l)}}),[])}({content:h,clientId:d}),P=(0,E.useMergeRefs)([N,T]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("table",{...M},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:f},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:B.margin},(0,l.createElement)("table",{width:b?`${b}%`:void 0},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{bgcolor:C.backgroundColor,role:"presentation",valign:"middle",className:"noptin-button-link__wrapper",style:{background:C.backgroundColor,textAlign:y?.textAlign,cursor:"auto",...w}},(0,l.createElement)(s.RichText,{ref:P,tagName:"span","aria-label":(0,r.__)("Button text"),placeholder:m||(0,r.__)("Add text…"),value:h,onChange:e=>a({text:Ae(e)}),withoutInteractiveFormatting:!0,className:"noptin-button-link",style:{...B.padding,...y||{},color:C.color,margin:"0px",display:"block"},onReplace:u,onMerge:p,identifier:"text"})))))))))),c&&z&&(0,l.createElement)(i.Popover,{placement:"bottom",onClose:()=>{A(!1),T.current?.focus()},anchor:x,focusOnMount:!1,__unstableSlotName:"__unstable-block-tools-after",shift:!0},(0,l.createElement)("div",{style:{padding:"1em",minWidth:240}},(0,l.createElement)(cl,{settingKey:"url",saved:n,setAttributes:a,setting:Hl}))),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(cl,{settingKey:"url",saved:n,setAttributes:a,setting:Hl}),(0,l.createElement)(Tl,{settings:e,attributes:n,setAttributes:a}),(0,l.createElement)(i.__experimentalToggleGroupControl,{label:(0,r.__)("Button width"),className:"noptin-toggle-group-control",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isAdaptiveWidth:!0,isBlock:!0,isDeselectable:!0,onChange:function(e){const t=n.width===e?void 0:e;a({width:t})}},[25,50,75,100].map((e=>(0,l.createElement)(i.__experimentalToggleGroupControlOption,{key:e,label:`${e}%`,value:e})))))),(0,l.createElement)(s.InspectorControls,{group:"advanced"},(0,l.createElement)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Link rel"),value:g||"",onChange:e=>a({rel:e})})))},Vl=(e,t)=>{let n=t||"";const o=n.includes("/")?n:"core/heading";return[o,{anchor:`block-${e}__list-heading`,style:{noptin:{typography:{fontSize:20,lineHeight:"1.3"}},spacing:{margin:{bottom:"10px"}}},..."core/heading"===o?{content:n}:{}}]},$l=(e,t,n="left")=>{if(t)return[t,{anchor:`block-${e}__list-action`,style:{noptin:{border:{radius:"5px"},typography:{textTransform:"none",textDecoration:"none",textAlign:"center"},align:n}}}]},Rl=(e,t,n)=>{if(!t)return;const o=n?"10px":"0px";return[t,{anchor:`block-${e}__list-featured-image`,width:n?"150px":"",caption:"",style:{noptin:{typography:{textTransform:"none",textDecoration:"none",textAlign:"center"}},spacing:{margin:{top:o,bottom:o,right:o,left:o},padding:{right:"0px",left:"0px"}}}}]},Dl={};window.DYNAMIC_RECORD_TEMPLATE_BLOCKS=Dl;const Ol={},jl=window.noptinEmailEditorSettings||{};window.initNoptinBlocks=()=>{var e,t,n;(0,o.setCategories)([{slug:"content",title:(0,r.__)("Content"),icon:"admin-generic"},{slug:"dynamic",title:(0,r.__)("Dynamic","newsletter-optin-box"),icon:"image-filter"},{slug:"design",title:(0,r.__)("Design","newsletter-optin-box"),icon:"welcome-widgets-menus"}]),G({name:ee,metadata:X,settings:te}),G({name:le,metadata:ne,settings:ae}),G({name:Me,metadata:Ce,settings:ze}),G({name:Ve,metadata:He,settings:$e}),G({name:We,metadata:Ue,settings:Ge}),G({name:Ke,metadata:qe,settings:Ye}),G({name:ht,metadata:st,settings:bt}),G({name:Bt,metadata:Et,settings:It}),G({name:Mt,metadata:Tt,settings:zt}),G({name:Lt,metadata:Nt,settings:Vt}),G({name:Kt,metadata:Wt,settings:Yt}),G({name:en,metadata:Jt,settings:tn}),G({name:ln,metadata:on,settings:an}),G({name:un,metadata:cn,settings:pn}),G({name:hn,metadata:gn,settings:bn}),G({name:xn,metadata:fn,settings:kn}),G({name:Kn,metadata:Un,settings:Yn}),e=jl.dynamicBlocks||{},t=jl.context,n=jl.objects,e.forEach((e=>{Array.isArray(e.metadata?.ancestor)&&Array.isArray(t)&&e.metadata.ancestor.some((e=>t.includes(e)))&&delete e.metadata.ancestor,e.element&&n[e.element]&&(((e,t)=>{const n=(({blockName:e,title:t,description:n,metadata:o})=>({apiVersion:3,name:e,title:t,category:"dynamic",description:n,attributes:{isStackedOnMobile:{type:"boolean",default:!0},columns:{type:"number",default:1},number:{type:"number",default:3}},providesContext:{[`${e}/isStackedOnMobile`]:"isStackedOnMobile",[`${e}/columns`]:"columns",[`${e}/number`]:"number"},noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,__experimentalExposeControlsToChildren:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,__experimentalDefaultControls:{margin:!0}}},...o||{}}))({blockName:e.name,title:e.title,description:e.description,metadata:e.metadata}),o=(({name:e,mergeTag:t})=>({attributes:n})=>{const{isStackedOnMobile:o,number:r,columns:a}=n,i={..._(n),...v(n),...Z.save(n),...V(n).style},c=`noptin_${e}_list`;return(0,l.createElement)("div",{...s.useBlockProps.save({style:i})},`[${c} merge_tag="${t}" number="${r}" columns=${a} responsive=${o?"yes":"no"}]`,(0,l.createElement)(s.InnerBlocks.Content,null),`[/${c}]`)})({name:t.name,mergeTag:e.mergeTag}),a=(({blockName:e,label:t})=>{const n=`${e}-template`,o=[n],a=[[n]],c=({setAttributes:e,attributes:n})=>{const c=n.columns>1,u=(0,s.useBlockProps)({style:{..._(n),...v(n),...Z(n),...V(n).style}}),p=(0,s.useInnerBlocksProps)(u,{allowedBlocks:o,renderAppender:!1,template:a,templateLock:"all"});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,r.sprintf)(/* translators: %s: plural name of the post type */ /* translators: %s: plural name of the post type */ -(0,r.__)("Number of %s to show"),t),value:n.number,onChange:t=>e({number:t}),min:1,max:20}),(0,l.createElement)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,r.__)("Columns"),value:n.columns,onChange:t=>e({columns:t}),min:1,max:4}),c&&(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Stack on mobile"),checked:n.isStackedOnMobile,onChange:()=>e({isStackedOnMobile:!n.isStackedOnMobile})}))),(0,l.createElement)("div",{...p}))};return e=>{const{clientId:t}=e,n=(0,S.useSelect)((e=>e(s.store).getBlocks(t).length>0),[t])?c:Ut;return(0,l.createElement)(n,{...e})}})({blockName:e.name,label:t.label}),c=(({blockName:e,name:t,template:n={}})=>{const{image:o,heading:l,description:a,meta:i,button:s}=n,c=`${e}-template`;return[{name:"list",title:(0,r.__)("List"),icon:Xe,isDefault:!0,attributes:{isStackedOnMobile:!1,columns:1,anchor:`block-${t}__list`,style:{noptin:{border:{border:{bottom:void 0,right:void 0,top:{color:"#e0dede",style:"solid",width:"1px"},left:void 0},radius:void 0}}}},innerBlocks:[[c,{style:{noptin:{border:{border:{top:void 0,right:void 0,bottom:{color:"#e0dede",style:"solid",width:"1px"},left:void 0},radius:void 0},color:{link:"#111111"}},spacing:{margin:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}},anchor:`block-${t}__list-template`},[["noptin/columns",{verticalAlignment:"middle",isStackedOnMobile:!0,anchor:`block-${t}__list-columns`},(0,w.compact)([o&&["noptin/column",{width:"150px",verticalAlignment:"middle",anchor:`block-${t}__list-column__left`,style:{spacing:{margin:{right:"0px",left:"0px",top:"0px",bottom:"0px"},padding:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}}},[Rl(t,o,!0)]],["noptin/column",{width:"",verticalAlignment:"middle",anchor:`block-${t}__list-column__right`,style:{spacing:{margin:{right:"10px",left:"10px",top:"10px",bottom:"10px"},padding:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}}},(0,w.compact)([Vl(t,l),a&&["core/paragraph",{content:a,anchor:`block-${t}__list-description`,style:{noptin:{typography:{lineHeight:"1.4"}},spacing:{margin:{bottom:"10px"}}}}],i&&["core/paragraph",{content:i,anchor:`block-${t}__list-meta`,style:{noptin:{color:{text:"#666666"},typography:{fontSize:13}},spacing:{margin:{bottom:"10px"}}}}],$l(t,s)])]])]]]],scope:["block"]},{name:"grid",title:(0,r.__)("Grid"),icon:"grid-view",isDefault:!1,attributes:{isStackedOnMobile:!0,columns:2,anchor:`block-${t}__grid`},innerBlocks:[[c,{style:{noptin:{border:{border:{color:"#e0dede",style:"solid",width:"1px"},radius:void 0},typography:{textAlign:"center"},color:{link:"#111111"}},spacing:{margin:{bottom:"24px"}}},anchor:`block-${t}__grid__template`},(0,w.compact)([Rl(t,o,!1),Vl(t,l),a&&["core/paragraph",{content:a,anchor:`block-${t}__list-description`,style:{noptin:{typography:{lineHeight:"1.4"}},spacing:{margin:{bottom:"10px"}}}}],i&&["core/paragraph",{content:i,anchor:`block-${t}__list-meta`,style:{noptin:{color:{text:"#666666"},typography:{fontSize:13}},spacing:{margin:{bottom:"10px"}}}}],$l(t,s,"center")])]],scope:["block"]}]})({blockName:e.name,name:t.name,template:Array.isArray(t.template)?{}:t.template}),u={icon:t.icon,edit:a,save:o,variations:c};G({name:e.name,metadata:n,settings:u})})({...e},{...n[e.element]}),((e,t)=>{const n=(({blockName:e,singularLabel:t})=>({apiVersion:3,name:`${e}-template`,parent:[e],title:(0,r.sprintf)((0,r.__)("%s Template","newsletter-optin-box"),t),category:"dynamic",description:(0,r.sprintf)((0,r.__)("Contains the block elements used to render a %s","newsletter-optin-box"),t),attributes:{style:{type:"object",default:{noptin:{border:{border:{color:"#95a5a6",width:"1px"},radius:"4px"}}}}},usesContext:[`${e}/isStackedOnMobile`,`${e}/columns`,`${e}/number`],noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,className:!1,customClassName:!1,spacing:{__experimentalSkipSerialization:!0,padding:!0,margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}}}))({blockName:e.name,singularLabel:t.singular_label}),{name:o}=n;Dl[o]={type:t.type,provides:Array.isArray(t.provides)?t.provides:[]};const a=(({name:e,blockName:t})=>({attributes:n,context:o,clientId:r})=>{const a=o[`${t}/isStackedOnMobile`],i=o[`${t}/columns`]||1,s=o[`${t}/number`]||10;return(0,l.createElement)(kl,{name:e,isStackedOnMobile:a,columns:i,totalRecords:s,attributes:n,clientId:r})})({blockName:e.name,name:t.name});G({name:o,metadata:n,settings:{icon:"art",edit:a,save:El()}})})({...e},{...n[e.element]}),Array.isArray(n[e.element].provides)&&n[e.element].provides.forEach((t=>{const n=`noptin/${t}-template`;Ol[n]=Ol[n]||[],Ol[n].push(`${e.name}-template`)})))})),e.forEach((e=>{if(Array.isArray(e.metadata?.ancestor)&&Array.isArray(t))if(e.metadata.ancestor.some((e=>t.includes(e))))delete e.metadata.ancestor;else{const t=[...e.metadata.ancestor];e.metadata.ancestor.forEach((e=>{Ol[e]&&t.push(...Ol[e])})),e.metadata.ancestor=t}e.element&&n[e.element]||(e=>{switch(e.defaults||(e.defaults={}),e.settings&&Object.entries(e.settings).forEach((([t,n])=>{void 0!==n.default&&(e.defaults[t]=n.default)})),e.element){case"heading":(e=>{const t=(({name:e,title:t,description:n,linksTo:o,metadata:r,defaults:l})=>{const a={level:{type:"number",default:l.level||2},anchor:{type:"string",default:t.toLowerCase().replace(" ","-")},settings:{type:"object",default:l.settings||{}}};return o&&(a.link={type:"boolean",default:!0}),{apiVersion:3,name:e,title:t,category:"dynamic",description:n,attributes:{...a,...r?.attributes||{}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0}},supports:{anchor:!1,className:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!1}}},...r||{}}})(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon||"plus-alt2",example:{attributes:{level:2}},edit:Ml(e),save:Al(e)}})})(e);break;case"image":(e=>{const t=(({name:e,title:t,description:n,metadata:o,defaults:r})=>({apiVersion:3,name:e,title:t,category:"dynamic",description:n,attributes:{anchor:{type:"string",default:t.toLowerCase().replace(" ","-")},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:r.alt||"",role:"content"},caption:{type:"string",source:"html",selector:".wp-block-image__caption",default:r.alt||void 0,role:"content"},href:{type:"string",source:"attribute",selector:"a",attribute:"href",default:r.href||"",role:"content"},width:{type:"string"},height:{type:"string"},settings:{type:"object",default:r.settings||{}}},supports:{anchor:!1,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0}}},noptin:{border:!0,align:!0},...o||{}}))(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon||ce,example:{attributes:{level:2}},edit:Bl(e),save:zl(e)}})})(e);break;case"button":(e=>{const t=(({name:e,title:t,description:n,metadata:o,defaults:r})=>({apiVersion:3,name:e,title:t,category:"noptin/button"===e?"content":"dynamic",description:n,keywords:["link","cta"],attributes:{url:{type:"string",source:"attribute",selector:"a",attribute:"href",role:"content",default:r.url||""},text:{type:"string",source:"html",selector:"a",role:"content",default:r.text||""},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel",role:"content"},placeholder:{type:"string",default:r.placeholder||void 0},style:{type:"object",default:{noptin:{border:{radius:"5px"},typography:{textTransform:"none",textDecoration:"none",textAlign:"center"}}}},width:{type:"number"},settings:{type:"object",default:r.settings||{}}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0},align:!0},supports:{anchor:!1,reusable:!1,shadow:!1,splitting:!0,spacing:{__experimentalSkipSerialization:!0,padding:["horizontal","vertical"],margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}},...o||{}}))(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon||"button",example:{attributes:{}},edit:Ll(e),save:function({attributes:e}){const{rel:t,text:n,url:o,width:r}=e,a=R(e),i=v(e),c=V(e),u=c?.style?.backgroundColor,p=c?.style?.color,d=Z.save(e,!0),m={...d.padding,..._(e),borderRadius:i?.borderRadius,margin:"0px",display:"block",color:p,wordBreak:"break-word"},g=s.useBlockProps.save({width:"100%",border:0,cellPadding:0,cellSpacing:0,role:"presentation",className:"noptin-button-block__wrapper"});return n?(0,l.createElement)("table",{...g},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:a},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:d.margin},(0,l.createElement)("table",{width:r?`${r}%`:void 0},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{bgcolor:u,role:"presentation",valign:"middle",className:"noptin-button-link__wrapper",style:{background:u,textAlign:m.textAlign,cursor:"auto",...i}},(0,l.createElement)(s.RichText.Content,{tagName:"a",className:"noptin-button-link",href:o,style:m,value:n,rel:t})))))))))):null}}})})(e);break;default:(e=>{const t=(({name:e,title:t,description:n,defaults:o,element:r,metadata:l})=>({apiVersion:3,name:e,title:t,category:"dynamic",description:n,attributes:{anchor:{type:"string",default:t.toLowerCase().replace(" ","-")},element:{type:"string",default:r||"p"},settings:{type:"object",default:o.settings||{}}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0,link:!0}},supports:{anchor:!1,className:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!1}},__experimentalSelector:r||"p"},...l||{}}))(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon||"plus-alt2",example:{attributes:{}},edit:Nl(e),save:Pl(e)}})})(e)}})({...e})})),jl.objects&&Object.keys(jl.objects).forEach((e=>{jl.objects[e].is_stand_alone&&((e=>{const t=(({name:e,label:t,singular_label:n,type:o,object_type:l,filters:a,query_defaults:i})=>{const s=i||{};return a&&Object.keys(a).forEach((e=>{(a[e].default||!1===a[e].default)&&(s[e]=a[e].default)})),{apiVersion:3,name:`noptin/${e.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}`,title:t,category:"dynamic",description:(0,r.sprintf)( +(0,r.__)("Hide parent section if no %s are found"),t.toLowerCase()),checked:a.hideParentSectionOnEmpty,onChange:()=>e({hideParentSectionOnEmpty:!a.hideParentSectionOnEmpty})}))),h&&(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.__experimentalToolsPanel,{className:"block-library-query-toolspanel__filters",label:(0,r.__)("Filters"),resetAll:()=>g(d),dropdownMenuProps:gl,as:"div"},Object.entries(o).map((([e,t])=>(0,l.createElement)(hl,{key:e,filterKey:e,filter:t,query:m,setQuery:g}))))),(0,l.createElement)("div",{...f}))};return e=>{const{clientId:t}=e,n=(0,S.useSelect)((e=>e(s.store).getBlocks(t).length>0),[t])?m:ir;return(0,l.createElement)(n,{...e})}},_l=({name:e})=>({attributes:t})=>{const{isStackedOnMobile:n,skipOnEmpty:o,query:r,columns:a}=t,i={..._(t),...v(t),...Z.save(t),...V(t).style},c={...r};Object.keys(c).forEach((e=>{""===c[e]&&delete c[e],"boolean"==typeof c[e]&&(c[e]=c[e]?"true":"false")}));const u=`noptin_${e}_list`,p=(0,de.addQueryArgs)("",c),d=t.hideParentSectionOnEmpty?' hide_parent_section_on_empty="yes"':"";return(0,l.createElement)("div",{...s.useBlockProps.save({style:i})},`[${u} query="${p.slice(1)}" columns=${a} responsive=${n?"yes":"no"} skiponempty=${o?"yes":"no"}${d}]`,(0,l.createElement)(s.InnerBlocks.Content,null),`[/${u}]`)},fl=(e,t)=>{let n=t||"";const o=n.includes("/")?n:"core/heading";return[o,{anchor:`block-${e}__list-heading`,style:{noptin:{typography:{fontSize:20,lineHeight:"1.3"}},spacing:{margin:{bottom:"10px"}}},..."core/heading"===o?{content:n}:{}}]},yl=(e,t,n="left")=>{if(t)return[t,{anchor:`block-${e}__list-action`,style:{noptin:{border:{radius:"5px"},typography:{textTransform:"none",textDecoration:"none",textAlign:"center"},align:n}}}]},vl=(e,t,n)=>{if(!t)return;const o=n?"10px":"0px";return[t,{anchor:`block-${e}__list-featured-image`,width:n?"150px":"",caption:"",style:{noptin:{typography:{textTransform:"none",textDecoration:"none",textAlign:"center"}},spacing:{margin:{top:o,bottom:o,right:o,left:o},padding:{right:"0px",left:"0px"}}}}]},xl=({name:e,type:t,template:n={}})=>{const{image:o,heading:l,description:a,meta:i,button:s}=n,c=`noptin/${t.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}-template`;return[{name:"list",title:(0,r.__)("List"),icon:go,isDefault:!0,attributes:{isStackedOnMobile:!1,columns:1,anchor:`block-${e}__list`,style:{noptin:{border:{border:{bottom:void 0,right:void 0,top:{color:"#e0dede",style:"solid",width:"1px"},left:void 0},radius:void 0}}}},innerBlocks:[[c,{style:{noptin:{border:{border:{top:void 0,right:void 0,bottom:{color:"#e0dede",style:"solid",width:"1px"},left:void 0},radius:void 0},color:{link:"#111111"}},spacing:{margin:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}},anchor:`block-${e}__list-template`},[["noptin/columns",{verticalAlignment:"middle",isStackedOnMobile:!0,anchor:`block-${e}__list-columns`},(0,w.compact)([o&&["noptin/column",{width:"150px",verticalAlignment:"middle",anchor:`block-${e}__list-column__left`,style:{spacing:{margin:{right:"0px",left:"0px",top:"0px",bottom:"0px"},padding:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}}},[vl(e,o,!0)]],["noptin/column",{width:"",verticalAlignment:"middle",anchor:`block-${e}__list-column__right`,style:{spacing:{margin:{right:"10px",left:"10px",top:"10px",bottom:"10px"},padding:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}}},(0,w.compact)([fl(e,l),a&&["core/paragraph",{content:a,anchor:`block-${e}__list-description`,style:{noptin:{typography:{lineHeight:"1.4"}},spacing:{margin:{bottom:"10px"}}}}],i&&["core/paragraph",{content:i,anchor:`block-${e}__list-meta`,style:{noptin:{color:{text:"#666666"},typography:{fontSize:13}},spacing:{margin:{bottom:"10px"}}}}],yl(e,s)])]])]]]],scope:["block"]},{name:"grid",title:(0,r.__)("Grid"),icon:"grid-view",isDefault:!1,attributes:{isStackedOnMobile:!0,columns:2,anchor:`block-${e}__grid`},innerBlocks:[[c,{style:{noptin:{border:{border:{color:"#e0dede",style:"solid",width:"1px"},radius:void 0},typography:{textAlign:"center"},color:{link:"#111111"}},spacing:{margin:{bottom:"24px"}}},anchor:`block-${e}__grid__template`},(0,w.compact)([vl(e,o,!1),fl(e,l),a&&["core/paragraph",{content:a,anchor:`block-${e}__list-description`,style:{noptin:{typography:{lineHeight:"1.4"}},spacing:{margin:{bottom:"10px"}}}}],i&&["core/paragraph",{content:i,anchor:`block-${e}__list-meta`,style:{noptin:{color:{text:"#666666"},typography:{fontSize:13}},spacing:{margin:{bottom:"10px"}}}}],yl(e,s,"center")])]],scope:["block"]}]},kl=(0,l.memo)((function({blocks:e,isHidden:t,setActiveBlockContextId:n,style:o,className:r}){const a=(0,s.__experimentalUseBlockPreview)({blocks:e,props:{className:r}});return(0,l.createElement)("div",{...a,tabIndex:0,role:"button",onClick:n,onKeyPress:n,style:{...o,display:t?"none":void 0}})}));function wl(e){return(0,l.createElement)("div",{...(0,s.useInnerBlocksProps)(e,{templateLock:!1})})}const El=({name:e,isStackedOnMobile:t,columns:n,totalRecords:o,attributes:r,clientId:i})=>{const c=(e=>{if(1===e)return"100%";const t=1e12;return Math.round(100/e*t)/t+"%"})(n),u=Array(o).fill(0),p=Array.from({length:n},(()=>[]));u.forEach(((e,t)=>{p[t%n].push(t)}));const[d,m]=(0,l.useState)("0.0"),g={..._(r),...v(r),...Z(r),...V(r).style},h=k("noptin-records__wrapper",`noptin-${e}__wrapper`,{[`noptin-columns noptin-columns__${n}`]:n>1,"noptin-is-stacked-on-mobile":n>1&&t}),b=k("noptin-records__column",`noptin-${e}__column`,{"noptin-column":n>1,"noptin-is-stacked-on-mobile":n>1&&t}),f=(0,S.useSelect)((e=>e(s.store).getBlocks(i)),[i]);return(0,l.createElement)("div",{...(0,s.useBlockProps)({className:h})},p.map(((e,t)=>(0,l.createElement)("div",{key:t,className:b,style:{width:c}},0===e.length&&(0,l.createElement)("span",null,"nbsp;"),e.map((e=>{const n=`${t}.${e}`;return(0,l.createElement)(a().Fragment,{key:n},n===d&&(0,l.createElement)(wl,{style:g,className:"noptin-record"}),f.length>0&&(0,l.createElement)(kl,{blocks:f,style:g,className:"noptin-record",setActiveBlockContextId:()=>m(n),isHidden:n===d}))}))))))},Cl=({name:e})=>({attributes:t,context:n,clientId:o})=>{const r=n[`noptin/${e}/isStackedOnMobile`],a=n[`noptin/${e}/columns`]||1,i=n[`noptin/${e}/query`]?.number||10;return(0,l.createElement)(El,{name:e,isStackedOnMobile:r,columns:a,totalRecords:i,attributes:t,clientId:o})},Sl=()=>({attributes:e})=>{const t={..._(e),...v(e),...Z.save(e),...V(e).style};return(0,l.createElement)("div",{...s.useBlockProps.save({style:t,className:"noptin-record"})},(0,l.createElement)(s.InnerBlocks.Content,null))},Bl={};window.RECORD_TEMPLATE_BLOCKS=Bl;function Il({attributes:e,setAttributes:t,isSelected:n,insertBlocksAfter:a,clientId:c,settings:u}){const{alt:p,caption:d,href:m,width:g,height:h,scale:b}=e,_=(0,E.usePrevious)(d),[f,y]=(0,l.useState)(!!d);(0,l.useEffect)((()=>{d&&!_&&y(!0)}),[d,_]);const v=(0,l.useCallback)((e=>{e&&!d&&e.focus()}),[d]);(0,l.useEffect)((()=>{n||d||y(!1)}),[n,d]);const x=(0,i.__experimentalUseCustomUnits)({availableUnits:["px"]});let k;return k=g&&h?`https://placehold.co/${parseInt(g)}x${parseInt(h)}`:g?`https://placehold.co/${parseInt(g)}`:h?`https://placehold.co/${parseInt(h)}`:"https://placehold.co/600",(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(i.ToolbarButton,{onClick:()=>{y(!f),f&&d&&t({caption:void 0})},icon:me,isPressed:f,label:f?(0,r.__)("Remove caption"):(0,r.__)("Add caption")})),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.__experimentalToolsPanel,{label:(0,r.__)("Settings"),panelId:c,resetAll:()=>{t({width:void 0,height:void 0})}},(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Alternative text"),isShownByDefault:!0,hasValue:()=>""!==p,panelId:c,onDeselect:()=>t({alt:void 0})},(0,l.createElement)(io,{settingKey:"alt",saved:e,setAttributes:t,setting:{el:"textarea",label:(0,r.__)("Alternative text"),description:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,r.__)("Describe the purpose of the image.")),(0,l.createElement)("br",null),(0,r.__)("Leave empty if decorative."))}})),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Link to"),isShownByDefault:!0,hasValue:()=>!!m,panelId:c,onDeselect:()=>t({href:void 0})},(0,l.createElement)(io,{settingKey:"href",saved:e,setAttributes:t,setting:{el:"input",type:"text",label:(0,r.__)("Link to"),description:(0,r.__)("Enter URL to make the image a link.")}})),u&&Object.entries(u).map((([n,o])=>(0,l.createElement)(i.__experimentalToolsPanelItem,{label:o.label,isShownByDefault:!0,hasValue:()=>""!==e[n]&&void 0!==e[n],onDeselect:()=>t({key:void 0}),panelId:c,key:n},(0,l.createElement)(io,{settingKey:n,prop:"settings",saved:e,setAttributes:t,setting:o})))),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Width"),isShownByDefault:!0,hasValue:()=>!!g,onDeselect:()=>t({width:void 0}),panelId:c,style:{gridColumn:"span 1"}},(0,l.createElement)(s.__experimentalUnitControl,{label:(0,r.__)("Width"),placeholder:(0,r.__)("Auto"),labelPosition:"top",min:0,value:g||"",onChange:e=>t({width:e}),size:"__unstable-large"})),(0,l.createElement)(i.__experimentalToolsPanelItem,{label:(0,r.__)("Height"),isShownByDefault:!0,hasValue:()=>!!h,onDeselect:()=>t({height:void 0}),panelId:c,style:{gridColumn:"span 1"}},(0,l.createElement)(s.__experimentalUnitControl,{label:(0,r.__)("Height"),placeholder:(0,r.__)("Auto"),labelPosition:"top",units:x,min:0,value:h||"",onChange:e=>t({height:e}),size:"__unstable-large"})))),(0,l.createElement)(xe,{href:m},(0,l.createElement)("img",{src:`${k}/31343c/fff.png?text=Placeholder`,alt:p||"Placeholder Image",style:{width:!g&&h?"auto":g,height:h,objectFit:b,maxWidth:"100%"}})),f&&(!s.RichText.isEmpty(d)||n)&&(0,l.createElement)(s.RichText,{identifier:"caption",ref:v,className:"wp-block-image__caption",tagName:"div","aria-label":(0,r.__)("Image caption text"),placeholder:(0,r.__)("Add caption"),value:d,onChange:e=>t({caption:e}),inlineToolbar:!0,__unstableOnSplitAtEnd:()=>a((0,o.createBlock)((0,o.getDefaultBlockName)())),style:{fontSize:"12px",textAlign:"center",marginTop:"12px"}}))}const Tl=({settings:e})=>function({attributes:t,setAttributes:n,isSelected:o,insertBlocksAfter:r,clientId:a}){const i=R(t);(0,l.useEffect)((()=>{t.width&&/^\d+$/.test(t.width)&&n({width:`${t.width}px`})}),[t.width]);const c={className:"noptin-image-block__wrapper",border:0,cellPadding:"0",cellSpacing:"0"};"left"!==i&&"right"!==i||(c.align=i,c.className+=" noptin-image-block__wrapper-is-aligned");const u=(0,s.useBlockProps)(c),p={...v(t),...Z(t),display:"inline-block",maxWidth:"100%"};return(0,l.createElement)("table",{...u},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:i,className:k({"is-selected":o})},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:p},(0,l.createElement)(Il,{attributes:t,setAttributes:n,isSelected:o,insertBlocksAfter:r,clientId:a,settings:e}))))))},Ml=(e,t)=>{let n="";return e&&Object.entries(e).forEach((([e,t])=>{if(t||0===t||!1===t){let o=t;"boolean"==typeof o&&(o=o?1:0),n+="number"==typeof o?` ${e}=${o}`:` ${e}="${o}"`}})),`[[${t}${n}]]`},zl=({settings:e,attributes:t,setAttributes:n})=>e?(0,l.createElement)(l.Fragment,null,Object.entries(e).map((([e,o])=>(0,l.createElement)(io,{key:e,settingKey:e,saved:t,prop:"settings",setAttributes:n,setting:o})))):null,Al=({mergeTag:e,settings:t,linksTo:n})=>function({attributes:o,setAttributes:a}){const c=o.link&&!!n,u={..._(o),...v(o),...Z(o),...V(o).style},p=(0,s.useBlockProps)({style:c?{cursor:"pointer"}:u}),d="h"+o.level,m=Ml(o.settings,e);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.BlockControls,{group:"block"},(0,l.createElement)(s.HeadingLevelDropdown,{value:o.level,onChange:e=>a({level:e})}),n&&(0,l.createElement)(i.ToolbarButton,{icon:"admin-links",label:(0,r.__)("Link"),onClick:()=>a({link:!o.link}),isPressed:o.link,size:"compact"})),t&&(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,null,(0,l.createElement)(i.__experimentalVStack,null,(0,l.createElement)(zl,{settings:t,attributes:o,setAttributes:a})))),(0,l.createElement)((()=>c?(0,l.createElement)(d,{...p},(0,l.createElement)("a",{href:`${n}`,onClick:e=>e.preventDefault(),style:u},m)):(0,l.createElement)(d,{...p},m)),null))},Pl=({mergeTag:e})=>function({attributes:t}){const{alt:n,caption:o,href:r,width:a,height:i}=t,c=R(t),u=Ml(t.settings,e),p=(0,l.createElement)("img",{src:u,alt:n,width:a&&a.endsWith("px")?a.slice(0,-2):void 0,border:"0",style:{width:!a&&i?"auto":a,height:i,maxWidth:"100%"}}),d={...v(t),...Z.save(t),display:"inline-block",maxWidth:"100%"},m=(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:d},r?(0,l.createElement)("a",{href:r,style:{display:"block",textDecoration:"none",maxWidth:"100%",lineHeight:0}},p):p,!s.RichText.isEmpty(o)&&(0,l.createElement)(s.RichText.Content,{className:"wp-block-image__caption",tagName:"div",value:o,style:{fontSize:"12px",textAlign:"center",marginTop:"12px"}})),g={className:"noptin-image-block__wrapper",border:0,cellPadding:"0",cellSpacing:"0",role:"presentation"};return"left"!==c&&"right"!==c||(g.align=c,g.className+=" noptin-image-block__wrapper-is-aligned"),(0,l.createElement)("table",{...s.useBlockProps.save(g)},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:c},m))))},Nl=({mergeTag:e,linksTo:t})=>function({attributes:n}){const o="h"+n.level,r=Ml(n.settings,e),a=n.link&&!!t,i={..._(n),...v(n),...Z.save(n),...V(n).style},c=s.useBlockProps.save({style:a?{cursor:"pointer"}:i});return a?(0,l.createElement)("a",{href:`${t}`,...c},(0,l.createElement)(o,{style:i},r)):(0,l.createElement)(o,{...c},r)},Hl=({mergeTag:e,settings:t})=>function({attributes:n,setAttributes:o}){const r=(0,s.useBlockProps)({className:"noptin-block__margin-wrapper",style:{..._(n),...v(n),...Z(n),...V(n).style}}),a=n.element||"p";return(0,l.createElement)(l.Fragment,null,t&&(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,null,(0,l.createElement)(i.__experimentalVStack,null,(0,l.createElement)(zl,{attributes:n,setAttributes:o,settings:t})))),(0,l.createElement)(a,{...r},Ml(n.settings,e)))},Ll=({mergeTag:e})=>function({attributes:t}){const n=s.useBlockProps.save({className:"noptin-block__margin-wrapper",style:{..._(t),...v(t),...Z.save(t),...V(t).style}}),o=t.element||"p";return(0,l.createElement)(o,{...n},Ml(t.settings,e))},Vl={el:"input",type:"text",label:(0,r.__)("Button URL"),description:(0,r.__)("The URL to link to.")},$l=({settings:e})=>function(t){const{attributes:n,setAttributes:a,isSelected:c,onReplace:u,mergeBlocks:p,clientId:d}=t,{placeholder:m,rel:g,text:h,width:b}=n,f=R(n),y=_(n),[x,k]=(0,l.useState)(null),w=v(n),C=V(n).style,B=Z(n,!0),I=(0,l.useRef)(),T=(0,l.useRef)(),M=(0,s.useBlockProps)({ref:(0,E.useMergeRefs)([k,I]),width:"100%",border:0,cellPadding:0,cellSpacing:0,role:"presentation",className:"noptin-button-block__wrapper"}),[z,A]=(0,l.useState)(!0);(0,l.useEffect)((()=>{c&&A(!0)}),[c]);const P=function(e){const{replaceBlocks:t,selectionChange:n}=(0,S.useDispatch)(s.store),{getBlock:r,getBlockRootClientId:a,getBlockIndex:i}=(0,S.useSelect)(s.store),c=(0,l.useRef)(e);return c.current=e,(0,E.useRefEffect)((e=>{function l(e){if(e.defaultPrevented||e.keyCode!==K.ENTER)return;const{content:l,clientId:s}=c.current;if(l.length)return;e.preventDefault();const u=r(a(s)),p=i(s),d=(0,o.cloneBlock)({...u,innerBlocks:u.innerBlocks.slice(0,p)}),m=(0,o.createBlock)((0,o.getDefaultBlockName)()),g=u.innerBlocks.slice(p+1),h=g.length?[(0,o.cloneBlock)({...u,innerBlocks:g})]:[];t(u.clientId,[d,m,...h],1),n(m.clientId)}return e.addEventListener("keydown",l),()=>{e.removeEventListener("keydown",l)}}),[])}({content:h,clientId:d}),N=(0,E.useMergeRefs)([P,T]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("table",{...M},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:f},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:B.margin},(0,l.createElement)("table",{width:b?`${b}%`:void 0},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{bgcolor:C.backgroundColor,role:"presentation",valign:"middle",className:"noptin-button-link__wrapper",style:{background:C.backgroundColor,textAlign:y?.textAlign,cursor:"auto",...w}},(0,l.createElement)(s.RichText,{ref:N,tagName:"span","aria-label":(0,r.__)("Button text"),placeholder:m||(0,r.__)("Add text…"),value:h,onChange:e=>a({text:Ae(e)}),withoutInteractiveFormatting:!0,className:"noptin-button-link",style:{...B.padding,...y||{},color:C.color,margin:"0px",display:"block"},onReplace:u,onMerge:p,identifier:"text"})))))))))),c&&z&&(0,l.createElement)(i.Popover,{placement:"bottom",onClose:()=>{A(!1),T.current?.focus()},anchor:x,focusOnMount:!1,__unstableSlotName:"__unstable-block-tools-after",shift:!0},(0,l.createElement)("div",{style:{padding:"1em",minWidth:240}},(0,l.createElement)(io,{settingKey:"url",saved:n,setAttributes:a,setting:Vl}))),(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(io,{settingKey:"url",saved:n,setAttributes:a,setting:Vl}),(0,l.createElement)(zl,{settings:e,attributes:n,setAttributes:a}),(0,l.createElement)(i.__experimentalToggleGroupControl,{label:(0,r.__)("Button width"),className:"noptin-toggle-group-control",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isAdaptiveWidth:!0,isBlock:!0,isDeselectable:!0,onChange:function(e){const t=n.width===e?void 0:e;a({width:t})}},[25,50,75,100].map((e=>(0,l.createElement)(i.__experimentalToggleGroupControlOption,{key:e,label:`${e}%`,value:e})))))),(0,l.createElement)(s.InspectorControls,{group:"advanced"},(0,l.createElement)(i.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Link rel"),value:g||"",onChange:e=>a({rel:e})})))},Rl=(e,t)=>{let n=t||"";const o=n.includes("/")?n:"core/heading";return[o,{anchor:`block-${e}__list-heading`,style:{noptin:{typography:{fontSize:20,lineHeight:"1.3"}},spacing:{margin:{bottom:"10px"}}},..."core/heading"===o?{content:n}:{}}]},Dl=(e,t,n="left")=>{if(t)return[t,{anchor:`block-${e}__list-action`,style:{noptin:{border:{radius:"5px"},typography:{textTransform:"none",textDecoration:"none",textAlign:"center"},align:n}}}]},Ol=(e,t,n)=>{if(!t)return;const o=n?"10px":"0px";return[t,{anchor:`block-${e}__list-featured-image`,width:n?"150px":"",caption:"",style:{noptin:{typography:{textTransform:"none",textDecoration:"none",textAlign:"center"}},spacing:{margin:{top:o,bottom:o,right:o,left:o},padding:{right:"0px",left:"0px"}}}}]},jl={};window.DYNAMIC_RECORD_TEMPLATE_BLOCKS=jl;const Fl={},Ul=window.noptinEmailEditorSettings||{};window.initNoptinBlocks=()=>{var e,t,n;(0,o.setCategories)([{slug:"content",title:(0,r.__)("Content"),icon:"admin-generic"},{slug:"dynamic",title:(0,r.__)("Dynamic","newsletter-optin-box"),icon:"image-filter"},{slug:"design",title:(0,r.__)("Design","newsletter-optin-box"),icon:"welcome-widgets-menus"}]),G({name:ee,metadata:X,settings:te}),G({name:le,metadata:ne,settings:ae}),G({name:Me,metadata:Ce,settings:ze}),G({name:Ve,metadata:He,settings:$e}),G({name:Ge,metadata:We,settings:qe}),G({name:po,metadata:so,settings:mo}),G({name:Ao,metadata:Co,settings:Po}),G({name:Uo,metadata:Oo,settings:Wo}),G({name:qo,metadata:Go,settings:Zo}),G({name:Jo,metadata:Yo,settings:er}),G({name:dr,metadata:sr,settings:mr}),G({name:_r,metadata:br,settings:fr}),G({name:kr,metadata:vr,settings:wr}),G({name:Sr,metadata:Cr,settings:Br}),G({name:zr,metadata:Mr,settings:Ar}),G({name:Lr,metadata:Pr,settings:Vr}),G({name:ul,metadata:ll,settings:pl}),e=Ul.dynamicBlocks||{},t=Ul.context,n=Ul.objects,e.forEach((e=>{Array.isArray(e.metadata?.ancestor)&&Array.isArray(t)&&e.metadata.ancestor.some((e=>t.includes(e)))&&delete e.metadata.ancestor,e.element&&n[e.element]&&(((e,t)=>{const n=(({blockName:e,title:t,description:n,metadata:o})=>({apiVersion:3,name:e,title:t,category:"dynamic",description:n,attributes:{isStackedOnMobile:{type:"boolean",default:!0},columns:{type:"number",default:1},number:{type:"number",default:3}},providesContext:{[`${e}/isStackedOnMobile`]:"isStackedOnMobile",[`${e}/columns`]:"columns",[`${e}/number`]:"number"},noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,__experimentalExposeControlsToChildren:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,__experimentalDefaultControls:{margin:!0}}},...o||{}}))({blockName:e.name,title:e.title,description:e.description,metadata:e.metadata}),o=(({name:e,mergeTag:t})=>({attributes:n})=>{const{isStackedOnMobile:o,number:r,columns:a}=n,i={..._(n),...v(n),...Z.save(n),...V(n).style},c=`noptin_${e}_list`;return(0,l.createElement)("div",{...s.useBlockProps.save({style:i})},`[${c} merge_tag="${t}" number="${r}" columns=${a} responsive=${o?"yes":"no"}]`,(0,l.createElement)(s.InnerBlocks.Content,null),`[/${c}]`)})({name:t.name,mergeTag:e.mergeTag}),a=(({blockName:e,label:t})=>{const n=`${e}-template`,o=[n],a=[[n]],c=({setAttributes:e,attributes:n})=>{const c=n.columns>1,u=(0,s.useBlockProps)({style:{..._(n),...v(n),...Z(n),...V(n).style}}),p=(0,s.useInnerBlocksProps)(u,{allowedBlocks:o,renderAppender:!1,template:a,templateLock:"all"});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(i.PanelBody,{title:(0,r.__)("Settings")},(0,l.createElement)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,r.sprintf)(/* translators: %s: plural name of the post type */ /* translators: %s: plural name of the post type */ +(0,r.__)("Number of %s to show"),t),value:n.number,onChange:t=>e({number:t}),min:1,max:20}),(0,l.createElement)(i.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,r.__)("Columns"),value:n.columns,onChange:t=>e({columns:t}),min:1,max:4}),c&&(0,l.createElement)(i.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Stack on mobile"),checked:n.isStackedOnMobile,onChange:()=>e({isStackedOnMobile:!n.isStackedOnMobile})}))),(0,l.createElement)("div",{...p}))};return e=>{const{clientId:t}=e,n=(0,S.useSelect)((e=>e(s.store).getBlocks(t).length>0),[t])?c:ir;return(0,l.createElement)(n,{...e})}})({blockName:e.name,label:t.label}),c=(({blockName:e,name:t,template:n={}})=>{const{image:o,heading:l,description:a,meta:i,button:s}=n,c=`${e}-template`;return[{name:"list",title:(0,r.__)("List"),icon:go,isDefault:!0,attributes:{isStackedOnMobile:!1,columns:1,anchor:`block-${t}__list`,style:{noptin:{border:{border:{bottom:void 0,right:void 0,top:{color:"#e0dede",style:"solid",width:"1px"},left:void 0},radius:void 0}}}},innerBlocks:[[c,{style:{noptin:{border:{border:{top:void 0,right:void 0,bottom:{color:"#e0dede",style:"solid",width:"1px"},left:void 0},radius:void 0},color:{link:"#111111"}},spacing:{margin:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}},anchor:`block-${t}__list-template`},[["noptin/columns",{verticalAlignment:"middle",isStackedOnMobile:!0,anchor:`block-${t}__list-columns`},(0,w.compact)([o&&["noptin/column",{width:"150px",verticalAlignment:"middle",anchor:`block-${t}__list-column__left`,style:{spacing:{margin:{right:"0px",left:"0px",top:"0px",bottom:"0px"},padding:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}}},[Ol(t,o,!0)]],["noptin/column",{width:"",verticalAlignment:"middle",anchor:`block-${t}__list-column__right`,style:{spacing:{margin:{right:"10px",left:"10px",top:"10px",bottom:"10px"},padding:{right:"0px",left:"0px",top:"0px",bottom:"0px"}}}},(0,w.compact)([Rl(t,l),a&&["core/paragraph",{content:a,anchor:`block-${t}__list-description`,style:{noptin:{typography:{lineHeight:"1.4"}},spacing:{margin:{bottom:"10px"}}}}],i&&["core/paragraph",{content:i,anchor:`block-${t}__list-meta`,style:{noptin:{color:{text:"#666666"},typography:{fontSize:13}},spacing:{margin:{bottom:"10px"}}}}],Dl(t,s)])]])]]]],scope:["block"]},{name:"grid",title:(0,r.__)("Grid"),icon:"grid-view",isDefault:!1,attributes:{isStackedOnMobile:!0,columns:2,anchor:`block-${t}__grid`},innerBlocks:[[c,{style:{noptin:{border:{border:{color:"#e0dede",style:"solid",width:"1px"},radius:void 0},typography:{textAlign:"center"},color:{link:"#111111"}},spacing:{margin:{bottom:"24px"}}},anchor:`block-${t}__grid__template`},(0,w.compact)([Ol(t,o,!1),Rl(t,l),a&&["core/paragraph",{content:a,anchor:`block-${t}__list-description`,style:{noptin:{typography:{lineHeight:"1.4"}},spacing:{margin:{bottom:"10px"}}}}],i&&["core/paragraph",{content:i,anchor:`block-${t}__list-meta`,style:{noptin:{color:{text:"#666666"},typography:{fontSize:13}},spacing:{margin:{bottom:"10px"}}}}],Dl(t,s,"center")])]],scope:["block"]}]})({blockName:e.name,name:t.name,template:Array.isArray(t.template)?{}:t.template}),u={icon:t.icon,edit:a,save:o,variations:c};G({name:e.name,metadata:n,settings:u})})({...e},{...n[e.element]}),((e,t)=>{const n=(({blockName:e,singularLabel:t})=>({apiVersion:3,name:`${e}-template`,parent:[e],title:(0,r.sprintf)((0,r.__)("%s Template","newsletter-optin-box"),t),category:"dynamic",description:(0,r.sprintf)((0,r.__)("Contains the block elements used to render a %s","newsletter-optin-box"),t),attributes:{style:{type:"object",default:{noptin:{border:{border:{color:"#95a5a6",width:"1px"},radius:"4px"}}}}},usesContext:[`${e}/isStackedOnMobile`,`${e}/columns`,`${e}/number`],noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,className:!1,customClassName:!1,spacing:{__experimentalSkipSerialization:!0,padding:!0,margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}}}))({blockName:e.name,singularLabel:t.singular_label}),{name:o}=n;jl[o]={type:t.type,provides:Array.isArray(t.provides)?t.provides:[]};const a=(({name:e,blockName:t})=>({attributes:n,context:o,clientId:r})=>{const a=o[`${t}/isStackedOnMobile`],i=o[`${t}/columns`]||1,s=o[`${t}/number`]||10;return(0,l.createElement)(El,{name:e,isStackedOnMobile:a,columns:i,totalRecords:s,attributes:n,clientId:r})})({blockName:e.name,name:t.name});G({name:o,metadata:n,settings:{icon:"art",edit:a,save:Sl()}})})({...e},{...n[e.element]}),Array.isArray(n[e.element].provides)&&n[e.element].provides.forEach((t=>{const n=`noptin/${t}-template`;Fl[n]=Fl[n]||[],Fl[n].push(`${e.name}-template`)})))})),e.forEach((e=>{if(Array.isArray(e.metadata?.ancestor)&&Array.isArray(t))if(e.metadata.ancestor.some((e=>t.includes(e))))delete e.metadata.ancestor;else{const t=[...e.metadata.ancestor];e.metadata.ancestor.forEach((e=>{Fl[e]&&t.push(...Fl[e])})),e.metadata.ancestor=t}e.element&&n[e.element]||(e=>{switch(e.defaults||(e.defaults={}),e.settings&&Object.entries(e.settings).forEach((([t,n])=>{void 0!==n.default&&(e.defaults[t]=n.default)})),e.element){case"heading":(e=>{const t=(({name:e,title:t,description:n,linksTo:o,metadata:r,defaults:l})=>{const a={level:{type:"number",default:l.level||2},anchor:{type:"string",default:t.toLowerCase().replace(" ","-")},settings:{type:"object",default:l.settings||{}}};return o&&(a.link={type:"boolean",default:!0}),{apiVersion:3,name:e,title:t,category:"dynamic",description:n,attributes:{...a,...r?.attributes||{}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0}},supports:{anchor:!1,className:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!1}}},...r||{}}})(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon||"plus-alt2",example:{attributes:{level:2}},edit:Al(e),save:Nl(e)}})})(e);break;case"image":(e=>{const t=(({name:e,title:t,description:n,metadata:o,defaults:r})=>({apiVersion:3,name:e,title:t,category:"dynamic",description:n,attributes:{anchor:{type:"string",default:t.toLowerCase().replace(" ","-")},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:r.alt||"",role:"content"},caption:{type:"string",source:"html",selector:".wp-block-image__caption",default:r.alt||void 0,role:"content"},href:{type:"string",source:"attribute",selector:"a",attribute:"href",default:r.href||"",role:"content"},width:{type:"string"},height:{type:"string"},settings:{type:"object",default:r.settings||{}}},supports:{anchor:!1,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0}}},noptin:{border:!0,align:!0},...o||{}}))(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon||ce,example:{attributes:{level:2}},edit:Tl(e),save:Pl(e)}})})(e);break;case"button":(e=>{const t=(({name:e,title:t,description:n,metadata:o,defaults:r})=>({apiVersion:3,name:e,title:t,category:"noptin/button"===e?"content":"dynamic",description:n,keywords:["link","cta"],attributes:{url:{type:"string",source:"attribute",selector:"a",attribute:"href",role:"content",default:r.url||""},text:{type:"string",source:"html",selector:"a",role:"content",default:r.text||""},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel",role:"content"},placeholder:{type:"string",default:r.placeholder||void 0},style:{type:"object",default:{noptin:{border:{radius:"5px"},typography:{textTransform:"none",textDecoration:"none",textAlign:"center"}}}},width:{type:"number"},settings:{type:"object",default:r.settings||{}}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0},align:!0},supports:{anchor:!1,reusable:!1,shadow:!1,splitting:!0,spacing:{__experimentalSkipSerialization:!0,padding:["horizontal","vertical"],margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}},...o||{}}))(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon||"button",example:{attributes:{}},edit:$l(e),save:function({attributes:e}){const{rel:t,text:n,url:o,width:r}=e,a=R(e),i=v(e),c=V(e),u=c?.style?.backgroundColor,p=c?.style?.color,d=Z.save(e,!0),m={...d.padding,..._(e),borderRadius:i?.borderRadius,margin:"0px",display:"block",color:p,wordBreak:"break-word"},g=s.useBlockProps.save({width:"100%",border:0,cellPadding:0,cellSpacing:0,role:"presentation",className:"noptin-button-block__wrapper"});return n?(0,l.createElement)("table",{...g},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{align:a},(0,l.createElement)("div",{className:"noptin-block__margin-wrapper",style:d.margin},(0,l.createElement)("table",{width:r?`${r}%`:void 0},(0,l.createElement)("tbody",null,(0,l.createElement)("tr",null,(0,l.createElement)("td",{bgcolor:u,role:"presentation",valign:"middle",className:"noptin-button-link__wrapper",style:{background:u,textAlign:m.textAlign,cursor:"auto",...i}},(0,l.createElement)(s.RichText.Content,{tagName:"a",className:"noptin-button-link",href:o,style:m,value:n,rel:t})))))))))):null}}})})(e);break;default:(e=>{const t=(({name:e,title:t,description:n,defaults:o,element:r,metadata:l})=>({apiVersion:3,name:e,title:t,category:"dynamic",description:n,attributes:{anchor:{type:"string",default:t.toLowerCase().replace(" ","-")},element:{type:"string",default:r||"p"},settings:{type:"object",default:o.settings||{}}},noptin:{typography:!0,border:!0,color:{background:!0,text:!0,link:!0}},supports:{anchor:!1,className:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0,__experimentalDefaultControls:{margin:!0,padding:!1}},__experimentalSelector:r||"p"},...l||{}}))(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon||"plus-alt2",example:{attributes:{}},edit:Hl(e),save:Ll(e)}})})(e)}})({...e})})),Ul.objects&&Object.keys(Ul.objects).forEach((e=>{Ul.objects[e].is_stand_alone&&((e=>{const t=(({name:e,label:t,singular_label:n,type:o,object_type:l,filters:a,query_defaults:i})=>{const s=i||{};return a&&Object.keys(a).forEach((e=>{(a[e].default||!1===a[e].default)&&(s[e]=a[e].default)})),{apiVersion:3,name:`noptin/${e.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}`,title:t,category:"dynamic",description:(0,r.sprintf)( // translators: %s: Collection, e.g, "Products" // translators: %s: Collection, e.g, "Products" -(0,r.__)("Displays %s in a list or a grid","newsletter-optin-box"),t),keywords:[n,o,l,e,t],attributes:{query:{type:"object",default:{number:10,order:"desc",orderby:"date",...s}},skipOnEmpty:{type:"boolean",default:!1},hideParentSectionOnEmpty:{type:"boolean",default:!1},isStackedOnMobile:{type:"boolean",default:!0},columns:{type:"number",default:1}},providesContext:{[`noptin/${e}/query`]:"query",[`noptin/${e}/isStackedOnMobile`]:"isStackedOnMobile",[`noptin/${e}/columns`]:"columns"},noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,__experimentalExposeControlsToChildren:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,__experimentalDefaultControls:{margin:!0}}}}})(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon,edit:gl(e),save:hl(e),variations:yl(e)}})})(jl.objects[e]),(e=>{const t=(({name:e,type:t,singular_label:n})=>({apiVersion:3,name:`noptin/${t.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}-template`,parent:[`noptin/${e.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}`],title:(0,r.sprintf)((0,r.__)("%s Template","newsletter-optin-box"),n),category:"dynamic",description:(0,r.sprintf)( +(0,r.__)("Displays %s in a list or a grid","newsletter-optin-box"),t),keywords:[n,o,l,e,t],attributes:{query:{type:"object",default:{number:10,order:"desc",orderby:"date",...s}},skipOnEmpty:{type:"boolean",default:!1},hideParentSectionOnEmpty:{type:"boolean",default:!1},isStackedOnMobile:{type:"boolean",default:!0},columns:{type:"number",default:1}},providesContext:{[`noptin/${e}/query`]:"query",[`noptin/${e}/isStackedOnMobile`]:"isStackedOnMobile",[`noptin/${e}/columns`]:"columns"},noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,__experimentalExposeControlsToChildren:!0,spacing:{__experimentalSkipSerialization:!0,margin:!0,__experimentalDefaultControls:{margin:!0}}}}})(e),{name:n}=t;G({name:n,metadata:t,settings:{icon:e.icon,edit:bl(e),save:_l(e),variations:xl(e)}})})(Ul.objects[e]),(e=>{const t=(({name:e,type:t,singular_label:n})=>({apiVersion:3,name:`noptin/${t.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}-template`,parent:[`noptin/${e.toLowerCase().replace(/[^a-z0-9\-]/g,"-")}`],title:(0,r.sprintf)((0,r.__)("%s Template","newsletter-optin-box"),n),category:"dynamic",description:(0,r.sprintf)( // translators: %s: Singular label, e.g, "Product" // translators: %s: Singular label, e.g, "Product" -(0,r.__)("Contains the block elements used to render a %s","newsletter-optin-box"),n),attributes:{style:{type:"object",default:{noptin:{border:{border:{color:"#95a5a6",width:"1px"},radius:"4px"}}}}},usesContext:[`noptin/${e}/isStackedOnMobile`,`noptin/${e}/columns`,`noptin/${e}/query`],noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,className:!1,customClassName:!1,spacing:{__experimentalSkipSerialization:!0,padding:!0,margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}}}))(e),{name:n}=t;Cl[n]={type:e.type,provides:Array.isArray(e.provides)?e.provides:[]},G({name:n,metadata:t,settings:{icon:"art",edit:wl(e),save:El()}})})(jl.objects[e]))})),(0,o.setDefaultBlockName)("core/paragraph"),(0,o.setFreeformContentHandlerName)("core/html"),(0,o.setUnregisteredTypeHandlerName)("core/missing"),(0,o.setGroupingBlockName)("noptin/group")}})(); \ No newline at end of file +(0,r.__)("Contains the block elements used to render a %s","newsletter-optin-box"),n),attributes:{style:{type:"object",default:{noptin:{border:{border:{color:"#95a5a6",width:"1px"},radius:"4px"}}}}},usesContext:[`noptin/${e}/isStackedOnMobile`,`noptin/${e}/columns`,`noptin/${e}/query`],noptin:{typography:!0,border:!0,color:!0},supports:{anchor:!1,html:!1,className:!1,customClassName:!1,spacing:{__experimentalSkipSerialization:!0,padding:!0,margin:!0,__experimentalDefaultControls:{padding:!0,margin:!0}}}}))(e),{name:n}=t;Bl[n]={type:e.type,provides:Array.isArray(e.provides)?e.provides:[]},G({name:n,metadata:t,settings:{icon:"art",edit:Cl(e),save:Sl()}})})(Ul.objects[e]))})),(0,o.setDefaultBlockName)("core/paragraph"),(0,o.setFreeformContentHandlerName)("core/html"),(0,o.setUnregisteredTypeHandlerName)("core/missing"),(0,o.setGroupingBlockName)("noptin/group")}})(); \ No newline at end of file diff --git a/build/Emails/assets/js/view-campaigns.asset.php b/build/Emails/assets/js/view-campaigns.asset.php index 8f8479a3..cfe9eb81 100644 --- a/build/Emails/assets/js/view-campaigns.asset.php +++ b/build/Emails/assets/js/view-campaigns.asset.php @@ -1 +1 @@ - array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'd453b6e329cb393190ca'); + array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '1ddf6befb0807111671a'); diff --git a/build/Emails/assets/js/view-campaigns.js b/build/Emails/assets/js/view-campaigns.js index 1b3746d3..eea05081 100644 --- a/build/Emails/assets/js/view-campaigns.js +++ b/build/Emails/assets/js/view-campaigns.js @@ -8,7 +8,7 @@ // translators: %s: description, e.g, "Send an email to the site admin." // translators: %s: description, e.g, "Send an email to the site admin." (0,u.__)("Send an email to the %s","newsletter-optin-box"),a)}}))),t)),{})})},select_template:{title:(0,u.__)("Select Template","newsletter-optin-box"),show:!c.data?.child_type&&!!c.templates,arg:"noptin_email_template",cardGroups:e=>{const t={blank:{label:(0,u.__)("Default","newsletter-optin-box"),orderFirst:!0,forcePremium:!1,isTemplate:!0}};return Array.isArray(c.local_templates)&&c.local_templates.forEach((e=>{t[`${e.slug}__local`]={label:e.name,forcePremium:!1,isTemplate:!0,useValue:`noptin_campaign_${e.id}`,selectText:(0,u.__)("Use Template","newsletter-optin-box")}})),Array.isArray(c.templates)&&c.templates.forEach((n=>{e?.select_type&&!1===S?.[e?.select_type]?.supports_general_templates&&e?.select_type!==n.templateType||(t[n.slug]={image:n.image||n.image_url,label:n.name,forcePremium:!0,isTemplate:!0,useValue:n.id,selectText:(0,u.__)("Use Template","newsletter-optin-box"),previewURL:`https://noptin.com/email-templates/${n.id}.html`},Array.isArray(n.requires)&&Array.isArray(c.integrations)&&c.integrations.forEach((e=>{n.requires.includes(e.slug)&&(t[n.slug].installation=e.installation)})))})),{Templates:t}}},campaign_name:{title:c.data?.new_campaign_label,show:!!c.data?.child_type,modal:{props:{title:c.data?.new_campaign_label,size:"medium"},content:(0,s.createElement)((()=>{const[e,t]=(0,s.useState)(""),[n,r]=(0,s.useState)(!1),[a,i]=(0,s.useState)(""),o=(0,s.useCallback)((t=>{t.preventDefault(),e&&(i(""),r(!0),l()({path:"/wp/v2/noptin-campaign",method:"POST",data:{title:e,status:"publish",meta:{campaign_type:c.data?.type}}}).then((e=>{e.noptin_campaign_type?.edit_url?window.location.href=e.noptin_campaign_type.edit_url:window.location.href=window.location.href})).catch((e=>{i(e.message),r(!1)})))}),[e]);return(0,s.createElement)(d.__experimentalVStack,{as:"form",onSubmit:o,style:{opacity:n?.5:1}},(0,s.createElement)(d.__experimentalInputControl,{label:(0,u.sprintf)(/* translators: %s: campaign type */ /* translators: %s: campaign type */ -(0,u.__)("%s name","newsletter-optin-box"),c.data?.label),help:(0,u.__)("Enter a name for your campaign","newsletter-optin-box"),value:e,onChange:t,style:{width:"100%"},required:!0,disabled:n,suffix:(0,s.createElement)(d.Button,{variant:"primary",type:"submit",disabled:!e,isBusy:n,isPressed:n},(0,u.__)("Create","newsletter-optin-box"),n&&(0,s.createElement)(d.Spinner,null))}),a&&(0,s.createElement)(d.Notice,{status:"error",onDismiss:()=>i("")},a))}),null)}}},T=Object.entries(A).reduce(((e,[t,n])=>(n.show&&(e[t]=n),e)),{}),P=(0,s.createContext)(void 0),O=({children:e})=>{const[t,n]=(0,s.useState)(E),r=(0,s.useMemo)((()=>{let e="";const r={};for(const[n,a]of Object.entries(T)){const i=a.arg?(0,p.getQueryArg)(t,a.arg):"";if(!i){e=n;break}r[n]=i}return{currentTitle:T[e]?.title||"",currentStep:e,isLastStep:e===Object.keys(T).pop(),isFirstStep:e===Object.keys(T)[0],hasSteps:Object.keys(T).length>0,stepValues:r,steps:T,campaign:`${c.data?.type||"noptin"}-emails`,removeQueryArgs:(...e)=>{n((0,p.removeQueryArgs)(t,...e))},addQueryArg:(e,r)=>{n((0,p.addQueryArgs)(t,{[e]:r}))},withQueryArg:(e,n)=>(0,p.addQueryArgs)(t,{[e]:n}),url:t}}),[t,n]);return(0,s.createElement)(P.Provider,{value:r},e)},M=({title:e,isOpen:t,closeModal:n,back:r,...a})=>{const i=(0,s.createElement)(s.Fragment,null,r&&(0,s.createElement)(d.Button,{icon:"arrow-left-alt",onClick:r,label:(0,u.__)("Back","newsletter-optin-box"),showTooltip:!0}));return(0,s.createElement)(s.Fragment,null,t&&(0,s.createElement)(d.Modal,{title:e,onRequestClose:n,headerActions:i,isFullScreen:!0},(0,s.createElement)(q,{...a})))};function $(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t{const r="noptin-campaign-explorer__sidebar",a=(0,R.useViewportMatch)("medium","<");return(0,s.createElement)(d.__experimentalSurface,{className:r,variant:a?"primary":"secondary",style:B},!a&&(0,s.createElement)(d.__experimentalElevation,{value:2}),(0,s.createElement)(d.NavigableMenu,{className:`${r}__categories-list`,orientation:a?"horizontal":"vertical",onNavigate:t=>n(e[t])},e.map((e=>(0,s.createElement)(d.Button,{key:e,label:e,text:e,className:`${r}__categories-list__item`,isPressed:t===e,onClick:()=>n(e)})))))},z=(window.wp.element,({image:e,title:t})=>{if("string"==typeof e&&e.startsWith("http"))return(0,s.createElement)("img",{src:e,width:24,alt:t,style:{maxWidth:24,height:"auto"}});if(e&&"string"==typeof e)return(0,s.createElement)(d.Icon,{size:24,icon:e,style:{color:"#424242"}});if(e&&"object"==typeof e){const t=e.fill||"#008000",n=e.path||"",r=e.viewBox||"0 0 24 24";return e.path?(0,s.createElement)(d.SVG,{viewBox:r,xmlns:"http://www.w3.org/2000/svg",style:{maxWidth:24}},(0,s.createElement)(d.Path,{fill:t,d:n})):(0,s.createElement)(d.Icon,{size:24,style:{color:t},icon:e.icon})}return(0,s.createElement)(d.Icon,{size:24,icon:"email",style:{color:"#424242"}})}),D=({learnMoreUrl:e,previewURL:t,action:n})=>{const[r,a]=(0,s.useState)(!1),[i,o]=(0,s.useState)(!0),l=()=>a(!1);return e?(0,s.createElement)(d.Button,{variant:"secondary",href:e,target:"_blank"},(0,s.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,u.__)("Learn More"))," ",(0,s.createElement)(d.Icon,{size:16,icon:"arrow-right-alt"})):t?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(d.Button,{variant:"secondary",onClick:()=>a(!0)},(0,s.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,u.__)("Preview"))," ",(0,s.createElement)(d.Icon,{size:16,icon:"visibility"})),r&&(0,s.createElement)(d.Modal,{title:(0,u.__)("Preview"),onRequestClose:l,className:"noptin-preview-modal",headerActions:(0,s.createElement)(d.__experimentalHStack,{justify:"flex-end",wrap:!0},n,(0,s.createElement)(d.Button,{variant:n?"secondary":"primary",onClick:l},(0,u.__)("Back to templates"))),isDismissible:!1,isFullScreen:!0},i&&(0,s.createElement)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},(0,s.createElement)(d.Spinner,null)),(0,s.createElement)("iframe",{src:t,style:{width:"100%",height:"100%",border:"none",display:i?"none":"block"},onLoad:()=>o(!1)}))):null},I=e=>{if(e.forcePremium?!1!==e.is_installed&&e?.licenseDetails?.key:!1!==e.is_installed){const t=e.primary||(0,s.createElement)(d.Button,{variant:"primary",onClick:e.onClick,href:e.href},(0,s.createElement)("span",{className:"noptin-selectable-card__label"},e.selectText||(0,u.__)("Select"))," ",(0,s.createElement)(d.Icon,{size:16,icon:"arrow-right-alt"}));return{upgradeText:null,button:t,secondaryButton:(0,s.createElement)(D,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:t})}}const t=(t,n)=>!1===e.is_installed&&e.installation?.[t]?e.installation?.[t]:e.licenseDetails[t]||n,n=t("install_desc",(0,u.__)("Activate your license key to unlock","newsletter-optin-box")),r=t("install_text",(0,u.__)("View Pricing","newsletter-optin-box")),a=t("install_url",(0,p.addQueryArgs)("https://noptin.com/pricing/",{utm_source:e.name||"license",utm_campaign:e.campaign||"noptin",utm_medium:"plugin-dashboard"})),i=(0,s.createElement)(d.Button,{variant:"primary",href:a,target:"_blank"},(0,s.createElement)("span",{className:"noptin-selectable-card-action__label"},r)," ",(0,s.createElement)(d.Icon,{size:16,icon:"lock"})),o=!e.licenseDetails?.key&&(0,s.createElement)(d.Button,{variant:"secondary",href:e.licenseDetails?.activate_url},(0,s.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,u.__)("Activate"))," ",(0,s.createElement)(d.Icon,{size:16,icon:"unlock"}));return{upgradeText:n,button:i,secondaryButton:e.licenseDetails?.key||e.previewURL?(0,s.createElement)(D,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:[i,o]}):o}},L=({name:e,label:t,description:n,image:r,useValue:a,onSelect:i,hrefCallback:o,href:l,isTemplate:c,...p})=>{const m=void 0===a?e:a,f=(0,s.useCallback)((()=>i?i(m):null),[m,i]),g=I({onClick:f,name:e.replace("automation_rule_",""),href:o?o(m):l,...p}),h=j("noptin-selectable-card",`noptin-selectable-card__${m}`,c&&"noptin-selectable-card--template");return(0,s.createElement)(d.Card,{className:h,size:"small"},(0,s.createElement)(d.CardHeader,null,(0,s.createElement)(d.__experimentalHeading,{level:4,numberOfLines:1},t),(0,s.createElement)(z,{image:r,title:t})),c&&r?(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{style:{width:"100%",flexGrow:1}},(0,s.createElement)("img",{src:r,alt:t,className:"noptin-template-preview__image"})),(0,s.createElement)(d.CardBody,null,g.upgradeText&&(0,s.createElement)(d.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))):(0,s.createElement)(d.CardBody,{style:{flexGrow:1}},(0,s.createElement)(d.__experimentalVStack,{spacing:4},n&&(0,s.createElement)(d.__experimentalText,{as:"p",variant:"muted"},n),c&&!r&&(0,s.createElement)(d.__experimentalText,{as:"em",variant:"muted"},(0,u.__)("No preview available","newsletter-optin-box")),g.upgradeText&&(0,s.createElement)(d.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))),(0,s.createElement)(d.CardFooter,{isBorderless:!0,justify:g.secondaryButton?"space-between":"flex-end"},g.secondaryButton,g.button),(0,s.createElement)(d.__experimentalElevation,{value:1,hover:3}))},F=["xhuge","huge","wide","xlarge","medium"],H=({showTitle:e,showSidebar:t,selectedCategory:n,cards:r,...a})=>{const i=F.map((e=>(0,R.useViewportMatch)(e,">="))).filter((e=>e)).length||1,o="noptin-campaign-explorer";let l=Object.entries(r);l.some((([,e])=>e.isTemplate))||l.sort(((e,t)=>{const n=["latest_posts_digest","periodic","manual_recipients"],r=n.includes(e[0])||e[1].orderFirst,a=n.includes(t[0])||t[1].orderFirst;return r&&!a?-1:!r&&a?1:e[1].label.localeCompare(t[1].label)}));const c=l.reduce(((e,[t,n])=>(n.forcePremium&&!a.licenseDetails?.key?e[1].push([t,n]):e[0].push([t,n]),e)),[[],[]]);return(0,s.createElement)(d.FlexBlock,{className:`${o}__list`},e&&(0,s.createElement)(d.__experimentalHeading,{level:2,lineHeight:"48px",className:`${o}__category-name`},n),(0,s.createElement)(d.__experimentalGrid,{role:"listbox",className:`${o}-list`,columns:t&&i>1?i-1:i,rowGap:32,columnGap:32},c[0].map((([e,t])=>(0,s.createElement)(L,{key:e,name:e,...a,...t}))),c[1].map((([e,t])=>(0,s.createElement)(L,{key:e,name:e,...a,...t})))))},U=({children:e,showSidebar:t,...n})=>{const r=(0,R.useViewportMatch)("medium","<");return t?r?(0,s.createElement)(d.__experimentalVStack,{spacing:4,...n},e):(0,s.createElement)(d.__experimentalHStack,{spacing:4,...n,justify:"stretch",alignment:"start",style:{maxHeight:"100%"}},e):(0,s.createElement)("div",{...n},e)},q=({cardGroups:e,...t})=>{const n=(0,s.useMemo)((()=>Object.keys(e)),[e]),r=n.length,[a,i]=(0,s.useState)(n[0]||"");(0,s.useEffect)((()=>{r>0&&!e[a]&&i(Object.keys(e)[0])}),[e,a]);const o=r>1,l=(0,s.useMemo)((()=>e[a]||{}),[e,a]),c=j("noptin-campaign-explorer",{"noptin-campaign-explorer--show-sidebar":o});return(0,s.createElement)(U,{className:c,showSidebar:o},o&&(0,s.createElement)(N,{selectedCategory:a,categories:n,onClickCategory:i}),(0,s.createElement)(H,{showTitle:o,showSidebar:o,selectedCategory:a,cards:l,...t}))},G=e=>{if(!e.isOpen)return null;const t=e.steps[e.currentStep];if(t.modal)return(0,s.createElement)(d.Modal,{onRequestClose:e.closeModal,...t.modal.props},t.modal.content);if(t.cardGroups){const n=[...Object.keys(e.stepValues)].pop(),r=e.isLastStep?void 0:n=>{t.arg&&e.addQueryArg(t.arg,n)};return(0,s.createElement)(M,{title:e.currentTitle,closeModal:e.closeModal,isOpen:e.isOpen,back:n&&!e.isFirstStep?()=>e.removeQueryArgs(e.steps[n]?.arg||""):void 0,cardGroups:"function"==typeof t.cardGroups?t.cardGroups(e.stepValues):t.cardGroups,licenseDetails:e.licenseDetails,onSelect:r,hrefCallback:t.arg&&e.isLastStep?n=>e.withQueryArg(t.arg,n):void 0,campaign:e.campaign,key:t.title})}return null},V=({buttonProps:e,...t})=>{const[n,r]=(0,s.useState)(!1),a=(0,s.useCallback)((()=>{r(!0)}),[r]),i=(0,s.useCallback)((()=>{r(!1)}),[r]),o=t.currentStep&&t.hasSteps,l={...e,onClick:o?a:void 0,href:o?void 0:t.url};return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(d.Button,{...l}),(0,s.createElement)(G,{isOpen:n,closeModal:i,...t}))},W={variant:"primary",text:c.data?.new_campaign_label,type:"button"},Q=()=>{const e=(()=>{const e=(0,s.useContext)(P);if(!e)throw new Error("useModal must be used within a ModalProvider");return e})();return(0,s.createElement)(V,{licenseDetails:c.license||{},buttonProps:W,...e})},X=()=>(0,s.createElement)(O,null,(0,s.createElement)(Q,null)),Y=()=>{const{upgradeText:e,button:t,secondaryButton:n}=I({is_installed:!!c.data?.click_to_add_first,forcePremium:!!c.data?.upsell,name:c.data?.plural,campaign:"emails",licenseDetails:c.license||{},primary:(0,s.createElement)(X,null)});return(0,s.createElement)(d.__experimentalVStack,{alignment:"center",justify:"center",spacing:6,style:{minHeight:320}},(0,s.createElement)(d.Icon,{icon:c.data?.icon,size:100,style:{color:"#646970"}}),(0,s.createElement)(d.__experimentalText,{align:"center",color:"#646970",size:16,isBlock:!0},c.data?.upsell||c.data?.click_to_add_first),(0,s.createElement)(d.__experimentalHStack,{alignment:"center",justify:"center",spacing:2},t,n),e&&(0,s.createElement)(d.__experimentalText,{align:"center",size:13,isBlock:!0,isDestructive:!0},e))};function K({title:e,isSecodary:t,className:n,children:r}){const[a,i]=(0,s.useState)(!0),o=j(n,"noptin-component__section");return(0,s.createElement)(d.Card,{variant:t?"secondary":"primary",className:o},(0,s.createElement)(d.CardHeader,null,(0,s.createElement)(d.Flex,null,(0,s.createElement)(d.FlexBlock,null,(0,s.createElement)("h3",null,e)),(0,s.createElement)(d.FlexItem,null,(0,s.createElement)(d.Button,{variant:"tertiary",onClick:()=>i(!a),icon:a?"arrow-up-alt2":"arrow-down-alt2"})))),a&&r)}function Z(){return Z=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?ce(be,--ye):0,ge--,10===_e&&(ge=1,fe--),_e}function ke(){return _e=ye2||Ae(_e)>3?"":" "}function $e(e,t){for(;--t&&ke()&&!(_e<48||_e>102||_e>57&&_e<65||_e>70&&_e<97););return Ce(e,Se()+(t<6&&32==Ee()&&32==ke()))}function je(e){for(;ke();)switch(_e){case e:return ye;case 34:case 39:34!==e&&39!==e&&je(_e);break;case 40:41===e&&je(e);break;case 92:ke()}return ye}function Re(e,t){for(;ke()&&e+_e!==57&&(e+_e!==84||47!==Ee()););return"/*"+Ce(t,ye-1)+"*"+ae(47===e?e:ke())}function Be(e){for(;!Ae(Ee());)ke();return Ce(e,ye)}var Ne="-ms-",ze="-moz-",De="-webkit-",Ie="comm",Le="rule",Fe="decl",He="@keyframes";function Ue(e,t){for(var n="",r=de(e),a=0;a0&&pe(k)-p&&me(m>32?Xe(k+";",r,n,p-1):Xe(le(k," ","")+";",r,n,p-2),s);break;case 59:k+=";";default:if(me(x=We(k,t,n,c,u,a,l,b,v=[],w=[],p),i),123===_)if(0===u)Ve(k,t,x,x,v,i,p,l,w);else switch(99===d&&110===ce(k,3)?100:d){case 100:case 108:case 109:case 115:Ve(e,x,x,r&&me(We(e,x,x,0,0,a,l,b,a,v=[],p),w),a,w,p,l,r?v:w);break;default:Ve(k,x,x,x,[""],w,0,l,w)}}c=u=m=0,g=y=1,b=k="",p=o;break;case 58:p=1+pe(k),m=f;default:if(g<1)if(123==_)--g;else if(125==_&&0==g++&&125==xe())continue;switch(k+=ae(_),_*g){case 38:y=u>0?1:(k+="\f",-1);break;case 44:l[c++]=(pe(k)-1)*y,y=1;break;case 64:45===Ee()&&(k+=Oe(ke())),d=Ee(),u=p=pe(b=k+=Be(Se())),_++;break;case 45:45===f&&2==pe(k)&&(g=0)}}return i}function We(e,t,n,r,a,i,o,l,s,c,u){for(var p=a-1,d=0===a?i:[""],m=de(d),f=0,g=0,h=0;f0?d[y]+" "+_:le(_,/&\f/g,d[y])))&&(s[h++]=b);return ve(e,t,n,0===a?Le:l,s,c,u)}function Qe(e,t,n){return ve(e,t,n,Ie,ae(_e),ue(e,2,-2),0)}function Xe(e,t,n,r){return ve(e,t,n,Fe,ue(e,0,r),ue(e,r+1,-1),r)}var Ye=function(e,t,n){for(var r=0,a=0;r=a,a=Ee(),38===r&&12===a&&(t[n]=1),!Ae(a);)ke();return Ce(e,ye)},Ke=new WeakMap,Ze=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Ke.get(n))&&!r){Ke.set(e,!0);for(var a=[],i=function(e,t){return Pe(function(e,t){var n=-1,r=44;do{switch(Ae(r)){case 0:38===r&&12===Ee()&&(t[n]=1),e[n]+=Ye(ye-1,t,n);break;case 2:e[n]+=Oe(r);break;case 4:if(44===r){e[++n]=58===Ee()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=ae(r)}}while(r=ke());return e}(Te(e),t))}(t,a),o=n.props,l=0,s=0;l6)switch(ce(e,t+1)){case 109:if(45!==ce(e,t+4))break;case 102:return le(e,/(.+:)(.+)-([^]+)/,"$1"+De+"$2-$3$1"+ze+(108==ce(e,t+3)?"$3":"$2-$3"))+e;case 115:return~se(e,"stretch")?et(le(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==ce(e,t+1))break;case 6444:switch(ce(e,pe(e)-3-(~se(e,"!important")&&10))){case 107:return le(e,":",":"+De)+e;case 101:return le(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+De+(45===ce(e,14)?"inline-":"")+"box$3$1"+De+"$2$3$1"+Ne+"$2box$3")+e}break;case 5936:switch(ce(e,t+11)){case 114:return De+e+Ne+le(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return De+e+Ne+le(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return De+e+Ne+le(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return De+e+Ne+e+e}return e}var tt=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Fe:e.return=et(e.value,e.length);break;case He:return Ue([we(e,{value:le(e.value,"@","@"+De)})],r);case Le:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Ue([we(e,{props:[le(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Ue([we(e,{props:[le(t,/:(plac\w+)/,":"+De+"input-$1")]}),we(e,{props:[le(t,/:(plac\w+)/,":-moz-$1")]}),we(e,{props:[le(t,/:(plac\w+)/,Ne+"input-$1")]})],r)}return""}))}}],nt=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,a,i=e.stylisPlugins||tt,o={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n96?_t:bt},wt=function(e,t,n){var r;if(t){var a=t.shouldForwardProp;r=e.__emotion_forwardProp&&a?function(t){return e.__emotion_forwardProp(t)&&a(t)}:a}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},xt=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return yt(t,n,r),ft((function(){return function(e,t,n){yt(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var a=t;do{e.insert(t===a?"."+r:"",a,e.sheet,!0),a=a.next}while(void 0!==a)}}(t,n,r)})),null},kt=function e(t,n){var r,a,i=t.__emotion_real===t,o=i&&t.__emotion_base||t;void 0!==n&&(r=n.label,a=n.target);var l=wt(t,n,i),c=l||vt(o),u=!c("as");return function(){var p=arguments,d=i&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&d.push("label:"+r+";"),null==p[0]||void 0===p[0].raw)d.push.apply(d,p);else{d.push(p[0][0]);for(var m=p.length,f=1;f=4;++r,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(a)+s;return{name:c,styles:a,next:pt}}(d.concat(h),t.registered,y);g+=t.key+"-"+b.name,void 0!==a&&(g+=" "+a);var v=u&&void 0===l?vt(f):c,w={};for(var x in e)u&&"as"===x||v(x)&&(w[x]=e[x]);return w.className=g,w.ref=n,s.createElement(s.Fragment,null,s.createElement(xt,{cache:t,serialized:b,isStringTag:"string"==typeof f}),s.createElement(f,w))},(0,s.forwardRef)((function(e,t){var n=(0,s.useContext)(gt);return g(e,n,t)})));return h.displayName=void 0!==r?r:"Styled("+("string"==typeof o?o:o.displayName||o.name||"Component")+")",h.defaultProps=t.defaultProps,h.__emotion_real=h,h.__emotion_base=o,h.__emotion_styles=d,h.__emotion_forwardProp=l,Object.defineProperty(h,"toString",{value:function(){return"."+a}}),h.withComponent=function(t,r){return e(t,Z({},n,r,{shouldForwardProp:wt(h,r,!0)})).apply(void 0,d)},h}}.bind();["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){kt[e]=kt(e)}));const Et=[0,100],St=[0,100],Ct=e=>`${1===e.length?"0":""}${e}`,At=(e,t,n)=>Math.max(Math.min(e,n),t),Tt=(e,t)=>Math.floor(Math.random()*(t-e+1))+e,Pt=(e,t,n)=>{const r=Tt(e,t);for(let a=0;a=i[0]&&r<=i[1])return Pt(e,t,n)}return r},Ot=(e,t)=>"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0],Mt=(e,t)=>"number"==typeof e?At(Math.abs(e),...t):1===e.length||e[0]===e[1]?At(Math.abs(e[0]),...t):[Math.abs(At(e[0],...t)),At(Math.abs(e[1]),...t)],$t=(e,t,n)=>(n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e),jt=(e,t,n)=>{let r,a,i;if(e/=360,n/=100,0==(t/=100))r=a=i=n;else{const o=n<.5?n*(1+t):n+t-n*t,l=2*n-o;r=$t(l,o,e+1/3),a=$t(l,o,e),i=$t(l,o,e-1/3)}return[Math.round(255*r),Math.round(255*a),Math.round(255*i)]},Rt=(e,t,n,r)=>(299*e+587*t+114*n)/1e3>=r,Bt=(e,t,n)=>`hsl(${e}, ${t}%, ${n}%)`,Nt=(e,t,n,r)=>"rgb"===r?`rgb(${e}, ${t}, ${n})`:`#${Ct(e.toString(16))}${Ct(t.toString(16))}${Ct(n.toString(16))}`,zt=(e,{format:t="hex",saturation:n=[50,55],lightness:r=[50,60],differencePoint:a=130}={})=>{const i=Math.abs((e=>{const t=e.length;let n=0;for(let r=0;r{t=Mt(t,Et),n=Mt(n,St);const i=a?Pt(0,359,a):Tt(0,359),o="number"==typeof t?t:Tt(...t),l="number"==typeof n?n:Tt(...n),[s,c,u]=jt(i,o,l);return{color:"hsl"===e?Bt(i,o,l):Nt(s,c,u,e),isLight:Rt(s,c,u,r)}};const Dt=zt,It=kt.span` +(0,u.__)("%s name","newsletter-optin-box"),c.data?.label),help:(0,u.__)("Enter a name for your campaign","newsletter-optin-box"),value:e,onChange:t,style:{width:"100%"},required:!0,disabled:n,suffix:(0,s.createElement)(d.Button,{variant:"primary",type:"submit",disabled:!e,isBusy:n,isPressed:n},(0,u.__)("Create","newsletter-optin-box"),n&&(0,s.createElement)(d.Spinner,null))}),a&&(0,s.createElement)(d.Notice,{status:"error",onDismiss:()=>i("")},a))}),null)}}},T=Object.entries(A).reduce(((e,[t,n])=>(n.show&&(e[t]=n),e)),{}),P=(0,s.createContext)(void 0),O=({children:e})=>{const[t,n]=(0,s.useState)(E),r=(0,s.useMemo)((()=>{let e="";const r={};for(const[n,a]of Object.entries(T)){const i=a.arg?(0,p.getQueryArg)(t,a.arg):"";if(!i){e=n;break}r[n]=i}return{currentTitle:T[e]?.title||"",currentStep:e,isLastStep:e===Object.keys(T).pop(),isFirstStep:e===Object.keys(T)[0],hasSteps:Object.keys(T).length>0,stepValues:r,steps:T,campaign:`${c.data?.type||"noptin"}-emails`,removeQueryArgs:(...e)=>{n((0,p.removeQueryArgs)(t,...e))},addQueryArg:(e,r)=>{n((0,p.addQueryArgs)(t,{[e]:r}))},withQueryArg:(e,n)=>(0,p.addQueryArgs)(t,{[e]:n}),url:t}}),[t,n]);return(0,s.createElement)(P.Provider,{value:r},e)},M=({title:e,isOpen:t,closeModal:n,back:r,...a})=>{const i=(0,s.createElement)(s.Fragment,null,r&&(0,s.createElement)(d.Button,{icon:"arrow-left-alt",onClick:r,label:(0,u.__)("Back","newsletter-optin-box"),showTooltip:!0}));return(0,s.createElement)(s.Fragment,null,t&&(0,s.createElement)(d.Modal,{title:e,onRequestClose:n,headerActions:i,isFullScreen:!0},(0,s.createElement)(q,{...a})))};function $(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t{const r="noptin-campaign-explorer__sidebar",a=(0,R.useViewportMatch)("medium","<");return(0,s.createElement)(d.__experimentalSurface,{className:r,variant:a?"primary":"secondary",style:N},!a&&(0,s.createElement)(d.__experimentalElevation,{value:2}),(0,s.createElement)(d.NavigableMenu,{className:`${r}__categories-list`,orientation:a?"horizontal":"vertical",onNavigate:t=>n(e[t])},e.map((e=>(0,s.createElement)(d.Button,{key:e,label:e,text:e,className:`${r}__categories-list__item`,isPressed:t===e,onClick:()=>n(e)})))))},z=(window.wp.element,({image:e,title:t})=>{if("string"==typeof e&&e.startsWith("http"))return(0,s.createElement)("img",{src:e,width:24,alt:t,style:{maxWidth:24,height:"auto"}});if(e&&"string"==typeof e)return(0,s.createElement)(d.Icon,{size:24,icon:e,style:{color:"#424242"}});if(e&&"object"==typeof e){const t=e.fill||"#008000",n=e.path||"",r=e.viewBox||"0 0 24 24";return e.path?(0,s.createElement)(d.SVG,{viewBox:r,xmlns:"http://www.w3.org/2000/svg",style:{maxWidth:24}},(0,s.createElement)(d.Path,{fill:t,d:n})):(0,s.createElement)(d.Icon,{size:24,style:{color:t},icon:e.icon})}return(0,s.createElement)(d.Icon,{size:24,icon:"email",style:{color:"#424242"}})}),D=({learnMoreUrl:e,previewURL:t,action:n})=>{const[r,a]=(0,s.useState)(!1),[i,o]=(0,s.useState)(!0),l=()=>a(!1);return e?(0,s.createElement)(d.Button,{variant:"secondary",href:e,target:"_blank"},(0,s.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,u.__)("Learn More"))," ",(0,s.createElement)(d.Icon,{size:16,icon:"arrow-right-alt"})):t?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(d.Button,{variant:"secondary",onClick:()=>a(!0)},(0,s.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,u.__)("Preview"))," ",(0,s.createElement)(d.Icon,{size:16,icon:"visibility"})),r&&(0,s.createElement)(d.Modal,{title:(0,u.__)("Preview"),onRequestClose:l,className:"noptin-preview-modal",headerActions:(0,s.createElement)(d.__experimentalHStack,{justify:"flex-end",wrap:!0},n,(0,s.createElement)(d.Button,{variant:n?"secondary":"primary",onClick:l},(0,u.__)("Back to templates"))),isDismissible:!1,isFullScreen:!0},i&&(0,s.createElement)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},(0,s.createElement)(d.Spinner,null)),(0,s.createElement)("iframe",{src:t,style:{width:"100%",height:"100%",border:"none",display:i?"none":"block"},onLoad:()=>o(!1)}))):null},I=e=>{if(e.forcePremium?!1!==e.is_installed&&e?.licenseDetails?.key:!1!==e.is_installed){const t=e.primary||(0,s.createElement)(d.Button,{variant:"primary",onClick:e.onClick,href:e.href},(0,s.createElement)("span",{className:"noptin-selectable-card__label"},e.selectText||(0,u.__)("Select"))," ",(0,s.createElement)(d.Icon,{size:16,icon:"arrow-right-alt"}));return{upgradeText:null,button:t,secondaryButton:(0,s.createElement)(D,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:t})}}const t=(t,n)=>!1===e.is_installed&&e.installation?.[t]?e.installation?.[t]:e.licenseDetails[t]||n,n=t("install_desc",(0,u.__)("Activate your license key to unlock","newsletter-optin-box")),r=t("install_text",(0,u.__)("View Pricing","newsletter-optin-box")),a=t("install_url",(0,p.addQueryArgs)("https://noptin.com/pricing/",{utm_source:e.name||"license",utm_campaign:e.campaign||"noptin",utm_medium:"plugin-dashboard"})),i=(0,s.createElement)(d.Button,{variant:"primary",href:a,target:"_blank"},(0,s.createElement)("span",{className:"noptin-selectable-card-action__label"},r)," ",(0,s.createElement)(d.Icon,{size:16,icon:"lock"})),o=!e.licenseDetails?.key&&(0,s.createElement)(d.Button,{variant:"secondary",href:e.licenseDetails?.activate_url},(0,s.createElement)("span",{className:"noptin-selectable-card-action__label"},(0,u.__)("Activate"))," ",(0,s.createElement)(d.Icon,{size:16,icon:"unlock"}));return{upgradeText:n,button:i,secondaryButton:e.licenseDetails?.key||e.previewURL?(0,s.createElement)(D,{learnMoreUrl:e.learnMoreUrl,previewURL:e.previewURL,action:[i,o]}):o}},L=({name:e,label:t,description:n,image:r,useValue:a,onSelect:i,hrefCallback:o,href:l,isTemplate:c,...p})=>{const m=void 0===a?e:a,f=(0,s.useCallback)((()=>i?i(m):null),[m,i]),g=I({onClick:f,name:e.replace("automation_rule_",""),href:o?o(m):l,...p}),h=j("noptin-selectable-card",`noptin-selectable-card__${m}`,c&&"noptin-selectable-card--template");return(0,s.createElement)(d.Card,{className:h,size:"small"},(0,s.createElement)(d.CardHeader,null,(0,s.createElement)(d.__experimentalHeading,{level:4,numberOfLines:1},t),(0,s.createElement)(z,{image:r,title:t})),c&&r?(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"noptin-template-preview__image-wrapper"},(0,s.createElement)("img",{src:r,alt:t,className:"noptin-template-preview__image"})),(0,s.createElement)(d.CardBody,null,g.upgradeText&&(0,s.createElement)(d.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))):(0,s.createElement)(d.CardBody,{style:{flexGrow:1}},(0,s.createElement)(d.__experimentalVStack,{spacing:4},n&&(0,s.createElement)(d.__experimentalText,{as:"p",variant:"muted"},n),c&&!r&&(0,s.createElement)(d.__experimentalText,{as:"em",variant:"muted"},(0,u.__)("No preview available","newsletter-optin-box")),g.upgradeText&&(0,s.createElement)(d.__experimentalText,{as:"em",isDestructive:!0},g.upgradeText))),(0,s.createElement)(d.CardFooter,{isBorderless:!0,justify:g.secondaryButton?"space-between":"flex-end"},g.secondaryButton,g.button),(0,s.createElement)(d.__experimentalElevation,{value:1,hover:3}))},F=["xhuge","huge","wide","xlarge","medium"],H=({showTitle:e,showSidebar:t,selectedCategory:n,cards:r,...a})=>{const i=F.map((e=>(0,R.useViewportMatch)(e,">="))).filter((e=>e)).length||1,o="noptin-campaign-explorer";let l=Object.entries(r);l.some((([,e])=>e.isTemplate))||l.sort(((e,t)=>{const n=["latest_posts_digest","periodic","manual_recipients"],r=n.includes(e[0])||e[1].orderFirst,a=n.includes(t[0])||t[1].orderFirst;return r&&!a?-1:!r&&a?1:e[1].label.localeCompare(t[1].label)}));const c=l.reduce(((e,[t,n])=>(n.forcePremium&&!a.licenseDetails?.key?e[1].push([t,n]):e[0].push([t,n]),e)),[[],[]]);return(0,s.createElement)(d.FlexBlock,{className:`${o}__list`},e&&(0,s.createElement)(d.__experimentalHeading,{level:2,lineHeight:"48px",className:`${o}__category-name`},n),(0,s.createElement)(d.__experimentalGrid,{role:"listbox",className:`${o}-list`,columns:t&&i>1?i-1:i,rowGap:32,columnGap:32},c[0].map((([e,t])=>(0,s.createElement)(L,{key:e,name:e,...a,...t}))),c[1].map((([e,t])=>(0,s.createElement)(L,{key:e,name:e,...a,...t})))))},U=({children:e,showSidebar:t,...n})=>{const r=(0,R.useViewportMatch)("medium","<");return t?r?(0,s.createElement)(d.__experimentalVStack,{spacing:4,...n},e):(0,s.createElement)(d.__experimentalHStack,{spacing:4,...n,justify:"stretch",alignment:"start",style:{maxHeight:"100%"}},e):(0,s.createElement)("div",{...n},e)},q=({cardGroups:e,...t})=>{const n=(0,s.useMemo)((()=>Object.keys(e)),[e]),r=n.length,[a,i]=(0,s.useState)(n[0]||"");(0,s.useEffect)((()=>{r>0&&!e[a]&&i(Object.keys(e)[0])}),[e,a]);const o=r>1,l=(0,s.useMemo)((()=>e[a]||{}),[e,a]),c=j("noptin-campaign-explorer",{"noptin-campaign-explorer--show-sidebar":o});return(0,s.createElement)(U,{className:c,showSidebar:o},o&&(0,s.createElement)(B,{selectedCategory:a,categories:n,onClickCategory:i}),(0,s.createElement)(H,{showTitle:o,showSidebar:o,selectedCategory:a,cards:l,...t}))},G=e=>{if(!e.isOpen)return null;const t=e.steps[e.currentStep];if(t.modal)return(0,s.createElement)(d.Modal,{onRequestClose:e.closeModal,...t.modal.props},t.modal.content);if(t.cardGroups){const n=[...Object.keys(e.stepValues)].pop(),r=e.isLastStep?void 0:n=>{t.arg&&e.addQueryArg(t.arg,n)};return(0,s.createElement)(M,{title:e.currentTitle,closeModal:e.closeModal,isOpen:e.isOpen,back:n&&!e.isFirstStep?()=>e.removeQueryArgs(e.steps[n]?.arg||""):void 0,cardGroups:"function"==typeof t.cardGroups?t.cardGroups(e.stepValues):t.cardGroups,licenseDetails:e.licenseDetails,onSelect:r,hrefCallback:t.arg&&e.isLastStep?n=>e.withQueryArg(t.arg,n):void 0,campaign:e.campaign,key:t.title})}return null},V=({buttonProps:e,...t})=>{const[n,r]=(0,s.useState)(!1),a=(0,s.useCallback)((()=>{r(!0)}),[r]),i=(0,s.useCallback)((()=>{r(!1)}),[r]),o=t.currentStep&&t.hasSteps,l={...e,onClick:o?a:void 0,href:o?void 0:t.url};return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(d.Button,{...l}),(0,s.createElement)(G,{isOpen:n,closeModal:i,...t}))},W={variant:"primary",text:c.data?.new_campaign_label,type:"button"},Q=()=>{const e=(()=>{const e=(0,s.useContext)(P);if(!e)throw new Error("useModal must be used within a ModalProvider");return e})();return(0,s.createElement)(V,{licenseDetails:c.license||{},buttonProps:W,...e})},X=()=>(0,s.createElement)(O,null,(0,s.createElement)(Q,null)),Y=()=>{const{upgradeText:e,button:t,secondaryButton:n}=I({is_installed:!!c.data?.click_to_add_first,forcePremium:!!c.data?.upsell,name:c.data?.plural,campaign:"emails",licenseDetails:c.license||{},primary:(0,s.createElement)(X,null)});return(0,s.createElement)(d.__experimentalVStack,{alignment:"center",justify:"center",spacing:6,style:{minHeight:320}},(0,s.createElement)(d.Icon,{icon:c.data?.icon,size:100,style:{color:"#646970"}}),(0,s.createElement)(d.__experimentalText,{align:"center",color:"#646970",size:16,isBlock:!0},c.data?.upsell||c.data?.click_to_add_first),(0,s.createElement)(d.__experimentalHStack,{alignment:"center",justify:"center",spacing:2},t,n),e&&(0,s.createElement)(d.__experimentalText,{align:"center",size:13,isBlock:!0,isDestructive:!0},e))};function K({title:e,isSecodary:t,className:n,children:r}){const[a,i]=(0,s.useState)(!0),o=j(n,"noptin-component__section");return(0,s.createElement)(d.Card,{variant:t?"secondary":"primary",className:o},(0,s.createElement)(d.CardHeader,null,(0,s.createElement)(d.Flex,null,(0,s.createElement)(d.FlexBlock,null,(0,s.createElement)("h3",null,e)),(0,s.createElement)(d.FlexItem,null,(0,s.createElement)(d.Button,{variant:"tertiary",onClick:()=>i(!a),icon:a?"arrow-up-alt2":"arrow-down-alt2"})))),a&&r)}function Z(){return Z=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?ce(be,--ye):0,ge--,10===_e&&(ge=1,fe--),_e}function ke(){return _e=ye2||Ae(_e)>3?"":" "}function $e(e,t){for(;--t&&ke()&&!(_e<48||_e>102||_e>57&&_e<65||_e>70&&_e<97););return Ce(e,Se()+(t<6&&32==Ee()&&32==ke()))}function je(e){for(;ke();)switch(_e){case e:return ye;case 34:case 39:34!==e&&39!==e&&je(_e);break;case 40:41===e&&je(e);break;case 92:ke()}return ye}function Re(e,t){for(;ke()&&e+_e!==57&&(e+_e!==84||47!==Ee()););return"/*"+Ce(t,ye-1)+"*"+ae(47===e?e:ke())}function Ne(e){for(;!Ae(Ee());)ke();return Ce(e,ye)}var Be="-ms-",ze="-moz-",De="-webkit-",Ie="comm",Le="rule",Fe="decl",He="@keyframes";function Ue(e,t){for(var n="",r=de(e),a=0;a0&&pe(k)-p&&me(m>32?Xe(k+";",r,n,p-1):Xe(le(k," ","")+";",r,n,p-2),s);break;case 59:k+=";";default:if(me(x=We(k,t,n,c,u,a,l,b,v=[],w=[],p),i),123===_)if(0===u)Ve(k,t,x,x,v,i,p,l,w);else switch(99===d&&110===ce(k,3)?100:d){case 100:case 108:case 109:case 115:Ve(e,x,x,r&&me(We(e,x,x,0,0,a,l,b,a,v=[],p),w),a,w,p,l,r?v:w);break;default:Ve(k,x,x,x,[""],w,0,l,w)}}c=u=m=0,g=y=1,b=k="",p=o;break;case 58:p=1+pe(k),m=f;default:if(g<1)if(123==_)--g;else if(125==_&&0==g++&&125==xe())continue;switch(k+=ae(_),_*g){case 38:y=u>0?1:(k+="\f",-1);break;case 44:l[c++]=(pe(k)-1)*y,y=1;break;case 64:45===Ee()&&(k+=Oe(ke())),d=Ee(),u=p=pe(b=k+=Ne(Se())),_++;break;case 45:45===f&&2==pe(k)&&(g=0)}}return i}function We(e,t,n,r,a,i,o,l,s,c,u){for(var p=a-1,d=0===a?i:[""],m=de(d),f=0,g=0,h=0;f0?d[y]+" "+_:le(_,/&\f/g,d[y])))&&(s[h++]=b);return ve(e,t,n,0===a?Le:l,s,c,u)}function Qe(e,t,n){return ve(e,t,n,Ie,ae(_e),ue(e,2,-2),0)}function Xe(e,t,n,r){return ve(e,t,n,Fe,ue(e,0,r),ue(e,r+1,-1),r)}var Ye=function(e,t,n){for(var r=0,a=0;r=a,a=Ee(),38===r&&12===a&&(t[n]=1),!Ae(a);)ke();return Ce(e,ye)},Ke=new WeakMap,Ze=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Ke.get(n))&&!r){Ke.set(e,!0);for(var a=[],i=function(e,t){return Pe(function(e,t){var n=-1,r=44;do{switch(Ae(r)){case 0:38===r&&12===Ee()&&(t[n]=1),e[n]+=Ye(ye-1,t,n);break;case 2:e[n]+=Oe(r);break;case 4:if(44===r){e[++n]=58===Ee()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=ae(r)}}while(r=ke());return e}(Te(e),t))}(t,a),o=n.props,l=0,s=0;l6)switch(ce(e,t+1)){case 109:if(45!==ce(e,t+4))break;case 102:return le(e,/(.+:)(.+)-([^]+)/,"$1"+De+"$2-$3$1"+ze+(108==ce(e,t+3)?"$3":"$2-$3"))+e;case 115:return~se(e,"stretch")?et(le(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==ce(e,t+1))break;case 6444:switch(ce(e,pe(e)-3-(~se(e,"!important")&&10))){case 107:return le(e,":",":"+De)+e;case 101:return le(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+De+(45===ce(e,14)?"inline-":"")+"box$3$1"+De+"$2$3$1"+Be+"$2box$3")+e}break;case 5936:switch(ce(e,t+11)){case 114:return De+e+Be+le(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return De+e+Be+le(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return De+e+Be+le(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return De+e+Be+e+e}return e}var tt=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Fe:e.return=et(e.value,e.length);break;case He:return Ue([we(e,{value:le(e.value,"@","@"+De)})],r);case Le:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Ue([we(e,{props:[le(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Ue([we(e,{props:[le(t,/:(plac\w+)/,":"+De+"input-$1")]}),we(e,{props:[le(t,/:(plac\w+)/,":-moz-$1")]}),we(e,{props:[le(t,/:(plac\w+)/,Be+"input-$1")]})],r)}return""}))}}],nt=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r,a,i=e.stylisPlugins||tt,o={},l=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n96?_t:bt},wt=function(e,t,n){var r;if(t){var a=t.shouldForwardProp;r=e.__emotion_forwardProp&&a?function(t){return e.__emotion_forwardProp(t)&&a(t)}:a}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},xt=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return yt(t,n,r),ft((function(){return function(e,t,n){yt(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var a=t;do{e.insert(t===a?"."+r:"",a,e.sheet,!0),a=a.next}while(void 0!==a)}}(t,n,r)})),null},kt=function e(t,n){var r,a,i=t.__emotion_real===t,o=i&&t.__emotion_base||t;void 0!==n&&(r=n.label,a=n.target);var l=wt(t,n,i),c=l||vt(o),u=!c("as");return function(){var p=arguments,d=i&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&d.push("label:"+r+";"),null==p[0]||void 0===p[0].raw)d.push.apply(d,p);else{d.push(p[0][0]);for(var m=p.length,f=1;f=4;++r,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(a)+s;return{name:c,styles:a,next:pt}}(d.concat(h),t.registered,y);g+=t.key+"-"+b.name,void 0!==a&&(g+=" "+a);var v=u&&void 0===l?vt(f):c,w={};for(var x in e)u&&"as"===x||v(x)&&(w[x]=e[x]);return w.className=g,w.ref=n,s.createElement(s.Fragment,null,s.createElement(xt,{cache:t,serialized:b,isStringTag:"string"==typeof f}),s.createElement(f,w))},(0,s.forwardRef)((function(e,t){var n=(0,s.useContext)(gt);return g(e,n,t)})));return h.displayName=void 0!==r?r:"Styled("+("string"==typeof o?o:o.displayName||o.name||"Component")+")",h.defaultProps=t.defaultProps,h.__emotion_real=h,h.__emotion_base=o,h.__emotion_styles=d,h.__emotion_forwardProp=l,Object.defineProperty(h,"toString",{value:function(){return"."+a}}),h.withComponent=function(t,r){return e(t,Z({},n,r,{shouldForwardProp:wt(h,r,!0)})).apply(void 0,d)},h}}.bind();["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){kt[e]=kt(e)}));const Et=[0,100],St=[0,100],Ct=e=>`${1===e.length?"0":""}${e}`,At=(e,t,n)=>Math.max(Math.min(e,n),t),Tt=(e,t)=>Math.floor(Math.random()*(t-e+1))+e,Pt=(e,t,n)=>{const r=Tt(e,t);for(let a=0;a=i[0]&&r<=i[1])return Pt(e,t,n)}return r},Ot=(e,t)=>"number"==typeof t?t:e%Math.abs(t[1]-t[0])+t[0],Mt=(e,t)=>"number"==typeof e?At(Math.abs(e),...t):1===e.length||e[0]===e[1]?At(Math.abs(e[0]),...t):[Math.abs(At(e[0],...t)),At(Math.abs(e[1]),...t)],$t=(e,t,n)=>(n<0?n+=1:n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e),jt=(e,t,n)=>{let r,a,i;if(e/=360,n/=100,0==(t/=100))r=a=i=n;else{const o=n<.5?n*(1+t):n+t-n*t,l=2*n-o;r=$t(l,o,e+1/3),a=$t(l,o,e),i=$t(l,o,e-1/3)}return[Math.round(255*r),Math.round(255*a),Math.round(255*i)]},Rt=(e,t,n,r)=>(299*e+587*t+114*n)/1e3>=r,Nt=(e,t,n)=>`hsl(${e}, ${t}%, ${n}%)`,Bt=(e,t,n,r)=>"rgb"===r?`rgb(${e}, ${t}, ${n})`:`#${Ct(e.toString(16))}${Ct(t.toString(16))}${Ct(n.toString(16))}`,zt=(e,{format:t="hex",saturation:n=[50,55],lightness:r=[50,60],differencePoint:a=130}={})=>{const i=Math.abs((e=>{const t=e.length;let n=0;for(let r=0;r{t=Mt(t,Et),n=Mt(n,St);const i=a?Pt(0,359,a):Tt(0,359),o="number"==typeof t?t:Tt(...t),l="number"==typeof n?n:Tt(...n),[s,c,u]=jt(i,o,l);return{color:"hsl"===e?Nt(i,o,l):Bt(s,c,u,e),isLight:Rt(s,c,u,r)}};const Dt=zt,It=kt.span` white-space: nowrap; border-radius: 200px; height: 24px; diff --git a/build/Emails/static/images/dribbble.png b/build/Emails/static/images/dribbble.png new file mode 100644 index 00000000..89dec1da Binary files /dev/null and b/build/Emails/static/images/dribbble.png differ diff --git a/build/Emails/static/images/facebook.png b/build/Emails/static/images/facebook.png new file mode 100644 index 00000000..c2f3eac4 Binary files /dev/null and b/build/Emails/static/images/facebook.png differ diff --git a/build/Emails/static/images/github.png b/build/Emails/static/images/github.png new file mode 100644 index 00000000..ae0e5b57 Binary files /dev/null and b/build/Emails/static/images/github.png differ diff --git a/build/Emails/static/images/google-plus.png b/build/Emails/static/images/google-plus.png new file mode 100644 index 00000000..f9859bce Binary files /dev/null and b/build/Emails/static/images/google-plus.png differ diff --git a/build/Emails/static/images/instagram.png b/build/Emails/static/images/instagram.png new file mode 100644 index 00000000..8dcfe44d Binary files /dev/null and b/build/Emails/static/images/instagram.png differ diff --git a/build/Emails/static/images/linkedin.png b/build/Emails/static/images/linkedin.png new file mode 100644 index 00000000..10856a30 Binary files /dev/null and b/build/Emails/static/images/linkedin.png differ diff --git a/build/Emails/static/images/medium.png b/build/Emails/static/images/medium.png new file mode 100644 index 00000000..ec3370ff Binary files /dev/null and b/build/Emails/static/images/medium.png differ diff --git a/build/Emails/static/images/pinterest.png b/build/Emails/static/images/pinterest.png new file mode 100644 index 00000000..61d17c47 Binary files /dev/null and b/build/Emails/static/images/pinterest.png differ diff --git a/build/Emails/static/images/soundcloud.png b/build/Emails/static/images/soundcloud.png new file mode 100644 index 00000000..30537d72 Binary files /dev/null and b/build/Emails/static/images/soundcloud.png differ diff --git a/build/Emails/static/images/tumblr.png b/build/Emails/static/images/tumblr.png new file mode 100644 index 00000000..4e63d611 Binary files /dev/null and b/build/Emails/static/images/tumblr.png differ diff --git a/build/Emails/static/images/twitter.png b/build/Emails/static/images/twitter.png new file mode 100644 index 00000000..675449ad Binary files /dev/null and b/build/Emails/static/images/twitter.png differ diff --git a/build/Emails/static/images/vimeo.png b/build/Emails/static/images/vimeo.png new file mode 100644 index 00000000..0ffc1789 Binary files /dev/null and b/build/Emails/static/images/vimeo.png differ diff --git a/build/Emails/static/images/xing.png b/build/Emails/static/images/xing.png new file mode 100644 index 00000000..108f9410 Binary files /dev/null and b/build/Emails/static/images/xing.png differ diff --git a/build/Emails/static/images/youtube.png b/build/Emails/static/images/youtube.png new file mode 100644 index 00000000..54a7bc5c Binary files /dev/null and b/build/Emails/static/images/youtube.png differ diff --git a/build/src/Automation_Rules/style-automation-rule-editor-rtl.css b/build/src/Automation_Rules/style-automation-rule-editor-rtl.css index fc411e19..722eacc1 100644 --- a/build/src/Automation_Rules/style-automation-rule-editor-rtl.css +++ b/build/src/Automation_Rules/style-automation-rule-editor-rtl.css @@ -1 +1 @@ -.noptin-email-campaigns__editor--add-new__button{float:right}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:right;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image{height:auto;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%}.components-base-control__field{max-width:600px} +.noptin-email-campaigns__editor--add-new__button{float:right}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:right;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image-wrapper{flex-grow:1;max-height:300px;width:100%}.noptin-selectable-card .noptin-template-preview__image{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%}.components-base-control__field{max-width:600px} diff --git a/build/src/Automation_Rules/style-automation-rules-rtl.css b/build/src/Automation_Rules/style-automation-rules-rtl.css index 2bf53cf4..2427d19f 100644 --- a/build/src/Automation_Rules/style-automation-rules-rtl.css +++ b/build/src/Automation_Rules/style-automation-rules-rtl.css @@ -1 +1 @@ -.noptin-email-campaigns__editor--add-new__button{float:right}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:right;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image{height:auto;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%}.noptin-automation-rules__editor--add-new__button{float:right}@media screen and (max-width:782px){.noptin-automation-rules__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-automation-rules__editor--add-new__button .components-button{height:30px}}.noptin-fade-out{opacity:.3;transition:opacity 1s ease-out}.noptin-toggle-button .components-toggle-control__label{display:none}#noptin-automation-rules-table td{vertical-align:middle}@media screen and (min-width:960px){#noptin-automation-rules-table .column-created_at,#noptin-automation-rules-table .column-times_run,#noptin-automation-rules-table .column-updated_at{width:100px}#noptin-automation-rules-table .column-actions{text-align:left;width:160px}}#noptin-automation-rules-table .noptin-rule-action,#noptin-automation-rules-table .noptin-rule-trigger{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}#noptin-automation-rules-table .noptin-rule-name{flex:1;font-weight:600}#noptin-automation-rules-table .noptin-rule-name .noptin-rule-description{color:#646970;font-weight:400;margin-top:.5rem}#noptin-automation-rules-table .noptin-rule-name .row-actions{font-weight:400}#noptin-automation-rules-table .noptin-rule-image{align-items:center;border-radius:50%;display:flex;height:40px;justify-content:center;width:40px}#noptin-automation-rules-table .noptin-rule-image img{border-radius:4px;height:auto;max-height:100%;-o-object-fit:cover;object-fit:cover;width:100%}#noptin-automation-rules-table .noptin-rule-image .dashicons{font-size:40px;height:40px;width:40px}#noptin-automation-rules-table .noptin-rule-meta{display:block;margin-bottom:.4rem}#noptin-automation-rules-table .noptin-rule-meta:last-child{margin-bottom:0}#noptin-automation-rules-table .noptin-rule-meta.noptin-rule-meta__delay{color:green;font-weight:700}#noptin-automation-rules-table .noptin-rule-meta.noptin-rule-meta__delay .noptin-rule-meta-key{font-weight:700}#noptin-automation-rules-table .noptin-rule-meta-key{font-weight:600}#noptin-automation-rules-table .noptin-rule-error{color:#b32d2e;display:block;margin-top:.8rem} +.noptin-email-campaigns__editor--add-new__button{float:right}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:right;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image-wrapper{flex-grow:1;max-height:300px;width:100%}.noptin-selectable-card .noptin-template-preview__image{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%}.noptin-automation-rules__editor--add-new__button{float:right}@media screen and (max-width:782px){.noptin-automation-rules__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-automation-rules__editor--add-new__button .components-button{height:30px}}.noptin-fade-out{opacity:.3;transition:opacity 1s ease-out}.noptin-toggle-button .components-toggle-control__label{display:none}#noptin-automation-rules-table td{vertical-align:middle}@media screen and (min-width:960px){#noptin-automation-rules-table .column-created_at,#noptin-automation-rules-table .column-times_run,#noptin-automation-rules-table .column-updated_at{width:100px}#noptin-automation-rules-table .column-actions{text-align:left;width:160px}}#noptin-automation-rules-table .noptin-rule-action,#noptin-automation-rules-table .noptin-rule-trigger{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}#noptin-automation-rules-table .noptin-rule-name{flex:1;font-weight:600}#noptin-automation-rules-table .noptin-rule-name .noptin-rule-description{color:#646970;font-weight:400;margin-top:.5rem}#noptin-automation-rules-table .noptin-rule-name .row-actions{font-weight:400}#noptin-automation-rules-table .noptin-rule-image{align-items:center;border-radius:50%;display:flex;height:40px;justify-content:center;width:40px}#noptin-automation-rules-table .noptin-rule-image img{border-radius:4px;height:auto;max-height:100%;-o-object-fit:cover;object-fit:cover;width:100%}#noptin-automation-rules-table .noptin-rule-image .dashicons{font-size:40px;height:40px;width:40px}#noptin-automation-rules-table .noptin-rule-meta{display:block;margin-bottom:.4rem}#noptin-automation-rules-table .noptin-rule-meta:last-child{margin-bottom:0}#noptin-automation-rules-table .noptin-rule-meta.noptin-rule-meta__delay{color:green;font-weight:700}#noptin-automation-rules-table .noptin-rule-meta.noptin-rule-meta__delay .noptin-rule-meta-key{font-weight:700}#noptin-automation-rules-table .noptin-rule-meta-key{font-weight:600}#noptin-automation-rules-table .noptin-rule-error{color:#b32d2e;display:block;margin-top:.8rem} diff --git a/build/src/Emails/style-view-campaigns-rtl.css b/build/src/Emails/style-view-campaigns-rtl.css index 733a1cbd..babe273c 100644 --- a/build/src/Emails/style-view-campaigns-rtl.css +++ b/build/src/Emails/style-view-campaigns-rtl.css @@ -1 +1 @@ -.noptin-email-campaigns__editor--add-new__button{float:right}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:right;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image{height:auto;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%} +.noptin-email-campaigns__editor--add-new__button{float:right}@media screen and (max-width:782px){.noptin-email-campaigns__editor--add-new__button .components-button{height:40px}}@media screen and (min-width:783px){.noptin-email-campaigns__editor--add-new__button .components-button{height:30px}}.noptin-campaign-explorer{padding-bottom:100px}.noptin-campaign-explorer__sidebar{box-sizing:border-box;padding:8px 0}@media(min-width:782px){.noptin-campaign-explorer__sidebar{padding:24px 32px 32px;width:280px}.noptin-campaign-explorer__sidebar__categories-list__item{display:block;height:48px;text-align:right;width:100%}}.noptin-campaign-explorer__category-name{padding-bottom:32px}.noptin-campaign-explorer__list{padding:24px 0 32px}.noptin-selectable-card{cursor:pointer;margin-bottom:24px}.noptin-selectable-card .noptin-template-preview__image-wrapper{flex-grow:1;max-height:300px;width:100%}.noptin-selectable-card .noptin-template-preview__image{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.noptin-selectable-card--template>div,.noptin-v-stack{display:flex;flex-direction:column}.noptin-v-stack{align-items:stretch;gap:8px;justify-content:center}.noptin-v-stack>*{min-height:0}#the-list .noptin-v-stack>*{margin:0}.noptin-strong{font-weight:700}.noptin-text-success{color:#19c106}.noptin-text-error{color:#cc1818}#noptin-email-campaigns-table{margin-top:30px;overflow:auto}#noptin-email-campaigns-table #the-list td,#noptin-email-campaigns-table #the-list th{vertical-align:middle}#noptin-email-campaigns-table .column-menu_order{text-align:center;width:50px}#noptin-email-campaigns-table .column-clicks,#noptin-email-campaigns-table .column-exited,#noptin-email-campaigns-table .column-joined,#noptin-email-campaigns-table .column-opens,#noptin-email-campaigns-table .column-recipients{text-align:center;width:70px}#noptin-email-campaigns-table .column-current,#noptin-email-campaigns-table .column-revenue,#noptin-email-campaigns-table .column-unsubscribed{text-align:center;width:90px}#noptin-email-campaigns-table .column-completed{text-align:center}#noptin-email-campaigns-table .column-completed,#noptin-email-campaigns-table .column-date_sent{width:100px}#noptin-email-campaigns-table .column-status{width:110px}#noptin-email-campaigns-table .noptin-stat-percent{font-size:16px;font-weight:700;margin:2px 0 5px}.noptin-sequence #noptin-email-campaigns-table .column-title{width:320px}#noptin-email-campaigns-parent{margin-bottom:20px;margin-top:20px}#noptin-email-campaigns-parent h1{font-size:18px;font-weight:600}.noptin-preview-modal .components-modal__content{padding:0}.noptin-preview-modal .components-modal__content>div:not(.components-modal__header){height:100%;position:relative;width:100%} diff --git a/templates/email-templates/noptin-visual/styles.php b/templates/email-templates/noptin-visual/styles.php index 50eee6b1..9402f522 100644 --- a/templates/email-templates/noptin-visual/styles.php +++ b/templates/email-templates/noptin-visual/styles.php @@ -132,6 +132,7 @@ table.noptin-button-block__wrapper table { border-collapse: separate; + border-spacing: 0; } /**