!function(){"use strict";var t={20:function(t,e,r){var o=r(609),n=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};e.jsx=function(t,e,r){var o,c={},u=null,s=null;for(o in void 0!==r&&(u=""+r),void 0!==e.key&&(u=""+e.key),void 0!==e.ref&&(s=e.ref),e)a.call(e,o)&&!l.hasOwnProperty(o)&&(c[o]=e[o]);if(t&&t.defaultProps)for(o in e=t.defaultProps)void 0===c[o]&&(c[o]=e[o]);return{$$typeof:n,type:t,key:u,ref:s,props:c,_owner:i.current}}},609:function(t){t.exports=window.React},848:function(t,e,r){t.exports=r(20)}},e={},r=window.wc.blocksCheckout,o=window.wc.wcBlocksSharedHocs,n=JSON.parse('{"apiVersion":3,"name":"automatewoo/marketing-optin","version":"0.1.0","title":"AutomateWoo Marketing opt-in","category":"woocommerce","textdomain":"automatewoo","supports":{"multiple":false},"attributes":{"lock":{"type":"object","default":{"remove":true}}},"parent":["woocommerce/checkout-contact-information-block"],"editorScript":"file:../build/marketing-optin-block.js","editorStyle":"file:../build/marketing-optin-block.css"}'),a=window.wc.wcSettings,i={text:{type:"string",default:(0,a.getSetting)("automatewoo_data","").optinDefaultText}};function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=Array(e);r<e;r++)o[r]=t[r];return o}var c=window.wp.element,u=function r(o){var n=e[o];if(void 0!==n)return n.exports;var a=e[o]={exports:{}};return t[o](a,a.exports,r),a.exports}(848),s=(0,a.getSetting)("automatewoo_data"),f=s.optinEnabled,p=s.alreadyOptedIn;(0,r.registerCheckoutBlock)({metadata:n,component:(0,o.withFilteredAttributes)(i)((function(t){var e,o,n=t.text,a=t.checkoutExtensionData,i=(e=(0,c.useState)(!1),o=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,n,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(o=a.call(r)).done)&&(l.push(o.value),l.length!==e);c=!0);}catch(t){u=!0,n=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw n}}return l}}(e,o)||function(t,e){if(t){if("string"==typeof t)return l(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}(e,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=i[0],d=i[1],m=a.setExtensionData;return(0,c.useEffect)((function(){(f||p)&&m("automatewoo","optin",s)}),[s,m]),!f||p?null:(0,u.jsx)(r.CheckboxControl,{checked:s,onChange:d,children:(0,u.jsx)("span",{dangerouslySetInnerHTML:{__html:n}})})}))})}();