(()=>{"use strict";var t=function(t,e,n){jQuery(document).trigger("ppcp-shown",{handler:t,action:"show",selector:e,element:n})},e=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=function(t){return"string"==typeof t?document.querySelector(t):t}(e);if(o){var i=o.style.getPropertyValue("display");if(n)"none"===i&&(o.style.removeProperty("display"),t("Hiding.setVisible",e,o)),function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}(o)||(o.style.setProperty("display","block"),t("Hiding.setVisible",e,o));else{if("none"===i)return;o.style.setProperty("display","none",r?"important":""),function(t,e,n){jQuery(document).trigger("ppcp-hidden",{handler:t,action:"hide",selector:e,element:n})}("Hiding.setVisible",e,o)}}},n=function(t){e(t,!1,arguments.length>1&&void 0!==arguments[1]&&arguments[1])},r=function(t){e(t,!0)};function o(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",c=n.toStringTag||"@@toStringTag";function u(n,r,o,c){var u=r&&r.prototype instanceof s?r:s,d=Object.create(u.prototype);return i(d,"_invoke",function(n,r,o){var i,c,u,s=0,d=o||[],f=!1,l={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,c=0,u=t,l.n=n,a}};function p(n,r){for(c=n,u=r,e=0;!f&&s&&!o&&e<d.length;e++){var o,i=d[e],p=l.p,y=i[2];n>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=n<2&&p<i[1])?(c=0,l.v=r,l.n=i[1]):p<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,l.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,d,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===d&&p(d,y),c=d,u=y;(e=c<2?t:u)||!f;){i||(c?c<3?(c>1&&(l.n=-1),p(c,u)):l.n=u:l.v=u);try{if(s=2,i){if(c||(o="next"),e=i[o]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,c<2&&(c=0)}else 1===c&&(e=i.return)&&e.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=t}else if((e=(f=l.n<0)?u:n.call(r,l))!==a)break}catch(e){i=t,c=1,u=e}finally{s=1}}return{value:e,done:f}}}(n,o,c),!0),d}var a={};function s(){}function d(){}function f(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):(i(e={},r,function(){return this}),e),p=f.prototype=s.prototype=Object.create(l);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,i(t,c,"GeneratorFunction")),t.prototype=Object.create(p),t}return d.prototype=f,i(p,"constructor",f),i(f,"constructor",d),d.displayName="GeneratorFunction",i(f,c,"GeneratorFunction"),i(p),i(p,c,"Generator"),i(p,r,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:u,m:y}})()}function i(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}i=function(t,e,n,r){function c(e,n){i(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(c("next",0),c("throw",1),c("return",2))},i(t,e,n,r)}function c(t,e,n,r,o,i,c){try{var u=t[i](c),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,o)}function u(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(t){c(i,r,o,u,a,"next",t)}function a(t){c(i,r,o,u,a,"throw",t)}u(void 0)})}}document.addEventListener("DOMContentLoaded",function(){var t=document.querySelector("button.refund-items");if(t){t.insertAdjacentHTML("afterend",'<button class="button" type="button" id="pcpVoid">'.concat(PcpVoidButton.button_text,"</button>")),n(t);var e=document.querySelector("#pcpVoid");e.addEventListener("click",u(o().m(function i(){var c,u;return o().w(function(o){for(;;)switch(o.n){case 0:if(window.confirm(PcpVoidButton.popup_text)){o.n=1;break}return o.a(2);case 1:return e.setAttribute("disabled","disabled"),o.n=2,fetch(PcpVoidButton.ajax.void.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:PcpVoidButton.ajax.void.nonce,wc_order_id:PcpVoidButton.wc_order_id})});case 2:return c=o.v,o.n=3,c.json();case 3:if((u=o.v).success){o.n=4;break}throw n(e),r(t),alert(PcpVoidButton.error_text),Error(u.data.message);case 4:location.reload();case 5:return o.a(2)}},i)})))}})})();