uawdijnntqw1x1x1
IP : 216.73.216.109
Hostname : premium160.web-hosting.com
Kernel : Linux premium160.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
batcwwjx
/
www
/
wp-content
/
plugins
/
woocommerce
/
assets
/
client
/
blocks
/
product-filter-taxonomy.js
/
/
(()=>{var e,t,o,r={2580:(e,t,o)=>{"use strict";var r=o(5573),n=o(790);const s=window.wc.wcSettings,l=window.wp.blocks;var c=o(7723);const a=window.wp.blockEditor,i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","name":"woocommerce/product-filter-taxonomy","title":"Taxonomy Filter","description":"Enable customers to filter the product collection by selecting one or more taxonomy terms, such as categories, brands, or tags.","category":"woocommerce","keywords":["WooCommerce"],"textdomain":"woocommerce","apiVersion":3,"ancestor":["woocommerce/product-filters"],"supports":{"interactivity":true,"color":{"text":true,"background":false,"__experimentalDefaultControls":{"text":false}},"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontWeight":true,"__experimentalFontFamily":true,"__experimentalFontStyle":true,"__experimentalTextTransform":true,"__experimentalTextDecoration":true,"__experimentalLetterSpacing":true,"__experimentalDefaultControls":{"fontSize":false}},"spacing":{"margin":true,"padding":true,"blockGap":true,"__experimentalDefaultControls":{"margin":false,"padding":false,"blockGap":false}},"__experimentalBorder":{"color":true,"radius":true,"style":true,"width":true,"__experimentalDefaultControls":{"color":false,"radius":false,"style":false,"width":false}}},"usesContext":["query","filterParams"],"attributes":{"taxonomy":{"type":"string","default":"product_cat"},"showCounts":{"type":"boolean","default":false},"displayStyle":{"type":"string","default":"woocommerce/product-filter-checkbox-list"},"isPreview":{"type":"boolean","default":false},"sortOrder":{"type":"string","default":"count-desc"},"hideEmpty":{"type":"boolean","default":true}},"example":{"attributes":{"isPreview":true}}}'),u=window.wp.components;var d=o(6087);const m=window.wp.data,p=window.wp.coreData;var f=o(4347);const y=window.wc.wcTypes;var h=o(9456),_=o(923),w=o.n(_);function b(e){const t=(0,d.useRef)(e);return w()(e,t.current)||(t.current=e),t.current}const x=window.wc.wcBlocksData,g=(0,d.createContext)("page"),v=()=>(0,d.useContext)(g),k=(g.Provider,e=>{const t=v();e=e||t;const o=(0,m.useSelect)((t=>t(x.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)),[e]),{setValueForQueryContext:r}=(0,m.useDispatch)(x.QUERY_STATE_STORE_KEY);return[o,(0,d.useCallback)((t=>{r(e,t)}),[e,r])]}),S=(e,t,o)=>{const r=v();o=o||r;const n=(0,m.useSelect)((r=>r(x.QUERY_STATE_STORE_KEY).getValueForQueryKey(o,e,t)),[o,e]),{setQueryValue:s}=(0,m.useDispatch)(x.QUERY_STATE_STORE_KEY);return[n,(0,d.useCallback)((t=>{s(o,e,t)}),[o,e,s])]},C=({queryAttribute:e,queryTaxonomy:t,queryPrices:o,queryStock:r,queryRating:n,queryState:s,isEditor:l=!1})=>{let c=v();c=`${c}-collection-data`;const[a]=k(c),[i,u]=S("calculate_attribute_counts",[],c),[p,_]=S("calculate_taxonomy_counts",[],c),[w,g]=S("calculate_price_range",null,c),[C,j]=S("calculate_stock_status_counts",null,c),[E,T]=S("calculate_rating_counts",null,c),O=b(e||{}),B=b(t),L=b(o),P=b(r),D=b(n);(0,d.useEffect)((()=>{"object"==typeof O&&Object.keys(O).length&&(i.find((e=>(0,y.objectHasProp)(O,"taxonomy")&&e.taxonomy===O.taxonomy))||u([...i,O]))}),[O,i,u]),(0,d.useEffect)((()=>{B&&!p.includes(B)&&_([...p,B])}),[B,p,_]),(0,d.useEffect)((()=>{w!==L&&void 0!==L&&g(L)}),[L,g,w]),(0,d.useEffect)((()=>{C!==P&&void 0!==P&&j(P)}),[P,j,C]),(0,d.useEffect)((()=>{E!==D&&void 0!==D&&T(D)}),[D,T,E]);const[R,I]=(0,d.useState)(l),[V]=(0,f.d7)(R,200);R||I(!0);const A=(0,d.useMemo)((()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=(0,h.di)(e.calculate_attribute_counts.map((({taxonomy:e,queryType:t})=>({taxonomy:e,query_type:t})))).asc(["taxonomy","query_type"])),Array.isArray(e.calculate_taxonomy_counts)&&(t.calculate_taxonomy_counts=e.calculate_taxonomy_counts),t})(a)),[a]),{results:q,isLoading:M}=(e=>{const{namespace:t,resourceName:o,resourceValues:r=[],query:n={},shouldSelect:s=!0}=e;if(!t||!o)throw new Error("The options object must have valid values for the namespace and the resource properties.");const l=(0,d.useRef)({results:[],isLoading:!0}),c=b(n),a=b(r),i=(()=>{const[,e]=(0,d.useState)();return(0,d.useCallback)((t=>{e((()=>{throw t}))}),[])})(),u=(0,m.useSelect)((e=>{if(!s)return null;const r=e(x.COLLECTIONS_STORE_KEY),n=[t,o,c,a],l=r.getCollectionError(...n);if(l){if(!(0,y.isError)(l))throw new Error("TypeError: `error` object is not an instance of Error constructor");i(l)}return{results:r.getCollection(...n),isLoading:!r.hasFinishedResolution("getCollection",n)}}),[t,o,a,c,s,i]);return null!==u&&(l.current=u),l.current})({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...s,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...A},shouldSelect:V});return{data:q,isLoading:M}},j=(e,t)=>{if(!e)return null;if(0===e.innerBlocks.length)return null;for(const o of e.innerBlocks){if(t(o))return o;const e=j(o,t);if(e)return e}return null},E=(e,t)=>j(e,(function(e){return e.name===t})),T=({clientId:e,currentStyle:t,onChange:o})=>{const r=(0,m.select)("core/block-editor").getBlock(e),s=r?.name,c=(0,l.getBlockTypes)().filter((e=>s?e.ancestor?.includes(s):[])),{insertBlock:a,replaceBlock:i}=(0,m.useDispatch)("core/block-editor"),[p,f]=(0,d.useState)({});return 0===c.length?null:(0,n.jsx)(u.__experimentalToggleGroupControl,{value:t,isBlock:!0,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:"",hideLabelFromVision:!0,onChange:e=>{if(!e||"string"!=typeof e)return;if(!r)return;const n=E(r,t);n?(f({...p,[t]:n.attributes}),i(n.clientId,(0,l.createBlock)(e,p[e]||{}))):a((0,l.createBlock)(e),r.innerBlocks.length,r.clientId,!1),o(e)},style:{width:"100%"},children:c.map((e=>(0,n.jsx)(u.__experimentalToggleGroupControlOption,{label:e.title,value:e.name},e.name)))})};function O(e,t){const o=(0,m.select)("core/block-editor").getBlock(e);if(!o)return;const r=o.name,n=(0,l.getBlockTypes)().filter((e=>e.ancestor?.includes(r))).find((e=>E(o,e.name))),s=n?E(o,n.name):null,{insertBlock:c,replaceBlock:a}=(0,m.dispatch)("core/block-editor");s?a(s.clientId,(0,l.createBlock)(t)):c((0,l.createBlock)(t),o.innerBlocks.length,o.clientId,!1)}const B=({attributes:e,setAttributes:t,clientId:o})=>{const{showCounts:r,sortOrder:s,hideEmpty:l,displayStyle:d}=e;return(0,n.jsx)(a.InspectorControls,{children:(0,n.jsxs)(u.__experimentalToolsPanel,{label:(0,c.__)("Display Settings","woocommerce"),resetAll:()=>{t({sortOrder:i.attributes.sortOrder.default,displayStyle:i.attributes.displayStyle.default,showCounts:i.attributes.showCounts.default,hideEmpty:i.attributes.hideEmpty.default}),O(o,i.attributes.displayStyle.default)},children:[(0,n.jsx)(u.__experimentalToolsPanelItem,{label:(0,c.__)("Sort Order","woocommerce"),hasValue:()=>"count-desc"!==s,onDeselect:()=>t({sortOrder:i.attributes.sortOrder.default}),children:(0,n.jsx)(u.SelectControl,{label:(0,c.__)("Sort Order","woocommerce"),value:s,options:[{label:(0,c.__)("Count (High to Low)","woocommerce"),value:"count-desc"},{label:(0,c.__)("Count (Low to High)","woocommerce"),value:"count-asc"},{label:(0,c.__)("Name (A to Z)","woocommerce"),value:"name-asc"},{label:(0,c.__)("Name (Z to A)","woocommerce"),value:"name-desc"}],onChange:e=>t({sortOrder:e})})}),(0,n.jsx)(u.__experimentalToolsPanelItem,{label:(0,c.__)("Display Style","woocommerce"),hasValue:()=>"woocommerce/product-filter-checkbox-list"!==d,isShownByDefault:!0,onDeselect:()=>{t({displayStyle:i.attributes.displayStyle.default}),O(o,i.attributes.displayStyle.default)},children:(0,n.jsx)(T,{clientId:o,currentStyle:d,onChange:e=>t({displayStyle:e})})}),(0,n.jsx)(u.__experimentalToolsPanelItem,{label:(0,c.__)("Product counts","woocommerce"),hasValue:()=>r,onDeselect:()=>t({showCounts:i.attributes.showCounts.default}),isShownByDefault:!0,children:(0,n.jsx)(u.ToggleControl,{label:(0,c.__)("Product counts","woocommerce"),checked:r,onChange:e=>t({showCounts:e})})}),(0,n.jsx)(u.__experimentalToolsPanelItem,{label:(0,c.__)("Hide items with no products","woocommerce"),hasValue:()=>!l,onDeselect:()=>t({hideEmpty:i.attributes.hideEmpty.default}),children:(0,n.jsx)(u.ToggleControl,{label:(0,c.__)("Hide items with no products","woocommerce"),checked:l,onChange:e=>t({hideEmpty:e})})})]})})},L=[{label:"Sample Item 1",value:"sample-item-1",selected:!1,count:10},{label:"Sample Item 2",value:"sample-item-2",selected:!0,count:12},{label:"Sample Item 3",value:"sample-item-3",selected:!1,count:5}],P=(e=[])=>(0,l.getBlockTypes)().map((e=>e.name)).filter((t=>!e.includes(t))),D=["woocommerce/product-filters","woocommerce/product-filter-attribute","woocommerce/product-filter-active","woocommerce/product-filter-price","woocommerce/product-filter-status","woocommerce/product-collection","core/query"];o(1652);const R=({children:e})=>(0,n.jsxs)("div",{className:"wc-block-product-filter-components-initial-disabled",children:[(0,n.jsx)("div",{className:"wc-block-product-filter-components-initial-disabled-overlay"}),e]});var I=o(2624);o(1007);const V=({children:e})=>(0,n.jsxs)("div",{className:"wc-block-product-filter-components-notice",children:[(0,n.jsx)(u.Icon,{className:"wc-block-product-filter-components-notice__icon",icon:I.A}),(0,n.jsx)("div",{className:"wc-block-product-filter-components-notice__content",children:e})]}),A=(0,s.getSetting)("filterableProductTaxonomies",[]);function q(e){const t=A.find((t=>t.name===e));return t?t.label:(0,c.__)("Taxonomy","woocommerce")}function M(e){return"string"==typeof e.label?e.label:e.ariaLabel}function N(e,t){return e.sort(((e,o)=>{switch(t){case"name-asc":return M(e).localeCompare(M(o));case"name-desc":return M(o).localeCompare(M(e));case"count-asc":return e.count-o.count;default:return o.count-e.count}}))}const F=(0,u.withSpokenMessages)((e=>{const{attributes:t}=e,{taxonomy:o,isPreview:r,displayStyle:s,showCounts:l,sortOrder:i,hideEmpty:u}=t,[f,h]=(0,d.useState)(r?N([...L],i):[]),[_,w]=(0,d.useState)(!r),{taxonomyTerms:b,isTermsLoading:x}=(0,m.useSelect)((e=>{if(r||!o)return{taxonomyTerms:[],isTermsLoading:!1};const{getEntityRecords:t,hasFinishedResolution:n}=e(p.store),s={per_page:15,hide_empty:u,orderby:"name",order:"asc"};return{taxonomyTerms:t("taxonomy",o,s)||[],isTermsLoading:!n("getEntityRecords",["taxonomy",o,s])}}),[o,u,r]),{data:g,isLoading:v}=C({queryTaxonomy:r?void 0:o,queryState:{},isEditor:!0});(0,d.useEffect)((()=>{if(r)return h(N([...L],i)),void w(!1);if(x||v)return void w(!0);if(!b.length)return h([]),void w(!1);const e=(0,y.objectHasProp)(g,"taxonomy_counts")&&Array.isArray(g.taxonomy_counts)?g.taxonomy_counts:[],t=function(e,t){const o=new Map;e.forEach((e=>{o.has(e.parent)||o.set(e.parent,[]),o.get(e.parent).push(e)})),o.keys().forEach((e=>{o.set(e,N(o.get(e),t))}));const r=[];return function e(t,n=0,s=new Set){n>10||t.forEach((t=>{if(!t.id||s.has(t.id))return;s.add(t.id),r.push({...t,depth:n});const l=o.get(t.id)||[];l.length>0&&e(l,n+1,s)}))}(o.get(0)),r}(b.reduce(((t,o)=>{const r=e.find((e=>e.term===o.id))?.count||0;return u&&0===r||t.push({label:o.name,value:o.slug,selected:!1,count:r,id:o.id,parent:o.parent||0}),t}),[]),i);h(t),w(!1)}),[o,b,g,i,u,r,x,v]);const{children:k,...S}=(0,a.useInnerBlocksProps)((0,a.useBlockProps)(),{allowedBlocks:P(D),template:[["core/heading",{level:3,content:q(o),style:{spacing:{margin:{bottom:"0.625rem",top:"0"}}}}],[s]]}),j=!r&&(x||v||_);return o?j||r||0!==b.length?(0,n.jsxs)("div",{...S,children:[(0,n.jsx)(B,{...e}),(0,n.jsx)(R,{children:(0,n.jsx)(a.BlockContextProvider,{value:{filterData:{items:0===f.length&&r?L:f,isLoading:j,showCounts:l}},children:k})})]}):(0,n.jsxs)("div",{...S,children:[(0,n.jsx)(B,{...e}),(0,n.jsx)(V,{children:(0,n.jsx)("p",{children:(0,c.sprintf)( // translators: %s: Taxonomy label. // translators: %s: Taxonomy label. (0,c.__)("There are no products associated with %s.","woocommerce"),q(o))})})]}):(0,n.jsxs)("div",{...S,children:[(0,n.jsx)(B,{...e}),(0,n.jsx)(V,{children:(0,n.jsx)("p",{children:(0,c.__)("Please select a taxonomy to use this filter!","woocommerce")})})]})})),H=(0,s.getSetting)("filterableProductTaxonomies",[]);(0,l.registerBlockType)(i,{edit:F,icon:()=>(0,n.jsx)(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M4.25 4C4.25 3.58579 4.58579 3.25 5 3.25L9.17284 3.25C9.37179 3.25 9.56258 3.32904 9.70324 3.46974L13.2877 7.05515L13.2893 7.05673C13.5844 7.35367 13.75 7.75532 13.75 8.17393C13.75 8.59255 13.5844 8.99419 13.2893 9.29114L12.7573 8.76246L13.2877 9.29272L10.2961 12.2851C10.1489 12.4325 9.97417 12.5494 9.78179 12.6292C9.58941 12.7089 9.38319 12.75 9.17493 12.75C8.96667 12.75 8.76045 12.7089 8.56807 12.6292C8.37575 12.5494 8.20104 12.4326 8.05392 12.2853L8.05378 12.2851L4.46991 8.7045C4.32911 8.56383 4.25 8.37296 4.25 8.17393V4ZM12.2253 8.23378L12.2257 8.23341C12.2412 8.21758 12.25 8.19622 12.25 8.17393C12.25 8.15164 12.2412 8.13029 12.2257 8.11446L12.2253 8.11409L8.86212 4.75H5.75V7.86307L9.11456 11.2246L9.11517 11.2252C9.12303 11.2331 9.13236 11.2393 9.14261 11.2436C9.15286 11.2478 9.16384 11.25 9.17493 11.25C9.18602 11.25 9.197 11.2478 9.20725 11.2436C9.2175 11.2393 9.22683 11.2331 9.23469 11.2252L9.23499 11.2249L12.2253 8.23378ZM12.9999 20H3.99988V18.5H12.9999V20ZM3.99988 16L19.9999 16V14.5L3.99988 14.5V16Z",fill:"currentColor"})}),save:()=>(0,n.jsx)("div",{...a.useBlockProps.save(),...a.useInnerBlocksProps.save()}),variations:H.map(((e,t)=>({name:`product-filter-taxonomy-${e.name}`,title:(0,c.sprintf)( // translators: %s is the taxonomy label. // translators: %s is the taxonomy label. (0,c.__)("%s Filter","woocommerce"),e.label),description:(0,c.sprintf)( // translators: %s is the taxonomy label. // translators: %s is the taxonomy label. (0,c.__)("Enable customers to filter the product collection by selecting one or more %s terms.","woocommerce"),e.label),attributes:{taxonomy:e.name},isActive:["taxonomy"],isDefault:0===t})))})},1652:()=>{},1007:()=>{},1609:e=>{"use strict";e.exports=window.React},790:e=>{"use strict";e.exports=window.ReactJSXRuntime},6087:e=>{"use strict";e.exports=window.wp.element},7723:e=>{"use strict";e.exports=window.wp.i18n},923:e=>{"use strict";e.exports=window.wp.isShallowEqual},5573:e=>{"use strict";e.exports=window.wp.primitives}},n={};function s(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e].call(o.exports,o,o.exports,s),o.exports}s.m=r,e=[],s.O=(t,o,r,n)=>{if(!o){var l=1/0;for(u=0;u<e.length;u++){for(var[o,r,n]=e[u],c=!0,a=0;a<o.length;a++)(!1&n||l>=n)&&Object.keys(s.O).every((e=>s.O[e](o[a])))?o.splice(a--,1):(c=!1,n<l&&(l=n));if(c){e.splice(u--,1);var i=r();void 0!==i&&(t=i)}}return t}n=n||0;for(var u=e.length;u>0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[o,r,n]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var n=Object.create(null);s.r(n);var l={};t=t||[null,o({}),o([]),o(o)];for(var c=2&r&&e;"object"==typeof c&&!~t.indexOf(c);c=o(c))Object.getOwnPropertyNames(c).forEach((t=>l[t]=()=>e[t]));return l.default=()=>e,s.d(n,l),n},s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.j=121,(()=>{var e={121:0};s.O.j=t=>0===e[t];var t=(t,o)=>{var r,n,[l,c,a]=o,i=0;if(l.some((t=>0!==e[t]))){for(r in c)s.o(c,r)&&(s.m[r]=c[r]);if(a)var u=a(s)}for(t&&t(o);i<l.length;i++)n=l[i],s.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return s.O(u)},o=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var l=s.O(void 0,[94],(()=>s(2580)));l=s.O(l),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["product-filter-taxonomy"]=l})();
/home/batcwwjx/www/wp-content/plugins/woocommerce/assets/client/blocks/product-filter-taxonomy.js