PageSourceSearch

https://nypost.com/wp-content/plugins/nyp-membership/build/9916.c36ea224d939b383e68a.bundle.min.js

js nypost.com collected 2026-10-01 07:55:43 UTC 485,140 bytes, 3 lines download raw bytes

1/*! For license information please see 9916.c36ea224d939b383e68a.bundle.min.js.LICENSE.txt */
2(self.webpackChunknyp_membership=self.webpackChunknyp_membership||[]).push([[9916],{9586:function(e){e.exports=function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[a]={exports:{}};t[a][0].call(d.exports,function(e){return i(t[a][1][e]||e)},d,d.exports,e,t,n,r)}return n[a].exports}for(var o=void 0,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";var r={};function i(e){var t,n=JSON.stringify(e);if(!e.forceScriptReload&&(t=r[n]))return t;var i=document.createElement("script"),o=e.dataAttributes||{},a=e.container||document.head;return i.src=e.src,i.id=e.id||"",i.async=!0,e.type&&i.setAttribute("type","".concat(e.type)),e.crossorigin&&i.setAttribute("crossorigin","".concat(e.crossorigin)),e.integrity&&i.setAttribute("integrity","".concat(e.integrity)),Object.keys(o).forEach(function(e){i.setAttribute("data-".concat(e),"".concat(o[e]))}),t=new Promise(function(t,n){i.addEventListener("load",function(){t(i)}),i.addEventListener("error",function(){n(new Error("".concat(e.src," failed to load.")))}),i.addEventListener("abort",function(){n(new Error("".concat(e.src," has aborted.")))}),a.appendChild(i)}),r[n]=t,t}i.clearCache=function(){r={}},t.exports=i},{}],2:[function(e,t,n){t.exports=e("./dist/load-script")},{"./dist/load-script":1}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.deferred=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];setTimeout(function(){try{e.apply(void 0,t)}catch(e){console.log("Error in callback function"),console.log(e)}},1)}}},{}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.once=function(e){var t=!1;return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];t||(t=!0,e.apply(void 0,n))}}},{}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.promiseOrCallback=function(e,t){if(!t)return e;e.then(function(e){return t(null,e)}).catch(function(e){return t(e)})}},{}],6:[function(e,t,n){"use strict";var r=e("./lib/deferred"),i=e("./lib/once"),o=e("./lib/promise-or-callback");function a(e){return function(){for(var t,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return"function"==typeof n[n.length-1]&&(t=n.pop(),t=i.once(r.deferred(t))),o.promiseOrCallback(e.apply(this,n),t)}}a.wrapPrototype=function(e,t){void 0===t&&(t={});var n=t.ignoreMethods||[],r=!0===t.transformPrivateMethods;return Object.getOwnPropertyNames(e.prototype).filter(function(t){var i,o="constructor"!==t&&"function"==typeof e.prototype[t],a=-1===n.indexOf(t);return i=!!r||"_"!==t.charAt(0),o&&i&&a}).forEach(function(t){var n=e.prototype[t];e.prototype[t]=a(n)}),e},t.exports=a},{"./lib/deferred":3,"./lib/once":4,"./lib/promise-or-callback":5}],7:[function(e,t,n){var r,i;r=this,i=function(e){"use strict";function t(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})}function n(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}
2var r={},i={};function o(e){var t,n=JSON.stringify(e);if(!e.forceScriptReload&&(t=i[n]))return t;var r=document.createElement("script"),o=e.dataAttributes||{},a=e.container||document.head;return r.src=e.src,r.id=e.id||"",r.async=!0,e.type&&r.setAttribute("type","".concat(e.type)),e.crossorigin&&r.setAttribute("crossorigin","".concat(e.crossorigin)),Object.keys(o).forEach(function(e){r.setAttribute("data-".concat(e),"".concat(o[e]))}),t=new Promise(function(t,n){r.addEventListener("load",function(){t(r)}),r.addEventListener("error",function(){n(new Error("".concat(e.src," failed to load.")))}),r.addEventListener("abort",function(){n(new Error("".concat(e.src," has aborted.")))}),a.appendChild(r)}),i[n]=t,t}o.clearCache=function(){i={}};var a=o;Object.defineProperty(r,"__esModule",{value:!0}),r.loadStylesheet=c=r.loadScript=void 0;var s=a,c=r.loadScript=s,d=function(e){var t=document.querySelector('link[href="'.concat(e.href,'"]'));if(t)return Promise.resolve(t);t=document.createElement("link");var n=e.container||document.head;return t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e.href),t.setAttribute("id",e.id),n.firstChild?n.insertBefore(t,n.firstChild):n.appendChild(t),Promise.resolve(t)};r.loadStylesheet=d;var l,u,p="fastlane",_="connect-boba",E={AXO_ASSET_NAME:{minified:"axo.min",unminified:"axo"},AXO_ASSET_PATH:_,LOCALE_PATH:"".concat(_,"/locales/"),CDNX_PROD:"https://www.paypalobjects.com"},m="BT",h="PPCP";function f(){return"function"==typeof window.define&&!!window.define.amd}function A(e,r,i){var o,a;return void 0===i&&(i=!0),t(this,void 0,void 0,function(){var t,s;return n(this,function(n){if((t=null===window||void 0===window?void 0:window.braintree)&&t[e.module]){if(r&&(null===(o=t[e.module])||void 0===o?void 0:o.VERSION)!==r)throw s=null===(a=t[e.module])||void 0===a?void 0:a.VERSION,new Error("".concat(e.module," already loaded with version ").concat(s," cannot load version ").concat(r));return[2,!0]}if(!r)throw new Error("Attempted to load ".concat(e.module," without specifying version"));return[2,y(e,r,i)]})})}function y(e,t,n){if(void 0===n&&(n=!0),f()){var r=n?e.amdModule.minified:e.amdModule.unminified;return new Promise(function(e,t){window.require([r],e,t)})}var i=n?e.script.minified:e.script.unminified;return c({id:"".concat(e.id,"-").concat(t),src:"https://js.braintreegateway.com/web/".concat(t,"/js/").concat(i)})}var I="client",T="hostedFields",P="braintree",N=((l={})[I]="client",l[T]="hosted-fields",l),O=((u={})[I]={id:"client",module:I,amdModule:{unminified:"".concat(P,"/").concat(N[I]),minified:"".concat(P,"/").concat(N[I],".min")},script:{unminified:"".concat(N[I],".js"),minified:"".concat(N[I],".min.js")}},u[T]={id:"hcf",module:T,amdModule:{unminified:"".concat(P,"/").concat(N[T]),minified:"".concat(P,"/").concat(N[T],".min")},script:{unminified:"".concat(N[T],".js"),minified:"".concat(N[T],".min.js")}},u);function g(e,t){var n;if(void 0===t&&(t=!0),f()){f()&&"function"==typeof window.requirejs&&"function"==typeof window.requirejs.config&&requirejs.config({paths:(n={},n[p]=e,n)});var r="".concat(p,"/").concat(t?E.AXO_ASSET_NAME.minified:E.AXO_ASSET_NAME.unminified);return new Promise(function(e,t){window.require([r],e,t)})}return c({id:"axo-id",src:e,forceScriptReload:!0})}function C(e){var t=e.assetUrl,n=e.bundleId;return n?"https://cdn-".concat(n,".static.engineering.dev.paypalinc.com/").concat(t):"".concat(E.CDNX_PROD,"/").concat(t)}e.constants=E,e.loadAxo=function(e){return t(this,void 0,void 0,function(){var t,r,i,o;return n(this,function(n){switch(n.label){case 0:return performance.mark("pp_axo_sdk_init_invoked"),t=e.btSdkVersion,r=e.minified,i=function(e){var t,n=!1!==(null==e?void 0:e.minified)?E.AXO_ASSET_NAME.minified:E.AXO_ASSET_NAME.unminified;return C({assetUrl:f()?E.AXO_ASSET_PATH:"".concat(E.AXO_ASSET_PATH,"/").concat(n,".js"),bundleId:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.bundleIdOverride})}(e),o=function(e){var t;return C({assetUrl:E.LOCALE_PATH,bundleId:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.bundleIdOverride})}(e),e.platform!==m?[3,2]:[4,Promise.all([A(O.hostedFields,t,r),g(i,r)])];case 1:case 3:return n.sent(),[3,5];case 2:return e.platform!==h?[3,4]:[4,Promise.all([A(O.client,t,r),A(O.hostedFields,t,r),g(i,r)])];case 4:throw new Error("unsupported axo platform");case 5:return[2,{metadata:{localeUrl:o}}]}})})}},i("object"==typeof n&&void 0!==t?n:(r="undefined"!=typeof globalThis?globalThis:r||self).loadAxo={})},{}],8:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("../lib/analytics"),o=e("./errors"),a=e("../lib/methods"),s=e("../lib/convert-methods-to-error"),c=e("@braintree/wrap-promise"),d=e("../lib/in-iframe");function l(e){this._instantiatedWithClient=Boolean(!e.useDeferredClient),this._client=e.client,this._createPromise=e.createPromise,this._client&&this._setMerchantIdentifier()}l.prototype._waitForClient=function(){return this._client?Promise.resolve():this._createPromise.then(function(e){this._client=e,this._setMerchantIdentifier()}.bind(this))},l.prototype._setMerchantIdentifier=function(){var e=this._client.getConfiguration().gatewayConfiguration.applePayWeb;e&&Object.defineProperty(this,"merchantIdentifier",{value:e.merchantIdentifier,configurable:!1,writable:!1})},l.prototype.createPaymentRequest=function(e){return this._instantiatedWithClient?this._createPaymentRequestSynchronously(e):this._waitForClient().then(function(){return this._createPaymentRequestSynchronously(e)}.bind(this))},l.prototype._createPaymentRequestSynchronously=function(e){var t=this._client.getConfiguration().gatewayConfiguration.applePayWeb,n={countryCode:t.countryCode,currencyCode:t.currencyCode,merchantCapabilities:t.merchantCapabilities||["supports3DS"],supportedNetworks:t.supportedNetworks.map(function(e){return"mastercard"===e?"masterCard":e})};return Object.assign({},n,e)},l.prototype.performValidation=function(e){var t=this;return e&&e.validationURL?this._waitForClient().then(function(){var n={validationUrl:e.validationURL,domainName:e.domainName||(d()?window.parent.location.hostname:window.location.hostname),merchantIdentifier:e.merchantIdentifier||t.merchantIdentifier};return null!=e.displayName&&(n.displayName=e.displayName),t._client.request({method:"post",endpoint:"apple_pay_web/sessions",data:{_meta:{source:"apple-pay"},applePayWebSession:n}})}).then(function(e){return i.sendEvent(t._client,"applepay.performValidation.succeeded"),Promise.resolve(e)}).catch(function(e){return i.sendEvent(t._client,"applepay.performValidation.failed"),"CLIENT_REQUEST_ERROR"===e.code?Promise.reject(new r({type:o.APPLE_PAY_MERCHANT_VALIDATION_FAILED.type,code:o.APPLE_PAY_MERCHANT_VALIDATION_FAILED.code,message:o.APPLE_PAY_MERCHANT_VALIDATION_FAILED.message,details:{originalError:e.details.originalError}})):Promise.reject(new r({type:o.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.type,code:o.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.code,message:o.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.message,details:{originalError:e}}))}):Promise.reject(new r(o.APPLE_PAY_VALIDATION_URL_REQUIRED))},l.prototype.tokenize=function(e){var t=this;return e.token?this._waitForClient().then(function(){return t._client.request({method:"post",endpoint:"payment_methods/apple_payment_tokens",data:{_meta:{source:"apple-pay"},applePaymentToken:Object.assign({},e.token,{paymentData:btoa(JSON.stringify(e.token.paymentData))})}})}).then(function(e){return i.sendEvent(t._client,"applepay.tokenize.succeeded"),Promise.resolve(e.applePayCards[0])}).catch(function(e){return i.sendEvent(t._client,"applepay.tokenize.failed"),Promise.reject(new r({type:o.APPLE_PAY_TOKENIZATION.type,code:o.APPLE_PAY_TOKENIZATION.code,message:o.APPLE_PAY_TOKENIZATION.message,details:{originalError:e}}))}):Promise.reject(new r(o.APPLE_PAY_PAYMENT_TOKEN_REQUIRED))},l.prototype.teardown=function(){return s(this,a(l.prototype)),Promise.resolve()},t.exports=c.wrapPrototype(l)},{"../lib/analytics":12,"../lib/braintree-error":16,"../lib/convert-methods-to-error":18,"../lib/in-iframe":24,"../lib/methods":26,"./errors":9,"@braintree/wrap-promise":6}],9:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={APPLE_PAY_NOT_ENABLED:{type:r.types.MERCHANT,code:"APPLE_PAY_NOT_ENABLED",message:"Apple Pay is not enabled for this merchant."},APPLE_PAY_VALIDATION_URL_REQUIRED:{type:r.types.MERCHANT,code:"APPLE_PAY_VALIDATION_URL_REQUIRED",message:"performValidation must be called with a validationURL."},APPLE_PAY_MERCHANT_VALIDATION_NETWORK:{type:r.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:r.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:r.types.MERCHANT,code:"APPLE_PAY_PAYMENT_TOKEN_REQUIRED",message:"tokenize must be called with a payment token."},APPLE_PAY_TOKENIZATION:{type:r.types.NETWORK,code:"APPLE_PAY_TOKENIZATION",message:"A network error occurred when processing the Apple Pay payment."}}},{"../lib/braintree-error":16}],10:[function(e,t,n){"use strict";var r=e("./apple-pay"),i=e("../lib/analytics"),o=e("../lib/braintree-error"),a=e("../lib/basic-component-verification"),s=e("../lib/create-assets-url"),c=e("../lib/create-deferred-client"),d=e("./errors"),l=e("@braintree/wrap-promise");t.exports={create:l(function(e){var t="Apple Pay";return a.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){var n,a=c.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:s.create(e.authorization),name:t}).then(function(e){return e.getConfiguration().gatewayConfiguration.applePayWeb?(i.sendEvent(e,"applepay.initialized"),e):Promise.reject(new o(d.APPLE_PAY_NOT_ENABLED))});return e.createPromise=a,n=new r(e),e.useDeferredClient?n:a.then(function(e){return n._client=e,n})})}),VERSION:"3.143.0"}},{"../lib/analytics":12,"../lib/basic-component-verification":15,"../lib/braintree-error":16,"../lib/create-assets-url":19,"../lib/create-deferred-client":21,"./apple-pay":8,"./errors":9,"@braintree/wrap-promise":6}],11:[function(e,t,n){"use strict";var r=e("./create-authorization-data"),i=e("./json-clone"),o=e("./constants");t.exports={addMetadata:function(e,t){var n,a=t?i(t):{},s=r(e.authorization).attrs,c=i(e.analyticsMetadata);for(n in a.braintreeLibraryVersion=o.BRAINTREE_LIBRARY_VERSION,a._meta)a._meta.hasOwnProperty(n)&&(c[n]=a._meta[n]);return a._meta=c,s.tokenizationKey?a.tokenizationKey=s.tokenizationKey:a.authorizationFingerprint=s.authorizationFingerprint,a},addEventMetadata:function(e){var t=e.getConfiguration(),n=r(t.authorization).attrs,i="production"===t.gatewayConfiguration.environment,a={api_integration_type:t.analyticsMetadata.integrationType,app_id:window.location.host,c_sdk_ver:o.VERSION,component:"braintreeclientsdk",merchant_sdk_env:i?"production":"sandbox",merchant_id:t.gatewayConfiguration.merchantId,event_source:"web",platform:o.PLATFORM,platform_version:window.navigator.userAgent,session_id:t.analyticsMetadata.sessionId,client_session_id:t.analyticsMetadata.sessionId,tenant_name:"braintree",product_name:"BT_DCC",space_key:"SKDUYK"};return n.tokenizationKey?a.tokenization_key=n.tokenizationKey:a.auth_fingerprint=n.authorizationFingerprint,a}}},{"./constants":17,"./create-authorization-data":20,"./json-clone":25}],12:[function(e,t,n){"use strict";var r=e("./constants"),i=e("./add-metadata"),o=e("./assign").assign;function a(e,t,n,a){var c=Date.now();return"vault"===n.flow?n.context_type="BA_Token":"checkout"===n.flow&&(n.context_type="EC_Token"),Promise.resolve(e).then(function(e){var d=e._request,l=r.ANALYTICS_URL,u=r.ANALYTICS_PREFIX+t,p="production"===e.getConfiguration().gatewayConfiguration.environment,_={events:[],tracking:[]},E=i.addEventMetadata(e,_);return E.event_name=u,E.t=c,_.events=[{level:"info",event:u,payload:o({env:p?"production":"sandbox",timestamp:c},n)}],_.tracking=[E],n&&"object"==typeof n&&(_.tracking=[s(E,n)]),d({url:l,method:"post",data:_,timeout:r.ANALYTICS_REQUEST_TIMEOUT_MS},a)}).catch(function(e){a&&a(e)})}function s(e,t){var n=o({},t);
2return Object.keys(n).forEach(function(e){-1===r.ALLOWED_EXTRA_EVENT_FIELDS.indexOf(e)&&delete n[e]}),o(e,n)}t.exports={sendEvent:function(e,t,n){return a(e,t,{},n)},sendEventPlus:a}},{"./add-metadata":11,"./assign":14,"./constants":17}],13:[function(e,t,n){"use strict";var r=e("@braintree/asset-loader/load-script"),i=e("@paypal/fastlane-sdk-loader");t.exports={loadScript:r,loadFastlane:i.loadAxo}},{"@braintree/asset-loader/load-script":2,"@paypal/fastlane-sdk-loader":7}],14:[function(e,t,n){"use strict";var r="function"==typeof Object.assign?Object.assign:i;function i(e){var t,n,r;for(t=1;t<arguments.length;t++)for(r in n=arguments[t])n.hasOwnProperty(r)&&(e[r]=n[r]);return e}t.exports={assign:r,_assign:i}},{}],15:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./errors"),o="3.143.0";t.exports={verify:function(e){var t,n,a;return e?(a=e.name,t=e.client,n=e.authorization,t||n?n||t.getVersion()===o?Promise.resolve():Promise.reject(new r({type:i.INCOMPATIBLE_VERSIONS.type,code:i.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+t.getVersion()+") and "+a+" (version "+o+") components must be from the same SDK version."})):Promise.reject(new r({type:i.INSTANTIATION_OPTION_REQUIRED.type,code:i.INSTANTIATION_OPTION_REQUIRED.code,message:"options.client is required when instantiating "+a+"."}))):Promise.reject(new r({type:i.INVALID_USE_OF_INTERNAL_FUNCTION.type,code:i.INVALID_USE_OF_INTERNAL_FUNCTION.code,message:"Options must be passed to basicComponentVerification function."}))}}},{"./braintree-error":16,"./errors":23}],16:[function(e,t,n){"use strict";var r=e("./enumerate");function i(e){if(!i.types.hasOwnProperty(e.type))throw new Error(e.type+" is not a valid type.");if(!e.code)throw new Error("Error code required.");if(!e.message)throw new Error("Error message required.");this.name="BraintreeError",this.code=e.code,this.message=e.message,this.type=e.type,this.details=e.details}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.types=r(["CUSTOMER","MERCHANT","NETWORK","INTERNAL","UNKNOWN"]),i.findRootError=function(e){return e instanceof i&&e.details&&e.details.originalError?i.findRootError(e.details.originalError):e},t.exports=i},{"./enumerate":22}],17:[function(e,t,n){"use strict";var r="3.143.0",i="web";t.exports={ANALYTICS_PREFIX:i+".",ANALYTICS_REQUEST_TIMEOUT_MS:2e3,ANALYTICS_URL:"https://www.paypal.com/xoplatform/logger/api/logger",ASSETS_URLS:{production:"https://assets.braintreegateway.com",sandbox:"https://assets.braintreegateway.com"},CLIENT_API_URLS:{production:"https://api.braintreegateway.com:443",sandbox:"https://api.sandbox.braintreegateway.com:443"},FRAUDNET_SOURCE:"BRAINTREE_SIGNIN",FRAUDNET_FNCLS:"fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99",FRAUDNET_URL:"https://c.paypal.com/da/r/fb.js",BUS_CONFIGURATION_REQUEST_EVENT:"BUS_CONFIGURATION_REQUEST",GRAPHQL_URLS:{production:"https://payments.braintree-api.com/graphql",sandbox:"https://payments.sandbox.braintree-api.com/graphql"},INTEGRATION_TIMEOUT_MS:6e4,VERSION:r,INTEGRATION:"custom",SOURCE:"client",PLATFORM:i,BRAINTREE_LIBRARY_VERSION:"braintree/web/"+r,ALLOWED_EXTRA_EVENT_FIELDS:["context_id","context_type","payment_ready_button_order","payment_ready_experiment_type","payment_ready_page_type","payment_ready_session_id","button_type","connect_start_time","domain","endpoint","end_time","request_start_time","start_time"]}},{}],18:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./errors");t.exports=function(e,t){t.forEach(function(t){e[t]=function(){throw new r({type:i.METHOD_CALLED_AFTER_TEARDOWN.type,code:i.METHOD_CALLED_AFTER_TEARDOWN.code,message:t+" cannot be called after teardown."})}})}},{"./braintree-error":16,"./errors":23}],19:[function(e,t,n){"use strict";var r=e("./constants").ASSETS_URLS;t.exports={create:function(e){return r.production}}},{"./constants":17}],20:[function(e,t,n){"use strict";var r=e("../lib/vendor/polyfill").atob,i=e("../lib/constants").CLIENT_API_URLS;t.exports=function(e){var t,n,o,a,s={attrs:{},configUrl:""};return/^[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9_]+$/.test(e)?(o=e.split("_"),a=o[0],n={merchantId:o.slice(2).join("_"),environment:a},s.environment=n.environment,s.attrs.tokenizationKey=e,s.configUrl=i[n.environment]+"/merchants/"+n.merchantId+"/client_api/v1/configuration"):(t=JSON.parse(r(e)),s.environment=t.environment,s.attrs.authorizationFingerprint=t.authorizationFingerprint,s.configUrl=t.configUrl,s.graphQL=t.graphQL),s}},{"../lib/constants":17,"../lib/vendor/polyfill":27}],21:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./assets"),o=e("./errors"),a="3.143.0";t.exports={create:function(e){var t=Promise.resolve();return e.client?Promise.resolve(e.client):(window.braintree&&window.braintree.client||(t=i.loadScript({src:e.assetsUrl+"/web/"+a+"/js/client.min.js"}).catch(function(e){return Promise.reject(new r({type:o.CLIENT_SCRIPT_FAILED_TO_LOAD.type,code:o.CLIENT_SCRIPT_FAILED_TO_LOAD.code,message:o.CLIENT_SCRIPT_FAILED_TO_LOAD.message,details:{originalError:e}}))}
2)),t.then(function(){return window.braintree.client.VERSION!==a?Promise.reject(new r({type:o.INCOMPATIBLE_VERSIONS.type,code:o.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+window.braintree.client.VERSION+") and "+e.name+" (version "+a+") components must be from the same SDK version."})):window.braintree.client.create({authorization:e.authorization,debug:e.debug})}))}}},{"./assets":13,"./braintree-error":16,"./errors":23}],22:[function(e,t,n){"use strict";t.exports=function(e,t){return t=null==t?"":t,e.reduce(function(e,n){return e[n]=t+n,e},{})}},{}],23:[function(e,t,n){"use strict";var r=e("./braintree-error");t.exports={INVALID_USE_OF_INTERNAL_FUNCTION:{type:r.types.INTERNAL,code:"INVALID_USE_OF_INTERNAL_FUNCTION"},INSTANTIATION_OPTION_REQUIRED:{type:r.types.MERCHANT,code:"INSTANTIATION_OPTION_REQUIRED"},INCOMPATIBLE_VERSIONS:{type:r.types.MERCHANT,code:"INCOMPATIBLE_VERSIONS"},CLIENT_SCRIPT_FAILED_TO_LOAD:{type:r.types.NETWORK,code:"CLIENT_SCRIPT_FAILED_TO_LOAD",message:"Braintree client script could not be loaded."},METHOD_CALLED_AFTER_TEARDOWN:{type:r.types.MERCHANT,code:"METHOD_CALLED_AFTER_TEARDOWN"},INSTANTIATION_OPTION_INVALID:{type:r.types.MERCHANT,code:"INSTANTIATION_OPTION_INVALID"}}},{"./braintree-error":16}],24:[function(e,t,n){"use strict";t.exports=function(e){e=e||window;try{return e.self!==e.top}catch(e){return!0}}},{}],25:[function(e,t,n){"use strict";t.exports=function(e){return JSON.parse(JSON.stringify(e))}},{}],26:[function(e,t,n){"use strict";t.exports=function(e){return Object.keys(e).filter(function(t){return"function"==typeof e[t]})}},{}],27:[function(e,t,n){"use strict";var r="function"==typeof atob?atob:i;function i(e){var t,n,r,i,o,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="";if(!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})([=]{1,2})?$/.test(e))throw new Error("Non base64 encoded input passed to window.atob polyfill");a=0;do{t=(63&s.indexOf(e.charAt(a++)))<<2|(i=s.indexOf(e.charAt(a++)))>>4&3,n=(15&i)<<4|(o=s.indexOf(e.charAt(a++)))>>2&15,r=(3&o)<<6|63&s.indexOf(e.charAt(a++)),c+=String.fromCharCode(t)+(n?String.fromCharCode(n):"")+(r?String.fromCharCode(r):"")}while(a<e.length);return c}t.exports={atob:function(e){return r.call(window,e)},_atob:i}},{}]},{},[10])(10)},1733:function(e){e.exports=function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[a]={exports:{}};t[a][0].call(d.exports,function(e){return i(t[a][1][e]||e)},d,d.exports,e,t,n,r)}return n[a].exports}for(var o=void 0,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";var r={};function i(e){var t,n=JSON.stringify(e);if(!e.forceScriptReload&&(t=r[n]))return t;var i=document.createElement("script"),o=e.dataAttributes||{},a=e.container||document.head;return i.src=e.src,i.id=e.id||"",i.async=!0,e.type&&i.setAttribute("type","".concat(e.type)),e.crossorigin&&i.setAttribute("crossorigin","".concat(e.crossorigin)),e.integrity&&i.setAttribute("integrity","".concat(e.integrity)),Object.keys(o).forEach(function(e){i.setAttribute("data-".concat(e),"".concat(o[e]))}),t=new Promise(function(t,n){i.addEventListener("load",function(){t(i)}),i.addEventListener("error",function(){n(new Error("".concat(e.src," failed to load.")))}),i.addEventListener("abort",function(){n(new Error("".concat(e.src," has aborted.")))}),a.appendChild(i)}),r[n]=t,t}i.clearCache=function(){r={}},t.exports=i},{}],2:[function(e,t,n){t.exports=e("./dist/load-script")},{"./dist/load-script":1}],3:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/Android/i.test(e)}},{}],4:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/CrOS/i.test(e)}},{}],5:[function(e,t,n){"use strict";var r=e("./is-edge"),i=e("./is-samsung"),o=e("./is-duckduckgo"),a=e("./is-opera"),s=e("./is-silk");t.exports=function(e){return!(-1===(e=e||window.navigator.userAgent).indexOf("Chrome")&&-1===e.indexOf("CriOS")||r(e)||i(e)||o(e)||a(e)||s(e))}},{"./is-duckduckgo":6,"./is-edge":7,"./is-opera":17,"./is-samsung":19,"./is-silk":20}],6:[function(e,t,n){"use strict";
2t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("DuckDuckGo/")}},{}],7:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("Edge/")||-1!==e.indexOf("Edg/")}},{}],8:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/Firefox/i.test(e)}},{}],9:[function(e,t,n){"use strict";var r=e("detectincognitojs");t.exports=function(){return r.detectIncognito()}},{detectincognitojs:52}],10:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/FxiOS/i.test(e)}},{}],11:[function(e,t,n){"use strict";var r=e("./is-ios");t.exports=function(e){return e=e||window.navigator.userAgent,r(e)&&function(e){return/\bGSA\b/.test(e)}(e)}},{"./is-ios":15}],12:[function(e,t,n){"use strict";var r=e("./is-ios"),i=e("./is-ios-firefox"),o=/webkit/i;t.exports=function(e){return e=e||window.navigator.userAgent,r(e)&&function(e){return o.test(e)}(e)&&!function(e){return e.indexOf("CriOS")>-1}(e)&&!i(e)&&!function(e){return e.indexOf("FBAN")>-1}(e)}},{"./is-ios":15,"./is-ios-firefox":10}],13:[function(e,t,n){"use strict";var r=e("./is-ios"),i=e("./is-ios-google-search-app");t.exports=function(e){return e=e||window.navigator.userAgent,!!r(e)&&(!!i(e)||/.+AppleWebKit(?!.*Safari)/i.test(e))}},{"./is-ios":15,"./is-ios-google-search-app":11}],14:[function(e,t,n){"use strict";var r=e("./is-ios-webview");t.exports=function(e,t){return t=void 0!==t?t:window.statusbar.visible,r(e)&&t}},{"./is-ios-webview":13}],15:[function(e,t,n){"use strict";var r=e("./is-ipados");t.exports=function(e,t,n){void 0===t&&(t=!0),e=e||window.navigator.userAgent;var i=/iPhone|iPod|iPad/i.test(e);return t?i||r(e,n):i}},{"./is-ipados":16}],16:[function(e,t,n){"use strict";t.exports=function(e,t){return e=e||window.navigator.userAgent,t=t||window.document,/Mac|iPad/i.test(e)&&"ontouchend"in t}},{}],17:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("OPR/")||-1!==e.indexOf("Opera/")||-1!==e.indexOf("OPT/")}},{}],18:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/^Mozilla\/5\.0.*Safari\//.test(e)&&!/(iPhone|iPad|iPod|Android|SM-)/i.test(e)&&!/Chrome|CriOS|FxiOS|OPiOS|mercury/i.test(e)}},{}],19:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/SamsungBrowser/i.test(e)}},{}],20:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("Silk/")}},{}],21:[function(e,t,n){"use strict";var r=e("./is-android"),i=e("./is-ios-firefox"),o=e("./is-ios-webview"),a=e("./is-chrome"),s=e("./is-samsung"),c=e("./is-duckduckgo");function d(e){return(e=e||window.navigator.userAgent).indexOf("Opera Mini")>-1}t.exports=function(e){return e=e||window.navigator.userAgent,!(o(e)||i(e)||function(e){return e=e||window.navigator.userAgent,!!r(e)&&/Version\/[\d.]+/i.test(e)&&!d(e)&&!c(e)}(e)||d(e)||function(e){var t=(e=e||window.navigator.userAgent).match(/CriOS\/(\d+)\./);return!!t&&parseInt(t[1],10)<48}(e)||function(e){return!a(e)&&!s(e)&&/samsung/i.test(e)}(e))}},{"./is-android":3,"./is-chrome":5,"./is-duckduckgo":6,"./is-ios-firefox":10,"./is-ios-webview":13,"./is-samsung":19}],22:[function(e,t,n){t.exports=e("./dist/is-android")},{"./dist/is-android":3}],23:[function(e,t,n){t.exports=e("./dist/is-chrome-os")},{"./dist/is-chrome-os":4}],24:[function(e,t,n){t.exports=e("./dist/is-chrome")},{"./dist/is-chrome":5}],25:[function(e,t,n){t.exports=e("./dist/is-firefox")},{"./dist/is-firefox":8}],26:[function(e,t,n){t.exports=e("./dist/is-incognito")},{"./dist/is-incognito":9}],27:[function(e,t,n){t.exports=e("./dist/is-ios-safari")},{"./dist/is-ios-safari":12}],28:[function(e,t,n){t.exports=e("./dist/is-ios-webview")},{"./dist/is-ios-webview":13}],29:[function(e,t,n){t.exports=e("./dist/is-ios-wkwebview")},{"./dist/is-ios-wkwebview":14}],30:[function(e,t,n){t.exports=e("./dist/is-ios")},{"./dist/is-ios":15}],31:[function(e,t,n){t.exports=e("./dist/is-safari")},{"./dist/is-safari":18}],32:[function(e,t,n){t.exports=e("./dist/supports-popups")},{"./dist/supports-popups":21}],33:[function(e,t,n){"use strict";var r=function(){function e(){this._events={}}return e.prototype.on=function(e,t){this._events[e]?this._events[e].push(t):this._events[e]=[t]},e.prototype.off=function(e,t){var n=this._events[e];if(n){var r=n.indexOf(t);n.splice(r,1)}},e.prototype._emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._events[e];r&&r.forEach(function(e){e.apply(void 0,t)})},e.prototype.hasListener=function(e){var t=this._events[e];return!!t&&t.length>0},e.createChild=function(t){t.prototype=Object.create(e.prototype,{constructor:t})},e}();t.exports=r},{}],34:[function(e,t,n){"use strict";var r="undefined"!=typeof Promise?Promise:null,i=function(){function e(t){var n=this;"function"!=typeof t?(this._promise=new e.Promise(function(e,t){n._resolveFunction=e,n._rejectFunction=t}),t=t||{}
2,this._onResolve=t.onResolve||e.defaultOnResolve,this._onReject=t.onReject||e.defaultOnReject,e.shouldCatchExceptions(t)&&this._promise.catch(function(){}),this._resetState()):this._promise=new e.Promise(t)}return e.defaultOnResolve=function(t){return e.Promise.resolve(t)},e.defaultOnReject=function(t){return e.Promise.reject(t)},e.setPromise=function(t){e.Promise=t},e.shouldCatchExceptions=function(t){return t.hasOwnProperty("suppressUnhandledPromiseMessage")?Boolean(t.suppressUnhandledPromiseMessage):Boolean(e.suppressUnhandledPromiseMessage)},e.all=function(t){return e.Promise.all(t)},e.allSettled=function(t){return e.Promise.allSettled(t)},e.race=function(t){return e.Promise.race(t)},e.reject=function(t){return e.Promise.reject(t)},e.resolve=function(t){return e.Promise.resolve(t)},e.prototype.then=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).then.apply(e,t)},e.prototype.catch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).catch.apply(e,t)},e.prototype.resolve=function(t){var n=this;return this.isFulfilled||(this._setResolved(),e.Promise.resolve().then(function(){return n._onResolve(t)}).then(function(e){n._resolveFunction(e)}).catch(function(e){n._resetState(),n.reject(e)})),this},e.prototype.reject=function(t){var n=this;return this.isFulfilled||(this._setRejected(),e.Promise.resolve().then(function(){return n._onReject(t)}).then(function(e){n._setResolved(),n._resolveFunction(e)}).catch(function(e){return n._rejectFunction(e)})),this},e.prototype._resetState=function(){this.isFulfilled=!1,this.isResolved=!1,this.isRejected=!1},e.prototype._setResolved=function(){this.isFulfilled=!0,this.isResolved=!0,this.isRejected=!1},e.prototype._setRejected=function(){this.isFulfilled=!0,this.isResolved=!1,this.isRejected=!0},e.Promise=r,e}();t.exports=i},{}],35:[function(e,t,n){"use strict";var r=e("./lib/set-attributes"),i=e("./lib/default-attributes"),o=e("./lib/assign");t.exports=function(e){void 0===e&&(e={});var t=document.createElement("iframe"),n=(0,o.assign)({},i.defaultAttributes,e);return n.style&&"string"!=typeof n.style&&((0,o.assign)(t.style,n.style),delete n.style),(0,r.setAttributes)(t,n),t.getAttribute("id")||(t.id=t.name),t}},{"./lib/assign":36,"./lib/default-attributes":37,"./lib/set-attributes":38}],36:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.assign=void 0,n.assign=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach(function(t){"object"==typeof t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}},{}],37:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.defaultAttributes=void 0,n.defaultAttributes={src:"about:blank",frameBorder:0,allowtransparency:!0,scrolling:"no"}},{}],38:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.setAttributes=void 0,n.setAttributes=function(e,t){for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];null==r?e.removeAttribute(n):e.setAttribute(n,r)}}},{}],39:[function(e,t,n){"use strict";t.exports=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)try{return crypto.randomUUID()}catch(e){}if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;for(var t=new Array(256),n=0;n<256;n++)t[n]=(n<16?"0":"")+n.toString(16);return t[e[0]]+t[e[1]]+t[e[2]]+t[e[3]]+"-"+t[e[4]]+t[e[5]]+"-"+t[e[6]]+t[e[7]]+"-"+t[e[8]]+t[e[9]]+"-"+t[e[10]]+t[e[11]]+t[e[12]]+t[e[13]]+t[e[14]]+t[e[15]]}throw new Error("@braintree/uuid: No secure random source available")}},{}],40:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.deferred=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];setTimeout(function(){try{e.apply(void 0,t)}catch(e){console.log("Error in callback function"),console.log(e)}},1)}}},{}],41:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.once=function(e){var t=!1;return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];t||(t=!0,e.apply(void 0,n))}}},{}],42:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.promiseOrCallback=function(e,t){if(!t)return e;e.then(function(e){return t(null,e)}).catch(function(e){return t(e)})}},{}],43:[function(e,t,n){"use strict";var r=e("./lib/deferred"),i=e("./lib/once"),o=e("./lib/promise-or-callback");function a(e){return function(){for(var t,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return"function"==typeof n[n.length-1]&&(t=n.pop(),t=i.once(r.deferred(t))),o.promiseOrCallback(e.apply(this,n),t)}}a.wrapPrototype=function(e,t){void 0===t&&(t={});var n=t.ignoreMethods||[],r=!0===t.transformPrivateMethods;return Object.getOwnPropertyNames(e.prototype).filter(function(t){var i,o="constructor"!==t&&"function"==typeof e.prototype[t],a=-1===n.indexOf(t);return i=!!r||"_"!==t.charAt(0),o&&i&&a}
2).forEach(function(t){var n=e.prototype[t];e.prototype[t]=a(n)}),e},t.exports=a},{"./lib/deferred":40,"./lib/once":41,"./lib/promise-or-callback":42}],44:[function(e,t,n){var r,i;r=this,i=function(e){"use strict";function t(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})}function n(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var r={},i={};function o(e){var t,n=JSON.stringify(e);if(!e.forceScriptReload&&(t=i[n]))return t;var r=document.createElement("script"),o=e.dataAttributes||{},a=e.container||document.head;return r.src=e.src,r.id=e.id||"",r.async=!0,e.type&&r.setAttribute("type","".concat(e.type)),e.crossorigin&&r.setAttribute("crossorigin","".concat(e.crossorigin)),Object.keys(o).forEach(function(e){r.setAttribute("data-".concat(e),"".concat(o[e]))}),t=new Promise(function(t,n){r.addEventListener("load",function(){t(r)}),r.addEventListener("error",function(){n(new Error("".concat(e.src," failed to load.")))}),r.addEventListener("abort",function(){n(new Error("".concat(e.src," has aborted.")))}),a.appendChild(r)}),i[n]=t,t}o.clearCache=function(){i={}};var a=o;Object.defineProperty(r,"__esModule",{value:!0}),r.loadStylesheet=c=r.loadScript=void 0;var s=a,c=r.loadScript=s,d=function(e){var t=document.querySelector('link[href="'.concat(e.href,'"]'));if(t)return Promise.resolve(t);t=document.createElement("link");var n=e.container||document.head;return t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e.href),t.setAttribute("id",e.id),n.firstChild?n.insertBefore(t,n.firstChild):n.appendChild(t),Promise.resolve(t)};r.loadStylesheet=d;var l,u,p="fastlane",_="connect-boba",E={AXO_ASSET_NAME:{minified:"axo.min",unminified:"axo"},AXO_ASSET_PATH:_,LOCALE_PATH:"".concat(_,"/locales/"),CDNX_PROD:"https://www.paypalobjects.com"},m="BT",h="PPCP";function f(){return"function"==typeof window.define&&!!window.define.amd}function A(e,r,i){var o,a;return void 0===i&&(i=!0),t(this,void 0,void 0,function(){var t,s;return n(this,function(n){if((t=null===window||void 0===window?void 0:window.braintree)&&t[e.module]){if(r&&(null===(o=t[e.module])||void 0===o?void 0:o.VERSION)!==r)throw s=null===(a=t[e.module])||void 0===a?void 0:a.VERSION,new Error("".concat(e.module," already loaded with version ").concat(s," cannot load version ").concat(r));return[2,!0]}if(!r)throw new Error("Attempted to load ".concat(e.module," without specifying version"));return[2,y(e,r,i)]})})}function y(e,t,n){if(void 0===n&&(n=!0),f()){var r=n?e.amdModule.minified:e.amdModule.unminified;return new Promise(function(e,t){window.require([r],e,t)})}var i=n?e.script.minified:e.script.unminified;return c({id:"".concat(e.id,"-").concat(t),src:"https://js.braintreegateway.com/web/".concat(t,"/js/").concat(i)})}var I="client",T="hostedFields",P="braintree",N=((l={})[I]="client",l[T]="hosted-fields",l),O=((u={})[I]={id:"client",module:I,amdModule:{unminified:"".concat(P,"/").concat(N[I]),minified:"".concat(P,"/").concat(N[I],".min")},script:{unminified:"".concat(N[I],".js"),minified:"".concat(N[I],".min.js")}},u[T]={id:"hcf",module:T,amdModule:{unminified:"".concat(P,"/").concat(N[T]),minified:"".concat(P,"/").concat(N[T],".min")},script:{unminified:"".concat(N[T],".js"),minified:"".concat(N[T],".min.js")}},u);function g(e,t){var n;if(void 0===t&&(t=!0),f()){f()&&"function"==typeof window.requirejs&&"function"==typeof window.requirejs.config&&requirejs.config({paths:(n={},n[p]=e,n)});var r="".concat(p,"/").concat(t?E.AXO_ASSET_NAME.minified:E.AXO_ASSET_NAME.unminified);return new Promise(function(e,t){window.require([r],e,t)})}return c({id:"axo-id",src:e,forceScriptReload:!0})}function C(e){var t=e.assetUrl,n=e.bundleId;return n?"https://cdn-".concat(n,".static.engineering.dev.paypalinc.com/").concat(t):"".concat(E.CDNX_PROD,"/").concat(t)}e.constants=E,e.loadAxo=function(e){return t(this,void 0,void 0,function(){var t,r,i,o;return n(this,function(n){switch(n.label){case 0:return performance.mark("pp_axo_sdk_init_invoked"),t=e.btSdkVersion,r=e.minified,i=function(e){var t,n=!1!==(null==e?void 0:e.minified)?E.AXO_ASSET_NAME.minified:E.AXO_ASSET_NAME.unminified;return C({assetUrl:f()?E.AXO_ASSET_PATH:"".concat(E.AXO_ASSET_PATH,"/").concat(n,".js"),bundleId:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.bundleIdOverride})}(e),o=function(e){var t;return C({assetUrl:E.LOCALE_PATH,bundleId:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.bundleIdOverride})}(e),e.platform!==m?[3,2]:[4,Promise.all([A(O.hostedFields,t,r),g(i,r)])];case 1:case 3:return n.sent(),[3,5];case 2:return e.platform!==h?[3,4]:[4,Promise.all([A(O.client,t,r),A(O.hostedFields,t,r),g(i,r)])];case 4:throw new Error("unsupported axo platform");case 5:return[2,{metadata:{localeUrl:o}}]}})})}},i("object"==typeof n&&void 0!==t?n:(r="undefined"!=typeof globalThis?globalThis:r||self).loadAxo={})},{}],45:[function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)},i=e("./lib/card-types"),o=e("./lib/add-matching-cards-to-results"),a=e("./lib/is-valid-input-type"),s=e("./lib/find-best-match"),c=e("./lib/clone"),d={},l={VISA:"visa",MASTERCARD:"mastercard",AMERICAN_EXPRESS:"american-express",DINERS_CLUB:"diners-club",DISCOVER:"discover",JCB:"jcb",UNIONPAY:"unionpay",NARANJA:"naranja",VERVE:"verve",MAESTRO:"maestro",ELO:"elo",MIR:"mir",HIPER:"hiper",HIPERCARD:"hipercard"},u=[l.VISA,l.MASTERCARD,l.AMERICAN_EXPRESS,l.DINERS_CLUB,l.DISCOVER,l.JCB,l.UNIONPAY,l.NARANJA,l.VERVE,l.MAESTRO,l.ELO,l.MIR,l.HIPER,l.HIPERCARD],p=(0,c.clone)(u);function _(e){return d[e]||i[e]}function E(e,t){void 0===t&&(t=!1);var n=p.indexOf(e);if(!t&&-1===n)throw new Error('"'+e+'" is not a supported card type.');return n}function m(e){var t=[];if(!(0,a.isValidInputType)(e))return t;if(0===e.length)return p.map(function(e){return(0,c.clone)(_(e))});p.forEach(function(n){var r=_(n);(0,o.addMatchingCardsToResults)(e,r,t)});var n=(0,s.findBestMatch)(t);return n?[n]:t}m.getTypeInfo=function(e){return(0,c.clone)(_(e))},m.removeCard=function(e){var t=E(e);p.splice(t,1)},m.addCard=function(e){var t=E(e.type,!0);d[e.type]=e,-1===t&&p.push(e.type)},m.updateCard=function(e,t){var n=d[e]||i[e];if(!n)throw new Error('"'.concat(e,"\" is not a recognized type. Use `addCard` instead.'"));
2if(t.type&&n.type!==t.type)throw new Error("Cannot overwrite type parameter.");var o=(0,c.clone)(n);o=r(r({},o),t),d[o.type]=o},m.changeOrder=function(e,t){var n=E(e);p.splice(n,1),p.splice(t,0,e)},m.resetModifications=function(){p=(0,c.clone)(u),d={}},m.types=l,t.exports=m},{"./lib/add-matching-cards-to-results":46,"./lib/card-types":47,"./lib/clone":48,"./lib/find-best-match":49,"./lib/is-valid-input-type":50}],46:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.addMatchingCardsToResults=function(e,t,n){var o,a;for(o=0;o<t.patterns.length;o++){var s=t.patterns[o];if((0,i.matches)(e,s)){var c=(0,r.clone)(t);a=Array.isArray(s)?String(s[0]).length:String(s).length,e.length>=a&&(c.matchStrength=a),n.push(c);break}}};var r=e("./clone"),i=e("./matches")},{"./clone":48,"./matches":51}],47:[function(e,t,n){"use strict";t.exports={visa:{niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},mastercard:{niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},"american-express":{niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},"diners-club":{niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},discover:{niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},jcb:{niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},unionpay:{niceType:"UnionPay",type:"unionpay",patterns:[620,[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[62207,62209],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292,810,[8110,8131],[8132,8151],[8152,8163],[8164,8171]],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},maestro:{niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,504174],[504176,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},elo:{niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},mir:{niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},hiper:{niceType:"Hiper",type:"hiper",patterns:[637095,63737423,63743358,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},hipercard:{niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},naranja:{niceType:"Naranja",type:"naranja",patterns:[589562,402918,527572],gaps:[4,8,12],lengths:[16],code:{name:"CVV",size:3}},verve:{niceType:"Verve",type:"verve",patterns:[[506099,506127],506129,[506133,506150],[506158,506163],506166,506168,506170,506173,[506176,506180],506184,[506187,506188],506191,506195,506197,507865,507866,[507868,507877],[507880,507888],507900,507941],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}}}},{}],48:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.clone=function(e){return e?JSON.parse(JSON.stringify(e)):null}},{}],49:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.findBestMatch=function(e){return function(e){var t=e.filter(function(e){return e.matchStrength}).length;return t>0&&t===e.length}(e)?e.reduce(function(e,t){return e?Number(e.matchStrength)<Number(t.matchStrength)?t:e:t}):null}},{}],50:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isValidInputType=function(e){return"string"==typeof e||e instanceof String}},{}],51:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.matches=function(e,t){return Array.isArray(t)?function(e,t,n){var r=String(t).length,i=e.substr(0,r),o=parseInt(i,10);return t=parseInt(String(t).substr(0,i.length),10),n=parseInt(String(n).substr(0,i.length),10),o>=t&&o<=n}(e,t[0],t[1]):function(e,t){return(t=String(t)).substring(0,e.length)===e.substring(0,t.length)}(e,t)}},{}],52:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Prom
2ise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function o(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,new Promise(function(e,t){var n="Unknown",o=!1;function a(t){o||(o=!0,e({isPrivate:t,browserName:n}))}function s(){var e=0,t=parseInt("-1");try{t.toFixed(t)}catch(t){e=t.message.length}return e}function c(){return void 0!==navigator.msSaveBlob&&function(e){try{return e===eval.toString().length}catch(e){return!1}}(39)}function d(){var e;return r(this,void 0,void 0,function(){var t,n;return i(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return r.sent(),a(!1),[3,3];case 2:return t=r.sent(),n=t,t instanceof Error&&(n=null!==(e=t.message)&&void 0!==e?e:t),"string"!=typeof n?(a(!1),[2]):(a(!!n.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function l(){var e;return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return void 0===(null===(e=navigator.storage)||void 0===e?void 0:e.getDirectory)?[3,2]:[4,d()];case 1:return t.sent(),[3,3];case 2:void 0!==navigator.maxTouchPoints?function(){var e=String(Math.random());try{var t=indexedDB.open(e,1);t.onupgradeneeded=function(t){var n=t.target.result,r=function(e){a(e)};try{n.createObjectStore("t",{autoIncrement:!0}).put(new Blob),r(!1)}catch(e){(e.message||"").includes("are not yet supported")?r(!0):r(!1)}finally{n.close(),indexedDB.deleteDatabase(e)}},t.onerror=function(){return a(!1)}}catch(e){a(!1)}}():function(){var e=window.openDatabase,t=window.localStorage;try{e(null,null,null,null)}catch(e){return void a(!0)}try{t.setItem("test","1"),t.removeItem("test")}catch(e){return void a(!0)}a(!1)}(),t.label=3;case 3:return[2]}})})}function u(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(e,t){var n;a(Math.round(t/1048576)<2*Math.round((void 0!==(n=window).performance&&void 0!==n.performance.memory&&void 0!==n.performance.memory.jsHeapSizeLimit?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(e){t(new Error("detectIncognito somehow failed to query storage quota: "+e.message))})}function p(){void 0!==self.Promise&&void 0!==self.Promise.allSettled?u():(0,window.webkitRequestFileSystem)(0,1,function(){a(!1)},function(){a(!0)})}function _(){return r(this,void 0,void 0,function(){var e,t;return i(this,function(n){switch(n.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return n.sent(),a(!1),[3,4];case 3:return e=n.sent(),"string"!=typeof(t=e instanceof Error&&"string"==typeof e.message?e.message:String(e))?(a(!1),[2]):(a(t.includes("Security error")),[2]);case 4:return a(void 0===navigator.serviceWorker),[2]}})})}(function(){return r(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return 44===s()?(n="Safari",[4,l()]):[3,2];case 1:return e.sent(),[3,6];case 2:return 51===s()?(r=navigator.userAgent,n=r.match(/Chrome/)?void 0!==navigator.brave?"Brave":r.match(/Edg/)?"Edge":r.match(/OPR/)?"Opera":"Chrome":"Chromium",p(),[3,6]):[3,3];case 3:return 25===s()?(n="Firefox",[4,_()]):[3,5];case 4:return e.sent(),[3,6];case 5:c()?(n="Internet Explorer",a(void 0===window.indexedDB)):t(new Error("detectIncognito cannot determine the browser")),e.label=6;case 6:return[2]}var r})})})().catch(t)})];case 1:return[2,e.sent()]}})})}n.__esModule=!0,n.detectIncognito=void 0,n.detectIncognito=o,"undefined"!=typeof window&&(window.detectIncognito=o),n.default=o},{}],53:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Framebus=void 0;var r=e("./lib"),i="undefined"!=typeof window&&window.Promise,o=function(){function e(e){void 0===e&&(e={}),this.origin=e.origin||"*",this.channel=e.channel||"",this.verifyDomain=e.verifyDomain,this.targetFrames=e.targetFrames||[],this.limitBroadcastToFramesArray=Boolean(e.targetFrames),this.isDestroyed=!1,this.listeners=[],this.hasAdditionalChecksForOnListeners=Boolean(this.verifyDomain||this.limitBroadcastToFramesArray)}return e.setPromise=function(t){e.Promise=t},e.target=function(t){return new e(t)},e.prototype.addTargetFrame=function(e){this.limitBroadcastToFramesArray&&this.targetFrames.push(e)},e.prototype.include=function(e){return null!=e&&null!=e.Window&&e.constructor===e.Window&&(r.childWindows.push(e),!0)},e.prototype.target=function(t){return e.target(t)},e.prototype.emit=function(e,t,n){if(this.isDestroyed)return!1;var i=this.origin;if(e=this.namespaceEvent(e),(0,r.isntString)(e))return!1;if((0,r.isntString)(i))return!1;"function"==typeof t&&(n=t,t=void 0);var o=(0,r.packagePayload)(e,i,t,n);return!!o&&(this.limitBroadcastToFramesArray?this.targetFramesAsWindows().forEac
2h(function(e){(0,r.sendMessage)(e,o,i)}):(0,r.broadcast)(o,{origin:i,frame:window.top||window.self}),!0)},e.prototype.emitAsPromise=function(t,n){var r=this;return new e.Promise(function(e,i){r.emit(t,n,function(t){e(t)})||i(new Error('Listener not added for "'.concat(t,'"')))})},e.prototype.on=function(e,t){if(this.isDestroyed)return!1;var n=this,i=this.origin,o=t;return e=this.namespaceEvent(e),!(0,r.subscriptionArgsInvalid)(e,o,i)&&(this.hasAdditionalChecksForOnListeners&&(o=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.passesVerifyDomainCheck(this&&this.origin)&&n.hasMatchingTargetFrame(this&&this.source)&&t.apply(void 0,e)}),this.listeners.push({eventName:e,handler:o,originalHandler:t}),r.subscribers[i]=r.subscribers[i]||{},r.subscribers[i][e]=r.subscribers[i][e]||[],r.subscribers[i][e].push(o),!0)},e.prototype.off=function(e,t){var n=t;if(this.isDestroyed)return!1;if(this.hasAdditionalChecksForOnListeners)for(var i=0;i<this.listeners.length;i++){var o=this.listeners[i];o.originalHandler===t&&(n=o.handler)}e=this.namespaceEvent(e);var a=this.origin;if((0,r.subscriptionArgsInvalid)(e,n,a))return!1;var s=r.subscribers[a]&&r.subscribers[a][e];if(!s)return!1;for(i=0;i<s.length;i++)if(s[i]===n)return s.splice(i,1),!0;return!1},e.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var e=0;e<this.listeners.length;e++){var t=this.listeners[e];this.off(t.eventName,t.handler)}this.listeners.length=0}},e.prototype.passesVerifyDomainCheck=function(e){return!this.verifyDomain||this.checkOrigin(e)},e.prototype.targetFramesAsWindows=function(){return this.limitBroadcastToFramesArray?this.targetFrames.map(function(e){return e instanceof HTMLIFrameElement?e.contentWindow:e}).filter(function(e){return e}):[]},e.prototype.hasMatchingTargetFrame=function(e){if(!this.limitBroadcastToFramesArray)return!0;var t=this.targetFramesAsWindows().find(function(t){return t===e});return Boolean(t)},e.prototype.checkOrigin=function(e){var t,n=document.createElement("a");return n.href=location.href,t="https:"===n.protocol?n.host.replace(/:443$/,""):"http:"===n.protocol?n.host.replace(/:80$/,""):n.host,n.protocol+"//"+t===e||!this.verifyDomain||this.verifyDomain(e)},e.prototype.namespaceEvent=function(e){return this.channel?"".concat(this.channel,":").concat(e):e},e.Promise=i,e}();n.Framebus=o},{"./lib":61}],54:[function(e,t,n){"use strict";var r=e("./lib"),i=e("./framebus");(0,r.attach)(),t.exports=i.Framebus},{"./framebus":53,"./lib":61}],55:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.detach=n.attach=void 0;var r=e("./"),i=!1;n.attach=function(){i||"undefined"==typeof window||(i=!0,window.addEventListener("message",r.onMessage,!1))},n.detach=function(){i=!1,window.removeEventListener("message",r.onMessage,!1)}},{"./":61}],56:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.broadcastToChildWindows=void 0;var r=e("./");n.broadcastToChildWindows=function(e,t,n){for(var i=r.childWindows.length-1;i>=0;i--){var o=r.childWindows[i];o.closed?r.childWindows.splice(i,1):n!==o&&(0,r.broadcast)(e,{origin:t,frame:o.top})}}},{"./":61}],57:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.broadcast=void 0;var r=e("./");n.broadcast=function e(t,n){var i,o=0,a=n.origin,s=n.frame;try{for(s.postMessage(t,a),(0,r.hasOpener)(s)&&s.opener.top!==window.top&&e(t,{origin:a,frame:s.opener.top});i=s.frames[o];)e(t,{origin:a,frame:i}),o++}catch(e){}}},{"./":61}],58:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.subscribers=n.childWindows=n.prefix=void 0,n.prefix="/*framebus*/",n.childWindows=[],n.subscribers={}},{}],59:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.dispatch=void 0;var r=e("./");n.dispatch=function(e,t,n,i,o){if(r.subscribers[e]&&r.subscribers[e][t]){var a=[];n&&a.push(n),i&&a.push(i);for(var s=0;s<r.subscribers[e][t].length;s++)r.subscribers[e][t][s].apply(o,a)}}},{"./":61}],60:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.hasOpener=void 0,n.hasOpener=function(e){return e.top===e&&null!=e.opener&&e.opener!==e&&!0!==e.opener.closed}},{}],61:[function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);
2i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),i(e("./attach"),n),i(e("./broadcast-to-child-windows"),n),i(e("./broadcast"),n),i(e("./constants"),n),i(e("./dispatch"),n),i(e("./has-opener"),n),i(e("./is-not-string"),n),i(e("./message"),n),i(e("./package-payload"),n),i(e("./send-message"),n),i(e("./subscribe-replier"),n),i(e("./subscription-args-invalid"),n),i(e("./types"),n),i(e("./unpack-payload"),n)},{"./attach":55,"./broadcast":57,"./broadcast-to-child-windows":56,"./constants":58,"./dispatch":59,"./has-opener":60,"./is-not-string":62,"./message":63,"./package-payload":64,"./send-message":65,"./subscribe-replier":66,"./subscription-args-invalid":67,"./types":68,"./unpack-payload":69}],62:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isntString=void 0,n.isntString=function(e){return"string"!=typeof e}},{}],63:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.onMessage=void 0;var r=e("./");n.onMessage=function(e){if(!(0,r.isntString)(e.data)){var t=(0,r.unpackPayload)(e);if(t){var n=t.eventData,i=t.reply;(0,r.dispatch)("*",t.event,n,i,e),(0,r.dispatch)(e.origin,t.event,n,i,e),(0,r.broadcastToChildWindows)(e.data,t.origin,e.source)}}}},{"./":61}],64:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.packagePayload=void 0;var r=e("./");n.packagePayload=function(e,t,n,i){var o,a={event:e,origin:t};"function"==typeof i&&(a.reply=(0,r.subscribeReplier)(i,t)),a.eventData=n;try{o=r.prefix+JSON.stringify(a)}catch(e){throw new Error("Could not stringify event: ".concat(e.message))}return o}},{"./":61}],65:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.sendMessage=void 0,n.sendMessage=function(e,t,n){try{e.postMessage(t,n)}catch(e){}}},{}],66:[function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.subscribeReplier=void 0;var i=e("../framebus"),o=r(e("@braintree/uuid"));n.subscribeReplier=function(e,t){var n=(0,o.default)();return i.Framebus.target({origin:t}).on(n,function r(o,a){e(o,a),i.Framebus.target({origin:t}).off(n,r)}),n}},{"../framebus":53,"@braintree/uuid":70}],67:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.subscriptionArgsInvalid=void 0;var r=e("./");n.subscriptionArgsInvalid=function(e,t,n){return!!(0,r.isntString)(e)||"function"!=typeof t||(0,r.isntString)(n)}},{"./":61}],68:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0})},{}],69:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.unpackPayload=void 0;var r=e("./");n.unpackPayload=function(e){var t;if(e.data.slice(0,r.prefix.length)!==r.prefix)return!1;try{t=JSON.parse(e.data.slice(r.prefix.length))}catch(e){return!1}if(t.reply){var n=e.origin,i=e.source,o=t.reply;t.reply=function(e){if(i){var t=(0,r.packagePayload)(o,n,e);t&&i.postMessage(t,n)}}}return t}},{"./":61}],70:[function(e,t,n){"use strict";t.exports=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},{}],71:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isIos=n.isIE9=n.isSamsungBrowser=n.isAndroidChrome=n.isKitKatWebview=void 0;var r="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent,i=e("@braintree/browser-detection/is-android"),o=e("@braintree/browser-detection/is-chrome-os"),a=e("@braintree/browser-detection/is-chrome"),s=e("@braintree/browser-detection/is-ios");n.isIos=s;var c=e("@braintree/browser-detection/is-ie9");n.isIE9=c;var d=/Version\/\d\.\d* Chrome\/\d*\.0\.0\.0/;n.isKitKatWebview=function(e){return void 0===e&&(e=r),i(e)&&d.test(e)},n.isAndroidChrome=function(e){return void 0===e&&(e=r),(i(e)||o(e))&&a(e)},n.isSamsungBrowser=function(e){return void 0===e&&(e=r),/SamsungBrowser/.test(e)||function(e){return!a(e)&&e.indexOf("Samsung")>-1}(e)}},{"@braintree/browser-detection/is-android":84,"@braintree/browser-detection/is-chrome":86,"@braintree/browser-detection/is-chrome-os":85,"@braintree/browser-detection/is-ie9":87,"@braintree/browser-detection/is-ios":88}],72:[function(e,t,n){"use strict";var r=e("./lib/device");t.exports=function(){return!(0,r.isSamsungBrowser)()}},{"./lib/device":71}],73:[function(e,t,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],74:[function(e,t,n){arguments[4][4][0].apply(n,arguments)},{dup:4}],75:[function(e,t,n){arguments[4][5][0].apply(n,arguments)},{"./is-duckduckgo":76,"./is-edge":77,"./is-opera":81,"./is-samsung":82,"./is-silk":83,dup:5}],76:[function(e,t,n){arguments[4][6][0].apply(n,arguments)},{dup:6}],77:[function(e,t,n){arguments[4][7][0].apply(n,arguments)},{dup:7}],78:[function(e,t,n){"use strict";
2t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("MSIE 9")}},{}],79:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./is-ipados":80,dup:15}],80:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],81:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],82:[function(e,t,n){arguments[4][19][0].apply(n,arguments)},{dup:19}],83:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{dup:20}],84:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{"./dist/is-android":73,dup:22}],85:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{"./dist/is-chrome-os":74,dup:23}],86:[function(e,t,n){arguments[4][24][0].apply(n,arguments)},{"./dist/is-chrome":75,dup:24}],87:[function(e,t,n){t.exports=e("./dist/is-ie9")},{"./dist/is-ie9":78}],88:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./dist/is-ios":79,dup:30}],89:[function(e,t,n){t.exports=e("./dist/supports-input-formatting")},{"./dist/supports-input-formatting":72}],90:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("./errors"),o=e("../lib/assign").assign,a=e("../lib/methods"),s=e("../lib/convert-methods-to-error"),c=e("@braintree/wrap-promise");function d(e){this._client=e.client}d.prototype.getRewardsBalance=function(e){var t,n=e.nonce;return n?(delete(t=o({_meta:{source:"american-express"},paymentMethodNonce:n},e)).nonce,this._client.request({method:"get",endpoint:"payment_methods/amex_rewards_balance",data:t}).catch(function(e){return Promise.reject(new r({type:i.AMEX_NETWORK_ERROR.type,code:i.AMEX_NETWORK_ERROR.code,message:"A network error occurred when getting the American Express rewards balance.",details:{originalError:e}}))})):Promise.reject(new r({type:i.AMEX_NONCE_REQUIRED.type,code:i.AMEX_NONCE_REQUIRED.code,message:"getRewardsBalance must be called with a nonce."}))},d.prototype.getExpressCheckoutProfile=function(e){return e.nonce?this._client.request({method:"get",endpoint:"payment_methods/amex_express_checkout_cards/"+e.nonce,data:{_meta:{source:"american-express"},paymentMethodNonce:e.nonce}}).catch(function(e){return Promise.reject(new r({type:i.AMEX_NETWORK_ERROR.type,code:i.AMEX_NETWORK_ERROR.code,message:"A network error occurred when getting the American Express Checkout nonce profile.",details:{originalError:e}}))}):Promise.reject(new r({type:i.AMEX_NONCE_REQUIRED.type,code:i.AMEX_NONCE_REQUIRED.code,message:"getExpressCheckoutProfile must be called with a nonce."}))},d.prototype.teardown=function(){return s(this,a(d.prototype)),Promise.resolve()},t.exports=c.wrapPrototype(d)},{"../lib/assign":146,"../lib/braintree-error":149,"../lib/convert-methods-to-error":151,"../lib/methods":181,"./errors":91,"@braintree/wrap-promise":43}],91:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={AMEX_NONCE_REQUIRED:{type:r.types.MERCHANT,code:"AMEX_NONCE_REQUIRED"},AMEX_NETWORK_ERROR:{type:r.types.NETWORK,code:"AMEX_NETWORK_ERROR"}}},{"../lib/braintree-error":149}],92:[function(e,t,n){"use strict";var r=e("./american-express"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("@braintree/wrap-promise");t.exports={create:s(function(e){var t="American Express";return i.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return o.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:a.create(e.authorization),name:t})}).then(function(t){return e.client=t,new r(e)})}),VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./american-express":90,"@braintree/wrap-promise":43}],93:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("../lib/analytics"),o=e("./errors"),a=e("../lib/methods"),s=e("../lib/convert-methods-to-error"),c=e("@braintree/wrap-promise"),d=e("../lib/in-iframe");function l(e){this._instantiatedWithClient=Boolean(!e.useDeferredClient),this._client=e.client,this._createPromise=e.createPromise,this._client&&this._setMerchantIdentifier()}l.prototype._waitForClient=function(){return this._client?Promise.resolve():this._createPromise.then(function(e){this._client=e,this._setMerchantIdentifier()}.bind(this))},l.prototype._setMerchantIdentifier=function(){var e=this._client.getConfiguration().gatewayConfiguration.applePayWeb;e&&Object.defineProperty(this,"merchantIdentifier",{value:e.merchantIdentifier,configurable:!1,writable:!1})},l.prototype.createPaymentRequest=function(e){return this._instantiatedWithClient?this._createPaymentRequestSynchronously(e):this._waitForClient().then(function(){return this._createPaymentRequestSynchronously(e)}.bind(this))},l.prototype._createPaymentRequestSynchronously=function(e){var t=this._client.getConfiguration().gatewayConfiguration.applePayWeb,n={countryCode:t.countryCode,currencyCode:t.currencyCode,merchantCapabilities:t.merchantCapabilities||["supports3DS"],supportedNetworks:t.supportedNetworks.map(function(e){return"mastercard"===e?"masterCard":e})};return Object.assign({},n,e)},l.prototype.performValidation=function(e){var t=this;return e&&e.validationURL?this._waitForClient().then(function(){var n={validationUrl:e.validationURL,domainName:e.domainName||(d()?window.parent.location.hostname:window.location.hostname),merchantIdentifier:e.merchantIdentifier||t.merchantIdentifier};return null!=e.displayName&&(n.displayName=e.displayName),t._client.request({method:"post",endpoint:"apple_pay_web/sessions",data:{_meta:{source:"apple-pay"},applePayWebSession:n}})}).then(function(e){return i.sendEvent(t._client,"applepay.performValidation.succeeded"),Promise.resolve(e)}).catch(function(e){return i.sendEvent(t._client,"applepay.performValidation.failed"),"CLIENT_REQUEST_ERROR"===e.code?Promise.reject(new r({type:o.APPLE_PAY_MERCHANT_VALIDATION_FAILED.type,code:o.APPLE_PAY_MERCHANT_VALIDATION_FAILED.code,message:o.APPLE_PAY_MERCHANT_VALIDATION_FAILED.message,details:{originalError:e.details.originalError}})):Promise.reject(new r({type:o.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.type,code:o.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.code,message:o.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.message,details:{originalError:e}}))}):Promise.reject(new r(o.APPLE_PAY_VALIDATION_URL_REQUIRED))},l.prototype.tokenize=function(e){var t=this;return e.token?this._waitForClient().then(function(){return t._client.request({method:"post",endpoint:"payment_methods/apple_payment_tokens",data:{_meta:{source:"apple-pay"},applePaymentToken:Object.assign({},e.token,{paymentData:btoa(JSON.stringify(e.token.paymentData))})}})}).then(function(e){return i.sendEvent(t._client,"applepay.tokenize.succeeded"),Promise.resolve(e.applePayCards[0])}).catch(function(e){return i.sendEvent(t._client,"applepay.tokenize.failed"),Promise.reject(new r({type:o.APPLE_PAY_TOKENIZATION.type,code:o.APPLE_PAY_TOKENIZATION.code,message:o.APPLE_PAY_TOKENIZATION.message,details:{originalError:e}}))}):Promise.reject(new r(o.APPLE_PAY_PAYMENT_TOKEN_REQUIRED))},l.prototype.teardown=function(){return s(this,a(l.prototype)),Promise.resolve()},t.exports=c.wrapPrototype(l)},{"../lib/analytics":144,"../lib/braintree-error":149,"../lib/convert-methods-to-error":151,"../lib/in-iframe":175,"../lib/methods":181,"./errors":94,"@braintree/wrap-promise":43}],94:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={APPLE_PAY_NOT_ENABLED:{type:r.types.MERCHANT,code:"APPLE_PAY_NOT_ENABLED",message:"Apple Pay is not enabled for this merchant."},APPLE_PAY_VALIDATION_URL_REQUIRED:{type:r.types.MERCHANT,code:"APPLE_PAY_VALIDATION_URL_REQUIRED",message:"performValidation must be called with a validationURL."},APPLE_PAY_MERCHANT_VALIDATION_NETWORK:{type:r.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:r.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:r.types.MERCHANT,code:"APPLE_PAY_PAYMENT_TOKEN_REQUIRED",message:"tokenize must be called with a payment token."},APPLE_PAY_TOKENIZATION:{type:r.types.NETWORK,code:"APPLE_PAY_TOKENIZATION",message:"A network error occurred when processing the Apple Pay payment."}}},{"../lib/braintree-error":149}],95:[function(e,t,n){"use strict";var r=e("./apple-pay"),i=e("../lib/analytics"),o=e("../lib/braintree-error"),a=e("../lib/basic-component-verification"),s=e("../lib/create-assets-url"),c=e("../lib/create-deferred-client"),d=e("./errors"),l=e("@braintree/wrap-promise");t.exports={create:l(function(e){var t="Apple Pay";return a.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){var n,a=c.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:s.create(e.authorization),name:t}).then(function(e){return e.getConfiguration().gatewayConfiguration.applePayWeb?(i.sendEvent(e,"applepay.initialized"),e):Promise.reject(new o(d.APPLE_PAY_NOT_ENABLED))});return e.createPromise=a,n=new r(e),e.useDeferredClient?n:a.then(function(e){return n._client=e,n})})}),VERSION:"3.143.0"}},{"../lib/analytics":144,"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./apple-pay":93,"./errors":94,"@braintree/wrap-promise":43}],96:[function(e,t,n){"use strict";var r=e("./constants").BRAINTREE_VERSION,i=e("./request/graphql"),o=e("./request"),a=e("../lib/is-verified-domain"),s=e("../lib/braintree-error"),c=e("../lib/convert-to-braintree-error"),d=e("./get-configuration").getConfiguration,l=e("../lib/create-authorization-data"),u=e("../lib/add-metadata"),p=e("@braintree/wrap-promise"),_=e("../lib/once"),E=e("../lib/deferred"),m=e("../lib/assign").assign,h=e("../lib/analytics"),f=e("./errors"),A=e("../lib/constants").VERSION,y=e("../lib/constants").GRAPHQL_URLS,I=e("../lib/methods"),T=e("../lib/convert-methods-to-error"),P=e("../lib/assets"),N=e("../lib/constants").FRA
2UDNET_FNCLS,O=e("../lib/constants").FRAUDNET_SOURCE,g=e("../lib/constants").FRAUDNET_URL,C={};function b(e){var t,n;if(e=e||{},t=JSON.stringify(e),!(n=e.gatewayConfiguration))throw new s(f.CLIENT_MISSING_GATEWAY_CONFIGURATION);if(["assetsUrl","clientApiUrl","configUrl"].forEach(function(e){if(e in n&&!a(n[e]))throw new s({type:f.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.type,code:f.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.code,message:e+" property is on an invalid domain."})}),this.getConfiguration=function(){return JSON.parse(t)},this._request=o,this._configuration=this.getConfiguration(),this._clientApiBaseUrl=n.clientApiUrl+"/v1/",n.graphQL){if(!a(n.graphQL.url))throw new s({type:f.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.type,code:f.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.code,message:"graphQL.url property is on an invalid domain."});this._graphQL=new i({graphQL:n.graphQL})}}b.initialize=function(e){var t,n,r=C[e.authorization];if(r)return h.sendEvent(r,"custom.client.load.cached"),r;try{n=l(e.authorization)}catch(e){return Promise.reject(new s(f.CLIENT_INVALID_AUTHORIZATION))}return r=d(n,e.sessionId).then(function(n){return e.debug&&(n.isDebug=!0),n.authorization=e.authorization,t=new b(n)}),C[e.authorization]=r,h.sendEvent(r,"custom.client.load.initialized"),r.then(function(e){return h.sendEvent(t,"custom.client.load.succeeded"),e}).catch(function(t){return delete C[e.authorization],Promise.reject(t)})},b.clearCache=function(){C={}},b.prototype._findOrCreateFraudnetJSON=function(e){var t,n,r,i,o=document.querySelector('script[fncls="'+N+'"]');o||((o=document.body.appendChild(document.createElement("script"))).type="application/json",o.setAttribute("fncls",N)),t=this.getConfiguration(),n={rda_tenant:"bt_card",mid:t.gatewayConfiguration.merchantId},(r=t.authorizationFingerprint)&&r.split("&").forEach(function(e){var t=e.split("=");"customer_id"===t[0]&&t.length>1&&(n.cid=t[1])}),i={f:e.substr(0,32),fp:n,bu:!1,s:O},o.text=JSON.stringify(i)},b.prototype.request=function(e,t){var n=this,i=new Promise(function(t,i){var o,a,d,l,p,_=Boolean("payment_methods/credit_cards"===e.endpoint&&n.getConfiguration().gatewayConfiguration.creditCards.collectDeviceData);if("graphQLApi"!==e.api&&(e.method?e.endpoint||(o="options.endpoint"):o="options.method"),o)throw new s({type:f.CLIENT_OPTION_REQUIRED.type,code:f.CLIENT_OPTION_REQUIRED.code,message:o+" is required when making a request."});if(a="api"in e?e.api:"clientApi",l={method:e.method,graphQL:n._graphQL,timeout:e.timeout,metadata:n._configuration.analyticsMetadata},"clientApi"===a)d=n._clientApiBaseUrl,l.data=u.addMetadata(n._configuration,e.data);
2else{if("graphQLApi"!==a)throw new s({type:f.CLIENT_OPTION_INVALID.type,code:f.CLIENT_OPTION_INVALID.code,message:"options.api is invalid."});d=y[n._configuration.gatewayConfiguration.environment],e.endpoint="",l.method="post",l.data=m({clientSdkMetadata:{platform:n._configuration.analyticsMetadata.platform,source:n._configuration.analyticsMetadata.source,integration:n._configuration.analyticsMetadata.integration,sessionId:n._configuration.analyticsMetadata.sessionId,version:A}},e.data),l.headers={Authorization:"Bearer "+((p=n._configuration).authorizationFingerprint||p.authorization),"Braintree-Version":r}}l.url=d+e.endpoint,l.sendAnalyticsEvent=function(e,t){t?h.sendEventPlus(n,e,t):h.sendEvent(n,e)},n._request(l,function(e,r,o){var d,l;(l=function(e,t){var n;if(-1===e?n=new s(f.CLIENT_REQUEST_TIMEOUT):401===e?n=new s(f.CLIENT_AUTHORIZATION_INVALID):403===e?n=new s(f.CLIENT_AUTHORIZATION_INSUFFICIENT):429===e?n=new s(f.CLIENT_RATE_LIMITED):e>=500?n=new s(f.CLIENT_GATEWAY_NETWORK):(e<200||e>=400)&&(n=c(t,{type:f.CLIENT_REQUEST_ERROR.type,code:f.CLIENT_REQUEST_ERROR.code,message:f.CLIENT_REQUEST_ERROR.message})),n)return n.details=n.details||{},n.details.httpStatus=e,n}(o,e))?i(l):"graphQLApi"===a&&r.errors?i(c(r.errors,{type:f.CLIENT_GRAPHQL_REQUEST_ERROR.type,code:f.CLIENT_GRAPHQL_REQUEST_ERROR.code,message:f.CLIENT_GRAPHQL_REQUEST_ERROR.message})):(d=m({_httpStatus:o},r),_&&d.creditCards&&d.creditCards.length>0&&(n._findOrCreateFraudnetJSON(d.creditCards[0].nonce),P.loadScript({src:g,forceScriptReload:!0})),t(d))})});return"function"==typeof t?(t=_(E(t)),void i.then(function(e){t(null,e,e._httpStatus)}).catch(function(e){var n=e&&e.details&&e.details.httpStatus;t(e,null,n)})):i},b.prototype.toJSON=function(){return this.getConfiguration()},b.prototype.getVersion=function(){return A},b.prototype.teardown=p(function(){return delete C[this.getConfiguration().authorization],T(this,I(b.prototype)),Promise.resolve()}),t.exports=b},{"../lib/add-metadata":143,"../lib/analytics":144,"../lib/assets":145,"../lib/assign":146,"../lib/braintree-error":149,"../lib/constants":150,"../lib/convert-methods-to-error":151,"../lib/convert-to-braintree-error":152,"../lib/create-authorization-data":154,"../lib/deferred":156,"../lib/is-verified-domain":179,"../lib/methods":181,"../lib/once":182,"./constants":97,"./errors":98,"./get-configuration":99,"./request":112,"./request/graphql":110,"@braintree/wrap-promise":43}],97:[function(e,t,n){"use strict";t.exports={BRAINTREE_VERSION:"2018-05-10"}},{}],98:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN:{type:r.types.MERCHANT,code:"CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN"},CLIENT_OPTION_REQUIRED:{type:r.types.MERCHANT,code:"CLIENT_OPTION_REQUIRED"}
2,CLIENT_OPTION_INVALID:{type:r.types.MERCHANT,code:"CLIENT_OPTION_INVALID"},CLIENT_MISSING_GATEWAY_CONFIGURATION:{type:r.types.INTERNAL,code:"CLIENT_MISSING_GATEWAY_CONFIGURATION",message:"Missing gatewayConfiguration."},CLIENT_INVALID_AUTHORIZATION:{type:r.types.MERCHANT,code:"CLIENT_INVALID_AUTHORIZATION",message:"Authorization is invalid. Make sure your client token or tokenization key is valid."},CLIENT_GATEWAY_NETWORK:{type:r.types.NETWORK,code:"CLIENT_GATEWAY_NETWORK",message:"Cannot contact the gateway at this time."},CLIENT_REQUEST_TIMEOUT:{type:r.types.NETWORK,code:"CLIENT_REQUEST_TIMEOUT",message:"Request timed out waiting for a reply."},CLIENT_REQUEST_ERROR:{type:r.types.NETWORK,code:"CLIENT_REQUEST_ERROR",message:"There was a problem with your request."},CLIENT_GRAPHQL_REQUEST_ERROR:{type:r.types.NETWORK,code:"CLIENT_GRAPHQL_REQUEST_ERROR",message:"There was a problem with your request."},CLIENT_RATE_LIMITED:{type:r.types.MERCHANT,code:"CLIENT_RATE_LIMITED",message:"You are being rate-limited; please try again in a few minutes."},CLIENT_AUTHORIZATION_INSUFFICIENT:{type:r.types.MERCHANT,code:"CLIENT_AUTHORIZATION_INSUFFICIENT",message:"The authorization used has insufficient privileges."},CLIENT_AUTHORIZATION_INVALID:{type:r.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":149}],99:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("@braintree/wrap-promise"),o=e("./request"),a=e("@braintree/uuid"),s=e("../lib/constants"),c=e("./errors"),d=e("./request/graphql"),l=e("../lib/constants").GRAPHQL_URLS,u=e("../lib/is-date-string-before-or-on"),p=e("./constants").BRAINTREE_VERSION;t.exports={getConfiguration:i(function(e,t){return new Promise(function(n,i){var _,E,m,h,f=t||a(),A={merchantAppId:window.location.host,platform:s.PLATFORM,sdkVersion:s.VERSION,source:s.SOURCE,integration:s.INTEGRATION,integrationType:s.INTEGRATION,sessionId:f};E=e.attrs,m=e.configUrl,E._meta=A,E.braintreeLibraryVersion=s.BRAINTREE_LIBRARY_VERSION,E.configVersion="3",h={url:m,method:"GET",data:E},E.authorizationFingerprint&&e.graphQL?(u(e.graphQL.date,p)&&(h.graphQL=new d({graphQL:{url:e.graphQL.url,features:["configuration"]}})),h.metadata=A):E.tokenizationKey&&(h.graphQL=new d({graphQL:{url:l[e.environment],features:["configuration"]}}),h.metadata=A),o(h,function(e,t,o){var a;if(e)return a=403===o?c.CLIENT_AUTHORIZATION_INSUFFICIENT:401===o?c.CLIENT_AUTHORIZATION_INVALID:c.CLIENT_GATEWAY_NETWORK,void i(new r({type:a.type,code:a.code,message:a.message,details:{originalError:e}}));_={authorizationType:E.tokenizationKey?"TOKENIZATION_KEY":"CLIENT_TOKEN",authorizationFingerprint:E.authorizationFingerprint,analyticsMetadata:A,gatewayConfiguration:t},n(_)})})})}},{"../lib/braintree-error":149,"../lib/constants":150,"../lib/is-date-string-before-or-on":176,"./constants":97,"./errors":98,"./request":112,"./request/graphql":110,"@braintree/uuid":39,"@braintree/wrap-promise":43}],100:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("./client"),o=e("@braintree/wrap-promise"),a=e("../lib/errors");t.exports={create:o(function(e){return e.authorization?i.initialize(e):Promise.reject(new r({type:a.INSTANTIATION_OPTION_REQUIRED.type,code:a.INSTANTIATION_OPTION_REQUIRED.code,message:"options.authorization is required when instantiating a client."}))}),VERSION:"3.143.0"}},{"../lib/braintree-error":149,"../lib/errors":159,"./client":96,"@braintree/wrap-promise":43}],101:[function(e,t,n){"use strict";var r=e("../../lib/querystring"),i=e("../../lib/assign").assign,o=e("./prep-body"),a=e("./parse-body"),s=e("./xhr"),c=s.isAvailable,d=e("./graphql/request"),l=e("./default-request"),u=/\/merchants\/[A-Za-z0-9_-]+\/client_api/,p=/payment_methods\/.*\/three_d_secure/;function _(e,t,n){var E,m,h,f,A,y,I,T=e.url,P=e.graphQL,N=e.timeout,O=s.getRequestObject(),g=n,C=Boolean(P&&P.isGraphQLRequest(T,e.data));e.headers=i({"Content-Type":"application/json"},e.headers),h=C?new d(e):new l(e),T=h.getUrl(),f=h.getBody(),A=h.getMethod(),y=h.getHeaders(),"GET"===A&&(T=r.queryify(T,f),f=null),c?O.onreadystatechange=function(){if(4===O.readyState){if(0===O.status&&C)return delete e.graphQL,void _(e,t,n);if(I=a(O.responseText),m=h.adaptResponseBody(I),E=h.determineStatus(O.status,I),e.sendAnalyticsEvent&&function(e,t){var n,r,i,o,a,s,c,d,l,_,E;try{n=(o=new URL(e)).hostname,r=o.pathname}catch(t){n=(e.match(/^https?:\/\/([^\/]+)/)||[])[1]||"",r=(e.match(/^https?:\/\/[^\/]+(\/.*)$/)||[])[1]||e}"/v1/tracking/batch/events"!==(i=r.replace(u,"").replace(p,"payment_methods/three_d_secure"))&&(a=e.replace(/:443(\/|$)/,"$1"),"undefined"!=typeof window&&window.performance&&window.performance.getEntriesByName&&(_=window.performance.getEntriesByName(a))&&_.length>0&&(s=(E=_[_.length-1]).connectStart?Math.round(E.connectStart):null,c=E.requestStart?Math.round(E.requestStart):null,l=Math.round(E.startTime),d=Math.round(E.responseEnd),t.sendAnalyticsEvent("core.api-request-latency",{connect_start_time:s,domain:n,endpoint:i,end_time:d,request_start_time:c,start_time:l})))}(T,e),E>
2=400||E<200){if(C&&function(e){var t=!e.data&&e.errors&&e.errors[0]&&e.errors[0].extensions&&e.errors[0].extensions.errorClass;return"UNKNOWN"===t||"INTERNAL"===t}(I))return delete e.graphQL,void _(e,t,n);if(t<1&&function(e){return!e||408===e}(E))return t++,void _(e,t,n);g(m||"error",null,E||500)}else g(null,m,E)}}:(e.headers&&(T=r.queryify(T,y)),O.onload=function(){g(null,a(O.responseText),O.status)},O.onerror=function(){g("error",null,500)},O.onprogress=function(){},O.ontimeout=function(){g("timeout",null,-1)});try{O.open(A,T,!0)}catch(r){if(!C)throw r;return delete e.graphQL,void _(e,t,n)}O.timeout=N,c&&Object.keys(y).forEach(function(e){O.setRequestHeader(e,y[e])});try{O.send(o(A,f))}catch(e){}}t.exports={request:function(e,t){_(e,0,t)}}},{"../../lib/assign":146,"../../lib/querystring":183,"./default-request":102,"./graphql/request":111,"./parse-body":113,"./prep-body":114,"./xhr":115}],102:[function(e,t,n){"use strict";function r(e){this._url=e.url,this._data=e.data,this._method=e.method,this._headers=e.headers}r.prototype.getUrl=function(){return this._url},r.prototype.getBody=function(){return this._data},r.prototype.getMethod=function(){return this._method},r.prototype.getHeaders=function(){return this._headers},r.prototype.adaptResponseBody=function(e){return e},r.prototype.determineStatus=function(e){return e},t.exports=r},{}],103:[function(e,t,n){"use strict";var r=e("./error"),i=e("../../../../lib/assign").assign,o={AMERICAN_EXPRESS:"American Express",DISCOVER:"Discover",INTERNATIONAL_MAESTRO:"Maestro",JCB:"JCB",MASTERCARD:"MasterCard",SOLO:"Solo",UK_MAESTRO:"UK Maestro",UNION_PAY:"UnionPay",VISA:"Visa",ELO:"Elo",HIPER:"Hiper",HIPERCARD:"Hipercard"},a={VISA:"visa",MASTERCARD:"mastercard",DISCOVER:"discover",AMERICAN_EXPRESS:"amex",INTERNATIONAL_MAESTRO:"maestro",ELO:"elo"},s={VISA:"Visa",MASTERCARD:"MasterCard",DISCOVER:"Discover",AMERICAN_EXPRESS:"American Express"},c={VISA:"visa",MASTERCARD:"mastercard",DISCOVER:"discover",AMERICAN_EXPRESS:"amex",INTERNATIONAL_MAESTRO:"maestro",ELO:"elo"},d={VISA:"visa",MASTERCARD:"master",DISCOVER:"discover",AMERICAN_EXPRESS:"amex",DINERS:"diners",INTERNATIONAL_MAESTRO:"maestro",JCB:"jcb"};function l(e,t){return e.reduce(function(e,n){return t.hasOwnProperty(n)?e.concat(t[n]):e},[])}t.exports=function(e,t){return e.data&&!e.errors?function(e,t){var n,r=e.data.clientConfiguration;return n={environment:r.environment.toLowerCase(),clientApiUrl:r.clientApiUrl,assetsUrl:r.assetsUrl,analytics:{url:r.analyticsUrl},merchantId:r.merchantId,venmo:"off"},r.supportedFeatures&&(n.graphQL={url:t._graphQL._config.url,features:r.supportedFeatures.map(function(e){return e.toLowerCase()})}),r.braintreeApi&&(n.braintreeApi=r.braintreeApi),r.applePayWeb&&(n.applePayWeb=r.applePayWeb,n.applePayWeb.supportedNetworks=l(r.applePayWeb.supportedCardBrands,a),delete n.applePayWeb.supportedCardBrands),r.fastlane&&(n.fastlane=r.fastlane),r.ideal&&(n.ideal=r.ideal),r.creditCard?(n.challenges=r.creditCard.challenges.map(function(e){return e.toLowerCase()}),n.creditCards={supportedCardTypes:l(r.creditCard.supportedCardBrands,o)},n.threeDSecureEnabled=r.creditCard.threeDSecureEnabled,n.threeDSecure=r.creditCard.threeDSecure):(n.challenges=[],n.creditCards={supportedCardTypes:[]},n.threeDSecureEnabled=!1),r.googlePay&&(n.androidPay={displayName:r.googlePay.displayName,enabled:!0,environment:r.googlePay.environment.toLowerCase(),googleAuthorizationFingerprint:r.googlePay.googleAuthorization,paypalClientId:r.googlePay.paypalClientId,supportedNetworks:l(r.googlePay.supportedCardBrands,c)}),r.venmo&&(n.payWithVenmo={merchantId:r.venmo.merchantId,accessToken:r.venmo.accessToken,environment:r.venmo.environment.toLowerCase(),enrichedCustomerDataEnabled:r.venmo.enrichedCustomerDataEnabled}),r.paypal?(n.paypalEnabled=!0,n.paypal=i({},r.paypal),n.paypal.currencyIsoCode=n.paypal.currencyCode,n.paypal.environment=n.paypal.environment.toLowerCase(),delete n.paypal.currencyCode):n.paypalEnabled=!1,r.unionPay&&(n.unionPay={enabled:!0,merchantAccountId:r.unionPay.merchantAccountId}),r.visaCheckout&&(n.visaCheckout={apikey:r.visaCheckout.apiKey,encryptionKey:r.visaCheckout.encryptionKey,externalClientId:r.visaCheckout.externalClientId,supportedCardTypes:l(r.visaC
2heckout.supportedCardBrands,s)}),r.masterpass&&(n.masterpass={merchantCheckoutId:r.masterpass.merchantCheckoutId,supportedNetworks:l(r.masterpass.supportedCardBrands,d)}),r.usBankAccount&&(n.usBankAccount={routeId:r.usBankAccount.routeId,plaid:{publicKey:r.usBankAccount.plaidPublicKey}}),r.openBanking&&(n.openBanking={businessNames:r.openBanking.businessNames,allowListedDomains:r.openBanking.allowListedDomains,profileId:r.openBanking.profileId}),n}(e,t):r(e)}},{"../../../../lib/assign":146,"./error":106}],104:[function(e,t,n){"use strict";var r=e("./error"),i={AMERICAN_EXPRESS:"American Express",DINERS:"Discover",DISCOVER:"Discover",ELO:"Elo",HIPER:"Hiper",HIPERCARD:"Hipercard",INTERNATIONAL_MAESTRO:"Maestro",JCB:"JCB",MASTERCARD:"MasterCard",UK_MAESTRO:"Maestro",UNION_PAY:"UnionPay",VISA:"Visa"},o={YES:"Yes",NO:"No",UNKNOWN:"Unknown"},a={PSDTWO:"psd2"};t.exports=function(e){return e.data&&!e.errors?(s=e.data.tokenizeCreditCardForPayPalConnect,c=s.paymentMethod.details,d=c.last4?c.last4.substr(2,4):"",(l=c.binData)&&(["commercial","debit","durbinRegulated","healthcare","payroll","prepaid"].forEach(function(e){l[e]?l[e]=o[l[e]]:l[e]="Unknown"}),["issuingBank","countryOfIssuance","productId","business","consumer","purchase","corporate"].forEach(function(e){l[e]||(l[e]="Unknown")}
2)),t={creditCards:[{binData:l,consumed:!1,description:d?"ending in "+d:"",nonce:s.paymentMethod.id,details:{cardholderName:c.cardholderName,expirationMonth:c.expirationMonth,expirationYear:c.expirationYear,bin:c.bin||"",cardType:i[c.brandCode]||"Unknown",lastFour:c.last4||"",lastTwo:d},type:"CreditCard",threeDSecureInfo:null}]},s.authenticationInsight&&(n=s.authenticationInsight.customerAuthenticationRegulationEnvironment,t.creditCards[0].authenticationInsight={regulationEnvironment:a[n]||n.toLowerCase()}),t):r(e);var t,n,s,c,d,l}},{"./error":106}],105:[function(e,t,n){"use strict";var r=e("./error"),i={AMERICAN_EXPRESS:"American Express",DINERS:"Discover",DISCOVER:"Discover",ELO:"Elo",HIPER:"Hiper",HIPERCARD:"Hipercard",INTERNATIONAL_MAESTRO:"Maestro",JCB:"JCB",MASTERCARD:"MasterCard",UK_MAESTRO:"Maestro",UNION_PAY:"UnionPay",VISA:"Visa"},o={YES:"Yes",NO:"No",UNKNOWN:"Unknown"},a={PSDTWO:"psd2"};t.exports=function(e){return e.data&&!e.errors?(s=e.data.tokenizeCreditCard,c=s.creditCard,d=c.last4?c.last4.substr(2,4):"",(l=c.binData)&&(["commercial","debit","durbinRegulated","healthcare","payroll","prepaid"].forEach(function(e){l[e]?l[e]=o[l[e]]:l[e]="Unknown"}),["issuingBank","countryOfIssuance","productId","business","consumer","purchase","corporate"].forEach(function(e){l[e]||(l[e]="Unknown")}
2)),t={creditCards:[{binData:l,consumed:!1,description:d?"ending in "+d:"",nonce:s.token,details:{cardholderName:c.cardholderName,expirationMonth:c.expirationMonth,expirationYear:c.expirationYear,bin:c.bin||"",cardType:i[c.brandCode]||"Unknown",lastFour:c.last4||"",lastTwo:d},type:"CreditCard",threeDSecureInfo:null}]},s.authenticationInsight&&(n=s.authenticationInsight.customerAuthenticationRegulationEnvironment,t.creditCards[0].authenticationInsight={regulationEnvironment:a[n]||n.toLowerCase()}),t):r(e);var t,n,s,c,d,l}},{"./error":106}],106:[function(e,t,n){"use strict";function r(e,t,n){var i,o=t.extensions.legacyCode,a=e[0];1!==e.length?(n.forEach(function(e){e.field===a&&(i=e)}),i||(i={field:a,fieldErrors:[]},n.push(i)),r(e.slice(1),t,i.fieldErrors)):n.push({code:o,field:a,message:t.message})}function i(e){return{creditCard:"Credit card is invalid"}[e[0].field]}t.exports=function(e){var t=e.errors&&e.errors[0]&&e.errors[0].extensions&&e.errors[0].extensions.errorClass;return"VALIDATION"===t?function(e){var t=function(e){var t=[];return e.forEach(function(e){e.extensions&&e.extensions.inputPath&&r(e.extensions.inputPath.slice(1),e,t)}),t}(e.errors);return 0===t.length?{error:{message:e.errors[0].message}}:{error:{message:i(t)},fieldErrors:t}}(e):t?function(e){return{error:{message:e.errors[0].message},fieldErrors:[]}}(e):{error:{message:"There was a problem serving your request"},fieldErrors:[]}}},{}],107:[function(e,t,n){"use strict";t.exports=function(){return{query:"query ClientConfiguration {   clientConfiguration {     analyticsUrl     environment     merchantId     assetsUrl     clientApiUrl     creditCard {       supportedCardBrands       challenges       threeDSecureEnabled       threeDSecure {         cardinalAuthenticationJWT         cardinalSongbirdUrl         cardinalSongbirdIdentityHash       }     }     applePayWeb {       countryCode       currencyCode       merchantIdentifier       supportedCardBrands     }     fastlane {       enabled       tokensOnDemand {         enabled         tokenExchange {           enabled         }       }     }     googlePay {       displayName       supportedCardBrands       environment       googleAuthorization       paypalClientId     }     ideal {       routeId       assetsUrl     }     masterpass {       merchantCheckoutId       supportedCardBrands     }     openBanking {       businessNames       allowListedDomains       profileId     }     paypal {       displayName       clientId       assetsUrl       environment       environmentNoNetwork       unvettedMerchant       braintreeClientId       billingAgreementsEnabled       merchantAccountId       currencyCode       payeeEmail     }     unionPay {       merchantAccountId     }     usBankAccount {       routeId       plaidPublicKey     }     venmo {       merchantId       accessToken       environment       enrichedCustomerDataEnabled    }     visaCheckout {       apiKey       externalClientId       supportedCardBrands     }     braintreeApi {       accessToken       url     }     supportedFeatures   } }",operationName:"ClientConfiguration"}}},{}],108:[function(e,t,n){"use strict";var r=e("../../../../lib/assign").assign;function i(e,t){var n=e.creditCard,i=n.fastlane||{},o="fastlane"in n&&"termsAndConditionsVersion"in n.fastlane&&n.fastlane.termsAndConditionsVersion,a="fastlane"in n&&"termsAndConditionsCountry"in n.fastlane&&n.fastlane.termsAndConditionsCountry,s=n.email,c="hasBuyerConsent"in i&&i.hasBuyerConsent,d=n.shippingAddress,l=function(e,t){var n=e.creditCard,i=n&&n.billingAddress,o=n&&n.expirationDate,a=n&&(n.expirationMonth||o&&o.split("/")[0].trim()),s=n&&(n.expirationYear||o&&o.split("/")[1].trim()),c={input:{creditCard:{number:n&&n.number,expirationMonth:a,expirationYear:s,cvv:n&&n.cvv,cardholderName:n&&n.cardholderName},options:{}}};return t.hasAuthenticationInsight&&(c.authenticationInsightInput={merchantAccountId:e.merchantAccountId}),i&&(c.input.creditCard.billingAddress=i),c.input=function(e,t){var n;
2return e.creditCard&&e.creditCard.options&&"boolean"==typeof e.creditCard.options.validate?n=e.creditCard.options.validate:e.authorizationFingerprint&&e.tokenizationKey||e.authorizationFingerprint?n=!0:e.tokenizationKey&&(n=!1),"boolean"==typeof n&&(t.options=r({validate:n},t.options)),t}(e,c.input),c}(e,t),u=r({},l.input,{email:s,optIn:c,phone:n.phone});return o&&(u.termsAndConditionsVersion=o),a&&(u.termsAndConditionsCountry=a),"authAssertion"in i&&(u.authAssertion=i.authAssertion),d&&(u.shippingAddress=d),{input:u}}t.exports=function(e){var t,n,r,o={hasAuthenticationInsight:Boolean(e.authenticationInsight&&e.merchantAccountId)};return{query:(t=o,n=t.hasAuthenticationInsight,r="mutation TokenizeCreditCardForPayPalConnect($input: TokenizeCreditCardForPayPalConnectInput!",n&&(r+=", $authenticationInsightInput: AuthenticationInsightInput!"),r+=") {   tokenizeCreditCardForPayPalConnect(input: $input) {     clientMutationId     paymentMethod {       id       details {         ... on CreditCardDetails {       bin       brandCode       last4       cardholderName       expirationMonth      expirationYear      binData {         prepaid         healthcare         debit         durbinRegulated         commercial         payroll         issuingBank         countryOfIssuance         productId         business         consumer         purchase         corporate       }         }       }     }",n&&(r+="    authenticationInsight(input: $authenticationInsightInput) {      customerAuthenticationRegulationEnvironment    }"),r+"  } }"),variables:i(e,o),operationName:"TokenizeCreditCardForPayPalConnect"}}},{"../../../../lib/assign":146}],109:[function(e,t,n){"use strict";var r=e("../../../../lib/assign").assign;function i(e,t){var n=e.creditCard,i=n&&n.billingAddress,o=n&&n.expirationDate,a=n&&(n.expirationMonth||o&&o.split("/")[0].trim()),s=n&&(n.expirationYear||o&&o.split("/")[1].trim()),c={input:{creditCard:{number:n&&n.number,expirationMonth:a,expirationYear:s,cvv:n&&n.cvv,cardholderName:n&&n.cardholderName},options:{}}};return t.hasAuthenticationInsight&&(c.authenticationInsightInput={merchantAccountId:e.merchantAccountId}),i&&(c.input.creditCard.billingAddress=i),c.input=function(e,t){var n;
2return e.creditCard&&e.creditCard.options&&"boolean"==typeof e.creditCard.options.validate?n=e.creditCard.options.validate:e.authorizationFingerprint&&e.tokenizationKey||e.authorizationFingerprint?n=!0:e.tokenizationKey&&(n=!1),"boolean"==typeof n&&(t.options=r({validate:n},t.options)),t}(e,c.input),c}t.exports=function(e){var t,n,r,o={hasAuthenticationInsight:Boolean(e.authenticationInsight&&e.merchantAccountId)};return{query:(t=o,n=t.hasAuthenticationInsight,r="mutation TokenizeCreditCard($input: TokenizeCreditCardInput!",n&&(r+=", $authenticationInsightInput: AuthenticationInsightInput!"),r+=") {   tokenizeCreditCard(input: $input) {     token     creditCard {       bin       brandCode       last4       cardholderName       expirationMonth      expirationYear      binData {         prepaid         healthcare         debit         durbinRegulated         commercial         payroll         issuingBank         countryOfIssuance         productId         business         consumer         purchase         corporate       }     } ",n&&(r+="    authenticationInsight(input: $authenticationInsightInput) {      customerAuthenticationRegulationEnvironment    }"),r+"  } }"),variables:i(e,o),operationName:"TokenizeCreditCard"}}},{"../../../../lib/assign":146}],110:[function(e,t,n){"use strict";var r={tokenize_credit_cards:"payment_methods/credit_cards",configuration:"configuration"},i=["creditCard.options.unionPayEnrollment"];function o(e){this._config=e.graphQL}o.prototype.getGraphQLEndpoint=function(){return this._config.url},o.prototype.isGraphQLRequest=function(e,t){var n,o=this.getClientApiPath(e);return!(!this._isGraphQLEnabled()||!o)&&(n=this._config.features.some(function(e){return r[e]===o}),!function(e){return i.some(function(t){return void 0!==t.split(".").reduce(function(e,t){return e&&e[t]},e)})}(t)&&n)},o.prototype.getClientApiPath=function(e){var t,n=e.split("/client_api/v1/");return n.length>1&&(t=n[1].split("?")[0]),t},o.prototype._isGraphQLEnabled=function(){return Boolean(this._config)},t.exports=o},{}],111:[function(e,t,n){"use strict";var r=e("../../constants").BRAINTREE_VERSION,i=e("../../../lib/assign").assign,o=e("../../../lib/snake-case-to-camel-case"),a=e("../../../lib/is-fastlane-checkout"),s=e("./generators/credit-card-tokenization"),c=e("./adapters/credit-card-tokenization"),d=e("./adapters/credit-card-tokenization-fastlane"),l=e("./generators/credit-card-for-fastlane-tokenization"),u=e("./generators/configuration"),p=e("./adapters/configuration"),_={"payment_methods/credit_cards":function(e,t){return t?l(e):s(e)},configuration:u},E={"payment_methods/credit_cards":function(e,t,n){return n?d(e,t):c(e,t)},configuration:p};function m(e){var t=e.graphQL.getClientApiPath(e.url);this._graphQL=e.graphQL,this._data=e.data,this._method=e.method,this._headers=e.headers,this._clientSdkMetadata={source:e.metadata.source,integration:e.metadata.integration,sessionId:e.metadata.sessionId},this._sendAnalyticsEvent=e.sendAnalyticsEvent||Function.prototype,this._generator=_[t],this._adapter=E[t],this._sendAnalyticsEvent("graphql.init")}function h(e){var t={};return Object.keys(e).forEach(function(n){var r=o(n);"object"==typeof e[n]?t[r]=h(e[n]):"number"==typeof e[n]?t[r]=String(e[n]):t[r]=e[n]}),t}m.prototype.getUrl=function(){return this._graphQL.getGraphQLEndpoint()},m.prototype.getBody=function(){var e=h(this._data),t=this._generator(e,a(this._data.creditCard)),n=i({clientSdkMetadata:this._clientSdkMetadata},t);return JSON.stringify(n)},m.prototype.getMethod=function(){return"POST"},m.prototype.getHeaders=function(){var e,t;return this._data.authorizationFingerprint?(this._sendAnalyticsEvent("graphql.authorization-fingerprint"),e=this._data.authorizationFingerprint):(this._sendAnalyticsEvent("graphql.tokenization-key"),e=this._data.tokenizationKey),t={Authorization:"Bearer "+e,"Braintree-Version":r},i({},this._headers,t)},m.prototype.adaptResponseBody=function(e){return this._adapter(e,this,"creditCard"in this._data&&a(this._data.creditCard))},m.prototype.determineStatus=function(e,t){var n,r;return 200===e?(r=t.errors&&t.errors[0]&&t.errors[0].extensions&&t.errors[0].extensions.errorClass,n=t.data&&!t.errors?200:"VALIDATION"===r?422:"AUTHORIZATION"===r?403:"AUTHENTICATION"===r?401:function(e,t){return!e&&t.errors[0].message}
2(r,t)?403:500):n=e||500,this._sendAnalyticsEvent("graphql.status."+e),this._sendAnalyticsEvent("graphql.determinedStatus."+n),n},t.exports=m},{"../../../lib/assign":146,"../../../lib/is-fastlane-checkout":177,"../../../lib/snake-case-to-camel-case":185,"../../constants":97,"./adapters/configuration":103,"./adapters/credit-card-tokenization":105,"./adapters/credit-card-tokenization-fastlane":104,"./generators/configuration":107,"./generators/credit-card-for-fastlane-tokenization":108,"./generators/credit-card-tokenization":109}],112:[function(e,t,n){"use strict";var r=e("../../lib/once"),i=e("./ajax-driver");t.exports=function(e,t){t=r(t||Function.prototype),e.method=(e.method||"GET").toUpperCase(),e.timeout=null==e.timeout?6e4:e.timeout,e.data=e.data||{},i.request(e,t)}},{"../../lib/once":182,"./ajax-driver":101}],113:[function(e,t,n){"use strict";t.exports=function(e){try{e=JSON.parse(e)}catch(e){}return e}},{}],114:[function(e,t,n){"use strict";t.exports=function(e,t){if("string"!=typeof e)throw new Error("Method must be a string");return"get"!==e.toLowerCase()&&null!=t&&(t="string"==typeof t?t:JSON.stringify(t)),t}},{}],115:[function(e,t,n){"use strict";var r="undefined"!=typeof window&&window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest;t.exports={isAvailable:r,getRequestObject:function(){return r?new window.XMLHttpRequest:new window.XDomainRequest}}},{}],116:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS:{type:r.types.MERCHANT,code:"DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS",message:"Data Collector must be created with Kount and/or PayPal."}}},{"../lib/braintree-error":149}],117:[function(e,t,n){"use strict";var r,i=e("../lib/constants").FRAUDNET_FNCLS,o=e("../lib/constants").FRAUDNET_SOURCE,a=e("../lib/constants").FRAUDNET_URL,s=e("../lib/assets").loadScript;function c(){}function d(e){e&&e.parentNode&&e.parentNode.removeChild(e)}c.prototype.initialize=function(e){var t=this;this.sessionId=e.sessionId||e.clientSessionId,this.sessionId&&(this.sessionId=this.sessionId.substring(0,32)),e.sessionId||(r=this.sessionId);var n,c,d,l={f:this.sessionId,s:o};return e.hasOwnProperty("beacon")&&!0!==e.beacon?l.bu=!1:l.b="https://b.stats.paypal.com/counter.cgi?i=127.0.0.1&p="+this.sessionId+"&t="+(new Date).getTime()/1e3+"&a=14",e.hasOwnProperty("cb1")&&(l.cb1=e.cb1),this._parameterBlock=(n=l,c=e.environment,d=document.body.appendChild(document.createElement("script")),"production"!==c&&(n.sandbox=!0),d.type="application/json",d.setAttribute("fncls",i),d.text=JSON.stringify(n),d),s({src:a}).then(function(e){return t._thirdPartyBlock=e,t}).catch(function(){return null})},c.prototype.teardown=function(){d(document.querySelector('iframe[title="ppfniframe"]')),d(document.querySelector('iframe[title="pbf"]')),d(this._parameterBlock),d(this._thirdPartyBlock)},t.exports={setup:function(e){var t=new c;return!(e=e||{}).sessionId&&r?(t.sessionId=r,Promise.resolve(t)):t.initialize(e)},clearSessionIdCache:function(){r=null}}},{"../lib/assets":145,"../lib/constants":150}],118:[function(e,t,n){"use strict";var r=e("./fraudnet"),i=e("../lib/braintree-error"),o=e("../lib/basic-component-verification"),a=e("../lib/create-deferred-client"),s=e("../lib/create-assets-url"),c=e("../lib/methods"),d=e("../lib/convert-methods-to-error"),l=e("@braintree/wrap-promise"),u=e("./errors");t.exports={create:l(function(e){var t="Data Collector",n={_instances:[]},p={};return o.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return n._instantiatedWithAClient=!e.useDeferredClient,n._createPromise=a.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:s.create(e.authorization),name:t}).then(function(t){var i=t.getConfiguration(),o={sessionId:e.riskCorrelationId||e.clientMetadataId||e.correlationId,clientSessionId:i.analyticsMetadata.sessionId,environment:i.gatewayConfiguration.environment,cb1:e.cb1};return e.hasOwnProperty("beacon")&&(o.beacon=e.beacon),r.setup(o).then(function(e){e&&(p.correlation_id=e.sessionId,n._instances.push(e))})}).then(function(){return 0===n._instances.length?Promise.reject(new i(u.DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS)):(n.deviceData=JSON.stringify(p),n.rawDeviceData=p,n)}),n.teardown=function(e){return l(function(){return e._createPromise.then(function(){e._instances.forEac
2h(function(e){e&&e.teardown()}),d(e,c(e))})})}(n),n.getDeviceData=function(e){return l(function(t){return t=t||{},e._createPromise.then(function(){return t.raw?Promise.resolve(e.rawDeviceData):Promise.resolve(e.deviceData)})})}(n),n._instantiatedWithAClient?n._createPromise:n})}),VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/convert-methods-to-error":151,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"../lib/methods":181,"./errors":116,"./fraudnet":117,"@braintree/wrap-promise":43}],119:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={FASTLANE_SDK_LOAD_ERROR:{type:r.types.MERCHANT,code:"FASTLANE_SDK_LOAD_ERROR"}}},{"../lib/braintree-error":149}],120:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("./errors"),o=e("../lib/assets").loadFastlane,a=e("@braintree/wrap-promise"),s=e("../lib/assign").assign;t.exports=a(function(e){var t=e.client.getConfiguration(),n=e.client.getVersion(),a=!0;return"production"!==t.gatewayConfiguration.environment&&(a=!1),o(s({platform:"BT",btSdkVersion:n,minified:a},e)).then(function(t){var n={platform:"BT",authorization:e.authorization,client:e.client,deviceData:e.deviceData};return delete e.authorization,delete e.client,delete e.deviceData,delete e.minified,delete e.btSdkVersion,(window.braintree._fastlane&&window.braintree._fastlane.create?window.braintree._fastlane.create:window.braintree.fastlane.create)(s({platformOptions:n},e,t.metadata))}).catch(function(e){return Promise.reject(new r({type:i.FASTLANE_SDK_LOAD_ERROR.type,code:i.FASTLANE_SDK_LOAD_ERROR.code,message:e.message}))})})},{"../lib/assets":145,"../lib/assign":146,"../lib/braintree-error":149,"./errors":119,"@braintree/wrap-promise":43}],121:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("./fastlane"),o=e("../lib/create-assets-url"),a=e("../lib/create-deferred-client"),s=e("@braintree/wrap-promise"),c=e("../lib/assign").assign;t.exports={create:s(function(e){var t="fastlane";return r.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return a.create({authorization:e.authorization,client:e.client,assetsUrl:o.create(e.authorization),name:t})}).then(function(t){return i(c({client:t,deviceData:e.deviceData},e))})}),VERSION:"3.143.0"}},{"../lib/assign":146,"../lib/basic-component-verification":147,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./fastlane":120,"@braintree/wrap-promise":43}],122:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={GOOGLE_PAYMENT_NOT_ENABLED:{type:r.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:r.types.UNKNOWN},GOOGLE_PAYMENT_UNSUPPORTED_VERSION:{code:"GOOGLE_PAYMENT_UNSUPPORTED_VERSION",type:r.types.MERCHANT}}},{"../lib/braintree-error":149}],123:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/assign").assign,o=e("../lib/convert-methods-to-error"),a=e("../lib/find"),s=e("../lib/generate-google-pay-configuration"),c=e("../lib/braintree-error"),d=e("./errors"),l=e("../lib/methods"),u=e("@braintree/wrap-promise"),p={1:"_createV1PaymentDataRequest",2:"_createV2PaymentDataRequest"};function _(e){if(this._createPromise=e.createPromise,this._client=e.client,this._useDeferredClient=e.useDeferredClient,this._googlePayVersion=e.googlePayVersion||1,this._googleMerchantId=e.googleMerchantId,this._isUnsupportedGooglePayAPIVersion())throw new c({code:d.GOOGLE_PAYMENT_UNSUPPORTED_VERSION.code,message:"The Braintree SDK does not support Google Pay version "+this._googlePayVersion+". Please upgrade the version of your Braintree SDK and contact support if this error persists.",type:d.GOOGLE_PAYMENT_UNSUPPORTED_VERSION.type})}_.prototype._waitForClient=function(){return this._client?Promise.resolve():this._createPromise.then(function(e){this._client=e}.bind(this))},_.prototype._isUnsupportedGooglePayAPIVersion=function(){return!(this._googlePayVersion in p)},_.prototype._getDefaultConfig=function(){return this._defaultConfig||(this._defaultConfig=s(this._client.getConfiguration(),this._googlePayVersion,this._googleMerchantId)),this._defaultConfig},_.prototype._createV1PaymentDataRequest=function(e){var t=this._getDefaultConfig(),n=e.cardRequirements&&e.cardRequirements.allowedCardNetworks,r=t.cardRequirements.allowedCardNetworks,o=n||r;return(e=i({},t,e)).cardRequirements.allowedCardNetworks=o,e},_.prototype._createV2PaymentDataRequest=function(e){var t=this._getDefaultConfig();return e.allowedPaymentMethods&&e.allowedPaymentMethods.forEach(function(e){var n=a(t.allowedPaymentMethods,"type",e.type);n&&function(e,t){Object.keys(t).forEach(function(n){"object"==typeof t[n]?e[n]=i({},t[n],e[n]):e[n]=e[n]||t[n]})}
2(e,n)}),i({},t,e)},_.prototype.createPaymentDataRequest=function(e){return this._useDeferredClient?this._waitForClient().then(function(){return this._createPaymentDataRequestSyncronously(e)}.bind(this)):this._createPaymentDataRequestSyncronously(e)},_.prototype._createPaymentDataRequestSyncronously=function(e){var t=i({},e),n=this._googlePayVersion,o=p[n];return t.transactionInfo&&t.transactionInfo.totalPrice&&(t.transactionInfo.totalPrice=t.transactionInfo.totalPrice.toString()),r.sendEvent(this._createPromise,"google-payment.v"+n+".createPaymentDataRequest"),this[o](t)},_.prototype.parseResponse=function(e){var t=this;return Promise.resolve().then(function(){var n,i=2===e.apiVersion?e.paymentMethodData.tokenizationData.token:e.paymentMethodToken.token,o=JSON.parse(i),a=o.error;return a?Promise.reject(a):(r.sendEvent(t._createPromise,"google-payment.parseResponse.succeeded"),o.paypalAccounts?(n=o.paypalAccounts[0],r.sendEvent(t._createPromise,"google-payment.parseResponse.succeeded.paypal"),Promise.resolve({nonce:n.nonce,type:n.type,description:n.description})):(n=o.androidPayCards[0],r.sendEvent(t._createPromise,"google-payment.parseResponse.succeeded.google-payment"),Promise.resolve({nonce:n.nonce,type:n.type,description:n.description,details:{cardType:n.details.cardType,lastFour:n.details.lastFour,lastTwo:n.details.lastTwo,isNetworkTokenized:n.details.isNetworkTokenized,bin:n.details.bin},binData:n.binData})))}).catch(function(e){return r.sendEvent(t._createPromise,"google-payment.parseResponse.failed"),Promise.reject(new c({code:d.GOOGLE_PAYMENT_GATEWAY_ERROR.code,message:d.GOOGLE_PAYMENT_GATEWAY_ERROR.message,type:d.GOOGLE_PAYMENT_GATEWAY_ERROR.type,details:{originalError:e}}))})},_.prototype.teardown=function(){return o(this,l(_.prototype)),Promise.resolve()},t.exports=u.wrapPrototype(_)},{"../lib/analytics":144,"../lib/assign":146,"../lib/braintree-error":149,"../lib/convert-methods-to-error":151,"../lib/find":161,"../lib/generate-google-pay-configuration":173,"../lib/methods":181,"./errors":122,"@braintree/wrap-promise":43}],124:[function(e,t,n){"use strict";var r=e("./google-payment"),i=e("../lib/braintree-error"),o=e("../lib/create-assets-url"),a=e("../lib/create-deferred-client"),s=e("../lib/basic-component-verification"),c=e("@braintree/wrap-promise"),d=e("./errors");t.exports={create:c(function(e){var t="Google Pay";return s.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){var n,s;return n=a.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o.create(e.authorization),name:t}).then(function(t){var n=t.getConfiguration();return e.client=t,n.gatewayConfiguration.androidPay?t:Promise.reject(new i(d.GOOGLE_PAYMENT_NOT_ENABLED))}),e.createPromise=n,s=new r(e),e.useDeferredClient?s:n.then(function(e){return s._client=e,s})})}),VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./errors":122,"./google-payment":123,"@braintree/wrap-promise":43}],125:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error"),i=e("../shared/errors"),o=e("../shared/constants").allowedAttributes;t.exports=function(e,t){var n;return o.hasOwnProperty(e)?null==t||function(e,t){return"string"===o[e]?"string"==typeof t||"number"==typeof t:"boolean"===o[e]&&("true"===String(t)||"false"===String(t))}(e,t)||(n=new r({type:i.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.type,code:i.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.code,message:'Value "'+t+'" is not allowed for "'+e+'" attribute.'})):n=new r({type:i.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.type,code:i.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.code,message:'The "'+e+'" attribute is not supported in Hosted Fields.'}),n}},{"../../lib/braintree-error":149,"../shared/constants":133,"../shared/errors":134}],126:[function(e,t,n){"use strict";var r=e("../shared/constants"),i=e("../../lib/use-min");t.exports=function(e,t,n){return e+"/web/"+r.VERSION+"/html/hosted-fields-frame"+i(n)+".html#"+t}},{"../../lib/use-min":187,"../shared/constants":133}],127:[function(e,t,n){"use strict";var r=e("../shared/constants").navigationDirections,i=e("../shared/browser-detection"),o=e("../shared/focus-intercept"),a=e("../shared/find-parent-tags"),s=["INPUT","SELECT","TEXTAREA"],c=["hidden","button","reset","submit","checkbox","radio","file"];function d(e){return i.hasSoftwareKeyboard()?s.indexOf(e.tagName)>-1&&c.indexOf(e.type)<0:"hidden"!==e.type}function l(e){var t,n;for(t=0;t<e.length;t++)if(d(n=e[t]))return n;return null}t.exports={removeExtraFocusElements:function(e,t){var n=Array.prototype.slice.call(e.elements);
2[l(n),l(n.reverse())].forEach(function(e){e&&o.matchFocusElement(e.getAttribute("id"))&&t(e.getAttribute("id"))})},createFocusChangeHandler:function(e,t){return function(n){var i,s,c,l,u=document.getElementById("bt-"+n.field+"-"+n.direction+"-"+e);if(u)if(c=a(u,"form")[0],document.forms.length<1||!c)t.onRemoveFocusIntercepts();else{i=(c=[].slice.call(c.elements)).indexOf(u),l=function(e,t){switch(e){case r.BACK:return{checkIndexBounds:function(e){return e<0},indexChange:-1};case r.FORWARD:return{checkIndexBounds:function(e){return e>t-1},indexChange:1}}return{}}(n.direction,c.length);do{if(i+=l.indexChange,l.checkIndexBounds(i))return;s=c[i]}while(!d(s));o.matchFocusElement(s.getAttribute("id"))?t.onTriggerInputFocus(s.getAttribute("data-braintree-type")):s.focus()}}}}},{"../shared/browser-detection":132,"../shared/constants":133,"../shared/find-parent-tags":135,"../shared/focus-intercept":136}],128:[function(e,t,n){"use strict";var r=e("../shared/constants").allowedStyles;t.exports=function(e){var t,n=document.createElement("input"),i={};return"."===e[0]&&(e=e.substring(1)),n.className=e,n.style.display="none !important",n.style.position="fixed !important",n.style.left="-99999px !important",n.style.top="-99999px !important",document.body.appendChild(n),t=window.getComputedStyle(n),r.forEach(function(e){var n=t[e];n&&(i[e]=n)}),document.body.removeChild(n),i}},{"../shared/constants":133}],129:[function(e,t,n){"use strict";var r=e("../../lib/assign").assign,i=e("../../lib/create-assets-url"),o=e("../../lib/is-verified-domain"),a=e("../../lib/destructor"),s=e("@braintree/iframer"),c=e("framebus"),d=e("../../lib/create-deferred-client"),l=e("../../lib/braintree-error"),u=e("./compose-url"),p=e("./get-styles-from-class"),_=e("../shared/constants"),E=e("../shared/errors"),m=e("../../lib/constants").INTEGRATION_TIMEOUT_MS,h=e("@braintree/uuid"),f=e("../shared/find-parent-tags"),A=e("../shared/browser-detection"),y=_.events,I=e("@braintree/event-emitter"),T=e("./inject-frame"),P=e("../../lib/analytics"),N=_.allowedFields,O=e("../../lib/methods"),g=e("../../lib/shadow"),C=e("../../lib/find-root-node"),b=e("../../lib/convert-methods-to-error"),v=e("../../lib/errors"),R=e("../shared/get-card-types"),S=e("./attribute-validation-error"),w=e("@braintree/wrap-promise"),D=e("./focus-change"),L=e("../shared/focus-intercept").destroy;function M(e){var t,n,f,A,N,C=this,S={},w={},U=[],k=h(),F=e.sessionId;if(this._merchantConfigurationOptions=r({},e),e.client?(f=(n=e.client.getConfiguration(void 0,F)).gatewayConfiguration.assetsUrl,A=n.isDebug):(f=i.create(e.authorization),A=Boolean(e.isDebug)),this._clientPromise=d.create({client:e.client,authorization:e.authorization,debug:A,assetsUrl:f,name:"Hosted Fields",sessionId:F}),N=u(f,k,A),!e.fields||0===Object.keys(e.fields).length)throw new l({type:v.INSTANTIATION_OPTION_REQUIRED.type,code:v.INSTANTIATION_OPTION_REQUIRED.code,message:"options.fields is required when instantiating Hosted Fields."});if(void 0!==e.binVerificationLength&&("number"!=typeof e.binVerificationLength||6!==e.binVerificationLength&&8!==e.binVerificationLength))throw new l({type:v.INSTANTIATION_OPTION_INVALID.type,code:v.INSTANTIATION_OPTION_INVALID.code,message:"options.binVerificationLength must be either 6 or 8."});I.call(this),this._injectedNodes=[],this._destructor=new a,this._fields=S,this._state={fields:{},cards:R("")},this._bus=new c({channel:k,verifyDomain:o,targetFrames:[window]}),this._destructor.registerFunctionForTeardown(function(){C._bus.teardown()}),e.client?P.sendEvent(this._clientPromise,"custom.hosted-fields.initialized"):P.sendEvent(this._clientPromise,"custom.hosted-fields.initialized.deferred-client"),Object.keys(e.fields).forEach(function(t){var n,r,i,o,a;if(!_.allowedFields.hasOwnProperty(t))throw new l({type:E.HOSTED_FIELDS_INVALID_FIELD_KEY.type,code:E.HOSTED_FIELDS_INVALID_FIELD_KEY.code,message:'"'+t+'" is not a valid field.'});if("string"==typeof(r=(n=e.fields[t]).container||n.selector)&&(r=document.querySelector(r)),!r||1!==r.nodeType)throw new l({type:E.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.type,code:E.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.code,message:E.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.message,details:{fieldSelector:n.selector,fieldContainer:n.container,fieldKey:t}});if(r.querySelector('iframe[name^="braintree-"]'))throw new l({type:E.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.type,code:E.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.co
2de,message:E.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.message,details:{fieldSelector:n.selector,fieldContainer:n.container,fieldKey:t}});if(i=r,g.isShadowElement(i)&&(i=g.transformToSlot(i,"height: 100%")),n.maxlength&&"number"!=typeof n.maxlength)throw new l({type:E.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,code:E.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,message:"The value for maxlength must be a number.",details:{fieldKey:t}});if(n.minlength&&"number"!=typeof n.minlength)throw new l({type:E.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,code:E.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,message:"The value for minlength must be a number.",details:{fieldKey:t}});o=s({type:t,name:"braintree-hosted-field-"+t,style:_.defaultIFrameStyle,title:n.iframeTitle||"Secure Credit Card Frame - "+_.allowedFields[t].label}),this._bus.addTargetFrame(o),this._injectedNodes.push.apply(this._injectedNodes,T(k,o,i,function(){C.focus(t)})),this._setupLabelFocus(t,r),S[t]={frameElement:o,containerElement:r},a=new Promise(function(e){w[t]=e}),U.push(a),this._state.fields[t]={isEmpty:!0,isValid:!1,isPotentiallyValid:!0,isFocused:!1,container:r},setTimeout(function(){o.src=N},0)}.bind(this)),this._merchantConfigurationOptions.styles&&Object.keys(this._merchantConfigurationOptions.styles).forEach(function(e){var t=C._merchantConfigurationOptions.styles[e];"string"==typeof t&&(C._merchantConfigurationOptions.styles[e]=p(t))}),this._bus.on(y.REMOVE_FOCUS_INTERCEPTS,function(e){L(e&&e.id)}),this._bus.on(y.TRIGGER_FOCUS_CHANGE,D.createFocusChangeHandler(k,{onRemoveFocusIntercepts:function(e){C._bus.emit(y.REMOVE_FOCUS_INTERCEPTS,{id:e})},onTriggerInputFocus:function(e){C.focus(e)}})),this._bus.on(y.READY_FOR_CLIENT,function(e){C._clientPromise.then(function(t){e(t)})}),this._bus.on(y.CARD_FORM_ENTRY_HAS_BEGUN,function(){P.sendEvent(C._clientPromise,"hosted-fields.input.started")}),this._bus.on(y.BIN_AVAILABLE,function(e){C._emit("binAvailable",{bin:e})}),t=setTimeout(function(){P.sendEvent(C._clientPromise,"custom.hosted-fields.load.timed-out"),C._emit("timeout")},m),Promise.all(U).then(function(e){var n,i,o=e[0];clearTimeout(t),o((n=C._merchantConfigurationOptions,(i=r({},n)).fields=r({},i.fields),Object.keys(i.fields).forEach(function(e){i.fields[e]=r({},i.fields[e]),delete i.fields[e].container}),i)),C._cleanUpFocusIntercepts(),C._emit("ready")}),this._bus.on(y.FRAME_READY,function(e,t){w[e.field](t)}),this._bus.on(y.INPUT_EVENT,function(e){return function(t){var n,r=t.merchantPayload,i=r.emittedBy,o=e[i].containerElement;Object.keys(r.fields).forEach(function(t){r.fields[t].container=e[t].containerElement}),n=r.fields[i],o.classList.toggle(_.externalClasses.FOCUSED,n.isFocused),o.classList.toggle(_.externalClasses.VALID,n.isValid),o.classList.toggle(_.externalClasses.INVALID,!n.isPotentiallyValid),this._state={cards:r.cards,fields:r.fields},this._emit(t.type,r)}}(S).bind(this)),this._destructor.registerFunctionForTeardown(function(){var e,t,n;for(e=0;e<C._injectedNodes.length;e++)(n=(t=C._injectedNodes[e]).parentNode).removeChild(t),n.classList.remove(_.externalClasses.FOCUSED,_.externalClasses.INVALID,_.externalClasses.VALID)}),this._destructor.registerFunctionForTeardown(function(){L()}),this._destructor.registerFunctionForTeardown(function(){var e=O(M.prototype).concat(O(I.prototype));b(C,e)})}I.createChild(M),M.prototype._setupLabelFocus=function(e,t){var n,r,i=this,o=C(t);if(null!=t.id){for(n=Array.prototype.slice.call(document.querySelectorAll('label[for="'+t.id+'"]')),o!==document&&(n=n.concat(Array.prototype.slice.call(o.querySelectorAll('label[for="'+t.id+'"]')))),n=(n=n.concat(f(t,"label"))).filter(function(e,t,n){return n.indexOf(e)===t}),r=0;r<n.length;r++)n[r].addEventListener("click",a,!1);this._destructor.registerFunctionForTeardown(function(){for(r=0;r<n.length;r++)n[r].removeEventListener("click",a,!1)})}function a(){i.focus(e)}},M.prototype._getAnyFieldContainer=function(){var e=this;return Object.keys(this._fields).reduce(function(t,n){return t||e._fields[n].containerElement},null)},M.prototype._cleanUpFocusIntercepts=function(){var e,t;document.forms.length<1?this._bus.emit(y.REMOVE_FOCUS_INTERCEPTS):(e=this._getAnyFieldContainer(),(t=f(e,"form")[0])?D.removeExtraFocusElements(t,function(e){this._bus.emit(y.REMOVE_FOCUS_INTERCEPTS,{id:e})}.bind(this)):this._bus.emit(y.REMOVE_FOCUS_INTERCEPTS))},M.prototype._attachInvalidFieldContainersToError=function(e){e.details&&e.details.invalidFieldKeys&&e.details.invalidFieldKeys.length>0&&(e.details.invalidFields={},e.details.invalidFieldKeys.forEach(function(t){e.details.invalidFields[t]=this._fields[t].containerElement}.bind(this)))},M.prototype.getChallenges=function(){return this._clientPromise.then(function(e){return e.getConfiguration().gatewayConfiguration.challenges})}
2,M.prototype.getSupportedCardTypes=function(){return this._clientPromise.then(function(e){return e.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes.map(function(e){return"MasterCard"===e?"Mastercard":e})})},M.prototype.teardown=function(){var e=this;return new Promise(function(t,n){e._destructor.teardown(function(r){P.sendEvent(e._clientPromise,"custom.hosted-fields.teardown-completed"),r?n(r):t()})})},M.prototype.tokenize=function(e){var t=this;return e||(e={}),new Promise(function(n,r){t._bus.emit(y.TOKENIZATION_REQUEST,e,function(e){var i=e[0],o=e[1];i?(t._attachInvalidFieldContainersToError(i),r(new l(i))):n(o)})})},M.prototype.addClass=function(e,t){var n;return N.hasOwnProperty(e)?this._fields.hasOwnProperty(e)?this._bus.emit(y.ADD_CLASS,{field:e,classname:t}):n=new l({type:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot add class to "'+e+'" field because it is not part of the current Hosted Fields options.'}):n=new l({type:E.HOSTED_FIELDS_FIELD_INVALID.type,code:E.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e+'" is not a valid field. You must use a valid field option when adding a class.'}),n?Promise.reject(n):Promise.resolve()},M.prototype.removeClass=function(e,t){var n;return N.hasOwnProperty(e)?this._fields.hasOwnProperty(e)?this._bus.emit(y.REMOVE_CLASS,{field:e,classname:t}):n=new l({type:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot remove class from "'+e+'" field because it is not part of the current Hosted Fields options.'}):n=new l({type:E.HOSTED_FIELDS_FIELD_INVALID.type,code:E.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e+'" is not a valid field. You must use a valid field option when removing a class.'}),n?Promise.reject(n):Promise.resolve()},M.prototype.setAttribute=function(e){var t,n;return N.hasOwnProperty(e.field)?this._fields.hasOwnProperty(e.field)?(t=S(e.attribute,e.value))?n=t:this._bus.emit(y.SET_ATTRIBUTE,{field:e.field,attribute:e.attribute,value:e.value}):n=new l({type:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot set attribute for "'+e.field+'" field because it is not part of the current Hosted Fields options.'}):n=new l({type:E.HOSTED_FIELDS_FIELD_INVALID.type,code:E.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e.field+'" is not a valid field. You must use a valid field option when setting an attribute.'}),n?Promise.reject(n):Promise.resolve()},M.prototype.setMonthOptions=function(e){var t,n=this,r=this._merchantConfigurationOptions.fields;return r.expirationMonth?r.expirationMonth.select||(t="Expiration month field must be a select element."):t="Expiration month field must exist to use setMonthOptions.",t?Promise.reject(new l({type:E.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,code:E.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,message:t})):new Promise(function(t){n._bus.emit(y.SET_MONTH_OPTIONS,e,t)})},M.prototype.setMessage=function(e){this._bus.emit(y.SET_MESSAGE,{field:e.field,message:e.message})},M.prototype.removeAttribute=function(e){var t,n;return N.hasOwnProperty(e.field)?this._fields.hasOwnProperty(e.field)?(t=S(e.attribute))?n=t:this._bus.emit(y.REMOVE_ATTRIBUTE,{field:e.field,attribute:e.attribute}):n=new l({type:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot remove attribute for "'+e.field+'" field because it is not part of the current Hosted Fields options.'}):n=new l({type:E.HOSTED_FIELDS_FIELD_INVALID.type,code:E.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e.field+'" is not a valid field. You must use a valid field option when removing an attribute.'}),n?Promise.reject(n):Promise.resolve()},M.prototype.setPlaceholder=function(e,t){return this.setAttribute({field:e,attribute:"placeholder",value:t})},M.prototype.clear=function(e){var t;return N.hasOwnProperty(e)?this._fields.hasOwnProperty(e)?this._bus.emit(y.CLEAR_FIELD,{field:e}):t=new l({type:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot clear "'+e+'" field because it is not part of the current Hosted Fields options.'}):t=new l({type:E.HOSTED_FIELDS_FIELD_INVALID.type,code:E.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e+'" is not a valid field. You must use a valid field option when clearing a field.'}
2),t?Promise.reject(t):Promise.resolve()},M.prototype.focus=function(e){var t,n=this._fields[e];return N.hasOwnProperty(e)?this._fields.hasOwnProperty(e)?(n.frameElement.focus(),this._bus.emit(y.TRIGGER_INPUT_FOCUS,{field:e}),A.isIos()&&setTimeout(function(){var e,t,r,i;e=n.containerElement,t=e.getBoundingClientRect(),r=Math.floor(t.height/2),i=Math.floor(t.width/2),t.top<(window.innerHeight-r||document.documentElement.clientHeight-r)&&t.right>i&&t.bottom>r&&t.left<(window.innerWidth-i||document.documentElement.clientWidth-i)||n.containerElement.scrollIntoView()},5)):t=new l({type:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,code:E.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,message:'Cannot focus "'+e+'" field because it is not part of the current Hosted Fields options.'}):t=new l({type:E.HOSTED_FIELDS_FIELD_INVALID.type,code:E.HOSTED_FIELDS_FIELD_INVALID.code,message:'"'+e+'" is not a valid field. You must use a valid field option when focusing a field.'}),t?Promise.reject(t):Promise.resolve()},M.prototype.getState=function(){return this._state},t.exports=w.wrapPrototype(M)},{"../../lib/analytics":144,"../../lib/assign":146,"../../lib/braintree-error":149,"../../lib/constants":150,"../../lib/convert-methods-to-error":151,"../../lib/create-assets-url":153,"../../lib/create-deferred-client":155,"../../lib/destructor":157,"../../lib/errors":159,"../../lib/find-root-node":160,"../../lib/is-verified-domain":179,"../../lib/methods":181,"../../lib/shadow":184,"../shared/browser-detection":132,"../shared/constants":133,"../shared/errors":134,"../shared/find-parent-tags":135,"../shared/focus-intercept":136,"../shared/get-card-types":137,"./attribute-validation-error":125,"./compose-url":126,"./focus-change":127,"./get-styles-from-class":128,"./inject-frame":130,"@braintree/event-emitter":33,"@braintree/iframer":35,"@braintree/uuid":39,"@braintree/wrap-promise":43,framebus:54}],130:[function(e,t,n){"use strict";var r=e("../shared/focus-intercept"),i=e("../shared/constants").navigationDirections;t.exports=function(e,t,n,o){var a=t.getAttribute("type"),s=document.createElement("div"),c=document.createDocumentFragment(),d=r.generate(e,a,i.BACK,o),l=r.generate(e,a,i.FORWARD,o);return s.style.clear="both",c.appendChild(d),c.appendChild(t),c.appendChild(l),c.appendChild(s),n.appendChild(c),[t,s]}},{"../shared/constants":133,"../shared/focus-intercept":136}],131:[function(e,t,n){"use strict";var r=e("./external/hosted-fields"),i=e("../lib/basic-component-verification"),o=e("./shared/errors"),a=e("restricted-input/supports-input-formatting"),s=e("@braintree/wrap-promise"),c=e("../lib/braintree-error");t.exports={supportsInputFormatting:a,create:s(function(e){return i.verify({name:"Hosted Fields",authorization:e.authorization,client:e.client}).then(function(){var t=new r(e);return new Promise(function(e,n){t.on("ready",function(){e(t)}),t.on("timeout",function(){n(new c(o.HOSTED_FIELDS_TIMEOUT))})})})}),VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"../lib/braintree-error":149,"./external/hosted-fields":129,"./shared/errors":134,"@braintree/wrap-promise":43,"restricted-input/supports-input-formatting":89}],132:[function(e,t,n){"use strict";var r=e("@braintree/browser-detection/is-android"),i=e("@braintree/browser-detection/is-chrome-os"),o=e("@braintree/browser-detection/is-ios"),a=e("@braintree/browser-detection/is-chrome"),s=e("@braintree/browser-detection/is-safari"),c=e("@braintree/browser-detection/is-ios-safari");t.exports={isAndroid:r,isChromeOS:i,isChromeIos:function(){return a()&&o()},isFirefox:e("@braintree/browser-detection/is-firefox"),isIos:o,isIosWebview:e("@braintree/browser-detection/is-ios-webview"),isSafari:s,isIosSafari:c,hasSoftwareKeyboard:function(){return r()||i()||o()}}},{"@braintree/browser-detection/is-android":22,"@braintree/browser-detection/is-chrome":24,"@braintree/browser-detection/is-chrome-os":23,"@braintree/browser-detection/is-firefox":25,"@braintree/browser-detection/is-ios":30,"@braintree/browser-detection/is-ios-safari":27,"@braintree/browser-detection/is-ios-webview":28,"@braintree/browser-detection/is-safari":31}],133:[function(e,t,n){"use strict";var r=e("../../lib/enumerate"),i=e("./errors"),o={VERSION:"3.143.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:i.HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE,81736:i.HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED},allowedStyles:["-moz-appearance","-moz-box-shadow","-moz-osx-font-smoothing","-moz-tap-highlight-color","-moz-transition","-webkit-appearance","-webkit-box-shadow","-webkit-font-smoothing","-webkit-tap-highlight-color","-webkit-text-fill-color","-webkit-transition","appearance","box-shadow","color","direction","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-weight","letter-spacing","line-height","margin","margin-top","margin-right","margin-bottom","margin-left","opacity","outline","padding","padding-top","padding-right","padding-bottom","padding-left","text-align","text-shadow","transition"],allowedFields:{cardholderName:{name:"cardholder-name",label:"Cardholder Name"},number:{name:"credit-card-number",label:"Credit Card Number"},cvv:{name:"cvv",label:"CVV"},expirationDate:{name:"expiration",label:"Expiration Date"},expirationMonth:{name:"expiration-month",label:"Expiration Month"},expirationYear:{name:"expiration-year",label:"Expiration Year"},postalCode:{name:"postal-code",label:"Postal Code"}},allowedAttributes:{"aria-invalid":"boolean","aria-required":"boolean",disabled:"boolean",placeholder:"string"},allowedBillingAddressFields:["company","countryCodeNumeric","countryCodeAlpha2","countryCodeAlpha3","countryName","extendedAddress","locality","region","firstName","lastName","postalCode","streetAddress"],allowedShippingAddressFields:["company","countryCodeNumeric","countryCodeAlpha2","countryCodeAlpha3","countryName","extendedAddress","locality","region","firstName","lastName","postalCode","streetAddress"],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"}};o.events=r(["ADD_CLASS","AUTOFILL_DATA_AVAILABLE","BIN_AVAILABLE","CARD_FORM_ENTRY_HAS_BEGUN","CLEAR_FIELD","CONFIGURATION","FRAME_READY","INPUT_EVENT","READY_FOR_CLIENT","REMOVE_ATTRIBUTE","REMOVE_CLASS","REMOVE_FOCUS_INTERCEPTS","SET_ATTRIBUTE","SET_MESSAGE","SET_MONTH_OPTIONS","TOKENIZATION_REQUEST","TRIGGER_FOCUS_CHANGE","TRIGGER_INPUT_FOCUS","VALIDATE_STRICT"],"hosted-fields:"),t.exp
2orts=o},{"../../lib/enumerate":158,"./errors":134}],134:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error");t.exports={HOSTED_FIELDS_TIMEOUT:{type:r.types.UNKNOWN,code:"HOSTED_FIELDS_TIMEOUT",message:"Hosted Fields timed out when attempting to set up."},HOSTED_FIELDS_INVALID_FIELD_KEY:{type:r.types.MERCHANT,code:"HOSTED_FIELDS_INVALID_FIELD_KEY"},HOSTED_FIELDS_INVALID_FIELD_SELECTOR:{type:r.types.MERCHANT,code:"HOSTED_FIELDS_INVALID_FIELD_SELECTOR",message:"Selector does not reference a valid DOM node."},HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME:{type:r.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME",message:"Element already contains a Braintree iframe."},HOSTED_FIELDS_FIELD_INVALID:{type:r.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_INVALID"},HOSTED_FIELDS_FIELD_NOT_PRESENT:{type:r.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_NOT_PRESENT"},HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR:{type:r.types.NETWORK,code:"HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR",message:"A tokenization network error occurred."},HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE:{type:r.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:r.types.CUSTOMER,code:"HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED",message:"CVV verification failed during tokenization."},HOSTED_FIELDS_FAILED_TOKENIZATION:{type:r.types.CUSTOMER,code:"HOSTED_FIELDS_FAILED_TOKENIZATION",message:"The supplied card data failed tokenization."},HOSTED_FIELDS_FIELDS_EMPTY:{type:r.types.CUSTOMER,code:"HOSTED_FIELDS_FIELDS_EMPTY",message:"All fields are empty. Cannot tokenize empty card fields."},HOSTED_FIELDS_FIELDS_INVALID:{type:r.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:r.types.MERCHANT,code:"HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED"},HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED:{type:r.types.MERCHANT,code:"HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED"},HOSTED_FIELDS_FIELD_PROPERTY_INVALID:{type:r.types.MERCHANT,code:"HOSTED_FIELDS_FIELD_PROPERTY_INVALID"}}},{"../../lib/braintree-error":149}],135:[function(e,t,n){"use strict";t.exports=function(e,t){for(var n=e.parentNode,r=[];null!=n;)null!=n.tagName&&n.tagName.toLowerCase()===t&&r.push(n),n=n.parentNode;return r}},{}],136:[function(e,t,n){"use strict";var r=e("./browser-detection"),i=e("./constants"),o=Object.keys(i.allowedFields),a=i.navigationDirections,s={generate:function(e,t,n,i){var o=document.createElement("input");return r.hasSoftwareKeyboard()||r.isFirefox()?(o.setAttribute("aria-hidden","true"),o.setAttribute("autocomplete","off"),o.setAttribute("data-braintree-direction",n),o.setAttribute("data-braintree-type",t),o.setAttribute("id","bt-"+t+"-"+n+"-"+e),o.setAttribute("style",JSON.stringify({border:"none !important",display:"block !important",height:"1px !important",left:"-1px !important",opacity:"0 !important",position:"absolute !important",top:"-1px !important",width:"1px !important"}).replace(/[{}"]/g,"").replace(/,/g,";")),o.classList.add("focus-intercept"),o.addEventListener("focus",function(e){i(e),r.hasSoftwareKeyboard()||o.blur()}),o):document.createDocumentFragment()},destroy:function(e){var t;e?t=[document.getElementById(e)]:(t=document.querySelectorAll("[data-braintree-direction]"),t=[].slice.call(t)),t.forEach(function(e){e&&1===e.nodeType&&s.matchFocusElement(e.getAttribute("id"))&&e.parentNode.removeChild(e)})},matchFocusElement:function(e){var t,n,r,i;return!!e&&!((t=e.split("-")).length<4)&&(n="bt"===t[0],r=o.indexOf(t[1])>-1,i=t[2]===a.BACK||t[2]===a.FORWARD,Boolean(n&&r&&i))}};t.exports=s},{"./browser-detection":132,"./constants":133}],137:[function(e,t,n){"use strict";var r=e("credit-card-type");t.exports=function(e){var t=r(e);return t.forEach(function(e){"mastercard"===e.type&&(e.type="master-card")}),t}},{"credit-card-type":45}],138:[function(e,t,n){"use strict";var r=e("./american-express"),i=e("./apple-pay"),o=e("./client"),a=e("./fastlane"),s=e("./data-collector"),c=e("./hosted-fields"),d=e("./local-payment"),l=e("./masterpass"),u=e("./instant-verification"),p=e("./payment-request"),_=e("./payment-ready"),E=e("./paypal"),m=e("./paypal-checkout"),h=e("./paypal-checkout-v6"),f=e("./google-payment"),A=e("./sepa"),y=e("./three-d-secure"),I=e("./unionpay"),T=e("./us-bank-account"),P=e("./vault-manager"),N=e("./venmo"),O=e("./visa-checkout"),g=e("./preferred-
2payment-methods");t.exports={fastlane:a,americanExpress:r,applePay:i,client:o,dataCollector:s,hostedFields:c,instantVerification:u,localPayment:d,masterpass:l,googlePayment:f,paymentRequest:p,paymentReady:_,paypal:E,paypalCheckout:m,paypalCheckoutV6:h,threeDSecure:y,unionpay:I,usBankAccount:T,vaultManager:P,venmo:N,visaCheckout:O,sepa:A,preferredPaymentMethods:g,VERSION:"3.143.0"}},{"./american-express":92,"./apple-pay":95,"./client":100,"./data-collector":118,"./fastlane":121,"./google-payment":124,"./hosted-fields":131,"./instant-verification":141,"./local-payment":192,"./masterpass":196,"./payment-ready":202,"./payment-request":205,"./paypal":216,"./paypal-checkout":213,"./paypal-checkout-v6":210,"./preferred-payment-methods":219,"./sepa":223,"./three-d-secure":233,"./unionpay":237,"./us-bank-account":243,"./vault-manager":246,"./venmo":251,"./visa-checkout":261}],139:[function(e,t,n){"use strict";t.exports={EXPERIENCE_URL:{sandbox:"https://www.sandbox.paypal.com/openfinance/v1/bank/payment-method/create",production:"https://www.paypal.com/openfinance/v1/bank/payment-method/create"},ACH_MANDATE_DETAILS_QUERY:"query AchMandateDetails($id: ID!) { node(id: $id) { id ... on PaymentMethod { id legacyId usage createdAt verifications { edges { node { status } } } details { __typename ... on UsBankAccountDetails { accountholderName accountType ownershipType bankName last4 routingNumber verified } } } } }"}},{}],140:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={INSTANT_VERIFICATION_ERROR:{type:r.types.MERCHANT,code:"INSTANT_VERIFICATION_ERROR"},INSTANT_VERIFICATION_NOT_ENABLED:{type:r.types.MERCHANT,code:"INSTANT_VERIFICATION_NOT_ENABLED",message:"Instant Verification is not enabled for this merchant account."},INSTANT_VERIFICATION_CANCELED:{type:r.types.CUSTOMER,code:"INSTANT_VERIFICATION_CANCELED",message:"Customer canceled the Instant Verification payment before authorizing."},INSTANT_VERIFICATION_FAILURE:{type:r.types.UNKNOWN,code:"INSTANT_VERIFICATION_FAILURE",message:"Instant Verification payment failed during authorizing."},INSTANT_VERIFICATION_JWT_REQUIRED:{type:r.types.MERCHANT,code:"INSTANT_VERIFICATION_JWT_MISSING",message:"JWT is required for Instant Verification payment flow."},INSTANT_VERIFICATION_MANDATE_ID_REQUIRED:{type:r.types.MERCHANT,code:"INSTANT_VERIFICATION_MANDATE_ID_REQUIRED",message:"Mandate ID is required to fetch ACH mandate details."},INSTANT_VERIFICATION_MANDATE_DETAILS_FAILED:{type:r.types.NETWORK,code:"INSTANT_VERIFICATION_MANDATE_DETAILS_FAILED",message:"Failed to fetch ACH mandate details."}}},{"../lib/braintree-error":149}],141:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("../lib/braintree-error"),o=e("../lib/create-assets-url"),a=e("../lib/create-deferred-client"),s=e("./errors"),c=e("./instant-verification"),d=e("@braintree/wrap-promise");t.exports={create:d(function(e){var t="Instant Verification";return r.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return a.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o.create(e.authorization),name:t})}).then(function(t){return e.client=t,e.client.getConfiguration().gatewayConfiguration.openBanking?new c(e):Promise.reject(new i(s.INSTANT_VERIFICATION_NOT_ENABLED))})}),VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./errors":140,"./instant-verification":142,"@braintree/wrap-promise":43}],142:[function(e,t,n){"use strict";var r=e("../lib/vendor/polyfill").atob,i=e("../lib/analytics"),o=e("../lib/braintree-error"),a=e("./constants"),s=e("./errors"),c=e("../lib/querystring"),d=e("@braintree/wrap-promise");function l(e){this._instantiatedWithClient=Boolean(!e.useDeferredClient),this._client=e.client,this._createPromise=e.createPromise,i.sendEvent(this._client,"instant-verification.component.initialized")}l.prototype.startPayment=function(e){var t,n,r=this,d=r._client.getConfiguration().authorizationFingerprint,l="";return e.jwt?(t=r._client.getConfiguration(),n=a.EXPERIENCE_URL.production,t&&t.gatewayConfiguration&&t.gatewayConfiguration.environment&&a.EXPERIENCE_URL[t.gatewayConfiguration.environment]&&(n=a.EXPERIENCE_URL[t.gatewayConfiguration.environment]),l=n+"?"+c.stringify({ct:e.jwt,at:d}),"undefined"!=typeof window&&window.location&&(i.sendEvent(r._client,"instant-verification.redirect.initiated"),window.location.href=l),Promise.resolve()):Promise.reject(new o(s.INSTANT_VERIFICATION_JWT_REQUIRED))},l.prototype.handleRedirect=function(e){var t,n,a,c=this;return e.success?(n=JSON.parse(r(e.success)),i.sendEvent(c._client,"instant-verification.redirect.completed.success"),n.tokenizedAccounts&&n.tokenizedAccounts[0]&&(a=n.tokenizedAccounts[0].tokenized_account),Promise.resolve(a)):(e.cancel&&(n=JSON.parse(r(e.cancel)),i.sendEvent(c._client,"instant-verification.redirect.completed.canceled"),t=new o(s.INSTANT_VERIFICATION_CANCELED)),e.error&&(n=JSON.parse(r(e.error)),i.sendEvent(c._client,"instant-verification.redirect.completed.error"),t=new o(s.INSTANT_VERIFICATION_FAILURE)),Promise.reject(t))},l.prototype.getAchMandateDetails=function(e){var t=this,n=e&&e.mandateId;return new Promise(function(e,r){n?t._client.request({api:"graphQLApi",method:"post",data:{query:a.ACH_MANDATE_DETAILS_QUERY,variables:{id:n},operationName:"AchMandateDetails"}},function(n,a){if(n)return i.sendEvent(t._client,"instant-verification.ach-mandate-details.failed"),void r(new o({type:s.INSTANT_VERIFICATION_MANDATE_DETAILS_FAILED.type,code:s.INSTANT_VERIFICATION_MANDATE_DETAILS_FAILED.code,message:s.INSTANT_VERIFICATION_MANDATE_DETAILS_FAILED.message,details:{originalError:n}}));if(a.data&&a.data.node){var c=a.data.node;c.details?(i.sendEvent(t._client,"instant-verification.ach-mandate-details.succeeded"),e({accountHolderName:(d=c).details.accountholderName,accountType:d.details.accountType,bankName:d.details.bankName,last4:d.details.last4,ownershipType:d.details.ownershipType,routingNumber:d.details.routingNumber})):r(new o({type:s.INSTANT_VERIFICATION_MANDATE_DETAILS_FAILED.type,code:s.INSTANT_VERIFICATION_MANDATE_DETAILS_FAILED.code,message:"Mandate details are missing in the response."}))}else r(new o({type:s.INSTANT_VERIFICATION_MANDATE_DETAILS_FAILED.type,code:s.INSTANT_VERIFICATION_MANDATE_DETAILS_FAILED.code,message:"No mandate details found for the provided ID."}));var d}):r(new o(s.INSTANT_VERIFICATION_MANDATE_ID_REQUIRED))})},t.exports=d.wrapPrototype(l)},{"../lib/analytics":144,"../lib/braintree-error":149,"../lib/querystring":183,"../lib/vendor/polyfill":188,"./constants":139,"./errors":14
20,"@braintree/wrap-promise":43}],143:[function(e,t,n){"use strict";var r=e("./create-authorization-data"),i=e("./json-clone"),o=e("./constants");t.exports={addMetadata:function(e,t){var n,a=t?i(t):{},s=r(e.authorization).attrs,c=i(e.analyticsMetadata);for(n in a.braintreeLibraryVersion=o.BRAINTREE_LIBRARY_VERSION,a._meta)a._meta.hasOwnProperty(n)&&(c[n]=a._meta[n]);return a._meta=c,s.tokenizationKey?a.tokenizationKey=s.tokenizationKey:a.authorizationFingerprint=s.authorizationFingerprint,a},addEventMetadata:function(e){var t=e.getConfiguration(),n=r(t.authorization).attrs,i="production"===t.gatewayConfiguration.environment,a={api_integration_type:t.analyticsMetadata.integrationType,app_id:window.location.host,c_sdk_ver:o.VERSION,component:"braintreeclientsdk",merchant_sdk_env:i?"production":"sandbox",merchant_id:t.gatewayConfiguration.merchantId,event_source:"web",platform:o.PLATFORM,platform_version:window.navigator.userAgent,session_id:t.analyticsMetadata.sessionId,client_session_id:t.analyticsMetadata.sessionId,tenant_name:"braintree",product_name:"BT_DCC",space_key:"SKDUYK"};return n.tokenizationKey?a.tokenization_key=n.tokenizationKey:a.auth_fingerprint=n.authorizationFingerprint,a}}},{"./constants":150,"./create-authorization-data":154,"./json-clone":180}],144:[function(e,t,n){"use strict";var r=e("./constants"),i=e("./add-metadata"),o=e("./assign").assign;function a(e,t,n,a){var c=Date.now();return"vault"===n.flow?n.context_type="BA_Token":"checkout"===n.flow&&(n.context_type="EC_Token"),Promise.resolve(e).then(function(e){var d=e._request,l=r.ANALYTICS_URL,u=r.ANALYTICS_PREFIX+t,p="production"===e.getConfiguration().gatewayConfiguration.environment,_={events:[],tracking:[]},E=i.addEventMetadata(e,_);return E.event_name=u,E.t=c,_.events=[{level:"info",event:u,payload:o({env:p?"production":"sandbox",timestamp:c},n)}],_.tracking=[E],n&&"object"==typeof n&&(_.tracking=[s(E,n)]),d({url:l,method:"post",data:_,timeout:r.ANALYTICS_REQUEST_TIMEOUT_MS},a)}).catch(function(e){a&&a(e)})}function s(e,t){var n=o({},t);return Object.keys(n).forEach(function(e){-1===r.ALLOWED_EXTRA_EVENT_FIELDS.indexOf(e)&&delete n[e]}),o(e,n)}t.exports={sendEvent:function(e,t,n){return a(e,t,{},n)},sendEventPlus:a}},{"./add-metadata":143,"./assign":146,"./constants":150}],145:[function(e,t,n){"use strict";var r=e("@braintree/asset-loader/load-script"),i=e("@paypal/fastlane-sdk-loader");t.exports={loadScript:r,loadFastlane:i.loadAxo}},{"@braintree/asset-loader/load-script":2,"@paypal/fastlane-sdk-loader":44}],146:[function(e,t,n){"use strict";var r="function"==typeof Object.assign?Object.assign:i;function i(e){var t,n,r;for(t=1;t<arguments.length;t++)for(r in n=arguments[t])n.hasOwnProperty(r)&&(e[r]=n[r]);return e}t.exports={assign:r,_assign:i}},{}],147:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./errors"),o="3.143.0";t.exports={verify:function(e){var t,n,a;return e?(a=e.name,t=e.client,n=e.authorization,t||n?n||t.getVersion()===o?Promise.resolve():Promise.reject(new r({type:i.INCOMPATIBLE_VERSIONS.type,code:i.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+t.getVersion()+") and "+a+" (version "+o+") components must be from the same SDK version."})):Promise.reject(new r({type:i.INSTANTIATION_OPTION_REQUIRED.type,code:i.INSTANTIATION_OPTION_REQUIRED.code,message:"options.client is required when instantiating "+a+"."}))):Promise.reject(new r({type:i.INVALID_USE_OF_INTERNAL_FUNCTION.type,code:i.INVALID_USE_OF_INTERNAL_FUNCTION.code,message:"Options must be passed to basicComponentVerification function."}))}}},{"./braintree-error":149,"./errors":159}],148:[function(e,t,n){"use strict";var r=e("./once");function i(e,t){0===e.length?(e(),t(null)):e(t)}t.exports=function(e,t){var n,o=e.length,a=o,s=r(t);if(0!==o)for(n=0;n<o;n++)i(e[n],c);else s(null);function c(e){e?s(e):0==(a-=1)&&s(null)}}},{"./once":182}],149:[function(e,t,n){"use strict";var r=e("./enumerate");function i(e){if(!i.types.hasOwnProperty(e.type))throw new Error(e.type+" is not a valid type.");if(!e.code)throw new Error("Error code required.");if(!e.message)throw new Error("Error message required.");
2this.name="BraintreeError",this.code=e.code,this.message=e.message,this.type=e.type,this.details=e.details}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.types=r(["CUSTOMER","MERCHANT","NETWORK","INTERNAL","UNKNOWN"]),i.findRootError=function(e){return e instanceof i&&e.details&&e.details.originalError?i.findRootError(e.details.originalError):e},t.exports=i},{"./enumerate":158}],150:[function(e,t,n){"use strict";var r="3.143.0",i="web";t.exports={ANALYTICS_PREFIX:i+".",ANALYTICS_REQUEST_TIMEOUT_MS:2e3,ANALYTICS_URL:"https://www.paypal.com/xoplatform/logger/api/logger",ASSETS_URLS:{production:"https://assets.braintreegateway.com",sandbox:"https://assets.braintreegateway.com"},CLIENT_API_URLS:{production:"https://api.braintreegateway.com:443",sandbox:"https://api.sandbox.braintreegateway.com:443"},FRAUDNET_SOURCE:"BRAINTREE_SIGNIN",FRAUDNET_FNCLS:"fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99",FRAUDNET_URL:"https://c.paypal.com/da/r/fb.js",BUS_CONFIGURATION_REQUEST_EVENT:"BUS_CONFIGURATION_REQUEST",GRAPHQL_URLS:{production:"https://payments.braintree-api.com/graphql",sandbox:"https://payments.sandbox.braintree-api.com/graphql"},INTEGRATION_TIMEOUT_MS:6e4,VERSION:r,INTEGRATION:"custom",SOURCE:"client",PLATFORM:i,BRAINTREE_LIBRARY_VERSION:"braintree/web/"+r,ALLOWED_EXTRA_EVENT_FIELDS:["context_id","context_type","payment_ready_button_order","payment_ready_experiment_type","payment_ready_page_type","payment_ready_session_id","button_type","connect_start_time","domain","endpoint","end_time","request_start_time","start_time"]}},{}],151:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./errors");t.exports=function(e,t){t.forEach(function(t){e[t]=function(){throw new r({type:i.METHOD_CALLED_AFTER_TEARDOWN.type,code:i.METHOD_CALLED_AFTER_TEARDOWN.code,message:t+" cannot be called after teardown."})}})}},{"./braintree-error":149,"./errors":159}],152:[function(e,t,n){"use strict";var r=e("./braintree-error");t.exports=function(e,t){return e instanceof r?e:new r({type:t.type,code:t.code,message:t.message,details:{originalError:e}})}},{"./braintree-error":149}],153:[function(e,t,n){"use strict";var r=e("./constants").ASSETS_URLS;t.exports={create:function(e){return r.production}}},{"./constants":150}],154:[function(e,t,n){"use strict";var r=e("../lib/vendor/polyfill").atob,i=e("../lib/constants").CLIENT_API_URLS;t.exports=function(e){var t,n,o,a,s={attrs:{},configUrl:""};return/^[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9_]+$/.test(e)?(o=e.split("_"),a=o[0],n={merchantId:o.slice(2).join("_"),environment:a},s.environment=n.environment,s.attrs.tokenizationKey=e,s.configUrl=i[n.environment]+"/merchants/"+n.merchantId+"/client_api/v1/configuration"):(t=JSON.parse(r(e)),s.environment=t.environment,s.attrs.authorizationFingerprint=t.authorizationFingerprint,s.configUrl=t.configUrl,s.graphQL=t.graphQL),s}},{"../lib/constants":150,"../lib/vendor/polyfill":188}],155:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./assets"),o=e("./errors"),a="3.143.0";t.exports={create:function(e){var t=Promise.resolve();return e.client?Promise.resolve(e.client):(window.braintree&&window.braintree.client||(t=i.loadScript({src:e.assetsUrl+"/web/"+a+"/js/client.min.js"}).catch(function(e){return Promise.reject(new r({type:o.CLIENT_SCRIPT_FAILED_TO_LOAD.type,code:o.CLIENT_SCRIPT_FAILED_TO_LOAD.code,message:o.CLIENT_SCRIPT_FAILED_TO_LOAD.message,details:{originalError:e}}))})),t.then(function(){return window.braintree.client.VERSION!==a?Promise.reject(new r({type:o.INCOMPATIBLE_VERSIONS.type,code:o.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+window.braintree.client.VERSION+") and "+e.name+" (version "+a+") components must be from the same SDK version."})):window.braintree.client.create({authorization:e.authorization,debug:e.debug})}))}}},{"./assets":145,"./braintree-error":149,"./errors":159}],156:[function(e,t,n){"use strict";t.exports=function(e){return function(){var t=arguments;setTimeout(function(){e.apply(null,t)},1)}}},{}],157:[function(e,t,n){"use strict";var r=e("./batch-execute-functions");function i(){this._teardownRegistry=[],this._isTearingDown=!1}i.prototype.registerFunctionForTeardown=function(e){"function"==typeof e&&this._teardownRegistry.push(e)},i.prototype.teardown=function(e){this._isTearingDown?e(new Error("Destructor is already tearing down")):(this._isTearingDown=!0,r(this._teardownRegistry,function(t){this._teardownRegistry=[],this._isTearingDown=!1,"function"==typeof e&&e(t)}.bind(this)))},t.exports=i},{"./batch-execute-functions":148}],158:[function(e,t,n){"use strict";
2t.exports=function(e,t){return t=null==t?"":t,e.reduce(function(e,n){return e[n]=t+n,e},{})}},{}],159:[function(e,t,n){"use strict";var r=e("./braintree-error");t.exports={INVALID_USE_OF_INTERNAL_FUNCTION:{type:r.types.INTERNAL,code:"INVALID_USE_OF_INTERNAL_FUNCTION"},INSTANTIATION_OPTION_REQUIRED:{type:r.types.MERCHANT,code:"INSTANTIATION_OPTION_REQUIRED"},INCOMPATIBLE_VERSIONS:{type:r.types.MERCHANT,code:"INCOMPATIBLE_VERSIONS"},CLIENT_SCRIPT_FAILED_TO_LOAD:{type:r.types.NETWORK,code:"CLIENT_SCRIPT_FAILED_TO_LOAD",message:"Braintree client script could not be loaded."},METHOD_CALLED_AFTER_TEARDOWN:{type:r.types.MERCHANT,code:"METHOD_CALLED_AFTER_TEARDOWN"},INSTANTIATION_OPTION_INVALID:{type:r.types.MERCHANT,code:"INSTANTIATION_OPTION_INVALID"}}},{"./braintree-error":149}],160:[function(e,t,n){"use strict";t.exports=function(e){for(;e.parentNode;)e=e.parentNode;return e}},{}],161:[function(e,t,n){"use strict";t.exports=function(e,t,n){var r;for(r=0;r<e.length;r++)if(e[r].hasOwnProperty(t)&&e[r][t]===n)return e[r];return null}},{}],162:[function(e,t,n){"use strict";var r=e("./strategies/popup"),i=e("./strategies/popup-bridge"),o=e("./strategies/modal"),a=e("framebus"),s=e("../shared/events"),c=e("../shared/errors"),d=e("../shared/constants"),l=e("@braintree/uuid"),u=e("@braintree/iframer"),p=e("../../braintree-error"),_=e("../shared/browser-detection"),E=e("./../../assign").assign,m=e("../../constants").BUS_CONFIGURATION_REQUEST_EVENT,h=["name","dispatchFrameUrl","openFrameUrl"];function f(){}function A(e){(function(e){if(!e)throw new Error("Valid configuration is required");if(h.forEach(function(t){if(!e.hasOwnProperty(t))throw new Error("A valid frame "+t+" must be provided")}),!/^[\w_]+$/.test(e.name))throw new Error("A valid frame name must be provided")})(e),this._serviceId=l().replace(/-/g,""),this._options={name:e.name+"_"+this._serviceId,dispatchFrameUrl:e.dispatchFrameUrl,openFrameUrl:e.openFrameUrl,height:e.height,width:e.width,top:e.top,left:e.left},this.state=e.state||{},this._bus=new a({channel:this._serviceId}),this._setBusEvents()}A.prototype.initialize=function(e){var t=function(){e(),this._bus.off(s.DISPATCH_FRAME_READY,t)}.bind(this);this._bus.on(s.DISPATCH_FRAME_READY,t),this._writeDispatchFrame()},A.prototype._writeDispatchFrame=function(){var e=d.DISPATCH_FRAME_NAME+"_"+this._serviceId,t=this._options.dispatchFrameUrl;this._dispatchFrame=u({"aria-hidden":!0,name:e,title:e,src:t,class:d.DISPATCH_FRAME_CLASS,height:0,width:0,style:{position:"absolute",left:"-9999px"}}),document.body.appendChild(this._dispatchFrame)},A.prototype._setBusEvents=function(){this._bus.on(s.DISPATCH_FRAME_REPORT,function(e,t){this._onCompleteCallback&&this._onCompleteCallback.call(null,e.err,e.payload),this._frame.close(),this._onCompleteCallback=null,t&&t()}.bind(this)),this._bus.on(m,function(e){e(this.state)}.bind(this))},A.prototype.open=function(e,t){if(e=e||{},this._frame=this._getFrameForEnvironment(e),this._frame.initialize(t),!(this._frame instanceof i)){if(E(this.state,e.state),this._onCompleteCallback=t,this._frame.open(),this.isFrameClosed())return this._cleanupFrame(),void(t&&t(ne
2w p(c.FRAME_SERVICE_FRAME_OPEN_FAILED)));this._pollForPopupClose()}},A.prototype.redirect=function(e){this._frame&&!this.isFrameClosed()&&this._frame.redirect(e)},A.prototype.close=function(){this.isFrameClosed()||this._frame.close()},A.prototype.focus=function(){this.isFrameClosed()||this._frame.focus()},A.prototype.createHandler=function(e){return e=e||{},{close:function(){e.beforeClose&&e.beforeClose(),this.close()}.bind(this),focus:function(){e.beforeFocus&&e.beforeFocus(),this.focus()}.bind(this)}},A.prototype.createNoopHandler=function(){return{close:f,focus:f}},A.prototype.teardown=function(){this.close(),this._dispatchFrame.parentNode.removeChild(this._dispatchFrame),this._dispatchFrame=null,this._cleanupFrame()},A.prototype.isFrameClosed=function(){return null==this._frame||this._frame.isClosed()},A.prototype._cleanupFrame=function(){this._frame=null,clearInterval(this._popupInterval),this._popupInterval=null},A.prototype._pollForPopupClose=function(){return this._popupInterval=setInterval(function(){this.isFrameClosed()&&(this._cleanupFrame(),this._onCompleteCallback&&this._onCompleteCallback(new p(c.FRAME_SERVICE_FRAME_CLOSED)))}.bind(this),d.POPUP_POLL_INTERVAL),this._popupInterval},A.prototype._getFrameForEnvironment=function(e){var t=_.supportsPopups(),n=Boolean(window.popupBridge),a=E({},this._options,e);return n?new i(a):t?new r(a):new o(a)},t.exports=A},{"../../braintree-error":149,"../../constants":150,"../shared/browser-detection":169,"../shared/constants":170,"../shared/errors":171,"../shared/events":172,"./../../assign":146,"./strategies/modal":164,"./strategies/popup":167,"./strategies/popup-bridge":165,"@braintree/iframer":35,"@braintree/uuid":39,framebus:54}],163:[function(e,t,n){"use strict";var r=e("./frame-service");t.exports={create:function(e,t){var n=new r(e);n.initialize(function(){t(n)})}}},{"./frame-service":162}],164:[function(e,t,n){"use strict";var r=e("@braintree/iframer"),i=e("../../../assign").assign,o=e("../../shared/browser-detection"),a={position:"fixed",top:0,left:0,bottom:0,padding:0,margin:0,border:0,outline:"none",zIndex:20001,background:"#FFFFFF"};function s(){}function c(e){this._closed=null,this._frame=null,this._options=e||{},this._container=this._options.container||document.body}c.prototype.initialize=s,c.prototype.open=function(){var e={src:this._options.openFrameUrl,name:this._options.name,scrolling:"yes",height:"100%",width:"100%",style:i({},a),title:"Lightbox Frame"};o.isIos()?(o.isIosWKWebview()&&(this._lockScrolling(),e.style={}),this._el=document.createElement("div"),i(this._el.style,a,{height:"100%",width:"100%",overflow:"auto","-webkit-overflow-scrolling":"touch"}),this._frame=r(e),this._el.appendChild(this._frame)):this._el=this._frame=r(e),this._closed=!1,this._container.appendChild(this._el)},c.prototype.focus=s,c.prototype.close=function(){this._container.removeChild(this._el),this._frame=null,this._closed=!0,o.isIosWKWebview()&&this._unlockScrolling()},c.prototype.isClosed=function(){return Boolean(this._closed)},c.prototype.redirect=function(e){this._frame.src=e},c.prototype._unlockScrolling=function(){document.body.style.overflow=this._savedBodyProperties.overflowStyle,document.body.style.position=this._savedBodyProperties.positionStyle,window.scrollTo(this._savedBodyProperties.left,this._savedBodyProperties.top),delete this._savedBodyProperties},c.prototype._lockScrolling=function(){var e=document.documentElement;this._savedBodyProperties={left:(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0),top:(window.pageYOffset||e.scrollTop)-(e.clientTop||0),overflowStyle:document.body.style.overflow,positionStyle:document.body.style.position},document.body.style.overflow="hidden",document.body.style.position="fixed",window.scrollTo(0,0)},t.exports=c},{"../../../assign":146,"../../shared/browser-detection":169,"@braintree/iframer":35}],165:[function(e,t,n){"use strict";var r=e("../../../braintree-error"),i=e("../../shared/errors");function o(){}function a(e){this._closed=null,this._options=e}a.prototype.initialize=function(e){var t=this;window.popupBridge.onComplete=function(n,o){var a=!o&&!n;t._closed=!0,n||a?e(new r(i.FRAME_SERVICE_FRAME_CLOSED)):e(null,o)}},a.prototype.open=function(e){var t;t=(e=e||{}).openFrameUrl||this._options.openFrameUrl,this._closed=!1,window.popupBridge.open(t)}
2,a.prototype.focus=o,a.prototype.close=o,a.prototype.isClosed=function(){return Boolean(this._closed)},a.prototype.redirect=function(e){this.open({openFrameUrl:e})},t.exports=a},{"../../../braintree-error":149,"../../shared/errors":171}],166:[function(e,t,n){"use strict";var r=e("../../../shared/constants"),i=e("./position");function o(e,t,n){return void 0!==t?t:i[e](n)}t.exports=function(e){var t=e.height||r.DEFAULT_POPUP_HEIGHT,n=e.width||r.DEFAULT_POPUP_WIDTH,i=o("top",e.top,t),a=o("left",e.left,n);return[r.POPUP_BASE_OPTIONS,"height="+t,"width="+n,"top="+i,"left="+a].join(",")}},{"../../../shared/constants":170,"./position":168}],167:[function(e,t,n){"use strict";var r=e("./compose-options");function i(e){this._frame=null,this._options=e||{}}i.prototype.initialize=function(){},i.prototype.open=function(){this._frame=window.open(this._options.openFrameUrl,this._options.name,r(this._options))},i.prototype.focus=function(){this._frame.focus()},i.prototype.close=function(){this._frame.closed||this._frame.close()},i.prototype.isClosed=function(){return!this._frame||Boolean(this._frame.closed)},i.prototype.redirect=function(e){this._frame.location.href=e},t.exports=i},{"./compose-options":166}],168:[function(e,t,n){"use strict";function r(e,t,n){return(e-t)/2+n}t.exports={top:function(e){return r(window.outerHeight||document.documentElement.clientHeight,e,null==window.screenY?window.screenTop:window.screenY)},left:function(e){return r(window.outerWidth||document.documentElement.clientWidth,e,null==window.screenX?window.screenLeft:window.screenX)},center:r}},{}],169:[function(e,t,n){"use strict";t.exports={isIos:e("@braintree/browser-detection/is-ios"),isIosWKWebview:e("@braintree/browser-detection/is-ios-wkwebview"),supportsPopups:e("@braintree/browser-detection/supports-popups")}},{"@braintree/browser-detection/is-ios":30,"@braintree/browser-detection/is-ios-wkwebview":29,"@braintree/browser-detection/supports-popups":32}],170:[function(e,t,n){"use strict";t.exports={DISPATCH_FRAME_NAME:"dispatch",DISPATCH_FRAME_CLASS:"braintree-dispatch-frame",POPUP_BASE_OPTIONS:"resizable,scrollbars",DEFAULT_POPUP_WIDTH:450,DEFAULT_POPUP_HEIGHT:535,POPUP_POLL_INTERVAL:100,POPUP_CLOSE_TIMEOUT:100}},{}],171:[function(e,t,n){"use strict";var r=e("../../braintree-error");t.exports={FRAME_SERVICE_FRAME_CLOSED:{type:r.types.INTERNAL,code:"FRAME_SERVICE_FRAME_CLOSED",message:"Frame closed before tokenization could occur."},FRAME_SERVICE_FRAME_OPEN_FAILED:{type:r.types.INTERNAL,code:"FRAME_SERVICE_FRAME_OPEN_FAILED",message:"Frame failed to open."}}},{"../../braintree-error":149}],172:[function(e,t,n){"use strict";var r=e("../../enumerate");t.exports=r(["DISPATCH_FRAME_READY","DISPATCH_FRAME_REPORT"],"frameService:")},{"../../enumerate":158}],173:[function(e,t,n){"use strict";var r="3.143.0",i=e("./assign").assign;function o(e,t){var n=e.analyticsMetadata,o={gateway:"braintree","braintree:merchantId":e.gatewayConfiguration.merchantId,"braintree:apiVersion":"v1","braintree:sdkVersion":r,"braintree:metadata":JSON.stringify({source:n.source,integration:n.integration,sessionId:n.sessionId,version:r,platform:n.platform})};return i({},o,t)}t.exports=function(e,t,n){var r,i,a=e.gatewayConfiguration.androidPay,s="production"===e.gatewayConfiguration.environment?"PRODUCTION":"TEST";return 2===t?(r={apiVersion:2,apiVersionMinor:0,environment:s,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:a.supportedNetworks.map(function(e){return e.toUpperCase()})},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:o(e,{"braintree:authorizationFingerprint":a.googleAuthorizationFingerprint})}}]},n&&(r.merchantInfo={merchantId:n}),a.paypalClientId&&(i={type:"PAYPAL",parameters:{purchase_context:{purchase_units:[{payee:{client_id:a.paypalClientId},recurring_payment:!0}]}},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:o(e,{"braintree:paypalClientId":a.paypalClientId})}},r.allowedPaymentMethods.push(i))):(r={environment:s,allowedPaymentMethods:["CARD","TOKENIZED_CARD"],paymentMethodTokenizationParameters:{tokenizationType:"PAYMENT_GATEWAY",parameters:o(e,{"braintree:authorizationFingerprint":a.googleAuthorizationFingerprint})},cardRequirements:{allowedCardNetworks:a.supportedNetworks.map(function(e){return e.toUpperCase()})}},"TOKENIZATION_KEY"===e.authorizationType&&(r.paymentMethodTokenizationParameters.parameters["braintree:clientKey"]=e.authorization),n&&(r.merchantId=n),t&&(r.apiVersion=t)),r}},{"./assign":146}],174:[function(e,t,n){"use strict";
2t.exports=function(e,t){var n,r;for(t=t||[],n=0;n<t.length;n++)if(r=t[n],!e.hasOwnProperty(r))return!0;return!1}},{}],175:[function(e,t,n){"use strict";t.exports=function(e){e=e||window;try{return e.self!==e.top}catch(e){return!0}}},{}],176:[function(e,t,n){"use strict";function r(e){var t=e.split("-");return new Date(t[0],t[1],t[2])}t.exports=function(e,t){return r(e)<=r(t)}},{}],177:[function(e,t,n){"use strict";t.exports=function(e){return e&&e.hasOwnProperty("fastlane")&&e.fastlane}},{}],178:[function(e,t,n){"use strict";t.exports={isHTTPS:function(e){return"https:"===(e||window.location.protocol)}}},{}],179:[function(e,t,n){"use strict";var r,i={"paypal.com":1,"braintreepayments.com":1,"braintreegateway.com":1,"braintree-api.com":1};t.exports=function(e){var t;return e=e.toLowerCase(),!!/^https:/.test(e)&&((r=r||document.createElement("a")).href=e,t=r.hostname.split(".").slice(-2).join("."),i.hasOwnProperty(t))}},{}],180:[function(e,t,n){"use strict";t.exports=function(e){return JSON.parse(JSON.stringify(e))}},{}],181:[function(e,t,n){"use strict";t.exports=function(e){return Object.keys(e).filter(function(t){return"function"==typeof e[t]})}},{}],182:[function(e,t,n){"use strict";t.exports=function(e){var t=!1;return function(){t||(t=!0,e.apply(null,arguments))}}},{}],183:[function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&"[object Array]"===Object.prototype.toString.call(e)||!1}function i(e){return e=e||window.location.href,/\?/.test(e)}function o(e,t){var n,i,a,s=[];for(a in e)e.hasOwnProperty(a)&&(i=e[a],n=t?r(e)?t+"[]":t+"["+a+"]":a,"object"==typeof i?s.push(o(i,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(i)));return s.join("&")}t.exports={parse:function(e){return i(e=e||window.location.href)?(e.split("?")[1]||"").replace(/#.*$/,"").split("&").reduce(function(e,t){var n=t.split("="),r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]);return e[r]=i,e},{}):{}},stringify:o,queryify:function(e,t){return e=e||"",null!=t&&"object"==typeof t&&function(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}(t)&&(e+=-1===e.indexOf("?")?"?":"",e+=-1!==e.indexOf("=")?"&":"",e+=o(t)),e},hasQueryParams:i}},{}],184:[function(e,t,n){"use strict";var r=e("@braintree/uuid"),i=e("./find-root-node");function o(e){return"[object ShadowRoot]"===(e=i(e)).toString()}function a(e){return o(e=i(e))?e.host:null}t.exports={isShadowElement:o,getShadowHost:a,transformToSlot:function e(t,n){var s=i(t).querySelector("style"),c=a(t),d="shadow-slot-"+r(),l=document.createElement("slot"),u=document.createElement("div");return l.setAttribute("name",d),t.appendChild(l),u.setAttribute("slot",d),c.appendChild(u),n&&(s||(s=document.createElement("style"),t.appendChild(s)),s.sheet.insertRule('::slotted([slot="'+d+'"]) { '+n+" }")),o(c)?e(u,n):u}}},{"./find-root-node":160,"@braintree/uuid":39}],185:[function(e,t,n){"use strict";t.exports=function(e){return-1===e.indexOf("_")?e:e.toLowerCase().replace(/(\_\w)/g,function(e){return e[1].toUpperCase()})}},{}],186:[function(e,t,n){"use strict";var r=e("./querystring");t.exports={getUrlParams:function(){var e=window.location.href;try{window.top&&window.top!==window&&window.top.location&&(e=window.top.location.href)}catch(e){}return r.parse(e)}}},{"./querystring":183}],187:[function(e,t,n){"use strict";t.exports=function(e){return e?"":".min"}},{}],188:[function(e,t,n){"use strict";var r="function"==typeof atob?atob:i;function i(e){var t,n,r,i,o,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="";if(!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})([=]{1,2})?$/.test(e))throw new Error("Non base64 encoded input passed to window.atob polyfill");a=0;do{t=(63&s.indexOf(e.charAt(a++)))<<2|(i=s.indexOf(e.charAt(a++)))>>4&3,n=(15&i)<<4|(o=s.indexOf(e.charAt(a++)))>>2&15,r=(3&o)<<6|63&s.indexOf(e.charAt(a++)),c+=String.fromCharCode(t)+(n?String.fromCharCode(n):"")+(r?String.fromCharCode(r):"")}while(a<e.length);return c}t.exports={atob:function(e){return r.call(window,e)},_atob:i}},{}],189:[function(e,t,n){"use strict";
2t.exports={REQUIRED_OPTIONS_FOR_START_PAYMENT:["givenName","surname","currencyCode","paymentType","amount","fallback"],REQUIRED_OPTIONS_FOR_PAY_UPON_INVOICE_PAYMENT_TYPE:["givenName","surname","currencyCode","onPaymentStart","paymentType","amount","address","billingAddress","birthDate","email","locale","customerServiceInstructions","correlationId","phone","phoneCountryCode","lineItems"],REQUIRED_OPTIONS_FOR_ADDRESS:["streetAddress","locality","postalCode","countryCode"],REQUIRED_OPTIONS_FOR_LINE_ITEMS:["category","name","quantity","unitAmount","unitTaxAmount"],REQUIRED_OPTIONS_FOR_BLIK_SEAMLESS_PAYMENT_TYPE:["givenName","surname","currencyCode","paymentType","amount"],REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_LEVEL_0:["authCode"],REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_FIRST:["authCode","consumerReference","aliasLabel"],REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_SUBSEQUENT:["consumerReference","aliasKey"]}},{}],190:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error"),i=e("../shared/errors");t.exports=function(e,t){var n,o;if(!e||"string"!=typeof e||!/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(e))throw new r(i.LOCAL_PAYMENT_QR_CODE_INVALID_DATA);if("string"==typeof t){if(!(n=document.querySelector(t)))throw new r({type:r.types.MERCHANT,code:"LOCAL_PAYMENT_QR_CODE_CONTAINER_NOT_FOUND",message:"QR code container element not found: "+t})}else{if(!t||t.nodeType!==Node.ELEMENT_NODE)throw new r(i.LOCAL_PAYMENT_QR_CODE_INVALID_CONTAINER);n=t}return n.innerHTML="",(o=document.createElement("img")).src="data:image/png;base64,"+e,o.alt="QR Code for payment",o.style.display="block",o.style.maxWidth="100%",o.style.height="auto",n.appendChild(o),o}},{"../../lib/braintree-error":149,"../shared/errors":194}],191:[function(e,t,n){"use strict";var r=e("../../lib/frame-service/external"),i=e("../../lib/braintree-error"),o=e("../../lib/use-min"),a=e("../../lib/constants").INTEGRATION_TIMEOUT_MS,s=e("../../lib/analytics"),c=e("../../lib/methods"),d=e("../../lib/convert-methods-to-error"),l=e("../../lib/convert-to-braintree-error"),u=e("@braintree/extended-promise"),p=e("../../lib/querystring"),_=e("@braintree/wrap-promise"),E=e("./constants"),m=e("../shared/errors"),h=e("../../lib/assign").assign,f=e("../../lib/in-iframe"),A=e("../shared/browser-detection"),y=e("./inject-qr-code");function I(e){this._client=e.client,this._assetsUrl=e.client.getConfiguration().gatewayConfiguration.assetsUrl+"/web/3.143.0",this._isDebug=e.client.getConfiguration().isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/local-payment-landing-frame"+o(this._isDebug)+".html",this._authorizationInProgress=!1,this._paymentType="unknown",this._merchantAccountId=e.merchantAccountId,e.redirectUrl&&(this._redirectUrl=e.redirectUrl,this._isRedirectFlow=!0)}function T(e){var t=e.blikOptions||{},n="string"==typeof e.paymentType?e.paymentType.toLowerCase():e.paymentType;return"blik"===n?t.hasOwnProperty("level_0")||t.hasOwnProperty("oneClick"):!("swish"!==n||!e.swishOptions||!e.swishOptions.requestQrCode)||["pay_upon_invoice","mbway","bancomatpay"].includes(n)}function P(e){var t,n;for(t=0;t<E.REQUIRED_OPTIONS_FOR_ADDRESS.length;t++)if(n=E.REQUIRED_OPTIONS_FOR_ADDRESS[t],!e.hasOwnProperty(n))return n;return!1}function N(e){var t,n,r,i;for(n=0;n<e.length;n++)for(r=e[n],t=0;t<E.REQUIRED_OPTIONS_FOR_LINE_ITEMS.length;t++)if(i=E.REQUIRED_OPTIONS_FOR_LINE_ITEMS[t],!r.hasOwnProperty(i))return i;return!1}function O(e){var t,n,r,i,o;if(!e)return!0;if("crypto"===(o=e.paymentType||"").toLowerCase())return function(e){return!(e.cryptoOptions||{}).approvalUrl&&"cryptoOptions.approvalUrl"}(e);if("swish"===o.toLowerCase())return function(e){var t,n,r=e.swishOptions||{},i=["givenName","surname","currencyCode","paymentType","amount"];for(t=0;t<i.length;t++)if(n=i[t],!e.hasOwnProperty(n))return n;return r.requestQrCode&&!r.qrContainer?"swishOptions.qrContainer":!(r.requestQrCode||r.returnUrl||e.redirectUrl||!A.isMobileDevice())&&"swishOptions.returnUrl"}(e);if(T(e)){if("pay_upon_invoice"===o.toLowerCase())for(t=0;t<E.REQUIRED_OPTIONS_FOR_PAY_UPON_INVOICE_PAYMENT_TYPE.length;t++){if(n=E.REQUIRED_OPTIONS_FOR_PAY_UPON_INVOICE_PAYMENT_TYPE[t],!e.hasOwnProperty(n))return n;if("address"===n||"billingAddress"===n){if(r=P(e[n]))return n+"."+r}else if("lineItems"===n&&(i=N(e[n])))return n+"."+i}else if("blik"===o.toLowerCase())return function(e){var t,n,r,i=e.blikOptions||{};for(e.redirectUrl||E.REQUIRED_OPTIONS_FOR_BLIK_SEAMLESS_PAYMENT_TYPE.push("onPaymentStart"),t=0;t<E.REQUIRED_OPTIONS_FOR_BLIK_SEAMLESS_PAYMENT_TYPE.length;t++)if(n=E.REQUIRED_OPTIONS_FOR_BLIK_SEAMLESS_PAYMENT_TYPE[t],!e.hasOwnProperty(n))return n;if(i.hasOwnProperty("level_0")){for(t=0;t<E.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_LEVEL_0.length;t++)if(n=E.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_LEVEL_0[t],!i.level_0.hasOwnProperty(n))return"blikOptions.level_0."+n}else if(i.hasOwnProperty("oneClick"))if((r=i.oneClick||{}).hasOwnProperty("aliasKey")){for(t=0;t<E.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_SUBSEQUENT.length;t++)if(n=E.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_SUBSEQUENT[t],!r.hasOwnProperty(n))return"blikOptions.oneClick."+n}else for(t=0;t<E.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_FIRST.length;t++)if(n=E.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_FIRST[t],!r.hasOwnProperty(n))return"blikOptions.oneClick."+n;return!1}(e)}else{for(e.redirectUrl||E.REQUIRED_OPTIONS_FOR_START_PAYMENT.push("onPaymentStart"),t=0;t<E.REQUIRED_OPTIONS_FOR_START_PAYMENT.length;t++)if(n=E.REQUIRED_OPTIONS_FOR_START_PAYMENT[t],!e.hasOwnProperty(n))return n;if(!e.fallback.url)return"fallback.url";if(!e.fallback.buttonText)return"fallback.buttonText";if(!0===e.recurrent&&!e.customerId)return"customerId"}return!1}u.suppressUnhandledPromiseMessage=!0,I.prototype._initialize=function(){var e=this,t=this._client,n=setTimeout(function(){s.sendEvent(t,"local-payment.load.timed-out")},a);return new Promise(function(i){r.create({name:"localpaymentlandingpage",dispatchFrameUrl:e._assetsUrl+"/html/dispatch-frame"+o(e._isDebug)+".html",openFrameUrl:e._loadingFrameUrl},function(r){e._frameService=r,clearTimeout(n),s.sendEvent(t,"local-payment.load.succeeded"),i(e)})})},I.prototype.startPayment=function(e){var t,n,r,a,c,d,_,E,f,I,P,N,g=this;if(g._isRedirectFlow?e.redirectUrl=g._redirectUrl:I=g._frameService._serviceId,t=O(e))return n=new i(m.LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION),"string"==typeof t&&(n.details="Missing required '"+t+"' option."),Promise.reject(n);if(e.paymentType&&"swish"===e.paymentType.toLowerCase()&&e.swishOptions&&e.swishOptions.requestQrCode){if(A.isMobileDevice()
2)return Promise.reject(new i(m.LOCAL_PAYMENT_QR_CODE_NOT_SUPPORTED));if(!e.swishOptions.qrContainer)return Promise.reject(new i(m.LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION))}return E=e.windowOptions||{},r=e.address||{},a=e.fallback||{},_=e.billingAddress||{},c={amount:e.amount,billingAddress:{line1:_.streetAddress,line2:_.extendedAddress,city:_.locality,state:_.region,postalCode:_.postalCode,countryCode:_.countryCode},birthDate:e.birthDate,blikOptions:e.blikOptions,city:r.locality,correlationId:e.correlationId,countryCode:r.countryCode,currencyIsoCode:e.currencyCode,discountAmount:e.discountAmount,experienceProfile:{brandName:e.displayName,customerServiceInstructions:e.customerServiceInstructions,locale:e.locale,noShipping:!e.shippingAddressRequired},firstName:e.givenName,fundingSource:e.paymentType,intent:"sale",lastName:e.surname,line1:r.streetAddress,line2:r.extendedAddress,lineItems:e.lineItems,merchantAccountId:g._merchantAccountId,merchantOrPartnerCustomerId:e.customerId,payerEmail:e.email,paymentTypeCountryCode:e.paymentTypeCountryCode,phone:e.phone,phoneCountryCode:e.phoneCountryCode,postalCode:r.postalCode,recurrent:e.recurrent,shippingAmount:e.shippingAmount,state:r.region},g._paymentType=e.paymentType.toLowerCase(),"swish"===g._paymentType&&A.isMobileDevice()&&(c.redirectToApp=!0,g._isRedirectFlow=!0),"crypto"===g._paymentType&&(g._isRedirectFlow=!0),g._isRedirectFlow?"swish"===g._paymentType&&e.swishOptions&&e.swishOptions.returnUrl&&A.isMobileDevice()?(P=p.queryify(e.swishOptions.returnUrl,{wasCanceled:!0}),N=e.swishOptions.returnUrl):(P=p.queryify(g._redirectUrl,{wasCanceled:!0}),N=g._redirectUrl):(P=p.queryify(g._assetsUrl+"/html/local-payment-redirect-frame"+o(g._isDebug)+".html",{channel:I,r:a.cancelUrl||a.url,t:a.cancelButtonText||a.buttonText,c:1}),N=p.queryify(g._assetsUrl+"/html/local-payment-redirect-frame"+o(g._isDebug)+".html",{channel:I,r:a.url,t:a.buttonText})),h(c,{cancelUrl:P,returnUrl:N}),g._authorizationInProgress&&!g._isRedirectFlow?(s.sendEvent(g._client,g._paymentType+".local-payment.start-payment.error.already-opened"),Promise.reject(new i(m.LOCAL_PAYMENT_ALREADY_IN_PROGRESS))):(g._authorizationInProgress=!0,d=new u,T(e)||g._isRedirectFlow||(g._startPaymentCallback=g._createStartPaymentCallback(function(e){d.resolve(e)},function(e){d.reject(e)}),g._frameService.open({width:E.width||1282,height:E.height||720},g._startPaymentCallback)),"crypto"===g._paymentType?(s.sendEvent(g._client,g._paymentType+".local-payment.start-payment.redirected"),g._redirectToPaymentResource(e.cryptoOptions.approvalUrl),d.resolve(),d):(g._client.request({method:"post",endpoint:"local_payments/create",data:c}).then(function(t){var n=t.paymentResource.redirectUrl;if(g._isRedirectFlow?s.sendEvent(g._client,g._paymentType+".local-payment.start-payment.redirected"):s.sendEvent(g._client,g._paymentType+".local-payment.start-payment.opened"),g._startPaymentOptions=e,function(e,t,n){return!!("swish"===n&&e.swishOptions&&e.swishOptions.requestQrCode&&t.paymentResource.qrDetails&&t.paymentResource.qrDetails.qrImage)}(e,t,g._paymentType)){g._authorizationInProgress=!1;try{y(t.paymentResource.qrDetails.qrImage,e.swishOptions.qrContainer)}catch(e){return d.reject(e)}"function"==typeof e.onPaymentStart&&(f=e.onPaymentStart({paymentId:t.paymentResource.paymentToken}))instanceof Promise?f.then(function(){d.resolve()}).catch(function(e){d.reject(e)}):d.resolve()}else T(e)?(g._authorizationInProgress=!1,"string"==typeof n&&n.length?d.reject(new i(m.LOCAL_PAYMENT_START_PAYMENT_DEFERRED_PAYMENT_FAILED)):(f=e.onPaymentStart({paymentId:t.paymentResource.paymentToken}))instanceof Promise?f.then(function(){d.resolve()}).catch(function(e){d.reject(e)}):d.resolve()):"function"==typeof e.onPaymentStart?Promise.resolve(e.onPaymentStart({paymentId:t.paymentResource.paymentToken},function(){g._isRedirectFlow||g._frameService.redirect(n)})).then(function(){g._isRedirectFlow&&(g._redirectToPaymentResource(n),d.resolve())}):g._isRedirectFlow?(g._redirectToPaymentResource(n),d.resolve()):g._isRedirectFlow||g._frameService.redirect(n);return d}).catch(function(e){var t=e.details&&e.details.httpStatus;g._isRedirectFlow||g._frameService.close(),g._authorizationInProgress=!1,422!==t?d.reject(l(e,{type:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.type,code:m.LO
2CAL_PAYMENT_START_PAYMENT_FAILED.code,message:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.message})):d.reject(new i({type:m.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.type,code:m.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.code,message:m.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.message,details:{originalError:e}}))}),d))},I.prototype._redirectToPaymentResource=function(e){f()?window.top.location.href=e:window.location.href=e},I.prototype.tokenize=function(e){var t=this,n=this._client;return(e=e||p.parse()).queryItems&&(e=e.queryItems),e.c||e.wasCanceled?Promise.reject(new i({type:m.LOCAL_PAYMENT_CANCELED.type,code:m.LOCAL_PAYMENT_CANCELED.code,message:m.LOCAL_PAYMENT_CANCELED.message,details:{originalError:{errorcode:e.errorcode,token:e.btLpToken}}})):e.errorcode?Promise.reject(new i({type:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.type,code:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.code,message:m.LOCAL_PAYMENT_START_PAYMENT_FAILED.message,details:{originalError:{errorcode:e.errorcode,token:e.btLpToken}}})):n.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:this._formatTokenizeData(e)}).then(function(e){var r=t._formatTokenizePayload(e);return window.popupBridge?s.sendEvent(n,t._paymentType+".local-payment.tokenization.success-popupbridge"):s.sendEvent(n,t._paymentType+".local-payment.tokenization.success"),r}).catch(function(e){return s.sendEvent(n,t._paymentType+".local-payment.tokenization.failed"),Promise.reject(l(e,{type:m.LOCAL_PAYMENT_TOKENIZATION_FAILED.type,code:m.LOCAL_PAYMENT_TOKENIZATION_FAILED.code,message:m.LOCAL_PAYMENT_TOKENIZATION_FAILED.message}))})},I.prototype.closeWindow=function(){this._authoriztionInProgress&&s.sendEvent(this._client,this._paymentType+".local-payment.start-payment.closed.by-merchant"),this._frameService.close()},I.prototype.focusWindow=function(){this._frameService.focus()},I.prototype._createStartPaymentCallback=function(e,t){var n=this,r=this._client;return function(o,a){if(n._authorizationInProgress=!1,o)if("FRAME_SERVICE_FRAME_CLOSED"===o.code){if(a&&"processing_error"===a.errorcode)return s.sendEvent(r,n._paymentType+".local-payment.failed-in-window"),void t(new i(m.LOCAL_PAYMENT_START_PAYMENT_FAILED));s.sendEvent(r,n._paymentType+".local-payment.tokenization.closed.by-user"),t(new i(m.LOCAL_PAYMENT_WINDOW_CLOSED))}else o.code&&o.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1&&t(new i({code:m.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.code,type:m.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.type,message:m.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.message,details:{originalError:o}}));else a&&(window.popupBridge||n._frameService.redirect(n._loadingFrameUrl),n.tokenize(a).then(e).catch(t).then(function(){n._frameService.close()}))}},I.prototype._formatTokenizePayload=function(e){var t,n={};return e.paypalAccounts&&(n=e.paypalAccounts[0]),t={nonce:n.nonce,details:{},type:n.type},n.details&&(n.details.payerInfo&&(t.details=n.details.payerInfo),n.details.correlationId&&(t.correlationId=n.details.correlationId)),t},I.prototype.hasTokenizationParams=function(){var e=p.parse();return!(!e.errorcode&&!e.token)||Boolean(e.btLpToken&&e.btLpPaymentId&&e.btLpPayerId)},I.prototype._formatTokenizeData=function(e){var t=this._client.getConfiguration().gatewayConfiguration;return{merchantAccountId:this._merchantAccountId,paypalAccount:{correlationId:e.btLpToken||e.token,paymentToken:e.btLpPaymentId||e.paymentId,payerId:e.btLpPayerId||e.PayerID,unilateral:t.paypal.unvettedMerchant,intent:"sale"}}},I.prototype.teardown=function(){var e=this;return e._isRedirectFlow||e._frameService.teardown(),d(e,c(I.prototype)),s.sendEvent(e._client,"local-payment.teardown-completed"),Promise.resolve()},t.exports=_.wrapPrototype(I)},{"../../lib/analytics":144,"../../lib/assign":146,"../../lib/braintree-error":149,"../../lib/constants":150,"../../lib/convert-methods-to-error":151,"../../lib/convert-to-braintree-error":152,"../../lib/frame-service/external":163,"../../lib/in-iframe":175,"../../lib/methods":181,"../../lib/querystring":183,"../../lib/use-min":187,"../shared/browser-detection":193,"../shared/errors":194,"./constants":189,"./inject-qr-code":190,"@braintree/extended-promise":34,"@braintree/wrap-promise":43}],192:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("./external/local-payment"),c=e("@braintree/wrap-promise"),d=e("../lib/braintree-error"),l=e("./shared/errors"),u=e("../lib/querystring").parse;
2t.exports={create:c(function(e){var t="Local Payment";return i.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return o.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:a.create(e.authorization),name:t})}).then(function(t){var n,i,o=t.getConfiguration();return e.client=t,!0!==o.gatewayConfiguration.paypalEnabled?Promise.reject(new d(l.LOCAL_PAYMENT_NOT_ENABLED)):(r.sendEvent(t,"local-payment.initialized"),n=new s(e),e.redirectUrl?(i=u(window.location.href)).token||i.wasCanceled?n.tokenize(i).then(function(e){return n.tokenizePayload=e,n}).catch(function(e){return console.log("Error while tokenizing: ",e),n}):n:n._initialize())})}),VERSION:"3.143.0"}},{"../lib/analytics":144,"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"../lib/querystring":183,"./external/local-payment":191,"./shared/errors":194,"@braintree/wrap-promise":43}],193:[function(e,t,n){"use strict";var r=e("@braintree/browser-detection/is-android"),i=e("@braintree/browser-detection/is-ios");t.exports={isMobileDevice:function(){return r()||i()}}},{"@braintree/browser-detection/is-android":22,"@braintree/browser-detection/is-ios":30}],194:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error");t.exports={LOCAL_PAYMENT_NOT_ENABLED:{type:r.types.MERCHANT,code:"LOCAL_PAYMENT_NOT_ENABLED",message:"LocalPayment is not enabled for this merchant."},LOCAL_PAYMENT_ALREADY_IN_PROGRESS:{type:r.types.MERCHANT,code:"LOCAL_PAYMENT_ALREADY_IN_PROGRESS",message:"LocalPayment payment is already in progress."},LOCAL_PAYMENT_CANCELED:{type:r.types.CUSTOMER,code:"LOCAL_PAYMENT_CANCELED",message:"Customer canceled the LocalPayment before authorizing."},LOCAL_PAYMENT_WINDOW_CLOSED:{type:r.types.CUSTOMER,code:"LOCAL_PAYMENT_WINDOW_CLOSED",message:"Customer closed LocalPayment window before authorizing."},LOCAL_PAYMENT_WINDOW_OPEN_FAILED:{type:r.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:r.types.NETWORK,code:"LOCAL_PAYMENT_START_PAYMENT_FAILED",message:"LocalPayment startPayment failed."},LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION:{type:r.types.MERCHANT,code:"LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION",message:"Missing required option for startPayment."},LOCAL_PAYMENT_START_PAYMENT_DEFERRED_PAYMENT_FAILED:{type:r.types.UNKNOWN,code:"LOCAL_PAYMENT_START_PAYMENT_DEFERRED_PAYMENT_FAILED",message:"LocalPayment startPayment deferred payment failed."},LOCAL_PAYMENT_TOKENIZATION_FAILED:{type:r.types.NETWORK,code:"LOCAL_PAYMENT_TOKENIZATION_FAILED",message:"Could not tokenize user's local payment method."},LOCAL_PAYMENT_INVALID_PAYMENT_OPTION:{type:r.types.MERCHANT,code:"LOCAL_PAYMENT_INVALID_PAYMENT_OPTION",message:"Local payment options are invalid."},LOCAL_PAYMENT_QR_CODE_INVALID_DATA:{type:r.types.MERCHANT,code:"LOCAL_PAYMENT_QR_CODE_INVALID_DATA",message:"QR code data must be a valid base64 string."},LOCAL_PAYMENT_QR_CODE_CONTAINER_NOT_FOUND:{type:r.types.MERCHANT,code:"LOCAL_PAYMENT_QR_CODE_CONTAINER_NOT_FOUND",message:"QR code container element not found."},LOCAL_PAYMENT_QR_CODE_INVALID_CONTAINER:{type:r.types.MERCHANT,code:"LOCAL_PAYMENT_QR_CODE_INVALID_CONTAINER",message:"QR code container must be a valid CSS selector string or HTML element."},LOCAL_PAYMENT_QR_CODE_NOT_SUPPORTED:{type:r.types.MERCHANT,code:"LOCAL_PAYMENT_QR_CODE_NOT_SUPPORTED",message:"QR code is only supported on desktop devices."}}},{"../../lib/braintree-error":149}],195:[function(e,t,n){"use strict";var r=e("../../lib/frame-service/external"),i=e("../../lib/braintree-error"),o=e("../shared/errors"),a=e("../../lib/methods"),s=e("@braintree/wrap-promise"),c=e("../../lib/analytics"),d=e("../../lib/convert-methods-to-error"),l=e("../../lib/convert-to-braintree-error"),u=e("../shared/constants"),p=e("../../lib/constants").INTEGRATION_TIMEOUT_MS;function _(e){var t=e.client.getConfiguration();this._client=e.client,this._assetsUrl=t.gatewayConfiguration.assetsUrl+"/web/3.143.0",this._isDebug=t.isDebug,this._authInProgress=!1,window.popupBridge&&"function"==typeof window.popupBridge.getReturnUrlPrefix?this._callbackUrl=window.popupBridge.getReturnUrlPrefix()+"return":this._callbackUrl=this._assetsUrl+"/html/redirect-frame"+(this._isDebug?"":".min")+".html"}_.prototype._initialize=function(){var e=this;return new Promise(function(t){var n=setTimeout(function(){c.sendEvent(e._client,"masterpass.load.timed-out")},p);r.create({name:u.LANDING_FRAME_NAME,height:u.POPUP_HEIGHT,width:u.POPUP_WIDTH,dispatchFrameUrl:e._assetsUrl+"/html/dispatch-frame"+(e._isDebug?"":".min")+".html",openFrameUrl:e._assetsUrl+"/html/masterpass-landing-frame"+(e._isDebug?"":".min")+".html"},function(r){e._frameService=r,clearTimeout(n),c.sendEvent(e._client,"masterpass.load.succeeded"),t(e)})})},_.prototype.tokenize=function(e){var t=this;return!e||function(e){var t,n;for(t=0;t<u.REQUIRED_OPTIONS_FOR_TOKENIZE.length;t++)if(n=u.REQUIRED_OPTIONS_FOR_TOKENIZE[t],!e.hasOwnProperty(n))return!0;return!1}(e)?Promise.reject(new i(o.MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION)):t._authInProgress?Promise.reject(new i(o.MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS)):new Promise(function(n,r){t._navigateFrameToLoadingPage(e).catch(r),t._frameService.open(e.frameOptions,t._createFrameOpenHandler(n,r))})},_.prototype._navigateFrameToLoadingPage=function(e){var t=this;return this._authInProgress=!0,this._client.request({method:"post",endpoint:"masterpass/request_token",data:{requestToken:{originUrl:window.location.protocol+"//"+window.location.hostname,subtotal:e.subtotal,currencyCode:e.currencyCode,callbackUrl:this._callbackUrl}}}).then(function(n){var r,i=t._assetsUrl+"/html/masterpass-loading-frame"+(t._isDebug?"":".min")+".html?",o=t._client.getConfiguration().gatewayConfiguration,a=e.config||{};r={environment:o.environment,requestToken:n.requestToken,callbackUrl:t._callbackUrl,merchantCheckoutId:o.masterpass.merchantCheckoutId,allowedCardTypes:o.masterpass.supportedNetworks,version:u.MASTERPASS_VERSION}
2,Object.keys(a).forEach(function(e){"function"!=typeof a[e]&&(r[e]=a[e])}),i+=Object.keys(r).map(function(e){return e+"="+r[e]}).join("&"),t._frameService.redirect(i)}).catch(function(e){var n=e.details&&e.details.httpStatus;return t._closeWindow(),422===n?Promise.reject(l(e,o.MASTERPASS_INVALID_PAYMENT_OPTION)):Promise.reject(l(e,o.MASTERPASS_FLOW_FAILED))})},_.prototype._createFrameOpenHandler=function(e,t){var n=this;return window.popupBridge?function(r,a){return n._authInProgress=!1,r?(c.sendEvent(n._client,"masterpass.tokenization.closed-popupbridge.by-user"),void t(l(r,o.MASTERPASS_POPUP_CLOSED))):a.queryItems?void n._tokenizeMasterpass(a.queryItems).then(e).catch(t):(c.sendEvent(n._client,"masterpass.tokenization.failed-popupbridge"),void t(new i(o.MASTERPASS_FLOW_FAILED)))}:function(r,a){if(r)return n._authInProgress=!1,"FRAME_SERVICE_FRAME_CLOSED"===r.code?(c.sendEvent(n._client,"masterpass.tokenization.closed.by-user"),void t(new i(o.MASTERPASS_POPUP_CLOSED))):r.code&&r.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1?(c.sendEvent(n._client,"masterpass.tokenization.failed.to-open"),void t(new i({code:o.MASTERPASS_POPUP_OPEN_FAILED.code,type:o.MASTERPASS_POPUP_OPEN_FAILED.type,message:o.MASTERPASS_POPUP_OPEN_FAILED.message,details:{originalError:r}}))):(c.sendEvent(n._client,"masterpass.tokenization.failed"),n._closeWindow(),void t(l(r,o.MASTERPASS_FLOW_FAILED)));n._tokenizeMasterpass(a).then(e).catch(t)}},_.prototype._tokenizeMasterpass=function(e){var t=this;return"success"!==e.mpstatus?(c.sendEvent(t._client,"masterpass.tokenization.closed.by-user"),t._closeWindow(),Promise.reject(new i(o.MASTERPASS_POPUP_CLOSED))):function(e){return[e.oauth_verifier,e.oauth_token,e.checkout_resource_url].some(function(e){return null==e||"null"===e})}(e)?(c.sendEvent(t._client,"masterpass.tokenization.closed.missing-payload"),t._closeWindow(),Promise.reject(new i(o.MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS))):t._client.request({endpoint:"payment_methods/masterpass_cards",method:"post",data:{masterpassCard:{checkoutResourceUrl:e.checkout_resource_url,requestToken:e.oauth_token,verifierToken:e.oauth_verifier}}}).then(function(e){return t._closeWindow(),window.popupBridge?c.sendEvent(t._client,"masterpass.tokenization.success-popupbridge"):c.sendEvent(t._client,"masterpass.tokenization.success"),e.masterpassCards[0]}).catch(function(e){return t._closeWindow(),window.popupBridge?c.sendEvent(t._client,"masterpass.tokenization.failed-popupbridge"):c.sendEvent(t._client,"masterpass.tokenization.failed"),Promise.reject(l(e,o.MASTERPASS_ACCOUNT_TOKENIZATION_FAILED))})},_.prototype._closeWindow=function(){this._authInProgress=!1,this._frameService.close()},_.prototype.teardown=function(){var e=this;return new Promise(function(t){e._frameService.teardown(),d(e,a(_.prototype)),c.sendEvent(e._client,"masterpass.teardown-completed"),t()})},t.exports=s.wrapPrototype(_)},{"../../lib/analytics":144,"../../lib/braintree-error":149,"../../lib/constants":150,"../../lib/convert-methods-to-error":151,"../../lib/convert-to-braintree-error":152,"../../lib/frame-service/external":163,"../../lib/methods":181,"../shared/constants":198,"../shared/errors":199,"@braintree/wrap-promise":43}],196:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("../lib/basic-component-verification"),o=e("./shared/browser-detection"),a=e("./external/masterpass"),s=e("../lib/create-deferred-client"),c=e("../lib/create-assets-url"),d=e("./shared/errors"),l=e("@braintree/wrap-promise");function u(){return Boolean(window.popupBridge||o.supportsPopups())}t.exports={create:l(function(e){var t="Masterpass";return i.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return u()?Promise.resolve():Promise.reject(new r(d.MASTERPASS_BROWSER_NOT_SUPPORTED))}).then(function(){return s.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:c.create(e.authorization),name:t})}).then(function(t){return e.client=t,e.client.getConfiguration().gatewayConfiguration.masterpass?new a(e)._initialize():Promise.reject(new r(d.MASTERPASS_NOT_ENABLED))})}),isSupported:u,VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./external/masterpass":195,"./shared/browser-detection":197,"./shared/errors":199,"@braintree/wrap-promise":43}],197:[function(e,t,n){"use strict";
2t.exports={supportsPopups:e("@braintree/browser-detection/supports-popups")}},{"@braintree/browser-detection/supports-popups":32}],198:[function(e,t,n){"use strict";t.exports={LANDING_FRAME_NAME:"braintreemasterpasslanding",POPUP_WIDTH:450,POPUP_HEIGHT:660,MASTERPASS_VERSION:"v6",REQUIRED_OPTIONS_FOR_TOKENIZE:["subtotal","currencyCode"]}},{}],199:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error");t.exports={MASTERPASS_BROWSER_NOT_SUPPORTED:{type:r.types.CUSTOMER,code:"MASTERPASS_BROWSER_NOT_SUPPORTED",message:"Browser is not supported."},MASTERPASS_NOT_ENABLED:{type:r.types.MERCHANT,code:"MASTERPASS_NOT_ENABLED",message:"Masterpass is not enabled for this merchant."},MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION:{type:r.types.MERCHANT,code:"MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION",message:"Missing required option for tokenize."},MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS:{type:r.types.MERCHANT,code:"MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS",message:"Masterpass tokenization is already in progress."},MASTERPASS_ACCOUNT_TOKENIZATION_FAILED:{type:r.types.NETWORK,code:"MASTERPASS_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's Masterpass account."},MASTERPASS_POPUP_OPEN_FAILED:{type:r.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:r.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:r.types.CUSTOMER,code:"MASTERPASS_POPUP_CLOSED",message:"Customer closed Masterpass popup before authorizing."},MASTERPASS_INVALID_PAYMENT_OPTION:{type:r.types.MERCHANT,code:"MASTERPASS_INVALID_PAYMENT_OPTION",message:"Masterpass payment options are invalid."},MASTERPASS_FLOW_FAILED:{type:r.types.NETWORK,code:"MASTERPASS_FLOW_FAILED",message:"Could not initialize Masterpass flow."}}},{"../../lib/braintree-error":149}],200:[function(e,t,n){"use strict";t.exports={CREATE_PAYMENT_READY_SESSION_QUERY:"mutation CreateCustomerSession($input: CreateCustomerSessionInput!) {\n  createCustomerSession(input: $input) {\n    sessionId\n clientMutationId\n }\n}",BUTTON_ORDER:{FIRST:"first",SECOND:"second",THIRD:"third",FOURTH:"fourth",FIFTH:"fifth",SIXTH:"sixth",SEVENTH:"seventh",EIGHT:"eight",OTHER:"other"},BUTTON_TYPE:{PAYPAL:"paypal",VENMO:"venmo",OTHER:"other"},EVENT_BUTTON_PRESENTED:"payment-ready.button_presented",EVENT_BUTTON_SELECTED:"payment-ready.button_selected",EXPERIMENT_TYPE:{CONTROL:"control",TEST:"test"},PAGE_TYPE:{HOMEPAGE:"homepage",ABOUT:"about",PRODUCT_CATEGORY:"product_category",PRODUCT_DETAILS:"product_details",SEARCH:"search",CART:"cart",CHECKOUT:"checkout",ORDER_REVIEW:"order_review",ORDER_CONFIRMATION:"order_confirmation",MINICART:"minicart",OTHER:"other"},UPDATE_PAYMENT_READY_SESSION_QUERY:"mutation UpdateCustomerSession($input: UpdateCustomerSessionInput!) {\n  updateCustomerSession(input: $input) {\n    sessionId\n clientMutationId\n }\n}",GENERATE_CUSTOMER_RECOMMENDATIONS_QUERY:"mutation GenerateCustomerRecommendations($input: GenerateCustomerRecommendationsInput!) {\n  generateCustomerRecommendations(input: $input) {\n     clientMutationId\n      sessionId\n      paymentRecommendations {\n        paymentOption\n        recommendedPriority\n      }\n      isInPayPalNetwork\n  }\n}",REQUIRED_OPTIONS_CREATE_SESSION:["customer"],REQUIRED_OPTIONS_UPDATE_SESSION:["sessionId","customer"],REQUIRED_OPTIONS_GET_RECOMMENDATIONS:["sessionId"]}},{}],201:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={PAYMENT_READY_ERROR:{type:r.types.MERCHANT,code:"PAYMENT_READY_ERROR"},PAYMENT_READY_MISSING_REQUIRED_OPTION:{type:r.types.MERCHANT,code:"PAYMENT_READY_MISSING_REQUIRED_OPTION",message:"Missing required option for Payment Ready method."},PAYMENT_READY_CREATE_SESSION_ERROR:{type:r.types.NETWORK,code:"PAYMENT_READY_CREATE_SESSION_ERROR",message:"Error creating customer session."},PAYMENT_READY_UPDATE_SESSION_ERROR:{type:r.types.NETWORK,code:"PAYMENT_READY_UPDATE_SESSION_ERROR",message:"Error updating customer session."},PAYMENT_READY_NO_SESSION_ID:{type:r.types.MERCHANT,code:"PAYMENT_READY_NO_SESSION_ID",message:"A session ID is required"},PAYMENT_READY_GET_RECOMMENDATIONS_ERROR:{type:r.types.NETWORK,code:"PAYMENT_READY_GET_RECOMMENDATIONS_ERROR",message:"Error getting customer recommendations"}}},{"../lib/braintree-error":149}],202:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("./payment-ready"),o=e("../lib/create-assets-url"),a=e("../lib/create-deferred-client"),s=e("../lib/basic-component-verification"),c=e("@braintree/wrap-promise");t.exports={create:c(function(e){var t="PAYMENT READY";return s.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return a.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o.create(e.authorization),name:t})}).then(function(t){return e.client=t,r.sendEvent(t,"payment-ready.client.initialized"),new i(e)})}),VERSION:"3.143.0"}},{"../lib/analytics":144,"../lib/basic-component-verification":147,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./payment-ready":203,"@braintree/wrap-promise":43}],203:[function(e,t,n){"use strict";var r=e("@braintree/wrap-promise"),i=e("../lib/analytics"),o=e("../lib/braintree-error"),a=e("./constants"),s=e("./errors"),c=e("../lib/has-missing-option");function d(e){this._instantiatedWithClient=Boolean(!e.useDeferredClient),this._client=e.client,this._createPromise=e.createPromise}d.prototype.createCustomerSession=function(e){var t=this;return!e||c(e,a.REQUIRED_OPTIONS_CREATE_SESSION)?(i.sendEvent(t._client,"payment-ready.create-customer-session.missing-options"),Promise.reject(new o(s.PAYMENT_READY_MISSING_REQUIRED_OPTION))):t._client.request({api:"graphQLApi",data:{query:a.CREATE_PAYMENT_READY_SESSION_QUERY,variables:{input:{sessionId:e.sessionId,customer:e.customer}}}}).then(function(e){return i.sendEvent(t._client,"payment-ready.create-customer-session.succeeded"),e.data.createCustomerSession}
2).catch(function(e){return i.sendEvent(t._client,"payment-ready.create-customer-session.failed"),Promise.reject(new o({type:e.type||s.PAYMENT_READY_CREATE_SESSION_ERROR.type,code:e.code||s.PAYMENT_READY_CREATE_SESSION_ERROR.code,message:e.message||s.PAYMENT_READY_CREATE_SESSION_ERROR.message,details:{originalError:e}}))})},d.prototype.updateCustomerSession=function(e){var t=this;return!e||c(e,a.REQUIRED_OPTIONS_UPDATE_SESSION)?(i.sendEvent(t._client,"payment-ready.update-customer-session.missing-options"),Promise.reject(new o(s.PAYMENT_READY_MISSING_REQUIRED_OPTION))):t._client.request({api:"graphQLApi",data:{query:a.UPDATE_PAYMENT_READY_SESSION_QUERY,variables:{input:{sessionId:e.sessionId,customer:e.customer}}}}).then(function(e){return i.sendEvent(t._client,"payment-ready.update-customer-session.succeeded"),e.data.updateCustomerSession}).catch(function(e){return i.sendEvent(t._client,"payment-ready.update-customer-session.failed"),Promise.reject(new o({type:e.type||s.PAYMENT_READY_UPDATE_SESSION_ERROR.type,code:e.code||s.PAYMENT_READY_UPDATE_SESSION_ERROR.code,message:e.message||s.PAYMENT_READY_UPDATE_SESSION_ERROR.message,details:{originalError:e}}))})},d.prototype.getCustomerRecommendations=function(e){var t=this;return!e||c(e,a.REQUIRED_OPTIONS_GET_RECOMMENDATIONS)?(i.sendEvent(t._client,"payment-ready.get-customer-recommendations.missing-options"),Promise.reject(new o(s.PAYMENT_READY_NO_SESSION_ID))):t._client.request({api:"graphQLApi",data:{query:a.GENERATE_CUSTOMER_RECOMMENDATIONS_QUERY,variables:{input:{sessionId:e.sessionId,customer:e.customer,domain:e.domain,purchaseUnits:e.purchaseUnits}}}}).then(function(e){return i.sendEvent(t._client,"payment-ready.get-customer-recommendations.succeeded"),e.data.generateCustomerRecommendations}).catch(function(e){return i.sendEvent(t._client,"payment-ready.get-customer-recommendations.failed"),Promise.reject(new o({type:e.type||s.PAYMENT_READY_GET_RECOMMENDATIONS_ERROR.type,code:e.code||s.PAYMENT_READY_GET_RECOMMENDATIONS_ERROR.code,message:e.message||s.PAYMENT_READY_GET_RECOMMENDATIONS_ERROR.message,details:{originalError:e}}))})},d.prototype.sendPresentedEvent=function(e){var t=e.presentmentDetails?e.presentmentDetails.experimentType:null,n=e.presentmentDetails?e.presentmentDetails.pageType:null,r=e.presentmentDetails?e.presentmentDetails.buttonOrder:null;if(e.paymentReadySessionId&&"string"==typeof e.paymentReadySessionId)if(e.buttonType&&"string"==typeof e.buttonType){var o,s=e.buttonType;Object.values(a.BUTTON_TYPE).includes(s)||(s=a.BUTTON_TYPE.OTHER),r&&!Object.values(a.BUTTON_ORDER).includes(r)&&(r=a.BUTTON_ORDER.OTHER),t&&!Object.values(a.EXPERIMENT_TYPE).includes(t)&&(t=a.EXPERIMENT_TYPE.TEST),n&&!Object.values(a.PAGE_TYPE).includes(n)&&(n=a.PAGE_TYPE.OTHER),o=function(e){var t={button_type:e.buttonType,payment_ready_session_id:e.sessionId};return e.buttonOrder&&(t.payment_ready_button_order=e.buttonOrder),e.experimentType&&(t.payment_ready_experiment_type=e.experimentType),e.pageType&&(t.payment_ready_page_type=e.pageType),t}({buttonOrder:r,buttonType:s,experimentType:t,pageType:n,sessionId:e.paymentReadySessionId}),i.sendEventPlus(this._client,a.EVENT_BUTTON_PRESENTED,o)}else console.warn("sendPresentedEvent: buttonType is missing");else console.warn("sendPresentedEvent: paymentReadySessionId is missing or invalid")},d.prototype.sendSelectedEvent=function(e){if(e.paymentReadySessionId&&"string"==typeof e.paymentReadySessionId)if(e.buttonType&&"string"==typeof e.buttonType){var t=e.buttonType;Object.values(a.BUTTON_TYPE).includes(t)||(t=a.BUTTON_TYPE.OTHER),i.sendEventPlus(this._client,a.EVENT_BUTTON_SELECTED,{payment_ready_session_id:e.paymentReadySessionId,button_type:t})}else console.warn("sendSelectedEvent: buttonType is missing");else console.warn("sendSelectedEvent: paymentReadySessionId is missing or invalid")},t.exports=r.wrapPrototype(d)},{"../lib/analytics":144,"../lib/braintree-error":149,"../lib/has-missing-option":174,"./constants":200,"./errors":201,"@braintree/wrap-promise":43}],204:[function(e,t,n){"use strict";var r=e("../../lib/analytics"),i=e("../../lib/assign").assign,o=e("framebus"),a=e("../../lib/convert-methods-to-error"),s=e("../../lib/generate-google-pay-configuration"),c=e("@braintree/iframer"),d=e("@braintree/uuid"),l=e("../../lib/use-min"),u=e("../../lib/methods"),p=e("@braintree/event-emitter"),_=e("../../lib/braintree-error"),E=e("../shared/constants"),m=E.events,h=E.errors,f=e("@braintree/wrap-promise"),A={Visa:"visa",MasterCard:"mastercard","American Express":"amex","Diners Club":"diners",Discover:"discover",JCB:"jcb",UnionPay:"unionpay",Maestro:"maestro"};function y(e){var t=e.enabledPaymentMethods||{};p.call(this),this._componentId=d(),this._client=e.client,this._enabledPaymentMethods={basicCard:!1!==t.basicCard,googlePay:!1!==t.googlePay},this._googlePayVersion=2===e.googlePayVersion?2:1,this._googleMerchantId="18278000977346790994",this._supportedPaymentMethods=this._constructDefaultSupp
2ortedPaymentMethods(),this._defaultSupportedPaymentMethods=Object.keys(this._supportedPaymentMethods).map(function(e){return this._supportedPaymentMethods[e]}.bind(this)),this._bus=new o({channel:this._componentId})}p.createChild(y),y.prototype._constructDefaultSupportedPaymentMethods=function(){var e=this._client.getConfiguration(),t=e.gatewayConfiguration.androidPay,n=e.gatewayConfiguration.creditCards,r={};return this._enabledPaymentMethods.basicCard&&n&&n.supportedCardTypes.length>0&&(r.basicCard={supportedMethods:"basic-card",data:{supportedNetworks:n.supportedCardTypes.reduce(function(e,t){return t in A&&e.push(A[t]),e},[])}}),this._enabledPaymentMethods.googlePay&&t&&t.enabled&&(r.googlePay={supportedMethods:"https://google.com/pay",data:s(e,this._googlePayVersion,this._googleMerchantId)}),r},y.prototype.initialize=function(){var e=this._client.getConfiguration(),t=this;return this._frame=c({allowPaymentRequest:!0,name:"braintree-payment-request-frame",class:"braintree-payment-request-frame",height:0,width:0,style:{position:"absolute",left:"-9999px"},title:"Secure Payment Frame"}
2),0===this._defaultSupportedPaymentMethods.length?Promise.reject(new _(h.PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS)):new Promise(function(n){var i,o,a;t._bus.on(m.FRAME_READY,function(e){e(t._client)}),t._bus.on(m.FRAME_CAN_MAKE_REQUESTS,function(){r.sendEvent(t._client,"payment-request.initialized"),t._bus.on(m.SHIPPING_ADDRESS_CHANGE,function(e){var n={target:{shippingAddress:e},updateWith:function(e){t._bus.emit(m.UPDATE_SHIPPING_ADDRESS,e)}};t._emit("shippingAddressChange",n),t._emit("shippingaddresschange",n)}),t._bus.on(m.SHIPPING_OPTION_CHANGE,function(e){var n={target:{shippingOption:e},updateWith:function(e){t._bus.emit(m.UPDATE_SHIPPING_OPTION,e)}};t._emit("shippingOptionChange",n),t._emit("shippingoptionchange",n)}),n(t)}),t._frame.src=(i=e.gatewayConfiguration.assetsUrl,o=t._componentId,a=e.isDebug,i+"/web/3.143.0/html/payment-request-frame"+l(a)+".html#"+o),document.body.appendChild(t._frame)})},y.prototype.createSupportedPaymentMethodsConfiguration=function(e,t){var n;if(!e)throw new _(h.PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE);if(!this._enabledPaymentMethods[e])throw new _(h.PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED);return(n=i({},this._supportedPaymentMethods[e])).data=i({},n.data,t),n},y.prototype.tokenize=function(e){var t=this;return new Promise(function(n,i){t._bus.emit(m.PAYMENT_REQUEST_INITIALIZED,{supportedPaymentMethods:e.supportedPaymentMethods||t._defaultSupp
2ortedPaymentMethods,details:e.details,options:e.options},function(e){var o=e[0],a=e[1];o?i(t._formatTokenizationError(o)):(r.sendEvent(t._client,"payment-request.tokenize.succeeded"),n({nonce:a.nonce,type:a.type,description:a.description,details:{rawPaymentResponse:a.details.rawPaymentResponse,cardType:a.details.cardType,lastFour:a.details.lastFour,lastTwo:a.details.lastTwo},binData:a.binData}))})})},y.prototype.canMakePayment=function(e){var t,n=this;return window.PaymentRequest?e.supportedPaymentMethods&&(e.supportedPaymentMethods.forEach(function(e){var n=e.supportedMethods;n in E.SUPPORTED_METHODS||(t=n)}),t)?Promise.reject(new _({type:h.PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD.type,code:h.PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD.code,message:t+" is not a supported payment method."})):new Promise(function(t,i){n._bus.emit(m.CAN_MAKE_PAYMENT,{supportedPaymentMethods:e.supportedPaymentMethods||n._defaultSupportedPaymentMethods,details:e.details,options:e.options},function(e){var o=e[0],a=e[1];o?i(n._formatCanMakePaymentError(o)):(r.sendEvent(n._client,"payment-request.can-make-payment."+a),t(a))})}):(r.sendEvent(n._client,"payment-request.can-make-payment.not-available"),Promise.resolve(!1))},y.prototype.teardown=function(){return this._bus.teardown(),this._frame.parentNode.removeChild(this._frame),a(this,u(y.prototype)),r.sendEvent(this._client,"payment-request.teardown-completed"),Promise.resolve()},y.prototype._formatTokenizationError=function(e){var t;switch(e.name){case"AbortError":return t=new _({type:h.PAYMENT_REQUEST_CANCELED.type,code:h.PAYMENT_REQUEST_CANCELED.code,message:h.PAYMENT_REQUEST_CANCELED.message,details:{originalError:e}}),r.sendEvent(this._client,"payment-request.tokenize.canceled"),t;case"PAYMENT_REQUEST_INITIALIZATION_FAILED":t=new _({type:h.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.type,code:h.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.code,message:h.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.message,details:{originalError:e}});break;case"BRAINTREE_GATEWAY_GOOGLE_PAYMENT_TOKENIZATION_ERROR":t=new _({type:h.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.type,code:h.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.code,message:h.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.message,details:{originalError:e}});break;case"BRAINTREE_GATEWAY_GOOGLE_PAYMENT_PARSING_ERROR":t=new _({type:h.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.type,code:h.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.code,message:h.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.message,details:{originalError:e}});break;default:t=new _({code:h.PAYMENT_REQUEST_NOT_COMPLETED.code,type:e.type||_.types.CUSTOMER,message:h.PAYMENT_REQUEST_NOT_COMPLETED.message,details:{originalError:e}})}return r.sendEvent(this._client,"payment-request.tokenize.failed"),t},y.prototype._formatCanMakePaymentError=function(e){var t;switch(e.name){case"PAYMENT_REQUEST_INITIALIZATION_FAILED":t=new _({type:h.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.type,code:h.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.code,message:h.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.message,details:{originalError:e}});break;case"NotAllowedError":t=new _({type:h.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.type,code:h.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.code,message:h.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.message,details:{originalError:e}});break;default:t=new _({code:h.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.code,type:h.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.type,message:h.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.message,details:{originalError:e}})}return r.sendEvent(this._client,"payment-request.can-make-payment.failed"),t},t.exports=f.wrapPrototype(y)},{"../../lib/analytics":144,"../../lib/assign":146,"../../lib/braintree-error":149,"../../lib/convert-methods-to-error":151,"../../lib/generate-google-pay-configuration":173,"../../lib/methods":181,"../../lib/use-min":187,"../shared/constants":206,"@braintree/event-emitter":33,"@braintree/iframer":35,"@braintree/uuid":39,"@braintree/wrap-promise":43,framebus:54}],205:[function(e,t,n){"use strict";var r=e("./external/payment-request"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("@braintree/wrap-promise");t.exports={create:s(function(e){var t="Payment Request";return i.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return o.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:a.create(e.authorization),name:t})}).then(function(t){return e.client=t,new r(e).initialize()})}),VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./external/payment-request":204,"@braintree/wrap-promise":43}],206:[function(e,t,n){"use strict";var r=e("../../lib/enumerate"),i=e("./errors"),o={};o.events=r(["CAN_MAKE_PAYMENT","FRAME_READY","FRAME_CAN_MAKE_REQUESTS","PAYMENT_REQUEST_INITIALIZED","SHIPPING_ADDRESS_CHANGE","UPDATE_SHIPPING_ADDRESS","SHIPPING_OPTION_CHANGE","UPDATE_SHIPPING_OPTION"],"payment-request:"),o.errors=i,o.SUPPORTED_METHODS={"basic-card":!0,"https://google.com/pay":!0},t.exports=o},{"../../lib/enumerate":158,"./errors":207}],207:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error");t.exports={PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS:{type:r.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:r.types.CUSTOMER,code:"PAYMENT_REQUEST_CANCELED",message:"Payment request was canceled."},PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED:{type:r.types.MERCHANT,code:"PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED",message:"Something went wrong when configuring the payment request."},PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED:{type:r.types.UNKNOWN,code:"PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED",message:"Something went wrong when calling `canMakePayment`"},PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED:{type:r.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:r.types.MERCHANT,code:"PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD"}
2,PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE:{type:r.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:r.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:r.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:r.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":149}],208:[function(e,t,n){"use strict";var r="paypal-checkout-v6",i={INITIALIZED:r+".initialized",TEARDOWN:r+".teardown",SDK_ALREADY_LOADED:r+".sdk-already-loaded",SDK_LOAD_STARTED:r+".load-sdk.started",SDK_LOAD_SUCCEEDED:r+".sdk-load.succeeded",SDK_LOAD_FAILED:r+".sdk-load.failed",CREATE_INSTANCE_STARTED:r+".create-instance.started",CREATE_INSTANCE_SUCCEEDED:r+".create-instance.succeeded",CREATE_INSTANCE_FAILED:r+".create-instance.failed",SESSION_CHECKOUT_CREATED:r+".session.checkout.created",SESSION_VAULT_CREATED:r+".session.vault.created",SESSION_CHECKOUT_WITH_VAULT_CREATED:r+".session.checkout-with-vault.created",PAYMENT_STARTED:r+".payment.started",PAYMENT_APPROVED:r+".payment.approved",PAYMENT_CANCELED:r+".payment.canceled",CHECKOUT_WITH_VAULT_STARTED:r+".checkout-with-vault.started",CHECKOUT_WITH_VAULT_APPROVED:r+".checkout-with-vault.approved",CHECKOUT_WITH_VAULT_CANCELED:r+".checkout-with-vault.canceled",CREATE_ORDER_STARTED:r+".create-order.started",CREATE_ORDER_SUCCEEDED:r+".create-order.succeeded",CREATE_ORDER_FAILED:r+".create-order.failed",CREATE_BA_TOKEN_STARTED:r+".create-billing-agreement-token.started",CREATE_BA_TOKEN_SUCCEEDED:r+".create-billing-agreement-token.succeeded",CREATE_BA_TOKEN_FAILED:r+".create-billing-agreement-token.failed",CREATE_BA_SESSION_STARTED:r+".create-billing-agreement-session.started",CREATE_BA_SESSION_INSTANCE_CREATED:r+".create-billing-agreement-session.instance-created",CREATE_BA_SESSION_SDK_NOT_LOADED:r+".create-billing-agreement-session.sdk-not-loaded",CREATE_BA_SESSION_SESSION_CREATED:r+".create-billing-agreement-session.session-created",CREATE_BA_SESSION_APPROVED:r+".create-billing-agreement-session.approved",CREATE_BA_SESSION_CANCELED:r+".create-billing-agreement-session.canceled",CREATE_BA_SESSION_FAILED:r+".create-billing-agreement-session.failed",TOKENIZE_PAYMENT_PREFIX:r+".tokenize-payment",TOKENIZE_BA_PREFIX:r+".tokenize-billing-agreement",CREDIT_OFFERED:r+".credit.offered",CREDIT_ACCEPTED:r+".credit.accepted",PAY_LATER_OFFERED:r+".pay-later.offered",PAY_LATER_ACCEPTED:r+".pay-later.accepted",FIND_ELIGIBLE_METHODS_STARTED:r+".find-eligible-methods.started",FIND_ELIGIBLE_METHODS_SUCCEEDED:r+".find-eligible-methods.succeeded",FIND_ELIGIBLE_METHODS_FAILED:r+".find-eligible-methods.failed",CREATE_MESSAGES_STARTED:r+".create-messages.started",CREATE_MESSAGES_SUCCEEDED:r+".create-messages.succeeded",CREATE_MESSAGES_FAILED:r+".create-messages.failed"};t.exports={VERSION:"3.143.0",PAYPAL_V6_SDK_BASE_URL:"https://www.{ENV}paypal.com/web-sdk/v6/core",PAYPAL_V6_ENVIRONMENT:{stage:"https://www.msmaster.qa.paypal.com/web-sdk/v6/core",teBraintree:"https://www.braintree.stage.paypal.com/web-sdk/v6/core"},ANALYTICS_PREFIX:r,ANALYTICS_EVENTS:i}},{}],209:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={PAYPAL_CHECKOUT_V6_NOT_ENABLED:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_NOT_ENABLED",message:"PayPal is not enabled for this merchant."},PAYPAL_CHECKOUT_V6_SANDBOX_ACCOUNT_NOT_LINKED:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_SANDBOX_ACCOUNT_NOT_LINKED",message:"A linked PayPal Sandbox account is required to use PayPal Checkout V6 in Sandbox. See https://developer.paypal.com/braintree/docs/guides/paypal/testing-go-live#linked-paypal-testing for details on linking your PayPal sandbox with Braintree."},PAYPAL_CHECKOUT_V6_TOKENIZATION_KEY_NOT_SUPPORTED:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_TOKENIZATION_KEY_NOT_SUPPORTED",message:"PayPal Checkout V6 requires a client token for authorization. Tokenization keys are not supported."},PAYPAL_CHECKOUT_V6_SDK_SCRIPT_LOAD_FAILED:{type:r.types.NETWORK,code:"PAYPAL_CHECKOUT_V6_SDK_SCRIPT_LOAD_FAILED",message:"PayPal V6 SDK script failed to load."},PAYPAL_CHECKOUT_V6_SDK_INITIALIZATION_FAILED:{type:r.types.NETWORK,code:"PAYPAL_CHECKOUT_V6_SDK_INITIALIZATION_FAILED",message:"PayPal V6 SDK instance creation failed."},PAYPAL_CHECKOUT_V6_CLIENT_TOKEN_INVALID:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_CLIENT_TOKEN_INVALID",message:"Client token is invali
2d or expired."},PAYPAL_CHECKOUT_V6_SDK_NOT_INITIALIZED:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_SDK_NOT_INITIALIZED",message:"PayPal SDK has not been initialized. Call loadPayPalSDK() before using this method."},PAYPAL_CHECKOUT_V6_ELIGIBILITY_CHECK_FAILED:{type:r.types.NETWORK,code:"PAYPAL_CHECKOUT_V6_ELIGIBILITY_CHECK_FAILED",message:"Failed to check payment method eligibility."},PAYPAL_CHECKOUT_V6_INVALID_ELIGIBILITY_OPTIONS:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_INVALID_ELIGIBILITY_OPTIONS",message:"Eligibility check options are invalid or missing required fields (amount, currency)."},PAYPAL_CHECKOUT_V6_SESSION_CREATION_FAILED:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_SESSION_CREATION_FAILED",message:"Failed to create PayPal payment session."},PAYPAL_CHECKOUT_V6_PAYMENT_START_FAILED:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_PAYMENT_START_FAILED",message:"Failed to start PayPal payment flow."},PAYPAL_CHECKOUT_V6_PAYMENT_CANCELED:{type:r.types.CUSTOMER,code:"PAYPAL_CHECKOUT_V6_PAYMENT_CANCELED",message:"Customer canceled the PayPal payment."},PAYPAL_CHECKOUT_V6_INVALID_SESSION_OPTIONS:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_INVALID_SESSION_OPTIONS",message:"PayPal session options are invalid or missing required fields."},PAYPAL_CHECKOUT_V6_SHIPPING_CALLBACK_CONFLICT:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_SHIPPING_CALLBACK_CONFLICT",message:"Cannot use both shippingCallbackUrl and client-side shipping callbacks (onShippingAddressChange/onShippingOptionsChange)."},PAYPAL_CHECKOUT_V6_APP_SWITCH_URLS_REQUIRED:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_APP_SWITCH_URLS_REQUIRED",message:"returnUrl and cancelUrl are required when using direct-app-switch presentation mode."},PAYPAL_CHECKOUT_V6_INSTANCE_NOT_READY:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_INSTANCE_NOT_READY",message:"PayPal SDK instance is not ready. Ensure loadPayPalSDK() has completed before calling start()."},PAYPAL_CHECKOUT_V6_ORDER_CREATION_FAILED:{type:r.types.NETWORK,code:"PAYPAL_CHECKOUT_V6_ORDER_CREATION_FAILED",message:"Could not create PayPal order."},PAYPAL_CHECKOUT_V6_INVALID_ORDER_OPTIONS:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_INVALID_ORDER_OPTIONS",message:"PayPal order options are invalid or missing required fields."},PAYPAL_CHECKOUT_V6_TOKENIZATION_FAILED:{type:r.types.NETWORK,code:"PAYPAL_CHECKOUT_V6_TOKENIZATION_FAILED",message:"Could not tokenize PayPal account."},PAYPAL_CHECKOUT_V6_MISSING_TOKENIZATION_DATA:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_MISSING_TOKENIZATION_DATA",message:"Missing required tokenization data (payerID and (orderID or paymentID))."},PAYPAL_CHECKOUT_V6_INVALID_UPDATE_OPTIONS:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_INVALID_UPDATE_OPTIONS",message:"PayPal update options are invalid or missing required fields."},PAYPAL_CHECKOUT_V6_PAYMENT_NOT_FOUND:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_PAYMENT_NOT_FOUND",message:"The specified payment ID cannot be found or is no longer active."},PAYPAL_CHECKOUT_V6_CURRENCY_MISMATCH:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_CURRENCY_MISMATCH",message:"The currency provided for the update does not match the original payment currency."},PAYPAL_CHECKOUT_V6_UPDATE_FAILED:{type:r.types.NETWORK,code:"PAYPAL_CHECKOUT_V6_UPDATE_FAILED",message:"Could not update PayPal payment details."},PAYPAL_CHECKOUT_V6_INVALID_LINE_ITEMS:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_INVALID_LINE_ITEMS",message:"Line items have invalid format or inconsistent currency."},PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CREATION_FAILED:{type:r.types.NETWORK,code:"PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CREATION_FAILED",message:"Could not create PayPal billing agreement."},PAYPAL_CHECKOUT_V6_INVALID_BILLING_AGREEMENT_OPTIONS:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_INVALID_BILLING_AGREEMENT_OPTIONS",message:"Billing agreement options are invalid or missing required fields."},PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CANCELED:{type:r.types.CUSTOMER,code:"PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CANCELED",message:"Customer canceled the billing agreement."},PAYPAL_CHECKOUT_V6_MESSAGES_CREATION_FAILED:{type:r.types.NETWORK,code:"PAYPAL_CHECKOUT_V6_MESSAGES_CREATION_FAILED",message:"Could not create PayPal Messages instance."},PAYPAL_CHECKOUT_V6_VIC_PARAM_REQUIRED:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_VIC_PARAM_REQUIRED",message:"A required vault initiated checkout parameter is missing."},PAYPAL_CHECKOUT_V6_VIC_POPUP_OPEN_FAILED:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_VIC_POPUP_OPEN_FAILED",message:"PayPal popup failed to open, make sure to initiate in response to a user action."}
2,PAYPAL_CHECKOUT_V6_VIC_CANCELED:{type:r.types.CUSTOMER,code:"PAYPAL_CHECKOUT_V6_VIC_CANCELED",message:"Customer closed PayPal popup before authorizing."},PAYPAL_CHECKOUT_V6_VIC_IN_PROGRESS:{type:r.types.MERCHANT,code:"PAYPAL_CHECKOUT_V6_VIC_IN_PROGRESS",message:"Vault initiated checkout already in progress."}}},{"../lib/braintree-error":149}],210:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("@braintree/wrap-promise"),o=e("./paypal-checkout-v6");t.exports={create:i(function(e){return r.verify({name:"PayPal Checkout V6",client:e.client,authorization:e.authorization}).then(function(){return new o(e)._initialize(e)})}),isSupported:function(){return!0},VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"./paypal-checkout-v6":211,"@braintree/wrap-promise":43}],211:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/assign").assign,o=e("../lib/braintree-error"),a=e("../lib/convert-to-braintree-error"),s=e("../lib/create-deferred-client"),c=e("../lib/create-assets-url"),d=e("../lib/create-authorization-data"),l=e("./errors"),u=e("../lib/frame-service/external"),p=e("../lib/methods"),_=e("../lib/convert-methods-to-error"),E=e("../lib/use-min"),m=e("@braintree/wrap-promise"),h=e("@braintree/extended-promise"),f=e("./constants"),A=e("../lib/constants").INTEGRATION_TIMEOUT_MS;h.suppressUnhandledPromiseMessage=!0;var y=["amount","currency","vaultInitiatedCheckoutPaymentMethodToken"];function I(e){this._merchantAccountId=e.merchantAccountId}I.prototype._initialize=function(e){var t;return e.client?(t=e.client.getConfiguration(),this._authorizationInformation={fingerprint:t.authorizationFingerprint,environment:t.gatewayConfiguration.environment}):(t=d(e.authorization),this._authorizationInformation={fingerprint:t.attrs.authorizationFingerprint,environment:t.environment}),this._clientPromise=s.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:e.authorization?c.create(e.authorization):void 0,name:"PayPal Checkout V6"}).then(function(e){return this._configuration=e.getConfiguration(),"TOKENIZATION_KEY"===this._configuration.authorizationType?this._setupError=new o(l.PAYPAL_CHECKOUT_V6_TOKENIZATION_KEY_NOT_SUPPORTED):this._merchantAccountId||(this._configuration.gatewayConfiguration.paypalEnabled?!0===this._configuration.gatewayConfiguration.paypal.environmentNoNetwork&&(this._setupError=new o(l.PAYPAL_CHECKOUT_V6_SANDBOX_ACCOUNT_NOT_LINKED)):this._setupError=new o(l.PAYPAL_CHECKOUT_V6_NOT_ENABLED)),this._setupError?Promise.reject(this._setupError):(this._client=e,r.sendEvent(e,f.ANALYTICS_EVENTS.INITIALIZED),this._frameServicePromise=this._setupFrameService(e),e)}.bind(this)),e.client?this._clientPromise.then(function(){return this}.bind(this)):Promise.resolve(this)},I.prototype.getClientId=function(){return this._clientPromise.then(function(e){return e.getConfiguration().gatewayConfiguration.paypal.clientId})},I.prototype._setupFrameService=function(e){var t=new h,n=e.getConfiguration(),i=setTimeout(function(){r.sendEvent(e,"paypal-checkout-v6.frame-service.timed-out"),t.reject(new o(l.PAYPAL_CHECKOUT_V6_SESSION_CREATION_FAILED))},A);return this._assetsUrl=n.gatewayConfiguration.paypal.assetsUrl+"/web/"+f.VERSION,this._isDebug=n.isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/paypal-landing-frame"+E(this._isDebug)+".html",u.create({name:"braintreepaypallanding",dispatchFrameUrl:this._assetsUrl+"/html/dispatch-frame"+E(this._isDebug)+".html",openFrameUrl:this._loadingFrameUrl},function(e){this._frameService=e,clearTimeout(i),t.resolve()}.bind(this)),t},I.prototype._isPayPalSdkAvailable=function(){return Boolean(window.paypal&&window.paypal.createInstance)},I.prototype._validateAppSwitchUrls=function(e,t){return"direct-app-switch"!==t||e.returnUrl&&e.cancelUrl?null:new o(l.PAYPAL_CHECKOUT_V6_APP_SWITCH_URLS_REQUIRED)},I.prototype._formatPlanMetadata=function(e){var t,n,r,i,o,a=["currencyIsoCode","name","oneTimeFeeAmount","productDescription","productPrice","productQuantity","shippingAmount","taxAmount","totalAmount"],s=["billingFrequency","billingFrequencyUnit","numberOfExecutions","sequence","startDate","trial","pricingScheme"],c={billingCycles:[]};if(e.hasOwnProperty("billingCycles"))for(t=0;t<e.billingCycles.length;t++){for(n=e.billingCycles[t],r={},i=0;i<s.length;i++)r[s[i]]=n[s[i]];c.billingCycles.push(r)}for(o=0;o<a.length;o++)c[a[o]]=e[a[o]];return c},I.prototype.loadPayPalSDK=function(e){var t=this;return this._clientPromise.then(function(n){var i,a=new h,s="production"===n.getConfiguration().gatewayConfiguration.environment?"":"sandbox.";return i=e&&e.env&&f.PAYPAL_V6_ENVIRONMENT[e.env]?f.PAYPAL_V6_ENVIRONMENT[e.env]:f.PAYPAL_V6_SDK_BASE_URL.replace("{ENV}",s),window.paypal&&window.paypal.version?(r.sendEvent(n,f.ANALYTICS_EVENTS.SDK_ALREADY_LOADED),Promise.resolve(t)):(r.sendEvent(n,f.ANALYTICS_EVENTS.SDK_LOAD_STARTED),t._paypalScript=document.createElement("script"),t._paypalScript.src=i,t._paypalScript.async=!0,t._paypalScript.onload=function(){r.sendEvent(n,f.ANALYTICS_EVENTS.SDK_LOAD_SUCCEEDED),a.resolve(t)},t._paypalScript.onerror=function(){r.sendEvent(n,f.ANALYTICS_EVENTS.SDK_LOAD_FAILED),a.reject(new o(l.PAYPAL_CHECKOUT_V6_SDK_SCRIPT_LOAD_FAILED))},document.head.appendChild(t._paypalScript),a)})},I.prototype._createPayPalInstance=function(e){return this._clientPromise.then(function(t){var n=t.getConfiguration(),o=n.gatewayConfiguration.paypal.clientId;return e=i({clientId:o,components:e.components,pageType:"checkout"},e),n.analyticsMetadata&&n.analyticsMetadata.sessionId&&(e.clientMetadataId=n.analyticsMetadata.sessionId),r.sendEvent(t,f.ANALYTICS_EVENTS.CREATE_INSTANCE_STARTED),window.paypal.createInstance(e).then(function(e){return r.sendEvent(t,f.ANALYTICS_EVENTS.CREATE_INSTANCE_SUCCEEDED),e}).catch(function(e){throw r.sendEvent(t,f.ANALYTICS_EVENTS.CREATE_INSTANCE_FAILED),a(e,{type:l.PAYPAL_CHECKOUT_V6_SDK_INITIALIZATION_FAILED.type,code:l.PAYPAL_CHECKOUT_V6_SDK_INITIALIZATION_FAILED.code,message:l.PAYPAL_CHECKOUT_V6_SDK_INITIALIZATION_FAILED.message})})})},I.prototype._initializePayPalInstance=function(e){var t=this,n={checkout:{instanceKey:"_paypalInstance",promiseKey:"_checkoutInstancePromise",components:["payp
2al-payments"]},vault:{instanceKey:"_paypalVaultInstance",promiseKey:"_vaultInstancePromise",components:["paypal-billing-agreements"]},messages:{instanceKey:"_paypalMessagesSdkInstance",promiseKey:"_messagesInstancePromise",components:["paypal-messages"]}}[e],r=n.instanceKey,i=n.promiseKey,o=n.components;t[r]||t[i]||!t._isPayPalSdkAvailable()||(t[i]=t._clientPromise.then(function(){return t._createPayPalInstance({components:o})}).then(function(e){return t[r]=e,e}).catch(function(e){return t[i]=null,Promise.reject(e)}))},I.prototype._buildBillingAgreementRequest=function(e){var t={},n={billingAgreementDescription:"description"};return["billingAgreementDescription","userAction","offerCredit","locale","landingPageType","planType","displayName","returnUrl","cancelUrl","shippingAddressOverride","enableShippingAddress","shippingAddressEditable"].forEach(function(r){var i=n[r]||r;e.hasOwnProperty(r)&&(t[i]=e[r])}),e.planMetadata&&(t.planMetadata=this._formatPlanMetadata(e.planMetadata)),e.amount&&e.currency&&(t.amount=e.amount,t.currency=e.currency),this._riskCorrelationId=e.riskCorrelationId,e.riskCorrelationId&&(t.riskCorrelationId=e.riskCorrelationId),t},I.prototype._createBillingAgreementToken=function(e){var t=this,n=this._configuration.gatewayConfiguration;this._riskCorrelationId=e.riskCorrelationId;var i={returnUrl:e.returnUrl||"https://www.paypal.com/checkoutnow/error",cancelUrl:e.cancelUrl||"https://www.paypal.com/checkoutnow/error",offerPaypalCredit:!0===e.offerCredit,merchantAccountId:this._merchantAccountId,experienceProfile:{brandName:e.displayName||n.paypal.displayName,localeCode:e.locale,noShipping:(!e.enableShippingAddress).toString(),landingPageType:e.landingPageType}},o=!1;return e.hasOwnProperty("shippingAddressEditable")&&(o=!1===e.shippingAddressEditable),i.experienceProfile.addressOverride=o,e.planType&&(i.planType=e.planType),(e.description||e.billingAgreementDescription)&&(i.description=e.description||e.billingAgreementDescription),e.planMetadata&&(i.planMetadata=this._formatPlanMetadata(e.planMetadata)),e.amount&&e.currency&&(i.amount=e.amount,i.currencyIsoCode=e.currency),e.shippingAddressOverride&&(i.shippingAddress=e.shippingAddressOverride),e.hasOwnProperty("userAction")&&(i.experienceProfile.userAction=e.userAction),e.riskCorrelationId&&(i.correlationId=e.riskCorrelationId),this._clientPromise.then(function(e){return r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_BA_TOKEN_STARTED),e.request({endpoint:"paypal_hermes/setup_billing_agreement",method:"post",data:i}).then(function(t){r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_BA_TOKEN_SUCCEEDED);var n=t.agreementSetup.tokenId;if(!n)throw new Error("Could not extract approval token from billing agreement setup");return{approvalTokenId:n,agreementSetup:t.agreementSetup}}).catch(function(n){if(r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_BA_TOKEN_FAILED),t._setupError)throw t._setupError;throw a(n,{type:l.PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CREATION_FAILED.type,code:l.PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CREATION_FAILED.code,message:l.PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CREATION_FAILED.message})})})},I.prototype._createPaymentResource=function(e){var t,n=this,i=this._configuration.gatewayConfiguration,o=e.intent||"capture";"capture"===o&&(o="sale"),this._riskCorrelationId=e.riskCorrelationId;var s={amount:e.amount,currencyIsoCode:e.currency,intent:o,returnUrl:e.returnUrl||"https://www.paypal.com/checkoutnow/error",cancelUrl:e.cancelUrl||"https://www.paypal.com/checkoutnow/error",experienceProfile:{brandName:e.displayName||i.paypal.displayName}};if(this._merchantAccountId&&(s.merchantAccountId=this._merchantAccountId),e.lineItems&&(s.lineItems=e.lineItems),e.shippingOptions&&(s.shippingOptions=e.shippingOptions),e.userAuthenticationEmail&&(s.payer_email=e.userAuthenticationEmail),e.amountBreakdown&&(s.amountBreakdown=e.amountBreakdown),!0===e.offerCredit&&(s.offerPaypalCredit=!0),e.requestBillingAgreement&&(s.requestBillingAgreement=!0),e.billingAgreementDetails&&(s.billingAgreementDetails=e.billingAgreementDetails),e.shippingCallbackUrl&&(s.shippingCallbackUrl=e.shippingCallbackUrl),e.shippingAddressOverride)for(t in e.shippingAddressOverride)e.shippingAddressOverride.hasOwnProperty(t)&&(s[t]=e.shippingAddressOverride[t]);return e.contactPreference&&(s.contactPreference=e.contactPreference),e.vaultInitiatedCheckoutPaymentMethodToken&&(s.vaultInitiatedCheckoutPaymentMethodToken=e.vaultInitiatedCheckoutPaymentMethodToken),this._clientPromise.then(function(e){return r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_ORDER_STARTED),e.request({endpoint:"paypal_hermes/create_payment_resource",method:"post",data:s}).then(function(t){r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_ORDER_SUCCEEDED);var i=t.paymentResource.redirectUrl.match(/token=([^&]+)/),o=i?i[1]:null;if(!o)throw new Error("Could not extract order ID from payment resource");return n._contextId=o,{orderId:o,paymentResource:t.paymentResource}}).catch(function(t){if(r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_ORDER_FAILED),n._setupError)throw n._setupError;throw a(t,{type:l.PAYPAL_CHECKOUT_V6_ORDER_CREATION_FAILED.type,code:l.PAYPAL_CHECKOUT_V6_ORDER_CREATION_FAILED.code,message:l.PAYPAL_CHECKOUT_V6_ORDER_CREATION_FAILED.message})})})},I.prototype._createCheckoutSessionOptions=function(e,t,n){var i=n?f.ANALYTICS_EVENTS.CHECKOUT_WITH_VAULT_APPROVED:f.ANALYTICS_EVENTS.PAYMENT_APPROVED,o=n?f.ANALYTICS_EVENTS.CHECKOUT_WITH_VAULT_CANCELED:f.ANALYTICS_EVENTS.PAYMENT_CANCELED,a={commit:"boolean"!=typeof t.commit||t.commit,onApprove:function(n){return r.sendEvent(e,i),t.onApprove(n)},onCancel:function(n){if(r.sendEvent(e,o),t&&"function"==typeof t.onCancel)return t.onCancel(n)}};return t&&"function"==typeof t.onError&&(a.onError=function(e){return t.onError(e)}),t&&"function"==typeof t.onShippingAddressChange&&(a.onShippingAddressChange=function(e){return t.onShippingAddressChange(e)}
2),t&&"function"==typeof t.onShippingOptionsChange&&(a.onShippingOptionsChange=function(e){return t.onShippingOptionsChange(e)}),a},I.prototype._createOrderPromise=function(e,t){return this._createPaymentResource(e).then(function(e){return{orderId:e.orderId}}).catch(function(e){throw t&&t(e),e})},I.prototype._startCheckoutSession=function(e,t,n,i,o,a){var s;s="paypal-credit"===i?"createPayPalCreditOneTimePaymentSession":"pay-later"===i?"createPayLaterOneTimePaymentSession":"createPayPalOneTimePaymentSession";var c=Boolean(a.requestBillingAgreement),d=c?f.ANALYTICS_EVENTS.CHECKOUT_WITH_VAULT_STARTED:f.ANALYTICS_EVENTS.PAYMENT_STARTED;return r.sendEvent(t,d),e[s](this._createCheckoutSessionOptions(t,o,c)).start({presentationMode:n},this._createOrderPromise(a,o.onError))},I.prototype._createBillingSessionCallbacks=function(e,t){return{onApprove:function(n){return r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_BA_SESSION_APPROVED),t.onApprove(n)},onCancel:function(n){r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_BA_SESSION_CANCELED),t.onCancel&&"function"==typeof t.onCancel&&t.onCancel(n)},onError:function(n){r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_BA_SESSION_FAILED),t.onError&&"function"==typeof t.onError&&t.onError(n)}}},I.prototype._createBillingTokenPromise=function(e){var t={flow:"vault",billingAgreementDescription:e.description,planType:e.planType,planMetadata:e.planMetadata,amount:e.amount,currency:e.currency,shippingAddressOverride:e.shippingAddressOverride,userAction:e.userAction,offerCredit:e.offerCredit,returnUrl:e.returnUrl,cancelUrl:e.cancelUrl};return e.locale&&(t.locale=e.locale),e.landingPageType&&(t.landingPageType=e.landingPageType),e.hasOwnProperty("enableShippingAddress")&&(t.enableShippingAddress=e.enableShippingAddress),e.hasOwnProperty("shippingAddressEditable")&&(t.shippingAddressEditable=e.shippingAddressEditable),e.riskCorrelationId&&(t.riskCorrelationId=e.riskCorrelationId),e.displayName&&(t.displayName=e.displayName),this.createPayment(t).then(function(e){return{billingToken:e}})},I.prototype._startBillingSession=function(e,t,n,i,o,a){var s="paypal-credit"===i?"createPayPalCreditBillingAgreementWithoutPurchase":"createPayPalBillingAgreementWithoutPurchase";r.sendEvent(t,f.ANALYTICS_EVENTS.CREATE_BA_SESSION_STARTED);var c=e[s](this._createBillingSessionCallbacks(t,a));r.sendEvent(t,f.ANALYTICS_EVENTS.CREATE_BA_SESSION_SESSION_CREATED);var d=this._createBillingTokenPromise(o).catch(function(e){throw a.onError&&a.onError(e),e});return c.start({presentationMode:n},d)},I.prototype._validatePaymentSessionOptions=function(e){if(e.shippingCallbackUrl&&(e.onShippingAddressChange||e.onShippingOptionsChange))throw new o(l.PAYPAL_CHECKOUT_V6_SHIPPING_CALLBACK_CONFLICT)},I.prototype._createPaymentSession=function(e,t){var n=this;this._validatePaymentSessionOptions(e),this._flow="checkout",this._sessionType=t;var r={amount:e.amount,currency:e.currency,intent:e.intent||"capture"};return["offerCredit","lineItems","shippingOptions","userAuthenticationEmail","amountBreakdown","returnUrl","cancelUrl","requestBillingAgreement","billingAgreementDetails","displayName","shippingCallbackUrl","contactPreference","shippingAddressOverride"].forEach(function(t){e[t]&&(r[t]=e[t])}),{start:function(i){var a=(i=i||{}).presentationMode||e.presentationMode||"auto",s=n._paypalInstance,c=n._validateAppSwitchUrls(e,a);return c?Promise.reject(c):s&&n._client?n._startCheckoutSession(s,n._client,a,t,e,r):n._checkoutInstancePromise?n._checkoutInstancePromise.then(function(i){return n._clientPromise.then(function(o){return n._startCheckoutSession(i,o,a,t,e,r)})}).catch(function(t){throw e.onError&&e.onError(t),t}):Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_INSTANCE_NOT_READY))}}},I.prototype.createOneTimePaymentSession=function(e){var t=this;if(!(e&&e.amount&&e.currency&&e.onApprove))throw new o(l.PAYPAL_CHECKOUT_V6_INVALID_SESSION_OPTIONS);r.sendEvent(t._clientPromise,f.ANALYTICS_EVENTS.SESSION_CHECKOUT_CREATED);var n=!0===e.offerCredit?"paypal-credit":"paypal";return!0===e.offerCredit&&r.sendEvent(t._clientPromise,f.ANALYTICS_EVENTS.CREDIT_OFFERED),t._initializePayPalInstance("checkout"),this._createPaymentSession(e,n)},I.prototype.createPayLaterSession=function(e){var t=this;if(!(e&&e.amount&&e.currency&&e.onApprove))throw new o(l.PAYPAL_CHECKOUT_V6_INVALID_SESSION_OPTIONS);return r.sendEvent(t._clientPromise,f.ANALYTICS_EVENTS.SESSION_CHECKOUT_CREATED),r.sendEvent(t._clientPromise,f.ANALYTICS_EVENTS.PAY_LATER_OFFERED),t._initializePayPalInstance("checkout"),this._createPaymentSession(e,"pay-later")},I.prototype.createCheckoutWithVaultSession=function(e){if(!(e&&e.amount&&e.currency&&e.onApprove))throw new o(l.PAYPAL_CHECKOUT_V6_INVALID_SESSION_OPTIONS);r.sendEvent(this._clientPromise,f.ANALYTICS_EVENTS.SESSION_CHECKOUT_WITH_VAULT_CREATED);var t=i({},e,{requestBillingAgreement:!0});return this._initializePayPalInstance("checkout"),this._createPaymentSession(t,"paypal")},I.prototype.createPayment=function(e){var t=this;return new Promise(function(n,r){var i;if(e&&e.flow){if(t._flow=e.flow,"vault"===e.flow)return i=t._buildBillingAgreementRequest(e),void t._createBillingAgreementToken(i).then(function(e){n(e.approvalTokenId)}).catch(r);t._createPaymentResource(e).then(function(e){n(e.orderId)}).catch(r)}else r(new o(l.PAYPAL_CHECKOUT_V6_INVALID_SESSION_OPTIONS))})},I.prototype.createBillingAgreementSession=function(e){var t=this,n={};if(!e)throw new o(l.PAYPAL_CHECKOUT_V6_INVALID_BILLING_AGREEMENT_OPTIONS);if(!e.onApprove||"function"!=typeof e.onApprove)throw new o(l.PAYPAL_CHECKOUT_V6_INVALID_BILLING_AGREEMENT_OPTIONS);r.sendEvent(t._clientPromise,f.ANALYTICS_EVENTS.SESSION_VAULT_CREATED);
2var i=!0===e.offerCredit?"paypal-credit":"paypal";!0===e.offerCredit&&r.sendEvent(t._clientPromise,f.ANALYTICS_EVENTS.CREDIT_OFFERED),t._initializePayPalInstance("vault");var a=t._buildBillingAgreementRequest(e);return n.start=function(n){var s=(n=n||{}).presentationMode||e.presentationMode||"auto",c=t._paypalVaultInstance,d=t._validateAppSwitchUrls(e,s);return d?Promise.reject(d):c&&t._client?t._startBillingSession(c,t._client,s,i,a,e):t._vaultInstancePromise?t._vaultInstancePromise.then(function(n){return t._clientPromise.then(function(c){if(!t._isPayPalSdkAvailable())throw r.sendEvent(c,f.ANALYTICS_EVENTS.CREATE_BA_SESSION_SDK_NOT_LOADED),new o(l.PAYPAL_CHECKOUT_V6_SDK_INITIALIZATION_FAILED);return r.sendEvent(c,f.ANALYTICS_EVENTS.CREATE_BA_SESSION_INSTANCE_CREATED),t._startBillingSession(n,c,s,i,a,e)})}).catch(function(e){return t._clientPromise.then(function(t){throw r.sendEvent(t,f.ANALYTICS_EVENTS.CREATE_BA_SESSION_FAILED),new o({type:l.PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CREATION_FAILED.type,code:l.PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CREATION_FAILED.code,message:l.PAYPAL_CHECKOUT_V6_BILLING_AGREEMENT_CREATION_FAILED.message,details:{originalError:e}})})}):t._isPayPalSdkAvailable()?Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_INSTANCE_NOT_READY)):t._clientPromise.then(function(e){throw r.sendEvent(e,f.ANALYTICS_EVENTS.CREATE_BA_SESSION_SDK_NOT_LOADED),new o(l.PAYPAL_CHECKOUT_V6_SDK_INITIALIZATION_FAILED)})},n},I.prototype.tokenizePayment=function(e){var t=this;return new Promise(function(n,i){var s=!0,c=Boolean(e&&e.billingToken);e&&(c||(e.payerID||e.payerId)&&(e.orderID||e.orderId||e.paymentID||e.paymentId))?(e.hasOwnProperty("vault")&&(s=e.vault),t._clientPromise.then(function(d){var u,p,_;return c?(_=f.ANALYTICS_EVENTS.TOKENIZE_BA_PREFIX,r.sendEvent(d,_+".started"),u="payment_methods/paypal_accounts",(p={paypalAccount:{billingAgreementToken:e.billingToken,merchantAccountId:t._merchantAccountId}}).paypalAccount.correlationId=t._riskCorrelationId||e.billingToken,s||(p.paypalAccount.vault=!1)):(_=f.ANALYTICS_EVENTS.TOKENIZE_PAYMENT_PREFIX,r.sendEventPlus(t._clientPromise,_+".started",{flow:t._flow,context_id:t._contextId}),p=t._formatTokenizeData({payerId:e.payerID||e.payerId,orderId:e.orderID||e.orderId,paymentId:e.paymentID||e.paymentId}),u="payment_methods/paypal_accounts"),d.request({endpoint:u,method:"post",data:p}).then(function(e){var n,i;return n=t._formatTokenizePayload(e),c?r.sendEvent(d,_+".succeeded"):(n.creditFinancingOffered&&(i="pay-later"===t._sessionType?f.ANALYTICS_EVENTS.PAY_LATER_ACCEPTED:f.ANALYTICS_EVENTS.CREDIT_ACCEPTED,r.sendEventPlus(t._clientPromise,i,{flow:t._flow,context_id:t._contextId})),r.sendEventPlus(t._clientPromise,_+".success",{flow:t._flow,context_id:t._contextId})),n}).catch(function(e){if(c)throw r.sendEvent(d,_+".failed"),new o({type:l.PAYPAL_CHECKOUT_V6_TOKENIZATION_FAILED.type,code:l.PAYPAL_CHECKOUT_V6_TOKENIZATION_FAILED.code,message:l.PAYPAL_CHECKOUT_V6_TOKENIZATION_FAILED.message,details:{originalError:e}});if(r.sendEventPlus(t._clientPromise,_+".failed",{flow:t._flow,context_id:t._contextId}),t._setupError)throw t._setupError;throw a(e,{type:l.PAYPAL_CHECKOUT_V6_TOKENIZATION_FAILED.type,code:l.PAYPAL_CHECKOUT_V6_TOKENIZATION_FAILED.code,message:l.PAYPAL_CHECKOUT_V6_TOKENIZATION_FAILED.message})}).then(n).catch(i)})):i(new o(l.PAYPAL_CHECKOUT_V6_MISSING_TOKENIZATION_DATA))})},I.prototype._formatTokenizeData=function(e){var t={paypalAccount:{correlationId:this._riskCorrelationId||e.billingToken||e.orderId||e.paymentId,paymentToken:e.paymentId||e.orderId,payerId:e.payerId,unilateral:this._configuration.gatewayConfiguration.paypal.unvettedMerchant}};return this._merchantAccountId&&(t.merchantAccountId=this._merchantAccountId),t},I.prototype._formatTokenizePayload=function(e){var t,n={};return e.paypalAccounts&&(n=e.paypalAccounts[0]),t={nonce:n.nonce,details:{},type:n.type},n.details&&n.details.payerInfo&&(t.details=n.details.payerInfo),n.details&&n.details.creditFinancingOffered&&(t.creditFinancingOffered=n.details.creditFinancingOffered),n.details&&n.details.shippingOptionId&&(t.shippingOptionId=n.details.shippingOptionId),n.details&&n.details.cobrandedCardLabel&&(t.cobrandedCardLabel=n.details.cobrandedCardLabel),t},I.prototype._verifyConsistentCurrency=function(e){var t,n=!0;return!e.currency||!(e.hasOwnProperty("shippingOptions")&&Array.isArray(e.shippingOptions)&&!(n=e.shippingOptions.every(function(t){return!(!t.amount||!t.amount.currency)&&e.currency.toLowerCase()===t.amount.currency.toLowerCase()})))&&!(e.hasOwnProperty("lineItems")&&Array.isArray(e.lineItems)&&e.lineItems.length>0&&!(n=e.lineItems.every(function(t){return!t.unitTaxAmountCurrency||e.currency.toLowerCase()===t.unitTaxAmountCurrency.toLowerCase()}
2)))&&(e.hasOwnProperty("amountBreakdown")&&e.amountBreakdown&&(t=e.amountBreakdown,n=!["shippingCurrency","handlingCurrency","taxTotalCurrency","insuranceCurrency","shippingDiscountCurrency","discountCurrency"].some(function(n){return t.hasOwnProperty(n)&&t[n]&&e.currency.toLowerCase()!==t[n].toLowerCase()})),n)},I.prototype.updatePayment=function(e){var t,n=this;return e&&e.paymentId&&e.amount&&e.currency?n._contextId!==e.paymentId?Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_PAYMENT_NOT_FOUND)):n._verifyConsistentCurrency(e)?e.lineItems&&Array.isArray(e.lineItems)&&!e.lineItems.every(function(e){return e&&"object"==typeof e&&e.hasOwnProperty("quantity")&&e.hasOwnProperty("unitAmount")&&e.hasOwnProperty("name")&&e.hasOwnProperty("kind")})?Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_INVALID_LINE_ITEMS)):(t={amount:e.amount,currencyIsoCode:e.currency,paymentId:e.paymentId},n._merchantAccountId&&(t.merchantAccountId=n._merchantAccountId),e.lineItems&&(t.lineItems=e.lineItems),e.shippingOptions&&(t.shippingOptions=e.shippingOptions),e.amountBreakdown&&(t.amountBreakdown=e.amountBreakdown),n._clientPromise.then(function(n){return r.sendEvent(n,"paypal-checkout-v6.update-payment.started"),n.request({endpoint:"paypal_hermes/patch_payment_resource",method:"post",data:t}).then(function(t){return r.sendEvent(n,"paypal-checkout-v6.update-payment.succeeded"),{success:!0,orderId:e.paymentId,updates:t.updates||{}}}).catch(function(e){return r.sendEvent(n,"paypal-checkout-v6.update-payment.failed"),Promise.reject(a(e,{type:l.PAYPAL_CHECKOUT_V6_UPDATE_FAILED.type,code:l.PAYPAL_CHECKOUT_V6_UPDATE_FAILED.code,message:l.PAYPAL_CHECKOUT_V6_UPDATE_FAILED.message}))})})):Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_CURRENCY_MISMATCH)):Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_INVALID_UPDATE_OPTIONS))},I.prototype.findEligibleMethods=function(e){var t=this;return this._clientPromise.then(function(n){return e&&e.currency?(t._paypalInstance?Promise.resolve(t._paypalInstance):t._createPayPalInstance({components:["paypal-payments"]}).then(function(e){return t._paypalInstance=e,e})).then(function(t){if(!t||"function"!=typeof t.findEligibleMethods)return Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_SDK_NOT_INITIALIZED));r.sendEvent(n,f.ANALYTICS_EVENTS.FIND_ELIGIBLE_METHODS_STARTED);var i={currencyCode:e.currency};return e.amount&&(i.amount=e.amount),e.countryCode&&(i.countryCode=e.countryCode),e.paymentFlow&&(i.paymentFlow=e.paymentFlow),t.findEligibleMethods(i).then(function(e){r.sendEvent(n,f.ANALYTICS_EVENTS.FIND_ELIGIBLE_METHODS_SUCCEEDED);var t=e&&"function"==typeof e.isEligible;return{paypal:t?e.isEligible("paypal"):Boolean(e&&e.paypal),paylater:t?e.isEligible("paylater"):Boolean(e&&e.paylater),credit:t?e.isEligible("credit"):Boolean(e&&e.credit),getDetails:function(t){return e.getDetails(t)}}}).catch(function(e){throw r.sendEvent(n,f.ANALYTICS_EVENTS.FIND_ELIGIBLE_METHODS_FAILED),a(e,{type:l.PAYPAL_CHECKOUT_V6_ELIGIBILITY_CHECK_FAILED.type,code:l.PAYPAL_CHECKOUT_V6_ELIGIBILITY_CHECK_FAILED.code,message:l.PAYPAL_CHECKOUT_V6_ELIGIBILITY_CHECK_FAILED.message})})}):Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_INVALID_ELIGIBILITY_OPTIONS))})},I.prototype.createMessages=function(e){var t=this;return this._clientPromise.then(function(n){return r.sendEvent(n,f.ANALYTICS_EVENTS.CREATE_MESSAGES_STARTED),t._paypalMessagesSdkInstance||t._isPayPalSdkAvailable()?(t._initializePayPalInstance("messages"),(t._paypalMessagesSdkInstance?Promise.resolve(t._paypalMessagesSdkInstance):t._messagesInstancePromise).then(function(t){if(!t||"function"!=typeof t.createPayPalMessages)return Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_SDK_NOT_INITIALIZED));var i=t.createPayPalMessages(e);return r.sendEvent(n,f.ANALYTICS_EVENTS.CREATE_MESSAGES_SUCCEEDED),i}).catch(function(e){throw r.sendEvent(n,f.ANALYTICS_EVENTS.CREATE_MESSAGES_FAILED),a(e,{type:l.PAYPAL_CHECKOUT_V6_MESSAGES_CREATION_FAILED.type,code:l.PAYPAL_CHECKOUT_V6_MESSAGES_CREATION_FAILED.code,message:l.PAYPAL_CHECKOUT_V6_MESSAGES_CREATION_FAILED.message})})):(r.sendEvent(n,f.ANALYTICS_EVENTS.CREATE_MESSAGES_FAILED),Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_SDK_NOT_INITIALIZED)))})},I.prototype.startVaultInitiatedCheckout=function(e){var t,n=this;return this._vaultInitiatedCheckoutInProgress?this._clientPromise.then(function(e){return r.sendEvent(e,"paypal-checkout-v6.vic.error.already-in-progress"),Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_VIC_IN_PROGRESS))}):(y.forEach(function(n){t||e&&e[n]||(t=n)}),t?Promise.reject(new o({type:l.PAYPAL_CHECKOUT_V6_VIC_PARAM_REQUIRED.type,code:l.PAYPAL_CHECKOUT_V6_VIC_PARAM_REQUIRED.code,message:"Required param "+t+" is missing."})):(this._vaultInitiatedCheckoutInProgress=!0,this._addModalBackdrop(e),Promise.all([n._clientPromise,n._frameServicePromise]).then(function(t){var o=t[0],a=i({},e,{flow:"checkout",returnUrl:n._constructVaultCheckoutUrl("redirect-frame"),cancelUrl:n._constructVaultCheckoutUrl("cancel-frame")});r.sendEvent(o,"paypal-checkout-v6.vic.started");var s=new h;return n._frameService.open({},n._createFrameServiceCallback(s)),n._createPaymentResource(a).then(function(e){return n._frameService.redirect(e.paymentResource.redirectUrl),s})}).then(function(e){return n._frameService.close(),n._vaultInitiatedCheckoutInProgress=!1,n._removeModalBackdrop(),n._clientPromise.then(function(t){return r.sendEvent(t,"paypal-checkout-v6.vic.succeeded"),e})}).catch(function(e){if(n._vaultInitiatedCheckoutInProgress=!1,n._removeModalBackdrop(),n._frameService&&n._frameService.close(),"FRAME_SERVICE_FRAME_CLOSED"===e.code)return n._clientPromise.then(function(e){return r.sendEvent(e,"paypal-checkout-v6.vic.canceled-by-customer"),Promise.reject(new o(l.PAYPAL_CHECKOUT_V6_VIC_CA
2NCELED))});if(e.code&&e.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1)return n._clientPromise.then(function(t){return r.sendEvent(t,"paypal-checkout-v6.vic.failed.popup-not-opened"),Promise.reject(new o({code:l.PAYPAL_CHECKOUT_V6_VIC_POPUP_OPEN_FAILED.code,type:l.PAYPAL_CHECKOUT_V6_VIC_POPUP_OPEN_FAILED.type,message:l.PAYPAL_CHECKOUT_V6_VIC_POPUP_OPEN_FAILED.message,details:{originalError:e}}))});throw e})))},I.prototype.closeVaultInitiatedCheckoutWindow=function(){var e=this,t=this._vaultInitiatedCheckoutInProgress;return this._waitForVaultInitiatedCheckoutDependencies().then(function(){t&&e._clientPromise.then(function(e){r.sendEvent(e,"paypal-checkout-v6.vic.canceled-by-merchant")}),e._frameService.close(),e._vaultInitiatedCheckoutInProgress=!1,e._removeModalBackdrop()})},I.prototype.focusVaultInitiatedCheckoutWindow=function(){var e=this;return this._waitForVaultInitiatedCheckoutDependencies().then(function(){e._frameService.focus()})},I.prototype._addModalBackdrop=function(e){e.optOutOfModalBackdrop||(this._modalBackdrop||(this._modalBackdrop=document.createElement("div"),this._modalBackdrop.setAttribute("data-braintree-paypal-vault-initiated-checkout-modal",!0),this._modalBackdrop.style.position="fixed",this._modalBackdrop.style.top=0,this._modalBackdrop.style.bottom=0,this._modalBackdrop.style.left=0,this._modalBackdrop.style.right=0,this._modalBackdrop.style.zIndex=9999,this._modalBackdrop.style.background="black",this._modalBackdrop.style.opacity="0.7",this._modalBackdrop.addEventListener("click",function(){this.focusVaultInitiatedCheckoutWindow()}.bind(this))),document.body.appendChild(this._modalBackdrop))},I.prototype._removeModalBackdrop=function(){this._modalBackdrop&&this._modalBackdrop.parentNode&&this._modalBackdrop.parentNode.removeChild(this._modalBackdrop)},I.prototype._constructVaultCheckoutUrl=function(e){var t=this._frameService._serviceId;return this._assetsUrl+"/html/"+e+E(this._isDebug)+".html?channel="+t},I.prototype._waitForVaultInitiatedCheckoutDependencies=function(){var e=this;return this._clientPromise.then(function(){return e._frameServicePromise})},I.prototype._createFrameServiceCallback=function(e){var t=this;return function(n,r){var i,o,a;n?e.reject(n):r&&(i=r.PayerID||r.payerId||r.payerid,o=r.orderId||r.orderid||r.OrderID,a={paymentToken:r.token,payerID:i,paymentID:r.paymentId,orderID:o},t._frameService.redirect(t._loadingFrameUrl),t.tokenizePayment(a).then(function(t){e.resolve(t)}).catch(function(t){e.reject(t)}))}},I.prototype.teardown=function(){return _(this,p(I.prototype)),this._paypalScript&&this._paypalScript.parentNode&&this._paypalScript.parentNode.removeChild(this._paypalScript),this._clientPromise.then(function(e){r.sendEvent(e,f.ANALYTICS_EVENTS.TEARDOWN)})},t.exports=m.wrapPrototype(I)},{"../lib/analytics":144,"../lib/assign":146,"../lib/braintree-error":149,"../lib/constants":150,"../lib/convert-methods-to-error":151,"../lib/convert-to-braintree-error":152,"../lib/create-assets-url":153,"../lib/create-authorization-data":154,"../lib/create-deferred-client":155,"../lib/frame-service/external":163,"../lib/methods":181,"../lib/use-min":187,"./constants":208,"./errors":209,"@braintree/extended-promise":34,"@braintree/wrap-promise":43}],212:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={PAYPAL_NOT_ENABLED:{type:r.types.MERCHANT,code:"PAYPAL_NOT_ENABLED",message:"PayPal is not enabled for this merchant."},PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED:{type:r.types.MERCHANT,code:"PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED",message:"A linked PayPal Sandbox account is required to use PayPal Checkout in Sandbox. See https://developer.paypal.com/braintree/docs/guides/paypal/testing-go-live#linked-paypal-testing for details on linking your PayPal sandbox with Braintree."},PAYPAL_ACCOUNT_TOKENIZATION_FAILED:{type:r.types.NETWORK,code:"PAYPAL_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's PayPal account."},PAYPAL_FLOW_FAILED:{type:r.types.NETWORK,code:"PAYPAL_FLOW_FAILED",message:"Could not initialize PayPal flow."},PAYPAL_FLOW_OPTION_REQUIRED:{type:r.types.MERCHANT,code:"PAYPAL_FLOW_OPTION_REQUIRED",message:"PayPal flow property is invali
2d or missing."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED:{type:r.types.MERCHANT,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED"},PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED:{type:r.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:r.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:r.types.CUSTOMER,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED",message:"Customer closed PayPal popup before authorizing."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS:{type:r.types.MERCHANT,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS",message:"Vault initiated checkout already in progress."},PAYPAL_INVALID_PAYMENT_OPTION:{type:r.types.MERCHANT,code:"PAYPAL_INVALID_PAYMENT_OPTION",message:"PayPal payment options are invalid."},PAYPAL_MISSING_REQUIRED_OPTION:{type:r.types.MERCHANT,code:"PAYPAL_MISSING_REQUIRED_OPTION",message:"Missing required option."}}},{"../lib/braintree-error":149}],213:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("@braintree/wrap-promise"),o=e("./paypal-checkout");t.exports={create:i(function(e){return r.verify({name:"PayPal Checkout",client:e.client,authorization:e.authorization}).then(function(){return new o(e)._initialize(e)})}),isSupported:function(){return!0},VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"./paypal-checkout":214,"@braintree/wrap-promise":43}],214:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/assign").assign,o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("@braintree/extended-promise"),c=e("@braintree/wrap-promise"),d=e("../lib/braintree-error"),l=e("../lib/convert-to-braintree-error"),u=e("./errors"),p=e("../paypal/shared/constants"),_=e("../lib/frame-service/external"),E=e("../lib/create-authorization-data"),m=e("../lib/methods"),h=e("../lib/use-min"),f=e("../lib/convert-methods-to-error"),A=e("../lib/querystring"),y=e("../lib/constants").INTEGRATION_TIMEOUT_MS,I=["amount","currency","vaultInitiatedCheckoutPaymentMethodToken"];function T(e){this._merchantAccountId=e.merchantAccountId,this._autoSetDataUserIdToken=Boolean(e.autoSetDataUserIdToken)}s.suppressUnhandledPromiseMessage=!0,T.prototype._initialize=function(e){var t;return e.client?(t=e.client.getConfiguration(),this._authorizationInformation={fingerprint:t.authorizationFingerprint,environment:t.gatewayConfiguration.environment}):(t=E(e.authorization),this._authorizationInformation={fingerprint:t.attrs.authorizationFingerprint,environment:t.environment}),this._clientPromise=o.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:a.create(e.authorization),name:"PayPal Checkout"}).then(function(e){return this._configuration=e.getConfiguration(),this._merchantAccountId||(this._configuration.gatewayConfiguration.paypalEnabled?!0===this._configuration.gatewayConfiguration.paypal.environmentNoNetwork&&(this._setupError=new d(u.PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED)):this._setupError=new d(u.PAYPAL_NOT_ENABLED)),this._setupError?Promise.reject(this._setupError):(r.sendEvent(e,"paypal-checkout.initialized"),this._frameServicePromise=this._setupFrameService(e),e)}.bind(this)),e.client?this._clientPromise.then(function(){return this}.bind(this)):Promise.resolve(this)},T.prototype._setupFrameService=function(e){var t=new s,n=e.getConfiguration(),i=setTimeout(function(){r.sendEvent(e,"paypal-checkout.frame-service.timed-out"),t.reject(new d(u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED))},y);return this._assetsUrl=n.gatewayConfiguration.paypal.assetsUrl+"/web/3.143.0",this._isDebug=n.isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/paypal-landing-frame"+h(this._isDebug)+".html",_.create({name:"braintreepaypallanding",dispatchFrameUrl:this._assetsUrl+"/html/dispatch-frame"+h(this._isDebug)+".html",openFrameUrl:this._loadingFrameUrl},function(e){this._frameService=e,clearTimeout(i),t.resolve()}.bind(this)),t},T.prototype.createPayment=function(e){var t=this;return e&&p.FLOW_ENDPOINTS.hasOwnProperty(e.flow)?(r.sendEvent(this._clientPromise,"paypal-checkout.createPayment"),this._createPaymentResource(e).then(function(n){var r;return r="checkout"===e.flow?A.parse(n.paymentResource.redirectUrl).token:n.agreementSetup.tokenId,t._contextId=r,r})):Promise.reject(new d(u.PAYPAL_FLOW_OPTION_REQUIRED))},T.prototype._createPaymentResource=function(e,t){var n=this,i="paypal_hermes/"+p.FLOW_ENDPOINTS[e.flow];return this._flow=e.flow,delete this.intentFromCreatePayment,t=t||{},!0===e.offerCredit&&r.sendEvent(this._clientPromise,"paypal-checkout.credit.offered"),this._clientPromise.then(function(r){return r.request({endpoint:i,method:"post",data:n._formatPaymentResourceData(e,t)}).then(function(t){return n.intentFromCreatePayment=e.intent,t})}).catch(function(e){return n._setupError?Promise.reject(n._setupError):422===(e.details&&e.details.httpStatus)?Promise.reject(new d({type:u.PAYPAL_INVALID_PAYMENT_OPTION.type,code:u.PAYPAL_INVALID_PAYMENT_OPTION.code,message:u.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:e}})):Promise.reject(l(e,{type:u.PAYPAL_FLOW_FAILED.type,code:u.PAYPAL_FLOW_FAILED.code,message:u.PAYPAL_FLOW_FAILED.message}))})},T.prototype.updatePayment=function(e){var t=this;return!e||this._hasMissingOption(e,p.REQUIRED_OPTIONS)?(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment.missing-options",{flow:t._flow,context_id:t._contextId}),Promise.reject(new d(u.PAYPAL_MISSING_REQUIRED_OPTION))):this._verifyConsistentCurrency(e)?(r.sendEventPlus(this._clientPromise,"paypal-checkout.updatePayment",{flow:t._flow,context_id:t._contextId}),this._clientPromise.then(function(n){return n.request({endpoint:"paypal_hermes/patch_payment_resource",method:"post",data:t._formatUpdatePaymentData(e)})}).catch(function(e){return 422===(e.details&&e.details.httpStatus)?(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment.invali
2d",{flow:t._flow,context_id:t._contextId}),Promise.reject(new d({type:u.PAYPAL_INVALID_PAYMENT_OPTION.type,code:u.PAYPAL_INVALID_PAYMENT_OPTION.code,message:u.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:e}}))):(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment."+u.PAYPAL_FLOW_FAILED.code,{flow:t._flow,context_id:t._contextId}),Promise.reject(l(e,{type:u.PAYPAL_FLOW_FAILED.type,code:u.PAYPAL_FLOW_FAILED.code,message:u.PAYPAL_FLOW_FAILED.message})))})):(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment.inconsistent-currencies",{flow:t._flow,context_id:t._contextId}),Promise.reject(new d({type:u.PAYPAL_INVALID_PAYMENT_OPTION.type,code:u.PAYPAL_INVALID_PAYMENT_OPTION.code,message:u.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:new Error("One or more shipping option currencies differ from checkout currency.")}})))},T.prototype.startVaultInitiatedCheckout=function(e){var t,n=this;return this._vaultInitiatedCheckoutInProgress?(r.sendEventPlus(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.error.already-in-progress",{flow:n._flow,context_id:n._contextId}),Promise.reject(new d(u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS))):(I.forEach(function(n){e.hasOwnProperty(n)||(t=n)}),t?Promise.reject(new d({type:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.type,code:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.code,message:"Required param "+t+" is missing."})):(this._vaultInitiatedCheckoutInProgress=!0,this._addModalBackdrop(e),e=i({},e,{flow:"checkout"}),r.sendEventPlus(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.started",{flow:n._flow,context_id:n._contextId}),this._waitForVaultInitiatedCheckoutDependencies().then(function(){var t=new s,r=n._createPaymentResource(e,{returnUrl:n._constructVaultCheckoutUrl("redirect-frame"),cancelUrl:n._constructVaultCheckoutUrl("cancel-frame")}).then(function(e){var r=e.paymentResource.redirectUrl;return n._frameService.redirect(r),t});return n._frameService.open({},n._createFrameServiceCallback(t)),r}).catch(function(e){return n._vaultInitiatedCheckoutInProgress=!1,n._removeModalBackdrop(),"FRAME_SERVICE_FRAME_CLOSED"===e.code?(r.sendEventPlus(n._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.canceled.by-customer",{flow:n._flow,context_id:n._contextId}),Promise.reject(new d(u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED))):(n._frameService&&n._frameService.close(),e.code&&e.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1?(r.sendEventPlus(n._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.failed.popup-not-opened",{flow:n._flow,context_id:n._contextId}),Promise.reject(new d({code:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.code,type:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.type,message:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.message,details:{originalError:e}}))):Promise.reject(e))}).then(function(e){return n._frameService.close(),n._vaultInitiatedCheckoutInProgress=!1,n._removeModalBackdrop(),r.sendEventPlus(n._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.succeeded",{flow:n._flow,context_id:n._contextId}),Promise.resolve(e)})))},T.prototype._addModalBackdrop=function(e){e.optOutOfModalBackdrop||(this._modalBackdrop||(this._modalBackdrop=document.createElement("div"),this._modalBackdrop.setAttribute("data-braintree-paypal-vault-initiated-checkout-modal",!0),this._modalBackdrop.style.position="fixed",this._modalBackdrop.style.top=0,this._modalBackdrop.style.bottom=0,this._modalBackdrop.style.left=0,this._modalBackdrop.style.right=0,this._modalBackdrop.style.zIndex=9999,this._modalBackdrop.style.background="black",this._modalBackdrop.style.opacity="0.7",this._modalBackdrop.addEventListener("click",function(){this.focusVaultInitiatedCheckoutWindow()}.bind(this))),document.body.appendChild(this._modalBackdrop))},T.prototype._removeModalBackdrop=function(){this._modalBackdrop&&this._modalBackdrop.parentNode&&this._modalBackdrop.parentNode.removeChild(this._modalBackdrop)},T.prototype.closeVaultInitiatedCheckoutWindow=function(){return this._vaultInitiatedCheckoutInProgress&&r.sendEventPlus(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.canceled.by-merchant",{flow:this._flow,context_id:this._contextId}),this._waitForVaultInitiatedCheckoutDependencies().then(function(){this._frameService.close()}.bind(this))}
2,T.prototype.focusVaultInitiatedCheckoutWindow=function(){return this._waitForVaultInitiatedCheckoutDependencies().then(function(){this._frameService.focus()}.bind(this))},T.prototype._createFrameServiceCallback=function(e){var t=this;return function(n,r){n?e.reject(n):r&&(t._frameService.redirect(t._loadingFrameUrl),t.tokenizePayment({paymentToken:r.token,payerID:r.PayerID,paymentID:r.paymentId,orderID:r.orderId}).then(function(t){e.resolve(t)}).catch(function(t){e.reject(t)}))}},T.prototype._waitForVaultInitiatedCheckoutDependencies=function(){var e=this;return this._clientPromise.then(function(){return e._frameServicePromise})},T.prototype._constructVaultCheckoutUrl=function(e){var t=this._frameService._serviceId;return this._assetsUrl+"/html/"+e+h(this._isDebug)+".html?channel="+t},T.prototype.tokenizePayment=function(e){var t,n=this,i=!0,o={flow:this._flow,intent:e.intent||this.intentFromCreatePayment},a={ecToken:e.paymentToken,billingToken:e.billingToken,payerId:e.payerID,paymentId:e.paymentID,orderId:e.orderID,shippingOptionsId:e.shippingOptionsId};return e.hasOwnProperty("vault")&&(i=e.vault),o.vault=i,r.sendEventPlus(this._clientPromise,"paypal-checkout.tokenization.started",{flow:n._flow,context_id:n._contextId}),this._clientPromise.then(function(e){return e.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:n._formatTokenizeData(o,a)})}).then(function(e){return t=n._formatTokenizePayload(e),r.sendEventPlus(n._clientPromise,"paypal-checkout.tokenization.success",{flow:n._flow,context_id:n._contextId}),t.creditFinancingOffered&&r.sendEventPlus(n._clientPromise,"paypal-checkout.credit.accepted",{flow:n._flow,context_id:n._contextId}),t}).catch(function(e){return n._setupError?Promise.reject(n._setupError):(r.sendEventPlus(n._clientPromise,"paypal-checkout.tokenization.failed",{flow:n._flow,context_id:n._contextId}),Promise.reject(l(e,{type:u.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.type,code:u.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.code,message:u.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.message})))})},T.prototype.getClientId=function(){return this._clientPromise.then(function(e){return e.getConfiguration().gatewayConfiguration.paypal.clientId})},T.prototype.loadPayPalSDK=function(e){var t,n=new s,r=e&&e.dataAttributes||{},o=r["user-id-token"]||r["data-user-id-token"];return this._configuration&&(r["client-metadata-id"]=r["client-metadata-id"]?r["client-metadata-id"]:this._configuration.analyticsMetadata.sessionId,r["data-sdk-integration-source"]=p.BT_INTEGRATION_SOURCE),o||(o=this._authorizationInformation.fingerprint&&this._authorizationInformation.fingerprint.split("?")[0]),this._paypalScript=document.createElement("script"),delete(e=i({},{components:"buttons"},e)).dataAttributes,e.vault?e.intent=e.intent||"tokenize":(e.intent=e.intent||"authorize",e.currency=e.currency||"USD"),t=p.ENVIRONMENT[e.env]||"https://www.paypal.com/sdk/js?",delete e.env,this._paypalScript.onload=function(){n.resolve()},Object.keys(r).forEach(function(e){this._paypalScript.setAttribute("data-"+e.replace(/^data\-/,""),r[e])}.bind(this)),(e["client-id"]?Promise.resolve(e["client-id"]):this.getClientId()).then(function(n){e["client-id"]=n,this._autoSetDataUserIdToken&&o&&(this._paypalScript.setAttribute("data-user-id-token",o),this._attachPreloadPixel({id:n,userIdToken:o,amount:r.amount,currency:e.currency,merchantId:e["merchant-id"]})),this._paypalScript.src=A.queryify(t,e),document.head.insertBefore(this._paypalScript,document.head.firstElementChild)}.bind(this)),n.then(function(){return this}.bind(this))},T.prototype._attachPreloadPixel=function(e){var t,n=e.id,r=e.userIdToken,i="production"===this._authorizationInformation.environment?"":"sandbox.",o="https://www.{ENV}paypal.com/smart/buttons/preload".replace("{ENV}",i),a={"client-id":n,"user-id-token":r};e.amount&&(a.amount=e.amount),e.currency&&(a.currency=e.currency),e.merchantId&&(a["merchant-id"]=e.merchantId),(t=new XMLHttpRequest).open("GET",A.queryify(o,a)),t.send()},T.prototype._formatPaymentResourceData=function(e,t){var n=this._configuration.gatewayConfiguration,r={returnUrl:t.returnUrl||"https://www.paypal.com/checkoutnow/error",cancelUrl:t.cancelUrl||"https://www.paypal.com/checkoutnow/error",offerPaypalCredit:!0===e.offerCredit,merchantAccountId:this._merchantAccountId,experienceProfile:{brandName:e.displayName||n.paypal.displayName,localeCode:e.locale,noShipping:(!e.enableShippingAddress).toString(),addressOverride:!1===e.shippingAddressEditable,landingPageType:e.landingPageType},shippingOptions:e.shippingOptions,payer_email:e.userAuthenticationEmail};return e.hasOwnProperty("returnUrl")&&(r.returnUrl=e.returnUrl),e.hasOwnProperty("cancelUrl")&&(r.cancelUrl=e.cancelUrl),e.hasOwnProperty("appSwitchPreference")&&(r.appSwitchPreference=e.appSwitchPreference),e.hasOwnProperty("shippingCallbackUrl")&&(r.shippingCallbackUrl=e.shippingCallbackUrl),e.hasOwnProperty("paymentReadySessionId")&&(r.paymentReadySessionId=e.paymentReadySessionId),e.hasOwnProperty("amountBreakdown")&&(r.amountBreakdown=e.amountBreakdown),e.planType&&(r.planType=e.planType),e.planMetadata&&(r.planMetadata=this._formatPlanMetadata(e.planMetadata)),this._formatPaymentResourceCheckoutData(r,e),this._formatPaymentResourceVaultData(r,e),this._riskCorrelationId=e.riskCorrelationId,e.riskCorrelationId&&(r.correlationId=this._riskCorrelationId),r},T.prototype._formatPaymentResourceVaultData=function(e,t){"checkout"!==t.flow&&(e.shippingAddress=t.shippingAddressOverride,t.billingAgreementDescription&&(e.description=t.billingAgreementDescription),t.hasOwnProperty("userAction")&&(e.experienceProfile.userAction=t.userAction))},T.prototype._formatPaymentResourceCheckoutData=function(e,t){var n,r=t.intent;if("checkout"===t.flow){for(n in e.amount=t.amount,e.currencyIsoCode=t.currency,e.requestBillingAgreement=t.requestBillingAgreement,t.hasOwnProperty("userAction")&&(e.experienceProfile.userAction=t.userAction),r&&("capture"===r&&(r="sale"),e.intent=r),t.hasOwnProperty("lineItems")&&(e.lineItems=t.lineItems),t.hasOwnProperty("vaultInitiatedCheckoutPaymentMethodToken")&&(e.vaultInitiatedCheckoutPaymentMethodToken=t.vaultInitiatedCheckoutPaymentMethodToken),t.hasOwnProperty("shippingOptions")&&(e.shippingOptions=t.shippingOptions),t.shippingAddressOverride)t.shippingAddressOverride.hasOwnProperty(n)&&(e[n]=t.shippingAddressOverride[n]);t.contactPreference&&(e.contactPreference=t.contactPreference),t.hasOwnProperty("billingAgreementDetails")&&(e.billingAgreementDetails=t.billingAgreementDetails)}},T.prototype._verifyConsistentCurrency=function(e){return!(e.currency&&e.hasOwnProperty("shippingOptions")&&Array.isArray(e.shippingOptions))||e.shippingOptions.every(function(t){return t.amount&&t.amount.currency&&e.currency.toLowerCase()===t.amount.currency.toLowerCase()})},T.prototype._hasMissingOption=function(e,t){var n,r;if(t=t||[],!e.hasOwnProperty("amount")&&!e.hasOwnProperty("lineItems"))return!0;for(n=0;n<t.length;n++)if(r=t[n],!e.hasOwnProperty(r))return!0;return!1},T.prototype._formatPlanMetadata=function(e){var t,n,r,i,o=["currencyIsoCode","name","oneTimeFeeAmount","productDescription","productPrice","productQuantity","shippingAmount","taxAmount","totalAmount"],a=["billingFrequency","billingFrequencyUnit","numberOfExecutions","sequence","startDate","trial","pricingScheme"],s={billingCycles:[]};if(e.hasOwnProperty("billingCycles"))for(s.billingCycles=[],t=0;t<e.billingCycles.length;t++){for(r=e.billingCycles[t],i={},n=0;n<a.length;n++)i[a[n]]=r[a[n]];s.billingCycles.push(i)}for(t=0;t<o.length;t++)s[o[t]]=e[o[t]];return s},T.prototype._formatUpdatePaymentData=function(e){var t=this,n={merchantAccountId:this._merchantAccountId,paymentId:e.paymentId||e.orderId,currencyIsoCode:e.currency};return e.hasOwnProperty("amount")&&(n.amount=e.amount),e.hasOwnProperty("lineItems")&&(n.lineItems=e.lineItems),e.hasOwnProperty("shippingOptions")&&(n.shippingOptions=e.shippingOptions),e.hasOwnProperty("amountBreakdown")&&(n.amountBreakdown=e.amountBreakdown),e.hasOwnProperty("shippingAddress")&&(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment.shippingAddress.provided.by-the-merchant",{flow:t._flow,context_id:t._contextId}),n.line1=e.shippingAddress.line1,e.shippingAddress.hasOwnProperty("line2")&&(n.line2=e.shippingAddress.line2),n.city=e.shippingAddress.city,n.state=e.shippingAddress.state,n.postalCode=e.shippingAddress.postalCode,n.countryCode=e.shippingAddress.countryCode,e.shippingAddress.hasOwnProperty("phone")&&(n.phone=e.shippingAddress.phone),e.shippingAddress.hasOwnProperty("recipientName")&&(n.recipientName=e.shippingAddress.recipientName)),n},T.prototype._formatTokenizeData=function(e,t){var n=this._configuration,r=n.gatewayConfiguration,i="TOKENIZATION_KEY"===n.authorizationType,o="vault"===e.flow||null==e.flow&&!t.paymentId,a={paypalAccount:{correlationId:this._riskCorrelationId||t.billingToken||t.ecToken,options:{validate:o&&!i&&e.vault}}};return o?a.paypalAccount.billingAgreementToken=t.billingToken:(a.paypalAccount.paymentToken=t.paymentId||t.orderId,a.paypalAccount.payerId=t.payerId,a.paypalAccount.unilateral=r.paypal.unvettedMerchant,e.intent&&(a.paypalAccount.intent=e.intent)),this._merchantAccountId&&(a.merchantAccountId=this._merchantAccountId),a},T.prototype._formatTokenizePayload=function(e){var t,n={};
2return e.paypalAccounts&&(n=e.paypalAccounts[0]),t={nonce:n.nonce,details:{},type:n.type},n.details&&n.details.payerInfo&&(t.details=n.details.payerInfo),n.details&&n.details.creditFinancingOffered&&(t.creditFinancingOffered=n.details.creditFinancingOffered),n.details&&n.details.shippingOptionId&&(t.shippingOptionId=n.details.shippingOptionId),n.details&&n.details.cobrandedCardLabel&&(t.cobrandedCardLabel=n.details.cobrandedCardLabel),t},T.prototype.teardown=function(){var e=this;return f(this,m(T.prototype)),this._paypalScript&&this._paypalScript.parentNode&&this._paypalScript.parentNode.removeChild(this._paypalScript),this._frameServicePromise.catch(function(){}).then(function(){return e._frameService?e._frameService.teardown():Promise.resolve()})},t.exports=c.wrapPrototype(T)},{"../lib/analytics":144,"../lib/assign":146,"../lib/braintree-error":149,"../lib/constants":150,"../lib/convert-methods-to-error":151,"../lib/convert-to-braintree-error":152,"../lib/create-assets-url":153,"../lib/create-authorization-data":154,"../lib/create-deferred-client":155,"../lib/frame-service/external":163,"../lib/methods":181,"../lib/querystring":183,"../lib/use-min":187,"../paypal/shared/constants":217,"./errors":212,"@braintree/extended-promise":34,"@braintree/wrap-promise":43}],215:[function(e,t,n){"use strict";var r=e("../../lib/frame-service/external"),i=e("../../lib/braintree-error"),o=e("../../lib/convert-to-braintree-error"),a=e("../../lib/use-min"),s=e("../../lib/once"),c="3.143.0",d=e("../shared/constants"),l=e("../../lib/constants").INTEGRATION_TIMEOUT_MS,u=e("../../lib/analytics"),p=e("../../lib/methods"),_=e("../../lib/deferred"),E=e("../shared/errors"),m=e("../../lib/convert-methods-to-error"),h=e("../../lib/querystring"),f=e("@braintree/wrap-promise");function A(e){this._client=e.client,this._assetsUrl=e.client.getConfiguration().gatewayConfiguration.paypal.assetsUrl+"/web/"+c,this._isDebug=e.client.getConfiguration().isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/paypal-landing-frame"+a(this._isDebug)+".html",this._authorizationInProgress=!1}A.prototype._initialize=function(){var e=this,t=this._client,n=setTimeout(function(){u.sendEvent(t,"paypal.load.timed-out")},l);return new Promise(function(i){r.create({name:d.LANDING_FRAME_NAME,dispatchFrameUrl:e._assetsUrl+"/html/dispatch-frame"+a(e._isDebug)+".html",openFrameUrl:e._loadingFrameUrl},function(r){e._frameService=r,clearTimeout(n),u.sendEvent(t,"paypal.load.succeeded"),i(e)})})},A.prototype.tokenize=function(e,t){var n,r,o=this,a=this._client;return t&&(t=s(_(t))),e&&d.FLOW_ENDPOINTS.hasOwnProperty(e.flow)?(n=new Promise(function(t,n){o._authorizationInProgress?(u.sendEvent(a,"paypal.tokenization.error.already-opened"),n(new i(E.PAYPAL_TOKENIZATION_REQUEST_ACTIVE))):(o._authorizationInProgress=!0,window.popupBridge||u.sendEvent(a,"paypal.tokenization.opened"),!0===e.offerCredit&&u.sendEvent(a,"paypal.credit.offered"),!0===e.offerPayLater&&u.sendEvent(a,"paypal.paylater.offered"),o._navigateFrameToAuth(e).catch(n),o._frameService.open({},o._createFrameServiceCallback(e,t,n)))}),t?(n.then(function(e){t(null,e)}).catch(t),this._frameService.createHandler({beforeClose:function(){u.sendEvent(a,"paypal.tokenization.closed.by-merchant")}})):n):(r=new i(E.PAYPAL_FLOW_OPTION_REQUIRED),t?(t(r),this._frameService.createNoopHandler()):Promise.reject(r))},A.prototype._createFrameServiceCallback=function(e,t,n){var r=this,o=this._client;return window.popupBridge?function(a,s){var c=s&&s.path&&"/cancel"===s.path.substring(0,7);r._authorizationInProgress=!1,a||c?(u.sendEvent(o,"popup-bridge:paypal:canceled"),n(new i(E.PAYPAL_POPUP_CLOSED))):s&&r._tokenizePayPal(e,s.queryItems).then(t).catch(n)}:function(a,s){r._authorizationInProgress=!1,a?"FRAME_SERVICE_FRAME_CLOSED"===a.code?(u.sendEvent(o,"paypal.tokenization.closed.by-user"),n(new i(E.PAYPAL_POPUP_CLOSED))):a.code&&a.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1&&n(new i({code:E.PAYPAL_POPUP_OPEN_FAILED.code,type:E.PAYPAL_POPUP_OPEN_FAILED.type,message:E.PAYPAL_POPUP_OPEN_FAILED.message,details:{originalError:a}}
2)):s&&r._tokenizePayPal(e,s).then(t).catch(n)}},A.prototype._tokenizePayPal=function(e,t){var n=this,r=this._client;return window.popupBridge||this._frameService.redirect(this._loadingFrameUrl),r.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:this._formatTokenizeData(e,t)}).then(function(e){var t=n._formatTokenizePayload(e);return window.popupBridge?u.sendEvent(r,"popup-bridge:paypal:succeeded"):u.sendEvent(r,"paypal.tokenization.success"),t.creditFinancingOffered&&u.sendEvent(r,"paypal.credit.accepted"),n._frameService.close(),t}).catch(function(e){return window.popupBridge?u.sendEvent(r,"popup-bridge:paypal:failed"):u.sendEvent(r,"paypal.tokenization.failed"),n._frameService.close(),Promise.reject(o(e,{type:E.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.type,code:E.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.code,message:E.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.message}))})},A.prototype._formatTokenizePayload=function(e){var t,n={};return e.paypalAccounts&&(n=e.paypalAccounts[0]),t={nonce:n.nonce,details:{},type:n.type},n.details&&n.details.payerInfo&&(t.details=n.details.payerInfo),n.details&&n.details.creditFinancingOffered&&(t.creditFinancingOffered=n.details.creditFinancingOffered),t},A.prototype._formatTokenizeData=function(e,t){var n=this._client.getConfiguration(),r=n.gatewayConfiguration,i="TOKENIZATION_KEY"===n.authorizationType,o={paypalAccount:{correlationId:t.ba_token||t.token,options:{validate:"vault"===e.flow&&!i}}};return t.ba_token?o.paypalAccount.billingAgreementToken=t.ba_token:(o.paypalAccount.paymentToken=t.paymentId,o.paypalAccount.payerId=t.PayerID,o.paypalAccount.unilateral=r.paypal.unvettedMerchant,e.hasOwnProperty("intent")&&(o.paypalAccount.intent=e.intent)),o},A.prototype._navigateFrameToAuth=function(e){var t=this,n=this._client,r="paypal_hermes/"+d.FLOW_ENDPOINTS[e.flow];return n.request({endpoint:r,method:"post",data:this._formatPaymentResourceData(e)}).then(function(r){var i;i="checkout"===e.flow?r.paymentResource.redirectUrl:r.agreementSetup.approvalUrl,"commit"===e.useraction&&(i=h.queryify(i,{useraction:"commit"})),window.popupBridge&&u.sendEvent(n,"popup-bridge:paypal:started"),t._frameService.redirect(i)}).catch(function(e){var n=e.details&&e.details.httpStatus;return t._frameService.close(),t._authorizationInProgress=!1,422===n?Promise.reject(new i({type:E.PAYPAL_INVALID_PAYMENT_OPTION.type,code:E.PAYPAL_INVALID_PAYMENT_OPTION.code,message:E.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:e}})):Promise.reject(o(e,{type:E.PAYPAL_FLOW_FAILED.type,code:E.PAYPAL_FLOW_FAILED.code,message:E.PAYPAL_FLOW_FAILED.message}))})},A.prototype._formatPaymentResourceData=function(e){var t,n=this._client.getConfiguration().gatewayConfiguration,r=this._frameService._serviceId,i={returnUrl:n.paypal.assetsUrl+"/web/"+c+"/html/redirect-frame"+a(this._isDebug)+".html?channel="+r,cancelUrl:n.paypal.assetsUrl+"/web/"+c+"/html/cancel-frame"+a(this._isDebug)+".html?channel="+r,offerPaypalCredit:!0===e.offerCredit,offerPayLater:!0===e.offerPayLater,experienceProfile:{brandName:e.displayName||n.paypal.displayName,localeCode:e.locale,noShipping:(!e.enableShippingAddress).toString(),addressOverride:!1===e.shippingAddressEditable,landingPageType:e.landingPageType}};if(window.popupBridge&&"function"==typeof window.popupBridge.getReturnUrlPrefix&&(i.returnUrl=window.popupBridge.getReturnUrlPrefix()+"return",i.cancelUrl=window.popupBridge.getReturnUrlPrefix()+"cancel"),"checkout"===e.flow)for(t in i.amount=e.amount,i.currencyIsoCode=e.currency,e.hasOwnProperty("intent")&&(i.intent=e.intent),e.shippingAddressOverride)e.shippingAddressOverride.hasOwnProperty(t)&&(i[t]=e.shippingAddressOverride[t]);else i.shippingAddress=e.shippingAddressOverride,e.billingAgreementDescription&&(i.description=e.billingAgreementDescription);return i},A.prototype.closeWindow=function(){this._authorizationInProgress&&u.sendEvent(this._client,"paypal.tokenize.closed.by-merchant"),this._frameService.close()},A.prototype.focusWindow=function(){this._frameService.focus()},A.prototype.teardown=f(function(){var e=this;return e._frameService.teardown(),m(e,p(A.prototype)),u.sendEvent(e._client,"paypal.teardown-completed"),Promise.resolve()}),t.exports=A},{"../../lib/analytics":144,"../../lib/braintree-error":149,"../../lib/constants":150,"../../lib/convert-methods-to-error":151,"../../lib/convert-to-braintree-error":152,"../../lib/deferred":156,"../../lib/frame-service/external":163,"../../lib/methods":181,"../../lib/once":182,"../../lib/querystring":183,"../../lib/use-min":187,"../shared/constants":217,"../shared/errors":218,"@braintree/wrap-promise":43}],216:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("../lib/braintree-error"),c=e("./shared/errors"),d=e("./external/paypal"),l=e("@braintree/wrap-promise");t.exports={create:l(function(e){var t="PayPal";return i.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return o.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:a.create(e.authorization),name:t})}).then(function(t){var n=t.getConfiguration();return e.client=t,!0!==n.gatewayConfiguration.paypalEnabled?Promise.reject(new s(c.PAYPAL_NOT_ENABLED)):(r.sendEvent(e.client,"paypal.initialized"),new d(e)._initialize())})}),isSupported:function(){return!0},VERSION:"3.143.0"}},{"../lib/analytics":144,"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./external/paypal":215,"./shared/errors":218,"@braintree/wrap-promise":43}],217:[function(e,t,n){"use strict";
2t.exports={LANDING_FRAME_NAME:"braintreepaypallanding",FLOW_ENDPOINTS:{checkout:"create_payment_resource",vault:"setup_billing_agreement"},REQUIRED_OPTIONS:["paymentId","currency"],ENVIRONMENT:{stage:"https://www.msmaster.qa.paypal.com/sdk/js?",sandbox:"https://www.sandbox.paypal.com/sdk/js?",teBraintree:"https://www.braintree.stage.paypal.com/sdk/js?"},BT_INTEGRATION_SOURCE:"BRAINTREE_WEB_SDK"}},{}],218:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error");t.exports={PAYPAL_NOT_ENABLED:{type:r.types.MERCHANT,code:"PAYPAL_NOT_ENABLED",message:"PayPal is not enabled for this merchant."},PAYPAL_TOKENIZATION_REQUEST_ACTIVE:{type:r.types.MERCHANT,code:"PAYPAL_TOKENIZATION_REQUEST_ACTIVE",message:"Another tokenization request is active."},PAYPAL_ACCOUNT_TOKENIZATION_FAILED:{type:r.types.NETWORK,code:"PAYPAL_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's PayPal account."},PAYPAL_FLOW_FAILED:{type:r.types.NETWORK,code:"PAYPAL_FLOW_FAILED",message:"Could not initialize PayPal flow."},PAYPAL_FLOW_OPTION_REQUIRED:{type:r.types.MERCHANT,code:"PAYPAL_FLOW_OPTION_REQUIRED",message:"PayPal flow property is invalid or missing."},PAYPAL_POPUP_OPEN_FAILED:{type:r.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:r.types.CUSTOMER,code:"PAYPAL_POPUP_CLOSED",message:"Customer closed PayPal popup before authorizing."},PAYPAL_INVALID_PAYMENT_OPTION:{type:r.types.MERCHANT,code:"PAYPAL_INVALID_PAYMENT_OPTION",message:"PayPal payment options are invalid."}}},{"../../lib/braintree-error":149}],219:[function(e,t,n){"use strict";var r=e("@braintree/wrap-promise"),i=e("../lib/basic-component-verification"),o=e("./preferred-payment-methods");t.exports={create:r(function(e){return i.verify({name:"PreferredPaymentMethods",client:e.client,authorization:e.authorization}).then(function(){return(new o).initialize(e)})}),VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"./preferred-payment-methods":220,"@braintree/wrap-promise":43}],220:[function(e,t,n){"use strict";var r=e("@braintree/wrap-promise"),i=e("../lib/analytics"),o=e("../lib/create-assets-url"),a=e("../lib/create-deferred-client");function s(){}s.prototype.initialize=function(e){var t=this;return this._clientPromise=a.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o.create(e.authorization),name:"PreferredPaymentMethods"}).catch(function(e){return t._setupError=e,Promise.reject(e)}),i.sendEvent(this._clientPromise,"preferred-payment-methods.initialized"),Promise.resolve(this)},s.prototype.fetchPreferredPaymentMethods=function(){var e,t=this;return this._clientPromise.then(function(t){return(e=t).request({api:"graphQLApi",data:{query:"query PreferredPaymentMethods { preferredPaymentMethods { paypalPreferred venmoPreferred } }"}})}).then(function(t){var n=t.data.preferredPaymentMethods.paypalPreferred,r=t.data.preferredPaymentMethods.venmoPreferred;return i.sendEvent(e,"preferred-payment-methods.paypal.api-detected."+n),i.sendEvent(e,"preferred-payment-methods.venmo.api-detected."+r),{paypalPreferred:n,venmoPreferred:r}}).catch(function(){return t._setupError?Promise.reject(t._setupError):(i.sendEvent(e,"preferred-payment-methods.api-error"),{paypalPreferred:!1,venmoPreferred:!1})})},t.exports=r.wrapPrototype(s)},{"../lib/analytics":144,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"@braintree/wrap-promise":43}],221:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error"),i=e("../shared/errors"),o=e("../../lib/frame-service/external"),a=e("../../lib/analytics"),s=e("../../lib/use-min"),c=e("../shared/constants").BILLING_ADDRESS_OPTIONS,d=e("../../lib/snake-case-to-camel-case"),l=e("../../lib/assign").assign,u=400,p=570;function _(e,t){var n={sepa_debit_account:{last_4:t.last4,merchant_or_partner_customer_id:t.customerId,bank_reference_token:t.bankReferenceToken,mandate_type:t.mandateType},merchant_account_id:t.merchantAccountId};return e.request({api:"clientApi",method:"post",endpoint:"payment_methods/sepa_debit_accounts",data:n}).then(function(e){if(!e.nonce)throw new r(i.SEPA_TRANSACTION_FAILED);return{nonce:e.nonce,ibanLastFour:t.last4,customerId:t.customerId,mandateType:t.mandateType}}).catch(function(){throw new r(i.SEPA_TRANSACTION_FAILED)})}t.exports={createMandate:function(e,t){var n={sepa_debit:{account_holder_name:t.accountHolderName,billing_address:{country_code:t.countryCode},iban:t.iban,merchant_or_partner_customer_id:t.customerId,mandate_type:t.mandateType},locale:t.locale,cancel_url:t.cancelUrl,return_url:t.returnUrl,merchant_account_id:t.merchantAccountId};
2return t.billingAddress&&c.forEach(function(e){var r=d(e);r in t.billingAddress&&(n.sepa_debit.billing_address[e]=t.billingAddress[r])}),e.request({api:"clientApi",method:"post",endpoint:"sepa_debit",data:n}).then(function(e){var t=e.message.body.sepaDebitAccount;if(!t)throw new r(i.SEPA_CREATE_MANDATE_FAILED);return{approvalUrl:t.approvalUrl,last4:t.last4,bankReferenceToken:t.bankReferenceToken}}).catch(function(){throw new r(i.SEPA_CREATE_MANDATE_FAILED)})},openPopup:function(e,t){var n=t.assetsUrl+"/html",c=t.debug||!1;return new Promise(function(d,l){var _={top:Math.round((window.outerHeight-p)/2)+window.screenTop,left:Math.round((window.outerWidth-u)/2)+window.screenLeft};o.create({name:"sepadirectdebit",dispatchFrameUrl:n+"/dispatch-frame"+s(c)+".html",openFrameUrl:n+"/sepa-landing-frame"+s(c)+".html",top:_.top,left:_.left,height:p,width:u},function(n){a.sendEvent(e,"sepa.popup.initialized"),n.open({},function(e,t){return function(e){return e&&e.success}(t)?(n.close(),d()):function(e,t){return e&&e.cancel||t&&"FRAME_SERVICE_FRAME_CLOSED"===t.code}(t,e)?(n.close(),l(new r(i.SEPA_CUSTOMER_CANCELED))):(n.close(),l(new r(i.SEPA_TOKENIZATION_FAILED)))}),n.redirect(t.approvalUrl)})})},handleApproval:_,POPUP_WIDTH:u,POPUP_HEIGHT:p,redirectPage:function(e){window.location.href=e},handleApprovalForFullPageRedirect:function(e,t){return e.request({api:"clientApi",method:"get",endpoint:"sepa_debit/"+t.cart_id}).then(function(n){var r=n.sepaDebitMandateDetail;return a.sendEvent(e,"sepa.redirect.mandate.approved"),l(t,{last4:r.last4,customerId:r.merchantOrPartnerCustomerId,mandateType:r.mandateType,bankReferenceToken:r.bankReferenceToken}),_(e,t)}).then(function(t){return a.sendEvent(e,"sepa.redirect.tokenization.success"),t}).catch(function(){throw a.sendEvent(e,"sepa.redirect.handle-approval.failed"),new r(i.SEPA_TRANSACTION_FAILED)})}}},{"../../lib/analytics":144,"../../lib/assign":146,"../../lib/braintree-error":149,"../../lib/frame-service/external":163,"../../lib/snake-case-to-camel-case":185,"../../lib/use-min":187,"../shared/constants":224,"../shared/errors":225}],222:[function(e,t,n){"use strict";var r=e("@braintree/wrap-promise"),i=e("../../lib/braintree-error"),o=e("../shared/errors"),a=e("../shared/constants"),s=e("./mandate"),c=e("../../lib/has-missing-option"),d=e("../../lib/analytics"),l=e("../../lib/assign").assign;function u(e){var t=e.client.getConfiguration();this._client=e.client,this._assetsUrl=t.gatewayConfiguration.assetsUrl+"/web/3.143.0",this._isDebug=t.isDebug,e.redirectUrl?(this._returnUrl=e.redirectUrl,this._cancelUrl=e.redirectUrl+"?cancel=1",this._isRedirectFlow=!0):(this._returnUrl=this._assetsUrl+"/html/redirect-frame.html?success=1",this._cancelUrl=this._assetsUrl+"/html/redirect-frame.html?cancel=1"),e.tokenizePayload&&(this.tokenizePayload=e.tokenizePayload),d.sendEvent(this._client,"sepa.component.initialized")}u.prototype.tokenize=function(e){var t,n=this,r=l({cancelUrl:n._cancelUrl,returnUrl:n._returnUrl},e);return!e||c(e,a.REQUIRED_OPTIONS)?(d.sendEvent(n._client,"sepa.input-validation.missing-options"),Promise.reject(new i(o.SEPA_TOKENIZE_MISSING_REQUIRED_OPTION))):a.MANDATE_TYPE_ENUM.includes(e.mandateType)?(t=s.createMandate(n._client,r).then(function(t){return d.sendEvent(n._client,"sepa.create-mandate.success"),n._isRedirectFlow?s.redirectPage(t.approvalUrl):(e.last4=t.last4,e.bankReferenceToken=t.bankReferenceToken,s.openPopup(n._client,{approvalUrl:t.approvalUrl,assetsUrl:n._assetsUrl}))}),n._isRedirectFlow?Promise.resolve():t.then(function(){return d.sendEvent(n._client,"sepa.mandate.approved"),s.handleApproval(n._client,{bankReferenceToken:e.bankReferenceToken,last4:e.last4,customerId:e.customerId,mandateType:e.mandateType,merchantAccountId:e.merchantAccountId})}).then(function(e){return d.sendEvent(n._client,"sepa.tokenization.success"),Promise.resolve(e)}).catch(function(e){return d.sendEvent(n._client,"sepa."+e.details+".failed"),Promise.reject(e)})):(d.sendEvent(n._client,"sepa.input-validation.invalid-mandate"),Promise.reject(new i(o.SEPA_INVALID_MANDATE_TYPE)))},t.exports=r.wrapPrototype(u)},{"../../lib/analytics":144,"../../lib/assign":146,"../../lib/braintree-error":149,"../../lib/has-missing-option":174,"../shared/constants":224,"../shared/errors":225,"./mandate":221,"@braintree/wrap-promise":43}],223:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("./external/sepa"),o=e("../lib/create-assets-url"),a=e("../lib/create-deferred-client"),s=e("../lib/basic-component-verification"),c=e("@braintree/wrap-promise"),d=e("../lib/querystring").parse,l=e("../lib/assign").assign,u=e("./external/mandate");t.exports={create:c(function(e){var t="SEPA",n=d(window.location.href);return s.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return a.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o.create(e.authorization),name:t})}).then(function(t){return e.client=t,r.sendEvent(t,"sepa.client.initialized"),new i(e)}).then(function(t){return n.success&&"true"===n.success&&n.cart_id?(e=l(e,n),u.handleApprovalForFullPageRedirect(e.client,e).then(function(e){return t.tokenizePayload=e,t}).catch(function(e){console.error("Problem while finishing tokenizing: ",e)})):(n.cancel&&r.sendEvent(e.client,"sepa.redirect.customer-canceled.failed"),t)})}),VERSION:"3.143.0"}},{"../lib/analytics":144,"../lib/assign":146,"../lib/basic-component-verification":147,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"../lib/querystring":183,"./external/mandate":221,"./external/sepa":222,"@braintree/wrap-promise":43}],224:[function(e,t,n){"use strict";
2t.exports={REQUIRED_OPTIONS:["iban","merchantAccountId","mandateType","customerId","accountHolderName","countryCode"],BILLING_ADDRESS_OPTIONS:["address_line_1","address_line_2","admin_area_1","admin_area_2","postal_code"],MANDATE_TYPE_ENUM:["ONE_OFF","RECURRENT"]}},{}],225:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error");t.exports={SEPA_CREATE_MANDATE_FAILED:{type:r.types.MERCHANT,code:"SEPA_CREATE_MANDATE_FAILED",message:"SEPA create mandate failed.",details:"create-mandate"},SEPA_CUSTOMER_CANCELED:{type:r.types.CUSTOMER,code:"SEPA_CUSTOMER_CANCELED",message:"User canceled SEPA authorization",details:"customer-canceled"},SEPA_INVALID_MANDATE_TYPE:{type:r.types.MERCHANT,code:"SEPA_INVALID_MANDATE_TYPE",message:"SEPA mandate type is invalid"},SEPA_TOKENIZATION_FAILED:{type:r.types.UNKNOWN,code:"SEPA_TOKENIZATION_FAILED",message:"SEPA encountered a problem",details:"open-popup"},SEPA_TOKENIZE_MISSING_REQUIRED_OPTION:{type:r.types.MERCHANT,code:"SEPA_TOKENIZE_MISSING_REQUIRED_OPTION",message:"Missing required option for tokenize."},SEPA_TRANSACTION_FAILED:{type:r.types.UNKNOWN,code:"SEPA_TRANSACTION_FAILED",message:"SEPA transaction failed",details:"handle-approval"}}},{"../../lib/braintree-error":149}],226:[function(e,t,n){"use strict";var r=e("../../../lib/assign").assign,i=e("../../../lib/analytics"),o=e("../../../lib/braintree-error"),a=e("../../../lib/is-verified-domain"),s=e("@braintree/extended-promise"),c=e("@braintree/event-emitter"),d=e("../../shared/errors"),l=e("@braintree/iframer"),u=e("framebus"),p=e("../../shared/constants"),_=e("@braintree/uuid"),E=e("../../shared/events"),m=e("../../../lib/use-min"),h=e("../../../lib/constants").BUS_CONFIGURATION_REQUEST_EVENT,f="3.143.0";function A(e){c.call(this),this._client=e.client,this._createPromise=e.createPromise,this._createOptions=e,this._client?(this._isDebug=this._client.getConfiguration().isDebug,this._assetsUrl=this._client.getConfiguration().gatewayConfiguration.assetsUrl):(this._isDebug=Boolean(e.isDebug),this._assetsUrl=e.assetsUrl),this._assetsUrl=this._assetsUrl+"/web/"+f}s.suppressUnhandledPromiseMessage=!0,c.createChild(A),A.prototype._waitForClient=function(){return this._client?Promise.resolve():this._createPromise.then(function(e){this._client=e}.bind(this))},A.prototype.setUpEventListeners=function(){throw new o(d.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},A.prototype.verifyCard=function(e,t){var n,r,o=this;return t=t||{},(r=this._checkForVerifyCardError(e,t))?Promise.reject(r):(this._verifyCardInProgress=!0,n=this._formatVerifyCardOptions(e),this._formatLookupData(n).then(function(e){return i.sendEvent(o._createPromise,"three-d-secure.verification-flow.started"),o._performLookup(n.nonce,e)}).then(function(e){return i.sendEvent(o._createPromise,"three-d-secure.verification-flow.3ds-version."+e.lookup.threeDSecureVersion),o._onLookupComplete(e,n)}).then(function(e){return o.initializeChallengeWithLookupResponse(e,n)}).then(function(e){return o._resetVerificationState(),i.sendEvent(o._createPromise,"three-d-secure.verification-flow.completed"),e}).catch(function(e){return o._resetVerificationState(),i.sendEvent(o._createPromise,"three-d-secure.verification-flow.failed"),Promise.reject(e)}))},A.prototype._checkForFrameworkSpecificVerifyCardErrors=function(){throw new o(d.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},A.prototype._presentChallenge=function(){throw new o(d.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},A.prototype.prepareLookup=function(){throw new o(d.THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED)},A.prototype._resetVerificationState=function(){this._verifyCardInProgress=!1,this._verifyCardPromisePlus=null,"function"==typeof this._reloadThreeDSecure&&this._reloadThreeDSecure()},A.prototype._performLookup=function(e,t){var n=this,r="payment_methods/"+e+"/three_d_secure/lookup";return this._waitForClient().then(function(){return n._client.request({endpoint:r,method:"post",data:t}).catch(function(e){var t,r=e&&e.details&&e.details.httpStatus,a="three-d-secure.verification-flow.lookup-failed";return 404===r?(t=d.THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR,a+=".404"):422===r?(t=d.THREEDS_LOOKUP_VALIDATION_ERROR,a+=".422"):t=d.THREEDS_LOOKUP_ERROR,i.sendEvent(n._createPromise,a),Promise.reject(new o({type:t.type,code:t.code,message:t.message,details:{originalError:e}}))})})},A.prototype._existsAndIsNumeric=function(e){return!(null==e||Array.isArray(e)||"boolean"==typeof e||"string"==typeof e&&""===e.trim()||isNaN(Number(e)))},A.prototype._checkForVerifyCardError=function(e,t){var n;return!0===this._verifyCardInProgress?new o(d.THREEDS_AUTHENTICATION_IN_PROGRESS):(e.nonce?this._existsAndIsNumeric(e.amount)||(n="an amount"):n="a nonce",n||(n=this._checkForFrameworkSpecificVerifyCardErrors(e,t)),n?new o({type:d.THREEDS_MISSING_VERIFY_CARD_OPTION.type,code:d.THREEDS_MISSING_VERIFY_CARD_OPTION.code,message:"verifyCard o
2ptions must include "+n+"."}):null)},A.prototype.initializeChallengeWithLookupResponse=function(e,t){var n=this;return t=t||{},this._lookupPaymentMethod=e.paymentMethod,n._verifyCardPromisePlus=n._verifyCardPromisePlus||new s,n._handleLookupResponse(e,t),n._verifyCardPromisePlus.then(function(e){return i.sendEvent(n._createPromise,"three-d-secure.verification-flow.liability-shifted."+String(e.liabilityShifted)),i.sendEvent(n._createPromise,"three-d-secure.verification-flow.liability-shift-possible."+String(e.liabilityShiftPossible)),e})},A.prototype._handleLookupResponse=function(e,t){var n,r=Boolean(e.lookup&&e.lookup.acsUrl);i.sendEvent(this._createPromise,"three-d-secure.verification-flow.challenge-presented."+String(r)),r?this._presentChallenge(e,t):((n=this._formatAuthResponse(e.paymentMethod,e.threeDSecureInfo)).verificationDetails=e.threeDSecureInfo,this._verifyCardPromisePlus.resolve(n))},A.prototype._onLookupComplete=function(e){return this._lookupPaymentMethod=e.paymentMethod,this._verifyCardPromisePlus=new s,Promise.resolve(e)},A.prototype._formatAuthResponse=function(e,t){return{nonce:e.nonce,type:e.type,binData:e.binData,details:e.details,description:e.description&&e.description.replace(/\+/g," "),liabilityShifted:t&&t.liabilityShifted,liabilityShiftPossible:t&&t.liabilityShiftPossible,threeDSecureInfo:e.threeDSecureInfo}},A.prototype._formatVerifyCardOptions=function(e){return r({},e)},A.prototype._formatLookupData=function(e){var t={amount:e.amount};return!0===e.collectDeviceData&&(t.browserColorDepth=window.screen.colorDepth,t.browserJavaEnabled=window.navigator.javaEnabled(),t.browserJavascriptEnabled=!0,t.browserLanguage=window.navigator.language,t.browserScreenHeight=window.screen.height,t.browserScreenWidth=window.screen.width,t.browserTimeZone=(new Date).getTimezoneOffset(),t.deviceChannel="Browser"),Promise.resolve(t)},A.prototype._handleV1AuthResponse=function(e){var t=JSON.parse(e.auth_response);t.success?this._verifyCardPromisePlus.resolve(this._formatAuthResponse(t.paymentMethod,t.threeDSecureInfo)):t.threeDSecureInfo&&t.threeDSecureInfo.liabilityShiftPossible?this._verifyCardPromisePlus.resolve(this._formatAuthResponse(this._lookupPaymentMethod,t.threeDSecureInfo)):this._verifyCardPromisePlus.reject(new o({type:o.types.UNKNOWN,code:"UNKNOWN_AUTH_RESPONSE",message:t.error.message}))},A.prototype.cancelVerifyCard=function(){var e,t;return this._verifyCardInProgress=!1,this._lookupPaymentMethod?(t=this._lookupPaymentMethod.threeDSecureInfo,e=r({},this._lookupPaymentMethod,{liabilityShiftPossible:t&&t.liabilityShiftPossible,liabilityShifted:t&&t.liabilityShifted,verificationDetails:t&&t.verificationDetails}),Promise.resolve(e)):Promise.reject(new o(d.THREEDS_NO_VERIFICATION_PAYLOAD))},A.prototype._setupV1Bus=function(e){var t=this._client.getConfiguration(),n=window.location.href.split("#")[0],r=e.lookupResponse,i=_(),o=new u({channel:i,verifyDomain:a}),s=this._assetsUrl+"/html/three-d-secure-authentication-complete-frame.html?channel="+encodeURIComponent(i)+"&";return o.on(h,function(i){i({clientConfiguration:t,nonce:e.nonce,acsUrl:r.acsUrl,pareq:r.pareq,termUrl:r.termUrl+"&three_d_secure_version="+f+"&authentication_complete_base_url="+encodeURIComponent(s),md:r.md,parentUrl:n})}),o.on(E.AUTHENTICATION_COMPLETE,e.handleAuthResponse),o},A.prototype._setupV1Iframe=function(e){var t=this._assetsUrl+"/html/three-d-secure-bank-frame"+m(this._isDebug)+".html?showLoader="+e.showLoader;return l({src:t,height:400,width:400,name:p.LANDING_FRAME_NAME+"_"+this._v1Bus.channel,title:"3D Secure Authorization Frame"})},A.prototype._setupV1Elements=function(e){this._v1Bus=this._setupV1Bus(e),this._v1Iframe=this._setupV1Iframe(e)},A.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)},A.prototype.teardown=function(){return i.sendEvent(this._createPromise,"three-d-secure.teardown-completed"),this._teardownV1Elements(),Promise.resolve()},t.exports=A},{"../../../lib/analytics":144,"../../../lib/assign":146,"../../../lib/braintree-error":149,"../../../lib/constants":150,"../../../lib/is-verified-domain":179,"../../../lib/use-min":187,"../../shared/constants":234,"../../shared/errors":235,"../../shared/events":236,"@braintree/event-emitter":33,"@braintree/extended-promise":34,"@braintree/iframer":35,"@braintree/uuid":39,framebus:54}],227:[function(e,t,n){"use strict";var r=e("./songbird");function i(e){r.call(this,e)}i.prototype=Object.create(r.prototype,{constructor:r}),i.prototype._createV1IframeModalElement=function(e){var t=document.createElement("div");return t.innerHTML='<div class="modal fade in" tabindex="-1" role="dialog" aria-labelledby="CCAFrameModal-label" aria-hidden="true" style="display: block;"><div class="modal-dialog" style="width:440px;z-index:999999;"><div class="modal-content"><div class="modal-body" data-braintree-v1-fallback-iframe-container><button type="button" data-braintree-v1-fallback-close-button class="close" data-dismiss="modal" aria-hidden="true">×</button></div></div></div><div data-braintree-v1-fallback-backdrop style="position: fixed;cursor: pointer;z-index: 999998;top: 0;left: 0;width: 100%;height: 100%;"></div></div>',t.querySelector("[data-braintree-v1-fallback-iframe-container]").appendChild(e),t},i.prototype._createCardinalConfigurationOptions=function(e){var t=r.prototype._createCardinalConfigurationOptions.call(this,e);return t.payment.framework="bootstrap3",t}
2,t.exports=i},{"./songbird":231}],228:[function(e,t,n){"use strict";var r=e("./songbird");function i(e){r.call(this,e)}i.prototype=Object.create(r.prototype,{constructor:r}),i.prototype._createV1IframeModalElement=function(e){var t=document.createElement("div"),n=Boolean(this._createOptions&&this._createOptions.cardinalSDKConfig&&this._createOptions.cardinalSDKConfig.payment&&this._createOptions.cardinalSDKConfig.payment.displayExitButton);return t.innerHTML='<div style="position: fixed;z-index: 999999;top: 50%;left: 50%;padding: 24px 20px;transform: translate(-50%,-50%);border-radius: 2px;background: #fff;max-width: 100%;overflow: auto;"><div><button data-braintree-v1-fallback-close-button style="font-family: Helvetica,Arial,sans-serif;font-size: 25px;line-height: 12px;position: absolute;top: 2px;right: 0px;cursor: pointer;color: #999;border: 0;outline: none;background: none;" onMouseOver="this.style.color=\'#000\'" onMouseOut="this.style.color=\'#999\'">×</button></div><div data-braintree-v1-fallback-iframe-container style="height: 400px;"></div></div><div data-braintree-v1-fallback-backdrop style="position: fixed;z-index: 999998;cursor: pointer;top: 0;left: 0;width: 100%;height: 100%;transition: opacity 1ms ease;background: rgba(0,0,0,.6);"></div>',n||(t.querySelector("[data-braintree-v1-fallback-close-button]").style.display="none"),t.querySelector("[data-braintree-v1-fallback-iframe-container]").appendChild(e),t},t.exports=i},{"./songbird":231}],229:[function(e,t,n){"use strict";var r=e("./cardinal-modal"),i=e("./bootstrap3-modal"),o=e("./inline-iframe");t.exports={"cardinal-modal":r,"bootstrap3-modal":i,"inline-iframe":o}},{"./bootstrap3-modal":227,"./cardinal-modal":228,"./inline-iframe":230}],230:[function(e,t,n){"use strict";var r=e("./songbird"),i=e("../../../lib/braintree-error"),o=e("../../shared/errors"),a=e("../../../lib/enumerate");function s(e){r.call(this,e)}s.prototype=Object.create(r.prototype,{constructor:r}),s.events=a(["AUTHENTICATION_IFRAME_AVAILABLE"],"inline-iframe-framework:"),s.prototype.setUpEventListeners=function(e){r.prototype.setUpEventListeners.call(this,e),this.on(s.events.AUTHENTICATION_IFRAME_AVAILABLE,function(t,n){e("authentication-iframe-available",t,n)})},s.prototype._createCardinalConfigurationOptions=function(e){var t=r.prototype._createCardinalConfigurationOptions.call(this,e);return t.payment.framework="inline",t},s.prototype._addV1IframeToPage=function(){this._emit(s.events.AUTHENTICATION_IFRAME_AVAILABLE,{element:this._v1Modal},function(){})},s.prototype._setupFrameworkSpecificListeners=function(){this.setCardinalListener("ui.inline.setup",this._onInlineSetup.bind(this))},s.prototype._onInlineSetup=function(e,t,n,r){var a,c;e&&t?("CCA"!==t.paymentType||"suppress"!==t.data.mode&&"static"!==t.data.mode)&&(c=!0):c=!0,c?r(new i(o.THREEDS_INLINE_IFRAME_DETAILS_INCORRECT)):((a=document.createElement("div")).innerHTML=e,"suppress"===t.data.mode?(a.style.display="none",document.body.appendChild(a),n()):"static"===t.data.mode&&this._emit(s.events.AUTHENTICATION_IFRAME_AVAILABLE,{element:a},function(){n()}))},t.exports=s},{"../../../lib/braintree-error":149,"../../../lib/enumerate":158,"../../shared/errors":235,"./songbird":231}],231:[function(e,t,n){"use strict";var r=e("./base"),i=e("../../../lib/assign").assign,o=e("../../../lib/deferred"),a=e("../../../lib/braintree-error"),s=e("../../../lib/convert-to-braintree-error"),c=e("../../../lib/analytics"),d=e("../../../lib/assets"),l=e("../../shared/errors"),u=e("../../../lib/enumerate"),p=e("@braintree/extended-promise"),_=e("../../../lib/constants").INTEGRATION_TIMEOUT_MS,E=e("../../../lib/constants").PLATFORM,m="3.143.0",h=["ui.close","ui.render","ui.renderHidden","ui.loading.close","ui.loading.render"],f=["low_value","transaction_risk_analysis"];function A(e){r.call(this,e),this._songbirdInitFailed=!1,this._clientMetadata={requestedThreeDSecureVersion:"2",sdkVersion:E+"/"+m},this.originalSetupOptions=e,this._getDfReferenceIdPromisePlus=new p,this.setupSongbird(e),this._cardinalEvents=[]}function y(e,t,n){t[n+"Line1"]=e.streetAddress,t[n+"Line2"]=e.extendedAddress,t[n+"Line3"]=e.line3,t[n+"City"]=e.locality,t[n+"State"]=e.region,t[n+"PostalCode"]=e.postalCode,t[n+"CountryCode"]=e.countryCodeAlpha2}p.suppressUnhandledPromiseMessage=!0,A.prototype=Object.create(r.prototype,{constructor:A}),A.events=u(["LOOKUP_COMPLETE","CUSTOMER_CANCELED","UI.CLOSE","UI.RENDER","UI.RENDERHIDDEN","UI.LOADING.CLOSE","UI.LOADING.RENDER"],"songbird-framework:"),A.prototype.setUpEventListeners=function(e){this.on(A.events.LOOKUP_COMPLETE,function(t,n){e("lookup-complete",t,n)}),this.on(A.events.CUSTOMER_CANCELED,function(){e("customer-canceled")}),this.on(A.events["UI.CLOSE"],function(){e("authentication-modal-close")}),this.on(A.events["UI.RENDER"],function(){e("authentication-modal-render")}),this.on(A.events["UI.RENDERHIDDEN"],function(){e("authentication-modal-render-hidden")}),this.on(A.events["UI.LOADING.CLOSE"],function(){e("authentication-modal-loader-close")}),this.on(A.events["UI.LOADING.RENDER"],function(){e("authentication-modal-loader-render")})},A.prototype.prepareLookup=function(e){var t=i({},e),n=this;return this.getDfReferenceId().then(function(e){t.dfReferenceId=e}).then(function(){return n._triggerCardinalBinProcess(e.bin)}).catch(function(){}).then(function(){return n._waitForClient()}).then(function(){return t.clientMetadata=n._clientMetadata,t.authorizationFingerprint=n._client.getConfiguration().authorizationFingerprint,t.braintreeLibraryVersion="braintree/web/"+m,t})},A.prototype.initializeChallengeWithLookupResponse=function(e,t){return this.setupSongbird().then(function(){return r.prototype.initializeChallengeWithLookupResponse.call(this,e,t)}.bind(this))},A.prototype.handleSongbirdError=function(e){this._songbirdInitFailed=!0,this._removeSongbirdListeners(),c.sendEvent(this._createPromise,"three-d-secure.cardinal-sdk.songbird-error."+e),this._songbirdPromise&&this._songbirdPromise.resolve()},A.prototype._triggerCardinalBinProcess=function(e){var t=this,n=Date.now();return window.Cardinal.trigger("bin.process",e).then(function(e){t._clientMetadata.issuerDeviceDataCollectionTimeElapsed=Date.now()-n,t._clientMetadata.issuerDeviceDataCollectionResult=e&&e.Status})},A.prototype.transformBillingAddress=function(e,t){return t&&(y(t,e,"billing"),e.billingPhoneNumber=t.phoneNumber,e.billingGivenName=t.givenName,e.billingSurname=t.surname),e},A.prototype.transformShippingAddress=function(e){var t=e.shippingAddress;return t&&(y(t,e,"shipping"),delete e.shippingAddress),e},A.prototype._createV1IframeModalElement=function(e){var t=document.createElement("div");return t.innerHTML='<div data-braintree-v1-fallback-iframe-container="true" style="height: 400px;"></div>',t.querySelector('[data-braintree-v1-fallback-iframe-container="true"]').appendChild(e),t},A.prototype._createV1IframeModal=function(e){var t=this._createV1IframeModalElement(e),n=t.querySelector("[data-braintree-v1-fallback-close-button]"),r=t.querySelector("[data-braintree-v1-fallback-backdrop]"),i=this;function o(){t.parentNode.removeChild(t),i.cancelVerifyCard(l.THREEDS_CARDINAL_SDK_CANCELED),document.removeEventListener("keyup",i._onV1Keyup),i._onV1Keyup=null}return this._onV1Keyup=function(e){"Escape"===e.key&&t.parentNode&&o()},n&&n.addEventListener("click",o),r&&r.addEventListener("click",o),document.addEventListener("keyup",this._onV1Keyup),t},A.prototype._addV1IframeToPage=function(){document.body.appendChild(this._v1Modal)},A.prototype.setupSongbird=function(e){var t=this,n=Date.now();return this._songbirdPromise||(e=e||{},this._songbirdPromise=new p,this._v2SetupFailureReason="reason-unknown",t._loadCardinalScript(e).then(function(){return window.Cardinal?t._configureCardinalSdk({setupOptions:e,setupStartTime:n}):(t._v2SetupFailureReason="cardinal-global-unavailable",Promise.reject(new a(l.THREEDS_CARDINAL_SDK_SETUP_FAILED)))}).catch(function(e){var n=s(e,{type:l.THREEDS_CARDINAL_SDK_SETUP_FAILED.type,code:l.THREEDS_CARDINAL_SDK_SETUP_FAILED.code,message:l.THREEDS_CARDINAL_SDK_SETUP_FAILED.message});t._getDfReferenceIdPromisePlus.reject(n),window.clearTimeout(t._songbirdSetupTimeoutReference),c.sendEvent(t._client,"three-d-secure.cardinal-sdk.init.setup-failed"),t.handleSongbirdError("cardinal-sdk-setup-failed."+t._v2SetupFailureReason)})),this._songbirdPromise},A.prototype._configureCardinalSdk=function(e){var t=this;return this._waitForClient().then(function(){return t._client.getConfiguration().gatewayConfiguration.threeDSecure}).then(function(n){var r=n.cardinalAuthenticationJWT,i=e.setupOptions,o=e.setupStartTime,a=t._createCardinalConfigurationOptions(i);h.forEach(function(e){t.setCardinalListener(e,function(){t._emit
2(A.events[e.toUpperCase()])})}),t.setCardinalListener("payments.setupComplete",t._createPaymentsSetupCompleteCallback()),t._setupFrameworkSpecificListeners(),window.Cardinal.configure(a),window.Cardinal.setup("init",{jwt:r}),t._clientMetadata.cardinalDeviceDataCollectionTimeElapsed=Date.now()-o,t.setCardinalListener("payments.validated",t._createPaymentsValidatedCallback())}).catch(function(e){return t._v2SetupFailureReason="cardinal-configuration-threw-error",Promise.reject(e)})},A.prototype.setCardinalListener=function(e,t){this._cardinalEvents.push(e),window.Cardinal.on(e,t)},A.prototype._setupFrameworkSpecificListeners=function(){},A.prototype._createCardinalConfigurationOptions=function(e){var t=e.cardinalSDKConfig||{},n=t.payment||{};return!t.logging&&e.loggingEnabled&&(t.logging={level:"verbose"}),t.payment={},n.hasOwnProperty("displayLoading")&&(t.payment.displayLoading=n.displayLoading),n.hasOwnProperty("displayExitButton")&&(t.payment.displayExitButton=n.displayExitButton),t},A.prototype._loadCardinalScript=function(e){var t,n=this,r={};return this._waitForClient().then(function(){return r.src=n._client.getConfiguration().gatewayConfiguration.threeDSecure.cardinalSongbirdUrl,(t=n._client.getConfiguration().gatewayConfiguration.threeDSecure.cardinalSongbirdIdentityHash)&&(r.crossorigin="anonymous",r.integrity=t),n._songbirdSetupTimeoutReference=window.setTimeout(function(){c.sendEvent(n._client,"three-d-secure.cardinal-sdk.init.setup-timeout"),n.handleSongbirdError("cardinal-sdk-setup-timeout")},e.timeout||_),d.loadScript(r)}).catch(function(e){return n._v2SetupFailureReason="songbird-js-failed-to-load",Promise.reject(s(e,l.THREEDS_CARDINAL_SDK_SCRIPT_LOAD_FAILED))})},A.prototype._createPaymentsSetupCompleteCallback=function(){var e=this;return function(t){e._getDfReferenceIdPromisePlus.resolve(t.sessionId),window.clearTimeout(e._songbirdSetupTimeoutReference),c.sendEvent(e._createPromise,"three-d-secure.cardinal-sdk.init.setup-completed"),e._songbirdPromise.resolve()}},A.prototype.getDfReferenceId=function(){return this._getDfReferenceIdPromisePlus},A.prototype._performJWTValidation=function(e,t){var n=this,r=this._lookupPaymentMethod.nonce,i="payment_methods/"+r+"/three_d_secure/authenticate_from_jwt",o=e&&e.Payment&&e.Payment.ExtendedData&&e.Payment.ExtendedData.ChallengeCancel;return o&&(c.sendEvent(this._createPromise,"three-d-secure.verification-flow.cardinal-sdk.cancel-code."+o),"01"===o&&this._emit(A.events.CUSTOMER_CANCELED)),c.sendEvent(this._createPromise,"three-d-secure.verification-flow.upgrade-payment-method.started"),this._waitForClient().then(function(){return n._client.request({method:"post",endpoint:i,data:{jwt:t,paymentMethodNonce:r}})}).then(function(t){var r=t.paymentMethod||n._lookupPaymentMethod,i=n._formatAuthResponse(r,t.threeDSecureInfo);return i.rawCardinalSDKVerificationData=e,c.sendEvent(n._client,"three-d-secure.verification-flow.upgrade-payment-method.succeeded"),Promise.resolve(i)}).catch(function(e){var t=new a({type:l.THREEDS_JWT_AUTHENTICATION_FAILED.type,code:l.THREEDS_JWT_AUTHENTICATION_FAILED.code,message:l.THREEDS_JWT_AUTHENTICATION_FAILED.message,details:{originalError:e}});return c.sendEvent(n._client,"three-d-secure.verification-flow.upgrade-payment-method.errored"),Promise.reject(t)})},A.prototype._createPaymentsValidatedCallback=function(){var e=this;return function(t,n){var r;if(c.sendEvent(e._createPromise,"three-d-secure.verification-flow.cardinal-sdk.action-code."+t.ActionCode.toLowerCase()),e._verifyCardPromisePlus)switch(t.ActionCode){case"SUCCESS":case"NOACTION":case"FAILURE":e._performJWTValidation(t,n).then(function(t){e._verifyCardPromisePlus.resolve(t)}).catch(function(t){e._verifyCardPromisePlus.reject(t)});break;case"ERROR":switch(c.sendEvent(e._createPromise,"three-d-secure.verification-flow.cardinal-sdk-error."+t.ErrorNumber),t.ErrorNumber){case 10001:case 10002:r=new a(l.THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT);break;case 10003:case 10007:case 10009:r=new a(l.THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT);break;case 10005:case 10006:r=new a(l.THREEDS_CARDINAL_SDK_BAD_CONFIG);break;
2case 10008:case 10010:r=new a(l.THREEDS_CARDINAL_SDK_BAD_JWT);break;case 10011:c.sendEvent(e._createPromise,"three-d-secure.verification-flow.canceled"),r=new a(l.THREEDS_CARDINAL_SDK_CANCELED);break;default:r=new a(l.THREEDS_CARDINAL_SDK_ERROR)}r.details={originalError:{code:t.ErrorNumber,description:t.ErrorDescription}},e._verifyCardPromisePlus.reject(r)}else e.handleSongbirdError("cardinal-sdk-setup-error.number-"+t.ErrorNumber)}},A.prototype._checkForVerifyCardError=function(e,t){return e.bin?r.prototype._checkForVerifyCardError.call(this,e,t):new a({type:l.THREEDS_MISSING_VERIFY_CARD_OPTION.type,code:l.THREEDS_MISSING_VERIFY_CARD_OPTION.code,message:"verifyCard options must include a BIN."})},A.prototype._checkForFrameworkSpecificVerifyCardErrors=function(e,t){var n;return"function"==typeof e.onLookupComplete||t.ignoreOnLookupCompleteRequirement||(n="an onLookupComplete function"),n},A.prototype._formatVerifyCardOptions=function(e){var t=r.prototype._formatVerifyCardOptions.call(this,e),n=t.additionalInformation||{};return n=this.transformBillingAddress(n,e.billingAddress),n=this.transformShippingAddress(n),e.onLookupComplete&&(t.onLookupComplete=o(e.onLookupComplete)),e.email&&(n.email=e.email),e.mobilePhoneNumber&&(n.mobilePhoneNumber=e.mobilePhoneNumber),t.additionalInformation=n,t},A.prototype._onLookupComplete=function(e,t){var n=this;return r.prototype._onLookupComplete.call(this,e).then(function(e){return new Promise(function(r,i){function o(){r(e)}e.requiresUserAuthentication=Boolean(e.lookup&&e.lookup.acsUrl),n._verifyCardPromisePlus.catch(i),t.onLookupComplete?t.onLookupComplete(e,o):n._emit(A.events.LOOKUP_COMPLETE,e,o)})})},A.prototype._presentChallenge=function(e){!this._songbirdInitFailed&&e.lookup.transactionId&&window.Cardinal.continue("cca",{AcsUrl:e.lookup.acsUrl,Payload:e.lookup.pareq},{OrderDetails:{TransactionId:e.lookup.transactionId}})},A.prototype._formatLookupData=function(e){var t=this;return r.prototype._formatLookupData.call(this,e).then(function(n){if(n.additionalInfo=e.additionalInformation,e.accountType&&(n.accountType=e.accountType),e.challengeRequested&&(n.challengeRequested=e.challengeRequested),e.requestedExemptionType){if(!f.includes(e.requestedExemptionType))throw new a({code:l.THREEDS_REQUESTED_EXEMPTION_TYPE_INVALID.code,type:l.THREEDS_REQUESTED_EXEMPTION_TYPE_INVALID.type,message:"requestedExemptionType `"+e.requestedExemptionType+"` is not a valid exemption. The accepted values are: `"+f.join("`, `")+"`"});n.requestedExemptionType=e.requestedExemptionType}return e.customFields&&(n.customFields=e.customFields),e.dataOnlyRequested&&(n.dataOnlyRequested=e.dataOnlyRequested),e.exemptionRequested&&(n.exemptionRequested=e.exemptionRequested),e.requestVisaDAF&&(n.requestVisaDAF=e.requestVisaDAF),e.bin&&(n.bin=e.bin),null!=e.cardAdd&&(n.cardAdd=e.cardAdd),null!=e.cardAddChallengeRequested&&(n.cardAdd=e.cardAddChallengeRequested),e.merchantName&&(n.merchantName=e.merchantName),e.applySmartAuthentication&&(n.applySmartAuthentication=e.applySmartAuthentication),t.prepareLookup(n)})},A.prototype.cancelVerifyCard=function(e){var t=this;return r.prototype.cancelVerifyCard.call(this).then(function(n){return t._verifyCardPromisePlus&&(e=e||new a(l.THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT),t._verifyCardPromisePlus.reject(e)),n})},A.prototype._removeSongbirdListeners=function(){this._cardinalEvents.forEach(function(e){window.Cardinal.off(e)}),this._cardinalEvents=[]},A.prototype.teardown=function(){return window.Cardinal&&this._removeSongbirdListeners(),r.prototype.teardown.call(this)},A.prototype._reloadThreeDSecure=function(){var e=this,t=Date.now();return e.teardown().then(function(){e._configureCardinalSdk({setupOptions:e.originalSetupOptions,setupStartTime:t})})},t.exports=A},{"../../../lib/analytics":144,"../../../lib/assets":145,"../../../lib/assign":146,"../../../lib/braintree-error":149,"../../../lib/constants":150,"../../../lib/convert-to-braintree-error":152,"../../../lib/deferred":156,"../../../lib/enumerate":158,"../../shared/errors":235,"./base":226,"@braintree/extended-promise":34}],232:[function(e,t,n){"use strict";var r=e("@braintree/wrap-promise"),i=e("../../lib/methods"),o=e("../../lib/convert-methods-to-error"),a=e("@braintree/event-emitter"),s=e("./frameworks");function c(e){var t=this,n=s[e.framework];a.call(this),this._framework=new n(e),this._framework.setUpEventListeners(function(){t._emit.apply(t,arguments)})}a.createChild(c),c.prototype.verifyCard=function(e){var t;return this.hasListener("lookup-complete")&&(t={ignoreOnLookupCompleteRequirement:!0}),this._framework.verifyCard(e,t)},c.prototype.initializeChallengeWithLookupResponse=function(e){return"string"==typeof e&&(e=JSON.parse(e)),this._framework.initializeChallengeWithLookupResponse(e)},c.prototype.prepareLookup=function(e){return this._framework.prepareLookup(e).then(function(e){return JSON.stringify(e)})},c.prototype.cancelVerifyCard=function(){return this._framework.cancelVerifyCard()},c.prototype.teardown=function(){var e=i(c.prototype).concat(i(a.prototype));return o(this,e),this._framework.teardown()},t.exports=r.wrapPrototype(c)},{"../../lib/convert-methods-to-error":151,"../../lib/methods":181,"./frameworks":229,"@braintree/event-emitter":33,"@braintree/wrap-promise":43}],233:[function(e,t,n){"use strict";var r=e("./external/three-d-secure"),i=e("../lib/is-https").isHTTPS,o=e("../lib/basic-component-verification"),a=e("../lib/create-deferred-client"),s=e("../lib/create-assets-url"),c=e("../lib/braintree-error"),d=e("../lib/analytics"),l=e("./shared/errors"),u=e("@braintree/wrap-promise");t.exports={create:u(function(e){var t="3D Secure",n=function(e){var t=String(e.version||"");if(!t||"1"===t)throw new c({code:l.THREEDS_UNSUPPORTED_VERSION.code,type:l.THREEDS_UNSUPPORTED_VERSION.type,message:l.THREEDS_UNSUPPORTED_VERSION.message});switch(t){case"2":case"2-cardinal-modal":return"cardinal-modal";case"2-bootstrap3-modal":return"bootstrap3-modal";case"2-inline-iframe":return"inline-iframe";default:throw new c({code:l.THREEDS_UNRECOGNIZED_VERSION.code,type:l.THREEDS_UNRECOGNIZED_VERSION.type,message:"Version `"+e.version+"` is not a recognized ver
2sion. You may need to update the version of your Braintree SDK to support this version."})}}(e);return o.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){var o=s.create(e.authorization),u=a.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o,name:t}).then(function(t){var n,r=t.getConfiguration(),o=r.gatewayConfiguration;return e.client=t,o.threeDSecureEnabled||(n=l.THREEDS_NOT_ENABLED),"TOKENIZATION_KEY"===r.authorizationType&&(n=l.THREEDS_CAN_NOT_USE_TOKENIZATION_KEY),"production"===o.environment&&!i()&&(n=l.THREEDS_HTTPS_REQUIRED),o.threeDSecure&&o.threeDSecure.cardinalAuthenticationJWT||(d.sendEvent(e.client,"three-d-secure.initialization.failed.missing-cardinalAuthenticationJWT"),n=l.THREEDS_NOT_ENABLED_FOR_V2),n?Promise.reject(new c(n)):(d.sendEvent(e.client,"three-d-secure.initialized"),t)}),p=new r({client:e.client,assetsUrl:o,createPromise:u,loggingEnabled:e.loggingEnabled,cardinalSDKConfig:e.cardinalSDKConfig,framework:n});return e.client?u.then(function(){return p}):p})}),VERSION:"3.143.0"}},{"../lib/analytics":144,"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"../lib/is-https":178,"./external/three-d-secure":232,"./shared/errors":235,"@braintree/wrap-promise":43}],234:[function(e,t,n){"use strict";t.exports={LANDING_FRAME_NAME:"braintreethreedsecurelanding"}},{}],235:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error");t.exports={THREEDS_NOT_ENABLED:{type:r.types.MERCHANT,code:"THREEDS_NOT_ENABLED",message:"3D Secure is not enabled for this merchant."},THREEDS_CAN_NOT_USE_TOKENIZATION_KEY:{type:r.types.MERCHANT,code:"THREEDS_CAN_NOT_USE_TOKENIZATION_KEY",message:"3D Secure can not use a tokenization key for authorization."},THREEDS_HTTPS_REQUIRED:{type:r.types.MERCHANT,code:"THREEDS_HTTPS_REQUIRED",message:"3D Secure requires HTTPS."},THREEDS_NOT_ENABLED_FOR_V2:{type:r.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:r.types.MERCHANT,code:"THREEDS_UNRECOGNIZED_VERSION"},THREEDS_CARDINAL_SDK_SETUP_FAILED:{type:r.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:r.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:r.types.UNKNOWN,code:"THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT",message:"Cardinal's Songbird.js took too long to setup."},THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT:{type:r.types.UNKNOWN,code:"THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT",message:"Cardinal's API took too long to respond."},THREEDS_CARDINAL_SDK_BAD_CONFIG:{type:r.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:r.types.MERCHANT,code:"THREEDS_CARDINAL_SDK_BAD_JWT",message:"Cardinal JWT missing or malformed. Please check your setup configuration."},THREEDS_CARDINAL_SDK_ERROR:{type:r.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:r.types.CUSTOMER,code:"THREEDS_CARDINAL_SDK_CANCELED",message:"Canceled by user."},THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT:{type:r.types.MERCHANT,code:"THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT",message:"3D Secure verfication canceled by merchant."},THREEDS_AUTHENTICATION_IN_PROGRESS:{type:r.types.MERCHANT,code:"THREEDS_AUTHENTICATION_IN_PROGRESS",message:"Cannot call verifyCard while existing authentication is in progress."},THREEDS_MISSING_VERIFY_CARD_OPTION:{type:r.types.MERCHANT,code:"THREEDS_MISSING_VERIFY_CARD_OPTION"},THREEDS_JWT_AUTHENTICATION_FAILED:{type:r.types.UNKNOWN,code:"THREEDS_JWT_AUTHENTICATION_FAILED",message:"Something went wrong authenticating the JWT from Cardinal"},THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR:{type:r.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:r.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:r.types.UNKNOWN,code:"THREEDS_LOOKUP_ERROR",message:"Something went wrong during the 3D Secure lookup"},THREEDS_INLINE_IFRAME_DETAILS_INCORRECT:{type:r.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:r.types.MERCHANT,code:"THREEDS_NO_VERIFICATION_PAYLOAD",message:"No verification payload available."},THREEDS_TERM_URL_REQUIRES_BRAINTREE_DOMAIN:{type:r.types.INTERNAL,code:"THREEDS_TERM_URL_REQUIRES_BRAINTREE_DOMAIN",message:"Term Url must be on a Braintree domain."}
2,THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED:{type:r.types.INTERNAL,code:"THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED",message:"Method not implemented for this framework."},THREEDS_REQUESTED_EXEMPTION_TYPE_INVALID:{type:r.types.MERCHANT,code:"THREEDS_REQUESTED_EXEMPTION_TYPE_INVALID",message:"Requested Exemption Type is invalid."},THREEDS_UNSUPPORTED_VERSION:{type:r.types.MERCHANT,code:"THREEDS_UNSUPPORTED_VERSION",message:"3D Secure `1` is deprecated and no longer supported. See available versions at https://braintree.github.io/braintree-web/current/module-braintree-web_three-d-secure.html#.create"}}},{"../../lib/braintree-error":149}],236:[function(e,t,n){"use strict";var r=e("../../lib/enumerate");t.exports=r(["AUTHENTICATION_COMPLETE"],"threedsecure:")},{"../../lib/enumerate":158}],237:[function(e,t,n){"use strict";var r=e("./shared/unionpay"),i=e("../lib/basic-component-verification"),o=e("../lib/braintree-error"),a=e("../lib/create-deferred-client"),s=e("../lib/create-assets-url"),c=e("../lib/analytics"),d=e("./shared/errors"),l=e("@braintree/wrap-promise");t.exports={create:l(function(e){var t="UnionPay";return i.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return a.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:s.create(e.authorization),name:t})}).then(function(t){var n=t.getConfiguration();return e.client=t,n.gatewayConfiguration.unionPay&&!0===n.gatewayConfiguration.unionPay.enabled?(c.sendEvent(e.client,"unionpay.initialized"),new r(e)):Promise.reject(new o(d.UNIONPAY_NOT_ENABLED))})}),VERSION:"3.143.0"}},{"../lib/analytics":144,"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./shared/errors":239,"./shared/unionpay":240,"@braintree/wrap-promise":43}],238:[function(e,t,n){"use strict";var r=e("../../lib/enumerate");t.exports={events:r(["HOSTED_FIELDS_FETCH_CAPABILITIES","HOSTED_FIELDS_ENROLL","HOSTED_FIELDS_TOKENIZE"],"union-pay:"),HOSTED_FIELDS_FRAME_NAME:"braintreeunionpayhostedfields"}},{"../../lib/enumerate":158}],239:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error");t.exports={UNIONPAY_NOT_ENABLED:{type:r.types.MERCHANT,code:"UNIONPAY_NOT_ENABLED",message:"UnionPay is not enabled for this merchant."},UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID:{type:r.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:r.types.MERCHANT,code:"UNIONPAY_HOSTED_FIELDS_INSTANCE_REQUIRED",message:"Could not find the Hosted Fields instance."},UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED:{type:r.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:r.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:r.types.MERCHANT,code:"UNIONPAY_EXPIRATION_DATE_INCOMPLETE",message:"You must supply expiration month and year or neither."},UNIONPAY_ENROLLMENT_CUSTOMER_INPUT_INVALID:{type:r.types.CUSTOMER,code:"UNIONPAY_ENROLLMENT_CUSTOMER_INPUT_INVALID",message:"Enrollment failed due to user input error."},UNIONPAY_ENROLLMENT_NETWORK_ERROR:{type:r.types.NETWORK,code:"UNIONPAY_ENROLLMENT_NETWORK_ERROR",message:"Could not enroll UnionPay card."},UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR:{type:r.types.NETWORK,code:"UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR",message:"Could not fetch card capabilities."},UNIONPAY_TOKENIZATION_NETWORK_ERROR:{type:r.types.NETWORK,code:"UNIONPAY_TOKENIZATION_NETWORK_ERROR",message:"A tokenization network error occurred."},UNIONPAY_MISSING_MOBILE_PHONE_DATA:{type:r.types.MERCHANT,code:"UNIONPAY_MISSING_MOBILE_PHONE_DATA",message:"A `mobile` with `countryCode` and `number` is required."},UNIONPAY_FAILED_TOKENIZATION:{type:r.types.CUSTOMER,code:"UNIONPAY_FAILED_TOKENIZATION",message:"The supplied card data failed tokenization."}}},{"../../lib/braintree-error":149}],240:[function(e,t,n){"use strict";var r=e("../../lib/analytics"),i=e("../../lib/braintree-error"),o=e("framebus"),a=e("./constants"),s=e("../../lib/is-verified-domain"),c=e("../../lib/use-min"),d=e("../../lib/convert-methods-to-error"),l=e("./errors"),u=a.events,p=e("@braintree/iframer"),_=e("../../lib/methods"),E=e("@braintree/uuid"),m=e("@braintree/wrap-promise"),h=e("../../lib/constants").BUS_CONFIGURATION_REQUEST_EVENT;function f(e){this._options=e}f.prototype.fetchCapabilities=function(e){var t=this,n=this._options.client,o=e.card?e.card.number:null,a=e.hostedFields;return o&&a?Promise.reject(new i(l.UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES)):o?n.request({method:"get",endpoint:"payment_methods/credit_cards/capabilities",data:{_meta:{source:"unionpay"},creditCard:{number:o}}}).then(function(e){return r.sendEvent(n,"unionpay.capabilities-received"),e}).catch(function(e){var t=e.details&&e.details.httpStatus;return r.sendEvent(n,"unionpay.capabilities-failed"),403===t?Promise.reject(e):Promise.reject(new i({type:l.UNIONPAY_FETCH_CAPABILITIES_NETWORK_E
2RROR.type,code:l.UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR.code,message:l.UNIONPAY_FETCH_CAPABILITIES_NETWORK_ERROR.message,details:{originalError:e}}))}):a?a._bus?t._initializeHostedFields().then(function(){return new Promise(function(e,n){t._bus.emit(u.HOSTED_FIELDS_FETCH_CAPABILITIES,{hostedFields:a},function(t){t.err?n(new i(t.err)):e(t.payload)})})}):Promise.reject(new i(l.UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID)):Promise.reject(new i(l.UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED))},f.prototype.enroll=function(e){var t,n=this,o=this._options.client,a=e.card,s=e.mobile,c=e.hostedFields;if(!s)return Promise.reject(new i(l.UNIONPAY_MISSING_MOBILE_PHONE_DATA));if(c)return c._bus?a?Promise.reject(new i(l.UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES)):new Promise(function(e,t){n._initializeHostedFields().then(function(){n._bus.emit(u.HOSTED_FIELDS_ENROLL,{hostedFields:c,mobile:s},function(n){n.err?t(new i(n.err)):e(n.payload)})})}):Promise.reject(new i(l.UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID));if(a&&a.number){if(t={_meta:{source:"unionpay"},unionPayEnrollment:{number:a.number,mobileCountryCode:s.countryCode,mobileNumber:s.number}},a.expirationDate)t.unionPayEnrollment.expirationDate=a.expirationDate;else if(a.expirationMonth||a.expirationYear){if(!a.expirationMonth||!a.expirationYear)return Promise.reject(new i(l.UNIONPAY_EXPIRATION_DATE_INCOMPLETE));t.unionPayEnrollment.expirationYear=a.expirationYear,t.unionPayEnrollment.expirationMonth=a.expirationMonth}return o.request({method:"post",endpoint:"union_pay_enrollments",data:t}).then(function(e){return r.sendEvent(o,"unionpay.enrollment-succeeded"),{enrollmentId:e.unionPayEnrollmentId,smsCodeRequired:e.smsCodeRequired}}).catch(function(e){var t,n=e.details&&e.details.httpStatus;return 403===n?t=e:n<500?(t=new i(l.UNIONPAY_ENROLLMENT_CUSTOMER_INPUT_INVALID)).details={originalError:e}:(t=new i(l.UNIONPAY_ENROLLMENT_NETWORK_ERROR)).details={originalError:e},r.sendEvent(o,"unionpay.enrollment-failed"),Promise.reject(t)})}return Promise.reject(new i(l.UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED))},f.prototype.tokenize=function(e){var t,n=this,o=this._options.client,a=e.card,s=e.hostedFields;return a&&s?Promise.reject(new i(l.UNIONPAY_CARD_AND_HOSTED_FIELDS_INSTANCES)):a?(t={_meta:{source:"unionpay"},creditCard:{number:e.card.number,options:{unionPayEnrollment:{id:e.enrollmentId}}}},e.smsCode&&(t.creditCard.options.unionPayEnrollment.smsCode=e.smsCode),a.expirationDate?t.creditCard.expirationDate=a.expirationDate:a.expirationMonth&&a.expirationYear&&(t.creditCard.expirationYear=a.expirationYear,t.creditCard.expirationMonth=a.expirationMonth),e.card.cvv&&(t.creditCard.cvv=e.card.cvv),o.request({method:"post",endpoint:"payment_methods/credit_cards",data:t}).then(function(e){var t=e.creditCards[0];return delete t.consumed,delete t.threeDSecureInfo,r.sendEvent(o,"unionpay.nonce-received"),t}).catch(function(e){var t,n=e.details&&e.details.httpStatus;return r.sendEvent(o,"unionpay.nonce-failed"),403===n?t=e:n<500?(t=new i(l.UNIONPAY_FAILED_TOKENIZATION)).details={originalError:e}:(t=new i(l.UNIONPAY_TOKENIZATION_NETWORK_ERROR)).details={originalError:e},Promise.reject(t)})):s?s._bus?new Promise(function(t,r){n._initializeHostedFields().then(function(){n._bus.emit(u.HOSTED_FIELDS_TOKENIZE,e,function(e){e.err?r(new i(e.err)):t(e.payload)})})}):Promise.reject(new i(l.UNIONPAY_HOSTED_FIELDS_INSTANCE_INVALID)):Promise.reject(new i(l.UNIONPAY_CARD_OR_HOSTED_FIELDS_INSTANCE_REQUIRED))},f.prototype.teardown=function(){return this._bus&&(this._hostedFieldsFrame.parentNode.removeChild(this._hostedFieldsFrame),this._bus.teardown()),d(this,_(f.prototype)),Promise.resolve()},f.prototype._initializeHostedFields=function(){var e,t,n=E(),r=this;return this._hostedFieldsInitializePromise||(this._hostedFieldsInitializePromise=new Promise(function(i){e=r._options.client.getConfiguration().gatewayConfiguration.assetsUrl,t=r._options.client.getConfiguration().isDebug,r._bus=new o({channel:n,verifyDomain:s}),r._hostedFieldsFrame=p({name:a.HOSTED_FIELDS_FRAME_NAME+"_"+n,src:e+"/web/3.143.0/html/unionpay-hosted-fields-frame"+c(t)+".html",height:0,width:0}),r._bus.on(h,function(e){e(r._options.client),i()}),document.body.appendChild(r._hostedFieldsFrame)})),this._hostedFieldsInitializePromise}
2,t.exports=m.wrapPrototype(f)},{"../../lib/analytics":144,"../../lib/braintree-error":149,"../../lib/constants":150,"../../lib/convert-methods-to-error":151,"../../lib/is-verified-domain":179,"../../lib/methods":181,"../../lib/use-min":187,"./constants":238,"./errors":239,"@braintree/iframer":35,"@braintree/uuid":39,"@braintree/wrap-promise":43,framebus:54}],241:[function(e,t,n){"use strict";t.exports={PLAID_LINK_JS:"https://cdn.plaid.com/link/v2/stable/link-initialize.js"}},{}],242:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={US_BANK_ACCOUNT_OPTION_REQUIRED:{type:r.types.MERCHANT,code:"US_BANK_ACCOUNT_OPTION_REQUIRED"},US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS:{type:r.types.MERCHANT,code:"US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS"},US_BANK_ACCOUNT_LOGIN_LOAD_FAILED:{type:r.types.NETWORK,code:"US_BANK_ACCOUNT_LOGIN_LOAD_FAILED",message:"Bank login flow failed to load."},US_BANK_ACCOUNT_LOGIN_CLOSED:{type:r.types.CUSTOMER,code:"US_BANK_ACCOUNT_LOGIN_CLOSED",message:"Customer closed bank login flow before authorizing."},US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE:{type:r.types.MERCHANT,code:"US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE",message:"Another bank login tokenization request is active."},US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR:{type:r.types.NETWORK,code:"US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR",message:"A tokenization network error occurred."},US_BANK_ACCOUNT_FAILED_TOKENIZATION:{type:r.types.CUSTOMER,code:"US_BANK_ACCOUNT_FAILED_TOKENIZATION",message:"The supplied data failed tokenization."},US_BANK_ACCOUNT_NOT_ENABLED:{type:r.types.MERCHANT,code:"US_BANK_ACCOUNT_NOT_ENABLED",message:"US bank account is not enabled."},US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED:{type:r.types.MERCHANT,code:"US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED",message:"Bank login is not enabled."}}},{"../lib/braintree-error":149}],243:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("../lib/braintree-error"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("./errors"),c=e("./us-bank-account"),d=e("@braintree/wrap-promise");t.exports={create:d(function(e){var t="US Bank Account";return r.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return o.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:a.create(e.authorization),name:t})}).then(function(t){return e.client=t,e.client.getConfiguration().gatewayConfiguration.usBankAccount?new c(e):Promise.reject(new i(s.US_BANK_ACCOUNT_NOT_ENABLED))})}),VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./errors":242,"./us-bank-account":244,"@braintree/wrap-promise":43}],244:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("./constants"),o=e("./errors"),a=e("../lib/errors"),s=e("../lib/analytics"),c=e("../lib/once"),d=e("../lib/convert-methods-to-error"),l=e("../lib/methods"),u=e("@braintree/wrap-promise"),p=I("UsBankAccount"),_=I("UsBankLogin");function E(e){this._client=e.client,this._isTokenizingBankLogin=!1,s.sendEvent(this._client,"usbankaccount.initialized")}function m(e){var t,n=e.details&&e.details.httpStatus;return(t=new r(401===n?a.BRAINTREE_API_ACCESS_RESTRICTED:n<500?o.US_BANK_ACCOUNT_FAILED_TOKENIZATION:o.US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR)).details={originalError:e},t}function h(e,t){var n=e.data[t].paymentMethod,r="US bank account ending in - "+n.details.last4;return{nonce:n.id,details:{},description:r,type:"us_bank_account"}}function f(e,t){function n(){var r=this.readyState;r&&"loaded"!==r&&"complete"!==r||(e.removeEventListener("error",i),e.removeEventListener("load",n),e.removeEventListener("readystatechange",n),t(null,window.Plaid))}function i(){e.parentNode.removeChild(e),t(new r(o.US_BANK_ACCOUNT_LOGIN_LOAD_FAILED))}e.addEventListener("error",i),e.addEventListener("load",n),e.addEventListener("readystatechange",n)}function A(e){return{streetAddress:e.streetAddress,extendedAddress:e.extendedAddress,city:e.locality,state:e.region,zipCode:e.postalCode}}function y(e,t){"personal"===t.ownershipType?e.individualOwner={firstName:t.firstName,lastName:t.lastName}:"business"===t.ownershipType&&(e.businessOwner={businessName:t.businessName})}function I(e){return"mutation Tokenize"+e+"($input: Tokenize"+e+"Input!) {  tokenize"+e+"(input: $input) {    paymentMethod {      id      details {        ... on UsBankAccountDetails {          last4        }      }    }  }}"}E.prototype.tokenize=function(e){return(e=e||{}
2).mandateText?e.bankDetails&&e.bankLogin?Promise.reject(new r({type:o.US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS.type,code:o.US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS.code,message:"tokenize must be called with bankDetails or bankLogin, not both."})):e.bankDetails?this._tokenizeBankDetails(e):e.bankLogin?this._tokenizeBankLogin(e):Promise.reject(new r({type:o.US_BANK_ACCOUNT_OPTION_REQUIRED.type,code:o.US_BANK_ACCOUNT_OPTION_REQUIRED.code,message:"tokenize must be called with bankDetails or bankLogin."})):Promise.reject(new r({type:o.US_BANK_ACCOUNT_OPTION_REQUIRED.type,code:o.US_BANK_ACCOUNT_OPTION_REQUIRED.code,message:"mandateText property is required."}))},E.prototype._tokenizeBankDetails=function(e){var t=this._client,n=e.bankDetails,r={achMandate:e.mandateText,routingNumber:n.routingNumber,accountNumber:n.accountNumber,accountType:n.accountType.toUpperCase(),billingAddress:A(n.billingAddress||{})};return y(r,n),t.request({api:"graphQLApi",data:{query:p,variables:{input:{usBankAccount:r}}}}).then(function(e){return s.sendEvent(t,"usbankaccount.bankdetails.tokenization.succeeded"),Promise.resolve(h(e,"tokenizeUsBankAccount"))}).catch(function(e){var n=m(e);return s.sendEvent(t,"usbankaccount.bankdetails.tokenization.failed"),Promise.reject(n)})},E.prototype._tokenizeBankLogin=function(e){var t=this,n=this._client,i=n.getConfiguration().gatewayConfiguration,a="production"===i.environment,c=i.usBankAccount.plaid;return e.bankLogin.displayName?c?this._isTokenizingBankLogin?Promise.reject(new r(o.US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE)):(this._isTokenizingBankLogin=!0,new Promise(function(i,d){t._loadPlaid(function(l,u){l?d(l):(u.create({clientName:e.bankLogin.displayName,apiVersion:"v2",env:a?"production":"sandbox",key:c.publicKey,product:"auth",selectAccount:!0,onExit:function(){t._isTokenizingBankLogin=!1,s.sendEvent(n,"usbankaccount.banklogin.tokenization.closed.by-user"),d(new r(o.US_BANK_ACCOUNT_LOGIN_CLOSED))},onSuccess:function(r,o){var c=e.bankLogin,l={publicToken:r,accountId:a?o.account_id:"plaid_account_id",accountType:o.account.subtype.toUpperCase(),achMandate:e.mandateText,billingAddress:A(c.billingAddress||{})};y(l,c),n.request({api:"graphQLApi",data:{query:_,variables:{input:{usBankLogin:l}}}}).then(function(e){t._isTokenizingBankLogin=!1,s.sendEvent(n,"usbankaccount.banklogin.tokenization.succeeded"),i(h(e,"tokenizeUsBankLogin"))}).catch(function(e){var r;t._isTokenizingBankLogin=!1,r=m(e),s.sendEvent(n,"usbankaccount.banklogin.tokenization.failed"),d(r)})}}).open(),s.sendEvent(n,"usbankaccount.banklogin.tokenization.started"))})})):Promise.reject(new r(o.US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED)):Promise.reject(new r({type:o.US_BANK_ACCOUNT_OPTION_REQUIRED.type,code:o.US_BANK_ACCOUNT_OPTION_REQUIRED.code,message:"displayName property is required when using bankLogin."}))},E.prototype._loadPlaid=function(e){var t,n;e=c(e),window.Plaid?e(null,window.Plaid):(t=document.querySelector('script[src="'+i.PLAID_LINK_JS+'"]'))?f(t,e):((n=document.createElement("script")).src=i.PLAID_LINK_JS,n.async=!0,f(n,e),document.body.appendChild(n),this._plaidScript=n)},E.prototype.teardown=function(){return this._plaidScript&&document.body.removeChild(this._plaidScript),d(this,l(E.prototype)),Promise.resolve()},t.exports=u.wrapPrototype(E)},{"../lib/analytics":144,"../lib/braintree-error":149,"../lib/convert-methods-to-error":151,"../lib/errors":159,"../lib/methods":181,"../lib/once":182,"./constants":241,"./errors":242,"@braintree/wrap-promise":43}],245:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN:{type:r.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:r.types.MERCHANT,code:"VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND"},VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR:{type:r.types.UNKNOWN,code:"VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR"}}},{"../lib/braintree-error":149}],246:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("../lib/create-deferred-client"),o=e("../lib/create-assets-url"),a=e("./vault-manager"),s=e("@braintree/wrap-promise");t.exports={create:s(function(e){var t="Vault Manager";return r.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return new a({createPromise:i.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:o.create(e.authorization),name:t})})})}),VERSION:"3.143.0"}},{"../lib/basic-component-verification":147,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./vault-manager"
2:247,"@braintree/wrap-promise":43}],247:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/braintree-error"),o=e("./errors"),a=e("../lib/convert-methods-to-error"),s=e("../lib/methods"),c=e("@braintree/wrap-promise");function d(e){this._createPromise=e.createPromise}function l(e){var t={nonce:e.nonce,default:e.default,details:e.details,hasSubscription:e.hasSubscription,type:e.type};return e.description&&(t.description=e.description),e.binData&&(t.binData=e.binData),t}d.prototype.fetchPaymentMethods=function(e){var t;return t=!0===(e=e||{}).defaultFirst?1:0,this._createPromise.then(function(e){return e.request({endpoint:"payment_methods",method:"get",data:{defaultFirst:t}})}).then(function(e){return r.sendEvent(this._createPromise,"vault-manager.fetch-payment-methods.succeeded"),e.paymentMethods.map(l)}.bind(this))},d.prototype.deletePaymentMethod=function(e){return this._createPromise.then(function(t){return"CLIENT_TOKEN"===t.getConfiguration().authorizationType?t.request({api:"graphQLApi",data:{query:"mutation DeletePaymentMethodFromSingleUseToken($input: DeletePaymentMethodFromSingleUseTokenInput!) {  deletePaymentMethodFromSingleUseToken(input: $input) {    clientMutationId  }}",variables:{input:{singleUseTokenId:e}},operationName:"DeletePaymentMethodFromSingleUseToken"}}).then(function(){r.sendEvent(t,"vault-manager.delete-payment-method.succeeded")}).catch(function(n){var a,s=n.details.originalError;return r.sendEvent(t,"vault-manager.delete-payment-method.failed"),s[0]&&"NOT_FOUND"===s[0].extensions.errorClass&&(a=new i({type:o.VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND.type,code:o.VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND.code,message:"A payment method for payment method nonce `"+e+"` could not be found.",details:{originalError:s}})),a||(a=new i({type:o.VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR.type,code:o.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 `"+e+"`.",details:{originalError:s}})),Promise.reject(a)}):Promise.reject(new i(o.VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN))})},d.prototype.teardown=function(){return a(this,s(d.prototype)),Promise.resolve()},t.exports=c.wrapPrototype(d)},{"../lib/analytics":144,"../lib/braintree-error":149,"../lib/convert-methods-to-error":151,"../lib/methods":181,"./errors":245,"@braintree/wrap-promise":43}],248:[function(e,t,n){"use strict";var r=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e("./venmo-desktop"));t.exports=function(e){return new r.default(e).initialize()}},{"./venmo-desktop":250}],249:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.VENMO_PAYMENT_CONTEXT_STATUS_QUERY=n.LEGACY_VENMO_PAYMENT_CONTEXT_STATUS_QUERY=n.UPDATE_PAYMENT_CONTEXT_QUERY=n.LEGACY_UPDATE_PAYMENT_CONTEXT_QUERY=n.CREATE_PAYMENT_CONTEXT_QUERY=n.LEGACY_CREATE_PAYMENT_CONTEXT_QUERY=void 0,n.LEGACY_CREATE_PAYMENT_CONTEXT_QUERY="mutation CreateVenmoQRCodePaymentContext($input: CreateVenmoQRCodePaymentContextInput!) {\n  createVenmoQRCodePaymentContext(input: $input) {\n    clientMutationId\n    venmoQRCodePaymentContext {\n      id\n      merchantId\n      createdAt\n      expiresAt\n    }\n  }\n}",n.CREATE_PAYMENT_CONTEXT_QUERY="mutation CreateVenmoPaymentContext($input: CreateVenmoPaymentContextInput!) {\n  createVenmoPaymentContext(input: $input) {\n    clientMutationId\n    venmoPaymentContext {\n      id\n      merchantId\n      createdAt\n      expiresAt\n    }\n  }\n}",n.LEGACY_UPDATE_PAYMENT_CONTEXT_QUERY="mutation UpdateVenmoQRCodePaymentContext($input: UpdateVenmoQRCodePaymentContextInput!) {\n  updateVenmoQRCodePaymentContext(input: $input) {\n    clientMutationId\n  }\n}",n.UPDATE_PAYMENT_CONTEXT_QUERY="mutation UpdateVenmoPaymentContextStatus($input: UpdateVenmoPaymentContextStatusInput!) {\n  updateVenmoPaymentContextStatus(input: $input) {\n    clientMutationId\n  }\n}",n.LEGACY_VENMO_PAYMENT_CONTEXT_STATUS_QUERY="query PaymentContext($id: ID!) {\n  node(id: $id) {\n    ... on VenmoQRCodePaymentContext {\n      status\n      paymentMethodId\n      userName\n    }\n  }\n}",n.VENMO_PAYMENT_CONTEXT_STATUS_QUERY="query PaymentContext($id: ID!) {\n  node(id: $id) {\n    ... on VenmoPaymentContext {\n      status\n      paymentMethodId\n      userName\n      payerInfo {\n        firstName\n        lastName\n        phoneNumber\n        email\n        externalId\n        userName\n        billingAddress {\n          fullName\n          addressLine1\n          addressLine2\n          adminArea1\n          adminArea2\n          postalCode\n          countryCode\n        }\n        shippingAddress {\n          fullName\n          addressLine1\n          addressLine2\n          adminArea1\n          adminArea2\n          postalCode\n          countryCode\n        }\n      }\n    }\n  }\n}"},{}],250:[function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)}
2,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var o=i(e("framebus")),a=i(e("@braintree/iframer")),s=i(e("@braintree/uuid")),c=e("../shared/events"),d=e("./queries"),l=function(){function e(e){this.isHidden=!0,this.env=e.environment,this.id=s.default(),this.profileId=e.profileId,this.displayName=e.displayName,this.paymentMethodUsage=e.paymentMethodUsage,this.riskCorrelationId=e.riskCorrelationId,this.shouldUseLegacyQRCodeMutation=!this.paymentMethodUsage;var t=e.url+"#"+this.env+"_"+this.id;this.bus=new o.default({channel:this.id,verifyDomain:e.verifyDomain,targetFrames:[]}),this.apiRequest=e.apiRequest,this.sendEvent=e.sendEvent,this.Promise=e.Promise,this.alertBox=document.createElement("div"),this.alertBox.setAttribute("data-venmo-desktop-id",this.id),this.alertBox.setAttribute("role","alert"),this.alertBox.style.position="fixed",this.alertBox.style.display="none",this.alertBox.style.height="1px",this.alertBox.style.width="1px",this.alertBox.style.overflow="hidden",this.alertBox.style.zIndex="0",this.iframe=a.default({src:t,name:"venmo-desktop-iframe",style:{display:"none",position:"fixed",top:"0",bottom:"0",right:"0",left:"0",height:"100%",width:"100%",zIndex:"9999999"},title:"Venmo Desktop"}),this.bus.addTargetFrame(this.iframe)}return e.prototype.initialize=function(){var e=this;return new this.Promise(function(t){e.bus.on(c.VENMO_DESKTOP_IFRAME_READY,function(){t(e)}),e.bus.on(c.VENMO_DESKTOP_REQUEST_NEW_QR_CODE,function(){e.sendEvent("venmo.tokenize.desktop.restarted-from-error-view"),e.startPolling()}),document.body.appendChild(e.iframe),document.body.appendChild(e.alertBox)})},e.prototype.launchDesktopFlow=function(){var e=this;this.isHidden=!1;var t=new this.Promise(function(t,n){e.launchDesktopPromiseRejectFunction=n;var r=function(){e.bus.off(c.VENMO_DESKTOP_CUSTOMER_CANCELED,o),e.bus.off(c.VENMO_DESKTOP_UNKNOWN_ERROR,i)},i=function(t){r(),e.sendEvent("venmo.tokenize.desktop.unknown-error"),n({allowUIToHandleError:!1,reason:"UNKNOWN_ERROR",err:t})},o=function(){r(),e.updateVenmoDesktopPaymentContext("CANCELED"),e.sendEvent("venmo.tokenize.desktop.status-change.canceled-from-modal"),n({allowUIToHandleError:!1,reason:"CUSTOMER_CANCELED"})};e.completedHandler=function(e){r(),t(e)},e.bus.on(c.VENMO_DESKTOP_CUSTOMER_CANCELED,o),e.bus.on(c.VENMO_DESKTOP_UNKNOWN_ERROR,i)});return this.iframe.style.display="block",this.setAlert("Generating a QR code, get your Venmo app ready"),this.iframe.focus(),this.startPolling(),t.then(function(t){return delete e.venmoContextId,delete e.launchDesktopPromiseRejectFunction,t}).catch(function(t){return delete e.venmoContextId,delete e.launchDesktopPromiseRejectFunction,e.Promise.reject(t)})},e.prototype.triggerCompleted=function(e){var t=this;this.isHidden||setTimeout(function(){t.completedHandler&&t.completedHandler(e),delete t.completedHandler},2e3)},e.prototype.triggerRejected=function(e){this.launchDesktopPromiseRejectFunction&&this.launchDesktopPromiseRejectFunction(e)},e.prototype.hideDesktopFlow=function(){this.setAlert(""),this.iframe.style.display="none",this.bus.emit(c.VENMO_DESKTOP_CLOSED_FROM_PARENT),this.isHidden=!0},e.prototype.displayError=function(e){this.isHidden||(this.bus.emit(c.VENMO_DESKTOP_DISPLAY_ERROR,{message:e}),this.setAlert(e))},e.prototype.displayQRCode=function(e,t){this.isHidden||(this.bus.emit(c.VENMO_DESKTOP_DISPLAY_QR_CODE,{id:e,merchantId:t}),this.sendEvent("venmo.desktop-qr.display-qr-code.status.presented",{context_id:this.venmoContextId}),this.setAlert("To scan the QR code, open your Venmo app"))},e.prototype.authorize=function(){this.isHidden||(this.bus.emit(c.VENMO_DESKTOP_AUTHORIZE),this.setAlert("Venmo account authorized"))},e.prototype.authorizing=function(){this.isHidden||(this.bus.emit(c.VENMO_DESKTOP_AUTHORIZING),this.sendEvent("venmo.desktop-qr.display-qr-code.status.authorizing",{context_id:this.venmoContextId}),this.setAlert("Authorize on your Venmo app"))},e.prototype.startPolling=function(){var e=this;return this.createVenmoDesktopPaymentContext().then(function(t){var n=new Date(t.expiresAt).getTime()-new Date(t.createdAt).getTime(),r=Date.now()+n;return e.displayQRCode(t.id,t.merchantId),e.pollForStatusChange(t.status,r)}).then(function(t){if(t){var n=t.userName||"";n="@"+n.replace("@",""),e.triggerCompleted({paymentMethodNonce:t.paymentMethodId,username:n,payerInfo:t.payerInfo,id:e.venmoContextId||""})}}).catch(function(t){t.allowUIToHandleError||(e.sendEvent("venmo.tokenize.desktop.unhandled-error"),e.triggerRe
2jected(t))})},e.prototype.pollForStatusChange=function(e,t){var n=this;return this.venmoContextId?Date.now()>t?this.updateVenmoDesktopPaymentContext("EXPIRED").then(function(){return n.displayError("Something went wrong"),n.sendEvent("venmo.tokenize.desktop.status-change.sdk-timeout"),n.Promise.reject({allowUIToHandleError:!0,reason:"TIMEOUT"})}):this.lookupVenmoDesktopPaymentContext().then(function(r){if(!n.venmoContextId||!r)return n.Promise.resolve();var i=r.status;if(i!==e)switch(e=i,n.sendEvent("venmo.tokenize.desktop.status-change."+e.toLowerCase()),e){case"CREATED":break;case"EXPIRED":case"FAILED":case"CANCELED":var o="CANCELED"===e?"The authorization was canceled":"Something went wrong";return n.displayError(o),n.Promise.reject({allowUIToHandleError:!0,reason:e});case"SCANNED":n.authorizing();break;case"APPROVED":return n.authorize(),n.Promise.resolve(r)}return new n.Promise(function(r,i){setTimeout(function(){n.pollForStatusChange(e,t).then(r).catch(i)},1e3)})}):this.Promise.resolve()},e.prototype.teardown=function(){this.bus.teardown(),this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe),this.alertBox.parentNode&&this.alertBox.parentNode.removeChild(this.alertBox)},e.prototype.setAlert=function(e){this.alertBox.style.display=e?"block":"none",this.alertBox.textContent=e},e.prototype.createPaymentContextFromGraphqlLegacyQRCodeMutation=function(e){return this.apiRequest(d.LEGACY_CREATE_PAYMENT_CONTEXT_QUERY,{input:{environment:this.env,intent:e}}).then(function(e){return e.createVenmoQRCodePaymentContext.venmoQRCodePaymentContext})},e.prototype.createPaymentContextFromGraphQL=function(e){var t=this,n={intent:e,paymentMethodUsage:this.paymentMethodUsage,venmoRiskCorrelationId:this.riskCorrelationId,customerClient:"DESKTOP"};return this.profileId&&(n.merchantProfileId=this.profileId),this.displayName&&(n.displayName=this.displayName),t.sendEvent("venmo.desktop-qr.create-payment-context.started"),this.apiRequest(d.CREATE_PAYMENT_CONTEXT_QUERY,{input:n}).then(function(e){return t.sendEvent("venmo.desktop-qr.create-payment-context.succeeded",{context_id:e.createVenmoPaymentContext.venmoPaymentContext.id}),e.createVenmoPaymentContext.venmoPaymentContext}).catch(function(e){throw t.sendEvent("venmo.desktop-qr.create-payment-context.failed"),e})},e.prototype.createVenmoDesktopPaymentContext=function(){var e=this;return(this.shouldUseLegacyQRCodeMutation?this.createPaymentContextFromGraphqlLegacyQRCodeMutation("PAY_FROM_APP"):this.createPaymentContextFromGraphQL("PAY_FROM_APP")).then(function(t){e.venmoContextId=t.id;var n=e.profileId||t.merchantId;return{id:t.id,status:t.status,merchantId:n,createdAt:t.createdAt,expiresAt:t.expiresAt}})},e.prototype.updateVenmoDesktopPaymentContext=function(e,t){if(void 0===t&&(t={}),!this.venmoContextId)return this.Promise.resolve();var n={input:r({id:this.venmoContextId,status:e},t)},i=this.shouldUseLegacyQRCodeMutation?d.LEGACY_UPDATE_PAYMENT_CONTEXT_QUERY:d.UPDATE_PAYMENT_CONTEXT_QUERY;return this.apiRequest(i,n).then(function(){})},e.prototype.lookupVenmoDesktopPaymentContext=function(){var e=this;if(!e.venmoContextId)return e.Promise.resolve();e.sendEvent("venmo.desktop-qr.query-payment-context.started",{context_id:e.venmoContextId});var t=e.shouldUseLegacyQRCodeMutation?d.LEGACY_VENMO_PAYMENT_CONTEXT_STATUS_QUERY:d.VENMO_PAYMENT_CONTEXT_STATUS_QUERY;return e.apiRequest(t,{id:e.venmoContextId}).then(function(t){return e.sendEvent("venmo.desktop-qr.query-payment-context.succeeded",{context_id:e.venmoContextId}),t.node}).catch(function(t){throw e.sendEvent("venmo.desktop-qr.query-payment-context.failed",{context_id:e.venmoContextId}),t})},e}();n.default=l},{"../shared/events":255,"./queries":249,"@braintree/iframer":35,"@braintree/uuid":39,framebus:54}],251:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/basic-component-verification"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("./shared/errors"),c=e("@braintree/wrap-promise"),d=e("../lib/braintree-error"),l=e("./venmo"),u=e("./shared/supports-venmo"),p=e("./shared/browser-detection");t.exports={create:c(function(e){var t="Venmo";return i.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){var n,i,c=p.isIncognito();return e.profileId&&"string"!=typeof e.profileId?Promise.reject(new d(s.VENMO_INVALID_PROFILE_ID)):e.deepLinkReturnUrl&&"string"!=typeof e.deepLinkReturnUrl?Promise.reject(new d(s.VENMO_INVALID_DEEP_LINK_RETURN_URL)):e.riskCorrelationId&&"string"!=typeof e.riskCorrelationId?Promise.reject(new d(s.VENMO_INVALID_RISK_CORRELATION_ID)):(n=o.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:a.create(e.authorization),name:t}).then(function(t){var n=t.getConfiguration();return e.client=t,n.gatewayConfiguration.payWithVenmo?t:Promise.reject(new d(s.VENMO_NOT_ENABLED))}),Promise.all([n,c]).then(function(t){var o=t[1];return e._isIncognito=o.isPrivate,e.createPromise=n,i=new l(e),r.sendEvent(n,"venmo.initialized"),i}))})}),isBrowserSupported:function(e){return u.isBrowserSupported(e)},VERSION:"3.143.0"}},{"../lib/analytics":144,"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./shared/browser-detection":252,"./shared/errors":254,"./shared/supports-venmo":257,"./venmo":259,"@braintree/wrap-promise":43}],252:[function(e,t,n){"use strict";var r,i=e("@braintree/browser-detection/is-android"),o=e("@braintree/browser-detection/is-chrome"),a=e("@braintree/browser-detection/is-ios"),s=e("@braintree/browser-detection/is-ios-safari"),c=e("@braintree/browser-detection/is-ios-webview");try{r=e("@braintree/browser-detection/is-incognito")}catch(e){r=function(){return Promise.resolve({isPrivate:!1,browserName:"unknown"})}}function d(){return i()&&window.navigator.userAgent.toLowerCase().indexOf("wv")>-1}
2t.exports={isAndroid:i,isAndroidWebview:d,isChrome:o,isIos:a,isIosChrome:function(){return a()&&o()},isIosSafari:s,isIosWebview:c,isWebview:function(){return d()||c()},isFacebookOwnedBrowserOnAndroid:function(){var e=window.navigator.userAgent.toLowerCase();return e.indexOf("huawei")>-1&&e.indexOf("fban")>-1||!!i()&&(e.indexOf("fb_iab")>-1||e.indexOf("instagram")>-1)},doesNotSupportWindowOpenInIos:function(){return!!a()&&(c()||!s())},isIncognito:r}},{"@braintree/browser-detection/is-android":22,"@braintree/browser-detection/is-chrome":24,"@braintree/browser-detection/is-incognito":26,"@braintree/browser-detection/is-ios":30,"@braintree/browser-detection/is-ios-safari":27,"@braintree/browser-detection/is-ios-webview":28}],253:[function(e,t,n){"use strict";t.exports={DOCUMENT_VISIBILITY_CHANGE_EVENT_DELAY:500,DEFAULT_PROCESS_RESULTS_DELAY:1e3,VENMO_APP_OR_MOBILE_AUTH_URL:"https://venmo.com/go/checkout",VENMO_MOBILE_APP_AUTH_ONLY_URL:"https://venmo.com/braintree/checkout",VENMO_WEB_LOGIN_URL:"https://account.venmo.com/go/web",VENMO_WEB_LOGIN_SANDBOX_URL:"https://account.ext.live.venmo.com/go/web"}},{}],254:[function(e,t,n){"use strict";var r=e("../../lib/braintree-error");t.exports={VENMO_NOT_ENABLED:{type:r.types.MERCHANT,code:"VENMO_NOT_ENABLED",message:"Venmo is not enabled for this merchant."},VENMO_TOKENIZATION_REQUEST_ACTIVE:{type:r.types.MERCHANT,code:"VENMO_TOKENIZATION_REQUEST_ACTIVE",message:"Another tokenization request is active."},VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE:{type:r.types.MERCHANT,code:"VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE",message:"No tokenization in progress."},VENMO_APP_FAILED:{type:r.types.UNKNOWN,code:"VENMO_APP_FAILED",message:"Venmo app encountered a problem."},VENMO_APP_CANCELED:{type:r.types.CUSTOMER,code:"VENMO_APP_CANCELED",message:"Venmo app authorization was canceled."},VENMO_CANCELED:{type:r.types.CUSTOMER,code:"VENMO_CANCELED",message:"User canceled Venmo authorization, or Venmo app is not available."},VENMO_CUSTOMER_CANCELED:{type:r.types.CUSTOMER,code:"VENMO_CUSTOMER_CANCELED",message:"User canceled Venmo authorization."},VENMO_NETWORK_ERROR:{type:r.types.NETWORK,code:"VENMO_NETWORK_ERROR",message:"Something went wrong making the request"},VENMO_DESKTOP_CANCELED:{type:r.types.CUSTOMER,code:"VENMO_DESKTOP_CANCELED",message:"User canceled Venmo authorization by closing the Venmo Desktop modal."},VENMO_TOKENIZATION_CANCELED_BY_MERCHANT:{type:r.types.MERCHANT,code:"VENMO_TOKENIZATION_CANCELED_BY_MERCHANT",message:"The Venmo tokenization was canceled by the merchant."},VENMO_DESKTOP_UNKNOWN_ERROR:{type:r.types.UNKNOWN,code:"VENMO_DESKTOP_UNKNOWN_ERROR",message:"Something went wrong with the Venmo Desktop flow."},VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED:{type:r.types.NETWORK,code:"VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED",message:"Something went wrong creating the Venmo Payment Context."},VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR:{type:r.types.UNKNOWN,code:"VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR",message:"Something went wrong during mobile polling."},VENMO_MOBILE_POLLING_TOKENIZATION_EXPIRED:{type:r.types.CUSTOMER,code:"VENMO_MOBILE_POLLING_TOKENIZATION_EXPIRED",message:"The Venmo authorization request is expired."},VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED:{type:r.types.CUSTOMER,code:"VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED",message:"The Venmo authorization was canceled"},VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT:{type:r.types.CUSTOMER,code:"VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT",message:"Customer took too long to authorize Venmo payment."},VENMO_MOBILE_POLLING_TOKENIZATION_NO_CONTEXT_ID:{type:r.types.UNKNOWN,code:"VENMO_MOBILE_POLLING_TOKENIZATION_NO_CONTEXT_ID",message:"No Venmo payment context ID available."},VENMO_MOBILE_POLLING_TOKENIZATION_FAILED:{type:r.types.UNKNOWN,code:"VENMO_MOBILE_POLLING_TOKENIZATION_FAILED",message:"The Venmo authorization failed."},VENMO_INVALID_PROFILE_ID:{type:r.types.MERCHANT,code:"VENMO_INVALID_PROFILE_ID",message:"Venmo profile ID is invali
2d."},VENMO_INVALID_DEEP_LINK_RETURN_URL:{type:r.types.MERCHANT,code:"VENMO_INVALID_DEEP_LINK_RETURN_URL",message:"Venmo deep link return URL is invalid."},VENMO_INVALID_RISK_CORRELATION_ID:{type:r.types.MERCHANT,code:"VENMO_INVALID_RISK_CORRELATION_ID",message:"Venmo risk correlation ID is invalid."},VENMO_TOKENIZATION_FAILED:{type:r.types.UNKNOWN,code:"VENMO_TOKENIZATION_FAILED",message:"Venmo encountered a problem"},VENMO_ECD_DISABLED:{type:r.types.MERCHANT,code:"ECD_DISABLED",message:"Cannot collect customer data when ECD is disabled. Enable this feature in the Control Panel to collect this data."}}},{"../../lib/braintree-error":149}],255:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.VENMO_DESKTOP_UNKNOWN_ERROR=n.VENMO_DESKTOP_REQUEST_NEW_QR_CODE=n.VENMO_DESKTOP_CLOSED_FROM_PARENT=n.VENMO_DESKTOP_IFRAME_READY=n.VENMO_DESKTOP_DISPLAY_QR_CODE=n.VENMO_DESKTOP_DISPLAY_ERROR=n.VENMO_DESKTOP_CUSTOMER_CANCELED=n.VENMO_DESKTOP_AUTHORIZING=n.VENMO_DESKTOP_AUTHORIZE=n.VENMO_DESKTOP_AUTHORIZATION_TIMED_OUT=void 0,n.VENMO_DESKTOP_AUTHORIZATION_TIMED_OUT="VENMO_DESKTOP_AUTHORIZATION_TIMED_OUT",n.VENMO_DESKTOP_AUTHORIZE="VENMO_DESKTOP_AUTHORIZE",n.VENMO_DESKTOP_AUTHORIZING="VENMO_DESKTOP_AUTHORIZING",n.VENMO_DESKTOP_CUSTOMER_CANCELED="VENMO_DESKTOP_CUSTOMER_CANCELED",n.VENMO_DESKTOP_DISPLAY_ERROR="VENMO_DESKTOP_DISPLAY_ERROR",n.VENMO_DESKTOP_DISPLAY_QR_CODE="VENMO_DESKTOP_DISPLAY_QR_CODE",n.VENMO_DESKTOP_IFRAME_READY="VENMO_DESKTOP_IFRAME_READY",n.VENMO_DESKTOP_CLOSED_FROM_PARENT="VENMO_DESKTOP_CLOSED_FROM_PARENT",n.VENMO_DESKTOP_REQUEST_NEW_QR_CODE="VENMO_DESKTOP_REQUEST_NEW_QR_CODE",n.VENMO_DESKTOP_UNKNOWN_ERROR="VENMO_DESKTOP_UNKNOWN_ERROR"},{}],256:[function(e,t,n){"use strict";var r=e("./constants");t.exports=function(e){return e.useAllowDesktopWebLogin?e.enableVenmoSandbox&&e.environment&&"production"!==e.environment?r.VENMO_WEB_LOGIN_SANDBOX_URL:r.VENMO_WEB_LOGIN_URL:e.mobileWebFallBack?r.VENMO_APP_OR_MOBILE_AUTH_URL:r.VENMO_MOBILE_APP_AUTH_ONLY_URL}},{"./constants":253}],257:[function(e,t,n){"use strict";var r=e("./browser-detection"),i=e("../../lib/in-iframe");function o(){var e=r.isAndroid(),t=e&&r.isChrome(),n=r.isIos(),i=r.isIosSafari();return{isAndroid:e,isAndroidChrome:t,isIos:n,isIosSafari:i,isMobileDevice:e||n,isMobileDeviceThatSupportsReturnToSameTab:i||t,isWebview:r.isAndroidWebview()||r.isIosWebview()}}function a(){var e=o();return e.isMobileDevice&&!e.isIosSafari&&!e.isAndroidChrome}t.exports={isBrowserSupported:function(e){var t=function(e){return{merchantAllowsDesktopBrowsers:!0===((e=e||{}).allowDesktopWebLogin||e.allowDesktop),merchantAllowsReturningToNewBrowserTab:!e.hasOwnProperty("allowNewBrowserTab")||e.allowNewBrowserTab,merchantAllowsNonDefaultBrowsers:!e.hasOwnProperty("allowNonDefaultBrowsers")||e.allowNonDefaultBrowsers,merchantAllowsWebviews:!e.hasOwnProperty("allowWebviews")||e.allowWebviews}}(e),n=o();return!(a()&&!t.merchantAllowsNonDefaultBrowsers)&&!function(e,t){return!e.merchantAllowsWebviews&&t.isWebview}(t,n)&&!function(e,t){return(!((e.merchantAllowsNonDefaultBrowsers||e.merchantAllowsReturningToNewBrowserTab)&&!i())||!r.isIosChrome())&&(t.isIos&&!t.isIosSafari||t.isAndroid&&!t.isAndroidChrome?!e.merchantAllowsReturningToNewBrowserTab:r.isFacebookOwnedBrowserOnAndroid())}(t,n)&&(!!n.isMobileDevice||t.merchantAllowsDesktopBrowsers)},isNonDefaultBrowser:a}},{"../../lib/in-iframe":175,"./browser-detection":252}],258:[function(e,t,n){"use strict";var r=e("../../lib/frame-service/external"),i=e("../../lib/use-min"),o=e("@braintree/extended-promise"),a=e("../shared/errors"),s=e("../../lib/braintree-error"),c="venmo-desktop-web-backdrop",d="venmo-desktop-web-backdrop.hidden",l="venmo-backdrop-container",u="venmo-popup-cancel-button",p="venmo-popup-continue-button",_="venmo-message",E="venmo-instructions",m="venmo-full-logo";function h(e){var t=e.frameServiceInstance,n=e.venmoUrl,r=e.checkForStatusChange,i=e.cancelTokenization,c=e.checkPaymentContextStatus,d=new o,l=e.analyticsCallback;return document.getElementById(p).addEventListener("click",function(){t.focus()}),document.getElementById(u).addEventListener("click",function(){t.close(),i(),f()}),t.open({},function(e){e?(l&&l("login","failed"),d.reject(e)):(l&&(l("login","succeeded"),l("return-to-merchant","start")),r(1).then(function(e){l&&l("return-to-merchant","succeeded"),d.resolve(e)}).catch(function(e){c().then(function(t){"CREATED"===t.status?(l&&l("return-to-merchant","canceled"),d.reject(new s(a.VENMO_CUSTOMER_CANCELED))):(l&&l("return-to-merchant","failed"),d.reject(e))})})),t.close(),f()}),t.redirect(n),d}function f(){document.getElementById("venmo-desktop-web-backdrop").classList.add("hidden")}function A(e){var t,n,r,i,o,a,s,h,f=document.getElementById(c);f?f.classList.remove("hidden"):(t=document.createElement("style"),n=document.createElement("div"),r=document.createElement("div"),i=document.createElement("div"),o=document.createElement("div"),a=document.createElement("div"),s=document.createElement("button"),h=document.createElement("button"),e&&(t.nonce=e),t.id="venmo-desktop-web__injected-styles",t.innerHTML=["#"+d+" {","display: none;","}","#"+c+" {","z-index: 3141592632;","cursor: pointer;","position: fixed;","top: 0;","left: 0;","bottom: 0;","width: 100%;","background: rgba(0, 0, 0, 0.8);","}"].concat(["#"+l+" {","display: flex;","align-content: center;","justify-content: center;","align-items: center;","width: 100%;","height: 100%;","flex-direction: column;","}"],["#"+u+" {","height: 24px;","width: 380px;","font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;","font-style: normal;","font-weight: 700;","font-size: 18px;","line-height: 24px;","text-align: center;","background-color: transparent;","border: none;","color: #FFFFFF;","margin-top: 28px;","}"],["#"+p+" {","width: 400px;","height: 50px;","background: #0074DE;","border-radius: 24px;","border: none;","font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;","font-style: normal;","font-weight: 700;","font-size: 18px;","color: #FFFFFF;","margin-top: 44px;","}"],["#"+_+" {","font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;","font-style: normal;","font-weight: 500;","font-size: 24px;","line-height: 32px;","text-align: center;","color: #FFFFFF;","margin-top: 32px;","}"],["#"+E+" {","font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;","font-style: normal;","font-weight: 400;","font-size: 16px;","line-height: 20px;","text-align: center;","color: #FFFFFF;","margin-top: 16px;","width: 400px;","}"]).join("\n"),n.id=c,r.id=l,i.id=m,i.innerHTML='<svg width="198" height="58" viewBox="0 0 198 58" fill="none" xmlns="http://www.w3.org/2000/svg">\n  <path fill-rule="evenodd" clip-rule="evenodd" d="M43.0702 13.6572C44.1935 15.4585 44.6999 17.3139 44.6999 19.6576C44.6999 27.1328 38.1277 36.8436 32.7935 43.6625H20.6099L15.7236 15.2939L26.3917 14.3105L28.9751 34.4966C31.389 30.6783 34.3678 24.6779 34.3678 20.587C34.3678 18.3477 33.9727 16.8225 33.3553 15.5666L43.0702 13.6572Z" fill="white"/>\n  <path fill-rule="evenodd" clip-rule="evenodd" d="M56.8965 26.1491C58.8596 26.1491 63.8018 25.2772 63.8018 22.5499C63.8018 21.2402 62.8481 20.587 61.7242 20.587C59.7579 20.587 57.1776 22.8763 56.8965 26.1491ZM56.6715 31.5506C56.6715 34.8807 58.5787 36.1873 61.107 36.1873C63.8603 36.1873 66.4966 35.534 69.923 33.8433L68.6324 42.3523C66.2183 43.4976 62.4559 44.2617 58.8039 44.2617C49.5403 44.2617 46.2249 38.8071 46.2249 31.9879C46.2249 23.1496 51.6179 13.765 62.7365 13.765C68.858 13.765 72.2809 17.0949 72.2809 21.7317C72.2815 29.2066 62.4005 31.4965 56.6715 31.5506Z" fill="white"/>\n  <path fill-rule="evenodd" clip-rule="evenodd" d="M103.067 20.3142C103.067 21.4052 102.897 22.9875 102.727 24.0216L99.5262 43.6622H89.1385L92.0585 25.658C92.1139 25.1696 92.284 24.1865 92.284 23.6411C92.284 22.3314 91.4414 22.0047 90.4282 22.0047C89.0826 22.0047 87.7337 22.6042 86.8354 23.0418L83.5234 43.6625H73.0772L77.8495 14.257H86.8908L87.0052 16.6041C89.1382 15.2404 91.9469 13.7656 95.932 13.7656C101.212 13.765 103.067 16.3845 103.067 20.3142Z" fill="white"/>\n  <path fill-rule="evenodd" clip-rule="evenodd" d="M133.906 16.9841C136.881 14.9131 139.69 13.765 143.563 13.765C148.897 13.765 150.753 16.3845 150.753 20.3142C150.753 21.4052 150.583 22.9875 150.413 24.0216L147.216 43.6622H136.825L139.801 25.2774C139.855 24.786 139.971 24.1865 139.971 23.8063C139.971 22.3317 139.128 22.0047 138.115 22.0047C136.824 22.0047 135.535 22.5501 134.577 23.0418L131.266 43.6625H120.878L123.854 25.2777C123.908 24.7863 124.02 24.1868 124.02 23.8065C124.02 22.332 123.177 22.0049 122.167 22.0049C120.819 22.0049 119.473 22.6045 118.574 23.0421L115.26 43.6628H104.817L109.589 14.2573H118.52L118.8 16.7122C120.878 15.241 123.684 13.7662 127.446 13.7662C130.704 13.765 132.837 15.129 133.906 16.9841Z" fill="white"/>\n  <path fill-rule="evenodd" clip-rule="evenodd" d="M171.426 25.5502C171.426 23.1496 170.808 21.513 168.956 21.513C164.857 21.513 164.015 28.55 164.015 32.1498C164.015 34.8807 164.802 36.5709 166.
2653 36.5709C170.528 36.5709 171.426 29.1497 171.426 25.5502ZM153.458 31.7152C153.458 22.442 158.511 13.765 170.136 13.765C178.896 13.765 182.098 18.7854 182.098 25.7148C182.098 34.8805 177.099 44.3723 165.194 44.3723C156.378 44.3723 153.458 38.7525 153.458 31.7152Z" fill="white"/>\n</svg>',o.id=_,o.innerText="What would you like to do?",a.id=E,a.innerText="Tap cancel payment to cancel and return to the business. Continue payment will relaunch the payment window.",s.id=p,s.innerText="Continue payment",h.id=u,h.innerText="Cancel payment",document.head.appendChild(t),r.appendChild(i),r.appendChild(o),r.appendChild(a),r.appendChild(s),r.appendChild(h),n.appendChild(r),document.body.appendChild(n),n.addEventListener("click",function(e){e.stopPropagation()}))}o.suppressUnhandledPromiseMessage=!0,t.exports={runWebLogin:function(e){return A(e.styleCspNonce),e.analyticsCallback&&e.analyticsCallback("login","start"),h(e)},openPopup:h,setupDesktopWebLogin:function(e){var t=new o,n=e.assetsUrl,a=e.debug||!1,s={top:Math.round((window.outerHeight-570)/2)+window.screenTop,left:Math.round((window.outerWidth-400)/2)+window.screenLeft},c=n+"/web/3.143.0/html";return r.create({name:"venmoDesktopWebLogin",dispatchFrameUrl:c+"/dispatch-frame"+i(a)+".html",openFrameUrl:c+"/venmo-landing-frame"+i(a)+".html",top:s.top,left:s.left,height:570,width:400},function(e){t.resolve(e)}),t},POPUP_WIDTH:400,POPUP_HEIGHT:570}},{"../../lib/braintree-error":149,"../../lib/frame-service/external":163,"../../lib/use-min":187,"../shared/errors":254,"@braintree/extended-promise":34}],259:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/assign").assign,o=e("./shared/supports-venmo"),a=e("./shared/browser-detection"),s=e("./shared/constants"),c=e("./shared/errors"),d=e("../lib/querystring"),l=e("../lib/is-verified-domain"),u=e("../lib/methods"),p=e("../lib/convert-methods-to-error"),_=e("@braintree/wrap-promise"),E=e("../lib/braintree-error"),m=e("../lib/in-iframe"),h=e("@braintree/extended-promise"),f=e("./shared/get-venmo-url"),A=e("./shared/web-login-backdrop"),y=e("../lib/snake-case-to-camel-case"),I=e("../lib/url-params"),T=e("./external/"),P=e("./external/queries"),N="3.143.0";function O(e){var t=this;this._allowDesktopWebLogin=Boolean(e.allowDesktopWebLogin),this._mobileWebFallBack=Boolean(e.mobileWebFallBack),this._createPromise=e.createPromise,this._allowNewBrowserTab=!1!==e.allowNewBrowserTab,this._allowWebviews=!1!==e.allowWebviews,this._allowDesktop=!0===e.allowDesktop,this._useRedirectForIOS=!0===e.useRedirectForIOS,this._profileId=e.profileId,this._displayName=e.displayName,this._deepLinkReturnUrl=e.deepLinkReturnUrl,this._ignoreHistoryChanges=e.ignoreHistoryChanges,this._paymentMethodUsage=(e.paymentMethodUsage||"").toUpperCase(),this._shouldUseLegacyFlow=!this._paymentMethodUsage,this._requireManualReturn=!0===e.requireManualReturn,this._useDesktopQRFlow=this._allowDesktop&&this._isDesktop()&&!this._allowDesktopWebLogin,this._useAllowDesktopWebLogin=this._allowDesktopWebLogin&&this._isDesktop(),this._cannotHaveReturnUrls=m()||this._requireManualReturn,this._allowAndroidRecreation=!1!==e.allowAndroidRecreation,this._allowNonDefaultBrowsers=!1!==e.allowNonDefaultBrowsers,this._maxRetryCount=3,this._collectCustomerBillingAddress=e.collectCustomerBillingAddress||!1,this._collectCustomerShippingAddress=e.collectCustomerShippingAddress||!1,this._cancelOnReturnToBrowser=!0===e.cancelOnReturnToBrowser&&!a.isAndroid(),this._isFinalAmount=e.isFinalAmount||!1,this._lineItems=e.lineItems,this._subTotalAmount=e.subTotalAmount,this._discountAmount=e.discountAmount,this._taxAmount=e.taxAmount,this._shippingAmount=e.shippingAmount,this._totalAmount=e.totalAmount,this._cspNonce=(this._mobileWebFallBack||this._allowDesktopWebLogin)&&(e.styleCspNonce||!1),this._mobilePollingInterval=250,this._mobilePollingExpiresThreshold=3e5,this._pollCount=0,this._riskCorrelationId=e.riskCorrelationId,this._shouldCreateVenmoPaymentContext=this._cannotHaveReturnUrls||!this._shouldUseLegacyFlow,this._isIncognito=e._isIncognito,this._enableVenmoSandbox=e.enableVenmoSandbox||!1,r.sendEvent(this._createPromise,"venmo.options.is-incognito."+String(Boolean(this._isIncognito))),r.sendEvent(this._createPromise,"venmo.desktop-flow.configured."+String(Boolean(this._allowDesktop))),this.hasTokenizationResult()?r.sendEvent(this._createPromise,"venmo.appswitch.return-in-new-tab"):this._useDesktopQRFlow?this._createPromise=this._createPromise.then(function(e){var n=e.getConfiguration().gatewayConfiguration;return T({url:n.assetsUrl+"/web/"+N+"/html/venmo-desktop-frame.html",environment:"production"===n.environment?"PRODUCTION":"SANDBOX",profileId:t._profileId||n.payWithVenmo.merchantId,paymentMethodUsage:t._paymentMethodUsage,riskCorrelationId:t._riskCorrelationId,displayName:t._displayName,Promise:Promise,apiRequest:function(t,n){return e.request({api:"graphQLApi",data:{query:t,variables:n}}).then(function(e){return e.data})},sendEvent:function(e,n){r.sendEventPlus(t._createPromise,e,n||{})},verifyDomain:l}).then(function(n){return t._venmoDesktopInstance=n,r.sendEvent(t._createPromise,"venmo.desktop-flow.presented"),e}).catch(function(){return r.sendEvent(t._createPromise,"venmo.desktop-flow.setup-failed"),t._useDesktopQRFlow=!1,e})}):this._shouldCreateVenmoPaymentContext&&(this._createPromise=this._createPromise.then(function(e){var n,i,o=t._determineAnalyticsCategory(),a=t._cannotHaveReturnUrls?"manual-return":"mobile-payment-context",s=e.getConfiguration();return i=A.setupDesktopWebLogin({assetsUrl:s.gatewayConfiguration.assetsUrl,debug:s.isDebug}).then(function(e){t._frameServiceInstance=e}).catch(function(e){return e}
2),t._mobilePollingContextEnvironment=s.gatewayConfiguration.environment.toUpperCase(),n=t._createVenmoPaymentContext(e).then(function(){return r.sendEventPlus(t._createPromise,"venmo."+a+".presented",{platform:o}),e}).catch(function(e){return r.sendEvent(t._createPromise,"venmo."+a+".setup-failed"),Promise.reject(new E({type:c.VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED.type,code:c.VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED.code,message:g(e)?e.details.originalError[0].message:c.VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED.message,details:{originalError:e}}))}),h.all([i,n]).then(function(e){var t=e[1];return Promise.resolve(t)}).catch(function(e){return Promise.reject(e)})}))}function g(e){return e.details&&e.details.originalError&&e.details.originalError[0]&&e.details.originalError[0].extensions&&"VALIDATION"===e.details.originalError[0].extensions.errorClass&&"user_error"===e.details.originalError[0].extensions.errorType}function C(e){var t="",n="";if(e)t=e;else{t=window.location.hash.substring(1);try{window.top&&window.top!==window&&window.top.location&&(n=window.top.location.hash.substring(1))&&(t=n)}catch(e){}}var r=t.split("&").reduce(function(e,t){var n=t.split("="),r=decodeURIComponent(n[0]).replace(/\W/g,""),i=y(r),o=decodeURIComponent(n[1]);return e[i]=o,e},{});return r.resourceId&&(r.id=r.resourceId),r}function b(e){return"@"+(e=e||"").replace("@","")}function v(){var e;return void 0!==window.document.hidden?e="visibilitychange":void 0!==window.document.msHidden?e="msvisibilitychange":void 0!==window.document.webkitHidden&&(e="webkitvisibilitychange"),e}h.suppressUnhandledPromiseMessage=!0,O.prototype._determineAnalyticsCategory=function(){return this._popupBridgeIsInstalled()?"popup-bridge":this._useDesktopQRFlow?"desktop-qr":this._useAllowDesktopWebLogin?"web-login-flow":this._isDesktop()?"desktop":"mobile"},O.prototype._createVenmoPaymentContext=function(e,t){var n,i,o=this,a=e.getConfiguration(),s=o._determineAnalyticsCategory(),d=a.gatewayConfiguration.payWithVenmo,l=!1,u=o._useAllowDesktopWebLogin?"NATIVE_WEB":"MOBILE_WEB";if(!this._shouldCreateVenmoPaymentContext)return Promise.resolve();if(this._shouldUseLegacyFlow)n=e.request({api:"graphQLApi",data:{query:P.LEGACY_CREATE_PAYMENT_CONTEXT_QUERY,variables:{input:{environment:this._mobilePollingContextEnvironment,intent:"PAY_FROM_APP"}}}}).then(function(e){return e.data.createVenmoQRCodePaymentContext.venmoQRCodePaymentContext});else{if((this._collectCustomerBillingAddress||this._collectCustomerShippingAddress)&&!d.enrichedCustomerDataEnabled)return Promise.reject(new E(c.VENMO_ECD_DISABLED));this._lineItems&&this._lineItems.forEach(function(e){e.unitTaxAmount=e.unitTaxAmount||"0"}),i={subTotalAmount:this._subTotalAmount,discountAmount:this._discountAmount,taxAmount:this._taxAmount,shippingAmount:this._shippingAmount,totalAmount:this._totalAmount,lineItems:this._lineItems},l=Object.keys(i).some(function(e){return void 0!==i[e]}),r.sendEventPlus(o._createPromise,"venmo.create-payment-context.started",{platform:s}),n=e.request({api:"graphQLApi",data:{query:P.CREATE_PAYMENT_CONTEXT_QUERY,variables:{input:{venmoRiskCorrelationId:this._riskCorrelationId,paymentMethodUsage:this._paymentMethodUsage,intent:"CONTINUE",customerClient:u,isFinalAmount:this._isFinalAmount,displayName:this._displayName,paysheetDetails:{collectCustomerBillingAddress:this._collectCustomerBillingAddress,collectCustomerShippingAddress:this._collectCustomerShippingAddress,transactionDetails:l?i:void 0}}}}}).then(function(e){var t=e.data.createVenmoPaymentContext.venmoPaymentContext;return r.sendEventPlus(o._createPromise,"venmo.create-payment-context.succeeded",{context_id:t.id,platform:s}),t}).catch(function(e){throw r.sendEventPlus(o._createPromise,"venmo.create-payment-context.failed",{platform:s}),e})}return n.then(function(n){var r=.6666*(new Date(n.expiresAt)-new Date(n.createdAt));clearTimeout(o._refreshPaymentContextTimeout),o._refreshPaymentContextTimeout=setTimeout(function(){o._tokenizationInProgress||o._createVenmoPaymentContext(e,!0)},r),t&&o._tokenizationInProgress||(o._venmoPaymentContextStatus=n.status,o._venmoPaymentContextId=n.id)})},O.prototype._popupBridgeIsInstalled=function(){return window.popupBridge&&"function"==typeof window.popupBridge.open},O.prototype._venmoNativeAppIsInstalled=function(){return Boolean(window.popupBridge&&(window.parent&&window.parent.popupBridge.isVenmoInstalled||window.popupBridge.isVenmoInstalled))},O.prototype._handleDeepLinkAppSwitch=function(e){window.navigator.platform&&/iPhone|iPad|iPod/.test(window.navigator.platform)?this._handleIosWebviewDeepLink(e):this._popupBridgeIsInstalled()?this._handlePopupBridgeAppSwitch(e):a.isAndroidWebview()?(r.sendEvent(this._createPromise,"venmo.appswitch.start.android-webview-redirect"),m()?this._handleIFrameBreakout(e):window.location.href=e):a.isAndroid()&&!a.isWebview()?(r.sendEvent(this._createPromise,"venmo.appswitch.start.android-browser-redirect"),m()?this._handleIFrameBreakout(e):window.location.href=e):(r.sendEvent(this._createPromise,"venmo.appswitch.start.webview"),this._venmoWindow=window.open(e))},O.prototype._handleIosWebviewDeepLink=function(e){r.sendEvent(this._createPromise,"venmo.appswitch.start.ios-webview"),m()?this._handleIosWebviewInIframe(e):!this._venmoNativeAppIsInstalled()&&this._popupBridgeIsInstalled()?this._handlePopupBridgeAppSwitch(e):window.location.href=e},O.prototype._handleIosWebviewInIframe=function(e){this._venmoNativeAppIsInstalled()?this._handleIFrameBreakout(e):this._popupBridgeIsInstalled()?this._handlePopupBridgeAppSwitch(e):this._handleIFrameBreakout(e)},O.prototype._handlePopupBridgeAppSwitch=function(e){r.sendEvent(this._createPromise,"venmo.appswitch.start.popup-bridge"),window.popupBridge.open(e)},O.prototype._handleBrowserAppSwitch=function(e){r.sendEvent(this._createPromise,"venmo.appswitch.start.browser"),a.doesNotSupportWindowOpenInIos()||this._shouldUseRedirectStrategy()?window.location.href=e:m()&&a.isAndroid()&&a.isChrome()?(r.sendEvent(this._createPromise,"venmo.appswitch.start.chrome-android-iframe-breakout"),this._handleIFrameBreakout(e)):this._mobileWebFallBack&&a.isAndroid()&&a.isChrome()?window.location.href=e:this._venmoWindow=window.open(e)},O.prototype._handleIFrameBreakout=function(e){window.top.location.href=e},O.prototype.appSwitch=function(e){this._deepLinkReturnUrl?this._handleDeepLinkAppSwitch(e):this._handleBrowserAppSwitch(e)},O.prototype.getUrl=function(){return this._createPromise.then(function(e){var t=e.getConfiguration(),n={},r=this._deepLinkReturnUrl||window.location.href.replace(window.location.hash,""),i=t.gatewayConfiguration.payWithVenmo,o=t.analyticsMetadata,a=i.accessToken,s={_meta:{version:o.sdkVersion,integration:o.integration,platform:o.platform,sessionId:o.sessionId}};return this._isDebug=t.isDebug,this._assetsUrl=t.gatewayConfiguration.assetsUrl,r=r.replace(/#*$/,""),this._venmoPaymentContextId&&(this._shouldUseLegacyFlow?a+="|pcid:"+this._venmoPaymentContextId:n.resource_id=this._venmoPaymentContextId),this._riskCorrelationId&&(n["client-metadata-id"]=this._riskCorrelationId),this._shouldIncludeReturnUrls()||this._useAllowDesktopWebLogin?(this._useAllowDesktopWebLogin&&(r=this._assetsUrl+"/web/"+N+"/html/redirect-frame.html"),n["x-success"]=r+"#venmoSuccess=1",n["x-cancel"]=r+"#venmoCancel=1",n["x-error"]=r+"#venmoError=1"):(n["x-success"]="NOOP",n["x-cancel"]="NOOP",n["x-error"]="NOOP"),this._allowAndroidRecreation?n.allowAndroidRecreation=1:n.allowAndroidRecreation=0,n.ua=window.navigator.userAgent,n.braintree_merchant_id=this._profileId||i.merchantId,n.braintree_access_token=a,n.braintree_environment=i.environment,n.braintree_sdk_data=btoa(JSON.stringify(s)),f({useAllowDesktopWebLogin:this._useAllowDesktopWebLogin,mobileWebFallBack:this._mobileWebFallBack,enableVenmoSandbox:this._enableVenmoSandbox,environment:i.environment})+"?"+d.stringify(n)}.bind(this))},O.prototype.isBrowserSupported=function(){return o.isBrowserSupported({allowNewBrowserTab:this._allowNewBrowserTab,allowWebviews:this._allowWebviews,allowDesktop:this._allowDesktop,allowDesktopWebLogin:this._allowDesktopWebLogin,allowNonDefaultBrowsers:this._allowNonDefaultBrowsers})},O.prototype.hasTokenizationResult=function(){return this._hasTokenizationResult()},O.prototype._hasTokenizationResult=function(e){var t=C(e),n={},r=I.getUrlParams();window;try{window.top&&window.top!==window&&window.top.location&&(n=C(window.top.location.hash))}catch(e){}return r.resource_id?this._venmoPaymentContextId=r.resource_id:t.id?this._venmoPaymentContextId=t.id:n.id&&(this._venmoPaymentContextId=n.id),void 0!==(t.venmoSuccess||t.venmoError||t.venmoCancel||n.venmoSuccess||n.venmoError||n.venmoCancel)},O.prototype._shouldIncludeReturnUrls=function(){return!o.isNonDefaultBrowser()||a.isWebview()||a.isAndroid()?!(!this._deepLinkReturnUrl&&(this._cannotHaveReturnUrls||(!this._isIncognito||!a.isIosSafari())&&this._isIncognito)):Boolean(this._deepLinkReturnUrl)&&this._shouldUseRedirectStrategy()},O.prototype._isDesktop=function(){return!(a.isIos()||a.isAndroid())},O.prototype._isIOSIframeWithoutVenmoApp=function(){return a.isIos()&&m()&&!this._venmoNativeAppIsInstalled()&&!this._requireManualReturn},O.prototype.tokenize=function(e){var t=this;return e=e||{},!0===this._tokenizationInProgress?Promise.reject(new E(c.VENMO_TOKENIZATION_REQUEST_ACTIVE)):(this._tokenizationInProgress=!0,(this._useDesktopQRFlow?this._tokenizeForDesktopQRFlow(e):this._useAllowDesktopWebLogin?this._tokenizeWebLoginWithRedirect(e):this._cannotHaveReturnUrls&&!this._isIOSIframeWithoutVenmoApp()?this._tokenizeForMobileWithManualReturn():this._tokenizeForMobileWithHashChangeListeners(e)).then(function(e){return t._createPromise.then(function(e){return t._createVenmoPaymentContext(e)}
2).then(function(){return t._tokenizationInProgress=!1,t._venmoWindow=null,function(e){var t={nonce:e.paymentMethodNonce,type:"VenmoAccount",details:{username:b(e.username),paymentContextId:e.id}};return e.payerInfo&&(t.details.payerInfo=e.payerInfo,t.details.payerInfo.userName=b(e.payerInfo.userName)),t}(e)})}).catch(function(e){return t._createPromise.then(function(e){return t._createVenmoPaymentContext(e)}).then(function(){return t._tokenizationInProgress=!1,t._venmoWindow=null,Promise.reject(e)})}))},O.prototype.cancelTokenization=function(){return this._tokenizationInProgress?(this._removeVisibilityEventListener(),this._tokenizePromise&&this._tokenizePromise.reject(new E(c.VENMO_TOKENIZATION_CANCELED_BY_MERCHANT)),this._pollingInProgress=!1,Promise.all([this._cancelMobilePaymentContext(),this._cancelVenmoDesktopContext()])):Promise.reject(new E(c.VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE))},O.prototype._tokenizeWebLoginWithRedirect=function(){var e,t=this;return r.sendEventPlus(t._createPromise,"venmo.tokenize.web-login.start",{context_id:t._venmoPaymentContextId}),this._tokenizePromise=new h,this.getUrl().then(function(n){return e={checkForStatusChange:t._checkPaymentContextStatusAndProcessResult.bind(t),cancelTokenization:t.cancelTokenization.bind(t),frameServiceInstance:t._frameServiceInstance,venmoUrl:n,debug:t._isDebug,checkPaymentContextStatus:t._checkPaymentContextStatus.bind(t),analyticsCallback:function(e,n){r.sendEventPlus(t._createPromise,"venmo.desktop."+e+"."+n,{context_id:t._venmoPaymentContextId})}},t._cspNonce&&(e=i({},e,{styleCspNonce:t._cspNonce})),A.runWebLogin(e).then(function(e){r.sendEventPlus(t._createPromise,"venmo.tokenize.web-login.success",{context_id:t._venmoPaymentContextId}),t._tokenizePromise.resolve({paymentMethodNonce:e.paymentMethodId,username:e.userName,payerInfo:e.payerInfo,id:t._venmoPaymentContextId})}).catch(function(e){r.sendEventPlus(t._createPromise,"venmo.tokenize.web-login.failure",{context_id:t._venmoPaymentContextId}),t._tokenizePromise.reject(e)}),t._tokenizePromise})},O.prototype._queryPaymentContextStatus=function(e){var t=this;return r.sendEventPlus(t._createPromise,"venmo.query-payment-context.started",{context_id:e}),this._createPromise.then(function(n){var r=t._shouldUseLegacyFlow?P.LEGACY_VENMO_PAYMENT_CONTEXT_STATUS_QUERY:P.VENMO_PAYMENT_CONTEXT_STATUS_QUERY;return n.request({api:"graphQLApi",data:{query:r,variables:{id:e}}})}).then(function(n){return r.sendEventPlus(t._createPromise,"venmo.query-payment-context.succeeded",{context_id:e}),n.data.node}).catch(function(n){throw r.sendEventPlus(t._createPromise,"venmo.query-payment-context.failed",{context_id:e}),n})},O.prototype._checkPaymentContextStatusAndProcessResult=function(e){var t=this;return t._checkPaymentContextStatus().then(function(n){var i=n.status;if(i!==t._venmoPaymentContextStatus)switch(t._venmoPaymentContextStatus=i,r.sendEventPlus(t._createPromise,"venmo.tokenize.web-login.status-change."+i.toLowerCase(),{context_id:t._venmoPaymentContextId}),i){case"APPROVED":return Promise.resolve(n);case"CANCELED":return Promise.reject(new E(c.VENMO_CUSTOMER_CANCELED));case"EXPIRED":case"FAILED":return Promise.reject(new E(c.VENMO_TOKENIZATION_FAILED))}return new Promise(function(n,r){e<t._maxRetryCount?(e++,t._checkPaymentContextStatusAndProcessResult(e).then(n).catch(r)):r(new E(c.VENMO_TOKENIZATION_FAILED))})})},O.prototype._checkPaymentContextStatus=function(){return this._queryPaymentContextStatus(this._venmoPaymentContextId).catch(function(e){return Promise.reject(new E({type:c.VENMO_NETWORK_ERROR.type,code:c.VENMO_NETWORK_ERROR.code,message:c.VENMO_NETWORK_ERROR.message,details:e}))}).then(function(e){return Promise.resolve(e)})},O.prototype._validatePollingContext=function(){return this._venmoPaymentContextId?Date.now()>this._mobilePollingContextExpiresIn?Promise.reject(new E(c.VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT)):null:Promise.reject(new E(c.VENMO_MOBILE_POLLING_TOKENIZATION_NO_CONTEXT_ID))},O.prototype._handleWindowClosure=function(){var e=this,t=e._determineAnalyticsCategory();return e._venmoWindow&&e._venmoWindow.closed&&"CREATED"===e._venmoPaymentContextStatus&&!0===e._cancelOnReturnToBrowser?(r.sendEventPlus(e._createPromise,"venmo.appswitch.browser-window.closed",{context_id:e._venmoPaymentContextId}),e._cancelMobilePaymentContext().then(function(){r.sendEventPlus(e._createPromise,"venmo.tokenize.manual-return.canceled",{context_id:e._venmoPaymentContextId,platform:t})}).catch(function(n){r.sendEventPlus(e._createPromise,"venmo.tokenize.manual-return.canceled.error",{context_id:e._venmoPaymentContextId,platform:t})}),Promise.reject(new E(c.VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED))):null},O.prototype._handleCancelOnReturn=function(){var e,t,n=this;return n._cancelOnReturnToBrowser?(e=Math.ceil(s.DEFAULT_PROCESS_RESULTS_DELAY/n._mobilePollingInterval),t=C(),n._pollCount++,void 0===(t.venmoSuccess||t.venmoError||t.venmoCancel)&&"CREATED"===n._venmoPaymentContextStatus&&n._pollCount>=e?(r.sendEventPlus(n._createPromise,"venmo.appswitch.cancel-on-return-to-browser",{context_id:n._venmoPaymentContextId}),n._cancelMobilePaymentContext().then(function(){r.sendEventPlus(n._createPromise,"venmo.appswitch.cancel-on-return-to-browser.success",{context_id:n._venmoPaymentContextId})}).catch(function(){r.sendEventPlus(n._createPromise,"venmo.appswitch.cancel-on-return-to-browser.error",{context_id:n._venmoPaymentContextId})}).finally(function(){n._pollCount=0})):null):null},O.prototype._handleStatusChange=function(e){var t=this,n=e.status;if(n!==t._venmoPaymentContextStatus)switch(t._venmoPaymentContextStatus=n,r.sendEventPlus(t._createPromise,"venmo.tokenize.manual-return.status-change."+n.toLowerCase(),{context_id:t._venmoPaymentContextId,platform:t._determineAnalyticsCategory()}
2),n){case"EXPIRED":case"FAILED":case"CANCELED":return Promise.reject(new E(c["VENMO_MOBILE_POLLING_TOKENIZATION_"+n]));case"APPROVED":return Promise.resolve(e)}return t._continuePolling()},O.prototype._continuePolling=function(){var e=this;return new Promise(function(t,n){setTimeout(function(){e._pollForStatusChange().then(t).catch(n)},e._mobilePollingInterval)})},O.prototype._queryAndProcessStatus=function(){var e=this;return this._queryPaymentContextStatus(this._venmoPaymentContextId).catch(function(e){return Promise.reject(new E({type:c.VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR.type,code:c.VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR.code,message:c.VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR.message,details:{originalError:e}}))}).then(function(t){return e._handleStatusChange(t)})},O.prototype._pollForStatusChange=function(){var e=this._validatePollingContext();return e||(this._handleWindowClosure()||(this._handleCancelOnReturn(),this._queryAndProcessStatus()))},O.prototype._startPolling=function(){var e=this,t=e._determineAnalyticsCategory();return this._pollingInProgress||(this._pollingInProgress=!0,this._pollForStatusChange().then(function(n){e._pollingInProgress=!1,r.sendEventPlus(e._createPromise,"venmo.tokenize.manual-return.success",{context_id:e._venmoPaymentContextId,platform:t}),e._tokenizePromise.resolve({paymentMethodNonce:n.paymentMethodId,username:n.userName,payerInfo:n.payerInfo,id:e._venmoPaymentContextId})}).catch(function(n){e._pollingInProgress=!1,r.sendEventPlus(e._createPromise,"venmo.tokenize.manual-return.failure",{context_id:e._venmoPaymentContextId,platform:t}),e._tokenizePromise.reject(n)})),this._tokenizePromise},O.prototype._tokenizeForMobileWithManualReturn=function(){var e=this;return this._mobilePollingContextExpiresIn=Date.now()+this._mobilePollingExpiresThreshold,this.hasTokenizationResult()?this.processHashChangeFlowResults():(r.sendEventPlus(this._createPromise,"venmo.tokenize.manual-return.start",{context_id:e._venmoPaymentContextId,platform:e._determineAnalyticsCategory()}),this._tokenizePromise=new h,this._startPolling(),this.getUrl().then(function(t){return e.hasTokenizationResult()?e.processHashChangeFlowResults():(e.appSwitch(t),e._tokenizePromise)}))},O.prototype._shouldUseRedirectStrategy=function(){return!!a.isIos()&&(!0===this._mobileWebFallBack||this._useRedirectForIOS)},O.prototype._tokenizeForMobileWithHashChangeListeners=function(e){var t,n,i=this;if(this.hasTokenizationResult())return this.processHashChangeFlowResults();var o=this._determineAnalyticsCategory();function a(e){var t;i.processHashChangeFlowResults(e).catch(function(e){r.sendEventPlus(i._createPromise,"venmo.tokenize.mobile.failure",{context_id:i._venmoPaymentContextId,platform:o}),t=e}).then(function(e){r.sendEventPlus(i._createPromise,"venmo.tokenize.mobile.success",{context_id:i._venmoPaymentContextId,platform:o}),i._ignoreHistoryChanges||window.location.hash===i._previousHash||(window.location.hash=i._previousHash),i._removeVisibilityEventListener(),t?i._tokenizePromise.reject(t):i._tokenizePromise.resolve(e),delete i._tokenizePromise})}return r.sendEventPlus(this._createPromise,"venmo.tokenize.mobile.start",{context_id:this._venmoPaymentContextId,platform:o}),this._tokenizePromise=new h,this._previousHash=window.location.hash,this._onHashChangeListener=function(e){var r=e.newURL.split("#")[1];i._hasTokenizationResult(r)&&(t=!0,clearTimeout(n),a(r))},window.addEventListener("hashchange",this._onHashChangeListener,!1),this._visibilityChangeListener=function(){var r=e.processResultsDelay||s.DEFAULT_PROCESS_RESULTS_DELAY;window.document.hidden||(i._venmoWindow&&!i._venmoWindow.closed&&i._venmoWindow.close(),t||(n=setTimeout(a,r)))},this.getUrl().then(function(e){return i.hasTokenizationResult()?(a(),i._tokenizePromise):(i.appSwitch(e),setTimeout(function(){window.document.addEventListener(v(),i._visibilityChangeListener)},s.DOCUMENT_VISIBILITY_CHANGE_EVENT_DELAY),i._tokenizePromise)})},O.prototype._tokenizeForDesktopQRFlow=function(){var e=this;return r.sendEvent(this._createPromise,"venmo.tokenize.desktop.start"),this._tokenizePromise=new h,this._createPromise.then(function(){return e._venmoDesktopInstance.launchDesktopFlow()}).then(function(t){e._venmoDesktopInstance.hideDesktopFlow(),r.sendEventPlus(e._createPromise,"venmo.tokenize.desktop.success",{context_id:t&&t.id}),e._tokenizePromise.resolve(t)}).catch(function(t){r.sendEventPlus(e._createPromise,"venmo.tokenize.desktop.failure",{context_id:e._venmoDesktopInstance&&e._venmoDesktopInstance.venmoContextId}),e._venmoDesktopInstance&&e._venmoDesktopInstance.hideDesktopFlow(),t&&"CUSTOMER_CANCELED"===t.reason?e._tokenizePromise.reject(new E(c.VENMO_DESKTOP_CANCELED)):e._tokenizePromise.reject(new E({type:c.VENMO_DESKTOP_UNKNOWN_ERROR.type,code:c.VENMO_DESKTOP_UNKNOWN_ERROR.code,message:c.VENMO_DESKTOP_UNKNOWN_ERROR.message,details:{originalError:t}}))}),this._tokenizePromise},O.prototype._cancelMobilePaymentContext=function(){var e=this;return this._createPromise.then(function(t){var n;return e._venmoPaymentContextId?(n=e._shouldUseLegacyFlow?P.LEGACY_UPDATE_PAYMENT_CONTEXT_QUERY:P.UPDATE_PAYMENT_CONTEXT_QUERY,t.request({api:"graphQLApi",data:{query:n,variables:{input:{id:e._venmoPaymentContextId,status:"CANCELED"}}}})):Promise.resolve()})},O.prototype._cancelVenmoDesktopContext=function(){var e=this;return this._createPromise.then(function(){return e._venmoDesktopInstance&&e._venmoDesktopInstance.updateVenmoDesktopPaymentContext("CANCELED"),Promise.resolve()})},O.prototype.teardown=function(){var e=this;return this._removeVisibilityEventListener(),this._createPromise.then(function(){e._venmoDesktopInstance&&e._venmoDesktopInstance.teardown(),clearTimeout(e._refreshPaymentContextTimeout),e._cancelMobilePaymentContext(),p(this,u(O.prototype))}.bind(this))},O.prototype._removeVisibilityEventListener=function(){window.removeEventListener("hashchange",this._onHashChangeListener),window.document.removeEventListener(v(),this._visibilityChangeListener),delete this._visibilityChangeListener,delete this._onHashChangeListener},O.prototype.processHashChangeFlowResults=function(e){var t=this,n=C(e);return new Promise(function(e,i){t._shouldUseLegacyFlow?n.venmoSuccess?(r.sendEvent(t._createPromise,"venmo.appswitch.handle.success"),window.popupBridge&&r.sendEvent(t._createPromise,"popup-bridge:venmo:succeeded"),e(n)):n.venmoError?(r.sendEvent(t._createPromise,"venmo.appswitch.handle.error"),window.popupBridge&&r.sendEvent(t._createPromise,"popup-bridge:venmo:failed"),i(new E({type:c.VENMO_APP_FAILED.type,code:c.VENMO_APP_FAILED.code,message:c.VENMO_APP_FAILED.message,details:{originalError:{message:decodeURIComponent(n.errorMessage),code:n.errorCode}}}))):n.venmoCancel?(r.sendEvent(t._createPromise,"venmo.appswitch.handle.cancel"),window.popupBridge&&r.sendEvent(t._createPromise,"popup-bridge:venmo:canceled"),i(new E(c.VENMO_APP_CANCELED))):(r.sendEvent(t._createPromise,"venmo.appswitch.cancel-or-un
2available"),i(new E(c.VENMO_CANCELED))):(t._pollingInProgress||(t._pollingInProgress=!0),t._pollForStatusChange().then(function(n){return t._pollingInProgress=!1,r.sendEventPlus(t._createPromise,"venmo.appswitch.handle.payment-context-status-query.success",{context_id:t._venmoPaymentContextId}),window.popupBridge&&r.sendEvent(t._createPromise,"popup-bridge:venmo:succeeded"),e({paymentMethodNonce:n.paymentMethodId,username:n.userName,payerInfo:n.payerInfo,id:t._venmoPaymentContextId})}).catch(function(o){t._pollingInProgress=!1,o.code===c.VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED.code?(window.popupBridge&&r.sendEvent(t._createPromise,"popup-bridge:venmo:canceled"),i(o)):window.popupBridge&&r.sendEvent(t._createPromise,"popup-bridge:venmo:failed"),r.sendEventPlus(t._createPromise,"venmo.process-results.payment-context-status-query-failed",{context_id:t._venmoPaymentContextId}),e(n)})),t._clearFragmentParameters()})},O.prototype._clearFragmentParameters=function(){this._ignoreHistoryChanges||"function"==typeof window.history.replaceState&&window.location.hash&&history.pushState({},"",window.location.href.slice(0,window.location.href.indexOf("#")))},t.exports=_.wrapPrototype(O)},{"../lib/analytics":144,"../lib/assign":146,"../lib/braintree-error":149,"../lib/convert-methods-to-error":151,"../lib/in-iframe":175,"../lib/is-verified-domain":179,"../lib/methods":181,"../lib/querystring":183,"../lib/snake-case-to-camel-case":185,"../lib/url-params":186,"./external/":248,"./external/queries":249,"./shared/browser-detection":252,"./shared/constants":253,"./shared/errors":254,"./shared/get-venmo-url":256,"./shared/supports-venmo":257,"./shared/web-login-backdrop":258,"@braintree/extended-promise":34,"@braintree/wrap-promise":43}],260:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={VISA_CHECKOUT_NOT_ENABLED:{type:r.types.MERCHANT,code:"VISA_CHECKOUT_NOT_ENABLED",message:"Visa Checkout is not enabled for this merchant."},VISA_CHECKOUT_INIT_OPTIONS_REQUIRED:{type:r.types.MERCHANT,code:"VISA_CHECKOUT_INIT_OPTIONS_REQUIRED",message:"initOptions requires an object."},VISA_CHECKOUT_PAYMENT_REQUIRED:{type:r.types.MERCHANT,code:"VISA_CHECKOUT_PAYMENT_REQUIRED",message:"tokenize requires callid, encKey, and encPaymentData."},VISA_CHECKOUT_TOKENIZATION:{type:r.types.NETWORK,code:"VISA_CHECKOUT_TOKENIZATION",message:"A network error occurred when processing the Visa Checkout payment."}}},{"../lib/braintree-error":149}],261:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("../lib/braintree-error"),o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("./visa-checkout"),c=e("../lib/analytics"),d=e("./errors"),l=e("@braintree/wrap-promise");t.exports={create:l(function(e){var t="Visa Checkout";return r.verify({name:t,client:e.client,authorization:e.authorization}).then(function(){return o.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:a.create(e.authorization),name:t})}).then(function(t){return e.client=t,e.client.getConfiguration().gatewayConfiguration.visaCheckout?(c.sendEvent(e.client,"visacheckout.initialized"),new s(e)):Promise.reject(new i(d.VISA_CHECKOUT_NOT_ENABLED))})}),VERSION:"3.143.0"}},{"../lib/analytics":144,"../lib/basic-component-verification":147,"../lib/braintree-error":149,"../lib/create-assets-url":153,"../lib/create-deferred-client":155,"./errors":260,"./visa-checkout":262,"@braintree/wrap-promise":43}],262:[function(e,t,n){"use strict";var r=e("../lib/braintree-error"),i=e("../lib/analytics"),o=e("./errors"),a=e("../lib/json-clone"),s=e("../lib/methods"),c=e("../lib/convert-methods-to-error"),d=e("@braintree/wrap-promise"),l={Visa:"VISA",MasterCard:"MASTERCARD",Discover:"DISCOVER","American Express":"AMEX"};function u(e){this._client=e.client}u.prototype.createInitOptions=function(e){var t,n=this._client.getConfiguration().gatewayConfiguration,i=n.visaCheckout;if(!e)throw new r(o.VISA_CHECKOUT_INIT_OPTIONS_REQUIRED);return(t=a(e)).apikey=t.apikey||i.apikey,t.encryptionKey=i.encryptionKey,t.externalClientId=t.externalClientId||i.externalClientId,t.settings=t.settings||{},t.settings.dataLevel="FULL",t.settings.payment=t.settings.payment||{},t.settings.payment.cardBrands||(t.settings.payment.cardBrands=n.visaCheckout.supportedCardTypes.reduce(function(e,t){return l.hasOwnProperty(t)?e.concat(l[t]):e},[])),t},u.prototype.tokenize=function(e){var t=this;return e.callid&&e.encKey&&e.encPaymentData?this._client.request({method:"post",endpoint:"payment_methods/visa_checkout_cards",data:{_meta:{source:"visa-checkout"},visaCheckoutCard:{callId:e.callid,encryptedPaymentData:e.encPaymentData,encryptedKey:e.encKey}}}).then(function(e){return i.sendEvent(t._client,"visacheckout.tokenize.succeeded"),e.visaC
2heckoutCards[0]}).catch(function(e){return i.sendEvent(t._client,"visacheckout.tokenize.failed"),Promise.reject(new r({type:o.VISA_CHECKOUT_TOKENIZATION.type,code:o.VISA_CHECKOUT_TOKENIZATION.code,message:o.VISA_CHECKOUT_TOKENIZATION.message,details:{originalError:e}}))}):Promise.reject(new r(o.VISA_CHECKOUT_PAYMENT_REQUIRED))},u.prototype.teardown=function(){return c(this,s(u.prototype)),Promise.resolve()},t.exports=d.wrapPrototype(u)},{"../lib/analytics":144,"../lib/braintree-error":149,"../lib/convert-methods-to-error":151,"../lib/json-clone":180,"../lib/methods":181,"./errors":260,"@braintree/wrap-promise":43}]},{},[138])(138)},6899:function(e){e.exports=function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[a]={exports:{}};t[a][0].call(d.exports,function(e){return i(t[a][1][e]||e)},d,d.exports,e,t,n,r)}return n[a].exports}for(var o=void 0,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";var r={};function i(e){var t,n=JSON.stringify(e);if(!e.forceScriptReload&&(t=r[n]))return t;var i=document.createElement("script"),o=e.dataAttributes||{},a=e.container||document.head;return i.src=e.src,i.id=e.id||"",i.async=!0,e.type&&i.setAttribute("type","".concat(e.type)),e.crossorigin&&i.setAttribute("crossorigin","".concat(e.crossorigin)),e.integrity&&i.setAttribute("integrity","".concat(e.integrity)),Object.keys(o).forEach(function(e){i.setAttribute("data-".concat(e),"".concat(o[e]))}),t=new Promise(function(t,n){i.addEventListener("load",function(){t(i)}),i.addEventListener("error",function(){n(new Error("".concat(e.src," failed to load.")))}),i.addEventListener("abort",function(){n(new Error("".concat(e.src," has aborted.")))}),a.appendChild(i)}),r[n]=t,t}i.clearCache=function(){r={}},t.exports=i},{}],2:[function(e,t,n){t.exports=e("./dist/load-script")},{"./dist/load-script":1}],3:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/Android/i.test(e)}},{}],4:[function(e,t,n){"use strict";var r=e("./is-edge"),i=e("./is-samsung"),o=e("./is-duckduckgo"),a=e("./is-opera"),s=e("./is-silk");t.exports=function(e){return!(-1===(e=e||window.navigator.userAgent).indexOf("Chrome")&&-1===e.indexOf("CriOS")||r(e)||i(e)||o(e)||a(e)||s(e))}},{"./is-duckduckgo":5,"./is-edge":6,"./is-opera":13,"./is-samsung":14,"./is-silk":15}],5:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("DuckDuckGo/")}},{}],6:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("Edge/")||-1!==e.indexOf("Edg/")}},{}],7:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/FxiOS/i.test(e)}},{}],8:[function(e,t,n){"use strict";var r=e("./is-ios");t.exports=function(e){return e=e||window.navigator.userAgent,r(e)&&function(e){return/\bGSA\b/.test(e)}(e)}},{"./is-ios":11}],9:[function(e,t,n){"use strict";var r=e("./is-ios"),i=e("./is-ios-google-search-app");t.exports=function(e){return e=e||window.navigator.userAgent,!!r(e)&&(!!i(e)||/.+AppleWebKit(?!.*Safari)/i.test(e))}},{"./is-ios":11,"./is-ios-google-search-app":8}],10:[function(e,t,n){"use strict";var r=e("./is-ios-webview");t.exports=function(e,t){return t=void 0!==t?t:window.statusbar.visible,r(e)&&t}},{"./is-ios-webview":9}],11:[function(e,t,n){"use strict";var r=e("./is-ipados");t.exports=function(e,t,n){void 0===t&&(t=!0),e=e||window.navigator.userAgent;var i=/iPhone|iPod|iPad/i.test(e);return t?i||r(e,n):i}},{"./is-ipados":12}],12:[function(e,t,n){"use strict";t.exports=function(e,t){return e=e||window.navigator.userAgent,t=t||window.document,/Mac|iPad/i.test(e)&&"ontouchend"in t}},{}],13:[function(e,t,n){"use strict";t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("OPR/")||-1!==e.indexOf("Opera/")||-1!==e.indexOf("OPT/")}},{}],14:[function(e,t,n){"use strict";t.exports=function(e){return e=e||window.navigator.userAgent,/SamsungBrowser/i.test(e)}},{}],15:[function(e,t,n){"use strict";
2t.exports=function(e){return-1!==(e=e||window.navigator.userAgent).indexOf("Silk/")}},{}],16:[function(e,t,n){"use strict";var r=e("./is-android"),i=e("./is-ios-firefox"),o=e("./is-ios-webview"),a=e("./is-chrome"),s=e("./is-samsung"),c=e("./is-duckduckgo");function d(e){return(e=e||window.navigator.userAgent).indexOf("Opera Mini")>-1}t.exports=function(e){return e=e||window.navigator.userAgent,!(o(e)||i(e)||function(e){return e=e||window.navigator.userAgent,!!r(e)&&/Version\/[\d.]+/i.test(e)&&!d(e)&&!c(e)}(e)||d(e)||function(e){var t=(e=e||window.navigator.userAgent).match(/CriOS\/(\d+)\./);return!!t&&parseInt(t[1],10)<48}(e)||function(e){return!a(e)&&!s(e)&&/samsung/i.test(e)}(e))}},{"./is-android":3,"./is-chrome":4,"./is-duckduckgo":5,"./is-ios-firefox":7,"./is-ios-webview":9,"./is-samsung":14}],17:[function(e,t,n){t.exports=e("./dist/is-ios-wkwebview")},{"./dist/is-ios-wkwebview":10}],18:[function(e,t,n){t.exports=e("./dist/is-ios")},{"./dist/is-ios":11}],19:[function(e,t,n){t.exports=e("./dist/supports-popups")},{"./dist/supports-popups":16}],20:[function(e,t,n){"use strict";var r="undefined"!=typeof Promise?Promise:null,i=function(){function e(t){var n=this;"function"!=typeof t?(this._promise=new e.Promise(function(e,t){n._resolveFunction=e,n._rejectFunction=t}),t=t||{},this._onResolve=t.onResolve||e.defaultOnResolve,this._onReject=t.onReject||e.defaultOnReject,e.shouldCatchExceptions(t)&&this._promise.catch(function(){}),this._resetState()):this._promise=new e.Promise(t)}return e.defaultOnResolve=function(t){return e.Promise.resolve(t)},e.defaultOnReject=function(t){return e.Promise.reject(t)},e.setPromise=function(t){e.Promise=t},e.shouldCatchExceptions=function(t){return t.hasOwnProperty("suppressUnhandledPromiseMessage")?Boolean(t.suppressUnhandledPromiseMessage):Boolean(e.suppressUnhandledPromiseMessage)},e.all=function(t){return e.Promise.all(t)},e.allSettled=function(t){return e.Promise.allSettled(t)},e.race=function(t){return e.Promise.race(t)},e.reject=function(t){return e.Promise.reject(t)},e.resolve=function(t){return e.Promise.resolve(t)},e.prototype.then=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).then.apply(e,t)},e.prototype.catch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this._promise).catch.apply(e,t)},e.prototype.resolve=function(t){var n=this;return this.isFulfilled||(this._setResolved(),e.Promise.resolve().then(function(){return n._onResolve(t)}).then(function(e){n._resolveFunction(e)}).catch(function(e){n._resetState(),n.reject(e)})),this},e.prototype.reject=function(t){var n=this;return this.isFulfilled||(this._setRejected(),e.Promise.resolve().then(function(){return n._onReject(t)}).then(function(e){n._setResolved(),n._resolveFunction(e)}).catch(function(e){return n._rejectFunction(e)})),this},e.prototype._resetState=function(){this.isFulfilled=!1,this.isResolved=!1,this.isRejected=!1},e.prototype._setResolved=function(){this.isFulfilled=!0,this.isResolved=!0,this.isRejected=!1},e.prototype._setRejected=function(){this.isFulfilled=!0,this.isResolved=!1,this.isRejected=!0},e.Promise=r,e}();t.exports=i},{}],21:[function(e,t,n){"use strict";var r=e("./lib/set-attributes"),i=e("./lib/default-attributes"),o=e("./lib/assign");t.exports=function(e){void 0===e&&(e={});var t=document.createElement("iframe"),n=(0,o.assign)({},i.defaultAttributes,e);return n.style&&"string"!=typeof n.style&&((0,o.assign)(t.style,n.style),delete n.style),(0,r.setAttributes)(t,n),t.getAttribute("id")||(t.id=t.name),t}},{"./lib/assign":22,"./lib/default-attributes":23,"./lib/set-attributes":24}],22:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.assign=void 0,n.assign=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach(function(t){"object"==typeof t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}},{}],23:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.defaultAttributes=void 0,n.defaultAttributes={src:"about:blank",frameBorder:0,allowtransparency:!0,scrolling:"no"}},{}],24:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.setAttributes=void 0,n.setAttributes=function(e,t){for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];null==r?e.removeAttribute(n):e.setAttribute(n,r)}}},{}],25:[function(e,t,n){"use strict";
2t.exports=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)try{return crypto.randomUUID()}catch(e){}if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;for(var t=new Array(256),n=0;n<256;n++)t[n]=(n<16?"0":"")+n.toString(16);return t[e[0]]+t[e[1]]+t[e[2]]+t[e[3]]+"-"+t[e[4]]+t[e[5]]+"-"+t[e[6]]+t[e[7]]+"-"+t[e[8]]+t[e[9]]+"-"+t[e[10]]+t[e[11]]+t[e[12]]+t[e[13]]+t[e[14]]+t[e[15]]}throw new Error("@braintree/uuid: No secure random source available")}},{}],26:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.deferred=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];setTimeout(function(){try{e.apply(void 0,t)}catch(e){console.log("Error in callback function"),console.log(e)}},1)}}},{}],27:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.once=function(e){var t=!1;return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];t||(t=!0,e.apply(void 0,n))}}},{}],28:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.promiseOrCallback=function(e,t){if(!t)return e;e.then(function(e){return t(null,e)}).catch(function(e){return t(e)})}},{}],29:[function(e,t,n){"use strict";var r=e("./lib/deferred"),i=e("./lib/once"),o=e("./lib/promise-or-callback");function a(e){return function(){for(var t,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return"function"==typeof n[n.length-1]&&(t=n.pop(),t=i.once(r.deferred(t))),o.promiseOrCallback(e.apply(this,n),t)}}a.wrapPrototype=function(e,t){void 0===t&&(t={});var n=t.ignoreMethods||[],r=!0===t.transformPrivateMethods;return Object.getOwnPropertyNames(e.prototype).filter(function(t){var i,o="constructor"!==t&&"function"==typeof e.prototype[t],a=-1===n.indexOf(t);return i=!!r||"_"!==t.charAt(0),o&&i&&a}).forEach(function(t){var n=e.prototype[t];e.prototype[t]=a(n)}),e},t.exports=a},{"./lib/deferred":26,"./lib/once":27,"./lib/promise-or-callback":28}],30:[function(e,t,n){var r,i;r=this,i=function(e){"use strict";function t(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})}function n(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var r={},i={};function o(e){var t,n=JSON.stringify(e);if(!e.forceScriptReload&&(t=i[n]))return t;var r=document.createElement("script"),o=e.dataAttributes||{},a=e.container||document.head;return r.src=e.src,r.id=e.id||"",r.async=!0,e.type&&r.setAttribute("type","".concat(e.type)),e.crossorigin&&r.setAttribute("crossorigin","".concat(e.crossorigin)),Object.keys(o).forEach(function(e){r.setAttribute("data-".concat(e),"".concat(o[e]))}),t=new Promise(function(t,n){r.addEventListener("load",function(){t(r)}),r.addEventListener("error",function(){n(new Error("".concat(e.src," failed to load.")))}),r.addEventListener("abort",function(){n(new Error("".concat(e.src," has aborted.")))}),a.appendChild(r)}),i[n]=t,t}o.clearCache=function(){i={}};var a=o;
2Object.defineProperty(r,"__esModule",{value:!0}),r.loadStylesheet=c=r.loadScript=void 0;var s=a,c=r.loadScript=s,d=function(e){var t=document.querySelector('link[href="'.concat(e.href,'"]'));if(t)return Promise.resolve(t);t=document.createElement("link");var n=e.container||document.head;return t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e.href),t.setAttribute("id",e.id),n.firstChild?n.insertBefore(t,n.firstChild):n.appendChild(t),Promise.resolve(t)};r.loadStylesheet=d;var l,u,p="fastlane",_="connect-boba",E={AXO_ASSET_NAME:{minified:"axo.min",unminified:"axo"},AXO_ASSET_PATH:_,LOCALE_PATH:"".concat(_,"/locales/"),CDNX_PROD:"https://www.paypalobjects.com"},m="BT",h="PPCP";function f(){return"function"==typeof window.define&&!!window.define.amd}function A(e,r,i){var o,a;return void 0===i&&(i=!0),t(this,void 0,void 0,function(){var t,s;return n(this,function(n){if((t=null===window||void 0===window?void 0:window.braintree)&&t[e.module]){if(r&&(null===(o=t[e.module])||void 0===o?void 0:o.VERSION)!==r)throw s=null===(a=t[e.module])||void 0===a?void 0:a.VERSION,new Error("".concat(e.module," already loaded with version ").concat(s," cannot load version ").concat(r));return[2,!0]}if(!r)throw new Error("Attempted to load ".concat(e.module," without specifying version"));return[2,y(e,r,i)]})})}function y(e,t,n){if(void 0===n&&(n=!0),f()){var r=n?e.amdModule.minified:e.amdModule.unminified;return new Promise(function(e,t){window.require([r],e,t)})}var i=n?e.script.minified:e.script.unminified;return c({id:"".concat(e.id,"-").concat(t),src:"https://js.braintreegateway.com/web/".concat(t,"/js/").concat(i)})}var I="client",T="hostedFields",P="braintree",N=((l={})[I]="client",l[T]="hosted-fields",l),O=((u={})[I]={id:"client",module:I,amdModule:{unminified:"".concat(P,"/").concat(N[I]),minified:"".concat(P,"/").concat(N[I],".min")},script:{unminified:"".concat(N[I],".js"),minified:"".concat(N[I],".min.js")}},u[T]={id:"hcf",module:T,amdModule:{unminified:"".concat(P,"/").concat(N[T]),minified:"".concat(P,"/").concat(N[T],".min")},script:{unminified:"".concat(N[T],".js"),minified:"".concat(N[T],".min.js")}},u);function g(e,t){var n;if(void 0===t&&(t=!0),f()){f()&&"function"==typeof window.requirejs&&"function"==typeof window.requirejs.config&&requirejs.config({paths:(n={},n[p]=e,n)});var r="".concat(p,"/").concat(t?E.AXO_ASSET_NAME.minified:E.AXO_ASSET_NAME.unminified);return new Promise(function(e,t){window.require([r],e,t)})}return c({id:"axo-id",src:e,forceScriptReload:!0})}function C(e){var t=e.assetUrl,n=e.bundleId;return n?"https://cdn-".concat(n,".static.engineering.dev.paypalinc.com/").concat(t):"".concat(E.CDNX_PROD,"/").concat(t)}e.constants=E,e.loadAxo=function(e){return t(this,void 0,void 0,function(){var t,r,i,o;return n(this,function(n){switch(n.label){case 0:return performance.mark("pp_axo_sdk_init_invoked"),t=e.btSdkVersion,r=e.minified,i=function(e){var t,n=!1!==(null==e?void 0:e.minified)?E.AXO_ASSET_NAME.minified:E.AXO_ASSET_NAME.unminified;return C({assetUrl:f()?E.AXO_ASSET_PATH:"".concat(E.AXO_ASSET_PATH,"/").concat(n,".js"),bundleId:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.bundleIdOverride})}(e),o=function(e){var t;return C({assetUrl:E.LOCALE_PATH,bundleId:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.bundleIdOverride})}(e),e.platform!==m?[3,2]:[4,Promise.all([A(O.hostedFields,t,r),g(i,r)])];case 1:case 3:return n.sent(),[3,5];case 2:return e.platform!==h?[3,4]:[4,Promise.all([A(O.client,t,r),A(O.hostedFields,t,r),g(i,r)])];case 4:throw new Error("unsupported axo platform");case 5:return[2,{metadata:{localeUrl:o}}]}})})}},i("object"==typeof n&&void 0!==t?n:(r="undefined"!=typeof globalThis?globalThis:r||self).loadAxo={})},{}],31:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Framebus=void 0;var r=e("./lib"),i="undefined"!=typeof window&&window.Promise,o=function(){function e(e){void 0===e&&(e={}),this.origin=e.origin||"*",this.channel=e.channel||"",this.verifyDomain=e.verifyDomain,this.targetFrames=e.targetFrames||[],this.limitBroadcastToFramesArray=Boolean(e.targetFrames),this.isDestroyed=!1,this.listeners=[],this.hasAdditionalChecksForOnListeners=Boolean(this.verifyDomain||this.limitBroadcastToFramesArray)}return e.setPromise=function(t){e.Promise=t},e.target=function(t){return new e(t)},e.prototype.addTargetFrame=function(e){this.limitBroadcastToFramesArray&&this.targetFrames.push(e)},e.prototype.include=function(e){return null!=e&&null!=e.Window&&e.constructor===e.Window&&(r.childWindows.push(e),!0)},e.prototype.target=function(t){return e.target(t)},e.prototype.emit=function(e,t,n){if(this.isDestroyed)return!1;var i=this.origin;if(e=this.namespaceEvent(e),(0,r.isntString)(e))return!1;if((0,r.isntString)(i))return!1;"function"==typeof t&&(n=t,t=void 0);var o=(0,r.packagePayload)(e,i,t,n);return!!o&&(this.limitBroadcastToFramesArray?this.targetFramesAsWindows().forEac
2h(function(e){(0,r.sendMessage)(e,o,i)}):(0,r.broadcast)(o,{origin:i,frame:window.top||window.self}),!0)},e.prototype.emitAsPromise=function(t,n){var r=this;return new e.Promise(function(e,i){r.emit(t,n,function(t){e(t)})||i(new Error('Listener not added for "'.concat(t,'"')))})},e.prototype.on=function(e,t){if(this.isDestroyed)return!1;var n=this,i=this.origin,o=t;return e=this.namespaceEvent(e),!(0,r.subscriptionArgsInvalid)(e,o,i)&&(this.hasAdditionalChecksForOnListeners&&(o=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.passesVerifyDomainCheck(this&&this.origin)&&n.hasMatchingTargetFrame(this&&this.source)&&t.apply(void 0,e)}),this.listeners.push({eventName:e,handler:o,originalHandler:t}),r.subscribers[i]=r.subscribers[i]||{},r.subscribers[i][e]=r.subscribers[i][e]||[],r.subscribers[i][e].push(o),!0)},e.prototype.off=function(e,t){var n=t;if(this.isDestroyed)return!1;if(this.hasAdditionalChecksForOnListeners)for(var i=0;i<this.listeners.length;i++){var o=this.listeners[i];o.originalHandler===t&&(n=o.handler)}e=this.namespaceEvent(e);var a=this.origin;if((0,r.subscriptionArgsInvalid)(e,n,a))return!1;var s=r.subscribers[a]&&r.subscribers[a][e];if(!s)return!1;for(i=0;i<s.length;i++)if(s[i]===n)return s.splice(i,1),!0;return!1},e.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var e=0;e<this.listeners.length;e++){var t=this.listeners[e];this.off(t.eventName,t.handler)}this.listeners.length=0}},e.prototype.passesVerifyDomainCheck=function(e){return!this.verifyDomain||this.checkOrigin(e)},e.prototype.targetFramesAsWindows=function(){return this.limitBroadcastToFramesArray?this.targetFrames.map(function(e){return e instanceof HTMLIFrameElement?e.contentWindow:e}).filter(function(e){return e}):[]},e.prototype.hasMatchingTargetFrame=function(e){if(!this.limitBroadcastToFramesArray)return!0;var t=this.targetFramesAsWindows().find(function(t){return t===e});return Boolean(t)},e.prototype.checkOrigin=function(e){var t,n=document.createElement("a");return n.href=location.href,t="https:"===n.protocol?n.host.replace(/:443$/,""):"http:"===n.protocol?n.host.replace(/:80$/,""):n.host,n.protocol+"//"+t===e||!this.verifyDomain||this.verifyDomain(e)},e.prototype.namespaceEvent=function(e){return this.channel?"".concat(this.channel,":").concat(e):e},e.Promise=i,e}();n.Framebus=o},{"./lib":39}],32:[function(e,t,n){"use strict";var r=e("./lib"),i=e("./framebus");(0,r.attach)(),t.exports=i.Framebus},{"./framebus":31,"./lib":39}],33:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.detach=n.attach=void 0;var r=e("./"),i=!1;n.attach=function(){i||"undefined"==typeof window||(i=!0,window.addEventListener("message",r.onMessage,!1))},n.detach=function(){i=!1,window.removeEventListener("message",r.onMessage,!1)}},{"./":39}],34:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.broadcastToChildWindows=void 0;var r=e("./");n.broadcastToChildWindows=function(e,t,n){for(var i=r.childWindows.length-1;i>=0;i--){var o=r.childWindows[i];o.closed?r.childWindows.splice(i,1):n!==o&&(0,r.broadcast)(e,{origin:t,frame:o.top})}}},{"./":39}],35:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.broadcast=void 0;var r=e("./");n.broadcast=function e(t,n){var i,o=0,a=n.origin,s=n.frame;try{for(s.postMessage(t,a),(0,r.hasOpener)(s)&&s.opener.top!==window.top&&e(t,{origin:a,frame:s.opener.top});i=s.frames[o];)e(t,{origin:a,frame:i}),o++}catch(e){}}},{"./":39}],36:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.subscribers=n.childWindows=n.prefix=void 0,n.prefix="/*framebus*/",n.childWindows=[],n.subscribers={}},{}],37:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.dispatch=void 0;var r=e("./");n.dispatch=function(e,t,n,i,o){if(r.subscribers[e]&&r.subscribers[e][t]){var a=[];n&&a.push(n),i&&a.push(i);for(var s=0;s<r.subscribers[e][t].length;s++)r.subscribers[e][t][s].apply(o,a)}}},{"./":39}],38:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.hasOpener=void 0,n.hasOpener=function(e){return e.top===e&&null!=e.opener&&e.opener!==e&&!0!==e.opener.closed}},{}],39:[function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);
2i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),i(e("./attach"),n),i(e("./broadcast-to-child-windows"),n),i(e("./broadcast"),n),i(e("./constants"),n),i(e("./dispatch"),n),i(e("./has-opener"),n),i(e("./is-not-string"),n),i(e("./message"),n),i(e("./package-payload"),n),i(e("./send-message"),n),i(e("./subscribe-replier"),n),i(e("./subscription-args-invalid"),n),i(e("./types"),n),i(e("./unpack-payload"),n)},{"./attach":33,"./broadcast":35,"./broadcast-to-child-windows":34,"./constants":36,"./dispatch":37,"./has-opener":38,"./is-not-string":40,"./message":41,"./package-payload":42,"./send-message":43,"./subscribe-replier":44,"./subscription-args-invalid":45,"./types":46,"./unpack-payload":47}],40:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isntString=void 0,n.isntString=function(e){return"string"!=typeof e}},{}],41:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.onMessage=void 0;var r=e("./");n.onMessage=function(e){if(!(0,r.isntString)(e.data)){var t=(0,r.unpackPayload)(e);if(t){var n=t.eventData,i=t.reply;(0,r.dispatch)("*",t.event,n,i,e),(0,r.dispatch)(e.origin,t.event,n,i,e),(0,r.broadcastToChildWindows)(e.data,t.origin,e.source)}}}},{"./":39}],42:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.packagePayload=void 0;var r=e("./");n.packagePayload=function(e,t,n,i){var o,a={event:e,origin:t};"function"==typeof i&&(a.reply=(0,r.subscribeReplier)(i,t)),a.eventData=n;try{o=r.prefix+JSON.stringify(a)}catch(e){throw new Error("Could not stringify event: ".concat(e.message))}return o}},{"./":39}],43:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.sendMessage=void 0,n.sendMessage=function(e,t,n){try{e.postMessage(t,n)}catch(e){}}},{}],44:[function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.subscribeReplier=void 0;var i=e("../framebus"),o=r(e("@braintree/uuid"));n.subscribeReplier=function(e,t){var n=(0,o.default)();return i.Framebus.target({origin:t}).on(n,function r(o,a){e(o,a),i.Framebus.target({origin:t}).off(n,r)}),n}},{"../framebus":31,"@braintree/uuid":48}],45:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.subscriptionArgsInvalid=void 0;var r=e("./");n.subscriptionArgsInvalid=function(e,t,n){return!!(0,r.isntString)(e)||"function"!=typeof t||(0,r.isntString)(n)}},{"./":39}],46:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0})},{}],47:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.unpackPayload=void 0;var r=e("./");n.unpackPayload=function(e){var t;if(e.data.slice(0,r.prefix.length)!==r.prefix)return!1;try{t=JSON.parse(e.data.slice(r.prefix.length))}catch(e){return!1}if(t.reply){var n=e.origin,i=e.source,o=t.reply;t.reply=function(e){if(i){var t=(0,r.packagePayload)(o,n,e);t&&i.postMessage(t,n)}}}return t}},{"./":39}],48:[function(e,t,n){"use strict";t.exports=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},{}],49:[function(e,t,n){"use strict";var r=e("./create-authorization-data"),i=e("./json-clone"),o=e("./constants");t.exports={addMetadata:function(e,t){var n,a=t?i(t):{},s=r(e.authorization).attrs,c=i(e.analyticsMetadata);for(n in a.braintreeLibraryVersion=o.BRAINTREE_LIBRARY_VERSION,a._meta)a._meta.hasOwnProperty(n)&&(c[n]=a._meta[n]);return a._meta=c,s.tokenizationKey?a.tokenizationKey=s.tokenizationKey:a.authorizationFingerprint=s.authorizationFingerprint,a},addEventMetadata:function(e){var t=e.getConfiguration(),n=r(t.authorization).attrs,i="production"===t.gatewayConfiguration.environment,a={api_integration_type:t.analyticsMetadata.integrationType,app_id:window.location.host,c_sdk_ver:o.VERSION,component:"braintreeclientsdk",merchant_sdk_env:i?"production":"sandbox",merchant_id:t.gatewayConfiguration.merchantId,event_source:"web",platform:o.PLATFORM,platform_version:window.navigator.userAgent,session_id:t.analyticsMetadata.sessionId,client_session_id:t.analyticsMetadata.sessionId,tenant_name:"braintree",product_name:"BT_DCC",space_key:"SKDUYK"};return n.tokenizationKey?a.tokenization_key=n.tokenizationKey:a.auth_fingerprint=n.authorizationFingerprint,a}}},{"./constants":55,"./create-authorization-data":59,"./json-clone":74}],50:[function(e,t,n){"use strict";var r=e("./constants"),i=e("./add-metadata"),o=e("./assign").assign;function a(e,t,n,a){var c=Date.now();return"vault"===n.flow?n.context_type="BA_Token":"checkout"===n.flow&&(n.context_type="EC_Token"),Promise.resolve(e).then(function(e){var d=e._request,l=r.ANALYTICS_URL,u=r.ANALYTICS_PREFIX+t,p="production"===e.getConfiguration().gatewayConfiguration.environment,_={events:[],tracking:[]},E=i.addEventMetadata(e,_);return E.event_name=u,E.t=c,_.events=[{level:"info",event:u,payload:o({env:p?"production":"sandbox",timestamp:c},n)}],_.tracking=[E],n&&"object"==typeof n&&(_.tracking=[s(E,n)]),d({url:l,method:"post",data:_,timeout:r.ANALYTICS_REQUEST_TIMEOUT_MS},a)}).catch(function(e){a&&a(e)})}function s(e,t){var n=o({},t);
2return Object.keys(n).forEach(function(e){-1===r.ALLOWED_EXTRA_EVENT_FIELDS.indexOf(e)&&delete n[e]}),o(e,n)}t.exports={sendEvent:function(e,t,n){return a(e,t,{},n)},sendEventPlus:a}},{"./add-metadata":49,"./assign":52,"./constants":55}],51:[function(e,t,n){"use strict";var r=e("@braintree/asset-loader/load-script"),i=e("@paypal/fastlane-sdk-loader");t.exports={loadScript:r,loadFastlane:i.loadAxo}},{"@braintree/asset-loader/load-script":2,"@paypal/fastlane-sdk-loader":30}],52:[function(e,t,n){"use strict";var r="function"==typeof Object.assign?Object.assign:i;function i(e){var t,n,r;for(t=1;t<arguments.length;t++)for(r in n=arguments[t])n.hasOwnProperty(r)&&(e[r]=n[r]);return e}t.exports={assign:r,_assign:i}},{}],53:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./errors"),o="3.143.0";t.exports={verify:function(e){var t,n,a;return e?(a=e.name,t=e.client,n=e.authorization,t||n?n||t.getVersion()===o?Promise.resolve():Promise.reject(new r({type:i.INCOMPATIBLE_VERSIONS.type,code:i.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+t.getVersion()+") and "+a+" (version "+o+") components must be from the same SDK version."})):Promise.reject(new r({type:i.INSTANTIATION_OPTION_REQUIRED.type,code:i.INSTANTIATION_OPTION_REQUIRED.code,message:"options.client is required when instantiating "+a+"."}))):Promise.reject(new r({type:i.INVALID_USE_OF_INTERNAL_FUNCTION.type,code:i.INVALID_USE_OF_INTERNAL_FUNCTION.code,message:"Options must be passed to basicComponentVerification function."}))}}},{"./braintree-error":54,"./errors":62}],54:[function(e,t,n){"use strict";var r=e("./enumerate");function i(e){if(!i.types.hasOwnProperty(e.type))throw new Error(e.type+" is not a valid type.");if(!e.code)throw new Error("Error code required.");if(!e.message)throw new Error("Error message required.");this.name="BraintreeError",this.code=e.code,this.message=e.message,this.type=e.type,this.details=e.details}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.types=r(["CUSTOMER","MERCHANT","NETWORK","INTERNAL","UNKNOWN"]),i.findRootError=function(e){return e instanceof i&&e.details&&e.details.originalError?i.findRootError(e.details.originalError):e},t.exports=i},{"./enumerate":61}],55:[function(e,t,n){"use strict";var r="3.143.0",i="web";t.exports={ANALYTICS_PREFIX:i+".",ANALYTICS_REQUEST_TIMEOUT_MS:2e3,ANALYTICS_URL:"https://www.paypal.com/xoplatform/logger/api/logger",ASSETS_URLS:{production:"https://assets.braintreegateway.com",sandbox:"https://assets.braintreegateway.com"},CLIENT_API_URLS:{production:"https://api.braintreegateway.com:443",sandbox:"https://api.sandbox.braintreegateway.com:443"},FRAUDNET_SOURCE:"BRAINTREE_SIGNIN",FRAUDNET_FNCLS:"fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99",FRAUDNET_URL:"https://c.paypal.com/da/r/fb.js",BUS_CONFIGURATION_REQUEST_EVENT:"BUS_CONFIGURATION_REQUEST",GRAPHQL_URLS:{production:"https://payments.braintree-api.com/graphql",sandbox:"https://payments.sandbox.braintree-api.com/graphql"},INTEGRATION_TIMEOUT_MS:6e4,VERSION:r,INTEGRATION:"custom",SOURCE:"client",PLATFORM:i,BRAINTREE_LIBRARY_VERSION:"braintree/web/"+r,ALLOWED_EXTRA_EVENT_FIELDS:["context_id","context_type","payment_ready_button_order","payment_ready_experiment_type","payment_ready_page_type","payment_ready_session_id","button_type","connect_start_time","domain","endpoint","end_time","request_start_time","start_time"]}},{}],56:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./errors");t.exports=function(e,t){t.forEach(function(t){e[t]=function(){throw new r({type:i.METHOD_CALLED_AFTER_TEARDOWN.type,code:i.METHOD_CALLED_AFTER_TEARDOWN.code,message:t+" cannot be called after teardown."})}})}},{"./braintree-error":54,"./errors":62}],57:[function(e,t,n){"use strict";var r=e("./braintree-error");t.exports=function(e,t){return e instanceof r?e:new r({type:t.type,code:t.code,message:t.message,details:{originalError:e}})}},{"./braintree-error":54}],58:[function(e,t,n){"use strict";var r=e("./constants").ASSETS_URLS;t.exports={create:function(e){return r.production}}},{"./constants":55}],59:[function(e,t,n){"use strict";var r=e("../lib/vendor/polyfill").atob,i=e("../lib/constants").CLIENT_API_URLS;t.exports=function(e){var t,n,o,a,s={attrs:{},configUrl:""};return/^[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9_]+$/.test(e)?(o=e.split("_"),a=o[0],n={merchantId:o.slice(2).join("_"),environment:a},s.environment=n.environment,s.attrs.tokenizationKey=e,s.configUrl=i[n.environment]+"/merchants/"+n.merchantId+"/client_api/v1/configuration"):(t=JSON.parse(r(e)),s.environment=t.environment,s.attrs.authorizationFingerprint=t.authorizationFingerprint,s.configUrl=t.configUrl,s.graphQL=t.graphQL),s}},{"../lib/constants":55,"../lib/vendor/polyfill":78}],60:[function(e,t,n){"use strict";var r=e("./braintree-error"),i=e("./assets"),o=e("./errors"),a="3.143.0";t.exports={create:function(e){var t=Promise.resolve();return e.client?Promise.resolve(e.client):(window.braintree&&window.braintree.client||(t=i.loadScript({src:e.assetsUrl+"/web/"+a+"/js/client.min.js"}).catch(function(e){return Promise.reject(new r({type:o.CLIENT_SCRIPT_FAILED_TO_LOAD.type,code:o.CLIENT_SCRIPT_FAILED_TO_LOAD.code,message:o.CLIENT_SCRIPT_FAILED_TO_LOAD.message,details:{originalError:e}}))}
2)),t.then(function(){return window.braintree.client.VERSION!==a?Promise.reject(new r({type:o.INCOMPATIBLE_VERSIONS.type,code:o.INCOMPATIBLE_VERSIONS.code,message:"Client (version "+window.braintree.client.VERSION+") and "+e.name+" (version "+a+") components must be from the same SDK version."})):window.braintree.client.create({authorization:e.authorization,debug:e.debug})}))}}},{"./assets":51,"./braintree-error":54,"./errors":62}],61:[function(e,t,n){"use strict";t.exports=function(e,t){return t=null==t?"":t,e.reduce(function(e,n){return e[n]=t+n,e},{})}},{}],62:[function(e,t,n){"use strict";var r=e("./braintree-error");t.exports={INVALID_USE_OF_INTERNAL_FUNCTION:{type:r.types.INTERNAL,code:"INVALID_USE_OF_INTERNAL_FUNCTION"},INSTANTIATION_OPTION_REQUIRED:{type:r.types.MERCHANT,code:"INSTANTIATION_OPTION_REQUIRED"},INCOMPATIBLE_VERSIONS:{type:r.types.MERCHANT,code:"INCOMPATIBLE_VERSIONS"},CLIENT_SCRIPT_FAILED_TO_LOAD:{type:r.types.NETWORK,code:"CLIENT_SCRIPT_FAILED_TO_LOAD",message:"Braintree client script could not be loaded."},METHOD_CALLED_AFTER_TEARDOWN:{type:r.types.MERCHANT,code:"METHOD_CALLED_AFTER_TEARDOWN"},INSTANTIATION_OPTION_INVALID:{type:r.types.MERCHANT,code:"INSTANTIATION_OPTION_INVALID"}}},{"./braintree-error":54}],63:[function(e,t,n){"use strict";var r=e("./strategies/popup"),i=e("./strategies/popup-bridge"),o=e("./strategies/modal"),a=e("framebus"),s=e("../shared/events"),c=e("../shared/errors"),d=e("../shared/constants"),l=e("@braintree/uuid"),u=e("@braintree/iframer"),p=e("../../braintree-error"),_=e("../shared/browser-detection"),E=e("./../../assign").assign,m=e("../../constants").BUS_CONFIGURATION_REQUEST_EVENT,h=["name","dispatchFrameUrl","openFrameUrl"];function f(){}function A(e){(function(e){if(!e)throw new Error("Valid configuration is required");if(h.forEach(function(t){if(!e.hasOwnProperty(t))throw new Error("A valid frame "+t+" must be provided")}),!/^[\w_]+$/.test(e.name))throw new Error("A valid frame name must be provided")})(e),this._serviceId=l().replace(/-/g,""),this._options={name:e.name+"_"+this._serviceId,dispatchFrameUrl:e.dispatchFrameUrl,openFrameUrl:e.openFrameUrl,height:e.height,width:e.width,top:e.top,left:e.left},this.state=e.state||{},this._bus=new a({channel:this._serviceId}),this._setBusEvents()}A.prototype.initialize=function(e){var t=function(){e(),this._bus.off(s.DISPATCH_FRAME_READY,t)}.bind(this);this._bus.on(s.DISPATCH_FRAME_READY,t),this._writeDispatchFrame()},A.prototype._writeDispatchFrame=function(){var e=d.DISPATCH_FRAME_NAME+"_"+this._serviceId,t=this._options.dispatchFrameUrl;this._dispatchFrame=u({"aria-hidden":!0,name:e,title:e,src:t,class:d.DISPATCH_FRAME_CLASS,height:0,width:0,style:{position:"absolute",left:"-9999px"}}),document.body.appendChild(this._dispatchFrame)},A.prototype._setBusEvents=function(){this._bus.on(s.DISPATCH_FRAME_REPORT,function(e,t){this._onCompleteCallback&&this._onCompleteCallback.call(null,e.err,e.payload),this._frame.close(),this._onCompleteCallback=null,t&&t()}.bind(this)),this._bus.on(m,function(e){e(this.state)}.bind(this))},A.prototype.open=function(e,t){if(e=e||{},this._frame=this._getFrameForEnvironment(e),this._frame.initialize(t),!(this._frame instanceof i)){if(E(this.state,e.state),this._onCompleteCallback=t,this._frame.open(),this.isFrameClosed())return this._cleanupFrame(),void(t&&t(ne
2w p(c.FRAME_SERVICE_FRAME_OPEN_FAILED)));this._pollForPopupClose()}},A.prototype.redirect=function(e){this._frame&&!this.isFrameClosed()&&this._frame.redirect(e)},A.prototype.close=function(){this.isFrameClosed()||this._frame.close()},A.prototype.focus=function(){this.isFrameClosed()||this._frame.focus()},A.prototype.createHandler=function(e){return e=e||{},{close:function(){e.beforeClose&&e.beforeClose(),this.close()}.bind(this),focus:function(){e.beforeFocus&&e.beforeFocus(),this.focus()}.bind(this)}},A.prototype.createNoopHandler=function(){return{close:f,focus:f}},A.prototype.teardown=function(){this.close(),this._dispatchFrame.parentNode.removeChild(this._dispatchFrame),this._dispatchFrame=null,this._cleanupFrame()},A.prototype.isFrameClosed=function(){return null==this._frame||this._frame.isClosed()},A.prototype._cleanupFrame=function(){this._frame=null,clearInterval(this._popupInterval),this._popupInterval=null},A.prototype._pollForPopupClose=function(){return this._popupInterval=setInterval(function(){this.isFrameClosed()&&(this._cleanupFrame(),this._onCompleteCallback&&this._onCompleteCallback(new p(c.FRAME_SERVICE_FRAME_CLOSED)))}.bind(this),d.POPUP_POLL_INTERVAL),this._popupInterval},A.prototype._getFrameForEnvironment=function(e){var t=_.supportsPopups(),n=Boolean(window.popupBridge),a=E({},this._options,e);return n?new i(a):t?new r(a):new o(a)},t.exports=A},{"../../braintree-error":54,"../../constants":55,"../shared/browser-detection":70,"../shared/constants":71,"../shared/errors":72,"../shared/events":73,"./../../assign":52,"./strategies/modal":65,"./strategies/popup":68,"./strategies/popup-bridge":66,"@braintree/iframer":21,"@braintree/uuid":25,framebus:32}],64:[function(e,t,n){"use strict";var r=e("./frame-service");t.exports={create:function(e,t){var n=new r(e);n.initialize(function(){t(n)})}}},{"./frame-service":63}],65:[function(e,t,n){"use strict";var r=e("@braintree/iframer"),i=e("../../../assign").assign,o=e("../../shared/browser-detection"),a={position:"fixed",top:0,left:0,bottom:0,padding:0,margin:0,border:0,outline:"none",zIndex:20001,background:"#FFFFFF"};function s(){}function c(e){this._closed=null,this._frame=null,this._options=e||{},this._container=this._options.container||document.body}c.prototype.initialize=s,c.prototype.open=function(){var e={src:this._options.openFrameUrl,name:this._options.name,scrolling:"yes",height:"100%",width:"100%",style:i({},a),title:"Lightbox Frame"};o.isIos()?(o.isIosWKWebview()&&(this._lockScrolling(),e.style={}),this._el=document.createElement("div"),i(this._el.style,a,{height:"100%",width:"100%",overflow:"auto","-webkit-overflow-scrolling":"touch"}),this._frame=r(e),this._el.appendChild(this._frame)):this._el=this._frame=r(e),this._closed=!1,this._container.appendChild(this._el)},c.prototype.focus=s,c.prototype.close=function(){this._container.removeChild(this._el),this._frame=null,this._closed=!0,o.isIosWKWebview()&&this._unlockScrolling()},c.prototype.isClosed=function(){return Boolean(this._closed)},c.prototype.redirect=function(e){this._frame.src=e},c.prototype._unlockScrolling=function(){document.body.style.overflow=this._savedBodyProperties.overflowStyle,document.body.style.position=this._savedBodyProperties.positionStyle,window.scrollTo(this._savedBodyProperties.left,this._savedBodyProperties.top),delete this._savedBodyProperties},c.prototype._lockScrolling=function(){var e=document.documentElement;this._savedBodyProperties={left:(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0),top:(window.pageYOffset||e.scrollTop)-(e.clientTop||0),overflowStyle:document.body.style.overflow,positionStyle:document.body.style.position},document.body.style.overflow="hidden",document.body.style.position="fixed",window.scrollTo(0,0)},t.exports=c},{"../../../assign":52,"../../shared/browser-detection":70,"@braintree/iframer":21}],66:[function(e,t,n){"use strict";var r=e("../../../braintree-error"),i=e("../../shared/errors");function o(){}function a(e){this._closed=null,this._options=e}a.prototype.initialize=function(e){var t=this;window.popupBridge.onComplete=function(n,o){var a=!o&&!n;t._closed=!0,n||a?e(new r(i.FRAME_SERVICE_FRAME_CLOSED)):e(null,o)}},a.prototype.open=function(e){var t;t=(e=e||{}).openFrameUrl||this._options.openFrameUrl,this._closed=!1,window.popupBridge.open(t)}
2,a.prototype.focus=o,a.prototype.close=o,a.prototype.isClosed=function(){return Boolean(this._closed)},a.prototype.redirect=function(e){this.open({openFrameUrl:e})},t.exports=a},{"../../../braintree-error":54,"../../shared/errors":72}],67:[function(e,t,n){"use strict";var r=e("../../../shared/constants"),i=e("./position");function o(e,t,n){return void 0!==t?t:i[e](n)}t.exports=function(e){var t=e.height||r.DEFAULT_POPUP_HEIGHT,n=e.width||r.DEFAULT_POPUP_WIDTH,i=o("top",e.top,t),a=o("left",e.left,n);return[r.POPUP_BASE_OPTIONS,"height="+t,"width="+n,"top="+i,"left="+a].join(",")}},{"../../../shared/constants":71,"./position":69}],68:[function(e,t,n){"use strict";var r=e("./compose-options");function i(e){this._frame=null,this._options=e||{}}i.prototype.initialize=function(){},i.prototype.open=function(){this._frame=window.open(this._options.openFrameUrl,this._options.name,r(this._options))},i.prototype.focus=function(){this._frame.focus()},i.prototype.close=function(){this._frame.closed||this._frame.close()},i.prototype.isClosed=function(){return!this._frame||Boolean(this._frame.closed)},i.prototype.redirect=function(e){this._frame.location.href=e},t.exports=i},{"./compose-options":67}],69:[function(e,t,n){"use strict";function r(e,t,n){return(e-t)/2+n}t.exports={top:function(e){return r(window.outerHeight||document.documentElement.clientHeight,e,null==window.screenY?window.screenTop:window.screenY)},left:function(e){return r(window.outerWidth||document.documentElement.clientWidth,e,null==window.screenX?window.screenLeft:window.screenX)},center:r}},{}],70:[function(e,t,n){"use strict";t.exports={isIos:e("@braintree/browser-detection/is-ios"),isIosWKWebview:e("@braintree/browser-detection/is-ios-wkwebview"),supportsPopups:e("@braintree/browser-detection/supports-popups")}},{"@braintree/browser-detection/is-ios":18,"@braintree/browser-detection/is-ios-wkwebview":17,"@braintree/browser-detection/supports-popups":19}],71:[function(e,t,n){"use strict";t.exports={DISPATCH_FRAME_NAME:"dispatch",DISPATCH_FRAME_CLASS:"braintree-dispatch-frame",POPUP_BASE_OPTIONS:"resizable,scrollbars",DEFAULT_POPUP_WIDTH:450,DEFAULT_POPUP_HEIGHT:535,POPUP_POLL_INTERVAL:100,POPUP_CLOSE_TIMEOUT:100}},{}],72:[function(e,t,n){"use strict";var r=e("../../braintree-error");t.exports={FRAME_SERVICE_FRAME_CLOSED:{type:r.types.INTERNAL,code:"FRAME_SERVICE_FRAME_CLOSED",message:"Frame closed before tokenization could occur."},FRAME_SERVICE_FRAME_OPEN_FAILED:{type:r.types.INTERNAL,code:"FRAME_SERVICE_FRAME_OPEN_FAILED",message:"Frame failed to open."}}},{"../../braintree-error":54}],73:[function(e,t,n){"use strict";var r=e("../../enumerate");t.exports=r(["DISPATCH_FRAME_READY","DISPATCH_FRAME_REPORT"],"frameService:")},{"../../enumerate":61}],74:[function(e,t,n){"use strict";t.exports=function(e){return JSON.parse(JSON.stringify(e))}},{}],75:[function(e,t,n){"use strict";t.exports=function(e){return Object.keys(e).filter(function(t){return"function"==typeof e[t]})}},{}],76:[function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&"[object Array]"===Object.prototype.toString.call(e)||!1}function i(e){return e=e||window.location.href,/\?/.test(e)}function o(e,t){var n,i,a,s=[];for(a in e)e.hasOwnProperty(a)&&(i=e[a],n=t?r(e)?t+"[]":t+"["+a+"]":a,"object"==typeof i?s.push(o(i,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(i)));return s.join("&")}t.exports={parse:function(e){return i(e=e||window.location.href)?(e.split("?")[1]||"").replace(/#.*$/,"").split("&").reduce(function(e,t){var n=t.split("="),r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]);return e[r]=i,e},{}):{}},stringify:o,queryify:function(e,t){return e=e||"",null!=t&&"object"==typeof t&&function(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}(t)&&(e+=-1===e.indexOf("?")?"?":"",e+=-1!==e.indexOf("=")?"&":"",e+=o(t)),e},hasQueryParams:i}},{}],77:[function(e,t,n){"use strict";t.exports=function(e){return e?"":".min"}},{}],78:[function(e,t,n){"use strict";var r="function"==typeof atob?atob:i;function i(e){var t,n,r,i,o,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
2+/=",c="";if(!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})([=]{1,2})?$/.test(e))throw new Error("Non base64 encoded input passed to window.atob polyfill");a=0;do{t=(63&s.indexOf(e.charAt(a++)))<<2|(i=s.indexOf(e.charAt(a++)))>>4&3,n=(15&i)<<4|(o=s.indexOf(e.charAt(a++)))>>2&15,r=(3&o)<<6|63&s.indexOf(e.charAt(a++)),c+=String.fromCharCode(t)+(n?String.fromCharCode(n):"")+(r?String.fromCharCode(r):"")}while(a<e.length);return c}t.exports={atob:function(e){return r.call(window,e)},_atob:i}},{}],79:[function(e,t,n){"use strict";var r=e("../lib/braintree-error");t.exports={PAYPAL_NOT_ENABLED:{type:r.types.MERCHANT,code:"PAYPAL_NOT_ENABLED",message:"PayPal is not enabled for this merchant."},PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED:{type:r.types.MERCHANT,code:"PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED",message:"A linked PayPal Sandbox account is required to use PayPal Checkout in Sandbox. See https://developer.paypal.com/braintree/docs/guides/paypal/testing-go-live#linked-paypal-testing for details on linking your PayPal sandbox with Braintree."},PAYPAL_ACCOUNT_TOKENIZATION_FAILED:{type:r.types.NETWORK,code:"PAYPAL_ACCOUNT_TOKENIZATION_FAILED",message:"Could not tokenize user's PayPal account."},PAYPAL_FLOW_FAILED:{type:r.types.NETWORK,code:"PAYPAL_FLOW_FAILED",message:"Could not initialize PayPal flow."},PAYPAL_FLOW_OPTION_REQUIRED:{type:r.types.MERCHANT,code:"PAYPAL_FLOW_OPTION_REQUIRED",message:"PayPal flow property is invalid or missing."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED:{type:r.types.MERCHANT,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED"},PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED:{type:r.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:r.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:r.types.CUSTOMER,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED",message:"Customer closed PayPal popup before authorizing."},PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS:{type:r.types.MERCHANT,code:"PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS",message:"Vault initiated checkout already in progress."},PAYPAL_INVALID_PAYMENT_OPTION:{type:r.types.MERCHANT,code:"PAYPAL_INVALID_PAYMENT_OPTION",message:"PayPal payment options are invalid."},PAYPAL_MISSING_REQUIRED_OPTION:{type:r.types.MERCHANT,code:"PAYPAL_MISSING_REQUIRED_OPTION",message:"Missing required option."}}},{"../lib/braintree-error":54}],80:[function(e,t,n){"use strict";var r=e("../lib/basic-component-verification"),i=e("@braintree/wrap-promise"),o=e("./paypal-checkout");t.exports={create:i(function(e){return r.verify({name:"PayPal Checkout",client:e.client,authorization:e.authorization}).then(function(){return new o(e)._initialize(e)})}),isSupported:function(){return!0},VERSION:"3.143.0"}},{"../lib/basic-component-verification":53,"./paypal-checkout":81,"@braintree/wrap-promise":29}],81:[function(e,t,n){"use strict";var r=e("../lib/analytics"),i=e("../lib/assign").assign,o=e("../lib/create-deferred-client"),a=e("../lib/create-assets-url"),s=e("@braintree/extended-promise"),c=e("@braintree/wrap-promise"),d=e("../lib/braintree-error"),l=e("../lib/convert-to-braintree-error"),u=e("./errors"),p=e("../paypal/shared/constants"),_=e("../lib/frame-service/external"),E=e("../lib/create-authorization-data"),m=e("../lib/methods"),h=e("../lib/use-min"),f=e("../lib/convert-methods-to-error"),A=e("../lib/querystring"),y=e("../lib/constants").INTEGRATION_TIMEOUT_MS,I=["amount","currency","vaultInitiatedCheckoutPaymentMethodToken"];function T(e){this._merchantAccountId=e.merchantAccountId,this._autoSetDataUserIdToken=Boolean(e.autoSetDataUserIdToken)}s.suppressUnhandledPromiseMessage=!0,T.prototype._initialize=function(e){var t;return e.client?(t=e.client.getConfiguration(),this._authorizationInformation={fingerprint:t.authorizationFingerprint,environment:t.gatewayConfiguration.environment}):(t=E(e.authorization),this._authorizationInformation={fingerprint:t.attrs.authorizationFingerprint,environment:t.environment}),this._clientPromise=o.create({authorization:e.authorization,client:e.client,debug:e.debug,assetsUrl:a.create(e.authorization),name:"PayPal Checkout"}).then(function(e){return this._configuration=e.getConfiguration(),this._merchantAccountId||(this._configuration.gatewayConfiguration.paypalEnabled?!0===this._configuration.gatewayConfiguration.paypal.environmentNoNetwork&&(this._setupError=ne
2w d(u.PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED)):this._setupError=new d(u.PAYPAL_NOT_ENABLED)),this._setupError?Promise.reject(this._setupError):(r.sendEvent(e,"paypal-checkout.initialized"),this._frameServicePromise=this._setupFrameService(e),e)}.bind(this)),e.client?this._clientPromise.then(function(){return this}.bind(this)):Promise.resolve(this)},T.prototype._setupFrameService=function(e){var t=new s,n=e.getConfiguration(),i=setTimeout(function(){r.sendEvent(e,"paypal-checkout.frame-service.timed-out"),t.reject(new d(u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED))},y);return this._assetsUrl=n.gatewayConfiguration.paypal.assetsUrl+"/web/3.143.0",this._isDebug=n.isDebug,this._loadingFrameUrl=this._assetsUrl+"/html/paypal-landing-frame"+h(this._isDebug)+".html",_.create({name:"braintreepaypallanding",dispatchFrameUrl:this._assetsUrl+"/html/dispatch-frame"+h(this._isDebug)+".html",openFrameUrl:this._loadingFrameUrl},function(e){this._frameService=e,clearTimeout(i),t.resolve()}.bind(this)),t},T.prototype.createPayment=function(e){var t=this;return e&&p.FLOW_ENDPOINTS.hasOwnProperty(e.flow)?(r.sendEvent(this._clientPromise,"paypal-checkout.createPayment"),this._createPaymentResource(e).then(function(n){var r;return r="checkout"===e.flow?A.parse(n.paymentResource.redirectUrl).token:n.agreementSetup.tokenId,t._contextId=r,r})):Promise.reject(new d(u.PAYPAL_FLOW_OPTION_REQUIRED))},T.prototype._createPaymentResource=function(e,t){var n=this,i="paypal_hermes/"+p.FLOW_ENDPOINTS[e.flow];return this._flow=e.flow,delete this.intentFromCreatePayment,t=t||{},!0===e.offerCredit&&r.sendEvent(this._clientPromise,"paypal-checkout.credit.offered"),this._clientPromise.then(function(r){return r.request({endpoint:i,method:"post",data:n._formatPaymentResourceData(e,t)}).then(function(t){return n.intentFromCreatePayment=e.intent,t})}).catch(function(e){return n._setupError?Promise.reject(n._setupError):422===(e.details&&e.details.httpStatus)?Promise.reject(new d({type:u.PAYPAL_INVALID_PAYMENT_OPTION.type,code:u.PAYPAL_INVALID_PAYMENT_OPTION.code,message:u.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:e}})):Promise.reject(l(e,{type:u.PAYPAL_FLOW_FAILED.type,code:u.PAYPAL_FLOW_FAILED.code,message:u.PAYPAL_FLOW_FAILED.message}))})},T.prototype.updatePayment=function(e){var t=this;return!e||this._hasMissingOption(e,p.REQUIRED_OPTIONS)?(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment.missing-options",{flow:t._flow,context_id:t._contextId}),Promise.reject(new d(u.PAYPAL_MISSING_REQUIRED_OPTION))):this._verifyConsistentCurrency(e)?(r.sendEventPlus(this._clientPromise,"paypal-checkout.updatePayment",{flow:t._flow,context_id:t._contextId}),this._clientPromise.then(function(n){return n.request({endpoint:"paypal_hermes/patch_payment_resource",method:"post",data:t._formatUpdatePaymentData(e)})}).catch(function(e){return 422===(e.details&&e.details.httpStatus)?(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment.invalid",{flow:t._flow,context_id:t._contextId}),Promise.reject(new d({type:u.PAYPAL_INVALID_PAYMENT_OPTION.type,code:u.PAYPAL_INVALID_PAYMENT_OPTION.code,message:u.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:e}}))):(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment."+u.PAYPAL_FLOW_FAILED.code,{flow:t._flow,context_id:t._contextId}),Promise.reject(l(e,{type:u.PAYPAL_FLOW_FAILED.type,code:u.PAYPAL_FLOW_FAILED.code,message:u.PAYPAL_FLOW_FAILED.message})))})):(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment.inconsistent-currencies",{flow:t._flow,context_id:t._contextId}),Promise.reject(new d({type:u.PAYPAL_INVALID_PAYMENT_OPTION.type,code:u.PAYPAL_INVALID_PAYMENT_OPTION.code,message:u.PAYPAL_INVALID_PAYMENT_OPTION.message,details:{originalError:new Error("One or more shipping option currencies differ from checkout currency.")}})))},T.prototype.startVaultInitiatedCheckout=function(e){var t,n=this;return this._vaultInitiatedCheckoutInProgress?(r.sendEventPlus(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.error.already-in-progress",{flow:n._flow,context_id:n._contextId}),Promise.reject(new d(u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS))
2):(I.forEach(function(n){e.hasOwnProperty(n)||(t=n)}),t?Promise.reject(new d({type:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.type,code:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.code,message:"Required param "+t+" is missing."})):(this._vaultInitiatedCheckoutInProgress=!0,this._addModalBackdrop(e),e=i({},e,{flow:"checkout"}),r.sendEventPlus(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.started",{flow:n._flow,context_id:n._contextId}),this._waitForVaultInitiatedCheckoutDependencies().then(function(){var t=new s,r=n._createPaymentResource(e,{returnUrl:n._constructVaultCheckoutUrl("redirect-frame"),cancelUrl:n._constructVaultCheckoutUrl("cancel-frame")}).then(function(e){var r=e.paymentResource.redirectUrl;return n._frameService.redirect(r),t});return n._frameService.open({},n._createFrameServiceCallback(t)),r}).catch(function(e){return n._vaultInitiatedCheckoutInProgress=!1,n._removeModalBackdrop(),"FRAME_SERVICE_FRAME_CLOSED"===e.code?(r.sendEventPlus(n._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.canceled.by-customer",{flow:n._flow,context_id:n._contextId}),Promise.reject(new d(u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED))):(n._frameService&&n._frameService.close(),e.code&&e.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED")>-1?(r.sendEventPlus(n._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.failed.popup-not-opened",{flow:n._flow,context_id:n._contextId}),Promise.reject(new d({code:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.code,type:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.type,message:u.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED.message,details:{originalError:e}}))):Promise.reject(e))}).then(function(e){return n._frameService.close(),n._vaultInitiatedCheckoutInProgress=!1,n._removeModalBackdrop(),r.sendEventPlus(n._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.succeeded",{flow:n._flow,context_id:n._contextId}),Promise.resolve(e)})))},T.prototype._addModalBackdrop=function(e){e.optOutOfModalBackdrop||(this._modalBackdrop||(this._modalBackdrop=document.createElement("div"),this._modalBackdrop.setAttribute("data-braintree-paypal-vault-initiated-checkout-modal",!0),this._modalBackdrop.style.position="fixed",this._modalBackdrop.style.top=0,this._modalBackdrop.style.bottom=0,this._modalBackdrop.style.left=0,this._modalBackdrop.style.right=0,this._modalBackdrop.style.zIndex=9999,this._modalBackdrop.style.background="black",this._modalBackdrop.style.opacity="0.7",this._modalBackdrop.addEventListener("click",function(){this.focusVaultInitiatedCheckoutWindow()}.bind(this))),document.body.appendChild(this._modalBackdrop))},T.prototype._removeModalBackdrop=function(){this._modalBackdrop&&this._modalBackdrop.parentNode&&this._modalBackdrop.parentNode.removeChild(this._modalBackdrop)},T.prototype.closeVaultInitiatedCheckoutWindow=function(){return this._vaultInitiatedCheckoutInProgress&&r.sendEventPlus(this._clientPromise,"paypal-checkout.startVaultInitiatedCheckout.canceled.by-merchant",{flow:this._flow,context_id:this._contextId}),this._waitForVaultInitiatedCheckoutDependencies().then(function(){this._frameService.close()}.bind(this))},T.prototype.focusVaultInitiatedCheckoutWindow=function(){return this._waitForVaultInitiatedCheckoutDependencies().then(function(){this._frameService.focus()}.bind(this))},T.prototype._createFrameServiceCallback=function(e){var t=this;return function(n,r){n?e.reject(n):r&&(t._frameService.redirect(t._loadingFrameUrl),t.tokenizePayment({paymentToken:r.token,payerID:r.PayerID,paymentID:r.paymentId,orderID:r.orderId}).then(function(t){e.resolve(t)}).catch(function(t){e.reject(t)}))}},T.prototype._waitForVaultInitiatedCheckoutDependencies=function(){var e=this;return this._clientPromise.then(function(){return e._frameServicePromise})},T.prototype._constructVaultCheckoutUrl=function(e){var t=this._frameService._serviceId;return this._assetsUrl+"/html/"+e+h(this._isDebug)+".html?channel="+t},T.prototype.tokenizePayment=function(e){var t,n=this,i=!0,o={flow:this._flow,intent:e.intent||this.intentFromCreatePayment},a={ecToken:e.paymentToken,billingToken:e.billingToken,payerId:e.payerID,paymentId:e.paymentID,orderId:e.orderID,shippingOptionsId:e.shippingOptionsId};return e.hasOwnProperty("vault")&&(i=e.vault),o.vault=i,r.sendEventPlus(this._clientPromise,"paypal-checkout.tokenization.started",{flow:n._flow,context_id:n._contextId}),this._clientPromise.then(function(e){return e.request({endpoint:"payment_methods/paypal_accounts",method:"post",data:n._formatTokenizeData(o,a)})}).then(function(e){return t=n._formatTokenizePayload(e),r.sendEventPlus(n._clientPromise,"paypal-checkout.tokenization.success",{flow:n._flow,context_id:n._contextId}),t.creditFinancingOffered&&r.sendEventPlus(n._clientPromise,"paypal-checkout.credit.accepted",{flow:n._flow,context_id:n._contextId}),t}).catch(function(e){return n._setupError?Promise.reject(n._setupError):(r.sendEventPlus(n._clientPromise,"paypal-checkout.tokenization.failed",{flow:n._flow,context_id:n._contextId}),Promise.reject(l(e,{type:u.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.type,code:u.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.code,message:u.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.message})))})},T.prototype.getClientId=function(){return this._clientPromise.then(function(e){return e.getConfiguration().gatewayConfiguration.paypal.clientId})},T.prototype.loadPayPalSDK=function(e){var t,n=new s,r=e&&e.dataAttributes||{},o=r["user-id-token"]||r["data-user-id-token"];return this._configuration&&(r["client-metadata-id"]=r["client-metadata-id"]?r["client-metadata-id"]:this._configuration.analyticsMetadata.sessionId,r["data-sdk-integration-source"]=p.BT_INTEGRATION_SOURCE),o||(o=this._authorizationInformation.fingerprint&&this._authorizationInformation.fingerprint.split("?")[0]),this._paypalScript=document.createElement("script"),delete(e=i({},{components:"buttons"},e)).dataAttributes,e.vault?e.intent=e.intent||"tokenize":(e.intent=e.intent||"authorize",e.currency=e.currency||"USD"),t=p.ENVIRONMENT[e.env]||"https://www.paypal.com/sdk/js?",delete e.env,this._paypalScript.onload=function(){n.resolve()},Object.keys(r).forEach(function(e){this._paypalScript.setAttribute("data-"+e.replace(/^data\-/,""),r[e])}.bind(this)),(e["client-id"]?Promise.resolve(e["client-id"]):this.getClientId()).then(function(n){e["client-id"]=n,this._autoSetDataUserIdToken&&o&&(this._paypalScript.setAttribute("data-user-id-token",o),this._attachPreloadPixel({id:n,userIdToken:o,amount:r.amount,currency:e.currency,merchantId:e["merchant-id"]})),this._paypalScript.src=A.queryify(t,e),document.head.insertBefore(this._paypalScript,document.head.firstElementChild)}.bind(this)),n.then(function(){return this}.bind(this))},T.prototype._attachPreloadPixel=function(e){var t,n=e.id,r=e.userIdToken,i="production"===this._authorizationInformation.environment?"":"sandbox.",o="https://www.{ENV}paypal.com/smart/buttons/preload".replace("{ENV}",i),a={"client-id":n,"user-id-token":r};e.amount&&(a.amount=e.amount),e.currency&&(a.currency=e.currency),e.merchantId&&(a["merchant-id"]=e.merchantId),(t=new XMLHttpRequest).open("GET",A.queryify(o,a)),t.send()},T.prototype._formatPaymentResourceData=function(e,t){var n=this._configuration.gatewayConfiguration,r={returnUrl:t.returnUrl||"https://www.paypal.com/checkoutnow/error",cancelUrl:t.cancelUrl||"https://www.paypal.com/checkoutnow/error",offerPaypalCredit:!0===e.offerCredit,merchantAccountId:this._merchantAccountId,experienceProfile:{brandName:e.displayName||n.paypal.displayName,localeCode:e.locale,noShipping:(!e.enableShippingAddress).toString(),addressOverride:!1===e.shippingAddressEditable,landingPageType:e.landingPageType},shippingOptions:e.shippingOptions,payer_email:e.userAuthenticationEmail};return e.hasOwnProperty("returnUrl")&&(r.returnUrl=e.returnUrl),e.hasOwnProperty("cancelUrl")&&(r.cancelUrl=e.cancelUrl),e.hasOwnProperty("appSwitchPreference")&&(r.appSwitchPreference=e.appSwitchPreference),e.hasOwnProperty("shippingCallbackUrl")&&(r.shippingCallbackUrl=e.shippingCallbackUrl),e.hasOwnProperty("paymentReadySessionId")&&(r.paymentReadySessionId=e.paymentReadySessionId),e.hasOwnProperty("amountBreakdown")&&(r.amountBreakdown=e.amountBreakdown),e.planType&&(r.planType=e.planType),e.planMetadata&&(r.planMetadata=this._formatPlanMetadata(e.planMetadata)),this._formatPaymentResourceCheckoutData(r,e),this._formatPaymentResourceVaultData(r,e),this._riskCorrelationId=e.riskCorrelationId,e.riskCorrelationId&&(r.correlationId=this._riskCorrelationId),r},T.prototype._formatPaymentResourceVaultData=function(e,t){"checkout"!==t.flow&&(e.shippingAddress=t.shippingAddressOverride,t.billingAgreementDescription&&(e.description=t.billingAgreementDescription),t.hasOwnProperty("userAction")&&(e.experienceProfile.userAction=t.userAction))},T.prototype._formatPaymentResourceCheckoutData=function(e,t){var n,r=t.intent;if("checkout"===t.flow){for(n in e.amount=t.amount,e.currencyIsoCode=t.currency,e.requestBillingAgreement=t.requestBillingAgreement,t.hasOwnProperty("userAction")&&(e.experienceProfile.userAction=t.userAction),r&&("capture"===r&&(r="sale"),e.intent=r),t.hasOwnProperty("lineItems")&&(e.lineItems=t.lineItems),t.hasOwnProperty("vaultInitiatedCheckoutPaymentMethodToken")&&(e.vaultInitiatedCheckoutPaymentMethodToken=t.vaultInitiatedCheckoutPaymentMethodToken),t.hasOwnProperty("shippingOptions")&&(e.shippingOptions=t.shippingOptions),t.shippingAddressOverride)t.shippingAddressOverride.hasOwnProperty(n)&&(e[n]=t.shippingAddressOverride[n]);t.contactPreference&&(e.contactPreference=t.contactPreference),t.hasOwnProperty("billingAgreementDetails")&&(e.billingAgreementDetails=t.billingAgreementDetails)}},T.prototype._verifyConsistentCurrency=function(e){return!(e.currency&&e.hasOwnProperty("shippingOptions")&&Array.isArray(e.shippingOptions))||e.shippingOptions.every(function(t){return t.amount&&t.amount.currency&&e.currency.toLowerCase()===t.amount.currency.toLowerCase()})},T.prototype._hasMissingOption=function(e,t){var n,r;if(t=t||[],!e.hasOwnProperty("amount")&&!e.hasOwnProperty("lineItems"))return!0;for(n=0;n<t.length;n++)if(r=t[n],!e.hasOwnProperty(r))return!0;return!1},T.prototype._formatPlanMetadata=function(e){var t,n,r,i,o=["currencyIsoCode","name","oneTimeFeeAmount","productDescription","productPrice","productQuantity","shippingAmount","taxAmount","totalAmount"],a=["billingFrequency","billingFrequencyUnit","numberOfExecutions","sequence","startDate","trial","pricingScheme"],s={billingCycles:[]};if(e.hasOwnProperty("billingCycles"))for(s.billingCycles=[],t=0;t<e.billingCycles.length;t++){for(r=e.billingCycles[t],i={},n=0;n<a.length;n++)i[a[n]]=r[a[n]];s.billingCycles.push(i)}for(t=0;t<o.length;t++)s[o[t]]=e[o[t]];return s},T.prototype._formatUpdatePaymentData=function(e){var t=this,n={merchantAccountId:this._merchantAccountId,paymentId:e.paymentId||e.orderId,currencyIsoCode:e.currency};return e.hasOwnProperty("amount")&&(n.amount=e.amount),e.hasOwnProperty("lineItems")&&(n.lineItems=e.lineItems),e.hasOwnProperty("shippingOptions")&&(n.shippingOptions=e.shippingOptions),e.hasOwnProperty("amountBreakdown")&&(n.amountBreakdown=e.amountBreakdown),e.hasOwnProperty("shippingAddress")&&(r.sendEventPlus(t._clientPromise,"paypal-checkout.updatePayment.shippingAddress.provided.by-the-merchant",{flow:t._flow,context_id:t._contextId}),n.line1=e.shippingAddress.line1,e.shippingAddress.hasOwnProperty("line2")&&(n.line2=e.shippingAddress.line2),n.city=e.shippingAddress.city,n.state=e.shippingAddress.state,n.postalCode=e.shippingAddress.postalCode,n.countryCode=e.shippingAddress.countryCode,e.shippingAddress.hasOwnProperty("phone")&&(n.phone=e.shippingAddress.phone),e.shippingAddress.hasOwnProperty("recipientName")&&(n.recipientName=e.shippingAddress.recipientName)),n},T.prototype._formatTokenizeData=function(e,t){var n=this._configuration,r=n.gatewayConfiguration,i="TOKENIZATION_KEY"===n.authorizationType,o="vault"===e.flow||null==e.flow&&!t.paymentId,a={paypalAccount:{correlationId:this._riskCorrelationId||t.billingToken||t.ecToken,options:{validate:o&&!i&&e.vault}}};return o?a.paypalAccount.billingAgreementToken=t.billingToken:(a.paypalAccount.paymentToken=t.paymentId||t.orderId,a.paypalAccount.payerId=t.payerId,a.paypalAccount.unilateral=r.paypal.unvettedMerchant,e.intent&&(a.paypalAccount.intent=e.intent)),this._merchantAccountId&&(a.merchantAccountId=this._merchantAccountId),a},T.prototype._formatTokenizePayload=function(e){var t,n={};
2return e.paypalAccounts&&(n=e.paypalAccounts[0]),t={nonce:n.nonce,details:{},type:n.type},n.details&&n.details.payerInfo&&(t.details=n.details.payerInfo),n.details&&n.details.creditFinancingOffered&&(t.creditFinancingOffered=n.details.creditFinancingOffered),n.details&&n.details.shippingOptionId&&(t.shippingOptionId=n.details.shippingOptionId),n.details&&n.details.cobrandedCardLabel&&(t.cobrandedCardLabel=n.details.cobrandedCardLabel),t},T.prototype.teardown=function(){var e=this;return f(this,m(T.prototype)),this._paypalScript&&this._paypalScript.parentNode&&this._paypalScript.parentNode.removeChild(this._paypalScript),this._frameServicePromise.catch(function(){}).then(function(){return e._frameService?e._frameService.teardown():Promise.resolve()})},t.exports=c.wrapPrototype(T)},{"../lib/analytics":50,"../lib/assign":52,"../lib/braintree-error":54,"../lib/constants":55,"../lib/convert-methods-to-error":56,"../lib/convert-to-braintree-error":57,"../lib/create-assets-url":58,"../lib/create-authorization-data":59,"../lib/create-deferred-client":60,"../lib/frame-service/external":64,"../lib/methods":75,"../lib/querystring":76,"../lib/use-min":77,"../paypal/shared/constants":82,"./errors":79,"@braintree/extended-promise":20,"@braintree/wrap-promise":29}],82:[function(e,t,n){"use strict";t.exports={LANDING_FRAME_NAME:"braintreepaypallanding",FLOW_ENDPOINTS:{checkout:"create_payment_resource",vault:"setup_billing_agreement"},REQUIRED_OPTIONS:["paymentId","currency"],ENVIRONMENT:{stage:"https://www.msmaster.qa.paypal.com/sdk/js?",sandbox:"https://www.sandbox.paypal.com/sdk/js?",teBraintree:"https://www.braintree.stage.paypal.com/sdk/js?"},BT_INTEGRATION_SOURCE:"BRAINTREE_WEB_SDK"}},{}]},{},[80])(80)}}]);
3//# sourceMappingURL=9916.c36ea224d939b383e68a.bundle.min.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.