"use strict";(self.webpackChunkshopwp=self.webpackChunkshopwp||[]).push([["Quantity-public"],{fXh0:function(t,e,n){n.r(e),n.d(e,{default:function(){return u}});var a=n("2MD/"),i=n("LpH3"),o=n("AU3J"),l=function(){var t=(0,i.iv)('position:relative;content:"";display:block;height:1px;background:black;width:12px;position:absolute;top:calc(50% - 1px);left:calc(50% - 6px);',(0,o.mq)("small"),"{width:20px;left:calc(50% - 10px);};label:QuantityDecIconCSS;");return(0,i.tZ)("span",{css:t,className:"wps-quantity-icon wps-quantity-decrement-icon"})},p=function(){var t=(0,i.iv)("position:relative;display:block;height:1px;background:black;width:10px;position:absolute;top:calc(50% - 1px);left:calc(50% - 5px);",(0,o.mq)("small"),'{width:20px;left:calc(50% - 10px);}&:after{content:"";display:block;height:1px;transform:rotate(90deg);background:black;width:10px;position:absolute;top:calc(50% - 0);left:calc(50% - 5px);',(0,o.mq)("small"),"{width:20px;left:calc(50% - 10px);}};label:QuantityIncIconCSS;");return(0,i.tZ)("span",{css:t,className:"wps-quantity-icon wps-quantity-increment-icon"})},r=n("dVqq"),c=n("U039"),s={name:"erezdp-QuantityIncCSS",styles:"border-radius:0 5px 5px 0;&:hover{cursor:pointer;background-color:#f1f1f1;};label:QuantityIncCSS;"},u=function(t){var e=t.initialQuantity,n=t.maxQuantity,u=t.minQuantity,d=t.quantityStep,b=t.dispatch,h=t.onChange,x=t.small,f=void 0===x||x,m=t.isUpdating,y=void 0!==m&&m,g=t.lineItem,w=void 0!==g&&g,v=t.setNotice,k=void 0!==v&&v,q=wp.element,S=q.useState,C=q.useEffect,Q=S(e),I=(0,a.Z)(Q,2),Z=I[0],N=I[1],z=(0,r.Nr)(parseInt(Z),20),E=(0,a.Z)(z,1)[0],T=(0,c.sc)();C((function(){F(e),N(e)}),[e]);var D=(0,i.iv)("&&{margin:0;width:",f?"40px":"45px",";height:",f?"40px":"45px",";border:none;text-align:center;font-size:18px;margin-right:0px;border-top:1px solid #606060;border-bottom:1px solid #606060;max-height:",f?"40px":"45px",';border-radius:0;appearance:none;padding:0;color:#121212;background:white;::-webkit-outer-spin-button,::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}&[type="number"]{-moz-appearance:textfield;}&:hover{cursor:',y?"not-allowed":"text",";}",(0,o.mq)("small"),"{width:60px;height:60px;max-height:60px;font-size:24px;}};label:quantityInputCSS;"),_=(0,i.iv)("color:#333;display:block;margin-top:0;position:relative;padding:0 10px;font-size:17px;font-family:monospace;background:transparent;box-shadow:none;cursor:pointer;text-align:center;border:1px solid #606060;width:",f?"45px":"50px",";height:",f?"40px":"45px",";outline:none;outline-offset:0;transition:all 0.2s ease;&:hover{background:#f1f1f1;}",(0,o.mq)("small"),"{font-size:26px;width:60px;height:60px;};label:QuantityIncDecCSS;"),A=s,U=(0,i.iv)("border-radius:5px 0 0 5px;&:hover{cursor:",y?"not-allowed":"pointer",";background-color:",y?"white":"#f1f1f1",";};label:QuantityDecCSS;"),O=(0,i.iv)("width:122px;margin:0;background:white;",(0,o.mq)("small"),"{width:100%;min-width:160px;};label:quantityContainer;");function B(t){if(!y&&(t.target.value||0===t.target.value)){if(u&&t.target.value<=u)var e=u;else e=t.target.value;F(t.target.value),N(e)}}function F(t){n&&t>n?k&&w&&w.merchandise.quantityAvailable>0&&k({type:"warning",message:wp.i18n.sprintf(wp.i18n.__("Warning: the quantity you're trying to purchase may be limited to %d at checkout.","shopwp"),w.merchandise.quantityAvailable)}):k&&w&&k(!1)}return C((function(){T||h(E,e)}),[E]),(0,i.tZ)("div",{className:"wps-quantity-container",css:[o.Q4,O,";label:Quantity;"]},(0,i.tZ)("div",{css:[o.mm,";label:Quantity;"]},(0,i.tZ)("button",{className:"wps-quantity-decrement",css:[_,U,";label:Quantity;"],type:"button",role:"button",onClick:function(){if(!y){if(b({type:"SET_NOTICE",payload:!1}),F(Z),d)t=Z-d;else var t=Z-1;!w&&t<1&&(t=1),F(t),N(t)}}},(0,i.tZ)(l,null)),(0,i.tZ)("input",{className:"wps-quantity-input",type:"number",min:u>1?u:1,onFocus:function(t){return t.currentTarget.select()},"aria-label":"Product Quantity Input",css:D,value:Z,onChange:B,onBlur:B,disabled:d}),(0,i.tZ)("button",{className:"wps-quantity-increment",css:[_,A,";label:Quantity;"],type:"button",role:"button",onClick:function(){if(!y){if(b({type:"SET_NOTICE",payload:!1}),d)t=Z+d;else var t=Z+1;F(t),N(t)}}},(0,i.tZ)(p,null))))}}}]);