function t_prod__init(t){var e=document.querySelector("#rec"+t);if(e){var r=e.querySelectorAll(".js-product");Array.prototype.forEach.call(r,(function(t){t.querySelector(".js-product-option")&&t_prod__initProduct(t)}))}}function t_prod__initProduct(t,e){"string"==typeof t&&(t=e),t_prod__initPrice(t),t_prod__addEvents__options(t),t_prod__updatePrice(t,e)}function t_prod__initPrice(t){if(t instanceof Element||(t=t[0]),t){var e=t.querySelector(".js-product-price");e||(t.insertAdjacentHTML("beforeend",'<div style="display:none;" class="js-product-price"></div>'),e=t.querySelector(".js-product-price"));var r=e.textContent,c=e.getAttribute("data-product-price-def"),n=e.getAttribute("data-product-price-def-str");if(r){if(!c&&!n){var o=t_prod__cleanPrice(r);e.setAttribute("data-product-price-def",o),e.setAttribute("data-product-price-def-str",r.replace(/"/g,""))}}else e.setAttribute("data-product-price-def",0)}}function t_prod__updatePrice(t,e){if(t instanceof Element||(t=t[0]),t){var r=t.querySelector(".js-product-price:not(.js-store-prod-price-range-val)"),c=t.querySelectorAll(".js-product-option-variants"),n=0,o=0;if(r){var i=r.getAttribute("data-product-price-def");i*=1,Array.prototype.forEach.call(c,(function(t){if(t){var e=t.querySelector("option:checked").getAttribute("data-product-variant-price");if(e){var r=t_prod__cleanPrice(e);-1!==e.indexOf("+")?o+=r:0!==parseFloat(r)&&(i=r)}}})),n=i+o,r.innerHTML=n>0?t_prod__showPrice(t_prod__roundPrice(n),e):r.getAttribute("data-product-price-def-str")}}}function t_prod__addEvents__options(t){if(t instanceof Element||(t=t[0]),t){var e=t.querySelectorAll(".js-product-option-variants");Array.prototype.forEach.call(e,(function(t){var e=t.closest(".js-product");t.addEventListener("change",(function(){t_prod__updatePrice(e),t_triggerEvent(document.body,"twishlist_addbtn")}))}))}}function t_prod__cleanPrice(t){return t?(t=(t=t.toString()).replace(",",".").replace(/[^0-9.]/g,""),t=parseFloat(t).toFixed(2),isNaN(t)&&(t=0),t=parseFloat(t),(t*=1)<0&&(t=0)):t=0,t}function t_prod__roundPrice(t){return t?(t=parseFloat(t).toFixed(2),t=parseFloat(t),(t*=1)<0&&(t=0)):t=0,t}function t_prod__showPrice(t,e){if(t){var r;if(t=t.toString(),window.tcart&&window.tcart.currency_dec&&"00"===window.tcart.currency_dec||e&&e.currencyDecimal&&"00"===e.currencyDecimal)if(-1===t.indexOf(".")&&-1===t.indexOf(","))t+=".00";else 1===t.substr(t.indexOf(".")+1).length&&(t+="0");t=t.replace(/\B(?=(\d{3})+(?!\d))/g," "),t=window.tcart&&window.tcart.currency_sep&&"."===window.tcart.currency_sep||e&&e.currencySeparator&&"."===e.currencySeparator?t.replace(",","."):t.replace(".",",")}else t="";return t}function t_triggerEvent(t,e){var r;document.createEvent?(r=document.createEvent("HTMLEvents")).initEvent(e,!0,!1):document.createEventObject&&((r=document.createEventObject()).eventType=e),r.eventName=e,t.dispatchEvent?t.dispatchEvent(r):t.fireEvent?t.fireEvent("on"+r.eventType,r):t[e]?t[e]():t["on"+e]&&t["on"+e]()}