/g,">")))})),e}},{}],38:[function(t,e,n){"use strict";var r=t("./validate-selector"),i=t("./filter-style-keys"),o=t("./filter-style-values");function a(t,e,n){var i,s,u=t+"{";return e=e||{},!function(t){return/^@media\s+/i.test(t)}(t)?(i=n(e),s=o(i),Object.keys(s).forEach((function(t){u+=t+":"+s[t]+";"}))):Object.keys(e).forEach((function(t){r(t)&&(u+=a(t,e[t],n))})),u+="}"}e.exports=function(t,e,n){var o,s=0,u=document.createElement("style");function c(t){return i(t,e,n)}return document.querySelector("head").appendChild(u),o=u.sheet||u.styleSheet,t=t||{},e=e||[],Object.keys(t).forEach((function(e){var n;if(r(e)){n=a(e,t[e],c);try{o.insertRule?o.insertRule(n,s):o.addRule(e,n.replace(/^[^{]+/,"").replace(/{|}/g,""),s),s++}catch(t){if(!t instanceof SyntaxError)throw t}}})),u}},{"./filter-style-keys":36,"./filter-style-values":37,"./validate-selector":39}],39:[function(t,e,n){"use strict";e.exports=function(t){return 0!==t.trim().length&&(!/supports/i.test(t)&&(!/import/i.test(t)&&(!/\{|\}/.test(t)&&!/-1}(t)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"@braintree/browser-detection/is-android":3,"@braintree/browser-detection/is-chrome":4,"@braintree/browser-detection/is-ie9":8,"@braintree/browser-detection/is-ios":10}],43:[function(t,e,n){"use strict";var r=t("./parse-pattern"),i=t("../is-backspace");function o(t){this.setPattern(t)}o.prototype.setPattern=function(t){if("string"!=typeof t)throw new Error("A valid pattern string is required");this.pattern=r(t)},o.prototype.format=function(t){var e,n,r,i=t.value,o=0,a="",s={start:t.selection.start,end:t.selection.end};for(e=0;ei.length));e++)if(n.isPermaChar)null==r&&a.length!==n.index||(a+=n.value,n.index<=s.start&&s.start++,n.index<=s.end&&s.end++);else for(;o1&&(n.cid=e[1])})),i={f:t.substr(0,32),fp:n,bu:!1,s:N},o.text=JSON.stringify(i)},R.prototype.request=function(t,e){var n=this,i=new d((function(e,i){var o,a,l,d,f,h,y=Boolean("payment_methods/credit_cards"===t.endpoint&&n.getConfiguration().gatewayConfiguration.creditCards.collectDeviceData);if("graphQLApi"!==t.api&&(t.method?t.endpoint||(o="options.endpoint"):o="options.method"),o)throw new s({type:v.CLIENT_OPTION_REQUIRED.type,code:v.CLIENT_OPTION_REQUIRED.code,message:o+" is required when making a request."});if(a="api"in t?t.api:"clientApi",d={method:t.method,graphQL:n._graphQL,timeout:t.timeout,metadata:n._configuration.analyticsMetadata},"clientApi"===a)l=n._clientApiBaseUrl,d.data=p(n._configuration,t.data);else if("braintreeApi"===a){if(!n._braintreeApi)throw new s(_.BRAINTREE_API_ACCESS_RESTRICTED);l=n._braintreeApi.baseUrl,d.data=t.data,d.headers={"Braintree-Version":E.BRAINTREE_API_VERSION_HEADER,Authorization:"Bearer "+n._braintreeApi.accessToken}}else{if("graphQLApi"!==a)throw new s({type:v.CLIENT_OPTION_INVALID.type,code:v.CLIENT_OPTION_INVALID.code,message:"options.api is invalid."});l=I[n._configuration.gatewayConfiguration.environment],t.endpoint="",d.method="post",d.data=m({clientSdkMetadata:{source:n._configuration.analyticsMetadata.source,integration:n._configuration.analyticsMetadata.integration,sessionId:n._configuration.analyticsMetadata.sessionId}},t.data),d.headers=(f=n._configuration.authorization,{Authorization:"Bearer "+((h=c(f).attrs).authorizationFingerprint||h.tokenizationKey),"Braintree-Version":r})}d.url=l+t.endpoint,d.sendAnalyticsEvent=function(t){g.sendEvent(n,t)},n._request(d,(function(t,r,o){var c,l;l=function(t,e){var n;-1===t?n=new s(v.CLIENT_REQUEST_TIMEOUT):403===t?n=new s(v.CLIENT_AUTHORIZATION_INSUFFICIENT):429===t?n=new s(v.CLIENT_RATE_LIMITED):t>=500?n=new s(v.CLIENT_GATEWAY_NETWORK):(t<200||t>=400)&&(n=u(e,{type:v.CLIENT_REQUEST_ERROR.type,code:v.CLIENT_REQUEST_ERROR.code,message:v.CLIENT_REQUEST_ERROR.message}));if(n)return n.details=n.details||{},n.details.httpStatus=t,n}(o,t),l?i(l):"graphQLApi"===a&&r.errors?i(u(r.errors,{type:v.CLIENT_GRAPHQL_REQUEST_ERROR.type,code:v.CLIENT_GRAPHQL_REQUEST_ERROR.code,message:v.CLIENT_GRAPHQL_REQUEST_ERROR.message})):(c=m({_httpStatus:o},r),y&&c.creditCards&&c.creditCards.length>0&&(n._findOrCreateFraudnetJSON(c.creditCards[0].nonce),C.loadScript({src:O,forceScriptReload:!0})),e(c))}))}));return"function"==typeof e?(e=h(y(e)),void i.then((function(t){e(null,t,t._httpStatus)})).catch((function(t){var n=t&&t.details&&t.details.httpStatus;e(t,null,n)}))):i},R.prototype.toJSON=function(){return this.getConfiguration()},R.prototype.getVersion=function(){return b},R.prototype.teardown=f((function(){return delete L[this.getConfiguration().authorization],A(this,T(R.prototype)),d.resolve()})),e.exports=R},{"../lib/add-metadata":103,"../lib/analytics":104,"../lib/assets":105,"../lib/assign":106,"../lib/braintree-error":107,"../lib/constants":111,"../lib/convert-methods-to-error":112,"../lib/convert-to-braintree-error":113,"../lib/create-authorization-data":114,"../lib/deferred":116,"../lib/errors":118,"../lib/is-verified-domain":121,"../lib/methods":123,"../lib/once":124,"../lib/promise":125,"./constants":61,"./errors":62,"./get-configuration":63,"./request":74,"./request/graphql":72,"@braintree/wrap-promise":16}],61:[function(t,e,n){"use strict";e.exports={BRAINTREE_API_VERSION_HEADER:"2017-04-03",BRAINTREE_VERSION:"2018-05-10"}},{}],62:[function(t,e,n){"use strict";var r=t("../lib/braintree-error");e.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"},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."}}},{"../lib/braintree-error":107}],63:[function(t,e,n){(function(n){"use strict";var r=t("../lib/braintree-error"),i=t("../lib/promise"),o=t("@braintree/wrap-promise"),a=t("./request"),s=t("../lib/vendor/uuid"),u=t("../lib/constants"),c=t("../lib/create-authorization-data"),l=t("./errors"),p=t("./request/graphql"),d=t("../lib/is-date-string-before-or-on"),f=t("./constants").BRAINTREE_VERSION;e.exports={getConfiguration:o((function(t){return new i((function(e,i){var o,h,y,m,g,E=s(),v={merchantAppId:n.location.host,platform:u.PLATFORM,sdkVersion:u.VERSION,source:u.SOURCE,integration:u.INTEGRATION,integrationType:u.INTEGRATION,sessionId:E};try{h=c(t.authorization)}catch(t){return void i(new r(l.CLIENT_INVALID_AUTHORIZATION))}y=h.attrs,m=h.configUrl,y._meta=v,y.braintreeLibraryVersion=u.BRAINTREE_LIBRARY_VERSION,y.configVersion="3",g={url:m,method:"GET",data:y},y.authorizationFingerprint&&h.graphQL&&(d(h.graphQL.date,f)&&(g.graphQL=new p({graphQL:{url:h.graphQL.url,features:["configuration"]}})),g.metadata=v),a(g,(function(n,a,s){var u;if(n)return u=403===s?l.CLIENT_AUTHORIZATION_INSUFFICIENT:l.CLIENT_GATEWAY_NETWORK,void i(new r({type:u.type,code:u.code,message:u.message,details:{originalError:n}}));o={authorization:t.authorization,authorizationType:y.tokenizationKey?"TOKENIZATION_KEY":"CLIENT_TOKEN",analyticsMetadata:v,gatewayConfiguration:a},e(o)}))}))}))}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lib/braintree-error":107,"../lib/constants":111,"../lib/create-authorization-data":114,"../lib/is-date-string-before-or-on":120,"../lib/promise":125,"../lib/vendor/uuid":130,"./constants":61,"./errors":62,"./request":74,"./request/graphql":72,"@braintree/wrap-promise":16}],64:[function(t,e,n){"use strict";var r=t("../../lib/querystring"),i=t("../browser-detection"),o=t("../../lib/assign").assign,a=t("./prep-body"),s=t("./parse-body"),u=t("./xhr"),c=u.isAvailable,l=t("./graphql/request"),p=t("./default-request");function d(t,e,n){var f,h,y,m,g,E,v,_=t.url,b=t.graphQL,I=t.timeout,T=u.getRequestObject(),A=n,C=Boolean(b&&b.isGraphQLRequest(_,t.data));t.headers=o({"Content-Type":"application/json"},t.headers),_=(y=C?new l(t):new p(t)).getUrl(),m=y.getBody(),g=y.getMethod(),E=y.getHeaders(),"GET"===g&&(_=r.queryify(_,m),m=null),c?T.onreadystatechange=function(){if(4===T.readyState){if(0===T.status&&C)return delete t.graphQL,void d(t,e,n);if(v=s(T.responseText),h=y.adaptResponseBody(v),(f=y.determineStatus(T.status,v))>=400||f<200){if(C&&function(t){var e=!t.data&&t.errors&&t.errors[0]&&t.errors[0].extensions&&t.errors[0].extensions.errorClass;return"UNKNOWN"===e||"INTERNAL"===e}(v))return delete t.graphQL,void d(t,e,n);if(e<1&&function(t){return(!t||408===t)&&i.isIe()}(f))return e++,void d(t,e,n);A(h||"error",null,f||500)}else A(null,h,f)}}:(t.headers&&(_=r.queryify(_,E)),T.onload=function(){A(null,s(T.responseText),T.status)},T.onerror=function(){A("error",null,500)},T.onprogress=function(){},T.ontimeout=function(){A("timeout",null,-1)});try{T.open(g,_,!0)}catch(r){if(!C)throw r;return delete t.graphQL,void d(t,e,n)}T.timeout=I,c&&Object.keys(E).forEach((function(t){T.setRequestHeader(t,E[t])}));try{T.send(a(g,m))}catch(t){}}e.exports={request:function(t,e){d(t,0,e)}}},{"../../lib/assign":106,"../../lib/querystring":126,"../browser-detection":59,"./default-request":65,"./graphql/request":73,"./parse-body":77,"./prep-body":78,"./xhr":79}],65:[function(t,e,n){"use strict";function r(t){this._url=t.url,this._data=t.data,this._method=t.method,this._headers=t.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(t){return t},r.prototype.determineStatus=function(t){return t},e.exports=r},{}],66:[function(t,e,n){(function(t){"use strict";e.exports=function(){return t.navigator.userAgent}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],67:[function(t,e,n){"use strict";var r=t("./error"),i=t("../../../../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"},a={VISA:"visa",MASTERCARD:"mastercard",DISCOVER:"discover",AMERICAN_EXPRESS:"amex"},s={VISA:"Visa",MASTERCARD:"MasterCard",DISCOVER:"Discover",AMERICAN_EXPRESS:"American Express"},u={VISA:"visa",MASTERCARD:"mastercard",DISCOVER:"discover",AMERICAN_EXPRESS:"amex"},c={VISA:"visa",MASTERCARD:"master",DISCOVER:"discover",AMERICAN_EXPRESS:"amex",DINERS:"diners",INTERNATIONAL_MAESTRO:"maestro",JCB:"jcb"};function l(t,e){return t.reduce((function(t,n){return e.hasOwnProperty(n)?t.concat(e[n]):t}),[])}e.exports=function(t,e){var n;return n=t.data&&!t.errors?function(t,e){var n,r=t.data.clientConfiguration;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:e._graphQL._config.url,features:r.supportedFeatures.map((function(t){return t.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.ideal&&(n.ideal=r.ideal);r.kount&&(n.kount={kountMerchantId:r.kount.merchantId});r.creditCard?(n.challenges=r.creditCard.challenges.map((function(t){return t.toLowerCase()})),n.creditCards={supportedCardTypes:l(r.creditCard.supportedCardBrands,o)},n.threeDSecureEnabled=r.creditCard.threeDSecureEnabled):(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,supportedNetworks:l(r.googlePay.supportedCardBrands,u)});r.venmo&&(n.payWithVenmo={merchantId:r.venmo.merchantId,accessToken:r.venmo.accessToken,environment:r.venmo.environment.toLowerCase()});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,externalClientId:r.visaCheckout.externalClientId,supportedCardTypes:l(r.visaCheckout.supportedCardBrands,s)});r.masterpass&&(n.masterpass={merchantCheckoutId:r.masterpass.merchantCheckoutId,supportedNetworks:l(r.masterpass.supportedCardBrands,c)});r.usBankAccount&&(n.usBankAccount={routeId:r.usBankAccount.routeId,plaid:{publicKey:r.usBankAccount.plaidPublicKey}});return n}(t,e):r(t),n}},{"../../../../lib/assign":106,"./error":69}],68:[function(t,e,n){"use strict";var r=t("./error"),i={AMERICAN_EXPRESS:"American Express",DINERS:"Discover",DISCOVER:"Discover",INTERNATIONAL_MAESTRO:"Maestro",JCB:"JCB",MASTERCARD:"MasterCard",UK_MAESTRO:"Maestro",UNION_PAY:"Union Pay",VISA:"Visa"},o={YES:"Yes",NO:"No",UNKNOWN:"Unknown"};e.exports=function(t){return t.data&&!t.errors?function(t){var e=t.data.tokenizeCreditCard,n=e.creditCard,r=n.last4?n.last4.substr(2,4):"",a=n.binData;a&&(["commercial","debit","durbinRegulated","healthcare","payroll","prepaid"].forEach((function(t){a[t]?a[t]=o[a[t]]:a[t]="Unknown"})),["issuingBank","countryOfIssuance","productId"].forEach((function(t){a[t]||(a[t]="Unknown")})));return{creditCards:[{binData:a,consumed:!1,description:r?"ending in "+r:"",nonce:e.token,details:{bin:n.bin||"",cardType:i[n.brandCode]||"Unknown",lastFour:n.last4||"",lastTwo:r},type:"CreditCard",threeDSecureInfo:null}]}}(t):r(t)}},{"./error":69}],69:[function(t,e,n){"use strict";function r(t,e,n){var i,o=e.extensions.legacyCode,a=t[0];1!==t.length?(n.forEach((function(t){t.field===a&&(i=t)})),i||(i={field:a,fieldErrors:[]},n.push(i)),r(t.slice(1),e,i.fieldErrors)):n.push({code:o,field:a,message:e.message})}function i(t){return{creditCard:"Credit card is invalid"}[t[0].field]}e.exports=function(t){var e,n=t.errors&&t.errors[0]&&t.errors[0].extensions&&t.errors[0].extensions.errorClass;return e="VALIDATION"===n?function(t){var e=function(t){var e=[];return t.forEach((function(t){r(t.extensions.inputPath.slice(1),t,e)})),e}(t.errors);return{error:{message:i(e)},fieldErrors:e}}(t):n?function(t){return{error:{message:t.errors[0].message},fieldErrors:[]}}(t):{error:{message:"There was a problem serving your request"},fieldErrors:[]},e}},{}],70:[function(t,e,n){"use strict";e.exports=function(){return{query:"query ClientConfiguration { clientConfiguration { analyticsUrl environment merchantId assetsUrl clientApiUrl creditCard { supportedCardBrands challenges threeDSecureEnabled } applePayWeb { countryCode currencyCode merchantIdentifier supportedCardBrands } googlePay { displayName supportedCardBrands environment googleAuthorization } ideal { routeId assetsUrl } kount { merchantId } masterpass { merchantCheckoutId supportedCardBrands } paypal { displayName clientId privacyUrl userAgreementUrl assetsUrl environment environmentNoNetwork unvettedMerchant braintreeClientId billingAgreementsEnabled merchantAccountId currencyCode payeeEmail } unionPay { merchantAccountId } usBankAccount { routeId plaidPublicKey } venmo { merchantId accessToken environment } visaCheckout { apiKey externalClientId supportedCardBrands } braintreeApi { accessToken url } supportedFeatures } }",operationName:"ClientConfiguration"}}},{}],71:[function(t,e,n){"use strict";var r=t("../../../../lib/assign").assign;function i(t){var e=t.creditCard,n=e&&e.billingAddress,i=e&&e.expirationDate,o=e&&(e.expirationMonth||i&&i.split("/")[0].trim()),a=e&&(e.expirationYear||i&&i.split("/")[1].trim()),s={input:{creditCard:{number:e&&e.number,expirationMonth:o,expirationYear:a,cvv:e&&e.cvv,cardholderName:e&&e.cardholderName},options:{}}};return n&&(s.input.creditCard.billingAddress=n),s.input=function(t,e){var n;t.creditCard&&t.creditCard.options&&"boolean"==typeof t.creditCard.options.validate?n=t.creditCard.options.validate:t.authorizationFingerprint&&t.tokenizationKey||t.authorizationFingerprint?n=!0:t.tokenizationKey&&(n=!1);"boolean"==typeof n&&(e.options=r({validate:n},e.options));return e}(t,s.input),s}e.exports=function(t){return{query:"mutation TokenizeCreditCard($input: TokenizeCreditCardInput!) { tokenizeCreditCard(input: $input) { token creditCard { bin brandCode last4 binData { prepaid healthcare debit durbinRegulated commercial payroll issuingBank countryOfIssuance productId } } } }",variables:i(t),operationName:"TokenizeCreditCard"}}},{"../../../../lib/assign":106}],72:[function(t,e,n){"use strict";var r=t("../../browser-detection"),i={tokenize_credit_cards:"payment_methods/credit_cards",configuration:"configuration"},o=["creditCard.options.unionPayEnrollment"];function a(t){this._config=t.graphQL}a.prototype.getGraphQLEndpoint=function(){return this._config.url},a.prototype.isGraphQLRequest=function(t,e){var n,a=this.getClientApiPath(t);return!(!this._isGraphQLEnabled()||!a||r.isIe9())&&(n=this._config.features.some((function(t){return i[t]===a})),!function(t){return o.some((function(e){return void 0!==e.split(".").reduce((function(t,e){return t&&t[e]}),t)}))}(e)&&n)},a.prototype.getClientApiPath=function(t){var e,n=t.split("/client_api/v1/");return n.length>1&&(e=n[1].split("?")[0]),e},a.prototype._isGraphQLEnabled=function(){return Boolean(this._config)},e.exports=a},{"../../browser-detection":59}],73:[function(t,e,n){"use strict";var r=t("../../constants").BRAINTREE_VERSION,i=t("../../../lib/assign").assign,o=t("./generators/credit-card-tokenization"),a=t("./adapters/credit-card-tokenization"),s=t("./generators/configuration"),u=t("./adapters/configuration"),c={"payment_methods/credit_cards":o,configuration:s},l={"payment_methods/credit_cards":a,configuration:u};function p(t){var e=t.graphQL.getClientApiPath(t.url);this._graphQL=t.graphQL,this._data=t.data,this._method=t.method,this._headers=t.headers,this._clientSdkMetadata={source:t.metadata.source,integration:t.metadata.integration,sessionId:t.metadata.sessionId},this._sendAnalyticsEvent=t.sendAnalyticsEvent||Function.prototype,this._generator=c[e],this._adapter=l[e],this._sendAnalyticsEvent("graphql.init")}function d(t){var e={};return Object.keys(t).forEach((function(n){var r,i=-1===(r=n).indexOf("_")?r:r.toLowerCase().replace(/(\_\w)/g,(function(t){return t[1].toUpperCase()}));"object"==typeof t[n]?e[i]=d(t[n]):"number"==typeof t[n]?e[i]=String(t[n]):e[i]=t[n]})),e}p.prototype.getUrl=function(){return this._graphQL.getGraphQLEndpoint()},p.prototype.getBody=function(){var t=d(this._data),e=this._generator(t),n=i({clientSdkMetadata:this._clientSdkMetadata},e);return JSON.stringify(n)},p.prototype.getMethod=function(){return"POST"},p.prototype.getHeaders=function(){var t,e;return this._data.authorizationFingerprint?(this._sendAnalyticsEvent("graphql.authorization-fingerprint"),t=this._data.authorizationFingerprint):(this._sendAnalyticsEvent("graphql.tokenization-key"),t=this._data.tokenizationKey),e={Authorization:"Bearer "+t,"Braintree-Version":r},i({},this._headers,e)},p.prototype.adaptResponseBody=function(t){return this._adapter(t,this)},p.prototype.determineStatus=function(t,e){var n,r;return 200===t?(r=e.errors&&e.errors[0]&&e.errors[0].extensions&&e.errors[0].extensions.errorClass,n=e.data&&!e.errors?200:"VALIDATION"===r?422:"AUTHORIZATION"===r?403:"AUTHENTICATION"===r?401:function(t,e){return!t&&e.errors[0].message}(r,e)?403:500):n=t||500,this._sendAnalyticsEvent("graphql.status."+t),this._sendAnalyticsEvent("graphql.determinedStatus."+n),n},e.exports=p},{"../../../lib/assign":106,"../../constants":61,"./adapters/configuration":67,"./adapters/credit-card-tokenization":68,"./generators/configuration":70,"./generators/credit-card-tokenization":71}],74:[function(t,e,n){"use strict";var r,i=t("../../lib/once"),o=t("./jsonp-driver"),a=t("./ajax-driver"),s=t("./get-user-agent"),u=t("./is-http");e.exports=function(t,e){e=i(e||Function.prototype),t.method=(t.method||"GET").toUpperCase(),t.timeout=null==t.timeout?6e4:t.timeout,t.data=t.data||{},null==r&&(r=!(u()&&/MSIE\s(8|9)/.test(s()))),r?a.request(t,e):o.request(t,e)}},{"../../lib/once":124,"./ajax-driver":64,"./get-user-agent":66,"./is-http":75,"./jsonp-driver":76}],75:[function(t,e,n){(function(t){"use strict";e.exports=function(){return"http:"===t.location.protocol}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],76:[function(t,e,n){(function(n){"use strict";var r,i=t("../../lib/vendor/uuid"),o=t("../../lib/querystring"),a={};function s(t){try{delete n[t]}catch(e){n[t]=null}}e.exports={request:function(t,e){var u,c="callback_json_"+i().replace(/-/g,""),l=t.url,p=t.data,d=t.method,f=t.timeout;l=o.queryify(l,p),u=function(t,e){var r=document.createElement("script"),i=!1;return r.src=t,r.async=!0,r.onerror=function(){n[e]({message:"error",status:500})},r.onload=r.onreadystatechange=function(){i||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(i=!0,r.onload=r.onreadystatechange=null)},r}(l=o.queryify(l,{_method:d,callback:c}),c),function(t,e,r){n[r]=function(n){var i=n.status||500,o=null,u=null;delete n.status,i>=400||i<200?o=n:u=n,s(r),function(t){t&&t.parentNode&&t.parentNode.removeChild(t)}(t),clearTimeout(a[r]),e(o,u,i)}}(u,e,c),function(t,e){a[e]=setTimeout((function(){a[e]=null,n[e]({error:"timeout",status:-1}),n[e]=function(){s(e)}}),t)}(f,c),r||(r=document.getElementsByTagName("head")[0]),r.appendChild(u)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../lib/querystring":126,"../../lib/vendor/uuid":130}],77:[function(t,e,n){"use strict";e.exports=function(t){try{t=JSON.parse(t)}catch(t){}return t}},{}],78:[function(t,e,n){"use strict";e.exports=function(t,e){if("string"!=typeof t)throw new Error("Method must be a string");return"get"!==t.toLowerCase()&&null!=e&&(e="string"==typeof e?e:JSON.stringify(e)),e}},{}],79:[function(t,e,n){(function(t){"use strict";var n=t.XMLHttpRequest&&"withCredentials"in new t.XMLHttpRequest;e.exports={isAvailable:n,getRequestObject:function(){return n?new XMLHttpRequest:new XDomainRequest}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],80:[function(t,e,n){"use strict";var r=t("../../lib/braintree-error"),i=t("../shared/errors"),o=t("../shared/constants").allowedAttributes;e.exports=function(t,e){var n;return o.hasOwnProperty(t)?null==e||function(t,e){if("string"===o[t])return"string"==typeof e||"number"==typeof e;if("boolean"===o[t])return"true"===String(e)||"false"===String(e);return!1}(t,e)||(n=new r({type:i.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.type,code:i.HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED.code,message:'Value "'+e+'" is not allowed for "'+t+'" attribute.'})):n=new r({type:i.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.type,code:i.HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED.code,message:'The "'+t+'" attribute is not supported in Hosted Fields.'}),n}},{"../../lib/braintree-error":107,"../shared/constants":100,"../shared/errors":101}],81:[function(t,e,n){"use strict";e.exports={assembleIFrames:function(t){var e,n,r=[];for(e=0;e0;return"number"in t&&(e.number=t.number.replace(/[-\s]/g,"")),"cvv"in t&&(e.cvv=t.cvv),"expirationMonth"in t&&(e.expiration_month=t.expirationMonth),"expirationYear"in t&&(2===t.expirationYear.length?e.expiration_year="20"+t.expirationYear:e.expiration_year=t.expirationYear),r&&(e.billing_address=n),"cardholderName"in t&&(e.cardholderName=t.cardholderName),e}},{}],95:[function(t,e,n){"use strict";e.exports={getFrameName:function(){return window.name.replace("braintree-hosted-field-","")}}},{}],96:[function(t,e,n){(function(n){"use strict";var r=t("../../lib/assign").assign,i=t("../../lib/bus"),o=t("../../lib/promise"),a=t("../../lib/convert-to-braintree-error"),s=t("./get-frame-name"),u=t("./assemble-iframes"),c=t("../../client/client"),l=t("inject-stylesheet").injectWithWhitelist,p=t("./models/credit-card-form").CreditCardForm,d=t("./components/field-component").FieldComponent,f=t("../../lib/analytics"),h=t("../../lib/braintree-error"),y=t("../shared/constants"),m=t("../shared/errors"),g=y.events,E=y.allowedStyles,v=y.tokenizationErrorCodes,_=t("./format-card-request-data"),b=["company","countryCodeNumeric","countryCodeAlpha2","countryCodeAlpha3","countryName","extendedAddress","locality","region","firstName","lastName","postalCode","streetAddress"];function I(t){var e=document.createDocumentFragment(),n=document.createElement("label"),r=document.createElement("input");return n.setAttribute("for",t+"-autofill-field"),n.textContent=t,r.id=t+"-autofill-field",r.className="autofill-field",r.type="text",r.name=t,r.setAttribute("tabindex",-1),r.setAttribute("autocomplete",y.autocompleteMappings[t]),e.appendChild(n),e.appendChild(r),e}function T(t){return function(e){var n,r,i,o,a,u,c;e&&e.month&&e.year&&(n=s.getFrameName(),i=e.month,o=e.year,a=e.cvv,2===o.length&&(o=String((new Date).getFullYear()).substring(0,2)+o),"expirationDate"===n?r=i+" / "+o:"expirationMonth"===n?r=i:"expirationYear"===n?r=o:"cvv"===n&&a&&(r=a),r&&(t.input.updateModel("value",r),t.input.shouldMask?t.input.maskValue(r):t.input.element.value=r,u=t.input.element,(c=u.getAttribute("placeholder"))&&(u.setAttribute("placeholder",""),u.setAttribute("placeholder",c))))}}function A(t,e){return function(n,i){o.resolve(t).then((function(s){var u,c,l=e.isEmpty(),p=e.invalidFieldKeys(),d=0===p.length;return l?(i([new h(m.HOSTED_FIELDS_FIELDS_EMPTY)]),o.resolve()):d?(n=n||{},u=function(t,e){var n=r({},e.billingAddress),i=e.cardholderName;Object.keys(n).forEach((function(e){(-1===b.indexOf(e)||t.hasOwnProperty(e))&&delete n[e]})),i&&(n.cardholderName=i);return r({},t,n)}(e.getCardData(),n),(c=_(u)).options={validate:!0===n.vault},s.request({api:"clientApi",method:"post",endpoint:"payment_methods/credit_cards",data:{_meta:{source:"hosted-fields"},creditCard:c}}).then((function(e){var n=e.creditCards[0],r={nonce:n.nonce,details:n.details,description:n.description,type:n.type,binData:n.binData};f.sendEvent(t,"custom.hosted-fields.tokenization.succeeded"),i([null,r])})).catch((function(e){var n=function(t){var e,n,r,i=t.details&&t.details.httpStatus;if(403===i)e=t;else if(i<500){try{r=(n=h.findRootError(t)).fieldErrors[0].fieldErrors[0].code}catch(t){}v.hasOwnProperty(r)?e=a(n,v[r]):(e=new h(m.HOSTED_FIELDS_FAILED_TOKENIZATION)).details={originalError:t}}else(e=new h(m.HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR)).details={originalError:t};return e}(e);f.sendEvent(t,"custom.hosted-fields.tokenization.failed"),i([n])}))):(i([new h({type:m.HOSTED_FIELDS_FIELDS_INVALID.type,code:m.HOSTED_FIELDS_FIELDS_INVALID.code,message:m.HOSTED_FIELDS_FIELDS_INVALID.message,details:{invalidFieldKeys:p}})]),o.resolve())}))}}function C(t){var e=new p(t),r=u.assembleIFrames(window.parent),i=new o((function(t){n.bus.emit(g.READY_FOR_CLIENT,(function(e){t(new c(e))}))})).then((function(n){return t.fields.number&&t.fields.number.rejectUnsupportedCards&&(e.setSupportedCardTypes(n.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes),e.validateField("number")),n}));return r.forEach((function(t){try{t.braintree.hostedFields.initialize(e)}catch(t){}})),f.sendEvent(i,"custom.hosted-fields.load.succeeded"),n.bus.on(g.TOKENIZATION_REQUEST,(function(t,n){A(i,e)(t,n)})),n.cardForm=e,i}e.exports={initialize:function(t){var e,r=s.getFrameName(),i=document.createElement("form");i.setAttribute("novalidate",!0),i.addEventListener("submit",(function(t){t.preventDefault()})),l(t.configuration.styles,E),e=new d({cardForm:t,type:r}),i.appendChild(e.element),"number"===r&&function(t){var e=I("expiration-month"),r=I("expiration-year"),i=I("cvv"),o=e.querySelector("input"),a=r.querySelector("input"),s=i.querySelector("input");o.addEventListener("keydown",(function(){setTimeout((function(){!function(t){t.style.position="relative",t.style.position="absolute"}(t),n.bus.emit(g.AUTOFILL_EXPIRATION_DATE,{month:o.value,year:a.value,cvv:s.value})}),5)})),t.appendChild(e),t.appendChild(r),t.appendChild(i)}(i),n.bus.on(g.AUTOFILL_EXPIRATION_DATE,T(e)),document.body.appendChild(i),function(){var t;if(!n.placeholderShim)return;if(!(t=document.querySelector("input")))return;n.placeholderShim(t)}()},create:function(){var t=location.hash.slice(1,location.hash.length),e=s.getFrameName();n.bus=new i({channel:t}),n.bus.emit(g.FRAME_READY,{field:e},C)},orchestrate:C,createTokenizationHandler:A,autofillHandler:T}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../client/client":60,"../../lib/analytics":104,"../../lib/assign":106,"../../lib/braintree-error":107,"../../lib/bus":110,"../../lib/convert-to-braintree-error":113,"../../lib/promise":125,"../shared/constants":100,"../shared/errors":101,"./assemble-iframes":81,"./components/field-component":90,"./format-card-request-data":94,"./get-frame-name":95,"./models/credit-card-form":97,"inject-stylesheet":35}],97:[function(t,e,n){(function(n){"use strict";var r=t("./evented-model"),i=t("../../shared/get-card-types"),o=t("card-validator"),a=t("../compare-possible-card-types"),s=t("../../shared/constants"),u=s.events,c=s.externalEvents,l=s.allowedFields,p=!1;function d(t){this._fieldKeys=Object.keys(t.fields).filter((function(t){return l.hasOwnProperty(t)})),this.configuration=t,this.setSupportedCardTypes(t.supportedCardTypes),r.apply(this,arguments),this._fieldKeys.forEach(function(t){var e=g(this,t);this.on("change:"+t+".value",f(this,t)),this.on("change:"+t+".isFocused",h(this,t)),this.on("change:"+t+".isEmpty",m(this,t)),this.on("change:"+t+".isValid",e),this.on("change:"+t+".isPotentiallyValid",e)}.bind(this)),this.on("change:number.value",this._onNumberChange),this.on("change:possibleCardTypes",function(){this.validateField("cvv")}.bind(this)),this.on("change:possibleCardTypes",y(this,"number"))}function f(t,e){return function(){t.set(e+".isEmpty",""===t.get(e+".value")),t.validateField(e)}}function h(t,e){return function(r){p||(p=!0,n.bus.emit(u.CARD_FORM_ENTRY_HAS_BEGUN)),t._fieldKeys.forEach((function(n){n!==e&&t.set(n+".isFocused",!1)})),t.emitEvent(e,r?c.FOCUS:c.BLUR)}}function y(t,e){return function(){t.emitEvent(e,c.CARD_TYPE_CHANGE)}}function m(t,e){return function(){var n=t.get(e+".isEmpty")?c.EMPTY:c.NOT_EMPTY;t.emitEvent(e,n)}}function g(t,e){return function(){t.emitEvent(e,c.VALIDITY_CHANGE)}}function E(t){var e,n,r;return r=(t=t.replace(/[\/\-\s]/g,"")).charAt(0),0===t.length?e=n="":"0"===r||"1"===r?(e=t.slice(0,2),n=t.slice(2)):(e="0"+r,n=t.slice(1)),{month:e,year:n}}function v(t){return _(t).toLowerCase()}function _(t){return t?t.replace(/[-\s]/g,""):""}d.prototype=Object.create(r.prototype),d.prototype.constructor=d,d.prototype.setSupportedCardTypes=function(t){t||(t=i("").map((function(t){return t.type}))),this.supportedCardTypes=t.map(v)},d.prototype.resetAttributes=function(){var t=((new Date).getMonth()+1).toString(),e=(new Date).getFullYear().toString();return this._fieldKeys.reduce(function(n,r){var i=this.configuration.fields[r],o=null!=i.select,a=null!=i.placeholder;return n[r]={value:"",isFocused:!1,isValid:!1,isPotentiallyValid:!0},o&&!a&&("expirationMonth"===r?n[r].value=t:"expirationYear"===r&&(n[r].value=e),"expirationMonth"!==r&&"expirationYear"!==r||(n[r].isValid=!0)),n[r].isEmpty=""===n[r].value,n}.bind(this),{possibleCardTypes:this.getCardTypes("")})},d.prototype.emitEvent=function(t,e){var r,i=this.get("possibleCardTypes"),o=this._fieldKeys.reduce(function(t,e){var n=this.get(e);return t[e]={isEmpty:n.isEmpty,isValid:n.isValid,isPotentiallyValid:n.isPotentiallyValid,isFocused:n.isFocused},t}.bind(this),{});r=i.map((function(t){return{niceType:t.niceType,type:t.type,code:t.code,supported:t.supported}})),n.bus.emit(u.INPUT_EVENT,{merchantPayload:{cards:r,emittedBy:t,fields:o},type:e})},d.prototype._onSplitDateChange=function(){var t,e=this.get("expirationMonth.value"),n=this.get("expirationYear.value"),r=o.expirationMonth(e),i=o.expirationYear(n);r.isValid&&i.isValid?(t=o.expirationDate(e+n),this.set("expirationMonth.isValid",t.isValid),this.set("expirationMonth.isPotentiallyValid",t.isPotentiallyValid),this.set("expirationYear.isValid",t.isValid),this.set("expirationYear.isPotentiallyValid",t.isPotentiallyValid)):(this.set("expirationMonth.isValid",r.isValid),this.set("expirationMonth.isPotentiallyValid",r.isPotentiallyValid),this.set("expirationYear.isValid",i.isValid),this.set("expirationYear.isPotentiallyValid",i.isPotentiallyValid))},d.prototype._onNumberChange=function(t){var e=this.getCardTypes(t),n=this.get("possibleCardTypes");a(e,n)||this.set("possibleCardTypes",e)},d.prototype.validateField=function(t){var e,n=this.get(t+".value"),r=o[t];e="cvv"===t?this._validateCvv(n,{minLength:this.configuration.fields.cvv&&this.configuration.fields.cvv.minlength}):"postalCode"===t?r(n,{minLength:this.configuration.fields.postalCode&&this.configuration.fields.postalCode.minlength}):"expirationDate"===t?r(E(n)):"number"===t?this._validateNumber(n):r(n),"expirationMonth"===t||"expirationYear"===t?this._onSplitDateChange():(this.set(t+".isValid",e.isValid),this.set(t+".isPotentiallyValid",e.isPotentiallyValid))},d.prototype._validateNumber=function(t){var e,n=o.number(t,{luhnValidateUnionPay:!0,maxLength:this.configuration.fields.number.maxCardLength}),r=n.card;return r&&"mastercard"===r.type&&(r.type="master-card"),(e=this.getCardTypes(t).filter((function(t){return r&&t.type===r.type}))[0])&&!1===Boolean(e.supported)&&(delete n.card,n.isValid=!1,n.isPotentiallyValid=!1),n},d.prototype._validateCvv=function(t,e){var n,r;return r=(e=e||{}).minLength,-1===this._fieldKeys.indexOf("number")?o.cvv(t,r||[3,4]):(n=this.get("possibleCardTypes").map((function(t){return t.code.size})),n=n.filter((function(t,e,n){return n.indexOf(t)===e})),o.cvv(t,n))},d.prototype.getCardData=function(){var t,e={},n=[];return-1!==this._fieldKeys.indexOf("number")&&n.push("number"),-1!==this._fieldKeys.indexOf("cvv")&&n.push("cvv"),-1!==this._fieldKeys.indexOf("postalCode")&&n.push("postalCode"),-1!==this._fieldKeys.indexOf("expirationMonth")&&n.push("expirationMonth"),-1!==this._fieldKeys.indexOf("expirationYear")&&n.push("expirationYear"),-1!==this._fieldKeys.indexOf("expirationDate")&&(t=E(this.get("expirationDate.value")),e.expirationMonth=t.month,e.expirationYear=t.year),n.reduce(function(t,e){return t[e]=this.get(e+".value"),t}.bind(this),e),e},d.prototype.isEmpty=function(){return this._fieldKeys.every(function(t){return 0===this.get(t).value.length}.bind(this))},d.prototype.invalidFieldKeys=function(){return this._fieldKeys.filter(function(t){return!this.get(t).isValid}.bind(this))},d.prototype.getCardTypes=function(t){return i(_(t)).map(function(t){var e=v(t.type);return t.supported=this.supportedCardTypes.indexOf(e)>=0,t}.bind(this))},d.prototype._resetCardFormHasStartedBeingFilled=function(){p=!1},e.exports={CreditCardForm:d}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../shared/constants":100,"../../shared/get-card-types":102,"../compare-possible-card-types":82,"./evented-model":98,"card-validator":17}],98:[function(t,e,n){"use strict";var r=Array.prototype.slice;function i(){this._attributes=this.resetAttributes(),this._listeners={}}i.prototype.get=function(t){var e,n,r,i=this._attributes;if(null==t)return i;for(r=t.split("."),e=0;e/g,">"):""}},{}],128:[function(t,e,n){(function(t){"use strict";var n,r=!1;try{n=Object.defineProperty({},"passive",{get:function(){r=!0}}),t.addEventListener("testPassive",null,n),t.removeEventListener("testPassive",null,n)}catch(t){}e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],129:[function(t,e,n){(function(t){"use strict";var n="function"==typeof t.atob?t.atob:r;function r(t){var e,n,r,i,o,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="";if(!new RegExp("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})([=]{1,2})?$").test(t))throw new Error("Non base64 encoded input passed to window.atob polyfill");a=0;do{e=(63&s.indexOf(t.charAt(a++)))<<2|(i=s.indexOf(t.charAt(a++)))>>4&3,n=(15&i)<<4|(o=s.indexOf(t.charAt(a++)))>>2&15,r=(3&o)<<6|63&s.indexOf(t.charAt(a++)),u+=String.fromCharCode(e)+(n?String.fromCharCode(n):"")+(r?String.fromCharCode(r):"")}while(a