} }}function t_store_addProductQuantityEvents(productElement) { var product = productElement; if (window.jQuery && product instanceof jQuery) { if (product.length === 0) { return; } product = product[0]; } var quantityBtns = product.querySelector('.t-store__prod__quantity'); if (quantityBtns) { var input = quantityBtns.querySelector('.t-store__prod__quantity-input'); var quantityMinusClickEvent = function () { input.stepDown(); }; var quantityMinusWrapper = product.querySelector('.t-store__prod__quantity__minus-wrapper'); if (quantityMinusWrapper) { quantityMinusWrapper.removeEventListener('click', quantityMinusClickEvent); quantityMinusWrapper.addEventListener('click', quantityMinusClickEvent); } var quantityPlusClickEvent = function () { input.stepUp(); }; var quantityPlusWrapper = product.querySelector('.t-store__prod__quantity__plus-wrapper'); if (quantityPlusWrapper) { quantityPlusWrapper.removeEventListener('click', quantityPlusClickEvent); quantityPlusWrapper.addEventListener('click', quantityPlusClickEvent); } var quantityInputChangeEvent = function () { var min = input.min || 1; var max = input.max || 9999; var value = parseInt(input.value || 1, 10); if (value < 1 || isNaN(value)) { input.value = min; } else if (value > max) { input.value = max; } else { input.value = value; } }; var quantityInput = product.querySelector('.t-store__prod__quantity-input'); if (quantityInput) { quantityInput.removeEventListener('change', quantityInputChangeEvent); quantityInput.addEventListener('change', quantityInputChangeEvent); } }}/** * Removes the product quantity buttons from the given product element. * * @param {HTMLElement} el_product - The product element to remove the quantity buttons from. */function t_store_removeProductQuantity(el_product) { var popupButton = el_product.querySelector( '.t-store__prod-popup__btn-wrapper a[href="#order"]:not(.t-store__prod-popup__btn_disabled)' ); var cardButton = el_product.querySelector( '.t-store__card__btns-wrapper a[href="#order"]:not([style*="display: none"])' ); if (cardButton || popupButton) { var quantityBtns = el_product.querySelector('.t-store__prod__quantity'); if (quantityBtns) { quantityBtns.parentNode.classList.remove('t-store__card__btns-wrapper--quantity'); t_store__removeElement(quantityBtns); } }}/** * Initializes routing for opening and closing a product popup using the browser's back and forward buttons. * * @param {string} recid - The ID of the product to open in the popup. * @param {Object} opts - An object containing options for the product popup. * @param {boolean} [opts.isRelevantsShow=false] - Whether to show relevant products in the popup. * @param {string} [opts.recid=null] - The ID of the relevant product to open in the popup. * @param {Object} [opts.productObj=null] - The product object for the product being opened in the popup. */function t_store_open_popup_routing_init(recid, opts) { window.onpopstate = function () { if (window.history.state) {