!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).braintree=e()}(function(){return function r(i,o,a){function s(t,e){if(!o[t]){if(!i[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=o[t]={exports:{}},i[t][0].call(n.exports,function(e){return s(i[t][1][e]||e)},n,n.exports,r,i,o,a)}return o[t].exports}for(var c="function"==typeof require&&require,e=0;e<a.length;e++)s(a[e]);return s}({1:[function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.PromiseGlobal=void 0;e=r(e("promise-polyfill")),e="undefined"!=typeof Promise?Promise:e.default;n.PromiseGlobal=e},{"promise-polyfill":70}],2:[function(e,t,n){"use strict";var a=e("./lib/promise"),s={};function r(n){var e,t=JSON.stringify(n);if(!n.forceScriptReload&&(e=s[t]))return e;var r=document.createElement("script"),i=n.dataAttributes||{},o=n.container||document.head;return r.src=n.src,r.id=n.id||"",r.async=!0,n.crossorigin&&r.setAttribute("crossorigin",""+n.crossorigin),Object.keys(i).forEach(function(e){r.setAttribute("data-"+e,""+i[e])}),e=new a.PromiseGlobal(function(e,t){r.addEventListener("load",function(){e(r)}),r.addEventListener("error",function(){t(new Error(n.src+" failed to load."))}),r.addEventListener("abort",function(){t(new Error(n.src+" has aborted."))}),o.appendChild(r)}),s[t]=e}r.clearCache=function(){s={}},t.exports=r},{"./lib/promise":1}],3:[function(e,t,n){t.exports=e("./dist/load-script")},{"./dist/load-script":2}],4:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/Android/.test(e)}},{}],5:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/CrOS/i.test(e)}},{}],6:[function(e,t,n){"use strict";var r=e("./is-edge"),i=e("./is-samsung"),o=e("./is-duckduckgo"),a=e("./is-opera"),s=e("./is-silk");t.exports=function(e){return!(-1===(e=e||window.navigator.userAgent).indexOf("Chrome")&&-1===e.indexOf("CriOS")||r(e)||i(e)||o(e)||a(e)||s(e))}},{"./is-duckduckgo":7,"./is-edge":8,"./is-opera":20,"./is-samsung":21,"./is-silk":22}],7:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("DuckDuckGo/")}},{}],8:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("Edge/")}},{}],9:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/Firefox/i.test(e)}},{}],10:[function(e,t,n){"use strict";var r=e("./is-ie11");t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("MSIE")||r(e)}},{"./is-ie11":12}],11:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("MSIE 10")}},{}],12:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("Trident/7")}},{}],13:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("MSIE 9")}},{}],14:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/FxiOS/i.test(e)}},{}],15:[function(e,t,n){"use strict";var r=e("./is-ios");t.exports=function(e){return e=e||window.navigator.userAgent,r(e)&&/\bGSA\b/.test(e)}},{"./is-ios":19}],16:[function(e,t,n){"use strict";var r=e("./is-ios"),i=e("./is-ios-firefox"),o=/webkit/i;t.exports=function(e){return e=e||window.navigator.userAgent,r(e)&&(t=e,o.test(t))&&-1===e.indexOf("CriOS")&&!i(e);var t}},{"./is-ios":19,"./is-ios-firefox":14}],17:[function(e,t,n){"use strict";var r=e("./is-ios"),i=e("./is-ios-google-search-app");t.exports=function(e){return e=e||window.navigator.userAgent,!!r(e)&&(!!i(e)||/.+AppleWebKit(?!.*Safari)/.test(e))}},{"./is-ios":19,"./is-ios-google-search-app":15}],18:[function(e,t,n){"use strict";var r=e("./is-ios-webview");t.exports=function(e,t){return t=void 0!==t?t:window.statusbar.visible,r(e)&&t}},{"./is-ios-webview":17}],19:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/iPhone|iPod|iPad/i.test(e)}},{}],20:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("OPR/")||-1!==e.indexOf("Opera/")||-1!==e.indexOf("OPT/")}},{}],21:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/SamsungBrowser/i.test(e)}},{}],22:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("Silk/")}},{}],23:[function(e,t,n){"use strict";var r=e("./is-android"),i=e("./is-ios-firefox"),o=e("./is-ios-webview"),a=e("./is-chrome"),s=e("./is-samsung"),c=e("./is-duckduckgo");function d(e){return-1<(e=e||window.navigator.userAgent).indexOf("Opera Mini")}t.exports=function(e){return e=e||window.navigator.userAgent,!(o(e)||i(e)||(t=(t=e)||window.navigator.userAgent,r(t)&&(/Version\/[\d.]+/.test(t)&&!d(t)&&!c(t)))||d(e)||(t=(t=(t=e)||window.navigator.userAgent).match(/CriOS\/(\d+)\./))&&parseInt(t[1],10)<48||!a(e=e)&&!s(e)&&/samsung/i.test(e));var t}},{"./is-android":4,"./is-chrome":6,"./is-duckduckgo":7,"./is-ios-firefox":14,"./is-ios-webview":17,"./is-samsung":21}],24:[function(e,t,n){t.exports=e("./dist/is-android")},{"./dist/is-android":4}],25:[function(e,t,n){t.exports=e("./dist/is-chrome-os")},{"./dist/is-chrome-os":5}],26:[function(e,t,n){t.exports=e("./dist/is-chrome")},{"./dist/is-chrome":6}],27:[function(e,t,n){t.exports=e("./dist/is-edge")},{"./dist/is-edge":8}],28:[function(e,t,n){t.exports=e("./dist/is-firefox")},{"./dist/is-firefox":9}],29:[function(e,t,n){t.exports=e("./dist/is-ie")},{"./dist/is-ie":10}],30:[function(e,t,n){t.exports=e("./dist/is-ie10")},{"./dist/is-ie10":11}],31:[function(e,t,n){t.exports=e("./dist/is-ie9")},{"./dist/is-ie9":13}],32:[function(e,t,n){t.exports=e("./dist/is-ios-safari")},{"./dist/is-ios-safari":16}],33:[function(e,t,n){t.exports=e("./dist/is-ios-webview")},{"./dist/is-ios-webview":17}],34:[function(e,t,n){t.exports=e("./dist/is-ios-wkwebview")},{"./dist/is-ios-wkwebview":18}],35:[function(e,t,n){t.exports=e("./dist/is-ios")},{"./dist/is-ios":19}],36:[function(e,t,n){t.exports=e("./dist/supports-popups")},{"./dist/supports-popups":23}],37:[function(e,t,n){"use strict";function r(e){return e.className.trim().split(/\s+/)}function i(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e.className=r(e).filter(function(e){return-1===t.indexOf(e)}).concat(t).join(" ")}function o(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e.className=r(e).filter(function(e){return-1===t.indexOf(e)}).join(" ")}Object.defineProperty(n,"__esModule",{value:!0}),n.toggle=n.remove=n.add=void 0,n.add=i,n.remove=o,n.toggle=function(e,t,n){(n?i:o)(e,t)}},{}],38:[function(e,t,n){"use strict";var r=(i.prototype.on=function(e,t){this._events[e]?this._events[e].push(t):this._events[e]=[t]},i.prototype.off=function(e,t){e=this._events[e];e&&(t=e.indexOf(t),e.splice(t,1))},i.prototype._emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e=this._events[e];e&&e.forEach(function(e){e.apply(void 0,t)})},i.prototype.hasListener=function(e){e=this._events[e];return!!e&&0<e.length},i.createChild=function(e){e.prototype=Object.create(i.prototype,{constructor:e})},i);function i(){this._events={}}t.exports=r},{}],39:[function(e,t,n){"use strict";var r="undefined"!=typeof Promise?Promise:null,r=(i.defaultOnResolve=function(e){return i.Promise.resolve(e)},i.defaultOnReject=function(e){return i.Promise.reject(e)},i.setPromise=function(e){i.Promise=e},i.shouldCatchExceptions=function(e){return e.hasOwnProperty("suppressUnhandledPromiseMessage")?Boolean(e.suppressUnhandledPromiseMessage):Boolean(i.suppressUnhandledPromiseMessage)},i.all=function(e){return i.Promise.all(e)},i.allSettled=function(e){return i.Promise.allSettled(e)},i.race=function(e){return i.Promise.race(e)},i.reject=function(e){return i.Promise.reject(e)},i.resolve=function(e){return i.Promise.resolve(e)},i.prototype.then=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).then.apply(e,t)},i.prototype.catch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).catch.apply(e,t)},i.prototype.resolve=function(e){var t=this;return this.isFulfilled||(this._setResolved(),i.Promise.resolve().then(function(){return t._onResolve(e)}).then(function(e){t._resolveFunction(e)}).catch(function(e){t._resetState(),t.reject(e)})),this},i.prototype.reject=function(e){var t=this;return this.isFulfilled||(this._setRejected(),i.Promise.resolve().then(function(){return t._onReject(e)}).then(function(e){t._setResolved(),t._resolveFunction(e)}).catch(function(e){return t._rejectFunction(e)})),this},i.prototype._resetState=function(){this.isFulfilled=!1,this.isResolved=!1,this.isRejected=!1},i.prototype._setResolved=function(){this.isFulfilled=!0,this.isResolved=!0,this.isRejected=!1},i.prototype._setRejected=function(){this.isFulfilled=!0,this.isResolved=!1,this.isRejected=!0},i.Promise=r,i);function i(e){var n=this;"function"!=typeof e?(this._promise=new i.Promise(function(e,t){n._resolveFunction=e,n._rejectFunction=t}),this._onResolve=(e=e||{}).onResolve||i.defaultOnResolve,this._onReject=e.onReject||i.defaultOnReject,i.shouldCatchExceptions(e)&&this._promise.catch(function(){}),this._resetState()):this._promise=new i.Promise(e)}t.exports=r},{}],40:[function(e,t,n){"use strict";var r=e("./lib/set-attributes"),i=e("./lib/default-attributes"),o=e("./lib/assign");t.exports=function(e){void 0===e&&(e={});var t=document.createElement("iframe"),e=o.assign({},i.defaultAttributes,e);return e.style&&"string"!=typeof e.style&&(o.assign(t.style,e.style),delete e.style),r.setAttributes(t,e),t.getAttribute("id")||(t.id=t.name),t}},{"./lib/assign":41,"./lib/default-attributes":42,"./lib/set-attributes":43}],41:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.assign=void 0,n.assign=function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.forEach(function(t){"object"==typeof t&&Object.keys(t).forEach(function(e){n[e]=t[e]})}),n}},{}],42:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.defaultAttributes=void 0,n.defaultAttributes={src:"about:blank",frameBorder:0,allowtransparency:!0,scrolling:"no"}},{}],43:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.setAttributes=void 0,n.setAttributes=function(e,t){for(var n in t){var r;t.hasOwnProperty(n)&&(null==(r=t[n])?e.removeAttribute(n):e.setAttribute(n,r))}}},{}],44:[function(e,t,n){"use strict";t.exports=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},{}],45:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.deferred=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];setTimeout(function(){try{n.apply(void 0,e)}catch(e){console.log("Error in callback function"),console.log(e)}},1)}}},{}],46:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.once=function(n){var r=!1;return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r||(r=!0,n.apply(void 0,e))}}},{}],47:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.promiseOrCallback=function(e,t){if(!t)return e;e.then(function(e){return t(null,e)}).catch(function(e){return t(e)})}},{}],48:[function(e,t,n){"use strict";var i=e("./lib/deferred"),o=e("./lib/once"),a=e("./lib/promise-or-callback");function s(r){return function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return"function"==typeof t[t.length-1]&&(e=t.pop(),e=o.once(i.deferred(e))),a.promiseOrCallback(r.apply(this,t),e)}}s.wrapPrototype=function(r,e){var i=(e=void 0===e?{}:e).ignoreMethods||[],o=!0===e.transformPrivateMethods;return Object.getOwnPropertyNames(r.prototype).filter(function(e){var t="constructor"!==e&&"function"==typeof r.prototype[e],n=-1===i.indexOf(e),e=o||"_"!==e.charAt(0);return t&&e&&n}).forEach(function(e){var t=r.prototype[e];r.prototype[e]=s(t)}),r},t.exports=s},{"./lib/deferred":45,"./lib/once":46,"./lib/promise-or-callback":47}],49:[function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=e("./lib/card-types"),o=e("./lib/add-matching-cards-to-results"),a=e("./lib/is-valid-input-type"),s=e("./lib/find-best-match"),c=e("./lib/clone"),d={},e={VISA:"visa",MASTERCARD:"mastercard",AMERICAN_EXPRESS:"american-express",DINERS_CLUB:"diners-club",DISCOVER:"discover",JCB:"jcb",UNIONPAY:"unionpay",MAESTRO:"maestro",ELO:"elo",MIR:"mir",HIPER:"hiper",HIPERCARD:"hipercard"},u=[e.VISA,e.MASTERCARD,e.AMERICAN_EXPRESS,e.DINERS_CLUB,e.DISCOVER,e.JCB,e.UNIONPAY,e.MAESTRO,e.ELO,e.MIR,e.HIPER,e.HIPERCARD],l=c.clone(u);function p(e){return d[e]||i[e]}function _(e,t){void 0===t&&(t=!1);var n=l.indexOf(e);if(!t&&-1===n)throw new Error('"'+e+'" is not a supported card type.');return n}function E(t){var n=[];if(!a.isValidInputType(t))return n;if(0===t.length)return l.map(function(e){return c.clone(p(e))});l.forEach(function(e){e=p(e);o.addMatchingCardsToResults(t,e,n)});var e=s.findBestMatch(n);return e?[e]:n}E.getTypeInfo=function(e){return c.clone(p(e))},E.removeCard=function(e){e=_(e);l.splice(e,1)},E.addCard=function(e){var t=_(e.type,!0);d[e.type]=e,-1===t&&l.push(e.type)},E.updateCard=function(e,t){var n=d[e]||i[e];if(!n)throw new Error('"'+e+"\" is not a recognized type. Use `addCard` instead.'");if(t.type&&n.type!==t.type)throw new Error("Cannot overwrite type parameter.");n=c.clone(n),n=r(r({},n),t);d[n.type]=n},E.changeOrder=function(e,t){var n=_(e);l.splice(n,1),l.splice(t,0,e)},E.resetModifications=function(){l=c.clone(u),d={}},E.types=e,t.exports=E},{"./lib/add-matching-cards-to-results":50,"./lib/card-types":51,"./lib/clone":52,"./lib/find-best-match":53,"./lib/is-valid-input-type":54}],50:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.addMatchingCardsToResults=void 0;var a=e("./clone"),s=e("./matches");n.addMatchingCardsToResults=function(e,t,n){for(var r=0;r<t.patterns.length;r++){var i=t.patterns[r];if(s.matches(e,i)){var o=a.clone(t),i=(Array.isArray(i)?String(i[0]):String(i)).length;e.length>=i&&(o.matchStrength=i),n.push(o);break}}}},{"./clone":52,"./matches":55}],51:[function(e,t,n){"use strict";t.exports={visa:{niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},mastercard:{niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},"american-express":{niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},"diners-club":{niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},discover:{niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},jcb:{niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},unionpay:{niceType:"UnionPay",type:"unionpay",patterns:[620,[624,626],[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[622019,622999],[62207,62209],[622126,622925],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292,810,[8110,8131],[8132,8151],[8152,8163],[8164,8171]],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},maestro:{niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,504174],[504176,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},elo:{niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},mir:{niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},hiper:{niceType:"Hiper",type:"hiper",patterns:[637095,63737423,63743358,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},hipercard:{niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}}}},{}],52:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.clone=void 0,n.clone=function(e){return e?JSON.parse(JSON.stringify(e)):null}},{}],53:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.findBestMatch=void 0,n.findBestMatch=function(e){return 0<(n=(t=e).filter(function(e){return e.matchStrength}).length)&&n===t.length?e.reduce(function(e,t){return!e||Number(e.matchStrength)<Number(t.matchStrength)?t:e}):null;var t,n}},{}],54:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isValidInputType=void 0,n.isValidInputType=function(e){return"string"==typeof e||e instanceof String}},{}],55:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.matches=void 0,n.matches=function(e,t){return Array.isArray(t)?(n=e,r=t[0],i=t[1],o=String(r).length,n=n.substr(0,o),o=parseInt(n,10),r=parseInt(String(r).substr(0,n.length),10),i=parseInt(String(i).substr(0,n.length),10),r<=o&&o<=i):(e=e,t=t,(t=String(t)).substring(0,e.length)===e.substring(0,t.length));var n,r,i,o}},{}],56:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Framebus=void 0;var i=e("./lib/is-not-string"),s=e("./lib/subscription-args-invalid"),o=e("./lib/broadcast"),a=e("./lib/package-payload"),c=e("./lib/constants"),e="undefined"!=typeof window&&window.Promise,e=(d.setPromise=function(e){d.Promise=e},d.target=function(e){return new d(e)},d.prototype.include=function(e){return null!=e&&(null!=e.Window&&(e.constructor===e.Window&&(c.childWindows.push(e),!0)))},d.prototype.target=function(e){return d.target(e)},d.prototype.emit=function(e,t,n){if(this.isDestroyed)return!1;var r=this.origin;if(e=this.namespaceEvent(e),i.isntString(e))return!1;if(i.isntString(r))return!1;"function"==typeof t&&(n=t,t=void 0);n=a.packagePayload(e,r,t,n);return!!n&&(o.broadcast(window.top||window.self,n,r),!0)},d.prototype.emitAsPromise=function(n,r){var i=this;return new d.Promise(function(t,e){i.emit(n,r,function(e){t(e)})||e(new Error('Listener not added for "'+n+'"'))})},d.prototype.on=function(e,n){if(this.isDestroyed)return!1;var r=this,t=this.origin,i=n;return e=this.namespaceEvent(e),!s.subscriptionArgsInvalid(e,i,t)&&(this.verifyDomain&&(i=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.checkOrigin(this&&this.origin)&&n.apply(void 0,e)}),this.listeners.push({eventName:e,handler:i,originalHandler:n}),c.subscribers[t]=c.subscribers[t]||{},c.subscribers[t][e]=c.subscribers[t][e]||[],c.subscribers[t][e].push(i),!0)},d.prototype.off=function(e,t){var n=t;if(this.isDestroyed)return!1;if(this.verifyDomain)for(var r=0;r<this.listeners.length;r++){var i=this.listeners[r];i.originalHandler===t&&(n=i.handler)}e=this.namespaceEvent(e);var o=this.origin;if(s.subscriptionArgsInvalid(e,n,o))return!1;var a=c.subscribers[o]&&c.subscribers[o][e];if(!a)return!1;for(r=0;r<a.length;r++)if(a[r]===n)return a.splice(r,1),!0;return!1},d.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var e=0;e<this.listeners.length;e++){var t=this.listeners[e];this.off(t.eventName,t.handler)}this.listeners.length=0}},d.prototype.checkOrigin=function(e){var t=document.createElement("a");t.href=location.href;var n="https:"===t.protocol?t.host.replace(/:443$/,""):"http:"===t.protocol?t.host.replace(/:80$/,""):t.host;return t.protocol+"//"+n===e||(!this.verifyDomain||this.verifyDomain(e))},d.prototype.namespaceEvent=function(e){return this.channel?this.channel+":"+e:e},d.Promise=e,d);function d(e){this.origin=(e=void 0===e?{}:e).origin||"*",this.channel=e.channel||"",this.verifyDomain=e.verifyDomain,this.isDestroyed=!1,this.listeners=[]}n.Framebus=e},{"./lib/broadcast":60,"./lib/constants":61,"./lib/is-not-string":64,"./lib/package-payload":66,"./lib/subscription-args-invalid":68}],57:[function(e,t,n){"use strict";var r=e("./lib/attach"),e=e("./framebus");r.attach(),t.exports=e.Framebus},{"./framebus":56,"./lib/attach":58}],58:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.detach=n.attach=void 0;var r=e("./message"),i=!1;n.attach=function(){i||"undefined"==typeof window||(i=!0,window.addEventListener("message",r.onmessage,!1))},n.detach=function(){i=!1,window.removeEventListener("message",r.onmessage,!1)}},{"./message":65}],59:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.broadcastToChildWindows=void 0;var o=e("./broadcast"),a=e("./constants");n.broadcastToChildWindows=function(e,t,n){for(var r=a.childWindows.length-1;0<=r;r--){var i=a.childWindows[r];i.closed?a.childWindows.splice(r,1):n!==i&&o.broadcast(i.top,e,t)}}},{"./broadcast":60,"./constants":61}],60:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.broadcast=void 0;var a=e("./has-opener");n.broadcast=function e(t,n,r){var i,o=0;try{for(t.postMessage(n,r),a.hasOpener(t)&&t.opener.top!==window.top&&e(t.opener.top,n,r);i=t.frames[o];)e(i,n,r),o++}catch(e){}}},{"./has-opener":63}],61:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.subscribers=n.childWindows=n.prefix=void 0,n.prefix="/*framebus*/",n.childWindows=[],n.subscribers={}},{}],62:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.dispatch=void 0;var s=e("./constants");n.dispatch=function(e,t,n,r,i){if(s.subscribers[e]&&s.subscribers[e][t]){var o=[];n&&o.push(n),r&&o.push(r);for(var a=0;a<s.subscribers[e][t].length;a++)s.subscribers[e][t][a].apply(i,o)}}},{"./constants":61}],63:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.hasOpener=void 0,n.hasOpener=function(e){return e.top===e&&(null!=e.opener&&(e.opener!==e&&!0!==e.opener.closed))}},{}],64:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isntString=void 0,n.isntString=function(e){return"string"!=typeof e}},{}],65:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.onmessage=void 0;var i=e("./is-not-string"),o=e("./unpack-payload"),a=e("./dispatch"),s=e("./broadcast-to-child-windows");n.onmessage=function(e){var t,n,r;i.isntString(e.data)||(t=o.unpackPayload(e))&&(n=t.eventData,r=t.reply,a.dispatch("*",t.event,n,r,e),a.dispatch(e.origin,t.event,n,r,e),s.broadcastToChildWindows(e.data,t.origin,e.source))}},{"./broadcast-to-child-windows":59,"./dispatch":62,"./is-not-string":64,"./unpack-payload":69}],66:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.packagePayload=void 0;var o=e("./subscribe-replier"),a=e("./constants");n.packagePayload=function(e,t,n,r){var i,e={event:e,origin:t};"function"==typeof r&&(e.reply=o.subscribeReplier(r,t)),e.eventData=n;try{i=a.prefix+JSON.stringify(e)}catch(e){throw new Error("Could not stringify event: "+e.message)}return i}},{"./constants":61,"./subscribe-replier":67}],67:[function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.subscribeReplier=void 0;var a=e("../framebus"),s=r(e("@braintree/uuid"));n.subscribeReplier=function(r,i){var o=s.default();return a.Framebus.target({origin:i}).on(o,function e(t,n){r(t,n),a.Framebus.target({origin:i}).off(o,e)}),o}},{"../framebus":56,"@braintree/uuid":44}],68:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.subscriptionArgsInvalid=void 0;var r=e("./is-not-string");n.subscriptionArgsInvalid=function(e,t,n){return!!r.isntString(e)||("function"!=typeof t||r.isntString(n))}},{"./is-not-string":64}],69:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.unpackPayload=void 0;var o=e("./constants"),a=e("./package-payload");n.unpackPayload=function(e){var t,n,r,i;if(e.data.slice(0,o.prefix.length)!==o.prefix)return!1;try{t=JSON.parse(e.data.slice(o.prefix.length))}catch(e){return!1}return t.reply&&(n=e.origin,r=e.source,i=t.reply,t.reply=function(e){!r||(e=a.packagePayload(i,n,e))&&r.postMessage(e,n)}),t}},{"./constants":61,"./package-payload":66}],70:[function(e,t,n){"use strict";var r=setTimeout;function c(e){return Boolean(e&&void 0!==e.length)}function i(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],p(e,this)}function a(n,r){for(;3===n._state;)n=n._value;0!==n._state?(n._handled=!0,o._immediateFn(function(){var e,t=1===n._state?r.onFulfilled:r.onRejected;if(null!==t){try{e=t(n._value)}catch(e){return void d(r.promise,e)}s(r.promise,e)}else(1===n._state?s:d)(r.promise,n._value)})):n._deferreds.push(r)}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof o)return t._state=3,t._value=e,void u(t);if("function"==typeof n)return void p((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,u(t)}catch(e){d(t,e)}var r,i}function d(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)a(e,e._deferreds[t]);e._deferreds=null}function l(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function p(e,t){var n=!1;try{e(function(e){n||(n=!0,s(t,e))},function(e){n||(n=!0,d(t,e))})}catch(e){if(n)return;n=!0,d(t,e)}}o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var n=new this.constructor(i);return a(this,new l(e,t,n)),n},o.prototype.finally=function(t){var n=this.constructor;return this.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){return n.reject(e)})})},o.all=function(t){return new o(function(i,o){if(!c(t))return o(new TypeError("Promise.all accepts an array"));var a=Array.prototype.slice.call(t);if(0===a.length)return i([]);var s=a.length;for(var e=0;e<a.length;e++)!function t(n,e){try{if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if("function"==typeof r)return void r.call(e,function(e){t(n,e)},o)}a[n]=e,0==--s&&i(a)}catch(e){o(e)}}(e,a[e])})},o.allSettled=function(n){return new this(function(i,e){if(!n||void 0===n.length)return e(new TypeError(typeof n+" "+n+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var o=Array.prototype.slice.call(n);if(0===o.length)return i([]);var a=o.length;for(var t=0;t<o.length;t++)!function t(n,e){if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if("function"==typeof r)return void r.call(e,function(e){t(n,e)},function(e){o[n]={status:"rejected",reason:e},0==--a&&i(o)})}o[n]={status:"fulfilled",value:e},0==--a&&i(o)}(t,o[t])})},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o(function(e){e(t)})},o.reject=function(n){return new o(function(e,t){t(n)})},o.race=function(i){return new o(function(e,t){if(!c(i))return t(new TypeError("Promise.race accepts an array"));for(var n=0,r=i.length;n<r;n++)o.resolve(i[n]).then(e,t)})},o._immediateFn="function"==typeof setImmediate?function(e){setImmediate(e)}:function(e){r(e,0)},o._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},t.exports=o},{}],71:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isIos=n.isIE9=n.isSamsungBrowser=n.isAndroidChrome=n.isKitKatWebview=void 0;var r="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent,i=e("@braintree/browser-detection/is-android"),o=e("@braintree/browser-detection/is-chrome-os"),a=e("@braintree/browser-detection/is-chrome"),s=e("@braintree/browser-detection/is-ios");n.isIos=s;e=e("@braintree/browser-detection/is-ie9");n.isIE9=e;var c=/Version\/\d\.\d* Chrome\/\d*\.0\.0\.0/;n.isKitKatWebview=function(e){return i(e=void 0===e?r:e)&&c.test(e)},n.isAndroidChrome=function(e){return(i(e=void 0===e?r:e)||o(e))&&a(e)},n.isSamsungBrowser=function(e){return/SamsungBrowser/.test(e=void 0===e?r:e)||!a(e=e)&&-1<e.indexOf("Samsung")}},{"@braintree/browser-detection/is-android":24,"@braintree/browser-detection/is-chrome":26,"@braintree/browser-detection/is-chrome-os":25,"@braintree/browser-detection/is-ie9":31,"@braintree/browser-detection/is-ios":35}],72:[function(e,t,n){"use strict";var r=e("./lib/device");t.exports=function(){return!r.isSamsungBrowser()}},{"./lib/device":71}],73:[function(e,t,n){t.exports=e("./dist/supports-input-formatting")},{"./dist/supports-input-formatting":72}],74:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("./errors"),o=e("../lib/assign").assign,a=e("../lib/promise"),s=e("../lib/methods"),c=e("../lib/convert-methods-to-error"),e=e("@braintree/wrap-promise");function d(e){this._client=e.client}d.prototype.getRewardsBalance=function(e){var t=e.nonce;return t?(delete(e=o({_meta:{source:"american-express"},paymentMethodNonce:t},e)).nonce,this._client.request({method:"get",endpoint:"payment_methods/amex_rewards_balance",data:e}).catch(function(e){return a.reject(new r({type:i.AMEX_NETWORK_ERROR.type,code:i.AMEX_NETWORK_ERROR.code,message:"A network error occurred when getting the American Express rewards balance.",details:{originalError:e}}))})):a.reject(new r({type:i.AMEX_NONCE_REQUIRED.type,code:i.AMEX_NONCE_REQUIRED.code,message:"getRewardsBalance must be called with a nonce."}))},d.prototype.getExpressCheckoutProfile=function(e){return e.nonce?this._client.request({method:"get",endpoint:"payment_methods/amex_express_checkout_cards/"+e.nonce,data:{_meta:{source:"american-express"},paymentMethodNonce:e.nonce}}).catch(function(e){return a.reject(new r({type:i.AMEX_NETWORK_ERROR.type,code:i.AMEX_NETWORK_ERROR.code,message:"A network error occurred when getting the American Express Checkout nonce profile.",details:{originalError:e}}))}):a.reject(new r({type:i.AMEX_NONCE_REQUIRED.type,code:i.AMEX_NONCE_REQUIRED.code,message:"getExpressCheckoutProfile must be called with a nonce."}))},d.prototype.teardown=function(){return c(this,s(d.prototype)),a.resolve()},t.exports=e.wrapPrototype(d)},{"../lib/assign":127,"../lib/braintree-error":130,"../lib/convert-methods-to-error":133,"../lib/methods":161,"../lib/promise":163,"./errors":75,"@braintree/wrap-promise":48}],75:[function(e,t,n){"use strict";e=e("../lib/braintree-error");t.exports={AMEX_NONCE_REQUIRED:{type:e.types.MERCHANT,code:"AMEX_NONCE_REQUIRED"},AMEX_NETWORK_ERROR:{type:e.types.NETWORK,code:"AMEX_NETWORK_ERROR"}}},{"../lib/braintree-error":130}],76:[function(e,t,n){"use strict";var r=e("./american-express"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),e=e("@braintree/wrap-promise");t.exports={create:e(function(t){var e="American Express";return i.verify({name:e,client:t.client,authorization:t.authorization}).then(function(){return o.create({authorization:t.authorization,client:t.client,debug:t.debug,assetsUrl:a.create(t.authorization),name:e})}).then(function(e){return t.client=e,new r(t)})}),VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"./american-express":74,"@braintree/wrap-promise":48}],77:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("../lib/analytics"),o=e("./errors"),a=e("../lib/promise"),s=e("../lib/methods"),c=e("../lib/convert-methods-to-error"),e=e("@braintree/wrap-promise");function d(e){this._instantiatedWithClient=Boolean(!e.useDeferredClient),this._client=e.client,this._createPromise=e.createPromise,this._client&&this._setMerchantIdentifier()}d.prototype._waitForClient=function(){return this._client?a.resolve():this._createPromise.then(function(e){this._client=e,this._setMerchantIdentifier()}.bind(this))},d.prototype._setMerchantIdentifier=function(){var e=this._client.getConfiguration().gatewayConfiguration.applePayWeb;e&&Object.defineProperty(this,"merchantIdentifier",{value:e.merchantIdentifier,configurable:!1,writable:!1})},d.prototype.createPaymentRequest=function(e){return this._instantiatedWithClient?this._createPaymentRequestSynchronously(e):this._waitForClient().then(function(){return this._createPaymentRequestSynchronously(e)}.bind(this))},d.prototype._createPaymentRequestSynchronously=function(e){var t=this._client.getConfiguration().gatewayConfiguration.applePayWeb,t={countryCode:t.countryCode,currencyCode:t.currencyCode,merchantCapabilities:t.merchantCapabilities||["supports3DS"],supportedNetworks:t.supportedNetworks.map(function(e){return"mastercard"===e?"masterCard":e})};return Object.assign({},t,e)},d.prototype.performValidation=function(t){var n=this;return t&&t.validationURL?this._waitForClient().then(function(){var e={validationUrl:t.validationURL,domainName:t.domainName||window.location.hostname,merchantIdentifier:t.merchantIdentifier||n.merchantIdentifier};return null!=t.displayName&&(e.displayName=t.displayName),n._client.request({method:"post",endpoint:"apple_pay_web/sessions",data:{_meta:{source:"apple-pay"},applePayWebSession:e}})}).then(function(e){return i.sendEvent(n._client,"applepay.performValidation.succeeded"),a.resolve(e)}).catch(function(e){return i.sendEvent(n._client,"applepay.performValidation.failed"),"CLIENT_REQUEST_ERROR"===e.code?a.reject(new r({type:o.APPLE_PAY_MERCHANT_VALIDATION_FAILED.type,code:o.APPLE_PAY_MERCHANT_VALIDATION_FAILED.code,message:o.APPLE_PAY_MERCHANT_VALIDATION_FAILED.message,details:{originalError:e.details.originalError}})):a.reject(new r({type:o.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.type,code:o.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.code,message:o.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.message,details:{originalError:e}}))}):a.reject(new r(o.APPLE_PAY_VALIDATION_URL_REQUIRED))},d.prototype.tokenize=function(e){var t=this;return e.token?this._waitForClient().then(function(){return t._client.request({method:"post",endpoint:"payment_methods/apple_payment_tokens",data:{_meta:{source:"apple-pay"},applePaymentToken:Object.assign({},e.token,{paymentData:btoa(JSON.stringify(e.token.paymentData))})}})}).then(function(e){return i.sendEvent(t._client,"applepay.tokenize.succeeded"),a.resolve(e.applePayCards[0])}).catch(function(e){return i.sendEvent(t._client,"applepay.tokenize.failed"),a.reject(new r({type:o.APPLE_PAY_TOKENIZATION.type,code:o.APPLE_PAY_TOKENIZATION.code,message:o.APPLE_PAY_TOKENIZATION.message,details:{originalError:e}}))}):a.reject(new r(o.APPLE_PAY_PAYMENT_TOKEN_REQUIRED))},d.prototype.teardown=function(){return c(this,s(d.prototype)),a.resolve()},t.exports=e.wrapPrototype(d)},{"../lib/analytics":125,"../lib/braintree-error":130,"../lib/convert-methods-to-error":133,"../lib/methods":161,"../lib/promise":163,"./errors":78,"@braintree/wrap-promise":48}],78:[function(e,t,n){"use strict";e=e("../lib/braintree-error");t.exports={APPLE_PAY_NOT_ENABLED:{type:e.types.MERCHANT,code:"APPLE_PAY_NOT_ENABLED",message:"Apple Pay is not enabled for this merchant."},APPLE_PAY_VALIDATION_URL_REQUIRED:{type:e.types.MERCHANT,code:"APPLE_PAY_VALIDATION_URL_REQUIRED",message:"performValidation must be called with a validationURL."},APPLE_PAY_MERCHANT_VALIDATION_NETWORK:{type:e.types.NETWORK,code:"APPLE_PAY_MERCHANT_VALIDATION_NETWORK",message:"A network error occurred when validating the Apple Pay merchant."},APPLE_PAY_MERCHANT_VALIDATION_FAILED:{type:e.types.MERCHANT,code:"APPLE_PAY_MERCHANT_VALIDATION_FAILED",message:"Make sure you have registered your domain name in the Braintree Control Panel."},APPLE_PAY_PAYMENT_TOKEN_REQUIRED:{type:e.types.MERCHANT,code:"APPLE_PAY_PAYMENT_TOKEN_REQUIRED",message:"tokenize must be called with a payment token."},APPLE_PAY_TOKENIZATION:{type:e.types.NETWORK,code:"APPLE_PAY_TOKENIZATION",message:"A network error occurred when processing the Apple Pay payment."}}},{"../lib/braintree-error":130}],79:[function(e,t,n){"use strict";var i=e("./apple-pay"),o=e("../lib/analytics"),a=e("../lib/braintree-error"),s=e("../lib/basic-component-verification"),c=e("../lib/create-assets-url"),d=e("../lib/create-deferred-client"),u=e("../lib/promise"),l=e("./errors"),e=e("@braintree/wrap-promise");t.exports={create:e(function(n){var r="Apple Pay";return s.verify({name:r,client:n.client,authorization:n.authorization}).then(function(){var t,e=d.create({authorization:n.authorization,client:n.client,debug:n.debug,assetsUrl:c.create(n.authorization),name:r}).then(function(e){return e.getConfiguration().gatewayConfiguration.applePayWeb?(o.sendEvent(e,"applepay.initialized"),e):u.reject(new a(l.APPLE_PAY_NOT_ENABLED))});return n.createPromise=e,t=new i(n),n.useDeferredClient?t:e.then(function(e){return t._client=e,t})})}),VERSION:"3.81.0"}},{"../lib/analytics":125,"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"./apple-pay":77,"./errors":78,"@braintree/wrap-promise":48}],80:[function(e,t,n){"use strict";var r=e("@braintree/browser-detection/is-ie"),e=e("@braintree/browser-detection/is-ie9");t.exports={isIe:r,isIe9:e}},{"@braintree/browser-detection/is-ie":29,"@braintree/browser-detection/is-ie9":31}],81:[function(e,t,n){"use strict";var d=e("./constants").BRAINTREE_VERSION,r=e("./request/graphql"),i=e("./request"),o=e("../lib/is-verified-domain"),u=e("../lib/braintree-error"),l=e("../lib/convert-to-braintree-error"),a=e("./get-configuration").getConfiguration,s=e("../lib/create-authorization-data"),p=e("../lib/add-metadata"),_=e("../lib/promise"),c=e("@braintree/wrap-promise"),E=e("../lib/once"),h=e("../lib/deferred"),m=e("../lib/assign").assign,f=e("../lib/analytics"),y=e("./errors"),A=e("../lib/constants").VERSION,T=e("../lib/constants").GRAPHQL_URLS,N=e("../lib/methods"),I=e("../lib/convert-methods-to-error"),O=e("../lib/assets"),b=e("../lib/constants").FRAUDNET_FNCLS,g=e("../lib/constants").FRAUDNET_SOURCE,P=e("../lib/constants").FRAUDNET_URL,v={};function C(e){var t,n;if(e=e||{},t=JSON.stringify(e),!(n=e.gatewayConfiguration))throw new u(y.CLIENT_MISSING_GATEWAY_CONFIGURATION);["assetsUrl","clientApiUrl","configUrl"].forEach(function(e){if(e in n&&!o(n[e]))throw new u({type:y.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.type,code:y.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.code,message:e+" property is on an invalid domain."})}),this.getConfiguration=function(){return JSON.parse(t)},this._request=i,this._configuration=this.getConfiguration(),this._clientApiBaseUrl=n.clientApiUrl+"/v1/",n.graphQL&&(this._graphQL=new r({graphQL:n.graphQL}))}C.initialize=function(t){var n,e,r=v[t.authorization];if(r)return f.sendEvent(r,"custom.client.load.cached"),r;try{e=s(t.authorization)}catch(e){return _.reject(new u(y.CLIENT_INVALID_AUTHORIZATION))}return r=a(e).then(function(e){return t.debug&&(e.isDebug=!0),e.authorization=t.authorization,n=new C(e)}),v[t.authorization]=r,f.sendEvent(r,"custom.client.load.initialized"),r.then(function(e){return f.sendEvent(n,"custom.client.load.succeeded"),e}).catch(function(e){return delete v[t.authorization],_.reject(e)})},C.clearCache=function(){v={}},C.prototype._findOrCreateFraudnetJSON=function(e){var t,n,r=document.querySelector('script[fncls="'+b+'"]');r||((r=document.body.appendChild(document.createElement("script"))).type="application/json",r.setAttribute("fncls",b)),n=this.getConfiguration(),t={rda_tenant:"bt_card",mid:n.gatewayConfiguration.merchantId},(n=n.authorizationFingerprint)&&n.split("&").forEach(function(e){e=e.split("=");"customer_id"===e[0]&&1<e.length&&(t.cid=e[1])}),e={f:e.substr(0,32),fp:t,bu:!1,s:g},r.text=JSON.stringify(e)},C.prototype.request=function(s,n){var c=this,e=new _(function(r,i){var o,e,t,n,a=Boolean("payment_methods/credit_cards"===s.endpoint&&c.getConfiguration().gatewayConfiguration.creditCards.collectDeviceData);if("graphQLApi"!==s.api&&(s.method?s.endpoint||(n="options.endpoint"):n="options.method"),n)throw new u({type:y.CLIENT_OPTION_REQUIRED.type,code:y.CLIENT_OPTION_REQUIRED.code,message:n+" is required when making a request."});if(o="api"in s?s.api:"clientApi",t={method:s.method,graphQL:c._graphQL,timeout:s.timeout,metadata:c._configuration.analyticsMetadata},"clientApi"===o)e=c._clientApiBaseUrl,t.data=p(c._configuration,s.data);else{if("graphQLApi"!==o)throw new u({type:y.CLIENT_OPTION_INVALID.type,code:y.CLIENT_OPTION_INVALID.code,message:"options.api is invalid."});e=T[c._configuration.gatewayConfiguration.environment],s.endpoint="",t.method="post",t.data=m({clientSdkMetadata:{platform:c._configuration.analyticsMetadata.platform,source:c._configuration.analyticsMetadata.source,integration:c._configuration.analyticsMetadata.integration,sessionId:c._configuration.analyticsMetadata.sessionId,version:A}},s.data),t.headers={Authorization:"Bearer "+((n=c._configuration).authorizationFingerprint||n.authorization),"Braintree-Version":d}}t.url=e+s.endpoint,t.sendAnalyticsEvent=function(e){f.sendEvent(c,e)},c._request(t,function(e,t,n){e=function(e,t){var n;-1===e?n=new u(y.CLIENT_REQUEST_TIMEOUT):401===e?n=new u(y.CLIENT_AUTHORIZATION_INVALID):403===e?n=new u(y.CLIENT_AUTHORIZATION_INSUFFICIENT):429===e?n=new u(y.CLIENT_RATE_LIMITED):500<=e?n=new u(y.CLIENT_GATEWAY_NETWORK):(e<200||400<=e)&&(n=l(t,{type:y.CLIENT_REQUEST_ERROR.type,code:y.CLIENT_REQUEST_ERROR.code,message:y.CLIENT_REQUEST_ERROR.message}));if(n)return n.details=n.details||{},n.details.httpStatus=e,n}(n,e);e?i(e):"graphQLApi"===o&&t.errors?i(l(t.errors,{type:y.CLIENT_GRAPHQL_REQUEST_ERROR.type,code:y.CLIENT_GRAPHQL_REQUEST_ERROR.code,message:y.CLIENT_GRAPHQL_REQUEST_ERROR.message})):(t=m({_httpStatus:n},t),a&&t.creditCards&&0<t.creditCards.length&&(c._findOrCreateFraudnetJSON(t.creditCards[0].nonce),O.loadScript({src:P,forceScriptReload:!0})),r(t))})});return"function"==typeof n?(n=E(h(n)),void e.then(function(e){n(null,e,e._httpStatus)}).catch(function(e){var t=e&&e.details&&e.details.httpStatus;n(e,null,t)})):e},C.prototype.toJSON=function(){return this.getConfiguration()},C.prototype.getVersion=function(){return A},C.prototype.teardown=c(function(){return delete v[this.getConfiguration().authorization],I(this,N(C.prototype)),_.resolve()}),t.exports=C},{"../lib/add-metadata":124,"../lib/analytics":125,"../lib/assets":126,"../lib/assign":127,"../lib/braintree-error":130,"../lib/constants":132,"../lib/convert-methods-to-error":133,"../lib/convert-to-braintree-error":134,"../lib/create-authorization-data":136,"../lib/deferred":138,"../lib/is-verified-domain":159,"../lib/methods":161,"../lib/once":162,"../lib/promise":163,"./constants":82,"./errors":83,"./get-configuration":84,"./request":96,"./request/graphql":94,"@braintree/wrap-promise":48}],82:[function(e,t,n){"use strict";t.exports={BRAINTREE_VERSION:"2018-05-10"}},{}],83:[function(e,t,n){"use strict";e=e("../lib/braintree-error");t.exports={CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN:{type:e.types.MERCHANT,code:"CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN"},CLIENT_OPTION_REQUIRED:{type:e.types.MERCHANT,code:"CLIENT_OPTION_REQUIRED"},CLIENT_OPTION_INVALID:{type:e.types.MERCHANT,code:"CLIENT_OPTION_INVALID"},CLIENT_MISSING_GATEWAY_CONFIGURATION:{type:e.types.INTERNAL,code:"CLIENT_MISSING_GATEWAY_CONFIGURATION",message:"Missing gatewayConfiguration."},CLIENT_INVALID_AUTHORIZATION:{type:e.types.MERCHANT,code:"CLIENT_INVALID_AUTHORIZATION",message:"Authorization is invalid. Make sure your client token or tokenization key is valid."},CLIENT_GATEWAY_NETWORK:{type:e.types.NETWORK,code:"CLIENT_GATEWAY_NETWORK",message:"Cannot contact the gateway at this time."},CLIENT_REQUEST_TIMEOUT:{type:e.types.NETWORK,code:"CLIENT_REQUEST_TIMEOUT",message:"Request timed out waiting for a reply."},CLIENT_REQUEST_ERROR:{type:e.types.NETWORK,code:"CLIENT_REQUEST_ERROR",message:"There was a problem with your request."},CLIENT_GRAPHQL_REQUEST_ERROR:{type:e.types.NETWORK,code:"CLIENT_GRAPHQL_REQUEST_ERROR",message:"There was a problem with your request."},CLIENT_RATE_LIMITED:{type:e.types.MERCHANT,code:"CLIENT_RATE_LIMITED",message:"You are being rate-limited; please try again in a few minutes."},CLIENT_AUTHORIZATION_INSUFFICIENT:{type:e.types.MERCHANT,code:"CLIENT_AUTHORIZATION_INSUFFICIENT",message:"The authorization used has insufficient privileges."},CLIENT_AUTHORIZATION_INVALID:{type:e.types.MERCHANT,code:"CLIENT_AUTHORIZATION_INVALID",message:"Either the client token has expired and a new one should be generated or the tokenization key has been deactivated or deleted."}}},{"../lib/braintree-error":130}],84:[function(e,t,n){"use strict";var c=e("../lib/braintree-error"),r=e("../lib/promise"),i=e("@braintree/wrap-promise"),d=e("./request"),u=e("@braintree/uuid"),l=e("../lib/constants"),p=e("./errors"),_=e("./request/graphql"),E=e("../lib/constants").GRAPHQL_URLS,h=e("../lib/is-date-string-before-or-on"),m=e("./constants").BRAINTREE_VERSION;t.exports={getConfiguration:i(function(t){return new r(function(r,i){var o,e=u(),a={merchantAppId:window.location.host,platform:l.PLATFORM,sdkVersion:l.VERSION,source:l.SOURCE,integration:l.INTEGRATION,integrationType:l.INTEGRATION,sessionId:e},s=t.attrs,e=t.configUrl;s._meta=a,s.braintreeLibraryVersion=l.BRAINTREE_LIBRARY_VERSION,s.configVersion="3",e={url:e,method:"GET",data:s},s.authorizationFingerprint&&t.graphQL?(h(t.graphQL.date,m)&&(e.graphQL=new _({graphQL:{url:t.graphQL.url,features:["configuration"]}})),e.metadata=a):s.tokenizationKey&&(e.graphQL=new _({graphQL:{url:E[t.environment],features:["configuration"]}}),e.metadata=a),d(e,function(e,t,n){return e?(n=403===n?p.CLIENT_AUTHORIZATION_INSUFFICIENT:401===n?p.CLIENT_AUTHORIZATION_INVALID:p.CLIENT_GATEWAY_NETWORK,void i(new c({type:n.type,code:n.code,message:n.message,details:{originalError:e}}))):(o={authorizationType:s.tokenizationKey?"TOKENIZATION_KEY":"CLIENT_TOKEN",authorizationFingerprint:s.authorizationFingerprint,analyticsMetadata:a,gatewayConfiguration:t},void r(o))})})})}},{"../lib/braintree-error":130,"../lib/constants":132,"../lib/is-date-string-before-or-on":157,"../lib/promise":163,"./constants":82,"./errors":83,"./request":96,"./request/graphql":94,"@braintree/uuid":44,"@braintree/wrap-promise":48}],85:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("./client"),o=e("../lib/promise"),a=e("@braintree/wrap-promise"),s=e("../lib/errors");t.exports={create:a(function(e){return e.authorization?i.initialize(e):o.reject(new r({type:s.INSTANTIATION_OPTION_REQUIRED.type,code:s.INSTANTIATION_OPTION_REQUIRED.code,message:"options.authorization is required when instantiating a client."}))}),VERSION:"3.81.0"}},{"../lib/braintree-error":130,"../lib/errors":141,"../lib/promise":163,"./client":81,"@braintree/wrap-promise":48}],86:[function(e,t,n){"use strict";var h=e("../../lib/querystring"),m=e("../../lib/assign").assign,f=e("./prep-body"),y=e("./parse-body"),A=e("./xhr"),T=A.isAvailable,N=e("./graphql/request"),I=e("./default-request"),O=1,b=408;function g(t,n,r){var i,o,a,e,s,c,d=t.url,u=t.graphQL,l=t.timeout,p=A.getRequestObject(),_=r,E=Boolean(u&&u.isGraphQLRequest(d,t.data));t.headers=m({"Content-Type":"application/json"},t.headers),d=(a=new(E?N:I)(t)).getUrl(),e=a.getBody(),u=a.getMethod(),s=a.getHeaders(),"GET"===u&&(d=h.queryify(d,e),e=null),T?p.onreadystatechange=function(){if(4===p.readyState){if(0===p.status&&E)return delete t.graphQL,void g(t,n,r);if(c=y(p.responseText),o=a.adaptResponseBody(c),400<=(i=a.determineStatus(p.status,c))||i<200){if(E&&("UNKNOWN"===(e=!(e=c).data&&e.errors&&e.errors[0]&&e.errors[0].extensions&&e.errors[0].extensions.errorClass)||"INTERNAL"===e))return delete t.graphQL,void g(t,n,r);n<O&&(!(e=i)||e===b)?g(t,++n,r):_(o||"error",null,i||500)}else _(null,o,i);var e}}:(t.headers&&(d=h.queryify(d,s)),p.onload=function(){_(null,y(p.responseText),p.status)},p.onerror=function(){_("error",null,500)},p.onprogress=function(){},p.ontimeout=function(){_("timeout",null,-1)});try{p.open(u,d,!0)}catch(e){if(!E)throw e;return delete t.graphQL,void g(t,n,r)}p.timeout=l,T&&Object.keys(s).forEach(function(e){p.setRequestHeader(e,s[e])});try{p.send(f(u,e))}catch(e){}}t.exports={request:function(e,t){g(e,0,t)}}},{"../../lib/assign":127,"../../lib/querystring":164,"./default-request":87,"./graphql/request":95,"./parse-body":99,"./prep-body":100,"./xhr":101}],87:[function(e,t,n){"use strict";function r(e){this._url=e.url,this._data=e.data,this._method=e.method,this._headers=e.headers}r.prototype.getUrl=function(){return this._url},r.prototype.getBody=function(){return this._data},r.prototype.getMethod=function(){return this._method},r.prototype.getHeaders=function(){return this._headers},r.prototype.adaptResponseBody=function(e){return e},r.prototype.determineStatus=function(e){return e},t.exports=r},{}],88:[function(e,t,n){"use strict";t.exports=function(){return window.navigator.userAgent}},{}],89:[function(e,t,n){"use strict";var r=e("./error"),i=e("../../../../lib/assign").assign,o={creditCard:{AMERICAN_EXPRESS:"American Express",DISCOVER:"Discover",INTERNATIONAL_MAESTRO:"Maestro",JCB:"JCB",MASTERCARD:"MasterCard",SOLO:"Solo",UK_MAESTRO:"UK Maestro",UNION_PAY:"UnionPay",VISA:"Visa"},applePayWeb:{VISA:"visa",MASTERCARD:"mastercard",DISCOVER:"discover",AMERICAN_EXPRESS:"amex",INTERNATIONAL_MAESTRO:"maestro",ELO:"elo"},visaCheckout:{VISA:"Visa",MASTERCARD:"MasterCard",DISCOVER:"Discover",AMERICAN_EXPRESS:"American Express"},googlePay:{VISA:"visa",MASTERCARD:"mastercard",DISCOVER:"discover",AMERICAN_EXPRESS:"amex",INTERNATIONAL_MAESTRO:"maestro",ELO:"elo"},masterpass:{VISA:"visa",MASTERCARD:"master",DISCOVER:"discover",AMERICAN_EXPRESS:"amex",DINERS:"diners",INTERNATIONAL_MAESTRO:"maestro",JCB:"jcb"}};function a(e,n){return e.reduce(function(e,t){return n.hasOwnProperty(t)?e.concat(n[t]):e},[])}t.exports=function(e,t){return e=e.data&&!e.errors?function(e,t){var n=e.data.clientConfiguration;e={environment:n.environment.toLowerCase(),clientApiUrl:n.clientApiUrl,assetsUrl:n.assetsUrl,analytics:{url:n.analyticsUrl},merchantId:n.merchantId,venmo:"off"},n.supportedFeatures&&(e.graphQL={url:t._graphQL._config.url,features:n.supportedFeatures.map(function(e){return e.toLowerCase()})});n.braintreeApi&&(e.braintreeApi=n.braintreeApi);n.applePayWeb&&(e.applePayWeb=n.applePayWeb,e.applePayWeb.supportedNetworks=a(n.applePayWeb.supportedCardBrands,o.applePayWeb),delete e.applePayWeb.supportedCardBrands);n.ideal&&(e.ideal=n.ideal);n.kount&&(e.kount={kountMerchantId:n.kount.merchantId});n.creditCard?(e.challenges=n.creditCard.challenges.map(function(e){return e.toLowerCase()}),e.creditCards={supportedCardTypes:a(n.creditCard.supportedCardBrands,o.creditCard)},e.threeDSecureEnabled=n.creditCard.threeDSecureEnabled,e.threeDSecure=n.creditCard.threeDSecure):(e.challenges=[],e.creditCards={supportedCardTypes:[]},e.threeDSecureEnabled=!1);n.googlePay&&(e.androidPay={displayName:n.googlePay.displayName,enabled:!0,environment:n.googlePay.environment.toLowerCase(),googleAuthorizationFingerprint:n.googlePay.googleAuthorization,paypalClientId:n.googlePay.paypalClientId,supportedNetworks:a(n.googlePay.supportedCardBrands,o.googlePay)});n.venmo&&(e.payWithVenmo={merchantId:n.venmo.merchantId,accessToken:n.venmo.accessToken,environment:n.venmo.environment.toLowerCase()});n.paypal?(e.paypalEnabled=!0,e.paypal=i({},n.paypal),e.paypal.currencyIsoCode=e.paypal.currencyCode,e.paypal.environment=e.paypal.environment.toLowerCase(),delete e.paypal.currencyCode):e.paypalEnabled=!1;n.unionPay&&(e.unionPay={enabled:!0,merchantAccountId:n.unionPay.merchantAccountId});n.visaCheckout&&(e.visaCheckout={apikey:n.visaCheckout.apiKey,encryptionKey:n.visaCheckout.encryptionKey,externalClientId:n.visaCheckout.externalClientId,supportedCardTypes:a(n.visaCheckout.supportedCardBrands,o.visaCheckout)});n.masterpass&&(e.masterpass={merchantCheckoutId:n.masterpass.merchantCheckoutId,supportedNetworks:a(n.masterpass.supportedCardBrands,o.masterpass)});n.usBankAccount&&(e.usBankAccount={routeId:n.usBankAccount.routeId,plaid:{publicKey:n.usBankAccount.plaidPublicKey}});return e}(e,t):r(e)}},{"../../../../lib/assign":127,"./error":91}],90:[function(e,t,n){"use strict";var r=e("./error"),i={AMERICAN_EXPRESS:"American Express",DINERS:"Discover",DISCOVER:"Discover",INTERNATIONAL_MAESTRO:"Maestro",JCB:"JCB",MASTERCARD:"MasterCard",UK_MAESTRO:"Maestro",UNION_PAY:"Union Pay",VISA:"Visa"},o={YES:"Yes",NO:"No",UNKNOWN:"Unknown"},a={PSDTWO:"psd2"};t.exports=function(e){return e=(e.data&&!e.errors?function(e){var t=e.data.tokenizeCreditCard,n=t.creditCard,e=n.last4?n.last4.substr(2,4):"",r=n.binData;r&&(["commercial","debit","durbinRegulated","healthcare","payroll","prepaid"].forEach(function(e){r[e]?r[e]=o[r[e]]:r[e]="Unknown"}),["issuingBank","countryOfIssuance","productId"].forEach(function(e){r[e]||(r[e]="Unknown")}));e={creditCards:[{binData:r,consumed:!1,description:e?"ending in "+e:"",nonce:t.token,details:{cardholderName:n.cardholderName,expirationMonth:n.expirationMonth,expirationYear:n.expirationYear,bin:n.bin||"",cardType:i[n.brandCode]||"Unknown",lastFour:n.last4||"",lastTwo:e},type:"CreditCard",threeDSecureInfo:null}]},t.authenticationInsight&&(t=t.authenticationInsight.customerAuthenticationRegulationEnvironment,e.creditCards[0].authenticationInsight={regulationEnvironment:a[t]||t.toLowerCase()});return e}:r)(e)}},{"./error":91}],91:[function(e,t,n){"use strict";t.exports=function(e){var t,n,r=e.errors&&e.errors[0]&&e.errors[0].extensions&&e.errors[0].extensions.errorClass;return e="VALIDATION"===r?0!==(n=function(e){var t=[];return e.forEach(function(e){e.extensions&&e.extensions.inputPath&&!function e(t,n,r){var i;var o=n.extensions.legacyCode;var a=t[0];if(1===t.length)return void r.push({code:o,field:a,message:n.message});r.forEach(function(e){e.field===a&&(i=e)});i||(i={field:a,fieldErrors:[]},r.push(i));e(t.slice(1),n,i.fieldErrors)}(e.extensions.inputPath.slice(1),e,t)}),t}((t=e).errors)).length?{error:{message:function(e){e=e[0].field;return{creditCard:"Credit card is invalid"}[e]}(n)},fieldErrors:n}:{error:{message:t.errors[0].message}}:r?{error:{message:e.errors[0].message},fieldErrors:[]}:{error:{message:"There was a problem serving your request"},fieldErrors:[]}}},{}],92:[function(e,t,n){"use strict";t.exports=function(){return{query:"query ClientConfiguration {   clientConfiguration {     analyticsUrl     environment     merchantId     assetsUrl     clientApiUrl     creditCard {       supportedCardBrands       challenges       threeDSecureEnabled       threeDSecure {         cardinalAuthenticationJWT       }     }     applePayWeb {       countryCode       currencyCode       merchantIdentifier       supportedCardBrands     }     googlePay {       displayName       supportedCardBrands       environment       googleAuthorization       paypalClientId     }     ideal {       routeId       assetsUrl     }     kount {       merchantId     }     masterpass {       merchantCheckoutId       supportedCardBrands     }     paypal {       displayName       clientId       privacyUrl       userAgreementUrl       assetsUrl       environment       environmentNoNetwork       unvettedMerchant       braintreeClientId       billingAgreementsEnabled       merchantAccountId       currencyCode       payeeEmail     }     unionPay {       merchantAccountId     }     usBankAccount {       routeId       plaidPublicKey     }     venmo {       merchantId       accessToken       environment     }     visaCheckout {       apiKey       externalClientId       supportedCardBrands     }     braintreeApi {       accessToken       url     }     supportedFeatures   } }",operationName:"ClientConfiguration"}}},{}],93:[function(e,t,n){"use strict";var a=e("../../../../lib/assign").assign;function i(e,t){var n=e.creditCard,r=n&&n.billingAddress,i=n&&n.expirationDate,o=n&&(n.expirationMonth||i&&i.split("/")[0].trim()),i=n&&(n.expirationYear||i&&i.split("/")[1].trim()),n={input:{creditCard:{number:n&&n.number,expirationMonth:o,expirationYear:i,cvv:n&&n.cvv,cardholderName:n&&n.cardholderName},options:{}}};return t.hasAuthenticationInsight&&(n.authenticationInsightInput={merchantAccountId:e.merchantAccountId}),r&&(n.input.creditCard.billingAddress=r),n.input=function(e,t){var n;e.creditCard&&e.creditCard.options&&"boolean"==typeof e.creditCard.options.validate?n=e.creditCard.options.validate:e.authorizationFingerprint&&e.tokenizationKey||e.authorizationFingerprint?n=!0:e.tokenizationKey&&(n=!1);"boolean"==typeof n&&(t.options=a({validate:n},t.options));return t}(e,n.input),n}t.exports=function(e){var t,n,r={hasAuthenticationInsight:Boolean(e.authenticationInsight&&e.merchantAccountId)};return{query:(n=(t=r).hasAuthenticationInsight,t="mutation TokenizeCreditCard($input: TokenizeCreditCardInput!",n&&(t+=", $authenticationInsightInput: AuthenticationInsightInput!"),t+=") {   tokenizeCreditCard(input: $input) {     token     creditCard {       bin       brandCode       last4       cardholderName       expirationMonth      expirationYear      binData {         prepaid         healthcare         debit         durbinRegulated         commercial         payroll         issuingBank         countryOfIssuance         productId       }     } ",n&&(t+="    authenticationInsight(input: $authenticationInsightInput) {      customerAuthenticationRegulationEnvironment    }"),t+="  } }"),variables:i(e,r),operationName:"TokenizeCreditCard"}}},{"../../../../lib/assign":127}],94:[function(e,t,n){"use strict";var i=e("../../browser-detection"),o={tokenize_credit_cards:"payment_methods/credit_cards",configuration:"configuration"},a=["creditCard.options.unionPayEnrollment"];function r(e){this._config=e.graphQL}r.prototype.getGraphQLEndpoint=function(){return this._config.url},r.prototype.isGraphQLRequest=function(e,t){var n,r=this.getClientApiPath(e);return!(!this._isGraphQLEnabled()||!r||i.isIe9())&&(e=this._config.features.some(function(e){return o[e]===r}),n=t,!a.some(function(e){return void 0!==e.split(".").reduce(function(e,t){return e&&e[t]},n)})&&e)},r.prototype.getClientApiPath=function(e){var t,e=e.split("/client_api/v1/");return t=1<e.length?e[1].split("?")[0]:t},r.prototype._isGraphQLEnabled=function(){return Boolean(this._config)},t.exports=r},{"../../browser-detection":80}],95:[function(e,t,n){"use strict";var r=e("../../constants").BRAINTREE_VERSION,i=e("../../../lib/assign").assign,o=e("./generators/credit-card-tokenization"),a=e("./adapters/credit-card-tokenization"),s=e("./generators/configuration"),e=e("./adapters/configuration"),c={"payment_methods/credit_cards":o,configuration:s},d={"payment_methods/credit_cards":a,configuration:e};function u(e){var t=e.graphQL.getClientApiPath(e.url);this._graphQL=e.graphQL,this._data=e.data,this._method=e.method,this._headers=e.headers,this._clientSdkMetadata={source:e.metadata.source,integration:e.metadata.integration,sessionId:e.metadata.sessionId},this._sendAnalyticsEvent=e.sendAnalyticsEvent||Function.prototype,this._generator=c[t],this._adapter=d[t],this._sendAnalyticsEvent("graphql.init")}function l(e){return-1===e.indexOf("_")?e:e.toLowerCase().replace(/(\_\w)/g,function(e){return e[1].toUpperCase()})}u.prototype.getUrl=function(){return this._graphQL.getGraphQLEndpoint()},u.prototype.getBody=function(){var e=function n(r){var i={};Object.keys(r).forEach(function(e){var t=l(e);"object"==typeof r[e]?i[t]=n(r[e]):"number"==typeof r[e]?i[t]=String(r[e]):i[t]=r[e]});return i}(this._data),e=this._generator(e),e=i({clientSdkMetadata:this._clientSdkMetadata},e);return JSON.stringify(e)},u.prototype.getMethod=function(){return"POST"},u.prototype.getHeaders=function(){var e=this._data.authorizationFingerprint?(this._sendAnalyticsEvent("graphql.authorization-fingerprint"),this._data.authorizationFingerprint):(this._sendAnalyticsEvent("graphql.tokenization-key"),this._data.tokenizationKey);return i({},this._headers,{Authorization:"Bearer "+e,"Braintree-Version":r})},u.prototype.adaptResponseBody=function(e){return this._adapter(e,this)},u.prototype.determineStatus=function(e,t){var n,r=200===e?(n=t.errors&&t.errors[0]&&t.errors[0].extensions&&t.errors[0].extensions.errorClass,t.data&&!t.errors?200:"VALIDATION"===n?422:"AUTHORIZATION"===n?403:"AUTHENTICATION"===n?401:(r=t,!n&&r.errors[0].message?403:500)):e||500;return this._sendAnalyticsEvent("graphql.status."+e),this._sendAnalyticsEvent("graphql.determinedStatus."+r),r},t.exports=u},{"../../../lib/assign":127,"../../constants":82,"./adapters/configuration":89,"./adapters/credit-card-tokenization":90,"./generators/configuration":92,"./generators/credit-card-tokenization":93}],96:[function(e,t,n){"use strict";var r,i=e("../../lib/once"),o=e("./jsonp-driver"),a=e("./ajax-driver"),s=e("./get-user-agent"),c=e("./is-http");t.exports=function(e,t){t=i(t||Function.prototype),e.method=(e.method||"GET").toUpperCase(),e.timeout=null==e.timeout?6e4:e.timeout,e.data=e.data||{},((r=null==r?!(c()&&/MSIE\s(8|9)/.test(s())):r)?a:o).request(e,t)}},{"../../lib/once":162,"./ajax-driver":86,"./get-user-agent":88,"./is-http":97,"./jsonp-driver":98}],97:[function(e,t,n){"use strict";t.exports=function(){return"http:"===window.location.protocol}},{}],98:[function(e,t,n){"use strict";var u,l=e("@braintree/uuid"),p=e("../../lib/querystring"),_={};function E(t){try{delete window[t]}catch(e){window[t]=null}}function h(i,o,a){window[a]=function(e){var t=e.status||500,n=null,r=null;delete e.status,400<=t||t<200?n=e:r=e,E(a),(e=i)&&e.parentNode&&e.parentNode.removeChild(e),clearTimeout(_[a]),o(n,r,t)}}t.exports={request:function(e,t){var n,r,i,o,a="callback_json_"+l().replace(/-/g,""),s=e.url,c=e.data,d=e.method,e=e.timeout,s=p.queryify(s,c);s=s=p.queryify(s,{_method:d,callback:a}),n=a,r=document.createElement("script"),i=!1,r.src=s,r.async=!0,r.onerror=function(){window[n]({message:"error",status:500})},r.onload=r.onreadystatechange=function(){i||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(i=!0,r.onload=r.onreadystatechange=null)},h(s=r,t,a),_[o=a]=setTimeout(function(){_[o]=null,window[o]({error:"timeout",status:-1}),window[o]=function(){E(o)}},e),(u=u||document.getElementsByTagName("head")[0]).appendChild(s)}}},{"../../lib/querystring":164,"@braintree/uuid":44}],99:[function(e,t,n){"use strict";t.exports=function(e){try{e=JSON.parse(e)}catch(e){}return e}},{}],100:[function(e,t,n){"use strict";t.exports=function(e,t){if("string"!=typeof e)throw new Error("Method must be a string");return t="get"!==e.toLowerCase()&&null!=t?"string"==typeof t?t:JSON.stringify(t):t}},{}],101:[function(e,t,n){"use strict";var r="undefined"!=typeof window&&window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest;t.exports={isAvailable:r,getRequestObject:function(){return new(r?window.XMLHttpRequest:window.XDomainRequest)}}},{}],102:[function(e,t,n){"use strict";e=e("../lib/braintree-error");t.exports={DATA_COLLECTOR_KOUNT_NOT_ENABLED:{type:e.types.MERCHANT,code:"DATA_COLLECTOR_KOUNT_NOT_ENABLED",message:"Kount is not enabled for this merchant."},DATA_COLLECTOR_KOUNT_ERROR:{type:e.types.MERCHANT,code:"DATA_COLLECTOR_KOUNT_ERROR"},DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS:{type:e.types.MERCHANT,code:"DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS",message:"Data Collector must be created with Kount and/or PayPal."}}},{"../lib/braintree-error":130}],103:[function(e,t,n){"use strict";var i,o=e("../lib/constants").FRAUDNET_FNCLS,a=e("../lib/constants").FRAUDNET_SOURCE,s=e("../lib/constants").FRAUDNET_URL,c=e("../lib/assets").loadScript,r=e("../lib/promise");function d(){}function u(e){e&&e.parentNode&&e.parentNode.removeChild(e)}d.prototype.initialize=function(e){var t,n=e.environment,r=this;return this.sessionId=e.sessionId||function(){var e,t="";for(e=0;e<32;e++)t+=Math.floor(16*Math.random()).toString(16);return t}(),e.sessionId||(i=this.sessionId),this._beaconId=(t=this.sessionId,e=(new Date).getTime()/1e3,"https://b.stats.paypal.com/counter.cgi?i=127.0.0.1&p="+t+"&t="+e+"&a=14"),this._parameterBlock=function(e,t,n){var r=document.body.appendChild(document.createElement("script")),t={f:e,s:a,b:t};"production"!==n&&(t.sandbox=!0);return r.type="application/json",r.setAttribute("fncls",o),r.text=JSON.stringify(t),r}(this.sessionId,this._beaconId,n),c({src:s}).then(function(e){return r._thirdPartyBlock=e,r}).catch(function(){return null})},d.prototype.teardown=function(){u(document.querySelector('iframe[title="ppfniframe"]')),u(document.querySelector('iframe[title="pbf"]')),u(this._parameterBlock),u(this._thirdPartyBlock)},t.exports={setup:function(e){var t=new d;return!(e=e||{}).sessionId&&i?(t.sessionId=i,r.resolve(t)):t.initialize(e)},clearSessionIdCache:function(){i=null}}},{"../lib/assets":126,"../lib/constants":132,"../lib/promise":163}],104:[function(e,t,n){"use strict";var a=e("./kount"),s=e("./fraudnet"),c=e("../lib/braintree-error"),d=e("../lib/basic-component-verification"),u=e("../lib/create-deferred-client"),l=e("../lib/create-assets-url"),p=e("../lib/methods"),_=e("../lib/convert-methods-to-error"),E=e("../lib/promise"),h=e("@braintree/wrap-promise"),m=e("./errors");t.exports={create:h(function(r){var i,n="Data Collector",o={_instances:[]};return d.verify({name:n,client:r.client,authorization:r.authorization}).then(function(){var e,t;return o._instantiatedWithAClient=!r.useDeferredClient,o._createPromise=u.create({authorization:r.authorization,client:r.client,debug:r.debug,assetsUrl:l.create(r.authorization),name:n}).then(function(e){var t,n=e.getConfiguration();if(!0===r.kount&&n.gatewayConfiguration.kount){try{t=a.setup({environment:n.gatewayConfiguration.environment,merchantId:n.gatewayConfiguration.kount.kountMerchantId})}catch(e){return E.reject(new c({type:m.DATA_COLLECTOR_KOUNT_ERROR.type,code:m.DATA_COLLECTOR_KOUNT_ERROR.code,message:e.message}))}i=t.deviceData,o._instances.push(t)}else i={};return E.resolve(e)}).then(function(e){return s.setup({sessionId:r.correlationId,environment:e.getConfiguration().gatewayConfiguration.environment}).then(function(e){e&&(i.correlation_id=e.sessionId,o._instances.push(e))})}).then(function(){return 0===o._instances.length?E.reject(new c(m.DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS)):(o.deviceData=JSON.stringify(i),o.rawDeviceData=i,o)}),o.teardown=(e=o,h(function(){return e._createPromise.then(function(){e._instances.forEach(function(e){e&&e.teardown()}),_(e,p(e))})})),o.getDeviceData=(t=o,h(function(e){return e=e||{},t._createPromise.then(function(){return e.raw?E.resolve(t.rawDeviceData):E.resolve(t.deviceData)})})),o._instantiatedWithAClient?o._createPromise:o})}),VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/convert-methods-to-error":133,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/methods":161,"../lib/promise":163,"./errors":102,"./fraudnet":103,"./kount":105,"@braintree/wrap-promise":48}],105:[function(e,t,n){"use strict";var r=e("./vendor/sjcl"),i=e("../lib/camel-case-to-snake-case"),e="https://assets.qa.braintreepayments.com/data",o={development:e,qa:e,sandbox:"https://assets.braintreegateway.com/sandbox/data",production:"https://assets.braintreegateway.com/data"},a={};function s(e){var t=s.getCachedDeviceData(e.merchantId);if(t)return this.deviceData=t,void(this._isCached=!0);this._currentEnvironment=this._initializeEnvironment(e),r.random.startCollectors(),this._deviceSessionId=this._generateDeviceSessionId(),this.deviceData=this._getDeviceData(),s.setCachedDeviceData(e.merchantId,this.deviceData),this._iframe=this._setupIFrame()}s.getCachedDeviceData=function(e){return a[e]},s.setCachedDeviceData=function(e,t){a[e]=t},s.prototype.teardown=function(){this._isCached||(r.random.stopCollectors(),this._removeIframe())},s.prototype._removeIframe=function(){this._iframe.parentNode.removeChild(this._iframe)},s.prototype._getDeviceData=function(){return i({deviceSessionId:this._deviceSessionId,fraudMerchantId:this._currentEnvironment.id})},s.prototype._generateDeviceSessionId=function(){var e=r.random.randomWords(4,0);return r.codec.hex.fromBits(e)},s.prototype._setupIFrame=function(){var e=this,t="?m="+this._currentEnvironment.id+"&s="+this._deviceSessionId,n=document.createElement("iframe");return n.width=1,n.id="braintreeDataFrame-"+this._deviceSessionId,n.height=1,n.frameBorder=0,n.scrolling="no",n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",n.title="Braintree-Kount-iframe",n.setAttribute("aria-hidden","true"),document.body.appendChild(n),setTimeout(function(){n.src=e._currentEnvironment.url+"/logo.htm"+t,n.innerHTML='<img src="'+e._currentEnvironment.url+"/logo.gif"+t+'" alt="" />'},10),n},s.prototype._initializeEnvironment=function(e){var t=o[e.environment];if(null==t)throw new Error(e.environment+" is not a valid environment for kount.environment");return{url:t,name:e.environment,id:e.merchantId}},t.exports={setup:function(e){return new s(null!=e?e:{})},Kount:s,environmentUrls:o}},{"../lib/camel-case-to-snake-case":131,"./vendor/sjcl":106}],106:[function(e,t,n){"use strict";var r,i,o,a,s,y={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(e){this.toString=function(){return"CORRUPT: "+this.message},this.message=e},invalid:function(e){this.toString=function(){return"INVALID: "+this.message},this.message=e},bug:function(e){this.toString=function(){return"BUG: "+this.message},this.message=e},notReady:function(e){this.toString=function(){return"NOT READY: "+this.message},this.message=e}}};function c(e,t,n){if(4!==t.length)throw new y.exception.invalid("invalid aes block size");var r=e.b[n],i=t[0]^r[0],o=t[n?3:1]^r[1],a=t[2]^r[2];t=t[n?1:3]^r[3];var s,c,d=r.length/4-2,u=4,l=[0,0,0,0],p=e.l[n];e=p[0];for(var _=p[1],E=p[2],h=p[3],m=p[4],f=0;f<d;f++)p=e[i>>>24]^_[o>>16&255]^E[a>>8&255]^h[255&t]^r[u],s=e[o>>>24]^_[a>>16&255]^E[t>>8&255]^h[255&i]^r[u+1],c=e[a>>>24]^_[t>>16&255]^E[i>>8&255]^h[255&o]^r[u+2],t=e[t>>>24]^_[i>>16&255]^E[o>>8&255]^h[255&a]^r[u+3],u+=4,i=p,o=s,a=c;for(f=0;f<4;f++)l[n?3&-f:f]=m[i>>>24]<<24^m[o>>16&255]<<16^m[a>>8&255]<<8^m[255&t]^r[u++],p=i,i=o,o=a,a=t,t=p;return l}function d(e,t){for(var n,r,i=e.u,o=e.b,a=i[0],s=i[1],c=i[2],d=i[3],u=i[4],l=i[5],p=i[6],_=i[7],E=0;E<64;E++)n=(n=E<16?t[E]:(n=t[E+1&15],r=t[E+14&15],t[15&E]=(n>>>7^n>>>18^n>>>3^n<<25^n<<14)+(r>>>17^r>>>19^r>>>10^r<<15^r<<13)+t[15&E]+t[E+9&15]|0))+_+(u>>>6^u>>>11^u>>>25^u<<26^u<<21^u<<7)+(p^u&(l^p))+o[E],_=p,p=l,l=u,u=d+n|0,d=c,c=s,a=n+((s=a)&c^d&(s^c))+(s>>>2^s>>>13^s>>>22^s<<30^s<<19^s<<10)|0;i[0]=i[0]+a|0,i[1]=i[1]+s|0,i[2]=i[2]+c|0,i[3]=i[3]+d|0,i[4]=i[4]+u|0,i[5]=i[5]+l|0,i[6]=i[6]+p|0,i[7]=i[7]+_|0}function u(e,t){var n,r=y.random.B[e],i=[];for(n in r)r.hasOwnProperty(n)&&i.push(r[n]);for(n=0;n<i.length;n++)i[n](t)}function l(e,t){"undefined"!=typeof window&&window.performance&&"function"==typeof window.performance.now?e.addEntropy(window.performance.now(),t,"loadtime"):e.addEntropy((new Date).valueOf(),t,"loadtime")}function p(e){e.b=_(e).concat(_(e)),e.C=new y.cipher.aes(e.b)}function _(e){for(var t=0;t<4&&(e.g[t]=e.g[t]+1|0,!e.g[t]);t++);return e.C.encrypt(e.g)}function E(e,t){return function(){t.apply(e,arguments)}}y.cipher.aes=function(e){this.l[0][0][0]||this.G();var t,n,r,i=this.l[0][4],o=this.l[1],a=e.length,s=1;if(4!==a&&6!==a&&8!==a)throw new y.exception.invalid("invalid aes key size");for(this.b=[n=e.slice(0),r=[]],e=a;e<4*a+28;e++)t=n[e-1],(0==e%a||8===a&&4==e%a)&&(t=i[t>>>24]<<24^i[t>>16&255]<<16^i[t>>8&255]<<8^i[255&t],0==e%a&&(t=t<<8^t>>>24^s<<24,s=s<<1^283*(s>>7))),n[e]=n[e-a]^t;for(a=0;e;a++,e--)t=n[3&a?e:e-4],r[a]=e<=4||a<4?t:o[0][i[t>>>24]]^o[1][i[t>>16&255]]^o[2][i[t>>8&255]]^o[3][i[255&t]]},y.cipher.aes.prototype={encrypt:function(e){return c(this,e,0)},decrypt:function(e){return c(this,e,1)},l:[[[],[],[],[],[]],[[],[],[],[],[]]],G:function(){for(var e,t,n,r,i,o,a=this.l[0],s=this.l[1],c=a[4],d=s[4],u=[],l=[],p=0;p<256;p++)l[(u[p]=p<<1^283*(p>>7))^p]=p;for(e=t=0;!c[e];e^=n||1,t=l[t]||1)for(o=16843009*(r=u[p=u[n=u[d[c[e]=i=(i=t^t<<1^t<<2^t<<3^t<<4)>>8^255&i^99]=e]]])^65537*p^257*n^16843008*e,r=257*u[i]^16843008*i,p=0;p<4;p++)a[p][e]=r=r<<24^r>>>8,s[p][i]=o=o<<24^o>>>8;for(p=0;p<5;p++)a[p]=a[p].slice(0),s[p]=s[p].slice(0)}},y.bitArray={bitSlice:function(e,t,n){return e=y.bitArray.M(e.slice(t/32),32-(31&t)).slice(1),void 0===n?e:y.bitArray.clamp(e,n-t)},extract:function(e,t,n){var r=Math.floor(-t-n&31);return(-32&(t+n-1^t)?e[t/32|0]<<32-r^e[t/32+1|0]>>>r:e[t/32|0]>>>r)&(1<<n)-1},concat:function(e,t){if(0===e.length||0===t.length)return e.concat(t);var n=e[e.length-1],r=y.bitArray.getPartial(n);return 32===r?e.concat(t):y.bitArray.M(t,r,0|n,e.slice(0,e.length-1))},bitLength:function(e){var t=e.length;return 0===t?0:32*(t-1)+y.bitArray.getPartial(e[t-1])},clamp:function(e,t){if(32*e.length<t)return e;var n=(e=e.slice(0,Math.ceil(t/32))).length;return t&=31,0<n&&t&&(e[n-1]=y.bitArray.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:function(e,t,n){return 32===e?t:(n?0|t:t<<32-e)+1099511627776*e},getPartial:function(e){return Math.round(e/1099511627776)||32},equal:function(e,t){if(y.bitArray.bitLength(e)!==y.bitArray.bitLength(t))return!1;for(var n=0,r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},M:function(e,t,n,r){var i=0;for(void 0===r&&(r=[]);32<=t;t-=32)r.push(n),n=0;if(0===t)return r.concat(e);for(i=0;i<e.length;i++)r.push(n|e[i]>>>t),n=e[i]<<32-t;return i=e.length?e[e.length-1]:0,e=y.bitArray.getPartial(i),r.push(y.bitArray.partial(t+e&31,32<t+e?n:r.pop(),1)),r},Y:function(e,t){return[e[0]^t[0],e[1]^t[1],e[2]^t[2],e[3]^t[3]]},byteswapM:function(e){for(var t,n=0;n<e.length;++n)t=e[n],e[n]=t>>>24|t>>>8&65280|(65280&t)<<8|t<<24;return e}},y.codec.utf8String={fromBits:function(e){for(var t,n="",r=y.bitArray.bitLength(e),i=0;i<r/8;i++)0==(3&i)&&(t=e[i/4]),n+=String.fromCharCode(t>>>8>>>8>>>8),t<<=8;return decodeURIComponent(escape(n))},toBits:function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0,r=0;r<e.length;r++)n=n<<8|e.charCodeAt(r),3==(3&r)&&(t.push(n),n=0);return 3&r&&t.push(y.bitArray.partial(8*(3&r),n)),t}},y.codec.hex={fromBits:function(e){for(var t="",n=0;n<e.length;n++)t+=(0xf00000000000+(0|e[n])).toString(16).substr(4);return t.substr(0,y.bitArray.bitLength(e)/4)},toBits:function(e){var t,n=[],r=(e=e.replace(/\s|0x/g,"")).length;for(e+="00000000",t=0;t<e.length;t+=8)n.push(0^parseInt(e.substr(t,8),16));return y.bitArray.clamp(n,4*r)}},y.hash.sha256=function(e){this.b[0]||this.G(),e?(this.u=e.u.slice(0),this.o=e.o.slice(0),this.h=e.h):this.reset()},y.hash.sha256.hash=function(e){return(new y.hash.sha256).update(e).finalize()},y.hash.sha256.prototype={blockSize:512,reset:function(){return this.u=this.K.slice(0),this.o=[],this.h=0,this},update:function(e){"string"==typeof e&&(e=y.codec.utf8String.toBits(e));var t=this.o=y.bitArray.concat(this.o,e);if(i=this.h,9007199254740991<(e=this.h=i+y.bitArray.bitLength(e)))throw new y.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!=typeof Uint32Array){for(var n=new Uint32Array(t),r=0,i=512+i-(512+i&511);i<=e;i+=512)d(this,n.subarray(16*r,16*(r+1))),r+=1;t.splice(0,16*r)}else for(i=512+i-(512+i&511);i<=e;i+=512)d(this,t.splice(0,16));return this},finalize:function(){for(var e=this.o,t=this.u,n=(e=y.bitArray.concat(e,[y.bitArray.partial(1,1)])).length+2;15&n;n++)e.push(0);for(e.push(Math.floor(this.h/4294967296)),e.push(0|this.h);e.length;)d(this,e.splice(0,16));return this.reset(),t},K:[],b:[],G:function(){function e(e){return 4294967296*(e-Math.floor(e))|0}for(var t,n,r=0,i=2;r<64;i++){for(n=!0,t=2;t*t<=i;t++)if(0==i%t){n=!1;break}n&&(r<8&&(this.K[r]=e(Math.pow(i,.5))),this.b[r]=e(Math.pow(i,1/3)),r++)}}},y.prng=function(e){this.c=[new y.hash.sha256],this.i=[0],this.H=0,this.v={},this.F=0,this.J={},this.L=this.f=this.j=this.T=0,this.b=[0,0,0,0,0,0,0,0],this.g=[0,0,0,0],this.C=void 0,this.D=e,this.s=!1,this.B={progress:{},seeded:{}},this.m=this.S=0,this.w=1,this.A=2,this.O=65536,this.I=[0,48,64,96,128,192,256,384,512,768,1024],this.P=3e4,this.N=80},y.prng.prototype={randomWords:function(e,t){var n=[];if((i=this.isReady(t))===this.m)throw new y.exception.notReady("generator isn't seeded");if(i&this.A){var r,i=!(i&this.w),o=[],a=0;for(this.L=o[0]=(new Date).valueOf()+this.P,r=0;r<16;r++)o.push(4294967296*Math.random()|0);for(r=0;r<this.c.length&&(o=o.concat(this.c[r].finalize()),a+=this.i[r],this.i[r]=0,i||!(this.H&1<<r));r++);for(this.H>=1<<this.c.length&&(this.c.push(new y.hash.sha256),this.i.push(0)),this.f-=a,a>this.j&&(this.j=a),this.H++,this.b=y.hash.sha256.hash(this.b.concat(o)),this.C=new y.cipher.aes(this.b),i=0;i<4&&(this.g[i]=this.g[i]+1|0,!this.g[i]);i++);}for(i=0;i<e;i+=4)0==(i+1)%this.O&&p(this),o=_(this),n.push(o[0],o[1],o[2],o[3]);return p(this),n.slice(0,e)},setDefaultParanoia:function(e,t){if(0===e&&"Setting paranoia=0 will ruin your security; use it only for testing"!==t)throw new y.exception.invalid("Setting paranoia=0 will ruin your security; use it only for testing");this.D=e},addEntropy:function(e,t,n){n=n||"user";var r,i=(new Date).valueOf(),o=this.v[n],a=this.isReady(),s=0,c=this.J[n];switch(void 0===c&&(c=this.J[n]=this.T++),void 0===o&&(o=this.v[n]=0),this.v[n]=(this.v[n]+1)%this.c.length,typeof e){case"number":void 0===t&&(t=1),this.c[o].update([c,this.F++,1,t,i,1,0|e]);break;case"object":if("[object Uint32Array]"===(n=Object.prototype.toString.call(e))){for(r=[],n=0;n<e.length;n++)r.push(e[n]);e=r}else for("[object Array]"!==n&&(s=1),n=0;n<e.length&&!s;n++)"number"!=typeof e[n]&&(s=1);if(!s){if(void 0===t)for(n=t=0;n<e.length;n++)for(r=e[n];0<r;)t++,r>>>=1;this.c[o].update([c,this.F++,2,t,i,e.length].concat(e))}break;case"string":void 0===t&&(t=e.length),this.c[o].update([c,this.F++,3,t,i,e.length]),this.c[o].update(e);break;default:s=1}if(s)throw new y.exception.bug("random: addEntropy only supports number, array of numbers or string");this.i[o]+=t,this.f+=t,a===this.m&&(this.isReady()!==this.m&&u("seeded",Math.max(this.j,this.f)),u("progress",this.getProgress()))},isReady:function(e){return e=this.I[void 0!==e?e:this.D],this.j&&this.j>=e?this.i[0]>this.N&&(new Date).valueOf()>this.L?this.A|this.w:this.w:this.f>=e?this.A|this.m:this.m},getProgress:function(e){return e=this.I[e||this.D],this.j>=e||this.f>e?1:this.f/e},startCollectors:function(){if(!this.s){if(this.a={loadTimeCollector:E(this,this.V),mouseCollector:E(this,this.W),keyboardCollector:E(this,this.U),accelerometerCollector:E(this,this.R),touchCollector:E(this,this.X)},window.addEventListener)window.addEventListener("load",this.a.loadTimeCollector,!1),window.addEventListener("mousemove",this.a.mouseCollector,!1),window.addEventListener("keypress",this.a.keyboardCollector,!1),window.addEventListener("devicemotion",this.a.accelerometerCollector,!1),window.addEventListener("touchmove",this.a.touchCollector,!1);else{if(!document.attachEvent)throw new y.exception.bug("can't attach event");document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector)}this.s=!0}},stopCollectors:function(){this.s&&(window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,!1),window.removeEventListener("mousemove",this.a.mouseCollector,!1),window.removeEventListener("keypress",this.a.keyboardCollector,!1),window.removeEventListener("devicemotion",this.a.accelerometerCollector,!1),window.removeEventListener("touchmove",this.a.touchCollector,!1)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove",this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.s=!1)},addEventListener:function(e,t){this.B[e][this.S++]=t},removeEventListener:function(e,t){var n,r,i=this.B[e],o=[];for(r in i)i.hasOwnProperty(r)&&i[r]===t&&o.push(r);for(n=0;n<o.length;n++)delete i[r=o[n]]},U:function(){l(this,1)},W:function(e){var t,n;try{t=e.x||e.clientX||e.offsetX||0,n=e.y||e.clientY||e.offsetY||0}catch(e){n=t=0}0!=t&&0!=n&&this.addEntropy([t,n],2,"mouse"),l(this,0)},X:function(e){e=e.touches[0]||e.changedTouches[0],this.addEntropy([e.pageX||e.clientX,e.pageY||e.clientY],1,"touch"),l(this,0)},V:function(){l(this,2)},R:function(e){var t;e=e.accelerationIncludingGravity.x||e.accelerationIncludingGravity.y||e.accelerationIncludingGravity.z,!window.orientation||"number"==typeof(t=window.orientation)&&this.addEntropy(t,1,"accelerometer"),e&&this.addEntropy(e,2,"accelerometer"),l(this,0)}},y.random=new y.prng(6);e:try{if(a=void 0!==t&&t.exports){try{s=e("crypto")}catch(e){s=null}a=i=s}if(a&&i.randomBytes)r=i.randomBytes(128),r=new Uint32Array(new Uint8Array(r).buffer),y.random.addEntropy(r,1024,"crypto['randomBytes']");else if("undefined"!=typeof window&&"undefined"!=typeof Uint32Array){if(o=new Uint32Array(32),window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(o);else{if(!window.msCrypto||!window.msCrypto.getRandomValues)break e;window.msCrypto.getRandomValues(o)}y.random.addEntropy(o,1024,"crypto['getRandomValues']")}}catch(e){"undefined"!=typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(e))}void 0!==t&&t.exports&&(t.exports=y)},{crypto:void 0}],107:[function(e,t,n){"use strict";e=e("../lib/braintree-error");t.exports={GOOGLE_PAYMENT_NOT_ENABLED:{type:e.types.MERCHANT,code:"GOOGLE_PAYMENT_NOT_ENABLED",message:"Google Pay is not enabled for this merchant."},GOOGLE_PAYMENT_GATEWAY_ERROR:{code:"GOOGLE_PAYMENT_GATEWAY_ERROR",message:"There was an error when tokenizing the Google Pay payment method.",type:e.types.UNKNOWN},GOOGLE_PAYMENT_UNSUPPORTED_VERSION:{code:"GOOGLE_PAYMENT_UNSUPPORTED_VERSION",type:e.types.MERCHANT}}},{"../lib/braintree-error":130}],108:[function(e,t,n){"use strict";var o=e("../lib/analytics"),a=e("../lib/assign").assign,r=e("../lib/convert-methods-to-error"),s=e("../lib/find"),i=e("../lib/generate-google-pay-configuration"),c=e("../lib/braintree-error"),d=e("./errors"),u=e("../lib/methods"),l=e("../lib/promise"),e=e("@braintree/wrap-promise"),p={1:"_createV1PaymentDataRequest",2:"_createV2PaymentDataRequest"};function _(e){if(this._createPromise=e.createPromise,this._client=e.client,this._useDeferredClient=e.useDeferredClient,this._googlePayVersion=e.googlePayVersion||1,this._googleMerchantId=e.googleMerchantId,this._isUnsupportedGooglePayAPIVersion())throw new c({code:d.GOOGLE_PAYMENT_UNSUPPORTED_VERSION.code,message:"The Braintree SDK does not support Google Pay version "+this._googlePayVersion+". Please upgrade the version of your Braintree SDK and contact support if this error persists.",type:d.GOOGLE_PAYMENT_UNSUPPORTED_VERSION.type})}_.prototype._waitForClient=function(){return this._client?l.resolve():this._createPromise.then(function(e){this._client=e}.bind(this))},_.prototype._isUnsupportedGooglePayAPIVersion=function(){return!(this._googlePayVersion in p)},_.prototype._getDefaultConfig=function(){return this._defaultConfig||(this._defaultConfig=i(this._client.getConfiguration(),this._googlePayVersion,this._googleMerchantId)),this._defaultConfig},_.prototype._createV1PaymentDataRequest=function(e){var t=this._getDefaultConfig(),n=e.cardRequirements&&e.cardRequirements.allowedCardNetworks,r=t.cardRequirements.allowedCardNetworks,r=n||r;return(e=a({},t,e)).cardRequirements.allowedCardNetworks=r,e},_.prototype._createV2PaymentDataRequest=function(e){var i=this._getDefaultConfig();return e.allowedPaymentMethods&&e.allowedPaymentMethods.forEach(function(e){var t,n,r=s(i.allowedPaymentMethods,"type",e.type);r&&(t=e,n=r,Object.keys(n).forEach(function(e){"object"==typeof n[e]?t[e]=a({},n[e],t[e]):t[e]=t[e]||n[e]}))}),e=a({},i,e)},_.prototype.createPaymentDataRequest=function(e){return this._useDeferredClient?this._waitForClient().then(function(){return this._createPaymentDataRequestSyncronously(e)}.bind(this)):this._createPaymentDataRequestSyncronously(e)},_.prototype._createPaymentDataRequestSyncronously=function(e){var t=a({},e),n=this._googlePayVersion,e=p[n];return o.sendEvent(this._createPromise,"google-payment.v"+n+".createPaymentDataRequest"),this[e](t)},_.prototype.parseResponse=function(r){var i=this;return l.resolve().then(function(){var e,t=(2===r.apiVersion?r.paymentMethodData.tokenizationData:r.paymentMethodToken).token,n=JSON.parse(t),t=n.error;return t?l.reject(t):(o.sendEvent(i._createPromise,"google-payment.parseResponse.succeeded"),n.paypalAccounts?(e=n.paypalAccounts[0],o.sendEvent(i._createPromise,"google-payment.parseResponse.succeeded.paypal"),l.resolve({nonce:e.nonce,type:e.type,description:e.description})):(e=n.androidPayCards[0],o.sendEvent(i._createPromise,"google-payment.parseResponse.succeeded.google-payment"),l.resolve({nonce:e.nonce,type:e.type,description:e.description,details:{cardType:e.details.cardType,lastFour:e.details.lastFour,lastTwo:e.details.lastTwo,isNetworkTokenized:e.details.isNetworkTokenized,bin:e.details.bin},binData:e.binData})))}).catch(function(e){return o.sendEvent(i._createPromise,"google-payment.parseResponse.failed"),l.reject(new c({code:d.GOOGLE_PAYMENT_GATEWAY_ERROR.code,message:d.GOOGLE_PAYMENT_GATEWAY_ERROR.message,type:d.GOOGLE_PAYMENT_GATEWAY_ERROR.type,details:{originalError:e}}))})},_.prototype.teardown=function(){return r(this,u(_.prototype)),l.resolve()},t.exports=e.wrapPrototype(_)},{"../lib/analytics":125,"../lib/assign":127,"../lib/braintree-error":130,"../lib/convert-methods-to-error":133,"../lib/find":143,"../lib/generate-google-pay-configuration":155,"../lib/methods":161,"../lib/promise":163,"./errors":107,"@braintree/wrap-promise":48}],109:[function(e,t,n){"use strict";var i=e("./google-payment"),o=e("../lib/braintree-error"),a=e("../lib/promise"),s=e("../lib/create-assets-url"),c=e("../lib/create-deferred-client"),d=e("../lib/basic-component-verification"),r=e("@braintree/wrap-promise"),u=e("./errors");t.exports={create:r(function(n){var r="Google Pay";return d.verify({name:r,client:n.client,authorization:n.authorization}).then(function(){var t,e=c.create({authorization:n.authorization,client:n.client,debug:n.debug,assetsUrl:s.create(n.authorization),name:r}).then(function(e){var t=e.getConfiguration();return n.client=e,t.gatewayConfiguration.androidPay?e:a.reject(new o(u.GOOGLE_PAYMENT_NOT_ENABLED))});return n.createPromise=e,t=new i(n),n.useDeferredClient?t:e.then(function(e){return t._client=e,t})})}),VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"./errors":107,"./google-payment":108,"@braintree/wrap-promise":48}],110:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error"),i=e("../shared/errors"),o=e("../shared/constants").allowedAttributes;t.exports=function(e,t){var n;return o.hasOwnProperty(e)?null==t||function(e,t){{if("string"===o[e])return"string"==typeof t||"number"==typeof t;if("boolean"===o[e])return"true"===String(t)||"false"===String(t)}return!1}(e,t)||(n=new r({type:i.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.type,code:i.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.code,message:'Value "'+t+'" is not allowed for "'+e+'" attribute.'})):n=new r({type:i.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.type,code:i.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.code,message:'The "'+e+'" attribute is not supported in Hosted Fields.'}),n}},{"../../lib/braintree-error":130,"../shared/constants":118,"../shared/errors":119}],111:[function(e,t,n){"use strict";var r=e("../shared/constants"),i=e("../../lib/use-min");t.exports=function(e,t,n){return e+"/web/"+r.VERSION+"/html/hosted-fields-frame"+i(n)+".html#"+t}},{"../../lib/use-min":166,"../shared/constants":118}],112:[function(e,t,n){"use strict";var c=e("../shared/constants").navigationDirections,r=e("../shared/browser-detection"),d=e("../shared/focus-intercept"),u=e("../shared/find-parent-tags"),i=["INPUT","SELECT","TEXTAREA"],o=["hidden","button","reset","submit","checkbox","radio","file"];function l(e){return r.hasSoftwareKeyboard()?-1<i.indexOf(e.tagName)&&o.indexOf(e.type)<0:"hidden"!==e.type}function a(e){for(var t,n=0;n<e.length;n++)if(l(t=e[n]))return t;return null}t.exports={removeExtraFocusElements:function(e,t){e=Array.prototype.slice.call(e.elements);[a(e),a(e.reverse())].forEach(function(e){e&&d.matchFocusElement(e.getAttribute("id"))&&t(e.getAttribute("id"))})},createFocusChangeHandler:function(a,s){return function(e){var t,n,r,i,o=document.getElementById("bt-"+e.field+"-"+e.direction+"-"+a);if(o)if(r=u(o,"form")[0],document.forms.length<1||!r)s.onRemoveFocusIntercepts();else{t=(r=[].slice.call(r.elements)).indexOf(o),i=function(e,t){switch(e){case c.BACK:return{checkIndexBounds:function(e){return e<0},indexChange:-1};case c.FORWARD:return{checkIndexBounds:function(e){return t-1<e},indexChange:1}}return{}}(e.direction,r.length);do{if(t+=i.indexChange,i.checkIndexBounds(t))return}while(!l(n=r[t]));d.matchFocusElement(n.getAttribute("id"))?s.onTriggerInputFocus(n.getAttribute("data-braintree-type")):n.focus()}}}}},{"../shared/browser-detection":117,"../shared/constants":118,"../shared/find-parent-tags":120,"../shared/focus-intercept":121}],113:[function(e,t,n){"use strict";var i=e("../shared/constants").allowedStyles;t.exports=function(e){var n,t=document.createElement("input"),r={};return"."===e[0]&&(e=e.substring(1)),t.className=e,t.style.display="none !important",t.style.position="fixed !important",t.style.left="-99999px !important",t.style.top="-99999px !important",document.body.appendChild(t),n=window.getComputedStyle(t),i.forEach(function(e){var t=n[e];t&&(r[e]=t)}),document.body.removeChild(t),r}},{"../shared/constants":118}],114:[function(e,t,n){"use strict";var r=e("../../lib/assign").assign,i=e("../../lib/create-assets-url"),p=e("../../lib/is-verified-domain"),_=e("../../lib/destructor"),E=e("@braintree/class-list"),h=e("@braintree/iframer"),m=e("framebus"),f=e("../../lib/create-deferred-client"),y=e("../../lib/braintree-error"),A=e("./compose-url"),T=e("./get-styles-from-class"),N=e("../shared/constants"),I=e("../shared/errors"),O=e("../../lib/constants").INTEGRATION_TIMEOUT_MS,b=e("@braintree/uuid"),s=e("../shared/find-parent-tags"),g=e("../shared/browser-detection"),P=N.events,v=e("@braintree/event-emitter"),C=e("./inject-frame"),R=e("../../lib/analytics"),o=N.allowedFields,S=e("../../lib/methods"),D=e("../../lib/shadow"),c=e("../../lib/find-root-node"),w=e("../../lib/convert-methods-to-error"),L=e("../../lib/errors"),M=e("../shared/get-card-types"),a=e("./attribute-validation-error"),U=e("../../lib/promise"),d=e("@braintree/wrap-promise"),k=e("./focus-change"),F=e("../shared/focus-intercept").destroy;function x(a){return function(e){var t,n,r=e.merchantPayload,i=r.emittedBy,o=a[i].containerElement;Object.keys(r.fields).forEach(function(e){r.fields[e].container=a[e].containerElement}),t=r.fields[i],"blur"===e.type&&(n=o,g.isIos()&&document.activeElement===document.body&&((i=n.querySelector("input"))||((i=document.createElement("input")).type="button",i.style.height="0px",i.style.width="0px",i.style.opacity="0",i.style.padding="0",i.style.position="absolute",i.style.left="-200%",i.style.top="0px",n.insertBefore(i,n.firstChild)),i.focus(),i.blur())),E.toggle(o,N.externalClasses.FOCUSED,t.isFocused),E.toggle(o,N.externalClasses.VALID,t.isValid),E.toggle(o,N.externalClasses.INVALID,!t.isPotentiallyValid),this._state={cards:r.cards,fields:r.fields},this._emit(e.type,r)}}function V(o){var n,e,t,a,s=this,c={},d={},u=[],l=b();if(this._merchantConfigurationOptions=r({},o),t=o.client?(e=(t=o.client.getConfiguration()).gatewayConfiguration.assetsUrl,t.isDebug):(e=i.create(o.authorization),Boolean(o.isDebug)),this._clientPromise=f.create({client:o.client,authorization:o.authorization,debug:t,assetsUrl:e,name:"Hosted Fields"}),a=A(e,l,t),!o.fields||0===Object.keys(o.fields).length)throw new y({type:L.INSTANTIATION_OPTION_REQUIRED.type,code:L.INSTANTIATION_OPTION_REQUIRED.code,message:"options.fields is required when instantiating Hosted Fields."});v.call(this),this._injectedNodes=[],this._destructor=new _,this._fields=c,this._state={fields:{},cards:M("")},this._bus=new m({channel:l,verifyDomain:p}),this._destructor.registerFunctionForTeardown(function(){s._bus.teardown()}),o.client?R.sendEvent(this._clientPromise,"custom.hosted-fields.initialized"):R.sendEvent(this._clientPromise,"custom.hosted-fields.initialized.deferred-client"),Object.keys(o.fields).forEach(function(t){var e,n,r,i;if(!N.allowedFields.hasOwnProperty(t))throw new y({type:I.HOSTED_FIELDS_INVALID_FIELD_KEY.type,code:I.HOSTED_FIELDS_INVALID_FIELD_KEY.code,message:'"'+t+'" is not a valid field.'});if(!(n="string"==typeof(n=(e=o.fields[t]).container||e.selector)?document.querySelector(n):n)||1!==n.nodeType)throw new y({type:I.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.type,code:I.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.code,message:I.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.message,details:{fieldSelector:e.selector,fieldContainer:e.container,fieldKey:t}});if(n.querySelector('iframe[name^="braintree-"]'))throw new y({type:I.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.type,code:I.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.code,message:I.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.message,details:{fieldSelector:e.selector,fieldContainer:e.container,fieldKey:t}});if(i=n,D.isShadowElement(i)&&(i=D.transformToSlot(i,"height: 100%")),e.maxlength&&"number"!=typeof e.maxlength)throw new y({type:I.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,code:I.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,message:"The value for maxlength must be a number.",details:{fieldKey:t}});if(e.minlength&&"number"!=typeof e.minlength)throw new y({type:I.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,code:I.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,message:"The value for minlength must be a number.",details:{fieldKey:t}});r=h({type:t,name:"braintree-hosted-field-"+t,style:N.defaultIFrameStyle,title:"Secure Credit Card Frame - "+N.allowedFields[t].label}),this._injectedNodes.push.apply(this._injectedNodes,C(l,r,i,function(){s.focus(t)})),this._setupLabelFocus(t,n),c[t]={frameElement:r,containerElement:n},i=new U(function(e){d[t]=e}),u.push(i),this._state.fields[t]={isEmpty:!0,isValid:!1,isPotentiallyValid:!0,isFocused:!1,container:n},setTimeout(function(){g.isIE()||g.isEdge()?(r.src="about:blank",setTimeout(function(){r.src=a},0)):r.src=a},0)}.bind(this)),this._merchantConfigurationOptions.styles&&Object.keys(this._merchantConfigurationOptions.styles).forEach(function(e){var t=s._merchantConfigurationOptions.styles[e];"string"==typeof t&&(s._merchantConfigurationOptions.styles[e]=T(t))}),this._bus.on(P.REMOVE_FOCUS_INTERCEPTS,function(e){F(e&&e.id)}),this._bus.on(P.TRIGGER_FOCUS_CHANGE,k.createFocusChangeHandler(l,{onRemoveFocusIntercepts:function(e){s._bus.emit(P.REMOVE_FOCUS_INTERCEPTS,{id:e})},onTriggerInputFocus:function(e){s.focus(e)}})),this._bus.on(P.READY_FOR_CLIENT,function(t){s._clientPromise.then(function(e){t(e)})}),this._bus.on(P.CARD_FORM_ENTRY_HAS_BEGUN,function(){R.sendEvent(s._clientPromise,"hosted-fields.input.started")}),this._bus.on(P.BIN_AVAILABLE,function(e){s._emit("binAvailable",{bin:e})}),n=setTimeout(function(){R.sendEvent(s._clientPromise,"custom.hosted-fields.load.timed-out"),s._emit("timeout")},O),U.all(u).then(function(e){var t,e=e[0];clearTimeout(n),e((e=s._merchantConfigurationOptions,(t=r({},e)).fields=r({},t.fields),Object.keys(t.fields).forEach(function(e){t.fields[e]=r({},t.fields[e]),delete t.fields[e].container}),t)),s._cleanUpFocusIntercepts(),s._emit("ready")}),this._bus.on(P.FRAME_READY,function(e,t){d[e.field](t)}),this._bus.on(P.INPUT_EVENT,x(c).bind(this)),this._destructor.registerFunctionForTeardown(function(){for(var e,t,n=0;n<s._injectedNodes.length;n++)(t=(e=s._injectedNodes[n]).parentNode).removeChild(e),E.remove(t,N.externalClasses.FOCUSED,N.externalClasses.INVALID,N.externalClasses.VALID)}),this._destructor.registerFunctionForTeardown(function(){F()}),this._destructor.registerFunctionForTeardown(function(){var e=S(V.prototype).concat(S(v.prototype));w(s,e)})}v.createChild(V),V.prototype._setupLabelFocus=function(e,t){var n,r,i=this,o=c(t);if(null!=t.id){for(n=Array.prototype.slice.call(document.querySelectorAll('label[for="'+t.id+'"]')),n=(n=(n=o!==document?n.concat(Array.prototype.slice.call(o.querySelectorAll('label[for="'+t.id+'"]'))):n).concat(s(t,"label"))).filter(function(e,t,n){return n.indexOf(e)===t}),r=0;r<n.length;r++)n[r].addEventListener("click",a,!1);this._destructor.registerFunctionForTeardown(function(){for(r=0;r<n.length;r++)n[r].removeEventListener("click",a,!1)})}function a(){i.focus(e)}},V.prototype._getAnyFieldContainer=function(){var n=this;return Object.keys(this._fields).reduce(function(e,t){return e||n._fields[t].containerElement},null)},V.prototype._cleanUpFocusIntercepts=function(){var e;document.forms.length<1?this._bus.emit(P.REMOVE_FOCUS_INTERCEPTS):(e=this._getAnyFieldContainer(),(e=s(e,"form")[0])?k.removeExtraFocusElements(e,function(e){this._bus.emit(P.REMOVE_FOCUS_INTERCEPTS,{id:e})}.bind(this)):this._bus.emit(P.REMOVE_FOCUS_INTERCEPTS))},V.prototype._attachInvalidFieldContainersToError=function(t){t.details&&t.details.invalidFieldKeys&&0<t.details.invalidFieldKeys.length&&(t.details.invalidFields={},t.details.invalidFieldKeys.forEach(function(e){t.details.invalidFields[e]=this._fields[e].containerElement}.bind(this)))},V.prototype.getChallenges=function(){return this._clientPromise.then(function(e){return e.getConfiguration().gatewayConfiguration.challenges})},V.prototype.getSupportedCardTypes=function(){return this._clientPromise.then(function(e){return e.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes.map(function(e){return"MasterCard"===e?"Mastercard":e})})},V.prototype.teardown=function(){var r=this;return new U(function(t,n){r._destructor.teardown(function(e){R.sendEvent(r._clientPromise,"custom.hosted-fields.teardown-completed"),e?n(e):t()})})},V.prototype.tokenize=function(e){var i=this;return e=e||{},new U(function(n,r){i._bus.emit(P.TOKENIZATION_REQUEST,e,function(e){var t=e[0],e=e[1];t?(i._attachInvalidFieldContainersToError(t),r(new y(t))):n(e)})})},V.prototype.addClass=function(e,t){var n;return o.hasOwnProperty(e)?this._fields.hasOwnProperty(e)?this._bus.emit(P.ADD_CLASS,{field:e,classname:t}):n=new y({type:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot add class to "'+e+'" field because it is not part of the current Hosted Fields options.'}):n=new y({type:I.HOSTED_FIELDS_FIELD_INVALID.type,code:I.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e+'" is not a valid field. You must use a valid field option when adding a class.'}),n?U.reject(n):U.resolve()},V.prototype.removeClass=function(e,t){var n;return o.hasOwnProperty(e)?this._fields.hasOwnProperty(e)?this._bus.emit(P.REMOVE_CLASS,{field:e,classname:t}):n=new y({type:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot remove class from "'+e+'" field because it is not part of the current Hosted Fields options.'}):n=new y({type:I.HOSTED_FIELDS_FIELD_INVALID.type,code:I.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e+'" is not a valid field. You must use a valid field option when removing a class.'}),n?U.reject(n):U.resolve()},V.prototype.setAttribute=function(e){var t,n;return o.hasOwnProperty(e.field)?this._fields.hasOwnProperty(e.field)?(t=a(e.attribute,e.value))?n=t:this._bus.emit(P.SET_ATTRIBUTE,{field:e.field,attribute:e.attribute,value:e.value}):n=new y({type:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot set attribute for "'+e.field+'" field because it is not part of the current Hosted Fields options.'}):n=new y({type:I.HOSTED_FIELDS_FIELD_INVALID.type,code:I.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e.field+'" is not a valid field. You must use a valid field option when setting an attribute.'}),n?U.reject(n):U.resolve()},V.prototype.setMonthOptions=function(t){var e,n=this,r=this._merchantConfigurationOptions.fields;return r.expirationMonth?r.expirationMonth.select||(e="Expiration month field must be a select element."):e="Expiration month field must exist to use setMonthOptions.",e?U.reject(new y({type:I.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,code:I.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,message:e})):new U(function(e){n._bus.emit(P.SET_MONTH_OPTIONS,t,e)})},V.prototype.setMessage=function(e){this._bus.emit(P.SET_MESSAGE,{field:e.field,message:e.message})},V.prototype.removeAttribute=function(e){var t,n;return o.hasOwnProperty(e.field)?this._fields.hasOwnProperty(e.field)?(t=a(e.attribute))?n=t:this._bus.emit(P.REMOVE_ATTRIBUTE,{field:e.field,attribute:e.attribute}):n=new y({type:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot remove attribute for "'+e.field+'" field because it is not part of the current Hosted Fields options.'}):n=new y({type:I.HOSTED_FIELDS_FIELD_INVALID.type,code:I.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e.field+'" is not a valid field. You must use a valid field option when removing an attribute.'}),n?U.reject(n):U.resolve()},V.prototype.setPlaceholder=function(e,t){return this.setAttribute({field:e,attribute:"placeholder",value:t})},V.prototype.clear=function(e){var t;return o.hasOwnProperty(e)?this._fields.hasOwnProperty(e)?this._bus.emit(P.CLEAR_FIELD,{field:e}):t=new y({type:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot clear "'+e+'" field because it is not part of the current Hosted Fields options.'}):t=new y({type:I.HOSTED_FIELDS_FIELD_INVALID.type,code:I.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e+'" is not a valid field. You must use a valid field option when clearing a field.'}),t?U.reject(t):U.resolve()},V.prototype.focus=function(e){var t,r=this._fields[e];return o.hasOwnProperty(e)?this._fields.hasOwnProperty(e)?(r.frameElement.focus(),this._bus.emit(P.TRIGGER_INPUT_FOCUS,{field:e}),g.isIos()&&setTimeout(function(){var e,t,n;e=r.containerElement,t=e.getBoundingClientRect(),n=Math.floor(t.height/2),e=Math.floor(t.width/2),t.top<(window.innerHeight-n||document.documentElement.clientHeight-n)&&t.right>e&&t.bottom>n&&t.left<(window.innerWidth-e||document.documentElement.clientWidth-e)||r.containerElement.scrollIntoView()},5)):t=new y({type:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:I.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot focus "'+e+'" field because it is not part of the current Hosted Fields options.'}):t=new y({type:I.HOSTED_FIELDS_FIELD_INVALID.type,code:I.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e+'" is not a valid field. You must use a valid field option when focusing a field.'}),t?U.reject(t):U.resolve()},V.prototype.getState=function(){return this._state},t.exports=d.wrapPrototype(V)},{"../../lib/analytics":125,"../../lib/assign":127,"../../lib/braintree-error":130,"../../lib/constants":132,"../../lib/convert-methods-to-error":133,"../../lib/create-assets-url":135,"../../lib/create-deferred-client":137,"../../lib/destructor":139,"../../lib/errors":141,"../../lib/find-root-node":142,"../../lib/is-verified-domain":159,"../../lib/methods":161,"../../lib/promise":163,"../../lib/shadow":165,"../shared/browser-detection":117,"../shared/constants":118,"../shared/errors":119,"../shared/find-parent-tags":120,"../shared/focus-intercept":121,"../shared/get-card-types":122,"./attribute-validation-error":110,"./compose-url":111,"./focus-change":112,"./get-styles-from-class":113,"./inject-frame":115,"@braintree/class-list":37,"@braintree/event-emitter":38,"@braintree/iframer":40,"@braintree/uuid":44,"@braintree/wrap-promise":48,framebus:57}],115:[function(e,t,n){"use strict";var c=e("../shared/focus-intercept"),d=e("../shared/constants").navigationDirections;t.exports=function(e,t,n,r){var i=t.getAttribute("type"),o=document.createElement("div"),a=document.createDocumentFragment(),s=c.generate(e,i,d.BACK,r),r=c.generate(e,i,d.FORWARD,r);return o.style.clear="both",a.appendChild(s),a.appendChild(t),a.appendChild(r),a.appendChild(o),n.appendChild(a),[t,o]}},{"../shared/constants":118,"../shared/focus-intercept":121}],116:[function(e,t,n){"use strict";var r=e("./external/hosted-fields"),i=e("../lib/basic-component-verification"),o=e("./shared/errors"),a=e("restricted-input/supports-input-formatting"),s=e("@braintree/wrap-promise"),c=e("../lib/braintree-error"),d=e("../lib/promise");t.exports={supportsInputFormatting:a,create:s(function(e){return i.verify({name:"Hosted Fields",authorization:e.authorization,client:e.client}).then(function(){var n=new r(e);return new d(function(e,t){n.on("ready",function(){e(n)}),n.on("timeout",function(){t(new c(o.HOSTED_FIELDS_TIMEOUT))})})})}),VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/promise":163,"./external/hosted-fields":114,"./shared/errors":119,"@braintree/wrap-promise":48,"restricted-input/supports-input-formatting":73}],117:[function(e,t,n){"use strict";var r=e("@braintree/browser-detection/is-android"),i=e("@braintree/browser-detection/is-chrome-os"),o=e("@braintree/browser-detection/is-ios"),a=e("@braintree/browser-detection/is-chrome");t.exports={isIE:e("@braintree/browser-detection/is-ie"),isEdge:e("@braintree/browser-detection/is-edge"),isIe9:e("@braintree/browser-detection/is-ie9"),isIe10:e("@braintree/browser-detection/is-ie10"),isAndroid:r,isChromeOS:i,isChromeIos:function(){return a()&&o()},isFirefox:e("@braintree/browser-detection/is-firefox"),isIos:o,isIosWebview:e("@braintree/browser-detection/is-ios-webview"),hasSoftwareKeyboard:function(){return r()||i()||o()}}},{"@braintree/browser-detection/is-android":24,"@braintree/browser-detection/is-chrome":26,"@braintree/browser-detection/is-chrome-os":25,"@braintree/browser-detection/is-edge":27,"@braintree/browser-detection/is-firefox":28,"@braintree/browser-detection/is-ie":29,"@braintree/browser-detection/is-ie10":30,"@braintree/browser-detection/is-ie9":31,"@braintree/browser-detection/is-ios":35,"@braintree/browser-detection/is-ios-webview":33}],118:[function(e,t,n){"use strict";var r=e("../../lib/enumerate"),e=e("./errors"),e={VERSION:"3.81.0",maxExpirationYearAge:19,externalEvents:{FOCUS:"focus",BLUR:"blur",EMPTY:"empty",NOT_EMPTY:"notEmpty",VALIDITY_CHANGE:"validityChange",CARD_TYPE_CHANGE:"cardTypeChange"},defaultMaxLengths:{number:19,postalCode:8,expirationDate:7,expirationMonth:2,expirationYear:4,cvv:3},externalClasses:{FOCUSED:"braintree-hosted-fields-focused",INVALID:"braintree-hosted-fields-invalid",VALID:"braintree-hosted-fields-valid"},navigationDirections:{BACK:"before",FORWARD:"after"},defaultIFrameStyle:{border:"none",width:"100%",height:"100%",float:"left"},tokenizationErrorCodes:{81724:e.HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE,81736:e.HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED},allowedStyles:["-moz-appearance","-moz-box-shadow","-moz-osx-font-smoothing","-moz-tap-highlight-color","-moz-transition","-webkit-appearance","-webkit-box-shadow","-webkit-font-smoothing","-webkit-tap-highlight-color","-webkit-transition","appearance","box-shadow","color","direction","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-weight","letter-spacing","line-height","margin","margin-top","margin-right","margin-bottom","margin-left","opacity","outline","padding","padding-top","padding-right","padding-bottom","padding-left","text-align","text-shadow","transition"],allowedFields:{cardholderName:{name:"cardholder-name",label:"Cardholder Name"},number:{name:"credit-card-number",label:"Credit Card Number"},cvv:{name:"cvv",label:"CVV"},expirationDate:{name:"expiration",label:"Expiration Date"},expirationMonth:{name:"expiration-month",label:"Expiration Month"},expirationYear:{name:"expiration-year",label:"Expiration Year"},postalCode:{name:"postal-code",label:"Postal Code"}},allowedAttributes:{"aria-invalid":"boolean","aria-required":"boolean",disabled:"boolean",placeholder:"string"},autocompleteMappings:{"cardholder-name":"cc-name","credit-card-number":"cc-number",expiration:"cc-exp","expiration-month":"cc-exp-month","expiration-year":"cc-exp-year",cvv:"cc-csc","postal-code":"billing postal-code"}};e.events=r(["ADD_CLASS","AUTOFILL_DATA_AVAILABLE","BIN_AVAILABLE","CARD_FORM_ENTRY_HAS_BEGUN","CLEAR_FIELD","CONFIGURATION","FRAME_READY","INPUT_EVENT","READY_FOR_CLIENT","REMOVE_ATTRIBUTE","REMOVE_CLASS","REMOVE_FOCUS_INTERCEPTS","SET_ATTRIBUTE","SET_MESSAGE","SET_MONTH_OPTIONS","TOKENIZATION_REQUEST","TRIGGER_FOCUS_CHANGE","TRIGGER_INPUT_FOCUS","VALIDATE_STRICT"],"hosted-fields:"),t.exports=e},{"../../lib/enumerate":140,"./errors":119}],119:[function(e,t,n){"use strict";e=e("../../lib/braintree-error");t.exports={HOSTED_FIELDS_TIMEOUT:{type:e.types.UNKNOWN,code:"HOSTED_FIELDS_TIMEOUT",message:"Hosted Fields timed out when attempting to set up."},HOSTED_FIELDS_INVALID_FIELD_KEY:{type:e.types.MERCHANT,code:"HOSTED_FIELDS_INVALID_FIELD_KEY"},HOSTED_FIELDS_INVALID_FIELD_SELECTOR:{type:e.types.MERCHANT,code:"HOSTED_FIELDS_INVALID_FIELD_SELECTOR",message:"Selector does not reference a valid DOM node."},HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME:{type:e.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME",message:"Element already contains a Braintree iframe."},HOSTED_FIELDS_FIELD_INVALID:{type:e.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_INVALID"},HOSTED_FIELDS_FIELD_NOT_PRESENT:{type:e.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_NOT_PRESENT"},HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR:{type:e.types.NETWORK,code:"HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR",message:"A tokenization network error occurred."},HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE:{type:e.types.CUSTOMER,code:"HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE",message:"This credit card already exists in the merchant's vault."},HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED:{type:e.types.CUSTOMER,code:"HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED",message:"CVV verification failed during tokenization."},HOSTED_FIELDS_FAILED_TOKENIZATION:{type:e.types.CUSTOMER,code:"HOSTED_FIELDS_FAILED_TOKENIZATION",message:"The supplied card data failed tokenization."},HOSTED_FIELDS_FIELDS_EMPTY:{type:e.types.CUSTOMER,code:"HOSTED_FIELDS_FIELDS_EMPTY",message:"All fields are empty. Cannot tokenize empty card fields."},HOSTED_FIELDS_FIELDS_INVALID:{type:e.types.CUSTOMER,code:"HOSTED_FIELDS_FIELDS_INVALID",message:"Some payment input fields are invalid. Cannot tokenize invalid card fields."},HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED:{type:e.types.MERCHANT,code:"HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED"},HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED:{type:e.types.MERCHANT,code:"HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED"},HOSTED_FIELDS_FIELD_PROPERTY_INVALID:{type:e.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_PROPERTY_INVALID"}}},{"../../lib/braintree-error":130}],120:[function(e,t,n){"use strict";t.exports=function(e,t){for(var n=e.parentNode,r=[];null!=n;)null!=n.tagName&&n.tagName.toLowerCase()===t&&r.push(n),n=n.parentNode;return r}},{}],121:[function(e,t,n){"use strict";var o=e("./browser-detection"),a=e("@braintree/class-list"),e=e("./constants"),r=Object.keys(e.allowedFields),i=e.navigationDirections,s={generate:function(e,t,n,r){var i=document.createElement("input");return o.hasSoftwareKeyboard()||o.isFirefox()||o.isIE()?(i.setAttribute("aria-hidden","true"),i.setAttribute("autocomplete","off"),i.setAttribute("data-braintree-direction",n),i.setAttribute("data-braintree-type",t),i.setAttribute("id","bt-"+t+"-"+n+"-"+e),i.setAttribute("style",JSON.stringify({border:"none !important",display:"block !important",height:"1px !important",left:"-1px !important",opacity:"0 !important",position:"absolute !important",top:"-1px !important",width:"1px !important"}).replace(/[{}"]/g,"").replace(/,/g,";")),a.add(i,"focus-intercept"),i.addEventListener("focus",function(e){r(e),o.hasSoftwareKeyboard()||i.blur()}),i):document.createDocumentFragment()},destroy:function(e){var t=e?[document.getElementById(e)]:(t=document.querySelectorAll("[data-braintree-direction]"),[].slice.call(t));t.forEach(function(e){e&&1===e.nodeType&&s.matchFocusElement(e.getAttribute("id"))&&e.parentNode.removeChild(e)})},matchFocusElement:function(e){var t,n;return!!e&&(!((n=e.split("-")).length<4)&&(t="bt"===n[0],e=-1<r.indexOf(n[1]),n=n[2]===i.BACK||n[2]===i.FORWARD,Boolean(t&&e&&n)))}};t.exports=s},{"./browser-detection":117,"./constants":118,"@braintree/class-list":37}],122:[function(e,t,n){"use strict";var r=e("credit-card-type");t.exports=function(e){e=r(e);return e.forEach(function(e){"mastercard"===e.type&&(e.type="master-card")}),e}},{"credit-card-type":49}],123:[function(e,t,n){"use strict";var r=e("./american-express"),i=e("./apple-pay"),o=e("./client"),a=e("./data-collector"),s=e("./hosted-fields"),c=e("./local-payment"),d=e("./masterpass"),u=e("./payment-request"),l=e("./paypal"),p=e("./paypal-checkout"),_=e("./google-payment"),E=e("./three-d-secure"),h=e("./unionpay"),m=e("./us-bank-account"),f=e("./vault-manager"),y=e("./venmo"),A=e("./visa-checkout"),e=e("./preferred-payment-methods");t.exports={americanExpress:r,applePay:i,client:o,dataCollector:a,hostedFields:s,localPayment:c,masterpass:d,googlePayment:_,paymentRequest:u,paypal:l,paypalCheckout:p,threeDSecure:E,unionpay:h,usBankAccount:m,vaultManager:f,venmo:y,visaCheckout:A,preferredPaymentMethods:e,VERSION:"3.81.0"}},{"./american-express":76,"./apple-pay":79,"./client":85,"./data-collector":104,"./google-payment":109,"./hosted-fields":116,"./local-payment":170,"./masterpass":173,"./payment-request":178,"./paypal":185,"./paypal-checkout":182,"./preferred-payment-methods":188,"./three-d-secure":198,"./unionpay":202,"./us-bank-account":208,"./vault-manager":211,"./venmo":216,"./visa-checkout":224}],124:[function(e,t,n){"use strict";var o=e("./create-authorization-data"),a=e("./json-clone"),s=e("./constants");t.exports=function(e,t){var n,r=t?a(t):{},t=o(e.authorization).attrs,i=a(e.analyticsMetadata);for(n in r.braintreeLibraryVersion=s.BRAINTREE_LIBRARY_VERSION,r._meta)r._meta.hasOwnProperty(n)&&(i[n]=r._meta[n]);return r._meta=i,t.tokenizationKey?r.tokenizationKey=t.tokenizationKey:r.authorizationFingerprint=t.authorizationFingerprint,r}},{"./constants":132,"./create-authorization-data":136,"./json-clone":160}],125:[function(e,t,n){"use strict";var r=e("./promise"),s=e("./constants"),c=e("./add-metadata");t.exports={sendEvent:function(e,i,o){var a=Date.now();return r.resolve(e).then(function(e){var t=Date.now(),n=e.getConfiguration(),r=e._request,e=n.gatewayConfiguration.analytics.url,t={analytics:[{kind:s.ANALYTICS_PREFIX+i,isAsync:Math.floor(t/1e3)!==Math.floor(a/1e3),timestamp:a}]};r({url:e,method:"post",data:c(n,t),timeout:s.ANALYTICS_REQUEST_TIMEOUT_MS},o)})}}},{"./add-metadata":124,"./constants":132,"./promise":163}],126:[function(e,t,n){"use strict";e=e("@braintree/asset-loader/load-script");t.exports={loadScript:e}},{"@braintree/asset-loader/load-script":3}],127:[function(e,t,n){"use strict";var r="function"==typeof Object.assign?Object.assign:i;function i(e){for(var t,n,r=1;r<arguments.length;r++)for(n in t=arguments[r])t.hasOwnProperty(n)&&(e[n]=t[n]);return e}t.exports={assign:r,_assign:i}},{}],128:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./promise"),o=e("./errors");t.exports={verify:function(e){var t,n;return e?(n=e.name,t=e.client,e=e.authorization,t||e?e||"3.81.0"===t.getVersion()?i.resolve():i.reject(new r({type:o.INCOMPATIBLE_VERSIONS.type,code:o.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+t.getVersion()+") and "+n+" (version 3.81.0) components must be from the same SDK version."})):i.reject(new r({type:o.INSTANTIATION_OPTION_REQUIRED.type,code:o.INSTANTIATION_OPTION_REQUIRED.code,message:"options.client is required when instantiating "+n+"."}))):i.reject(new r({type:o.INVALID_USE_OF_INTERNAL_FUNCTION.type,code:o.INVALID_USE_OF_INTERNAL_FUNCTION.code,message:"Options must be passed to basicComponentVerification function."}))}}},{"./braintree-error":130,"./errors":141,"./promise":163}],129:[function(e,t,n){"use strict";var d=e("./once");t.exports=function(e,t){var n,r,i,o=e.length,a=o,s=d(t);if(0!==o)for(n=0;n<o;n++)r=e[n],i=c,0===r.length?(r(),i(null)):r(i);else s(null);function c(e){e?s(e):0===--a&&s(null)}}},{"./once":162}],130:[function(e,t,n){"use strict";e=e("./enumerate");function r(e){if(!r.types.hasOwnProperty(e.type))throw new Error(e.type+" is not a valid type.");if(!e.code)throw new Error("Error code required.");if(!e.message)throw new Error("Error message required.");this.name="BraintreeError",this.code=e.code,this.message=e.message,this.type=e.type,this.details=e.details}r.prototype=Object.create(Error.prototype),(r.prototype.constructor=r).types=e(["CUSTOMER","MERCHANT","NETWORK","INTERNAL","UNKNOWN"]),r.findRootError=function(e){return e instanceof r&&e.details&&e.details.originalError?r.findRootError(e.details.originalError):e},t.exports=r},{"./enumerate":140}],131:[function(e,t,n){"use strict";t.exports=function(n){return Object.keys(n).reduce(function(e,t){return e[t.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1_$2").toLowerCase()]=n[t],e},{})}},{}],132:[function(e,t,n){"use strict";t.exports={ANALYTICS_PREFIX:"web.",ANALYTICS_REQUEST_TIMEOUT_MS:2e3,ASSETS_URLS:{production:"https://assets.braintreegateway.com",sandbox:"https://assets.braintreegateway.com"},CLIENT_API_URLS:{production:"https://api.braintreegateway.com:443",sandbox:"https://api.sandbox.braintreegateway.com:443"},FRAUDNET_SOURCE:"BRAINTREE_SIGNIN",FRAUDNET_FNCLS:"fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99",FRAUDNET_URL:"https://c.paypal.com/da/r/fb.js",BUS_CONFIGURATION_REQUEST_EVENT:"BUS_CONFIGURATION_REQUEST",GRAPHQL_URLS:{production:"https://payments.braintree-api.com/graphql",sandbox:"https://payments.sandbox.braintree-api.com/graphql"},INTEGRATION_TIMEOUT_MS:6e4,VERSION:"3.81.0",INTEGRATION:"custom",SOURCE:"client",PLATFORM:"web",BRAINTREE_LIBRARY_VERSION:"braintree/web/3.81.0"}},{}],133:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./errors");t.exports=function(t,e){e.forEach(function(e){t[e]=function(){throw new r({type:i.METHOD_CALLED_AFTER_TEARDOWN.type,code:i.METHOD_CALLED_AFTER_TEARDOWN.code,message:e+" cannot be called after teardown."})}})}},{"./braintree-error":130,"./errors":141}],134:[function(e,t,n){"use strict";var r=e("./braintree-error");t.exports=function(e,t){return e instanceof r?e:new r({type:t.type,code:t.code,message:t.message,details:{originalError:e}})}},{"./braintree-error":130}],135:[function(e,t,n){"use strict";var r=e("./constants").ASSETS_URLS;t.exports={create:function(e){return r.production}}},{"./constants":132}],136:[function(e,t,n){"use strict";var i=e("../lib/vendor/polyfill").atob,o=e("../lib/constants").CLIENT_API_URLS;t.exports=function(e){var t,n,r={attrs:{},configUrl:""};return/^[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9_]+$/.test(e)?(t=(n=(t=e).split("_"))[0],t={merchantId:n.slice(2).join("_"),environment:t},r.environment=t.environment,r.attrs.tokenizationKey=e,r.configUrl=o[t.environment]+"/merchants/"+t.merchantId+"/client_api/v1/configuration"):(e=JSON.parse(i(e)),r.environment=e.environment,r.attrs.authorizationFingerprint=e.authorizationFingerprint,r.configUrl=e.configUrl,r.graphQL=e.graphQL),r}},{"../lib/constants":132,"../lib/vendor/polyfill":167}],137:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./promise"),o=e("./assets"),a=e("./errors"),s="3.81.0";t.exports={create:function(e){var t=i.resolve();return e.client?i.resolve(e.client):(t=!window.braintree||!window.braintree.client?o.loadScript({src:e.assetsUrl+"/web/"+s+"/js/client.min.js"}).catch(function(e){return i.reject(new r({type:a.CLIENT_SCRIPT_FAILED_TO_LOAD.type,code:a.CLIENT_SCRIPT_FAILED_TO_LOAD.code,message:a.CLIENT_SCRIPT_FAILED_TO_LOAD.message,details:{originalError:e}}))}):t).then(function(){return window.braintree.client.VERSION!==s?i.reject(new r({type:a.INCOMPATIBLE_VERSIONS.type,code:a.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+window.braintree.client.VERSION+") and "+e.name+" (version "+s+") components must be from the same SDK version."})):window.braintree.client.create({authorization:e.authorization,debug:e.debug})})}}},{"./assets":126,"./braintree-error":130,"./errors":141,"./promise":163}],138:[function(e,t,n){"use strict";t.exports=function(t){return function(){var e=arguments;setTimeout(function(){t.apply(null,e)},1)}}},{}],139:[function(e,t,n){"use strict";var r=e("./batch-execute-functions");function i(){this._teardownRegistry=[],this._isTearingDown=!1}i.prototype.registerFunctionForTeardown=function(e){"function"==typeof e&&this._teardownRegistry.push(e)},i.prototype.teardown=function(t){this._isTearingDown?t(new Error("Destructor is already tearing down")):(this._isTearingDown=!0,r(this._teardownRegistry,function(e){this._teardownRegistry=[],this._isTearingDown=!1,"function"==typeof t&&t(e)}.bind(this)))},t.exports=i},{"./batch-execute-functions":129}],140:[function(e,t,n){"use strict";t.exports=function(e,n){return n=null==n?"":n,e.reduce(function(e,t){return e[t]=n+t,e},{})}},{}],141:[function(e,t,n){"use strict";e=e("./braintree-error");t.exports={INVALID_USE_OF_INTERNAL_FUNCTION:{type:e.types.INTERNAL,code:"INVALID_USE_OF_INTERNAL_FUNCTION"},INSTANTIATION_OPTION_REQUIRED:{type:e.types.MERCHANT,code:"INSTANTIATION_OPTION_REQUIRED"},INCOMPATIBLE_VERSIONS:{type:e.types.MERCHANT,code:"INCOMPATIBLE_VERSIONS"},CLIENT_SCRIPT_FAILED_TO_LOAD:{type:e.types.NETWORK,code:"CLIENT_SCRIPT_FAILED_TO_LOAD",message:"Braintree client script could not be loaded."},METHOD_CALLED_AFTER_TEARDOWN:{type:e.types.MERCHANT,code:"METHOD_CALLED_AFTER_TEARDOWN"}}},{"./braintree-error":130}],142:[function(e,t,n){"use strict";t.exports=function(e){for(;e.parentNode;)e=e.parentNode;return e}},{}],143:[function(e,t,n){"use strict";t.exports=function(e,t,n){for(var r=0;r<e.length;r++)if(e[r].hasOwnProperty(t)&&e[r][t]===n)return e[r];return null}},{}],144:[function(e,t,n){"use strict";var r=e("./strategies/popup"),i=e("./strategies/popup-bridge"),o=e("./strategies/modal"),a=e("framebus"),s=e("../shared/events"),c=e("../shared/errors"),d=e("../shared/constants"),u=e("@braintree/uuid"),l=e("@braintree/iframer"),p=e("../../braintree-error"),_=e("../shared/browser-detection"),E=e("../../is-https"),h=e("./../../assign").assign,m=e("../../constants").BUS_CONFIGURATION_REQUEST_EVENT,f=["name","dispatchFrameUrl","openFrameUrl"];function y(){}function A(e){!function(t){if(!t)throw new Error("Valid configuration is required");if(f.forEach(function(e){if(!t.hasOwnProperty(e))throw new Error("A valid frame "+e+" must be provided")}),!/^[\w_]+$/.test(t.name))throw new Error("A valid frame name must be provided")}(e),this._serviceId=u().replace(/-/g,""),this._options={name:e.name+"_"+this._serviceId,dispatchFrameUrl:e.dispatchFrameUrl,openFrameUrl:e.openFrameUrl,height:e.height,width:e.width,top:e.top,left:e.left},this.state=e.state||{},this._bus=new a({channel:this._serviceId}),this._setBusEvents()}A.prototype.initialize=function(e){var t=function(){e(),this._bus.off(s.DISPATCH_FRAME_READY,t)}.bind(this);this._bus.on(s.DISPATCH_FRAME_READY,t),this._writeDispatchFrame()},A.prototype._writeDispatchFrame=function(){var e=d.DISPATCH_FRAME_NAME+"_"+this._serviceId,t=this._options.dispatchFrameUrl;this._dispatchFrame=l({"aria-hidden":!0,name:e,title:e,src:t,class:d.DISPATCH_FRAME_CLASS,height:0,width:0,style:{position:"absolute",left:"-9999px"}}),document.body.appendChild(this._dispatchFrame)},A.prototype._setBusEvents=function(){this._bus.on(s.DISPATCH_FRAME_REPORT,function(e,t){this._onCompleteCallback&&this._onCompleteCallback.call(null,e.err,e.payload),this._frame.close(),this._onCompleteCallback=null,t&&t()}.bind(this)),this._bus.on(m,function(e){e(this.state)}.bind(this))},A.prototype.open=function(e,t){if(this._frame=this._getFrameForEnvironment(e=e||{}),this._frame.initialize(t),!(this._frame instanceof i)){if(h(this.state,e.state),this._onCompleteCallback=t,this._frame.open(),this.isFrameClosed())return this._cleanupFrame(),void(t&&t(_.isIE()&&!E.isHTTPS()?new p(c.FRAME_SERVICE_FRAME_OPEN_FAILED_IE_BUG):new p(c.FRAME_SERVICE_FRAME_OPEN_FAILED)));this._pollForPopupClose()}},A.prototype.redirect=function(e){this._frame&&!this.isFrameClosed()&&this._frame.redirect(e)},A.prototype.close=function(){this.isFrameClosed()||this._frame.close()},A.prototype.focus=function(){this.isFrameClosed()||this._frame.focus()},A.prototype.createHandler=function(e){return e=e||{},{close:function(){e.beforeClose&&e.beforeClose(),this.close()}.bind(this),focus:function(){e.beforeFocus&&e.beforeFocus(),this.focus()}.bind(this)}},A.prototype.createNoopHandler=function(){return{close:y,focus:y}},A.prototype.teardown=function(){this.close(),this._dispatchFrame.parentNode.removeChild(this._dispatchFrame),this._dispatchFrame=null,this._cleanupFrame()},A.prototype.isFrameClosed=function(){return null==this._frame||this._frame.isClosed()},A.prototype._cleanupFrame=function(){this._frame=null,clearInterval(this._popupInterval),this._popupInterval=null},A.prototype._pollForPopupClose=function(){return this._popupInterval=setInterval(function(){this.isFrameClosed()&&(this._cleanupFrame(),this._onCompleteCallback&&this._onCompleteCallback(new p(c.FRAME_SERVICE_FRAME_CLOSED)))}.bind(this),d.POPUP_POLL_INTERVAL),this._popupInterval},A.prototype._getFrameForEnvironment=function(e){var t=_.supportsPopups(),n=Boolean(window.popupBridge),e=h({},this._options,e);return new(n?i:t?r:o)(e)},t.exports=A},{"../../braintree-error":130,"../../constants":132,"../../is-https":158,"../shared/browser-detection":151,"../shared/constants":152,"../shared/errors":153,"../shared/events":154,"./../../assign":127,"./strategies/modal":146,"./strategies/popup":149,"./strategies/popup-bridge":147,"@braintree/iframer":40,"@braintree/uuid":44,framebus:57}],145:[function(e,t,n){"use strict";var r=e("./frame-service");t.exports={create:function(e,t){var n=new r(e);n.initialize(function(){t(n)})}}},{"./frame-service":144}],146:[function(e,t,n){"use strict";var r=e("@braintree/iframer"),i=e("../../../assign").assign,o=e("../../shared/browser-detection"),a={position:"fixed",top:0,left:0,bottom:0,padding:0,margin:0,border:0,outline:"none",zIndex:20001,background:"#FFFFFF"};function s(){}function c(e){this._closed=null,this._frame=null,this._options=e||{},this._container=this._options.container||document.body}c.prototype.initialize=s,c.prototype.open=function(){var e={src:this._options.openFrameUrl,name:this._options.name,scrolling:"yes",height:"100%",width:"100%",style:i({},a),title:"Lightbox Frame"};o.isIos()?(o.isIosWKWebview()&&(this._lockScrolling(),e.style={}),this._el=document.createElement("div"),i(this._el.style,a,{height:"100%",width:"100%",overflow:"auto","-webkit-overflow-scrolling":"touch"}),this._frame=r(e),this._el.appendChild(this._frame)):this._el=this._frame=r(e),this._closed=!1,this._container.appendChild(this._el)},c.prototype.focus=s,c.prototype.close=function(){this._container.removeChild(this._el),this._frame=null,this._closed=!0,o.isIosWKWebview()&&this._unlockScrolling()},c.prototype.isClosed=function(){return Boolean(this._closed)},c.prototype.redirect=function(e){this._frame.src=e},c.prototype._unlockScrolling=function(){document.body.style.overflow=this._savedBodyProperties.overflowStyle,document.body.style.position=this._savedBodyProperties.positionStyle,window.scrollTo(this._savedBodyProperties.left,this._savedBodyProperties.top),delete this._savedBodyProperties},c.prototype._lockScrolling=function(){var e=document.documentElement;this._savedBodyProperties={left:(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0),top:(window.pageYOffset||e.scrollTop)-(e.clientTop||0),overflowStyle:document.body.style.overflow,positionStyle:document.body.style.position},document.body.style.overflow="hidden",document.body.style.position="fixed",window.scrollTo(0,0)},t.exports=c},{"../../../assign":127,"../../shared/browser-detection":151,"@braintree/iframer":40}],147:[function(e,t,n){"use strict";var o=e("../../../braintree-error"),a=e("../../shared/errors");function r(){}function i(e){this._closed=null,this._options=e}i.prototype.initialize=function(r){var i=this;window.popupBridge.onComplete=function(e,t){var n=!t&&!e;i._closed=!0,e||n?r(new o(a.FRAME_SERVICE_FRAME_CLOSED)):r(null,t)}},i.prototype.open=function(e){e=(e=e||{}).openFrameUrl||this._options.openFrameUrl;this._closed=!1,window.popupBridge.open(e)},i.prototype.focus=r,i.prototype.close=r,i.prototype.isClosed=function(){return Boolean(this._closed)},i.prototype.redirect=function(e){this.open({openFrameUrl:e})},t.exports=i},{"../../../braintree-error":130,"../../shared/errors":153}],148:[function(e,t,n){"use strict";var i=e("../../../shared/constants"),r=e("./position");function o(e,t,n){return void 0!==t?t:r[e](n)}t.exports=function(e){var t=e.height||i.DEFAULT_POPUP_HEIGHT,n=e.width||i.DEFAULT_POPUP_WIDTH,r=o("top",e.top,t),e=o("left",e.left,n);return[i.POPUP_BASE_OPTIONS,"height="+t,"width="+n,"top="+r,"left="+e].join(",")}},{"../../../shared/constants":152,"./position":150}],149:[function(e,t,n){"use strict";var r=e("./compose-options");function i(e){this._frame=null,this._options=e||{},this.open()}i.prototype.initialize=function(){},i.prototype.open=function(){this._frame=window.open(this._options.openFrameUrl,this._options.name,r(this._options))},i.prototype.focus=function(){this._frame.focus()},i.prototype.close=function(){this._frame.closed||this._frame.close()},i.prototype.isClosed=function(){return!this._frame||Boolean(this._frame.closed)},i.prototype.redirect=function(e){this._frame.location.href=e},t.exports=i},{"./compose-options":148}],150:[function(e,t,n){"use strict";function r(e,t,n){return(e-t)/2+n}t.exports={top:function(e){return((window.outerHeight||document.documentElement.clientHeight)-e)/2+(null==window.screenY?window.screenTop:window.screenY)},left:function(e){return((window.outerWidth||document.documentElement.clientWidth)-e)/2+(null==window.screenX?window.screenLeft:window.screenX)},center:r}},{}],151:[function(e,t,n){"use strict";t.exports={isIos:e("@braintree/browser-detection/is-ios"),isIosWKWebview:e("@braintree/browser-detection/is-ios-wkwebview"),isIE:e("@braintree/browser-detection/is-ie"),supportsPopups:e("@braintree/browser-detection/supports-popups")}},{"@braintree/browser-detection/is-ie":29,"@braintree/browser-detection/is-ios":35,"@braintree/browser-detection/is-ios-wkwebview":34,"@braintree/browser-detection/supports-popups":36}],152:[function(e,t,n){"use strict";t.exports={DISPATCH_FRAME_NAME:"dispatch",DISPATCH_FRAME_CLASS:"braintree-dispatch-frame",POPUP_BASE_OPTIONS:"resizable,scrollbars",DEFAULT_POPUP_WIDTH:450,DEFAULT_POPUP_HEIGHT:535,POPUP_POLL_INTERVAL:100,POPUP_CLOSE_TIMEOUT:100}},{}],153:[function(e,t,n){"use strict";e=e("../../braintree-error");t.exports={FRAME_SERVICE_FRAME_CLOSED:{type:e.types.INTERNAL,code:"FRAME_SERVICE_FRAME_CLOSED",message:"Frame closed before tokenization could occur."},FRAME_SERVICE_FRAME_OPEN_FAILED:{type:e.types.INTERNAL,code:"FRAME_SERVICE_FRAME_OPEN_FAILED",message:"Frame failed to open."},FRAME_SERVICE_FRAME_OPEN_FAILED_IE_BUG:{type:e.types.INTERNAL,code:"FRAME_SERVICE_FRAME_OPEN_FAILED_IE_BUG",message:"Could not open frame. This may be due to a bug in IE browsers when attempting to open an HTTPS page from a HTTP page. https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11324352/"}}},{"../../braintree-error":130}],154:[function(e,t,n){"use strict";e=e("../../enumerate");t.exports=e(["DISPATCH_FRAME_READY","DISPATCH_FRAME_REPORT"],"frameService:")},{"../../enumerate":140}],155:[function(e,t,n){"use strict";var r=e("./assign").assign;function s(e,t){var n=e.analyticsMetadata,n={gateway:"braintree","braintree:merchantId":e.gatewayConfiguration.merchantId,"braintree:apiVersion":"v1","braintree:sdkVersion":"3.81.0","braintree:metadata":JSON.stringify({source:n.source,integration:n.integration,sessionId:n.sessionId,version:"3.81.0",platform:n.platform})};return r({},n,t)}t.exports=function(e,t,n){var r,i,o=e.gatewayConfiguration.androidPay,a="production"===e.gatewayConfiguration.environment?"PRODUCTION":"TEST";return 2===t?(r={apiVersion:2,apiVersionMinor:0,environment:a,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:o.supportedNetworks.map(function(e){return e.toUpperCase()})},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:s(e,{"braintree:authorizationFingerprint":o.googleAuthorizationFingerprint})}}]},n&&(r.merchantInfo={merchantId:n}),o.paypalClientId&&(i={type:"PAYPAL",parameters:{purchase_context:{purchase_units:[{payee:{client_id:o.paypalClientId},recurring_payment:!0}]}},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:s(e,{"braintree:paypalClientId":o.paypalClientId})}},r.allowedPaymentMethods.push(i))):(r={environment:a,allowedPaymentMethods:["CARD","TOKENIZED_CARD"],paymentMethodTokenizationParameters:{tokenizationType:"PAYMENT_GATEWAY",parameters:s(e,{"braintree:authorizationFingerprint":o.googleAuthorizationFingerprint})},cardRequirements:{allowedCardNetworks:o.supportedNetworks.map(function(e){return e.toUpperCase()})}},"TOKENIZATION_KEY"===e.authorizationType&&(r.paymentMethodTokenizationParameters.parameters["braintree:clientKey"]=e.authorization),n&&(r.merchantId=n),t&&(r.apiVersion=t)),r}},{"./assign":127}],156:[function(e,t,n){"use strict";t.exports=function(e){e=e||window;try{return e.self!==e.top}catch(e){return!0}}},{}],157:[function(e,t,n){"use strict";function r(e){e=e.split("-");return new Date(e[0],e[1],e[2])}t.exports=function(e,t){return r(e)<=r(t)}},{}],158:[function(e,t,n){"use strict";t.exports={isHTTPS:function(e){return"https:"===(e=e||window.location.protocol)}}},{}],159:[function(e,t,n){"use strict";var r,i={"paypal.com":1,"braintreepayments.com":1,"braintreegateway.com":1,"braintree-api.com":1};t.exports=function(e){return e=e.toLowerCase(),!!/^https:/.test(e)&&((r=r||document.createElement("a")).href=e,e=r.hostname.split(".").slice(-2).join("."),i.hasOwnProperty(e))}},{}],160:[function(e,t,n){"use strict";t.exports=function(e){return JSON.parse(JSON.stringify(e))}},{}],161:[function(e,t,n){"use strict";t.exports=function(t){return Object.keys(t).filter(function(e){return"function"==typeof t[e]})}},{}],162:[function(e,t,n){"use strict";t.exports=function(e){var t=!1;return function(){t||(t=!0,e.apply(null,arguments))}}},{}],163:[function(e,t,n){"use strict";var r=e("promise-polyfill"),e=e("@braintree/extended-promise"),r="undefined"!=typeof Promise?Promise:r;e.suppressUnhandledPromiseMessage=!0,e.setPromise(r),t.exports=r},{"@braintree/extended-promise":39,"promise-polyfill":70}],164:[function(e,t,n){"use strict";function r(e){return e=e||window.location.href,/\?/.test(e)}function a(e,t){var n,r,i,o=[];for(r in e)e.hasOwnProperty(r)&&(n=e[r],i=t?(i=e)&&"object"==typeof i&&"number"==typeof i.length&&"[object Array]"===Object.prototype.toString.call(i)?t+"[]":t+"["+r+"]":r,"object"==typeof n?o.push(a(n,i)):o.push(encodeURIComponent(i)+"="+encodeURIComponent(n)));return o.join("&")}t.exports={parse:function(e){return r(e=e||window.location.href)?e.replace(/#.*$/,"").replace(/^.*\?/,"").split("&").reduce(function(e,t){var n=t.split("="),t=decodeURIComponent(n[0]),n=decodeURIComponent(n[1]);return e[t]=n,e},{}):{}},stringify:a,queryify:function(e,t){return e=e||"",null!=t&&"object"==typeof t&&function(e){for(var t in e)if(e.hasOwnProperty(t))return 1}(t)&&(e+=-1===e.indexOf("?")?"?":"",e+=-1!==e.indexOf("=")?"&":"",e+=a(t)),e},hasQueryParams:r}},{}],165:[function(e,t,n){"use strict";var c=e("@braintree/uuid"),d=e("./find-root-node");function u(e){return"[object ShadowRoot]"===(e=d(e)).toString()}function l(e){return u(e=d(e))?e.host:null}t.exports={isShadowElement:u,getShadowHost:l,transformToSlot:function e(t,n){var r=d(t).querySelector("style"),i=l(t),o="shadow-slot-"+c(),a=document.createElement("slot"),s=document.createElement("div");return a.setAttribute("name",o),t.appendChild(a),s.setAttribute("slot",o),i.appendChild(s),n&&(r||(r=document.createElement("style"),t.appendChild(r)),r.sheet.insertRule('::slotted([slot="'+o+'"]) { '+n+" }")),u(i)?e(s,n):s}}},{"./find-root-node":142,"@braintree/uuid":44}],166:[function(e,t,n){"use strict";t.exports=function(e){return e?"":".min"}},{}],167:[function(e,t,n){"use strict";var r="function"==typeof atob?atob:i;function i(e){var t,n,r,i,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="";if(!new RegExp("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})([=]{1,2})?$").test(e))throw new Error("Non base64 encoded input passed to window.atob polyfill");for(o=0;n=a.indexOf(e.charAt(o++)),t=(15&(r=a.indexOf(e.charAt(o++))))<<4|(i=a.indexOf(e.charAt(o++)))>>2&15,i=(3&i)<<6|63&a.indexOf(e.charAt(o++)),s+=String.fromCharCode((63&n)<<2|r>>4&3)+(t?String.fromCharCode(t):"")+(i?String.fromCharCode(i):""),o<e.length;);return s}t.exports={atob:function(e){return r.call(window,e)},_atob:i}},{}],168:[function(e,t,n){"use strict";t.exports={REQUIRED_OPTIONS_FOR_START_PAYMENT:["onPaymentStart","paymentType","amount","fallback"]}},{}],169:[function(e,t,n){"use strict";var o=e("../../lib/frame-service/external"),a=e("../../lib/braintree-error"),s=e("../../lib/use-min"),c=e("../../lib/constants").INTEGRATION_TIMEOUT_MS,d=e("../../lib/analytics"),r=e("../../lib/methods"),i=e("../../lib/convert-methods-to-error"),u=e("../../lib/convert-to-braintree-error"),l=e("../../lib/promise"),p=e("@braintree/extended-promise"),_=e("../../lib/querystring"),E=e("@braintree/wrap-promise"),h=e("./constants"),m=e("../shared/errors");function f(e){this._client=e.client,this._assetsUrl=e.client.getConfiguration().gatewayConfiguration.assetsUrl+"/web/3.81.0",this._isDebug=e.client.getConfiguration().isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/local-payment-landing-frame"+s(this._isDebug)+".html",this._authorizationInProgress=!1,this._paymentType="unknown",this._merchantAccountId=e.merchantAccountId}f.prototype._initialize=function(){var n=this,r=this._client,i=setTimeout(function(){d.sendEvent(r,"local-payment.load.timed-out")},c);return new l(function(t){o.create({name:"localpaymentlandingpage",dispatchFrameUrl:n._assetsUrl+"/html/dispatch-frame"+s(n._isDebug)+".html",openFrameUrl:n._loadingFrameUrl},function(e){n._frameService=e,clearTimeout(i),d.sendEvent(r,"local-payment.load.succeeded"),t(n)})})},f.prototype.startPayment=function(t){var e,n,r=this,i=this._frameService._serviceId,o=t.windowOptions||{};return function(e){var t,n;if(!e)return!0;for(t=0;t<h.REQUIRED_OPTIONS_FOR_START_PAYMENT.length;t++)if(n=h.REQUIRED_OPTIONS_FOR_START_PAYMENT[t],!e.hasOwnProperty(n))return!0;return!e.fallback.url||!e.fallback.buttonText}(t)?l.reject(new a(m.LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION)):(e=t.address||{},e={intent:"sale",returnUrl:_.queryify(r._assetsUrl+"/html/local-payment-redirect-frame"+s(r._isDebug)+".html",{channel:i,r:t.fallback.url,t:t.fallback.buttonText}),cancelUrl:_.queryify(r._assetsUrl+"/html/local-payment-redirect-frame"+s(r._isDebug)+".html",{channel:i,r:t.fallback.cancelUrl||t.fallback.url,t:t.fallback.cancelButtonText||t.fallback.buttonText,c:1}),experienceProfile:{noShipping:!t.shippingAddressRequired},fundingSource:t.paymentType,paymentTypeCountryCode:t.paymentTypeCountryCode,amount:t.amount,currencyIsoCode:t.currencyCode,firstName:t.givenName,lastName:t.surname,payerEmail:t.email,phone:t.phone,line1:e.streetAddress,line2:e.extendedAddress,city:e.locality,state:e.region,postalCode:e.postalCode,countryCode:e.countryCode,merchantAccountId:r._merchantAccountId,bic:t.bic},r._paymentType=t.paymentType.toLowerCase(),r._authorizationInProgress?(d.sendEvent(r._client,r._paymentType+".local-payment.start-payment.error.already-opened"),l.reject(new a(m.LOCAL_PAYMENT_ALREADY_IN_PROGRESS))):(r._authorizationInProgress=!0,n=new p,r._startPaymentCallback=r._createStartPaymentCallback(function(e){n.resolve(e)},function(e){n.reject(e)}),r._frameService.open({width:o.width||1282,height:o.height||720},r._startPaymentCallback),r._client.request({method:"post",endpoint:"local_payments/create",data:e}).then(function(e){d.sendEvent(r._client,r._paymentType+".local-payment.start-payment.opened"),(r._startPaymentOptions=t).onPaymentStart({paymentId:e.paymentResource.paymentToken},function(){r._frameService.redirect(e.paymentResource.redirectUrl)})}).catch(function(e){var t=e.details&&e.details.httpStatus;r._frameService.close(),r._authorizationInProgress=!1,422!==t?n.reject(u(e,{type:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.type,code:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.code,message:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.message})):n.reject(new a({type:m.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.type,code:m.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.code,message:m.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.message,details:{originalError:e}}))}),n))},f.prototype.tokenize=function(e){var t=this,n=this._client;return(e=e||_.parse()).c||e.wasCanceled?l.reject(new a({type:m.LOCAL_PAYMENT_CANCELED.type,code:m.LOCAL_PAYMENT_CANCELED.code,message:m.LOCAL_PAYMENT_CANCELED.message,details:{originalError:{errorcode:e.errorcode,token:e.btLpToken}}})):e.errorcode?l.reject(new a({type:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.type,code:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.code,message:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.message,details:{originalError:{errorcode:e.errorcode,token:e.btLpToken}}})):n.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:this._formatTokenizeData(e)}).then(function(e){e=t._formatTokenizePayload(e);return window.popupBridge?d.sendEvent(n,t._paymentType+".local-payment.tokenization.success-popupbridge"):d.sendEvent(n,t._paymentType+".local-payment.tokenization.success"),e}).catch(function(e){return d.sendEvent(n,t._paymentType+".local-payment.tokenization.failed"),l.reject(u(e,{type:m.LOCAL_PAYMENT_TOKENIZATION_FAILED.type,code:m.LOCAL_PAYMENT_TOKENIZATION_FAILED.code,message:m.LOCAL_PAYMENT_TOKENIZATION_FAILED.message}))})},f.prototype.closeWindow=function(){this._authoriztionInProgress&&d.sendEvent(this._client,this._paymentType+".local-payment.start-payment.closed.by-merchant"),this._frameService.close()},f.prototype.focusWindow=function(){this._frameService.focus()},f.prototype._createStartPaymentCallback=function(n,r){var i=this,o=this._client;return function(e,t){if(i._authorizationInProgress=!1,e)if("FRAME_SERVICE_FRAME_CLOSED"===e.code){if(t&&"processing_error"===t.errorcode)return d.sendEvent(o,i._paymentType+".local-payment.failed-in-window"),void r(new a(m.LOCAL_PAYMENT_START_PAYMENT_FAILED));d.sendEvent(o,i._paymentType+".local-payment.tokenization.closed.by-user"),r(new a(m.LOCAL_PAYMENT_WINDOW_CLOSED))}else e.code&&-1<e.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")&&r(new a({code:m.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.code,type:m.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.type,message:m.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.message,details:{originalError:e}}));else t&&(window.popupBridge||i._frameService.redirect(i._loadingFrameUrl),i.tokenize(t).then(n).catch(r).then(function(){i._frameService.close()}))}},f.prototype._formatTokenizePayload=function(e){var t={},e={nonce:(t=e.paypalAccounts?e.paypalAccounts[0]:t).nonce,details:{},type:t.type};return t.details&&(t.details.payerInfo&&(e.details=t.details.payerInfo),t.details.correlationId&&(e.correlationId=t.details.correlationId)),e},f.prototype.hasTokenizationParams=function(){var e=_.parse();return!!e.errorcode||Boolean(e.btLpToken&&e.btLpPaymentId&&e.btLpPayerId)},f.prototype._formatTokenizeData=function(e){var t=this._client.getConfiguration().gatewayConfiguration;return{merchantAccountId:this._merchantAccountId,paypalAccount:{correlationId:e.btLpToken||e.token,paymentToken:e.btLpPaymentId||e.paymentId,payerId:e.btLpPayerId||e.PayerID,unilateral:t.paypal.unvettedMerchant,intent:"sale"}}},f.prototype.teardown=function(){return this._frameService.teardown(),i(this,r(f.prototype)),d.sendEvent(this._client,"local-payment.teardown-completed"),l.resolve()},t.exports=E.wrapPrototype(f)},{"../../lib/analytics":125,"../../lib/braintree-error":130,"../../lib/constants":132,"../../lib/convert-methods-to-error":133,"../../lib/convert-to-braintree-error":134,"../../lib/frame-service/external":145,"../../lib/methods":161,"../../lib/promise":163,"../../lib/querystring":164,"../../lib/use-min":166,"../shared/errors":171,"./constants":168,"@braintree/extended-promise":39,"@braintree/wrap-promise":48}],170:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("./external/local-payment"),c=e("../lib/promise"),d=e("@braintree/wrap-promise"),u=e("../lib/braintree-error"),l=e("./shared/errors");t.exports={create:d(function(n){var e="Local Payment";return i.verify({name:e,client:n.client,authorization:n.authorization}).then(function(){return o.create({authorization:n.authorization,client:n.client,debug:n.debug,assetsUrl:a.create(n.authorization),name:e})}).then(function(e){var t=e.getConfiguration();return n.client=e,!0!==t.gatewayConfiguration.paypalEnabled?c.reject(new u(l.LOCAL_PAYMENT_NOT_ENABLED)):(r.sendEvent(e,"local-payment.initialized"),new s(n)._initialize())})}),VERSION:"3.81.0"}},{"../lib/analytics":125,"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"./external/local-payment":169,"./shared/errors":171,"@braintree/wrap-promise":48}],171:[function(e,t,n){"use strict";e=e("../../lib/braintree-error");t.exports={LOCAL_PAYMENT_NOT_ENABLED:{type:e.types.MERCHANT,code:"LOCAL_PAYMENT_NOT_ENABLED",message:"LocalPayment is not enabled for this merchant."},LOCAL_PAYMENT_ALREADY_IN_PROGRESS:{type:e.types.MERCHANT,code:"LOCAL_PAYMENT_ALREADY_IN_PROGRESS",message:"LocalPayment payment is already in progress."},LOCAL_PAYMENT_CANCELED:{type:e.types.CUSTOMER,code:"LOCAL_PAYMENT_CANCELED",message:"Customer canceled the LocalPayment before authorizing."},LOCAL_PAYMENT_WINDOW_CLOSED:{type:e.types.CUSTOMER,code:"LOCAL_PAYMENT_WINDOW_CLOSED",message:"Customer closed LocalPayment window before authorizing."},LOCAL_PAYMENT_WINDOW_OPEN_FAILED:{type:e.types.MERCHANT,code:"LOCAL_PAYMENT_WINDOW_OPEN_FAILED",message:"LocalPayment window failed to open; make sure startPayment was called in response to a user action."},LOCAL_PAYMENT_START_PAYMENT_FAILED:{type:e.types.NETWORK,code:"LOCAL_PAYMENT_START_PAYMENT_FAILED",message:"LocalPayment startPayment failed."},LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION:{type:e.types.MERCHANT,code:"LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION",message:"Missing required option for startPayment."},LOCAL_PAYMENT_TOKENIZATION_FAILED:{type:e.types.NETWORK,code:"LOCAL_PAYMENT_TOKENIZATION_FAILED",message:"Could not tokenize user's local payment method."},LOCAL_PAYMENT_INVALID_PAYMENT_OPTION:{type:e.types.MERCHANT,code:"LOCAL_PAYMENT_INVALID_PAYMENT_OPTION",message:"Local payment options are invalid."}}},{"../../lib/braintree-error":130}],172:[function(e,t,n){"use strict";var i=e("../../lib/promise"),o=e("../../lib/frame-service/external"),a=e("../../lib/braintree-error"),s=e("../shared/errors"),r=e("../../lib/methods"),c=e("@braintree/wrap-promise"),d=e("../../lib/analytics"),u=e("../../lib/convert-methods-to-error"),l=e("../../lib/convert-to-braintree-error"),p=e("../shared/constants"),_=e("../../lib/constants").INTEGRATION_TIMEOUT_MS;function E(e){var t=e.client.getConfiguration();this._client=e.client,this._assetsUrl=t.gatewayConfiguration.assetsUrl+"/web/3.81.0",this._isDebug=t.isDebug,this._authInProgress=!1,window.popupBridge&&"function"==typeof window.popupBridge.getReturnUrlPrefix?this._callbackUrl=window.popupBridge.getReturnUrlPrefix()+"return":this._callbackUrl=this._assetsUrl+"/html/redirect-frame"+(this._isDebug?"":".min")+".html"}E.prototype._initialize=function(){var r=this;return new i(function(t){var n=setTimeout(function(){d.sendEvent(r._client,"masterpass.load.timed-out")},_);o.create({name:p.LANDING_FRAME_NAME,height:p.POPUP_HEIGHT,width:p.POPUP_WIDTH,dispatchFrameUrl:r._assetsUrl+"/html/dispatch-frame"+(r._isDebug?"":".min")+".html",openFrameUrl:r._assetsUrl+"/html/masterpass-landing-frame"+(r._isDebug?"":".min")+".html"},function(e){r._frameService=e,clearTimeout(n),d.sendEvent(r._client,"masterpass.load.succeeded"),t(r)})})},E.prototype.tokenize=function(n){var r=this;return!n||function(e){var t,n;for(t=0;t<p.REQUIRED_OPTIONS_FOR_TOKENIZE.length;t++)if(n=p.REQUIRED_OPTIONS_FOR_TOKENIZE[t],!e.hasOwnProperty(n))return!0;return!1}(n)?i.reject(new a(s.MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION)):r._authInProgress?i.reject(new a(s.MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS)):new i(function(e,t){r._navigateFrameToLoadingPage(n).catch(t),r._frameService.open(n.frameOptions,r._createFrameOpenHandler(e,t))})},E.prototype._navigateFrameToLoadingPage=function(o){var a=this;return this._authInProgress=!0,this._client.request({method:"post",endpoint:"masterpass/request_token",data:{requestToken:{originUrl:window.location.protocol+"//"+window.location.hostname,subtotal:o.subtotal,currencyCode:o.currencyCode,callbackUrl:this._callbackUrl}}}).then(function(e){var t=a._assetsUrl+"/html/masterpass-loading-frame"+(a._isDebug?"":".min")+".html?",n=a._client.getConfiguration().gatewayConfiguration,r=o.config||{},i={environment:n.environment,requestToken:e.requestToken,callbackUrl:a._callbackUrl,merchantCheckoutId:n.masterpass.merchantCheckoutId,allowedCardTypes:n.masterpass.supportedNetworks,version:p.MASTERPASS_VERSION};Object.keys(r).forEach(function(e){"function"!=typeof r[e]&&(i[e]=r[e])}),t+=Object.keys(i).map(function(e){return e+"="+i[e]}).join("&"),a._frameService.redirect(t)}).catch(function(e){var t=e.details&&e.details.httpStatus;return a._closeWindow(),422===t?i.reject(l(e,s.MASTERPASS_INVALID_PAYMENT_OPTION)):i.reject(l(e,s.MASTERPASS_FLOW_FAILED))})},E.prototype._createFrameOpenHandler=function(n,r){var i=this;return window.popupBridge?function(e,t){return i._authInProgress=!1,e?(d.sendEvent(i._client,"masterpass.tokenization.closed-popupbridge.by-user"),void r(l(e,s.MASTERPASS_POPUP_CLOSED))):t.queryItems?void i._tokenizeMasterpass(t.queryItems).then(n).catch(r):(d.sendEvent(i._client,"masterpass.tokenization.failed-popupbridge"),void r(new a(s.MASTERPASS_FLOW_FAILED)))}:function(e,t){if(e)return i._authInProgress=!1,"FRAME_SERVICE_FRAME_CLOSED"===e.code?(d.sendEvent(i._client,"masterpass.tokenization.closed.by-user"),void r(new a(s.MASTERPASS_POPUP_CLOSED))):e.code&&-1<e.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")?(d.sendEvent(i._client,"masterpass.tokenization.failed.to-open"),void r(new a({code:s.MASTERPASS_POPUP_OPEN_FAILED.code,type:s.MASTERPASS_POPUP_OPEN_FAILED.type,message:s.MASTERPASS_POPUP_OPEN_FAILED.message,details:{originalError:e}}))):(d.sendEvent(i._client,"masterpass.tokenization.failed"),i._closeWindow(),void r(l(e,s.MASTERPASS_FLOW_FAILED)));i._tokenizeMasterpass(t).then(n).catch(r)}},E.prototype._tokenizeMasterpass=function(e){var t=this;return"success"!==e.mpstatus?(d.sendEvent(t._client,"masterpass.tokenization.closed.by-user"),t._closeWindow(),i.reject(new a(s.MASTERPASS_POPUP_CLOSED))):[e.oauth_verifier,e.oauth_token,e.checkout_resource_url].some(function(e){return null==e||"null"===e})?(d.sendEvent(t._client,"masterpass.tokenization.closed.missing-payload"),t._closeWindow(),i.reject(new a(s.MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS))):t._client.request({endpoint:"payment_methods/masterpass_cards",method:"post",data:{masterpassCard:{checkoutResourceUrl:e.checkout_resource_url,requestToken:e.oauth_token,verifierToken:e.oauth_verifier}}}).then(function(e){return t._closeWindow(),window.popupBridge?d.sendEvent(t._client,"masterpass.tokenization.success-popupbridge"):d.sendEvent(t._client,"masterpass.tokenization.success"),e.masterpassCards[0]}).catch(function(e){return t._closeWindow(),window.popupBridge?d.sendEvent(t._client,"masterpass.tokenization.failed-popupbridge"):d.sendEvent(t._client,"masterpass.tokenization.failed"),i.reject(l(e,s.MASTERPASS_ACCOUNT_TOKENIZATION_FAILED))})},E.prototype._closeWindow=function(){this._authInProgress=!1,this._frameService.close()},E.prototype.teardown=function(){var t=this;return new i(function(e){t._frameService.teardown(),u(t,r(E.prototype)),d.sendEvent(t._client,"masterpass.teardown-completed"),e()})},t.exports=c.wrapPrototype(E)},{"../../lib/analytics":125,"../../lib/braintree-error":130,"../../lib/constants":132,"../../lib/convert-methods-to-error":133,"../../lib/convert-to-braintree-error":134,"../../lib/frame-service/external":145,"../../lib/methods":161,"../../lib/promise":163,"../shared/constants":175,"../shared/errors":176,"@braintree/wrap-promise":48}],173:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("../lib/basic-component-verification"),o=e("./shared/browser-detection"),a=e("./external/masterpass"),s=e("../lib/create-deferred-client"),c=e("../lib/create-assets-url"),d=e("./shared/errors"),u=e("../lib/promise"),e=e("@braintree/wrap-promise");function l(){return Boolean(window.popupBridge||o.supportsPopups())}t.exports={create:e(function(t){var e="Masterpass";return i.verify({name:e,client:t.client,authorization:t.authorization}).then(function(){return l()?u.resolve():u.reject(new r(d.MASTERPASS_BROWSER_NOT_SUPPORTED))}).then(function(){return s.create({authorization:t.authorization,client:t.client,debug:t.debug,assetsUrl:c.create(t.authorization),name:e})}).then(function(e){return t.client=e,t.client.getConfiguration().gatewayConfiguration.masterpass?new a(t)._initialize():u.reject(new r(d.MASTERPASS_NOT_ENABLED))})}),isSupported:l,VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"./external/masterpass":172,"./shared/browser-detection":174,"./shared/errors":176,"@braintree/wrap-promise":48}],174:[function(e,t,n){"use strict";t.exports={supportsPopups:e("@braintree/browser-detection/supports-popups")}},{"@braintree/browser-detection/supports-popups":36}],175:[function(e,t,n){"use strict";t.exports={LANDING_FRAME_NAME:"braintreemasterpasslanding",POPUP_WIDTH:450,POPUP_HEIGHT:660,MASTERPASS_VERSION:"v6",REQUIRED_OPTIONS_FOR_TOKENIZE:["subtotal","currencyCode"]}},{}],176:[function(e,t,n){"use strict";e=e("../../lib/braintree-error");t.exports={MASTERPASS_BROWSER_NOT_SUPPORTED:{type:e.types.CUSTOMER,code:"MASTERPASS_BROWSER_NOT_SUPPORTED",message:"Browser is not supported."},MASTERPASS_NOT_ENABLED:{type:e.types.MERCHANT,code:"MASTERPASS_NOT_ENABLED",message:"Masterpass is not enabled for this merchant."},MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION:{type:e.types.MERCHANT,code:"MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION",message:"Missing required option for tokenize."},MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS:{type:e.types.MERCHANT,code:"MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS",message:"Masterpass tokenization is already in progress."},MASTERPASS_ACCOUNT_TOKENIZATION_FAILED:{type:e.types.NETWORK,code:"MASTERPASS_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's Masterpass account."},MASTERPASS_POPUP_OPEN_FAILED:{type:e.types.MERCHANT,code:"MASTERPASS_POPUP_OPEN_FAILED",message:"Masterpass popup failed to open. Make sure to tokenize in response to a user action, such as a click."},MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS:{type:e.types.MERCHANT,code:"MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS",message:"Masterpass popup failed to return all required parameters needed to continue tokenization."},MASTERPASS_POPUP_CLOSED:{type:e.types.CUSTOMER,code:"MASTERPASS_POPUP_CLOSED",message:"Customer closed Masterpass popup before authorizing."},MASTERPASS_INVALID_PAYMENT_OPTION:{type:e.types.MERCHANT,code:"MASTERPASS_INVALID_PAYMENT_OPTION",message:"Masterpass payment options are invalid."},MASTERPASS_FLOW_FAILED:{type:e.types.NETWORK,code:"MASTERPASS_FLOW_FAILED",message:"Could not initialize Masterpass flow."}}},{"../../lib/braintree-error":130}],177:[function(e,t,n){"use strict";var a=e("../../lib/analytics"),r=e("../../lib/assign").assign,i=e("framebus"),o=e("../../lib/convert-methods-to-error"),s=e("../../lib/generate-google-pay-configuration"),c=e("@braintree/iframer"),d=e("@braintree/uuid"),u=e("../../lib/use-min"),l=e("../../lib/methods"),p=e("../../lib/promise"),_=e("@braintree/event-emitter"),E=e("../../lib/braintree-error"),h=e("../shared/constants"),m=h.events,f=h.errors,e=e("@braintree/wrap-promise"),y={Visa:"visa",MasterCard:"mastercard","American Express":"amex","Diners Club":"diners",Discover:"discover",JCB:"jcb",UnionPay:"unionpay",Maestro:"maestro"};function A(e){var t=e.enabledPaymentMethods||{};_.call(this),this._componentId=d(),this._client=e.client,this._enabledPaymentMethods={basicCard:!1!==t.basicCard,googlePay:!1!==t.googlePay},this._googlePayVersion=2===e.googlePayVersion?2:1,this._googleMerchantId="18278000977346790994",this._supportedPaymentMethods=this._constructDefaultSupportedPaymentMethods(),this._defaultSupportedPaymentMethods=Object.keys(this._supportedPaymentMethods).map(function(e){return this._supportedPaymentMethods[e]}.bind(this)),this._bus=new i({channel:this._componentId})}_.createChild(A),A.prototype._constructDefaultSupportedPaymentMethods=function(){var e=this._client.getConfiguration(),t=e.gatewayConfiguration.androidPay,n=e.gatewayConfiguration.creditCards,r={};return this._enabledPaymentMethods.basicCard&&n&&0<n.supportedCardTypes.length&&(r.basicCard={supportedMethods:"basic-card",data:{supportedNetworks:n.supportedCardTypes.reduce(function(e,t){return t in y&&e.push(y[t]),e},[])}}),this._enabledPaymentMethods.googlePay&&t&&t.enabled&&(r.googlePay={supportedMethods:"https://google.com/pay",data:s(e,this._googlePayVersion,this._googleMerchantId)}),r},A.prototype.initialize=function(){var i=this._client.getConfiguration(),o=this;return this._frame=c({allowPaymentRequest:!0,name:"braintree-payment-request-frame",class:"braintree-payment-request-frame",height:0,width:0,style:{position:"absolute",left:"-9999px"},title:"Secure Payment Frame"}),0===this._defaultSupportedPaymentMethods.length?p.reject(new E(f.PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS)):new p(function(e){var t,n,r;o._bus.on(m.FRAME_READY,function(e){e(o._client)}),o._bus.on(m.FRAME_CAN_MAKE_REQUESTS,function(){a.sendEvent(o._client,"payment-request.initialized"),o._bus.on(m.SHIPPING_ADDRESS_CHANGE,function(e){e={target:{shippingAddress:e},updateWith:function(e){o._bus.emit(m.UPDATE_SHIPPING_ADDRESS,e)}};o._emit("shippingAddressChange",e),o._emit("shippingaddresschange",e)}),o._bus.on(m.SHIPPING_OPTION_CHANGE,function(e){e={target:{shippingOption:e},updateWith:function(e){o._bus.emit(m.UPDATE_SHIPPING_OPTION,e)}};o._emit("shippingOptionChange",e),o._emit("shippingoptionchange",e)}),e(o)}),o._frame.src=(t=i.gatewayConfiguration.assetsUrl,n=o._componentId,r=i.isDebug,t+"/web/3.81.0/html/payment-request-frame"+u(r)+".html#"+n),document.body.appendChild(o._frame)})},A.prototype.createSupportedPaymentMethodsConfiguration=function(e,t){if(!e)throw new E(f.PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE);if(!this._enabledPaymentMethods[e])throw new E(f.PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED);return(e=r({},this._supportedPaymentMethods[e])).data=r({},e.data,t),e},A.prototype.tokenize=function(e){var i=this;return new p(function(n,r){i._bus.emit(m.PAYMENT_REQUEST_INITIALIZED,{supportedPaymentMethods:e.supportedPaymentMethods||i._defaultSupportedPaymentMethods,details:e.details,options:e.options},function(e){var t=e[0],e=e[1];t?r(i._formatTokenizationError(t)):(a.sendEvent(i._client,"payment-request.tokenize.succeeded"),n({nonce:e.nonce,type:e.type,description:e.description,details:{rawPaymentResponse:e.details.rawPaymentResponse,cardType:e.details.cardType,lastFour:e.details.lastFour,lastTwo:e.details.lastTwo},binData:e.binData}))})})},A.prototype.canMakePayment=function(e){var t,i=this;return window.PaymentRequest?e.supportedPaymentMethods&&(e.supportedPaymentMethods.forEach(function(e){e=e.supportedMethods;e in h.SUPPORTED_METHODS||(t=e)}),t)?p.reject(new E({type:f.PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD.type,code:f.PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD.code,message:t+" is not a supported payment method."})):new p(function(n,r){i._bus.emit(m.CAN_MAKE_PAYMENT,{supportedPaymentMethods:e.supportedPaymentMethods||i._defaultSupportedPaymentMethods,details:e.details,options:e.options},function(e){var t=e[0],e=e[1];t?r(i._formatCanMakePaymentError(t)):(a.sendEvent(i._client,"payment-request.can-make-payment."+e),n(e))})}):(a.sendEvent(i._client,"payment-request.can-make-payment.not-available"),p.resolve(!1))},A.prototype.teardown=function(){return this._bus.teardown(),this._frame.parentNode.removeChild(this._frame),o(this,l(A.prototype)),a.sendEvent(this._client,"payment-request.teardown-completed"),p.resolve()},A.prototype._formatTokenizationError=function(e){var t;switch(e.name){case"AbortError":return t=new E({type:f.PAYMENT_REQUEST_CANCELED.type,code:f.PAYMENT_REQUEST_CANCELED.code,message:f.PAYMENT_REQUEST_CANCELED.message,details:{originalError:e}}),a.sendEvent(this._client,"payment-request.tokenize.canceled"),t;case"PAYMENT_REQUEST_INITIALIZATION_FAILED":t=new E({type:f.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.type,code:f.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.code,message:f.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.message,details:{originalError:e}});break;case"BRAINTREE_GATEWAY_GOOGLE_PAYMENT_TOKENIZATION_ERROR":t=new E({type:f.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.type,code:f.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.code,message:f.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.message,details:{originalError:e}});break;case"BRAINTREE_GATEWAY_GOOGLE_PAYMENT_PARSING_ERROR":t=new E({type:f.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.type,code:f.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.code,message:f.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.message,details:{originalError:e}});break;default:t=new E({code:f.PAYMENT_REQUEST_NOT_COMPLETED.code,type:e.type||E.types.CUSTOMER,message:f.PAYMENT_REQUEST_NOT_COMPLETED.message,details:{originalError:e}})}return a.sendEvent(this._client,"payment-request.tokenize.failed"),t},A.prototype._formatCanMakePaymentError=function(e){var t;switch(e.name){case"PAYMENT_REQUEST_INITIALIZATION_FAILED":t=new E({type:f.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.type,code:f.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.code,message:f.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.message,details:{originalError:e}});break;case"NotAllowedError":t=new E({type:f.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.type,code:f.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.code,message:f.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.message,details:{originalError:e}});break;default:t=new E({code:f.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.code,type:f.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.type,message:f.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.message,details:{originalError:e}})}return a.sendEvent(this._client,"payment-request.can-make-payment.failed"),t},t.exports=e.wrapPrototype(A)},{"../../lib/analytics":125,"../../lib/assign":127,"../../lib/braintree-error":130,"../../lib/convert-methods-to-error":133,"../../lib/generate-google-pay-configuration":155,"../../lib/methods":161,"../../lib/promise":163,"../../lib/use-min":166,"../shared/constants":179,"@braintree/event-emitter":38,"@braintree/iframer":40,"@braintree/uuid":44,"@braintree/wrap-promise":48,framebus:57}],178:[function(e,t,n){"use strict";var r=e("./external/payment-request"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),e=e("@braintree/wrap-promise");t.exports={create:e(function(t){var e="Payment Request";return i.verify({name:e,client:t.client,authorization:t.authorization}).then(function(){return o.create({authorization:t.authorization,client:t.client,debug:t.debug,assetsUrl:a.create(t.authorization),name:e})}).then(function(e){return t.client=e,new r(t).initialize()})}),VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"./external/payment-request":177,"@braintree/wrap-promise":48}],179:[function(e,t,n){"use strict";var r=e("../../lib/enumerate"),i=e("./errors"),e={};e.events=r(["CAN_MAKE_PAYMENT","FRAME_READY","FRAME_CAN_MAKE_REQUESTS","PAYMENT_REQUEST_INITIALIZED","SHIPPING_ADDRESS_CHANGE","UPDATE_SHIPPING_ADDRESS","SHIPPING_OPTION_CHANGE","UPDATE_SHIPPING_OPTION"],"payment-request:"),e.errors=i,e.SUPPORTED_METHODS={"basic-card":!0,"https://google.com/pay":!0},t.exports=e},{"../../lib/enumerate":140,"./errors":180}],180:[function(e,t,n){"use strict";e=e("../../lib/braintree-error");t.exports={PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS:{type:e.types.MERCHANT,code:"PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS",message:"There are no supported payment methods associated with this account."},PAYMENT_REQUEST_CANCELED:{type:e.types.CUSTOMER,code:"PAYMENT_REQUEST_CANCELED",message:"Payment request was canceled."},PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED:{type:e.types.MERCHANT,code:"PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED",message:"Something went wrong when configuring the payment request."},PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED:{type:e.types.UNKNOWN,code:"PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED",message:"Something went wrong when calling `canMakePayment`"},PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED:{type:e.types.MERCHANT,code:"PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED",message:"Something went wrong when calling `canMakePayment`. Most likely, `canMakePayment` was called multiple times with different supportedMethods configurations."},PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD:{type:e.types.MERCHANT,code:"PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD"},PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE:{type:e.types.MERCHANT,code:"PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE",message:"Something went wrong when tokenizing the Google Pay card."},PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR:{type:e.types.UNKNOWN,code:"PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR",message:"Something went wrong when tokenizing the Google Pay card."},PAYMENT_REQUEST_NOT_COMPLETED:{code:"PAYMENT_REQUEST_NOT_COMPLETED",message:"Payment request could not be completed."},PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE:{type:e.types.MERCHANT,code:"PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE",message:"createSupportedPaymentMethodsConfiguration must include a type parameter."},PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED:{type:e.types.MERCHANT,code:"PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED",message:"createSupportedPaymentMethodsConfiguration type parameter must be valid or enabled."}}},{"../../lib/braintree-error":130}],181:[function(e,t,n){"use strict";e=e("../lib/braintree-error");t.exports={PAYPAL_NOT_ENABLED:{type:e.types.MERCHANT,code:"PAYPAL_NOT_ENABLED",message:"PayPal is not enabled for this merchant."},PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED:{type:e.types.MERCHANT,code:"PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED",message:"A linked PayPal Sandbox account is required to use PayPal Checkout in Sandbox. See https://developer.paypal.com/braintree/docs/guides/paypal/testing-go-live#linked-paypal-testing for details on linking your PayPal sandbox with Braintree."},PAYPAL_ACCOUNT_TOKENIZATION_FAILED:{type:e.types.NETWORK,code:"PAYPAL_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's PayPal account."},PAYPAL_FLOW_FAILED:{type:e.types.NETWORK,code:"PAYPAL_FLOW_FAILED",message:"Could not initialize PayPal flow."},PAYPAL_FLOW_OPTION_REQUIRED:{type:e.types.MERCHANT,code:"PAYPAL_FLOW_OPTION_REQUIRED",message:"PayPal flow property is invalid or missing."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED:{type:e.types.MERCHANT,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED"},PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED:{type:e.types.NETWORK,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED",message:"Something went wrong when setting up the checkout workflow."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED:{type:e.types.MERCHANT,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED",message:"PayPal popup failed to open, make sure to initiate the vault checkout in response to a user action."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED:{type:e.types.CUSTOMER,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED",message:"Customer closed PayPal popup before authorizing."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS:{type:e.types.MERCHANT,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS",message:"Vault initiated checkout already in progress."},PAYPAL_INVALID_PAYMENT_OPTION:{type:e.types.MERCHANT,code:"PAYPAL_INVALID_PAYMENT_OPTION",message:"PayPal payment options are invalid."}}},{"../lib/braintree-error":130}],182:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("@braintree/wrap-promise"),o=e("./paypal-checkout");t.exports={create:i(function(e){return r.verify({name:"PayPal Checkout",client:e.client,authorization:e.authorization}).then(function(){return new o(e)._initialize(e)})}),isSupported:function(){return!0},VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"./paypal-checkout":183,"@braintree/wrap-promise":48}],183:[function(e,t,n){"use strict";var a=e("../lib/analytics"),i=e("../lib/assign").assign,r=e("../lib/create-deferred-client"),o=e("../lib/create-assets-url"),s=e("../lib/promise"),c=e("@braintree/extended-promise"),d=e("@braintree/wrap-promise"),u=e("../lib/braintree-error"),l=e("../lib/convert-to-braintree-error"),p=e("./errors"),_=e("../paypal/shared/constants"),E=e("../lib/frame-service/external"),h=e("../lib/create-authorization-data"),m=e("../lib/methods"),f=e("../lib/use-min"),y=e("../lib/convert-methods-to-error"),A=e("../lib/querystring"),T=e("../lib/constants").INTEGRATION_TIMEOUT_MS,N=["amount","currency","vaultInitiatedCheckoutPaymentMethodToken"];function I(e){this._merchantAccountId=e.merchantAccountId,this._autoSetDataUserIdToken=Boolean(e.autoSetDataUserIdToken)}I.prototype._initialize=function(e){var t;return e.client?(t=e.client.getConfiguration(),this._authorizationInformation={fingerprint:t.authorizationFingerprint,environment:t.gatewayConfiguration.environment}):(t=h(e.authorization),this._authorizationInformation={fingerprint:t.attrs.authorizationFingerprint,environment:t.environment}),this._clientPromise=r.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o.create(e.authorization),name:"PayPal Checkout"}).then(function(e){return this._configuration=e.getConfiguration(),this._merchantAccountId||(this._configuration.gatewayConfiguration.paypalEnabled?!0===this._configuration.gatewayConfiguration.paypal.environmentNoNetwork&&(this._setupError=new u(p.PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED)):this._setupError=new u(p.PAYPAL_NOT_ENABLED)),this._setupError?s.reject(this._setupError):(a.sendEvent(e,"paypal-checkout.initialized"),this._frameServicePromise=this._setupFrameService(e),e)}.bind(this)),e.client?this._clientPromise.then(function(){return this}.bind(this)):s.resolve(this)},I.prototype._setupFrameService=function(e){var t=new c,n=e.getConfiguration(),r=setTimeout(function(){a.sendEvent(e,"paypal-checkout.frame-service.timed-out"),t.reject(new u(p.PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED))},T);return this._assetsUrl=n.gatewayConfiguration.paypal.assetsUrl+"/web/3.81.0",this._isDebug=n.isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/paypal-landing-frame"+f(this._isDebug)+".html",E.create({name:"braintreepaypallanding",dispatchFrameUrl:this._assetsUrl+"/html/dispatch-frame"+f(this._isDebug)+".html",openFrameUrl:this._loadingFrameUrl},function(e){this._frameService=e,clearTimeout(r),t.resolve()}.bind(this)),t},I.prototype.createPayment=function(t){return t&&_.FLOW_ENDPOINTS.hasOwnProperty(t.flow)?(a.sendEvent(this._clientPromise,"paypal-checkout.createPayment"),this._createPaymentResource(t).then(function(e){e="checkout"===t.flow?e.paymentResource.redirectUrl.match(/EC-\w+/)[0]:e.agreementSetup.tokenId;return e})):s.reject(new u(p.PAYPAL_FLOW_OPTION_REQUIRED))},I.prototype._createPaymentResource=function(t,n){var r=this,i="paypal_hermes/"+_.FLOW_ENDPOINTS[t.flow];return delete this.intentFromCreatePayment,n=n||{},!0===t.offerCredit&&a.sendEvent(this._clientPromise,"paypal-checkout.credit.offered"),this._clientPromise.then(function(e){return e.request({endpoint:i,method:"post",data:r._formatPaymentResourceData(t,n)}).then(function(e){return r.intentFromCreatePayment=t.intent,e})}).catch(function(e){return r._setupError?s.reject(r._setupError):422===(e.details&&e.details.httpStatus)?s.reject(new u({type:p.PAYPAL_INVALID_PAYMENT_OPTION.type,code:p.PAYPAL_INVALID_PAYMENT_OPTION.code,message:p.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:e}})):s.reject(l(e,{type:p.PAYPAL_FLOW_FAILED.type,code:p.PAYPAL_FLOW_FAILED.code,message:p.PAYPAL_FLOW_FAILED.message}))})},I.prototype.startVaultInitiatedCheckout=function(n){var t,r=this;return this._vaultInitiatedCheckoutInProgress?(a.sendEvent(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.error.already-in-progress"),s.reject(new u(p.PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS))):(N.forEach(function(e){n.hasOwnProperty(e)||(t=e)}),t?s.reject(new u({type:p.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.type,code:p.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.code,message:"Required param "+t+" is missing."})):(this._vaultInitiatedCheckoutInProgress=!0,this._addModalBackdrop(n),n=i({},n,{flow:"checkout"}),a.sendEvent(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.started"),this._waitForVaultInitiatedCheckoutDependencies().then(function(){var t=new c,e=r._createPaymentResource(n,{returnUrl:r._constructVaultCheckutUrl("redirect-frame"),cancelUrl:r._constructVaultCheckutUrl("cancel-frame")}).then(function(e){e=e.paymentResource.redirectUrl;return r._frameService.redirect(e),t});return r._frameService.open({},r._createFrameServiceCallback(t)),e}).catch(function(e){return r._vaultInitiatedCheckoutInProgress=!1,r._removeModalBackdrop(),"FRAME_SERVICE_FRAME_CLOSED"===e.code?(a.sendEvent(r._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.canceled.by-customer"),s.reject(new u(p.PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED))):(r._frameService&&r._frameService.close(),e.code&&-1<e.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")?(a.sendEvent(r._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.failed.popup-not-opened"),s.reject(new u({code:p.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.code,type:p.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.type,message:p.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.message,details:{originalError:e}}))):s.reject(e))}).then(function(e){return r._frameService.close(),r._vaultInitiatedCheckoutInProgress=!1,r._removeModalBackdrop(),a.sendEvent(r._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.succeeded"),s.resolve(e)})))},I.prototype._addModalBackdrop=function(e){e.optOutOfModalBackdrop||(this._modalBackdrop||(this._modalBackdrop=document.createElement("div"),this._modalBackdrop.setAttribute("data-braintree-paypal-vault-initiated-checkout-modal",!0),this._modalBackdrop.style.position="fixed",this._modalBackdrop.style.top=0,this._modalBackdrop.style.bottom=0,this._modalBackdrop.style.left=0,this._modalBackdrop.style.right=0,this._modalBackdrop.style.zIndex=9999,this._modalBackdrop.style.background="black",this._modalBackdrop.style.opacity="0.7",this._modalBackdrop.addEventListener("click",function(){this.focusVaultInitiatedCheckoutWindow()}.bind(this))),document.body.appendChild(this._modalBackdrop))},I.prototype._removeModalBackdrop=function(){this._modalBackdrop&&this._modalBackdrop.parentNode&&this._modalBackdrop.parentNode.removeChild(this._modalBackdrop)},I.prototype.closeVaultInitiatedCheckoutWindow=function(){return this._vaultInitiatedCheckoutInProgress&&a.sendEvent(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.canceled.by-merchant"),this._waitForVaultInitiatedCheckoutDependencies().then(function(){this._frameService.close()}.bind(this))},I.prototype.focusVaultInitiatedCheckoutWindow=function(){return this._waitForVaultInitiatedCheckoutDependencies().then(function(){this._frameService.focus()}.bind(this))},I.prototype._createFrameServiceCallback=function(n){var r=this;return function(e,t){e?n.reject(e):t&&(r._frameService.redirect(r._loadingFrameUrl),r.tokenizePayment({paymentToken:t.token,payerID:t.PayerID,paymentID:t.paymentId}).then(function(e){n.resolve(e)}).catch(function(e){n.reject(e)}))}},I.prototype._waitForVaultInitiatedCheckoutDependencies=function(){var e=this;return this._clientPromise.then(function(){return e._frameServicePromise})},I.prototype._constructVaultCheckutUrl=function(e){var t=this._frameService._serviceId;return this._assetsUrl+"/html/"+e+f(this._isDebug)+".html?channel="+t},I.prototype.tokenizePayment=function(e){var t,n=this,r=!0,i={flow:e.billingToken&&!e.paymentID?"vault":"checkout",intent:e.intent||this.intentFromCreatePayment},o={ecToken:e.paymentToken,billingToken:e.billingToken,payerId:e.payerID,paymentId:e.paymentID,shippingOptionsId:e.shippingOptionsId};return e.hasOwnProperty("vault")&&(r=e.vault),i.vault=r,a.sendEvent(this._clientPromise,"paypal-checkout.tokenization.started"),this._clientPromise.then(function(e){return e.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:n._formatTokenizeData(i,o)})}).then(function(e){return t=n._formatTokenizePayload(e),a.sendEvent(n._clientPromise,"paypal-checkout.tokenization.success"),t.creditFinancingOffered&&a.sendEvent(n._clientPromise,"paypal-checkout.credit.accepted"),t}).catch(function(e){return n._setupError?s.reject(n._setupError):(a.sendEvent(n._clientPromise,"paypal-checkout.tokenization.failed"),s.reject(l(e,{type:p.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.type,code:p.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.code,message:p.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.message})))})},I.prototype.getClientId=function(){return this._clientPromise.then(function(e){return e.getConfiguration().gatewayConfiguration.paypal.clientId})},I.prototype.loadPayPalSDK=function(t){var e=new c,n=t&&t.dataAttributes||{},r=(r=n["user-id-token"]||n["data-user-id-token"])||this._authorizationInformation.fingerprint&&this._authorizationInformation.fingerprint.split("?")[0];return this._paypalScript=document.createElement("script"),delete(t=i({},{components:"buttons"},t)).dataAttributes,t.vault?t.intent=t.intent||"tokenize":(t.intent=t.intent||"authorize",t.currency=t.currency||"USD"),this._paypalScript.onload=function(){e.resolve()},Object.keys(n).forEach(function(e){this._paypalScript.setAttribute("data-"+e.replace(/^data\-/,""),n[e])}.bind(this)),(t["client-id"]?s.resolve(t["client-id"]):this.getClientId()).then(function(e){t["client-id"]=e,this._autoSetDataUserIdToken&&r&&(this._paypalScript.setAttribute("data-user-id-token",r),this._attachPreloadPixel({id:e,userIdToken:r,amount:n.amount,currency:t.currency,merchantId:t["merchant-id"]})),this._paypalScript.src=A.queryify("https://www.paypal.com/sdk/js?",t),document.head.insertBefore(this._paypalScript,document.head.firstElementChild)}.bind(this)),e.then(function(){return this}.bind(this))},I.prototype._attachPreloadPixel=function(e){var t=e.id,n=e.userIdToken,r=this._authorizationInformation.environment,r="https://www.{ENV}paypal.com/smart/buttons/preload".replace("{ENV}","production"===r?"":"sandbox."),n={"client-id":t,"user-id-token":n};e.amount&&(n.amount=e.amount),e.currency&&(n.currency=e.currency),e.merchantId&&(n["merchant-id"]=e.merchantId),(e=new XMLHttpRequest).open("GET",A.queryify(r,n)),e.send()},I.prototype._formatPaymentResourceData=function(e,t){var n,r=this._configuration.gatewayConfiguration,i=e.intent,o={returnUrl:t.returnUrl||"https://www.paypal.com/checkoutnow/error",cancelUrl:t.cancelUrl||"https://www.paypal.com/checkoutnow/error",offerPaypalCredit:!0===e.offerCredit,merchantAccountId:this._merchantAccountId,experienceProfile:{brandName:e.displayName||r.paypal.displayName,localeCode:e.locale,noShipping:(!e.enableShippingAddress).toString(),addressOverride:!1===e.shippingAddressEditable,landingPageType:e.landingPageType},shippingOptions:e.shippingOptions};if("checkout"===e.flow){for(n in o.amount=e.amount,o.currencyIsoCode=e.currency,o.requestBillingAgreement=e.requestBillingAgreement,i&&(o.intent=i="capture"===i?"sale":i),e.hasOwnProperty("lineItems")&&(o.lineItems=e.lineItems),e.hasOwnProperty("vaultInitiatedCheckoutPaymentMethodToken")&&(o.vaultInitiatedCheckoutPaymentMethodToken=e.vaultInitiatedCheckoutPaymentMethodToken),e.hasOwnProperty("shippingOptions")&&(o.shippingOptions=e.shippingOptions),e.shippingAddressOverride)e.shippingAddressOverride.hasOwnProperty(n)&&(o[n]=e.shippingAddressOverride[n]);e.hasOwnProperty("billingAgreementDetails")&&(o.billingAgreementDetails=e.billingAgreementDetails)}else o.shippingAddress=e.shippingAddressOverride,e.billingAgreementDescription&&(o.description=e.billingAgreementDescription);return o},I.prototype._formatTokenizeData=function(e,t){var n=this._configuration,r=n.gatewayConfiguration,i="TOKENIZATION_KEY"===n.authorizationType,n="vault"===e.flow,i={paypalAccount:{correlationId:t.billingToken||t.ecToken,options:{validate:n&&!i&&e.vault}}};return n?i.paypalAccount.billingAgreementToken=t.billingToken:(i.paypalAccount.paymentToken=t.paymentId,i.paypalAccount.payerId=t.payerId,i.paypalAccount.unilateral=r.paypal.unvettedMerchant,e.intent&&(i.paypalAccount.intent=e.intent)),this._merchantAccountId&&(i.merchantAccountId=this._merchantAccountId),i},I.prototype._formatTokenizePayload=function(e){var t={},e={nonce:(t=e.paypalAccounts?e.paypalAccounts[0]:t).nonce,details:{},type:t.type};return t.details&&t.details.payerInfo&&(e.details=t.details.payerInfo),t.details&&t.details.creditFinancingOffered&&(e.creditFinancingOffered=t.details.creditFinancingOffered),t.details&&t.details.shippingOptionId&&(e.shippingOptionId=t.details.shippingOptionId),t.details&&t.details.cobrandedCardLabel&&(e.cobrandedCardLabel=t.details.cobrandedCardLabel),e},I.prototype.teardown=function(){var e=this;return y(this,m(I.prototype)),this._paypalScript&&this._paypalScript.parentNode&&this._paypalScript.parentNode.removeChild(this._paypalScript),this._frameServicePromise.catch(function(){}).then(function(){return e._frameService?e._frameService.teardown():s.resolve()})},t.exports=d.wrapPrototype(I)},{"../lib/analytics":125,"../lib/assign":127,"../lib/braintree-error":130,"../lib/constants":132,"../lib/convert-methods-to-error":133,"../lib/convert-to-braintree-error":134,"../lib/create-assets-url":135,"../lib/create-authorization-data":136,"../lib/create-deferred-client":137,"../lib/frame-service/external":145,"../lib/methods":161,"../lib/promise":163,"../lib/querystring":164,"../lib/use-min":166,"../paypal/shared/constants":186,"./errors":181,"@braintree/extended-promise":39,"@braintree/wrap-promise":48}],184:[function(e,t,n){"use strict";var o=e("../../lib/frame-service/external"),c=e("../../lib/braintree-error"),i=e("../../lib/convert-to-braintree-error"),a=e("../../lib/use-min"),s=e("../../lib/once"),d="3.81.0",u=e("../shared/constants"),l=e("../../lib/constants").INTEGRATION_TIMEOUT_MS,p=e("../../lib/analytics"),r=e("../../lib/methods"),_=e("../../lib/deferred"),E=e("../shared/errors"),h=e("../../lib/convert-methods-to-error"),m=e("../../lib/querystring"),f=e("../../lib/promise"),e=e("@braintree/wrap-promise");function y(e){this._client=e.client,this._assetsUrl=e.client.getConfiguration().gatewayConfiguration.paypal.assetsUrl+"/web/"+d,this._isDebug=e.client.getConfiguration().isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/paypal-landing-frame"+a(this._isDebug)+".html",this._authorizationInProgress=!1}y.prototype._initialize=function(){var n=this,r=this._client,i=setTimeout(function(){p.sendEvent(r,"paypal.load.timed-out")},l);return new f(function(t){o.create({name:u.LANDING_FRAME_NAME,dispatchFrameUrl:n._assetsUrl+"/html/dispatch-frame"+a(n._isDebug)+".html",openFrameUrl:n._loadingFrameUrl},function(e){n._frameService=e,clearTimeout(i),p.sendEvent(r,"paypal.load.succeeded"),t(n)})})},y.prototype.tokenize=function(n,t){var e,r=this,i=this._client;return t=t&&s(_(t)),n&&u.FLOW_ENDPOINTS.hasOwnProperty(n.flow)?(e=new f(function(e,t){r._authorizationInProgress?(p.sendEvent(i,"paypal.tokenization.error.already-opened"),t(new c(E.PAYPAL_TOKENIZATION_REQUEST_ACTIVE))):(r._authorizationInProgress=!0,window.popupBridge||p.sendEvent(i,"paypal.tokenization.opened"),!0===n.offerCredit&&p.sendEvent(i,"paypal.credit.offered"),!0===n.offerPayLater&&p.sendEvent(i,"paypal.paylater.offered"),r._navigateFrameToAuth(n).catch(t),r._frameService.open({},r._createFrameServiceCallback(n,e,t)))}),t?(e.then(function(e){t(null,e)}).catch(t),this._frameService.createHandler({beforeClose:function(){p.sendEvent(i,"paypal.tokenization.closed.by-merchant")}})):e):(e=new c(E.PAYPAL_FLOW_OPTION_REQUIRED),t?(t(e),this._frameService.createNoopHandler()):f.reject(e))},y.prototype._createFrameServiceCallback=function(r,i,o){var a=this,s=this._client;return window.popupBridge?function(e,t){var n=t&&t.path&&"/cancel"===t.path.substring(0,7);a._authorizationInProgress=!1,e||n?(p.sendEvent(s,"paypal.tokenization.closed-popupbridge.by-user"),o(new c(E.PAYPAL_POPUP_CLOSED))):t&&a._tokenizePayPal(r,t.queryItems).then(i).catch(o)}:function(e,t){a._authorizationInProgress=!1,e?"FRAME_SERVICE_FRAME_CLOSED"===e.code?(p.sendEvent(s,"paypal.tokenization.closed.by-user"),o(new c(E.PAYPAL_POPUP_CLOSED))):e.code&&-1<e.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")&&o(new c({code:E.PAYPAL_POPUP_OPEN_FAILED.code,type:E.PAYPAL_POPUP_OPEN_FAILED.type,message:E.PAYPAL_POPUP_OPEN_FAILED.message,details:{originalError:e}})):t&&a._tokenizePayPal(r,t).then(i).catch(o)}},y.prototype._tokenizePayPal=function(e,t){var n=this,r=this._client;return window.popupBridge||this._frameService.redirect(this._loadingFrameUrl),r.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:this._formatTokenizeData(e,t)}).then(function(e){e=n._formatTokenizePayload(e);return window.popupBridge?p.sendEvent(r,"paypal.tokenization.success-popupbridge"):p.sendEvent(r,"paypal.tokenization.success"),e.creditFinancingOffered&&p.sendEvent(r,"paypal.credit.accepted"),n._frameService.close(),e}).catch(function(e){return window.popupBridge?p.sendEvent(r,"paypal.tokenization.failed-popupbridge"):p.sendEvent(r,"paypal.tokenization.failed"),n._frameService.close(),f.reject(i(e,{type:E.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.type,code:E.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.code,message:E.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.message}))})},y.prototype._formatTokenizePayload=function(e){var t={},e={nonce:(t=e.paypalAccounts?e.paypalAccounts[0]:t).nonce,details:{},type:t.type};return t.details&&t.details.payerInfo&&(e.details=t.details.payerInfo),t.details&&t.details.creditFinancingOffered&&(e.creditFinancingOffered=t.details.creditFinancingOffered),e},y.prototype._formatTokenizeData=function(e,t){var n=this._client.getConfiguration(),r=n.gatewayConfiguration,n="TOKENIZATION_KEY"===n.authorizationType,n={paypalAccount:{correlationId:t.ba_token||t.token,options:{validate:"vault"===e.flow&&!n}}};return t.ba_token?n.paypalAccount.billingAgreementToken=t.ba_token:(n.paypalAccount.paymentToken=t.paymentId,n.paypalAccount.payerId=t.PayerID,n.paypalAccount.unilateral=r.paypal.unvettedMerchant,e.hasOwnProperty("intent")&&(n.paypalAccount.intent=e.intent)),n},y.prototype._navigateFrameToAuth=function(t){var n=this,r=this._client,e="paypal_hermes/"+u.FLOW_ENDPOINTS[t.flow];return r.request({endpoint:e,method:"post",data:this._formatPaymentResourceData(t)}).then(function(e){e="checkout"===t.flow?e.paymentResource.redirectUrl:e.agreementSetup.approvalUrl;"commit"===t.useraction&&(e=m.queryify(e,{useraction:"commit"})),window.popupBridge&&p.sendEvent(r,"paypal.tokenization.opened-popupbridge"),n._frameService.redirect(e)}).catch(function(e){var t=e.details&&e.details.httpStatus;return n._frameService.close(),n._authorizationInProgress=!1,422===t?f.reject(new c({type:E.PAYPAL_INVALID_PAYMENT_OPTION.type,code:E.PAYPAL_INVALID_PAYMENT_OPTION.code,message:E.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:e}})):f.reject(i(e,{type:E.PAYPAL_FLOW_FAILED.type,code:E.PAYPAL_FLOW_FAILED.code,message:E.PAYPAL_FLOW_FAILED.message}))})},y.prototype._formatPaymentResourceData=function(e){var t,n=this._client.getConfiguration().gatewayConfiguration,r=this._frameService._serviceId,i={returnUrl:n.paypal.assetsUrl+"/web/"+d+"/html/redirect-frame"+a(this._isDebug)+".html?channel="+r,cancelUrl:n.paypal.assetsUrl+"/web/"+d+"/html/cancel-frame"+a(this._isDebug)+".html?channel="+r,offerPaypalCredit:!0===e.offerCredit,offerPayLater:!0===e.offerPayLater,experienceProfile:{brandName:e.displayName||n.paypal.displayName,localeCode:e.locale,noShipping:(!e.enableShippingAddress).toString(),addressOverride:!1===e.shippingAddressEditable,landingPageType:e.landingPageType}};if(window.popupBridge&&"function"==typeof window.popupBridge.getReturnUrlPrefix&&(i.returnUrl=window.popupBridge.getReturnUrlPrefix()+"return",i.cancelUrl=window.popupBridge.getReturnUrlPrefix()+"cancel"),"checkout"===e.flow)for(t in i.amount=e.amount,i.currencyIsoCode=e.currency,e.hasOwnProperty("intent")&&(i.intent=e.intent),e.shippingAddressOverride)e.shippingAddressOverride.hasOwnProperty(t)&&(i[t]=e.shippingAddressOverride[t]);else i.shippingAddress=e.shippingAddressOverride,e.billingAgreementDescription&&(i.description=e.billingAgreementDescription);return i},y.prototype.closeWindow=function(){this._authorizationInProgress&&p.sendEvent(this._client,"paypal.tokenize.closed.by-merchant"),this._frameService.close()},y.prototype.focusWindow=function(){this._frameService.focus()},y.prototype.teardown=e(function(){return this._frameService.teardown(),h(this,r(y.prototype)),p.sendEvent(this._client,"paypal.teardown-completed"),f.resolve()}),t.exports=y},{"../../lib/analytics":125,"../../lib/braintree-error":130,"../../lib/constants":132,"../../lib/convert-methods-to-error":133,"../../lib/convert-to-braintree-error":134,"../../lib/deferred":138,"../../lib/frame-service/external":145,"../../lib/methods":161,"../../lib/once":162,"../../lib/promise":163,"../../lib/querystring":164,"../../lib/use-min":166,"../shared/constants":186,"../shared/errors":187,"@braintree/wrap-promise":48}],185:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("../lib/braintree-error"),c=e("./shared/errors"),d=e("./external/paypal"),u=e("@braintree/wrap-promise"),l=e("../lib/promise");t.exports={create:u(function(n){return i.verify({name:"PayPal",client:n.client,authorization:n.authorization}).then(function(){return o.create({authorization:n.authorization,client:n.client,debug:n.debug,assetsUrl:a.create(n.authorization),name:"PayPal"})}).then(function(e){var t=e.getConfiguration();return n.client=e,!0!==t.gatewayConfiguration.paypalEnabled?l.reject(new s(c.PAYPAL_NOT_ENABLED)):(r.sendEvent(n.client,"paypal.initialized"),new d(n)._initialize())})}),isSupported:function(){return!0},VERSION:"3.81.0"}},{"../lib/analytics":125,"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"./external/paypal":184,"./shared/errors":187,"@braintree/wrap-promise":48}],186:[function(e,t,n){"use strict";t.exports={LANDING_FRAME_NAME:"braintreepaypallanding",FLOW_ENDPOINTS:{checkout:"create_payment_resource",vault:"setup_billing_agreement"}}},{}],187:[function(e,t,n){"use strict";e=e("../../lib/braintree-error");t.exports={PAYPAL_NOT_ENABLED:{type:e.types.MERCHANT,code:"PAYPAL_NOT_ENABLED",message:"PayPal is not enabled for this merchant."},PAYPAL_TOKENIZATION_REQUEST_ACTIVE:{type:e.types.MERCHANT,code:"PAYPAL_TOKENIZATION_REQUEST_ACTIVE",message:"Another tokenization request is active."},PAYPAL_ACCOUNT_TOKENIZATION_FAILED:{type:e.types.NETWORK,code:"PAYPAL_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's PayPal account."},PAYPAL_FLOW_FAILED:{type:e.types.NETWORK,code:"PAYPAL_FLOW_FAILED",message:"Could not initialize PayPal flow."},PAYPAL_FLOW_OPTION_REQUIRED:{type:e.types.MERCHANT,code:"PAYPAL_FLOW_OPTION_REQUIRED",message:"PayPal flow property is invalid or missing."},PAYPAL_POPUP_OPEN_FAILED:{type:e.types.MERCHANT,code:"PAYPAL_POPUP_OPEN_FAILED",message:"PayPal popup failed to open, make sure to tokenize in response to a user action."},PAYPAL_POPUP_CLOSED:{type:e.types.CUSTOMER,code:"PAYPAL_POPUP_CLOSED",message:"Customer closed PayPal popup before authorizing."},PAYPAL_INVALID_PAYMENT_OPTION:{type:e.types.MERCHANT,code:"PAYPAL_INVALID_PAYMENT_OPTION",message:"PayPal payment options are invalid."}}},{"../../lib/braintree-error":130}],188:[function(e,t,n){"use strict";var r=e("@braintree/wrap-promise"),i=e("../lib/basic-component-verification"),o=e("./preferred-payment-methods");t.exports={create:r(function(e){return i.verify({name:"PreferredPaymentMethods",client:e.client,authorization:e.authorization}).then(function(){return(new o).initialize(e)})}),VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"./preferred-payment-methods":189,"@braintree/wrap-promise":48}],189:[function(e,t,n){"use strict";var r=e("@braintree/wrap-promise"),i=e("../lib/analytics"),o=e("../lib/create-assets-url"),a=e("../lib/create-deferred-client"),s=e("../lib/promise");function c(){}c.prototype.initialize=function(e){var t=this;return this._clientPromise=a.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o.create(e.authorization),name:"PreferredPaymentMethods"}).catch(function(e){return t._setupError=e,s.reject(e)}),i.sendEvent(this._clientPromise,"preferred-payment-methods.initialized"),s.resolve(this)},c.prototype.fetchPreferredPaymentMethods=function(){var n,e=this;return this._clientPromise.then(function(e){return(n=e).request({api:"graphQLApi",data:{query:"query PreferredPaymentMethods { preferredPaymentMethods { paypalPreferred venmoPreferred } }"}})}).then(function(e){var t=e.data.preferredPaymentMethods.paypalPreferred,e=e.data.preferredPaymentMethods.venmoPreferred;return i.sendEvent(n,"preferred-payment-methods.paypal.api-detected."+t),i.sendEvent(n,"preferred-payment-methods.venmo.api-detected."+e),{paypalPreferred:t,venmoPreferred:e}}).catch(function(){return e._setupError?s.reject(e._setupError):(i.sendEvent(n,"preferred-payment-methods.api-error"),{paypalPreferred:!1,venmoPreferred:!1})})},t.exports=r.wrapPrototype(c)},{"../lib/analytics":125,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"@braintree/wrap-promise":48}],190:[function(e,t,n){"use strict";var r=e("../../../lib/assign").assign,o=e("../../../lib/analytics"),a=e("../../../lib/braintree-error"),s=e("../../../lib/promise"),c=e("../../../lib/is-verified-domain"),i=e("@braintree/extended-promise"),d=e("@braintree/event-emitter"),u=e("../../shared/errors"),l=e("@braintree/iframer"),p=e("framebus"),_=e("../../shared/constants"),E=e("@braintree/uuid"),h=e("../../shared/events"),m=e("../../../lib/use-min"),f=e("../../../lib/constants").BUS_CONFIGURATION_REQUEST_EVENT;function y(e){d.call(this),this._client=e.client,this._createPromise=e.createPromise,this._createOptions=e,this._client?(this._isDebug=this._client.getConfiguration().isDebug,this._assetsUrl=this._client.getConfiguration().gatewayConfiguration.assetsUrl):(this._isDebug=Boolean(e.isDebug),this._assetsUrl=e.assetsUrl),this._assetsUrl=this._assetsUrl+"/web/3.81.0"}d.createChild(y),y.prototype._waitForClient=function(){return this._client?s.resolve():this._createPromise.then(function(e){this._client=e}.bind(this))},y.prototype.setUpEventListeners=function(){throw new a(u.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},y.prototype.verifyCard=function(e,t){var n,r=this;return(t=this._checkForVerifyCardError(e,t=t||{}))?s.reject(t):(this._verifyCardInProgress=!0,n=this._formatVerifyCardOptions(e),this._formatLookupData(n).then(function(e){return o.sendEvent(r._createPromise,"three-d-secure.verification-flow.started"),r._performLookup(n.nonce,e)}).then(function(e){return o.sendEvent(r._createPromise,"three-d-secure.verification-flow.3ds-version."+e.lookup.threeDSecureVersion),r._onLookupComplete(e,n)}).then(function(e){return r.initializeChallengeWithLookupResponse(e,n)}).then(function(e){return r._resetVerificationState(),o.sendEvent(r._createPromise,"three-d-secure.verification-flow.completed"),e}).catch(function(e){return r._resetVerificationState(),o.sendEvent(r._createPromise,"three-d-secure.verification-flow.failed"),s.reject(e)}))},y.prototype._checkForFrameworkSpecificVerifyCardErrors=function(){throw new a(u.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},y.prototype._presentChallenge=function(){throw new a(u.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},y.prototype.prepareLookup=function(){throw new a(u.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},y.prototype._resetVerificationState=function(){this._verifyCardInProgress=!1,this._verifyCardPromisePlus=null},y.prototype._performLookup=function(e,t){var i=this,n="payment_methods/"+e+"/three_d_secure/lookup";return this._waitForClient().then(function(){return i._client.request({endpoint:n,method:"post",data:t}).catch(function(e){var t,n=e&&e.details&&e.details.httpStatus,r="three-d-secure.verification-flow.lookup-failed";return 404===n?(t=u.THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR,r+=".404"):422===n?(t=u.THREEDS_LOOKUP_VALIDATION_ERROR,r+=".422"):t=u.THREEDS_LOOKUP_ERROR,o.sendEvent(i._createPromise,r),s.reject(new a({type:t.type,code:t.code,message:t.message,details:{originalError:e}}))})})},y.prototype._checkForVerifyCardError=function(e,t){var n;return!0===this._verifyCardInProgress?new a(u.THREEDS_AUTHENTICATION_IN_PROGRESS):(e.nonce?e.amount||(n="an amount"):n="a nonce",(n=n||this._checkForFrameworkSpecificVerifyCardErrors(e,t))?new a({type:u.THREEDS_MISSING_VERIFY_CARD_OPTION.type,code:u.THREEDS_MISSING_VERIFY_CARD_OPTION.code,message:"verifyCard options must include "+n+"."}):null)},y.prototype.initializeChallengeWithLookupResponse=function(e,t){var n=this;return t=t||{},this._lookupPaymentMethod=e.paymentMethod,n._verifyCardPromisePlus=n._verifyCardPromisePlus||new i,n._handleLookupResponse(e,t),n._verifyCardPromisePlus.then(function(e){return o.sendEvent(n._createPromise,"three-d-secure.verification-flow.liability-shifted."+String(e.liabilityShifted)),o.sendEvent(n._createPromise,"three-d-secure.verification-flow.liability-shift-possible."+String(e.liabilityShiftPossible)),e})},y.prototype._handleLookupResponse=function(e,t){var n=Boolean(e.lookup&&e.lookup.acsUrl);o.sendEvent(this._createPromise,"three-d-secure.verification-flow.challenge-presented."+String(n)),n?this._presentChallenge(e,t):((t=this._formatAuthResponse(e.paymentMethod,e.threeDSecureInfo)).verificationDetails=e.threeDSecureInfo,this._verifyCardPromisePlus.resolve(t))},y.prototype._onLookupComplete=function(e){return this._lookupPaymentMethod=e.paymentMethod,this._verifyCardPromisePlus=new i,s.resolve(e)},y.prototype._formatAuthResponse=function(e,t){return{nonce:e.nonce,type:e.type,binData:e.binData,details:e.details,description:e.description&&e.description.replace(/\+/g," "),liabilityShifted:t&&t.liabilityShifted,liabilityShiftPossible:t&&t.liabilityShiftPossible,threeDSecureInfo:e.threeDSecureInfo}},y.prototype._formatVerifyCardOptions=function(e){return r({},e)},y.prototype._formatLookupData=function(e){e={amount:e.amount};return s.resolve(e)},y.prototype._handleV1AuthResponse=function(e){e=JSON.parse(e.auth_response);e.success?this._verifyCardPromisePlus.resolve(this._formatAuthResponse(e.paymentMethod,e.threeDSecureInfo)):e.threeDSecureInfo&&e.threeDSecureInfo.liabilityShiftPossible?this._verifyCardPromisePlus.resolve(this._formatAuthResponse(this._lookupPaymentMethod,e.threeDSecureInfo)):this._verifyCardPromisePlus.reject(new a({type:a.types.UNKNOWN,code:"UNKNOWN_AUTH_RESPONSE",message:e.error.message}))},y.prototype.cancelVerifyCard=function(){var e;return this._verifyCardInProgress=!1,this._lookupPaymentMethod?(e=this._lookupPaymentMethod.threeDSecureInfo,e=r({},this._lookupPaymentMethod,{liabilityShiftPossible:e&&e.liabilityShiftPossible,liabilityShifted:e&&e.liabilityShifted,verificationDetails:e&&e.verificationDetails}),s.resolve(e)):s.reject(new a(u.THREEDS_NO_VERIFICATION_PAYLOAD))},y.prototype._setupV1Bus=function(e){var t=window.location.href.split("#")[0],n=e.lookupResponse,r=E(),i=new p({channel:r,verifyDomain:c}),o=this._assetsUrl+"/html/three-d-secure-authentication-complete-frame.html?channel="+encodeURIComponent(r)+"&";return i.on(f,function(e){e({acsUrl:n.acsUrl,pareq:n.pareq,termUrl:n.termUrl+"&three_d_secure_version=3.81.0&authentication_complete_base_url="+encodeURIComponent(o),md:n.md,parentUrl:t})}),i.on(h.AUTHENTICATION_COMPLETE,e.handleAuthResponse),i},y.prototype._setupV1Iframe=function(e){e=this._assetsUrl+"/html/three-d-secure-bank-frame"+m(this._isDebug)+".html?showLoader="+e.showLoader;return l({src:e,height:400,width:400,name:_.LANDING_FRAME_NAME+"_"+this._v1Bus.channel,title:"3D Secure Authorization Frame"})},y.prototype._setupV1Elements=function(e){this._v1Bus=this._setupV1Bus(e),this._v1Iframe=this._setupV1Iframe(e)},y.prototype._teardownV1Elements=function(){this._v1Bus&&(this._v1Bus.teardown(),this._v1Bus=null),this._v1Iframe&&this._v1Iframe.parentNode&&(this._v1Iframe.parentNode.removeChild(this._v1Iframe),this._v1Iframe=null),this._onV1Keyup&&(document.removeEventListener("keyup",this._onV1Keyup),this._onV1Keyup=null)},y.prototype.teardown=function(){return o.sendEvent(this._createPromise,"three-d-secure.teardown-completed"),this._teardownV1Elements(),s.resolve()},t.exports=y},{"../../../lib/analytics":125,"../../../lib/assign":127,"../../../lib/braintree-error":130,"../../../lib/constants":132,"../../../lib/is-verified-domain":159,"../../../lib/promise":163,"../../../lib/use-min":166,"../../shared/constants":199,"../../shared/errors":200,"../../shared/events":201,"@braintree/event-emitter":38,"@braintree/extended-promise":39,"@braintree/iframer":40,"@braintree/uuid":44,framebus:57}],191:[function(e,t,n){"use strict";var r=e("./songbird");function i(e){r.call(this,e)}(i.prototype=Object.create(r.prototype,{constructor:r}))._createV1IframeModalElement=function(e){var t=document.createElement("div");return t.innerHTML='<div class="modal fade in" tabindex="-1" role="dialog" aria-labelledby="CCAFrameModal-label" aria-hidden="true" style="display: block;"><div class="modal-dialog" style="width:440px;z-index:999999;"><div class="modal-content"><div class="modal-body" data-braintree-v1-fallback-iframe-container><button type="button" data-braintree-v1-fallback-close-button class="close" data-dismiss="modal" aria-hidden="true">×</button></div></div></div><div data-braintree-v1-fallback-backdrop style="position: fixed;cursor: pointer;z-index: 999998;top: 0;left: 0;width: 100%;height: 100%;"></div></div>',t.querySelector("[data-braintree-v1-fallback-iframe-container]").appendChild(e),t},i.prototype._createCardinalConfigurationOptions=function(e){e=r.prototype._createCardinalConfigurationOptions.call(this,e);return e.payment.framework="bootstrap3",e},t.exports=i},{"./songbird":196}],192:[function(e,t,n){"use strict";var r=e("./songbird");function i(e){r.call(this,e)}(i.prototype=Object.create(r.prototype,{constructor:r}))._createV1IframeModalElement=function(e){var t=document.createElement("div"),n=Boolean(this._createOptions&&this._createOptions.cardinalSDKConfig&&this._createOptions.cardinalSDKConfig.payment&&this._createOptions.cardinalSDKConfig.payment.displayExitButton);return t.innerHTML='<div style="position: fixed;z-index: 999999;top: 50%;left: 50%;padding: 24px 20px;transform: translate(-50%,-50%);border-radius: 2px;background: #fff;max-width: 100%;overflow: auto;"><div><button data-braintree-v1-fallback-close-button style="font-family: Helvetica,Arial,sans-serif;font-size: 25px;line-height: 12px;position: absolute;top: 2px;right: 0px;cursor: pointer;color: #999;border: 0;outline: none;background: none;" onMouseOver="this.style.color=\'#000\'" onMouseOut="this.style.color=\'#999\'">×</button></div><div data-braintree-v1-fallback-iframe-container style="height: 400px;"></div></div><div data-braintree-v1-fallback-backdrop style="position: fixed;z-index: 999998;cursor: pointer;top: 0;left: 0;width: 100%;height: 100%;transition: opacity 1ms ease;background: rgba(0,0,0,.6);"></div>',n||(t.querySelector("[data-braintree-v1-fallback-close-button]").style.display="none"),t.querySelector("[data-braintree-v1-fallback-iframe-container]").appendChild(e),t},t.exports=i},{"./songbird":196}],193:[function(e,t,n){"use strict";var r=e("./legacy"),i=e("./cardinal-modal"),o=e("./bootstrap3-modal"),e=e("./inline-iframe");t.exports={legacy:r,"cardinal-modal":i,"bootstrap3-modal":o,"inline-iframe":e}},{"./bootstrap3-modal":191,"./cardinal-modal":192,"./inline-iframe":194,"./legacy":195}],194:[function(e,t,n){"use strict";var r=e("./songbird"),o=e("../../../lib/braintree-error"),a=e("../../shared/errors"),e=e("../../../lib/enumerate");function s(e){r.call(this,e)}s.prototype=Object.create(r.prototype,{constructor:r}),s.events=e(["AUTHENTICATION_IFRAME_AVAILABLE"],"inline-iframe-framework:"),s.prototype.setUpEventListeners=function(n){r.prototype.setUpEventListeners.call(this,n),this.on(s.events.AUTHENTICATION_IFRAME_AVAILABLE,function(e,t){n("authentication-iframe-available",e,t)})},s.prototype._createCardinalConfigurationOptions=function(e){e=r.prototype._createCardinalConfigurationOptions.call(this,e);return e.payment.framework="inline",e},s.prototype._addV1IframeToPage=function(){this._emit(s.events.AUTHENTICATION_IFRAME_AVAILABLE,{element:this._v1Modal},function(){})},s.prototype._setupFrameworkSpecificListeners=function(){this.setCardinalListener("ui.inline.setup",this._onInlineSetup.bind(this))},s.prototype._onInlineSetup=function(e,t,n,r){var i;(i=!e||!t||"CCA"!==t.paymentType||"suppress"!==t.data.mode&&"static"!==t.data.mode||i)?r(new o(a.THREEDS_INLINE_IFRAME_DETAILS_INCORRECT)):((r=document.createElement("div")).innerHTML=e,"suppress"===t.data.mode?(r.style.display="none",document.body.appendChild(r),n()):"static"===t.data.mode&&this._emit(s.events.AUTHENTICATION_IFRAME_AVAILABLE,{element:r},function(){n()}))},t.exports=s},{"../../../lib/braintree-error":130,"../../../lib/enumerate":140,"../../shared/errors":200,"./songbird":196}],195:[function(e,t,n){"use strict";var r=e("./base"),i=e("../../../lib/deferred");function o(e){r.call(this,e)}(o.prototype=Object.create(r.prototype,{constructor:o})).setUpEventListeners=function(){},o.prototype.transformV1CustomerBillingAddress=function(e){return e.billingAddress.line1=e.billingAddress.streetAddress,e.billingAddress.line2=e.billingAddress.extendedAddress,e.billingAddress.city=e.billingAddress.locality,e.billingAddress.state=e.billingAddress.region,e.billingAddress.countryCode=e.billingAddress.countryCodeAlpha2,delete e.billingAddress.streetAddress,delete e.billingAddress.extendedAddress,delete e.billingAddress.locality,delete e.billingAddress.region,delete e.billingAddress.countryCodeAlpha2,e},o.prototype._createIframe=function(t){var n=this;return this._setupV1Elements({lookupResponse:t.lookupResponse,showLoader:t.showLoader,handleAuthResponse:function(e){n._handleAuthResponse(e,t)}}),this._v1Iframe},o.prototype._handleAuthResponse=function(e,t){this._v1Bus.teardown(),t.removeFrame(),i(function(){this._handleV1AuthResponse(e)}.bind(this))()},o.prototype._checkForFrameworkSpecificVerifyCardErrors=function(e){var t;return"function"!=typeof e.addFrame?t="an addFrame function":"function"!=typeof e.removeFrame&&(t="a removeFrame function"),t},o.prototype._formatVerifyCardOptions=function(e){var t=r.prototype._formatVerifyCardOptions.call(this,e);return t.addFrame=i(e.addFrame),t.removeFrame=i(e.removeFrame),t.showLoader=!1!==e.showLoader,t},o.prototype._formatLookupData=function(t){var n=this;return r.prototype._formatLookupData.call(this,t).then(function(e){return t.customer&&t.customer.billingAddress&&(e.customer=n.transformV1CustomerBillingAddress(t.customer)),e})},o.prototype._presentChallenge=function(e,t){t.addFrame(null,this._createIframe({showLoader:t.showLoader,lookupResponse:e.lookup,removeFrame:t.removeFrame}))},t.exports=o},{"../../../lib/deferred":138,"./base":190}],196:[function(e,t,n){"use strict";var r=e("./base"),i=e("../../../lib/assign").assign,o=e("../../../lib/deferred"),a=e("../../../lib/braintree-error"),s=e("../../../lib/convert-to-braintree-error"),c=e("../../../lib/analytics"),d=e("../../../lib/assets"),u=e("../../shared/errors"),l=e("../../../lib/enumerate"),p=e("../../shared/constants"),_=e("../../../lib/promise"),E=e("@braintree/extended-promise"),h=e("../../../lib/constants").INTEGRATION_TIMEOUT_MS,m=e("../../../lib/constants").PLATFORM,f=["ui.close","ui.render","ui.renderHidden","ui.loading.close","ui.loading.render"];function y(e){r.call(this,e),this._useV1Fallback=!1,this._clientMetadata={requestedThreeDSecureVersion:"2",sdkVersion:m+"/3.81.0"},this._getDfReferenceIdPromisePlus=new E,this.setupSongbird(e),this._cardinalEvents=[]}function A(e,t,n){t[n+"Line1"]=e.streetAddress,t[n+"Line2"]=e.extendedAddress,t[n+"Line3"]=e.line3,t[n+"City"]=e.locality,t[n+"State"]=e.region,t[n+"PostalCode"]=e.postalCode,t[n+"CountryCode"]=e.countryCodeAlpha2}y.prototype=Object.create(r.prototype,{constructor:y}),y.events=l(["LOOKUP_COMPLETE","CUSTOMER_CANCELED","UI.CLOSE","UI.RENDER","UI.RENDERHIDDEN","UI.LOADING.CLOSE","UI.LOADING.RENDER"],"songbird-framework:"),y.prototype.setUpEventListeners=function(n){this.on(y.events.LOOKUP_COMPLETE,function(e,t){n("lookup-complete",e,t)}),this.on(y.events.CUSTOMER_CANCELED,function(){n("customer-canceled")}),this.on(y.events["UI.CLOSE"],function(){n("authentication-modal-close")}),this.on(y.events["UI.RENDER"],function(){n("authentication-modal-render")}),this.on(y.events["UI.RENDERHIDDEN"],function(){n("authentication-modal-render-hidden")}),this.on(y.events["UI.LOADING.CLOSE"],function(){n("authentication-modal-loader-close")}),this.on(y.events["UI.LOADING.RENDER"],function(){n("authentication-modal-loader-render")})},y.prototype.prepareLookup=function(e){var t=i({},e),n=this;return this.getDfReferenceId().then(function(e){t.dfReferenceId=e}).then(function(){return n._triggerCardinalBinProcess(e.bin)}).catch(function(){}).then(function(){return n._waitForClient()}).then(function(){return t.clientMetadata=n._clientMetadata,t.authorizationFingerprint=n._client.getConfiguration().authorizationFingerprint,t.braintreeLibraryVersion="braintree/web/3.81.0",t})},y.prototype.initializeChallengeWithLookupResponse=function(e,t){return this.setupSongbird().then(function(){return r.prototype.initializeChallengeWithLookupResponse.call(this,e,t)}.bind(this))},y.prototype.initiateV1Fallback=function(e){this._useV1Fallback=!0,this._removeSongbirdListeners(),c.sendEvent(this._createPromise,"three-d-secure.v1-fallback."+e),this._songbirdPromise&&this._songbirdPromise.resolve()},y.prototype._triggerCardinalBinProcess=function(e){var t=this,n=Date.now();return e?window.Cardinal.trigger("bin.process",e).then(function(e){t._clientMetadata.issuerDeviceDataCollectionTimeElapsed=Date.now()-n,t._clientMetadata.issuerDeviceDataCollectionResult=e&&e.Status}):_.resolve()},y.prototype.transformBillingAddress=function(e,t){return t&&(A(t,e,"billing"),e.billingPhoneNumber=t.phoneNumber,e.billingGivenName=t.givenName,e.billingSurname=t.surname),e},y.prototype.transformShippingAddress=function(e){var t=e.shippingAddress;return t&&(A(t,e,"shipping"),delete e.shippingAddress),e},y.prototype._createV1IframeModalElement=function(e){var t=document.createElement("div");return t.innerHTML='<div data-braintree-v1-fallback-iframe-container="true" style="height: 400px;"></div>',t.querySelector('[data-braintree-v1-fallback-iframe-container="true"]').appendChild(e),t},y.prototype._createV1IframeModal=function(e){var t=this._createV1IframeModalElement(e),n=t.querySelector("[data-braintree-v1-fallback-close-button]"),e=t.querySelector("[data-braintree-v1-fallback-backdrop]"),r=this;function i(){t.parentNode.removeChild(t),r.cancelVerifyCard(u.THREEDS_CARDINAL_SDK_CANCELED),document.removeEventListener("keyup",r._onV1Keyup),r._onV1Keyup=null}return this._onV1Keyup=function(e){"Escape"===e.key&&t.parentNode&&i()},n&&n.addEventListener("click",i),e&&e.addEventListener("click",i),document.addEventListener("keyup",this._onV1Keyup),t},y.prototype._addV1IframeToPage=function(){document.body.appendChild(this._v1Modal)},y.prototype._handleAuthResponseFromV1Fallback=function(e){this._teardownV1Elements(),this._v1Modal.parentNode.removeChild(this._v1Modal),this._handleV1AuthResponse(e)},y.prototype._presentChallengeWithV1Fallback=function(e){var t=this;this._setupV1Elements({lookupResponse:e,showLoader:!0,handleAuthResponse:function(e){t._handleAuthResponseFromV1Fallback(e)}}),this._v1Modal=this._createV1IframeModal(this._v1Iframe),this._addV1IframeToPage()},y.prototype.setupSongbird=function(e){var t=this,n=Date.now();return this._songbirdPromise||(e=e||{},this._songbirdPromise=new E,this._v2SetupFailureReason="reason-unknown",t._loadCardinalScript(e).then(function(){return window.Cardinal?t._configureCardinalSdk({setupOptions:e,setupStartTime:n}):(t._v2SetupFailureReason="cardinal-global-unavailable",_.reject(new a(u.THREEDS_CARDINAL_SDK_SETUP_FAILED)))}).catch(function(e){e=s(e,{type:u.THREEDS_CARDINAL_SDK_SETUP_FAILED.type,code:u.THREEDS_CARDINAL_SDK_SETUP_FAILED.code,message:u.THREEDS_CARDINAL_SDK_SETUP_FAILED.message});t._getDfReferenceIdPromisePlus.reject(e),window.clearTimeout(t._songbirdSetupTimeoutReference),c.sendEvent(t._client,"three-d-secure.cardinal-sdk.init.setup-failed"),t.initiateV1Fallback("cardinal-sdk-setup-failed."+t._v2SetupFailureReason)}),this._songbirdPromise)},y.prototype._configureCardinalSdk=function(r){var i=this;return this._waitForClient().then(function(){var e=i._client.getConfiguration().gatewayConfiguration.threeDSecure;return e.hasOwnProperty("versionTwo")&&"cardinal"!==e.versionTwo?_.reject(new Error("cardinal-api-not-available-or-configured")):e}).then(function(e){var t=e.cardinalAuthenticationJWT,n=r.setupOptions,e=r.setupStartTime,n=i._createCardinalConfigurationOptions(n);f.forEach(function(e){i.setCardinalListener(e,function(){i._emit(y.events[e.toUpperCase()])})}),i.setCardinalListener("payments.setupComplete",i._createPaymentsSetupCompleteCallback()),i._setupFrameworkSpecificListeners(),window.Cardinal.configure(n),window.Cardinal.setup("init",{jwt:t}),i._clientMetadata.cardinalDeviceDataCollectionTimeElapsed=Date.now()-e,i.setCardinalListener("payments.validated",i._createPaymentsValidatedCallback())}).catch(function(e){return"cardinal-api-not-available-or-configured"===e.message?i._v2SetupFailureReason="cardinal-api-not-available-or-configured":i._v2SetupFailureReason="cardinal-configuration-threw-error",_.reject(e)})},y.prototype.setCardinalListener=function(e,t){this._cardinalEvents.push(e),window.Cardinal.on(e,t)},y.prototype._setupFrameworkSpecificListeners=function(){},y.prototype._createCardinalConfigurationOptions=function(e){var t=e.cardinalSDKConfig||{},n=t.payment||{};return!t.logging&&e.loggingEnabled&&(t.logging={level:"verbose"}),t.payment={},n.hasOwnProperty("displayLoading")&&(t.payment.displayLoading=n.displayLoading),n.hasOwnProperty("displayExitButton")&&(t.payment.displayExitButton=n.displayExitButton),t},y.prototype._loadCardinalScript=function(t){var n=this,r=p.CARDINAL_SCRIPT_SOURCE.sandbox;return this._waitForClient().then(function(){var e="production"===n._client.getConfiguration().gatewayConfiguration.environment;return n._songbirdSetupTimeoutReference=window.setTimeout(function(){c.sendEvent(n._client,"three-d-secure.cardinal-sdk.init.setup-timeout"),n.initiateV1Fallback("cardinal-sdk-setup-timeout")},t.timeout||h),e&&(r=p.CARDINAL_SCRIPT_SOURCE.production),d.loadScript({src:r})}).catch(function(e){return n._v2SetupFailureReason="songbird-js-failed-to-load",_.reject(s(e,u.THREEDS_CARDINAL_SDK_SCRIPT_LOAD_FAILED))})},y.prototype._createPaymentsSetupCompleteCallback=function(){var t=this;return function(e){t._getDfReferenceIdPromisePlus.resolve(e.sessionId),window.clearTimeout(t._songbirdSetupTimeoutReference),c.sendEvent(t._createPromise,"three-d-secure.cardinal-sdk.init.setup-completed"),t._songbirdPromise.resolve()}},y.prototype.getDfReferenceId=function(){return this._getDfReferenceIdPromisePlus},y.prototype._performJWTValidation=function(n,e){var r=this,t=this._lookupPaymentMethod.nonce,i="payment_methods/"+t+"/three_d_secure/authenticate_from_jwt",o=n&&n.Payment&&n.Payment.ExtendedData&&n.Payment.ExtendedData.ChallengeCancel;return o&&(c.sendEvent(this._createPromise,"three-d-secure.verification-flow.cardinal-sdk.cancel-code."+o),"01"===o&&this._emit(y.events.CUSTOMER_CANCELED)),c.sendEvent(this._createPromise,"three-d-secure.verification-flow.upgrade-payment-method.started"),this._waitForClient().then(function(){return r._client.request({method:"post",endpoint:i,data:{jwt:e,paymentMethodNonce:t}})}).then(function(e){var t=e.paymentMethod||r._lookupPaymentMethod,e=r._formatAuthResponse(t,e.threeDSecureInfo);return e.rawCardinalSDKVerificationData=n,c.sendEvent(r._client,"three-d-secure.verification-flow.upgrade-payment-method.succeeded"),_.resolve(e)}).catch(function(e){e=new a({type:u.THREEDS_JWT_AUTHENTICATION_FAILED.type,code:u.THREEDS_JWT_AUTHENTICATION_FAILED.code,message:u.THREEDS_JWT_AUTHENTICATION_FAILED.message,details:{originalError:e}});return c.sendEvent(r._client,"three-d-secure.verification-flow.upgrade-payment-method.errored"),_.reject(e)})},y.prototype._createPaymentsValidatedCallback=function(){var r=this;return function(e,t){var n;if(r._useV1Fallback)c.sendEvent(r._createPromise,"three-d-secure.verification-flow.cardinal-sdk.payments-validated-callback-called-in-v1-fallback-flow");else if(c.sendEvent(r._createPromise,"three-d-secure.verification-flow.cardinal-sdk.action-code."+e.ActionCode.toLowerCase()),r._verifyCardPromisePlus)switch(e.ActionCode){case"SUCCESS":case"NOACTION":case"FAILURE":r._performJWTValidation(e,t).then(function(e){r._verifyCardPromisePlus.resolve(e)}).catch(function(e){r._verifyCardPromisePlus.reject(e)});break;case"ERROR":switch(c.sendEvent(r._createPromise,"three-d-secure.verification-flow.cardinal-sdk-error."+e.ErrorNumber),e.ErrorNumber){case 10001:case 10002:n=new a(u.THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT);break;case 10003:case 10007:case 10009:n=new a(u.THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT);break;case 10005:case 10006:n=new a(u.THREEDS_CARDINAL_SDK_BAD_CONFIG);break;case 10008:case 10010:n=new a(u.THREEDS_CARDINAL_SDK_BAD_JWT);break;case 10011:c.sendEvent(r._createPromise,"three-d-secure.verification-flow.canceled"),n=new a(u.THREEDS_CARDINAL_SDK_CANCELED);break;default:n=new a(u.THREEDS_CARDINAL_SDK_ERROR)}n.details={originalError:{code:e.ErrorNumber,description:e.ErrorDescription}},r._verifyCardPromisePlus.reject(n)}else r.initiateV1Fallback("cardinal-sdk-setup-error.number-"+e.ErrorNumber)}},y.prototype._checkForVerifyCardError=function(e,t){return r.prototype._checkForVerifyCardError.call(this,e,t)},y.prototype._checkForFrameworkSpecificVerifyCardErrors=function(e,t){var n;return n="function"!=typeof e.onLookupComplete&&!t.ignoreOnLookupCompleteRequirement?"an onLookupComplete function":n},y.prototype._formatVerifyCardOptions=function(e){var t=r.prototype._formatVerifyCardOptions.call(this,e),n=t.additionalInformation||{},n=this.transformBillingAddress(n,e.billingAddress);return n=this.transformShippingAddress(n),e.onLookupComplete&&(t.onLookupComplete=o(e.onLookupComplete)),e.email&&(n.email=e.email),e.mobilePhoneNumber&&(n.mobilePhoneNumber=e.mobilePhoneNumber),t.additionalInformation=n,t},y.prototype._onLookupComplete=function(e,i){var o=this;return r.prototype._onLookupComplete.call(this,e).then(function(r){return new _(function(e,t){function n(){e(r)}r.requiresUserAuthentication=Boolean(r.lookup&&r.lookup.acsUrl),o._verifyCardPromisePlus.catch(t),i.onLookupComplete?i.onLookupComplete(r,n):o._emit(y.events.LOOKUP_COMPLETE,r,n)})})},y.prototype._presentChallenge=function(e){!this._useV1Fallback&&e.lookup.transactionId?window.Cardinal.continue("cca",{AcsUrl:e.lookup.acsUrl,Payload:e.lookup.pareq},{OrderDetails:{TransactionId:e.lookup.transactionId}}):this._presentChallengeWithV1Fallback(e.lookup)},y.prototype._formatLookupData=function(t){var n=this;return r.prototype._formatLookupData.call(this,t).then(function(e){return e.additionalInfo=t.additionalInformation,t.accountType&&(e.accountType=t.accountType),t.challengeRequested&&(e.challengeRequested=t.challengeRequested),t.dataOnlyRequested&&(e.dataOnlyRequested=t.dataOnlyRequested),t.exemptionRequested&&(e.exemptionRequested=t.exemptionRequested),t.bin&&(e.bin=t.bin),null!=t.cardAdd&&(e.cardAdd=t.cardAdd),null!=t.cardAddChallengeRequested&&(e.cardAdd=t.cardAddChallengeRequested),n.prepareLookup(e)})},y.prototype.cancelVerifyCard=function(t){var n=this;return r.prototype.cancelVerifyCard.call(this).then(function(e){return n._verifyCardPromisePlus&&(t=t||new a(u.THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT),n._verifyCardPromisePlus.reject(t)),e})},y.prototype._removeSongbirdListeners=function(){this._cardinalEvents.forEach(function(e){window.Cardinal.off(e)}),this._cardinalEvents=[]},y.prototype.teardown=function(){return window.Cardinal&&this._removeSongbirdListeners(),r.prototype.teardown.call(this)},t.exports=y},{"../../../lib/analytics":125,"../../../lib/assets":126,"../../../lib/assign":127,"../../../lib/braintree-error":130,"../../../lib/constants":132,"../../../lib/convert-to-braintree-error":134,"../../../lib/deferred":138,"../../../lib/enumerate":140,"../../../lib/promise":163,"../../shared/constants":199,"../../shared/errors":200,"./base":190,"@braintree/extended-promise":39}],197:[function(e,t,n){"use strict";var r=e("@braintree/wrap-promise"),i=e("../../lib/methods"),o=e("../../lib/convert-methods-to-error"),a=e("@braintree/event-emitter"),s=e("./frameworks");function c(e){var t=this,n=s[e.framework];a.call(this),this._framework=new n(e),this._framework.setUpEventListeners(function(){t._emit.apply(t,arguments)})}a.createChild(c),c.prototype.verifyCard=function(e){var t;return this.hasListener("lookup-complete")&&(t={ignoreOnLookupCompleteRequirement:!0}),this._framework.verifyCard(e,t)},c.prototype.initializeChallengeWithLookupResponse=function(e){return"string"==typeof e&&(e=JSON.parse(e)),this._framework.initializeChallengeWithLookupResponse(e)},c.prototype.prepareLookup=function(e){return this._framework.prepareLookup(e).then(function(e){return JSON.stringify(e)})},c.prototype.cancelVerifyCard=function(){return this._framework.cancelVerifyCard()},c.prototype.teardown=function(){var e=i(c.prototype).concat(i(a.prototype));return o(this,e),this._framework.teardown()},t.exports=r.wrapPrototype(c)},{"../../lib/convert-methods-to-error":133,"../../lib/methods":161,"./frameworks":193,"@braintree/event-emitter":38,"@braintree/wrap-promise":48}],198:[function(e,t,n){"use strict";var a=e("./external/three-d-secure"),s=e("../lib/is-https").isHTTPS,i=e("../lib/basic-component-verification"),c=e("../lib/create-deferred-client"),d=e("../lib/create-assets-url"),u=e("../lib/braintree-error"),l=e("../lib/analytics"),p=e("./shared/errors"),_=e("../lib/promise"),e=e("@braintree/wrap-promise");t.exports={create:e(function(o){var r="3D Secure";return i.verify({name:r,client:o.client,authorization:o.authorization}).then(function(){var e=d.create(o.authorization),i=function(e){var t=String(e.version||"");if(!t||"1"===t)return"legacy";switch(t){case"2":case"2-cardinal-modal":return"cardinal-modal";case"2-bootstrap3-modal":return"bootstrap3-modal";case"2-inline-iframe":return"inline-iframe";default:throw new u({code:p.THREEDS_UNRECOGNIZED_VERSION.code,type:p.THREEDS_UNRECOGNIZED_VERSION.type,message:"Version `"+e.version+"` is not a recognized version. You may need to update the version of your Braintree SDK to support this version."})}}(o),t=c.create({authorization:o.authorization,client:o.client,debug:o.debug,assetsUrl:e,name:r}).then(function(e){var t,n=e.getConfiguration(),r=n.gatewayConfiguration;return o.client=e,r.threeDSecureEnabled||(t=p.THREEDS_NOT_ENABLED),"TOKENIZATION_KEY"===n.authorizationType&&(t=p.THREEDS_CAN_NOT_USE_TOKENIZATION_KEY),"production"===r.environment&&!s()&&(t=p.THREEDS_HTTPS_REQUIRED),"legacy"===i||r.threeDSecure&&r.threeDSecure.cardinalAuthenticationJWT||(l.sendEvent(o.client,"three-d-secure.initialization.failed.missing-cardinalAuthenticationJWT"),t=p.THREEDS_NOT_ENABLED_FOR_V2),t?_.reject(new u(t)):(l.sendEvent(o.client,"three-d-secure.initialized"),e)}),n=new a({client:o.client,assetsUrl:e,createPromise:t,loggingEnabled:o.loggingEnabled,cardinalSDKConfig:o.cardinalSDKConfig,framework:i});return o.client?t.then(function(){return n}):n})}),VERSION:"3.81.0"}},{"../lib/analytics":125,"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/is-https":158,"../lib/promise":163,"./external/three-d-secure":197,"./shared/errors":200,"@braintree/wrap-promise":48}],199:[function(e,t,n){"use strict";t.exports={LANDING_FRAME_NAME:"braintreethreedsecurelanding",CARDINAL_SCRIPT_SOURCE:{production:"https://songbird.cardinalcommerce.com/edge/v1/songbird.js",sandbox:"https://songbirdstag.cardinalcommerce.com/edge/v1/songbird.js"}}},{}],200:[function(e,t,n){"use strict";e=e("../../lib/braintree-error");t.exports={THREEDS_NOT_ENABLED:{type:e.types.MERCHANT,code:"THREEDS_NOT_ENABLED",message:"3D Secure is not enabled for this merchant."},THREEDS_CAN_NOT_USE_TOKENIZATION_KEY:{type:e.types.MERCHANT,code:"THREEDS_CAN_NOT_USE_TOKENIZATION_KEY",message:"3D Secure can not use a tokenization key for authorization."},THREEDS_HTTPS_REQUIRED:{type:e.types.MERCHANT,code:"THREEDS_HTTPS_REQUIRED",message:"3D Secure requires HTTPS."},THREEDS_NOT_ENABLED_FOR_V2:{type:e.types.MERCHANT,code:"THREEDS_NOT_ENABLED_FOR_V2",message:"3D Secure version 2 is not enabled for this merchant. Contact Braintree Support for assistance at https://help.braintreepayments.com/"},THREEDS_UNRECOGNIZED_VERSION:{type:e.types.MERCHANT,code:"THREEDS_UNRECOGNIZED_VERSION"},THREEDS_CARDINAL_SDK_SETUP_FAILED:{type:e.types.UNKNOWN,code:"THREEDS_CARDINAL_SDK_SETUP_FAILED",message:"Something went wrong setting up Cardinal's Songbird.js library."},THREEDS_CARDINAL_SDK_SCRIPT_LOAD_FAILED:{type:e.types.NETWORK,code:"THREEDS_CARDINAL_SDK_SCRIPT_LOAD_FAILED",message:"Cardinal's Songbird.js library could not be loaded."},THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT:{type:e.types.UNKNOWN,code:"THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT",message:"Cardinal's Songbird.js took too long to setup."},THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT:{type:e.types.UNKNOWN,code:"THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT",message:"Cardinal's API took too long to respond."},THREEDS_CARDINAL_SDK_BAD_CONFIG:{type:e.types.MERCHANT,code:"THREEDS_CARDINAL_SDK_BAD_CONFIG",message:"JWT or other required field missing. Please check your setup configuration."},THREEDS_CARDINAL_SDK_BAD_JWT:{type:e.types.MERCHANT,code:"THREEDS_CARDINAL_SDK_BAD_JWT",message:"Cardinal JWT missing or malformed. Please check your setup configuration."},THREEDS_CARDINAL_SDK_ERROR:{type:e.types.UNKNOWN,code:"THREEDS_CARDINAL_SDK_ERROR",message:"A general error has occurred with Cardinal. See description for more information."},THREEDS_CARDINAL_SDK_CANCELED:{type:e.types.CUSTOMER,code:"THREEDS_CARDINAL_SDK_CANCELED",message:"Canceled by user."},THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT:{type:e.types.MERCHANT,code:"THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT",message:"3D Secure verfication canceled by merchant."},THREEDS_AUTHENTICATION_IN_PROGRESS:{type:e.types.MERCHANT,code:"THREEDS_AUTHENTICATION_IN_PROGRESS",message:"Cannot call verifyCard while existing authentication is in progress."},THREEDS_MISSING_VERIFY_CARD_OPTION:{type:e.types.MERCHANT,code:"THREEDS_MISSING_VERIFY_CARD_OPTION"},THREEDS_JWT_AUTHENTICATION_FAILED:{type:e.types.UNKNOWN,code:"THREEDS_JWT_AUTHENTICATION_FAILED",message:"Something went wrong authenticating the JWT from Cardinal"},THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR:{type:e.types.MERCHANT,code:"THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR",message:"Either the payment method nonce passed to `verifyCard` does not exist, or it was already consumed"},THREEDS_LOOKUP_VALIDATION_ERROR:{type:e.types.CUSTOMER,code:"THREEDS_LOOKUP_VALIDATION_ERROR",message:"The data passed in `verifyCard` did not pass validation checks. See details for more info"},THREEDS_LOOKUP_ERROR:{type:e.types.UNKNOWN,code:"THREEDS_LOOKUP_ERROR",message:"Something went wrong during the 3D Secure lookup"},THREEDS_INLINE_IFRAME_DETAILS_INCORRECT:{type:e.types.UNKNOWN,code:"THREEDS_INLINE_IFRAME_DETAILS_INCORRECT",message:"Something went wrong when attempting to add the authentication iframe to the page."},THREEDS_NO_VERIFICATION_PAYLOAD:{type:e.types.MERCHANT,code:"THREEDS_NO_VERIFICATION_PAYLOAD",message:"No verification payload available."},THREEDS_TERM_URL_REQUIRES_BRAINTREE_DOMAIN:{type:e.types.INTERNAL,code:"THREEDS_TERM_URL_REQUIRES_BRAINTREE_DOMAIN",message:"Term Url must be on a Braintree domain."},THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED:{type:e.types.INTERNAL,code:"THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED",message:"Method not implemented for this framework."}}},{"../../lib/braintree-error":130}],201:[function(e,t,n){"use strict";e=e("../../lib/enumerate");t.exports=e(["AUTHENTICATION_COMPLETE"],"threedsecure:")},{"../../lib/enumerate":140}],202:[function(e,t,n){"use strict";var r=e("./shared/unionpay"),i=e("../lib/basic-component-verification"),o=e("../lib/braintree-error"),a=e("../lib/create-deferred-client"),s=e("../lib/create-assets-url"),c=e("../lib/analytics"),d=e("./shared/errors"),u=e("../lib/promise"),e=e("@braintree/wrap-promise");t.exports={create:e(function(n){var e="UnionPay";return i.verify({name:e,client:n.client,authorization:n.authorization}).then(function(){return a.create({authorization:n.authorization,client:n.client,debug:n.debug,assetsUrl:s.create(n.authorization),name:e})}).then(function(e){var t=e.getConfiguration();return n.client=e,t.gatewayConfiguration.unionPay&&!0===t.gatewayConfiguration.unionPay.enabled?(c.sendEvent(n.client,"unionpay.initialized"),new r(n)):u.reject(new o(d.UNIONPAY_NOT_ENABLED))})}),VERSION:"3.81.0"}},{"../lib/analytics":125,"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"./shared/errors":204,"./shared/unionpay":205,"@braintree/wrap-promise":48}],203:[function(e,t,n){"use strict";e=e("../../lib/enumerate");t.exports={events:e(["HOSTED_FIELDS_FETCH_CAPABILITIES","HOSTED_FIELDS_ENROLL","HOSTED_FIELDS_TOKENIZE"],"union-pay:"),HOSTED_FIELDS_FRAME_NAME:"braintreeunionpayhostedfields"}},{"../../lib/enumerate":140}],204:[function(e,t,n){"use strict";e=e("../../lib/braintree-error");t.exports={UNIONPAY_NOT_ENABLED:{type:e.types.MERCHANT,code:"UNIONPAY_NOT_ENABLED",message:"UnionPay is not enabled for this merchant."},UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID:{type:e.types.MERCHANT,code:"UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID",message:"Found an invalid Hosted Fields instance. Please use a valid Hosted Fields instance."},UNIONPAY_HOSTED_FIELDS_INSTANCE_REQUIRED:{type:e.types.MERCHANT,code:"UNIONPAY_HOSTED_FIELDS_INSTANCE_REQUIRED",message:"Could not find the Hosted Fields instance."},UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED:{type:e.types.MERCHANT,code:"UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED",message:"A card or a Hosted Fields instance is required. Please supply a card or a Hosted Fields instance."},UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES:{type:e.types.MERCHANT,code:"UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES",message:"Please supply either a card or a Hosted Fields instance, not both."},UNIONPAY_EXPIRATION_DATE_INCOMPLETE:{type:e.types.MERCHANT,code:"UNIONPAY_EXPIRATION_DATE_INCOMPLETE",message:"You must supply expiration month and year or neither."},UNIONPAY_ENROLLMENT_CUSTOMER_INPUT_INVALID:{type:e.types.CUSTOMER,code:"UNIONPAY_ENROLLMENT_CUSTOMER_INPUT_INVALID",message:"Enrollment failed due to user input error."},UNIONPAY_ENROLLMENT_NETWORK_ERROR:{type:e.types.NETWORK,code:"UNIONPAY_ENROLLMENT_NETWORK_ERROR",message:"Could not enroll UnionPay card."},UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR:{type:e.types.NETWORK,code:"UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR",message:"Could not fetch card capabilities."},UNIONPAY_TOKENIZATION_NETWORK_ERROR:{type:e.types.NETWORK,code:"UNIONPAY_TOKENIZATION_NETWORK_ERROR",message:"A tokenization network error occurred."},UNIONPAY_MISSING_MOBILE_PHONE_DATA:{type:e.types.MERCHANT,code:"UNIONPAY_MISSING_MOBILE_PHONE_DATA",message:"A `mobile` with `countryCode` and `number` is required."},UNIONPAY_FAILED_TOKENIZATION:{type:e.types.CUSTOMER,code:"UNIONPAY_FAILED_TOKENIZATION",message:"The supplied card data failed tokenization."}}},{"../../lib/braintree-error":130}],205:[function(e,t,n){"use strict";var s=e("../../lib/analytics"),c=e("../../lib/braintree-error"),o=e("framebus"),a=e("./constants"),d=e("../../lib/is-verified-domain"),u=e("../../lib/use-min"),r=e("../../lib/convert-methods-to-error"),l=e("./errors"),p=a.events,_=e("@braintree/iframer"),i=e("../../lib/methods"),E=e("@braintree/uuid"),h=e("../../lib/promise"),m=e("@braintree/wrap-promise"),f=e("../../lib/constants").BUS_CONFIGURATION_REQUEST_EVENT;function y(e){this._options=e}y.prototype.fetchCapabilities=function(e){var r=this,n=this._options.client,t=e.card?e.card.number:null,i=e.hostedFields;return t&&i?h.reject(new c(l.UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES)):t?n.request({method:"get",endpoint:"payment_methods/credit_cards/capabilities",data:{_meta:{source:"unionpay"},creditCard:{number:t}}}).then(function(e){return s.sendEvent(n,"unionpay.capabilities-received"),e}).catch(function(e){var t=e.details&&e.details.httpStatus;return s.sendEvent(n,"unionpay.capabilities-failed"),403===t?h.reject(e):h.reject(new c({type:l.UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR.type,code:l.UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR.code,message:l.UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR.message,details:{originalError:e}}))}):i?i._bus?r._initializeHostedFields().then(function(){return new h(function(t,n){r._bus.emit(p.HOSTED_FIELDS_FETCH_CAPABILITIES,{hostedFields:i},function(e){e.err?n(new c(e.err)):t(e.payload)})})}):h.reject(new c(l.UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID)):h.reject(new c(l.UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED))},y.prototype.enroll=function(e){var r=this,i=this._options.client,t=e.card,o=e.mobile,a=e.hostedFields;if(!o)return h.reject(new c(l.UNIONPAY_MISSING_MOBILE_PHONE_DATA));if(a)return a._bus?t?h.reject(new c(l.UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES)):new h(function(t,n){r._initializeHostedFields().then(function(){r._bus.emit(p.HOSTED_FIELDS_ENROLL,{hostedFields:a,mobile:o},function(e){e.err?n(new c(e.err)):t(e.payload)})})}):h.reject(new c(l.UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID));if(t&&t.number){if(e={_meta:{source:"unionpay"},unionPayEnrollment:{number:t.number,mobileCountryCode:o.countryCode,mobileNumber:o.number}},t.expirationDate)e.unionPayEnrollment.expirationDate=t.expirationDate;else if(t.expirationMonth||t.expirationYear){if(!t.expirationMonth||!t.expirationYear)return h.reject(new c(l.UNIONPAY_EXPIRATION_DATE_INCOMPLETE));e.unionPayEnrollment.expirationYear=t.expirationYear,e.unionPayEnrollment.expirationMonth=t.expirationMonth}return i.request({method:"post",endpoint:"union_pay_enrollments",data:e}).then(function(e){return s.sendEvent(i,"unionpay.enrollment-succeeded"),{enrollmentId:e.unionPayEnrollmentId,smsCodeRequired:e.smsCodeRequired}}).catch(function(e){var t,n=e.details&&e.details.httpStatus;return 403===n?t=e:n<500?(t=new c(l.UNIONPAY_ENROLLMENT_CUSTOMER_INPUT_INVALID)).details={originalError:e}:(t=new c(l.UNIONPAY_ENROLLMENT_NETWORK_ERROR)).details={originalError:e},s.sendEvent(i,"unionpay.enrollment-failed"),h.reject(t)})}return h.reject(new c(l.UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED))},y.prototype.tokenize=function(e){var t,r=this,i=this._options.client,n=e.card,o=e.hostedFields;return n&&o?h.reject(new c(l.UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES)):n?(t={_meta:{source:"unionpay"},creditCard:{number:e.card.number,options:{unionPayEnrollment:{id:e.enrollmentId}}}},e.smsCode&&(t.creditCard.options.unionPayEnrollment.smsCode=e.smsCode),n.expirationDate?t.creditCard.expirationDate=n.expirationDate:n.expirationMonth&&n.expirationYear&&(t.creditCard.expirationYear=n.expirationYear,t.creditCard.expirationMonth=n.expirationMonth),e.card.cvv&&(t.creditCard.cvv=e.card.cvv),i.request({method:"post",endpoint:"payment_methods/credit_cards",data:t}).then(function(e){e=e.creditCards[0];return delete e.consumed,delete e.threeDSecureInfo,s.sendEvent(i,"unionpay.nonce-received"),e}).catch(function(e){var t,n=e.details&&e.details.httpStatus;return s.sendEvent(i,"unionpay.nonce-failed"),403===n?t=e:n<500?(t=new c(l.UNIONPAY_FAILED_TOKENIZATION)).details={originalError:e}:(t=new c(l.UNIONPAY_TOKENIZATION_NETWORK_ERROR)).details={originalError:e},h.reject(t)})):o?o._bus?new h(function(t,n){r._initializeHostedFields().then(function(){r._bus.emit(p.HOSTED_FIELDS_TOKENIZE,e,function(e){e.err?n(new c(e.err)):t(e.payload)})})}):h.reject(new c(l.UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID)):h.reject(new c(l.UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED))},y.prototype.teardown=function(){return this._bus&&(this._hostedFieldsFrame.parentNode.removeChild(this._hostedFieldsFrame),this._bus.teardown()),r(this,i(y.prototype)),h.resolve()},y.prototype._initializeHostedFields=function(){var e,n,r=E(),i=this;return this._hostedFieldsInitializePromise||(this._hostedFieldsInitializePromise=new h(function(t){e=i._options.client.getConfiguration().gatewayConfiguration.assetsUrl,n=i._options.client.getConfiguration().isDebug,i._bus=new o({channel:r,verifyDomain:d}),i._hostedFieldsFrame=_({name:a.HOSTED_FIELDS_FRAME_NAME+"_"+r,src:e+"/web/3.81.0/html/unionpay-hosted-fields-frame"+u(n)+".html",height:0,width:0}),i._bus.on(f,function(e){e(i._options.client),t()}),document.body.appendChild(i._hostedFieldsFrame)}),this._hostedFieldsInitializePromise)},t.exports=m.wrapPrototype(y)},{"../../lib/analytics":125,"../../lib/braintree-error":130,"../../lib/constants":132,"../../lib/convert-methods-to-error":133,"../../lib/is-verified-domain":159,"../../lib/methods":161,"../../lib/promise":163,"../../lib/use-min":166,"./constants":203,"./errors":204,"@braintree/iframer":40,"@braintree/uuid":44,"@braintree/wrap-promise":48,framebus:57}],206:[function(e,t,n){"use strict";t.exports={PLAID_LINK_JS:"https://cdn.plaid.com/link/v2/stable/link-initialize.js"}},{}],207:[function(e,t,n){"use strict";e=e("../lib/braintree-error");t.exports={US_BANK_ACCOUNT_OPTION_REQUIRED:{type:e.types.MERCHANT,code:"US_BANK_ACCOUNT_OPTION_REQUIRED"},US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS:{type:e.types.MERCHANT,code:"US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS"},US_BANK_ACCOUNT_LOGIN_LOAD_FAILED:{type:e.types.NETWORK,code:"US_BANK_ACCOUNT_LOGIN_LOAD_FAILED",message:"Bank login flow failed to load."},US_BANK_ACCOUNT_LOGIN_CLOSED:{type:e.types.CUSTOMER,code:"US_BANK_ACCOUNT_LOGIN_CLOSED",message:"Customer closed bank login flow before authorizing."},US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE:{type:e.types.MERCHANT,code:"US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE",message:"Another bank login tokenization request is active."},US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR:{type:e.types.NETWORK,code:"US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR",message:"A tokenization network error occurred."},US_BANK_ACCOUNT_FAILED_TOKENIZATION:{type:e.types.CUSTOMER,code:"US_BANK_ACCOUNT_FAILED_TOKENIZATION",message:"The supplied data failed tokenization."},US_BANK_ACCOUNT_NOT_ENABLED:{type:e.types.MERCHANT,code:"US_BANK_ACCOUNT_NOT_ENABLED",message:"US bank account is not enabled."},US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED:{type:e.types.MERCHANT,code:"US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED",message:"Bank login is not enabled."}}},{"../lib/braintree-error":130}],208:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("../lib/braintree-error"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("./errors"),c=e("./us-bank-account"),d=e("../lib/promise"),e=e("@braintree/wrap-promise");t.exports={create:e(function(t){var e="US Bank Account";return r.verify({name:e,client:t.client,authorization:t.authorization}).then(function(){return o.create({authorization:t.authorization,client:t.client,debug:t.debug,assetsUrl:a.create(t.authorization),name:e})}).then(function(e){return t.client=e,t.client.getConfiguration().gatewayConfiguration.usBankAccount?new c(t):d.reject(new i(s.US_BANK_ACCOUNT_NOT_ENABLED))})}),VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"./errors":207,"./us-bank-account":209,"@braintree/wrap-promise":48}],209:[function(e,t,n){"use strict";var d=e("../lib/braintree-error"),r=e("./constants"),u=e("./errors"),i=e("../lib/errors"),l=e("../lib/analytics"),o=e("../lib/once"),a=e("../lib/convert-methods-to-error"),s=e("../lib/methods"),p=e("../lib/promise"),e=e("@braintree/wrap-promise");y("UsBankAccount"),y("UsBankLogin");function c(e){this._client=e.client,this._isTokenizingBankLogin=!1,l.sendEvent(this._client,"usbankaccount.initialized")}function _(e){var t=e.details&&e.details.httpStatus,t=new d(401===t?i.BRAINTREE_API_ACCESS_RESTRICTED:t<500?u.US_BANK_ACCOUNT_FAILED_TOKENIZATION:u.US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR);return t.details={originalError:e},t}function E(e,t){e=e.data[t].paymentMethod,t=e.details.last4;return{nonce:e.id,details:{},description:"US bank account ending in - "+t,type:"us_bank_account"}}function h(t,n){function r(){var e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(t.removeEventListener("error",i),t.removeEventListener("load",r),t.removeEventListener("readystatechange",r),n(null,window.Plaid))}function i(){t.parentNode.removeChild(t),n(new d(u.US_BANK_ACCOUNT_LOGIN_LOAD_FAILED))}t.addEventListener("error",i),t.addEventListener("load",r),t.addEventListener("readystatechange",r)}function m(e){return{streetAddress:e.streetAddress,extendedAddress:e.extendedAddress,city:e.locality,state:e.region,zipCode:e.postalCode}}function f(e,t){"personal"===t.ownershipType?e.individualOwner={firstName:t.firstName,lastName:t.lastName}:"business"===t.ownershipType&&(e.businessOwner={businessName:t.businessName})}function y(e){return"mutation Tokenize"+e+"($input: Tokenize"+e+"Input!) {  tokenize"+e+"(input: $input) {    paymentMethod {      id      details {        ... on UsBankAccountDetails {          last4        }      }    }  }}"}c.prototype.tokenize=function(e){return(e=e||{}).mandateText?e.bankDetails&&e.bankLogin?p.reject(new d({type:u.US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS.type,code:u.US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS.code,message:"tokenize must be called with bankDetails or bankLogin, not both."})):e.bankDetails?this._tokenizeBankDetails(e):e.bankLogin?this._tokenizeBankLogin(e):p.reject(new d({type:u.US_BANK_ACCOUNT_OPTION_REQUIRED.type,code:u.US_BANK_ACCOUNT_OPTION_REQUIRED.code,message:"tokenize must be called with bankDetails or bankLogin."})):p.reject(new d({type:u.US_BANK_ACCOUNT_OPTION_REQUIRED.type,code:u.US_BANK_ACCOUNT_OPTION_REQUIRED.code,message:"mandateText property is required."}))},c.prototype._tokenizeBankDetails=function(e){var t=this._client,n=e.bankDetails,e={achMandate:e.mandateText,routingNumber:n.routingNumber,accountNumber:n.accountNumber,accountType:n.accountType.toUpperCase(),billingAddress:m(n.billingAddress||{})};return f(e,n),t.request({api:"graphQLApi",data:{query:"mutation TokenizeUsBankAccount($input: TokenizeUsBankAccountInput!) {  tokenizeUsBankAccount(input: $input) {    paymentMethod {      id      details {        ... on UsBankAccountDetails {          last4        }      }    }  }}",variables:{input:{usBankAccount:e}}}}).then(function(e){return l.sendEvent(t,"usbankaccount.bankdetails.tokenization.succeeded"),p.resolve(E(e,"tokenizeUsBankAccount"))}).catch(function(e){e=_(e);return l.sendEvent(t,"usbankaccount.bankdetails.tokenization.failed"),p.reject(e)})},c.prototype._tokenizeBankLogin=function(o){var a=this,s=this._client,e=s.getConfiguration().gatewayConfiguration,c="production"===e.environment,n=e.usBankAccount.plaid;return o.bankLogin.displayName?n?this._isTokenizingBankLogin?p.reject(new d(u.US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE)):(this._isTokenizingBankLogin=!0,new p(function(r,i){a._loadPlaid(function(e,t){e?i(e):(t.create({clientName:o.bankLogin.displayName,apiVersion:"v2",env:c?"production":"sandbox",key:n.publicKey,product:"auth",selectAccount:!0,onExit:function(){a._isTokenizingBankLogin=!1,l.sendEvent(s,"usbankaccount.banklogin.tokenization.closed.by-user"),i(new d(u.US_BANK_ACCOUNT_LOGIN_CLOSED))},onSuccess:function(e,t){var n=o.bankLogin,t={publicToken:e,accountId:c?t.account_id:"plaid_account_id",accountType:t.account.subtype.toUpperCase(),achMandate:o.mandateText,billingAddress:m(n.billingAddress||{})};f(t,n),s.request({api:"graphQLApi",data:{query:"mutation TokenizeUsBankLogin($input: TokenizeUsBankLoginInput!) {  tokenizeUsBankLogin(input: $input) {    paymentMethod {      id      details {        ... on UsBankAccountDetails {          last4        }      }    }  }}",variables:{input:{usBankLogin:t}}}}).then(function(e){a._isTokenizingBankLogin=!1,l.sendEvent(s,"usbankaccount.banklogin.tokenization.succeeded"),r(E(e,"tokenizeUsBankLogin"))}).catch(function(e){a._isTokenizingBankLogin=!1,e=_(e),l.sendEvent(s,"usbankaccount.banklogin.tokenization.failed"),i(e)})}}).open(),l.sendEvent(s,"usbankaccount.banklogin.tokenization.started"))})})):p.reject(new d(u.US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED)):p.reject(new d({type:u.US_BANK_ACCOUNT_OPTION_REQUIRED.type,code:u.US_BANK_ACCOUNT_OPTION_REQUIRED.code,message:"displayName property is required when using bankLogin."}))},c.prototype._loadPlaid=function(e){var t;e=o(e),window.Plaid?e(null,window.Plaid):(t=document.querySelector('script[src="'+r.PLAID_LINK_JS+'"]'))?h(t,e):((t=document.createElement("script")).src=r.PLAID_LINK_JS,t.async=!0,h(t,e),document.body.appendChild(t),this._plaidScript=t)},c.prototype.teardown=function(){return this._plaidScript&&document.body.removeChild(this._plaidScript),a(this,s(c.prototype)),p.resolve()},t.exports=e.wrapPrototype(c)},{"../lib/analytics":125,"../lib/braintree-error":130,"../lib/convert-methods-to-error":133,"../lib/errors":141,"../lib/methods":161,"../lib/once":162,"../lib/promise":163,"./constants":206,"./errors":207,"@braintree/wrap-promise":48}],210:[function(e,t,n){"use strict";e=e("../lib/braintree-error");t.exports={VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN:{type:e.types.MERCHANT,code:"VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN",message:"A client token with a customer id must be used to delete a payment method nonce."},VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND:{type:e.types.MERCHANT,code:"VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND"},VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR:{type:e.types.UNKNOWN,code:"VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR"}}},{"../lib/braintree-error":130}],211:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("../lib/create-deferred-client"),o=e("../lib/create-assets-url"),a=e("./vault-manager"),e=e("@braintree/wrap-promise");t.exports={create:e(function(e){var t="Vault Manager";return r.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return new a({createPromise:i.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o.create(e.authorization),name:t})})})}),VERSION:"3.81.0"}},{"../lib/basic-component-verification":128,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"./vault-manager":212,"@braintree/wrap-promise":48}],212:[function(e,t,n){"use strict";var i=e("../lib/analytics"),o=e("../lib/braintree-error"),a=e("./errors"),r=e("../lib/convert-methods-to-error"),s=e("../lib/methods"),c=e("../lib/promise"),e=e("@braintree/wrap-promise");function d(e){this._createPromise=e.createPromise}function u(e){var t={nonce:e.nonce,default:e.default,details:e.details,hasSubscription:e.hasSubscription,type:e.type};return e.description&&(t.description=e.description),e.binData&&(t.binData=e.binData),t}d.prototype.fetchPaymentMethods=function(e){var t=!0===(e=e||{}).defaultFirst?1:0;return this._createPromise.then(function(e){return e.request({endpoint:"payment_methods",method:"get",data:{defaultFirst:t}})}).then(function(e){return i.sendEvent(this._createPromise,"vault-manager.fetch-payment-methods.succeeded"),e.paymentMethods.map(u)}.bind(this))},d.prototype.deletePaymentMethod=function(r){return this._createPromise.then(function(n){return"CLIENT_TOKEN"===n.getConfiguration().authorizationType?n.request({api:"graphQLApi",data:{query:"mutation DeletePaymentMethodFromSingleUseToken($input: DeletePaymentMethodFromSingleUseTokenInput!) {  deletePaymentMethodFromSingleUseToken(input: $input) {    clientMutationId  }}",variables:{input:{singleUseTokenId:r}},operationName:"DeletePaymentMethodFromSingleUseToken"}}).then(function(){i.sendEvent(n,"vault-manager.delete-payment-method.succeeded")}).catch(function(e){var t,e=e.details.originalError;return i.sendEvent(n,"vault-manager.delete-payment-method.failed"),t=(t=e[0]&&"NOT_FOUND"===e[0].extensions.errorClass?new o({type:a.VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND.type,code:a.VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND.code,message:"A payment method for payment method nonce `"+r+"` could not be found.",details:{originalError:e}}):t)||new o({type:a.VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR.type,code:a.VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR.code,message:"An unknown error occured when attempting to delete the payment method assocaited with the payment method nonce `"+r+"`.",details:{originalError:e}}),c.reject(t)}):c.reject(new o(a.VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN))})},d.prototype.teardown=function(){return r(this,s(d.prototype)),c.resolve()},t.exports=e.wrapPrototype(d)},{"../lib/analytics":125,"../lib/braintree-error":130,"../lib/convert-methods-to-error":133,"../lib/methods":161,"../lib/promise":163,"./errors":210,"@braintree/wrap-promise":48}],213:[function(e,t,n){"use strict";var r=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e("./venmo-desktop"));t.exports=function(e){return new r.default(e).initialize()}},{"./venmo-desktop":215}],214:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.VENMO_PAYMENT_CONTEXT_STATUS_QUERY=n.LEGACY_VENMO_PAYMENT_CONTEXT_STATUS_QUERY=n.UPDATE_PAYMENT_CONTEXT_QUERY=n.LEGACY_UPDATE_PAYMENT_CONTEXT_QUERY=n.CREATE_PAYMENT_CONTEXT_QUERY=n.LEGACY_CREATE_PAYMENT_CONTEXT_QUERY=void 0,n.LEGACY_CREATE_PAYMENT_CONTEXT_QUERY="mutation CreateVenmoQRCodePaymentContext($input: CreateVenmoQRCodePaymentContextInput!) {\n  createVenmoQRCodePaymentContext(input: $input) {\n    clientMutationId\n    venmoQRCodePaymentContext {\n      id\n      merchantId\n      createdAt\n      expiresAt\n    }\n  }\n}",n.CREATE_PAYMENT_CONTEXT_QUERY="mutation CreateVenmoPaymentContext($input: CreateVenmoPaymentContextInput!) {\n  createVenmoPaymentContext(input: $input) {\n    clientMutationId\n    venmoPaymentContext {\n      id\n      merchantId\n      createdAt\n      expiresAt\n    }\n  }\n}",n.LEGACY_UPDATE_PAYMENT_CONTEXT_QUERY="mutation UpdateVenmoQRCodePaymentContext($input: UpdateVenmoQRCodePaymentContextInput!) {\n  updateVenmoQRCodePaymentContext(input: $input) {\n    clientMutationId\n  }\n}",n.UPDATE_PAYMENT_CONTEXT_QUERY="mutation UpdateVenmoPaymentContextStatus($input: UpdateVenmoPaymentContextStatusInput!) {\n  updateVenmoPaymentContextStatus(input: $input) {\n    clientMutationId\n  }\n}",n.LEGACY_VENMO_PAYMENT_CONTEXT_STATUS_QUERY="query PaymentContext($id: ID!) {\n  node(id: $id) {\n    ... on VenmoQRCodePaymentContext {\n      status\n      paymentMethodId\n      userName\n    }\n  }\n}",n.VENMO_PAYMENT_CONTEXT_STATUS_QUERY="query PaymentContext($id: ID!) {\n  node(id: $id) {\n    ... on VenmoPaymentContext {\n      status\n      paymentMethodId\n      userName\n    }\n  }\n}"},{}],215:[function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var o=i(e("framebus")),a=i(e("@braintree/iframer")),s=i(e("@braintree/uuid")),c=e("../shared/events"),d=e("./queries"),e=(u.prototype.initialize=function(){var t=this;return new this.Promise(function(e){t.bus.on(c.VENMO_DESKTOP_IFRAME_READY,function(){e(t)}),t.bus.on(c.VENMO_DESKTOP_REQUEST_NEW_QR_CODE,function(){t.sendEvent("venmo.tokenize.desktop.restarted-from-error-view"),t.startPolling()}),document.body.appendChild(t.iframe),document.body.appendChild(t.alertBox)})},u.prototype.launchDesktopFlow=function(){var a=this;this.isHidden=!1;var e=new this.Promise(function(t,n){a.launchDesktopPromiseRejectFunction=n;function r(){a.bus.off(c.VENMO_DESKTOP_CUSTOMER_CANCELED,i),a.bus.off(c.VENMO_DESKTOP_AUTHORIZATION_COMPLETED,o),a.bus.off(c.VENMO_DESKTOP_UNKNOWN_ERROR,e)}var e=function(e){r(),a.sendEvent("venmo.tokenize.desktop.unknown-error"),n({allowUIToHandleError:!1,reason:"UNKNOWN_ERROR",err:e})},i=function(){r(),a.updateVenmoDesktopPaymentContext("CANCELED"),a.sendEvent("venmo.tokenize.desktop.status-change.canceled-from-modal"),n({allowUIToHandleError:!1,reason:"CUSTOMER_CANCELED"})},o=function(e){r(),t(e)};a.bus.on(c.VENMO_DESKTOP_CUSTOMER_CANCELED,i),a.bus.on(c.VENMO_DESKTOP_AUTHORIZATION_COMPLETED,o),a.bus.on(c.VENMO_DESKTOP_UNKNOWN_ERROR,e)});return this.iframe.style.display="block",this.setAlert("Generating a QR code, get your Venmo app ready"),this.iframe.focus(),this.startPolling(),e.then(function(e){return delete a.venmoContextId,delete a.launchDesktopPromiseRejectFunction,e}).catch(function(e){return delete a.venmoContextId,delete a.launchDesktopPromiseRejectFunction,a.Promise.reject(e)})},u.prototype.triggerCompleted=function(e){var t=this;this.isHidden||setTimeout(function(){t.bus.emit(c.VENMO_DESKTOP_AUTHORIZATION_COMPLETED,e)},2e3)},u.prototype.triggerRejected=function(e){this.launchDesktopPromiseRejectFunction&&this.launchDesktopPromiseRejectFunction(e)},u.prototype.hideDesktopFlow=function(){this.setAlert(""),this.iframe.style.display="none",this.bus.emit(c.VENMO_DESKTOP_CLOSED_FROM_PARENT),this.isHidden=!0},u.prototype.displayError=function(e){this.isHidden||(this.bus.emit(c.VENMO_DESKTOP_DISPLAY_ERROR,{message:e}),this.setAlert(e))},u.prototype.displayQRCode=function(e,t){this.isHidden||(this.bus.emit(c.VENMO_DESKTOP_DISPLAY_QR_CODE,{id:e,merchantId:t}),this.setAlert("To scan the QR code, open your Venmo app"))},u.prototype.authorize=function(){this.isHidden||(this.bus.emit(c.VENMO_DESKTOP_AUTHORIZE),this.setAlert("Venmo account authorized"))},u.prototype.authorizing=function(){this.isHidden||(this.bus.emit(c.VENMO_DESKTOP_AUTHORIZING),this.setAlert("Authorize on your Venmo app"))},u.prototype.startPolling=function(){var n=this;return this.createVenmoDesktopPaymentContext().then(function(e){var t=new Date(e.expiresAt).getTime()-new Date(e.createdAt).getTime(),t=Date.now()+t;return n.displayQRCode(e.id,e.merchantId),n.pollForStatusChange(e.status,t)}).then(function(e){var t;e&&(t="@"+(t=e.userName||"").replace("@",""),n.triggerCompleted({paymentMethodNonce:e.paymentMethodId,username:t}))}).catch(function(e){e.allowUIToHandleError||(n.sendEvent("venmo.tokenize.desktop.unhandled-error"),n.triggerRejected(e))})},u.prototype.pollForStatusChange=function(r,i){var o=this;return this.venmoContextId?Date.now()>i?this.updateVenmoDesktopPaymentContext("EXPIRED").then(function(){return o.displayError("Something went wrong"),o.sendEvent("venmo.tokenize.desktop.status-change.sdk-timeout"),o.Promise.reject({allowUIToHandleError:!0,reason:"TIMEOUT"})}):this.lookupVenmoDesktopPaymentContext().then(function(e){if(!o.venmoContextId||!e)return o.Promise.resolve();var t=e.status;if(t!==r)switch(r=t,o.sendEvent("venmo.tokenize.desktop.status-change."+r.toLowerCase()),r){case"CREATED":break;case"EXPIRED":case"FAILED":case"CANCELED":var n="CANCELED"===r?"The authorization was canceled":"Something went wrong";return o.displayError(n),o.Promise.reject({allowUIToHandleError:!0,reason:r});case"SCANNED":o.authorizing();break;case"APPROVED":return o.authorize(),o.Promise.resolve(e)}return new o.Promise(function(e,t){setTimeout(function(){o.pollForStatusChange(r,i).then(e).catch(t)},1e3)})}):this.Promise.resolve()},u.prototype.teardown=function(){this.bus.teardown(),this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe),this.alertBox.parentNode&&this.alertBox.parentNode.removeChild(this.alertBox)},u.prototype.setAlert=function(e){this.alertBox.style.display=e?"block":"none",this.alertBox.textContent=e},u.prototype.createPaymentContextFromGraphqlLegacyQRCodeMutation=function(e){return this.apiRequest(d.LEGACY_CREATE_PAYMENT_CONTEXT_QUERY,{input:{environment:this.env,intent:e}}).then(function(e){return e.createVenmoQRCodePaymentContext.venmoQRCodePaymentContext})},u.prototype.createPaymentContextFromGraphQL=function(e){e={intent:e,paymentMethodUsage:this.paymentMethodUsage,customerClient:"DESKTOP"};return this.profileId&&(e.merchantProfileId=this.profileId),this.displayName&&(e.displayName=this.displayName),this.apiRequest(d.CREATE_PAYMENT_CONTEXT_QUERY,{input:e}).then(function(e){return e.createVenmoPaymentContext.venmoPaymentContext})},u.prototype.createVenmoDesktopPaymentContext=function(){var n=this;return(this.shouldUseLegacyQRCodeMutation?this.createPaymentContextFromGraphqlLegacyQRCodeMutation("PAY_FROM_APP"):this.createPaymentContextFromGraphQL("PAY_FROM_APP")).then(function(e){n.venmoContextId=e.id;var t=n.profileId||e.merchantId;return{id:e.id,status:e.status,merchantId:t,createdAt:e.createdAt,expiresAt:e.expiresAt}})},u.prototype.updateVenmoDesktopPaymentContext=function(e,t){if(void 0===t&&(t={}),!this.venmoContextId)return this.Promise.resolve();e={input:r({id:this.venmoContextId,status:e},t)},t=this.shouldUseLegacyQRCodeMutation?d.LEGACY_UPDATE_PAYMENT_CONTEXT_QUERY:d.UPDATE_PAYMENT_CONTEXT_QUERY;return this.apiRequest(t,e).then(function(){})},u.prototype.lookupVenmoDesktopPaymentContext=function(){if(!this.venmoContextId)return this.Promise.resolve();var e=this.shouldUseLegacyQRCodeMutation?d.LEGACY_VENMO_PAYMENT_CONTEXT_STATUS_QUERY:d.VENMO_PAYMENT_CONTEXT_STATUS_QUERY;return this.apiRequest(e,{id:this.venmoContextId}).then(function(e){return e.node})},u);function u(e){this.isHidden=!0,this.env=e.environment,this.id=s.default(),this.profileId=e.profileId,this.displayName=e.displayName,this.paymentMethodUsage=e.paymentMethodUsage,this.shouldUseLegacyQRCodeMutation=!this.paymentMethodUsage;var t=e.url+"#"+this.env+"_"+this.id;this.bus=new o.default({channel:this.id,verifyDomain:e.verifyDomain}),this.apiRequest=e.apiRequest,this.sendEvent=e.sendEvent,this.Promise=e.Promise,this.alertBox=document.createElement("div"),this.alertBox.setAttribute("data-venmo-desktop-id",this.id),this.alertBox.setAttribute("role","alert"),this.alertBox.style.position="fixed",this.alertBox.style.display="none",this.alertBox.style.height="1px",this.alertBox.style.width="1px",this.alertBox.style.overflow="hidden",this.alertBox.style.zIndex="0",this.iframe=a.default({src:t,name:"venmo-desktop-iframe",style:{display:"none",position:"fixed",top:"0",bottom:"0",right:"0",left:"0",height:"100%",width:"100%",zIndex:"9999999"},title:"Venmo Desktop"})}n.default=e},{"../shared/events":220,"./queries":214,"@braintree/iframer":40,"@braintree/uuid":44,framebus:57}],216:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("./shared/errors"),c=e("@braintree/wrap-promise"),d=e("../lib/braintree-error"),u=e("./venmo"),l=e("../lib/promise"),p=e("./shared/supports-venmo");t.exports={create:c(function(n){return i.verify({name:"Venmo",client:n.client,authorization:n.authorization}).then(function(){var e,t;return n.profileId&&"string"!=typeof n.profileId?l.reject(new d(s.VENMO_INVALID_PROFILE_ID)):n.deepLinkReturnUrl&&"string"!=typeof n.deepLinkReturnUrl?l.reject(new d(s.VENMO_INVALID_DEEP_LINK_RETURN_URL)):(e=o.create({authorization:n.authorization,client:n.client,debug:n.debug,assetsUrl:a.create(n.authorization),name:"Venmo"}).then(function(e){var t=e.getConfiguration();return n.client=e,t.gatewayConfiguration.payWithVenmo?e:l.reject(new d(s.VENMO_NOT_ENABLED))}),n.createPromise=e,t=new u(n),r.sendEvent(e,"venmo.initialized"),e.then(function(){return t}))})}),isBrowserSupported:function(e){return p.isBrowserSupported(e)},VERSION:"3.81.0"}},{"../lib/analytics":125,"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"./shared/errors":219,"./shared/supports-venmo":221,"./venmo":222,"@braintree/wrap-promise":48}],217:[function(e,t,n){"use strict";var r=e("@braintree/browser-detection/is-android"),i=e("@braintree/browser-detection/is-chrome"),o=e("@braintree/browser-detection/is-ios"),a=e("@braintree/browser-detection/is-ios-safari"),s=e("@braintree/browser-detection/is-ios-webview");t.exports={isAndroid:r,isAndroidWebview:function(){return r()&&-1<window.navigator.userAgent.toLowerCase().indexOf("wv")},isChrome:i,isIos:o,isIosSafari:a,isIosWebview:s,doesNotSupportWindowOpenInIos:function(){return s()||o()&&i()}}},{"@braintree/browser-detection/is-android":24,"@braintree/browser-detection/is-chrome":26,"@braintree/browser-detection/is-ios":35,"@braintree/browser-detection/is-ios-safari":32,"@braintree/browser-detection/is-ios-webview":33}],218:[function(e,t,n){"use strict";t.exports={DOCUMENT_VISIBILITY_CHANGE_EVENT_DELAY:500,DEFAULT_PROCESS_RESULTS_DELAY:1e3,VENMO_OPEN_URL:"https://venmo.com/braintree/checkout"}},{}],219:[function(e,t,n){"use strict";e=e("../../lib/braintree-error");t.exports={VENMO_NOT_ENABLED:{type:e.types.MERCHANT,code:"VENMO_NOT_ENABLED",message:"Venmo is not enabled for this merchant."},VENMO_TOKENIZATION_REQUEST_ACTIVE:{type:e.types.MERCHANT,code:"VENMO_TOKENIZATION_REQUEST_ACTIVE",message:"Another tokenization request is active."},VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE:{type:e.types.MERCHANT,code:"VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE",message:"No tokenization in progress."},VENMO_APP_FAILED:{type:e.types.UNKNOWN,code:"VENMO_APP_FAILED",message:"Venmo app encountered a problem."},VENMO_APP_CANCELED:{type:e.types.CUSTOMER,code:"VENMO_APP_CANCELED",message:"Venmo app authorization was canceled."},VENMO_CANCELED:{type:e.types.CUSTOMER,code:"VENMO_CANCELED",message:"User canceled Venmo authorization, or Venmo app is not available."},VENMO_DESKTOP_CANCELED:{type:e.types.CUSTOMER,code:"VENMO_DESKTOP_CANCELED",message:"User canceled Venmo authorization by closing the Venmo Desktop modal."},VENMO_TOKENIZATION_CANCELED_BY_MERCHANT:{type:e.types.MERCHANT,code:"VENMO_TOKENIZATION_CANCELED_BY_MERCHANT",message:"The Venmo tokenization was canceled by the merchant."},VENMO_DESKTOP_UNKNOWN_ERROR:{type:e.types.UNKNOWN,code:"VENMO_DESKTOP_UNKNOWN_ERROR",message:"Something went wrong with the Venmo Desktop flow."},VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED:{type:e.types.NETWORK,code:"VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED",message:"Something went wrong creating the Venmo Payment Context."},VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR:{type:e.types.UNKNOWN,code:"VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR",message:"Something went wrong during mobile polling."},VENMO_MOBILE_POLLING_TOKENIZATION_EXPIRED:{type:e.types.CUSTOMER,code:"VENMO_MOBILE_POLLING_TOKENIZATION_EXPIRED",message:"The Venmo authorization request is expired."},VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED:{type:e.types.CUSTOMER,code:"VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED",message:"The Venmo authorization was canceled"},VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT:{type:e.types.CUSTOMER,code:"VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT",message:"Customer took too long to authorize Venmo payment."},VENMO_MOBILE_POLLING_TOKENIZATION_FAILED:{type:e.types.UNKNOWN,code:"VENMO_MOBILE_POLLING_TOKENIZATION_FAILED",message:"The Venmo authorization failed."},VENMO_INVALID_PROFILE_ID:{type:e.types.MERCHANT,code:"VENMO_INVALID_PROFILE_ID",message:"Venmo profile ID is invalid."},VENMO_INVALID_DEEP_LINK_RETURN_URL:{type:e.types.MERCHANT,code:"VENMO_INVALID_DEEP_LINK_RETURN_URL",message:"Venmo deep link return URL is invalid."}}},{"../../lib/braintree-error":130}],220:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.VENMO_DESKTOP_UNKNOWN_ERROR=n.VENMO_DESKTOP_REQUEST_NEW_QR_CODE=n.VENMO_DESKTOP_CLOSED_FROM_PARENT=n.VENMO_DESKTOP_IFRAME_READY=n.VENMO_DESKTOP_DISPLAY_QR_CODE=n.VENMO_DESKTOP_DISPLAY_ERROR=n.VENMO_DESKTOP_CUSTOMER_CANCELED=n.VENMO_DESKTOP_AUTHORIZATION_COMPLETED=n.VENMO_DESKTOP_AUTHORIZING=n.VENMO_DESKTOP_AUTHORIZE=n.VENMO_DESKTOP_AUTHORIZATION_TIMED_OUT=void 0,n.VENMO_DESKTOP_AUTHORIZATION_TIMED_OUT="VENMO_DESKTOP_AUTHORIZATION_TIMED_OUT",n.VENMO_DESKTOP_AUTHORIZE="VENMO_DESKTOP_AUTHORIZE",n.VENMO_DESKTOP_AUTHORIZING="VENMO_DESKTOP_AUTHORIZING",n.VENMO_DESKTOP_AUTHORIZATION_COMPLETED="VENMO_DESKTOP_AUTHORIZATION_COMPLETED",n.VENMO_DESKTOP_CUSTOMER_CANCELED="VENMO_DESKTOP_CUSTOMER_CANCELED",n.VENMO_DESKTOP_DISPLAY_ERROR="VENMO_DESKTOP_DISPLAY_ERROR",n.VENMO_DESKTOP_DISPLAY_QR_CODE="VENMO_DESKTOP_DISPLAY_QR_CODE",n.VENMO_DESKTOP_IFRAME_READY="VENMO_DESKTOP_IFRAME_READY",n.VENMO_DESKTOP_CLOSED_FROM_PARENT="VENMO_DESKTOP_CLOSED_FROM_PARENT",n.VENMO_DESKTOP_REQUEST_NEW_QR_CODE="VENMO_DESKTOP_REQUEST_NEW_QR_CODE",n.VENMO_DESKTOP_UNKNOWN_ERROR="VENMO_DESKTOP_UNKNOWN_ERROR"},{}],221:[function(e,t,n){"use strict";var o=e("./browser-detection");t.exports={isBrowserSupported:function(e){var t=(i=o.isAndroid())||o.isIos(),n=i&&o.isChrome(),r=o.isIosSafari()||n,i=!0===(e=e||{}).allowDesktop,n=!e.hasOwnProperty("allowNewBrowserTab")||e.allowNewBrowserTab;return!(e.hasOwnProperty("allowWebviews")&&!e.allowWebviews&&(o.isAndroidWebview()||o.isIosWebview()))&&(n?i||t:!!r||i&&!t)}}},{"./browser-detection":217}],222:[function(e,t,n){"use strict";var a=e("../lib/analytics"),r=e("./shared/supports-venmo"),i=e("./shared/browser-detection"),s=e("./shared/constants"),o=e("./shared/errors"),c=e("../lib/querystring"),d=e("../lib/is-verified-domain"),u=e("../lib/methods"),l=e("../lib/convert-methods-to-error"),p=e("@braintree/wrap-promise"),_=e("../lib/braintree-error"),E=e("../lib/in-iframe"),h=e("../lib/promise"),m=e("@braintree/extended-promise"),f=e("./external/"),y=e("./external/queries");function A(e){var r=this;this._createPromise=e.createPromise,this._allowNewBrowserTab=!1!==e.allowNewBrowserTab,this._allowWebviews=!1!==e.allowWebviews,this._allowDesktop=!0===e.allowDesktop,this._requireManualReturn=!0===e.requireManualReturn,this._useRedirectForIOS=!0===e.useRedirectForIOS,this._profileId=e.profileId,this._displayName=e.displayName,this._deepLinkReturnUrl=e.deepLinkReturnUrl,this._ignoreHistoryChanges=e.ignoreHistoryChanges,this._paymentMethodUsage=(e.paymentMethodUsage||"").toUpperCase(),this._shouldUseLegacyFlow=!this._paymentMethodUsage,this._useDesktopFlow=this._allowDesktop&&this._isDesktop(),this._cannotHaveReturnUrls=E()||this._requireManualReturn,this._shouldCreateVenmoPaymentContext=this._cannotHaveReturnUrls||!this._shouldUseLegacyFlow,a.sendEvent(this._createPromise,"venmo.desktop-flow.configured."+String(Boolean(this._allowDesktop))),this.hasTokenizationResult()?a.sendEvent(this._createPromise,"venmo.appswitch.return-in-new-tab"):this._useDesktopFlow?this._createPromise=this._createPromise.then(function(n){var e=n.getConfiguration().gatewayConfiguration;return f({url:e.assetsUrl+"/web/3.81.0/html/venmo-desktop-frame.html",environment:"production"===e.environment?"PRODUCTION":"SANDBOX",profileId:r._profileId||e.payWithVenmo.merchantId,paymentMethodUsage:r._paymentMethodUsage,displayName:r._displayName,Promise:h,apiRequest:function(e,t){return n.request({api:"graphQLApi",data:{query:e,variables:t}}).then(function(e){return e.data})},sendEvent:function(e){a.sendEvent(r._createPromise,e)},verifyDomain:d}).then(function(e){return r._venmoDesktopInstance=e,a.sendEvent(r._createPromise,"venmo.desktop-flow.presented"),n}).catch(function(){return a.sendEvent(r._createPromise,"venmo.desktop-flow.setup-failed"),r._useDesktopFlow=!1,n})}):this._shouldCreateVenmoPaymentContext&&(this._mobilePollingInterval=250,this._mobilePollingExpiresThreshold=3e5,this._createPromise=this._createPromise.then(function(e){var t=r._cannotHaveReturnUrls?"manual-return":"mobile-payment-context",n=e.getConfiguration().gatewayConfiguration;return r._mobilePollingContextEnvironment=n.environment.toUpperCase(),r._createVenmoPaymentContext(e).then(function(){return a.sendEvent(r._createPromise,"venmo."+t+".presented"),e}).catch(function(e){return a.sendEvent(r._createPromise,"venmo."+t+".setup-failed"),h.reject(new _({type:o.VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED.type,code:o.VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED.code,message:o.VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED.message,details:{originalError:e}}))})}))}function T(e){return(e||window.location.hash.substring(1)).split("&").reduce(function(e,t){var n=t.split("="),t=decodeURIComponent(n[0]).replace(/\W/g,""),n=decodeURIComponent(n[1]);return e[t]=n,e},{})}function N(){var e;return void 0!==window.document.hidden?e="visibilitychange":void 0!==window.document.msHidden?e="msvisibilitychange":void 0!==window.document.webkitHidden&&(e="webkitvisibilitychange"),e}A.prototype._createVenmoPaymentContext=function(n,r){var i=this;return this._shouldCreateVenmoPaymentContext?(this._shouldUseLegacyFlow?n.request({api:"graphQLApi",data:{query:y.LEGACY_CREATE_PAYMENT_CONTEXT_QUERY,variables:{input:{environment:this._mobilePollingContextEnvironment,intent:"PAY_FROM_APP"}}}}).then(function(e){return e.data.createVenmoQRCodePaymentContext.venmoQRCodePaymentContext}):n.request({api:"graphQLApi",data:{query:y.CREATE_PAYMENT_CONTEXT_QUERY,variables:{input:{paymentMethodUsage:this._paymentMethodUsage,intent:"CONTINUE",customerClient:"MOBILE_WEB",displayName:this._displayName}}}}).then(function(e){return e.data.createVenmoPaymentContext.venmoPaymentContext})).then(function(e){var t=.6666*(new Date(e.expiresAt)-new Date(e.createdAt));clearTimeout(i._refreshPaymentContextTimeout),i._refreshPaymentContextTimeout=setTimeout(function(){i._tokenizationInProgress||i._createVenmoPaymentContext(n,!0)},t),r&&i._tokenizationInProgress||(i._venmoPaymentContextStatus=e.status,i._venmoPaymentContextId=e.id)}):h.resolve()},A.prototype.appSwitch=function(e){this._deepLinkReturnUrl?window.navigator.platform&&/iPhone|iPad|iPod/.test(window.navigator.platform)?(a.sendEvent(this._createPromise,"venmo.appswitch.start.ios-webview"),window.location.href=e):window.popupBridge&&"function"==typeof window.popupBridge.open?(a.sendEvent(this._createPromise,"venmo.appswitch.start.popup-bridge"),window.popupBridge.open(e)):(a.sendEvent(this._createPromise,"venmo.appswitch.start.webview"),window.open(e)):(a.sendEvent(this._createPromise,"venmo.appswitch.start.browser"),i.doesNotSupportWindowOpenInIos()||this._shouldUseRedirectStrategy()?window.location.href=e:window.open(e))},A.prototype.getUrl=function(){return this._createPromise.then(function(e){var t=e.getConfiguration(),n={},r=this._deepLinkReturnUrl||window.location.href.replace(window.location.hash,""),i=t.gatewayConfiguration.payWithVenmo,e=t.analyticsMetadata,t=i.accessToken,e={_meta:{version:e.sdkVersion,integration:e.integration,platform:e.platform,sessionId:e.sessionId}},r=r.replace(/#*$/,"");return this._venmoPaymentContextId&&(this._shouldUseLegacyFlow?t+="|pcid:"+this._venmoPaymentContextId:n.resource_id=this._venmoPaymentContextId),this._shouldIncludeReturnUrls()?(n["x-success"]=r+"#venmoSuccess=1",n["x-cancel"]=r+"#venmoCancel=1",n["x-error"]=r+"#venmoError=1"):(n["x-success"]="NOOP",n["x-cancel"]="NOOP",n["x-error"]="NOOP"),n.ua=window.navigator.userAgent,n.braintree_merchant_id=this._profileId||i.merchantId,n.braintree_access_token=t,n.braintree_environment=i.environment,n.braintree_sdk_data=btoa(JSON.stringify(e)),s.VENMO_OPEN_URL+"?"+c.stringify(n)}.bind(this))},A.prototype.isBrowserSupported=function(){return r.isBrowserSupported({allowNewBrowserTab:this._allowNewBrowserTab,allowWebviews:this._allowWebviews,allowDesktop:this._allowDesktop})},A.prototype.hasTokenizationResult=function(){return this._hasTokenizationResult()},A.prototype._hasTokenizationResult=function(e){e=T(e);return void 0!==(e.venmoSuccess||e.venmoError||e.venmoCancel)},A.prototype._shouldIncludeReturnUrls=function(){return!!this._deepLinkReturnUrl||!this._cannotHaveReturnUrls},A.prototype._isDesktop=function(){return!(i.isIos()||i.isAndroid())},A.prototype.tokenize=function(e){var t=this;return e=e||{},!0===this._tokenizationInProgress?h.reject(new _(o.VENMO_TOKENIZATION_REQUEST_ACTIVE)):(this._tokenizationInProgress=!0,(this._useDesktopFlow?this._tokenizeForDesktop(e):this._cannotHaveReturnUrls?this._tokenizeForMobileWithManualReturn():this._tokenizeForMobileWithHashChangeListeners(e)).then(function(e){return t._createPromise.then(function(e){return t._createVenmoPaymentContext(e)}).then(function(){return t._tokenizationInProgress=!1,{nonce:e.paymentMethodNonce,type:"VenmoAccount",details:{username:e.username}}})}).catch(function(e){return t._createPromise.then(function(e){return t._createVenmoPaymentContext(e)}).then(function(){return t._tokenizationInProgress=!1,h.reject(e)})}))},A.prototype.cancelTokenization=function(){return this._tokenizationInProgress?(this._removeVisibilityEventListener(),this._tokenizePromise&&this._tokenizePromise.reject(new _(o.VENMO_TOKENIZATION_CANCELED_BY_MERCHANT)),h.all([this._cancelMobilePaymentContext(),this._cancelVenmoDesktopContext()])):h.reject(new _(o.VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE))},A.prototype._queryPaymentContextStatus=function(n){var r=this;return this._createPromise.then(function(e){var t=r._shouldUseLegacyFlow?y.LEGACY_VENMO_PAYMENT_CONTEXT_STATUS_QUERY:y.VENMO_PAYMENT_CONTEXT_STATUS_QUERY;return e.request({api:"graphQLApi",data:{query:t,variables:{id:n}}})}).then(function(e){return e.data.node})},A.prototype._pollForStatusChange=function(){var n=this;return Date.now()>n._mobilePollingContextExpiresIn?h.reject(new _(o.VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT)):this._queryPaymentContextStatus(this._venmoPaymentContextId).catch(function(e){return h.reject(new _({type:o.VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR.type,code:o.VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR.code,message:o.VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR.message,details:{originalError:e}}))}).then(function(e){var t=e.status;if(t!==n._venmoPaymentContextStatus)switch(n._venmoPaymentContextStatus=t,a.sendEvent(n._createPromise,"venmo.tokenize.manual-return.status-change."+t.toLowerCase()),t){case"EXPIRED":case"FAILED":case"CANCELED":return h.reject(new _(o["VENMO_MOBILE_POLLING_TOKENIZATION_"+t]));case"APPROVED":return h.resolve(e)}return new h(function(e,t){setTimeout(function(){n._pollForStatusChange().then(e).catch(t)},n._mobilePollingInterval)})})},A.prototype._tokenizeForMobileWithManualReturn=function(){var t=this;return a.sendEvent(this._createPromise,"venmo.tokenize.manual-return.start"),this._mobilePollingContextExpiresIn=Date.now()+this._mobilePollingExpiresThreshold,this._tokenizePromise=new m,this._pollForStatusChange().then(function(e){a.sendEvent(t._createPromise,"venmo.tokenize.manual-return.success"),t._tokenizePromise.resolve({paymentMethodNonce:e.paymentMethodId,username:"@"+(e.userName||"").replace("@","")})}).catch(function(e){a.sendEvent(t._createPromise,"venmo.tokenize.manual-return.failure"),t._tokenizePromise.reject(e)}),this.getUrl().then(function(e){return t.appSwitch(e),t._tokenizePromise})},A.prototype._shouldUseRedirectStrategy=function(){return!!i.isIos()&&this._useRedirectForIOS},A.prototype._tokenizeForMobileWithHashChangeListeners=function(t){var n,r,i=this;return this.hasTokenizationResult()?this.processResultsFromHash():(a.sendEvent(this._createPromise,"venmo.tokenize.mobile.start"),this._tokenizePromise=new m,this._previousHash=window.location.hash,this._onHashChangeListener=function(e){e=e.newURL.split("#")[1];i._hasTokenizationResult(e)&&(n=!0,clearTimeout(r),o(e))},window.addEventListener("hashchange",this._onHashChangeListener,!1),this._visibilityChangeListener=function(){var e=t.processResultsDelay||s.DEFAULT_PROCESS_RESULTS_DELAY;window.document.hidden||n||(r=setTimeout(o,e))},this.getUrl().then(function(e){return i.appSwitch(e),setTimeout(function(){window.document.addEventListener(N(),i._visibilityChangeListener)},s.DOCUMENT_VISIBILITY_CHANGE_EVENT_DELAY),i._tokenizePromise}));function o(e){var t;i.processResultsFromHash(e).catch(function(e){t=e}).then(function(e){i._ignoreHistoryChanges||window.location.hash===i._previousHash||(window.location.hash=i._previousHash),i._removeVisibilityEventListener(),t?i._tokenizePromise.reject(t):i._tokenizePromise.resolve(e),delete i._tokenizePromise})}},A.prototype._tokenizeForDesktop=function(){var t=this;return a.sendEvent(this._createPromise,"venmo.tokenize.desktop.start"),this._tokenizePromise=new m,this._createPromise.then(function(){return t._venmoDesktopInstance.launchDesktopFlow()}).then(function(e){t._venmoDesktopInstance.hideDesktopFlow(),a.sendEvent(t._createPromise,"venmo.tokenize.desktop.success"),t._tokenizePromise.resolve(e)}).catch(function(e){a.sendEvent(t._createPromise,"venmo.tokenize.desktop.failure"),t._venmoDesktopInstance&&t._venmoDesktopInstance.hideDesktopFlow(),e&&"CUSTOMER_CANCELED"===e.reason?t._tokenizePromise.reject(new _(o.VENMO_DESKTOP_CANCELED)):t._tokenizePromise.reject(new _({type:o.VENMO_DESKTOP_UNKNOWN_ERROR.type,code:o.VENMO_DESKTOP_UNKNOWN_ERROR.code,message:o.VENMO_DESKTOP_UNKNOWN_ERROR.message,details:{originalError:e}}))}),this._tokenizePromise},A.prototype._updateVenmoDesktopPaymentContext=function(e,t){return this._venmoDesktopInstance.updateVenmoDesktopPaymentContext(e,t)},A.prototype._cancelMobilePaymentContext=function(){var n=this;return this._createPromise.then(function(e){var t;return n._venmoPaymentContextId?(t=n._shouldUseLegacyFlow?y.LEGACY_UPDATE_PAYMENT_CONTEXT_QUERY:y.UPDATE_PAYMENT_CONTEXT_QUERY,e.request({api:"graphQLApi",data:{query:t,variables:{input:{id:n._venmoPaymentContextId,status:"CANCELED"}}}})):h.resolve()})},A.prototype._cancelVenmoDesktopContext=function(){var e=this;return this._createPromise.then(function(){return e._venmoDesktopInstance&&e._venmoDesktopInstance.updateVenmoDesktopPaymentContext("CANCELED"),h.resolve()})},A.prototype.teardown=function(){var e=this;return this._removeVisibilityEventListener(),this._createPromise.then(function(){e._venmoDesktopInstance&&e._venmoDesktopInstance.teardown(),clearTimeout(e._refreshPaymentContextTimeout),e._cancelMobilePaymentContext(),l(this,u(A.prototype))}.bind(this))},A.prototype._removeVisibilityEventListener=function(){window.removeEventListener("hashchange",this._onHashChangeListener),window.document.removeEventListener(N(),this._visibilityChangeListener),delete this._visibilityChangeListener,delete this._onHashChangeListener},A.prototype.processResultsFromHash=function(e){var n=this,r=T(e);return new h(function(t,e){r.venmoSuccess?(a.sendEvent(n._createPromise,"venmo.appswitch.handle.success"),r.resource_id&&!n._shouldUseLegacyFlow?n._queryPaymentContextStatus(r.resource_id).then(function(e){return"APPROVED"!==e.status?(a.sendEvent(n._createPromise,"venmo.process-results.unexpected-payment-context-status."+e.status.toLowerCase()),void t(r)):void t({paymentMethodNonce:e.paymentMethodId,username:e.userName})}).catch(function(){a.sendEvent(n._createPromise,"venmo.process-results.payment-context-status-query-failed"),t(r)}):t(r)):r.venmoError?(a.sendEvent(n._createPromise,"venmo.appswitch.handle.error"),e(new _({type:o.VENMO_APP_FAILED.type,code:o.VENMO_APP_FAILED.code,message:o.VENMO_APP_FAILED.message,details:{originalError:{message:decodeURIComponent(r.errorMessage),code:r.errorCode}}}))):r.venmoCancel?(a.sendEvent(n._createPromise,"venmo.appswitch.handle.cancel"),e(new _(o.VENMO_APP_CANCELED))):(a.sendEvent(n._createPromise,"venmo.appswitch.cancel-or-unavailable"),e(new _(o.VENMO_CANCELED))),n._clearFragmentParameters()})},A.prototype._clearFragmentParameters=function(){this._ignoreHistoryChanges||"function"==typeof window.history.replaceState&&window.location.hash&&history.pushState({},"",window.location.href.slice(0,window.location.href.indexOf("#")))},t.exports=p.wrapPrototype(A)},{"../lib/analytics":125,"../lib/braintree-error":130,"../lib/convert-methods-to-error":133,"../lib/in-iframe":156,"../lib/is-verified-domain":159,"../lib/methods":161,"../lib/promise":163,"../lib/querystring":164,"./external/":213,"./external/queries":214,"./shared/browser-detection":217,"./shared/constants":218,"./shared/errors":219,"./shared/supports-venmo":221,"@braintree/extended-promise":39,"@braintree/wrap-promise":48}],223:[function(e,t,n){"use strict";e=e("../lib/braintree-error");t.exports={VISA_CHECKOUT_NOT_ENABLED:{type:e.types.MERCHANT,code:"VISA_CHECKOUT_NOT_ENABLED",message:"Visa Checkout is not enabled for this merchant."},VISA_CHECKOUT_INIT_OPTIONS_REQUIRED:{type:e.types.MERCHANT,code:"VISA_CHECKOUT_INIT_OPTIONS_REQUIRED",message:"initOptions requires an object."},VISA_CHECKOUT_PAYMENT_REQUIRED:{type:e.types.MERCHANT,code:"VISA_CHECKOUT_PAYMENT_REQUIRED",message:"tokenize requires callid, encKey, and encPaymentData."},VISA_CHECKOUT_TOKENIZATION:{type:e.types.NETWORK,code:"VISA_CHECKOUT_TOKENIZATION",message:"A network error occurred when processing the Visa Checkout payment."}}},{"../lib/braintree-error":130}],224:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("../lib/braintree-error"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("./visa-checkout"),c=e("../lib/analytics"),d=e("./errors"),u=e("../lib/promise"),e=e("@braintree/wrap-promise");t.exports={create:e(function(t){var e="Visa Checkout";return r.verify({name:e,client:t.client,authorization:t.authorization}).then(function(){return o.create({authorization:t.authorization,client:t.client,debug:t.debug,assetsUrl:a.create(t.authorization),name:e})}).then(function(e){return t.client=e,t.client.getConfiguration().gatewayConfiguration.visaCheckout?(c.sendEvent(t.client,"visacheckout.initialized"),new s(t)):u.reject(new i(d.VISA_CHECKOUT_NOT_ENABLED))})}),VERSION:"3.81.0"}},{"../lib/analytics":125,"../lib/basic-component-verification":128,"../lib/braintree-error":130,"../lib/create-assets-url":135,"../lib/create-deferred-client":137,"../lib/promise":163,"./errors":223,"./visa-checkout":225,"@braintree/wrap-promise":48}],225:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("../lib/analytics"),o=e("./errors"),a=e("../lib/json-clone"),s=e("../lib/methods"),c=e("../lib/convert-methods-to-error"),d=e("../lib/promise"),e=e("@braintree/wrap-promise"),u={Visa:"VISA",MasterCard:"MASTERCARD",Discover:"DISCOVER","American Express":"AMEX"};function l(e){this._client=e.client}l.prototype.createInitOptions=function(e){var t=this._client.getConfiguration().gatewayConfiguration,n=t.visaCheckout;if(!e)throw new r(o.VISA_CHECKOUT_INIT_OPTIONS_REQUIRED);return(e=a(e)).apikey=e.apikey||n.apikey,e.encryptionKey=n.encryptionKey,e.externalClientId=e.externalClientId||n.externalClientId,e.settings=e.settings||{},e.settings.dataLevel="FULL",e.settings.payment=e.settings.payment||{},e.settings.payment.cardBrands||(e.settings.payment.cardBrands=t.visaCheckout.supportedCardTypes.reduce(function(e,t){return u.hasOwnProperty(t)?e.concat(u[t]):e},[])),e},l.prototype.tokenize=function(e){var t=this;return e.callid&&e.encKey&&e.encPaymentData?this._client.request({method:"post",endpoint:"payment_methods/visa_checkout_cards",data:{_meta:{source:"visa-checkout"},visaCheckoutCard:{callId:e.callid,encryptedPaymentData:e.encPaymentData,encryptedKey:e.encKey}}}).then(function(e){return i.sendEvent(t._client,"visacheckout.tokenize.succeeded"),e.visaCheckoutCards[0]}).catch(function(e){return i.sendEvent(t._client,"visacheckout.tokenize.failed"),d.reject(new r({type:o.VISA_CHECKOUT_TOKENIZATION.type,code:o.VISA_CHECKOUT_TOKENIZATION.code,message:o.VISA_CHECKOUT_TOKENIZATION.message,details:{originalError:e}}))}):d.reject(new r(o.VISA_CHECKOUT_PAYMENT_REQUIRED))},l.prototype.teardown=function(){return c(this,s(l.prototype)),d.resolve()},t.exports=e.wrapPrototype(l)},{"../lib/analytics":125,"../lib/braintree-error":130,"../lib/convert-methods-to-error":133,"../lib/json-clone":160,"../lib/methods":161,"../lib/promise":163,"./errors":223,"@braintree/wrap-promise":48}]},{},[123])(123)});