!function(){"use strict";var t={n:function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},d:function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e=window.wp.blocks;function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var n=window.wp.element,o=window.wp.i18n,i=window.wp.blockEditor,u=window.wp.components,c=window.wp.apiFetch,a=t.n(c),l=JSON.parse('{"u2":"wcvendors-pro/store-attributes-filter"}');(0,e.registerBlockType)(l.u2,{edit:function(t){var e=t.attributes,c=t.setAttributes,l=e.title,s=e.productAttributes,f=e.selectedAttributes;return(0,n.useEffect)((function(){a()({path:"/wc/v3/products/attributes"}).then((function(t){c({productAttributes:t})}))}),[]),console.log(s),(0,n.createElement)("div",(0,i.useBlockProps)(),(0,n.createElement)(u.TextControl,{label:(0,o.__)("Title","wcvendors-pro"),onChange:function(t){return c({title:t})},value:l}),s&&s.map((function(t){return(0,n.createElement)(u.CheckboxControl,{label:t.name,checked:f.includes(t.id),onChange:function(e){return function(t,e){var n;c(t?{selectedAttributes:[].concat((n=f,function(t){if(Array.isArray(t))return r(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),[e.id])}:{selectedAttributes:f.filter((function(t){return t!==e.id}))})}(e,t)}})})))}})}();