!function(){"use strict";var e,t,r,o,n,i,a,l,s,c={7005:function(e,t,r){var o=r(1609),n=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,r){var o,s={},c=null,u=null;for(o in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)i.call(t,o)&&!l.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:n,type:e,key:c,ref:u,props:s,_owner:a.current}}},9255:function(e,t,r){e.exports=r(7005)},1609:function(e){e.exports=window.React}},u={};e=window.wp.blocks,t=window.wp.primitives,r=function e(t){var r=u[t];if(void 0!==r)return r.exports;var o=u[t]={exports:{}};return c[t](o,o.exports,e),o.exports}(9255),o=(0,r.jsx)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(t.Path,{d:"m4 5.5h2v6.5h1.5v-6.5h2v-1.5h-5.5zm16 10.5h-16v-1.5h16zm-7 4h-9v-1.5h9z"})}),n=window.wp.i18n,i=window.wp.blockEditor,a=window.wp.coreData,l=window.wp.element,s=JSON.parse('{"UU":"surecart/product-list-filter-checkboxes-label"}'),(0,e.registerBlockType)(s.UU,{icon:o,edit:e=>{let{setAttributes:t,context:{taxonomySlug:r},attributes:{label:o}}=e;const{records:s}=(0,a.useEntityRecords)("root","taxonomy",{per_page:-1}),c=(s??[]).filter((e=>e.types.includes("sc_product")&&e?.visibility.public));(0,l.useEffect)((()=>{if(!r)return;if(!c?.length)return;const e=c.find((e=>e.slug===r))?.name??(0,n.__)("Filter by","surecart");t({label:e})}),[r,c]);const u=(0,i.useBlockProps)();return React.createElement("div",u,React.createElement(i.RichText,{tagName:"span","aria-label":(0,n.__)("Label text","surecart"),placeholder:(0,n.__)("Add label…","surecart"),value:o,onChange:e=>t({label:e}),withoutInteractiveFormatting:!0,allowedFormats:[]}))}})}();