2 lines
92 KiB
JavaScript
2 lines
92 KiB
JavaScript
(()=>{"use strict";function t(){t=function(){return n};var e,n={},o=Object.prototype,i=o.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{f({},"")}catch(e){f=function(t,r,e){return t[r]=e}}function l(t,r,n,o){var i=r&&r.prototype instanceof d?r:d,a=Object.create(i.prototype);return f(a,"_invoke",function(t,r,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=E(u,n);if(c){if(c===p)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=h(t,r,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(t,n,new O(o||[])),!0),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}n.wrap=l;var p={};function d(){}function y(){}function v(){}var g={};f(g,u,function(){return this});var m=Object.getPrototypeOf,w=m&&m(m(P([])));w&&w!==o&&i.call(w,u)&&(g=w);var b=v.prototype=d.prototype=Object.create(g);function _(t){["next","throw","return"].forEach(function(r){f(t,r,function(t){return this._invoke(r,t)})})}function x(t,e){function n(o,a,u,c){var s=h(t[o],t,a);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==r(l)&&i.call(l,"__await")?e.resolve(l.__await).then(function(t){n("next",t,u,c)},function(t){n("throw",t,u,c)}):e.resolve(l).then(function(t){f.value=t,u(f)},function(t){return n("throw",t,u,c)})}c(s.arg)}var o;f(this,"_invoke",function(t,r){function i(){return new e(function(e,o){n(t,r,e,o)})}return o=o?o.then(i,i):i()},!0)}function E(t,r){var n=r.method,o=t.i[n];if(o===e)return r.delegate=null,"throw"===n&&t.i.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=h(o,t.i,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,p;var a=i.arg;return a?a.done?(r[t.r]=a.value,r.next=t.n,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,p):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function k(t){this.tryEntries.push(t)}function S(t){var r=t[4]||{};r.type="normal",r.arg=e,t[4]=r}function O(t){this.tryEntries=[[-1]],t.forEach(k,this),this.reset(!0)}function P(t){if(null!=t){var n=t[u];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(i.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(r(t)+" is not iterable")}return y.prototype=v,f(b,"constructor",v),f(v,"constructor",y),y.displayName=f(v,s,"GeneratorFunction"),n.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===y||"GeneratorFunction"===(r.displayName||r.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,f(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},n.awrap=function(t){return{__await:t}},_(x.prototype),f(x.prototype,c,function(){return this}),n.AsyncIterator=x,n.async=function(t,r,e,o,i){void 0===i&&(i=Promise);var a=new x(l(t,r,e,o),i);return n.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},_(b),f(b,s,"Generator"),f(b,u,function(){return this}),f(b,"toString",function(){return"[object Generator]"}),n.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},n.values=P,O.prototype={constructor:O,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e){a.type="throw",a.arg=t,r.next=e}for(var o=r.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=e,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],p):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),p},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),S(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;S(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={i:P(t),r,n},"next"===this.method&&(this.arg=e),p}},n}function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function e(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function n(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var a=t.apply(r,n);function u(t){e(a,o,i,u,c,"next",t)}function c(t){e(a,o,i,u,c,"throw",t)}u(void 0)})}}function o(){return i.apply(this,arguments)}function i(){return i=n(t().mark(function e(){var o,i;return t().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("true"!==IPPWidgetOptions.isBlock){e.next=3;break}return e.next=3,c();case 3:if((o=document.querySelectorAll(".izi-widget-placeholder")).length){e.next=6;break}return e.abrupt("return");case 6:if("object"===("undefined"==typeof InpostIziJavsscriptWoocommerce?"undefined":r(InpostIziJavsscriptWoocommerce))){e.next=8;break}return e.abrupt("return");case 8:return i=Array.from(o).map(function(){var r=n(t().mark(function r(e){var n,o,i,c;return t().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.classList[1],o="izi-widget-product"===n?e.getAttribute("data-product-id"):null,!a(e)){t.next=9;break}return t.next=5,f(n,o,!0);case 5:i=t.sent,e.innerHTML=u(e,i),t.next=13;break;case 9:return t.next=11,f(n,o);case 11:c=t.sent,e.innerHTML=c;case 13:window.IPPwidget.refresh();case 14:case"end":return t.stop()}},r)}));return function(t){return r.apply(this,arguments)}}()),e.next=11,Promise.all(i);case 11:document.querySelectorAll(".izi-widget-placeholder").forEach(function(t){var r;r=t,new Promise(function(t){var e=0,n=setInterval(function(){var o=r.querySelector("inpost-izi-button");null!=o&&o.shadowRoot&&(clearInterval(n),t(o.shadowRoot)),++e>=30&&(clearInterval(n),t(null))},100)}).then(function(t){var e;if(t){var n=t.querySelector(".button");if(n){var o="pl"===(null===(e=r.querySelector("inpost-izi-button").getAttribute("language"))||void 0===e?void 0:e.trim().toLowerCase())?"pl":"en",i="pl"===o?"Kup z InPost":"Buy with InPost";n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.setAttribute("aria-label",i),n.setAttribute("lang",o),n.dataset.keyboardHandlerAdded||(n.addEventListener("keydown",function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),n.dataset.keyboardHandlerAdded="1")}}})});case 12:case"end":return e.stop()}},e)})),i.apply(this,arguments)}function a(t){return t.classList.contains("izi-widget-gutenberg")}function u(t,r){var e=JSON.parse(t.getAttribute("data-attributes"));if(!r.match(/variation="([^"]*)"/))return r;var n=[];e.variant&&n.push(e.variant),e.size&&n.push(e.size),e.frameStyle&&n.push(e.frameStyle),e.background&&n.push(e.background);var o=n.join(" ");return r.replace(/variation="[^"]*"/,'variation="'.concat(o,'"'))}function c(){return s.apply(this,arguments)}function s(){return(s=n(t().mark(function r(){return t().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(t,r){var e=function(){var t=document.querySelector(".wc-block-checkout__shipping-option"),r=document.querySelector(".wc-block-checkout__payment-method"),e=document.querySelector(".izi-widget-placeholder");return!!(t||r||e)};if(e())t();else{var n=new MutationObserver(function(r){e()&&(n.disconnect(),t())});n.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),setTimeout(function(){n.disconnect(),r(new Error("Timeout waiting for block checkout to load"))},1e4)}}));case 1:case"end":return t.stop()}},r)}))).apply(this,arguments)}function f(t){return l.apply(this,arguments)}function l(){return l=n(t().mark(function e(n){var o,i,a,u,c,s=arguments;return t().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:o=s.length>1&&void 0!==s[1]?s[1]:null,i=s.length>2&&void 0!==s[2]&&s[2],t.t0=n,t.next="izi-widget-order"===t.t0?5:"izi-widget-checkout"===t.t0?7:"izi-widget-minicart"===t.t0?9:"izi-widget-cart"===t.t0?11:"izi-widget-product"===t.t0?13:15;break;case 5:return a="wp-json/inpost/v1/izi/widget/place_order_create",t.abrupt("break",15);case 7:return a="wp-json/inpost/v1/izi/widget/place_checkout_page",t.abrupt("break",15);case 9:return a="wp-json/inpost/v1/izi/widget/place_minicart",t.abrupt("break",15);case 11:return a="wp-json/inpost/v1/izi/widget/place_basket_summary",t.abrupt("break",15);case 13:return a="wp-json/inpost/v1/izi/widget/place_product_card/".concat(o),t.abrupt("break",15);case 15:return"undefined"==typeof InpostIziJavsscriptWoocommerce||r(InpostIziJavsscriptWoocommerce),u=(new Date).getTime(),t.next=19,fetch("".concat(InpostIziJavsscriptWoocommerce.home_url).concat(a,"?t=").concat(u,"&isBlock=").concat(i),{credentials:"same-origin",headers:{"Content-Type":"text/html",cache:"no-cache"}});case 19:if((c=t.sent).ok){t.next=22;break}throw new Error("Network response was not ok");case 22:if(200===c.status){t.next=24;break}return t.abrupt("return");case 24:return t.next=26,c.text();case 26:return t.abrupt("return",t.sent);case 27:case"end":return t.stop()}},e)})),l.apply(this,arguments)}function h(t){var r="; ".concat(document.cookie).split("; ".concat(t,"="));if(2===r.length)return r.pop().split(";").shift()}function p(t,r,e){var n=Number(e),o="expires="+new Date(n>1e12?n:1e3*n).toUTCString(),i=encodeURIComponent(String(r)),a=window.location&&window.location.hostname?"; domain="+window.location.hostname:"";document.cookie=t+"="+i+"; "+o+"; path=/"+a+"; Secure;"}function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function y(){y=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(r,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(r,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=E(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=f(r,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(r,n,new O(o||[])),!0),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var l={};function h(){}function p(){}function v(){}var g={};c(g,i,function(){return this});var m=Object.getPrototypeOf,w=m&&m(m(P([])));w&&w!==e&&n.call(w,i)&&(g=w);var b=v.prototype=h.prototype=Object.create(g);function _(t){["next","throw","return"].forEach(function(r){c(t,r,function(t){return this._invoke(r,t)})})}function x(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==d(l)&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(l).then(function(t){s.value=t,a(s)},function(t){return e("throw",t,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()},!0)}function E(r,e){var n=e.method,o=r.i[n];if(o===t)return e.delegate=null,"throw"===n&&r.i.return&&(e.method="return",e.arg=t,E(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=f(o,r.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var a=i.arg;return a?a.done?(e[r.r]=a.value,e.next=r.n,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function k(t){this.tryEntries.push(t)}function S(r){var e=r[4]||{};e.type="normal",e.arg=t,r[4]=e}function O(t){this.tryEntries=[[-1]],t.forEach(k,this),this.reset(!0)}function P(r){if(null!=r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(d(r)+" is not iterable")}return p.prototype=v,c(b,"constructor",v),c(v,"constructor",p),p.displayName=c(v,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},r.awrap=function(t){return{__await:t}},_(x.prototype),c(x.prototype,a,function(){return this}),r.AsyncIterator=x,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new x(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},_(b),c(b,u,"Generator"),c(b,i,function(){return this}),c(b,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},r.values=P,O.prototype={constructor:O,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(t){a.type="throw",a.arg=r,e.next=t}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),S(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;S(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={i:P(r),r:e,n},"next"===this.method&&(this.arg=t),l}},r}function v(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function g(t){return m.apply(this,arguments)}function m(){var t;return t=y().mark(function t(r){var e,n,o,i,a,u,c,s,f,l,d,v,g,m;return y().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=r){t.next=2;break}return t.abrupt("return");case 2:if(!(e=document.querySelector('inpost-izi-button[data-currency-processed="1"]'))){t.next=6;break}return e.removeAttribute("data-currency-processed"),t.abrupt("return",IPPWidgetOptions.basketBindingApiKey);case 6:if(n=new FormData,!(o=window.document.querySelector("form.cart"))){t.next=13;break}i=o.querySelector("button[type=submit]"),n=new FormData(o,i),t.next=23;break;case 13:if(!(a=window.document.querySelector("input.variation_id"))){t.next=23;break}if(n.append("variation_id",a.value),u=document.querySelector(".variations")){t.next=19;break}return t.abrupt("return");case 19:if(c=u.querySelectorAll("select")){t.next=22;break}return t.abrupt("return");case 22:c.forEach(function(t){return n.append(t.name,t.value)});case 23:return n.append("action","add_to_cart"),void 0!==r&&n.append("product_id",r),(s=h("basket_binding_api_key"))&&n.append("basket_binding_api_key",s),(f=document.createElement("div")).id="izi-temp-container",f.style.display="none",document.body.appendChild(f),(l=document.createElement("a")).classList.add("ajax_add_to_cart","add_to_cart_button"),l.dataset.productId=r,l.href="?add-to-cart="+r,f.appendChild(l),(d=document.createElement("span")).classList.add("added_to_cart"),f.appendChild(d),t.prev=39,t.next=42,fetch(InpostIziJavsscriptWoocommerce.ajaxurl,{method:"POST",credentials:"same-origin",body:n});case 42:if(!((v=t.sent).status>=500)){t.next=45;break}throw new Error("Server error 500");case 45:return t.prev=45,t.next=48,v.json();case 48:(g=t.sent).basket_binding_api_key&&(IPPWidgetOptions.basketBindingApiKey=g.basket_binding_api_key,h("basket_binding_api_key")||p("basket_binding_api_key",g.basket_binding_api_key,g.session_expiration)),t.next=55;break;case 52:t.prev=52,t.t0=t.catch(45),console.warn("[InPostPay] Failed to parse add_to_cart response JSON:",t.t0);case 55:m=window.alert,window.alert=function(t){void 0!==t&&"undefined"!==t?m.call(window,t):console.warn("[InPostPay] Zablokowano alert(undefined) z pluginu zewnętrznego")},jQuery(document.body).trigger("added_to_cart",[v.fragments,v.cart_hash,jQuery(l)]),setTimeout(function(){window.alert=m},100),console.warn("[InPostPay] Trigger added_to_cart"),"undefined"!=typeof wc_add_to_cart_params?jQuery.ajax({url:wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","get_refreshed_fragments"),type:"POST",success:function(t){t&&t.fragments&&(jQuery.each(t.fragments,function(t,r){if(jQuery(t).length>0)try{jQuery(t).html(jQuery(r).html())}catch(n){var e;console.error("[InPostPay] Błąd przy podmianie fragmentu:",{key:t,valueSnippet:null==r||null===(e=r.toString())||void 0===e?void 0:e.substring(0,500),error:n,stack:n.stack})}else console.warn("[InPostPay] Nie znaleziono elementu do podmiany:",t)}),"undefined"!=typeof wc_cart_fragments_params&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(t.fragments)),sessionStorage.setItem("wc_cart_hash",t.cart_hash)),jQuery(document.body).trigger("wc_fragments_refreshed"),jQuery(document.body).trigger("added_to_cart",[null,null,jQuery(l)]),setTimeout(function(){document.getElementById("izi-temp-container")&&document.getElementById("izi-temp-container").remove()},100))},error:function(t,r,e){console.error("[FRAGMENTS-ERROR]",r,e,t.responseText),document.getElementById("izi-temp-container")&&document.getElementById("izi-temp-container").remove()}}):(jQuery(document.body).trigger("added_to_cart",[null,null,jQuery(l)]),setTimeout(function(){document.getElementById("izi-temp-container")&&document.getElementById("izi-temp-container").remove()},100)),t.next=67;break;case 63:t.prev=63,t.t1=t.catch(39),console.error("[InPostPay] Błąd przy ładowaniu koszyka:",t.t1,t.t1.stack),document.getElementById("izi-temp-container")&&document.getElementById("izi-temp-container").remove();case 67:return t.abrupt("return",IPPWidgetOptions.basketBindingApiKey);case 68:case"end":return t.stop()}},t,null,[[39,63],[45,52]])}),m=function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){v(i,n,o,a,u,"next",t)}function u(t){v(i,n,o,a,u,"throw",t)}a(void 0)})},m.apply(this,arguments)}function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}function b(){b=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(r,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(r,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=E(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=f(r,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(r,n,new O(o||[])),!0),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var l={};function h(){}function p(){}function d(){}var y={};c(y,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(P([])));g&&g!==e&&n.call(g,i)&&(y=g);var m=d.prototype=h.prototype=Object.create(y);function _(t){["next","throw","return"].forEach(function(r){c(t,r,function(t){return this._invoke(r,t)})})}function x(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==w(l)&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(l).then(function(t){s.value=t,a(s)},function(t){return e("throw",t,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()},!0)}function E(r,e){var n=e.method,o=r.i[n];if(o===t)return e.delegate=null,"throw"===n&&r.i.return&&(e.method="return",e.arg=t,E(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=f(o,r.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var a=i.arg;return a?a.done?(e[r.r]=a.value,e.next=r.n,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function k(t){this.tryEntries.push(t)}function S(r){var e=r[4]||{};e.type="normal",e.arg=t,r[4]=e}function O(t){this.tryEntries=[[-1]],t.forEach(k,this),this.reset(!0)}function P(r){if(null!=r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(w(r)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},r.awrap=function(t){return{__await:t}},_(x.prototype),c(x.prototype,a,function(){return this}),r.AsyncIterator=x,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new x(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},_(m),c(m,u,"Generator"),c(m,i,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},r.values=P,O.prototype={constructor:O,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(t){a.type="throw",a.arg=r,e.next=t}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),S(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;S(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={i:P(r),r:e,n},"next"===this.method&&(this.arg=t),l}},r}function _(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function x(t){return E.apply(this,arguments)}function E(){var t;return t=b().mark(function t(r){var e,n,o,i,a,u,c,s,f,l,h,p,d,y,v,g;return b().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=3;break}return console.warn("[InPostPay] iziCanBeBound called without productId"),t.abrupt("return",!1);case 3:if(e=document.querySelector('.izi-widget-product[data-product-id="'.concat(r,'"]')),n=e?e.closest("form"):null,o=n||window.document.querySelector('form[data-product_id="'.concat(r,'"]'))){t.next=8;break}return t.abrupt("return",!0);case 8:if(i=o.querySelector("button.single_add_to_cart_button"),a=o.querySelector("button.single_add_to_cart_button.disabled"),u=o.querySelector('a.add_to_cart_button[data-product_id="'.concat(r,'"]')),c=o.querySelector(".post-".concat(r)),s=o.querySelectorAll("form.cart .pewc-item"),f=o.querySelectorAll(".wapf input[required]"),u||o||c){t.next=16;break}return t.abrupt("return",!0);case 16:if(!(i&&i.disabled||a)){t.next=18;break}return t.abrupt("return",!1);case 18:if(!(f.length>0)){t.next=22;break}if(Array.from(f).every(function(t){return t.value})){t.next=22;break}return t.abrupt("return",!1);case 22:if(!(s.length>0)){t.next=38;break}if(l=o.querySelectorAll('.pewc-item.required-field input[type="text"]'),h=o.querySelectorAll(".pewc-item select"),p=o.querySelectorAll(".pewc-item.required-field input.pewc_file_data"),!(l.length>0)){t.next=30;break}if(Array.from(l).every(function(t){return t.value})){t.next=30;break}return t.abrupt("return",!1);case 30:if(!(h.length>0)){t.next=34;break}if(Array.from(h).every(function(t){return t.value})){t.next=34;break}return t.abrupt("return",!1);case 34:if(!(p.length>0)){t.next=38;break}if(Array.from(p).every(function(t){return t.value})){t.next=38;break}return t.abrupt("return",!1);case 38:if(!o){t.next=43;break}return d=o.querySelector('button[type="submit"]'),(y=!d.classList.contains("disabled"))||d.click(),t.abrupt("return",y);case 43:if(!u){t.next=47;break}return(v=!u.classList.contains("product_type_variable"))||u.click(),t.abrupt("return",v);case 47:if(!c){t.next=51;break}return(g=!c.classList.contains("outofstock"))||o.querySelector('a[data-product_id="'.concat(r,'"]')).click(),t.abrupt("return",g);case 51:case"end":return t.stop()}},t)}),E=function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){_(i,n,o,a,u,"next",t)}function u(t){_(i,n,o,a,u,"throw",t)}a(void 0)})},E.apply(this,arguments)}function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function S(){if(document.querySelectorAll(".izi-widget-placeholder").length&&"object"===("undefined"==typeof InpostIziJavsscriptWoocommerce?"undefined":k(InpostIziJavsscriptWoocommerce))){var t=O();document.querySelectorAll("form").forEach(function(r){r.querySelector('button[type="submit"], input[type="submit"]')&&["gclid","fbclid","client_id"].forEach(function(e){var n=t[e];if(n&&!r.querySelector('[name="inpostpay_'.concat(e,'"]'))){var o=document.createElement("input");o.type="hidden",o.name="inpostpay_".concat(e),o.value=n,r.appendChild(o)}})})}}function O(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];try{return{gclid:localStorage.getItem("gclid")||null,fbclid:localStorage.getItem("fbclid")||null,client_id:localStorage.getItem("client_id")||null}}catch(r){return t&&console.error("Błąd przy odczycie identyfikatorów z localStorage:",r),{gclid:null,fbclid:null,client_id:null}}}function P(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return j(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?j(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(u)throw i}}}}function j(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function T(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,r)||function(t,r){if(t){if("string"==typeof t)return A(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?A(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function N(){N=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(r,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(r,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=f(r,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(r,n,new k(o||[])),!0),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var l={};function h(){}function p(){}function d(){}var y={};c(y,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==e&&n.call(g,i)&&(y=g);var m=d.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach(function(r){c(t,r,function(t){return this._invoke(r,t)})})}function b(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==I(l)&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(l).then(function(t){s.value=t,a(s)},function(t){return e("throw",t,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()},!0)}function _(r,e){var n=e.method,o=r.i[n];if(o===t)return e.delegate=null,"throw"===n&&r.i.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=f(o,r.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var a=i.arg;return a?a.done?(e[r.r]=a.value,e.next=r.n,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){this.tryEntries.push(t)}function E(r){var e=r[4]||{};e.type="normal",e.arg=t,r[4]=e}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(r){if(null!=r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(I(r)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},r.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,a,function(){return this}),r.AsyncIterator=b,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(m),c(m,u,"Generator"),c(m,i,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},r.values=S,k.prototype={constructor:k,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(t){a.type="throw",a.arg=r,e.next=t}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),E(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;E(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={i:S(r),r:e,n},"next"===this.method&&(this.arg=t),l}},r}function G(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function z(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){G(i,n,o,a,u,"next",t)}function u(t){G(i,n,o,a,u,"throw",t)}a(void 0)})}}!function(){if(!window.__ipp_mfp_focus_fix_installed){window.__ipp_mfp_focus_fix_installed=!0;var t="inpostpay-widget-popup",r=window.jQuery;if(r){var e=function(){return r.magnificPopup?r.magnificPopup.instance:null},n=!1,o=null,i=function(){var i,a=e();n||a&&a.isOpen&&document.getElementById(t)&&(i=r._data(document,"events"),o=(i&&i.focusin?i.focusin:[]).filter(function(t){return t&&"mfp"===t.namespace&&"function"==typeof t.handler}),r(document).off("focusin.mfp"),n=!0)},a=function(){if(n){n=!1;var t=e();if(t&&t.isOpen){if(o&&o.length){var i,a=P(o);try{for(a.s();!(i=a.n()).done;){var u=i.value;r(document).on("focusin.mfp",u.handler)}}catch(t){a.e(t)}finally{a.f()}}o=null}else o=null}};document.getElementById(t)&&i();var u=new MutationObserver(function(r){var e,n=P(r);try{for(n.s();!(e=n.n()).done;){var o,u=e.value,c=P(u.addedNodes);try{for(c.s();!(o=c.n()).done;){var s=o.value;s&&1===s.nodeType&&s.id===t&&i()}}catch(t){c.e(t)}finally{c.f()}var f,l=P(u.removedNodes);try{for(l.s();!(f=l.n()).done;){var h=f.value;h&&1===h.nodeType&&h.id===t&&a()}}catch(t){l.e(t)}finally{l.f()}}}catch(t){n.e(t)}finally{n.f()}});document.body?u.observe(document.body,{childList:!0}):document.addEventListener("DOMContentLoaded",function(){u.observe(document.body,{childList:!0})},{once:!0})}}}();var q=null;function F(t){return L.apply(this,arguments)}function L(){return(L=z(N().mark(function t(r){return N().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!q||!q.closest("#inpostpay-widget-popup")){t.next=2;break}return t.abrupt("return");case 2:if(!r){t.next=6;break}return t.next=5,B(r);case 5:case 8:return t.abrupt("return",t.sent);case 6:return t.next=8,C();case 9:case"end":return t.stop()}},t)}))).apply(this,arguments)}function B(t){return W.apply(this,arguments)}function W(){return(W=z(N().mark(function t(r){var e,n,o,i;return N().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=document.querySelector('.izi-widget-product[data-product-id="'.concat(r,'"]')),(n=null==e?void 0:e.getAttribute("data-alert-message"))||(o=document.querySelector("inpost-izi-button"),n=(null==o?void 0:o.getAttribute("data-alert-message"))||"An unknown error occurred."),t.prev=3,t.next=6,x(r);case 6:if(t.sent){t.next=10;break}throw alert(n),new Error("UNDELIVERABLE_PRODUCT");case 10:return t.next=12,g(r);case 12:return i=t.sent,t.abrupt("return",i);case 16:throw t.prev=16,t.t0=t.catch(3),t.t0;case 19:case"end":return t.stop()}},t,null,[[3,16]])}))).apply(this,arguments)}function C(){return R.apply(this,arguments)}function R(){return(R=z(N().mark(function t(){var r,e,n,o,i,a;return N().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=h("basket_binding_api_key")||(null===(r=IPPWidgetOptions)||void 0===r?void 0:r.basketBindingApiKey))||""===e.trim()||"undefined"===e){t.next=4;break}return console.log("[InPostPay] Contextual click: using existing basket_binding_api_key"),t.abrupt("return",e);case 4:return n=new FormData,Object.entries(O(!1)).forEach(function(t){var r=T(t,2),e=r[0],o=r[1];o&&n.append("inpostpay_".concat(e),o)}),t.prev=6,t.next=9,fetch("/?wc-ajax=inpost_pay_binding",{method:"POST",body:n});case 9:if((o=t.sent).ok){t.next=13;break}throw console.warn("[InPostPay] Contextual bootstrap failed:",o.status),new Error("Failed to obtain basket_binding_api_key");case 13:return t.next=15,o.json();case 15:if(i=t.sent,a=null,i.basket_binding_api_key?a=i.basket_binding_api_key:i.data&&i.data.basket_binding_api_key?a=i.data.basket_binding_api_key:"string"==typeof i&&(a=i),!a||"string"!=typeof a){t.next=22;break}return IPPWidgetOptions.basketBindingApiKey=a,console.log("[InPostPay] Contextual click: basket_binding_api_key obtained"),t.abrupt("return",a);case 22:throw console.warn("[InPostPay] Contextual bootstrap: no key in response"),new Error("No basket_binding_api_key in response");case 26:throw t.prev=26,t.t0=t.catch(6),console.error("[InPostPay] Contextual bootstrap error:",t.t0),t.t0;case 30:case"end":return t.stop()}},t,null,[[6,26]])}))).apply(this,arguments)}document.addEventListener("click",function(t){q=t.target});var J=function(){window.location.href=window.location.href};function M(t){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(t)}function Q(){Q=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(r,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(r,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=f(r,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(r,n,new k(o||[])),!0),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var l={};function h(){}function p(){}function d(){}var y={};c(y,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==e&&n.call(g,i)&&(y=g);var m=d.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach(function(r){c(t,r,function(t){return this._invoke(r,t)})})}function b(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==M(l)&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(l).then(function(t){s.value=t,a(s)},function(t){return e("throw",t,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()},!0)}function _(r,e){var n=e.method,o=r.i[n];if(o===t)return e.delegate=null,"throw"===n&&r.i.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=f(o,r.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var a=i.arg;return a?a.done?(e[r.r]=a.value,e.next=r.n,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){this.tryEntries.push(t)}function E(r){var e=r[4]||{};e.type="normal",e.arg=t,r[4]=e}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(r){if(null!=r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(M(r)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},r.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,a,function(){return this}),r.AsyncIterator=b,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(m),c(m,u,"Generator"),c(m,i,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},r.values=S,k.prototype={constructor:k,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(t){a.type="throw",a.arg=r,e.next=t}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),E(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;E(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={i:S(r),r:e,n},"next"===this.method&&(this.arg=t),l}},r}function D(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function U(t){return Y.apply(this,arguments)}function Y(){var t;return t=Q().mark(function t(r){var e,n;return Q().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("orderCreated"!==r){t.next=3;break}return window.location.href=InpostIziJavsscriptWoocommerce.thank_you_url,t.abrupt("return",Promise.resolve(!0));case 3:if("basketProductChanged"!==r){t.next=6;break}return J(),t.abrupt("return",Promise.resolve(!0));case 6:if("basketDeleted"!==r){t.next=13;break}if(e=document.body.classList.contains("single-product"),n=document.querySelector(".izi-widget-product"),e||n){t.next=11;break}return t.abrupt("return");case 11:return J(),t.abrupt("return",Promise.resolve(!0));case 13:case"end":return t.stop()}},t)}),Y=function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){D(i,n,o,a,u,"next",t)}function u(t){D(i,n,o,a,u,"throw",t)}a(void 0)})},Y.apply(this,arguments)}function K(t){return K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K(t)}function H(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return $(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?$(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(u)throw i}}}}function $(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function Z(){Z=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(r,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(r,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=f(r,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(r,n,new k(o||[])),!0),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var l={};function h(){}function p(){}function d(){}var y={};c(y,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==e&&n.call(g,i)&&(y=g);var m=d.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach(function(r){c(t,r,function(t){return this._invoke(r,t)})})}function b(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==K(l)&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(l).then(function(t){s.value=t,a(s)},function(t){return e("throw",t,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()},!0)}function _(r,e){var n=e.method,o=r.i[n];if(o===t)return e.delegate=null,"throw"===n&&r.i.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=f(o,r.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var a=i.arg;return a?a.done?(e[r.r]=a.value,e.next=r.n,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){this.tryEntries.push(t)}function E(r){var e=r[4]||{};e.type="normal",e.arg=t,r[4]=e}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(r){if(null!=r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(K(r)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},r.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,a,function(){return this}),r.AsyncIterator=b,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(m),c(m,u,"Generator"),c(m,i,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},r.values=S,k.prototype={constructor:k,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(t){a.type="throw",a.arg=r,e.next=t}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),E(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;E(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={i:S(r),r:e,n},"next"===this.method&&(this.arg=t),l}},r}function V(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function X(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){V(i,n,o,a,u,"next",t)}function u(t){V(i,n,o,a,u,"throw",t)}a(void 0)})}}var tt,rt=!1,et=!1,nt=!1;function ot(){return ot=X(Z().mark(function t(){var r;return Z().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(document.body.classList.contains("woocommerce-cart")||document.querySelector(".woocommerce-cart-form")||document.querySelector(".cart_totals")||document.querySelector("div.wp-block-woocommerce-cart")){t.next=3;break}return t.abrupt("return");case 3:"true"===IPPWidgetOptions.isBlock?window.wp&&(r=null,window.wp.data.subscribe(function(){try{var t=window.wp.data.select("wc/store/cart");if(t){var e,n,o=t.getCartData(),i=t.getCartTotals(),a={itemCount:(null==o||null===(e=o.items)||void 0===e?void 0:e.length)||0,total:(null==i?void 0:i.total_price)||0,itemsWeight:(null==o?void 0:o.itemsWeight)||0,coupons:(null==o||null===(n=o.coupons)||void 0===n?void 0:n.length)||0};r&&JSON.stringify(r)!==JSON.stringify(a)&&(console.log("Cart data changed"),rt||(et=!1,it())),r=a}}catch(t){console.warn("Error:",t)}})):jQuery(document.body).on("wc_fragments_refreshed",function(){var t=document.querySelector("#inpostpay-widget-popup");rt||(et=!1,t||et||at(30,250).then(function(){it()}).catch(function(){it()}))}),nt||(nt=!0,document.addEventListener("click",function(){var t=X(Z().mark(function t(r){var e,n;return Z().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r.target.closest("inpost-izi-button")){t.next=3;break}return t.abrupt("return");case 3:return rt=!0,t.prev=4,t.next=7,at(8,250);case 7:return t.next=9,ut();case 9:t.next=17;break;case 11:t.prev=11,t.t0=t.catch(4),e=document.querySelector("#inpostpay-widget-popup"),n=document.querySelector("inpost-izi-button"),!e&&!n&&it();case 17:case"end":return t.stop()}},t,null,[[4,11]])}));return function(r){return t.apply(this,arguments)}}()),jQuery(document.body).on("wc_fragments_refreshed",function(){rt||it()}),new MutationObserver(function(t){var r,e=H(t);try{for(e.s();!(r=e.n()).done;){r.value.removedNodes.forEach(function(t){"inpostpay-widget-popup"===t.id&&(rt=!1,et=!1,document.body.classList.contains("woocommerce-cart")&&at(30,250).then(function(){it()}).catch(function(){it()}),document.querySelector("inpost-izi-button")||at(30,250).then(function(){it()}).catch(function(){it()}),setTimeout(function(){document.querySelector("#inpostpay-widget-popup")||et||it()},1e3))})}}catch(t){e.e(t)}finally{e.f()}}).observe(document.body,{childList:!0,subtree:!0}));case 5:case"end":return t.stop()}},t)})),ot.apply(this,arguments)}function it(){var t=!!document.querySelector("#inpostpay-widget-popup"),r=document.querySelector("inpost-izi-button");t||et||r||(window.IPPwidget=InPostPayWidget.init(window.IPPWidgetOptions),o(),et=!0)}function at(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return new Promise(function(e,n){var o=0,i=setInterval(function(){var r=document.querySelector("#inpostpay-widget-popup");r?(clearInterval(i),e(r)):++o>=t&&(clearInterval(i),n(new Error("Popup nie pojawił się w czasie")))},r)})}function ut(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;return new Promise(function(e,n){var o=0,i=setInterval(function(){var r=document.querySelector("#inpostpay-widget-popup"),n=null==r?void 0:r.shadowRoot,a=null==n?void 0:n.querySelector("#button-connect");a?(clearInterval(i),e(a)):++o>=t&&clearInterval(i)},r)})}function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function st(){st=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(r,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(r,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=f(r,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(r,n,new k(o||[])),!0),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var l={};function h(){}function p(){}function d(){}var y={};c(y,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==e&&n.call(g,i)&&(y=g);var m=d.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach(function(r){c(t,r,function(t){return this._invoke(r,t)})})}function b(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==ct(l)&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(l).then(function(t){s.value=t,a(s)},function(t){return e("throw",t,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()},!0)}function _(r,e){var n=e.method,o=r.i[n];if(o===t)return e.delegate=null,"throw"===n&&r.i.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=f(o,r.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var a=i.arg;return a?a.done?(e[r.r]=a.value,e.next=r.n,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){this.tryEntries.push(t)}function E(r){var e=r[4]||{};e.type="normal",e.arg=t,r[4]=e}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(r){if(null!=r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(ct(r)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},r.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,a,function(){return this}),r.AsyncIterator=b,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(m),c(m,u,"Generator"),c(m,i,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},r.values=S,k.prototype={constructor:k,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(t){a.type="throw",a.arg=r,e.next=t}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),E(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;E(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={i:S(r),r:e,n},"next"===this.method&&(this.arg=t),l}},r}function ft(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return lt(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?lt(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(u)throw i}}}}function lt(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function ht(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function pt(){var t;return t=st().mark(function t(){var r,e,n;return st().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=function(){return!!document.querySelector(".wp-block-woocommerce-empty-cart-block")||!!document.querySelector(".cart-empty")||(document.querySelector(".woocommerce-cart-form")||document.querySelector('form[action*="cart"]'),!1)},e=function(){var t=document.querySelectorAll('[data-from-elementor="1"]');if(0!==t.length){var r=n();t.forEach(function(t){"BASKET_SUMMARY"===t.getAttribute("binding_place")&&(t.style.display=r?"none":"block")})}},r=document.querySelector(".elementor-widget-container")){t.next=5;break}return t.abrupt("return");case 5:e(),jQuery(document.body).on("wc_fragments_refreshed",function(){e()}),jQuery(document.body).on("updated_cart_totals removed_from_cart added_to_cart",function(){e()}),new MutationObserver(function(t){var r,e=ft(t);try{for(e.s();!(r=e.n()).done;)r.value.addedNodes.forEach(function(t){if("INPOST-IZI-BUTTON"===t.nodeName){var r=document.querySelector(".woocommerce-cart-form");t.style.display=r?"block":"none"}})}catch(t){e.e(t)}finally{e.f()}}).observe(r,{childList:!0,subtree:!0});case 10:case"end":return t.stop()}},t)}),pt=function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){ht(i,n,o,a,u,"next",t)}function u(t){ht(i,n,o,a,u,"throw",t)}a(void 0)})},pt.apply(this,arguments)}function dt(){dt=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(r,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(r,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=f(r,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(r,n,new k(o||[])),!0),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var l={};function h(){}function p(){}function d(){}var y={};c(y,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==e&&n.call(g,i)&&(y=g);var m=d.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach(function(r){c(t,r,function(t){return this._invoke(r,t)})})}function b(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==yt(l)&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(l).then(function(t){s.value=t,a(s)},function(t){return e("throw",t,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()},!0)}function _(r,e){var n=e.method,o=r.i[n];if(o===t)return e.delegate=null,"throw"===n&&r.i.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=f(o,r.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var a=i.arg;return a?a.done?(e[r.r]=a.value,e.next=r.n,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){this.tryEntries.push(t)}function E(r){var e=r[4]||{};e.type="normal",e.arg=t,r[4]=e}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(r){if(null!=r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(yt(r)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},r.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,a,function(){return this}),r.AsyncIterator=b,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(m),c(m,u,"Generator"),c(m,i,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},r.values=S,k.prototype={constructor:k,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(t){a.type="throw",a.arg=r,e.next=t}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),E(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;E(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={i:S(r),r:e,n},"next"===this.method&&(this.arg=t),l}},r}function yt(t){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(t)}function vt(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function gt(){var t;return t=dt().mark(function t(){var r,e,n,o,i,a,u,c,s;return dt().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(s=function(t){t&&J()},r=document.querySelector(".izi-widget-product"),e=document.querySelector("inpost-izi-button"),r||e){t.next=5;break}return t.abrupt("return");case 5:n=!1,o=!1,i=null,a=!0,"object"===("undefined"==typeof InpostIziJavsscriptWoocommerce?"undefined":yt(InpostIziJavsscriptWoocommerce))&&(a=InpostIziJavsscriptWoocommerce.refresh_after_add_to_cart),u=function(t){var r;null!=t&&null!==(r=t.shadowRoot)&&void 0!==r&&r.querySelector(".count-badge")&&s(a)},c=function(t){i&&i.disconnect(),(i=new MutationObserver(function(t){t.forEach(function(t){t.addedNodes.forEach(function(t){t.nodeType===Node.ELEMENT_NODE&&(t.querySelector&&t.querySelector(".count-badge")&&(n=!1,s(a)),t.classList.contains("product-count")&&t.querySelector(".count-badge")&&(n=!1,s(a)))}),"attributes"===t.type&&t.target.classList.contains("product-count")&&t.target.querySelector(".count-badge")&&(n=!1,s(a))})})).observe(t,{childList:!0,subtree:!0,attributes:!0})},jQuery(document.body).on("added_to_cart",function(){n=!0;var t=document.querySelector("inpost-izi-button");t&&t.shadowRoot&&(t.shadowRoot.querySelector(".count-badge")?(n=!1,s(a)):c(t.shadowRoot))}),new MutationObserver(function(t){t.forEach(function(t){t.addedNodes.forEach(function(t){if("inpostpay-widget-popup"===t.id){var r=document.querySelector("#inpostpay-widget-popup").shadowRoot;c(r),r.addEventListener("click",function(t){o="button-unpair"===t.target.id})}}),t.removedNodes.forEach(function(t){"inpostpay-widget-popup"===t.id&&n&&!o&&(n=!1,s(a))})})}).observe(document.body,{childList:!0,subtree:!0}),u(e);case 16:case"end":return t.stop()}},t)}),gt=function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){vt(i,n,o,a,u,"next",t)}function u(t){vt(i,n,o,a,u,"throw",t)}a(void 0)})},gt.apply(this,arguments)}function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function wt(){wt=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(r,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(r,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=f(r,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(r,n,new k(o||[])),!0),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var l={};function h(){}function p(){}function d(){}var y={};c(y,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==e&&n.call(g,i)&&(y=g);var m=d.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach(function(r){c(t,r,function(t){return this._invoke(r,t)})})}function b(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==mt(l)&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(l).then(function(t){s.value=t,a(s)},function(t){return e("throw",t,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()},!0)}function _(r,e){var n=e.method,o=r.i[n];if(o===t)return e.delegate=null,"throw"===n&&r.i.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=f(o,r.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var a=i.arg;return a?a.done?(e[r.r]=a.value,e.next=r.n,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){this.tryEntries.push(t)}function E(r){var e=r[4]||{};e.type="normal",e.arg=t,r[4]=e}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(r){if(null!=r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(mt(r)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},r.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,a,function(){return this}),r.AsyncIterator=b,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(m),c(m,u,"Generator"),c(m,i,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},r.values=S,k.prototype={constructor:k,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(t){a.type="throw",a.arg=r,e.next=t}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),E(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;E(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={i:S(r),r:e,n},"next"===this.method&&(this.arg=t),l}},r}function bt(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function _t(){var t;return t=wt().mark(function t(){var r,e,n,o;return wt().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,r=new FormData,(e=h("basket_binding_api_key"))&&r.append("basket_binding_api_key",e),t.next=6,fetch("/?wc-ajax=inpost_pay_bind",{method:"POST",credentials:"same-origin",body:r});case 6:if((n=t.sent).ok){t.next=10;break}return console.warn("[InPostPay] Bind failed (expected if no basket_binding_api_key):",n.status),t.abrupt("return");case 10:return t.prev=10,t.next=13,n.json();case 13:(o=t.sent).success&&o.data&&o.data.basket_binding_api_key&&(IPPWidgetOptions.basketBindingApiKey=o.data.basket_binding_api_key,h("basket_binding_api_key")||p("basket_binding_api_key",o.data.basket_binding_api_key,o.data.session_expiration)),t.next=20;break;case 17:t.prev=17,t.t0=t.catch(10),console.warn("[InPostPay] Failed to parse bind response JSON:",t.t0);case 20:t.next=25;break;case 22:t.prev=22,t.t1=t.catch(0),console.warn("[InPostPay] Bind error:",t.t1);case 25:case"end":return t.stop()}},t,null,[[0,22],[10,17]])}),_t=function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){bt(i,n,o,a,u,"next",t)}function u(t){bt(i,n,o,a,u,"throw",t)}a(void 0)})},_t.apply(this,arguments)}function xt(t){if(t)var r=0,e=setInterval(function(){var t=document.querySelectorAll("inpost-izi-button");t.length>0?(clearInterval(e),t.forEach(function(t){var r=0,e=setInterval(function(){if(t.shadowRoot){clearInterval(e);var n=t.shadowRoot.querySelector(".button");n&&(t.setAttribute("data-currency-processed","1"),n.click(),console.log("BUTTON CLICKED"))}else++r>=30&&clearInterval(e)},200)})):++r>=30&&clearInterval(e)},300)}function Et(){Et=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(r,e,n,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype);return c(a,"_invoke",function(r,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=f(r,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(r,n,new k(o||[])),!0),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var l={};function h(){}function p(){}function d(){}var y={};c(y,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==e&&n.call(g,i)&&(y=g);var m=d.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach(function(r){c(t,r,function(t){return this._invoke(r,t)})})}function b(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==Ot(l)&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,u)},function(t){e("throw",t,a,u)}):r.resolve(l).then(function(t){s.value=t,a(s)},function(t){return e("throw",t,a,u)})}u(c.arg)}var o;c(this,"_invoke",function(t,n){function i(){return new r(function(r,o){e(t,n,r,o)})}return o=o?o.then(i,i):i()},!0)}function _(r,e){var n=e.method,o=r.i[n];if(o===t)return e.delegate=null,"throw"===n&&r.i.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var i=f(o,r.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var a=i.arg;return a?a.done?(e[r.r]=a.value,e.next=r.n,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){this.tryEntries.push(t)}function E(r){var e=r[4]||{};e.type="normal",e.arg=t,r[4]=e}function k(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function S(r){if(null!=r){var e=r[i];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(Ot(r)+" is not iterable")}return p.prototype=d,c(m,"constructor",d),c(d,"constructor",p),p.displayName=c(d,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},r.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,a,function(){return this}),r.AsyncIterator=b,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(m),c(m,u,"Generator"),c(m,i,function(){return this}),c(m,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},r.values=S,k.prototype={constructor:k,reset:function(r){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(t){a.type="throw",a.arg=r,e.next=t}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,c=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],l):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),l},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),E(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;E(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={i:S(r),r:e,n},"next"===this.method&&(this.arg=t),l}},r}function kt(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function St(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var i=t.apply(r,e);function a(t){kt(i,n,o,a,u,"next",t)}function u(t){kt(i,n,o,a,u,"throw",t)}a(void 0)})}}function Ot(t){return Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ot(t)}function Pt(){var t=!1,r=null;function e(){var r=document.querySelector("inpost-izi-button");if(r&&r.shadowRoot){var e=r.shadowRoot.querySelector(".count-badge");e&&!t?(t=!0,function(){_t.apply(this,arguments)}()):!e&&t&&(t=!1)}else t=!1}new MutationObserver(function(){var n=document.querySelector("inpost-izi-button");n&&n.shadowRoot?(r||(r=new MutationObserver(e)).observe(n.shadowRoot,{childList:!0,subtree:!0}),e()):(r&&(r.disconnect(),r=null),t=!1)}).observe(document.body,{childList:!0,subtree:!0}),setInterval(e,200)}tt=EventTarget.prototype.dispatchEvent,EventTarget.prototype.dispatchEvent=function(t){try{t&&t.type&&(t.type.includes("wc")||t.type.includes("cart")||t.type.includes("basket")||t.type.includes("izi"))&&(void 0!==t.detail&&null!==t.detail||(t.detail={data:{}}))}catch(t){console.warn("[InPostPay] DOM event safeguard error",t)}return tt.call(this,t)},"object"===("undefined"==typeof InpostIziJavsscriptWoocommerce?"undefined":Ot(InpostIziJavsscriptWoocommerce))&&(window.addEventListener("load",St(Et().mark(function t(){var r,e,n;return Et().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=h("basket_binding_api_key"),IPPWidgetOptions&&"string"==typeof e&&""!==e.trim()&&"undefined"!==e&&(n=e.trim(),IPPWidgetOptions.basketBindingApiKey=n),window.IPPwidget=InPostPayWidget.init(IPPWidgetOptions),o(),S(),Pt(),xt(Boolean(null===(r=window.InpostIziJavsscriptWoocommerce)||void 0===r?void 0:r.currency_restored));case 8:case"end":return t.stop()}},t)}))),document.addEventListener("DOMContentLoaded",function(){IPPWidgetOptions.unboundWidgetClicked=F,IPPWidgetOptions.handleBasketEvent=U,function(){ot.apply(this,arguments)}(),function(){pt.apply(this,arguments)}(),function(){gt.apply(this,arguments)}()},!1))})();
|
|
//# sourceMappingURL=woocommerceizi.js.map
|