(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{withFilteredAttributes:()=>m,withProductDataContext:()=>g});const o=window.wc.wcBlocksData,r=window.wp.data,n=window.wp.element,s=window.wp.isShallowEqual;var a=e.n(s);function c(e){const t=(0,n.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}const i=window.wc.wcTypes,u=window.wp.i18n,d=e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:s,isLoading:a}=(e=>{const{namespace:t,resourceName:s,resourceValues:a=[],query:d={},shouldSelect:l=!0}=e;if(!t||!s)throw new Error("The options object must have valid values for the namespace and the resource properties.");const p=(0,n.useRef)({results:[],isLoading:!0}),w=c(d),h=c(a),g=(()=>{const[,e]=(0,n.useState)();return(0,n.useCallback)(t=>{e(()=>{throw t})},[])})(),m=(0,r.useSelect)(e=>{if(!l)return null;const r=e(o.COLLECTIONS_STORE_KEY),n=[t,s,w,h],a=r.getCollectionError(...n);if(a)if((0,i.isError)(a))g(a);else{const e="object"==typeof a&&null!==a&&"string"==typeof a.message?a.message:(0,u.__)("Something went wrong while loading data.","woocommerce");g(new Error(e))}return{results:r.getCollection(...n),isLoading:!r.hasFinishedResolution("getCollection",n)}},[t,s,h,w,l,g]);return null!==m&&(p.current=m),p.current})({...t,query:e}),{value:d}=((e,t)=>{const{namespace:n,resourceName:s,resourceValues:a=[],query:i={}}=t;if(!n||!s)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const u=c(i),d=c(a),{value:l,isLoading:p=!0}=(0,r.useSelect)(t=>{const r=t(o.COLLECTIONS_STORE_KEY),a=[e,n,s,u,d];return{value:r.getCollectionHeader(...a),isLoading:r.hasFinishedResolution("getCollectionHeader",a)}},[e,n,s,d,u]);return{value:l,isLoading:p}})("x-wp-total",{...t,query:e});return{products:s,totalProducts:parseInt(d,10),productsLoading:a}},l=window.wc.wcBlocksSharedContext,p=window.ReactJSXRuntime,w=(e,t)=>e.find(e=>e.id===t),h=e=>{const{productId:t,OriginalComponent:o,postId:r,product:n,isDescendentOfQueryLoop:s}=e,a=((e,t,o)=>e?o:t||o)(s,t,r),{products:c,productsLoading:i}=d({include:a}),u={product:a>0&&c.length>0?w(c,a):null,isLoading:i};return n?(0,p.jsx)(l.ProductDataContextProvider,{product:n,isLoading:!1,children:(0,p.jsx)(o,{...e})}):(0,p.jsx)(l.ProductDataContextProvider,{product:u.product,isLoading:u.isLoading,children:(0,p.jsx)(o,{...e})})},g=e=>t=>{const o=(0,l.useProductDataContext)({isAdmin:t.isAdmin,product:t.product});return!t.product&&o.hasContext||t.isAdmin?(0,p.jsx)(e,{...t}):(0,p.jsx)(h,{...t,OriginalComponent:e})},m=e=>t=>o=>{const r=((e,t)=>{const o=[];return Object.keys(e).forEach(r=>{if(void 0!==t[r])switch(e[r].type){case"boolean":o[r]="false"!==t[r]&&!1!==t[r];break;case"number":o[r]=parseInt(t[r],10);break;case"array":case"object":o[r]=JSON.parse(t[r]);break;default:o[r]=t[r]}else o[r]=e[r].default}),o})(e,o);return(0,p.jsx)(t,{...o,...r})};(this.wc=this.wc||{}).wcBlocksSharedHocs=t})();