(()=>{"use strict";function t(e){return t="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},t(e)}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function r(e,r,n){return(r=function(e){var r=function(e){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}window.wp.i18n,((function(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach(function(e){r(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}({},tripzzy.strings)||{}).messages||{}).required_field;var n=tripzzy,o=n.ajax_url,i=n.nonce;function c(){var t=document.getElementById("tripzzy-checkout-form-response-msg"),e=document.getElementById("tripzzy-checkout-form-response-title"),r=document.getElementById("tripzzy-checkout-form-response"),n=document.getElementById("tripzzy-payment-button");try{n.innerHTML="",n.classList.add("tripzzy-is-processing"),function(){var t=document.getElementById("tripzzy-checkout-form-response-msg"),e=document.getElementById("tripzzy-checkout-form-response-title"),r=document.getElementById("tripzzy-checkout-form-response");t.classList.remove("tripzzy-response-msg","tripzzy-error"),e.innerHTML="",r.innerHTML=""}(),document.getElementById("tripzzy-payment-details"),document.getElementById("tripzzy-checkout-form");var c=n.getAttribute("data-total");fetch("".concat(o,"?tripzzy_nonce=").concat(i,"&action=tripzzy_get_account_details"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:c})}).then(function(t){if(n.classList.remove("tripzzy-is-processing"),void 0!==t.success&&!t.success)throw new Error(t.statusText);return t.json()}).then(function(t){if(!t.success)throw new Error(t.data[0].message);var e,r=null!==(e=t.data.account_details)&&void 0!==e?e:"",o=wp.template("tripzzy-book-now-pay-latter");n.innerHTML=r+o()})}catch(o){t.classList.add("tripzzy-response-msg","tripzzy-error"),e.innerHTML="Error",r.innerHTML=o.message,setTimeout(function(){n.classList.remove("tripzzy-is-processing")},100)}}c(),document.addEventListener("click",function(t){t.target===document.querySelector("#tripzzy-payment-mode-bank_transfer")&&c()})})();