!function(){var e=function(e){var t={exports:{}};return e.call(t.exports,t,t.exports),t.exports},t=function(){function e(e,t){for(var n=0;n=0&&(e(document.forms[o],"submit",t),e(document.forms[o],"change",r),a(document.forms[o]));var c=document.forms[o].elements.previous_step;c&&"payment_method"===c.value&&e(document.body,"submit",n)}}))}(),y=XMLHttpRequest,f=y.prototype.open,h=y.prototype.send,y.prototype.open=function(e,t){this._url=t,this._method=e,p.handleXhrOpen(),f.apply(this,arguments)},y.prototype.send=function(e){var t=new p(this,this._url,this._method,e);this.addEventListener?this.addEventListener("readystatechange",t.onReadyStateChange.bind(t),!1):(t.oldOnReadyStateChange=this.onreadystatechange,this.onreadystatechange=t.onReadyStateChange),h.call(this,e)},function(e,t){function n(e,t){e.clone().json().then((function(e){var n=t.items;return o(e.items,n),e})).catch(a)}function r(e,t){var n=c(t);e.clone().json().then((function(e){return s(e,n)})).catch(a)}function a(e){console&&console.warn&&console.warn("[shop_events_listener] Error in handleFetchRequest: "+e.message)}"function"==typeof t&&(e.fetch=function(){var e=arguments;return t.apply(this,Array.prototype.slice.call(arguments)).then((function(t){if(!t.ok)return t;var o=document.createElement("a");o.href=t.url;var i=o.pathname?o.pathname:t.url;try{if(p.ADD_TO_CART_REGEX.test(i)){try{var c=JSON.parse(e[1].body);if(Object.keys(c).includes("items"))return n(t,c),t}catch(e){}r(t,e[1].body)}}catch(e){a(e)}return t}))})}(window,window.fetch)}))}("undefined"!=typeof global?global:"undefined"!=typeof window&&window);