text: (this.webpackJsonpfrontend=this.webpackJsonpfrontend||[]).push([[11],{671:function(e,t,n){"use strict";n.d(t,"a",(function(){return m})),n.d(t,"b",(function(){return A})),n.d(t,"c",(function(){return E}));var r,a,o,i=n(1),u=n.n(i);!function(e){e.INITIAL="initial",e.PENDING="pending",e.REJECTED="rejected",e.RESOLVED="resolved"}(r||(r={})),function(e){e.LOADING_STATUS="setLoadingStatus",e.RESET_OPTIONS="resetOptions",e.SET_BRAINTREE_INSTANCE="braintreeInstance"}(a||(a={})),function(e){e.NUMBER="number",e.CVV="cvv",e.EXPIRATION_DATE="expirationDate",e.EXPIRATION_MONTH="expirationMonth",e.EXPIRATION_YEAR="expirationYear",e.POSTAL_CODE="postalCode"}(o||(o={}));var c="data-react-paypal-script-id",s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}function d(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}function f(e){return void 0===e&&(e="paypal"),window[e]}function p(e){var t=e.reactComponentName,n=e.sdkComponentKey,r=e.sdkRequestedComponents,a=void 0===r?"":r,o=e.sdkDataNamespace,i="Unable to render <"+t+" /> because window."+(void 0===o?"paypal":o)+"."+n.charAt(0).toUpperCase().concat(n.substring(1))+" is undefined.";if(!a.includes(n)){var u=[a,n].filter(Boolean).join();i+="\nTo fix the issue, add '"+n+"' to the list of components passed to the parent PayPalScriptProvider:\n`<PayPalScriptProvider options={{ components: '"+u+"'}}>`."}return i}function v(e){return"react-paypal-js-"+function(e){for(var t="",n=0;n<e.length;n++){var r=e[n].charCodeAt(0)*n;e[n+1]&&(r+=e[n+1].charCodeAt(0)*(n-1)),t+=String.fromCharCode(97+Math.abs(r)%26)}return t}(JSON.stringify(e))}function h(e,t){var n;switch(t.type){case a.LOADING_STATUS:return s(s({},e),{loadingStatus:t.value});case a.RESET_OPTIONS:return function(e){var t=self.document.querySelector("script["+c+'="'+e+'"]');(null===t||void 0===t?void 0:t.parentNode)&&t.parentNode.removeChild(t)}(e.options[c]),delete t.value[c],s(s({},e),{loadingStatus:r.PENDING,options:s(s({},t.value),(n={},n[c]=""+v(t.value),n["data-sdk-integration-source"]="react-paypal-js",n))});case a.SET_BRAINTREE_INSTANCE:return s(s({},e),{braintreePayPalCheckoutInstance:t.value});default:return e}}var y=Object(i.createContext)(null);function b(e){if("function"===typeof(null===e||void 0===e?void 0:e.dispatch)&&0!==e.dispatch.length)return e;throw new Error("usePayPalScriptReducer must be used within a PayPalScriptProvider")}function E(){var e=b(Object(i.useContext)(y));return[s(s({},e),{isInitial:e.loadingStatus===r.INITIAL,isPending:e.loadingStatus===r.PENDING,isResolved:e.loadingStatus===r.RESOLVED,isRejected:e.loadingStatus===r.REJECTED}),e.dispatch]}Object(i.createContext)(null);var m=function e(t){var n=t.className,r=void 0===n?"":n,a=t.disabled,o=void 0!==a&&a,c=t.children,v=t.forceReRender,h=void 0===v?[]:v,y=l(t,["className","disabled","children","forceReRender"]),b=o?{opacity:.38}:{},m=(r+" "+(o?"paypal-buttons-disabled":"")).trim(),O=Object(i.useRef)(null),S=Object(i.useRef)(null),g=E()[0],N=g.isResolved,P=g.options,w=Object(i.useState)(null),I=w[0],j=w[1],A=Object(i.useState)(!0),T=A[0],R=A[1],C=Object(i.useState)(null)[1];function k(){null!==S.current&&S.current.close().catch((function(){}))}return Object(i.useEffect)((function(){if(!1===N)return k;var t=f(P["data-namespace"]);if(void 0===t||void 0===t.Buttons)return C((function(){throw new Error(p({reactComponentName:e.displayName,sdkComponentKey:"buttons",sdkRequestedComponents:P.components,sdkDataNamespace:P["data-namespace"]}))})),k;try{S.current=t.Buttons(s(s({},y),{onInit:function(e,t){j(t),"function"===typeof y.onInit&&y.onInit(e,t)}}))}catch(n){return C((function(){throw new Error("Failed to render <PayPalButtons /> component. Failed to initialize:  "+n)}))}return!1===S.current.isEligible()?(R(!1),k):O.current?(S.current.render(O.current).catch((function(e){null!==O.current&&0!==O.current.children.length&&C((function(){throw new Error("Failed to render <PayPalButtons /> component. "+e)}))})),k):k}),d(d([N],h,!0),[y.fundingSource],!1)),Object(i.useEffect)((function(){null!==I&&(!0===o?I.disable().catch((function(){})):I.enable().catch((function(){})))}),[o,I]),u.a.createElement(u.a.Fragment,null,T?u.a.createElement("div",{ref:O,style:b,className:m}):c)};function O(e){var t="https://www.paypal.com/sdk/js";e.sdkBaseURL&&(t=e.sdkBaseURL,delete e.sdkBaseURL);var n=function(e,t){var n="",r="";Array.isArray(e)?e.length>1?(n="*",r=e.toString()):n=e.toString():"string"===typeof e&&e.length>0?n=e:"string"===typeof t&&t.length>0&&(n="*",r=t);return{"merchant-id":n,"data-merchant-id":r}}(e["merchant-id"],e["data-merchant-id"]),r=Object.assign({},e,n),a=Object.keys(r).filter((function(e){return"undefined"!==typeof r[e]&&null!==r[e]&&""!==r[e]})).reduce((function(e,t){var n=r[t].toString();return"data-"===t.substring(0,5)?e.dataAttributes[t]=n:e.queryParams[t]=n,e}),{queryParams:{},dataAttributes:{}}),o=a.queryParams,i=a.dataAttributes;return{url:t+"?"+S(o),dataAttributes:i}}function S(e){var t="";return Object.keys(e).forEach((function(n){0!==t.length&&(t+="&"),t+=n+"="+e[n]})),t}function g(e,t){void 0===t&&(t={});var n=document.createElement("script");return n.src=e,Object.keys(t).forEach((function(e){n.setAttribute(e,t[e]),"data-csp-nonce"===e&&n.setAttribute("nonce",t["data-csp-nonce"])})),n}function N(e,t){if(void 0===t&&(t=w()),j(e,t),"undefined"===typeof window)return t.resolve(null);var n=O(e),r=n.url,a=n.dataAttributes,o=a["data-namespace"]||"paypal",i=I(o);return function(e,t){var n=document.querySelector('script[src="'+e+'"]');if(null===n)return null;var r=g(e,t),a=Object.assign({},n.dataset);if(delete a.uidAuto,Object.keys(a).length!==Object.keys(r.dataset).length)return null;var o=!0;return Object.keys(a).forEach((function(e){a[e]!==r.dataset[e]&&(o=!1)})),o?n:null}(r,a)&&i?t.resolve(i):P({url:r,attributes:a},t).then((function(){var e=I(o);if(e)return e;throw new Error("The window."+o+" global variable is not available.")}))}function P(e,t){void 0===t&&(t=w()),j(e,t);var n=e.url,r=e.attributes;if("string"!==typeof n||0===n.length)throw new Error("Invalid url.");if("undefined"!==typeof r&&"object"!==typeof r)throw new Error("Expected attributes to be an object.");return new t((function(e,t){if("undefined"===typeof window)return e();!function(e){var t=e.url,n=e.attributes,r=e.onSuccess,a=e.onError,o=g(t,n);o.onerror=a,o.onload=r,document.head.insertBefore(o,document.head.firstElementChild)}({url:n,attributes:r,onSuccess:function(){return e()},onError:function(){return t(new Error('The script "'+n+'" failed to load.'))}})}))}function w(){if("undefined"===typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function I(e){return window[e]}function j(e,t){if("object"!==typeof e||null===e)throw new Error("Expected an options object.");if("undefined"!==typeof t&&"function"!==typeof t)throw new Error("Expected PromisePonyfill to be a function.")}m.displayName="PayPalButtons";(function e(t){var n=t.className,r=void 0===n?"":n,a=t.children,o=l(t,["className","children"]),c=E()[0],d=c.isResolved,v=c.options,h=Object(i.useRef)(null),y=Object(i.useState)(!0),b=y[0],m=y[1],O=Object(i.useState)(null)[1];return Object(i.useEffect)((function(){if(!1!==d){var t=f(v["data-namespace"]);if(void 0===t||void 0===t.Marks)return O((function(){throw new Error(p({reactComponentName:e.displayName,sdkComponentKey:"marks",sdkRequestedComponents:v.components,sdkDataNamespace:v["data-namespace"]}))}));!function(e){var t=h.current;if(!t||!e.isEligible())return m(!1);t.firstChild&&t.removeChild(t.firstChild),e.render(t).catch((function(e){null!==t&&0!==t.children.length&&O((function(){throw new Error("Failed to render <PayPalMarks /> component. "+e)}))}))}(t.Marks(s({},o)))}}),[d,o.fundingSource]),u.a.createElement(u.a.Fragment,null,b?u.a.createElement("div",{ref:h,className:r}):a)}).displayName="PayPalMarks";var A=function(e){var t,n=e.options,o=void 0===n?{"client-id":"test"}:n,l=e.children,d=e.deferLoading,f=void 0!==d&&d,p=Object(i.useReducer)(h,{options:s(s({},o),(t={},t[c]=""+v(o),t["data-sdk-integration-source"]="react-paypal-js",t)),loadingStatus:f?r.INITIAL:r.PENDING}),b=p[0],E=p[1];return Object(i.useEffect)((function(){if(!1===f&&b.loadingStatus===r.INITIAL)return E({type:a.LOADING_STATUS,value:r.PENDING});if(b.loadingStatus===r.PENDING){var e=!0;return N(b.options).then((function(){e&&E({type:a.LOADING_STATUS,value:r.RESOLVED})})).catch((function(){e&&E({type:a.LOADING_STATUS,value:r.REJECTED})})),function(){e=!1}}}),[b.options,f,b.loadingStatus]),u.a.createElement(y.Provider,{value:s(s({},b),{dispatch:E})},l)}}}]);