forked from janober/braintree-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbraintree-angular.min.js
12 lines (12 loc) · 353 KB
/
braintree-angular.min.js
1
2
3
4
5
6
7
8
9
10
11
12
!function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(require,module,exports){"use strict";module.exports=require("./lib/braintree-angular")},{"./lib/braintree-angular":2}],2:[function(require,module,exports){var braintreeWeb=require("braintree-web"),braintreeFactory=require("./braintree-factory"),braingular=window.angular.module("braintree-angular",[]);braingular.factory("$braintree",["clientTokenPath","$http",braintreeFactory(braintreeWeb)]),braingular.directive("braintreeDropin",function(){return{restrict:"AEC",scope:{options:"="},template:'<div id="bt-dropin"></div>',controller:["$scope","$braintree",function($scope,$braintree){var options=$scope.options||{};options.headless||(options.container="bt-dropin"),$braintree.setupDropin(options)}]}}),braingular.directive("braintreePaypal",function(){return{restrict:"AEC",scope:{options:"="},template:'<div id="bt-paypal"></div>',controller:["$scope","$braintree",function($scope,$braintree){var options=$scope.options||{};options.headless||(options.container="bt-paypal"),$braintree.setupPayPal(options)}]}}),module.exports=braingular},{"./braintree-factory":3,"braintree-web":4}],3:[function(require,module,exports){function braintreeFactory(braintree){return function(clientTokenPath,$http){var $braintree={};return $braintree.clientToken=null,Object.keys(braintree).forEach(function(key){$braintree[key]=braintree[key]}),$braintree.getClientToken=function(params){var path=clientTokenPath;return params&&(path+="?",path+=Object.keys(params).map(function(key){return key+"="+params[key]}).join("&")),$http.get(path)},$braintree.setupDropin=function(options){$braintree.getClientToken().then(function(response){braintree.setup(response.data,"dropin",options)}).catch(function(response){console.error("error fetching client token at "+clientTokenPath,response.data,response.status)})},$braintree.setupPayPal=function(options){$braintree.getClientToken().then(function(response){braintree.setup(response.data,"paypal",options)}).catch(function(response){console.error("error fetching client token at "+clientTokenPath,response.data,response.status)})},$braintree}}module.exports=braintreeFactory},{}],4:[function(require,module,exports){(function(global,setImmediate){(function(){!function(f){if("object"==typeof exports&&void 0!==module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:this,g.braintree=f()}}(function(){var define;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(_dereq_,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PromiseGlobal=void 0;var promise_polyfill_1=__importDefault(_dereq_("promise-polyfill")),PromiseGlobal="undefined"!=typeof Promise?Promise:promise_polyfill_1.default;exports.PromiseGlobal=PromiseGlobal},{"promise-polyfill":69}],2:[function(_dereq_,module,exports){"use strict";function loadScript(options){var scriptLoadPromise,stringifiedOptions=JSON.stringify(options);if(!options.forceScriptReload&&(scriptLoadPromise=scriptPromiseCache[stringifiedOptions]))return scriptLoadPromise;var script=document.createElement("script"),attrs=options.dataAttributes||{},container=options.container||document.head;return script.src=options.src,script.id=options.id||"",script.async=!0,options.crossorigin&&script.setAttribute("crossorigin",""+options.crossorigin),Object.keys(attrs).forEach(function(key){script.setAttribute("data-"+key,""+attrs[key])}),scriptLoadPromise=new promise_1.PromiseGlobal(function(resolve,reject){script.addEventListener("load",function(){resolve(script)}),script.addEventListener("error",function(){reject(new Error(options.src+" failed to load."))}),script.addEventListener("abort",function(){reject(new Error(options.src+" has aborted."))}),container.appendChild(script)}),scriptPromiseCache[stringifiedOptions]=scriptLoadPromise,scriptLoadPromise}var promise_1=_dereq_("./lib/promise"),scriptPromiseCache={};loadScript.clearCache=function(){scriptPromiseCache={}},module.exports=loadScript},{"./lib/promise":1}],3:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/load-script")},{"./dist/load-script":2}],4:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,/Android/.test(ua)}},{}],5:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,/CrOS/i.test(ua)}},{}],6:[function(_dereq_,module,exports){"use strict";var isEdge=_dereq_("./is-edge"),isSamsung=_dereq_("./is-samsung");module.exports=function(ua){return ua=ua||window.navigator.userAgent,!(-1===ua.indexOf("Chrome")&&-1===ua.indexOf("CriOS")||isEdge(ua)||isSamsung(ua))}},{"./is-edge":7,"./is-samsung":19}],7:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,-1!==ua.indexOf("Edge/")}},{}],8:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,/Firefox/i.test(ua)}},{}],9:[function(_dereq_,module,exports){"use strict";var isIE11=_dereq_("./is-ie11");module.exports=function(ua){return ua=ua||window.navigator.userAgent,-1!==ua.indexOf("MSIE")||isIE11(ua)}},{"./is-ie11":11}],10:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,-1!==ua.indexOf("MSIE 10")}},{}],11:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,-1!==ua.indexOf("Trident/7")}},{}],12:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,-1!==ua.indexOf("MSIE 9")}},{}],13:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,/FxiOS/i.test(ua)}},{}],14:[function(_dereq_,module,exports){"use strict";function isWebkit(ua){return webkitRegexp.test(ua)}var isIos=_dereq_("./is-ios"),webkitRegexp=/webkit/i;module.exports=function(ua){return ua=ua||window.navigator.userAgent,isIos(ua)&&isWebkit(ua)&&-1===ua.indexOf("CriOS")}},{"./is-ios":17}],15:[function(_dereq_,module,exports){"use strict";function isGoogleSearchApp(ua){return/\bGSA\b/.test(ua)}var isIos=_dereq_("./is-ios");module.exports=function(ua){return ua=ua||window.navigator.userAgent,!!isIos(ua)&&(!!isGoogleSearchApp(ua)||/.+AppleWebKit(?!.*Safari)/.test(ua))}},{"./is-ios":17}],16:[function(_dereq_,module,exports){"use strict";var isIosWebview=_dereq_("./is-ios-webview");module.exports=function(ua,statusBarVisible){return statusBarVisible=void 0!==statusBarVisible?statusBarVisible:window.statusbar.visible,isIosWebview(ua)&&statusBarVisible}},{"./is-ios-webview":15}],17:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,/iPhone|iPod|iPad/i.test(ua)}},{}],18:[function(_dereq_,module,exports){"use strict";var isIosFirefox=_dereq_("./is-ios-firefox"),isFirefox=_dereq_("./is-firefox");module.exports=function(ua){return ua=ua||window.navigator.userAgent,isIosFirefox(ua)||/iPhone|iPod|iPad|Mobile|Tablet/i.test(ua)&&isFirefox(ua)}},{"./is-firefox":8,"./is-ios-firefox":13}],19:[function(_dereq_,module,exports){"use strict";module.exports=function(ua){return ua=ua||window.navigator.userAgent,/SamsungBrowser/i.test(ua)}},{}],20:[function(_dereq_,module,exports){"use strict";function isUnsupportedIosChrome(ua){ua=ua||window.navigator.userAgent;var match=ua.match(/CriOS\/(\d+)\./);return!!match&&parseInt(match[1],10)<MINIMUM_SUPPORTED_CHROME_IOS_VERSION}function isOperaMini(ua){return ua=ua||window.navigator.userAgent,ua.indexOf("Opera Mini")>-1}function isAndroidWebview(ua){var androidWebviewRegExp=/Version\/[\d.]+/;return ua=ua||window.navigator.userAgent,!!isAndroid(ua)&&(androidWebviewRegExp.test(ua)&&!isOperaMini(ua))}function isOldSamsungBrowserOrSamsungWebview(ua){return!isChrome(ua)&&!isSamsungBrowser(ua)&&/samsung/i.test(ua)}var MINIMUM_SUPPORTED_CHROME_IOS_VERSION=48,isAndroid=_dereq_("./is-android"),isIosFirefox=_dereq_("./is-ios-firefox"),isIosWebview=_dereq_("./is-ios-webview"),isChrome=_dereq_("./is-chrome"),isSamsungBrowser=_dereq_("./is-samsung");module.exports=function(ua){return ua=ua||window.navigator.userAgent,!(isIosWebview(ua)||isIosFirefox(ua)||isAndroidWebview(ua)||isOperaMini(ua)||isUnsupportedIosChrome(ua)||isOldSamsungBrowserOrSamsungWebview(ua))}},{"./is-android":4,"./is-chrome":6,"./is-ios-firefox":13,"./is-ios-webview":15,"./is-samsung":19}],21:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-android")},{"./dist/is-android":4}],22:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-chrome-os")},{"./dist/is-chrome-os":5}],23:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-chrome")},{"./dist/is-chrome":6}],24:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-edge")},{"./dist/is-edge":7}],25:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-firefox")},{"./dist/is-firefox":8}],26:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-ie")},{"./dist/is-ie":9}],27:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-ie10")},{"./dist/is-ie10":10}],28:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-ie9")},{"./dist/is-ie9":12}],29:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-ios-safari")},{"./dist/is-ios-safari":14}],30:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-ios-webview")},{"./dist/is-ios-webview":15}],31:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-ios-wkwebview")},{"./dist/is-ios-wkwebview":16}],32:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-ios")},{"./dist/is-ios":17}],33:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-mobile-firefox")},{"./dist/is-mobile-firefox":18}],34:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/is-samsung")},{"./dist/is-samsung":19}],35:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/supports-popups")},{"./dist/supports-popups":20}],36:[function(_dereq_,module,exports){"use strict";function _classesOf(element){return element.className.trim().split(/\s+/)}function add(element){for(var toAdd=[],_i=1;_i<arguments.length;_i++)toAdd[_i-1]=arguments[_i];element.className=_classesOf(element).filter(function(classname){return-1===toAdd.indexOf(classname)}).concat(toAdd).join(" ")}function remove(element){for(var toRemove=[],_i=1;_i<arguments.length;_i++)toRemove[_i-1]=arguments[_i];element.className=_classesOf(element).filter(function(classname){return-1===toRemove.indexOf(classname)}).join(" ")}function toggle(element,classname,adding){adding?add(element,classname):remove(element,classname)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toggle=exports.remove=exports.add=void 0,exports.add=add,exports.remove=remove,exports.toggle=toggle},{}],37:[function(_dereq_,module,exports){"use strict";var EventEmitter=function(){function EventEmitter(){this._events={}}return EventEmitter.prototype.on=function(event,callback){this._events[event]?this._events[event].push(callback):this._events[event]=[callback]},EventEmitter.prototype.off=function(event,callback){var eventCallbacks=this._events[event];if(eventCallbacks){var indexOfCallback=eventCallbacks.indexOf(callback);eventCallbacks.splice(indexOfCallback,1)}},EventEmitter.prototype._emit=function(event){for(var args=[],_i=1;_i<arguments.length;_i++)args[_i-1]=arguments[_i];var eventCallbacks=this._events[event];eventCallbacks&&eventCallbacks.forEach(function(callback){callback.apply(void 0,args)})},EventEmitter.prototype.hasListener=function(event){var eventCallbacks=this._events[event];return!!eventCallbacks&&eventCallbacks.length>0},EventEmitter.createChild=function(ChildObject){ChildObject.prototype=Object.create(EventEmitter.prototype,{constructor:ChildObject})},EventEmitter}();module.exports=EventEmitter},{}],38:[function(_dereq_,module,exports){"use strict";var GlobalPromise="undefined"!=typeof Promise?Promise:null,ExtendedPromise=function(){function ExtendedPromise(options){var _this=this;if("function"==typeof options)return void(this._promise=new ExtendedPromise.Promise(options));this._promise=new ExtendedPromise.Promise(function(resolve,reject){_this._resolveFunction=resolve,_this._rejectFunction=reject}),options=options||{},this._onResolve=options.onResolve||ExtendedPromise.defaultOnResolve,this._onReject=options.onReject||ExtendedPromise.defaultOnReject,ExtendedPromise.shouldCatchExceptions(options)&&this._promise.catch(function(){}),this._resetState()}return ExtendedPromise.defaultOnResolve=function(result){return ExtendedPromise.Promise.resolve(result)},ExtendedPromise.defaultOnReject=function(err){return ExtendedPromise.Promise.reject(err)},ExtendedPromise.setPromise=function(PromiseClass){ExtendedPromise.Promise=PromiseClass},ExtendedPromise.shouldCatchExceptions=function(options){return options.hasOwnProperty("suppressUnhandledPromiseMessage")?Boolean(options.suppressUnhandledPromiseMessage):Boolean(ExtendedPromise.suppressUnhandledPromiseMessage)},ExtendedPromise.all=function(args){return ExtendedPromise.Promise.all(args)},ExtendedPromise.allSettled=function(args){return ExtendedPromise.Promise.allSettled(args)},ExtendedPromise.race=function(args){return ExtendedPromise.Promise.race(args)},ExtendedPromise.reject=function(arg){return ExtendedPromise.Promise.reject(arg)},ExtendedPromise.resolve=function(arg){return ExtendedPromise.Promise.resolve(arg)},ExtendedPromise.prototype.then=function(){for(var _a,args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return(_a=this._promise).then.apply(_a,args)},ExtendedPromise.prototype.catch=function(){for(var _a,args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];return(_a=this._promise).catch.apply(_a,args)},ExtendedPromise.prototype.resolve=function(arg){var _this=this;return this.isFulfilled?this:(this._setResolved(),ExtendedPromise.Promise.resolve().then(function(){return _this._onResolve(arg)}).then(function(argForResolveFunction){_this._resolveFunction(argForResolveFunction)}).catch(function(err){_this._resetState(),_this.reject(err)}),this)},ExtendedPromise.prototype.reject=function(arg){var _this=this;return this.isFulfilled?this:(this._setRejected(),ExtendedPromise.Promise.resolve().then(function(){return _this._onReject(arg)}).then(function(result){_this._setResolved(),_this._resolveFunction(result)}).catch(function(err){return _this._rejectFunction(err)}),this)},ExtendedPromise.prototype._resetState=function(){this.isFulfilled=!1,this.isResolved=!1,this.isRejected=!1},ExtendedPromise.prototype._setResolved=function(){this.isFulfilled=!0,this.isResolved=!0,this.isRejected=!1},ExtendedPromise.prototype._setRejected=function(){this.isFulfilled=!0,this.isResolved=!1,this.isRejected=!0},ExtendedPromise.Promise=GlobalPromise,ExtendedPromise}();module.exports=ExtendedPromise},{}],39:[function(_dereq_,module,exports){"use strict";var set_attributes_1=_dereq_("./lib/set-attributes"),default_attributes_1=_dereq_("./lib/default-attributes"),assign_1=_dereq_("./lib/assign");module.exports=function(options){void 0===options&&(options={});var iframe=document.createElement("iframe"),config=assign_1.assign({},default_attributes_1.defaultAttributes,options);return config.style&&"string"!=typeof config.style&&(assign_1.assign(iframe.style,config.style),delete config.style),set_attributes_1.setAttributes(iframe,config),iframe.getAttribute("id")||(iframe.id=iframe.name),iframe}},{"./lib/assign":40,"./lib/default-attributes":41,"./lib/set-attributes":42}],40:[function(_dereq_,module,exports){"use strict";function assign(target){for(var objs=[],_i=1;_i<arguments.length;_i++)objs[_i-1]=arguments[_i];return objs.forEach(function(obj){"object"==typeof obj&&Object.keys(obj).forEach(function(key){target[key]=obj[key]})}),target}Object.defineProperty(exports,"__esModule",{value:!0}),exports.assign=void 0,exports.assign=assign},{}],41:[function(_dereq_,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultAttributes=void 0,exports.defaultAttributes={src:"about:blank",frameBorder:0,allowtransparency:!0,scrolling:"no"}},{}],42:[function(_dereq_,module,exports){"use strict";function setAttributes(element,attributes){for(var key in attributes)if(attributes.hasOwnProperty(key)){var value=attributes[key];null==value?element.removeAttribute(key):element.setAttribute(key,value)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.setAttributes=void 0,exports.setAttributes=setAttributes},{}],43:[function(_dereq_,module,exports){"use strict";function uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=16*Math.random()|0;return("x"===c?r:3&r|8).toString(16)})}module.exports=uuid},{}],44:[function(_dereq_,module,exports){"use strict";function deferred(fn){return function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];setTimeout(function(){try{fn.apply(void 0,args)}catch(err){console.log("Error in callback function"),console.log(err)}},1)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.deferred=deferred},{}],45:[function(_dereq_,module,exports){"use strict";function once(fn){var called=!1;return function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];called||(called=!0,fn.apply(void 0,args))}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.once=once},{}],46:[function(_dereq_,module,exports){"use strict";function promiseOrCallback(promise,callback){if(!callback)return promise;promise.then(function(data){return callback(null,data)}).catch(function(err){return callback(err)})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.promiseOrCallback=promiseOrCallback},{}],47:[function(_dereq_,module,exports){"use strict";function wrapPromise(fn){return function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];var callback;return"function"==typeof args[args.length-1]&&(callback=args.pop(),callback=once_1.once(deferred_1.deferred(callback))),promise_or_callback_1.promiseOrCallback(fn.apply(this,args),callback)}}var deferred_1=_dereq_("./lib/deferred"),once_1=_dereq_("./lib/once"),promise_or_callback_1=_dereq_("./lib/promise-or-callback");wrapPromise.wrapPrototype=function(target,options){void 0===options&&(options={});var ignoreMethods=options.ignoreMethods||[],includePrivateMethods=!0===options.transformPrivateMethods;return Object.getOwnPropertyNames(target.prototype).filter(function(method){var isNotPrivateMethod,isNonConstructorFunction="constructor"!==method&&"function"==typeof target.prototype[method],isNotAnIgnoredMethod=-1===ignoreMethods.indexOf(method);return isNotPrivateMethod=!!includePrivateMethods||"_"!==method.charAt(0),isNonConstructorFunction&&isNotPrivateMethod&&isNotAnIgnoredMethod}).forEach(function(method){var original=target.prototype[method];target.prototype[method]=wrapPromise(original)}),target},module.exports=wrapPromise},{"./lib/deferred":44,"./lib/once":45,"./lib/promise-or-callback":46}],48:[function(_dereq_,module,exports){"use strict";function findType(cardType){return customCards[cardType]||cardTypes[cardType]}function getAllCardTypes(){return testOrder.map(function(cardType){return clone_1.clone(findType(cardType))})}function getCardPosition(name,ignoreErrorForNotExisting){void 0===ignoreErrorForNotExisting&&(ignoreErrorForNotExisting=!1);var position=testOrder.indexOf(name);if(!ignoreErrorForNotExisting&&-1===position)throw new Error('"'+name+'" is not a supported card type.');return position}function creditCardType(cardNumber){var results=[];if(!is_valid_input_type_1.isValidInputType(cardNumber))return results;if(0===cardNumber.length)return getAllCardTypes();testOrder.forEach(function(cardType){var cardConfiguration=findType(cardType);add_matching_cards_to_results_1.addMatchingCardsToResults(cardNumber,cardConfiguration,results)});var bestMatch=find_best_match_1.findBestMatch(results);return bestMatch?[bestMatch]:results}var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},cardTypes=_dereq_("./lib/card-types"),add_matching_cards_to_results_1=_dereq_("./lib/add-matching-cards-to-results"),is_valid_input_type_1=_dereq_("./lib/is-valid-input-type"),find_best_match_1=_dereq_("./lib/find-best-match"),clone_1=_dereq_("./lib/clone"),customCards={},cardNames={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"},ORIGINAL_TEST_ORDER=[cardNames.VISA,cardNames.MASTERCARD,cardNames.AMERICAN_EXPRESS,cardNames.DINERS_CLUB,cardNames.DISCOVER,cardNames.JCB,cardNames.UNIONPAY,cardNames.MAESTRO,cardNames.ELO,cardNames.MIR,cardNames.HIPER,cardNames.HIPERCARD],testOrder=clone_1.clone(ORIGINAL_TEST_ORDER);creditCardType.getTypeInfo=function(cardType){return clone_1.clone(findType(cardType))},creditCardType.removeCard=function(name){var position=getCardPosition(name);testOrder.splice(position,1)},creditCardType.addCard=function(config){var existingCardPosition=getCardPosition(config.type,!0);customCards[config.type]=config,-1===existingCardPosition&&testOrder.push(config.type)},creditCardType.updateCard=function(cardType,updates){var originalObject=customCards[cardType]||cardTypes[cardType];if(!originalObject)throw new Error('"'+cardType+"\" is not a recognized type. Use `addCard` instead.'");if(updates.type&&originalObject.type!==updates.type)throw new Error("Cannot overwrite type parameter.");var clonedCard=clone_1.clone(originalObject);clonedCard=__assign(__assign({},clonedCard),updates),customCards[clonedCard.type]=clonedCard},creditCardType.changeOrder=function(name,position){var currentPosition=getCardPosition(name);testOrder.splice(currentPosition,1),testOrder.splice(position,0,name)},creditCardType.resetModifications=function(){testOrder=clone_1.clone(ORIGINAL_TEST_ORDER),customCards={}},creditCardType.types=cardNames,module.exports=creditCardType},{"./lib/add-matching-cards-to-results":49,"./lib/card-types":50,"./lib/clone":51,"./lib/find-best-match":52,"./lib/is-valid-input-type":53}],49:[function(_dereq_,module,exports){"use strict";function addMatchingCardsToResults(cardNumber,cardConfiguration,results){var i,patternLength;for(i=0;i<cardConfiguration.patterns.length;i++){var pattern=cardConfiguration.patterns[i];if(matches_1.matches(cardNumber,pattern)){var clonedCardConfiguration=clone_1.clone(cardConfiguration);patternLength=Array.isArray(pattern)?String(pattern[0]).length:String(pattern).length,cardNumber.length>=patternLength&&(clonedCardConfiguration.matchStrength=patternLength),results.push(clonedCardConfiguration);break}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.addMatchingCardsToResults=void 0;var clone_1=_dereq_("./clone"),matches_1=_dereq_("./matches");exports.addMatchingCardsToResults=addMatchingCardsToResults},{"./clone":51,"./matches":54}],50:[function(_dereq_,module,exports){"use strict";var cardTypes={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,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}}};module.exports=cardTypes},{}],51:[function(_dereq_,module,exports){"use strict";function clone(originalObject){return originalObject?JSON.parse(JSON.stringify(originalObject)):null}Object.defineProperty(exports,"__esModule",{value:!0}),exports.clone=void 0,exports.clone=clone},{}],52:[function(_dereq_,module,exports){"use strict";function hasEnoughResultsToDetermineBestMatch(results){var numberOfResultsWithMaxStrengthProperty=results.filter(function(result){return result.matchStrength}).length;return numberOfResultsWithMaxStrengthProperty>0&&numberOfResultsWithMaxStrengthProperty===results.length}function findBestMatch(results){return hasEnoughResultsToDetermineBestMatch(results)?results.reduce(function(bestMatch,result){return bestMatch?Number(bestMatch.matchStrength)<Number(result.matchStrength)?result:bestMatch:result}):null}Object.defineProperty(exports,"__esModule",{value:!0}),exports.findBestMatch=void 0,exports.findBestMatch=findBestMatch},{}],53:[function(_dereq_,module,exports){"use strict";function isValidInputType(cardNumber){return"string"==typeof cardNumber||cardNumber instanceof String}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isValidInputType=void 0,exports.isValidInputType=isValidInputType},{}],54:[function(_dereq_,module,exports){"use strict";function matchesRange(cardNumber,min,max){var maxLengthToCheck=String(min).length,substr=cardNumber.substr(0,maxLengthToCheck),integerRepresentationOfCardNumber=parseInt(substr,10);return min=parseInt(String(min).substr(0,substr.length),10),max=parseInt(String(max).substr(0,substr.length),10),integerRepresentationOfCardNumber>=min&&integerRepresentationOfCardNumber<=max}function matchesPattern(cardNumber,pattern){return pattern=String(pattern),pattern.substring(0,cardNumber.length)===cardNumber.substring(0,pattern.length)}function matches(cardNumber,pattern){return Array.isArray(pattern)?matchesRange(cardNumber,pattern[0],pattern[1]):matchesPattern(cardNumber,pattern)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.matches=void 0,exports.matches=matches},{}],55:[function(_dereq_,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Framebus=void 0;var is_not_string_1=_dereq_("./lib/is-not-string"),subscription_args_invalid_1=_dereq_("./lib/subscription-args-invalid"),broadcast_1=_dereq_("./lib/broadcast"),package_payload_1=_dereq_("./lib/package-payload"),constants_1=_dereq_("./lib/constants"),Framebus=function(){function Framebus(options){void 0===options&&(options={}),this.origin=options.origin||"*",this.channel=options.channel||"",this.verifyDomain=options.verifyDomain,this.isDestroyed=!1,this.listeners=[]}return Framebus.target=function(options){return new Framebus(options)},Framebus.prototype.include=function(childWindow){return null!=childWindow&&(null!=childWindow.Window&&(childWindow.constructor===childWindow.Window&&(constants_1.childWindows.push(childWindow),!0)))},Framebus.prototype.target=function(options){return Framebus.target(options)},Framebus.prototype.emit=function(eventName,data,reply){if(this.isDestroyed)return!1;var origin=this.origin;if(eventName=this.namespaceEvent(eventName),is_not_string_1.isntString(eventName))return!1;if(is_not_string_1.isntString(origin))return!1;"function"==typeof data&&(reply=data,data=void 0);var payload=package_payload_1.packagePayload(eventName,origin,data,reply);return!!payload&&(broadcast_1.broadcast(window.top||window.self,payload,origin),!0)},Framebus.prototype.on=function(eventName,originalHandler){if(this.isDestroyed)return!1;var self=this,origin=this.origin,handler=originalHandler;return eventName=this.namespaceEvent(eventName),!subscription_args_invalid_1.subscriptionArgsInvalid(eventName,handler,origin)&&(this.verifyDomain&&(handler=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];self.checkOrigin(this&&this.origin)&&originalHandler.apply(void 0,args)}),this.listeners.push({eventName:eventName,handler:handler,originalHandler:originalHandler}),constants_1.subscribers[origin]=constants_1.subscribers[origin]||{},constants_1.subscribers[origin][eventName]=constants_1.subscribers[origin][eventName]||[],constants_1.subscribers[origin][eventName].push(handler),!0)},Framebus.prototype.off=function(eventName,originalHandler){var handler=originalHandler;if(this.isDestroyed)return!1;if(this.verifyDomain)for(var i=0;i<this.listeners.length;i++){var listener=this.listeners[i];listener.originalHandler===originalHandler&&(handler=listener.handler)}eventName=this.namespaceEvent(eventName);var origin=this.origin;if(subscription_args_invalid_1.subscriptionArgsInvalid(eventName,handler,origin))return!1;var subscriberList=constants_1.subscribers[origin]&&constants_1.subscribers[origin][eventName];if(!subscriberList)return!1;for(var i=0;i<subscriberList.length;i++)if(subscriberList[i]===handler)return subscriberList.splice(i,1),!0;return!1},Framebus.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var i=0;i<this.listeners.length;i++){var listener=this.listeners[i];this.off(listener.eventName,listener.handler)}this.listeners.length=0}},Framebus.prototype.checkOrigin=function(postMessageOrigin){var merchantHost,a=document.createElement("a");return a.href=location.href,merchantHost="https:"===a.protocol?a.host.replace(/:443$/,""):"http:"===a.protocol?a.host.replace(/:80$/,""):a.host,
a.protocol+"//"+merchantHost===postMessageOrigin||!this.verifyDomain||this.verifyDomain(postMessageOrigin)},Framebus.prototype.namespaceEvent=function(eventName){return this.channel?this.channel+":"+eventName:eventName},Framebus}();exports.Framebus=Framebus},{"./lib/broadcast":59,"./lib/constants":60,"./lib/is-not-string":63,"./lib/package-payload":65,"./lib/subscription-args-invalid":67}],56:[function(_dereq_,module,exports){"use strict";var attach_1=_dereq_("./lib/attach"),framebus_1=_dereq_("./framebus");attach_1.attach(),module.exports=framebus_1.Framebus},{"./framebus":55,"./lib/attach":57}],57:[function(_dereq_,module,exports){"use strict";function attach(){isAttached||"undefined"==typeof window||(isAttached=!0,window.addEventListener("message",message_1.onmessage,!1))}function detach(){isAttached=!1,window.removeEventListener("message",message_1.onmessage,!1)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.detach=exports.attach=void 0;var message_1=_dereq_("./message"),isAttached=!1;exports.attach=attach,exports.detach=detach},{"./message":64}],58:[function(_dereq_,module,exports){"use strict";function broadcastToChildWindows(payload,origin,source){for(var i=constants_1.childWindows.length-1;i>=0;i--){var childWindow=constants_1.childWindows[i];childWindow.closed?constants_1.childWindows.splice(i,1):source!==childWindow&&broadcast_1.broadcast(childWindow.top,payload,origin)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.broadcastToChildWindows=void 0;var broadcast_1=_dereq_("./broadcast"),constants_1=_dereq_("./constants");exports.broadcastToChildWindows=broadcastToChildWindows},{"./broadcast":59,"./constants":60}],59:[function(_dereq_,module,exports){"use strict";function broadcast(frame,payload,origin){var frameToBroadcastTo,i=0;try{for(frame.postMessage(payload,origin),has_opener_1.hasOpener(frame)&&broadcast(frame.opener.top,payload,origin);frameToBroadcastTo=frame.frames[i];)broadcast(frameToBroadcastTo,payload,origin),i++}catch(_){}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.broadcast=void 0;var has_opener_1=_dereq_("./has-opener");exports.broadcast=broadcast},{"./has-opener":62}],60:[function(_dereq_,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.subscribers=exports.childWindows=exports.prefix=void 0,exports.prefix="/*framebus*/",exports.childWindows=[],exports.subscribers={}},{}],61:[function(_dereq_,module,exports){"use strict";function dispatch(origin,event,data,reply,e){if(constants_1.subscribers[origin]&&constants_1.subscribers[origin][event]){var args=[];data&&args.push(data),reply&&args.push(reply);for(var i=0;i<constants_1.subscribers[origin][event].length;i++)constants_1.subscribers[origin][event][i].apply(e,args)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.dispatch=void 0;var constants_1=_dereq_("./constants");exports.dispatch=dispatch},{"./constants":60}],62:[function(_dereq_,module,exports){"use strict";function hasOpener(frame){return frame.top===frame&&(null!=frame.opener&&(frame.opener!==frame&&!0!==frame.opener.closed))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.hasOpener=void 0,exports.hasOpener=hasOpener},{}],63:[function(_dereq_,module,exports){"use strict";function isntString(str){return"string"!=typeof str}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isntString=void 0,exports.isntString=isntString},{}],64:[function(_dereq_,module,exports){"use strict";function onmessage(e){if(!is_not_string_1.isntString(e.data)){var payload=unpack_payload_1.unpackPayload(e);if(payload){var data=payload.eventData,reply=payload.reply;dispatch_1.dispatch("*",payload.event,data,reply,e),dispatch_1.dispatch(e.origin,payload.event,data,reply,e),broadcast_to_child_windows_1.broadcastToChildWindows(e.data,payload.origin,e.source)}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.onmessage=void 0;var is_not_string_1=_dereq_("./is-not-string"),unpack_payload_1=_dereq_("./unpack-payload"),dispatch_1=_dereq_("./dispatch"),broadcast_to_child_windows_1=_dereq_("./broadcast-to-child-windows");exports.onmessage=onmessage},{"./broadcast-to-child-windows":58,"./dispatch":61,"./is-not-string":63,"./unpack-payload":68}],65:[function(_dereq_,module,exports){"use strict";function packagePayload(event,origin,data,reply){var packaged,payload={event:event,origin:origin};"function"==typeof reply&&(payload.reply=subscribe_replier_1.subscribeReplier(reply,origin)),payload.eventData=data;try{packaged=constants_1.prefix+JSON.stringify(payload)}catch(e){throw new Error("Could not stringify event: "+e.message)}return packaged}Object.defineProperty(exports,"__esModule",{value:!0}),exports.packagePayload=void 0;var subscribe_replier_1=_dereq_("./subscribe-replier"),constants_1=_dereq_("./constants");exports.packagePayload=packagePayload},{"./constants":60,"./subscribe-replier":66}],66:[function(_dereq_,module,exports){"use strict";function subscribeReplier(fn,origin){function replier(data,replyOriginHandler){fn(data,replyOriginHandler),framebus_1.Framebus.target({origin:origin}).off(uuid,replier)}var uuid=uuid_1.default();return framebus_1.Framebus.target({origin:origin}).on(uuid,replier),uuid}var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.subscribeReplier=void 0;var framebus_1=_dereq_("../framebus"),uuid_1=__importDefault(_dereq_("@braintree/uuid"));exports.subscribeReplier=subscribeReplier},{"../framebus":55,"@braintree/uuid":43}],67:[function(_dereq_,module,exports){"use strict";function subscriptionArgsInvalid(event,fn,origin){return!!is_not_string_1.isntString(event)||("function"!=typeof fn||is_not_string_1.isntString(origin))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.subscriptionArgsInvalid=void 0;var is_not_string_1=_dereq_("./is-not-string");exports.subscriptionArgsInvalid=subscriptionArgsInvalid},{"./is-not-string":63}],68:[function(_dereq_,module,exports){"use strict";function unpackPayload(e){var payload;if(e.data.slice(0,constants_1.prefix.length)!==constants_1.prefix)return!1;try{payload=JSON.parse(e.data.slice(constants_1.prefix.length))}catch(err){return!1}if(payload.reply){var replyOrigin_1=e.origin,replySource_1=e.source,replyEvent_1=payload.reply;payload.reply=function(replyData){if(replySource_1){var replyPayload=package_payload_1.packagePayload(replyEvent_1,replyOrigin_1,replyData);replyPayload&&replySource_1.postMessage(replyPayload,replyOrigin_1)}}}return payload}Object.defineProperty(exports,"__esModule",{value:!0}),exports.unpackPayload=void 0;var constants_1=_dereq_("./constants"),package_payload_1=_dereq_("./package-payload");exports.unpackPayload=unpackPayload},{"./constants":60,"./package-payload":65}],69:[function(_dereq_,module,exports){"use strict";function finallyConstructor(callback){var constructor=this.constructor;return this.then(function(value){return constructor.resolve(callback()).then(function(){return value})},function(reason){return constructor.resolve(callback()).then(function(){return constructor.reject(reason)})})}function isArray(x){return Boolean(x&&void 0!==x.length)}function noop(){}function bind(fn,thisArg){return function(){fn.apply(thisArg,arguments)}}function Promise(fn){if(!(this instanceof Promise))throw new TypeError("Promises must be constructed via new");if("function"!=typeof fn)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],doResolve(fn,this)}function handle(self,deferred){for(;3===self._state;)self=self._value;if(0===self._state)return void self._deferreds.push(deferred);self._handled=!0,Promise._immediateFn(function(){var cb=1===self._state?deferred.onFulfilled:deferred.onRejected;if(null===cb)return void(1===self._state?resolve:reject)(deferred.promise,self._value);var ret;try{ret=cb(self._value)}catch(e){return void reject(deferred.promise,e)}resolve(deferred.promise,ret)})}function resolve(self,newValue){try{if(newValue===self)throw new TypeError("A promise cannot be resolved with itself.");if(newValue&&("object"==typeof newValue||"function"==typeof newValue)){var then=newValue.then;if(newValue instanceof Promise)return self._state=3,self._value=newValue,void finale(self);if("function"==typeof then)return void doResolve(bind(then,newValue),self)}self._state=1,self._value=newValue,finale(self)}catch(e){reject(self,e)}}function reject(self,newValue){self._state=2,self._value=newValue,finale(self)}function finale(self){2===self._state&&0===self._deferreds.length&&Promise._immediateFn(function(){self._handled||Promise._unhandledRejectionFn(self._value)});for(var i=0,len=self._deferreds.length;i<len;i++)handle(self,self._deferreds[i]);self._deferreds=null}function Handler(onFulfilled,onRejected,promise){this.onFulfilled="function"==typeof onFulfilled?onFulfilled:null,this.onRejected="function"==typeof onRejected?onRejected:null,this.promise=promise}function doResolve(fn,self){var done=!1;try{fn(function(value){done||(done=!0,resolve(self,value))},function(reason){done||(done=!0,reject(self,reason))})}catch(ex){if(done)return;done=!0,reject(self,ex)}}var setTimeoutFunc=setTimeout;Promise.prototype.catch=function(onRejected){return this.then(null,onRejected)},Promise.prototype.then=function(onFulfilled,onRejected){var prom=new this.constructor(noop);return handle(this,new Handler(onFulfilled,onRejected,prom)),prom},Promise.prototype.finally=finallyConstructor,Promise.all=function(arr){return new Promise(function(resolve,reject){function res(i,val){try{if(val&&("object"==typeof val||"function"==typeof val)){var then=val.then;if("function"==typeof then)return void then.call(val,function(val){res(i,val)},reject)}args[i]=val,0==--remaining&&resolve(args)}catch(ex){reject(ex)}}if(!isArray(arr))return reject(new TypeError("Promise.all accepts an array"));var args=Array.prototype.slice.call(arr);if(0===args.length)return resolve([]);for(var remaining=args.length,i=0;i<args.length;i++)res(i,args[i])})},Promise.resolve=function(value){return value&&"object"==typeof value&&value.constructor===Promise?value:new Promise(function(resolve){resolve(value)})},Promise.reject=function(value){return new Promise(function(resolve,reject){reject(value)})},Promise.race=function(arr){return new Promise(function(resolve,reject){if(!isArray(arr))return reject(new TypeError("Promise.race accepts an array"));for(var i=0,len=arr.length;i<len;i++)Promise.resolve(arr[i]).then(resolve,reject)})},Promise._immediateFn="function"==typeof setImmediate&&function(fn){setImmediate(fn)}||function(fn){setTimeoutFunc(fn,0)},Promise._unhandledRejectionFn=function(err){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",err)},module.exports=Promise},{}],70:[function(_dereq_,module,exports){"use strict";function isOldSamsungBrowserOrSamsungWebview(ua){return!isChrome(ua)&&ua.indexOf("Samsung")>-1}function isKitKatWebview(ua){return void 0===ua&&(ua=UA),isAndroid(ua)&&KITKAT_WEBVIEW_REGEX.test(ua)}function isAndroidChrome(ua){return void 0===ua&&(ua=UA),(isAndroid(ua)||isChromeOs(ua))&&isChrome(ua)}function isSamsungBrowser(ua){return void 0===ua&&(ua=UA),/SamsungBrowser/.test(ua)||isOldSamsungBrowserOrSamsungWebview(ua)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isIos=exports.isIE9=exports.isSamsungBrowser=exports.isAndroidChrome=exports.isKitKatWebview=void 0;var UA="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent,isAndroid=_dereq_("@braintree/browser-detection/is-android"),isChromeOs=_dereq_("@braintree/browser-detection/is-chrome-os"),isChrome=_dereq_("@braintree/browser-detection/is-chrome"),isIos=_dereq_("@braintree/browser-detection/is-ios");exports.isIos=isIos;var isIE9=_dereq_("@braintree/browser-detection/is-ie9");exports.isIE9=isIE9;var KITKAT_WEBVIEW_REGEX=/Version\/\d\.\d* Chrome\/\d*\.0\.0\.0/;exports.isKitKatWebview=isKitKatWebview,exports.isAndroidChrome=isAndroidChrome,exports.isSamsungBrowser=isSamsungBrowser},{"@braintree/browser-detection/is-android":21,"@braintree/browser-detection/is-chrome":23,"@braintree/browser-detection/is-chrome-os":22,"@braintree/browser-detection/is-ie9":28,"@braintree/browser-detection/is-ios":32}],71:[function(_dereq_,module,exports){"use strict";var device_1=_dereq_("./lib/device");module.exports=function(){return!device_1.isSamsungBrowser()}},{"./lib/device":70}],72:[function(_dereq_,module,exports){module.exports=_dereq_("./dist/supports-input-formatting")},{"./dist/supports-input-formatting":71}],73:[function(_dereq_,module,exports){"use strict";function AmericanExpress(options){this._client=options.client}var BraintreeError=_dereq_("../lib/braintree-error"),errors=_dereq_("./errors"),assign=_dereq_("../lib/assign").assign,Promise=_dereq_("../lib/promise"),methods=_dereq_("../lib/methods"),convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),wrapPromise=_dereq_("@braintree/wrap-promise");AmericanExpress.prototype.getRewardsBalance=function(options){var data,nonce=options.nonce;return nonce?(data=assign({_meta:{source:"american-express"},paymentMethodNonce:nonce},options),delete data.nonce,this._client.request({method:"get",endpoint:"payment_methods/amex_rewards_balance",data:data}).catch(function(err){return Promise.reject(new BraintreeError({type:errors.AMEX_NETWORK_ERROR.type,code:errors.AMEX_NETWORK_ERROR.code,message:"A network error occurred when getting the American Express rewards balance.",details:{originalError:err}}))})):Promise.reject(new BraintreeError({type:errors.AMEX_NONCE_REQUIRED.type,code:errors.AMEX_NONCE_REQUIRED.code,message:"getRewardsBalance must be called with a nonce."}))},AmericanExpress.prototype.getExpressCheckoutProfile=function(options){return options.nonce?this._client.request({method:"get",endpoint:"payment_methods/amex_express_checkout_cards/"+options.nonce,data:{_meta:{source:"american-express"},paymentMethodNonce:options.nonce}}).catch(function(err){return Promise.reject(new BraintreeError({type:errors.AMEX_NETWORK_ERROR.type,code:errors.AMEX_NETWORK_ERROR.code,message:"A network error occurred when getting the American Express Checkout nonce profile.",details:{originalError:err}}))}):Promise.reject(new BraintreeError({type:errors.AMEX_NONCE_REQUIRED.type,code:errors.AMEX_NONCE_REQUIRED.code,message:"getExpressCheckoutProfile must be called with a nonce."}))},AmericanExpress.prototype.teardown=function(){return convertMethodsToError(this,methods(AmericanExpress.prototype)),Promise.resolve()},module.exports=wrapPromise.wrapPrototype(AmericanExpress)},{"../lib/assign":126,"../lib/braintree-error":129,"../lib/convert-methods-to-error":132,"../lib/methods":159,"../lib/promise":161,"./errors":74,"@braintree/wrap-promise":47}],74:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../lib/braintree-error");module.exports={AMEX_NONCE_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"AMEX_NONCE_REQUIRED"},AMEX_NETWORK_ERROR:{type:BraintreeError.types.NETWORK,code:"AMEX_NETWORK_ERROR"}}},{"../lib/braintree-error":129}],75:[function(_dereq_,module,exports){"use strict";function create(options){var name="American Express";return basicComponentVerification.verify({name:name,client:options.client,authorization:options.authorization}).then(function(){return createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:name})}).then(function(client){return options.client=client,new AmericanExpress(options)})}var AmericanExpress=_dereq_("./american-express"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),wrapPromise=_dereq_("@braintree/wrap-promise");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"./american-express":73,"@braintree/wrap-promise":47}],76:[function(_dereq_,module,exports){"use strict";function ApplePay(options){this._instantiatedWithClient=Boolean(!options.useDeferredClient),this._client=options.client,this._createPromise=options.createPromise,this._client&&this._setMerchantIdentifier()}var BraintreeError=_dereq_("../lib/braintree-error"),analytics=_dereq_("../lib/analytics"),errors=_dereq_("./errors"),Promise=_dereq_("../lib/promise"),methods=_dereq_("../lib/methods"),convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),wrapPromise=_dereq_("@braintree/wrap-promise");ApplePay.prototype._waitForClient=function(){return this._client?Promise.resolve():this._createPromise.then(function(client){this._client=client,this._setMerchantIdentifier()}.bind(this))},ApplePay.prototype._setMerchantIdentifier=function(){var applePayConfig=this._client.getConfiguration().gatewayConfiguration.applePayWeb;applePayConfig&&Object.defineProperty(this,"merchantIdentifier",{value:applePayConfig.merchantIdentifier,configurable:!1,writable:!1})},ApplePay.prototype.createPaymentRequest=function(paymentRequest){return this._instantiatedWithClient?this._createPaymentRequestSynchronously(paymentRequest):this._waitForClient().then(function(){return this._createPaymentRequestSynchronously(paymentRequest)}.bind(this))},ApplePay.prototype._createPaymentRequestSynchronously=function(paymentRequest){var applePay=this._client.getConfiguration().gatewayConfiguration.applePayWeb,defaults={countryCode:applePay.countryCode,currencyCode:applePay.currencyCode,merchantCapabilities:applePay.merchantCapabilities||["supports3DS"],supportedNetworks:applePay.supportedNetworks.map(function(network){return"mastercard"===network?"masterCard":network})};return Object.assign({},defaults,paymentRequest)},ApplePay.prototype.performValidation=function(options){var self=this;return options&&options.validationURL?this._waitForClient().then(function(){var applePayWebSession={validationUrl:options.validationURL,domainName:options.domainName||window.location.hostname,merchantIdentifier:options.merchantIdentifier||self.merchantIdentifier};return null!=options.displayName&&(applePayWebSession.displayName=options.displayName),self._client.request({method:"post",endpoint:"apple_pay_web/sessions",data:{_meta:{source:"apple-pay"},applePayWebSession:applePayWebSession}})}).then(function(response){return analytics.sendEvent(self._client,"applepay.performValidation.succeeded"),Promise.resolve(response)}).catch(function(err){return analytics.sendEvent(self._client,"applepay.performValidation.failed"),"CLIENT_REQUEST_ERROR"===err.code?Promise.reject(new BraintreeError({type:errors.APPLE_PAY_MERCHANT_VALIDATION_FAILED.type,code:errors.APPLE_PAY_MERCHANT_VALIDATION_FAILED.code,message:errors.APPLE_PAY_MERCHANT_VALIDATION_FAILED.message,details:{originalError:err.details.originalError}})):Promise.reject(new BraintreeError({type:errors.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.type,code:errors.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.code,message:errors.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.message,details:{originalError:err}}))}):Promise.reject(new BraintreeError(errors.APPLE_PAY_VALIDATION_URL_REQUIRED))},ApplePay.prototype.tokenize=function(options){var self=this;return options.token?this._waitForClient().then(function(){return self._client.request({method:"post",endpoint:"payment_methods/apple_payment_tokens",data:{_meta:{source:"apple-pay"},applePaymentToken:Object.assign({},options.token,{paymentData:btoa(JSON.stringify(options.token.paymentData))})}})}).then(function(response){return analytics.sendEvent(self._client,"applepay.tokenize.succeeded"),Promise.resolve(response.applePayCards[0])}).catch(function(err){return analytics.sendEvent(self._client,"applepay.tokenize.failed"),Promise.reject(new BraintreeError({type:errors.APPLE_PAY_TOKENIZATION.type,code:errors.APPLE_PAY_TOKENIZATION.code,message:errors.APPLE_PAY_TOKENIZATION.message,details:{originalError:err}}))}):Promise.reject(new BraintreeError(errors.APPLE_PAY_PAYMENT_TOKEN_REQUIRED))},ApplePay.prototype.teardown=function(){return convertMethodsToError(this,methods(ApplePay.prototype)),Promise.resolve()},module.exports=wrapPromise.wrapPrototype(ApplePay)},{"../lib/analytics":124,"../lib/braintree-error":129,"../lib/convert-methods-to-error":132,"../lib/methods":159,"../lib/promise":161,"./errors":77,"@braintree/wrap-promise":47}],77:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../lib/braintree-error");module.exports={APPLE_PAY_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"APPLE_PAY_NOT_ENABLED",message:"Apple Pay is not enabled for this merchant."},APPLE_PAY_VALIDATION_URL_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"APPLE_PAY_VALIDATION_URL_REQUIRED",message:"performValidation must be called with a validationURL."},APPLE_PAY_MERCHANT_VALIDATION_NETWORK:{type:BraintreeError.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:BraintreeError.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:BraintreeError.types.MERCHANT,code:"APPLE_PAY_PAYMENT_TOKEN_REQUIRED",message:"tokenize must be called with a payment token."},APPLE_PAY_TOKENIZATION:{type:BraintreeError.types.NETWORK,code:"APPLE_PAY_TOKENIZATION",message:"A network error occurred when processing the Apple Pay payment."}}},{"../lib/braintree-error":129}],78:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"Apple Pay",client:options.client,authorization:options.authorization}).then(function(){var applePayInstance,createPromise=createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:"Apple Pay"}).then(function(client){return client.getConfiguration().gatewayConfiguration.applePayWeb?(analytics.sendEvent(client,"applepay.initialized"),client):Promise.reject(new BraintreeError(errors.APPLE_PAY_NOT_ENABLED))});return options.createPromise=createPromise,applePayInstance=new ApplePay(options),options.useDeferredClient?applePayInstance:createPromise.then(function(client){return applePayInstance._client=client,applePayInstance})})}var ApplePay=_dereq_("./apple-pay"),analytics=_dereq_("../lib/analytics"),BraintreeError=_dereq_("../lib/braintree-error"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),createAssetsUrl=_dereq_("../lib/create-assets-url"),createDeferredClient=_dereq_("../lib/create-deferred-client"),Promise=_dereq_("../lib/promise"),errors=_dereq_("./errors"),wrapPromise=_dereq_("@braintree/wrap-promise");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/analytics":124,"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"./apple-pay":76,"./errors":77,"@braintree/wrap-promise":47}],79:[function(_dereq_,module,exports){"use strict";var isIe=_dereq_("@braintree/browser-detection/is-ie"),isIe9=_dereq_("@braintree/browser-detection/is-ie9");module.exports={isIe:isIe,isIe9:isIe9}},{"@braintree/browser-detection/is-ie":26,"@braintree/browser-detection/is-ie9":28}],80:[function(_dereq_,module,exports){"use strict";function Client(configuration){var configurationJSON,gatewayConfiguration;if(configuration=configuration||{},configurationJSON=JSON.stringify(configuration),!(gatewayConfiguration=configuration.gatewayConfiguration))throw new BraintreeError(errors.CLIENT_MISSING_GATEWAY_CONFIGURATION);["assetsUrl","clientApiUrl","configUrl"].forEach(function(property){if(property in gatewayConfiguration&&!isVerifiedDomain(gatewayConfiguration[property]))throw new BraintreeError({type:errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.type,code:errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.code,message:property+" property is on an invalid domain."})}),this.getConfiguration=function(){return JSON.parse(configurationJSON)},this._request=request,this._configuration=this.getConfiguration(),this._clientApiBaseUrl=gatewayConfiguration.clientApiUrl+"/v1/",gatewayConfiguration.graphQL&&(this._graphQL=new GraphQL({graphQL:gatewayConfiguration.graphQL}))}function formatRequestError(status,err){var requestError;if(-1===status?requestError=new BraintreeError(errors.CLIENT_REQUEST_TIMEOUT):401===status?requestError=new BraintreeError(errors.CLIENT_AUTHORIZATION_INVALID):403===status?requestError=new BraintreeError(errors.CLIENT_AUTHORIZATION_INSUFFICIENT):429===status?requestError=new BraintreeError(errors.CLIENT_RATE_LIMITED):status>=500?requestError=new BraintreeError(errors.CLIENT_GATEWAY_NETWORK):(status<200||status>=400)&&(requestError=convertToBraintreeError(err,{type:errors.CLIENT_REQUEST_ERROR.type,code:errors.CLIENT_REQUEST_ERROR.code,message:errors.CLIENT_REQUEST_ERROR.message})),requestError)return requestError.details=requestError.details||{},requestError.details.httpStatus=status,requestError}function getAuthorizationHeadersForGraphQL(configuration){return{Authorization:"Bearer "+(configuration.authorizationFingerprint||configuration.authorization),"Braintree-Version":BRAINTREE_VERSION}}var BRAINTREE_VERSION=_dereq_("./constants").BRAINTREE_VERSION,GraphQL=_dereq_("./request/graphql"),request=_dereq_("./request"),isVerifiedDomain=_dereq_("../lib/is-verified-domain"),BraintreeError=_dereq_("../lib/braintree-error"),convertToBraintreeError=_dereq_("../lib/convert-to-braintree-error"),getGatewayConfiguration=_dereq_("./get-configuration").getConfiguration,createAuthorizationData=_dereq_("../lib/create-authorization-data"),addMetadata=_dereq_("../lib/add-metadata"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),once=_dereq_("../lib/once"),deferred=_dereq_("../lib/deferred"),assign=_dereq_("../lib/assign").assign,analytics=_dereq_("../lib/analytics"),errors=_dereq_("./errors"),VERSION=_dereq_("../lib/constants").VERSION,GRAPHQL_URLS=_dereq_("../lib/constants").GRAPHQL_URLS,methods=_dereq_("../lib/methods"),convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),assets=_dereq_("../lib/assets"),FRAUDNET_FNCLS=_dereq_("../lib/constants").FRAUDNET_FNCLS,FRAUDNET_SOURCE=_dereq_("../lib/constants").FRAUDNET_SOURCE,FRAUDNET_URL=_dereq_("../lib/constants").FRAUDNET_URL,cachedClients={};Client.initialize=function(options){var clientInstance,authData,promise=cachedClients[options.authorization];if(promise)return analytics.sendEvent(promise,"custom.client.load.cached"),promise;try{authData=createAuthorizationData(options.authorization)}catch(err){return Promise.reject(new BraintreeError(errors.CLIENT_INVALID_AUTHORIZATION))}return promise=getGatewayConfiguration(authData).then(function(configuration){return options.debug&&(configuration.isDebug=!0),configuration.authorization=options.authorization,clientInstance=new Client(configuration)}),cachedClients[options.authorization]=promise,analytics.sendEvent(promise,"custom.client.load.initialized"),promise.then(function(client){return analytics.sendEvent(clientInstance,"custom.client.load.succeeded"),client}).catch(function(err){return delete cachedClients[options.authorization],Promise.reject(err)})},Client.clearCache=function(){cachedClients={}},Client.prototype._findOrCreateFraudnetJSON=function(clientMetadataId){var config,additionalData,authorizationFingerprint,parameters,el=document.querySelector('script[fncls="'+FRAUDNET_FNCLS+'"]');el||(el=document.body.appendChild(document.createElement("script")),el.type="application/json",el.setAttribute("fncls",FRAUDNET_FNCLS)),config=this.getConfiguration(),additionalData={rda_tenant:"bt_card",mid:config.gatewayConfiguration.merchantId},authorizationFingerprint=config.authorizationFingerprint,authorizationFingerprint&&authorizationFingerprint.split("&").forEach(function(pieces){var component=pieces.split("=");"customer_id"===component[0]&&component.length>1&&(additionalData.cid=component[1])}),parameters={f:clientMetadataId.substr(0,32),fp:additionalData,bu:!1,s:FRAUDNET_SOURCE},el.text=JSON.stringify(parameters)},Client.prototype.request=function(options,callback){var self=this,requestPromise=new Promise(function(resolve,reject){var optionName,api,baseUrl,requestOptions,shouldCollectData=Boolean("payment_methods/credit_cards"===options.endpoint&&self.getConfiguration().gatewayConfiguration.creditCards.collectDeviceData);if("graphQLApi"!==options.api&&(options.method?options.endpoint||(optionName="options.endpoint"):optionName="options.method"),optionName)throw new BraintreeError({type:errors.CLIENT_OPTION_REQUIRED.type,code:errors.CLIENT_OPTION_REQUIRED.code,message:optionName+" is required when making a request."});if(api="api"in options?options.api:"clientApi",requestOptions={method:options.method,graphQL:self._graphQL,timeout:options.timeout,metadata:self._configuration.analyticsMetadata},"clientApi"===api)baseUrl=self._clientApiBaseUrl,requestOptions.data=addMetadata(self._configuration,options.data);else{if("graphQLApi"!==api)throw new BraintreeError({type:errors.CLIENT_OPTION_INVALID.type,code:errors.CLIENT_OPTION_INVALID.code,message:"options.api is invalid."});baseUrl=GRAPHQL_URLS[self._configuration.gatewayConfiguration.environment],options.endpoint="",requestOptions.method="post",requestOptions.data=assign({clientSdkMetadata:{source:self._configuration.analyticsMetadata.source,integration:self._configuration.analyticsMetadata.integration,sessionId:self._configuration.analyticsMetadata.sessionId}},options.data),requestOptions.headers=getAuthorizationHeadersForGraphQL(self._configuration)}requestOptions.url=baseUrl+options.endpoint,requestOptions.sendAnalyticsEvent=function(kind){analytics.sendEvent(self,kind)},self._request(requestOptions,function(err,data,status){var resolvedData,requestError;return(requestError=formatRequestError(status,err))?void reject(requestError):"graphQLApi"===api&&data.errors?void reject(convertToBraintreeError(data.errors,{type:errors.CLIENT_GRAPHQL_REQUEST_ERROR.type,code:errors.CLIENT_GRAPHQL_REQUEST_ERROR.code,message:errors.CLIENT_GRAPHQL_REQUEST_ERROR.message})):(resolvedData=assign({_httpStatus:status},data),shouldCollectData&&resolvedData.creditCards&&resolvedData.creditCards.length>0&&(self._findOrCreateFraudnetJSON(resolvedData.creditCards[0].nonce),assets.loadScript({src:FRAUDNET_URL,forceScriptReload:!0})),void resolve(resolvedData))})});return"function"==typeof callback?(callback=once(deferred(callback)),void requestPromise.then(function(response){callback(null,response,response._httpStatus)}).catch(function(err){var status=err&&err.details&&err.details.httpStatus;callback(err,null,status)})):requestPromise},Client.prototype.toJSON=function(){return this.getConfiguration()},Client.prototype.getVersion=function(){return VERSION},Client.prototype.teardown=wrapPromise(function(){var self=this;return delete cachedClients[self.getConfiguration().authorization],convertMethodsToError(self,methods(Client.prototype)),Promise.resolve()}),module.exports=Client},{"../lib/add-metadata":123,"../lib/analytics":124,"../lib/assets":125,"../lib/assign":126,"../lib/braintree-error":129,"../lib/constants":131,"../lib/convert-methods-to-error":132,"../lib/convert-to-braintree-error":133,"../lib/create-authorization-data":135,"../lib/deferred":137,"../lib/is-verified-domain":157,"../lib/methods":159,"../lib/once":160,"../lib/promise":161,"./constants":81,"./errors":82,"./get-configuration":83,"./request":95,"./request/graphql":93,"@braintree/wrap-promise":47}],81:[function(_dereq_,module,exports){"use strict";module.exports={
BRAINTREE_VERSION:"2018-05-10"}},{}],82:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../lib/braintree-error");module.exports={CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN:{type:BraintreeError.types.MERCHANT,code:"CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN"},CLIENT_OPTION_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"CLIENT_OPTION_REQUIRED"},CLIENT_OPTION_INVALID:{type:BraintreeError.types.MERCHANT,code:"CLIENT_OPTION_INVALID"},CLIENT_MISSING_GATEWAY_CONFIGURATION:{type:BraintreeError.types.INTERNAL,code:"CLIENT_MISSING_GATEWAY_CONFIGURATION",message:"Missing gatewayConfiguration."},CLIENT_INVALID_AUTHORIZATION:{type:BraintreeError.types.MERCHANT,code:"CLIENT_INVALID_AUTHORIZATION",message:"Authorization is invalid. Make sure your client token or tokenization key is valid."},CLIENT_GATEWAY_NETWORK:{type:BraintreeError.types.NETWORK,code:"CLIENT_GATEWAY_NETWORK",message:"Cannot contact the gateway at this time."},CLIENT_REQUEST_TIMEOUT:{type:BraintreeError.types.NETWORK,code:"CLIENT_REQUEST_TIMEOUT",message:"Request timed out waiting for a reply."},CLIENT_REQUEST_ERROR:{type:BraintreeError.types.NETWORK,code:"CLIENT_REQUEST_ERROR",message:"There was a problem with your request."},CLIENT_GRAPHQL_REQUEST_ERROR:{type:BraintreeError.types.NETWORK,code:"CLIENT_GRAPHQL_REQUEST_ERROR",message:"There was a problem with your request."},CLIENT_RATE_LIMITED:{type:BraintreeError.types.MERCHANT,code:"CLIENT_RATE_LIMITED",message:"You are being rate-limited; please try again in a few minutes."},CLIENT_AUTHORIZATION_INSUFFICIENT:{type:BraintreeError.types.MERCHANT,code:"CLIENT_AUTHORIZATION_INSUFFICIENT",message:"The authorization used has insufficient privileges."},CLIENT_AUTHORIZATION_INVALID:{type:BraintreeError.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":129}],83:[function(_dereq_,module,exports){"use strict";function getConfiguration(authData){return new Promise(function(resolve,reject){var configuration,attrs,configUrl,reqOptions,sessionId=uuid(),analyticsMetadata={merchantAppId:window.location.host,platform:constants.PLATFORM,sdkVersion:constants.VERSION,source:constants.SOURCE,integration:constants.INTEGRATION,integrationType:constants.INTEGRATION,sessionId:sessionId};attrs=authData.attrs,configUrl=authData.configUrl,attrs._meta=analyticsMetadata,attrs.braintreeLibraryVersion=constants.BRAINTREE_LIBRARY_VERSION,attrs.configVersion="3",reqOptions={url:configUrl,method:"GET",data:attrs},attrs.authorizationFingerprint&&authData.graphQL?(isDateStringBeforeOrOn(authData.graphQL.date,BRAINTREE_VERSION)&&(reqOptions.graphQL=new GraphQL({graphQL:{url:authData.graphQL.url,features:["configuration"]}})),reqOptions.metadata=analyticsMetadata):attrs.tokenizationKey&&(reqOptions.graphQL=new GraphQL({graphQL:{url:GRAPHQL_URLS[authData.environment],features:["configuration"]}}),reqOptions.metadata=analyticsMetadata),request(reqOptions,function(err,response,status){var errorTemplate;if(err)return errorTemplate=403===status?errors.CLIENT_AUTHORIZATION_INSUFFICIENT:401===status?errors.CLIENT_AUTHORIZATION_INVALID:errors.CLIENT_GATEWAY_NETWORK,void reject(new BraintreeError({type:errorTemplate.type,code:errorTemplate.code,message:errorTemplate.message,details:{originalError:err}}));configuration={authorizationType:attrs.tokenizationKey?"TOKENIZATION_KEY":"CLIENT_TOKEN",authorizationFingerprint:attrs.authorizationFingerprint,analyticsMetadata:analyticsMetadata,gatewayConfiguration:response},resolve(configuration)})})}var BraintreeError=_dereq_("../lib/braintree-error"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),request=_dereq_("./request"),uuid=_dereq_("@braintree/uuid"),constants=_dereq_("../lib/constants"),errors=_dereq_("./errors"),GraphQL=_dereq_("./request/graphql"),GRAPHQL_URLS=_dereq_("../lib/constants").GRAPHQL_URLS,isDateStringBeforeOrOn=_dereq_("../lib/is-date-string-before-or-on"),BRAINTREE_VERSION=_dereq_("./constants").BRAINTREE_VERSION;module.exports={getConfiguration:wrapPromise(getConfiguration)}},{"../lib/braintree-error":129,"../lib/constants":131,"../lib/is-date-string-before-or-on":155,"../lib/promise":161,"./constants":81,"./errors":82,"./request":95,"./request/graphql":93,"@braintree/uuid":43,"@braintree/wrap-promise":47}],84:[function(_dereq_,module,exports){"use strict";function create(options){return options.authorization?Client.initialize(options):Promise.reject(new BraintreeError({type:sharedErrors.INSTANTIATION_OPTION_REQUIRED.type,code:sharedErrors.INSTANTIATION_OPTION_REQUIRED.code,message:"options.authorization is required when instantiating a client."}))}var BraintreeError=_dereq_("../lib/braintree-error"),Client=_dereq_("./client"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),sharedErrors=_dereq_("../lib/errors");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/braintree-error":129,"../lib/errors":140,"../lib/promise":161,"./client":80,"@braintree/wrap-promise":47}],85:[function(_dereq_,module,exports){"use strict";function requestShouldRetry(status){return!status||status===TCP_PRECONNECT_BUG_STATUS_CODE}function graphQLRequestShouldRetryWithClientApi(body){var errorClass=!body.data&&body.errors&&body.errors[0]&&body.errors[0].extensions&&body.errors[0].extensions.errorClass;return"UNKNOWN"===errorClass||"INTERNAL"===errorClass}function _requestWithRetry(options,tcpRetryCount,cb){var status,resBody,ajaxRequest,body,method,headers,parsedBody,url=options.url,graphQL=options.graphQL,timeout=options.timeout,req=xhr.getRequestObject(),callback=cb,isGraphQLRequest=Boolean(graphQL&&graphQL.isGraphQLRequest(url,options.data));options.headers=assign({"Content-Type":"application/json"},options.headers),ajaxRequest=isGraphQLRequest?new GraphQLRequest(options):new DefaultRequest(options),url=ajaxRequest.getUrl(),body=ajaxRequest.getBody(),method=ajaxRequest.getMethod(),headers=ajaxRequest.getHeaders(),"GET"===method&&(url=querystring.queryify(url,body),body=null),isXHRAvailable?req.onreadystatechange=function(){if(4===req.readyState){if(0===req.status&&isGraphQLRequest)return delete options.graphQL,void _requestWithRetry(options,tcpRetryCount,cb);if(parsedBody=parseBody(req.responseText),resBody=ajaxRequest.adaptResponseBody(parsedBody),(status=ajaxRequest.determineStatus(req.status,parsedBody))>=400||status<200){if(isGraphQLRequest&&graphQLRequestShouldRetryWithClientApi(parsedBody))return delete options.graphQL,void _requestWithRetry(options,tcpRetryCount,cb);if(tcpRetryCount<MAX_TCP_RETRYCOUNT&&requestShouldRetry(status))return tcpRetryCount++,void _requestWithRetry(options,tcpRetryCount,cb);callback(resBody||"error",null,status||500)}else callback(null,resBody,status)}}:(options.headers&&(url=querystring.queryify(url,headers)),req.onload=function(){callback(null,parseBody(req.responseText),req.status)},req.onerror=function(){callback("error",null,500)},req.onprogress=function(){},req.ontimeout=function(){callback("timeout",null,-1)});try{req.open(method,url,!0)}catch(requestOpenError){if(!isGraphQLRequest)throw requestOpenError;return delete options.graphQL,void _requestWithRetry(options,tcpRetryCount,cb)}req.timeout=timeout,isXHRAvailable&&Object.keys(headers).forEach(function(headerKey){req.setRequestHeader(headerKey,headers[headerKey])});try{req.send(prepBody(method,body))}catch(e){}}function request(options,cb){_requestWithRetry(options,0,cb)}var querystring=_dereq_("../../lib/querystring"),assign=_dereq_("../../lib/assign").assign,prepBody=_dereq_("./prep-body"),parseBody=_dereq_("./parse-body"),xhr=_dereq_("./xhr"),isXHRAvailable=xhr.isAvailable,GraphQLRequest=_dereq_("./graphql/request"),DefaultRequest=_dereq_("./default-request"),MAX_TCP_RETRYCOUNT=1,TCP_PRECONNECT_BUG_STATUS_CODE=408;module.exports={request:request}},{"../../lib/assign":126,"../../lib/querystring":162,"./default-request":86,"./graphql/request":94,"./parse-body":98,"./prep-body":99,"./xhr":100}],86:[function(_dereq_,module,exports){"use strict";function DefaultRequest(options){this._url=options.url,this._data=options.data,this._method=options.method,this._headers=options.headers}DefaultRequest.prototype.getUrl=function(){return this._url},DefaultRequest.prototype.getBody=function(){return this._data},DefaultRequest.prototype.getMethod=function(){return this._method},DefaultRequest.prototype.getHeaders=function(){return this._headers},DefaultRequest.prototype.adaptResponseBody=function(parsedBody){return parsedBody},DefaultRequest.prototype.determineStatus=function(status){return status},module.exports=DefaultRequest},{}],87:[function(_dereq_,module,exports){"use strict";module.exports=function(){return window.navigator.userAgent}},{}],88:[function(_dereq_,module,exports){"use strict";function configurationResponseAdapter(responseBody,ctx){return responseBody.data&&!responseBody.errors?adaptConfigurationResponseBody(responseBody,ctx):errorResponseAdapter(responseBody)}function adaptConfigurationResponseBody(body,ctx){var response,configuration=body.data.clientConfiguration;return response={environment:configuration.environment.toLowerCase(),clientApiUrl:configuration.clientApiUrl,assetsUrl:configuration.assetsUrl,analytics:{url:configuration.analyticsUrl},merchantId:configuration.merchantId,venmo:"off"},configuration.supportedFeatures&&(response.graphQL={url:ctx._graphQL._config.url,features:configuration.supportedFeatures.map(function(feature){return feature.toLowerCase()})}),configuration.braintreeApi&&(response.braintreeApi=configuration.braintreeApi),configuration.applePayWeb&&(response.applePayWeb=configuration.applePayWeb,response.applePayWeb.supportedNetworks=mapCardTypes(configuration.applePayWeb.supportedCardBrands,cardTypeTransforms.applePayWeb),delete response.applePayWeb.supportedCardBrands),configuration.ideal&&(response.ideal=configuration.ideal),configuration.kount&&(response.kount={kountMerchantId:configuration.kount.merchantId}),configuration.creditCard?(response.challenges=configuration.creditCard.challenges.map(function(challenge){return challenge.toLowerCase()}),response.creditCards={supportedCardTypes:mapCardTypes(configuration.creditCard.supportedCardBrands,cardTypeTransforms.creditCard)},response.threeDSecureEnabled=configuration.creditCard.threeDSecureEnabled,response.threeDSecure=configuration.creditCard.threeDSecure):(response.challenges=[],response.creditCards={supportedCardTypes:[]},response.threeDSecureEnabled=!1),configuration.googlePay&&(response.androidPay={displayName:configuration.googlePay.displayName,enabled:!0,environment:configuration.googlePay.environment.toLowerCase(),googleAuthorizationFingerprint:configuration.googlePay.googleAuthorization,paypalClientId:configuration.googlePay.paypalClientId,supportedNetworks:mapCardTypes(configuration.googlePay.supportedCardBrands,cardTypeTransforms.googlePay)}),configuration.venmo&&(response.payWithVenmo={merchantId:configuration.venmo.merchantId,accessToken:configuration.venmo.accessToken,environment:configuration.venmo.environment.toLowerCase()}),configuration.paypal?(response.paypalEnabled=!0,response.paypal=assign({},configuration.paypal),response.paypal.currencyIsoCode=response.paypal.currencyCode,response.paypal.environment=response.paypal.environment.toLowerCase(),delete response.paypal.currencyCode):response.paypalEnabled=!1,configuration.unionPay&&(response.unionPay={enabled:!0,merchantAccountId:configuration.unionPay.merchantAccountId}),configuration.visaCheckout&&(response.visaCheckout={apikey:configuration.visaCheckout.apiKey,externalClientId:configuration.visaCheckout.externalClientId,supportedCardTypes:mapCardTypes(configuration.visaCheckout.supportedCardBrands,cardTypeTransforms.visaCheckout)}),configuration.masterpass&&(response.masterpass={merchantCheckoutId:configuration.masterpass.merchantCheckoutId,supportedNetworks:mapCardTypes(configuration.masterpass.supportedCardBrands,cardTypeTransforms.masterpass)}),configuration.usBankAccount&&(response.usBankAccount={routeId:configuration.usBankAccount.routeId,plaid:{publicKey:configuration.usBankAccount.plaidPublicKey}}),response}function mapCardTypes(cardTypes,cardTypeTransformMap){return cardTypes.reduce(function(acc,type){return cardTypeTransformMap.hasOwnProperty(type)?acc.concat(cardTypeTransformMap[type]):acc},[])}var errorResponseAdapter=_dereq_("./error"),assign=_dereq_("../../../../lib/assign").assign,cardTypeTransforms={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"},visaCheckout:{VISA:"Visa",MASTERCARD:"MasterCard",DISCOVER:"Discover",AMERICAN_EXPRESS:"American Express"},googlePay:{VISA:"visa",MASTERCARD:"mastercard",DISCOVER:"discover",AMERICAN_EXPRESS:"amex"},masterpass:{VISA:"visa",MASTERCARD:"master",DISCOVER:"discover",AMERICAN_EXPRESS:"amex",DINERS:"diners",INTERNATIONAL_MAESTRO:"maestro",JCB:"jcb"}};module.exports=configurationResponseAdapter},{"../../../../lib/assign":126,"./error":90}],89:[function(_dereq_,module,exports){"use strict";function creditCardTokenizationResponseAdapter(responseBody){return responseBody.data&&!responseBody.errors?adaptTokenizeCreditCardResponseBody(responseBody):errorResponseAdapter(responseBody)}function adaptTokenizeCreditCardResponseBody(body){var response,regulationEnvironment,data=body.data.tokenizeCreditCard,creditCard=data.creditCard,lastTwo=creditCard.last4?creditCard.last4.substr(2,4):"",binData=creditCard.binData;return binData&&(["commercial","debit","durbinRegulated","healthcare","payroll","prepaid"].forEach(function(key){binData[key]?binData[key]=BIN_DATA_MAP[binData[key]]:binData[key]="Unknown"}),["issuingBank","countryOfIssuance","productId"].forEach(function(key){binData[key]||(binData[key]="Unknown")})),response={creditCards:[{binData:binData,consumed:!1,description:lastTwo?"ending in "+lastTwo:"",nonce:data.token,details:{cardholderName:creditCard.cardholderName,expirationMonth:creditCard.expirationMonth,expirationYear:creditCard.expirationYear,bin:creditCard.bin||"",cardType:CARD_BRAND_MAP[creditCard.brandCode]||"Unknown",lastFour:creditCard.last4||"",lastTwo:lastTwo},type:"CreditCard",threeDSecureInfo:null}]},data.authenticationInsight&&(regulationEnvironment=data.authenticationInsight.customerAuthenticationRegulationEnvironment,response.creditCards[0].authenticationInsight={regulationEnvironment:AUTHENTICATION_INSIGHT_MAP[regulationEnvironment]||regulationEnvironment.toLowerCase()}),response}var errorResponseAdapter=_dereq_("./error"),CARD_BRAND_MAP={AMERICAN_EXPRESS:"American Express",DINERS:"Discover",DISCOVER:"Discover",INTERNATIONAL_MAESTRO:"Maestro",JCB:"JCB",MASTERCARD:"MasterCard",UK_MAESTRO:"Maestro",UNION_PAY:"Union Pay",VISA:"Visa"},BIN_DATA_MAP={YES:"Yes",NO:"No",UNKNOWN:"Unknown"},AUTHENTICATION_INSIGHT_MAP={PSDTWO:"psd2"};module.exports=creditCardTokenizationResponseAdapter},{"./error":90}],90:[function(_dereq_,module,exports){"use strict";function errorResponseAdapter(responseBody){var errorClass=responseBody.errors&&responseBody.errors[0]&&responseBody.errors[0].extensions&&responseBody.errors[0].extensions.errorClass;return"VALIDATION"===errorClass?userErrorResponseAdapter(responseBody):errorClass?errorWithClassResponseAdapter(responseBody):{error:{message:"There was a problem serving your request"},fieldErrors:[]}}function errorWithClassResponseAdapter(responseBody){return{error:{message:responseBody.errors[0].message},fieldErrors:[]}}function userErrorResponseAdapter(responseBody){var fieldErrors=buildFieldErrors(responseBody.errors);return 0===fieldErrors.length?{error:{message:responseBody.errors[0].message}}:{error:{message:getLegacyMessage(fieldErrors)},fieldErrors:fieldErrors}}function buildFieldErrors(errors){var fieldErrors=[];return errors.forEach(function(error){error.extensions&&error.extensions.inputPath&&addFieldError(error.extensions.inputPath.slice(1),error,fieldErrors)}),fieldErrors}function addFieldError(inputPath,errorDetail,fieldErrors){var fieldError,legacyCode=errorDetail.extensions.legacyCode,inputField=inputPath[0];if(1===inputPath.length)return void fieldErrors.push({code:legacyCode,field:inputField,message:errorDetail.message});fieldErrors.forEach(function(candidate){candidate.field===inputField&&(fieldError=candidate)}),fieldError||(fieldError={field:inputField,fieldErrors:[]},fieldErrors.push(fieldError)),addFieldError(inputPath.slice(1),errorDetail,fieldError.fieldErrors)}function getLegacyMessage(errors){return{creditCard:"Credit card is invalid"}[errors[0].field]}module.exports=errorResponseAdapter},{}],91:[function(_dereq_,module,exports){"use strict";function configuration(){return{query:CONFIGURATION_QUERY,operationName:"ClientConfiguration"}}var CONFIGURATION_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 } }";module.exports=configuration},{}],92:[function(_dereq_,module,exports){"use strict";function createMutation(config){var hasAuthenticationInsight=config.hasAuthenticationInsight,mutation="mutation TokenizeCreditCard($input: TokenizeCreditCardInput!";return hasAuthenticationInsight&&(mutation+=", $authenticationInsightInput: AuthenticationInsightInput!"),mutation+=") { tokenizeCreditCard(input: $input) { token creditCard { bin brandCode last4 cardholderName expirationMonth expirationYear binData { prepaid healthcare debit durbinRegulated commercial payroll issuingBank countryOfIssuance productId } } ",hasAuthenticationInsight&&(mutation+=" authenticationInsight(input: $authenticationInsightInput) { customerAuthenticationRegulationEnvironment }"),mutation+=" } }"}function createCreditCardTokenizationBody(body,options){var cc=body.creditCard,billingAddress=cc&&cc.billingAddress,expDate=cc&&cc.expirationDate,expirationMonth=cc&&(cc.expirationMonth||expDate&&expDate.split("/")[0].trim()),expirationYear=cc&&(cc.expirationYear||expDate&&expDate.split("/")[1].trim()),variables={input:{creditCard:{number:cc&&cc.number,expirationMonth:expirationMonth,expirationYear:expirationYear,cvv:cc&&cc.cvv,cardholderName:cc&&cc.cardholderName},options:{}}};return options.hasAuthenticationInsight&&(variables.authenticationInsightInput={merchantAccountId:body.merchantAccountId}),billingAddress&&(variables.input.creditCard.billingAddress=billingAddress),variables.input=addValidationRule(body,variables.input),variables}function addValidationRule(body,input){var validate;return body.creditCard&&body.creditCard.options&&"boolean"==typeof body.creditCard.options.validate?validate=body.creditCard.options.validate:body.authorizationFingerprint&&body.tokenizationKey||body.authorizationFingerprint?validate=!0:body.tokenizationKey&&(validate=!1),"boolean"==typeof validate&&(input.options=assign({validate:validate},input.options)),input}function creditCardTokenization(body){var options={hasAuthenticationInsight:Boolean(body.authenticationInsight&&body.merchantAccountId)};return{query:createMutation(options),variables:createCreditCardTokenizationBody(body,options),operationName:"TokenizeCreditCard"}}var assign=_dereq_("../../../../lib/assign").assign;module.exports=creditCardTokenization},{"../../../../lib/assign":126}],93:[function(_dereq_,module,exports){"use strict";function GraphQL(config){this._config=config.graphQL}function containsDisallowedlistedKeys(body){return disallowedInputPaths.some(function(keys){return void 0!==keys.split(".").reduce(function(accumulator,key){return accumulator&&accumulator[key]},body)})}var browserDetection=_dereq_("../../browser-detection"),features={tokenize_credit_cards:"payment_methods/credit_cards",configuration:"configuration"},disallowedInputPaths=["creditCard.options.unionPayEnrollment"];GraphQL.prototype.getGraphQLEndpoint=function(){return this._config.url},GraphQL.prototype.isGraphQLRequest=function(url,body){var featureEnabled,path=this.getClientApiPath(url);return!(!this._isGraphQLEnabled()||!path||browserDetection.isIe9())&&(featureEnabled=this._config.features.some(function(feature){return features[feature]===path}),!containsDisallowedlistedKeys(body)&&featureEnabled)},GraphQL.prototype.getClientApiPath=function(url){var path,pathParts=url.split("/client_api/v1/");return pathParts.length>1&&(path=pathParts[1].split("?")[0]),path},GraphQL.prototype._isGraphQLEnabled=function(){return Boolean(this._config)},module.exports=GraphQL},{"../../browser-detection":79}],94:[function(_dereq_,module,exports){"use strict";function GraphQLRequest(options){var clientApiPath=options.graphQL.getClientApiPath(options.url);this._graphQL=options.graphQL,this._data=options.data,this._method=options.method,this._headers=options.headers,this._clientSdkMetadata={source:options.metadata.source,integration:options.metadata.integration,sessionId:options.metadata.sessionId},this._sendAnalyticsEvent=options.sendAnalyticsEvent||Function.prototype,this._generator=generators[clientApiPath],this._adapter=adapters[clientApiPath],this._sendAnalyticsEvent("graphql.init")}function isGraphQLError(errorClass,parsedResponse){return!errorClass&&parsedResponse.errors[0].message}function snakeCaseToCamelCase(snakeString){return-1===snakeString.indexOf("_")?snakeString:snakeString.toLowerCase().replace(/(\_\w)/g,function(match){return match[1].toUpperCase()})}function formatBodyKeys(originalBody){var body={};return Object.keys(originalBody).forEach(function(key){var camelCaseKey=snakeCaseToCamelCase(key);"object"==typeof originalBody[key]?body[camelCaseKey]=formatBodyKeys(originalBody[key]):"number"==typeof originalBody[key]?body[camelCaseKey]=String(originalBody[key]):body[camelCaseKey]=originalBody[key]}),body}var BRAINTREE_VERSION=_dereq_("../../constants").BRAINTREE_VERSION,assign=_dereq_("../../../lib/assign").assign,creditCardTokenizationBodyGenerator=_dereq_("./generators/credit-card-tokenization"),creditCardTokenizationResponseAdapter=_dereq_("./adapters/credit-card-tokenization"),configurationBodyGenerator=_dereq_("./generators/configuration"),configurationResponseAdapter=_dereq_("./adapters/configuration"),generators={"payment_methods/credit_cards":creditCardTokenizationBodyGenerator,configuration:configurationBodyGenerator},adapters={"payment_methods/credit_cards":creditCardTokenizationResponseAdapter,configuration:configurationResponseAdapter};GraphQLRequest.prototype.getUrl=function(){return this._graphQL.getGraphQLEndpoint()},GraphQLRequest.prototype.getBody=function(){var formattedBody=formatBodyKeys(this._data),generatedBody=this._generator(formattedBody),body=assign({clientSdkMetadata:this._clientSdkMetadata},generatedBody);return JSON.stringify(body)},GraphQLRequest.prototype.getMethod=function(){return"POST"},GraphQLRequest.prototype.getHeaders=function(){var authorization,headers;return this._data.authorizationFingerprint?(this._sendAnalyticsEvent("graphql.authorization-fingerprint"),authorization=this._data.authorizationFingerprint):(this._sendAnalyticsEvent("graphql.tokenization-key"),authorization=this._data.tokenizationKey),headers={Authorization:"Bearer "+authorization,"Braintree-Version":BRAINTREE_VERSION},assign({},this._headers,headers)},GraphQLRequest.prototype.adaptResponseBody=function(parsedBody){return this._adapter(parsedBody,this)},GraphQLRequest.prototype.determineStatus=function(httpStatus,parsedResponse){var status,errorClass;return 200===httpStatus?(errorClass=parsedResponse.errors&&parsedResponse.errors[0]&&parsedResponse.errors[0].extensions&&parsedResponse.errors[0].extensions.errorClass,status=parsedResponse.data&&!parsedResponse.errors?200:"VALIDATION"===errorClass?422:"AUTHORIZATION"===errorClass?403:"AUTHENTICATION"===errorClass?401:isGraphQLError(errorClass,parsedResponse)?403:500):status=httpStatus||500,this._sendAnalyticsEvent("graphql.status."+httpStatus),this._sendAnalyticsEvent("graphql.determinedStatus."+status),status},module.exports=GraphQLRequest},{"../../../lib/assign":126,"../../constants":81,"./adapters/configuration":88,"./adapters/credit-card-tokenization":89,"./generators/configuration":91,"./generators/credit-card-tokenization":92}],95:[function(_dereq_,module,exports){"use strict";function isAjaxAvailable(){return null==ajaxIsAvaliable&&(ajaxIsAvaliable=!(isHTTP()&&/MSIE\s(8|9)/.test(getUserAgent()))),ajaxIsAvaliable}var ajaxIsAvaliable,once=_dereq_("../../lib/once"),JSONPDriver=_dereq_("./jsonp-driver"),AJAXDriver=_dereq_("./ajax-driver"),getUserAgent=_dereq_("./get-user-agent"),isHTTP=_dereq_("./is-http");module.exports=function(options,cb){cb=once(cb||Function.prototype),options.method=(options.method||"GET").toUpperCase(),options.timeout=null==options.timeout?6e4:options.timeout,options.data=options.data||{},isAjaxAvailable()?AJAXDriver.request(options,cb):JSONPDriver.request(options,cb)}},{"../../lib/once":160,"./ajax-driver":85,"./get-user-agent":87,"./is-http":96,"./jsonp-driver":97}],96:[function(_dereq_,module,exports){"use strict";module.exports=function(){return"http:"===window.location.protocol}},{}],97:[function(_dereq_,module,exports){"use strict";function _removeScript(script){script&&script.parentNode&&script.parentNode.removeChild(script)}function _createScriptTag(url,callbackName){var script=document.createElement("script"),done=!1;return script.src=url,script.async=!0,script.onerror=function(){window[callbackName]({message:"error",status:500})},script.onload=script.onreadystatechange=function(){done||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(done=!0,script.onload=script.onreadystatechange=null)},script}function _cleanupGlobal(callbackName){try{delete window[callbackName]}catch(_){window[callbackName]=null}}function _setupTimeout(timeout,callbackName){timeouts[callbackName]=setTimeout(function(){timeouts[callbackName]=null,window[callbackName]({error:"timeout",status:-1}),window[callbackName]=function(){_cleanupGlobal(callbackName)}},timeout)}function _setupGlobalCallback(script,callback,callbackName){window[callbackName]=function(response){var status=response.status||500,err=null,data=null;delete response.status,status>=400||status<200?err=response:data=response,_cleanupGlobal(callbackName),_removeScript(script),clearTimeout(timeouts[callbackName]),callback(err,data,status)}}function request(options,callback){var script,callbackName="callback_json_"+uuid().replace(/-/g,""),url=options.url,attrs=options.data,method=options.method,timeout=options.timeout;url=querystring.queryify(url,attrs),url=querystring.queryify(url,{_method:method,callback:callbackName}),script=_createScriptTag(url,callbackName),_setupGlobalCallback(script,callback,callbackName),_setupTimeout(timeout,callbackName),head||(head=document.getElementsByTagName("head")[0]),head.appendChild(script)}var head,uuid=_dereq_("@braintree/uuid"),querystring=_dereq_("../../lib/querystring"),timeouts={};module.exports={request:request}},{"../../lib/querystring":162,"@braintree/uuid":43}],98:[function(_dereq_,module,exports){"use strict";module.exports=function(body){try{body=JSON.parse(body)}catch(e){}return body}},{}],99:[function(_dereq_,module,exports){"use strict";module.exports=function(method,body){if("string"!=typeof method)throw new Error("Method must be a string");return"get"!==method.toLowerCase()&&null!=body&&(body="string"==typeof body?body:JSON.stringify(body)),body}},{}],100:[function(_dereq_,module,exports){"use strict";function getRequestObject(){return isXHRAvailable?new window.XMLHttpRequest:new window.XDomainRequest}var isXHRAvailable="undefined"!=typeof window&&window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest;module.exports={isAvailable:isXHRAvailable,getRequestObject:getRequestObject}},{}],101:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../lib/braintree-error");module.exports={DATA_COLLECTOR_KOUNT_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"DATA_COLLECTOR_KOUNT_NOT_ENABLED",message:"Kount is not enabled for this merchant."},DATA_COLLECTOR_KOUNT_ERROR:{type:BraintreeError.types.MERCHANT,code:"DATA_COLLECTOR_KOUNT_ERROR"},DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS:{type:BraintreeError.types.MERCHANT,code:"DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS",message:"Data Collector must be created with Kount and/or PayPal."}}},{"../lib/braintree-error":129}],102:[function(_dereq_,module,exports){"use strict";function setup(){var fraudNet=new Fraudnet;return cachedSessionId?(fraudNet.sessionId=cachedSessionId,Promise.resolve(fraudNet)):fraudNet.initialize()}function clearSessionIdCache(){cachedSessionId=null}function Fraudnet(){}function removeElementIfOnPage(element){element&&element.parentNode&&element.parentNode.removeChild(element)}function _generateSessionId(){var i,id="";for(i=0;i<32;i++)id+=Math.floor(16*Math.random()).toString(16);return id}function _generateBeaconId(sessionId){return"https://b.stats.paypal.com/counter.cgi?i=127.0.0.1&p="+sessionId+"&t="+(new Date).getTime()/1e3+"&a=14"}function _createParameterBlock(sessionId,beaconId){var el=document.body.appendChild(document.createElement("script"));return el.type="application/json",el.setAttribute("fncls",FRAUDNET_FNCLS),el.text=JSON.stringify({f:sessionId,s:FRAUDNET_SOURCE,b:beaconId}),el}var cachedSessionId,FRAUDNET_FNCLS=_dereq_("../lib/constants").FRAUDNET_FNCLS,FRAUDNET_SOURCE=_dereq_("../lib/constants").FRAUDNET_SOURCE,FRAUDNET_URL=_dereq_("../lib/constants").FRAUDNET_URL,loadScript=_dereq_("../lib/assets").loadScript,Promise=_dereq_("../lib/promise");Fraudnet.prototype.initialize=function(){var self=this;return this.sessionId=cachedSessionId=_generateSessionId(),this._beaconId=_generateBeaconId(this.sessionId),this._parameterBlock=_createParameterBlock(this.sessionId,this._beaconId),loadScript({src:FRAUDNET_URL}).then(function(block){return self._thirdPartyBlock=block,self}).catch(function(){return null})},Fraudnet.prototype.teardown=function(){removeElementIfOnPage(document.querySelector('iframe[title="ppfniframe"]')),removeElementIfOnPage(document.querySelector('iframe[title="pbf"]')),removeElementIfOnPage(this._parameterBlock),removeElementIfOnPage(this._thirdPartyBlock)},module.exports={setup:setup,clearSessionIdCache:clearSessionIdCache}},{"../lib/assets":125,"../lib/constants":131,"../lib/promise":161}],103:[function(_dereq_,module,exports){"use strict";function create(options){
var data,name="Data Collector",result={_instances:[]};return basicComponentVerification.verify({name:name,client:options.client,authorization:options.authorization}).then(function(){return result._instantiatedWithAClient=!options.useDeferredClient,result._createPromise=createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:name}).then(function(client){var kountInstance,config=client.getConfiguration();if(!0===options.kount&&config.gatewayConfiguration.kount){try{kountInstance=kount.setup({environment:config.gatewayConfiguration.environment,merchantId:config.gatewayConfiguration.kount.kountMerchantId})}catch(err){return Promise.reject(new BraintreeError({type:errors.DATA_COLLECTOR_KOUNT_ERROR.type,code:errors.DATA_COLLECTOR_KOUNT_ERROR.code,message:err.message}))}data=kountInstance.deviceData,result._instances.push(kountInstance)}else data={};return Promise.resolve()}).then(function(){return fraudnet.setup().then(function(fraudnetInstance){fraudnetInstance&&(data.correlation_id=fraudnetInstance.sessionId,result._instances.push(fraudnetInstance))})}).then(function(){return 0===result._instances.length?Promise.reject(new BraintreeError(errors.DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS)):(result.deviceData=JSON.stringify(data),result.rawDeviceData=data,result)}),result.teardown=createTeardownMethod(result),result.getDeviceData=createGetDeviceDataMethod(result),result._instantiatedWithAClient?result._createPromise:result})}function createTeardownMethod(result){return wrapPromise(function(){return result._createPromise.then(function(){result._instances.forEach(function(instance){instance&&instance.teardown()}),convertMethodsToError(result,methods(result))})})}function createGetDeviceDataMethod(result){return wrapPromise(function(options){return options=options||{},result._createPromise.then(function(){return options.raw?Promise.resolve(result.rawDeviceData):Promise.resolve(result.deviceData)})})}var kount=_dereq_("./kount"),fraudnet=_dereq_("./fraudnet"),BraintreeError=_dereq_("../lib/braintree-error"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),methods=_dereq_("../lib/methods"),convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),errors=_dereq_("./errors");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/convert-methods-to-error":132,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/methods":159,"../lib/promise":161,"./errors":101,"./fraudnet":102,"./kount":104,"@braintree/wrap-promise":47}],104:[function(_dereq_,module,exports){"use strict";function setup(o){return new Kount(null!=o?o:{})}function Kount(options){var previouslyInitializedDeviceData=Kount.getCachedDeviceData(options.merchantId);if(previouslyInitializedDeviceData)return this.deviceData=previouslyInitializedDeviceData,void(this._isCached=!0);this._currentEnvironment=this._initializeEnvironment(options),sjcl.random.startCollectors(),this._deviceSessionId=this._generateDeviceSessionId(),this.deviceData=this._getDeviceData(),Kount.setCachedDeviceData(options.merchantId,this.deviceData),this._iframe=this._setupIFrame()}var sjcl=_dereq_("./vendor/sjcl"),camelCaseToSnakeCase=_dereq_("../lib/camel-case-to-snake-case"),QA_URL="https://assets.qa.braintreepayments.com/data",environmentUrls={development:QA_URL,qa:QA_URL,sandbox:"https://assets.braintreegateway.com/sandbox/data",production:"https://assets.braintreegateway.com/data"},cachedDeviceData={};Kount.getCachedDeviceData=function(merchantId){return cachedDeviceData[merchantId]},Kount.setCachedDeviceData=function(merchantId,data){cachedDeviceData[merchantId]=data},Kount.prototype.teardown=function(){this._isCached||(sjcl.random.stopCollectors(),this._removeIframe())},Kount.prototype._removeIframe=function(){this._iframe.parentNode.removeChild(this._iframe)},Kount.prototype._getDeviceData=function(){return camelCaseToSnakeCase({deviceSessionId:this._deviceSessionId,fraudMerchantId:this._currentEnvironment.id})},Kount.prototype._generateDeviceSessionId=function(){var bits;return bits=sjcl.random.randomWords(4,0),sjcl.codec.hex.fromBits(bits)},Kount.prototype._setupIFrame=function(){var params,iframe,self=this;return params="?m="+this._currentEnvironment.id+"&s="+this._deviceSessionId,iframe=document.createElement("iframe"),iframe.width=1,iframe.id="braintreeDataFrame-"+this._deviceSessionId,iframe.height=1,iframe.frameBorder=0,iframe.scrolling="no",iframe.style.position="fixed",iframe.style.left="-999999px",iframe.style.top="-999999px",iframe.title="Braintree-Kount-iframe",iframe.setAttribute("aria-hidden","true"),document.body.appendChild(iframe),setTimeout(function(){iframe.src=self._currentEnvironment.url+"/logo.htm"+params,iframe.innerHTML='<img src="'+self._currentEnvironment.url+"/logo.gif"+params+'" alt="" />'},10),iframe},Kount.prototype._initializeEnvironment=function(options){var url=environmentUrls[options.environment];if(null==url)throw new Error(options.environment+" is not a valid environment for kount.environment");return{url:url,name:options.environment,id:options.merchantId}},module.exports={setup:setup,Kount:Kount,environmentUrls:environmentUrls}},{"../lib/camel-case-to-snake-case":130,"./vendor/sjcl":105}],105:[function(_dereq_,module,exports){"use strict";function t(a,b,c){if(4!==b.length)throw new sjcl.exception.invalid("invalid aes block size");var d=a.b[c],e=b[0]^d[0],f=b[c?3:1]^d[1],g=b[2]^d[2];b=b[c?1:3]^d[3];var k,l,p,h,n=d.length/4-2,m=4,q=[0,0,0,0];k=a.l[c],a=k[0];var r=k[1],v=k[2],w=k[3],x=k[4];for(h=0;h<n;h++)k=a[e>>>24]^r[f>>16&255]^v[g>>8&255]^w[255&b]^d[m],l=a[f>>>24]^r[g>>16&255]^v[b>>8&255]^w[255&e]^d[m+1],p=a[g>>>24]^r[b>>16&255]^v[e>>8&255]^w[255&f]^d[m+2],b=a[b>>>24]^r[e>>16&255]^v[f>>8&255]^w[255&g]^d[m+3],m+=4,e=k,f=l,g=p;for(h=0;4>h;h++)q[c?3&-h:h]=x[e>>>24]<<24^x[f>>16&255]<<16^x[g>>8&255]<<8^x[255&b]^d[m++],k=e,e=f,f=g,g=b,b=k;return q}function u(a,b){var c,d,e,f=a.u,g=a.b,k=f[0],l=f[1],p=f[2],n=f[3],h=f[4],m=f[5],q=f[6],r=f[7];for(c=0;64>c;c++)16>c?d=b[c]:(d=b[c+1&15],e=b[c+14&15],d=b[15&c]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+b[15&c]+b[c+9&15]|0),d=d+r+(h>>>6^h>>>11^h>>>25^h<<26^h<<21^h<<7)+(q^h&(m^q))+g[c],r=q,q=m,m=h,h=n+d|0,n=p,p=l,l=k,k=d+(l&p^n&(l^p))+(l>>>2^l>>>13^l>>>22^l<<30^l<<19^l<<10)|0;f[0]=f[0]+k|0,f[1]=f[1]+l|0,f[2]=f[2]+p|0,f[3]=f[3]+n|0,f[4]=f[4]+h|0,f[5]=f[5]+m|0,f[6]=f[6]+q|0,f[7]=f[7]+r|0}function A(a,b){var c,d=sjcl.random.B[a],e=[];for(c in d)d.hasOwnProperty(c)&&e.push(d[c]);for(c=0;c<e.length;c++)e[c](b)}function C(a,b){"undefined"!=typeof window&&window.performance&&"function"==typeof window.performance.now?a.addEntropy(window.performance.now(),b,"loadtime"):a.addEntropy((new Date).valueOf(),b,"loadtime")}function y(a){a.b=z(a).concat(z(a)),a.C=new sjcl.cipher.aes(a.b)}function z(a){for(var b=0;4>b&&(a.g[b]=a.g[b]+1|0,!a.g[b]);b++);return a.C.encrypt(a.g)}function B(a,b){return function(){b.apply(a,arguments)}}var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message},this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message},this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message},this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message},this.message=a}}};sjcl.cipher.aes=function(a){this.l[0][0][0]||this.G();var b,c,d,e,f=this.l[0][4],g=this.l[1];b=a.length;var k=1;if(4!==b&&6!==b&&8!==b)throw new sjcl.exception.invalid("invalid aes key size");for(this.b=[d=a.slice(0),e=[]],a=b;a<4*b+28;a++)c=d[a-1],(0==a%b||8===b&&4==a%b)&&(c=f[c>>>24]<<24^f[c>>16&255]<<16^f[c>>8&255]<<8^f[255&c],0==a%b&&(c=c<<8^c>>>24^k<<24,k=k<<1^283*(k>>7))),d[a]=d[a-b]^c;for(b=0;a;b++,a--)c=d[3&b?a:a-4],e[b]=4>=a||4>b?c:g[0][f[c>>>24]]^g[1][f[c>>16&255]]^g[2][f[c>>8&255]]^g[3][f[255&c]]},sjcl.cipher.aes.prototype={encrypt:function(a){return t(this,a,0)},decrypt:function(a){return t(this,a,1)},l:[[[],[],[],[],[]],[[],[],[],[],[]]],G:function(){var e,f,g,p,n,h,m,a=this.l[0],b=this.l[1],c=a[4],d=b[4],k=[],l=[];for(e=0;256>e;e++)l[(k[e]=e<<1^283*(e>>7))^e]=e;for(f=g=0;!c[f];f^=p||1,g=l[g]||1)for(h=g^g<<1^g<<2^g<<3^g<<4,h=h>>8^255&h^99,c[f]=h,d[h]=f,n=k[e=k[p=k[f]]],m=16843009*n^65537*e^257*p^16843008*f,n=257*k[h]^16843008*h,e=0;4>e;e++)a[e][f]=n=n<<24^n>>>8,b[e][h]=m=m<<24^m>>>8;for(e=0;5>e;e++)a[e]=a[e].slice(0),b[e]=b[e].slice(0)}},sjcl.bitArray={bitSlice:function(a,b,c){return a=sjcl.bitArray.M(a.slice(b/32),32-(31&b)).slice(1),void 0===c?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return(-32&(b+c-1^b)?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return 32===d?a.concat(b):sjcl.bitArray.M(b,d,0|c,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===b?0:32*(b-1)+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;return b&=31,0<c&&b&&(a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1)),a},partial:function(a,b,c){return 32===a?b:(c?0|b:b<<32-a)+1099511627776*a},getPartial:function(a){return Math.round(a/1099511627776)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return!1;var d,c=0;for(d=0;d<a.length;d++)c|=a[d]^b[d];return 0===c},M:function(a,b,c,d){var e;for(e=0,void 0===d&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)return d.concat(a);for(e=0;e<a.length;e++)d.push(c|a[e]>>>b),c=a[e]<<32-b;return e=a.length?a[a.length-1]:0,a=sjcl.bitArray.getPartial(e),d.push(sjcl.bitArray.partial(b+a&31,32<b+a?c:d.pop(),1)),d},Y:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&65280|(65280&c)<<8|c<<24;return a}},sjcl.codec.utf8String={fromBits:function(a){var d,e,b="",c=sjcl.bitArray.bitLength(a);for(d=0;d<c/8;d++)0==(3&d)&&(e=a[d/4]),b+=String.fromCharCode(e>>>8>>>8>>>8),e<<=8;return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var c,b=[],d=0;for(c=0;c<a.length;c++)d=d<<8|a.charCodeAt(c),3==(3&c)&&(b.push(d),d=0);return 3&c&&b.push(sjcl.bitArray.partial(8*(3&c),d)),b}},sjcl.codec.hex={fromBits:function(a){var c,b="";for(c=0;c<a.length;c++)b+=(0xf00000000000+(0|a[c])).toString(16).substr(4);return b.substr(0,sjcl.bitArray.bitLength(a)/4)},toBits:function(a){var b,d,c=[];for(a=a.replace(/\s|0x/g,""),d=a.length,a+="00000000",b=0;b<a.length;b+=8)c.push(0^parseInt(a.substr(b,8),16));return sjcl.bitArray.clamp(c,4*d)}},sjcl.hash.sha256=function(a){this.b[0]||this.G(),a?(this.u=a.u.slice(0),this.o=a.o.slice(0),this.h=a.h):this.reset()},sjcl.hash.sha256.hash=function(a){return(new sjcl.hash.sha256).update(a).finalize()},sjcl.hash.sha256.prototype={blockSize:512,reset:function(){return this.u=this.K.slice(0),this.o=[],this.h=0,this},update:function(a){"string"==typeof a&&(a=sjcl.codec.utf8String.toBits(a));var b,c=this.o=sjcl.bitArray.concat(this.o,a);if(b=this.h,9007199254740991<(a=this.h=b+sjcl.bitArray.bitLength(a)))throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!=typeof Uint32Array){var d=new Uint32Array(c),e=0;for(b=512+b-(512+b&511);b<=a;b+=512)u(this,d.subarray(16*e,16*(e+1))),e+=1;c.splice(0,16*e)}else for(b=512+b-(512+b&511);b<=a;b+=512)u(this,c.splice(0,16));return this},finalize:function(){var a,b=this.o,c=this.u,b=sjcl.bitArray.concat(b,[sjcl.bitArray.partial(1,1)]);for(a=b.length+2;15&a;a++)b.push(0);for(b.push(Math.floor(this.h/4294967296)),b.push(0|this.h);b.length;)u(this,b.splice(0,16));return this.reset(),c},K:[],b:[],G:function(){function a(a){return 4294967296*(a-Math.floor(a))|0}for(var d,e,b=0,c=2;64>b;c++){for(e=!0,d=2;d*d<=c;d++)if(0==c%d){e=!1;break}e&&(8>b&&(this.K[b]=a(Math.pow(c,.5))),this.b[b]=a(Math.pow(c,1/3)),b++)}}},sjcl.prng=function(a){this.c=[new sjcl.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=a,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},sjcl.prng.prototype={randomWords:function(a,b){var d,c=[];d=this.isReady(b);var e;if(d===this.m)throw new sjcl.exception.notReady("generator isn't seeded");if(d&this.A){d=!(d&this.w),e=[];var g,f=0;for(this.L=e[0]=(new Date).valueOf()+this.P,g=0;16>g;g++)e.push(4294967296*Math.random()|0);for(g=0;g<this.c.length&&(e=e.concat(this.c[g].finalize()),f+=this.i[g],this.i[g]=0,d||!(this.H&1<<g));g++);for(this.H>=1<<this.c.length&&(this.c.push(new sjcl.hash.sha256),this.i.push(0)),this.f-=f,f>this.j&&(this.j=f),this.H++,this.b=sjcl.hash.sha256.hash(this.b.concat(e)),this.C=new sjcl.cipher.aes(this.b),d=0;4>d&&(this.g[d]=this.g[d]+1|0,!this.g[d]);d++);}for(d=0;d<a;d+=4)0==(d+1)%this.O&&y(this),e=z(this),c.push(e[0],e[1],e[2],e[3]);return y(this),c.slice(0,a)},setDefaultParanoia:function(a,b){if(0===a&&"Setting paranoia=0 will ruin your security; use it only for testing"!==b)throw new sjcl.exception.invalid("Setting paranoia=0 will ruin your security; use it only for testing");this.D=a},addEntropy:function(a,b,c){c=c||"user";var d,e,f=(new Date).valueOf(),g=this.v[c],k=this.isReady(),l=0;switch(d=this.J[c],void 0===d&&(d=this.J[c]=this.T++),void 0===g&&(g=this.v[c]=0),this.v[c]=(this.v[c]+1)%this.c.length,typeof a){case"number":void 0===b&&(b=1),this.c[g].update([d,this.F++,1,b,f,1,0|a]);break;case"object":if("[object Uint32Array]"===(c=Object.prototype.toString.call(a))){for(e=[],c=0;c<a.length;c++)e.push(a[c]);a=e}else for("[object Array]"!==c&&(l=1),c=0;c<a.length&&!l;c++)"number"!=typeof a[c]&&(l=1);if(!l){if(void 0===b)for(c=b=0;c<a.length;c++)for(e=a[c];0<e;)b++,e>>>=1;this.c[g].update([d,this.F++,2,b,f,a.length].concat(a))}break;case"string":void 0===b&&(b=a.length),this.c[g].update([d,this.F++,3,b,f,a.length]),this.c[g].update(a);break;default:l=1}if(l)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.i[g]+=b,this.f+=b,k===this.m&&(this.isReady()!==this.m&&A("seeded",Math.max(this.j,this.f)),A("progress",this.getProgress()))},isReady:function(a){return a=this.I[void 0!==a?a:this.D],this.j&&this.j>=a?this.i[0]>this.N&&(new Date).valueOf()>this.L?this.A|this.w:this.w:this.f>=a?this.A|this.m:this.m},getProgress:function(a){return a=this.I[a||this.D],this.j>=a?1:this.f>a?1:this.f/a},startCollectors:function(){if(!this.s){if(this.a={loadTimeCollector:B(this,this.V),mouseCollector:B(this,this.W),keyboardCollector:B(this,this.U),accelerometerCollector:B(this,this.R),touchCollector:B(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 sjcl.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(a,b){this.B[a][this.S++]=b},removeEventListener:function(a,b){var c,d,e=this.B[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d);for(c=0;c<f.length;c++)d=f[c],delete e[d]},U:function(){C(this,1)},W:function(a){var b,c;try{b=a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(d){c=b=0}0!=b&&0!=c&&this.addEntropy([b,c],2,"mouse"),C(this,0)},X:function(a){a=a.touches[0]||a.changedTouches[0],this.addEntropy([a.pageX||a.clientX,a.pageY||a.clientY],1,"touch"),C(this,0)},V:function(){C(this,2)},R:function(a){if(a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z,window.orientation){var b=window.orientation;"number"==typeof b&&this.addEntropy(b,1,"accelerometer")}a&&this.addEntropy(a,2,"accelerometer"),C(this,0)}},sjcl.random=new sjcl.prng(6);a:try{var D,E,F,G;if(G=void 0!==module&&module.exports){var H;try{H=_dereq_("crypto")}catch(a){H=null}G=E=H}if(G&&E.randomBytes)D=E.randomBytes(128),D=new Uint32Array(new Uint8Array(D).buffer),sjcl.random.addEntropy(D,1024,"crypto['randomBytes']");else if("undefined"!=typeof window&&"undefined"!=typeof Uint32Array){if(F=new Uint32Array(32),window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(F);else{if(!window.msCrypto||!window.msCrypto.getRandomValues)break a;window.msCrypto.getRandomValues(F)}sjcl.random.addEntropy(F,1024,"crypto['getRandomValues']")}}catch(a){"undefined"!=typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(a))}void 0!==module&&module.exports&&(module.exports=sjcl),"function"==typeof define&&define([],function(){return sjcl})},{crypto:void 0}],106:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../lib/braintree-error");module.exports={GOOGLE_PAYMENT_NOT_ENABLED:{type:BraintreeError.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:BraintreeError.types.UNKNOWN},GOOGLE_PAYMENT_UNSUPPORTED_VERSION:{code:"GOOGLE_PAYMENT_UNSUPPORTED_VERSION",type:BraintreeError.types.MERCHANT}}},{"../lib/braintree-error":129}],107:[function(_dereq_,module,exports){"use strict";function GooglePayment(options){if(this._createPromise=options.createPromise,this._client=options.client,this._useDeferredClient=options.useDeferredClient,this._googlePayVersion=options.googlePayVersion||1,this._googleMerchantId=options.googleMerchantId,this._isUnsupportedGooglePayAPIVersion())throw new BraintreeError({code:errors.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:errors.GOOGLE_PAYMENT_UNSUPPORTED_VERSION.type})}function applyDefaultsToPaymentMethodConfiguration(merchantSubmittedPaymentMethod,defaultPaymentMethod){Object.keys(defaultPaymentMethod).forEach(function(parameter){"object"==typeof defaultPaymentMethod[parameter]?merchantSubmittedPaymentMethod[parameter]=assign({},defaultPaymentMethod[parameter],merchantSubmittedPaymentMethod[parameter]):merchantSubmittedPaymentMethod[parameter]=merchantSubmittedPaymentMethod[parameter]||defaultPaymentMethod[parameter]})}var analytics=_dereq_("../lib/analytics"),assign=_dereq_("../lib/assign").assign,convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),find=_dereq_("../lib/find"),generateGooglePayConfiguration=_dereq_("../lib/generate-google-pay-configuration"),BraintreeError=_dereq_("../lib/braintree-error"),errors=_dereq_("./errors"),methods=_dereq_("../lib/methods"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),CREATE_PAYMENT_DATA_REQUEST_METHODS={1:"_createV1PaymentDataRequest",2:"_createV2PaymentDataRequest"};GooglePayment.prototype._waitForClient=function(){return this._client?Promise.resolve():this._createPromise.then(function(client){this._client=client}.bind(this))},GooglePayment.prototype._isUnsupportedGooglePayAPIVersion=function(){return!(this._googlePayVersion in CREATE_PAYMENT_DATA_REQUEST_METHODS)},GooglePayment.prototype._getDefaultConfig=function(){return this._defaultConfig||(this._defaultConfig=generateGooglePayConfiguration(this._client.getConfiguration(),this._googlePayVersion,this._googleMerchantId)),this._defaultConfig},GooglePayment.prototype._createV1PaymentDataRequest=function(paymentDataRequest){var defaultConfig=this._getDefaultConfig(),overrideCardNetworks=paymentDataRequest.cardRequirements&&paymentDataRequest.cardRequirements.allowedCardNetworks,defaultConfigCardNetworks=defaultConfig.cardRequirements.allowedCardNetworks,allowedCardNetworks=overrideCardNetworks||defaultConfigCardNetworks;return paymentDataRequest=assign({},defaultConfig,paymentDataRequest),paymentDataRequest.cardRequirements.allowedCardNetworks=allowedCardNetworks,paymentDataRequest},GooglePayment.prototype._createV2PaymentDataRequest=function(paymentDataRequest){var defaultConfig=this._getDefaultConfig();return paymentDataRequest.allowedPaymentMethods&&paymentDataRequest.allowedPaymentMethods.forEach(function(paymentMethod){var defaultPaymentMethod=find(defaultConfig.allowedPaymentMethods,"type",paymentMethod.type);defaultPaymentMethod&&applyDefaultsToPaymentMethodConfiguration(paymentMethod,defaultPaymentMethod)}),paymentDataRequest=assign({},defaultConfig,paymentDataRequest)},GooglePayment.prototype.createPaymentDataRequest=function(overrides){return this._useDeferredClient?this._waitForClient().then(function(){return this._createPaymentDataRequestSyncronously(overrides)}.bind(this)):this._createPaymentDataRequestSyncronously(overrides)},GooglePayment.prototype._createPaymentDataRequestSyncronously=function(overrides){var paymentDataRequest=assign({},overrides),version=this._googlePayVersion,createPaymentDataRequestMethod=CREATE_PAYMENT_DATA_REQUEST_METHODS[version];return analytics.sendEvent(this._createPromise,"google-payment.v"+version+".createPaymentDataRequest"),this[createPaymentDataRequestMethod](paymentDataRequest)},GooglePayment.prototype.parseResponse=function(response){var self=this;return Promise.resolve().then(function(){var payload,rawResponse=2===response.apiVersion?response.paymentMethodData.tokenizationData.token:response.paymentMethodToken.token,parsedResponse=JSON.parse(rawResponse),error=parsedResponse.error;return error?Promise.reject(error):(analytics.sendEvent(self._createPromise,"google-payment.parseResponse.succeeded"),parsedResponse.paypalAccounts?(payload=parsedResponse.paypalAccounts[0],analytics.sendEvent(self._createPromise,"google-payment.parseResponse.succeeded.paypal"),Promise.resolve({nonce:payload.nonce,type:payload.type,description:payload.description})):(payload=parsedResponse.androidPayCards[0],analytics.sendEvent(self._createPromise,"google-payment.parseResponse.succeeded.google-payment"),Promise.resolve({nonce:payload.nonce,type:payload.type,description:payload.description,details:{cardType:payload.details.cardType,lastFour:payload.details.lastFour,lastTwo:payload.details.lastTwo,isNetworkTokenized:payload.details.isNetworkTokenized,bin:payload.details.bin},binData:payload.binData})))}).catch(function(error){return analytics.sendEvent(self._createPromise,"google-payment.parseResponse.failed"),Promise.reject(new BraintreeError({code:errors.GOOGLE_PAYMENT_GATEWAY_ERROR.code,message:errors.GOOGLE_PAYMENT_GATEWAY_ERROR.message,type:errors.GOOGLE_PAYMENT_GATEWAY_ERROR.type,details:{originalError:error}}))})},GooglePayment.prototype.teardown=function(){return convertMethodsToError(this,methods(GooglePayment.prototype)),Promise.resolve()},module.exports=wrapPromise.wrapPrototype(GooglePayment)},{"../lib/analytics":124,"../lib/assign":126,"../lib/braintree-error":129,"../lib/convert-methods-to-error":132,"../lib/find":142,"../lib/generate-google-pay-configuration":154,"../lib/methods":159,"../lib/promise":161,"./errors":106,"@braintree/wrap-promise":47}],108:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"Google Pay",client:options.client,authorization:options.authorization}).then(function(){var createPromise,instance;return createPromise=createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:"Google Pay"}).then(function(client){var configuration=client.getConfiguration();return options.client=client,configuration.gatewayConfiguration.androidPay?client:Promise.reject(new BraintreeError(errors.GOOGLE_PAYMENT_NOT_ENABLED))}),options.createPromise=createPromise,instance=new GooglePayment(options),options.useDeferredClient?instance:createPromise.then(function(client){return instance._client=client,instance})})}var GooglePayment=_dereq_("./google-payment"),BraintreeError=_dereq_("../lib/braintree-error"),Promise=_dereq_("../lib/promise"),createAssetsUrl=_dereq_("../lib/create-assets-url"),createDeferredClient=_dereq_("../lib/create-deferred-client"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),wrapPromise=_dereq_("@braintree/wrap-promise"),errors=_dereq_("./errors");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"./errors":106,"./google-payment":107,"@braintree/wrap-promise":47}],109:[function(_dereq_,module,exports){"use strict";function attributeValidationError(attribute,value){var err;return allowedAttributes.hasOwnProperty(attribute)?null==value||_isValid(attribute,value)||(err=new BraintreeError({type:errors.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.type,code:errors.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.code,message:'Value "'+value+'" is not allowed for "'+attribute+'" attribute.'})):err=new BraintreeError({type:errors.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.type,code:errors.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.code,message:'The "'+attribute+'" attribute is not supported in Hosted Fields.'}),err}function _isValid(attribute,value){return"string"===allowedAttributes[attribute]?"string"==typeof value||"number"==typeof value:"boolean"===allowedAttributes[attribute]&&("true"===String(value)||"false"===String(value))}var BraintreeError=_dereq_("../../lib/braintree-error"),errors=_dereq_("../shared/errors"),allowedAttributes=_dereq_("../shared/constants").allowedAttributes;module.exports=attributeValidationError},{"../../lib/braintree-error":129,"../shared/constants":117,"../shared/errors":118}],110:[function(_dereq_,module,exports){"use strict";var constants=_dereq_("../shared/constants"),useMin=_dereq_("../../lib/use-min");module.exports=function(assetsUrl,componentId,isDebug){return assetsUrl+"/web/"+constants.VERSION+"/html/hosted-fields-frame"+useMin(isDebug)+".html#"+componentId}},{"../../lib/use-min":164,"../shared/constants":117}],111:[function(_dereq_,module,exports){"use strict";function _isUserFocusableElement(element){return browserDetection.hasSoftwareKeyboard()?userFocusableTagNames.indexOf(element.tagName)>-1&&unfocusedInputTypes.indexOf(element.type)<0:"hidden"!==element.type}function _createNavigationHelper(direction,numberOfElementsInForm){switch(direction){case directions.BACK:return{checkIndexBounds:function(index){return index<0},indexChange:-1};case directions.FORWARD:return{checkIndexBounds:function(index){return index>numberOfElementsInForm-1},indexChange:1}}return{}}function _findFirstFocusableElement(elementsInForm){var elementsIndex,element;for(elementsIndex=0;elementsIndex<elementsInForm.length;elementsIndex++)if(element=elementsInForm[elementsIndex],_isUserFocusableElement(element))return element;return null}var directions=_dereq_("../shared/constants").navigationDirections,browserDetection=_dereq_("../shared/browser-detection"),focusIntercept=_dereq_("../shared/focus-intercept"),findParentTags=_dereq_("../shared/find-parent-tags"),userFocusableTagNames=["INPUT","SELECT","TEXTAREA"],unfocusedInputTypes=["hidden","button","reset","submit","checkbox","radio","file"];module.exports={removeExtraFocusElements:function(checkoutForm,onRemoveFocusIntercepts){var elements=Array.prototype.slice.call(checkoutForm.elements);[_findFirstFocusableElement(elements),_findFirstFocusableElement(elements.reverse())].forEach(function(input){input&&focusIntercept.matchFocusElement(input.getAttribute("id"))&&onRemoveFocusIntercepts(input.getAttribute("id"))})},createFocusChangeHandler:function(hostedFieldsId,callbacks){return function(data){var currentIndex,targetElement,checkoutForm,navHelper,sourceElement=document.getElementById("bt-"+data.field+"-"+data.direction+"-"+hostedFieldsId);if(sourceElement){if(checkoutForm=findParentTags(sourceElement,"form")[0],document.forms.length<1||!checkoutForm)return void callbacks.onRemoveFocusIntercepts();checkoutForm=[].slice.call(checkoutForm.elements),currentIndex=checkoutForm.indexOf(sourceElement),navHelper=_createNavigationHelper(data.direction,checkoutForm.length);do{if(currentIndex+=navHelper.indexChange,navHelper.checkIndexBounds(currentIndex))return;targetElement=checkoutForm[currentIndex]}while(!_isUserFocusableElement(targetElement));focusIntercept.matchFocusElement(targetElement.getAttribute("id"))?callbacks.onTriggerInputFocus(targetElement.getAttribute("data-braintree-type")):targetElement.focus()}}}}},{"../shared/browser-detection":116,"../shared/constants":117,"../shared/find-parent-tags":119,"../shared/focus-intercept":120}],112:[function(_dereq_,module,exports){"use strict";var allowedStyles=_dereq_("../shared/constants").allowedStyles;module.exports=function(cssClass){var computedStyles,element=document.createElement("input"),styles={};return"."===cssClass[0]&&(cssClass=cssClass.substring(1)),element.className=cssClass,element.style.display="none !important",element.style.position="fixed !important",element.style.left="-99999px !important",element.style.top="-99999px !important",document.body.appendChild(element),computedStyles=window.getComputedStyle(element),allowedStyles.forEach(function(style){var value=computedStyles[style];value&&(styles[style]=value)}),document.body.removeChild(element),styles}},{"../shared/constants":117}],113:[function(_dereq_,module,exports){"use strict";function createInputEventHandler(fields){return function(eventData){var field,merchantPayload=eventData.merchantPayload,emittedBy=merchantPayload.emittedBy,container=fields[emittedBy].containerElement;Object.keys(merchantPayload.fields).forEach(function(key){merchantPayload.fields[key].container=fields[key].containerElement}),field=merchantPayload.fields[emittedBy],"blur"===eventData.type&&performBlurFixForIos(container),classList.toggle(container,constants.externalClasses.FOCUSED,field.isFocused),classList.toggle(container,constants.externalClasses.VALID,field.isValid),classList.toggle(container,constants.externalClasses.INVALID,!field.isPotentiallyValid),this._state={cards:merchantPayload.cards,fields:merchantPayload.fields},this._emit(eventData.type,merchantPayload)}}function performBlurFixForIos(container){var hiddenInput;browserDetection.isIos()&&document.activeElement===document.body&&(hiddenInput=container.querySelector("input"),hiddenInput||(hiddenInput=document.createElement("input"),hiddenInput.type="button",hiddenInput.style.height="0px",
hiddenInput.style.width="0px",hiddenInput.style.opacity="0",hiddenInput.style.padding="0",hiddenInput.style.position="absolute",hiddenInput.style.left="-200%",hiddenInput.style.top="0px",container.insertBefore(hiddenInput,container.firstChild)),hiddenInput.focus(),hiddenInput.blur())}function isVisibleEnough(node){var boundingBox=node.getBoundingClientRect(),verticalMidpoint=Math.floor(boundingBox.height/2),horizontalMidpoint=Math.floor(boundingBox.width/2);return boundingBox.top<(window.innerHeight-verticalMidpoint||document.documentElement.clientHeight-verticalMidpoint)&&boundingBox.right>horizontalMidpoint&&boundingBox.bottom>verticalMidpoint&&boundingBox.left<(window.innerWidth-horizontalMidpoint||document.documentElement.clientWidth-horizontalMidpoint)}function HostedFields(options){var failureTimeout,clientConfig,assetsUrl,isDebug,hostedFieldsUrl,self=this,fields={},frameReadyPromiseResolveFunctions={},frameReadyPromises=[],componentId=uuid();if(this._merchantConfigurationOptions=assign({},options),options.client?(clientConfig=options.client.getConfiguration(),assetsUrl=clientConfig.gatewayConfiguration.assetsUrl,isDebug=clientConfig.isDebug):(assetsUrl=createAssetsUrl.create(options.authorization),isDebug=Boolean(options.isDebug)),this._clientPromise=createDeferredClient.create({client:options.client,authorization:options.authorization,debug:isDebug,assetsUrl:assetsUrl,name:"Hosted Fields"}),hostedFieldsUrl=composeUrl(assetsUrl,componentId,isDebug),!options.fields||0===Object.keys(options.fields).length)throw new BraintreeError({type:sharedErrors.INSTANTIATION_OPTION_REQUIRED.type,code:sharedErrors.INSTANTIATION_OPTION_REQUIRED.code,message:"options.fields is required when instantiating Hosted Fields."});EventEmitter.call(this),this._injectedNodes=[],this._destructor=new Destructor,this._fields=fields,this._state={fields:{},cards:getCardTypes("")},this._bus=new Bus({channel:componentId,verifyDomain:isVerifiedDomain}),this._destructor.registerFunctionForTeardown(function(){self._bus.teardown()}),options.client?analytics.sendEvent(this._clientPromise,"custom.hosted-fields.initialized"):analytics.sendEvent(this._clientPromise,"custom.hosted-fields.initialized.deferred-client"),Object.keys(options.fields).forEach(function(key){var field,externalContainer,internalContainer,frame,frameReadyPromise;if(!constants.allowedFields.hasOwnProperty(key))throw new BraintreeError({type:errors.HOSTED_FIELDS_INVALID_FIELD_KEY.type,code:errors.HOSTED_FIELDS_INVALID_FIELD_KEY.code,message:'"'+key+'" is not a valid field.'});if(field=options.fields[key],externalContainer=field.container||field.selector,"string"==typeof externalContainer&&(externalContainer=document.querySelector(externalContainer)),!externalContainer||1!==externalContainer.nodeType)throw new BraintreeError({type:errors.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.type,code:errors.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.code,message:errors.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.message,details:{fieldSelector:field.selector,fieldContainer:field.container,fieldKey:key}});if(externalContainer.querySelector('iframe[name^="braintree-"]'))throw new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.type,code:errors.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.code,message:errors.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.message,details:{fieldSelector:field.selector,fieldContainer:field.container,fieldKey:key}});if(internalContainer=externalContainer,shadow.isShadowElement(internalContainer)&&(internalContainer=shadow.transformToSlot(internalContainer,"height: 100%")),field.maxlength&&"number"!=typeof field.maxlength)throw new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,code:errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,message:"The value for maxlength must be a number.",details:{fieldKey:key}});if(field.minlength&&"number"!=typeof field.minlength)throw new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,code:errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,message:"The value for minlength must be a number.",details:{fieldKey:key}});frame=iFramer({type:key,name:"braintree-hosted-field-"+key,style:constants.defaultIFrameStyle,title:"Secure Credit Card Frame - "+constants.allowedFields[key].label}),this._injectedNodes.push.apply(this._injectedNodes,injectFrame(componentId,frame,internalContainer,function(){self._bus.emit(events.TRIGGER_INPUT_FOCUS,{field:key})})),this._setupLabelFocus(key,externalContainer),fields[key]={frameElement:frame,containerElement:externalContainer},frameReadyPromise=new Promise(function(resolve){frameReadyPromiseResolveFunctions[key]=resolve}),frameReadyPromises.push(frameReadyPromise),this._state.fields[key]={isEmpty:!0,isValid:!1,isPotentiallyValid:!0,isFocused:!1,container:externalContainer},setTimeout(function(){browserDetection.isIE()||browserDetection.isEdge()?(frame.src="about:blank",setTimeout(function(){frame.src=hostedFieldsUrl},0)):frame.src=hostedFieldsUrl},0)}.bind(this)),this._merchantConfigurationOptions.styles&&Object.keys(this._merchantConfigurationOptions.styles).forEach(function(selector){var className=self._merchantConfigurationOptions.styles[selector];"string"==typeof className&&(self._merchantConfigurationOptions.styles[selector]=getStylesFromClass(className))}),this._bus.on(events.REMOVE_FOCUS_INTERCEPTS,function(data){destroyFocusIntercept(data&&data.id)}),this._bus.on(events.TRIGGER_FOCUS_CHANGE,focusChange.createFocusChangeHandler(componentId,{onRemoveFocusIntercepts:function(element){self._bus.emit(events.REMOVE_FOCUS_INTERCEPTS,{id:element})},onTriggerInputFocus:function(targetType){self._bus.emit(events.TRIGGER_INPUT_FOCUS,{field:targetType})}})),this._bus.on(events.READY_FOR_CLIENT,function(reply){self._clientPromise.then(function(client){reply(client)})}),this._bus.on(events.CARD_FORM_ENTRY_HAS_BEGUN,function(){analytics.sendEvent(self._clientPromise,"hosted-fields.input.started")}),this._bus.on(events.BIN_AVAILABLE,function(bin){self._emit("binAvailable",{bin:bin})}),failureTimeout=setTimeout(function(){analytics.sendEvent(self._clientPromise,"custom.hosted-fields.load.timed-out"),self._emit("timeout")},INTEGRATION_TIMEOUT_MS),Promise.all(frameReadyPromises).then(function(results){var reply=results[0];clearTimeout(failureTimeout),reply(formatMerchantConfigurationForIframes(self._merchantConfigurationOptions)),self._cleanUpFocusIntercepts(),self._emit("ready")}),this._bus.on(events.FRAME_READY,function(data,reply){frameReadyPromiseResolveFunctions[data.field](reply)}),this._bus.on(events.INPUT_EVENT,createInputEventHandler(fields).bind(this)),browserDetection.isIos()&&this._bus.on(events.TRIGGER_INPUT_FOCUS,function(data){var container=fields[data.field].containerElement;setTimeout(function(){isVisibleEnough(container)||container.scrollIntoView()},SAFARI_FOCUS_TIMEOUT)}),this._destructor.registerFunctionForTeardown(function(){var j,node,parent;for(j=0;j<self._injectedNodes.length;j++)node=self._injectedNodes[j],parent=node.parentNode,parent.removeChild(node),classList.remove(parent,constants.externalClasses.FOCUSED,constants.externalClasses.INVALID,constants.externalClasses.VALID)}),this._destructor.registerFunctionForTeardown(function(){destroyFocusIntercept()}),this._destructor.registerFunctionForTeardown(function(){var methodNames=methods(HostedFields.prototype).concat(methods(EventEmitter.prototype));convertMethodsToError(self,methodNames)})}function formatMerchantConfigurationForIframes(config){var formattedConfig=assign({},config);return formattedConfig.fields=assign({},formattedConfig.fields),Object.keys(formattedConfig.fields).forEach(function(field){formattedConfig.fields[field]=assign({},formattedConfig.fields[field]),delete formattedConfig.fields[field].container}),formattedConfig}var assign=_dereq_("../../lib/assign").assign,createAssetsUrl=_dereq_("../../lib/create-assets-url"),isVerifiedDomain=_dereq_("../../lib/is-verified-domain"),Destructor=_dereq_("../../lib/destructor"),classList=_dereq_("@braintree/class-list"),iFramer=_dereq_("@braintree/iframer"),Bus=_dereq_("framebus"),createDeferredClient=_dereq_("../../lib/create-deferred-client"),BraintreeError=_dereq_("../../lib/braintree-error"),composeUrl=_dereq_("./compose-url"),getStylesFromClass=_dereq_("./get-styles-from-class"),constants=_dereq_("../shared/constants"),errors=_dereq_("../shared/errors"),INTEGRATION_TIMEOUT_MS=_dereq_("../../lib/constants").INTEGRATION_TIMEOUT_MS,uuid=_dereq_("@braintree/uuid"),findParentTags=_dereq_("../shared/find-parent-tags"),browserDetection=_dereq_("../shared/browser-detection"),events=constants.events,EventEmitter=_dereq_("@braintree/event-emitter"),injectFrame=_dereq_("./inject-frame"),analytics=_dereq_("../../lib/analytics"),allowedFields=constants.allowedFields,methods=_dereq_("../../lib/methods"),shadow=_dereq_("../../lib/shadow"),findRootNode=_dereq_("../../lib/find-root-node"),convertMethodsToError=_dereq_("../../lib/convert-methods-to-error"),sharedErrors=_dereq_("../../lib/errors"),getCardTypes=_dereq_("../shared/get-card-types"),attributeValidationError=_dereq_("./attribute-validation-error"),Promise=_dereq_("../../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),focusChange=_dereq_("./focus-change"),destroyFocusIntercept=_dereq_("../shared/focus-intercept").destroy,SAFARI_FOCUS_TIMEOUT=5;EventEmitter.createChild(HostedFields),HostedFields.prototype._setupLabelFocus=function(type,container){function triggerFocus(){bus.emit(events.TRIGGER_INPUT_FOCUS,{field:type})}var labels,i,shouldSkipLabelFocus=browserDetection.isIos(),bus=this._bus,rootNode=findRootNode(container);if(!shouldSkipLabelFocus&&null!=container.id){for(labels=Array.prototype.slice.call(document.querySelectorAll('label[for="'+container.id+'"]')),rootNode!==document&&(labels=labels.concat(Array.prototype.slice.call(rootNode.querySelectorAll('label[for="'+container.id+'"]')))),labels=labels.concat(findParentTags(container,"label")),labels=labels.filter(function(label,index,arr){return arr.indexOf(label)===index}),i=0;i<labels.length;i++)labels[i].addEventListener("click",triggerFocus,!1);this._destructor.registerFunctionForTeardown(function(){for(i=0;i<labels.length;i++)labels[i].removeEventListener("click",triggerFocus,!1)})}},HostedFields.prototype._getAnyFieldContainer=function(){var self=this;return Object.keys(this._fields).reduce(function(found,field){return found||self._fields[field].containerElement},null)},HostedFields.prototype._cleanUpFocusIntercepts=function(){var iframeContainer,checkoutForm;document.forms.length<1?this._bus.emit(events.REMOVE_FOCUS_INTERCEPTS):(iframeContainer=this._getAnyFieldContainer(),checkoutForm=findParentTags(iframeContainer,"form")[0],checkoutForm?focusChange.removeExtraFocusElements(checkoutForm,function(id){this._bus.emit(events.REMOVE_FOCUS_INTERCEPTS,{id:id})}.bind(this)):this._bus.emit(events.REMOVE_FOCUS_INTERCEPTS))},HostedFields.prototype._attachInvalidFieldContainersToError=function(err){err.details&&err.details.invalidFieldKeys&&err.details.invalidFieldKeys.length>0&&(err.details.invalidFields={},err.details.invalidFieldKeys.forEach(function(field){err.details.invalidFields[field]=this._fields[field].containerElement}.bind(this)))},HostedFields.prototype.getChallenges=function(){return this._clientPromise.then(function(client){return client.getConfiguration().gatewayConfiguration.challenges})},HostedFields.prototype.getSupportedCardTypes=function(){return this._clientPromise.then(function(client){return client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes.map(function(cardType){return"MasterCard"===cardType?"Mastercard":cardType})})},HostedFields.prototype.teardown=function(){var self=this;return new Promise(function(resolve,reject){self._destructor.teardown(function(err){analytics.sendEvent(self._clientPromise,"custom.hosted-fields.teardown-completed"),err?reject(err):resolve()})})},HostedFields.prototype.tokenize=function(options){var self=this;return options||(options={}),new Promise(function(resolve,reject){self._bus.emit(events.TOKENIZATION_REQUEST,options,function(response){var err=response[0],payload=response[1];err?(self._attachInvalidFieldContainersToError(err),reject(new BraintreeError(err))):resolve(payload)})})},HostedFields.prototype.addClass=function(field,classname){var err;return allowedFields.hasOwnProperty(field)?this._fields.hasOwnProperty(field)?this._bus.emit(events.ADD_CLASS,{field:field,classname:classname}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot add class to "'+field+'" field because it is not part of the current Hosted Fields options.'}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_INVALID.type,code:errors.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+field+'" is not a valid field. You must use a valid field option when adding a class.'}),err?Promise.reject(err):Promise.resolve()},HostedFields.prototype.removeClass=function(field,classname){var err;return allowedFields.hasOwnProperty(field)?this._fields.hasOwnProperty(field)?this._bus.emit(events.REMOVE_CLASS,{field:field,classname:classname}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot remove class from "'+field+'" field because it is not part of the current Hosted Fields options.'}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_INVALID.type,code:errors.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+field+'" is not a valid field. You must use a valid field option when removing a class.'}),err?Promise.reject(err):Promise.resolve()},HostedFields.prototype.setAttribute=function(options){var attributeErr,err;return allowedFields.hasOwnProperty(options.field)?this._fields.hasOwnProperty(options.field)?(attributeErr=attributeValidationError(options.attribute,options.value),attributeErr?err=attributeErr:this._bus.emit(events.SET_ATTRIBUTE,{field:options.field,attribute:options.attribute,value:options.value})):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot set attribute for "'+options.field+'" field because it is not part of the current Hosted Fields options.'}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_INVALID.type,code:errors.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+options.field+'" is not a valid field. You must use a valid field option when setting an attribute.'}),err?Promise.reject(err):Promise.resolve()},HostedFields.prototype.setMonthOptions=function(options){var errorMessage,self=this,merchantOptions=this._merchantConfigurationOptions.fields;return merchantOptions.expirationMonth?merchantOptions.expirationMonth.select||(errorMessage="Expiration month field must be a select element."):errorMessage="Expiration month field must exist to use setMonthOptions.",errorMessage?Promise.reject(new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,code:errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,message:errorMessage})):new Promise(function(resolve){self._bus.emit(events.SET_MONTH_OPTIONS,options,resolve)})},HostedFields.prototype.setMessage=function(options){this._bus.emit(events.SET_MESSAGE,{field:options.field,message:options.message})},HostedFields.prototype.removeAttribute=function(options){var attributeErr,err;return allowedFields.hasOwnProperty(options.field)?this._fields.hasOwnProperty(options.field)?(attributeErr=attributeValidationError(options.attribute),attributeErr?err=attributeErr:this._bus.emit(events.REMOVE_ATTRIBUTE,{field:options.field,attribute:options.attribute})):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot remove attribute for "'+options.field+'" field because it is not part of the current Hosted Fields options.'}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_INVALID.type,code:errors.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+options.field+'" is not a valid field. You must use a valid field option when removing an attribute.'}),err?Promise.reject(err):Promise.resolve()},HostedFields.prototype.setPlaceholder=function(field,placeholder){return this.setAttribute({field:field,attribute:"placeholder",value:placeholder})},HostedFields.prototype.clear=function(field){var err;return allowedFields.hasOwnProperty(field)?this._fields.hasOwnProperty(field)?this._bus.emit(events.CLEAR_FIELD,{field:field}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot clear "'+field+'" field because it is not part of the current Hosted Fields options.'}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_INVALID.type,code:errors.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+field+'" is not a valid field. You must use a valid field option when clearing a field.'}),err?Promise.reject(err):Promise.resolve()},HostedFields.prototype.focus=function(field){var err;return allowedFields.hasOwnProperty(field)?this._fields.hasOwnProperty(field)?this._bus.emit(events.TRIGGER_INPUT_FOCUS,{field:field}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot focus "'+field+'" field because it is not part of the current Hosted Fields options.'}):err=new BraintreeError({type:errors.HOSTED_FIELDS_FIELD_INVALID.type,code:errors.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+field+'" is not a valid field. You must use a valid field option when focusing a field.'}),err?Promise.reject(err):Promise.resolve()},HostedFields.prototype.getState=function(){return this._state},module.exports=wrapPromise.wrapPrototype(HostedFields)},{"../../lib/analytics":124,"../../lib/assign":126,"../../lib/braintree-error":129,"../../lib/constants":131,"../../lib/convert-methods-to-error":132,"../../lib/create-assets-url":134,"../../lib/create-deferred-client":136,"../../lib/destructor":138,"../../lib/errors":140,"../../lib/find-root-node":141,"../../lib/is-verified-domain":157,"../../lib/methods":159,"../../lib/promise":161,"../../lib/shadow":163,"../shared/browser-detection":116,"../shared/constants":117,"../shared/errors":118,"../shared/find-parent-tags":119,"../shared/focus-intercept":120,"../shared/get-card-types":121,"./attribute-validation-error":109,"./compose-url":110,"./focus-change":111,"./get-styles-from-class":112,"./inject-frame":114,"@braintree/class-list":36,"@braintree/event-emitter":37,"@braintree/iframer":39,"@braintree/uuid":43,"@braintree/wrap-promise":47,framebus:56}],114:[function(_dereq_,module,exports){"use strict";var focusIntercept=_dereq_("../shared/focus-intercept"),directions=_dereq_("../shared/constants").navigationDirections;module.exports=function(id,frame,container,focusHandler){var frameType=frame.getAttribute("type"),clearboth=document.createElement("div"),fragment=document.createDocumentFragment(),focusInterceptBefore=focusIntercept.generate(id,frameType,directions.BACK,focusHandler),focusInterceptAfter=focusIntercept.generate(id,frameType,directions.FORWARD,focusHandler);return clearboth.style.clear="both",fragment.appendChild(focusInterceptBefore),fragment.appendChild(frame),fragment.appendChild(focusInterceptAfter),fragment.appendChild(clearboth),container.appendChild(fragment),[frame,clearboth]}},{"../shared/constants":117,"../shared/focus-intercept":120}],115:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"Hosted Fields",authorization:options.authorization,client:options.client}).then(function(){var integration=new HostedFields(options);return new Promise(function(resolve,reject){integration.on("ready",function(){resolve(integration)}),integration.on("timeout",function(){reject(new BraintreeError(errors.HOSTED_FIELDS_TIMEOUT))})})})}var HostedFields=_dereq_("./external/hosted-fields"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),errors=_dereq_("./shared/errors"),supportsInputFormatting=_dereq_("restricted-input/supports-input-formatting"),wrapPromise=_dereq_("@braintree/wrap-promise"),BraintreeError=_dereq_("../lib/braintree-error"),Promise=_dereq_("../lib/promise");module.exports={supportsInputFormatting:supportsInputFormatting,create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/promise":161,"./external/hosted-fields":113,"./shared/errors":118,"@braintree/wrap-promise":47,"restricted-input/supports-input-formatting":72}],116:[function(_dereq_,module,exports){"use strict";function hasSoftwareKeyboard(){return isAndroid()||isChromeOS()||isIos()}function isChromeIos(){return isChrome()&&isIos()}var isAndroid=_dereq_("@braintree/browser-detection/is-android"),isChromeOS=_dereq_("@braintree/browser-detection/is-chrome-os"),isIos=_dereq_("@braintree/browser-detection/is-ios"),isChrome=_dereq_("@braintree/browser-detection/is-chrome");module.exports={isIE:_dereq_("@braintree/browser-detection/is-ie"),isEdge:_dereq_("@braintree/browser-detection/is-edge"),isIe9:_dereq_("@braintree/browser-detection/is-ie9"),isIe10:_dereq_("@braintree/browser-detection/is-ie10"),isAndroid:isAndroid,isChromeOS:isChromeOS,isChromeIos:isChromeIos,isFirefox:_dereq_("@braintree/browser-detection/is-firefox"),isIos:isIos,isIosWebview:_dereq_("@braintree/browser-detection/is-ios-webview"),hasSoftwareKeyboard:hasSoftwareKeyboard}},{"@braintree/browser-detection/is-android":21,"@braintree/browser-detection/is-chrome":23,"@braintree/browser-detection/is-chrome-os":22,"@braintree/browser-detection/is-edge":24,"@braintree/browser-detection/is-firefox":25,"@braintree/browser-detection/is-ie":26,"@braintree/browser-detection/is-ie10":27,"@braintree/browser-detection/is-ie9":28,"@braintree/browser-detection/is-ios":32,"@braintree/browser-detection/is-ios-webview":30}],117:[function(_dereq_,module,exports){"use strict";var enumerate=_dereq_("../../lib/enumerate"),errors=_dereq_("./errors"),constants={VERSION:"3.69.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:errors.HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE,81736:errors.HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED},allowedStyles:["-moz-appearance","-moz-osx-font-smoothing","-moz-tap-highlight-color","-moz-transition","-webkit-appearance","-webkit-font-smoothing","-webkit-tap-highlight-color","-webkit-transition","appearance","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"}};constants.events=enumerate(["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:"),module.exports=constants},{"../../lib/enumerate":139,"./errors":118}],118:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../../lib/braintree-error");module.exports={HOSTED_FIELDS_TIMEOUT:{type:BraintreeError.types.UNKNOWN,code:"HOSTED_FIELDS_TIMEOUT",message:"Hosted Fields timed out when attempting to set up."},HOSTED_FIELDS_INVALID_FIELD_KEY:{type:BraintreeError.types.MERCHANT,code:"HOSTED_FIELDS_INVALID_FIELD_KEY"},HOSTED_FIELDS_INVALID_FIELD_SELECTOR:{type:BraintreeError.types.MERCHANT,code:"HOSTED_FIELDS_INVALID_FIELD_SELECTOR",message:"Selector does not reference a valid DOM node."},HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME:{type:BraintreeError.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME",message:"Element already contains a Braintree iframe."},HOSTED_FIELDS_FIELD_INVALID:{type:BraintreeError.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_INVALID"},HOSTED_FIELDS_FIELD_NOT_PRESENT:{type:BraintreeError.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_NOT_PRESENT"},HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR:{type:BraintreeError.types.NETWORK,code:"HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR",message:"A tokenization network error occurred."},HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE:{type:BraintreeError.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:BraintreeError.types.CUSTOMER,code:"HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED",message:"CVV verification failed during tokenization."},HOSTED_FIELDS_FAILED_TOKENIZATION:{type:BraintreeError.types.CUSTOMER,code:"HOSTED_FIELDS_FAILED_TOKENIZATION",message:"The supplied card data failed tokenization."},HOSTED_FIELDS_FIELDS_EMPTY:{type:BraintreeError.types.CUSTOMER,code:"HOSTED_FIELDS_FIELDS_EMPTY",message:"All fields are empty. Cannot tokenize empty card fields."},HOSTED_FIELDS_FIELDS_INVALID:{type:BraintreeError.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:BraintreeError.types.MERCHANT,code:"HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED"},HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED:{type:BraintreeError.types.MERCHANT,code:"HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED"},HOSTED_FIELDS_FIELD_PROPERTY_INVALID:{type:BraintreeError.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_PROPERTY_INVALID"}}},{"../../lib/braintree-error":129}],119:[function(_dereq_,module,exports){"use strict";function findParentTags(element,tag){for(var parent=element.parentNode,parents=[];null!=parent;)null!=parent.tagName&&parent.tagName.toLowerCase()===tag&&parents.push(parent),parent=parent.parentNode;return parents}module.exports=findParentTags},{}],120:[function(_dereq_,module,exports){"use strict";var browserDetection=_dereq_("./browser-detection"),classList=_dereq_("@braintree/class-list"),constants=_dereq_("./constants"),allowedFields=Object.keys(constants.allowedFields),directions=constants.navigationDirections,focusIntercept={generate:function(hostedFieldsId,type,direction,handler){var input=document.createElement("input"),focusInterceptStyles={border:"none !important",display:"block !important",height:"1px !important",left:"-1px !important",opacity:"0 !important",position:"absolute !important",top:"-1px !important",width:"1px !important"};return browserDetection.hasSoftwareKeyboard()||browserDetection.isFirefox()||browserDetection.isIE()?(input.setAttribute("aria-hidden","true"),input.setAttribute("autocomplete","off"),input.setAttribute("data-braintree-direction",direction),input.setAttribute("data-braintree-type",type),input.setAttribute("id","bt-"+type+"-"+direction+"-"+hostedFieldsId),input.setAttribute("style",JSON.stringify(focusInterceptStyles).replace(/[{}"]/g,"").replace(/,/g,";")),classList.add(input,"focus-intercept"),input.addEventListener("focus",function(event){handler(event),browserDetection.hasSoftwareKeyboard()||input.blur()}),input):document.createDocumentFragment()},destroy:function(idString){var focusInputs;idString?focusInputs=[document.getElementById(idString)]:(focusInputs=document.querySelectorAll("[data-braintree-direction]"),focusInputs=[].slice.call(focusInputs)),focusInputs.forEach(function(node){node&&1===node.nodeType&&focusIntercept.matchFocusElement(node.getAttribute("id"))&&node.parentNode.removeChild(node)})},matchFocusElement:function(idString){var idComponents,hasBTPrefix,isAllowedType,isValidDirection;return!!idString&&(idComponents=idString.split("-"),!(idComponents.length<4)&&(hasBTPrefix="bt"===idComponents[0],isAllowedType=allowedFields.indexOf(idComponents[1])>-1,isValidDirection=idComponents[2]===directions.BACK||idComponents[2]===directions.FORWARD,Boolean(hasBTPrefix&&isAllowedType&&isValidDirection)))}};module.exports=focusIntercept},{"./browser-detection":116,"./constants":117,"@braintree/class-list":36}],121:[function(_dereq_,module,exports){"use strict";var creditCardType=_dereq_("credit-card-type");module.exports=function(number){var results=creditCardType(number);return results.forEach(function(card){"mastercard"===card.type&&(card.type="master-card")}),results}},{"credit-card-type":48}],122:[function(_dereq_,module,exports){"use strict";var americanExpress=_dereq_("./american-express"),applePay=_dereq_("./apple-pay"),client=_dereq_("./client"),dataCollector=_dereq_("./data-collector"),hostedFields=_dereq_("./hosted-fields"),localPayment=_dereq_("./local-payment"),masterpass=_dereq_("./masterpass"),paymentRequest=_dereq_("./payment-request"),paypal=_dereq_("./paypal"),paypalCheckout=_dereq_("./paypal-checkout"),googlePayment=_dereq_("./google-payment"),threeDSecure=_dereq_("./three-d-secure"),unionpay=_dereq_("./unionpay"),usBankAccount=_dereq_("./us-bank-account"),vaultManager=_dereq_("./vault-manager"),venmo=_dereq_("./venmo"),visaCheckout=_dereq_("./visa-checkout"),preferredPaymentMethods=_dereq_("./preferred-payment-methods");module.exports={americanExpress:americanExpress,applePay:applePay,client:client,dataCollector:dataCollector,hostedFields:hostedFields,localPayment:localPayment,masterpass:masterpass,googlePayment:googlePayment,paymentRequest:paymentRequest,paypal:paypal,paypalCheckout:paypalCheckout,threeDSecure:threeDSecure,unionpay:unionpay,usBankAccount:usBankAccount,vaultManager:vaultManager,venmo:venmo,visaCheckout:visaCheckout,preferredPaymentMethods:preferredPaymentMethods,VERSION:"3.69.0"}},{"./american-express":75,"./apple-pay":78,"./client":84,"./data-collector":103,"./google-payment":108,"./hosted-fields":115,"./local-payment":168,"./masterpass":171,"./payment-request":176,"./paypal":183,"./paypal-checkout":180,"./preferred-payment-methods":186,"./three-d-secure":196,"./unionpay":200,"./us-bank-account":206,"./vault-manager":209,"./venmo":211,"./visa-checkout":218}],123:[function(_dereq_,module,exports){"use strict";function addMetadata(configuration,data){var key,attrs=data?jsonClone(data):{},authAttrs=createAuthorizationData(configuration.authorization).attrs,_meta=jsonClone(configuration.analyticsMetadata);attrs.braintreeLibraryVersion=constants.BRAINTREE_LIBRARY_VERSION;for(key in attrs._meta)attrs._meta.hasOwnProperty(key)&&(_meta[key]=attrs._meta[key]);return attrs._meta=_meta,
authAttrs.tokenizationKey?attrs.tokenizationKey=authAttrs.tokenizationKey:attrs.authorizationFingerprint=authAttrs.authorizationFingerprint,attrs}var createAuthorizationData=_dereq_("./create-authorization-data"),jsonClone=_dereq_("./json-clone"),constants=_dereq_("./constants");module.exports=addMetadata},{"./constants":131,"./create-authorization-data":135,"./json-clone":158}],124:[function(_dereq_,module,exports){"use strict";function sendAnalyticsEvent(clientInstanceOrPromise,kind,callback){var timestamp=Date.now();return Promise.resolve(clientInstanceOrPromise).then(function(client){var timestampInPromise=Date.now(),configuration=client.getConfiguration(),request=client._request,url=configuration.gatewayConfiguration.analytics.url,data={analytics:[{kind:constants.ANALYTICS_PREFIX+kind,isAsync:Math.floor(timestampInPromise/1e3)!==Math.floor(timestamp/1e3),timestamp:timestamp}]};request({url:url,method:"post",data:addMetadata(configuration,data),timeout:constants.ANALYTICS_REQUEST_TIMEOUT_MS},callback)})}var Promise=_dereq_("./promise"),constants=_dereq_("./constants"),addMetadata=_dereq_("./add-metadata");module.exports={sendEvent:sendAnalyticsEvent}},{"./add-metadata":123,"./constants":131,"./promise":161}],125:[function(_dereq_,module,exports){"use strict";var loadScript=_dereq_("@braintree/asset-loader/load-script");module.exports={loadScript:loadScript}},{"@braintree/asset-loader/load-script":3}],126:[function(_dereq_,module,exports){"use strict";function assignPolyfill(destination){var i,source,key;for(i=1;i<arguments.length;i++){source=arguments[i];for(key in source)source.hasOwnProperty(key)&&(destination[key]=source[key])}return destination}var assignNormalized="function"==typeof Object.assign?Object.assign:assignPolyfill;module.exports={assign:assignNormalized,_assign:assignPolyfill}},{}],127:[function(_dereq_,module,exports){"use strict";function basicComponentVerification(options){var client,authorization,name;return options?(name=options.name,client=options.client,authorization=options.authorization,client||authorization?authorization||client.getVersion()===VERSION?Promise.resolve():Promise.reject(new BraintreeError({type:sharedErrors.INCOMPATIBLE_VERSIONS.type,code:sharedErrors.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+client.getVersion()+") and "+name+" (version "+VERSION+") components must be from the same SDK version."})):Promise.reject(new BraintreeError({type:sharedErrors.INSTANTIATION_OPTION_REQUIRED.type,code:sharedErrors.INSTANTIATION_OPTION_REQUIRED.code,message:"options.client is required when instantiating "+name+"."}))):Promise.reject(new BraintreeError({type:sharedErrors.INVALID_USE_OF_INTERNAL_FUNCTION.type,code:sharedErrors.INVALID_USE_OF_INTERNAL_FUNCTION.code,message:"Options must be passed to basicComponentVerification function."}))}var BraintreeError=_dereq_("./braintree-error"),Promise=_dereq_("./promise"),sharedErrors=_dereq_("./errors"),VERSION="3.69.0";module.exports={verify:basicComponentVerification}},{"./braintree-error":129,"./errors":140,"./promise":161}],128:[function(_dereq_,module,exports){"use strict";function call(fn,callback){0===fn.length?(fn(),callback(null)):fn(callback)}var once=_dereq_("./once");module.exports=function(functions,cb){function finish(err){if(err)return void callback(err);0===(remaining-=1)&&callback(null)}var i,length=functions.length,remaining=length,callback=once(cb);if(0===length)return void callback(null);for(i=0;i<length;i++)call(functions[i],finish)}},{"./once":160}],129:[function(_dereq_,module,exports){"use strict";function BraintreeError(options){if(!BraintreeError.types.hasOwnProperty(options.type))throw new Error(options.type+" is not a valid type.");if(!options.code)throw new Error("Error code required.");if(!options.message)throw new Error("Error message required.");this.name="BraintreeError",this.code=options.code,this.message=options.message,this.type=options.type,this.details=options.details}var enumerate=_dereq_("./enumerate");BraintreeError.prototype=Object.create(Error.prototype),BraintreeError.prototype.constructor=BraintreeError,BraintreeError.types=enumerate(["CUSTOMER","MERCHANT","NETWORK","INTERNAL","UNKNOWN"]),BraintreeError.findRootError=function(err){return err instanceof BraintreeError&&err.details&&err.details.originalError?BraintreeError.findRootError(err.details.originalError):err},module.exports=BraintreeError},{"./enumerate":139}],130:[function(_dereq_,module,exports){"use strict";function transformKey(key){return key.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1_$2").toLowerCase()}module.exports=function(obj){return Object.keys(obj).reduce(function(newObj,key){return newObj[transformKey(key)]=obj[key],newObj},{})}},{}],131:[function(_dereq_,module,exports){"use strict";var CLIENT_API_URLS={production:"https://api.braintreegateway.com:443",sandbox:"https://api.sandbox.braintreegateway.com:443"},ASSETS_URLS={production:"https://assets.braintreegateway.com",sandbox:"https://assets.braintreegateway.com"},GRAPHQL_URLS={production:"https://payments.braintree-api.com/graphql",sandbox:"https://payments.sandbox.braintree-api.com/graphql"};module.exports={ANALYTICS_PREFIX:"web.",ANALYTICS_REQUEST_TIMEOUT_MS:2e3,ASSETS_URLS:ASSETS_URLS,CLIENT_API_URLS:CLIENT_API_URLS,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:GRAPHQL_URLS,INTEGRATION_TIMEOUT_MS:6e4,VERSION:"3.69.0",INTEGRATION:"custom",SOURCE:"client",PLATFORM:"web",BRAINTREE_LIBRARY_VERSION:"braintree/web/3.69.0"}},{}],132:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("./braintree-error"),sharedErrors=_dereq_("./errors");module.exports=function(instance,methodNames){methodNames.forEach(function(methodName){instance[methodName]=function(){throw new BraintreeError({type:sharedErrors.METHOD_CALLED_AFTER_TEARDOWN.type,code:sharedErrors.METHOD_CALLED_AFTER_TEARDOWN.code,message:methodName+" cannot be called after teardown."})}})}},{"./braintree-error":129,"./errors":140}],133:[function(_dereq_,module,exports){"use strict";function convertToBraintreeError(originalErr,btErrorObject){return originalErr instanceof BraintreeError?originalErr:new BraintreeError({type:btErrorObject.type,code:btErrorObject.code,message:btErrorObject.message,details:{originalError:originalErr}})}var BraintreeError=_dereq_("./braintree-error");module.exports=convertToBraintreeError},{"./braintree-error":129}],134:[function(_dereq_,module,exports){"use strict";function createAssetsUrl(authorization){return ASSETS_URLS.production}var ASSETS_URLS=_dereq_("./constants").ASSETS_URLS;module.exports={create:createAssetsUrl}},{"./constants":131}],135:[function(_dereq_,module,exports){"use strict";function _isTokenizationKey(str){return/^[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9_]+$/.test(str)}function _parseTokenizationKey(tokenizationKey){var tokens=tokenizationKey.split("_"),environment=tokens[0];return{merchantId:tokens.slice(2).join("_"),environment:environment}}function createAuthorizationData(authorization){var parsedClientToken,parsedTokenizationKey,data={attrs:{},configUrl:""};return _isTokenizationKey(authorization)?(parsedTokenizationKey=_parseTokenizationKey(authorization),data.environment=parsedTokenizationKey.environment,data.attrs.tokenizationKey=authorization,data.configUrl=CLIENT_API_URLS[parsedTokenizationKey.environment]+"/merchants/"+parsedTokenizationKey.merchantId+"/client_api/v1/configuration"):(parsedClientToken=JSON.parse(atob(authorization)),data.environment=parsedClientToken.environment,data.attrs.authorizationFingerprint=parsedClientToken.authorizationFingerprint,data.configUrl=parsedClientToken.configUrl,data.graphQL=parsedClientToken.graphQL),data}var atob=_dereq_("../lib/vendor/polyfill").atob,CLIENT_API_URLS=_dereq_("../lib/constants").CLIENT_API_URLS;module.exports=createAuthorizationData},{"../lib/constants":131,"../lib/vendor/polyfill":165}],136:[function(_dereq_,module,exports){"use strict";function createDeferredClient(options){var promise=Promise.resolve();return options.client?Promise.resolve(options.client):(window.braintree&&window.braintree.client||(promise=assets.loadScript({src:options.assetsUrl+"/web/"+VERSION+"/js/client.min.js"}).catch(function(err){return Promise.reject(new BraintreeError({type:sharedErrors.CLIENT_SCRIPT_FAILED_TO_LOAD.type,code:sharedErrors.CLIENT_SCRIPT_FAILED_TO_LOAD.code,message:sharedErrors.CLIENT_SCRIPT_FAILED_TO_LOAD.message,details:{originalError:err}}))})),promise.then(function(){return window.braintree.client.VERSION!==VERSION?Promise.reject(new BraintreeError({type:sharedErrors.INCOMPATIBLE_VERSIONS.type,code:sharedErrors.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+window.braintree.client.VERSION+") and "+options.name+" (version "+VERSION+") components must be from the same SDK version."})):window.braintree.client.create({authorization:options.authorization,debug:options.debug})}))}var BraintreeError=_dereq_("./braintree-error"),Promise=_dereq_("./promise"),assets=_dereq_("./assets"),sharedErrors=_dereq_("./errors"),VERSION="3.69.0";module.exports={create:createDeferredClient}},{"./assets":125,"./braintree-error":129,"./errors":140,"./promise":161}],137:[function(_dereq_,module,exports){"use strict";module.exports=function(fn){return function(){var args=arguments;setTimeout(function(){fn.apply(null,args)},1)}}},{}],138:[function(_dereq_,module,exports){"use strict";function Destructor(){this._teardownRegistry=[],this._isTearingDown=!1}var batchExecuteFunctions=_dereq_("./batch-execute-functions");Destructor.prototype.registerFunctionForTeardown=function(fn){"function"==typeof fn&&this._teardownRegistry.push(fn)},Destructor.prototype.teardown=function(callback){if(this._isTearingDown)return void callback(new Error("Destructor is already tearing down"));this._isTearingDown=!0,batchExecuteFunctions(this._teardownRegistry,function(err){this._teardownRegistry=[],this._isTearingDown=!1,"function"==typeof callback&&callback(err)}.bind(this))},module.exports=Destructor},{"./batch-execute-functions":128}],139:[function(_dereq_,module,exports){"use strict";function enumerate(values,prefix){return prefix=null==prefix?"":prefix,values.reduce(function(enumeration,value){return enumeration[value]=prefix+value,enumeration},{})}module.exports=enumerate},{}],140:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("./braintree-error");module.exports={INVALID_USE_OF_INTERNAL_FUNCTION:{type:BraintreeError.types.INTERNAL,code:"INVALID_USE_OF_INTERNAL_FUNCTION"},INSTANTIATION_OPTION_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"INSTANTIATION_OPTION_REQUIRED"},INCOMPATIBLE_VERSIONS:{type:BraintreeError.types.MERCHANT,code:"INCOMPATIBLE_VERSIONS"},CLIENT_SCRIPT_FAILED_TO_LOAD:{type:BraintreeError.types.NETWORK,code:"CLIENT_SCRIPT_FAILED_TO_LOAD",message:"Braintree client script could not be loaded."},METHOD_CALLED_AFTER_TEARDOWN:{type:BraintreeError.types.MERCHANT,code:"METHOD_CALLED_AFTER_TEARDOWN"}}},{"./braintree-error":129}],141:[function(_dereq_,module,exports){"use strict";module.exports=function(element){for(;element.parentNode;)element=element.parentNode;return element}},{}],142:[function(_dereq_,module,exports){"use strict";module.exports=function(array,key,value){var i;for(i=0;i<array.length;i++)if(array[i].hasOwnProperty(key)&&array[i][key]===value)return array[i];return null}},{}],143:[function(_dereq_,module,exports){"use strict";function noop(){}function _validateFrameConfiguration(options){if(!options)throw new Error("Valid configuration is required");if(REQUIRED_CONFIG_KEYS.forEach(function(key){if(!options.hasOwnProperty(key))throw new Error("A valid frame "+key+" must be provided")}),!/^[\w_]+$/.test(options.name))throw new Error("A valid frame name must be provided")}function FrameService(options){_validateFrameConfiguration(options),this._serviceId=uuid().replace(/-/g,""),this._options={name:options.name+"_"+this._serviceId,dispatchFrameUrl:options.dispatchFrameUrl,openFrameUrl:options.openFrameUrl,height:options.height,width:options.width,top:options.top,left:options.left},this.state=options.state||{},this._bus=new Bus({channel:this._serviceId}),this._setBusEvents()}var Popup=_dereq_("./strategies/popup"),PopupBridge=_dereq_("./strategies/popup-bridge"),Modal=_dereq_("./strategies/modal"),Bus=_dereq_("framebus"),events=_dereq_("../shared/events"),errors=_dereq_("../shared/errors"),constants=_dereq_("../shared/constants"),uuid=_dereq_("@braintree/uuid"),iFramer=_dereq_("@braintree/iframer"),BraintreeError=_dereq_("../../braintree-error"),browserDetection=_dereq_("../shared/browser-detection"),isHTTPS=_dereq_("../../is-https"),assign=_dereq_("./../../assign").assign,BUS_CONFIGURATION_REQUEST_EVENT=_dereq_("../../constants").BUS_CONFIGURATION_REQUEST_EVENT,REQUIRED_CONFIG_KEYS=["name","dispatchFrameUrl","openFrameUrl"];FrameService.prototype.initialize=function(callback){var dispatchFrameReadyHandler=function(){callback(),this._bus.off(events.DISPATCH_FRAME_READY,dispatchFrameReadyHandler)}.bind(this);this._bus.on(events.DISPATCH_FRAME_READY,dispatchFrameReadyHandler),this._writeDispatchFrame()},FrameService.prototype._writeDispatchFrame=function(){var frameName=constants.DISPATCH_FRAME_NAME+"_"+this._serviceId,frameSrc=this._options.dispatchFrameUrl;this._dispatchFrame=iFramer({"aria-hidden":!0,name:frameName,title:frameName,src:frameSrc,class:constants.DISPATCH_FRAME_CLASS,height:0,width:0,style:{position:"absolute",left:"-9999px"}}),document.body.appendChild(this._dispatchFrame)},FrameService.prototype._setBusEvents=function(){this._bus.on(events.DISPATCH_FRAME_REPORT,function(res,reply){this._onCompleteCallback&&this._onCompleteCallback.call(null,res.err,res.payload),this._frame.close(),this._onCompleteCallback=null,reply&&reply()}.bind(this)),this._bus.on(BUS_CONFIGURATION_REQUEST_EVENT,function(reply){reply(this.state)}.bind(this))},FrameService.prototype.open=function(options,callback){var error;if(options=options||{},this._frame=this._getFrameForEnvironment(options),this._frame.initialize(callback),!(this._frame instanceof PopupBridge)){if(assign(this.state,options.state),this._onCompleteCallback=callback,this._frame.open(),this.isFrameClosed())return this._cleanupFrame(),void(callback&&(error=new BraintreeError(browserDetection.isIE()&&!isHTTPS.isHTTPS()?errors.FRAME_SERVICE_FRAME_OPEN_FAILED_IE_BUG:errors.FRAME_SERVICE_FRAME_OPEN_FAILED),callback(error)));this._pollForPopupClose()}},FrameService.prototype.redirect=function(url){this._frame&&!this.isFrameClosed()&&this._frame.redirect(url)},FrameService.prototype.close=function(){this.isFrameClosed()||this._frame.close()},FrameService.prototype.focus=function(){this.isFrameClosed()||this._frame.focus()},FrameService.prototype.createHandler=function(options){return options=options||{},{close:function(){options.beforeClose&&options.beforeClose(),this.close()}.bind(this),focus:function(){options.beforeFocus&&options.beforeFocus(),this.focus()}.bind(this)}},FrameService.prototype.createNoopHandler=function(){return{close:noop,focus:noop}},FrameService.prototype.teardown=function(){this.close(),this._dispatchFrame.parentNode.removeChild(this._dispatchFrame),this._dispatchFrame=null,this._cleanupFrame()},FrameService.prototype.isFrameClosed=function(){return null==this._frame||this._frame.isClosed()},FrameService.prototype._cleanupFrame=function(){this._frame=null,clearInterval(this._popupInterval),this._popupInterval=null},FrameService.prototype._pollForPopupClose=function(){return this._popupInterval=setInterval(function(){this.isFrameClosed()&&(this._cleanupFrame(),this._onCompleteCallback&&this._onCompleteCallback(new BraintreeError(errors.FRAME_SERVICE_FRAME_CLOSED)))}.bind(this),constants.POPUP_POLL_INTERVAL),this._popupInterval},FrameService.prototype._getFrameForEnvironment=function(options){var usePopup=browserDetection.supportsPopups(),popupBridgeExists=Boolean(window.popupBridge),initOptions=assign({},this._options,options);return popupBridgeExists?new PopupBridge(initOptions):usePopup?new Popup(initOptions):new Modal(initOptions)},module.exports=FrameService},{"../../braintree-error":129,"../../constants":131,"../../is-https":156,"../shared/browser-detection":150,"../shared/constants":151,"../shared/errors":152,"../shared/events":153,"./../../assign":126,"./strategies/modal":145,"./strategies/popup":148,"./strategies/popup-bridge":146,"@braintree/iframer":39,"@braintree/uuid":43,framebus:56}],144:[function(_dereq_,module,exports){"use strict";var FrameService=_dereq_("./frame-service");module.exports={create:function(options,callback){var frameService=new FrameService(options);frameService.initialize(function(){callback(frameService)})}}},{"./frame-service":143}],145:[function(_dereq_,module,exports){"use strict";function noop(){}function Modal(options){this._closed=null,this._frame=null,this._options=options||{},this._container=this._options.container||document.body}var iFramer=_dereq_("@braintree/iframer"),assign=_dereq_("../../../assign").assign,browserDetection=_dereq_("../../shared/browser-detection"),ELEMENT_STYLES={position:"fixed",top:0,left:0,bottom:0,padding:0,margin:0,border:0,outline:"none",zIndex:20001,background:"#FFFFFF"};Modal.prototype.initialize=noop,Modal.prototype.open=function(){var iframerConfig={src:this._options.openFrameUrl,name:this._options.name,scrolling:"yes",height:"100%",width:"100%",style:assign({},ELEMENT_STYLES),title:"Lightbox Frame"};browserDetection.isIos()?(browserDetection.isIosWKWebview()&&(this._lockScrolling(),iframerConfig.style={}),this._el=document.createElement("div"),assign(this._el.style,ELEMENT_STYLES,{height:"100%",width:"100%",overflow:"auto","-webkit-overflow-scrolling":"touch"}),this._frame=iFramer(iframerConfig),this._el.appendChild(this._frame)):this._el=this._frame=iFramer(iframerConfig),this._closed=!1,this._container.appendChild(this._el)},Modal.prototype.focus=noop,Modal.prototype.close=function(){this._container.removeChild(this._el),this._frame=null,this._closed=!0,browserDetection.isIosWKWebview()&&this._unlockScrolling()},Modal.prototype.isClosed=function(){return Boolean(this._closed)},Modal.prototype.redirect=function(redirectUrl){this._frame.src=redirectUrl},Modal.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},Modal.prototype._lockScrolling=function(){var doc=document.documentElement;this._savedBodyProperties={left:(window.pageXOffset||doc.scrollLeft)-(doc.clientLeft||0),top:(window.pageYOffset||doc.scrollTop)-(doc.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)},module.exports=Modal},{"../../../assign":126,"../../shared/browser-detection":150,"@braintree/iframer":39}],146:[function(_dereq_,module,exports){"use strict";function noop(){}function PopupBridge(options){this._closed=null,this._options=options}var BraintreeError=_dereq_("../../../braintree-error"),errors=_dereq_("../../shared/errors");PopupBridge.prototype.initialize=function(callback){var self=this;window.popupBridge.onComplete=function(err,payload){var popupDismissed=!payload&&!err;if(self._closed=!0,err||popupDismissed)return void callback(new BraintreeError(errors.FRAME_SERVICE_FRAME_CLOSED));callback(null,payload)}},PopupBridge.prototype.open=function(options){var url;options=options||{},url=options.openFrameUrl||this._options.openFrameUrl,this._closed=!1,window.popupBridge.open(url)},PopupBridge.prototype.focus=noop,PopupBridge.prototype.close=noop,PopupBridge.prototype.isClosed=function(){return Boolean(this._closed)},PopupBridge.prototype.redirect=function(redirectUrl){this.open({openFrameUrl:redirectUrl})},module.exports=PopupBridge},{"../../../braintree-error":129,"../../shared/errors":152}],147:[function(_dereq_,module,exports){"use strict";function calculatePosition(type,userDefinedPosition,size){return void 0!==userDefinedPosition?userDefinedPosition:position[type](size)}var constants=_dereq_("../../../shared/constants"),position=_dereq_("./position");module.exports=function(options){var height=options.height||constants.DEFAULT_POPUP_HEIGHT,width=options.width||constants.DEFAULT_POPUP_WIDTH,top=calculatePosition("top",options.top,height),left=calculatePosition("left",options.left,width);return[constants.POPUP_BASE_OPTIONS,"height="+height,"width="+width,"top="+top,"left="+left].join(",")}},{"../../../shared/constants":151,"./position":149}],148:[function(_dereq_,module,exports){"use strict";function noop(){}function Popup(options){this._frame=null,this._options=options||{},this.open()}var composeOptions=_dereq_("./compose-options");Popup.prototype.initialize=noop,Popup.prototype.open=function(){this._frame=window.open(this._options.openFrameUrl,this._options.name,composeOptions(this._options))},Popup.prototype.focus=function(){this._frame.focus()},Popup.prototype.close=function(){this._frame.closed||this._frame.close()},Popup.prototype.isClosed=function(){return!this._frame||Boolean(this._frame.closed)},Popup.prototype.redirect=function(redirectUrl){this._frame.location.href=redirectUrl},module.exports=Popup},{"./compose-options":147}],149:[function(_dereq_,module,exports){"use strict";function top(height){return center(window.outerHeight||document.documentElement.clientHeight,height,null==window.screenY?window.screenTop:window.screenY)}function left(width){return center(window.outerWidth||document.documentElement.clientWidth,width,null==window.screenX?window.screenLeft:window.screenX)}function center(windowMetric,popupMetric,offset){return(windowMetric-popupMetric)/2+offset}module.exports={top:top,left:left,center:center}},{}],150:[function(_dereq_,module,exports){"use strict";module.exports={isIos:_dereq_("@braintree/browser-detection/is-ios"),isIosWKWebview:_dereq_("@braintree/browser-detection/is-ios-wkwebview"),isIE:_dereq_("@braintree/browser-detection/is-ie"),supportsPopups:_dereq_("@braintree/browser-detection/supports-popups")}},{"@braintree/browser-detection/is-ie":26,"@braintree/browser-detection/is-ios":32,"@braintree/browser-detection/is-ios-wkwebview":31,"@braintree/browser-detection/supports-popups":35}],151:[function(_dereq_,module,exports){"use strict";module.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}},{}],152:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../../braintree-error");module.exports={FRAME_SERVICE_FRAME_CLOSED:{type:BraintreeError.types.INTERNAL,code:"FRAME_SERVICE_FRAME_CLOSED",message:"Frame closed before tokenization could occur."},FRAME_SERVICE_FRAME_OPEN_FAILED:{type:BraintreeError.types.INTERNAL,code:"FRAME_SERVICE_FRAME_OPEN_FAILED",message:"Frame failed to open."},FRAME_SERVICE_FRAME_OPEN_FAILED_IE_BUG:{type:BraintreeError.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":129}],153:[function(_dereq_,module,exports){"use strict";var enumerate=_dereq_("../../enumerate");module.exports=enumerate(["DISPATCH_FRAME_READY","DISPATCH_FRAME_REPORT"],"frameService:")},{"../../enumerate":139}],154:[function(_dereq_,module,exports){"use strict";function generateTokenizationParameters(configuration,overrides){var metadata=configuration.analyticsMetadata,basicTokenizationParameters={gateway:"braintree","braintree:merchantId":configuration.gatewayConfiguration.merchantId,"braintree:apiVersion":"v1","braintree:sdkVersion":VERSION,"braintree:metadata":JSON.stringify({source:metadata.source,integration:metadata.integration,sessionId:metadata.sessionId,version:VERSION,platform:metadata.platform})};return assign({},basicTokenizationParameters,overrides)}var VERSION="3.69.0",assign=_dereq_("./assign").assign;module.exports=function(configuration,googlePayVersion,googleMerchantId){var data,paypalPaymentMethod,androidPayConfiguration=configuration.gatewayConfiguration.androidPay,environment="production"===configuration.gatewayConfiguration.environment?"PRODUCTION":"TEST";return 2===googlePayVersion?(data={apiVersion:2,apiVersionMinor:0,environment:environment,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:androidPayConfiguration.supportedNetworks.map(function(card){return card.toUpperCase()})},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:generateTokenizationParameters(configuration,{"braintree:authorizationFingerprint":androidPayConfiguration.googleAuthorizationFingerprint})}}]},googleMerchantId&&(data.merchantInfo={merchantId:googleMerchantId}),androidPayConfiguration.paypalClientId&&(paypalPaymentMethod={type:"PAYPAL",parameters:{purchase_context:{purchase_units:[{payee:{client_id:androidPayConfiguration.paypalClientId},recurring_payment:!0}]}},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:generateTokenizationParameters(configuration,{"braintree:paypalClientId":androidPayConfiguration.paypalClientId})}},data.allowedPaymentMethods.push(paypalPaymentMethod))):(data={environment:environment,allowedPaymentMethods:["CARD","TOKENIZED_CARD"],paymentMethodTokenizationParameters:{tokenizationType:"PAYMENT_GATEWAY",parameters:generateTokenizationParameters(configuration,{"braintree:authorizationFingerprint":androidPayConfiguration.googleAuthorizationFingerprint})},cardRequirements:{allowedCardNetworks:androidPayConfiguration.supportedNetworks.map(function(card){return card.toUpperCase()})}},"TOKENIZATION_KEY"===configuration.authorizationType&&(data.paymentMethodTokenizationParameters.parameters["braintree:clientKey"]=configuration.authorization),googleMerchantId&&(data.merchantId=googleMerchantId),googlePayVersion&&(data.apiVersion=googlePayVersion)),data}},{"./assign":126}],155:[function(_dereq_,module,exports){"use strict";function convertDateStringToDate(dateString){var splitDate=dateString.split("-");return new Date(splitDate[0],splitDate[1],splitDate[2])}function isDateStringBeforeOrOn(firstDate,secondDate){return convertDateStringToDate(firstDate)<=convertDateStringToDate(secondDate)}module.exports=isDateStringBeforeOrOn},{}],156:[function(_dereq_,module,exports){"use strict";function isHTTPS(protocol){return"https:"===(protocol=protocol||window.location.protocol)}module.exports={isHTTPS:isHTTPS}},{}],157:[function(_dereq_,module,exports){"use strict";function stripSubdomains(domain){return domain.split(".").slice(-2).join(".")}function isVerifiedDomain(url){var mainDomain;return url=url.toLowerCase(),!!/^https:/.test(url)&&(parser=parser||document.createElement("a"),parser.href=url,mainDomain=stripSubdomains(parser.hostname),legalHosts.hasOwnProperty(mainDomain))}var parser,legalHosts={"paypal.com":1,"braintreepayments.com":1,"braintreegateway.com":1,"braintree-api.com":1};module.exports=isVerifiedDomain},{}],158:[function(_dereq_,module,exports){"use strict";module.exports=function(value){return JSON.parse(JSON.stringify(value))}},{}],159:[function(_dereq_,module,exports){"use strict";module.exports=function(obj){return Object.keys(obj).filter(function(key){return"function"==typeof obj[key]})}},{}],160:[function(_dereq_,module,exports){"use strict";function once(fn){var called=!1;return function(){called||(called=!0,fn.apply(null,arguments))}}module.exports=once},{}],161:[function(_dereq_,module,exports){"use strict";var PromisePolyfill=_dereq_("promise-polyfill"),ExtendedPromise=_dereq_("@braintree/extended-promise"),PromiseGlobal="undefined"!=typeof Promise?Promise:PromisePolyfill;ExtendedPromise.suppressUnhandledPromiseMessage=!0,ExtendedPromise.setPromise(PromiseGlobal),module.exports=PromiseGlobal},{"@braintree/extended-promise":38,"promise-polyfill":69}],162:[function(_dereq_,module,exports){"use strict";function _notEmpty(obj){var key;for(key in obj)if(obj.hasOwnProperty(key))return!0;return!1}function _isArray(value){return value&&"object"==typeof value&&"number"==typeof value.length&&"[object Array]"===Object.prototype.toString.call(value)||!1}function parse(url){var query;return url=url||window.location.href,/\?/.test(url)?(query=url.replace(/#.*$/,"").replace(/^.*\?/,"").split("&"),query.reduce(function(toReturn,keyValue){var parts=keyValue.split("="),key=decodeURIComponent(parts[0]),value=decodeURIComponent(parts[1]);return toReturn[key]=value,toReturn},{})):{}}function stringify(params,namespace){var k,v,p,query=[];for(p in params)params.hasOwnProperty(p)&&(v=params[p],k=namespace?_isArray(params)?namespace+"[]":namespace+"["+p+"]":p,"object"==typeof v?query.push(stringify(v,k)):query.push(encodeURIComponent(k)+"="+encodeURIComponent(v)));return query.join("&")}function queryify(url,params){return url=url||"",null!=params&&"object"==typeof params&&_notEmpty(params)&&(url+=-1===url.indexOf("?")?"?":"",url+=-1!==url.indexOf("=")?"&":"",url+=stringify(params)),url}module.exports={parse:parse,stringify:stringify,queryify:queryify}},{}],163:[function(_dereq_,module,exports){"use strict";function isShadowElement(element){return element=findRootNode(element),"[object ShadowRoot]"===element.toString()}function getShadowHost(element){return element=findRootNode(element),isShadowElement(element)?element.host:null}function transformToSlot(element,styles){var styleNode=findRootNode(element).querySelector("style"),shadowHost=getShadowHost(element),slotName="shadow-slot-"+uuid(),slot=document.createElement("slot"),slotProvider=document.createElement("div");return slot.setAttribute("name",slotName),element.appendChild(slot),slotProvider.setAttribute("slot",slotName),shadowHost.appendChild(slotProvider),styles&&(styleNode||(styleNode=document.createElement("style"),element.appendChild(styleNode)),styleNode.sheet.insertRule('::slotted([slot="'+slotName+'"]) { '+styles+" }")),slotProvider}var uuid=_dereq_("@braintree/uuid"),findRootNode=_dereq_("./find-root-node");module.exports={isShadowElement:isShadowElement,getShadowHost:getShadowHost,transformToSlot:transformToSlot}},{"./find-root-node":141,"@braintree/uuid":43}],164:[function(_dereq_,module,exports){"use strict";function useMin(isDebug){return isDebug?"":".min"}module.exports=useMin},{}],165:[function(_dereq_,module,exports){"use strict";function atobPolyfill(base64String){var a,b,c,b1,b2,b3,b4,i,base64Matcher=new RegExp("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})([=]{1,2})?$"),characters="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",result="";if(!base64Matcher.test(base64String))throw new Error("Non base64 encoded input passed to window.atob polyfill");i=0;do{b1=characters.indexOf(base64String.charAt(i++)),b2=characters.indexOf(base64String.charAt(i++)),b3=characters.indexOf(base64String.charAt(i++)),b4=characters.indexOf(base64String.charAt(i++)),a=(63&b1)<<2|b2>>4&3,b=(15&b2)<<4|b3>>2&15,c=(3&b3)<<6|63&b4,result+=String.fromCharCode(a)+(b?String.fromCharCode(b):"")+(c?String.fromCharCode(c):"")}while(i<base64String.length);return result}var atobNormalized="function"==typeof atob?window.atob:atobPolyfill;module.exports={atob:function(base64String){return atobNormalized.call(window,base64String)},_atob:atobPolyfill}},{}],166:[function(_dereq_,module,exports){"use strict";module.exports={REQUIRED_OPTIONS_FOR_START_PAYMENT:["onPaymentStart","paymentType","amount","fallback"]}
},{}],167:[function(_dereq_,module,exports){"use strict";function LocalPayment(options){this._client=options.client,this._assetsUrl=options.client.getConfiguration().gatewayConfiguration.assetsUrl+"/web/"+VERSION,this._isDebug=options.client.getConfiguration().isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/local-payment-landing-frame"+useMin(this._isDebug)+".html",this._authorizationInProgress=!1,this._paymentType="unknown",this._merchantAccountId=options.merchantAccountId}function hasMissingOption(options){var i,option;if(!options)return!0;for(i=0;i<constants.REQUIRED_OPTIONS_FOR_START_PAYMENT.length;i++)if(option=constants.REQUIRED_OPTIONS_FOR_START_PAYMENT[i],!options.hasOwnProperty(option))return!0;return!options.fallback.url||!options.fallback.buttonText}var frameService=_dereq_("../../lib/frame-service/external"),BraintreeError=_dereq_("../../lib/braintree-error"),useMin=_dereq_("../../lib/use-min"),VERSION="3.69.0",INTEGRATION_TIMEOUT_MS=_dereq_("../../lib/constants").INTEGRATION_TIMEOUT_MS,analytics=_dereq_("../../lib/analytics"),methods=_dereq_("../../lib/methods"),convertMethodsToError=_dereq_("../../lib/convert-methods-to-error"),convertToBraintreeError=_dereq_("../../lib/convert-to-braintree-error"),Promise=_dereq_("../../lib/promise"),querystring=_dereq_("../../lib/querystring"),wrapPromise=_dereq_("@braintree/wrap-promise"),constants=_dereq_("./constants"),errors=_dereq_("../shared/errors");LocalPayment.prototype._initialize=function(){var self=this,client=this._client,failureTimeout=setTimeout(function(){analytics.sendEvent(client,"local-payment.load.timed-out")},INTEGRATION_TIMEOUT_MS);return new Promise(function(resolve){frameService.create({name:"localpaymentlandingpage",dispatchFrameUrl:self._assetsUrl+"/html/dispatch-frame"+useMin(self._isDebug)+".html",openFrameUrl:self._loadingFrameUrl},function(service){self._frameService=service,clearTimeout(failureTimeout),analytics.sendEvent(client,"local-payment.load.succeeded"),resolve(self)})})},LocalPayment.prototype.startPayment=function(options){var address,params,self=this,serviceId=this._frameService._serviceId;return hasMissingOption(options)?Promise.reject(new BraintreeError(errors.LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION)):(address=options.address||{},params={intent:"sale",returnUrl:querystring.queryify(self._assetsUrl+"/html/local-payment-redirect-frame"+useMin(self._isDebug)+".html",{channel:serviceId,r:options.fallback.url,t:options.fallback.buttonText}),cancelUrl:querystring.queryify(self._assetsUrl+"/html/cancel-frame"+useMin(self._isDebug)+".html",{channel:serviceId}),experienceProfile:{noShipping:!options.shippingAddressRequired},fundingSource:options.paymentType,amount:options.amount,currencyIsoCode:options.currencyCode,firstName:options.givenName,lastName:options.surname,payerEmail:options.email,phone:options.phone,line1:address.streetAddress,line2:address.extendedAddress,city:address.locality,state:address.region,postalCode:address.postalCode,countryCode:address.countryCode,merchantAccountId:self._merchantAccountId},self._paymentType=options.paymentType.toLowerCase(),self._authorizationInProgress?(analytics.sendEvent(self._client,self._paymentType+".local-payment.start-payment.error.already-opened"),Promise.reject(new BraintreeError(errors.LOCAL_PAYMENT_ALREADY_IN_PROGRESS))):(self._authorizationInProgress=!0,new Promise(function(resolve,reject){self._startPaymentCallback=self._createStartPaymentCallback(resolve,reject),self._frameService.open({},self._startPaymentCallback),self._client.request({method:"post",endpoint:"local_payments/create",data:params}).then(function(response){analytics.sendEvent(self._client,self._paymentType+".local-payment.start-payment.opened"),self._startPaymentOptions=options,options.onPaymentStart({paymentId:response.paymentResource.paymentToken},function(){self._frameService.redirect(response.paymentResource.redirectUrl)})}).catch(function(err){var status=err.details&&err.details.httpStatus;if(self._frameService.close(),self._authorizationInProgress=!1,422===status)return void reject(new BraintreeError({type:errors.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.type,code:errors.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.code,message:errors.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.message,details:{originalError:err}}));reject(convertToBraintreeError(err,{type:errors.LOCAL_PAYMENT_START_PAYMENT_FAILED.type,code:errors.LOCAL_PAYMENT_START_PAYMENT_FAILED.code,message:errors.LOCAL_PAYMENT_START_PAYMENT_FAILED.message}))})})))},LocalPayment.prototype.tokenize=function(params){var self=this,client=this._client;return params=params||querystring.parse(),client.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:this._formatTokenizeData(params)}).then(function(response){var payload=self._formatTokenizePayload(response);return window.popupBridge?analytics.sendEvent(client,self._paymentType+".local-payment.tokenization.success-popupbridge"):analytics.sendEvent(client,self._paymentType+".local-payment.tokenization.success"),payload}).catch(function(err){return analytics.sendEvent(client,self._paymentType+".local-payment.tokenization.failed"),Promise.reject(convertToBraintreeError(err,{type:errors.LOCAL_PAYMENT_TOKENIZATION_FAILED.type,code:errors.LOCAL_PAYMENT_TOKENIZATION_FAILED.code,message:errors.LOCAL_PAYMENT_TOKENIZATION_FAILED.message}))})},LocalPayment.prototype.closeWindow=function(){this._authoriztionInProgress&&analytics.sendEvent(this._client,this._paymentType+".local-payment.start-payment.closed.by-merchant"),this._frameService.close()},LocalPayment.prototype.focusWindow=function(){this._frameService.focus()},LocalPayment.prototype._createStartPaymentCallback=function(resolve,reject){var self=this,client=this._client;return function(err,params){self._authorizationInProgress=!1,err?"FRAME_SERVICE_FRAME_CLOSED"===err.code?(analytics.sendEvent(client,self._paymentType+".local-payment.tokenization.closed.by-user"),reject(new BraintreeError(errors.LOCAL_PAYMENT_WINDOW_CLOSED))):err.code&&err.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1&&reject(new BraintreeError({code:errors.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.code,type:errors.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.type,message:errors.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.message,details:{originalError:err}})):params&&(window.popupBridge||self._frameService.redirect(self._loadingFrameUrl),self.tokenize(params).then(resolve).catch(reject).then(function(){self._frameService.close()}))}},LocalPayment.prototype._formatTokenizePayload=function(response){var payload,account={};return response.paypalAccounts&&(account=response.paypalAccounts[0]),payload={nonce:account.nonce,details:{},type:account.type},account.details&&(account.details.payerInfo&&(payload.details=account.details.payerInfo),account.details.correlationId&&(payload.correlationId=account.details.correlationId)),payload},LocalPayment.prototype.hasTokenizationParams=function(){var params=querystring.parse();return Boolean(params.btLpToken&¶ms.btLpPaymentId&¶ms.btLpPayerId)},LocalPayment.prototype._formatTokenizeData=function(params){var clientConfiguration=this._client.getConfiguration(),gatewayConfiguration=clientConfiguration.gatewayConfiguration;return{merchantAccountId:this._merchantAccountId,paypalAccount:{correlationId:params.btLpToken||params.token,paymentToken:params.btLpPaymentId||params.paymentId,payerId:params.btLpPayerId||params.PayerID,unilateral:gatewayConfiguration.paypal.unvettedMerchant,intent:"sale"}}},LocalPayment.prototype.teardown=function(){var self=this;return self._frameService.teardown(),convertMethodsToError(self,methods(LocalPayment.prototype)),analytics.sendEvent(self._client,"local-payment.teardown-completed"),Promise.resolve()},module.exports=wrapPromise.wrapPrototype(LocalPayment)},{"../../lib/analytics":124,"../../lib/braintree-error":129,"../../lib/constants":131,"../../lib/convert-methods-to-error":132,"../../lib/convert-to-braintree-error":133,"../../lib/frame-service/external":144,"../../lib/methods":159,"../../lib/promise":161,"../../lib/querystring":162,"../../lib/use-min":164,"../shared/errors":169,"./constants":166,"@braintree/wrap-promise":47}],168:[function(_dereq_,module,exports){"use strict";function create(options){var name="Local Payment";return basicComponentVerification.verify({name:name,client:options.client,authorization:options.authorization}).then(function(){return createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:name})}).then(function(client){var localPaymentInstance,config=client.getConfiguration();return options.client=client,!0!==config.gatewayConfiguration.paypalEnabled?Promise.reject(new BraintreeError(errors.LOCAL_PAYMENT_NOT_ENABLED)):(analytics.sendEvent(client,"local-payment.initialized"),localPaymentInstance=new LocalPayment(options),localPaymentInstance._initialize())})}var analytics=_dereq_("../lib/analytics"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),LocalPayment=_dereq_("./external/local-payment"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),BraintreeError=_dereq_("../lib/braintree-error"),errors=_dereq_("./shared/errors");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/analytics":124,"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"./external/local-payment":167,"./shared/errors":169,"@braintree/wrap-promise":47}],169:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../../lib/braintree-error");module.exports={LOCAL_PAYMENT_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"LOCAL_PAYMENT_NOT_ENABLED",message:"LocalPayment is not enabled for this merchant."},LOCAL_PAYMENT_ALREADY_IN_PROGRESS:{type:BraintreeError.types.MERCHANT,code:"LOCAL_PAYMENT_ALREADY_IN_PROGRESS",message:"LocalPayment payment is already in progress."},LOCAL_PAYMENT_WINDOW_CLOSED:{type:BraintreeError.types.CUSTOMER,code:"LOCAL_PAYMENT_WINDOW_CLOSED",message:"Customer closed LocalPayment window before authorizing."},LOCAL_PAYMENT_WINDOW_OPEN_FAILED:{type:BraintreeError.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:BraintreeError.types.NETWORK,code:"LOCAL_PAYMENT_START_PAYMENT_FAILED",message:"LocalPayment startPayment failed."},LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION:{type:BraintreeError.types.MERCHANT,code:"LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION",message:"Missing required option for startPayment."},LOCAL_PAYMENT_TOKENIZATION_FAILED:{type:BraintreeError.types.NETWORK,code:"LOCAL_PAYMENT_TOKENIZATION_FAILED",message:"Could not tokenize user's local payment method."},LOCAL_PAYMENT_INVALID_PAYMENT_OPTION:{type:BraintreeError.types.MERCHANT,code:"LOCAL_PAYMENT_INVALID_PAYMENT_OPTION",message:"Local payment options are invalid."}}},{"../../lib/braintree-error":129}],170:[function(_dereq_,module,exports){"use strict";function Masterpass(options){var configuration=options.client.getConfiguration();this._client=options.client,this._assetsUrl=configuration.gatewayConfiguration.assetsUrl+"/web/"+VERSION,this._isDebug=configuration.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"}function isMissingRequiredPayload(payload){return[payload.oauth_verifier,payload.oauth_token,payload.checkout_resource_url].some(function(element){return null==element||"null"===element})}function hasMissingOption(options){var i,option;for(i=0;i<constants.REQUIRED_OPTIONS_FOR_TOKENIZE.length;i++)if(option=constants.REQUIRED_OPTIONS_FOR_TOKENIZE[i],!options.hasOwnProperty(option))return!0;return!1}var Promise=_dereq_("../../lib/promise"),frameService=_dereq_("../../lib/frame-service/external"),BraintreeError=_dereq_("../../lib/braintree-error"),errors=_dereq_("../shared/errors"),VERSION="3.69.0",methods=_dereq_("../../lib/methods"),wrapPromise=_dereq_("@braintree/wrap-promise"),analytics=_dereq_("../../lib/analytics"),convertMethodsToError=_dereq_("../../lib/convert-methods-to-error"),convertToBraintreeError=_dereq_("../../lib/convert-to-braintree-error"),constants=_dereq_("../shared/constants"),INTEGRATION_TIMEOUT_MS=_dereq_("../../lib/constants").INTEGRATION_TIMEOUT_MS;Masterpass.prototype._initialize=function(){var self=this;return new Promise(function(resolve){var failureTimeout=setTimeout(function(){analytics.sendEvent(self._client,"masterpass.load.timed-out")},INTEGRATION_TIMEOUT_MS);frameService.create({name:constants.LANDING_FRAME_NAME,height:constants.POPUP_HEIGHT,width:constants.POPUP_WIDTH,dispatchFrameUrl:self._assetsUrl+"/html/dispatch-frame"+(self._isDebug?"":".min")+".html",openFrameUrl:self._assetsUrl+"/html/masterpass-landing-frame"+(self._isDebug?"":".min")+".html"},function(service){self._frameService=service,clearTimeout(failureTimeout),analytics.sendEvent(self._client,"masterpass.load.succeeded"),resolve(self)})})},Masterpass.prototype.tokenize=function(options){var self=this;return!options||hasMissingOption(options)?Promise.reject(new BraintreeError(errors.MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION)):self._authInProgress?Promise.reject(new BraintreeError(errors.MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS)):new Promise(function(resolve,reject){self._navigateFrameToLoadingPage(options).catch(reject),self._frameService.open(options.frameOptions,self._createFrameOpenHandler(resolve,reject))})},Masterpass.prototype._navigateFrameToLoadingPage=function(options){var self=this;return this._authInProgress=!0,this._client.request({method:"post",endpoint:"masterpass/request_token",data:{requestToken:{originUrl:window.location.protocol+"//"+window.location.hostname,subtotal:options.subtotal,currencyCode:options.currencyCode,callbackUrl:this._callbackUrl}}}).then(function(response){var queryParams,redirectUrl=self._assetsUrl+"/html/masterpass-loading-frame"+(self._isDebug?"":".min")+".html?",gatewayConfiguration=self._client.getConfiguration().gatewayConfiguration,config=options.config||{};queryParams={environment:gatewayConfiguration.environment,requestToken:response.requestToken,callbackUrl:self._callbackUrl,merchantCheckoutId:gatewayConfiguration.masterpass.merchantCheckoutId,allowedCardTypes:gatewayConfiguration.masterpass.supportedNetworks,version:constants.MASTERPASS_VERSION},Object.keys(config).forEach(function(key){"function"!=typeof config[key]&&(queryParams[key]=config[key])}),redirectUrl+=Object.keys(queryParams).map(function(key){return key+"="+queryParams[key]}).join("&"),self._frameService.redirect(redirectUrl)}).catch(function(err){var status=err.details&&err.details.httpStatus;return self._closeWindow(),422===status?Promise.reject(convertToBraintreeError(err,errors.MASTERPASS_INVALID_PAYMENT_OPTION)):Promise.reject(convertToBraintreeError(err,errors.MASTERPASS_FLOW_FAILED))})},Masterpass.prototype._createFrameOpenHandler=function(resolve,reject){var self=this;return window.popupBridge?function(popupBridgeErr,payload){return self._authInProgress=!1,popupBridgeErr?(analytics.sendEvent(self._client,"masterpass.tokenization.closed-popupbridge.by-user"),void reject(convertToBraintreeError(popupBridgeErr,errors.MASTERPASS_POPUP_CLOSED))):payload.queryItems?void self._tokenizeMasterpass(payload.queryItems).then(resolve).catch(reject):(analytics.sendEvent(self._client,"masterpass.tokenization.failed-popupbridge"),void reject(new BraintreeError(errors.MASTERPASS_FLOW_FAILED)))}:function(frameServiceErr,payload){if(frameServiceErr)return self._authInProgress=!1,"FRAME_SERVICE_FRAME_CLOSED"===frameServiceErr.code?(analytics.sendEvent(self._client,"masterpass.tokenization.closed.by-user"),void reject(new BraintreeError(errors.MASTERPASS_POPUP_CLOSED))):frameServiceErr.code&&frameServiceErr.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1?(analytics.sendEvent(self._client,"masterpass.tokenization.failed.to-open"),void reject(new BraintreeError({code:errors.MASTERPASS_POPUP_OPEN_FAILED.code,type:errors.MASTERPASS_POPUP_OPEN_FAILED.type,message:errors.MASTERPASS_POPUP_OPEN_FAILED.message,details:{originalError:frameServiceErr}}))):(analytics.sendEvent(self._client,"masterpass.tokenization.failed"),self._closeWindow(),void reject(convertToBraintreeError(frameServiceErr,errors.MASTERPASS_FLOW_FAILED)));self._tokenizeMasterpass(payload).then(resolve).catch(reject)}},Masterpass.prototype._tokenizeMasterpass=function(payload){var self=this;return"success"!==payload.mpstatus?(analytics.sendEvent(self._client,"masterpass.tokenization.closed.by-user"),self._closeWindow(),Promise.reject(new BraintreeError(errors.MASTERPASS_POPUP_CLOSED))):isMissingRequiredPayload(payload)?(analytics.sendEvent(self._client,"masterpass.tokenization.closed.missing-payload"),self._closeWindow(),Promise.reject(new BraintreeError(errors.MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS))):self._client.request({endpoint:"payment_methods/masterpass_cards",method:"post",data:{masterpassCard:{checkoutResourceUrl:payload.checkout_resource_url,requestToken:payload.oauth_token,verifierToken:payload.oauth_verifier}}}).then(function(response){return self._closeWindow(),window.popupBridge?analytics.sendEvent(self._client,"masterpass.tokenization.success-popupbridge"):analytics.sendEvent(self._client,"masterpass.tokenization.success"),response.masterpassCards[0]}).catch(function(tokenizeErr){return self._closeWindow(),window.popupBridge?analytics.sendEvent(self._client,"masterpass.tokenization.failed-popupbridge"):analytics.sendEvent(self._client,"masterpass.tokenization.failed"),Promise.reject(convertToBraintreeError(tokenizeErr,errors.MASTERPASS_ACCOUNT_TOKENIZATION_FAILED))})},Masterpass.prototype._closeWindow=function(){this._authInProgress=!1,this._frameService.close()},Masterpass.prototype.teardown=function(){var self=this;return new Promise(function(resolve){self._frameService.teardown(),convertMethodsToError(self,methods(Masterpass.prototype)),analytics.sendEvent(self._client,"masterpass.teardown-completed"),resolve()})},module.exports=wrapPromise.wrapPrototype(Masterpass)},{"../../lib/analytics":124,"../../lib/braintree-error":129,"../../lib/constants":131,"../../lib/convert-methods-to-error":132,"../../lib/convert-to-braintree-error":133,"../../lib/frame-service/external":144,"../../lib/methods":159,"../../lib/promise":161,"../shared/constants":173,"../shared/errors":174,"@braintree/wrap-promise":47}],171:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"Masterpass",client:options.client,authorization:options.authorization}).then(function(){return isSupported()?Promise.resolve():Promise.reject(new BraintreeError(errors.MASTERPASS_BROWSER_NOT_SUPPORTED))}).then(function(){return createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:"Masterpass"})}).then(function(client){var masterpassInstance,configuration;return options.client=client,configuration=options.client.getConfiguration().gatewayConfiguration,configuration.masterpass?(masterpassInstance=new Masterpass(options),masterpassInstance._initialize()):Promise.reject(new BraintreeError(errors.MASTERPASS_NOT_ENABLED))})}function isSupported(){return Boolean(window.popupBridge||browserDetection.supportsPopups())}var BraintreeError=_dereq_("../lib/braintree-error"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),browserDetection=_dereq_("./shared/browser-detection"),Masterpass=_dereq_("./external/masterpass"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),errors=_dereq_("./shared/errors"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise");module.exports={create:wrapPromise(create),isSupported:isSupported,VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"./external/masterpass":170,"./shared/browser-detection":172,"./shared/errors":174,"@braintree/wrap-promise":47}],172:[function(_dereq_,module,exports){"use strict";module.exports={supportsPopups:_dereq_("@braintree/browser-detection/supports-popups")}},{"@braintree/browser-detection/supports-popups":35}],173:[function(_dereq_,module,exports){"use strict";module.exports={LANDING_FRAME_NAME:"braintreemasterpasslanding",POPUP_WIDTH:450,POPUP_HEIGHT:660,MASTERPASS_VERSION:"v6",REQUIRED_OPTIONS_FOR_TOKENIZE:["subtotal","currencyCode"]}},{}],174:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../../lib/braintree-error");module.exports={MASTERPASS_BROWSER_NOT_SUPPORTED:{type:BraintreeError.types.CUSTOMER,code:"MASTERPASS_BROWSER_NOT_SUPPORTED",message:"Browser is not supported."},MASTERPASS_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"MASTERPASS_NOT_ENABLED",message:"Masterpass is not enabled for this merchant."},MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION:{type:BraintreeError.types.MERCHANT,code:"MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION",message:"Missing required option for tokenize."},MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS:{type:BraintreeError.types.MERCHANT,code:"MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS",message:"Masterpass tokenization is already in progress."},MASTERPASS_ACCOUNT_TOKENIZATION_FAILED:{type:BraintreeError.types.NETWORK,code:"MASTERPASS_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's Masterpass account."},MASTERPASS_POPUP_OPEN_FAILED:{type:BraintreeError.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:BraintreeError.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:BraintreeError.types.CUSTOMER,code:"MASTERPASS_POPUP_CLOSED",message:"Customer closed Masterpass popup before authorizing."},MASTERPASS_INVALID_PAYMENT_OPTION:{type:BraintreeError.types.MERCHANT,code:"MASTERPASS_INVALID_PAYMENT_OPTION",message:"Masterpass payment options are invalid."},MASTERPASS_FLOW_FAILED:{type:BraintreeError.types.NETWORK,code:"MASTERPASS_FLOW_FAILED",message:"Could not initialize Masterpass flow."}}},{"../../lib/braintree-error":129}],175:[function(_dereq_,module,exports){"use strict";function composeUrl(assetsUrl,componentId,isDebug){return assetsUrl+"/web/"+VERSION+"/html/payment-request-frame"+useMin(isDebug)+".html#"+componentId}function PaymentRequestComponent(options){var enabledPaymentMethods=options.enabledPaymentMethods||{};EventEmitter.call(this),this._componentId=uuid(),this._client=options.client,this._enabledPaymentMethods={basicCard:!1!==enabledPaymentMethods.basicCard,googlePay:!1!==enabledPaymentMethods.googlePay},this._googlePayVersion=2===options.googlePayVersion?2:1,this._googleMerchantId=BRAINTREE_GOOGLE_PAY_MERCHANT_ID,this._supportedPaymentMethods=this._constructDefaultSupportedPaymentMethods(),this._defaultSupportedPaymentMethods=Object.keys(this._supportedPaymentMethods).map(function(key){return this._supportedPaymentMethods[key]}.bind(this)),this._bus=new Bus({channel:this._componentId})}var analytics=_dereq_("../../lib/analytics"),assign=_dereq_("../../lib/assign").assign,Bus=_dereq_("framebus"),convertMethodsToError=_dereq_("../../lib/convert-methods-to-error"),generateGooglePayConfiguration=_dereq_("../../lib/generate-google-pay-configuration"),iFramer=_dereq_("@braintree/iframer"),uuid=_dereq_("@braintree/uuid"),useMin=_dereq_("../../lib/use-min"),methods=_dereq_("../../lib/methods"),Promise=_dereq_("../../lib/promise"),EventEmitter=_dereq_("@braintree/event-emitter"),BraintreeError=_dereq_("../../lib/braintree-error"),VERSION="3.69.0",constants=_dereq_("../shared/constants"),events=constants.events,errors=constants.errors,wrapPromise=_dereq_("@braintree/wrap-promise"),CARD_TYPE_MAPPINGS={Visa:"visa",MasterCard:"mastercard","American Express":"amex","Diners Club":"diners",Discover:"discover",JCB:"jcb",UnionPay:"unionpay",Maestro:"maestro"},BRAINTREE_GOOGLE_PAY_MERCHANT_ID="18278000977346790994";EventEmitter.createChild(PaymentRequestComponent),PaymentRequestComponent.prototype._constructDefaultSupportedPaymentMethods=function(){var configuration=this._client.getConfiguration(),androidPayConfiguration=configuration.gatewayConfiguration.androidPay,cardConfiguration=configuration.gatewayConfiguration.creditCards,supportedPaymentMethods={};return this._enabledPaymentMethods.basicCard&&cardConfiguration&&cardConfiguration.supportedCardTypes.length>0&&(supportedPaymentMethods.basicCard={supportedMethods:"basic-card",data:{supportedNetworks:cardConfiguration.supportedCardTypes.reduce(function(types,cardType){return cardType in CARD_TYPE_MAPPINGS&&types.push(CARD_TYPE_MAPPINGS[cardType]),types},[])}}),this._enabledPaymentMethods.googlePay&&androidPayConfiguration&&androidPayConfiguration.enabled&&(supportedPaymentMethods.googlePay={supportedMethods:"https://google.com/pay",data:generateGooglePayConfiguration(configuration,this._googlePayVersion,this._googleMerchantId)}),supportedPaymentMethods},PaymentRequestComponent.prototype.initialize=function(){var clientConfiguration=this._client.getConfiguration(),self=this;return this._frame=iFramer({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?Promise.reject(new BraintreeError(errors.PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS)):new Promise(function(resolve){self._bus.on(events.FRAME_READY,function(reply){reply(self._client)}),self._bus.on(events.FRAME_CAN_MAKE_REQUESTS,function(){analytics.sendEvent(self._client,"payment-request.initialized"),self._bus.on(events.SHIPPING_ADDRESS_CHANGE,function(shippingAddress){var shippingAddressChangeEvent={target:{shippingAddress:shippingAddress},updateWith:function(paymentDetails){self._bus.emit(events.UPDATE_SHIPPING_ADDRESS,paymentDetails)}};self._emit("shippingAddressChange",shippingAddressChangeEvent),self._emit("shippingaddresschange",shippingAddressChangeEvent)}),self._bus.on(events.SHIPPING_OPTION_CHANGE,function(shippingOption){var shippingOptionChangeEvent={target:{shippingOption:shippingOption},updateWith:function(paymentDetails){self._bus.emit(events.UPDATE_SHIPPING_OPTION,paymentDetails)}};self._emit("shippingOptionChange",shippingOptionChangeEvent),self._emit("shippingoptionchange",shippingOptionChangeEvent)}),resolve(self)}),self._frame.src=composeUrl(clientConfiguration.gatewayConfiguration.assetsUrl,self._componentId,clientConfiguration.isDebug),document.body.appendChild(self._frame)})},PaymentRequestComponent.prototype.createSupportedPaymentMethodsConfiguration=function(type,overrides){var configuration;if(!type)throw new BraintreeError(errors.PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE);if(!this._enabledPaymentMethods[type])throw new BraintreeError(errors.PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED);return configuration=assign({},this._supportedPaymentMethods[type]),configuration.data=assign({},configuration.data,overrides),configuration},PaymentRequestComponent.prototype.tokenize=function(configuration){var self=this;return new Promise(function(resolve,reject){self._bus.emit(events.PAYMENT_REQUEST_INITIALIZED,{supportedPaymentMethods:configuration.supportedPaymentMethods||self._defaultSupportedPaymentMethods,details:configuration.details,options:configuration.options},function(response){var rawError=response[0],payload=response[1];if(rawError)return void reject(self._formatTokenizationError(rawError));analytics.sendEvent(self._client,"payment-request.tokenize.succeeded"),resolve({nonce:payload.nonce,type:payload.type,description:payload.description,details:{rawPaymentResponse:payload.details.rawPaymentResponse,cardType:payload.details.cardType,lastFour:payload.details.lastFour,lastTwo:payload.details.lastTwo},binData:payload.binData})})})},PaymentRequestComponent.prototype.canMakePayment=function(configuration){var unsupportedPaymentMethod,self=this;return window.PaymentRequest?configuration.supportedPaymentMethods&&(configuration.supportedPaymentMethods.forEach(function(config){var supportedMethods=config.supportedMethods;supportedMethods in constants.SUPPORTED_METHODS||(unsupportedPaymentMethod=supportedMethods)}),unsupportedPaymentMethod)?Promise.reject(new BraintreeError({type:errors.PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD.type,code:errors.PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD.code,message:unsupportedPaymentMethod+" is not a supported payment method."})):new Promise(function(resolve,reject){self._bus.emit(events.CAN_MAKE_PAYMENT,{supportedPaymentMethods:configuration.supportedPaymentMethods||self._defaultSupportedPaymentMethods,details:configuration.details,options:configuration.options},function(response){var error=response[0],payload=response[1];if(error)return void reject(self._formatCanMakePaymentError(error));analytics.sendEvent(self._client,"payment-request.can-make-payment."+payload),resolve(payload)})}):(analytics.sendEvent(self._client,"payment-request.can-make-payment.not-available"),Promise.resolve(!1))},PaymentRequestComponent.prototype.teardown=function(){return this._bus.teardown(),this._frame.parentNode.removeChild(this._frame),convertMethodsToError(this,methods(PaymentRequestComponent.prototype)),analytics.sendEvent(this._client,"payment-request.teardown-completed"),Promise.resolve()},PaymentRequestComponent.prototype._formatTokenizationError=function(error){var formattedError;switch(error.name){case"AbortError":return formattedError=new BraintreeError({type:errors.PAYMENT_REQUEST_CANCELED.type,code:errors.PAYMENT_REQUEST_CANCELED.code,message:errors.PAYMENT_REQUEST_CANCELED.message,details:{originalError:error}}),analytics.sendEvent(this._client,"payment-request.tokenize.canceled"),formattedError;case"PAYMENT_REQUEST_INITIALIZATION_FAILED":formattedError=new BraintreeError({type:errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.type,code:errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.code,message:errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.message,details:{originalError:error}});break;case"BRAINTREE_GATEWAY_GOOGLE_PAYMENT_TOKENIZATION_ERROR":formattedError=new BraintreeError({type:errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.type,code:errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.code,message:errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.message,details:{originalError:error}});break;case"BRAINTREE_GATEWAY_GOOGLE_PAYMENT_PARSING_ERROR":formattedError=new BraintreeError({type:errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.type,code:errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.code,message:errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.message,details:{originalError:error}});break;default:formattedError=new BraintreeError({code:errors.PAYMENT_REQUEST_NOT_COMPLETED.code,type:error.type||BraintreeError.types.CUSTOMER,message:errors.PAYMENT_REQUEST_NOT_COMPLETED.message,details:{originalError:error}})}
return analytics.sendEvent(this._client,"payment-request.tokenize.failed"),formattedError},PaymentRequestComponent.prototype._formatCanMakePaymentError=function(error){var formattedError;switch(error.name){case"PAYMENT_REQUEST_INITIALIZATION_FAILED":formattedError=new BraintreeError({type:errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.type,code:errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.code,message:errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.message,details:{originalError:error}});break;case"NotAllowedError":formattedError=new BraintreeError({type:errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.type,code:errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.code,message:errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.message,details:{originalError:error}});break;default:formattedError=new BraintreeError({code:errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.code,type:errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.type,message:errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.message,details:{originalError:error}})}return analytics.sendEvent(this._client,"payment-request.can-make-payment.failed"),formattedError},module.exports=wrapPromise.wrapPrototype(PaymentRequestComponent)},{"../../lib/analytics":124,"../../lib/assign":126,"../../lib/braintree-error":129,"../../lib/convert-methods-to-error":132,"../../lib/generate-google-pay-configuration":154,"../../lib/methods":159,"../../lib/promise":161,"../../lib/use-min":164,"../shared/constants":177,"@braintree/event-emitter":37,"@braintree/iframer":39,"@braintree/uuid":43,"@braintree/wrap-promise":47,framebus:56}],176:[function(_dereq_,module,exports){"use strict";function create(options){var name="Payment Request";return basicComponentVerification.verify({name:name,client:options.client,authorization:options.authorization}).then(function(){return createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:name})}).then(function(client){var paymentRequestInstance;return options.client=client,paymentRequestInstance=new PaymentRequestComponent(options),paymentRequestInstance.initialize()})}var PaymentRequestComponent=_dereq_("./external/payment-request"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),wrapPromise=_dereq_("@braintree/wrap-promise");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"./external/payment-request":175,"@braintree/wrap-promise":47}],177:[function(_dereq_,module,exports){"use strict";var enumerate=_dereq_("../../lib/enumerate"),errors=_dereq_("./errors"),constants={};constants.events=enumerate(["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:"),constants.errors=errors,constants.SUPPORTED_METHODS={"basic-card":!0,"https://google.com/pay":!0},module.exports=constants},{"../../lib/enumerate":139,"./errors":178}],178:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../../lib/braintree-error");module.exports={PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS:{type:BraintreeError.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:BraintreeError.types.CUSTOMER,code:"PAYMENT_REQUEST_CANCELED",message:"Payment request was canceled."},PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED:{type:BraintreeError.types.MERCHANT,code:"PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED",message:"Something went wrong when configuring the payment request."},PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED:{type:BraintreeError.types.UNKNOWN,code:"PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED",message:"Something went wrong when calling `canMakePayment`"},PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED:{type:BraintreeError.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:BraintreeError.types.MERCHANT,code:"PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD"},PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE:{type:BraintreeError.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:BraintreeError.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:BraintreeError.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:BraintreeError.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":129}],179:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../lib/braintree-error");module.exports={PAYPAL_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_NOT_ENABLED",message:"PayPal is not enabled for this merchant."},PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED",message:"A linked PayPal Sandbox account is required to use PayPal Checkout in Sandbox. See https://developers.braintreepayments.com/guides/paypal/testing-go-live/#linked-paypal-testing for details on linking your PayPal sandbox with Braintree."},PAYPAL_ACCOUNT_TOKENIZATION_FAILED:{type:BraintreeError.types.NETWORK,code:"PAYPAL_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's PayPal account."},PAYPAL_FLOW_FAILED:{type:BraintreeError.types.NETWORK,code:"PAYPAL_FLOW_FAILED",message:"Could not initialize PayPal flow."},PAYPAL_FLOW_OPTION_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_FLOW_OPTION_REQUIRED",message:"PayPal flow property is invalid or missing."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED"},PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED:{type:BraintreeError.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:BraintreeError.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:BraintreeError.types.CUSTOMER,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED",message:"Customer closed PayPal popup before authorizing."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS",message:"Vault initiated checkout already in progress."},PAYPAL_INVALID_PAYMENT_OPTION:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_INVALID_PAYMENT_OPTION",message:"PayPal payment options are invalid."}}},{"../lib/braintree-error":129}],180:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"PayPal Checkout",client:options.client,authorization:options.authorization}).then(function(){return new PayPalCheckout(options)._initialize(options)})}function isSupported(){return!0}var basicComponentVerification=_dereq_("../lib/basic-component-verification"),wrapPromise=_dereq_("@braintree/wrap-promise"),PayPalCheckout=_dereq_("./paypal-checkout");module.exports={create:wrapPromise(create),isSupported:isSupported,VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"./paypal-checkout":181,"@braintree/wrap-promise":47}],181:[function(_dereq_,module,exports){"use strict";function PayPalCheckout(options){this._merchantAccountId=options.merchantAccountId,this._autoSetDataUserIdToken=Boolean(options.autoSetDataUserIdToken)}var analytics=_dereq_("../lib/analytics"),assign=_dereq_("../lib/assign").assign,createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),Promise=_dereq_("../lib/promise"),ExtendedPromise=_dereq_("@braintree/extended-promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),BraintreeError=_dereq_("../lib/braintree-error"),convertToBraintreeError=_dereq_("../lib/convert-to-braintree-error"),errors=_dereq_("./errors"),constants=_dereq_("../paypal/shared/constants"),frameService=_dereq_("../lib/frame-service/external"),createAuthorizationData=_dereq_("../lib/create-authorization-data"),methods=_dereq_("../lib/methods"),useMin=_dereq_("../lib/use-min"),convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),querystring=_dereq_("../lib/querystring"),INTEGRATION_TIMEOUT_MS=_dereq_("../lib/constants").INTEGRATION_TIMEOUT_MS,REQUIRED_PARAMS_FOR_START_VAULT_INITIATED_CHECKOUT=["amount","currency","vaultInitiatedCheckoutPaymentMethodToken"];PayPalCheckout.prototype._initialize=function(options){var config;return options.client?(config=options.client.getConfiguration(),this._authorizationInformation={fingerprint:config.authorizationFingerprint,environment:config.gatewayConfiguration.environment}):(config=createAuthorizationData(options.authorization),this._authorizationInformation={fingerprint:config.attrs.authorizationFingerprint,environment:config.environment}),this._clientPromise=createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:"PayPal Checkout"}).then(function(client){return this._configuration=client.getConfiguration(),this._merchantAccountId||(this._configuration.gatewayConfiguration.paypalEnabled?!0===this._configuration.gatewayConfiguration.paypal.environmentNoNetwork&&(this._setupError=new BraintreeError(errors.PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED)):this._setupError=new BraintreeError(errors.PAYPAL_NOT_ENABLED)),this._setupError?Promise.reject(this._setupError):(analytics.sendEvent(client,"paypal-checkout.initialized"),this._frameServicePromise=this._setupFrameService(client),client)}.bind(this)),options.client?this._clientPromise.then(function(){return this}.bind(this)):Promise.resolve(this)},PayPalCheckout.prototype._setupFrameService=function(client){var frameServicePromise=new ExtendedPromise,config=client.getConfiguration(),timeoutRef=setTimeout(function(){analytics.sendEvent(client,"paypal-checkout.frame-service.timed-out"),frameServicePromise.reject(new BraintreeError(errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED))},INTEGRATION_TIMEOUT_MS);return this._assetsUrl=config.gatewayConfiguration.paypal.assetsUrl+"/web/3.69.0",this._isDebug=config.isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/paypal-landing-frame"+useMin(this._isDebug)+".html",frameService.create({name:"braintreepaypallanding",dispatchFrameUrl:this._assetsUrl+"/html/dispatch-frame"+useMin(this._isDebug)+".html",openFrameUrl:this._loadingFrameUrl},function(service){this._frameService=service,clearTimeout(timeoutRef),frameServicePromise.resolve()}.bind(this)),frameServicePromise},PayPalCheckout.prototype.createPayment=function(options){return options&&constants.FLOW_ENDPOINTS.hasOwnProperty(options.flow)?(analytics.sendEvent(this._clientPromise,"paypal-checkout.createPayment"),this._createPaymentResource(options).then(function(response){return"checkout"===options.flow?response.paymentResource.redirectUrl.match(/EC-\w+/)[0]:response.agreementSetup.tokenId})):Promise.reject(new BraintreeError(errors.PAYPAL_FLOW_OPTION_REQUIRED))},PayPalCheckout.prototype._createPaymentResource=function(options,config){var self=this,endpoint="paypal_hermes/"+constants.FLOW_ENDPOINTS[options.flow];return delete this.intentFromCreatePayment,config=config||{},!0===options.offerCredit&&analytics.sendEvent(this._clientPromise,"paypal-checkout.credit.offered"),this._clientPromise.then(function(client){return client.request({endpoint:endpoint,method:"post",data:self._formatPaymentResourceData(options,config)}).then(function(data){return self.intentFromCreatePayment=options.intent,data})}).catch(function(err){var status;return self._setupError?Promise.reject(self._setupError):(status=err.details&&err.details.httpStatus,422===status?Promise.reject(new BraintreeError({type:errors.PAYPAL_INVALID_PAYMENT_OPTION.type,code:errors.PAYPAL_INVALID_PAYMENT_OPTION.code,message:errors.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:err}})):Promise.reject(convertToBraintreeError(err,{type:errors.PAYPAL_FLOW_FAILED.type,code:errors.PAYPAL_FLOW_FAILED.code,message:errors.PAYPAL_FLOW_FAILED.message})))})},PayPalCheckout.prototype.startVaultInitiatedCheckout=function(options){var missingRequiredParam,self=this;return this._vaultInitiatedCheckoutInProgress?(analytics.sendEvent(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.error.already-in-progress"),Promise.reject(new BraintreeError(errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS))):(REQUIRED_PARAMS_FOR_START_VAULT_INITIATED_CHECKOUT.forEach(function(param){options.hasOwnProperty(param)||(missingRequiredParam=param)}),missingRequiredParam?Promise.reject(new BraintreeError({type:errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.type,code:errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.code,message:"Required param "+missingRequiredParam+" is missing."})):(this._vaultInitiatedCheckoutInProgress=!0,this._addModalBackdrop(options),options=assign({},options,{flow:"checkout"}),analytics.sendEvent(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.started"),this._waitForVaultInitiatedCheckoutDependencies().then(function(){var frameCommunicationPromise=new ExtendedPromise,startVaultInitiatedCheckoutPromise=self._createPaymentResource(options,{returnUrl:self._constructVaultCheckutUrl("redirect-frame"),cancelUrl:self._constructVaultCheckutUrl("cancel-frame")}).then(function(response){var redirectUrl=response.paymentResource.redirectUrl;return self._frameService.redirect(redirectUrl),frameCommunicationPromise});return self._frameService.open({},self._createFrameServiceCallback(frameCommunicationPromise)),startVaultInitiatedCheckoutPromise}).catch(function(err){return self._vaultInitiatedCheckoutInProgress=!1,self._removeModalBackdrop(),"FRAME_SERVICE_FRAME_CLOSED"===err.code?(analytics.sendEvent(self._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.canceled.by-customer"),Promise.reject(new BraintreeError(errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED))):(self._frameService&&self._frameService.close(),err.code&&err.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1?(analytics.sendEvent(self._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.failed.popup-not-opened"),Promise.reject(new BraintreeError({code:errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.code,type:errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.type,message:errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.message,details:{originalError:err}}))):Promise.reject(err))}).then(function(response){return self._frameService.close(),self._vaultInitiatedCheckoutInProgress=!1,self._removeModalBackdrop(),analytics.sendEvent(self._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.succeeded"),Promise.resolve(response)})))},PayPalCheckout.prototype._addModalBackdrop=function(options){options.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))},PayPalCheckout.prototype._removeModalBackdrop=function(){this._modalBackdrop&&this._modalBackdrop.parentNode&&this._modalBackdrop.parentNode.removeChild(this._modalBackdrop)},PayPalCheckout.prototype.closeVaultInitiatedCheckoutWindow=function(){return this._vaultInitiatedCheckoutInProgress&&analytics.sendEvent(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.canceled.by-merchant"),this._waitForVaultInitiatedCheckoutDependencies().then(function(){this._frameService.close()}.bind(this))},PayPalCheckout.prototype.focusVaultInitiatedCheckoutWindow=function(){return this._waitForVaultInitiatedCheckoutDependencies().then(function(){this._frameService.focus()}.bind(this))},PayPalCheckout.prototype._createFrameServiceCallback=function(frameCommunicationPromise){var self=this;return function(err,payload){err?frameCommunicationPromise.reject(err):payload&&(self._frameService.redirect(self._loadingFrameUrl),self.tokenizePayment({paymentToken:payload.token,payerID:payload.PayerID,paymentID:payload.paymentId}).then(function(res){frameCommunicationPromise.resolve(res)}).catch(function(tokenizationError){frameCommunicationPromise.reject(tokenizationError)}))}},PayPalCheckout.prototype._waitForVaultInitiatedCheckoutDependencies=function(){var self=this;return this._clientPromise.then(function(){return self._frameServicePromise})},PayPalCheckout.prototype._constructVaultCheckutUrl=function(frameName){var serviceId=this._frameService._serviceId;return this._assetsUrl+"/html/"+frameName+useMin(this._isDebug)+".html?channel="+serviceId},PayPalCheckout.prototype.tokenizePayment=function(tokenizeOptions){var payload,self=this,shouldVault=!0,options={flow:tokenizeOptions.billingToken&&!tokenizeOptions.paymentID?"vault":"checkout",intent:tokenizeOptions.intent||this.intentFromCreatePayment},params={ecToken:tokenizeOptions.paymentToken,billingToken:tokenizeOptions.billingToken,payerId:tokenizeOptions.payerID,paymentId:tokenizeOptions.paymentID,shippingOptionsId:tokenizeOptions.shippingOptionsId};return tokenizeOptions.hasOwnProperty("vault")&&(shouldVault=tokenizeOptions.vault),options.vault=shouldVault,analytics.sendEvent(this._clientPromise,"paypal-checkout.tokenization.started"),this._clientPromise.then(function(client){return client.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:self._formatTokenizeData(options,params)})}).then(function(response){return payload=self._formatTokenizePayload(response),analytics.sendEvent(self._clientPromise,"paypal-checkout.tokenization.success"),payload.creditFinancingOffered&&analytics.sendEvent(self._clientPromise,"paypal-checkout.credit.accepted"),payload}).catch(function(err){return self._setupError?Promise.reject(self._setupError):(analytics.sendEvent(self._clientPromise,"paypal-checkout.tokenization.failed"),Promise.reject(convertToBraintreeError(err,{type:errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.type,code:errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.code,message:errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.message})))})},PayPalCheckout.prototype.getClientId=function(){return this._clientPromise.then(function(client){return client.getConfiguration().gatewayConfiguration.paypal.clientId})},PayPalCheckout.prototype.loadPayPalSDK=function(options){var idPromise,src,userIdToken,loadPromise=new ExtendedPromise,dataAttributes=options&&options.dataAttributes;return userIdToken=dataAttributes&&dataAttributes["user-id-token"]?dataAttributes["user-id-token"]:this._authorizationInformation.fingerprint&&this._authorizationInformation.fingerprint.split("?")[0],this._paypalScript=document.createElement("script"),options=assign({},{components:"buttons"},options),delete options.dataAttributes,options.vault||(options.intent=options.intent||"authorize",options.currency=options.currency||"USD"),src="https://www.paypal.com/sdk/js?",this._paypalScript.onload=function(){loadPromise.resolve()},dataAttributes&&Object.keys(dataAttributes).forEach(function(attribute){this._paypalScript.setAttribute("data-"+attribute,dataAttributes[attribute])}.bind(this)),idPromise=options["client-id"]?Promise.resolve(options["client-id"]):this.getClientId(),idPromise.then(function(id){options["client-id"]=id,this._autoSetDataUserIdToken&&userIdToken&&(this._paypalScript.setAttribute("data-user-id-token",userIdToken),this._attachPreloadPixel({id:id,userIdToken:userIdToken,amount:dataAttributes&&dataAttributes.amount,currency:options.currency,merchantId:options["merchant-id"]})),this._paypalScript.src=querystring.queryify(src,options),document.head.insertBefore(this._paypalScript,document.head.firstElementChild)}.bind(this)),loadPromise.then(function(){return this}.bind(this))},PayPalCheckout.prototype._attachPreloadPixel=function(options){var request,id=options.id,userIdToken=options.userIdToken,env=this._authorizationInformation.environment,subdomain="production"===env?"":"sandbox.",url="https://www.{ENV}paypal.com/smart/buttons/preload".replace("{ENV}",subdomain),preloadOptions={"client-id":id,"user-id-token":userIdToken};options.amount&&(preloadOptions.amount=options.amount),options.currency&&(preloadOptions.currency=options.currency),options.merchantId&&(preloadOptions["merchant-id"]=options.merchantId),request=new XMLHttpRequest,request.open("GET",querystring.queryify(url,preloadOptions)),request.send()},PayPalCheckout.prototype._formatPaymentResourceData=function(options,config){var key,gatewayConfiguration=this._configuration.gatewayConfiguration,intent=options.intent,paymentResource={returnUrl:config.returnUrl||"https://www.paypal.com/checkoutnow/error",cancelUrl:config.cancelUrl||"https://www.paypal.com/checkoutnow/error",offerPaypalCredit:!0===options.offerCredit,merchantAccountId:this._merchantAccountId,experienceProfile:{brandName:options.displayName||gatewayConfiguration.paypal.displayName,localeCode:options.locale,noShipping:(!options.enableShippingAddress).toString(),addressOverride:!1===options.shippingAddressEditable,landingPageType:options.landingPageType},shippingOptions:options.shippingOptions};if("checkout"===options.flow){paymentResource.amount=options.amount,paymentResource.currencyIsoCode=options.currency,paymentResource.requestBillingAgreement=options.requestBillingAgreement,intent&&("capture"===intent&&(intent="sale"),paymentResource.intent=intent),options.hasOwnProperty("lineItems")&&(paymentResource.lineItems=options.lineItems),options.hasOwnProperty("vaultInitiatedCheckoutPaymentMethodToken")&&(paymentResource.vaultInitiatedCheckoutPaymentMethodToken=options.vaultInitiatedCheckoutPaymentMethodToken),options.hasOwnProperty("shippingOptions")&&(paymentResource.shippingOptions=options.shippingOptions);for(key in options.shippingAddressOverride)options.shippingAddressOverride.hasOwnProperty(key)&&(paymentResource[key]=options.shippingAddressOverride[key]);options.hasOwnProperty("billingAgreementDetails")&&(paymentResource.billingAgreementDetails=options.billingAgreementDetails)}else paymentResource.shippingAddress=options.shippingAddressOverride,options.billingAgreementDescription&&(paymentResource.description=options.billingAgreementDescription);return paymentResource},PayPalCheckout.prototype._formatTokenizeData=function(options,params){var clientConfiguration=this._configuration,gatewayConfiguration=clientConfiguration.gatewayConfiguration,isTokenizationKey="TOKENIZATION_KEY"===clientConfiguration.authorizationType,isVaultFlow="vault"===options.flow,data={paypalAccount:{correlationId:params.billingToken||params.ecToken,options:{validate:isVaultFlow&&!isTokenizationKey&&options.vault}}};return isVaultFlow?data.paypalAccount.billingAgreementToken=params.billingToken:(data.paypalAccount.paymentToken=params.paymentId,data.paypalAccount.payerId=params.payerId,data.paypalAccount.unilateral=gatewayConfiguration.paypal.unvettedMerchant,options.intent&&(data.paypalAccount.intent=options.intent)),this._merchantAccountId&&(data.merchantAccountId=this._merchantAccountId),data},PayPalCheckout.prototype._formatTokenizePayload=function(response){var payload,account={};return response.paypalAccounts&&(account=response.paypalAccounts[0]),payload={nonce:account.nonce,details:{},type:account.type},account.details&&account.details.payerInfo&&(payload.details=account.details.payerInfo),account.details&&account.details.creditFinancingOffered&&(payload.creditFinancingOffered=account.details.creditFinancingOffered),account.details&&account.details.shippingOptionId&&(payload.shippingOptionId=account.details.shippingOptionId),account.details&&account.details.cobrandedCardLabel&&(payload.cobrandedCardLabel=account.details.cobrandedCardLabel),payload},PayPalCheckout.prototype.teardown=function(){return convertMethodsToError(this,methods(PayPalCheckout.prototype)),this._paypalScript&&this._paypalScript.parentNode&&this._paypalScript.parentNode.removeChild(this._paypalScript),Promise.resolve()},module.exports=wrapPromise.wrapPrototype(PayPalCheckout)},{"../lib/analytics":124,"../lib/assign":126,"../lib/braintree-error":129,"../lib/constants":131,"../lib/convert-methods-to-error":132,"../lib/convert-to-braintree-error":133,"../lib/create-assets-url":134,"../lib/create-authorization-data":135,"../lib/create-deferred-client":136,"../lib/frame-service/external":144,"../lib/methods":159,"../lib/promise":161,"../lib/querystring":162,"../lib/use-min":164,"../paypal/shared/constants":184,"./errors":179,"@braintree/extended-promise":38,"@braintree/wrap-promise":47}],182:[function(_dereq_,module,exports){"use strict";function PayPal(options){this._client=options.client,this._assetsUrl=options.client.getConfiguration().gatewayConfiguration.paypal.assetsUrl+"/web/"+VERSION,this._isDebug=options.client.getConfiguration().isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/paypal-landing-frame"+useMin(this._isDebug)+".html",this._authorizationInProgress=!1}var frameService=_dereq_("../../lib/frame-service/external"),BraintreeError=_dereq_("../../lib/braintree-error"),convertToBraintreeError=_dereq_("../../lib/convert-to-braintree-error"),useMin=_dereq_("../../lib/use-min"),once=_dereq_("../../lib/once"),VERSION="3.69.0",constants=_dereq_("../shared/constants"),INTEGRATION_TIMEOUT_MS=_dereq_("../../lib/constants").INTEGRATION_TIMEOUT_MS,analytics=_dereq_("../../lib/analytics"),methods=_dereq_("../../lib/methods"),deferred=_dereq_("../../lib/deferred"),errors=_dereq_("../shared/errors"),convertMethodsToError=_dereq_("../../lib/convert-methods-to-error"),querystring=_dereq_("../../lib/querystring"),Promise=_dereq_("../../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise");PayPal.prototype._initialize=function(){var self=this,client=this._client,failureTimeout=setTimeout(function(){analytics.sendEvent(client,"paypal.load.timed-out")},INTEGRATION_TIMEOUT_MS);return new Promise(function(resolve){frameService.create({name:constants.LANDING_FRAME_NAME,dispatchFrameUrl:self._assetsUrl+"/html/dispatch-frame"+useMin(self._isDebug)+".html",openFrameUrl:self._loadingFrameUrl},function(service){self._frameService=service,clearTimeout(failureTimeout),analytics.sendEvent(client,"paypal.load.succeeded"),resolve(self)})})},PayPal.prototype.tokenize=function(options,callback){var tokenizePromise,optionError,self=this,client=this._client;return callback&&(callback=once(deferred(callback))),options&&constants.FLOW_ENDPOINTS.hasOwnProperty(options.flow)?(tokenizePromise=new Promise(function(resolve,reject){self._authorizationInProgress?(analytics.sendEvent(client,"paypal.tokenization.error.already-opened"),reject(new BraintreeError(errors.PAYPAL_TOKENIZATION_REQUEST_ACTIVE))):(self._authorizationInProgress=!0,window.popupBridge||analytics.sendEvent(client,"paypal.tokenization.opened"),!0===options.offerCredit&&analytics.sendEvent(client,"paypal.credit.offered"),self._navigateFrameToAuth(options).catch(reject),self._frameService.open({},self._createFrameServiceCallback(options,resolve,reject)))}),callback?(tokenizePromise.then(function(res){callback(null,res)}).catch(callback),this._frameService.createHandler({beforeClose:function(){analytics.sendEvent(client,"paypal.tokenization.closed.by-merchant")}})):tokenizePromise):(optionError=new BraintreeError(errors.PAYPAL_FLOW_OPTION_REQUIRED),callback?(callback(optionError),this._frameService.createNoopHandler()):Promise.reject(optionError))},PayPal.prototype._createFrameServiceCallback=function(options,resolve,reject){var self=this,client=this._client;return window.popupBridge?function(err,payload){var canceled=payload&&payload.path&&"/cancel"===payload.path.substring(0,7);self._authorizationInProgress=!1,err||canceled?(analytics.sendEvent(client,"paypal.tokenization.closed-popupbridge.by-user"),reject(new BraintreeError(errors.PAYPAL_POPUP_CLOSED))):payload&&self._tokenizePayPal(options,payload.queryItems).then(resolve).catch(reject)}:function(err,params){self._authorizationInProgress=!1,err?"FRAME_SERVICE_FRAME_CLOSED"===err.code?(analytics.sendEvent(client,"paypal.tokenization.closed.by-user"),reject(new BraintreeError(errors.PAYPAL_POPUP_CLOSED))):err.code&&err.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1&&reject(new BraintreeError({code:errors.PAYPAL_POPUP_OPEN_FAILED.code,type:errors.PAYPAL_POPUP_OPEN_FAILED.type,message:errors.PAYPAL_POPUP_OPEN_FAILED.message,details:{originalError:err}})):params&&self._tokenizePayPal(options,params).then(resolve).catch(reject)}},PayPal.prototype._tokenizePayPal=function(options,params){var self=this,client=this._client;return window.popupBridge||this._frameService.redirect(this._loadingFrameUrl),client.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:this._formatTokenizeData(options,params)}).then(function(response){var payload=self._formatTokenizePayload(response);return window.popupBridge?analytics.sendEvent(client,"paypal.tokenization.success-popupbridge"):analytics.sendEvent(client,"paypal.tokenization.success"),payload.creditFinancingOffered&&analytics.sendEvent(client,"paypal.credit.accepted"),self._frameService.close(),payload}).catch(function(err){return window.popupBridge?analytics.sendEvent(client,"paypal.tokenization.failed-popupbridge"):analytics.sendEvent(client,"paypal.tokenization.failed"),self._frameService.close(),Promise.reject(convertToBraintreeError(err,{type:errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.type,code:errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.code,message:errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.message}))})},PayPal.prototype._formatTokenizePayload=function(response){var payload,account={};return response.paypalAccounts&&(account=response.paypalAccounts[0]),payload={nonce:account.nonce,details:{},type:account.type},account.details&&account.details.payerInfo&&(payload.details=account.details.payerInfo),account.details&&account.details.creditFinancingOffered&&(payload.creditFinancingOffered=account.details.creditFinancingOffered),payload},PayPal.prototype._formatTokenizeData=function(options,params){
var clientConfiguration=this._client.getConfiguration(),gatewayConfiguration=clientConfiguration.gatewayConfiguration,isTokenizationKey="TOKENIZATION_KEY"===clientConfiguration.authorizationType,data={paypalAccount:{correlationId:params.ba_token||params.token,options:{validate:"vault"===options.flow&&!isTokenizationKey}}};return params.ba_token?data.paypalAccount.billingAgreementToken=params.ba_token:(data.paypalAccount.paymentToken=params.paymentId,data.paypalAccount.payerId=params.PayerID,data.paypalAccount.unilateral=gatewayConfiguration.paypal.unvettedMerchant,options.hasOwnProperty("intent")&&(data.paypalAccount.intent=options.intent)),data},PayPal.prototype._navigateFrameToAuth=function(options){var self=this,client=this._client,endpoint="paypal_hermes/"+constants.FLOW_ENDPOINTS[options.flow];return client.request({endpoint:endpoint,method:"post",data:this._formatPaymentResourceData(options)}).then(function(response){var redirectUrl;redirectUrl="checkout"===options.flow?response.paymentResource.redirectUrl:response.agreementSetup.approvalUrl,"commit"===options.useraction&&(redirectUrl=querystring.queryify(redirectUrl,{useraction:"commit"})),window.popupBridge&&analytics.sendEvent(client,"paypal.tokenization.opened-popupbridge"),self._frameService.redirect(redirectUrl)}).catch(function(err){var status=err.details&&err.details.httpStatus;return self._frameService.close(),self._authorizationInProgress=!1,422===status?Promise.reject(new BraintreeError({type:errors.PAYPAL_INVALID_PAYMENT_OPTION.type,code:errors.PAYPAL_INVALID_PAYMENT_OPTION.code,message:errors.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:err}})):Promise.reject(convertToBraintreeError(err,{type:errors.PAYPAL_FLOW_FAILED.type,code:errors.PAYPAL_FLOW_FAILED.code,message:errors.PAYPAL_FLOW_FAILED.message}))})},PayPal.prototype._formatPaymentResourceData=function(options){var key,gatewayConfiguration=this._client.getConfiguration().gatewayConfiguration,serviceId=this._frameService._serviceId,paymentResource={returnUrl:gatewayConfiguration.paypal.assetsUrl+"/web/"+VERSION+"/html/redirect-frame"+useMin(this._isDebug)+".html?channel="+serviceId,cancelUrl:gatewayConfiguration.paypal.assetsUrl+"/web/"+VERSION+"/html/cancel-frame"+useMin(this._isDebug)+".html?channel="+serviceId,offerPaypalCredit:!0===options.offerCredit,experienceProfile:{brandName:options.displayName||gatewayConfiguration.paypal.displayName,localeCode:options.locale,noShipping:(!options.enableShippingAddress).toString(),addressOverride:!1===options.shippingAddressEditable,landingPageType:options.landingPageType}};if(window.popupBridge&&"function"==typeof window.popupBridge.getReturnUrlPrefix&&(paymentResource.returnUrl=window.popupBridge.getReturnUrlPrefix()+"return",paymentResource.cancelUrl=window.popupBridge.getReturnUrlPrefix()+"cancel"),"checkout"===options.flow){paymentResource.amount=options.amount,paymentResource.currencyIsoCode=options.currency,options.hasOwnProperty("intent")&&(paymentResource.intent=options.intent);for(key in options.shippingAddressOverride)options.shippingAddressOverride.hasOwnProperty(key)&&(paymentResource[key]=options.shippingAddressOverride[key])}else paymentResource.shippingAddress=options.shippingAddressOverride,options.billingAgreementDescription&&(paymentResource.description=options.billingAgreementDescription);return paymentResource},PayPal.prototype.closeWindow=function(){this._authorizationInProgress&&analytics.sendEvent(this._client,"paypal.tokenize.closed.by-merchant"),this._frameService.close()},PayPal.prototype.focusWindow=function(){this._frameService.focus()},PayPal.prototype.teardown=wrapPromise(function(){var self=this;return self._frameService.teardown(),convertMethodsToError(self,methods(PayPal.prototype)),analytics.sendEvent(self._client,"paypal.teardown-completed"),Promise.resolve()}),module.exports=PayPal},{"../../lib/analytics":124,"../../lib/braintree-error":129,"../../lib/constants":131,"../../lib/convert-methods-to-error":132,"../../lib/convert-to-braintree-error":133,"../../lib/deferred":137,"../../lib/frame-service/external":144,"../../lib/methods":159,"../../lib/once":160,"../../lib/promise":161,"../../lib/querystring":162,"../../lib/use-min":164,"../shared/constants":184,"../shared/errors":185,"@braintree/wrap-promise":47}],183:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"PayPal",client:options.client,authorization:options.authorization}).then(function(){return createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:"PayPal"})}).then(function(client){var pp,config=client.getConfiguration();return options.client=client,!0!==config.gatewayConfiguration.paypalEnabled?Promise.reject(new BraintreeError(errors.PAYPAL_NOT_ENABLED)):(analytics.sendEvent(options.client,"paypal.initialized"),pp=new PayPal(options),pp._initialize())})}function isSupported(){return!0}var analytics=_dereq_("../lib/analytics"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),BraintreeError=_dereq_("../lib/braintree-error"),errors=_dereq_("./shared/errors"),PayPal=_dereq_("./external/paypal"),wrapPromise=_dereq_("@braintree/wrap-promise"),Promise=_dereq_("../lib/promise");module.exports={create:wrapPromise(create),isSupported:isSupported,VERSION:"3.69.0"}},{"../lib/analytics":124,"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"./external/paypal":182,"./shared/errors":185,"@braintree/wrap-promise":47}],184:[function(_dereq_,module,exports){"use strict";module.exports={LANDING_FRAME_NAME:"braintreepaypallanding",FLOW_ENDPOINTS:{checkout:"create_payment_resource",vault:"setup_billing_agreement"}}},{}],185:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../../lib/braintree-error");module.exports={PAYPAL_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_NOT_ENABLED",message:"PayPal is not enabled for this merchant."},PAYPAL_TOKENIZATION_REQUEST_ACTIVE:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_TOKENIZATION_REQUEST_ACTIVE",message:"Another tokenization request is active."},PAYPAL_ACCOUNT_TOKENIZATION_FAILED:{type:BraintreeError.types.NETWORK,code:"PAYPAL_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's PayPal account."},PAYPAL_FLOW_FAILED:{type:BraintreeError.types.NETWORK,code:"PAYPAL_FLOW_FAILED",message:"Could not initialize PayPal flow."},PAYPAL_FLOW_OPTION_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_FLOW_OPTION_REQUIRED",message:"PayPal flow property is invalid or missing."},PAYPAL_POPUP_OPEN_FAILED:{type:BraintreeError.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:BraintreeError.types.CUSTOMER,code:"PAYPAL_POPUP_CLOSED",message:"Customer closed PayPal popup before authorizing."},PAYPAL_INVALID_PAYMENT_OPTION:{type:BraintreeError.types.MERCHANT,code:"PAYPAL_INVALID_PAYMENT_OPTION",message:"PayPal payment options are invalid."}}},{"../../lib/braintree-error":129}],186:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"PreferredPaymentMethods",client:options.client,authorization:options.authorization}).then(function(){return(new PreferredPaymentMethods).initialize(options)})}var wrapPromise=_dereq_("@braintree/wrap-promise"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),PreferredPaymentMethods=_dereq_("./preferred-payment-methods");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"./preferred-payment-methods":187,"@braintree/wrap-promise":47}],187:[function(_dereq_,module,exports){"use strict";function PreferredPaymentMethods(){}var wrapPromise=_dereq_("@braintree/wrap-promise"),analytics=_dereq_("../lib/analytics"),createAssetsUrl=_dereq_("../lib/create-assets-url"),createDeferredClient=_dereq_("../lib/create-deferred-client"),Promise=_dereq_("../lib/promise");PreferredPaymentMethods.prototype.initialize=function(options){var self=this;return this._clientPromise=createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:"PreferredPaymentMethods"}).catch(function(err){return self._setupError=err,Promise.reject(err)}),analytics.sendEvent(this._clientPromise,"preferred-payment-methods.initialized"),Promise.resolve(this)},PreferredPaymentMethods.prototype.fetchPreferredPaymentMethods=function(){var client,self=this;return this._clientPromise.then(function(clientInstance){return client=clientInstance,client.request({api:"graphQLApi",data:{query:"query PreferredPaymentMethods { preferredPaymentMethods { paypalPreferred venmoPreferred } }"}})}).then(function(result){var paypalPreferred=result.data.preferredPaymentMethods.paypalPreferred,venmoPreferred=result.data.preferredPaymentMethods.venmoPreferred;return analytics.sendEvent(client,"preferred-payment-methods.paypal.api-detected."+paypalPreferred),analytics.sendEvent(client,"preferred-payment-methods.venmo.api-detected."+venmoPreferred),{paypalPreferred:paypalPreferred,venmoPreferred:venmoPreferred}}).catch(function(){return self._setupError?Promise.reject(self._setupError):(analytics.sendEvent(client,"preferred-payment-methods.api-error"),{paypalPreferred:!1,venmoPreferred:!1})})},module.exports=wrapPromise.wrapPrototype(PreferredPaymentMethods)},{"../lib/analytics":124,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"@braintree/wrap-promise":47}],188:[function(_dereq_,module,exports){"use strict";function BaseFramework(options){EventEmitter.call(this),this._client=options.client,this._createPromise=options.createPromise,this._createOptions=options,this._client?(this._isDebug=this._client.getConfiguration().isDebug,this._assetsUrl=this._client.getConfiguration().gatewayConfiguration.assetsUrl):(this._isDebug=Boolean(options.isDebug),this._assetsUrl=options.assetsUrl),this._assetsUrl=this._assetsUrl+"/web/"+VERSION}var assign=_dereq_("../../../lib/assign").assign,analytics=_dereq_("../../../lib/analytics"),BraintreeError=_dereq_("../../../lib/braintree-error"),Promise=_dereq_("../../../lib/promise"),isVerifiedDomain=_dereq_("../../../lib/is-verified-domain"),ExtendedPromise=_dereq_("@braintree/extended-promise"),EventEmitter=_dereq_("@braintree/event-emitter"),errors=_dereq_("../../shared/errors"),iFramer=_dereq_("@braintree/iframer"),Bus=_dereq_("framebus"),constants=_dereq_("../../shared/constants"),uuid=_dereq_("@braintree/uuid"),events=_dereq_("../../shared/events"),useMin=_dereq_("../../../lib/use-min"),BUS_CONFIGURATION_REQUEST_EVENT=_dereq_("../../../lib/constants").BUS_CONFIGURATION_REQUEST_EVENT,VERSION="3.69.0";EventEmitter.createChild(BaseFramework),BaseFramework.prototype._waitForClient=function(){return this._client?Promise.resolve():this._createPromise.then(function(client){this._client=client}.bind(this))},BaseFramework.prototype.setUpEventListeners=function(){throw new BraintreeError(errors.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},BaseFramework.prototype.verifyCard=function(options,privateOptions){var formattedOptions,error,self=this;return privateOptions=privateOptions||{},(error=this._checkForVerifyCardError(options,privateOptions))?Promise.reject(error):(this._verifyCardInProgress=!0,formattedOptions=this._formatVerifyCardOptions(options),this._formatLookupData(formattedOptions).then(function(data){return analytics.sendEvent(self._createPromise,"three-d-secure.verification-flow.started"),self._performLookup(formattedOptions.nonce,data)}).then(function(response){return analytics.sendEvent(self._createPromise,"three-d-secure.verification-flow.3ds-version."+response.lookup.threeDSecureVersion),self._onLookupComplete(response,formattedOptions)}).then(function(response){return self.initializeChallengeWithLookupResponse(response,formattedOptions)}).then(function(payload){return self._resetVerificationState(),analytics.sendEvent(self._createPromise,"three-d-secure.verification-flow.completed"),payload}).catch(function(err){return self._resetVerificationState(),analytics.sendEvent(self._createPromise,"three-d-secure.verification-flow.failed"),Promise.reject(err)}))},BaseFramework.prototype._checkForFrameworkSpecificVerifyCardErrors=function(){throw new BraintreeError(errors.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},BaseFramework.prototype._presentChallenge=function(){throw new BraintreeError(errors.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},BaseFramework.prototype.prepareLookup=function(){throw new BraintreeError(errors.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},BaseFramework.prototype._resetVerificationState=function(){this._verifyCardInProgress=!1,this._verifyCardPromisePlus=null},BaseFramework.prototype._performLookup=function(nonce,data){var self=this,url="payment_methods/"+nonce+"/three_d_secure/lookup";return this._waitForClient().then(function(){return self._client.request({endpoint:url,method:"post",data:data}).catch(function(err){var lookupError,status=err&&err.details&&err.details.httpStatus,analyticsMessage="three-d-secure.verification-flow.lookup-failed";return 404===status?(lookupError=errors.THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR,analyticsMessage+=".404"):422===status?(lookupError=errors.THREEDS_LOOKUP_VALIDATION_ERROR,analyticsMessage+=".422"):lookupError=errors.THREEDS_LOOKUP_ERROR,analytics.sendEvent(self._createPromise,analyticsMessage),Promise.reject(new BraintreeError({type:lookupError.type,code:lookupError.code,message:lookupError.message,details:{originalError:err}}))})})},BaseFramework.prototype._checkForVerifyCardError=function(options,privateOptions){var errorOption;return!0===this._verifyCardInProgress?new BraintreeError(errors.THREEDS_AUTHENTICATION_IN_PROGRESS):(options.nonce?options.amount||(errorOption="an amount"):errorOption="a nonce",errorOption||(errorOption=this._checkForFrameworkSpecificVerifyCardErrors(options,privateOptions)),errorOption?new BraintreeError({type:errors.THREEDS_MISSING_VERIFY_CARD_OPTION.type,code:errors.THREEDS_MISSING_VERIFY_CARD_OPTION.code,message:"verifyCard options must include "+errorOption+"."}):null)},BaseFramework.prototype.initializeChallengeWithLookupResponse=function(lookupResponse,options){var self=this;return options=options||{},this._lookupPaymentMethod=lookupResponse.paymentMethod,self._verifyCardPromisePlus=self._verifyCardPromisePlus||new ExtendedPromise,self._handleLookupResponse(lookupResponse,options),self._verifyCardPromisePlus.then(function(payload){return analytics.sendEvent(self._createPromise,"three-d-secure.verification-flow.liability-shifted."+String(payload.liabilityShifted)),analytics.sendEvent(self._createPromise,"three-d-secure.verification-flow.liability-shift-possible."+String(payload.liabilityShiftPossible)),payload})},BaseFramework.prototype._handleLookupResponse=function(lookupResponse,options){var details,challengeShouldBePresented=Boolean(lookupResponse.lookup&&lookupResponse.lookup.acsUrl);analytics.sendEvent(this._createPromise,"three-d-secure.verification-flow.challenge-presented."+String(challengeShouldBePresented)),challengeShouldBePresented?this._presentChallenge(lookupResponse,options):(details=this._formatAuthResponse(lookupResponse.paymentMethod,lookupResponse.threeDSecureInfo),details.verificationDetails=lookupResponse.threeDSecureInfo,this._verifyCardPromisePlus.resolve(details))},BaseFramework.prototype._onLookupComplete=function(response){return this._lookupPaymentMethod=response.paymentMethod,this._verifyCardPromisePlus=new ExtendedPromise,Promise.resolve(response)},BaseFramework.prototype._formatAuthResponse=function(paymentMethod,threeDSecureInfo){return{nonce:paymentMethod.nonce,binData:paymentMethod.binData,details:paymentMethod.details,description:paymentMethod.description&&paymentMethod.description.replace(/\+/g," "),liabilityShifted:threeDSecureInfo&&threeDSecureInfo.liabilityShifted,liabilityShiftPossible:threeDSecureInfo&&threeDSecureInfo.liabilityShiftPossible,threeDSecureInfo:paymentMethod.threeDSecureInfo}},BaseFramework.prototype._formatVerifyCardOptions=function(options){return assign({},options)},BaseFramework.prototype._formatLookupData=function(options){var data={amount:options.amount};return Promise.resolve(data)},BaseFramework.prototype._handleV1AuthResponse=function(data){var authResponse=JSON.parse(data.auth_response);authResponse.success?this._verifyCardPromisePlus.resolve(this._formatAuthResponse(authResponse.paymentMethod,authResponse.threeDSecureInfo)):authResponse.threeDSecureInfo&&authResponse.threeDSecureInfo.liabilityShiftPossible?this._verifyCardPromisePlus.resolve(this._formatAuthResponse(this._lookupPaymentMethod,authResponse.threeDSecureInfo)):this._verifyCardPromisePlus.reject(new BraintreeError({type:BraintreeError.types.UNKNOWN,code:"UNKNOWN_AUTH_RESPONSE",message:authResponse.error.message}))},BaseFramework.prototype.cancelVerifyCard=function(){var response,threeDSecureInfo;return this._verifyCardInProgress=!1,this._lookupPaymentMethod?(threeDSecureInfo=this._lookupPaymentMethod.threeDSecureInfo,response=assign({},this._lookupPaymentMethod,{liabilityShiftPossible:threeDSecureInfo&&threeDSecureInfo.liabilityShiftPossible,liabilityShifted:threeDSecureInfo&&threeDSecureInfo.liabilityShifted,verificationDetails:threeDSecureInfo&&threeDSecureInfo.verificationDetails}),Promise.resolve(response)):Promise.reject(new BraintreeError(errors.THREEDS_NO_VERIFICATION_PAYLOAD))},BaseFramework.prototype._setupV1Bus=function(options){var parentURL=window.location.href.split("#")[0],lookupResponse=options.lookupResponse,channel=uuid(),bus=new Bus({channel:channel,verifyDomain:isVerifiedDomain}),authenticationCompleteBaseUrl=this._assetsUrl+"/html/three-d-secure-authentication-complete-frame.html?channel="+encodeURIComponent(channel)+"&";return bus.on(BUS_CONFIGURATION_REQUEST_EVENT,function(reply){reply({acsUrl:lookupResponse.acsUrl,pareq:lookupResponse.pareq,termUrl:lookupResponse.termUrl+"&three_d_secure_version="+VERSION+"&authentication_complete_base_url="+encodeURIComponent(authenticationCompleteBaseUrl),md:lookupResponse.md,parentUrl:parentURL})}),bus.on(events.AUTHENTICATION_COMPLETE,options.handleAuthResponse),bus},BaseFramework.prototype._setupV1Iframe=function(options){var url=this._assetsUrl+"/html/three-d-secure-bank-frame"+useMin(this._isDebug)+".html?showLoader="+options.showLoader;return iFramer({src:url,height:400,width:400,name:constants.LANDING_FRAME_NAME+"_"+this._v1Bus.channel,title:"3D Secure Authorization Frame"})},BaseFramework.prototype._setupV1Elements=function(options){this._v1Bus=this._setupV1Bus(options),this._v1Iframe=this._setupV1Iframe(options)},BaseFramework.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)},BaseFramework.prototype.teardown=function(){return analytics.sendEvent(this._createPromise,"three-d-secure.teardown-completed"),this._teardownV1Elements(),Promise.resolve()},module.exports=BaseFramework},{"../../../lib/analytics":124,"../../../lib/assign":126,"../../../lib/braintree-error":129,"../../../lib/constants":131,"../../../lib/is-verified-domain":157,"../../../lib/promise":161,"../../../lib/use-min":164,"../../shared/constants":197,"../../shared/errors":198,"../../shared/events":199,"@braintree/event-emitter":37,"@braintree/extended-promise":38,"@braintree/iframer":39,"@braintree/uuid":43,framebus:56}],189:[function(_dereq_,module,exports){"use strict";function Bootstrap3ModalFramework(options){SongbirdFramework.call(this,options)}var SongbirdFramework=_dereq_("./songbird");Bootstrap3ModalFramework.prototype=Object.create(SongbirdFramework.prototype,{constructor:SongbirdFramework}),Bootstrap3ModalFramework.prototype._createV1IframeModalElement=function(iframe){var modal=document.createElement("div");return modal.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>',modal.querySelector("[data-braintree-v1-fallback-iframe-container]").appendChild(iframe),modal},Bootstrap3ModalFramework.prototype._createCardinalConfigurationOptions=function(setupOptions){var options=SongbirdFramework.prototype._createCardinalConfigurationOptions.call(this,setupOptions);return options.payment.framework="bootstrap3",options},module.exports=Bootstrap3ModalFramework},{"./songbird":194}],190:[function(_dereq_,module,exports){"use strict";function CardinalModalFramework(options){SongbirdFramework.call(this,options)}var SongbirdFramework=_dereq_("./songbird");CardinalModalFramework.prototype=Object.create(SongbirdFramework.prototype,{constructor:SongbirdFramework}),CardinalModalFramework.prototype._createV1IframeModalElement=function(iframe){var modal=document.createElement("div"),addCloseButton=Boolean(this._createOptions&&this._createOptions.cardinalSDKConfig&&this._createOptions.cardinalSDKConfig.payment&&this._createOptions.cardinalSDKConfig.payment.displayExitButton);return modal.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>',addCloseButton||(modal.querySelector("[data-braintree-v1-fallback-close-button]").style.display="none"),modal.querySelector("[data-braintree-v1-fallback-iframe-container]").appendChild(iframe),modal},module.exports=CardinalModalFramework},{"./songbird":194}],191:[function(_dereq_,module,exports){"use strict";var LegacyFramework=_dereq_("./legacy"),CardinalModalFramework=_dereq_("./cardinal-modal"),Bootstrap3ModalFramework=_dereq_("./bootstrap3-modal"),InlineIframeFramework=_dereq_("./inline-iframe");module.exports={legacy:LegacyFramework,"cardinal-modal":CardinalModalFramework,"bootstrap3-modal":Bootstrap3ModalFramework,"inline-iframe":InlineIframeFramework}},{"./bootstrap3-modal":189,"./cardinal-modal":190,"./inline-iframe":192,"./legacy":193}],192:[function(_dereq_,module,exports){"use strict";function InlineIframeFramework(options){SongbirdFramework.call(this,options)}var SongbirdFramework=_dereq_("./songbird"),BraintreeError=_dereq_("../../../lib/braintree-error"),errors=_dereq_("../../shared/errors"),enumerate=_dereq_("../../../lib/enumerate");InlineIframeFramework.prototype=Object.create(SongbirdFramework.prototype,{constructor:SongbirdFramework}),InlineIframeFramework.events=enumerate(["AUTHENTICATION_IFRAME_AVAILABLE"],"inline-iframe-framework:"),InlineIframeFramework.prototype.setUpEventListeners=function(reply){SongbirdFramework.prototype.setUpEventListeners.call(this,reply),this.on(InlineIframeFramework.events.AUTHENTICATION_IFRAME_AVAILABLE,function(payload,next){reply("authentication-iframe-available",payload,next)})},InlineIframeFramework.prototype._createCardinalConfigurationOptions=function(setupOptions){var options=SongbirdFramework.prototype._createCardinalConfigurationOptions.call(this,setupOptions);return options.payment.framework="inline",options},InlineIframeFramework.prototype._addV1IframeToPage=function(){this._emit(InlineIframeFramework.events.AUTHENTICATION_IFRAME_AVAILABLE,{element:this._v1Modal},function(){})},InlineIframeFramework.prototype._setupFrameworkSpecificListeners=function(){this.setCardinalListener("ui.inline.setup",this._onInlineSetup.bind(this))},InlineIframeFramework.prototype._onInlineSetup=function(htmlTemplate,details,resolve,reject){var container,hasError;if(htmlTemplate&&details?"CCA"!==details.paymentType?hasError=!0:"suppress"!==details.data.mode&&"static"!==details.data.mode&&(hasError=!0):hasError=!0,hasError)return void reject(new BraintreeError(errors.THREEDS_INLINE_IFRAME_DETAILS_INCORRECT));container=document.createElement("div"),container.innerHTML=htmlTemplate,"suppress"===details.data.mode?(container.style.display="none",document.body.appendChild(container),resolve()):"static"===details.data.mode&&this._emit(InlineIframeFramework.events.AUTHENTICATION_IFRAME_AVAILABLE,{element:container},function(){resolve()})},module.exports=InlineIframeFramework},{"../../../lib/braintree-error":129,"../../../lib/enumerate":139,"../../shared/errors":198,"./songbird":194}],193:[function(_dereq_,module,exports){"use strict";function LegacyFramework(options){BaseFramework.call(this,options)}var BaseFramework=_dereq_("./base"),deferred=_dereq_("../../../lib/deferred");LegacyFramework.prototype=Object.create(BaseFramework.prototype,{constructor:LegacyFramework}),LegacyFramework.prototype.setUpEventListeners=function(){},LegacyFramework.prototype.transformV1CustomerBillingAddress=function(customer){return customer.billingAddress.line1=customer.billingAddress.streetAddress,customer.billingAddress.line2=customer.billingAddress.extendedAddress,customer.billingAddress.city=customer.billingAddress.locality,customer.billingAddress.state=customer.billingAddress.region,customer.billingAddress.countryCode=customer.billingAddress.countryCodeAlpha2,delete customer.billingAddress.streetAddress,delete customer.billingAddress.extendedAddress,delete customer.billingAddress.locality,delete customer.billingAddress.region,delete customer.billingAddress.countryCodeAlpha2,customer},LegacyFramework.prototype._createIframe=function(options){var self=this;return this._setupV1Elements({lookupResponse:options.lookupResponse,showLoader:options.showLoader,handleAuthResponse:function(data){self._handleAuthResponse(data,options)}}),this._v1Iframe},LegacyFramework.prototype._handleAuthResponse=function(data,options){this._v1Bus.teardown(),options.removeFrame(),deferred(function(){this._handleV1AuthResponse(data)}.bind(this))()},LegacyFramework.prototype._checkForFrameworkSpecificVerifyCardErrors=function(options){var errorOption;return"function"!=typeof options.addFrame?errorOption="an addFrame function":"function"!=typeof options.removeFrame&&(errorOption="a removeFrame function"),errorOption},LegacyFramework.prototype._formatVerifyCardOptions=function(options){var modifiedOptions=BaseFramework.prototype._formatVerifyCardOptions.call(this,options);return modifiedOptions.addFrame=deferred(options.addFrame),modifiedOptions.removeFrame=deferred(options.removeFrame),modifiedOptions.showLoader=!1!==options.showLoader,modifiedOptions},LegacyFramework.prototype._formatLookupData=function(options){var self=this;return BaseFramework.prototype._formatLookupData.call(this,options).then(function(data){return options.customer&&options.customer.billingAddress&&(data.customer=self.transformV1CustomerBillingAddress(options.customer)),data})},LegacyFramework.prototype._presentChallenge=function(lookupResponse,options){options.addFrame(null,this._createIframe({showLoader:options.showLoader,lookupResponse:lookupResponse.lookup,removeFrame:options.removeFrame}))},module.exports=LegacyFramework},{"../../../lib/deferred":137,"./base":188}],194:[function(_dereq_,module,exports){"use strict";function SongbirdFramework(options){BaseFramework.call(this,options),this._useV1Fallback=!1,this._clientMetadata={requestedThreeDSecureVersion:"2",sdkVersion:PLATFORM+"/"+VERSION},this._getDfReferenceIdPromisePlus=new ExtendedPromise,this.setupSongbird(options),this._cardinalEvents=[]}function extractAddressData(source,target,prefix){target[prefix+"Line1"]=source.streetAddress,target[prefix+"Line2"]=source.extendedAddress,target[prefix+"Line3"]=source.line3,target[prefix+"City"]=source.locality,target[prefix+"State"]=source.region,target[prefix+"PostalCode"]=source.postalCode,target[prefix+"CountryCode"]=source.countryCodeAlpha2}var BaseFramework=_dereq_("./base"),assign=_dereq_("../../../lib/assign").assign,deferred=_dereq_("../../../lib/deferred"),BraintreeError=_dereq_("../../../lib/braintree-error"),convertToBraintreeError=_dereq_("../../../lib/convert-to-braintree-error"),analytics=_dereq_("../../../lib/analytics"),assets=_dereq_("../../../lib/assets"),errors=_dereq_("../../shared/errors"),enumerate=_dereq_("../../../lib/enumerate"),constants=_dereq_("../../shared/constants"),Promise=_dereq_("../../../lib/promise"),ExtendedPromise=_dereq_("@braintree/extended-promise"),INTEGRATION_TIMEOUT_MS=_dereq_("../../../lib/constants").INTEGRATION_TIMEOUT_MS,PLATFORM=_dereq_("../../../lib/constants").PLATFORM,VERSION="3.69.0",SONGBIRD_UI_EVENTS=["ui.close","ui.render","ui.renderHidden","ui.loading.close","ui.loading.render"];SongbirdFramework.prototype=Object.create(BaseFramework.prototype,{constructor:SongbirdFramework}),SongbirdFramework.events=enumerate(["LOOKUP_COMPLETE","CUSTOMER_CANCELED","UI.CLOSE","UI.RENDER","UI.RENDERHIDDEN","UI.LOADING.CLOSE","UI.LOADING.RENDER"],"songbird-framework:"),SongbirdFramework.prototype.setUpEventListeners=function(reply){this.on(SongbirdFramework.events.LOOKUP_COMPLETE,function(data,next){reply("lookup-complete",data,next)}),this.on(SongbirdFramework.events.CUSTOMER_CANCELED,function(){reply("customer-canceled")}),this.on(SongbirdFramework.events["UI.CLOSE"],function(){reply("authentication-modal-close")}),this.on(SongbirdFramework.events["UI.RENDER"],function(){reply("authentication-modal-render")}),this.on(SongbirdFramework.events["UI.RENDERHIDDEN"],function(){reply("authentication-modal-render-hidden")}),this.on(SongbirdFramework.events["UI.LOADING.CLOSE"],function(){reply("authentication-modal-loader-close")}),this.on(SongbirdFramework.events["UI.LOADING.RENDER"],function(){reply("authentication-modal-loader-render")})},SongbirdFramework.prototype.prepareLookup=function(options){var data=assign({},options),self=this;return this.getDfReferenceId().then(function(id){data.dfReferenceId=id}).then(function(){return self._triggerCardinalBinProcess(options.bin)}).catch(function(){}).then(function(){return self._waitForClient()}).then(function(){return data.clientMetadata=self._clientMetadata,data.authorizationFingerprint=self._client.getConfiguration().authorizationFingerprint,data.braintreeLibraryVersion="braintree/web/"+VERSION,data})},SongbirdFramework.prototype.initializeChallengeWithLookupResponse=function(lookupResponse,options){return this.setupSongbird().then(function(){return BaseFramework.prototype.initializeChallengeWithLookupResponse.call(this,lookupResponse,options)}.bind(this))},SongbirdFramework.prototype._initiateV1Fallback=function(errorType){this._useV1Fallback=!0,
analytics.sendEvent(this._createPromise,"three-d-secure.v1-fallback."+errorType),this._songbirdPromise.resolve()},SongbirdFramework.prototype._triggerCardinalBinProcess=function(bin){var self=this,issuerStartTime=Date.now();return bin?window.Cardinal.trigger("bin.process",bin).then(function(binResults){self._clientMetadata.issuerDeviceDataCollectionTimeElapsed=Date.now()-issuerStartTime,self._clientMetadata.issuerDeviceDataCollectionResult=binResults&&binResults.Status}):Promise.resolve()},SongbirdFramework.prototype.transformBillingAddress=function(additionalInformation,billingAddress){return billingAddress&&(extractAddressData(billingAddress,additionalInformation,"billing"),additionalInformation.billingPhoneNumber=billingAddress.phoneNumber,additionalInformation.billingGivenName=billingAddress.givenName,additionalInformation.billingSurname=billingAddress.surname),additionalInformation},SongbirdFramework.prototype.transformShippingAddress=function(additionalInformation){var shippingAddress=additionalInformation.shippingAddress;return shippingAddress&&(extractAddressData(shippingAddress,additionalInformation,"shipping"),delete additionalInformation.shippingAddress),additionalInformation},SongbirdFramework.prototype._createV1IframeModalElement=function(iframe){var modal=document.createElement("div");return modal.innerHTML='<div data-braintree-v1-fallback-iframe-container="true" style="height: 400px;"></div>',modal.querySelector('[data-braintree-v1-fallback-iframe-container="true"]').appendChild(iframe),modal},SongbirdFramework.prototype._createV1IframeModal=function(iframe){function closeHandler(){modal.parentNode.removeChild(modal),self.cancelVerifyCard(errors.THREEDS_CARDINAL_SDK_CANCELED),document.removeEventListener("keyup",self._onV1Keyup),self._onV1Keyup=null}var modal=this._createV1IframeModalElement(iframe),btn=modal.querySelector("[data-braintree-v1-fallback-close-button]"),backdrop=modal.querySelector("[data-braintree-v1-fallback-backdrop]"),self=this;return this._onV1Keyup=function(e){"Escape"===e.key&&modal.parentNode&&closeHandler()},btn&&btn.addEventListener("click",closeHandler),backdrop&&backdrop.addEventListener("click",closeHandler),document.addEventListener("keyup",this._onV1Keyup),modal},SongbirdFramework.prototype._addV1IframeToPage=function(){document.body.appendChild(this._v1Modal)},SongbirdFramework.prototype._handleAuthResponseFromV1Fallback=function(data){this._teardownV1Elements(),this._v1Modal.parentNode.removeChild(this._v1Modal),this._handleV1AuthResponse(data)},SongbirdFramework.prototype._presentChallengeWithV1Fallback=function(lookupResponse){var self=this;this._setupV1Elements({lookupResponse:lookupResponse,showLoader:!0,handleAuthResponse:function(data){self._handleAuthResponseFromV1Fallback(data)}}),this._v1Modal=this._createV1IframeModal(this._v1Iframe),this._addV1IframeToPage()},SongbirdFramework.prototype.setupSongbird=function(setupOptions){var self=this,startTime=Date.now();return this._songbirdPromise?this._songbirdPromise:(setupOptions=setupOptions||{},this._songbirdPromise=new ExtendedPromise,this._v2SetupFailureReason="reason-unknown",self._loadCardinalScript(setupOptions).then(function(){return window.Cardinal?self._configureCardinalSdk({setupOptions:setupOptions,setupStartTime:startTime}):(self._v2SetupFailureReason="cardinal-global-unavailable",Promise.reject(new BraintreeError(errors.THREEDS_CARDINAL_SDK_SETUP_FAILED)))}).catch(function(err){var error=convertToBraintreeError(err,{type:errors.THREEDS_CARDINAL_SDK_SETUP_FAILED.type,code:errors.THREEDS_CARDINAL_SDK_SETUP_FAILED.code,message:errors.THREEDS_CARDINAL_SDK_SETUP_FAILED.message});self._getDfReferenceIdPromisePlus.reject(error),window.clearTimeout(self._songbirdSetupTimeoutReference),analytics.sendEvent(self._client,"three-d-secure.cardinal-sdk.init.setup-failed"),self._initiateV1Fallback("cardinal-sdk-setup-failed."+self._v2SetupFailureReason)}),this._songbirdPromise)},SongbirdFramework.prototype._configureCardinalSdk=function(config){var self=this;return this._waitForClient().then(function(){var jwt=self._client.getConfiguration().gatewayConfiguration.threeDSecure.cardinalAuthenticationJWT,setupOptions=config.setupOptions,setupStartTime=config.setupStartTime,cardinalConfiguration=self._createCardinalConfigurationOptions(setupOptions);SONGBIRD_UI_EVENTS.forEach(function(eventName){self.setCardinalListener(eventName,function(){self._emit(SongbirdFramework.events[eventName.toUpperCase()])})}),self.setCardinalListener("payments.setupComplete",self._createPaymentsSetupCompleteCallback()),self._setupFrameworkSpecificListeners(),window.Cardinal.configure(cardinalConfiguration),window.Cardinal.setup("init",{jwt:jwt}),self._clientMetadata.cardinalDeviceDataCollectionTimeElapsed=Date.now()-setupStartTime,self.setCardinalListener("payments.validated",self._createPaymentsValidatedCallback())}).catch(function(err){return self._v2SetupFailureReason="cardinal-configuration-threw-error",Promise.reject(err)})},SongbirdFramework.prototype.setCardinalListener=function(eventName,cb){this._cardinalEvents.push(eventName),window.Cardinal.on(eventName,cb)},SongbirdFramework.prototype._setupFrameworkSpecificListeners=function(){},SongbirdFramework.prototype._createCardinalConfigurationOptions=function(setupOptions){var cardinalConfiguration=setupOptions.cardinalSDKConfig||{},paymentSettings=cardinalConfiguration.payment||{};return!cardinalConfiguration.logging&&setupOptions.loggingEnabled&&(cardinalConfiguration.logging={level:"verbose"}),cardinalConfiguration.payment={},paymentSettings.hasOwnProperty("displayLoading")&&(cardinalConfiguration.payment.displayLoading=paymentSettings.displayLoading),paymentSettings.hasOwnProperty("displayExitButton")&&(cardinalConfiguration.payment.displayExitButton=paymentSettings.displayExitButton),cardinalConfiguration},SongbirdFramework.prototype._loadCardinalScript=function(setupOptions){var self=this,scriptSource=constants.CARDINAL_SCRIPT_SOURCE.sandbox;return this._waitForClient().then(function(){var isProduction="production"===self._client.getConfiguration().gatewayConfiguration.environment;return self._songbirdSetupTimeoutReference=window.setTimeout(function(){analytics.sendEvent(self._client,"three-d-secure.cardinal-sdk.init.setup-timeout"),self._initiateV1Fallback("cardinal-sdk-setup-timeout")},setupOptions.timeout||INTEGRATION_TIMEOUT_MS),isProduction&&(scriptSource=constants.CARDINAL_SCRIPT_SOURCE.production),assets.loadScript({src:scriptSource})}).catch(function(err){return self._v2SetupFailureReason="songbird-js-failed-to-load",Promise.reject(convertToBraintreeError(err,errors.THREEDS_CARDINAL_SDK_SCRIPT_LOAD_FAILED))})},SongbirdFramework.prototype._createPaymentsSetupCompleteCallback=function(){var self=this;return function(data){self._getDfReferenceIdPromisePlus.resolve(data.sessionId),window.clearTimeout(self._songbirdSetupTimeoutReference),analytics.sendEvent(self._createPromise,"three-d-secure.cardinal-sdk.init.setup-completed"),self._songbirdPromise.resolve()}},SongbirdFramework.prototype.getDfReferenceId=function(){return this._getDfReferenceIdPromisePlus},SongbirdFramework.prototype._performJWTValidation=function(rawCardinalSDKVerificationData,jwt){var self=this,nonce=this._lookupPaymentMethod.nonce,url="payment_methods/"+nonce+"/three_d_secure/authenticate_from_jwt",cancelCode=rawCardinalSDKVerificationData&&rawCardinalSDKVerificationData.Payment&&rawCardinalSDKVerificationData.Payment.ExtendedData&&rawCardinalSDKVerificationData.Payment.ExtendedData.ChallengeCancel;return cancelCode&&(analytics.sendEvent(this._createPromise,"three-d-secure.verification-flow.cardinal-sdk.cancel-code."+cancelCode),"01"===cancelCode&&this._emit(SongbirdFramework.events.CUSTOMER_CANCELED)),analytics.sendEvent(this._createPromise,"three-d-secure.verification-flow.upgrade-payment-method.started"),this._waitForClient().then(function(){return self._client.request({method:"post",endpoint:url,data:{jwt:jwt,paymentMethodNonce:nonce}})}).then(function(response){var paymentMethod=response.paymentMethod||self._lookupPaymentMethod,formattedResponse=self._formatAuthResponse(paymentMethod,response.threeDSecureInfo);return formattedResponse.rawCardinalSDKVerificationData=rawCardinalSDKVerificationData,analytics.sendEvent(self._client,"three-d-secure.verification-flow.upgrade-payment-method.succeeded"),Promise.resolve(formattedResponse)}).catch(function(err){var error=new BraintreeError({type:errors.THREEDS_JWT_AUTHENTICATION_FAILED.type,code:errors.THREEDS_JWT_AUTHENTICATION_FAILED.code,message:errors.THREEDS_JWT_AUTHENTICATION_FAILED.message,details:{originalError:err}});return analytics.sendEvent(self._client,"three-d-secure.verification-flow.upgrade-payment-method.errored"),Promise.reject(error)})},SongbirdFramework.prototype._createPaymentsValidatedCallback=function(){var self=this;return function(data,validatedJwt){var formattedError;if(analytics.sendEvent(self._createPromise,"three-d-secure.verification-flow.cardinal-sdk.action-code."+data.ActionCode.toLowerCase()),!self._verifyCardPromisePlus)return void self._initiateV1Fallback("cardinal-sdk-setup-error.number-"+data.ErrorNumber);switch(data.ActionCode){case"SUCCESS":case"NOACTION":case"FAILURE":self._performJWTValidation(data,validatedJwt).then(function(result){self._verifyCardPromisePlus.resolve(result)}).catch(function(err){self._verifyCardPromisePlus.reject(err)});break;case"ERROR":switch(analytics.sendEvent(self._createPromise,"three-d-secure.verification-flow.cardinal-sdk-error."+data.ErrorNumber),data.ErrorNumber){case 10001:case 10002:formattedError=new BraintreeError(errors.THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT);break;case 10003:case 10007:case 10009:formattedError=new BraintreeError(errors.THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT);break;case 10005:case 10006:formattedError=new BraintreeError(errors.THREEDS_CARDINAL_SDK_BAD_CONFIG);break;case 10008:case 10010:formattedError=new BraintreeError(errors.THREEDS_CARDINAL_SDK_BAD_JWT);break;case 10011:analytics.sendEvent(self._createPromise,"three-d-secure.verification-flow.canceled"),formattedError=new BraintreeError(errors.THREEDS_CARDINAL_SDK_CANCELED);break;default:formattedError=new BraintreeError(errors.THREEDS_CARDINAL_SDK_ERROR)}formattedError.details={originalError:{code:data.ErrorNumber,description:data.ErrorDescription}},self._verifyCardPromisePlus.reject(formattedError)}}},SongbirdFramework.prototype._checkForVerifyCardError=function(options,privateOptions){return BaseFramework.prototype._checkForVerifyCardError.call(this,options,privateOptions)},SongbirdFramework.prototype._checkForFrameworkSpecificVerifyCardErrors=function(options,privateOptions){var errorOption;return"function"==typeof options.onLookupComplete||privateOptions.ignoreOnLookupCompleteRequirement||(errorOption="an onLookupComplete function"),errorOption},SongbirdFramework.prototype._formatVerifyCardOptions=function(options){var modifiedOptions=BaseFramework.prototype._formatVerifyCardOptions.call(this,options),additionalInformation=modifiedOptions.additionalInformation||{};return additionalInformation=this.transformBillingAddress(additionalInformation,options.billingAddress),additionalInformation=this.transformShippingAddress(additionalInformation),options.onLookupComplete&&(modifiedOptions.onLookupComplete=deferred(options.onLookupComplete)),options.email&&(additionalInformation.email=options.email),options.mobilePhoneNumber&&(additionalInformation.mobilePhoneNumber=options.mobilePhoneNumber),modifiedOptions.additionalInformation=additionalInformation,modifiedOptions},SongbirdFramework.prototype._onLookupComplete=function(lookupResponse,options){var self=this;return BaseFramework.prototype._onLookupComplete.call(this,lookupResponse).then(function(response){return new Promise(function(resolve,reject){function next(){resolve(response)}response.requiresUserAuthentication=Boolean(response.lookup&&response.lookup.acsUrl),self._verifyCardPromisePlus.catch(reject),options.onLookupComplete?options.onLookupComplete(response,next):self._emit(SongbirdFramework.events.LOOKUP_COMPLETE,response,next)})})},SongbirdFramework.prototype._presentChallenge=function(lookupResponse){if(this._useV1Fallback)return void this._presentChallengeWithV1Fallback(lookupResponse.lookup);window.Cardinal.continue("cca",{AcsUrl:lookupResponse.lookup.acsUrl,Payload:lookupResponse.lookup.pareq},{OrderDetails:{TransactionId:lookupResponse.lookup.transactionId}})},SongbirdFramework.prototype._formatLookupData=function(options){var self=this;return BaseFramework.prototype._formatLookupData.call(this,options).then(function(data){return data.additionalInfo=options.additionalInformation,options.challengeRequested&&(data.challengeRequested=options.challengeRequested),options.exemptionRequested&&(data.exemptionRequested=options.exemptionRequested),options.bin&&(data.bin=options.bin),self.prepareLookup(data)})},SongbirdFramework.prototype.cancelVerifyCard=function(verifyCardError){var self=this;return BaseFramework.prototype.cancelVerifyCard.call(this).then(function(response){return self._verifyCardPromisePlus&&(verifyCardError=verifyCardError||new BraintreeError(errors.THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT),self._verifyCardPromisePlus.reject(verifyCardError)),response})},SongbirdFramework.prototype.teardown=function(){return window.Cardinal&&this._cardinalEvents.forEach(function(eventName){window.Cardinal.off(eventName)}),BaseFramework.prototype.teardown.call(this)},module.exports=SongbirdFramework},{"../../../lib/analytics":124,"../../../lib/assets":125,"../../../lib/assign":126,"../../../lib/braintree-error":129,"../../../lib/constants":131,"../../../lib/convert-to-braintree-error":133,"../../../lib/deferred":137,"../../../lib/enumerate":139,"../../../lib/promise":161,"../../shared/constants":197,"../../shared/errors":198,"./base":188,"@braintree/extended-promise":38}],195:[function(_dereq_,module,exports){"use strict";function ThreeDSecure(options){var self=this,Framework=FRAMEWORKS[options.framework];EventEmitter.call(this),this._framework=new Framework(options),this._framework.setUpEventListeners(function(){self._emit.apply(self,arguments)})}var wrapPromise=_dereq_("@braintree/wrap-promise"),methods=_dereq_("../../lib/methods"),convertMethodsToError=_dereq_("../../lib/convert-methods-to-error"),EventEmitter=_dereq_("@braintree/event-emitter"),FRAMEWORKS=_dereq_("./frameworks");EventEmitter.createChild(ThreeDSecure),ThreeDSecure.prototype.verifyCard=function(options){var privateOptions;return this.hasListener("lookup-complete")&&(privateOptions={ignoreOnLookupCompleteRequirement:!0}),this._framework.verifyCard(options,privateOptions)},ThreeDSecure.prototype.initializeChallengeWithLookupResponse=function(lookupResponse){return"string"==typeof lookupResponse&&(lookupResponse=JSON.parse(lookupResponse)),this._framework.initializeChallengeWithLookupResponse(lookupResponse)},ThreeDSecure.prototype.prepareLookup=function(options){return this._framework.prepareLookup(options).then(function(data){return JSON.stringify(data)})},ThreeDSecure.prototype.cancelVerifyCard=function(){return this._framework.cancelVerifyCard()},ThreeDSecure.prototype.teardown=function(){var methodNames=methods(ThreeDSecure.prototype).concat(methods(EventEmitter.prototype));return convertMethodsToError(this,methodNames),this._framework.teardown()},module.exports=wrapPromise.wrapPrototype(ThreeDSecure)},{"../../lib/convert-methods-to-error":132,"../../lib/methods":159,"./frameworks":191,"@braintree/event-emitter":37,"@braintree/wrap-promise":47}],196:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"3D Secure",client:options.client,authorization:options.authorization}).then(function(){var assetsUrl=createAssetsUrl.create(options.authorization),framework=getFramework(options),createPromise=createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:assetsUrl,name:"3D Secure"}).then(function(client){var error,isProduction,config=client.getConfiguration(),gwConfig=config.gatewayConfiguration;return options.client=client,gwConfig.threeDSecureEnabled||(error=errors.THREEDS_NOT_ENABLED),"TOKENIZATION_KEY"===config.authorizationType&&(error=errors.THREEDS_CAN_NOT_USE_TOKENIZATION_KEY),isProduction="production"===gwConfig.environment,isProduction&&!isHTTPS()&&(error=errors.THREEDS_HTTPS_REQUIRED),"legacy"===framework||gwConfig.threeDSecure&&gwConfig.threeDSecure.cardinalAuthenticationJWT||(analytics.sendEvent(options.client,"three-d-secure.initialization.failed.missing-cardinalAuthenticationJWT"),error=errors.THREEDS_NOT_ENABLED_FOR_V2),error?Promise.reject(new BraintreeError(error)):(analytics.sendEvent(options.client,"three-d-secure.initialized"),client)}),instance=new ThreeDSecure({client:options.client,assetsUrl:assetsUrl,createPromise:createPromise,loggingEnabled:options.loggingEnabled,cardinalSDKConfig:options.cardinalSDKConfig,framework:framework});return options.client?createPromise.then(function(){return instance}):instance})}function getFramework(options){var version=String(options.version||"");if(!version||"1"===version)return"legacy";switch(version){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 BraintreeError({code:errors.THREEDS_UNRECOGNIZED_VERSION.code,type:errors.THREEDS_UNRECOGNIZED_VERSION.type,message:"Version `"+options.version+"` is not a recognized version. You may need to update the version of your Braintree SDK to support this version."})}}var ThreeDSecure=_dereq_("./external/three-d-secure"),isHTTPS=_dereq_("../lib/is-https").isHTTPS,basicComponentVerification=_dereq_("../lib/basic-component-verification"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),BraintreeError=_dereq_("../lib/braintree-error"),analytics=_dereq_("../lib/analytics"),errors=_dereq_("./shared/errors"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/analytics":124,"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/is-https":156,"../lib/promise":161,"./external/three-d-secure":195,"./shared/errors":198,"@braintree/wrap-promise":47}],197:[function(_dereq_,module,exports){"use strict";module.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"}}},{}],198:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../../lib/braintree-error");module.exports={THREEDS_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"THREEDS_NOT_ENABLED",message:"3D Secure is not enabled for this merchant."},THREEDS_CAN_NOT_USE_TOKENIZATION_KEY:{type:BraintreeError.types.MERCHANT,code:"THREEDS_CAN_NOT_USE_TOKENIZATION_KEY",message:"3D Secure can not use a tokenization key for authorization."},THREEDS_HTTPS_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"THREEDS_HTTPS_REQUIRED",message:"3D Secure requires HTTPS."},THREEDS_NOT_ENABLED_FOR_V2:{type:BraintreeError.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:BraintreeError.types.MERCHANT,code:"THREEDS_UNRECOGNIZED_VERSION"},THREEDS_CARDINAL_SDK_SETUP_FAILED:{type:BraintreeError.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:BraintreeError.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:BraintreeError.types.UNKNOWN,code:"THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT",message:"Cardinal's Songbird.js took too long to setup."},THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT:{type:BraintreeError.types.UNKNOWN,code:"THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT",message:"Cardinal's API took too long to respond."},THREEDS_CARDINAL_SDK_BAD_CONFIG:{type:BraintreeError.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:BraintreeError.types.MERCHANT,code:"THREEDS_CARDINAL_SDK_BAD_JWT",message:"Cardinal JWT missing or malformed. Please check your setup configuration."},THREEDS_CARDINAL_SDK_ERROR:{type:BraintreeError.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:BraintreeError.types.CUSTOMER,code:"THREEDS_CARDINAL_SDK_CANCELED",message:"Canceled by user."},THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT:{type:BraintreeError.types.MERCHANT,code:"THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT",message:"3D Secure verfication canceled by merchant."},THREEDS_AUTHENTICATION_IN_PROGRESS:{type:BraintreeError.types.MERCHANT,code:"THREEDS_AUTHENTICATION_IN_PROGRESS",message:"Cannot call verifyCard while existing authentication is in progress."},THREEDS_MISSING_VERIFY_CARD_OPTION:{type:BraintreeError.types.MERCHANT,code:"THREEDS_MISSING_VERIFY_CARD_OPTION"},THREEDS_JWT_AUTHENTICATION_FAILED:{type:BraintreeError.types.UNKNOWN,code:"THREEDS_JWT_AUTHENTICATION_FAILED",message:"Something went wrong authenticating the JWT from Cardinal"},THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR:{type:BraintreeError.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:BraintreeError.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:BraintreeError.types.UNKNOWN,code:"THREEDS_LOOKUP_ERROR",message:"Something went wrong during the 3D Secure lookup"},THREEDS_INLINE_IFRAME_DETAILS_INCORRECT:{type:BraintreeError.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:BraintreeError.types.MERCHANT,code:"THREEDS_NO_VERIFICATION_PAYLOAD",message:"No verification payload available."},THREEDS_TERM_URL_REQUIRES_BRAINTREE_DOMAIN:{type:BraintreeError.types.INTERNAL,code:"THREEDS_TERM_URL_REQUIRES_BRAINTREE_DOMAIN",message:"Term Url must be on a Braintree domain."},THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED:{type:BraintreeError.types.INTERNAL,code:"THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED",message:"Method not implemented for this framework."}}},{"../../lib/braintree-error":129}],199:[function(_dereq_,module,exports){"use strict";var enumerate=_dereq_("../../lib/enumerate");module.exports=enumerate(["AUTHENTICATION_COMPLETE"],"threedsecure:")},{"../../lib/enumerate":139}],200:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"UnionPay",client:options.client,authorization:options.authorization}).then(function(){return createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:"UnionPay"})}).then(function(client){var config=client.getConfiguration();return options.client=client,config.gatewayConfiguration.unionPay&&!0===config.gatewayConfiguration.unionPay.enabled?(analytics.sendEvent(options.client,"unionpay.initialized"),new UnionPay(options)):Promise.reject(new BraintreeError(errors.UNIONPAY_NOT_ENABLED))})}var UnionPay=_dereq_("./shared/unionpay"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),BraintreeError=_dereq_("../lib/braintree-error"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),analytics=_dereq_("../lib/analytics"),errors=_dereq_("./shared/errors"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/analytics":124,"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"./shared/errors":202,"./shared/unionpay":203,"@braintree/wrap-promise":47}],201:[function(_dereq_,module,exports){"use strict";var enumerate=_dereq_("../../lib/enumerate");module.exports={events:enumerate(["HOSTED_FIELDS_FETCH_CAPABILITIES","HOSTED_FIELDS_ENROLL","HOSTED_FIELDS_TOKENIZE"],"union-pay:"),HOSTED_FIELDS_FRAME_NAME:"braintreeunionpayhostedfields"}},{"../../lib/enumerate":139}],202:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../../lib/braintree-error");module.exports={UNIONPAY_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"UNIONPAY_NOT_ENABLED",message:"UnionPay is not enabled for this merchant."},UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID:{type:BraintreeError.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:BraintreeError.types.MERCHANT,code:"UNIONPAY_HOSTED_FIELDS_INSTANCE_REQUIRED",message:"Could not find the Hosted Fields instance."},UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED:{type:BraintreeError.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:BraintreeError.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:BraintreeError.types.MERCHANT,code:"UNIONPAY_EXPIRATION_DATE_INCOMPLETE",message:"You must supply expiration month and year or neither."},UNIONPAY_ENROLLMENT_CUSTOMER_INPUT_INVALID:{type:BraintreeError.types.CUSTOMER,code:"UNIONPAY_ENROLLMENT_CUSTOMER_INPUT_INVALID",message:"Enrollment failed due to user input error."},UNIONPAY_ENROLLMENT_NETWORK_ERROR:{type:BraintreeError.types.NETWORK,code:"UNIONPAY_ENROLLMENT_NETWORK_ERROR",message:"Could not enroll UnionPay card."},UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR:{type:BraintreeError.types.NETWORK,code:"UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR",message:"Could not fetch card capabilities."},UNIONPAY_TOKENIZATION_NETWORK_ERROR:{type:BraintreeError.types.NETWORK,code:"UNIONPAY_TOKENIZATION_NETWORK_ERROR",message:"A tokenization network error occurred."},UNIONPAY_MISSING_MOBILE_PHONE_DATA:{type:BraintreeError.types.MERCHANT,code:"UNIONPAY_MISSING_MOBILE_PHONE_DATA",message:"A `mobile` with `countryCode` and `number` is required."},UNIONPAY_FAILED_TOKENIZATION:{type:BraintreeError.types.CUSTOMER,code:"UNIONPAY_FAILED_TOKENIZATION",message:"The supplied card data failed tokenization."}}},{"../../lib/braintree-error":129}],203:[function(_dereq_,module,exports){"use strict";function UnionPay(options){this._options=options}var analytics=_dereq_("../../lib/analytics"),BraintreeError=_dereq_("../../lib/braintree-error"),Bus=_dereq_("framebus"),constants=_dereq_("./constants"),isVerifiedDomain=_dereq_("../../lib/is-verified-domain"),useMin=_dereq_("../../lib/use-min"),convertMethodsToError=_dereq_("../../lib/convert-methods-to-error"),errors=_dereq_("./errors"),events=constants.events,iFramer=_dereq_("@braintree/iframer"),methods=_dereq_("../../lib/methods"),uuid=_dereq_("@braintree/uuid"),Promise=_dereq_("../../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),BUS_CONFIGURATION_REQUEST_EVENT=_dereq_("../../lib/constants").BUS_CONFIGURATION_REQUEST_EVENT;UnionPay.prototype.fetchCapabilities=function(options){var self=this,client=this._options.client,cardNumber=options.card?options.card.number:null,hostedFields=options.hostedFields;return cardNumber&&hostedFields?Promise.reject(new BraintreeError(errors.UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES)):cardNumber?client.request({method:"get",endpoint:"payment_methods/credit_cards/capabilities",data:{_meta:{source:"unionpay"},creditCard:{number:cardNumber}}}).then(function(response){return analytics.sendEvent(client,"unionpay.capabilities-received"),response}).catch(function(err){var status=err.details&&err.details.httpStatus;return analytics.sendEvent(client,"unionpay.capabilities-failed"),403===status?Promise.reject(err):Promise.reject(new BraintreeError({type:errors.UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR.type,code:errors.UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR.code,message:errors.UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR.message,details:{originalError:err}}))}):hostedFields?hostedFields._bus?self._initializeHostedFields().then(function(){return new Promise(function(resolve,reject){self._bus.emit(events.HOSTED_FIELDS_FETCH_CAPABILITIES,{hostedFields:hostedFields},function(response){if(response.err)return void reject(new BraintreeError(response.err));resolve(response.payload)})})}):Promise.reject(new BraintreeError(errors.UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID)):Promise.reject(new BraintreeError(errors.UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED))},UnionPay.prototype.enroll=function(options){var data,self=this,client=this._options.client,card=options.card,mobile=options.mobile,hostedFields=options.hostedFields;if(!mobile)return Promise.reject(new BraintreeError(errors.UNIONPAY_MISSING_MOBILE_PHONE_DATA));if(hostedFields)return hostedFields._bus?card?Promise.reject(new BraintreeError(errors.UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES)):new Promise(function(resolve,reject){self._initializeHostedFields().then(function(){self._bus.emit(events.HOSTED_FIELDS_ENROLL,{hostedFields:hostedFields,mobile:mobile},function(response){if(response.err)return void reject(new BraintreeError(response.err));resolve(response.payload)})})}):Promise.reject(new BraintreeError(errors.UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID));if(card&&card.number){if(data={_meta:{source:"unionpay"},unionPayEnrollment:{number:card.number,mobileCountryCode:mobile.countryCode,mobileNumber:mobile.number}},card.expirationDate)data.unionPayEnrollment.expirationDate=card.expirationDate;else if(card.expirationMonth||card.expirationYear){if(!card.expirationMonth||!card.expirationYear)return Promise.reject(new BraintreeError(errors.UNIONPAY_EXPIRATION_DATE_INCOMPLETE));data.unionPayEnrollment.expirationYear=card.expirationYear,data.unionPayEnrollment.expirationMonth=card.expirationMonth}return client.request({method:"post",endpoint:"union_pay_enrollments",data:data}).then(function(response){return analytics.sendEvent(client,"unionpay.enrollment-succeeded"),{enrollmentId:response.unionPayEnrollmentId,smsCodeRequired:response.smsCodeRequired}}).catch(function(err){var error,status=err.details&&err.details.httpStatus;return 403===status?error=err:status<500?(error=new BraintreeError(errors.UNIONPAY_ENROLLMENT_CUSTOMER_INPUT_INVALID),error.details={originalError:err}):(error=new BraintreeError(errors.UNIONPAY_ENROLLMENT_NETWORK_ERROR),error.details={originalError:err}),analytics.sendEvent(client,"unionpay.enrollment-failed"),Promise.reject(error)})}return Promise.reject(new BraintreeError(errors.UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED))},UnionPay.prototype.tokenize=function(options){var data,self=this,client=this._options.client,card=options.card,hostedFields=options.hostedFields
;return card&&hostedFields?Promise.reject(new BraintreeError(errors.UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES)):card?(data={_meta:{source:"unionpay"},creditCard:{number:options.card.number,options:{unionPayEnrollment:{id:options.enrollmentId}}}},options.smsCode&&(data.creditCard.options.unionPayEnrollment.smsCode=options.smsCode),card.expirationDate?data.creditCard.expirationDate=card.expirationDate:card.expirationMonth&&card.expirationYear&&(data.creditCard.expirationYear=card.expirationYear,data.creditCard.expirationMonth=card.expirationMonth),options.card.cvv&&(data.creditCard.cvv=options.card.cvv),client.request({method:"post",endpoint:"payment_methods/credit_cards",data:data}).then(function(response){var tokenizedCard=response.creditCards[0];return delete tokenizedCard.consumed,delete tokenizedCard.threeDSecureInfo,analytics.sendEvent(client,"unionpay.nonce-received"),tokenizedCard}).catch(function(err){var error,status=err.details&&err.details.httpStatus;return analytics.sendEvent(client,"unionpay.nonce-failed"),403===status?error=err:status<500?(error=new BraintreeError(errors.UNIONPAY_FAILED_TOKENIZATION),error.details={originalError:err}):(error=new BraintreeError(errors.UNIONPAY_TOKENIZATION_NETWORK_ERROR),error.details={originalError:err}),Promise.reject(error)})):hostedFields?hostedFields._bus?new Promise(function(resolve,reject){self._initializeHostedFields().then(function(){self._bus.emit(events.HOSTED_FIELDS_TOKENIZE,options,function(response){if(response.err)return void reject(new BraintreeError(response.err));resolve(response.payload)})})}):Promise.reject(new BraintreeError(errors.UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID)):Promise.reject(new BraintreeError(errors.UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED))},UnionPay.prototype.teardown=function(){return this._bus&&(this._hostedFieldsFrame.parentNode.removeChild(this._hostedFieldsFrame),this._bus.teardown()),convertMethodsToError(this,methods(UnionPay.prototype)),Promise.resolve()},UnionPay.prototype._initializeHostedFields=function(){var assetsUrl,isDebug,componentId=uuid(),self=this;return this._hostedFieldsInitializePromise?this._hostedFieldsInitializePromise:(this._hostedFieldsInitializePromise=new Promise(function(resolve){assetsUrl=self._options.client.getConfiguration().gatewayConfiguration.assetsUrl,isDebug=self._options.client.getConfiguration().isDebug,self._bus=new Bus({channel:componentId,verifyDomain:isVerifiedDomain}),self._hostedFieldsFrame=iFramer({name:constants.HOSTED_FIELDS_FRAME_NAME+"_"+componentId,src:assetsUrl+"/web/3.69.0/html/unionpay-hosted-fields-frame"+useMin(isDebug)+".html",height:0,width:0}),self._bus.on(BUS_CONFIGURATION_REQUEST_EVENT,function(reply){reply(self._options.client),resolve()}),document.body.appendChild(self._hostedFieldsFrame)}),this._hostedFieldsInitializePromise)},module.exports=wrapPromise.wrapPrototype(UnionPay)},{"../../lib/analytics":124,"../../lib/braintree-error":129,"../../lib/constants":131,"../../lib/convert-methods-to-error":132,"../../lib/is-verified-domain":157,"../../lib/methods":159,"../../lib/promise":161,"../../lib/use-min":164,"./constants":201,"./errors":202,"@braintree/iframer":39,"@braintree/uuid":43,"@braintree/wrap-promise":47,framebus:56}],204:[function(_dereq_,module,exports){"use strict";module.exports={PLAID_LINK_JS:"https://cdn.plaid.com/link/v2/stable/link-initialize.js"}},{}],205:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../lib/braintree-error");module.exports={US_BANK_ACCOUNT_OPTION_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"US_BANK_ACCOUNT_OPTION_REQUIRED"},US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS:{type:BraintreeError.types.MERCHANT,code:"US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS"},US_BANK_ACCOUNT_LOGIN_LOAD_FAILED:{type:BraintreeError.types.NETWORK,code:"US_BANK_ACCOUNT_LOGIN_LOAD_FAILED",message:"Bank login flow failed to load."},US_BANK_ACCOUNT_LOGIN_CLOSED:{type:BraintreeError.types.CUSTOMER,code:"US_BANK_ACCOUNT_LOGIN_CLOSED",message:"Customer closed bank login flow before authorizing."},US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE:{type:BraintreeError.types.MERCHANT,code:"US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE",message:"Another bank login tokenization request is active."},US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR:{type:BraintreeError.types.NETWORK,code:"US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR",message:"A tokenization network error occurred."},US_BANK_ACCOUNT_FAILED_TOKENIZATION:{type:BraintreeError.types.CUSTOMER,code:"US_BANK_ACCOUNT_FAILED_TOKENIZATION",message:"The supplied data failed tokenization."},US_BANK_ACCOUNT_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"US_BANK_ACCOUNT_NOT_ENABLED",message:"US bank account is not enabled."},US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED",message:"Bank login is not enabled."}}},{"../lib/braintree-error":129}],206:[function(_dereq_,module,exports){"use strict";function create(options){var name="US Bank Account";return basicComponentVerification.verify({name:name,client:options.client,authorization:options.authorization}).then(function(){return createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:name})}).then(function(client){var usBankAccount;return options.client=client,usBankAccount=options.client.getConfiguration().gatewayConfiguration.usBankAccount,usBankAccount?new USBankAccount(options):Promise.reject(new BraintreeError(errors.US_BANK_ACCOUNT_NOT_ENABLED))})}var basicComponentVerification=_dereq_("../lib/basic-component-verification"),BraintreeError=_dereq_("../lib/braintree-error"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),errors=_dereq_("./errors"),USBankAccount=_dereq_("./us-bank-account"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"./errors":205,"./us-bank-account":207,"@braintree/wrap-promise":47}],207:[function(_dereq_,module,exports){"use strict";function USBankAccount(options){this._client=options.client,this._isTokenizingBankLogin=!1,analytics.sendEvent(this._client,"usbankaccount.initialized")}function errorFrom(err){var error,status=err.details&&err.details.httpStatus;return error=new BraintreeError(401===status?sharedErrors.BRAINTREE_API_ACCESS_RESTRICTED:status<500?errors.US_BANK_ACCOUNT_FAILED_TOKENIZATION:errors.US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR),error.details={originalError:err},error}function formatTokenizeResponseFromGraphQL(response,type){var data=response.data[type].paymentMethod,last4=data.details.last4,description="US bank account ending in - "+last4;return{nonce:data.id,details:{},description:description,type:"us_bank_account"}}function addLoadListeners(script,callback){function loadHandler(){var readyState=this.readyState;readyState&&"loaded"!==readyState&&"complete"!==readyState||(removeLoadListeners(),callback(null,window.Plaid))}function errorHandler(){script.parentNode.removeChild(script),callback(new BraintreeError(errors.US_BANK_ACCOUNT_LOGIN_LOAD_FAILED))}function removeLoadListeners(){script.removeEventListener("error",errorHandler),script.removeEventListener("load",loadHandler),script.removeEventListener("readystatechange",loadHandler)}script.addEventListener("error",errorHandler),script.addEventListener("load",loadHandler),script.addEventListener("readystatechange",loadHandler)}function formatBillingAddressForGraphQL(address){return{streetAddress:address.streetAddress,extendedAddress:address.extendedAddress,city:address.locality,state:address.region,zipCode:address.postalCode}}function formatDataForOwnershipType(data,details){"personal"===details.ownershipType?data.individualOwner={firstName:details.firstName,lastName:details.lastName}:"business"===details.ownershipType&&(data.businessOwner={businessName:details.businessName})}function createGraphQLMutation(type){return"mutation Tokenize"+type+"($input: Tokenize"+type+"Input!) { tokenize"+type+"(input: $input) { paymentMethod { id details { ... on UsBankAccountDetails { last4 } } } }}"}var BraintreeError=_dereq_("../lib/braintree-error"),constants=_dereq_("./constants"),errors=_dereq_("./errors"),sharedErrors=_dereq_("../lib/errors"),analytics=_dereq_("../lib/analytics"),once=_dereq_("../lib/once"),convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),methods=_dereq_("../lib/methods"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),TOKENIZE_BANK_DETAILS_MUTATION=createGraphQLMutation("UsBankAccount"),TOKENIZE_BANK_LOGIN_MUTATION=createGraphQLMutation("UsBankLogin");USBankAccount.prototype.tokenize=function(options){return options=options||{},options.mandateText?options.bankDetails&&options.bankLogin?Promise.reject(new BraintreeError({type:errors.US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS.type,code:errors.US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS.code,message:"tokenize must be called with bankDetails or bankLogin, not both."})):options.bankDetails?this._tokenizeBankDetails(options):options.bankLogin?this._tokenizeBankLogin(options):Promise.reject(new BraintreeError({type:errors.US_BANK_ACCOUNT_OPTION_REQUIRED.type,code:errors.US_BANK_ACCOUNT_OPTION_REQUIRED.code,message:"tokenize must be called with bankDetails or bankLogin."})):Promise.reject(new BraintreeError({type:errors.US_BANK_ACCOUNT_OPTION_REQUIRED.type,code:errors.US_BANK_ACCOUNT_OPTION_REQUIRED.code,message:"mandateText property is required."}))},USBankAccount.prototype._tokenizeBankDetails=function(options){var client=this._client,bankDetails=options.bankDetails,data={achMandate:options.mandateText,routingNumber:bankDetails.routingNumber,accountNumber:bankDetails.accountNumber,accountType:bankDetails.accountType.toUpperCase(),billingAddress:formatBillingAddressForGraphQL(bankDetails.billingAddress||{})};return formatDataForOwnershipType(data,bankDetails),client.request({api:"graphQLApi",data:{query:TOKENIZE_BANK_DETAILS_MUTATION,variables:{input:{usBankAccount:data}}}}).then(function(response){return analytics.sendEvent(client,"usbankaccount.bankdetails.tokenization.succeeded"),Promise.resolve(formatTokenizeResponseFromGraphQL(response,"tokenizeUsBankAccount"))}).catch(function(err){var error=errorFrom(err);return analytics.sendEvent(client,"usbankaccount.bankdetails.tokenization.failed"),Promise.reject(error)})},USBankAccount.prototype._tokenizeBankLogin=function(options){var self=this,client=this._client,gatewayConfiguration=client.getConfiguration().gatewayConfiguration,isProduction="production"===gatewayConfiguration.environment,plaidConfig=gatewayConfiguration.usBankAccount.plaid;return options.bankLogin.displayName?plaidConfig?this._isTokenizingBankLogin?Promise.reject(new BraintreeError(errors.US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE)):(this._isTokenizingBankLogin=!0,new Promise(function(resolve,reject){self._loadPlaid(function(plaidLoadErr,plaid){if(plaidLoadErr)return void reject(plaidLoadErr);plaid.create({clientName:options.bankLogin.displayName,apiVersion:"v2",env:isProduction?"production":"sandbox",key:plaidConfig.publicKey,product:"auth",selectAccount:!0,onExit:function(){self._isTokenizingBankLogin=!1,analytics.sendEvent(client,"usbankaccount.banklogin.tokenization.closed.by-user"),reject(new BraintreeError(errors.US_BANK_ACCOUNT_LOGIN_CLOSED))},onSuccess:function(publicToken,metadata){var bankLogin=options.bankLogin,data={publicToken:publicToken,accountId:isProduction?metadata.account_id:"plaid_account_id",accountType:metadata.account.subtype.toUpperCase(),achMandate:options.mandateText,billingAddress:formatBillingAddressForGraphQL(bankLogin.billingAddress||{})};formatDataForOwnershipType(data,bankLogin),client.request({api:"graphQLApi",data:{query:TOKENIZE_BANK_LOGIN_MUTATION,variables:{input:{usBankLogin:data}}}}).then(function(response){self._isTokenizingBankLogin=!1,analytics.sendEvent(client,"usbankaccount.banklogin.tokenization.succeeded"),resolve(formatTokenizeResponseFromGraphQL(response,"tokenizeUsBankLogin"))}).catch(function(tokenizeErr){var error;self._isTokenizingBankLogin=!1,error=errorFrom(tokenizeErr),analytics.sendEvent(client,"usbankaccount.banklogin.tokenization.failed"),reject(error)})}}).open(),analytics.sendEvent(client,"usbankaccount.banklogin.tokenization.started")})})):Promise.reject(new BraintreeError(errors.US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED)):Promise.reject(new BraintreeError({type:errors.US_BANK_ACCOUNT_OPTION_REQUIRED.type,code:errors.US_BANK_ACCOUNT_OPTION_REQUIRED.code,message:"displayName property is required when using bankLogin."}))},USBankAccount.prototype._loadPlaid=function(callback){var existingScript,script;if(callback=once(callback),window.Plaid)return void callback(null,window.Plaid);existingScript=document.querySelector('script[src="'+constants.PLAID_LINK_JS+'"]'),existingScript?addLoadListeners(existingScript,callback):(script=document.createElement("script"),script.src=constants.PLAID_LINK_JS,script.async=!0,addLoadListeners(script,callback),document.body.appendChild(script),this._plaidScript=script)},USBankAccount.prototype.teardown=function(){return this._plaidScript&&document.body.removeChild(this._plaidScript),convertMethodsToError(this,methods(USBankAccount.prototype)),Promise.resolve()},module.exports=wrapPromise.wrapPrototype(USBankAccount)},{"../lib/analytics":124,"../lib/braintree-error":129,"../lib/convert-methods-to-error":132,"../lib/errors":140,"../lib/methods":159,"../lib/once":160,"../lib/promise":161,"./constants":204,"./errors":205,"@braintree/wrap-promise":47}],208:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../lib/braintree-error");module.exports={VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN:{type:BraintreeError.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:BraintreeError.types.MERCHANT,code:"VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND"},VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR:{type:BraintreeError.types.UNKNOWN,code:"VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR"}}},{"../lib/braintree-error":129}],209:[function(_dereq_,module,exports){"use strict";function create(options){var name="Vault Manager";return basicComponentVerification.verify({name:name,client:options.client,authorization:options.authorization}).then(function(){return new VaultManager({createPromise:createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:name})})})}var basicComponentVerification=_dereq_("../lib/basic-component-verification"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),VaultManager=_dereq_("./vault-manager"),wrapPromise=_dereq_("@braintree/wrap-promise");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/basic-component-verification":127,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"./vault-manager":210,"@braintree/wrap-promise":47}],210:[function(_dereq_,module,exports){"use strict";function VaultManager(options){this._createPromise=options.createPromise}function formatPaymentMethodPayload(paymentMethod){var formattedPaymentMethod={nonce:paymentMethod.nonce,default:paymentMethod.default,details:paymentMethod.details,hasSubscription:paymentMethod.hasSubscription,type:paymentMethod.type};return paymentMethod.description&&(formattedPaymentMethod.description=paymentMethod.description),paymentMethod.binData&&(formattedPaymentMethod.binData=paymentMethod.binData),formattedPaymentMethod}var analytics=_dereq_("../lib/analytics"),BraintreeError=_dereq_("../lib/braintree-error"),errors=_dereq_("./errors"),convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),methods=_dereq_("../lib/methods"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise");VaultManager.prototype.fetchPaymentMethods=function(options){var defaultFirst;return options=options||{},defaultFirst=!0===options.defaultFirst?1:0,this._createPromise.then(function(client){return client.request({endpoint:"payment_methods",method:"get",data:{defaultFirst:defaultFirst}})}).then(function(paymentMethodsPayload){return analytics.sendEvent(this._createPromise,"vault-manager.fetch-payment-methods.succeeded"),paymentMethodsPayload.paymentMethods.map(formatPaymentMethodPayload)}.bind(this))},VaultManager.prototype.deletePaymentMethod=function(paymentMethodNonce){return this._createPromise.then(function(client){return"CLIENT_TOKEN"===client.getConfiguration().authorizationType?client.request({api:"graphQLApi",data:{query:"mutation DeletePaymentMethodFromSingleUseToken($input: DeletePaymentMethodFromSingleUseTokenInput!) { deletePaymentMethodFromSingleUseToken(input: $input) { clientMutationId }}",variables:{input:{singleUseTokenId:paymentMethodNonce}},operationName:"DeletePaymentMethodFromSingleUseToken"}}).then(function(){analytics.sendEvent(client,"vault-manager.delete-payment-method.succeeded")}).catch(function(error){var formattedError,originalError=error.details.originalError;return analytics.sendEvent(client,"vault-manager.delete-payment-method.failed"),originalError[0]&&"NOT_FOUND"===originalError[0].extensions.errorClass&&(formattedError=new BraintreeError({type:errors.VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND.type,code:errors.VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND.code,message:"A payment method for payment method nonce `"+paymentMethodNonce+"` could not be found.",details:{originalError:originalError}})),formattedError||(formattedError=new BraintreeError({type:errors.VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR.type,code:errors.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 `"+paymentMethodNonce+"`.",details:{originalError:originalError}})),Promise.reject(formattedError)}):Promise.reject(new BraintreeError(errors.VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN))})},VaultManager.prototype.teardown=function(){return convertMethodsToError(this,methods(VaultManager.prototype)),Promise.resolve()},module.exports=wrapPromise.wrapPrototype(VaultManager)},{"../lib/analytics":124,"../lib/braintree-error":129,"../lib/convert-methods-to-error":132,"../lib/methods":159,"../lib/promise":161,"./errors":208,"@braintree/wrap-promise":47}],211:[function(_dereq_,module,exports){"use strict";function create(options){return basicComponentVerification.verify({name:"Venmo",client:options.client,authorization:options.authorization}).then(function(){var createPromise,instance;return options.profileId&&"string"!=typeof options.profileId?Promise.reject(new BraintreeError(errors.VENMO_INVALID_PROFILE_ID)):options.deepLinkReturnUrl&&"string"!=typeof options.deepLinkReturnUrl?Promise.reject(new BraintreeError(errors.VENMO_INVALID_DEEP_LINK_RETURN_URL)):(createPromise=createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:"Venmo"}).then(function(client){var configuration=client.getConfiguration();return options.client=client,configuration.gatewayConfiguration.payWithVenmo?client:Promise.reject(new BraintreeError(errors.VENMO_NOT_ENABLED))}),options.createPromise=createPromise,instance=new Venmo(options),analytics.sendEvent(createPromise,"venmo.initialized"),options.client?createPromise.then(function(){return instance}):instance)})}function isBrowserSupported(options){return supportsVenmo.isBrowserSupported(options)}var analytics=_dereq_("../lib/analytics"),basicComponentVerification=_dereq_("../lib/basic-component-verification"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),errors=_dereq_("./shared/errors"),wrapPromise=_dereq_("@braintree/wrap-promise"),BraintreeError=_dereq_("../lib/braintree-error"),Venmo=_dereq_("./venmo"),Promise=_dereq_("../lib/promise"),supportsVenmo=_dereq_("./shared/supports-venmo");module.exports={create:wrapPromise(create),isBrowserSupported:isBrowserSupported,VERSION:"3.69.0"}},{"../lib/analytics":124,"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"./shared/errors":214,"./shared/supports-venmo":215,"./venmo":216,"@braintree/wrap-promise":47}],212:[function(_dereq_,module,exports){"use strict";function isAndroidWebview(){return isAndroid()&&window.navigator.userAgent.toLowerCase().indexOf("wv")>-1}var isAndroid=_dereq_("@braintree/browser-detection/is-android"),isChrome=_dereq_("@braintree/browser-detection/is-chrome"),isIos=_dereq_("@braintree/browser-detection/is-ios"),isIosSafari=_dereq_("@braintree/browser-detection/is-ios-safari"),isSamsungBrowser=_dereq_("@braintree/browser-detection/is-samsung"),isMobileFirefox=_dereq_("@braintree/browser-detection/is-mobile-firefox"),isIosWebview=_dereq_("@braintree/browser-detection/is-ios-webview");module.exports={isAndroid:isAndroid,isAndroidWebview:isAndroidWebview,isChrome:isChrome,isIos:isIos,isIosSafari:isIosSafari,isIosWebview:isIosWebview,isSamsungBrowser:isSamsungBrowser,isMobileFirefox:isMobileFirefox}},{"@braintree/browser-detection/is-android":21,"@braintree/browser-detection/is-chrome":23,"@braintree/browser-detection/is-ios":32,"@braintree/browser-detection/is-ios-safari":29,"@braintree/browser-detection/is-ios-webview":30,"@braintree/browser-detection/is-mobile-firefox":33,"@braintree/browser-detection/is-samsung":34}],213:[function(_dereq_,module,exports){"use strict";module.exports={DOCUMENT_VISIBILITY_CHANGE_EVENT_DELAY:500,DEFAULT_PROCESS_RESULTS_DELAY:1e3,VENMO_OPEN_URL:"https://venmo.com/braintree/checkout"}},{}],214:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../../lib/braintree-error");module.exports={VENMO_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"VENMO_NOT_ENABLED",message:"Venmo is not enabled for this merchant."},VENMO_TOKENIZATION_REQUEST_ACTIVE:{type:BraintreeError.types.MERCHANT,code:"VENMO_TOKENIZATION_REQUEST_ACTIVE",message:"Another tokenization request is active."},VENMO_APP_FAILED:{type:BraintreeError.types.UNKNOWN,code:"VENMO_APP_FAILED",message:"Venmo app encountered a problem."},VENMO_APP_CANCELED:{type:BraintreeError.types.CUSTOMER,code:"VENMO_APP_CANCELED",message:"Venmo app authorization was canceled."},VENMO_CANCELED:{type:BraintreeError.types.CUSTOMER,code:"VENMO_CANCELED",message:"User canceled Venmo authorization, or Venmo app is not available."},VENMO_INVALID_PROFILE_ID:{type:BraintreeError.types.MERCHANT,code:"VENMO_INVALID_PROFILE_ID",message:"Venmo profile ID is invalid."},VENMO_INVALID_DEEP_LINK_RETURN_URL:{type:BraintreeError.types.MERCHANT,code:"VENMO_INVALID_DEEP_LINK_RETURN_URL",message:"Venmo deep link return URL is invalid."}}},{"../../lib/braintree-error":129}],215:[function(_dereq_,module,exports){"use strict";function isBrowserSupported(options){var allowNewBrowserTab,isAndroid=browserDetection.isAndroid(),isAndroidChrome=isAndroid&&browserDetection.isChrome(),isIosChrome=browserDetection.isIos()&&browserDetection.isChrome(),supportsReturnToSameTab=browserDetection.isIosSafari()||isAndroidChrome,supportsReturnToNewTab=isIosChrome||browserDetection.isSamsungBrowser()||browserDetection.isMobileFirefox();return options=options||{},allowNewBrowserTab=!options.hasOwnProperty("allowNewBrowserTab")||options.allowNewBrowserTab,!(!(!options.hasOwnProperty("allowWebviews")||options.allowWebviews)&&(browserDetection.isAndroidWebview()||browserDetection.isIosWebview()))&&(allowNewBrowserTab?supportsReturnToSameTab||supportsReturnToNewTab:supportsReturnToSameTab)}var browserDetection=_dereq_("./browser-detection");module.exports={isBrowserSupported:isBrowserSupported}},{"./browser-detection":212}],216:[function(_dereq_,module,exports){"use strict";function Venmo(options){this._createPromise=options.createPromise,this._allowNewBrowserTab=!1!==options.allowNewBrowserTab,this._allowWebviews=!1!==options.allowWebviews,this._profileId=options.profileId,this._deepLinkReturnUrl=options.deepLinkReturnUrl,this._ignoreHistoryChanges=options.ignoreHistoryChanges}function getFragmentParameters(hash){return(hash||window.location.hash.substring(1)).split("&").reduce(function(toReturn,keyValue){var parts=keyValue.split("="),key=decodeURIComponent(parts[0]).replace(/\W/g,""),value=decodeURIComponent(parts[1]);return toReturn[key]=value,toReturn},{})}function formatTokenizePayload(fragmentParams){return{nonce:fragmentParams.paymentMethodNonce,type:"VenmoAccount",details:{username:fragmentParams.username}}}function documentVisibilityChangeEventName(){var visibilityChange;return void 0!==window.document.hidden?visibilityChange="visibilitychange":void 0!==window.document.msHidden?visibilityChange="msvisibilitychange":void 0!==window.document.webkitHidden&&(visibilityChange="webkitvisibilitychange"),visibilityChange}function isIosWebview(){return window.navigator.platform&&/iPhone|iPad|iPod/.test(window.navigator.platform)}var analytics=_dereq_("../lib/analytics"),isBrowserSupported=_dereq_("./shared/supports-venmo"),constants=_dereq_("./shared/constants"),errors=_dereq_("./shared/errors"),querystring=_dereq_("../lib/querystring"),methods=_dereq_("../lib/methods"),convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),wrapPromise=_dereq_("@braintree/wrap-promise"),BraintreeError=_dereq_("../lib/braintree-error"),Promise=_dereq_("../lib/promise"),ExtendedPromise=_dereq_("@braintree/extended-promise");Venmo.prototype.getUrl=function(){return this._url?Promise.resolve(this._url):this._createPromise.then(function(client){var configuration=client.getConfiguration(),params={},currentUrl=this._deepLinkReturnUrl||window.location.href.replace(window.location.hash,""),venmoConfiguration=configuration.gatewayConfiguration.payWithVenmo,analyticsMetadata=configuration.analyticsMetadata,braintreeData={_meta:{version:analyticsMetadata.sdkVersion,integration:analyticsMetadata.integration,platform:analyticsMetadata.platform,sessionId:analyticsMetadata.sessionId}};return params["x-success"]=currentUrl+"#venmoSuccess=1",params["x-cancel"]=currentUrl+"#venmoCancel=1",params["x-error"]=currentUrl+"#venmoError=1",params.ua=window.navigator.userAgent,params.braintree_merchant_id=this._profileId||venmoConfiguration.merchantId,params.braintree_access_token=venmoConfiguration.accessToken,params.braintree_environment=venmoConfiguration.environment,params.braintree_sdk_data=btoa(JSON.stringify(braintreeData)),this._url=constants.VENMO_OPEN_URL+"?"+querystring.stringify(params),this._url}.bind(this))},Venmo.prototype.isBrowserSupported=function(){return isBrowserSupported.isBrowserSupported({allowNewBrowserTab:this._allowNewBrowserTab,allowWebviews:this._allowWebviews})},Venmo.prototype.hasTokenizationResult=function(){return this._hasTokenizationResult()},Venmo.prototype._hasTokenizationResult=function(hash){var params=getFragmentParameters(hash);return void 0!==(params.venmoSuccess||params.venmoError||params.venmoCancel)},Venmo.prototype.tokenize=function(options){function completeFlow(hash){var error;self._processResults(hash).catch(function(err){error=err}).then(function(res){self._ignoreHistoryChanges||window.location.hash===self._previousHash||(window.location.hash=self._previousHash),self._removeVisibilityEventListener(),error?self._tokenizePromise.reject(error):self._tokenizePromise.resolve(res),delete self._tokenizePromise})}var resultProcessingInProgress,visibilityChangeListenerTimeout,self=this;return options=options||{},!0===this._tokenizationInProgress?Promise.reject(new BraintreeError(errors.VENMO_TOKENIZATION_REQUEST_ACTIVE)):this.hasTokenizationResult()?this._processResults():(this._tokenizationInProgress=!0,this._tokenizePromise=new ExtendedPromise,this._previousHash=window.location.hash,this._onHashChangeListener=function(e){var hash=e.newURL.split("#")[1];self._hasTokenizationResult(hash)&&(resultProcessingInProgress=!0,clearTimeout(visibilityChangeListenerTimeout),self._tokenizationInProgress=!1,completeFlow(hash))},window.addEventListener("hashchange",this._onHashChangeListener,!1),this._visibilityChangeListener=function(){var delay=options.processResultsDelay||constants.DEFAULT_PROCESS_RESULTS_DELAY;window.document.hidden||(self._tokenizationInProgress=!1,resultProcessingInProgress||(visibilityChangeListenerTimeout=setTimeout(completeFlow,delay)))},this.getUrl().then(function(url){return self._deepLinkReturnUrl?isIosWebview()?(analytics.sendEvent(self._createPromise,"venmo.appswitch.start.ios-webview"),window.location.href=url):window.popupBridge&&"function"==typeof window.popupBridge.open?(analytics.sendEvent(self._createPromise,"venmo.appswitch.start.popup-bridge"),window.popupBridge.open(url)):(analytics.sendEvent(self._createPromise,"venmo.appswitch.start.webview"),window.open(url)):(analytics.sendEvent(self._createPromise,"venmo.appswitch.start.browser"),window.open(url)),setTimeout(function(){window.document.addEventListener(documentVisibilityChangeEventName(),self._visibilityChangeListener)},constants.DOCUMENT_VISIBILITY_CHANGE_EVENT_DELAY),self._tokenizePromise}))},Venmo.prototype.teardown=function(){return this._removeVisibilityEventListener(),convertMethodsToError(this,methods(Venmo.prototype)),Promise.resolve()},Venmo.prototype._removeVisibilityEventListener=function(){window.removeEventListener("hashchange",this._onHashChangeListener),window.document.removeEventListener(documentVisibilityChangeEventName(),this._visibilityChangeListener),delete this._visibilityChangeListener,delete this._onHashChangeListener},Venmo.prototype._processResults=function(hash){var self=this,params=getFragmentParameters(hash);return new Promise(function(resolve,reject){params.venmoSuccess?(analytics.sendEvent(self._createPromise,"venmo.appswitch.handle.success"),resolve(formatTokenizePayload(params))):params.venmoError?(analytics.sendEvent(self._createPromise,"venmo.appswitch.handle.error"),reject(new BraintreeError({type:errors.VENMO_APP_FAILED.type,code:errors.VENMO_APP_FAILED.code,message:errors.VENMO_APP_FAILED.message,details:{originalError:{message:decodeURIComponent(params.errorMessage),code:params.errorCode}}}))):params.venmoCancel?(analytics.sendEvent(self._createPromise,"venmo.appswitch.handle.cancel"),reject(new BraintreeError(errors.VENMO_APP_CANCELED))):(analytics.sendEvent(self._createPromise,"venmo.appswitch.cancel-or-unavailable"),reject(new BraintreeError(errors.VENMO_CANCELED))),self._clearFragmentParameters()})},Venmo.prototype._clearFragmentParameters=function(){this._ignoreHistoryChanges||"function"==typeof window.history.replaceState&&window.location.hash&&history.pushState({},"",window.location.href.slice(0,window.location.href.indexOf("#")))},module.exports=wrapPromise.wrapPrototype(Venmo)},{"../lib/analytics":124,"../lib/braintree-error":129,"../lib/convert-methods-to-error":132,"../lib/methods":159,"../lib/promise":161,"../lib/querystring":162,"./shared/constants":213,"./shared/errors":214,"./shared/supports-venmo":215,"@braintree/extended-promise":38,"@braintree/wrap-promise":47}],217:[function(_dereq_,module,exports){"use strict";var BraintreeError=_dereq_("../lib/braintree-error");module.exports={VISA_CHECKOUT_NOT_ENABLED:{type:BraintreeError.types.MERCHANT,code:"VISA_CHECKOUT_NOT_ENABLED",
message:"Visa Checkout is not enabled for this merchant."},VISA_CHECKOUT_INIT_OPTIONS_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"VISA_CHECKOUT_INIT_OPTIONS_REQUIRED",message:"initOptions requires an object."},VISA_CHECKOUT_PAYMENT_REQUIRED:{type:BraintreeError.types.MERCHANT,code:"VISA_CHECKOUT_PAYMENT_REQUIRED",message:"tokenize requires callid, encKey, and encPaymentData."},VISA_CHECKOUT_TOKENIZATION:{type:BraintreeError.types.NETWORK,code:"VISA_CHECKOUT_TOKENIZATION",message:"A network error occurred when processing the Visa Checkout payment."}}},{"../lib/braintree-error":129}],218:[function(_dereq_,module,exports){"use strict";function create(options){var name="Visa Checkout";return basicComponentVerification.verify({name:name,client:options.client,authorization:options.authorization}).then(function(){return createDeferredClient.create({authorization:options.authorization,client:options.client,debug:options.debug,assetsUrl:createAssetsUrl.create(options.authorization),name:name})}).then(function(client){return options.client=client,options.client.getConfiguration().gatewayConfiguration.visaCheckout?(analytics.sendEvent(options.client,"visacheckout.initialized"),new VisaCheckout(options)):Promise.reject(new BraintreeError(errors.VISA_CHECKOUT_NOT_ENABLED))})}var basicComponentVerification=_dereq_("../lib/basic-component-verification"),BraintreeError=_dereq_("../lib/braintree-error"),createDeferredClient=_dereq_("../lib/create-deferred-client"),createAssetsUrl=_dereq_("../lib/create-assets-url"),VisaCheckout=_dereq_("./visa-checkout"),analytics=_dereq_("../lib/analytics"),errors=_dereq_("./errors"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise");module.exports={create:wrapPromise(create),VERSION:"3.69.0"}},{"../lib/analytics":124,"../lib/basic-component-verification":127,"../lib/braintree-error":129,"../lib/create-assets-url":134,"../lib/create-deferred-client":136,"../lib/promise":161,"./errors":217,"./visa-checkout":219,"@braintree/wrap-promise":47}],219:[function(_dereq_,module,exports){"use strict";function VisaCheckout(options){this._client=options.client}function transformCardTypes(cardTypes){return cardTypes.reduce(function(acc,type){return cardTypeTransformMap.hasOwnProperty(type)?acc.concat(cardTypeTransformMap[type]):acc},[])}var BraintreeError=_dereq_("../lib/braintree-error"),analytics=_dereq_("../lib/analytics"),errors=_dereq_("./errors"),jsonClone=_dereq_("../lib/json-clone"),methods=_dereq_("../lib/methods"),convertMethodsToError=_dereq_("../lib/convert-methods-to-error"),Promise=_dereq_("../lib/promise"),wrapPromise=_dereq_("@braintree/wrap-promise"),cardTypeTransformMap={Visa:"VISA",MasterCard:"MASTERCARD",Discover:"DISCOVER","American Express":"AMEX"};VisaCheckout.prototype.createInitOptions=function(options){var initOptions,gatewayConfiguration=this._client.getConfiguration().gatewayConfiguration,visaCheckoutConfiguration=gatewayConfiguration.visaCheckout;if(!options)throw new BraintreeError(errors.VISA_CHECKOUT_INIT_OPTIONS_REQUIRED);return initOptions=jsonClone(options),initOptions.apikey=initOptions.apikey||visaCheckoutConfiguration.apikey,initOptions.externalClientId=initOptions.externalClientId||visaCheckoutConfiguration.externalClientId,initOptions.settings=initOptions.settings||{},initOptions.settings.dataLevel="FULL",initOptions.settings.payment=initOptions.settings.payment||{},initOptions.settings.payment.cardBrands||(initOptions.settings.payment.cardBrands=transformCardTypes(gatewayConfiguration.visaCheckout.supportedCardTypes)),initOptions},VisaCheckout.prototype.tokenize=function(payment){var self=this;return payment.callid&&payment.encKey&&payment.encPaymentData?this._client.request({method:"post",endpoint:"payment_methods/visa_checkout_cards",data:{_meta:{source:"visa-checkout"},visaCheckoutCard:{callId:payment.callid,encryptedPaymentData:payment.encPaymentData,encryptedKey:payment.encKey}}}).then(function(response){return analytics.sendEvent(self._client,"visacheckout.tokenize.succeeded"),response.visaCheckoutCards[0]}).catch(function(err){return analytics.sendEvent(self._client,"visacheckout.tokenize.failed"),Promise.reject(new BraintreeError({type:errors.VISA_CHECKOUT_TOKENIZATION.type,code:errors.VISA_CHECKOUT_TOKENIZATION.code,message:errors.VISA_CHECKOUT_TOKENIZATION.message,details:{originalError:err}}))}):Promise.reject(new BraintreeError(errors.VISA_CHECKOUT_PAYMENT_REQUIRED))},VisaCheckout.prototype.teardown=function(){return convertMethodsToError(this,methods(VisaCheckout.prototype)),Promise.resolve()},module.exports=wrapPromise.wrapPrototype(VisaCheckout)},{"../lib/analytics":124,"../lib/braintree-error":129,"../lib/convert-methods-to-error":132,"../lib/json-clone":158,"../lib/methods":159,"../lib/promise":161,"./errors":217,"@braintree/wrap-promise":47}]},{},[122])(122)})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("timers").setImmediate)},{timers:6}],5:[function(require,module,exports){function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,runClearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var cachedSetTimeout,cachedClearTimeout,process=module.exports={};!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],6:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){function Timeout(id,clearFn){this._id=id,this._clearFn=clearFn}var nextTick=require("process/browser.js").nextTick,apply=Function.prototype.apply,slice=Array.prototype.slice,immediateIds={},nextImmediateId=0;exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)},exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)},exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(window,this._id)},exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId),item._idleTimeout=msecs},exports.unenroll=function(item){clearTimeout(item._idleTimeoutId),item._idleTimeout=-1},exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;msecs>=0&&(item._idleTimeoutId=setTimeout(function(){item._onTimeout&&item._onTimeout()},msecs))},exports.setImmediate="function"==typeof setImmediate?setImmediate:function(fn){var id=nextImmediateId++,args=!(arguments.length<2)&&slice.call(arguments,1);return immediateIds[id]=!0,nextTick(function(){immediateIds[id]&&(args?fn.apply(null,args):fn.call(null),exports.clearImmediate(id))}),id},exports.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(id){delete immediateIds[id]}}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":5,timers:6}]},{},[1]);