Liferay.Loader.define("commerce-frontend-js@4.0.52/components/mini_cart/Opener",["module","exports","require","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./MiniCartContext"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=c(r("@frontend-taglib-clay$clayui/icon")),a=c(r("liferay!frontend-js-react-web$classnames")),o=(c(r("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=f();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react"))),i=c(r("./MiniCartContext"));function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){const{cartState:e,displayTotalItemsQuantity:t,openCart:r}=(0,o.useContext)(i.default),{cartItems:f=[],summary:c={}}=e,{itemsQuantity:u}=c,[l,s]=(0,o.useState)(0);return(0,o.useEffect)((()=>{s(u)}),[u,s]),(0,o.useEffect)((()=>{s(t&&"itemsQuantity"in c?c.itemsQuantity:f.length)}),[f,t,c,s]),o.default.createElement("button",{className:(0,a.default)({"has-badge":l>0,"mini-cart-opener":!0}),"data-badge-count":l,onClick:r},o.default.createElement(n.default,{symbol:"shopping-cart"}))};t.default=u}}));
//# sourceMappingURL=Opener.js.map