(()=>{"use strict";const e=window.wp.blocks,a=window.wp.blockEditor,t=window.wp.components,l=window.wp.i18n,s=JSON.parse('{"UU":"gateway/facet-toggle"}'),o=window.ReactJSXRuntime;(0,e.registerBlockType)(s.UU,{edit:({attributes:e,setAttributes:s})=>{const{label:c,fieldKey:n,filterValue:i}=e,r=(0,a.useBlockProps)({className:"gateway-facet gateway-facet--toggle"});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.InspectorControls,{children:(0,o.jsxs)(t.PanelBody,{title:(0,l.__)("Facet Toggle Settings","gateway"),children:[(0,o.jsx)(t.TextControl,{label:(0,l.__)("Label","gateway"),value:c,onChange:e=>s({label:e}),help:(0,l.__)("Checkbox label shown to the user.","gateway")}),(0,o.jsx)(t.TextControl,{label:(0,l.__)("Field Key","gateway"),value:n,onChange:e=>s({fieldKey:e}),help:(0,l.__)('The record property to match against (e.g. "status").',"gateway")}),(0,o.jsx)(t.TextControl,{label:(0,l.__)("Filter Value","gateway"),value:i,onChange:e=>s({filterValue:e}),help:(0,l.__)('The value that must match when this toggle is checked (e.g. "active").',"gateway")})]})}),(0,o.jsxs)("label",{...r,children:[(0,o.jsx)("input",{type:"checkbox",className:"gateway-facet__checkbox",readOnly:!0})," ",c||(0,o.jsx)("em",{children:(0,l.__)("(no label)","gateway")})]})]})},save:({attributes:e})=>{const{label:t,fieldKey:l,filterValue:s}=e;return(0,o.jsxs)("label",{...a.useBlockProps.save({className:"gateway-facet gateway-facet--toggle"}),children:[(0,o.jsx)("input",{type:"checkbox",className:"gateway-facet__checkbox","data-field-key":l||void 0,"data-filter-value":s||void 0,"data-wp-on--change":"actions.filterByToggle"})," ",t]})}})})();