!function(){var e={151:function(e){var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};e.exports=t},206:function(e){function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}
/*!
 * Determine if an object is a Buffer
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},503:function(e,t,n){var o,r,l,a,c;o=n(939),r=n(151).utf8,l=n(206),a=n(151).bin,(c=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?a.stringToBytes(e):r.stringToBytes(e):l(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=o.bytesToWords(e),i=8*e.length,s=1732584193,u=-271733879,m=-1732584194,p=271733878,b=0;b<n.length;b++)n[b]=16711935&(n[b]<<8|n[b]>>>24)|4278255360&(n[b]<<24|n[b]>>>8);n[i>>>5]|=128<<i%32,n[14+(i+64>>>9<<4)]=i;var h=c._ff,y=c._gg,f=c._hh,d=c._ii;for(b=0;b<n.length;b+=16){var g=s,w=u,_=m,v=p;s=h(s,u,m,p,n[b+0],7,-680876936),p=h(p,s,u,m,n[b+1],12,-389564586),m=h(m,p,s,u,n[b+2],17,606105819),u=h(u,m,p,s,n[b+3],22,-1044525330),s=h(s,u,m,p,n[b+4],7,-176418897),p=h(p,s,u,m,n[b+5],12,1200080426),m=h(m,p,s,u,n[b+6],17,-1473231341),u=h(u,m,p,s,n[b+7],22,-45705983),s=h(s,u,m,p,n[b+8],7,1770035416),p=h(p,s,u,m,n[b+9],12,-1958414417),m=h(m,p,s,u,n[b+10],17,-42063),u=h(u,m,p,s,n[b+11],22,-1990404162),s=h(s,u,m,p,n[b+12],7,1804603682),p=h(p,s,u,m,n[b+13],12,-40341101),m=h(m,p,s,u,n[b+14],17,-1502002290),s=y(s,u=h(u,m,p,s,n[b+15],22,1236535329),m,p,n[b+1],5,-165796510),p=y(p,s,u,m,n[b+6],9,-1069501632),m=y(m,p,s,u,n[b+11],14,643717713),u=y(u,m,p,s,n[b+0],20,-373897302),s=y(s,u,m,p,n[b+5],5,-701558691),p=y(p,s,u,m,n[b+10],9,38016083),m=y(m,p,s,u,n[b+15],14,-660478335),u=y(u,m,p,s,n[b+4],20,-405537848),s=y(s,u,m,p,n[b+9],5,568446438),p=y(p,s,u,m,n[b+14],9,-1019803690),m=y(m,p,s,u,n[b+3],14,-187363961),u=y(u,m,p,s,n[b+8],20,1163531501),s=y(s,u,m,p,n[b+13],5,-1444681467),p=y(p,s,u,m,n[b+2],9,-51403784),m=y(m,p,s,u,n[b+7],14,1735328473),s=f(s,u=y(u,m,p,s,n[b+12],20,-1926607734),m,p,n[b+5],4,-378558),p=f(p,s,u,m,n[b+8],11,-2022574463),m=f(m,p,s,u,n[b+11],16,1839030562),u=f(u,m,p,s,n[b+14],23,-35309556),s=f(s,u,m,p,n[b+1],4,-1530992060),p=f(p,s,u,m,n[b+4],11,1272893353),m=f(m,p,s,u,n[b+7],16,-155497632),u=f(u,m,p,s,n[b+10],23,-1094730640),s=f(s,u,m,p,n[b+13],4,681279174),p=f(p,s,u,m,n[b+0],11,-358537222),m=f(m,p,s,u,n[b+3],16,-722521979),u=f(u,m,p,s,n[b+6],23,76029189),s=f(s,u,m,p,n[b+9],4,-640364487),p=f(p,s,u,m,n[b+12],11,-421815835),m=f(m,p,s,u,n[b+15],16,530742520),s=d(s,u=f(u,m,p,s,n[b+2],23,-995338651),m,p,n[b+0],6,-198630844),p=d(p,s,u,m,n[b+7],10,1126891415),m=d(m,p,s,u,n[b+14],15,-1416354905),u=d(u,m,p,s,n[b+5],21,-57434055),s=d(s,u,m,p,n[b+12],6,1700485571),p=d(p,s,u,m,n[b+3],10,-1894986606),m=d(m,p,s,u,n[b+10],15,-1051523),u=d(u,m,p,s,n[b+1],21,-2054922799),s=d(s,u,m,p,n[b+8],6,1873313359),p=d(p,s,u,m,n[b+15],10,-30611744),m=d(m,p,s,u,n[b+6],15,-1560198380),u=d(u,m,p,s,n[b+13],21,1309151649),s=d(s,u,m,p,n[b+4],6,-145523070),p=d(p,s,u,m,n[b+11],10,-1120210379),m=d(m,p,s,u,n[b+2],15,718787259),u=d(u,m,p,s,n[b+9],21,-343485551),s=s+g>>>0,u=u+w>>>0,m=m+_>>>0,p=p+v>>>0}return o.endian([s,u,m,p])})._ff=function(e,t,n,o,r,l,a){var c=e+(t&n|~t&o)+(r>>>0)+a;return(c<<l|c>>>32-l)+t},c._gg=function(e,t,n,o,r,l,a){var c=e+(t&o|n&~o)+(r>>>0)+a;return(c<<l|c>>>32-l)+t},c._hh=function(e,t,n,o,r,l,a){var c=e+(t^n^o)+(r>>>0)+a;return(c<<l|c>>>32-l)+t},c._ii=function(e,t,n,o,r,l,a){var c=e+(n^(t|~o))+(r>>>0)+a;return(c<<l|c>>>32-l)+t},c._blocksize=16,c._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=o.wordsToBytes(c(e,t));return t&&t.asBytes?n:t&&t.asString?a.bytesToString(n):o.bytesToHex(n)}},939:function(e){var t,n;t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,o=0;n<e.length;n++,o+=8)t[o>>>5]|=e[n]<<24-o%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],o=0;o<e.length;o+=3)for(var r=e[o]<<16|e[o+1]<<8|e[o+2],l=0;l<4;l++)8*o+6*l<=8*e.length?n.push(t.charAt(r>>>6*(3-l)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],o=0,r=0;o<e.length;r=++o%4)0!=r&&n.push((t.indexOf(e.charAt(o-1))&Math.pow(2,-2*r+8)-1)<<2*r|t.indexOf(e.charAt(o))>>>6-2*r);return n}},e.exports=n},942:function(e,t){var n;
/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,l(n)))}return e}function l(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)o.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.element,t=window.wp.i18n,o=window.wp.blocks;function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function l(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==r(t)?t:t+""}function a(e,t,n){return(t=l(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=window.wp.blockEditor,i=window.wp.components;const s=function(){const e={};return e.promise=new Promise(function(t,n){e.resolve=t,e.reject=n}),e};var u=n(503),m=n.n(u);function p(e){if(Array.isArray(e))return`[${e.map(function(e){return p(e)}).join(",")}]`;if("object"==typeof e&&null!==e){let t="";const n=Object.keys(e).sort();t+=`{${JSON.stringify(n)}`;for(let o=0;o<n.length;o++)t+=`${p(e[n[o]])},`;return`${t}}`}return`${JSON.stringify(e)}`}const b=function(e){return m()(p(e))},h=["fetcherName"];function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const d=0,g=1,w=2;let _={cacheKey:{state:d,response:null,payoad:{}}},v={};const k=new class{parseOptions(e){const{fetcherName:t=null}=e;return{args:{fetcherName:t},inputFetchOptions:function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)n=l[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,h)}}fetch(e,t,n){const{args:o}=this.parseOptions(n),r=b(f(f({},t),{},{url:e}));if(_[r]||(_[r]={state:d,response:null,payload:{waitingForResponse:[]}},o.fetcherName&&v[o.fetcherName]&&(v[o.fetcherName].forEach(function(e){e.abort()}),v[o.fetcherName]=[])),_[r].state===w){const e=s();return e.resolve(_[r].response.clone()),e.promise}if(_[r].state===g)return this.fetchLoadingState(r,e,t,n);if(_[r].state===d)return this.fetchEmptyState(r,e,t,n);throw new Error("Invalid state",{cacheEntry:_[r]})}fetchLoadingState(e,t,n,o){const r=s();return _[e].payload.waitingForResponse.push(r),r.promise}fetchEmptyState(e,t,n,o){const{args:r,inputFetchOptions:l}=this.parseOptions(o);_[e].state=g;let a=new AbortController;r.fetcherName&&(v[r.fetcherName]||(v[r.fetcherName]=[]),v[r.fetcherName].push(a));const c=s(),i=f({method:"POST",headers:{"Content-Type":"application/json"},signal:a.signal},l);return"POST"===i.method&&(i.body=JSON.stringify(n)),fetch(t,i).then(function(t){_[e].response=t.clone(),[c,..._[e].payload.waitingForResponse].forEach(function(t){t.resolve(_[e].response.clone())}),_[e].payload={waitingForResponse:[]},_[e].state=w,r.fetcherName&&(v[r.fetcherName]=[])}).catch(function(t){[c,..._[e].payload.waitingForResponse].forEach(function(t){t.reject(_[e].response)}),_[e].payload={waitingForResponse:[]},_[e].state=d}),c.promise}};var E=function(e,t,n={}){return k.fetch(e,t,n)};function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},x.apply(null,arguments)}var C=function({showCheckbox:t}){return t?(0,e.createElement)("span",{className:"ct-filter-checkbox"}):null};var O=function({showLabel:t=!0,label:n,count:o=0,withCount:r=!1}){return t||r?(0,e.createElement)("span",{className:"ct-filter-label"},t?`${n}`:"",r?(0,e.createElement)("span",{className:"ct-filter-count"},"(",o,")"):null):null};var T=function({showCounters:t,count:n}){return t?(0,e.createElement)("span",{className:"ct-filter-count"},n):null};var S=function({blockData:t,maybeAttribute:n,attributes:o,item:r}){var l,a,c,i,s,u;const m=null==r||null===(l=r.meta)||void 0===l||null===(a=l.accent_color)||void 0===a||null===(c=a.default)||void 0===c?void 0:c.color,p=null==r||null===(i=r.meta)||void 0===i||null===(s=i.image)||void 0===s?void 0:s.url,b=(0,e.useMemo)(function(){var e,t,n,o,l,a,c,i,s,u,p,b,h;if("dual"===(null==r||null===(e=r.meta)||void 0===e?void 0:e.color_type)&&null!=r&&null!==(t=r.meta)&&void 0!==t&&null!==(n=t.accent_color)&&void 0!==n&&null!==(o=n.secondary)&&void 0!==o&&o.color&&"CT_CSS_SKIP_RULE"!==(null==r||null===(l=r.meta)||void 0===l||null===(a=l.accent_color)||void 0===a||null===(c=a.secondary)||void 0===c?void 0:c.color)&&null!=r&&null!==(i=r.meta)&&void 0!==i&&null!==(s=i.accent_color)&&void 0!==s&&null!==(u=s.default)&&void 0!==u&&u.color&&"CT_CSS_SKIP_RULE"!==(null==r||null===(p=r.meta)||void 0===p||null===(b=p.accent_color)||void 0===b||null===(h=b.default)||void 0===h?void 0:h.color)){const{accent_color:e}=r.meta,{default:{color:t},secondary:{color:n}}=e;return{backgroundImage:`linear-gradient(-45deg, ${t} 0%, ${t} 50%, ${n} 50%, ${n} 100%)`}}return{backgroundColor:m}},[null==r?void 0:r.meta]);return(0,e.createElement)("li",{className:"ct-filter-item"},(0,e.createElement)("div",{className:"ct-filter-item-inner"},(0,e.createElement)("a",{href:"#"},(0,e.createElement)(C,{showCheckbox:o.showAttributesCheckbox}),t.has_swatches&&o.showItemsRendered?(0,e.createElement)(React.Fragment,null,"color"===(null==n?void 0:n.type)&&"CT_CSS_SKIP_RULE"!==m||"image"===(null==n?void 0:n.type)&&p||"button"===(null==n?void 0:n.type)?(0,e.createElement)("span",{className:"ct-swatch-container"},"color"===(null==n?void 0:n.type)?(0,e.createElement)("span",{className:"ct-swatch",style:b}):null,"image"===(null==n?void 0:n.type)?(0,e.createElement)("span",{className:"ct-media-container ct-swatch"},(0,e.createElement)("img",{src:p,alt:r.name,style:{aspectRatio:"1/1",height:"auto",maxWidth:"100%"}})):null,"button"===(null==n?void 0:n.type)?(0,e.createElement)("span",{className:"ct-swatch"},(null==r||null===(u=r.meta)||void 0===u?void 0:u.short_name)||(null==r?void 0:r.name)):null):null):null,(0,e.createElement)(O,{label:r.name,showLabel:o.showLabel}),(0,e.createElement)(T,{count:r.count,showCounters:o.showCounters}))))};var B=function({taxItem:t,attributes:n}){var o;const{showItemsRendered:r,showTaxonomyImages:l,type:a,taxonomy:c}=n;return(r||l)&&null!=t&&null!==(o=t.tax_image)&&void 0!==o&&o.url&&("categories"!==a||"product_brand"!==c||r)&&("categories"!==a||"product_brand"===c||l)?(0,e.createElement)("div",{className:"ct-media-container"},(0,e.createElement)("img",{src:t.tax_image.url,alt:t.name,style:{aspectRatio:"var(--product-taxonomy-logo-aspect-ratio)"}})):null};const P=function({taxItem:t,attributes:n}){const o=t.children||[],{showLabel:r}=n,l=!n.expandable||n.defaultExpanded,a="list"===n.viewType&&n.hierarchical,c="list"===n.viewType&&n.expandable;return(0,e.createElement)("li",{className:"ct-filter-item"},(0,e.createElement)("div",{className:"ct-filter-item-inner"},(0,e.createElement)("a",{href:"#"},(0,e.createElement)(C,{showCheckbox:n.showCheckbox}),(0,e.createElement)(B,{taxItem:t,attributes:n}),(0,e.createElement)(O,{showLabel:r,label:t.name,count:t.count,withCount:n.showCounters&&c&&a}),(0,e.createElement)(T,{count:t.count,showCounters:n.showCounters&&(!c||!a)})),o.length&&a&&c?(0,e.createElement)("span",{className:"ct-expandable-trigger"},(0,e.createElement)("svg",{className:"ct-icon",width:"10",height:"10",viewBox:"0 0 25 25"},(0,e.createElement)("path",{d:"M.207 17.829 12.511 5.525l1.768 1.768L1.975 19.596z"}),(0,e.createElement)("path",{d:"m10.721 7.243 1.768-1.768L24.793 17.78l-1.768 1.767z"}))):null),o.length&&a&&l?(0,e.createElement)("ul",{className:"ct-filter-children"},o.map(function(t){return n.taxonomy_not_in.includes(t.term_id)&&n.excludeTaxonomy?null:(0,e.createElement)(P,{key:t.term_id,taxItem:t,attributes:n})})):null)};var N=P;function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var F=function({attributes:n,setAttributes:o,blockData:r}){const l=(0,c.useBlockProps)({className:"ct-filter-widget-wrapper"}),a=(0,e.useMemo)(function(){if(n.searchPlaceholder.length)return n.searchPlaceholder;let e="";if("attributes"===n.type){const t=Object.values(r.attributes_tax).find(function({attribute_name:e}){return e===n.attribute});t&&(e=t.attribute_label.toLowerCase())}return"categories"===n.type&&r.product_taxonomies[n.taxonomy]&&(e=r.product_taxonomies[n.taxonomy].name.toLowerCase()),sprintf((0,t.__)("Find by %s","blocksy-companion"),e)},[n,r]),i={color:r.ct_color_swatch_shape,image:r.ct_image_swatch_shape,button:r.ct_button_swatch_shape,mixed:r.ct_mixed_swatch_shape},s=Object.values(r.attributes_tax).find(function({attribute_name:e}){return e===n.attribute}),u=(0,e.useMemo)(function(){return"categories"===n.type?{style:R({"--product-taxonomy-logo-size":`${n.logoMaxW}px`,"--product-taxonomy-logo-aspect-ratio":n.aspectRatio,"--theme-object-fit":n.imageFit},n.limitHeight?{maxHeight:`${n.limitHeightValue}px`}:{}),"data-frame":n.useFrame?"yes":"no"}:"attributes"===n.type&&s&&s.type&&"select"!==s.type?R({"data-swatches-shape":i[s.type],"data-swatches-type":s.type},n.limitHeight?{style:{maxHeight:`${n.limitHeightValue}px`}}:{}):R({},n.limitHeight?{style:{maxHeight:`${n.limitHeightValue}px`}}:{})},[n,s]);return"categories"!==n.type||r.can_display_preview?(0,e.createElement)("div",l,n.showSearch&&(0,e.createElement)("div",{className:"ct-filter-search"},(0,e.createElement)("input",{type:"search",placeholder:a,onChange:function(e){return o({searchPlaceholder:e.target.value})}}),(0,e.createElement)("span",{className:"ct-filter-search-icon"},(0,e.createElement)("svg",{className:"ct-filter-search-zoom-icon",width:"13",height:"13",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 15 15"},(0,e.createElement)("path",{d:"M14.8,13.7L12,11c0.9-1.2,1.5-2.6,1.5-4.2c0-3.7-3-6.8-6.8-6.8S0,3,0,6.8s3,6.8,6.8,6.8c1.6,0,3.1-0.6,4.2-1.5l2.8,2.8c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2C15.1,14.5,15.1,14,14.8,13.7z M1.5,6.8c0-2.9,2.4-5.2,5.2-5.2S12,3.9,12,6.8S9.6,12,6.8,12S1.5,9.6,1.5,6.8z"})))),(0,e.createElement)("ul",x({className:"ct-filter-widget"},u,{"data-display-type":n.viewType,"data-filter-criteria":"categories"===n.type?`taxonomy:${n.taxonomy}`:n.type}),r.terms.length>0&&("categories"===n.type&&n.hierarchical&&"list"===n.viewType?r.terms:r.flatTerms).map(function(t){return n.taxonomy_not_in.includes(t.term_id)&&n.excludeTaxonomy||0===t.count?null:"categories"===n.type?(0,e.createElement)(N,{key:t.term_id,taxItem:t,attributes:n}):(0,e.createElement)(S,{key:t.term_id,blockData:r,maybeAttribute:s,item:t,attributes:n})})),n.showResetButton&&(0,e.createElement)("div",{className:"ct-filter-reset wp-block-button is-style-outline"},(0,e.createElement)("a",{href:"#",className:"ct-button-ghost wp-element-button wp-block-button__link"},(0,e.createElement)("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"currentColor"},(0,e.createElement)("path",{d:"M8.5,7.5l4.5,4.5l-1,1L7.5,8.5L3,13l-1-1l4.5-4.5L2,3l1-1l4.5,4.5L12,2l1,1L8.5,7.5z"})),(0,t.__)("Reset Filter","blocksy-companion")))):(0,e.createElement)("div",null,(0,t.__)("Please wait until the lookup table is generated.","blocksy-companion"))};const M={categories:(0,t.__)("Please select a valid taxonomy.","blocksy-companion"),attributes:(0,t.__)("Please select a valid attribute.","blocksy-companion")};var L=function({isError:t,type:n,children:o}){const r=(0,c.useBlockProps)({className:"ct-block-notice components-notice is-warning"});return t?(0,e.createElement)("div",r,(0,e.createElement)("div",{className:"components-notice__content"},(0,e.createElement)("p",null,null==M?void 0:M[n]))):o};const I=function(e,n){return"categories"===e.type?n&&n.product_taxonomies&&n.product_taxonomies[e.taxonomy]&&n.product_taxonomies[e.taxonomy].name?n.product_taxonomies[e.taxonomy].name:(0,t.__)("Product Categories","blocksy-companion"):"attributes"===e.type?(0,t.__)("Product Attributes","blocksy-companion"):(0,t.__)("Taxonomy","blocksy-companion")};var A=function({blockData:n,attributes:o,setAttributes:r}){const{excludeTaxonomy:l,taxonomy_not_in:a}=o,c=I(o,n);return(0,e.createElement)(React.Fragment,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.sprintf)((0,t.__)("Exclude %s","blocksy-companion"),c),help:!1,checked:l,onChange:function(){return r({excludeTaxonomy:!l})}}),l&&(0,e.createElement)(i.FormTokenField,{label:(0,t.__)("Exclude Speciffic Items","blocksy-companion"),__experimentalShowHowTo:!1,value:n?n.flatTerms.filter(function({term_id:e}){return a.includes(e)}).map(function({term_id:e,name:t}){return`${t}---${e}`}):[],suggestions:n?n.flatTerms.map(function({name:e,term_id:t}){return`${e}---${t}`}):[],displayTransform:function(e){return e.split("---")[0]},__experimentalExpandOnFocus:!0,onChange:function(e){r({taxonomy_not_in:e.map(function(e){return parseInt(e.split("---")[1])})})}}))};const H=["1/1","4/3","16/9","2/1"];var D=function({attributes:n,setAttributes:o,blockData:r}){const{type:l,taxonomy:a,showItemsRendered:c,showTaxonomyImages:s,aspectRatio:u,logoMaxW:m,useFrame:p}=n,b=I(n,r),h=(0,e.useMemo)(function(){return"categories"===l?(0,t.sprintf)((0,t.__)("Show %s Image","blocksy-companion"),b):(0,t.__)("Show Swatches","blocksy-companion")},[l,b]),y=(0,e.useMemo)(function(){return"categories"===l&&"product_brand"===a||"attributes"===l?c:s},[l,a,c,s]),f=(0,e.useCallback)(function(){o("categories"!==l||"product_brand"===a?{showItemsRendered:!c}:{showTaxonomyImages:!s})},[l,a,s,c]),d=(0,e.useMemo)(function(){return"product_tag"!==a&&("categories"===l&&"product_brand"===a?c:"attributes"!==l&&s)},[l,a,c,s]);return r&&"product_tag"!==a?(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:h,checked:y,onChange:f}),d?(0,e.createElement)(React.Fragment,null,(0,e.createElement)(i.__experimentalToggleGroupControl,{label:(0,t.__)("Aspect Ratio","blocksy-companion"),value:u,isBlock:!0,onChange:function(e){return o({aspectRatio:e})}},H.map(function(t){return(0,e.createElement)(i.__experimentalToggleGroupControlOption,{key:t,value:t,label:t})})),(0,e.createElement)(i.__experimentalToggleGroupControl,{label:(0,t.__)("Scale","blocksy-companion"),value:n.imageFit,isBlock:!0,onChange:function(e){return o({imageFit:e})}},(0,e.createElement)(i.__experimentalToggleGroupControlOption,{key:"cover",value:"cover",label:(0,t.__)("Cover","blocksy-companion")}),(0,e.createElement)(i.__experimentalToggleGroupControlOption,{key:"contain",value:"contain",label:(0,t.__)("Contain","blocksy-companion")})),(0,e.createElement)(i.RangeControl,{label:(0,t.__)("Max width","blocksy-companion"),value:m,onChange:function(e){return o({logoMaxW:e})},min:10,max:140}),(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Image Frame","blocksy-companion"),checked:p,onChange:function(){return o({useFrame:!p})}})):null):null};function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const $=function(e){return e.reduce(function(e,t){return[...e,V(V({},t),{},{children:[]}),...t.children?$(t.children):[]]},[])},Z={categories:(0,t.__)("Taxonomy","blocksy-companion"),attributes:(0,t.__)("Attribute","blocksy-companion")};var G=function({attributes:n,setAttributes:o}){var r;const[l,a]=(0,e.useState)(null);(0,e.useEffect)(function(){!async function(){const e={type:n.type};"categories"===n.type&&(e.taxonomy=n.taxonomy),"attributes"===n.type&&(e.attribute=n.attribute),E(`${wp.ajax.settings.url}?action=blc_ext_filters_get_block_data`,e).then(function(e){return e.json()}).then(function({success:e,data:t}){t.terms.length>0&&(t.flatTerms=$(t.terms)),a(t)})}()},[n.type,n.taxonomy,n.attribute]),(0,e.useEffect)(function(){"brands"===n.type&&o({type:"categories",taxonomy:"product_brand"}),"product_brands"===n.taxonomy&&o({taxonomy:"product_brand"}),n.taxonomy||o({taxonomy:"product_cat"})},[n.type,n.taxonomy]);const s=[{label:(0,t.__)("Select attribute","blocksy-companion"),value:""},...l?Object.values(l.attributes_tax).map(function({attribute_name:e,attribute_label:t}){return{label:t,value:e}}):[]],u=l?Object.keys(l.product_taxonomies).map(function(e){return{label:l.product_taxonomies[e].name,value:e}}):[];let m=!1;return l&&"attributes"===n.type&&(n.attribute||(m=!0),s.map(function({value:e}){return e}).includes(n.attribute)||(m=!0)),l&&"categories"===n.type&&!u.map(function({value:e}){return e}).includes(n.taxonomy)&&(m=!0),(0,e.createElement)(React.Fragment,null,!l&&(0,e.createElement)(i.Spinner,null),l&&(0,e.createElement)(L,{isError:m,type:n.type},(0,e.createElement)(F,{blockData:l,attributes:n,setAttributes:o})),(0,e.createElement)(c.InspectorControls,null,(0,e.createElement)(i.Panel,{header:(0,t.__)("Filter Settings","blocksy-companion")},(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.__experimentalToggleGroupControl,{label:(0,t.__)("Filter By","blocksy-companion"),value:n.type,isBlock:!0,onChange:function(e){return o({type:e})}},Object.keys(Z).map(function(t){return(0,e.createElement)(i.__experimentalToggleGroupControlOption,{key:t,value:t,label:Z[t],disable:!0})})),(0,e.createElement)(i.__experimentalToggleGroupControl,{label:(0,t.__)("Display Type","blocksy-companion"),value:n.viewType,isBlock:!0,onChange:function(e){return o({viewType:e})}},(0,e.createElement)(i.__experimentalToggleGroupControlOption,{value:"list",label:(0,t.__)("List","blocksy-companion")}),(0,e.createElement)(i.__experimentalToggleGroupControlOption,{value:"inline",label:(0,t.__)("Inline","blocksy-companion")})),"categories"===n.type&&(0,e.createElement)(i.SelectControl,{label:(0,t.__)("Taxonomy","blocksy-companion"),options:u,value:n.taxonomy,onChange:function(e){return o({taxonomy:e})}}),"attributes"===n.type&&(0,e.createElement)(i.SelectControl,{label:(0,t.__)("Attribute","blocksy-companion"),options:s,value:n.attribute,onChange:function(e){return o({attribute:e})}})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Multiple Selections","blocksy-companion"),help:(0,t.__)("Allow selecting multiple items in a filter.","blocksy-companion"),checked:n.multipleFilters,onChange:function(){return o({multipleFilters:!n.multipleFilters})}})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Search Box","blocksy-companion"),checked:n.showSearch,onChange:function(){return o({showSearch:!n.showSearch})}})),"categories"===n.type&&(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Checkboxes","blocksy-companion"),checked:n.showCheckbox,onChange:function(){return o({showCheckbox:!n.showCheckbox})}})),"attributes"===n.type&&(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Checkboxes","blocksy-companion"),checked:n.showAttributesCheckbox,onChange:function(){return o({showAttributesCheckbox:!n.showAttributesCheckbox})}})),l&&"categories"===n.type&&"list"===n.viewType&&(null===(r=l.product_taxonomies[n.taxonomy])||void 0===r?void 0:r.is_taxonomy_hierarchical)&&(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Hierarchy","blocksy-companion"),checked:n.hierarchical,onChange:function(){return o({hierarchical:!n.hierarchical})}}),n.hierarchical?(0,e.createElement)(React.Fragment,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Expandable","blocksy-companion"),checked:n.expandable,onChange:function(){return o({expandable:!n.expandable})}}),n.expandable?(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Expanded by Default","blocksy-companion"),checked:n.defaultExpanded,onChange:function(){return o({defaultExpanded:!n.defaultExpanded})}}):null):null),(0,e.createElement)(D,{attributes:n,setAttributes:o,blockData:l}),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Label","blocksy-companion"),checked:n.showLabel,onChange:function(){return o({showLabel:!n.showLabel})}})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Counter","blocksy-companion"),checked:n.showCounters,onChange:function(){return o({showCounters:!n.showCounters})}})),"attributes"===n.type&&n.showItemsRendered||"categories"===n.type&&n.showTaxonomyImages||n.showItemsRendered&&"categories"===n.type&&"product_brand"===n.taxonomy?(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Tooltip","blocksy-companion"),checked:n.showTooltips,onChange:function(){return o({showTooltips:!n.showTooltips})}})):null,l&&l.terms.length>0&&(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(A,{attributes:n,setAttributes:o,blockData:l})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Container Maximum Height","blocksy-companion"),checked:n.limitHeight,onChange:function(){return o({limitHeight:!n.limitHeight})}}),n.limitHeight?(0,e.createElement)(i.RangeControl,{label:(0,t.__)("Max Height","blocksy-companion"),value:n.limitHeightValue,onChange:function(e){return o({limitHeightValue:e})},min:10,max:1e3,step:10}):null),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Reset Button","blocksy-companion"),checked:n.showResetButton,onChange:function(){return o({showResetButton:!n.showResetButton})}})))))};(0,o.registerBlockType)("blocksy/woocommerce-filters",{apiVersion:3,title:(0,t.__)("Shop Filters Controls","blocksy-companion"),description:(0,t.__)("Widget for filtering the WooCommerce products loop by category, attribute or brand.","blocksy-companion"),icon:"filter",icon:{src:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"wc-block-editor-components-block-icon"},(0,e.createElement)("path",{d:"M18.7,7.1c-0.4-1.5-1.7-2.6-3.3-2.6S12.4,5.6,12,7.1H4v1.8h8c0.4,1.5,1.7,2.5,3.3,2.5s2.9-1.1,3.3-2.5H20V7.1H18.7zM15.3,9.8c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8c1,0,1.8,0.8,1.8,1.8C17.1,8.9,16.3,9.8,15.3,9.8z M8.7,12.6c-1.6,0-2.9,1.1-3.3,2.6H4v1.8h1.3c0.4,1.5,1.7,2.5,3.3,2.5s2.9-1.1,3.3-2.5h8v-1.8h-8C11.6,13.7,10.3,12.6,8.7,12.6z M8.7,17.8c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8c1,0,1.8,0.8,1.8,1.8C10.5,17,9.7,17.8,8.7,17.8z"}))},category:"widgets",supports:{html:!1,inserter:!1,lock:!1},attributes:{type:{type:"string",default:"categories"},viewType:{type:"string",default:"list"},showCounters:{type:"boolean",default:!1},multipleFilters:{type:"boolean",default:!0},attribute:{type:"string",default:""},taxonomy:{type:"string",default:"product_cat"},showLabel:{type:"boolean",default:!0},showCheckbox:{type:"boolean",default:!0},showAttributesCheckbox:{type:"boolean",default:!1},showItemsRendered:{type:"boolean",default:!0},showTaxonomyImages:{type:"boolean",default:!1},showResetButton:{type:"boolean",default:!1},hierarchical:{type:"boolean",default:!1},expandable:{type:"boolean",default:!1},defaultExpanded:{type:"boolean",default:!0},useFrame:{type:"boolean",default:!1},logoMaxW:{type:"number",default:40},aspectRatio:{type:"string",default:"16/9"},imageFit:{type:"string",default:"contain"},excludeTaxonomy:{type:"boolean",default:!1},taxonomy_not_in:{type:"array",default:[]},showSearch:{type:"boolean",default:!1},searchPlaceholder:{type:"string",default:""},limitHeight:{type:"boolean",default:!1},limitHeightValue:{type:"number",default:400},showTooltips:{type:"boolean",default:!1}},edit:function(t){return(0,e.createElement)(G,t)},save:function(){return(0,e.createElement)("div",{class:"wp-block-blocksy-woocommerce-filters"},"Blocksy: Ajax Category Filter")},deprecated:[{isEligible:function({taxonomy:e}){return"product_brands"===e},migrate:function(){return{taxonomy:"product_brand"}}}]}),wp.blocks.registerBlockVariation("blocksy/widgets-wrapper",{name:"blocksy-filters",title:(0,t.__)("Shop Filters","blocksy-companion"),attributes:{heading:(0,t.__)("Filter","blocksy-companion"),block:"blocksy/woocommerce-filters"},isActive:function(e){return"blocksy/woocommerce-filters"===e.block},icon:{src:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"wc-block-editor-components-block-icon"},(0,e.createElement)("path",{d:"M18.7,7.1c-0.4-1.5-1.7-2.6-3.3-2.6S12.4,5.6,12,7.1H4v1.8h8c0.4,1.5,1.7,2.5,3.3,2.5s2.9-1.1,3.3-2.5H20V7.1H18.7zM15.3,9.8c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8c1,0,1.8,0.8,1.8,1.8C17.1,8.9,16.3,9.8,15.3,9.8z M8.7,12.6c-1.6,0-2.9,1.1-3.3,2.6H4v1.8h1.3c0.4,1.5,1.7,2.5,3.3,2.5s2.9-1.1,3.3-2.5h8v-1.8h-8C11.6,13.7,10.3,12.6,8.7,12.6z M8.7,17.8c-1,0-1.8-0.8-1.8-1.8c0-1,0.8-1.8,1.8-1.8c1,0,1.8,0.8,1.8,1.8C10.5,17,9.7,17.8,8.7,17.8z"}))}});var W=function({attributes:n,blockData:o}){const r=(0,c.useBlockProps)({className:"ct-filter-widget-wrapper"}),{showResetButton:l,showPrices:a,showInputs:s}=n;return o?(0,e.createElement)("div",r,(0,e.createElement)("div",{className:"ct-price-filter"},(0,e.createElement)("div",{className:"ct-price-filter-slider"},(0,e.createElement)("div",{className:"ct-price-filter-range-track",style:{"--start":"10%","--end":"70%"}}),(0,e.createElement)("span",{className:"ct-price-filter-range-handle-min",style:{insetInlineStart:"10%"}}),(0,e.createElement)("span",{className:"ct-price-filter-range-handle-max",style:{insetInlineStart:"70%"}}),(0,e.createElement)("input",{type:"range",value:10,readOnly:!0}),(0,e.createElement)("input",{type:"range",value:100,readOnly:!0})),a&&!s?(0,e.createElement)("div",{className:"ct-price-filter-values"},(0,e.createElement)("span",null,"Price: "),(0,e.createElement)("span",{className:"ct-price-filter-min"},o.currency_symbol,"10"),(0,e.createElement)("span",null," - "),(0,e.createElement)("span",{className:"ct-price-filter-max"},o.currency_symbol,"70")):null,s?(0,e.createElement)("div",{class:"ct-price-filter-inputs","data-currency-position":o.currency_position},(0,e.createElement)("div",{class:"ct-price-filter-input-min"},"Minimum:",(0,e.createElement)("div",{class:"ct-price-filter-input ct-pseudo-input"},(0,e.createElement)("small",null,o.currency_symbol),(0,e.createElement)("input",{type:"number",value:"10",min:"0",max:"70",step:"1",name:"min_price"}))),(0,e.createElement)("div",{class:"ct-price-filter-input-max"},"Maximum:",(0,e.createElement)("div",{class:"ct-price-filter-input ct-pseudo-input"},(0,e.createElement)("small",null,o.currency_symbol),(0,e.createElement)("input",{type:"number",value:"70",min:"0",max:"70",step:"1",name:"max_price"})))):null),l?(0,e.createElement)("div",{className:"ct-filter-reset wp-block-button is-style-outline"},(0,e.createElement)("a",{href:"#",className:"ct-button-ghost wp-element-button wp-block-button__link"},(0,e.createElement)("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"currentColor"},(0,e.createElement)("path",{d:"M8.5,7.5l4.5,4.5l-1,1L7.5,8.5L3,13l-1-1l4.5-4.5L2,3l1-1l4.5,4.5L12,2l1,1L8.5,7.5z"})),(0,t.__)("Reset Filter","blocksy-companion"))):null):(0,e.createElement)(i.Spinner,null)};(0,o.registerBlockType)("blocksy/woocommerce-price-filter",{apiVersion:3,title:(0,t.__)("Filter by Price Controls","blocksy-companion"),description:(0,t.__)("Widget for filtering the WooCommerce products by price.","blocksy-companion"),icon:"filter",icon:{src:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"wc-block-editor-components-block-icon"},(0,e.createElement)("path",{d:"M10.25,10.25c0,.17133.09821.40308.41229.62299.31183.2182.78241.37701,1.33771.37701.82538,0,1.6048.23297,2.19788.64807.5907.41351,1.05212,1.0567,1.05212,1.85193s-.46143,1.43842-1.05212,1.85193c-.4093.2865-.90729.48615-1.44788.58246v.31561c0,.41418-.33582.75-.75.75s-.75-.33582-.75-.75v-.31561c-.54059-.09631-1.03857-.29596-1.44788-.58246-.5907-.41351-1.05212-1.0567-1.05212-1.85193,0-.41418.33582-.75.75-.75s.75.33582.75.75c0,.17133.09821.40308.41229.62299.31183.2182.78241.37701,1.33771.37701s1.02588-.15881,1.33771-.37701c.31409-.21991.41229-.45166.41229-.62299s-.09821-.40308-.41229-.62299c-.31183-.2182-.78241-.37701-1.33771-.37701-.82538,0-1.6048-.23297-2.19788-.64807-.5907-.41351-1.05212-1.0567-1.05212-1.85193,0-.79517.46143-1.43835,1.05212-1.85187.4093-.2865.90729-.48621,1.44788-.58252v-.31561c0-.41418.33582-.75.75-.75s.75.33582.75.75v.31561c.54059.09631,1.03857.29602,1.44788.58252.5907.41351,1.05212,1.0567,1.05212,1.85187,0,.41418-.33582.75-.75.75s-.75-.33582-.75-.75c0-.17133-.09821-.40314-.41229-.62299-.31183-.21826-.78241-.37701-1.33771-.37701s-1.02588.15875-1.33771.37701c-.31409.21985-.41229.45166-.41229.62299ZM20.21289,13.47168l-1.36816,1.38086v1.95508c0,1.14648-.92871,2.0791-2.07129,2.0791h-1.9375l-1.36621,1.38184c-.38867.39062-.91016.60645-1.46777.60645-.55713,0-1.07812-.21582-1.4668-.60645l-1.36719-1.38184h-1.9375c-1.14258,0-2.07178-.93262-2.07178-2.0791v-1.95508l-1.37158-1.38086c-.8042-.81152-.8042-2.13037,0-2.94043l1.37158-1.38086v-1.95508c0-1.14746.9292-2.08057,2.07178-2.08057h1.9375l1.36719-1.37891c.38477-.38818.91943-.61084,1.4668-.61084.54785,0,1.08301.22266,1.46777.61084l1.36621,1.37891h1.9375c1.14258,0,2.07129.93311,2.07129,2.08057v1.95557l1.36816,1.38037c.80371.81006.80371,2.12891,0,2.94043ZM17.63086,14.06055l1.57715-1.58887c.2627-.26465.26172-.67969,0-.94482l-1.57715-1.58789c-.12891-.13232-.20312-.31299-.20312-.49707v-2.24756c0-.37793-.28125-.66309-.65527-.66309h-2.23047c-.18945,0-.36816-.07373-.50195-.20801l-1.57617-1.58936c-.24902-.25-.67627-.25-.92432,0l-1.57568,1.58887c-.12988.13232-.31348.2085-.50244.2085h-2.23047c-.37305,0-.6543.28516-.6543.66309v2.24756c0,.18457-.07422.36572-.20361.49707l-1.57617,1.58789c-.26318.26514-.26318.68018,0,.94482l1.57617,1.58887c.12939.13086.20361.31152.20361.49707v2.24805c0,.37793.28125.66211.6543.66211h2.23047c.1875,0,.37061.07617.50244.20898l1.57568,1.58887c.12793.12891.29199.19922.4624.19922h.00098c.16992,0,.33398-.07031.46094-.19922l1.57617-1.58887c.13379-.13477.31152-.20898.50195-.20898h2.23047c.37402,0,.65527-.28418.65527-.66211v-2.24805c0-.18457.07422-.36523.20312-.49707Z"}))},category:"widgets",supports:{html:!1,inserter:!1,lock:!1},attributes:{showTooltips:{type:"boolean",default:!0},showPrices:{type:"boolean",default:!0},showInputs:{type:"boolean",default:!1},showResetButton:{type:"boolean",default:!1}},edit:function({attributes:n,setAttributes:o}){const{showTooltips:r,showResetButton:l,showPrices:a,showInputs:s}=n,[u,m]=(0,e.useState)(null);return(0,e.useEffect)(function(){E(`${wp.ajax.settings.url}?action=blc_ext_filters_get_block_data`,{type:"price"}).then(function(e){return e.json()}).then(function({success:e,data:t}){m(t)})},[]),(0,e.createElement)(React.Fragment,null,(0,e.createElement)(W,{attributes:n,blockData:u}),(0,e.createElement)(c.InspectorControls,null,(0,e.createElement)(i.Panel,{header:"Filter Settings"},(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Tooltip","blocksy-companion"),checked:r,onChange:function(){return o({showTooltips:!r})}})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Price Input Fields","blocksy-companion"),checked:s,onChange:function(){return o({showInputs:!s})}})),s?null:(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Price Range Text","blocksy-companion"),checked:a,onChange:function(){return o({showPrices:!a})}})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Reset Button","blocksy-companion"),checked:l,onChange:function(){return o({showResetButton:!l})}})))))},save:function(){return(0,e.createElement)("div",{class:"wp-block-blocksy-woocommerce-price-filter"},"Blocksy: Price Filter")}}),wp.blocks.registerBlockVariation("blocksy/widgets-wrapper",{name:"blocksy-price-filter",title:(0,t.__)("Filter by Price","blocksy-companion"),attributes:{heading:(0,t.__)("Filter","blocksy-companion"),block:"blocksy/woocommerce-price-filter"},isActive:function(e){return"blocksy/woocommerce-price-filter"===e.block},icon:{src:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"wc-block-editor-components-block-icon"},(0,e.createElement)("path",{d:"M10.25,10.25c0,.17133.09821.40308.41229.62299.31183.2182.78241.37701,1.33771.37701.82538,0,1.6048.23297,2.19788.64807.5907.41351,1.05212,1.0567,1.05212,1.85193s-.46143,1.43842-1.05212,1.85193c-.4093.2865-.90729.48615-1.44788.58246v.31561c0,.41418-.33582.75-.75.75s-.75-.33582-.75-.75v-.31561c-.54059-.09631-1.03857-.29596-1.44788-.58246-.5907-.41351-1.05212-1.0567-1.05212-1.85193,0-.41418.33582-.75.75-.75s.75.33582.75.75c0,.17133.09821.40308.41229.62299.31183.2182.78241.37701,1.33771.37701s1.02588-.15881,1.33771-.37701c.31409-.21991.41229-.45166.41229-.62299s-.09821-.40308-.41229-.62299c-.31183-.2182-.78241-.37701-1.33771-.37701-.82538,0-1.6048-.23297-2.19788-.64807-.5907-.41351-1.05212-1.0567-1.05212-1.85193,0-.79517.46143-1.43835,1.05212-1.85187.4093-.2865.90729-.48621,1.44788-.58252v-.31561c0-.41418.33582-.75.75-.75s.75.33582.75.75v.31561c.54059.09631,1.03857.29602,1.44788.58252.5907.41351,1.05212,1.0567,1.05212,1.85187,0,.41418-.33582.75-.75.75s-.75-.33582-.75-.75c0-.17133-.09821-.40314-.41229-.62299-.31183-.21826-.78241-.37701-1.33771-.37701s-1.02588.15875-1.33771.37701c-.31409.21985-.41229.45166-.41229.62299ZM20.21289,13.47168l-1.36816,1.38086v1.95508c0,1.14648-.92871,2.0791-2.07129,2.0791h-1.9375l-1.36621,1.38184c-.38867.39062-.91016.60645-1.46777.60645-.55713,0-1.07812-.21582-1.4668-.60645l-1.36719-1.38184h-1.9375c-1.14258,0-2.07178-.93262-2.07178-2.0791v-1.95508l-1.37158-1.38086c-.8042-.81152-.8042-2.13037,0-2.94043l1.37158-1.38086v-1.95508c0-1.14746.9292-2.08057,2.07178-2.08057h1.9375l1.36719-1.37891c.38477-.38818.91943-.61084,1.4668-.61084.54785,0,1.08301.22266,1.46777.61084l1.36621,1.37891h1.9375c1.14258,0,2.07129.93311,2.07129,2.08057v1.95557l1.36816,1.38037c.80371.81006.80371,2.12891,0,2.94043ZM17.63086,14.06055l1.57715-1.58887c.2627-.26465.26172-.67969,0-.94482l-1.57715-1.58789c-.12891-.13232-.20312-.31299-.20312-.49707v-2.24756c0-.37793-.28125-.66309-.65527-.66309h-2.23047c-.18945,0-.36816-.07373-.50195-.20801l-1.57617-1.58936c-.24902-.25-.67627-.25-.92432,0l-1.57568,1.58887c-.12988.13232-.31348.2085-.50244.2085h-2.23047c-.37305,0-.6543.28516-.6543.66309v2.24756c0,.18457-.07422.36572-.20361.49707l-1.57617,1.58789c-.26318.26514-.26318.68018,0,.94482l1.57617,1.58887c.12939.13086.20361.31152.20361.49707v2.24805c0,.37793.28125.66211.6543.66211h2.23047c.1875,0,.37061.07617.50244.20898l1.57568,1.58887c.12793.12891.29199.19922.4624.19922h.00098c.16992,0,.33398-.07031.46094-.19922l1.57617-1.58887c.13379-.13477.31152-.20898.50195-.20898h2.23047c.37402,0,.65527-.28418.65527-.66211v-2.24805c0-.18457.07422-.36523.20312-.49707Z"}))}});var U=function({attributes:n,blockData:o}){const r=(0,c.useBlockProps)({className:"ct-filter-widget-wrapper"}),{showCounters:l,showResetButton:a,showCheckboxes:s,layout:u,statuses:m}=n,{status_counts:p}=o||{};return o?(0,e.createElement)("div",r,(0,e.createElement)("div",{className:"ct-status-filter"},(0,e.createElement)("ul",{className:"ct-filter-widget","data-display-type":u},m.map(function({id:t,label:n,enabled:o}){return o&&+p[t]?(0,e.createElement)("li",{className:"ct-filter-item",key:t},(0,e.createElement)("div",{className:"ct-filter-item-inner"},(0,e.createElement)("a",{href:"#",rel:"nofollow","aria-label":t,"data-key":"filter_stock_status","data-value":t},s?(0,e.createElement)("span",{className:"ct-filter-checkbox"}):null,(0,e.createElement)("span",{className:"ct-filter-label"},n),l?(0,e.createElement)("span",{className:"ct-filter-count"},p[t]||0):null))):null}))),a?(0,e.createElement)("div",{className:"ct-filter-reset wp-block-button is-style-outline"},(0,e.createElement)("a",{href:"#",className:"ct-button-ghost wp-element-button wp-block-button__link"},(0,e.createElement)("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"currentColor"},(0,e.createElement)("path",{d:"M8.5,7.5l4.5,4.5l-1,1L7.5,8.5L3,13l-1-1l4.5-4.5L2,3l1-1l4.5,4.5L12,2l1,1L8.5,7.5z"})),(0,t.__)("Reset Filter","blocksy-companion"))):null):(0,e.createElement)(i.Spinner,null)},K=window.blocksyOptions;function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const Q=(0,K.getOptionsForBlock)("status_filter"),X=(0,K.getAttributesFromOptions)(Q);(0,o.registerBlockType)("blocksy/woocommerce-status-filter",{apiVersion:3,title:(0,t.__)("Filter by Status Controls","blocksy-companion"),description:(0,t.__)("Filter by products status.","blocksy-companion"),icon:"filter",icon:{src:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"wc-block-editor-components-block-icon"},(0,e.createElement)("path",{"fill-rule":"evenodd",d:"M12 19.313a7.312 7.312 0 1 1 0-14.625 7.312 7.312 0 0 1 0 14.625ZM3 12a9 9 0 1 1 18 0 9 9 0 0 1-18 0Zm12.972-1.653-1.194-1.194-3.903 3.904-1.653-1.654-1.194 1.194 2.847 2.846 5.097-5.096Z"}))},category:"widgets",supports:{html:!1,inserter:!1,lock:!1},attributes:q(q({},X),{},{layout:{type:"string",default:"list"},showCheckboxes:{type:"boolean",default:!0},showCounters:{type:"boolean",default:!0},showResetButton:{type:"boolean",default:!1}}),edit:function({attributes:n,setAttributes:o}){const{layout:r,showResetButton:l,showCounters:a,showCheckboxes:s}=n,[u,m]=(0,e.useState)(null);return(0,e.useEffect)(function(){E(`${wp.ajax.settings.url}?action=blc_ext_filters_get_block_data`,{type:"status"}).then(function(e){return e.json()}).then(function({success:e,data:t}){m(t)})},[]),(0,e.createElement)(React.Fragment,null,(0,e.createElement)(U,{attributes:n,blockData:u}),(0,e.createElement)(c.InspectorControls,null,(0,e.createElement)(i.Panel,{header:"Filter Settings"},(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.__experimentalToggleGroupControl,{label:(0,t.__)("Display Type","blocksy-companion"),value:r,isBlock:!0,onChange:function(e){return o({layout:e})}},(0,e.createElement)(i.__experimentalToggleGroupControlOption,{key:"list",value:"list",label:(0,t.__)("List","blocksy-companion")}),(0,e.createElement)(i.__experimentalToggleGroupControlOption,{key:"inline",value:"inline",label:(0,t.__)("Inline","blocksy-companion")})),(0,e.createElement)(K.OptionsPanel,{purpose:"gutenberg",onChange:function(e,t){o({[e]:t})},options:Q,value:n,hasRevertButton:!1})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Checkboxes","blocksy-companion"),checked:s,onChange:function(){return o({showCheckboxes:!s})}})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Counters","blocksy-companion"),checked:a,onChange:function(){return o({showCounters:!a})}})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Reset Button","blocksy-companion"),checked:l,onChange:function(){return o({showResetButton:!l})}})))))},save:function(){return(0,e.createElement)("div",null,"Blocksy: Status Filter")}}),wp.blocks.registerBlockVariation("blocksy/widgets-wrapper",{name:"blocksy-status-filter",title:(0,t.__)("Filter by Status","blocksy-companion"),attributes:{heading:(0,t.__)("Filter","blocksy-companion"),block:"blocksy/woocommerce-status-filter"},isActive:function(e){return"blocksy/woocommerce-status-filter"===e.block},icon:{src:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"wc-block-editor-components-block-icon"},(0,e.createElement)("path",{"fill-rule":"evenodd",d:"M12 19.313a7.312 7.312 0 1 1 0-14.625 7.312 7.312 0 0 1 0 14.625ZM3 12a9 9 0 1 1 18 0 9 9 0 0 1-18 0Zm12.972-1.653-1.194-1.194-3.903 3.904-1.653-1.654-1.194 1.194 2.847 2.846 5.097-5.096Z"}))}});var Y=n(942),ee=n.n(Y);const te=[{id:1,label:(0,t.__)("1 star","blocksy-companion")},{id:2,label:(0,t.__)("2 stars","blocksy-companion")},{id:3,label:(0,t.__)("3 stars","blocksy-companion")},{id:4,label:(0,t.__)("4 stars","blocksy-companion")},{id:5,label:(0,t.__)("5 stars","blocksy-companion")}];var ne=function({attributes:n}){const o=(0,c.useBlockProps)({className:"ct-filter-widget-wrapper"}),{showResetButton:r}=n;return(0,e.createElement)("div",o,(0,e.createElement)("div",{className:"ct-rating-filter"},(0,e.createElement)("ul",{className:"ct-filter-widget","data-display-type":"inline"},te.map(function({id:t,label:n}){return(0,e.createElement)("li",{className:ee()("ct-filter-item",{active:4===t}),key:t},(0,e.createElement)("a",{href:"#",rel:"nofollow",ariaLabel:t,dataKey:"filter_stock_rating",dataValue:t},(0,e.createElement)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},(0,e.createElement)("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}))))}))),r?(0,e.createElement)("div",{className:"ct-filter-reset wp-block-button is-style-outline"},(0,e.createElement)("a",{href:"#",className:"ct-button-ghost wp-element-button wp-block-button__link"},(0,e.createElement)("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"currentColor"},(0,e.createElement)("path",{d:"M8.5,7.5l4.5,4.5l-1,1L7.5,8.5L3,13l-1-1l4.5-4.5L2,3l1-1l4.5,4.5L12,2l1,1L8.5,7.5z"})),(0,t.__)("Reset Filter","blocksy-companion"))):null)};(0,o.registerBlockType)("blocksy/woocommerce-rating-filter",{apiVersion:3,title:(0,t.__)("Filter by Rating Controls","blocksy-companion"),description:(0,t.__)("Filter by products rating.","blocksy-companion"),icon:"filter",icon:{src:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"wc-block-editor-components-block-icon"},(0,e.createElement)("path",{"fill-rule":"evenodd",d:"M5.3 3h13.4C20 3 21 4 21 5.3v13.4c0 1.3-1 2.3-2.3 2.3H5.3C4 21 3 20 3 18.7V5.3C3 4 4 3 5.3 3Zm13.4 16.5c.4 0 .8-.4.8-.8V5.3c0-.4-.4-.8-.8-.8H5.3c-.4 0-.8.4-.8.8v13.4c0 .4.4.8.8.8h13.4ZM11.924 8.022a.144.144 0 0 0-.053.058l-1.186 2.404a.144.144 0 0 1-.108.078l-2.653.386a.143.143 0 0 0-.08.244l1.92 1.871a.143.143 0 0 1 .041.128l-.453 2.642a.144.144 0 0 0 .208.15l2.373-1.247a.144.144 0 0 1 .133 0l2.374 1.247a.143.143 0 0 0 .207-.15l-.453-2.642a.143.143 0 0 1 .041-.128l1.92-1.871a.144.144 0 0 0-.008-.212.143.143 0 0 0-.071-.032l-2.653-.386a.144.144 0 0 1-.108-.078L12.128 8.08a.143.143 0 0 0-.204-.058Z"}))},category:"widgets",supports:{html:!1,inserter:!1,lock:!1},attributes:{showTooltips:{type:"boolean",default:!0},exactMatch:{type:"boolean",default:!1},showResetButton:{type:"boolean",default:!1}},edit:function({attributes:n,setAttributes:o}){const{showResetButton:r,showTooltips:l,exactMatch:a}=n;return(0,e.createElement)(React.Fragment,null,(0,e.createElement)(ne,{attributes:n}),(0,e.createElement)(c.InspectorControls,null,(0,e.createElement)(i.Panel,{header:"Filter Settings"},(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Match Rating Exactly","blocksy-companion"),help:(0,t.__)("Show only products that match the selected rating exactly.","blocksy-companion"),checked:a,onChange:function(){return o({exactMatch:!a})}})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Tooltip","blocksy-companion"),checked:l,onChange:function(){return o({showTooltips:!l})}})),(0,e.createElement)(i.PanelBody,null,(0,e.createElement)(i.ToggleControl,{label:(0,t.__)("Show Reset Button","blocksy-companion"),checked:r,onChange:function(){return o({showResetButton:!r})}})))))},save:function(){return(0,e.createElement)("div",null,"Blocksy: Rating Filter")}}),wp.blocks.registerBlockVariation("blocksy/widgets-wrapper",{name:"blocksy-rating-filter",title:(0,t.__)("Filter by Rating","blocksy-companion"),attributes:{heading:(0,t.__)("Filter","blocksy-companion"),block:"blocksy/woocommerce-rating-filter"},isActive:function(e){return"blocksy/woocommerce-rating-filter"===e.block},icon:{src:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"wc-block-editor-components-block-icon"},(0,e.createElement)("path",{"fill-rule":"evenodd",d:"M5.3 3h13.4C20 3 21 4 21 5.3v13.4c0 1.3-1 2.3-2.3 2.3H5.3C4 21 3 20 3 18.7V5.3C3 4 4 3 5.3 3Zm13.4 16.5c.4 0 .8-.4.8-.8V5.3c0-.4-.4-.8-.8-.8H5.3c-.4 0-.8.4-.8.8v13.4c0 .4.4.8.8.8h13.4ZM11.924 8.022a.144.144 0 0 0-.053.058l-1.186 2.404a.144.144 0 0 1-.108.078l-2.653.386a.143.143 0 0 0-.08.244l1.92 1.871a.143.143 0 0 1 .041.128l-.453 2.642a.144.144 0 0 0 .208.15l2.373-1.247a.144.144 0 0 1 .133 0l2.374 1.247a.143.143 0 0 0 .207-.15l-.453-2.642a.143.143 0 0 1 .041-.128l1.92-1.871a.144.144 0 0 0-.008-.212.143.143 0 0 0-.071-.032l-2.653-.386a.144.144 0 0 1-.108-.078L12.128 8.08a.143.143 0 0 0-.204-.058Z"}))}})}()}();