(()=>{"use strict";var e,o,r,t={3777:(e,o,r)=>{var t=r(5573),c=r(790);const i=(0,c.jsx)(t.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(t.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6 10C7.10457 10 8 9.10457 8 8C8 6.89543 7.10457 6 6 6C4.89543 6 4 6.89543 4 8C4 9.10457 4.89543 10 6 10ZM20 8.75H11.1111V7.25L20 7.25V8.75ZM20 15.75L11.1111 15.75V14.25L20 14.25V15.75ZM8 15C8 16.1046 7.10457 17 6 17C4.89543 17 4 16.1046 4 15C4 13.8954 4.89543 13 6 13C7.10457 13 8 13.8954 8 15Z",fill:"currentColor"})}),l=window.wp.blocks,s=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","name":"woocommerce/product-filter-removable-chips","title":"Chips","description":"Display removable active filters as chips.","category":"woocommerce","keywords":["WooCommerce"],"textdomain":"woocommerce","apiVersion":3,"ancestor":["woocommerce/product-filter-active"],"supports":{"layout":{"allowSwitching":false,"allowInheriting":false,"allowVerticalAlignment":false,"default":{"type":"flex"}},"interactivity":true},"usesContext":["queryId","filterData"],"attributes":{"chipText":{"type":"string"},"customChipText":{"type":"string"},"chipBackground":{"type":"string"},"customChipBackground":{"type":"string"},"chipBorder":{"type":"string"},"customChipBorder":{"type":"string"}},"style":"file:../woocommerce/product-filter-removable-chips-style.css"}');var n=r(7723),a=r(4921),p=r(4476),u=r(556),d=r(4530),h=r(1924);const m=window.wc.blocksComponents,b=window.wp.components,w=window.wp.blockEditor;function f(e,o=""){return e?.length?`var(--wp--preset--color--${e})`:o||""}function v(e){const{chipText:o,chipBackground:r,chipBorder:t,customChipText:c,customChipBackground:i,customChipBorder:l}=e,s={"--wc-product-filter-removable-chips-text":f(o,c),"--wc-product-filter-removable-chips-background":f(r,i),"--wc-product-filter-removable-chips-border":f(t,l)};return Object.keys(s).reduce(((e,o)=>(s[o]&&(e[o]=s[o]),e)),{})}function g(e){const{chipText:o,chipBackground:r,chipBorder:t,customChipText:c,customChipBackground:i,customChipBorder:l}=e;return{"has-chip-text-color":o||c,"has-chip-background-color":r||i,"has-chip-border-color":t||l}}const C=(0,w.withColors)({chipText:"chip-text",chipBorder:"chip-border",chipBackground:"chip-background"})((e=>{const o=(0,w.__experimentalUseMultipleOriginColorsAndGradients)(),{name:r,context:t,clientId:i,attributes:s,setAttributes:f,chipText:C,setChipText:x,chipBackground:k,setChipBackground:y,chipBorder:_,setChipBorder:B}=e,{customChipText:j,customChipBackground:O,customChipBorder:T,layout:P}=s,{filterData:A}=t,{items:S}=A,M=(0,l.getBlockSupport)(r,"layout"),V=M?.default,N=P||V||{},I=(0,w.useBlockProps)({className:(0,a.A)("wc-block-product-filter-removable-chips",{...g(s)}),style:v(s)}),R=(0,w.useInnerBlocksProps)(I,{});return(0,c.jsxs)("div",{...R,children:[(0,c.jsx)(w.BlockControls,{children:(0,c.jsxs)(b.ToolbarGroup,{children:[(0,c.jsx)(b.ToolbarButton,{icon:p.A,label:(0,n.__)("Horizontal","woocommerce"),onClick:()=>f({layout:{...N,orientation:"horizontal"}}),isPressed:"horizontal"===N.orientation||!N.orientation}),(0,c.jsx)(b.ToolbarButton,{icon:u.A,label:(0,n.__)("Vertical","woocommerce"),onClick:()=>f({layout:{...N,orientation:"vertical"}}),isPressed:"vertical"===N.orientation})]})}),(0,c.jsx)("ul",{className:"wc-block-product-filter-removable-chips__items",children:S?.map(((e,o)=>{return(0,c.jsxs)("li",{className:"wc-block-product-filter-removable-chips__item",children:[(0,c.jsx)("span",{className:"wc-block-product-filter-removable-chips__label",children:e.type+": "+e.label}),(0,c.jsxs)("button",{className:"wc-block-product-filter-removable-chips__remove",children:[(0,c.jsx)(d.A,{className:"wc-block-product-filter-removable-chips__remove-icon",icon:h.A,size:25}),(0,c.jsx)(m.Label,{screenReaderLabel:(r=e.type+": "+e.label,(0,n.sprintf)(/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */ /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
(0,n.__)("Remove %s filter","woocommerce"),r))})]})]},o);var r}))}),(0,c.jsx)(w.InspectorControls,{group:"color",children:o.hasColorsOrGradients&&(0,c.jsx)(w.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{label:(0,n.__)("Chip Text","woocommerce"),colorValue:C.color||j,onColorChange:e=>{x(e),f({customChipText:e})},resetAllFilter:()=>{x(""),f({customChipText:""})}},{label:(0,n.__)("Chip Border","woocommerce"),colorValue:_.color||T,onColorChange:e=>{B(e),f({customChipBorder:e})},resetAllFilter:()=>{B(""),f({customChipBorder:""})}},{label:(0,n.__)("Chip Background","woocommerce"),colorValue:k.color||O,onColorChange:e=>{y(e),f({customChipBackground:e})},resetAllFilter:()=>{y(""),f({customChipBackground:""})}}],panelId:i,...o})})]})}));(0,l.registerBlockType)(s,{edit:C,icon:i,save:({attributes:e,style:o})=>{const r=w.useBlockProps.save({className:(0,a.A)("wc-block-product-filter-removable-chips",e.className,g(e)),style:{...o,...v(e)}});return(0,c.jsx)("div",{...r})}})},1609:e=>{e.exports=window.React},790:e=>{e.exports=window.ReactJSXRuntime},6087:e=>{e.exports=window.wp.element},7723:e=>{e.exports=window.wp.i18n},5573:e=>{e.exports=window.wp.primitives}},c={};function i(e){var o=c[e];if(void 0!==o)return o.exports;var r=c[e]={exports:{}};return t[e].call(r.exports,r,r.exports,i),r.exports}i.m=t,e=[],i.O=(o,r,t,c)=>{if(!r){var l=1/0;for(p=0;p<e.length;p++){for(var[r,t,c]=e[p],s=!0,n=0;n<r.length;n++)(!1&c||l>=c)&&Object.keys(i.O).every((e=>i.O[e](r[n])))?r.splice(n--,1):(s=!1,c<l&&(l=c));if(s){e.splice(p--,1);var a=t();void 0!==a&&(o=a)}}return o}c=c||0;for(var p=e.length;p>0&&e[p-1][2]>c;p--)e[p]=e[p-1];e[p]=[r,t,c]},i.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return i.d(o,{a:o}),o},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var c=Object.create(null);i.r(c);var l={};o=o||[null,r({}),r([]),r(r)];for(var s=2&t&&e;"object"==typeof s&&!~o.indexOf(s);s=r(s))Object.getOwnPropertyNames(s).forEach((o=>l[o]=()=>e[o]));return l.default=()=>e,i.d(c,l),c},i.d=(e,o)=>{for(var r in o)i.o(o,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},i.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.j=6609,(()=>{var e={6609:0};i.O.j=o=>0===e[o];var o=(o,r)=>{var t,c,[l,s,n]=r,a=0;if(l.some((o=>0!==e[o]))){for(t in s)i.o(s,t)&&(i.m[t]=s[t]);if(n)var p=n(i)}for(o&&o(r);a<l.length;a++)c=l[a],i.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return i.O(p)},r=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];r.forEach(o.bind(null,0)),r.push=o.bind(null,r.push.bind(r))})();var l=i.O(void 0,[94],(()=>i(3777)));l=i.O(l),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["product-filter-removable-chips"]=l})();