(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,n=window.wp.blocks,i=window.wp.i18n,a=window.wp.components,o=window.wp.blockEditor,r=window.wp.serverSideRender;var l=e.n(r);const s=Object.entries(moBlockOptinCampaigns.optins).map((([e,t])=>({label:t,value:e})));function c({attributes:e,setAttributes:n}){return(0,t.createElement)("div",{className:"mailoptin-form-block-select-wrap"},0===s.length?(0,t.createElement)(a.Notice,{status:"error",isDismissible:!1},(0,i.__)("No optin campaign found. Please create one","mailoptin")):(0,t.createElement)(p,{attributes:e,setAttributes:n}))}function p({attributes:e,setAttributes:n}){return(0,t.createElement)(a.SelectControl,{label:(0,i.__)("Select an optin campaign","mailoptin"),options:[{label:"––––"},...s],onChange:e=>n({id:e}),value:e.id})}const m=JSON.parse('{"UU":"mailoptin/email-optin"}');(0,n.registerBlockType)(m.UU,{icon:(0,t.createElement)("svg",{width:"150",height:"150",viewBox:"0 0 11.16 11.16",fillRule:"evenodd"},(0,t.createElement)("path",{d:"M.92.79V.8h0 .01l3.11 3.03 1.5 1.44L10.18.8c.04-.04.09-.07.15-.09.17-.07.36-.02.5.1.08.09.14.2.14.32v8.55c0 .44-.36.8-.8.8H.99c-.44 0-.8-.36-.8-.8V1.11h0c0-.24.2-.43.43-.43.12 0 .22.04.3.11zM2.3 5.14c-.3-.64.27-1.27.91-1.17.14.02.28.08.4.18l1.93 1.87 4.53-4.37c.05-.05.12-.08.19-.08a.28.28 0 0 1 .28.28v1.64L6.18 7.81c-.11.09-.21.17-.32.22-.21.12-.39.14-.62.03-.1-.04-.19-.11-.3-.19l-2.4-2.38a1.37 1.37 0 0 1-.24-.35z"})),edit:function({attributes:e,setAttributes:n}){return(0,t.createElement)("div",{...(0,o.useBlockProps)()},(0,t.createElement)(o.InspectorControls,{key:"setting"},(0,t.createElement)(a.Panel,null,(0,t.createElement)(a.PanelBody,{initialOpen:!0,title:(0,i.__)("Optin Campaign","mailoptin")},(0,t.createElement)(a.PanelRow,null,(0,t.createElement)(p,{attributes:e,setAttributes:n})))))," ",0!==s.length&&e.id?(0,t.createElement)(l(),{LoadingResponsePlaceholder:a.Spinner,block:"mailoptin/email-optin",attributes:e}):(0,t.createElement)(c,{setAttributes:n,attributes:e}))},save:function({attributes:e}){const{id:n}=e;return(0,t.createElement)("div",{...o.useBlockProps.save()},void 0===n?"":`[mo-optin-form id=${n}]`)}})})();