import{K as o,m as i,j as u,k as a,v as r,t as l,b as m}from"./BCLrUOBx.js";const y={setup(){const t=m(),{setToastError:e}=t;return{setToastError:e}},data(){return{qtyVal:1}},props:{productInventory:{type:Object,default:()=>({})},quantity:{type:Number,default:1},max:{type:Number,default:1}},components:{},mixins:[],computed:{qtyComputed(){return this.qtyVal}},methods:{qty(t){if(!Object.keys(this.productInventory).length){this.setToastError(this.$t("detailRight.requiredAttributes"));return}if(this.qtyVal+t>this.max){this.setToastError(this.$t("quantityNav.maximumExceeds"));return}if(this.qtyVal+t===0){this.setToastError(this.$t("quantityNav.min"));return}this.qtyVal+=t,this.$emit("value-changed",{direction:t,value:this.qtyVal})}},activated(){this.qtyVal=this.quantity},mounted(){this.qtyVal=this.quantity}},c={class:"quantity-area"},d={class:"no-control"};function p(t,e,h,q,f,s){return u(),i("span",c,[a("button",{"aria-label":"subtract",onClick:e[0]||(e[0]=r(n=>s.qty(-1),["prevent"]))}," - "),a("span",d,l(s.qtyComputed),1),a("button",{"aria-label":"add",onClick:e[1]||(e[1]=r(n=>s.qty(1),["prevent"]))}," + ")])}const _=o(y,[["render",p]]);export{_ as default};
