!function(){var e={567:function(e){"use strict";e.exports=window.jQuery},284:function(e){"use strict";e.exports=window.regeneratorRuntime},330:function(e){"use strict";e.exports=window.braintree.client},753:function(e){"use strict";e.exports=window.braintree.threeDSecure},156:function(e){function t(e,t,r,n,o,i,u){try{var c=e[i](u),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,i){var u=e.apply(r,n);function c(e){t(u,o,i,c,a,"next",e)}function a(e){t(u,o,i,c,a,"throw",e)}c(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},670:function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},836:function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}!function(){var e=r(836),t=e(r(284)),n=e(r(670)),o=e(r(156)),i=e(r(330)),u=e(r(753)),c=e(r(567));function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){(0,n.default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f,d=cartflows_offer.wcBraintree,l=new Promise((function(e,t){i.default.create({authorization:d.clientToken},(function(r,n){r?(console.log(r),t()):e(n)}))})),p=new Promise(function(){var e=(0,o.default)(t.default.mark((function e(r,n){var o;return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l;case 2:o=e.sent,u.default.create({version:2,client:o},(function(e,t){return e?n(e):r(t)}));case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),w=function(){var e=(0,o.default)(t.default.mark((function e(r){var n,i;return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.newURL.match(/wcBraintree3DS=(.*)/))try{(i=JSON.parse(window.atob(decodeURIComponent(n[1])))).nonce?(history.pushState({},"",window.location.pathname+window.location.search),p.then((function(e){var r;e.verifyCard(s(s({amount:i.amount,nonce:i.nonce,bin:i.details.bin},null==d||null===(r=d.order)||void 0===r?void 0:r.threeDSData),{},{onLookupComplete:function(e,t){return t()}}),function(){var e=(0,o.default)(t.default.mark((function e(r,n){return t.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r){e.next=4;break}b(r.message),e.next=11;break;case 4:if(!n.liabilityShifted){e.next=10;break}return e.next=7,v({nonce:n.nonce,order_id:cartflows_offer.order_id,step_id:cartflows_offer.step_id});case 7:f.click(),e.next=11;break;case 10:b(d.threeDSFailedMsg);case 11:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}())}))):i.error&&b(i.message)}catch(e){}return e.abrupt("return",!0);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),v=function(e){var t=e.nonce,r=e.order_id,n=e.step_id;return new Promise((function(e,o){var i;c.default.ajax({url:null==d?void 0:d.ajax_url,method:"POST",dataType:"json",data:{nonce:t,order_id:r,step_id:n,security:null==d||null===(i=d.security)||void 0===i?void 0:i.storeVaultedNonce}}).done((function(t){t.success&&e()})).fail((function(){o()}))}))},b=function(e){(0,c.default)("body").trigger("wcf-update-msg",[e,"wcf-payment-error"]),setTimeout((function(){(0,c.default)(document.body).trigger("wcf-hide-loader"),(0,c.default)(document.body).trigger("wcf-update-msg",[d.successMessage,"wcf-payment-success"])}),d.timeout)};window.addEventListener("hashchange",w),(0,c.default)(document.body).on("click",'a[href*="wcf-up-offer"], a[href*="wcf-down-offer"]',(function(e){f=(0,c.default)(e.currentTarget)}))}(),(window.wcBraintree=window.wcBraintree||{})["wc-braintree-cartflows"]={}}();
//# sourceMappingURL=wc-braintree-cartflows.js.map