!function(){"use strict";var t=window.wc.blocksCheckout,e=window.wc.wcBlocksSharedHocs,o=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:./marketing-optin-block.js","editorStyle":"file:./marketing-optin-block.css"}'),n=window.wc.wcSettings,r={text:{type:"string",default:(0,n.getSetting)("automatewoo_data","").optinDefaultText}};function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,n=Array(e);o<e;o++)n[o]=t[o];return n}var i=window.wp.element,c=window.ReactJSXRuntime,l=(0,n.getSetting)("automatewoo_data"),u=l.optinEnabled,s=l.alreadyOptedIn;(0,t.registerCheckoutBlock)({metadata:o,component:(0,e.withFilteredAttributes)(r)((function(e){var o,n,r=e.text,l=e.checkoutExtensionData,f=(o=(0,i.useState)(!1),n=2,function(t){if(Array.isArray(t))return t}(o)||function(t,e){var o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var n,r,a,i,c=[],l=!0,u=!1;try{if(a=(o=o.call(t)).next,0===e){if(Object(o)!==o)return;l=!1}else for(;!(l=(n=a.call(o)).done)&&(c.push(n.value),c.length!==e);l=!0);}catch(t){u=!0,r=t}finally{try{if(!l&&null!=o.return&&(i=o.return(),Object(i)!==i))return}finally{if(u)throw r}}return c}}(o,n)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?a(t,e):void 0}}(o,n)||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.")}()),m=f[0],d=f[1],p=l.setExtensionData;return(0,i.useEffect)((function(){(u||s)&&p("automatewoo","optin",m)}),[m,p]),!u||s?null:(0,c.jsx)(t.CheckboxControl,{checked:m,onChange:d,children:(0,c.jsx)("span",{dangerouslySetInnerHTML:{__html:r}})})}))})}();