!function(){var e={151(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},939(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 l=e[o]<<16|e[o+1]<<8|e[o+2],a=0;a<4;a++)8*o+6*a<=8*e.length?n.push(t.charAt(l>>>6*(3-a)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],o=0,l=0;o<e.length;l=++o%4)0!=l&&n.push((t.indexOf(e.charAt(o-1))&Math.pow(2,-2*l+8)-1)<<2*l|t.indexOf(e.charAt(o))>>>6-2*l);return n}},e.exports=n},206(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(e,t,n){var o,l,a,r,c;o=n(939),l=n(151).utf8,a=n(206),r=n(151).bin,(c=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?r.stringToBytes(e):l.stringToBytes(e):a(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,h=0;h<n.length;h++)n[h]=16711935&(n[h]<<8|n[h]>>>24)|4278255360&(n[h]<<24|n[h]>>>8);n[i>>>5]|=128<<i%32,n[14+(i+64>>>9<<4)]=i;var b=c._ff,y=c._gg,d=c._hh,f=c._ii;for(h=0;h<n.length;h+=16){var g=s,_=u,w=m,k=p;s=b(s,u,m,p,n[h+0],7,-680876936),p=b(p,s,u,m,n[h+1],12,-389564586),m=b(m,p,s,u,n[h+2],17,606105819),u=b(u,m,p,s,n[h+3],22,-1044525330),s=b(s,u,m,p,n[h+4],7,-176418897),p=b(p,s,u,m,n[h+5],12,1200080426),m=b(m,p,s,u,n[h+6],17,-1473231341),u=b(u,m,p,s,n[h+7],22,-45705983),s=b(s,u,m,p,n[h+8],7,1770035416),p=b(p,s,u,m,n[h+9],12,-1958414417),m=b(m,p,s,u,n[h+10],17,-42063),u=b(u,m,p,s,n[h+11],22,-1990404162),s=b(s,u,m,p,n[h+12],7,1804603682),p=b(p,s,u,m,n[h+13],12,-40341101),m=b(m,p,s,u,n[h+14],17,-1502002290),s=y(s,u=b(u,m,p,s,n[h+15],22,1236535329),m,p,n[h+1],5,-165796510),p=y(p,s,u,m,n[h+6],9,-1069501632),m=y(m,p,s,u,n[h+11],14,643717713),u=y(u,m,p,s,n[h+0],20,-373897302),s=y(s,u,m,p,n[h+5],5,-701558691),p=y(p,s,u,m,n[h+10],9,38016083),m=y(m,p,s,u,n[h+15],14,-660478335),u=y(u,m,p,s,n[h+4],20,-405537848),s=y(s,u,m,p,n[h+9],5,568446438),p=y(p,s,u,m,n[h+14],9,-1019803690),m=y(m,p,s,u,n[h+3],14,-187363961),u=y(u,m,p,s,n[h+8],20,1163531501),s=y(s,u,m,p,n[h+13],5,-1444681467),p=y(p,s,u,m,n[h+2],9,-51403784),m=y(m,p,s,u,n[h+7],14,1735328473),s=d(s,u=y(u,m,p,s,n[h+12],20,-1926607734),m,p,n[h+5],4,-378558),p=d(p,s,u,m,n[h+8],11,-2022574463),m=d(m,p,s,u,n[h+11],16,1839030562),u=d(u,m,p,s,n[h+14],23,-35309556),s=d(s,u,m,p,n[h+1],4,-1530992060),p=d(p,s,u,m,n[h+4],11,1272893353),m=d(m,p,s,u,n[h+7],16,-155497632),u=d(u,m,p,s,n[h+10],23,-1094730640),s=d(s,u,m,p,n[h+13],4,681279174),p=d(p,s,u,m,n[h+0],11,-358537222),m=d(m,p,s,u,n[h+3],16,-722521979),u=d(u,m,p,s,n[h+6],23,76029189),s=d(s,u,m,p,n[h+9],4,-640364487),p=d(p,s,u,m,n[h+12],11,-421815835),m=d(m,p,s,u,n[h+15],16,530742520),s=f(s,u=d(u,m,p,s,n[h+2],23,-995338651),m,p,n[h+0],6,-198630844),p=f(p,s,u,m,n[h+7],10,1126891415),m=f(m,p,s,u,n[h+14],15,-1416354905),u=f(u,m,p,s,n[h+5],21,-57434055),s=f(s,u,m,p,n[h+12],6,1700485571),p=f(p,s,u,m,n[h+3],10,-1894986606),m=f(m,p,s,u,n[h+10],15,-1051523),u=f(u,m,p,s,n[h+1],21,-2054922799),s=f(s,u,m,p,n[h+8],6,1873313359),p=f(p,s,u,m,n[h+15],10,-30611744),m=f(m,p,s,u,n[h+6],15,-1560198380),u=f(u,m,p,s,n[h+13],21,1309151649),s=f(s,u,m,p,n[h+4],6,-145523070),p=f(p,s,u,m,n[h+11],10,-1120210379),m=f(m,p,s,u,n[h+2],15,718787259),u=f(u,m,p,s,n[h+9],21,-343485551),s=s+g>>>0,u=u+_>>>0,m=m+w>>>0,p=p+k>>>0}return o.endian([s,u,m,p])})._ff=function(e,t,n,o,l,a,r){var c=e+(t&n|~t&o)+(l>>>0)+r;return(c<<a|c>>>32-a)+t},c._gg=function(e,t,n,o,l,a,r){var c=e+(t&o|n&~o)+(l>>>0)+r;return(c<<a|c>>>32-a)+t},c._hh=function(e,t,n,o,l,a,r){var c=e+(t^n^o)+(l>>>0)+r;return(c<<a|c>>>32-a)+t},c._ii=function(e,t,n,o,l,a,r){var c=e+(n^(t|~o))+(l>>>0)+r;return(c<<a|c>>>32-a)+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?r.bytesToString(n):o.bytesToHex(n)}},942(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 l(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=r(e,a(n)))}return e}function a(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return l.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=r(t,n));return t}function r(e,t){return t?e?e+" "+t:e+t:e}e.exports?(l.default=l,e.exports=l):void 0===(n=function(){return l}.apply(t,[]))||(e.exports=n)}()}},t={};function n(o){var l=t[o];if(void 0!==l)return l.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.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,l=window.wp.blockEditor,a=window.wp.components;const r=function(){const e={};return e.promise=new Promise(function(t,n){e.resolve=t,e.reject=n}),e};var c=n(503),i=n.n(c);function s(e){if(Array.isArray(e))return`[${e.map(function(e){return s(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+=`${s(e[n[o]])},`;return`${t}}`}return`${JSON.stringify(e)}`}const u=function(e){return i()(s(e))};const m=0,p=1,h=2;let b={cacheKey:{state:m,response:null,payoad:{}}},y={};const d=new class{parseOptions(e){const{fetcherName:t=null,...n}=e;return{args:{fetcherName:t},inputFetchOptions:n}}fetch(e,t,n){const{args:o}=this.parseOptions(n),l=u({...t,url:e});if(b[l]||(b[l]={state:m,response:null,payload:{waitingForResponse:[]}},o.fetcherName&&y[o.fetcherName]&&(y[o.fetcherName].forEach(function(e){e.abort()}),y[o.fetcherName]=[])),b[l].state===h){const e=r();return e.resolve(b[l].response.clone()),e.promise}if(b[l].state===p)return this.fetchLoadingState(l,e,t,n);if(b[l].state===m)return this.fetchEmptyState(l,e,t,n);throw new Error("Invalid state",{cacheEntry:b[l]})}fetchLoadingState(e,t,n,o){const l=r();return b[e].payload.waitingForResponse.push(l),l.promise}fetchEmptyState(e,t,n,o){const{args:l,inputFetchOptions:a}=this.parseOptions(o);b[e].state=p;let c=new AbortController;l.fetcherName&&(y[l.fetcherName]||(y[l.fetcherName]=[]),y[l.fetcherName].push(c));const i=r(),s={method:"POST",headers:{"Content-Type":"application/json"},signal:c.signal,...a};return"POST"===s.method&&(s.body=JSON.stringify(n)),fetch(t,s).then(function(t){b[e].response=t.clone(),[i,...b[e].payload.waitingForResponse].forEach(function(t){t.resolve(b[e].response.clone())}),b[e].payload={waitingForResponse:[]},b[e].state=h,l.fetcherName&&(y[l.fetcherName]=[])}).catch(function(t){[i,...b[e].payload.waitingForResponse].forEach(function(t){t.reject(b[e].response)}),b[e].payload={waitingForResponse:[]},b[e].state=m}),i.promise}};var f=function(e,t,n={}){return d.fetch(e,t,n)};function g(){return g=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},g.apply(null,arguments)}var _=function({showCheckbox:t}){return t?(0,e.createElement)("span",{className:"ct-filter-checkbox"}):null};var w=function({showLabel:t=!0,label:n,count:o=0,withCount:l=!1}){return t||l?(0,e.createElement)("span",{className:"ct-filter-label"},t?`${n}`:"",l?(0,e.createElement)("span",{className:"ct-filter-count"},"(",o,")"):null):null};var k=function({showCounters:t,count:n}){return t?(0,e.createElement)("span",{className:"ct-filter-count"},n):null};var E=function({blockData:t,maybeAttribute:n,attributes:o,item:l}){const a=l?.meta?.accent_color?.default?.color,r=l?.meta?.image?.url,c=(0,e.useMemo)(function(){if("dual"===l?.meta?.color_type&&l?.meta?.accent_color?.secondary?.color&&"CT_CSS_SKIP_RULE"!==l?.meta?.accent_color?.secondary?.color&&l?.meta?.accent_color?.default?.color&&"CT_CSS_SKIP_RULE"!==l?.meta?.accent_color?.default?.color){const{accent_color:e}=l.meta,{default:{color:t},secondary:{color:n}}=e;return{backgroundImage:`linear-gradient(-45deg, ${t} 0%, ${t} 50%, ${n} 50%, ${n} 100%)`}}return{backgroundColor:a}},[l?.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)(_,{showCheckbox:o.showAttributesCheckbox}),t.has_swatches&&o.showItemsRendered?(0,e.createElement)(React.Fragment,null,"color"===n?.type&&"CT_CSS_SKIP_RULE"!==a||"image"===n?.type&&r||"button"===n?.type?(0,e.createElement)("span",{className:"ct-swatch-container"},"color"===n?.type?(0,e.createElement)("span",{className:"ct-swatch",style:c}):null,"image"===n?.type?(0,e.createElement)("span",{className:"ct-media-container ct-swatch"},(0,e.createElement)("img",{src:r,alt:l.name,style:{aspectRatio:"1/1",height:"auto",maxWidth:"100%"}})):null,"button"===n?.type?(0,e.createElement)("span",{className:"ct-swatch"},l?.meta?.short_name||l?.name):null):null):null,(0,e.createElement)(w,{label:l.name,showLabel:o.showLabel}),(0,e.createElement)(k,{count:l.count,showCounters:o.showCounters}))))};var v=function({taxItem:t,attributes:n}){const{showItemsRendered:o,showTaxonomyImages:l,type:a,taxonomy:r}=n;return(o||l)&&t?.tax_image?.url&&("categories"!==a||"product_brand"!==r||o)&&("categories"!==a||"product_brand"===r||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 x=function({taxItem:t,attributes:n}){const o=t.children||[],{showLabel:l}=n,a=!n.expandable||n.defaultExpanded,r="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)(_,{showCheckbox:n.showCheckbox}),(0,e.createElement)(v,{taxItem:t,attributes:n}),(0,e.createElement)(w,{showLabel:l,label:t.name,count:t.count,withCount:n.showCounters&&c&&r}),(0,e.createElement)(k,{count:t.count,showCounters:n.showCounters&&(!c||!r)})),o.length&&r&&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&&r&&a?(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)(x,{key:t.term_id,taxItem:t,attributes:n})})):null)};var C=x;var T=function({attributes:n,setAttributes:o,blockData:a}){const r=(0,l.useBlockProps)({className:"ct-filter-widget-wrapper"}),c=(0,e.useMemo)(function(){if(n.searchPlaceholder.length)return n.searchPlaceholder;let e="";if("attributes"===n.type){const t=Object.values(a.attributes_tax).find(function({attribute_name:e}){return e===n.attribute});t&&(e=t.attribute_label.toLowerCase())}return"categories"===n.type&&a.product_taxonomies[n.taxonomy]&&(e=a.product_taxonomies[n.taxonomy].name.toLowerCase()),sprintf((0,t.__)("Find by %s","blocksy-companion"),e)},[n,a]),i={color:a.ct_color_swatch_shape,image:a.ct_image_swatch_shape,button:a.ct_button_swatch_shape,mixed:a.ct_mixed_swatch_shape},s=Object.values(a.attributes_tax).find(function({attribute_name:e}){return e===n.attribute}),u=(0,e.useMemo)(function(){return"categories"===n.type?{style:{"--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?{"data-swatches-shape":i[s.type],"data-swatches-type":s.type,...n.limitHeight?{style:{maxHeight:`${n.limitHeightValue}px`}}:{}}:{...n.limitHeight?{style:{maxHeight:`${n.limitHeightValue}px`}}:{}}},[n,s]);return"categories"!==n.type||a.can_display_preview?(0,e.createElement)("div",r,n.showSearch&&(0,e.createElement)("div",{className:"ct-filter-search"},(0,e.createElement)("input",{type:"search",placeholder:c,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",g({className:"ct-filter-widget"},u,{"data-display-type":n.viewType,"data-filter-criteria":"categories"===n.type?`taxonomy:${n.taxonomy}`:n.type}),a.terms.length>0&&("categories"===n.type&&n.hierarchical&&"list"===n.viewType?a.terms:a.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)(C,{key:t.term_id,taxItem:t,attributes:n}):(0,e.createElement)(E,{key:t.term_id,blockData:a,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 B={categories:(0,t.__)("Please select a valid taxonomy.","blocksy-companion"),attributes:(0,t.__)("Please select a valid attribute.","blocksy-companion")};var S=function({isError:t,type:n,children:o}){const a=(0,l.useBlockProps)({className:"ct-block-notice components-notice is-warning"});return t?(0,e.createElement)("div",a,(0,e.createElement)("div",{className:"components-notice__content"},(0,e.createElement)("p",null,B?.[n]))):o};const N=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 R=function({blockData:n,attributes:o,setAttributes:l}){const{excludeTaxonomy:r,taxonomy_not_in:c}=o,i=N(o,n);return(0,e.createElement)(React.Fragment,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.sprintf)((0,t.__)("Exclude %s","blocksy-companion"),i),help:!1,checked:r,onChange:function(){return l({excludeTaxonomy:!r})}}),r&&(0,e.createElement)(a.FormTokenField,{label:(0,t.__)("Exclude Speciffic Items","blocksy-companion"),__experimentalShowHowTo:!1,value:n?n.flatTerms.filter(function({term_id:e}){return c.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){l({taxonomy_not_in:e.map(function(e){return parseInt(e.split("---")[1])})})}}))};const F=["1/1","4/3","16/9","2/1"];var P=function({attributes:n,setAttributes:o,blockData:l}){const{type:r,taxonomy:c,showItemsRendered:i,showTaxonomyImages:s,aspectRatio:u,logoMaxW:m,useFrame:p}=n,h=N(n,l),b=(0,e.useMemo)(function(){return"categories"===r?(0,t.sprintf)((0,t.__)("Show %s Image","blocksy-companion"),h):(0,t.__)("Show Swatches","blocksy-companion")},[r,h]),y=(0,e.useMemo)(function(){return"categories"===r&&"product_brand"===c||"attributes"===r?i:s},[r,c,i,s]),d=(0,e.useCallback)(function(){o("categories"!==r||"product_brand"===c?{showItemsRendered:!i}:{showTaxonomyImages:!s})},[r,c,s,i]),f=(0,e.useMemo)(function(){return"product_tag"!==c&&("categories"===r&&"product_brand"===c?i:"attributes"!==r&&s)},[r,c,i,s]);return l&&"product_tag"!==c?(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:b,checked:y,onChange:d}),f?(0,e.createElement)(React.Fragment,null,(0,e.createElement)(a.__experimentalToggleGroupControl,{label:(0,t.__)("Aspect Ratio","blocksy-companion"),value:u,isBlock:!0,onChange:function(e){return o({aspectRatio:e})}},F.map(function(t){return(0,e.createElement)(a.__experimentalToggleGroupControlOption,{key:t,value:t,label:t})})),(0,e.createElement)(a.__experimentalToggleGroupControl,{label:(0,t.__)("Scale","blocksy-companion"),value:n.imageFit,isBlock:!0,onChange:function(e){return o({imageFit:e})}},(0,e.createElement)(a.__experimentalToggleGroupControlOption,{key:"cover",value:"cover",label:(0,t.__)("Cover","blocksy-companion")}),(0,e.createElement)(a.__experimentalToggleGroupControlOption,{key:"contain",value:"contain",label:(0,t.__)("Contain","blocksy-companion")})),(0,e.createElement)(a.RangeControl,{label:(0,t.__)("Max width","blocksy-companion"),value:m,onChange:function(e){return o({logoMaxW:e})},min:10,max:140}),(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Image Frame","blocksy-companion"),checked:p,onChange:function(){return o({useFrame:!p})}})):null):null};const M=function(e){return e.reduce(function(e,t){return[...e,{...t,children:[]},...t.children?M(t.children):[]]},[])},L={categories:(0,t.__)("Taxonomy","blocksy-companion"),attributes:(0,t.__)("Attribute","blocksy-companion")};var I=function({attributes:n,setAttributes:o}){const[r,c]=(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),f(`${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=M(t.terms)),c(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 i=[{label:(0,t.__)("Select attribute","blocksy-companion"),value:""},...r?Object.values(r.attributes_tax).map(function({attribute_name:e,attribute_label:t}){return{label:t,value:e}}):[]],s=r?Object.keys(r.product_taxonomies).map(function(e){return{label:r.product_taxonomies[e].name,value:e}}):[];let u=!1;return r&&"attributes"===n.type&&(n.attribute||(u=!0),i.map(function({value:e}){return e}).includes(n.attribute)||(u=!0)),r&&"categories"===n.type&&!s.map(function({value:e}){return e}).includes(n.taxonomy)&&(u=!0),(0,e.createElement)(React.Fragment,null,!r&&(0,e.createElement)(a.Spinner,null),r&&(0,e.createElement)(S,{isError:u,type:n.type},(0,e.createElement)(T,{blockData:r,attributes:n,setAttributes:o})),(0,e.createElement)(l.InspectorControls,null,(0,e.createElement)(a.Panel,{header:(0,t.__)("Filter Settings","blocksy-companion")},(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.__experimentalToggleGroupControl,{label:(0,t.__)("Filter By","blocksy-companion"),value:n.type,isBlock:!0,onChange:function(e){return o({type:e})}},Object.keys(L).map(function(t){return(0,e.createElement)(a.__experimentalToggleGroupControlOption,{key:t,value:t,label:L[t],disable:!0})})),(0,e.createElement)(a.__experimentalToggleGroupControl,{label:(0,t.__)("Display Type","blocksy-companion"),value:n.viewType,isBlock:!0,onChange:function(e){return o({viewType:e})}},(0,e.createElement)(a.__experimentalToggleGroupControlOption,{value:"list",label:(0,t.__)("List","blocksy-companion")}),(0,e.createElement)(a.__experimentalToggleGroupControlOption,{value:"inline",label:(0,t.__)("Inline","blocksy-companion")})),"categories"===n.type&&(0,e.createElement)(a.SelectControl,{label:(0,t.__)("Taxonomy","blocksy-companion"),options:s,value:n.taxonomy,onChange:function(e){return o({taxonomy:e})}}),"attributes"===n.type&&(0,e.createElement)(a.SelectControl,{label:(0,t.__)("Attribute","blocksy-companion"),options:i,value:n.attribute,onChange:function(e){return o({attribute:e})}})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.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)(a.PanelBody,null,(0,e.createElement)(a.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)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Checkboxes","blocksy-companion"),checked:n.showCheckbox,onChange:function(){return o({showCheckbox:!n.showCheckbox})}})),"attributes"===n.type&&(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Checkboxes","blocksy-companion"),checked:n.showAttributesCheckbox,onChange:function(){return o({showAttributesCheckbox:!n.showAttributesCheckbox})}})),r&&"categories"===n.type&&"list"===n.viewType&&r.product_taxonomies[n.taxonomy]?.is_taxonomy_hierarchical&&(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.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)(a.ToggleControl,{label:(0,t.__)("Expandable","blocksy-companion"),checked:n.expandable,onChange:function(){return o({expandable:!n.expandable})}}),n.expandable?(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Expanded by Default","blocksy-companion"),checked:n.defaultExpanded,onChange:function(){return o({defaultExpanded:!n.defaultExpanded})}}):null):null),(0,e.createElement)(P,{attributes:n,setAttributes:o,blockData:r}),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Label","blocksy-companion"),checked:n.showLabel,onChange:function(){return o({showLabel:!n.showLabel})}})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.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)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Tooltip","blocksy-companion"),checked:n.showTooltips,onChange:function(){return o({showTooltips:!n.showTooltips})}})):null,r&&r.terms.length>0&&(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(R,{attributes:n,setAttributes:o,blockData:r})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Container Maximum Height","blocksy-companion"),checked:n.limitHeight,onChange:function(){return o({limitHeight:!n.limitHeight})}}),n.limitHeight?(0,e.createElement)(a.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)(a.PanelBody,null,(0,e.createElement)(a.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)(I,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 A=function({attributes:n,blockData:o}){const r=(0,l.useBlockProps)({className:"ct-filter-widget-wrapper"}),{showResetButton:c,showPrices:i,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})),i&&!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),c?(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)(a.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:c,showPrices:i,showInputs:s}=n,[u,m]=(0,e.useState)(null);return(0,e.useEffect)(function(){f(`${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)(A,{attributes:n,blockData:u}),(0,e.createElement)(l.InspectorControls,null,(0,e.createElement)(a.Panel,{header:"Filter Settings"},(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Tooltip","blocksy-companion"),checked:r,onChange:function(){return o({showTooltips:!r})}})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Price Input Fields","blocksy-companion"),checked:s,onChange:function(){return o({showInputs:!s})}})),s?null:(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Price Range Text","blocksy-companion"),checked:i,onChange:function(){return o({showPrices:!i})}})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Reset Button","blocksy-companion"),checked:c,onChange:function(){return o({showResetButton:!c})}})))))},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 O=function({attributes:n,blockData:o}){const r=(0,l.useBlockProps)({className:"ct-filter-widget-wrapper"}),{showCounters:c,showResetButton:i,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),c?(0,e.createElement)("span",{className:"ct-filter-count"},p[t]||0):null))):null}))),i?(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)(a.Spinner,null)},H=window.blocksyOptions;const j=(0,H.getOptionsForBlock)("status_filter"),z=(0,H.getAttributesFromOptions)(j);(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:{...z,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:c,showCounters:i,showCheckboxes:s}=n,[u,m]=(0,e.useState)(null);return(0,e.useEffect)(function(){f(`${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)(O,{attributes:n,blockData:u}),(0,e.createElement)(l.InspectorControls,null,(0,e.createElement)(a.Panel,{header:"Filter Settings"},(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.__experimentalToggleGroupControl,{label:(0,t.__)("Display Type","blocksy-companion"),value:r,isBlock:!0,onChange:function(e){return o({layout:e})}},(0,e.createElement)(a.__experimentalToggleGroupControlOption,{key:"list",value:"list",label:(0,t.__)("List","blocksy-companion")}),(0,e.createElement)(a.__experimentalToggleGroupControlOption,{key:"inline",value:"inline",label:(0,t.__)("Inline","blocksy-companion")})),(0,e.createElement)(H.OptionsPanel,{purpose:"gutenberg",onChange:function(e,t){o({[e]:t})},options:j,value:n,hasRevertButton:!1})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Checkboxes","blocksy-companion"),checked:s,onChange:function(){return o({showCheckboxes:!s})}})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Counters","blocksy-companion"),checked:i,onChange:function(){return o({showCounters:!i})}})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Reset Button","blocksy-companion"),checked:c,onChange:function(){return o({showResetButton:!c})}})))))},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 V=n(942),$=n.n(V);const Z=[{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 D=function({attributes:n}){const o=(0,l.useBlockProps)({className:"ct-filter-widget-wrapper"}),{showResetButton:a}=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"},Z.map(function({id:t,label:n}){return(0,e.createElement)("li",{className:$()("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"}))))}))),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,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:c,exactMatch:i}=n;return(0,e.createElement)(React.Fragment,null,(0,e.createElement)(D,{attributes:n}),(0,e.createElement)(l.InspectorControls,null,(0,e.createElement)(a.Panel,{header:"Filter Settings"},(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Match Rating Exactly","blocksy-companion"),help:(0,t.__)("Show only products that match the selected rating exactly.","blocksy-companion"),checked:i,onChange:function(){return o({exactMatch:!i})}})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.ToggleControl,{label:(0,t.__)("Show Tooltip","blocksy-companion"),checked:c,onChange:function(){return o({showTooltips:!c})}})),(0,e.createElement)(a.PanelBody,null,(0,e.createElement)(a.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"}))}})}()}();