@idonatedev/idonate-sdk 1.2.0-dev8 → 1.2.0-dev9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CLIENT_HEADERS = exports.CARD_CONNECT_DEFAULT_STYLE = exports.DEFAULT_APP_NAME = exports.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL = exports.FALLBACK_CF_TURNSTILE_SITE_KEY = exports.FALLBACK_PC_SCRIPT_ID = exports.FALLBACK_PC_SCRIPT_URL = exports.SANDBOX_APPLE_PAY_URL = exports.APPLE_PAY_URL = exports.SPREEDLY_TOKENIZER_URL = exports.SANDBOX_CARD_CONNECT_BASE_URL = exports.PRODUCTION_CARD_CONNECT_BASE_URL = exports.SANDBOX_BASE_URL = exports.PRODUCTION_BASE_URL = exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = '1.2.0-dev8';
4
+ exports.SDK_VERSION = '1.2.0-dev9';
5
5
  exports.PRODUCTION_BASE_URL = 'https://secure-api.idonate.com';
6
6
  exports.SANDBOX_BASE_URL = 'https://api.qa-idonate.com';
7
7
  exports.PRODUCTION_CARD_CONNECT_BASE_URL = 'https://boltgw.cardconnect.com:8443';
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = '1.2.0-dev8';
1
+ export const SDK_VERSION = '1.2.0-dev9';
2
2
  export const PRODUCTION_BASE_URL = 'https://secure-api.idonate.com';
3
3
  export const SANDBOX_BASE_URL = 'https://api.qa-idonate.com';
4
4
  export const PRODUCTION_CARD_CONNECT_BASE_URL = 'https://boltgw.cardconnect.com:8443';
@@ -629,7 +629,7 @@ export class CardConnectTokenizer extends Tokenizer {
629
629
  return iframe;
630
630
  }
631
631
  static generateCardConnectCss(styles, layout = 'single-line', isDesktopSafari = false) {
632
- var _a, _b, _c, _d;
632
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
633
633
  const css = [];
634
634
  if (layout === 'two-line') {
635
635
  css.push('html,form,body{margin:0;padding:0;}');
@@ -672,10 +672,13 @@ export class CardConnectTokenizer extends Tokenizer {
672
672
  }
673
673
  if (layout === 'two-line') {
674
674
  css.push('input#ccnumfield{width:100%;display:block;margin-bottom:8px;}');
675
- css.push('input#ccexpiryfieldmonth{width:20%;}');
676
- css.push('input#ccexpiryfieldyear{width:24%;}');
677
- css.push('input#cccvvfield{width:calc(56% - 20px);}');
678
- if ((_a = styles.input) === null || _a === void 0 ? void 0 : _a.borderRadius) {
675
+ const twoLinePadding = ((_a = styles.twoLine) === null || _a === void 0 ? void 0 : _a.padding) || ((_b = styles.input) === null || _b === void 0 ? void 0 : _b.padding) || '10px';
676
+ const twoLineFontSize = ((_c = styles.twoLine) === null || _c === void 0 ? void 0 : _c.fontSize) || ((_d = styles.input) === null || _d === void 0 ? void 0 : _d.fontSize) || '14px';
677
+ const twoLineTextAlign = ((_e = styles.twoLine) === null || _e === void 0 ? void 0 : _e.textAlign) || 'left';
678
+ css.push(`input#ccexpiryfieldmonth{width:25%;padding:${twoLinePadding};font-size:${twoLineFontSize};text-align:${twoLineTextAlign};}`);
679
+ css.push(`input#ccexpiryfieldyear{width:35%;padding:${twoLinePadding};font-size:${twoLineFontSize};text-align:${twoLineTextAlign};}`);
680
+ css.push(`input#cccvvfield{width:calc(40% - 16px);padding:${twoLinePadding};font-size:${twoLineFontSize};text-align:${twoLineTextAlign};margin-left:-4px;}`);
681
+ if ((_f = styles.input) === null || _f === void 0 ? void 0 : _f.borderRadius) {
679
682
  css.push(`input{border-radius:${styles.input.borderRadius};}`);
680
683
  }
681
684
  }
@@ -684,7 +687,7 @@ export class CardConnectTokenizer extends Tokenizer {
684
687
  css.push('select#ccexpirymonth{width:16%;margin:0;margin-right:-12px;}');
685
688
  css.push('select#ccexpiryyear{width:20%;}');
686
689
  css.push('input#cccvvfield{width:20%;margin:0;margin-left:-12px;}');
687
- if ((_b = styles.input) === null || _b === void 0 ? void 0 : _b.borderRadius) {
690
+ if ((_g = styles.input) === null || _g === void 0 ? void 0 : _g.borderRadius) {
688
691
  css.push(`input#ccnumfield{border-radius:${styles.input.borderRadius} 0 0 ${styles.input.borderRadius};border-right:none;}`);
689
692
  css.push('select#ccexpirymonth{border-radius:0;border-right:none;}');
690
693
  css.push('select#ccexpiryyear{border-radius:0;border-right:none;}');
@@ -702,7 +705,7 @@ export class CardConnectTokenizer extends Tokenizer {
702
705
  css.push(`select#ccexpirymonth{width:15%;margin-right:${marginRight};}`);
703
706
  css.push(`select#ccexpiryyear{width:20%;margin-right:${marginRight};}`);
704
707
  css.push('input#cccvvfield{width:15%;}');
705
- if ((_c = styles.input) === null || _c === void 0 ? void 0 : _c.borderRadius) {
708
+ if ((_h = styles.input) === null || _h === void 0 ? void 0 : _h.borderRadius) {
706
709
  css.push(`input,select{border-radius:${styles.input.borderRadius};}`);
707
710
  }
708
711
  }
@@ -718,7 +721,7 @@ export class CardConnectTokenizer extends Tokenizer {
718
721
  if (focusStyles.length > 0) {
719
722
  css.push(`input:focus{${focusStyles.join(';')};}`);
720
723
  css.push(`select:focus{${focusStyles.join(';')};}`);
721
- if (isConnected && ((_d = styles.input) === null || _d === void 0 ? void 0 : _d.border)) {
724
+ if (isConnected && ((_j = styles.input) === null || _j === void 0 ? void 0 : _j.border)) {
722
725
  css.push(`input#ccnumfield:focus{border:${styles.input.border};${focusStyles.join(';')};}`);
723
726
  css.push(`select#ccexpirymonth:focus{border:${styles.input.border};${focusStyles.join(';')};}`);
724
727
  css.push(`select#ccexpiryyear:focus{border:${styles.input.border};${focusStyles.join(';')};}`);
@@ -27,6 +27,11 @@ export const DEFAULT_UNIFIED_STYLES = {
27
27
  flexWrap: 'nowrap',
28
28
  rowGap: '1rem',
29
29
  },
30
+ twoLine: {
31
+ padding: '',
32
+ fontSize: '',
33
+ textAlign: '',
34
+ },
30
35
  };
31
36
  export function mergeStyles(defaults, userStyles) {
32
37
  if (!userStyles)
@@ -36,6 +41,7 @@ export function mergeStyles(defaults, userStyles) {
36
41
  focus: Object.assign(Object.assign({}, defaults.focus), userStyles.focus),
37
42
  error: Object.assign(Object.assign({}, defaults.error), userStyles.error),
38
43
  container: Object.assign(Object.assign({}, defaults.container), userStyles.container),
44
+ twoLine: Object.assign(Object.assign({}, defaults.twoLine), userStyles.twoLine),
39
45
  };
40
46
  }
41
47
  export function getContainerStylesForLayout(baseStyles, layout = 'single-line') {
@@ -53,6 +53,11 @@ export interface TokenizerStylingComplete {
53
53
  flexWrap?: string;
54
54
  rowGap?: string;
55
55
  };
56
+ twoLine: {
57
+ padding: string;
58
+ fontSize: string;
59
+ textAlign: string;
60
+ };
56
61
  }
57
62
  type DeepPartial<T> = T extends object ? {
58
63
  [P in keyof T]?: DeepPartial<T[P]>;
@@ -635,7 +635,7 @@ class CardConnectTokenizer extends Tokenizer_1.Tokenizer {
635
635
  return iframe;
636
636
  }
637
637
  static generateCardConnectCss(styles, layout = 'single-line', isDesktopSafari = false) {
638
- var _a, _b, _c, _d;
638
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
639
639
  const css = [];
640
640
  if (layout === 'two-line') {
641
641
  css.push('html,form,body{margin:0;padding:0;}');
@@ -678,10 +678,13 @@ class CardConnectTokenizer extends Tokenizer_1.Tokenizer {
678
678
  }
679
679
  if (layout === 'two-line') {
680
680
  css.push('input#ccnumfield{width:100%;display:block;margin-bottom:8px;}');
681
- css.push('input#ccexpiryfieldmonth{width:20%;}');
682
- css.push('input#ccexpiryfieldyear{width:24%;}');
683
- css.push('input#cccvvfield{width:calc(56% - 20px);}');
684
- if ((_a = styles.input) === null || _a === void 0 ? void 0 : _a.borderRadius) {
681
+ const twoLinePadding = ((_a = styles.twoLine) === null || _a === void 0 ? void 0 : _a.padding) || ((_b = styles.input) === null || _b === void 0 ? void 0 : _b.padding) || '10px';
682
+ const twoLineFontSize = ((_c = styles.twoLine) === null || _c === void 0 ? void 0 : _c.fontSize) || ((_d = styles.input) === null || _d === void 0 ? void 0 : _d.fontSize) || '14px';
683
+ const twoLineTextAlign = ((_e = styles.twoLine) === null || _e === void 0 ? void 0 : _e.textAlign) || 'left';
684
+ css.push(`input#ccexpiryfieldmonth{width:25%;padding:${twoLinePadding};font-size:${twoLineFontSize};text-align:${twoLineTextAlign};}`);
685
+ css.push(`input#ccexpiryfieldyear{width:35%;padding:${twoLinePadding};font-size:${twoLineFontSize};text-align:${twoLineTextAlign};}`);
686
+ css.push(`input#cccvvfield{width:calc(40% - 16px);padding:${twoLinePadding};font-size:${twoLineFontSize};text-align:${twoLineTextAlign};margin-left:-4px;}`);
687
+ if ((_f = styles.input) === null || _f === void 0 ? void 0 : _f.borderRadius) {
685
688
  css.push(`input{border-radius:${styles.input.borderRadius};}`);
686
689
  }
687
690
  }
@@ -690,7 +693,7 @@ class CardConnectTokenizer extends Tokenizer_1.Tokenizer {
690
693
  css.push('select#ccexpirymonth{width:16%;margin:0;margin-right:-12px;}');
691
694
  css.push('select#ccexpiryyear{width:20%;}');
692
695
  css.push('input#cccvvfield{width:20%;margin:0;margin-left:-12px;}');
693
- if ((_b = styles.input) === null || _b === void 0 ? void 0 : _b.borderRadius) {
696
+ if ((_g = styles.input) === null || _g === void 0 ? void 0 : _g.borderRadius) {
694
697
  css.push(`input#ccnumfield{border-radius:${styles.input.borderRadius} 0 0 ${styles.input.borderRadius};border-right:none;}`);
695
698
  css.push('select#ccexpirymonth{border-radius:0;border-right:none;}');
696
699
  css.push('select#ccexpiryyear{border-radius:0;border-right:none;}');
@@ -708,7 +711,7 @@ class CardConnectTokenizer extends Tokenizer_1.Tokenizer {
708
711
  css.push(`select#ccexpirymonth{width:15%;margin-right:${marginRight};}`);
709
712
  css.push(`select#ccexpiryyear{width:20%;margin-right:${marginRight};}`);
710
713
  css.push('input#cccvvfield{width:15%;}');
711
- if ((_c = styles.input) === null || _c === void 0 ? void 0 : _c.borderRadius) {
714
+ if ((_h = styles.input) === null || _h === void 0 ? void 0 : _h.borderRadius) {
712
715
  css.push(`input,select{border-radius:${styles.input.borderRadius};}`);
713
716
  }
714
717
  }
@@ -724,7 +727,7 @@ class CardConnectTokenizer extends Tokenizer_1.Tokenizer {
724
727
  if (focusStyles.length > 0) {
725
728
  css.push(`input:focus{${focusStyles.join(';')};}`);
726
729
  css.push(`select:focus{${focusStyles.join(';')};}`);
727
- if (isConnected && ((_d = styles.input) === null || _d === void 0 ? void 0 : _d.border)) {
730
+ if (isConnected && ((_j = styles.input) === null || _j === void 0 ? void 0 : _j.border)) {
728
731
  css.push(`input#ccnumfield:focus{border:${styles.input.border};${focusStyles.join(';')};}`);
729
732
  css.push(`select#ccexpirymonth:focus{border:${styles.input.border};${focusStyles.join(';')};}`);
730
733
  css.push(`select#ccexpiryyear:focus{border:${styles.input.border};${focusStyles.join(';')};}`);
@@ -32,6 +32,11 @@ exports.DEFAULT_UNIFIED_STYLES = {
32
32
  flexWrap: 'nowrap',
33
33
  rowGap: '1rem',
34
34
  },
35
+ twoLine: {
36
+ padding: '',
37
+ fontSize: '',
38
+ textAlign: '',
39
+ },
35
40
  };
36
41
  function mergeStyles(defaults, userStyles) {
37
42
  if (!userStyles)
@@ -41,6 +46,7 @@ function mergeStyles(defaults, userStyles) {
41
46
  focus: Object.assign(Object.assign({}, defaults.focus), userStyles.focus),
42
47
  error: Object.assign(Object.assign({}, defaults.error), userStyles.error),
43
48
  container: Object.assign(Object.assign({}, defaults.container), userStyles.container),
49
+ twoLine: Object.assign(Object.assign({}, defaults.twoLine), userStyles.twoLine),
44
50
  };
45
51
  }
46
52
  function getContainerStylesForLayout(baseStyles, layout = 'single-line') {
@@ -53,6 +53,11 @@ export interface TokenizerStylingComplete {
53
53
  flexWrap?: string;
54
54
  rowGap?: string;
55
55
  };
56
+ twoLine: {
57
+ padding: string;
58
+ fontSize: string;
59
+ textAlign: string;
60
+ };
56
61
  }
57
62
  type DeepPartial<T> = T extends object ? {
58
63
  [P in keyof T]?: DeepPartial<T[P]>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idonatedev/idonate-sdk",
3
3
  "author": "iDonate",
4
- "version": "1.2.0-dev8",
4
+ "version": "1.2.0-dev9",
5
5
  "sideEffects": false,
6
6
  "description": "iDonate Web SDK",
7
7
  "engines": {
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.idonate=t():e.idonate=t()}(self,()=>(()=>{"use strict";var e={115:function(e,t){var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};function n(){const e=new Date;return new Promise((t,i)=>{!function n(){void 0!==window.grecaptcha&&void 0!==window.grecaptcha.render?t(window.grecaptcha):(new Date).valueOf()-e.valueOf()>15e3?i(new Error("grecaptcha not loaded after 15 seconds")):setTimeout(n,250)}()})}Object.defineProperty(t,"__esModule",{value:!0}),t.RecaptchaElement=void 0,t.injectScript=function(e){if(void 0!==window.grecaptcha)throw new Error("grecaptcha is already defined");const t=document.createElement("script");t.src="https://www.google.com/recaptcha/api.js?render=explicit",t.async=!0,t.defer=!0,t.onload=e||null,"interactive"===document.readyState||"complete"===document.readyState?document.body.appendChild(t):window.addEventListener("DOMContentLoaded",()=>{document.body.appendChild(t)})},t.wrapElement=function(e,t,i){const n=Object.assign(Object.assign({},i||{}),{sitekey:t}),o=new r(e,n);return o.render(),o},t.wrapElementWithThrow=function(e,t,n){return i(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},n||{}),{sitekey:t}),o=new r(e,i);return yield o.render(),o})};class r{constructor(e,t){this.container=e,this.params=t,this.executeResolveQueue=[]}render(){return void 0!==this.widgetId&&console.warn("rendering an already-rendered widget"),n().then(e=>{this.widgetId=e.render(this.container,Object.assign(Object.assign({},this.params),{callback:e=>{var t;this.resolvedToken=e,null===(t=this.executeResolveQueue.pop())||void 0===t||t(e)},"expired-callback":()=>{this.resolvedToken=void 0}}))})}resolveToken(){return new Promise((e,t)=>{n().then(i=>{if("invisible"!==this.params.size){const n=i.getResponse();return n?e(n):t(new Error("checkbox recaptcha is not checked"))}this.executeResolveQueue.push(e),void 0!==this.resolvedToken&&(this.resolvedToken=void 0,i.reset(this.widgetId)),i.execute(this.widgetId)}).catch(e=>{t(e)})})}}t.RecaptchaElement=r},122:function(e,t){var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.handleCFChallenge=void 0;let n=null;t.handleCFChallenge=(e,t)=>new Promise((e,r)=>i(void 0,void 0,void 0,function*(){var i,o,a;try{const r=null===window||void 0===window?void 0:window.document;if(!r||!window)throw new Error("document is not present on window");const o=r.createElement("div"),a=r.createElement("div"),s=i=>{var n;null===(n=null==i?void 0:i.render)||void 0===n||n.call(i,"#iDonateTurnstileBox",{sitekey:t.config.turnstileSiteKey,callback(t,i){o.remove(),e({token:t,preClearance:i})}})};if(window.idonateTurnstileLoadedHandler=()=>{const e=window.turnstile;a.innerHTML="",e&&(n=e),s(e)},o.setAttribute("id","idonateTurnstileWrapper"),o.style.position="fixed",o.style.top="0",o.style.bottom="0",o.style.left="0",o.style.right="0",o.style.backgroundColor="rgba(0,0,0,0.9)",o.style.transition="all 400ms",o.style.display="flex",o.style.flexDirection="column",o.style.padding="40px 30px",o.style.opacity="0",o.style.color="white",o.style.fontFamily="sans-serif",o.style.zIndex="1000",o.innerHTML='<h1 id="idonateTurnstileVerificationHeader">Last tiny step before we submit your payment:</h1>',a.setAttribute("id","iDonateTurnstileBox"),o.append(a),r.body.append(o),n)s(n);else{const e=r.createElement("script");a.innerHTML="loading ...",e.src=t.config.turnstileCdnUrl+"?render=explicit&onload=idonateTurnstileLoadedHandler",r.body.append(e)}null===(i=a.scrollIntoView)||void 0===i||i.call(a),o.style.opacity="1"}catch(e){null===(o=null===console||void 0===console?void 0:console.error)||void 0===o||o.call(console,e),null===(a=null===console||void 0===console?void 0:console.warn)||void 0===a||a.call(console,"iDonate SDK: Could not handle request, please reload the page and try again"),r(null)}}))},138:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.PayPalTokenizer=void 0;const r=i(415),o=i(367),a="paypal-sdk-script";class s extends r.Tokenizer{constructor(e,t,i,n){var r,o;super(),this.gateway=e,this.containerId=t,this.configContext=n,this.mode="credit_card";const a=e.config;if(!(null==a?void 0:a.client_id))throw new Error("PayPal gateway configuration missing client_id");this.clientId=a.client_id,this.sandboxMode=null!==(r=a.sandbox_mode)&&void 0!==r&&r,this.currency=i.currency||"USD",this.amount=i.amount,this.enableVenmo=null===(o=i.enableVenmo)||void 0===o||o,this.locale=i.locale||"en_US",this.onCreateOrder=i.onCreateOrder,this.organizationId=n.organizationId,this.embedId=n.embedId,this.clientConfig=n.clientConfig}static create(e,t,i){return n(this,void 0,void 0,function*(){const n=new s(e,t.containerId,t,i);return yield n.init(),n})}init(){return n(this,void 0,void 0,function*(){if(this.containerEl=document.getElementById(this.containerId),!this.containerEl)throw new Error(`Container element not found: ${this.containerId}`);return this.containerEl.innerHTML="",Object.assign(this.containerEl.style,{display:"flex",flexDirection:"column",gap:"0.5rem",alignItems:"stretch"}),new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("PayPal SDK initialization timeout"))},1e4);this.loadPayPalSDK().then(()=>(clearTimeout(i),this.renderButtons())).then(()=>{this.emit("ready"),this.emit("validation",{isValid:!0}),e()}).catch(e=>{clearTimeout(i),this.emit("error",new o.TokenizationError("Failed to initialize PayPal","INIT_FAILED")),t(e)})})})}loadPayPalSDK(){return n(this,void 0,void 0,function*(){if(window.paypal)return Promise.resolve();if(document.getElementById(a))return this.waitForPayPalGlobal();const e=new URLSearchParams({"client-id":this.clientId,currency:this.currency,intent:"capture"}),t=["card","paylater"];this.enableVenmo?e.set("enable-funding","venmo"):t.push("venmo"),e.set("disable-funding",t.join(","));const i=document.createElement("script");return i.id=a,i.src=`https://www.paypal.com/sdk/js?${e.toString()}`,i.async=!0,new Promise((e,t)=>{i.onload=()=>{this.waitForPayPalGlobal().then(e).catch(t)},i.onerror=()=>{t(new Error("Failed to load PayPal SDK"))},document.head.appendChild(i)})})}waitForPayPalGlobal(){return n(this,arguments,void 0,function*(e=5e3){const t=Date.now();for(;Date.now()-t<e;){if(window.paypal)return Promise.resolve();yield new Promise(e=>setTimeout(e,100))}throw new Error("Timeout waiting for PayPal SDK to load")})}renderButtons(){return n(this,void 0,void 0,function*(){if(!window.paypal)throw new Error("PayPal SDK not loaded");if(!this.containerEl)throw new Error("Container element not found");this.paypalButtonContainer=document.createElement("div"),this.paypalButtonContainer.id=`${this.containerId}-buttons`,this.paypalButtonContainer.style.minHeight="40px",this.containerEl.appendChild(this.paypalButtonContainer),yield this.renderPayPalButtons()})}renderPayPalButtons(){return n(this,void 0,void 0,function*(){if(!window.paypal||!this.paypalButtonContainer)return;const e=window.paypal.Buttons({createOrder:()=>this.createOrder(),onApprove:e=>this.handleApprove(e),onCancel:e=>this.handleCancel(e),onError:e=>this.handleError(e,"PayPal error"),style:{layout:"vertical",shape:"rect",height:40}});yield e.render(this.paypalButtonContainer)})}createOrder(){const e=`${this.clientConfig.embedApiBaseUrl}/payment/paypal/create-order`;let t,i=this.currency;if(this.onCreateOrder){const e=this.onCreateOrder();t=e.amount,i=e.currency||this.currency}else t=this.amount;if(void 0===t||t<=0){const e=new Error("Amount is required to create PayPal order");return this.handleError(e,"Order creation failed"),Promise.reject(e)}const n={payment_gateway_id:this.gateway.id,currency:i,amount:t};return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.json()}).then(e=>{if(!e.orderId)throw new Error("Order creation failed: missing orderId");return this.paymentTransactionId=e.payment_transaction_id,this.paymentMethodId=e.payment_method_id,e.orderId}).catch(e=>{throw this.handleError(e,"Order creation failed"),e})}handleApprove(e){return n(this,void 0,void 0,function*(){const t={token:e.orderID,lastFour:e.orderID.slice(-4),provider:"paypal_checkout",paymentMethodId:this.paymentMethodId,paymentTransactionId:this.paymentTransactionId};this.cachedToken=t,this.emit("validation",{isValid:!0,hasToken:!0}),this.emit("tokenReady",t)})}handleCancel(e){this.emit("error",new o.TokenizationError("Payment cancelled by user","USER_CANCELLED"))}handleError(e,t){const i=(null==e?void 0:e.message)||(null==e?void 0:e.toString())||"Unknown error";this.emit("error",new o.TokenizationError(`${t}: ${i}`,(null==e?void 0:e.code)||"PAYPAL_ERROR"))}tokenize(e){return n(this,void 0,void 0,function*(){if(!this.isReady)throw new Error("Tokenizer not initialized");if(this.cachedToken)return this.cachedToken;throw new o.TokenizationError("No PayPal order approved. User must click PayPal or Venmo button to complete payment.","NO_TOKEN")})}validate(){return n(this,void 0,void 0,function*(){return{isValid:!0,errors:[]}})}clear(){this.cachedToken=void 0,this.emit("validation",{isValid:!0,hasToken:!1})}focus(e){}destroy(){this.containerEl&&(this.containerEl.innerHTML=""),this.eventHandlers.clear(),this.cachedToken=void 0}hasToken(){return!!this.cachedToken}getToken(){return this.cachedToken||null}get tokenizationMode(){return"auto"}}t.PayPalTokenizer=s},156:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buildCashPaymentPayload=function(e,t){var i,n,r,o,a,s,d,l,c,u,h,p,m,y,b,v,f;const g={country:t.billingAddress.country,address1:t.billingAddress.address1,address2:t.billingAddress.address2,city:t.billingAddress.city,state:t.billingAddress.state,zip_code:t.billingAddress.zip},E={title:t.billingContact.salutation,first_name:t.billingContact.firstName,middle_name:t.billingContact.middleName,last_name:t.billingContact.lastName,company_name:t.billingContact.company,email:t.billingContact.email,home_phone:t.billingContact.primaryPhone,timezone:(new Intl.DateTimeFormat).resolvedOptions().timeZone},_={payment_method_id:t.paymentMethodId,payment_transaction_id:t.paymentTransactionId,gateway_id:t.paymentGatewayId,amount:t.paymentAmount,type:"cash",frequency:t.recurringFrequency,start_date:t.recurringStart,end_date:t.recurringEnd,retain_on_success:t.retainPaymentMethod},N={organization_id:e,campaign_id:t.campaignId,reference_code:t.referenceCode,double_the_donation_company_id:t.corporateMatchingId,donor_id:t.donorId,hide_name:t.anonymousOptIn,show_name_to_fundraiser:t.showNameToFundraiserOptIn,email_opt_in:t.emailOptIn,donor_paid_fee:t.donorPaidFeeAmount,designation_note:t.designationNote,gift_id:t.giftId,gift_extra:t.giftExtra,gift_skipped:t.giftSkipped,p2p_fundraiser_id:t.p2pFundraiserId,p2p_fundraiser_comment:t.p2pFundraiserComment,organization_event_id:t.organizationEventId,advocate_id:t.advocateId,advocacy_program_id:t.advocacyProgramId,advocacy_team_id:t.advocacyTeamId,page_id:t.landingPageId,embed_id:t.embedId,tribute_definition_id:null===(i=t.tribute)||void 0===i?void 0:i.tributeDefinitionId,tribute_recipient_first_name:null===(n=t.tribute)||void 0===n?void 0:n.tributeFirstName,tribute_recipient_last_name:null===(r=t.tribute)||void 0===r?void 0:r.tributeLastName,tribute_address1:null===(o=t.tribute)||void 0===o?void 0:o.tributeAddress1,tribute_address2:null===(a=t.tribute)||void 0===a?void 0:a.tributeAddress2,tribute_city:null===(s=t.tribute)||void 0===s?void 0:s.tributeCity,tribute_state:null===(d=t.tribute)||void 0===d?void 0:d.tributeState,tribute_postal_code:null===(l=t.tribute)||void 0===l?void 0:l.tributePostalCode,tribute_country:null===(c=t.tribute)||void 0===c?void 0:c.tributeCountry,tribute_from_name:null===(u=t.tribute)||void 0===u?void 0:u.tributeFromName,tribute_recipient_email:null===(h=t.tribute)||void 0===h?void 0:h.tributeRecipientEmail,honorees:null===(p=t.tribute)||void 0===p?void 0:p.honorees,tribute_send_card:null===(m=t.tribute)||void 0===m?void 0:m.tributeSendCard,tribute_include_amount:null===(y=t.tribute)||void 0===y?void 0:y.tributeIncludeAmount,tribute_skipped:null===(b=t.tribute)||void 0===b?void 0:b.tributeSkipped,tribute_type:null===(v=t.tribute)||void 0===v?void 0:v.tributeType,useOnBillingAddress:null===(f=t.tribute)||void 0===f?void 0:f.useOnBillingAddress,embed_referer:window.location.href,converted_to_recurring:t.convertedToRecurring};t.designations?N.designations=t.designations:N.designations=[],t.designationId&&N.designations.push({id:t.designationId,amount:t.paymentAmount});const I={};return t.utm&&(t.utm.campaign&&(I.utm_campaign=t.utm.campaign),t.utm.content&&(I.utm_content=t.utm.content),t.utm.medium&&(I.utm_medium=t.utm.medium),t.utm.source&&(I.utm_source=t.utm.source),t.utm.term&&(I.utm_term=t.utm.term)),t.customerMeta&&[1,2,3,4,5].forEach(e=>{const i=`custom_note_${e}`;t.customerMeta[i]&&(N[i]=t.customerMeta[i],delete t.customerMeta[i])}),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},N),g),E),_),I),{customer_meta:t.customerMeta||{},recaptcha_token:t.recaptchaToken,recaptcha_type:t.recaptchaType})},t.buildDonationResult=function(e){let t,i,n,r,o;return e._raw_response.transaction&&(o=e._raw_response.transaction),e._raw_response.schedule&&(r=e._raw_response.schedule),e._raw_response.donor&&(n=e._raw_response.donor),e._raw_response.designation&&(i=e._raw_response.designation),e._raw_response.campaign&&(t=e._raw_response.campaign),Object.assign(Object.assign({},e),{campaign:t,designation:i,donor:n,schedule:r,transaction:o})},t.buildCreatePaymentMethodPayload=function(e){return{gateway_id:e.paymentGatewayId,backend_name:e.backendName,payment_method_type:e.paymentMethodType,payment_method_token:e.paymentMethodToken,donor_id:e.donorId,first_name:e.contact.firstName,last_name:e.contact.lastName,company:e.contact.company,email:e.contact.email,phone:e.contact.primaryPhone,country:e.address.country,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip_code:e.address.zip,embed_id:e.embedId,recaptcha_token:e.recaptchaToken,recaptcha_type:e.recaptchaType}},t.collapseClientErrors=function(e){return new n.ClientError(e.map(e=>e.message).join("\n "),{_rawPayload:e})},t.buildCreatePaymentMethodResult=function(e){return Object.assign(Object.assign({},e),{paymentMethodId:e._raw_response.result.id})},t.unpackSpreedlyResponse=function(e){return e.json().then(e=>{if(e.errors)throw new n.ClientError(e.errors.map(e=>e.message).join("\n "),e);return e})},t.extractSpreedlyToken=function(e){if(!e.transaction||!e.transaction.payment_method)throw new n.ClientError("Payment Method not tokenized.");return e.transaction.payment_method.token};const n=i(523)},247:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CLIENT_HEADERS=t.CARD_CONNECT_DEFAULT_STYLE=t.DEFAULT_APP_NAME=t.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL=t.FALLBACK_CF_TURNSTILE_SITE_KEY=t.FALLBACK_PC_SCRIPT_ID=t.FALLBACK_PC_SCRIPT_URL=t.SANDBOX_APPLE_PAY_URL=t.APPLE_PAY_URL=t.SPREEDLY_TOKENIZER_URL=t.SANDBOX_CARD_CONNECT_BASE_URL=t.PRODUCTION_CARD_CONNECT_BASE_URL=t.SANDBOX_BASE_URL=t.PRODUCTION_BASE_URL=t.SDK_VERSION=void 0,t.SDK_VERSION="1.2.0-dev8",t.PRODUCTION_BASE_URL="https://secure-api.idonate.com",t.SANDBOX_BASE_URL="https://api.qa-idonate.com",t.PRODUCTION_CARD_CONNECT_BASE_URL="https://boltgw.cardconnect.com:8443",t.SANDBOX_CARD_CONNECT_BASE_URL="https://boltgw-uat.cardconnect.com",t.SPREEDLY_TOKENIZER_URL="https://core.spreedly.com/v1/payment_methods.json",t.APPLE_PAY_URL="https://apple-pay-gateway.apple.com/paymentservices/paymentSession",t.SANDBOX_APPLE_PAY_URL="https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession",t.FALLBACK_PC_SCRIPT_URL="https://p.idonate.com/r",t.FALLBACK_PC_SCRIPT_ID="_3fd4dad26e8c277bc50fb2ddf8233b50bc8d9704",t.FALLBACK_CF_TURNSTILE_SITE_KEY="0x4AAAAAAAxuRxNZTvX8shIj",t.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL="https://challenges.cloudflare.com/turnstile/v0/api.js",t.DEFAULT_APP_NAME="unnamed-sdk-client",t.CARD_CONNECT_DEFAULT_STYLE="\nbody {\n margin: 0;\n}\n\nform {\n display: flex;\n}\n\nlabel#cccardlabel {\n display: none;\n}\n\nbr {\n display: none;\n}\n\nlabel#cccvvlabel {\n display: none;\n}\n\nlabel#ccexpirylabel {\n display: none;\n}\n\ninput {\n padding: 10px;\n}\n\nselect {\n padding: 10px;\n font-size: 14px;\n color: #8b959d;\n}\n\nselect#ccexpirymonth {\n margin-right: -30px;\n border: 1px solid #b6b8ba;\n border-right: 0;\n}\n\ninput#ccnumfield {\n width: 70%;\n border: 1px solid #b6b8ba;\n border-right: 0;\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n font-size: 14px;\n color: #8b959d;\n}\n\nselect#ccexpiryyear {\n border: 1px solid #b6b8ba;\n border-right: 0;\n}\n\ninput#cccvvfield {\n border: 1px solid #b6b8ba;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n font-size: 14px;\n color: #8b959d;\n}\n".replace(/\s+/gi," "),t.CLIENT_HEADERS={"User-Agent":("undefined"!=typeof navigator?navigator.userAgent:"undefined"!=typeof process&&process.version?`Node.js/${process.version} (${process.platform})`:"unknown-runtime")+` idonate-sdk@${t.SDK_VERSION}`,"Content-Type":"application/json"}},367:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TokenizationError=void 0;class i extends Error{constructor(e,t){super("string"==typeof e?e:e.map(e=>e.message||e).join(", ")),this.name="TokenizationError",this.code=t,Array.isArray(e)?this.errors=e.map(e=>({field:e.field||e.attribute||"unknown",message:e.message||e.error||String(e),code:e.code||e.key})):this.errors=[{field:"cardNumber",message:e,code:t}]}}t.TokenizationError=i},415:function(e,t,i){var n,r=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=n(e),a=0;a<i.length;a++)"default"!==i[a]&&r(t,e,i[a]);return o(t,e),t}),s=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.Tokenizer=void 0;const d=i(631);t.Tokenizer=class{constructor(){this.mode="credit_card",this.eventHandlers=new Map,this._isReady=!1}get isReady(){return this._isReady}getMode(){return this.mode}on(e,t){if(this.eventHandlers.has(e)||this.eventHandlers.set(e,new Set),this.eventHandlers.get(e).add(t),"ready"===e&&this._isReady)try{t()}catch(e){}}off(e,t){const i=this.eventHandlers.get(e);i&&i.delete(t)}emit(e,t){"ready"===e&&(this._isReady=!0);const i=this.eventHandlers.get(e);i&&i.forEach(e=>{try{e(t)}catch(e){}})}isCardData(e){return"credit_card"===this.mode}isBankAccountData(e){return"bank_account"===this.mode}normalizeCardType(e){return{visa:"visa",mastercard:"mastercard",master:"mastercard",americanexpress:"amex",amex:"amex",discover:"discover",dinersclub:"diners",diners:"diners",jcb:"jcb"}[e.toLowerCase().replace(/[\s-_]/g,"")]||"unknown"}addExpiryFormatter(e){e&&(e.addEventListener("input",e=>{const t=e.target;t.value=(0,d.formatExpiryInput)(t.value),this.emit("change",{field:"expiry"})}),e.addEventListener("keypress",e=>{const t=String.fromCharCode(e.which);/[0-9\/]/.test(t)||8===e.which||e.preventDefault()}))}parseExpiry(e){return(null==e?void 0:e.value)?(0,d.parseExpiryDate)(e.value):null}applyInputStyles(e,t,i){const n=t.input,r="0"===t.container.gap;if(Object.assign(e.style,{height:n.height,padding:n.padding,fontSize:n.fontSize,fontFamily:n.fontFamily,backgroundColor:n.backgroundColor,color:n.color,boxSizing:"border-box",width:"100%",transition:n.transition}),r&&i){switch(e.style.borderTop=n.border,e.style.borderBottom=n.border,i){case"left":case"middle":e.style.borderLeft=n.border,e.style.borderRight="none";break;case"right":e.style.borderLeft=n.border,e.style.borderRight=n.border}e.style.borderRadius=(0,d.getConnectedBorderRadius)(n.borderRadius,i,!0)}else e.style.border=n.border,e.style.borderRadius=n.borderRadius;(0,d.addFocusHandlers)(e,t)}generateFieldIds(e){return{numberId:`${e}-card-number`,expiryId:`${e}-expiry`,cvvId:`${e}-cvv`}}static create(e,t,n){return s(this,void 0,void 0,function*(){switch(e.backend_name){case"spreedly":{const{SpreedlyTokenizer:r}=yield Promise.resolve().then(()=>a(i(875)));return r.create(e,t,n)}case"card_connect":{const{CardConnectTokenizer:r}=yield Promise.resolve().then(()=>a(i(601)));return r.create(e,t,n)}case"paypal_checkout":{const{PayPalTokenizer:r}=yield Promise.resolve().then(()=>a(i(138)));return r.create(e,t,n)}default:throw new Error(`Unsupported payment backend: ${e.backend_name}`)}})}}},454:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_UNIFIED_STYLES=void 0,t.mergeStyles=function(e,t){return t?{input:Object.assign(Object.assign({},e.input),t.input),focus:Object.assign(Object.assign({},e.focus),t.focus),error:Object.assign(Object.assign({},e.error),t.error),container:Object.assign(Object.assign({},e.container),t.container)}:e},t.getContainerStylesForLayout=function(e,t="single-line"){return"two-line"===t?Object.assign(Object.assign({},e),{container:Object.assign(Object.assign({},e.container),{flexWrap:"wrap",rowGap:e.container.rowGap||e.container.gap})}):e},t.DEFAULT_UNIFIED_STYLES={input:{height:"40px",padding:"10px 12px",fontSize:"14px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',color:"#333",backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",boxSizing:"border-box",width:"100%",transition:"all 0.15s ease-in-out"},focus:{borderColor:"#007bff",outline:"none",boxShadow:"0 0 0 2px rgba(0, 123, 255, 0.25)"},error:{borderColor:"#dc3545"},container:{display:"flex",gap:"1rem",alignItems:"center",flexWrap:"nowrap",rowGap:"1rem"}}},472:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.receiveEmbedData=function(){let e;return new Promise((t,i)=>{window.parent||i("Cannot receive data without parent"),e=e=>{let i;try{i=JSON.parse(e.data)}catch(e){return}i.embedData&&t(i.embedData)},window.addEventListener("message",e)}).then(t=>(window.removeEventListener("message",e),t))},t.sanitizeString=o,t.sanitizeArray=a,t.sanitizeObject=s,t.splitName=function(e){const t=e.split(" ");return{firstName:t.slice(0,-1).join(" ")||"NOT GIVEN",lastName:t.slice(-1).join(" ")}},t.parseResponse=function(e,t){return e.json().then(i=>{const o=[];if(200!==e.status&&(void 0!==i.result&&Object.keys(i.result).forEach(e=>{o.push(new n.ClientError(e+": "+i.result[e].join("\n "),{field:e}))}),void 0!==i.messages?i.messages.forEach(e=>{"error"===e.category&&o.push(new n.ClientError(e.message))}):o.push(new n.ClientError(i.message))),t&&t.throwErrors&&o.length)throw(0,r.collapseClientErrors)(o);return{errors:o,_raw_response:i}})};const n=i(523),r=i(156);function o(e){if(!e)return e;const t=document.createElement("div");t.innerHTML=e;const i=Array.from(t.getElementsByTagName("script"));for(const e of i)e.parentNode&&e.parentNode.removeChild(e);return t.innerHTML}function a(e){return e.map(s)}function s(e){if(null==e)return e;if(Array.isArray(e))return a(e);if("string"==typeof e)return o(e);if("object"==typeof e){const t={};for(const[i,n]of Object.entries(e))Array.isArray(n)?t[i]=a(n):t[i]="string"==typeof n?o(n):s(n);return t}return e}},523:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ClientError=t.ApplePaySessionStatus=void 0,t.ApplePaySessionStatus={STATUS_SUCCESS:"undefined"!=typeof ApplePaySession?ApplePaySession.STATUS_SUCCESS:1,STATUS_FAILURE:"undefined"!=typeof ApplePaySession?ApplePaySession.STATUS_FAILURE:0};class i extends Error{constructor(e,t){super(e),this.message=e,this.details=t,Error.captureStackTrace&&Error.captureStackTrace(this,i)}}t.ClientError=i},578:function(e,t,i){var n,r=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=n(e),a=0;a<i.length;a++)"default"!==i[a]&&r(t,e,i[a]);return o(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.iats=t.TokenizationError=t.PayPalTokenizer=t.CardConnectTokenizer=t.SpreedlyTokenizer=t.Tokenizer=void 0;const s=a(i(903));t.iats=s;var d=i(415);Object.defineProperty(t,"Tokenizer",{enumerable:!0,get:function(){return d.Tokenizer}});var l=i(875);Object.defineProperty(t,"SpreedlyTokenizer",{enumerable:!0,get:function(){return l.SpreedlyTokenizer}});var c=i(601);Object.defineProperty(t,"CardConnectTokenizer",{enumerable:!0,get:function(){return c.CardConnectTokenizer}});var u=i(138);Object.defineProperty(t,"PayPalTokenizer",{enumerable:!0,get:function(){return u.PayPalTokenizer}});var h=i(367);Object.defineProperty(t,"TokenizationError",{enumerable:!0,get:function(){return h.TokenizationError}})},592:function(e,t){var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.fetchSpreedlySecurityArgs=function(e,t,n){return i(this,void 0,void 0,function*(){if(!e.enableSpreedlySecureTokenization)throw new Error("Secure tokenization is not enabled");const r=()=>i(this,void 0,void 0,function*(){const i=yield fetch(`${e.embedApiBaseUrl}/spreedly/security-args`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,embed_id:n})});if(!i.ok)throw new Error(`Security args request failed: ${i.status}`);return i.json()});try{return yield r()}catch(e){if(e instanceof TypeError&&e.message.includes("fetch"))return yield new Promise(e=>setTimeout(e,1e3)),r();throw e}})}},601:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CardConnectTokenizer=void 0;const o=i(415),a=i(367),s=r(i(731)),d=i(454),l=i(799),c=i(631);class u extends o.Tokenizer{constructor(e,t,i,n="credit_card",r=!1,o="single-line"){super(),this.iframeUrl=t,this.containerId=i,this.layout=o,this.enableTestMode=!1,this.mode=n,this.enableTestMode=r,this.iframe=e;const a=new URL(t);this.expectedOrigin=`${a.protocol}//${a.host}`,this.currentValidationState={isValid:!1,cardNumber:{isValid:!1,isEmpty:!0},cvv:{isValid:!1,isEmpty:!0},expiry:{isValid:!1,isEmpty:!0}}}static create(e,t,i){return n(this,void 0,void 0,function*(){var n;if("bank_account"===t.mode&&"CA"===t.bankCountry)throw new Error("CardConnect does not support Canadian bank accounts");let r="single-line";if("responsive"===t.layout){const e=document.getElementById(t.containerId);r=((null==e?void 0:e.offsetWidth)||0)<(t.responsiveBreakpoint||l.RESPONSIVE_BREAKPOINT)?"two-line":"single-line"}else"two-line"===t.layout&&(r="two-line");const o=Object.assign(Object.assign({},t),{layout:r});let a=(null===(n=e.config)||void 0===n?void 0:n.base_url)||i.clientConfig.cardConnectBaseUrl;i.cardConnectBaseUrl=a;const s=(0,d.mergeStyles)(d.DEFAULT_UNIFIED_STYLES,t.styling),c=u.generateIframeUrl(a,o),h=u.createIframe(c,s),p=new u(h,c,t.containerId,t.mode||"credit_card",t.enableTestMode||!1,r);return p.createInternalElements(o),yield p.init(),p})}createInternalElements(e){const t=document.getElementById(e.containerId);if(!t)throw new Error(`Container element not found: ${e.containerId}`);this.containerEl=t,t.innerHTML="";const i=(0,d.getContainerStylesForLayout)((0,d.mergeStyles)(d.DEFAULT_UNIFIED_STYLES,e.styling),this.layout);Object.assign(t.style,i.container),"bank_account"===this.mode?this.createBankAccountFields(t,i):this.createCreditCardFields(t,i)}createCreditCardFields(e,t){if(this.iframe.style.width="100%","two-line"===this.layout||"responsive"===this.layout){const e=t.input.height||"40px";this.iframe.style.height=`calc((${e}) * 2 + 10px)`}else this.iframe.style.height=t.input.height||"40px";this.iframe.style.border="none",this.iframe.style.display="block",e.appendChild(this.iframe)}createBankAccountFields(e,t){this.iframe.style.display="none","two-line"===this.layout?(this.accountTypeEl=(0,c.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:"1",minWidth:l.BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,t,"left"),e.appendChild(this.accountTypeEl),this.routingNumberEl=(0,c.createInputElement)(`${this.containerId}-routing`,"text","Routing *",9),Object.assign(this.routingNumberEl.style,{flex:"1",minWidth:l.BANK_FIELD_FLEX.routingNumber.minWidth}),this.applyInputStyles(this.routingNumberEl,t,"right"),e.appendChild(this.routingNumberEl),this.accountNumberEl=(0,c.createInputElement)(`${this.containerId}-account`,"text","Account Number *",17),Object.assign(this.accountNumberEl.style,{flex:"1",flexBasis:"100%",minWidth:l.BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,t),e.appendChild(this.accountNumberEl)):(this.routingNumberEl=(0,c.createInputElement)(`${this.containerId}-routing`,"text","Routing *",9),Object.assign(this.routingNumberEl.style,{flex:l.BANK_FIELD_FLEX.routingNumber.flex,minWidth:l.BANK_FIELD_FLEX.routingNumber.minWidth}),this.applyInputStyles(this.routingNumberEl,t,"left"),e.appendChild(this.routingNumberEl),this.accountNumberEl=(0,c.createInputElement)(`${this.containerId}-account`,"text","Account Number *",17),Object.assign(this.accountNumberEl.style,{flex:l.BANK_FIELD_FLEX.accountNumber.flex,minWidth:l.BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,t,"middle"),e.appendChild(this.accountNumberEl),this.accountTypeEl=(0,c.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:l.BANK_FIELD_FLEX.accountType.flex,minWidth:l.BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,t,"right"),e.appendChild(this.accountTypeEl))}init(){return n(this,void 0,void 0,function*(){return"bank_account"===this.mode?(this.enableTestMode&&setTimeout(()=>{this.routingNumberEl&&(this.routingNumberEl.value="021000021",this.routingNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountNumberEl&&(this.accountNumberEl.value="9876543210",this.accountNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountTypeEl&&(this.accountTypeEl.value="checking",this.accountTypeEl.dispatchEvent(new Event("change",{bubbles:!0})))},100),this.emit("ready"),Promise.resolve()):new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("CardConnect initialization timeout"))},l.INIT_TIMEOUT);this.messageHandler=e=>{e.origin===this.expectedOrigin&&this.handleMessage(e)},window.addEventListener("message",this.messageHandler),this.iframe.onload=()=>{clearTimeout(i),this.enableTestMode&&this.mode,this.emit("ready"),e()},this.iframe.onerror=()=>{clearTimeout(i),t(new Error("Failed to load CardConnect iframe"))}})})}tokenize(e){return n(this,void 0,void 0,function*(){if(!this.isReady)throw new Error("Tokenizer not initialized");if("credit_card"===this.mode&&this.hasToken()){const e=this.getToken();if(e)return e}return"bank_account"===this.mode||this.isBankAccountData(e)?this.tokenizeBankAccountInternal(e):this.tokenizeCardInternal(e)})}tokenizeCardInternal(e){return n(this,void 0,void 0,function*(){return this.cachedTokenResult&&"0"===this.cachedTokenResult.errorCode?{token:this.cachedTokenResult.token,lastFour:this.cachedTokenResult.token.slice(-4),cardType:this.normalizeCardType("unknown"),provider:"cardconnect"}:(this.tokenizationPromise||(this.tokenizationPromise=new Promise((e,t)=>{this.tokenizationResolve=e,this.tokenizationReject=t;const i=setTimeout(()=>{this.tokenizationPromise=void 0,this.tokenizationResolve=void 0,this.tokenizationReject=void 0,t(new a.TokenizationError("Tokenization timeout - ensure all card fields are filled in iframe","TIMEOUT"))},l.TOKENIZE_TIMEOUT),n=e=>{clearTimeout(i),this.off("tokenization",n)};this.on("tokenization",n)})),this.tokenizationPromise)})}tokenizeBankAccountInternal(e){return n(this,void 0,void 0,function*(){var e,t,i;const n=null===(e=this.routingNumberEl)||void 0===e?void 0:e.value,r=null===(t=this.accountNumberEl)||void 0===t?void 0:t.value,o=(null===(i=this.accountTypeEl)||void 0===i?void 0:i.value)||"checking";if(!n||!r)throw new a.TokenizationError("Routing number and account number are required","VALIDATION_ERROR");if(!(0,c.validateRoutingNumber)(n))throw new a.TokenizationError("Invalid routing number","VALIDATION_ERROR");if(!(0,c.validateAccountNumber)(r))throw new a.TokenizationError("Invalid account number","VALIDATION_ERROR");const d=new URL(this.iframeUrl).origin,l=new s.default({});return l.cardConnectBaseUrl=d,{token:(yield u.tokenizeBankAccount(n,r,l)).token,lastFour:r.slice(-4),accountType:o,paymentMethodType:"bank_account",provider:"cardconnect"}})}validate(){return n(this,void 0,void 0,function*(){if(!this.isReady)throw new Error("Tokenizer not initialized");return"bank_account"===this.mode?this.validateBankAccountInternal():this.validateCardInternal()})}validateCardInternal(){return n(this,void 0,void 0,function*(){const e=[];return this.currentValidationState.cardNumber?this.currentValidationState.cardNumber.isEmpty?e.push({field:"cardNumber",message:"Card number is required"}):this.currentValidationState.cardNumber.isValid||e.push({field:"cardNumber",message:"Invalid card number"}):e.push({field:"cardNumber",message:"Card number is required"}),this.currentValidationState.expiry?this.currentValidationState.expiry.isEmpty?e.push({field:"expiry",message:"Expiry date is required"}):this.currentValidationState.expiry.isValid||e.push({field:"expiry",message:"Invalid expiry date"}):e.push({field:"expiry",message:"Expiry date is required"}),this.currentValidationState.cvv?this.currentValidationState.cvv.isEmpty?e.push({field:"cvv",message:"CVV is required"}):this.currentValidationState.cvv.isValid||e.push({field:"cvv",message:"Invalid CVV"}):e.push({field:"cvv",message:"CVV is required"}),{isValid:this.currentValidationState.isValid,errors:e}})}validateBankAccountInternal(){return n(this,void 0,void 0,function*(){var e,t;const i=[];return(null===(e=this.routingNumberEl)||void 0===e?void 0:e.value)?(0,c.validateRoutingNumber)(this.routingNumberEl.value)||i.push({field:"routingNumber",message:"Invalid routing number"}):i.push({field:"routingNumber",message:"Routing number is required"}),(null===(t=this.accountNumberEl)||void 0===t?void 0:t.value)?(0,c.validateAccountNumber)(this.accountNumberEl.value)||i.push({field:"accountNumber",message:"Invalid account number"}):i.push({field:"accountNumber",message:"Account number is required"}),{isValid:0===i.length,errors:i}})}clear(){var e;"bank_account"===this.mode?(this.routingNumberEl&&(this.routingNumberEl.value=""),this.accountNumberEl&&(this.accountNumberEl.value=""),this.accountTypeEl&&(this.accountTypeEl.value="checking")):null===(e=this.iframe.contentWindow)||void 0===e||e.postMessage({action:"clear"},this.expectedOrigin),this.currentValidationState={isValid:!1,cardNumber:{isValid:!1,isEmpty:!0},cvv:{isValid:!1,isEmpty:!0},expiry:{isValid:!1,isEmpty:!0}},this.emit("validation",this.currentValidationState)}focus(e){var t;if("bank_account"===this.mode)"routingNumber"===e&&this.routingNumberEl?this.routingNumberEl.focus():"accountNumber"===e&&this.accountNumberEl&&this.accountNumberEl.focus();else{const i={cardNumber:"number",cvv:"cvv",expiry:"expiry"}[e];i&&(null===(t=this.iframe.contentWindow)||void 0===t||t.postMessage({action:"focus",field:i},this.expectedOrigin))}}destroy(){this.messageHandler&&window.removeEventListener("message",this.messageHandler),this.containerEl&&(this.containerEl.innerHTML=""),this.eventHandlers.clear()}hasToken(){var e,t;return"credit_card"===this.mode&&"0"===(null===(e=this.cachedTokenResult)||void 0===e?void 0:e.errorCode)&&!!(null===(t=this.cachedTokenResult)||void 0===t?void 0:t.token)}getToken(){var e;if("credit_card"===this.mode&&"0"===(null===(e=this.cachedTokenResult)||void 0===e?void 0:e.errorCode)){const e=this.cachedTokenResult.cardType?this.normalizeCardType(this.cachedTokenResult.cardType):this.normalizeCardType("unknown");return{token:this.cachedTokenResult.token,lastFour:this.cachedTokenResult.last4||this.cachedTokenResult.token.slice(-4),cardType:e,provider:"cardconnect"}}return null}get tokenizationMode(){return"credit_card"===this.mode?"auto":"manual"}handleMessage(e){try{const t="string"==typeof e.data?JSON.parse(e.data):e.data;if(t.token&&void 0!==t.errorCode)if(this.cachedTokenResult=t,this.emit("tokenization",t),"0"===t.errorCode){const e=t.cardType?this.normalizeCardType(t.cardType):this.normalizeCardType("unknown");t.cardType&&e!==this.currentCardType&&(this.currentCardType=e,this.emit("cardTypeChange",{cardType:e}));const i={token:t.token,lastFour:t.last4||t.token.slice(-4),cardType:e,provider:"cardconnect"};this.tokenizationResolve&&(this.tokenizationResolve(i),this.tokenizationPromise=void 0,this.tokenizationResolve=void 0,this.tokenizationReject=void 0),this.currentValidationState={isValid:!0,cardNumber:{isValid:!0,isEmpty:!1},cvv:{isValid:!0,isEmpty:!1},expiry:{isValid:!0,isEmpty:!1}},this.emit("validation",{isValid:!0}),this.emit("tokenReady",i)}else this.tokenizationReject&&(this.tokenizationReject(new a.TokenizationError(t.errorMessage||"Tokenization failed",t.errorCode||"UNKNOWN")),this.tokenizationPromise=void 0,this.tokenizationResolve=void 0,this.tokenizationReject=void 0);if("validation"!==t.event&&void 0===t.validationError||this.handleValidationMessage(t),"focus"!==t.event&&"blur"!==t.event||this.emit(t.event,{field:t.data}),("input"===t.event||"change"===t.event)&&(this.emit("change",{field:t.data}),t.cardType)){const e=this.normalizeCardType(t.cardType);e!==this.currentCardType&&(this.currentCardType=e,this.emit("cardTypeChange",{cardType:e}))}}catch(e){}}handleValidationMessage(e){var t,i,n,r,o,a;if(e.validationError){const t=e.validationError.toLowerCase();t.includes("card")||t.includes("number")?this.currentValidationState.cardNumber={isValid:!1,isEmpty:!1}:t.includes("cvv")||t.includes("security")?this.currentValidationState.cvv={isValid:!1,isEmpty:!1}:(t.includes("expir")||t.includes("month")||t.includes("year"))&&(this.currentValidationState.expiry={isValid:!1,isEmpty:!1}),this.currentValidationState.isValid=!1,this.emit("validation",this.currentValidationState)}else this.currentValidationState.isValid=null!==(i=null===(t=this.currentValidationState.cardNumber)||void 0===t?void 0:t.isValid)&&void 0!==i&&i&&null!==(r=null===(n=this.currentValidationState.cvv)||void 0===n?void 0:n.isValid)&&void 0!==r&&r&&null!==(a=null===(o=this.currentValidationState.expiry)||void 0===o?void 0:o.isValid)&&void 0!==a&&a}static generateIframeUrl(e,t){const i=new URLSearchParams({invalidinputevent:"true",enhancedresponse:"true",useexpiry:"true",usecvv:"true",formatinput:"true",unique:"true",norsa:"true",placeholder:"Card Number *",placeholdercvv:"CVV",invalidcreditcardevent:"true",invalidexpiry:"true",invalidcvv:"true"});"two-line"===t.layout?(i.set("useexpiryfield","true"),i.set("orientation","horizontal"),i.set("placeholdermonth","MM"),i.set("placeholderyear","YYYY")):(i.set("orientation","horizontal"),i.set("placeholdermonth","MM"),i.set("placeholderyear","YYYY"));const n=(0,d.mergeStyles)(d.DEFAULT_UNIFIED_STYLES,t.styling),r="undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)&&!/Chrome/.test(navigator.userAgent)&&!/Mobile/.test(navigator.userAgent),o=u.generateCardConnectCss(n,t.layout||"single-line",r),a=[];return i.forEach((e,t)=>{a.push(`${encodeURIComponent(t)}=${encodeURIComponent(e)}`)}),a.push(`css=${o}`),`${e}/itoke/ajax-tokenizer.html?${a.join("&")}`}static createIframe(e,t){const i=document.createElement("iframe");return i.src=e,i.style.width="100%",i.style.height=t.input.height,i.style.border="none",i.style.overflow="hidden",i.style.display="block",i.style.minWidth="0",t.container&&(Object.entries(t.container).forEach(([e,t])=>{"height"!==e&&"width"!==e&&(i.style[e]=t)}),t.container.width&&(i.style.width=t.container.width)),i.setAttribute("scrolling","no"),i.setAttribute("title","Secure card input"),i.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),i}static generateCardConnectCss(e,t="single-line",i=!1){var n,r,o,a;const s=[];"two-line"===t?(s.push("html,form,body{margin:0;padding:0;}"),s.push("label{display:none;}"),s.push("br{display:none;}")):(s.push("body{margin:0;padding:0;display:flex;align-items:center;}"),s.push("form{margin:0;padding:0;display:flex;width:100%;align-items:center;}"),s.push("label{display:none;}"),s.push("br{display:none;}"));const d="0"===e.container.gap,l=d?"0":e.container.gap||"1rem";if(e.input){const t=[];e.input.height&&t.push(`height:${e.input.height}`),e.input.padding&&t.push(`padding:${e.input.padding}`),e.input.fontSize&&t.push(`font-size:${e.input.fontSize}`),e.input.fontFamily&&t.push(`font-family:${e.input.fontFamily}`),e.input.border&&t.push(`border:${e.input.border}`),e.input.backgroundColor&&t.push(`background-color:${e.input.backgroundColor}`),e.input.color&&t.push(`color:${e.input.color}`),t.push("box-sizing:border-box");const n=t.join(";");s.push(`input{${n};}`),i?s.push(`select{${n};-webkit-appearance:none;appearance:none;}`):s.push(`select{${n};}`)}if("two-line"===t)s.push("input#ccnumfield{width:100%;display:block;margin-bottom:8px;}"),s.push("input#ccexpiryfieldmonth{width:20%;}"),s.push("input#ccexpiryfieldyear{width:24%;}"),s.push("input#cccvvfield{width:calc(56% - 20px);}"),(null===(n=e.input)||void 0===n?void 0:n.borderRadius)&&s.push(`input{border-radius:${e.input.borderRadius};}`);else if(d)s.push("input#ccnumfield{width:44%;margin:0;}"),s.push("select#ccexpirymonth{width:16%;margin:0;margin-right:-12px;}"),s.push("select#ccexpiryyear{width:20%;}"),s.push("input#cccvvfield{width:20%;margin:0;margin-left:-12px;}"),(null===(r=e.input)||void 0===r?void 0:r.borderRadius)?(s.push(`input#ccnumfield{border-radius:${e.input.borderRadius} 0 0 ${e.input.borderRadius};border-right:none;}`),s.push("select#ccexpirymonth{border-radius:0;border-right:none;}"),s.push("select#ccexpiryyear{border-radius:0;border-right:none;}"),s.push(`input#cccvvfield{border-radius:0 ${e.input.borderRadius} ${e.input.borderRadius} 0;}`)):(s.push("input#ccnumfield{border-right:none;}"),s.push("select#ccexpirymonth{border-right:none;}"),s.push("select#ccexpiryyear{border-right:none;}"));else{const t="0"===l?"0":"8px";s.push(`input#ccnumfield{width:50%;margin-right:${t};}`),s.push(`select#ccexpirymonth{width:15%;margin-right:${t};}`),s.push(`select#ccexpiryyear{width:20%;margin-right:${t};}`),s.push("input#cccvvfield{width:15%;}"),(null===(o=e.input)||void 0===o?void 0:o.borderRadius)&&s.push(`input,select{border-radius:${e.input.borderRadius};}`)}if(e.focus){const t=[];e.focus.borderColor&&t.push(`border-color:${e.focus.borderColor}`),e.focus.outline&&t.push("outline:none"),e.focus.boxShadow&&t.push(`box-shadow:${e.focus.boxShadow}`),t.length>0&&(s.push(`input:focus{${t.join(";")};}`),s.push(`select:focus{${t.join(";")};}`),d&&(null===(a=e.input)||void 0===a?void 0:a.border)&&(s.push(`input#ccnumfield:focus{border:${e.input.border};${t.join(";")};}`),s.push(`select#ccexpirymonth:focus{border:${e.input.border};${t.join(";")};}`),s.push(`select#ccexpiryyear:focus{border:${e.input.border};${t.join(";")};}`)))}if(e.error){const t=[];e.error.borderColor&&t.push(`border-color:${e.error.borderColor}`),e.error.backgroundColor&&t.push(`background-color:${e.error.backgroundColor}`),t.length>0&&s.push(`.error{${t.join(";")};}`)}return encodeURIComponent(s.join(""))}static tokenizeBankAccount(e,t,i){return fetch(`${i.cardConnectBaseUrl}/cardsecure/api/v1/ccn/tokenize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:`${e}/${t}`,unique:!0})}).then(e=>e.json())}}t.CardConnectTokenizer=u},611:(e,t,i)=>{var n;i.r(t),i.d(t,{NIL:()=>P,parse:()=>b,stringify:()=>c,v1:()=>y,v3:()=>w,v4:()=>S,v5:()=>k,validate:()=>s,version:()=>O});var r=new Uint8Array(16);function o(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)}const a=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,s=function(e){return"string"==typeof e&&a.test(e)};for(var d=[],l=0;l<256;++l)d.push((l+256).toString(16).substr(1));const c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(d[e[t+0]]+d[e[t+1]]+d[e[t+2]]+d[e[t+3]]+"-"+d[e[t+4]]+d[e[t+5]]+"-"+d[e[t+6]]+d[e[t+7]]+"-"+d[e[t+8]]+d[e[t+9]]+"-"+d[e[t+10]]+d[e[t+11]]+d[e[t+12]]+d[e[t+13]]+d[e[t+14]]+d[e[t+15]]).toLowerCase();if(!s(i))throw TypeError("Stringified UUID is invalid");return i};var u,h,p=0,m=0;const y=function(e,t,i){var n=t&&i||0,r=t||new Array(16),a=(e=e||{}).node||u,s=void 0!==e.clockseq?e.clockseq:h;if(null==a||null==s){var d=e.random||(e.rng||o)();null==a&&(a=u=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==s&&(s=h=16383&(d[6]<<8|d[7]))}var l=void 0!==e.msecs?e.msecs:Date.now(),y=void 0!==e.nsecs?e.nsecs:m+1,b=l-p+(y-m)/1e4;if(b<0&&void 0===e.clockseq&&(s=s+1&16383),(b<0||l>p)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=l,m=y,h=s;var v=(1e4*(268435455&(l+=122192928e5))+y)%4294967296;r[n++]=v>>>24&255,r[n++]=v>>>16&255,r[n++]=v>>>8&255,r[n++]=255&v;var f=l/4294967296*1e4&268435455;r[n++]=f>>>8&255,r[n++]=255&f,r[n++]=f>>>24&15|16,r[n++]=f>>>16&255,r[n++]=s>>>8|128,r[n++]=255&s;for(var g=0;g<6;++g)r[n+g]=a[g];return t||c(r)},b=function(e){if(!s(e))throw TypeError("Invalid UUID");var t,i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i};function v(e,t,i){function n(e,n,r,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],i=0;i<e.length;++i)t.push(e.charCodeAt(i));return t}(e)),"string"==typeof n&&(n=b(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+e.length);if(a.set(n),a.set(e,n.length),(a=i(a))[6]=15&a[6]|t,a[8]=63&a[8]|128,r){o=o||0;for(var s=0;s<16;++s)r[o+s]=a[s];return r}return c(a)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function f(e){return 14+(e+64>>>9<<4)+1}function g(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function E(e,t,i,n,r,o){return g((a=g(g(t,e),g(n,o)))<<(s=r)|a>>>32-s,i);var a,s}function _(e,t,i,n,r,o,a){return E(t&i|~t&n,e,t,r,o,a)}function N(e,t,i,n,r,o,a){return E(t&n|i&~n,e,t,r,o,a)}function I(e,t,i,n,r,o,a){return E(t^i^n,e,t,r,o,a)}function T(e,t,i,n,r,o,a){return E(i^(t|~n),e,t,r,o,a)}const w=v("v3",48,function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var i=0;i<t.length;++i)e[i]=t.charCodeAt(i)}return function(e){for(var t=[],i=32*e.length,n="0123456789abcdef",r=0;r<i;r+=8){var o=e[r>>5]>>>r%32&255,a=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);t.push(a)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[f(t)-1]=t;for(var i=1732584193,n=-271733879,r=-1732584194,o=271733878,a=0;a<e.length;a+=16){var s=i,d=n,l=r,c=o;i=_(i,n,r,o,e[a],7,-680876936),o=_(o,i,n,r,e[a+1],12,-389564586),r=_(r,o,i,n,e[a+2],17,606105819),n=_(n,r,o,i,e[a+3],22,-1044525330),i=_(i,n,r,o,e[a+4],7,-176418897),o=_(o,i,n,r,e[a+5],12,1200080426),r=_(r,o,i,n,e[a+6],17,-1473231341),n=_(n,r,o,i,e[a+7],22,-45705983),i=_(i,n,r,o,e[a+8],7,1770035416),o=_(o,i,n,r,e[a+9],12,-1958414417),r=_(r,o,i,n,e[a+10],17,-42063),n=_(n,r,o,i,e[a+11],22,-1990404162),i=_(i,n,r,o,e[a+12],7,1804603682),o=_(o,i,n,r,e[a+13],12,-40341101),r=_(r,o,i,n,e[a+14],17,-1502002290),i=N(i,n=_(n,r,o,i,e[a+15],22,1236535329),r,o,e[a+1],5,-165796510),o=N(o,i,n,r,e[a+6],9,-1069501632),r=N(r,o,i,n,e[a+11],14,643717713),n=N(n,r,o,i,e[a],20,-373897302),i=N(i,n,r,o,e[a+5],5,-701558691),o=N(o,i,n,r,e[a+10],9,38016083),r=N(r,o,i,n,e[a+15],14,-660478335),n=N(n,r,o,i,e[a+4],20,-405537848),i=N(i,n,r,o,e[a+9],5,568446438),o=N(o,i,n,r,e[a+14],9,-1019803690),r=N(r,o,i,n,e[a+3],14,-187363961),n=N(n,r,o,i,e[a+8],20,1163531501),i=N(i,n,r,o,e[a+13],5,-1444681467),o=N(o,i,n,r,e[a+2],9,-51403784),r=N(r,o,i,n,e[a+7],14,1735328473),i=I(i,n=N(n,r,o,i,e[a+12],20,-1926607734),r,o,e[a+5],4,-378558),o=I(o,i,n,r,e[a+8],11,-2022574463),r=I(r,o,i,n,e[a+11],16,1839030562),n=I(n,r,o,i,e[a+14],23,-35309556),i=I(i,n,r,o,e[a+1],4,-1530992060),o=I(o,i,n,r,e[a+4],11,1272893353),r=I(r,o,i,n,e[a+7],16,-155497632),n=I(n,r,o,i,e[a+10],23,-1094730640),i=I(i,n,r,o,e[a+13],4,681279174),o=I(o,i,n,r,e[a],11,-358537222),r=I(r,o,i,n,e[a+3],16,-722521979),n=I(n,r,o,i,e[a+6],23,76029189),i=I(i,n,r,o,e[a+9],4,-640364487),o=I(o,i,n,r,e[a+12],11,-421815835),r=I(r,o,i,n,e[a+15],16,530742520),i=T(i,n=I(n,r,o,i,e[a+2],23,-995338651),r,o,e[a],6,-198630844),o=T(o,i,n,r,e[a+7],10,1126891415),r=T(r,o,i,n,e[a+14],15,-1416354905),n=T(n,r,o,i,e[a+5],21,-57434055),i=T(i,n,r,o,e[a+12],6,1700485571),o=T(o,i,n,r,e[a+3],10,-1894986606),r=T(r,o,i,n,e[a+10],15,-1051523),n=T(n,r,o,i,e[a+1],21,-2054922799),i=T(i,n,r,o,e[a+8],6,1873313359),o=T(o,i,n,r,e[a+15],10,-30611744),r=T(r,o,i,n,e[a+6],15,-1560198380),n=T(n,r,o,i,e[a+13],21,1309151649),i=T(i,n,r,o,e[a+4],6,-145523070),o=T(o,i,n,r,e[a+11],10,-1120210379),r=T(r,o,i,n,e[a+2],15,718787259),n=T(n,r,o,i,e[a+9],21,-343485551),i=g(i,s),n=g(n,d),r=g(r,l),o=g(o,c)}return[i,n,r,o]}(function(e){if(0===e.length)return[];for(var t=8*e.length,i=new Uint32Array(f(t)),n=0;n<t;n+=8)i[n>>5]|=(255&e[n/8])<<n%32;return i}(e),8*e.length))}),S=function(e,t,i){var n=(e=e||{}).random||(e.rng||o)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var r=0;r<16;++r)t[i+r]=n[r];return t}return c(n)};function C(e,t,i,n){switch(e){case 0:return t&i^~t&n;case 1:case 3:return t^i^n;case 2:return t&i^t&n^i&n}}function A(e,t){return e<<t|e>>>32-t}const k=v("v5",80,function(e){var t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var r=0;r<n.length;++r)e.push(n.charCodeAt(r))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var o=e.length/4+2,a=Math.ceil(o/16),s=new Array(a),d=0;d<a;++d){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=e[64*d+4*c]<<24|e[64*d+4*c+1]<<16|e[64*d+4*c+2]<<8|e[64*d+4*c+3];s[d]=l}s[a-1][14]=8*(e.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295;for(var u=0;u<a;++u){for(var h=new Uint32Array(80),p=0;p<16;++p)h[p]=s[u][p];for(var m=16;m<80;++m)h[m]=A(h[m-3]^h[m-8]^h[m-14]^h[m-16],1);for(var y=i[0],b=i[1],v=i[2],f=i[3],g=i[4],E=0;E<80;++E){var _=Math.floor(E/20),N=A(y,5)+C(_,b,v,f)+g+t[_]+h[E]>>>0;g=f,f=v,v=A(b,30)>>>0,b=y,y=N}i[0]=i[0]+y>>>0,i[1]=i[1]+b>>>0,i[2]=i[2]+v>>>0,i[3]=i[3]+f>>>0,i[4]=i[4]+g>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}),P="00000000-0000-0000-0000-000000000000",O=function(e){if(!s(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},631:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseExpiryDate=function(e){const t=e.split("/");if(2!==t.length)return null;const i=t[0],n=t[1];return 2!==i.length||2!==n.length?null:{month:i,year:"20"+n}},t.formatExpiryInput=function(e){let t=e.replace(/\D/g,"");return t=t.substring(0,4),t.length>=2?t.substring(0,2)+"/"+t.substring(2,4):t},t.withTimeout=function(e,t,i){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(new Error(i)),t))])},t.getConnectedBorderRadius=function(e,t,i){if(!i)return e;switch(t){case"left":return`${e} 0 0 ${e}`;case"middle":return"0";case"right":return`0 ${e} ${e} 0`;default:return e}},t.addFocusHandlers=function(e,t,i,n){e.addEventListener("focus",()=>{t.focus&&Object.assign(e.style,t.focus),null==i||i()}),e.addEventListener("blur",()=>{e.style.border=t.input.border,e.style.outline="none",e.style.boxShadow="none",null==n||n()})},t.createFieldContainer=function(e,t,i,n){const r=document.createElement("div");return r.id=e,r.style.flex=t,r.style.display="flex",i&&(r.style.minWidth=i),n&&(r.style.maxWidth=n),r},t.createInputElement=function(e,t,i,n){const r=document.createElement("input");return r.id=e,r.type=t,r.placeholder=i,n&&(r.maxLength=n),r},t.validateRoutingNumber=function(e){const t=e.replace(/\D/g,"");if(9!==t.length)return!1;const i=t.split("").map(Number);return(3*i[0]+7*i[1]+1*i[2]+3*i[3]+7*i[4]+1*i[5]+3*i[6]+7*i[7]+1*i[8])%10==0},t.validateAccountNumber=function(e){const t=e.replace(/\D/g,"");return!(t.length<4||t.length>17)&&/^\d+$/.test(t)},t.maskAccountNumber=function(e){const t=e.replace(/\D/g,"");if(t.length<=4)return t;const i=t.slice(-4);return"*".repeat(t.length-4)+i},t.createAccountTypeSelect=function(e){const t=document.createElement("select");t.id=e;const i=document.createElement("option");i.value="checking",i.text="Checking";const n=document.createElement("option");return n.value="savings",n.text="Savings",t.appendChild(i),t.appendChild(n),t},t.validateInstitutionNumber=function(e){return 3===e.replace(/\D/g,"").length},t.validateTransitNumber=function(e){return 5===e.replace(/\D/g,"").length},t.validateCanadianAccountNumber=function(e){return e.replace(/\D/g,"").length>=7},t.formatCanadianRoutingNumber=function(e,t){return"0"+e.replace(/\D/g,"").padStart(3,"0")+t.replace(/\D/g,"").padStart(5,"0")}},712:function(e,t,i){var n,r=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=n(e),a=0;a<i.length;a++)"default"!==i[a]&&r(t,e,i[a]);return o(t,e),t}),s=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=i(523),c=i(156),u=i(247),h=i(472),p=d(i(953)),m=d(i(731)),y=i(875),b=a(i(777)),v=i(611),f=i(122),g=i(578),E={enableSandboxMode:!1,overrideBaseUrl:void 0,enableDelay:!1,secondsToDelay:0};t.default=class{get organizationId(){if(!this.currentOrganizationId)throw new Error("organizationId undefined");return this.currentOrganizationId}constructor(e,t,i){var n;this.clientKey=e,"string"==typeof t?this.embedId=t:(this.embedConfigCache=t,this.embedId=t.embed_id||"",t.organization_id&&(this.currentOrganizationId=t.organization_id)),this.currentOrganizationId||(this.currentOrganizationId=e),this.options=Object.assign({},E,i),this.allowTransaction=!1,this.config=new m.default(this.options);const r=Object.entries(this.config);for(const[e,t]of r){const i=Object.getOwnPropertyDescriptor(this,e);if(!i||void 0!==i.set)try{this[e]=t}catch(e){}}if(this.options.enableDelay&&this.options.secondsToDelay){const e=1e3*this.options.secondsToDelay;setTimeout(()=>{this.allowTransaction=!0},e)}else this.allowTransaction=!0;this.options.enableSandboxMode&&void 0!==console&&console.info(`[Sandbox] iDonate SDK Configuration (v${u.SDK_VERSION}):`,JSON.parse(JSON.stringify(this)));try{const{pcScriptBase:e,pcScriptId:t}=this.config;if(!e||!t)throw new Error("missing config");const i=(0,v.v4)(),n=window.document.createElement("script");n.setAttribute("src",e+"/"+i+".js"),n.setAttribute("id",t);let r=!1;const o=()=>{var e;try{if(r)return;window.document.body.append(n),r=!0}catch(t){null===(e=null===console||void 0===console?void 0:console.warn)||void 0===e||e.call(console,"not appended")}};o(),window.addEventListener("DOMContentLoaded",()=>{window.document.body.append(n)})}catch(e){null===(n=null===console||void 0===console?void 0:console.warn)||void 0===n||n.call(console,"Warning, partial initialization: ",String(e))}this.currentOrganizationId||this.setOrganizationId(this.clientKey)}createDonation(e){if(!this.allowTransaction)throw new Error("Wow, that was fast - try again");e.embedId||(e.embedId=this.embedId);const t=(0,c.buildCashPaymentPayload)(this.organizationId,e),i=e=>fetch(`${this.config.embedApiBaseUrl}/donate/cash-payment`,{method:"POST",headers:Object.assign(Object.assign(Object.assign({},u.CLIENT_HEADERS),e?{"cf-validation-token":e}:{}),{"User-Agent":u.CLIENT_HEADERS["User-Agent"]+" source:"+this.config.client}),body:JSON.stringify(t),credentials:"include"});return i().then(e=>s(this,void 0,void 0,function*(){if("challenge"===e.headers.get("cf-mitigated")){const t=yield(0,f.handleCFChallenge)(e,this);return i(null==t?void 0:t.token)}return e})).then(e=>(0,h.parseResponse)(e,{throwErrors:!0})).then(e=>(0,c.buildDonationResult)(e))}createTransaction(e){return this.createDonation(e).then(e=>{var t;return{transactionId:null===(t=e.transaction)||void 0===t?void 0:t.id,_raw_response:e._raw_response}})}createPaymentMethod(e){return e.embedId||(e.embedId=this.embedId),b.createPaymentMethod(e,this.config)}setOrganizationId(e){this.currentOrganizationId=e}waitForDonationResult(e,t){return new Promise((i,n)=>{setTimeout(()=>{let r;r=setInterval(()=>{fetch(`${this.config.embedApiBaseUrl}/donate/cash-payment/${e}/payment_status`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>e.result).then(e=>{(function(e){return!!e.processed&&!!e.transaction})(e)&&(r&&(clearInterval(r),r=null),e.error&&n(new l.ClientError(e.error)),i((0,c.buildDonationResult)({_raw_response:Object.assign({campaign:null,designation:{},donor:{},form_data:{},id:null,schedule:{},transaction:{}},e)}))),null==t||t()}).catch(e=>{r&&(clearInterval(r),r=null),n(e)})},2e3)},2e3)})}tokenizeCardConnectApplePay(e){const t=new p.default(e);let i="";const n=t.begin();return new Promise((e,r)=>{n.then(n=>{n.onvalidatemerchant=e=>{const o={apple_pay_url:this.config.applePayUrl,organization_id:this.organizationId};t.createSession(o,this.config.embedApiBaseUrl).then(e=>{i=e.result.merchantSessionIdentifier,n.completeMerchantValidation(e.result)}).catch(e=>{n.abort(),r(e)})},n.onpaymentauthorized=o=>{t.tokenizeWithCardConnect(o.payment,this.config.cardConnectBaseUrl).then(t=>{var r,a;const s=Object.assign(Object.assign({},o.payment.billingContact),{email:null===(r=o.payment.shippingContact)||void 0===r?void 0:r.emailAddress,phone:null===(a=o.payment.shippingContact)||void 0===a?void 0:a.phoneNumber});e({applePaySession:n,cardConnectResponse:t,billingContact:s,merchantSessionId:i})}).catch(e=>{n.abort(),r(e)})},n.oncancel=e=>{r(new Error("Apple Pay has been closed"))}}).catch(e=>r(e))})}createTokenizer(e,t){return s(this,void 0,void 0,function*(){return g.Tokenizer.create(e,t,{organizationId:this.organizationId,embedId:this.embedId,clientConfig:this.config})})}tokenizeSpreedlyPayPal(e){return y.SpreedlyTokenizer.tokenizePayPal(e,this.config)}selectGateway(e,t,i){if(i){const t=e.find(e=>e.id===i);if(t)return t}return e[0]}getEmbedConfig(){return s(this,void 0,void 0,function*(){return this.embedConfigCache?this.embedConfigCache:(this.embedConfigPromise||(this.embedConfigPromise=b.fetchEmbedConfig(this.embedId,this.config).then(e=>(this.embedConfigCache=e,e))),this.embedConfigPromise)})}getGateway(e){return s(this,void 0,void 0,function*(){const t=yield this.getEmbedConfig(),i=t.available_gateways.find(t=>t.id===e);if(!i)throw new Error(`Gateway ${e} not found in embed configuration. Available: ${t.available_gateways.map(e=>e.id).join(", ")}`);return i})}}},731:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=i(247);t.default=class{constructor(e){e.enableSandboxMode?(this.apiBaseUrl=n.SANDBOX_BASE_URL,this.cardConnectBaseUrl=n.SANDBOX_CARD_CONNECT_BASE_URL,this.applePayUrl=n.SANDBOX_APPLE_PAY_URL):(this.apiBaseUrl=n.PRODUCTION_BASE_URL,this.cardConnectBaseUrl=n.PRODUCTION_CARD_CONNECT_BASE_URL,this.applePayUrl=n.APPLE_PAY_URL),this.client=e.sdkClientName||n.DEFAULT_APP_NAME,e.overrideBaseUrl&&(this.apiBaseUrl=e.overrideBaseUrl),this.authApiBaseUrl=e.overrideAuthApiBaseUrl||`${this.apiBaseUrl}/auth`,this.donorApiBaseUrl=e.overrideDonorApiBaseUrl||`${this.apiBaseUrl}/donor`,this.embedApiBaseUrl=e.overrideEmbedApiBaseUrl||`${this.apiBaseUrl}/embed`,e.overrideApplePayUrl&&(this.applePayUrl=e.overrideApplePayUrl),e.overrideCardConnectBaseUrl&&(this.cardConnectBaseUrl=e.overrideCardConnectBaseUrl),this.pcScriptBase=e.pcScriptBase||n.FALLBACK_PC_SCRIPT_URL,this.pcScriptId=e.pcScriptId||n.FALLBACK_PC_SCRIPT_ID,this.turnstileCdnUrl=e.turnstileCdnUrl||n.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL,this.turnstileSiteKey=e.turnstileSiteKey||n.FALLBACK_CF_TURNSTILE_SITE_KEY,(null==e?void 0:e.spreedlyEnvironmentKey)&&(this.spreedlyEnvironmentKey=e.spreedlyEnvironmentKey),this.enableDelay=e.enableDelay||!1,this.secondsToDelay=e.secondsToDelay||0,this.enableSpreedlySecureTokenization=e.enableSpreedlySecureTokenization||!1,this.organizationId=e.organizationId,this.embedId=e.embedId,this.cardConnectTokenizerUrl=`${this.cardConnectBaseUrl}/itoke/ajax-tokenizer.html`}}},740:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});class i{static resolveLib(e){const t=new Date;return new Promise((i,n)=>{!function r(){if(void 0!==window.google&&void 0!==window.google.payments){const t=new google.payments.api.PaymentsClient(e);i(t)}else(new Date).valueOf()-t.valueOf()>15e3?n(new Error("pay.js not loaded after 15 seconds")):setTimeout(r,250)}()})}static injectScript(){if(void 0!==window.google&&void 0!==window.google.payments)throw new Error("google payments is already injected");const e=document.createElement("script");e.src="https://pay.google.com/gp/p/js/pay.js?render=explicit",e.async=!0,e.defer=!0,document.body.appendChild(e)}constructor(e){this.baseRequest={apiVersion:2,apiVersionMinor:0},this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}},this.transactionInfo={countryCode:"US",currencyCode:"USD",totalPriceStatus:"FINAL",totalPrice:""},this.tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:"cardconnect",gatewayMerchantId:""}},this.googlePayOptions={environment:"PRODUCTION"},this.paymentRequestDefaults=Object.assign(Object.assign({},this.baseRequest),{merchantInfo:{merchantId:""},transactionInfo:this.transactionInfo,emailRequired:!0,allowedPaymentMethods:[Object.assign(Object.assign({},this.baseCardPaymentMethod),{tokenizationSpecification:this.tokenizationSpecification})]}),this.paymentsClient=null;const{paymentOptions:t,cardConnectMerchantId:i,paymentDataRequest:n,baseCardPaymentMethodParameters:r={}}=e;this.tokenizationSpecification.parameters.gatewayMerchantId=i,this.paymentRequest=Object.assign({},this.paymentRequestDefaults,n),this.googlePayOptions=Object.assign({},this.googlePayOptions,Object.assign(Object.assign({},t),{merchantInfo:this.paymentRequest.merchantInfo})),this.baseCardPaymentMethod.parameters=Object.assign(Object.assign({},this.baseCardPaymentMethod.parameters),r)}getGoogleIsReadyToPayRequest(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})}getGooglePaymentClient(){return new Promise((e,t)=>{this.paymentsClient?e(this.paymentsClient):i.resolveLib(this.googlePayOptions).then(t=>{this.paymentsClient=t,e(t)}).catch(e=>t(e))})}onGooglePaymentButtonClicked(e){const t=this.paymentRequest;return this.transactionInfo=Object.assign({},this.transactionInfo,e),t.transactionInfo=this.transactionInfo,new Promise((e,i)=>{this.paymentsClient?this.paymentsClient.loadPaymentData(t).then(t=>{e(t)}).catch(e=>{i(e)}):i(new Error("PaymentClient is not initialized"))})}tokenizeWithCardConnect(e,t){return fetch(`${t}/cardsecure/api/v1/ccn/tokenize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encryptionhandler:"EC_GOOGLE_PAY",devicedata:e,unique:!0})}).then(e=>e.json())}}t.default=i},777:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createPaymentMethod=function(e,t){const i=(0,n.buildCreatePaymentMethodPayload)(e);return fetch(`${t.embedApiBaseUrl}/payment/payment-methods`,{method:"POST",headers:r.CLIENT_HEADERS,body:JSON.stringify(i)}).then(e=>(0,o.parseResponse)(e,{throwErrors:!0})).then(e=>(0,n.buildCreatePaymentMethodResult)(e))},t.fetchEmbedConfig=function(e,t){return fetch(`${t.embedApiBaseUrl}/config/${e}`,{method:"GET",headers:r.CLIENT_HEADERS}).then(e=>(0,o.parseResponse)(e,{throwErrors:!0})).then(e=>e._raw_response.result)};const n=i(156),r=i(247),o=i(472)},799:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RESPONSIVE_BREAKPOINT=t.FIELD_CONSTRAINTS=t.PLACEHOLDERS=t.CANADIAN_BANK_FIELD_FLEX=t.BANK_FIELD_FLEX=t.FIELD_FLEX=t.TOKENIZE_TIMEOUT=t.INIT_TIMEOUT=void 0,t.INIT_TIMEOUT=1e4,t.TOKENIZE_TIMEOUT=3e4,t.FIELD_FLEX={cardNumber:{flex:"1 1 60%",minWidth:"150px"},expiry:{flex:"0 1 20%",minWidth:"70px"},cvv:{flex:"0 1 20%",minWidth:"60px"}},t.BANK_FIELD_FLEX={routingNumber:{flex:"0 1 30%",minWidth:"100px"},accountNumber:{flex:"1 1 45%",minWidth:"120px"},accountType:{flex:"0 1 25%",minWidth:"90px"}},t.CANADIAN_BANK_FIELD_FLEX={institutionNumber:{flex:"0 1 15%",minWidth:"60px"},transitNumber:{flex:"0 1 20%",minWidth:"80px"},accountNumber:{flex:"1 1 40%",minWidth:"110px"},accountType:{flex:"0 1 25%",minWidth:"90px"}},t.PLACEHOLDERS={cardNumber:"Card Number *",expiry:"MM/YY *",cvv:"CVV *"},t.FIELD_CONSTRAINTS={expiry:{maxLength:5,pattern:/^\d{0,2}\/?\d{0,2}$/},cvv:{maxLength:4}},t.RESPONSIVE_BREAKPOINT=400},806:function(e,t,i){var n,r=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=n(e),a=0;a<i.length;a++)"default"!==i[a]&&r(t,e,i[a]);return o(t,e),t}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GooglePay=t.ApplePay=t.constants=t.recaptcha=t.ConfigHandler=t.Client=t.shared=t.util=t.tokenize=void 0;const l=a(i(578));t.tokenize=l;const c=a(i(472));t.util=c;const u=a(i(115));t.recaptcha=u;const h=a(i(247));t.constants=h;const p=a(i(777));t.shared=p;const m=d(i(712));t.Client=m.default;const y=d(i(731));t.ConfigHandler=y.default;const b=d(i(953));t.ApplePay=b.default;const v=d(i(740));t.GooglePay=v.default,s(i(523),t)},875:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.SpreedlyTokenizer=void 0;const r=i(415),o=i(367),a=i(247),s=i(156),d=i(592),l=i(454),c=i(799),u=i(631);class h extends r.Tokenizer{constructor(e,t,i,n="credit_card",r="US",o=!1,a="single-line",s=c.RESPONSIVE_BREAKPOINT){if(super(),this.environmentKey=e,this.containerId=t,this.layout=a,this.bankCountry="US",this.enableTestMode=!1,this.effectiveLayout="single-line",this.responsiveBreakpoint=c.RESPONSIVE_BREAKPOINT,this.mode=n,this.bankCountry=r,this.enableTestMode=o,this.responsiveBreakpoint=s,"credit_card"===n){const e=window.SpreedlyPaymentFrame;this.spreedly=e?new e:window.Spreedly}else this.spreedly=window.Spreedly;this.currentValidationState="bank_account"===n?{isValid:!1,routingNumber:{isValid:!1,isEmpty:!0},accountNumber:{isValid:!1,isEmpty:!0}}:{isValid:!1,cardNumber:{isValid:!1,isEmpty:!0},cvv:{isValid:!1,isEmpty:!0},expiry:{isValid:!1,isEmpty:!0}},this.mergedStyles=(0,l.getContainerStylesForLayout)((0,l.mergeStyles)(l.DEFAULT_UNIFIED_STYLES,i),this.layout);const d=this.generateFieldIds(t);this.numberEl=d.numberId,this.cvvEl=d.cvvId,this.expiryId=d.expiryId}static create(e,t,i){return n(this,void 0,void 0,function*(){var n;"bank_account"!==t.mode&&(yield h.ensureSpreedlyLoaded());let r=null===(n=e.config)||void 0===n?void 0:n.environment_key;!r&&i.clientConfig.spreedlyEnvironmentKey&&(r=i.clientConfig.spreedlyEnvironmentKey),r||(r="");const o=new h(r,t.containerId,t.styling,t.mode||"credit_card",t.bankCountry||"US",t.enableTestMode||!1,t.layout||"single-line",t.responsiveBreakpoint||c.RESPONSIVE_BREAKPOINT);let a;if(o.organizationId=i.organizationId,o.embedId=i.embedId,o.clientConfig=i.clientConfig,o.createInternalElements(),"credit_card"===t.mode&&i.clientConfig.enableSpreedlySecureTokenization){if(!i.organizationId||!i.embedId)throw new Error("Secure tokenization is enabled but organizationId and embedId are required");try{a=yield(0,d.fetchSpreedlySecurityArgs)(i.clientConfig,i.organizationId,i.embedId)}catch(e){throw new Error(`Secure tokenization is enabled but failed to initialize: ${e instanceof Error?e.message:"Unknown error"}`)}}return yield o.init(a),o})}init(e){return n(this,void 0,void 0,function*(){return this.containerEl=document.getElementById(this.containerId),"bank_account"===this.mode?(this.enableTestMode&&setTimeout(()=>{"CA"===this.bankCountry?(this.institutionNumberEl&&(this.institutionNumberEl.value="004",this.institutionNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.transitNumberEl&&(this.transitNumberEl.value="12345",this.transitNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountNumberEl&&(this.accountNumberEl.value="1234567",this.accountNumberEl.dispatchEvent(new Event("input",{bubbles:!0})))):(this.routingNumberEl&&(this.routingNumberEl.value="021000021",this.routingNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountNumberEl&&(this.accountNumberEl.value="9876543210",this.accountNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountTypeEl&&(this.accountTypeEl.value="checking",this.accountTypeEl.dispatchEvent(new Event("change",{bubbles:!0}))))},100),this.emit("ready"),Promise.resolve()):new Promise((t,i)=>{const n=setTimeout(()=>{i(new Error("Spreedly initialization timeout"))},c.INIT_TIMEOUT);this.spreedly.on("ready",()=>{clearTimeout(n),this.spreedly.setPlaceholder("number",c.PLACEHOLDERS.cardNumber),this.spreedly.setFieldType("number","text"),this.spreedly.setNumberFormat("prettyFormat"),this.spreedly.setPlaceholder("cvv",c.PLACEHOLDERS.cvv),this.spreedly.setFieldType("cvv","text"),this.applyUnifiedStyles(),this.enableTestMode&&"credit_card"===this.mode&&this.spreedly.setValue&&(this.spreedly.setValue("number","4111111111111111"),this.spreedly.setValue("cvv","123"),setTimeout(()=>{this.expiryEl&&(this.expiryEl.value="12/34",this.expiryEl.dispatchEvent(new Event("input",{bubbles:!0})))},100)),this.emit("ready"),t()}),this.spreedly.on("errors",e=>{this.emit("error",new o.TokenizationError(e))}),this.spreedly.on("fieldEvent",(e,t,i,n)=>{this.handleFieldEvent(e,t,n)});const r={numberEl:this.numberEl,cvvEl:this.cvvEl};e&&(r.certificateToken=e.certificate_token,r.signature=e.signature,r.timestamp=e.timestamp,r.nonce=e.nonce),this.spreedly.init(this.environmentKey,r)})})}tokenize(e){return n(this,void 0,void 0,function*(){if(!this.isReady)throw new Error("Tokenizer not initialized");return"bank_account"===this.mode||this.isBankAccountData(e)?this.tokenizeBankAccountInternal(e):this.tokenizeCardInternal(e)})}tokenizeCardInternal(e){return n(this,void 0,void 0,function*(){return new Promise((t,i)=>{var n,r,a,s,d,l;const u=setTimeout(()=>{this.spreedly&&this.spreedly.removeHandlers&&this.spreedly.removeHandlers(),i(new o.TokenizationError("Tokenization timeout","TIMEOUT"))},c.TOKENIZE_TIMEOUT),h=()=>{clearTimeout(u),this.spreedly&&this.spreedly.removeHandlers&&this.spreedly.removeHandlers()};this.spreedly.on("paymentMethod",(e,i)=>{h();const n={token:e,lastFour:i.last_four_digits,cardType:this.normalizeCardType(i.card_type),provider:"spreedly"};this.emit("tokenReady",n),t(n)}),this.spreedly.on("errors",e=>{h(),i(new o.TokenizationError(e))});const p=this.parseExpiry(this.expiryEl);if(!p)return h(),void i(new o.TokenizationError("Expiration date is required","VALIDATION_ERROR"));const m=p.month,y=p.year;this.spreedly.tokenizeCreditCard({first_name:e.firstName,last_name:e.lastName,month:m,year:y,email:e.email,phone_number:e.phone,address1:null===(n=e.address)||void 0===n?void 0:n.address1,address2:null===(r=e.address)||void 0===r?void 0:r.address2,city:null===(a=e.address)||void 0===a?void 0:a.city,state:null===(s=e.address)||void 0===s?void 0:s.state,zip:null===(d=e.address)||void 0===d?void 0:d.zip,country:null===(l=e.address)||void 0===l?void 0:l.country})})})}createCanadianBankAccountFields(e){"two-line"===this.layout?(this.accountTypeEl=(0,u.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:"2",minWidth:c.CANADIAN_BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,this.mergedStyles,"left"),e.appendChild(this.accountTypeEl),this.institutionNumberEl=(0,u.createInputElement)(`${this.containerId}-institution`,"text","Inst *",3),Object.assign(this.institutionNumberEl.style,{flex:"1",minWidth:c.CANADIAN_BANK_FIELD_FLEX.institutionNumber.minWidth}),this.applyInputStyles(this.institutionNumberEl,this.mergedStyles,"middle"),this.institutionNumberEl.addEventListener("blur",()=>{!(0,u.validateInstitutionNumber)(this.institutionNumberEl.value)&&this.institutionNumberEl.value?this.applyErrorStyles(this.institutionNumberEl):this.applyInputStyles(this.institutionNumberEl,this.mergedStyles,"middle"),this.updateBankAccountValidation()}),e.appendChild(this.institutionNumberEl),this.transitNumberEl=(0,u.createInputElement)(`${this.containerId}-transit`,"text","Transit *",5),Object.assign(this.transitNumberEl.style,{flex:"2",minWidth:c.CANADIAN_BANK_FIELD_FLEX.transitNumber.minWidth}),this.applyInputStyles(this.transitNumberEl,this.mergedStyles,"right"),this.transitNumberEl.addEventListener("blur",()=>{!(0,u.validateTransitNumber)(this.transitNumberEl.value)&&this.transitNumberEl.value?this.applyErrorStyles(this.transitNumberEl):this.applyInputStyles(this.transitNumberEl,this.mergedStyles,"right"),this.updateBankAccountValidation()}),e.appendChild(this.transitNumberEl),this.accountNumberEl=(0,u.createInputElement)(`${this.containerId}-account`,"text","Account Number *"),Object.assign(this.accountNumberEl.style,{flex:"1",flexBasis:"100%",minWidth:c.CANADIAN_BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,this.mergedStyles),this.accountNumberEl.addEventListener("blur",()=>{!(0,u.validateCanadianAccountNumber)(this.accountNumberEl.value)&&this.accountNumberEl.value?this.applyErrorStyles(this.accountNumberEl):this.applyInputStyles(this.accountNumberEl,this.mergedStyles),this.updateBankAccountValidation()}),e.appendChild(this.accountNumberEl)):(this.institutionNumberEl=(0,u.createInputElement)(`${this.containerId}-institution`,"text","Inst *",3),Object.assign(this.institutionNumberEl.style,{flex:c.CANADIAN_BANK_FIELD_FLEX.institutionNumber.flex,minWidth:c.CANADIAN_BANK_FIELD_FLEX.institutionNumber.minWidth}),this.applyInputStyles(this.institutionNumberEl,this.mergedStyles,"left"),this.institutionNumberEl.addEventListener("blur",()=>{!(0,u.validateInstitutionNumber)(this.institutionNumberEl.value)&&this.institutionNumberEl.value?this.applyErrorStyles(this.institutionNumberEl):this.applyInputStyles(this.institutionNumberEl,this.mergedStyles,"left"),this.updateBankAccountValidation()}),e.appendChild(this.institutionNumberEl),this.transitNumberEl=(0,u.createInputElement)(`${this.containerId}-transit`,"text","Transit *",5),Object.assign(this.transitNumberEl.style,{flex:c.CANADIAN_BANK_FIELD_FLEX.transitNumber.flex,minWidth:c.CANADIAN_BANK_FIELD_FLEX.transitNumber.minWidth}),this.applyInputStyles(this.transitNumberEl,this.mergedStyles,"middle"),this.transitNumberEl.addEventListener("blur",()=>{!(0,u.validateTransitNumber)(this.transitNumberEl.value)&&this.transitNumberEl.value?this.applyErrorStyles(this.transitNumberEl):this.applyInputStyles(this.transitNumberEl,this.mergedStyles,"middle"),this.updateBankAccountValidation()}),e.appendChild(this.transitNumberEl),this.accountNumberEl=(0,u.createInputElement)(`${this.containerId}-account`,"text","Account Number *"),Object.assign(this.accountNumberEl.style,{flex:c.CANADIAN_BANK_FIELD_FLEX.accountNumber.flex,minWidth:c.CANADIAN_BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,this.mergedStyles,"middle"),this.accountNumberEl.addEventListener("blur",()=>{!(0,u.validateCanadianAccountNumber)(this.accountNumberEl.value)&&this.accountNumberEl.value?this.applyErrorStyles(this.accountNumberEl):this.applyInputStyles(this.accountNumberEl,this.mergedStyles,"middle"),this.updateBankAccountValidation()}),e.appendChild(this.accountNumberEl),this.accountTypeEl=(0,u.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:c.CANADIAN_BANK_FIELD_FLEX.accountType.flex,minWidth:c.CANADIAN_BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,this.mergedStyles,"right"),e.appendChild(this.accountTypeEl))}tokenizeBankAccountInternal(e){return n(this,void 0,void 0,function*(){var t,i,n,r,a,s,d,l,c,p,m,y;if(!this.isReady)throw new Error("Tokenizer not initialized");if("bank_account"!==this.mode)throw new Error("Tokenizer not in bank account mode");let b,v;const f=(null===(t=this.accountTypeEl)||void 0===t?void 0:t.value)||"checking";if("CA"===this.bankCountry){const e=null===(i=this.institutionNumberEl)||void 0===i?void 0:i.value,t=null===(n=this.transitNumberEl)||void 0===n?void 0:n.value;if(v=null===(r=this.accountNumberEl)||void 0===r?void 0:r.value,!e||!t||!v)throw new o.TokenizationError("Institution number, transit number, and account number are required","VALIDATION_ERROR");if(!(0,u.validateInstitutionNumber)(e))throw new o.TokenizationError("Institution number must be 3 digits","VALIDATION_ERROR");if(!(0,u.validateTransitNumber)(t))throw new o.TokenizationError("Transit number must be 5 digits","VALIDATION_ERROR");if(!(0,u.validateCanadianAccountNumber)(v))throw new o.TokenizationError("Invalid account number","VALIDATION_ERROR");b=(0,u.formatCanadianRoutingNumber)(e,t)}else{if(b=null===(a=this.routingNumberEl)||void 0===a?void 0:a.value,v=null===(s=this.accountNumberEl)||void 0===s?void 0:s.value,!b||!v)throw new o.TokenizationError("Routing number and account number are required","VALIDATION_ERROR");if(!(0,u.validateRoutingNumber)(b))throw new o.TokenizationError("Invalid routing number","VALIDATION_ERROR");if(!(0,u.validateAccountNumber)(v))throw new o.TokenizationError("Invalid account number","VALIDATION_ERROR")}return{token:yield h.tokenizeBankAccount({contact:{firstName:e.firstName,lastName:e.lastName,email:e.email,primaryPhone:e.phone},address:{address1:null===(d=e.address)||void 0===d?void 0:d.address1,address2:null===(l=e.address)||void 0===l?void 0:l.address2,city:null===(c=e.address)||void 0===c?void 0:c.city,state:null===(p=e.address)||void 0===p?void 0:p.state,zip:null===(m=e.address)||void 0===m?void 0:m.zip,country:null===(y=e.address)||void 0===y?void 0:y.country},account:{accountNumber:v,routingNumber:b,accountType:f,accountHolderType:"personal"}},this.clientConfig),lastFour:v.slice(-4),accountType:f,paymentMethodType:"bank_account",provider:"spreedly"}})}validate(){return n(this,void 0,void 0,function*(){return"bank_account"===this.mode?this.validateBankAccountInternal():this.validateCardInternal()})}validateCardInternal(){return n(this,void 0,void 0,function*(){var e,t,i,n,r;const o=[];(null===(e=this.currentValidationState.cardNumber)||void 0===e?void 0:e.isEmpty)?o.push({field:"cardNumber",message:"Card number is required"}):(null===(t=this.currentValidationState.cardNumber)||void 0===t?void 0:t.isValid)||o.push({field:"cardNumber",message:"Invalid card number"}),(null===(i=this.currentValidationState.cvv)||void 0===i?void 0:i.isEmpty)?o.push({field:"cvv",message:"CVV is required"}):(null===(n=this.currentValidationState.cvv)||void 0===n?void 0:n.isValid)||o.push({field:"cvv",message:"Invalid CVV"});const a=this.parseExpiry(this.expiryEl);return(null===(r=this.expiryEl)||void 0===r?void 0:r.value)?a||o.push({field:"expiry",message:"Invalid expiration date"}):o.push({field:"expiry",message:"Expiration date is required"}),{isValid:0===o.length,errors:o}})}validateBankAccountInternal(){return n(this,void 0,void 0,function*(){var e,t,i,n,r;const o=[];return"CA"===this.bankCountry?((null===(e=this.institutionNumberEl)||void 0===e?void 0:e.value)?(0,u.validateInstitutionNumber)(this.institutionNumberEl.value)||o.push({field:"routingNumber",message:"Institution number must be 3 digits"}):o.push({field:"routingNumber",message:"Institution number is required"}),(null===(t=this.transitNumberEl)||void 0===t?void 0:t.value)?(0,u.validateTransitNumber)(this.transitNumberEl.value)||o.push({field:"routingNumber",message:"Transit number must be 5 digits"}):o.push({field:"routingNumber",message:"Transit number is required"}),(null===(i=this.accountNumberEl)||void 0===i?void 0:i.value)?(0,u.validateCanadianAccountNumber)(this.accountNumberEl.value)||o.push({field:"accountNumber",message:"Account number must be at least 7 digits"}):o.push({field:"accountNumber",message:"Account number is required"})):((null===(n=this.routingNumberEl)||void 0===n?void 0:n.value)?(0,u.validateRoutingNumber)(this.routingNumberEl.value)||o.push({field:"routingNumber",message:"Invalid routing number"}):o.push({field:"routingNumber",message:"Routing number is required"}),(null===(r=this.accountNumberEl)||void 0===r?void 0:r.value)?(0,u.validateAccountNumber)(this.accountNumberEl.value)||o.push({field:"accountNumber",message:"Invalid account number"}):o.push({field:"accountNumber",message:"Account number is required"})),{isValid:0===o.length,errors:o}})}applyUnifiedStyles(){var e;const t="0"===(null===(e=this.mergedStyles.container)||void 0===e?void 0:e.gap);if(this.mergedStyles.input)if(t){const e=Object.assign(Object.assign({},this.mergedStyles.input),{borderRight:"none",borderRadius:this.mergedStyles.input.borderRadius?`${this.mergedStyles.input.borderRadius} 0 0 ${this.mergedStyles.input.borderRadius}`:"0"}),t=this.stylesToCssString(e);this.spreedly.setStyle("number",t);const i=Object.assign(Object.assign({},this.mergedStyles.input),{borderRadius:this.mergedStyles.input.borderRadius?`0 ${this.mergedStyles.input.borderRadius} ${this.mergedStyles.input.borderRadius} 0`:"0"}),n=this.stylesToCssString(i);this.spreedly.setStyle("cvv",n)}else{const e=this.stylesToCssString(this.mergedStyles.input);this.spreedly.setStyle("number",e),this.spreedly.setStyle("cvv",e)}if(this.mergedStyles.focus){const e=this.stylesToCssString(this.mergedStyles.focus);this.spreedly.setStyle("number:focus",e),this.spreedly.setStyle("cvv:focus",e)}if(this.mergedStyles.error){const e=this.stylesToCssString(this.mergedStyles.error);this.spreedly.setStyle("number.invalid",e),this.spreedly.setStyle("cvv.invalid",e)}}stylesToCssString(e){return Object.entries(e).filter(([e,t])=>null!=t).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}: ${t}`).join("; ")}clear(){"bank_account"===this.mode?("CA"===this.bankCountry?(this.institutionNumberEl&&(this.institutionNumberEl.value=""),this.transitNumberEl&&(this.transitNumberEl.value="")):this.routingNumberEl&&(this.routingNumberEl.value=""),this.accountNumberEl&&(this.accountNumberEl.value=""),this.accountTypeEl&&(this.accountTypeEl.selectedIndex=0)):(this.spreedly.reload(),this.expiryEl&&(this.expiryEl.value=""))}focus(e){if("bank_account"===this.mode)return"routingNumber"===e?void("CA"===this.bankCountry&&this.institutionNumberEl?this.institutionNumberEl.focus():this.routingNumberEl&&this.routingNumberEl.focus()):"accountNumber"===e&&this.accountNumberEl?void this.accountNumberEl.focus():void 0;if("expiry"===e&&this.expiryEl)return void this.expiryEl.focus();const t={cardNumber:this.numberEl,cvv:this.cvvEl,expiry:null,routingNumber:null,accountNumber:null}[e];if(t){const e=document.getElementById(t);null==e||e.focus()}}determineLayout(e){return e<this.responsiveBreakpoint?"two-line":"single-line"}setupResizeObserver(){if("responsive"!==this.layout)return;const e=document.getElementById(this.containerId);if(!e)return;let t;this.resizeObserver=new ResizeObserver(e=>{clearTimeout(t),t=setTimeout(()=>{const t=e[0].contentRect.width,i=this.determineLayout(t);i!==this.effectiveLayout&&this.applyLayoutStyles(i)},100)}),this.resizeObserver.observe(e)}applyLayoutStyles(e){this.effectiveLayout=e;const t=document.getElementById(this.containerId);t&&("two-line"===e?(t.style.flexWrap="wrap",this.cardNumberDiv&&(this.cardNumberDiv.style.flex="1",this.cardNumberDiv.style.flexBasis="100%"),this.expiryEl&&(this.expiryEl.style.flex="1",this.expiryEl.style.flexBasis="auto"),this.cvvDiv&&(this.cvvDiv.style.flex="1",this.cvvDiv.style.flexBasis="auto")):(t.style.flexWrap="nowrap",this.cardNumberDiv&&(this.cardNumberDiv.style.flex=c.FIELD_FLEX.cardNumber.flex),this.expiryEl&&(this.expiryEl.style.flex=c.FIELD_FLEX.expiry.flex),this.cvvDiv&&(this.cvvDiv.style.flex=c.FIELD_FLEX.cvv.flex)))}destroy(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.spreedly&&this.spreedly.removeHandlers&&this.spreedly.removeHandlers(),this.eventHandlers.clear(),this.expiryEl}hasToken(){return!1}getToken(){return null}get tokenizationMode(){return"manual"}updateOverallValidation(){var e,t,i,n,r,o;"credit_card"===this.mode?this.currentValidationState.isValid=null!==(t=null===(e=this.currentValidationState.cardNumber)||void 0===e?void 0:e.isValid)&&void 0!==t&&t&&null!==(n=null===(i=this.currentValidationState.cvv)||void 0===i?void 0:i.isValid)&&void 0!==n&&n&&null!==(o=null===(r=this.currentValidationState.expiry)||void 0===r?void 0:r.isValid)&&void 0!==o&&o:this.currentValidationState.isValid=!0,this.emit("validation",this.currentValidationState)}handleFieldEvent(e,t,i){"input"===t&&("number"===e?(this.currentValidationState.cardNumber={isValid:i.validNumber||!1,isEmpty:0===i.numberLength},i.cardType&&"unknown"!==i.cardType&&this.emit("cardTypeChange",{cardType:this.normalizeCardType(i.cardType)})):"cvv"===e&&(this.currentValidationState.cvv={isValid:i.validCvv||!1,isEmpty:0===i.cvvLength}),this.updateOverallValidation()),"focus"===t?this.emit("focus",{field:e}):"blur"===t?this.emit("blur",{field:e}):"input"===t&&this.emit("change",{field:e})}createInternalElements(){const e=document.getElementById(this.containerId);if(!e)throw new Error(`Container element not found: ${this.containerId}`);e.innerHTML="",Object.assign(e.style,this.mergedStyles.container),"bank_account"===this.mode?this.createBankAccountFields(e):this.createCreditCardFields(e)}createCreditCardFields(e){if("responsive"===this.layout?this.effectiveLayout=this.determineLayout(e.offsetWidth):this.effectiveLayout="two-line"===this.layout?"two-line":"single-line","two-line"===this.effectiveLayout&&"responsive"!==this.layout){const t=(0,u.createFieldContainer)(this.numberEl,"1",c.FIELD_FLEX.cardNumber.minWidth);t.style.height=this.mergedStyles.input.height,t.style.flexBasis="100%",this.cardNumberDiv=t,e.appendChild(t),this.expiryEl=(0,u.createInputElement)(this.expiryId,"text",c.PLACEHOLDERS.expiry,c.FIELD_CONSTRAINTS.expiry.maxLength),Object.assign(this.expiryEl.style,{flex:"1",minWidth:c.FIELD_FLEX.expiry.minWidth}),this.applyInputStyles(this.expiryEl,this.mergedStyles,"left"),this.addExpiryFormatter(this.expiryEl),this.expiryEl.addEventListener("input",()=>{var e;const t=this.parseExpiry(this.expiryEl);this.currentValidationState.expiry={isValid:!!t,isEmpty:!(null===(e=this.expiryEl)||void 0===e?void 0:e.value)},this.updateOverallValidation()}),e.appendChild(this.expiryEl);const i=(0,u.createFieldContainer)(this.cvvEl,"1",c.FIELD_FLEX.cvv.minWidth);i.style.height=this.mergedStyles.input.height,this.cvvDiv=i,e.appendChild(i)}else{const t=(0,u.createFieldContainer)(this.numberEl,c.FIELD_FLEX.cardNumber.flex,c.FIELD_FLEX.cardNumber.minWidth);t.style.height=this.mergedStyles.input.height,this.cardNumberDiv=t,e.appendChild(t),this.expiryEl=(0,u.createInputElement)(this.expiryId,"text",c.PLACEHOLDERS.expiry,c.FIELD_CONSTRAINTS.expiry.maxLength),Object.assign(this.expiryEl.style,{flex:c.FIELD_FLEX.expiry.flex,minWidth:c.FIELD_FLEX.expiry.minWidth}),this.applyInputStyles(this.expiryEl,this.mergedStyles,"middle"),this.addExpiryFormatter(this.expiryEl),this.expiryEl.addEventListener("input",()=>{var e;const t=this.parseExpiry(this.expiryEl);this.currentValidationState.expiry={isValid:!!t,isEmpty:!(null===(e=this.expiryEl)||void 0===e?void 0:e.value)},this.updateOverallValidation()}),e.appendChild(this.expiryEl);const i=(0,u.createFieldContainer)(this.cvvEl,c.FIELD_FLEX.cvv.flex,c.FIELD_FLEX.cvv.minWidth);i.style.height=this.mergedStyles.input.height,this.cvvDiv=i,e.appendChild(i),"responsive"===this.layout&&(this.applyLayoutStyles(this.effectiveLayout),this.setupResizeObserver())}}createBankAccountFields(e){"CA"===this.bankCountry?this.createCanadianBankAccountFields(e):this.createUSBankAccountFields(e)}createUSBankAccountFields(e){"two-line"===this.layout?(this.accountTypeEl=(0,u.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:"1",minWidth:c.BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,this.mergedStyles,"left"),e.appendChild(this.accountTypeEl),this.routingNumberEl=(0,u.createInputElement)(`${this.containerId}-routing`,"text","Routing *",9),Object.assign(this.routingNumberEl.style,{flex:"1",minWidth:c.BANK_FIELD_FLEX.routingNumber.minWidth}),this.applyInputStyles(this.routingNumberEl,this.mergedStyles,"right"),this.routingNumberEl.addEventListener("blur",()=>{!(0,u.validateRoutingNumber)(this.routingNumberEl.value)&&this.routingNumberEl.value?this.applyErrorStyles(this.routingNumberEl):this.applyInputStyles(this.routingNumberEl,this.mergedStyles,"right"),this.updateBankAccountValidation()}),e.appendChild(this.routingNumberEl),this.accountNumberEl=(0,u.createInputElement)(`${this.containerId}-account`,"text","Account Number *",17),Object.assign(this.accountNumberEl.style,{flex:"1",flexBasis:"100%",minWidth:c.BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,this.mergedStyles),this.accountNumberEl.addEventListener("blur",()=>{!(0,u.validateAccountNumber)(this.accountNumberEl.value)&&this.accountNumberEl.value?this.applyErrorStyles(this.accountNumberEl):this.applyInputStyles(this.accountNumberEl,this.mergedStyles),this.updateBankAccountValidation()}),e.appendChild(this.accountNumberEl)):(this.routingNumberEl=(0,u.createInputElement)(`${this.containerId}-routing`,"text","Routing *",9),Object.assign(this.routingNumberEl.style,{flex:c.BANK_FIELD_FLEX.routingNumber.flex,minWidth:c.BANK_FIELD_FLEX.routingNumber.minWidth}),this.applyInputStyles(this.routingNumberEl,this.mergedStyles,"left"),this.routingNumberEl.addEventListener("blur",()=>{!(0,u.validateRoutingNumber)(this.routingNumberEl.value)&&this.routingNumberEl.value?this.applyErrorStyles(this.routingNumberEl):this.applyInputStyles(this.routingNumberEl,this.mergedStyles,"left"),this.updateBankAccountValidation()}),e.appendChild(this.routingNumberEl),this.accountNumberEl=(0,u.createInputElement)(`${this.containerId}-account`,"text","Account Number *",17),Object.assign(this.accountNumberEl.style,{flex:c.BANK_FIELD_FLEX.accountNumber.flex,minWidth:c.BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,this.mergedStyles,"middle"),this.accountNumberEl.addEventListener("blur",()=>{!(0,u.validateAccountNumber)(this.accountNumberEl.value)&&this.accountNumberEl.value?this.applyErrorStyles(this.accountNumberEl):this.applyInputStyles(this.accountNumberEl,this.mergedStyles,"middle"),this.updateBankAccountValidation()}),e.appendChild(this.accountNumberEl),this.accountTypeEl=(0,u.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:c.BANK_FIELD_FLEX.accountType.flex,minWidth:c.BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,this.mergedStyles,"right"),e.appendChild(this.accountTypeEl))}updateBankAccountValidation(){if("CA"===this.bankCountry){if(!this.institutionNumberEl||!this.transitNumberEl||!this.accountNumberEl)return;const e=(0,u.validateInstitutionNumber)(this.institutionNumberEl.value),t=(0,u.validateTransitNumber)(this.transitNumberEl.value),i=(0,u.validateCanadianAccountNumber)(this.accountNumberEl.value);this.currentValidationState={isValid:e&&t&&i,routingNumber:{isValid:e&&t,isEmpty:!this.institutionNumberEl.value&&!this.transitNumberEl.value,error:e?t?void 0:"Invalid transit number":"Invalid institution number"},accountNumber:{isValid:i,isEmpty:!this.accountNumberEl.value,error:i?void 0:"Account number must be at least 7 digits"}}}else{if(!this.routingNumberEl||!this.accountNumberEl)return;const e=(0,u.validateRoutingNumber)(this.routingNumberEl.value),t=(0,u.validateAccountNumber)(this.accountNumberEl.value);this.currentValidationState={isValid:e&&t,routingNumber:{isValid:e,isEmpty:!this.routingNumberEl.value,error:e?void 0:"Invalid routing number"},accountNumber:{isValid:t,isEmpty:!this.accountNumberEl.value,error:t?void 0:"Invalid account number"}}}this.emit("validation",this.currentValidationState)}validateExpiry(){if(!this.expiryEl)return;const e=this.parseExpiry(this.expiryEl);if(!e)return void this.applyErrorStyles(this.expiryEl);const t=parseInt(e.month,10),i=parseInt(e.year,10);if(t<1||t>12)return void this.applyErrorStyles(this.expiryEl);const n=new Date;new Date(i,t-1)<n?this.applyErrorStyles(this.expiryEl):this.applyInputStyles(this.expiryEl,this.mergedStyles,"middle")}applyErrorStyles(e){this.mergedStyles.error?Object.assign(e.style,this.mergedStyles.error):e.style.borderColor="#dc3545"}static ensureSpreedlyLoaded(){return n(this,void 0,void 0,function*(){window.Spreedly||(yield h.loadScript("https://core.spreedly.com/iframe/iframe-v1.min.js","spreedly-iframe-script"),yield h.waitForGlobal("Spreedly",5e3))})}static loadScript(e,t){return n(this,void 0,void 0,function*(){if(!t||!document.getElementById(t))return Array.from(document.getElementsByTagName("script")).find(t=>t.src===e)?void 0:new Promise((i,n)=>{const r=document.createElement("script");r.src=e,r.async=!0,t&&(r.id=t),r.onload=()=>i(),r.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.body.appendChild(r)})})}static waitForGlobal(e){return n(this,arguments,void 0,function*(e,t=1e4){const i=Date.now();for(;Date.now()-i<t;){const t=window[e];if(t)return t;yield new Promise(e=>setTimeout(e,100))}throw new Error(`Timeout waiting for global: ${e}`)})}static tokenizeBankAccount(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(a.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{bank_account:{first_name:e.contact.firstName||void 0,last_name:e.contact.lastName||void 0,full_name:e.contact.fullName||void 0,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country,bank_account_number:e.account.accountNumber.replace(/\s+/g,""),bank_routing_number:e.account.routingNumber.replace(/\s+/g,""),bank_account_holder_type:e.account.accountHolderType,bank_account_type:e.account.accountType}},retained:!1})}).then(s.unpackSpreedlyResponse).then(s.extractSpreedlyToken)}static tokenizeCreditCard(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(a.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{credit_card:{first_name:e.contact.firstName,last_name:e.contact.lastName,full_name:e.contact.fullName,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country,number:e.card.cardNumber.replace(/\s+/g,""),verification_value:e.card.verificationValue,year:e.card.expirationYear,month:e.card.expirationMonth}},retained:!1})}).then(s.unpackSpreedlyResponse).then(s.extractSpreedlyToken)}static tokenizePayPal(e,t){if(void 0===t.spreedlyEnvironmentKey)throw new Error("Spreedly is not configured.");return fetch(a.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{payment_method_type:"paypal",first_name:e.contact.firstName,last_name:e.contact.lastName,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},retained:!1})}).then(s.unpackSpreedlyResponse).then(s.extractSpreedlyToken)}}t.SpreedlyTokenizer=h},903:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tokenizePaymentBankCanada=function(e,t,i,r,o,a,s,d,l){const c=(0,n.v4)();let u=l.address1;l.address2&&(u+="\n"+l.address2);const h={IATS_DPM_ProcessOption:"TOKEN",IATS_DPM_RecurringOn:"FALSE",IATS_DPM_ProcessID:o,IATS_DPM_RelayURL:a,IATS_DPM_ClientDefined_PaymentId:c,IATS_DPM_ClientDefined_GatewayId:s,IATS_DPM_Title:d.salutation,IATS_DPM_FirstName:d.firstName,IATS_DPM_LastName:d.lastName,IATS_DPM_Address:u,IATS_DPM_City:l.city,IATS_DPM_Province:l.state,IATS_DPM_Country:l.country,IATS_DPM_ZipCode:l.zip,IATS_DPM_Phone:d.primaryPhone,IATS_DPM_EMAIL:d.email,IATS_DPM_AccountNumber:e+t+i,IATS_DPM_MOP:"ACHEFT",IATS_DPM_AccountType:r},p=new FormData;for(const[e,t]of Object.entries(h))p.append(e,t);return fetch("https://www.iatspayments.com/netgate/IATSDPMProcess.aspx",{method:"POST",mode:"no-cors",body:p}).then(e=>e.text().then(()=>c))},t.tokenizePaymentBankUs=function(){throw new Error("US Bank Tokenization Not Yet Implemented")},t.tokenizePaymentCard=function(){throw new Error("Card Tokenization Not Yet Implemented")};const n=i(611)},953:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=i(247);class o{constructor(e){this.appleSession=null,this.paymentRequestDefaults={currencyCode:"USD",countryCode:"US",merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["amex","masterCard","visa","discover"],requiredBillingContactFields:["postalAddress","name"],requiredShippingContactFields:["email","phone"],total:{label:"iDonate",amount:"",type:"final"}},this.paymentRequest=Object.assign({},this.paymentRequestDefaults,e)}static isSupported(){return window.ApplePaySession&&ApplePaySession.canMakePayments()&&ApplePaySession.supportsVersion(o.ApplePayApiVersion)}begin(){return n(this,void 0,void 0,function*(){if(!o.isSupported())throw new Error("Apple Pay Not Supported");return this.appleSession=new ApplePaySession(o.ApplePayApiVersion,this.paymentRequest),this.appleSession.begin(),this.appleSession})}createSession(e,t){return fetch(`${t}/payment/create-session`,{method:"POST",headers:r.CLIENT_HEADERS,body:JSON.stringify(e)}).then(e=>e.json())}tokenizeWithCardConnect(e,t){const i=e.token.paymentData,n=`${i.data}&ectype=apple&ecsig=${i.signature}&eckey=${i.header.ephemeralPublicKey}&ectid=${i.header.transactionId}&echash=&ecpublickeyhash=${i.header.publicKeyHash}`;return fetch(`${t}/cardsecure/api/v1/ccn/tokenize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encryptionhandler:"EC_APPLE_PAY",devicedata:n,unique:!0})}).then(e=>e.json())}}o.ApplePayApiVersion=6,t.default=o}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}return i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(806)})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.idonate=t():e.idonate=t()}(self,()=>(()=>{"use strict";var e={115:function(e,t){var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};function n(){const e=new Date;return new Promise((t,i)=>{!function n(){void 0!==window.grecaptcha&&void 0!==window.grecaptcha.render?t(window.grecaptcha):(new Date).valueOf()-e.valueOf()>15e3?i(new Error("grecaptcha not loaded after 15 seconds")):setTimeout(n,250)}()})}Object.defineProperty(t,"__esModule",{value:!0}),t.RecaptchaElement=void 0,t.injectScript=function(e){if(void 0!==window.grecaptcha)throw new Error("grecaptcha is already defined");const t=document.createElement("script");t.src="https://www.google.com/recaptcha/api.js?render=explicit",t.async=!0,t.defer=!0,t.onload=e||null,"interactive"===document.readyState||"complete"===document.readyState?document.body.appendChild(t):window.addEventListener("DOMContentLoaded",()=>{document.body.appendChild(t)})},t.wrapElement=function(e,t,i){const n=Object.assign(Object.assign({},i||{}),{sitekey:t}),o=new r(e,n);return o.render(),o},t.wrapElementWithThrow=function(e,t,n){return i(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},n||{}),{sitekey:t}),o=new r(e,i);return yield o.render(),o})};class r{constructor(e,t){this.container=e,this.params=t,this.executeResolveQueue=[]}render(){return void 0!==this.widgetId&&console.warn("rendering an already-rendered widget"),n().then(e=>{this.widgetId=e.render(this.container,Object.assign(Object.assign({},this.params),{callback:e=>{var t;this.resolvedToken=e,null===(t=this.executeResolveQueue.pop())||void 0===t||t(e)},"expired-callback":()=>{this.resolvedToken=void 0}}))})}resolveToken(){return new Promise((e,t)=>{n().then(i=>{if("invisible"!==this.params.size){const n=i.getResponse();return n?e(n):t(new Error("checkbox recaptcha is not checked"))}this.executeResolveQueue.push(e),void 0!==this.resolvedToken&&(this.resolvedToken=void 0,i.reset(this.widgetId)),i.execute(this.widgetId)}).catch(e=>{t(e)})})}}t.RecaptchaElement=r},122:function(e,t){var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.handleCFChallenge=void 0;let n=null;t.handleCFChallenge=(e,t)=>new Promise((e,r)=>i(void 0,void 0,void 0,function*(){var i,o,a;try{const r=null===window||void 0===window?void 0:window.document;if(!r||!window)throw new Error("document is not present on window");const o=r.createElement("div"),a=r.createElement("div"),s=i=>{var n;null===(n=null==i?void 0:i.render)||void 0===n||n.call(i,"#iDonateTurnstileBox",{sitekey:t.config.turnstileSiteKey,callback(t,i){o.remove(),e({token:t,preClearance:i})}})};if(window.idonateTurnstileLoadedHandler=()=>{const e=window.turnstile;a.innerHTML="",e&&(n=e),s(e)},o.setAttribute("id","idonateTurnstileWrapper"),o.style.position="fixed",o.style.top="0",o.style.bottom="0",o.style.left="0",o.style.right="0",o.style.backgroundColor="rgba(0,0,0,0.9)",o.style.transition="all 400ms",o.style.display="flex",o.style.flexDirection="column",o.style.padding="40px 30px",o.style.opacity="0",o.style.color="white",o.style.fontFamily="sans-serif",o.style.zIndex="1000",o.innerHTML='<h1 id="idonateTurnstileVerificationHeader">Last tiny step before we submit your payment:</h1>',a.setAttribute("id","iDonateTurnstileBox"),o.append(a),r.body.append(o),n)s(n);else{const e=r.createElement("script");a.innerHTML="loading ...",e.src=t.config.turnstileCdnUrl+"?render=explicit&onload=idonateTurnstileLoadedHandler",r.body.append(e)}null===(i=a.scrollIntoView)||void 0===i||i.call(a),o.style.opacity="1"}catch(e){null===(o=null===console||void 0===console?void 0:console.error)||void 0===o||o.call(console,e),null===(a=null===console||void 0===console?void 0:console.warn)||void 0===a||a.call(console,"iDonate SDK: Could not handle request, please reload the page and try again"),r(null)}}))},138:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.PayPalTokenizer=void 0;const r=i(415),o=i(367),a="paypal-sdk-script";class s extends r.Tokenizer{constructor(e,t,i,n){var r,o;super(),this.gateway=e,this.containerId=t,this.configContext=n,this.mode="credit_card";const a=e.config;if(!(null==a?void 0:a.client_id))throw new Error("PayPal gateway configuration missing client_id");this.clientId=a.client_id,this.sandboxMode=null!==(r=a.sandbox_mode)&&void 0!==r&&r,this.currency=i.currency||"USD",this.amount=i.amount,this.enableVenmo=null===(o=i.enableVenmo)||void 0===o||o,this.locale=i.locale||"en_US",this.onCreateOrder=i.onCreateOrder,this.organizationId=n.organizationId,this.embedId=n.embedId,this.clientConfig=n.clientConfig}static create(e,t,i){return n(this,void 0,void 0,function*(){const n=new s(e,t.containerId,t,i);return yield n.init(),n})}init(){return n(this,void 0,void 0,function*(){if(this.containerEl=document.getElementById(this.containerId),!this.containerEl)throw new Error(`Container element not found: ${this.containerId}`);return this.containerEl.innerHTML="",Object.assign(this.containerEl.style,{display:"flex",flexDirection:"column",gap:"0.5rem",alignItems:"stretch"}),new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("PayPal SDK initialization timeout"))},1e4);this.loadPayPalSDK().then(()=>(clearTimeout(i),this.renderButtons())).then(()=>{this.emit("ready"),this.emit("validation",{isValid:!0}),e()}).catch(e=>{clearTimeout(i),this.emit("error",new o.TokenizationError("Failed to initialize PayPal","INIT_FAILED")),t(e)})})})}loadPayPalSDK(){return n(this,void 0,void 0,function*(){if(window.paypal)return Promise.resolve();if(document.getElementById(a))return this.waitForPayPalGlobal();const e=new URLSearchParams({"client-id":this.clientId,currency:this.currency,intent:"capture"}),t=["card","paylater"];this.enableVenmo?e.set("enable-funding","venmo"):t.push("venmo"),e.set("disable-funding",t.join(","));const i=document.createElement("script");return i.id=a,i.src=`https://www.paypal.com/sdk/js?${e.toString()}`,i.async=!0,new Promise((e,t)=>{i.onload=()=>{this.waitForPayPalGlobal().then(e).catch(t)},i.onerror=()=>{t(new Error("Failed to load PayPal SDK"))},document.head.appendChild(i)})})}waitForPayPalGlobal(){return n(this,arguments,void 0,function*(e=5e3){const t=Date.now();for(;Date.now()-t<e;){if(window.paypal)return Promise.resolve();yield new Promise(e=>setTimeout(e,100))}throw new Error("Timeout waiting for PayPal SDK to load")})}renderButtons(){return n(this,void 0,void 0,function*(){if(!window.paypal)throw new Error("PayPal SDK not loaded");if(!this.containerEl)throw new Error("Container element not found");this.paypalButtonContainer=document.createElement("div"),this.paypalButtonContainer.id=`${this.containerId}-buttons`,this.paypalButtonContainer.style.minHeight="40px",this.containerEl.appendChild(this.paypalButtonContainer),yield this.renderPayPalButtons()})}renderPayPalButtons(){return n(this,void 0,void 0,function*(){if(!window.paypal||!this.paypalButtonContainer)return;const e=window.paypal.Buttons({createOrder:()=>this.createOrder(),onApprove:e=>this.handleApprove(e),onCancel:e=>this.handleCancel(e),onError:e=>this.handleError(e,"PayPal error"),style:{layout:"vertical",shape:"rect",height:40}});yield e.render(this.paypalButtonContainer)})}createOrder(){const e=`${this.clientConfig.embedApiBaseUrl}/payment/paypal/create-order`;let t,i=this.currency;if(this.onCreateOrder){const e=this.onCreateOrder();t=e.amount,i=e.currency||this.currency}else t=this.amount;if(void 0===t||t<=0){const e=new Error("Amount is required to create PayPal order");return this.handleError(e,"Order creation failed"),Promise.reject(e)}const n={payment_gateway_id:this.gateway.id,currency:i,amount:t};return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.json()}).then(e=>{if(!e.orderId)throw new Error("Order creation failed: missing orderId");return this.paymentTransactionId=e.payment_transaction_id,this.paymentMethodId=e.payment_method_id,e.orderId}).catch(e=>{throw this.handleError(e,"Order creation failed"),e})}handleApprove(e){return n(this,void 0,void 0,function*(){const t={token:e.orderID,lastFour:e.orderID.slice(-4),provider:"paypal_checkout",paymentMethodId:this.paymentMethodId,paymentTransactionId:this.paymentTransactionId};this.cachedToken=t,this.emit("validation",{isValid:!0,hasToken:!0}),this.emit("tokenReady",t)})}handleCancel(e){this.emit("error",new o.TokenizationError("Payment cancelled by user","USER_CANCELLED"))}handleError(e,t){const i=(null==e?void 0:e.message)||(null==e?void 0:e.toString())||"Unknown error";this.emit("error",new o.TokenizationError(`${t}: ${i}`,(null==e?void 0:e.code)||"PAYPAL_ERROR"))}tokenize(e){return n(this,void 0,void 0,function*(){if(!this.isReady)throw new Error("Tokenizer not initialized");if(this.cachedToken)return this.cachedToken;throw new o.TokenizationError("No PayPal order approved. User must click PayPal or Venmo button to complete payment.","NO_TOKEN")})}validate(){return n(this,void 0,void 0,function*(){return{isValid:!0,errors:[]}})}clear(){this.cachedToken=void 0,this.emit("validation",{isValid:!0,hasToken:!1})}focus(e){}destroy(){this.containerEl&&(this.containerEl.innerHTML=""),this.eventHandlers.clear(),this.cachedToken=void 0}hasToken(){return!!this.cachedToken}getToken(){return this.cachedToken||null}get tokenizationMode(){return"auto"}}t.PayPalTokenizer=s},156:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buildCashPaymentPayload=function(e,t){var i,n,r,o,a,s,d,l,c,u,h,p,m,y,b,v,f;const g={country:t.billingAddress.country,address1:t.billingAddress.address1,address2:t.billingAddress.address2,city:t.billingAddress.city,state:t.billingAddress.state,zip_code:t.billingAddress.zip},E={title:t.billingContact.salutation,first_name:t.billingContact.firstName,middle_name:t.billingContact.middleName,last_name:t.billingContact.lastName,company_name:t.billingContact.company,email:t.billingContact.email,home_phone:t.billingContact.primaryPhone,timezone:(new Intl.DateTimeFormat).resolvedOptions().timeZone},_={payment_method_id:t.paymentMethodId,payment_transaction_id:t.paymentTransactionId,gateway_id:t.paymentGatewayId,amount:t.paymentAmount,type:"cash",frequency:t.recurringFrequency,start_date:t.recurringStart,end_date:t.recurringEnd,retain_on_success:t.retainPaymentMethod},N={organization_id:e,campaign_id:t.campaignId,reference_code:t.referenceCode,double_the_donation_company_id:t.corporateMatchingId,donor_id:t.donorId,hide_name:t.anonymousOptIn,show_name_to_fundraiser:t.showNameToFundraiserOptIn,email_opt_in:t.emailOptIn,donor_paid_fee:t.donorPaidFeeAmount,designation_note:t.designationNote,gift_id:t.giftId,gift_extra:t.giftExtra,gift_skipped:t.giftSkipped,p2p_fundraiser_id:t.p2pFundraiserId,p2p_fundraiser_comment:t.p2pFundraiserComment,organization_event_id:t.organizationEventId,advocate_id:t.advocateId,advocacy_program_id:t.advocacyProgramId,advocacy_team_id:t.advocacyTeamId,page_id:t.landingPageId,embed_id:t.embedId,tribute_definition_id:null===(i=t.tribute)||void 0===i?void 0:i.tributeDefinitionId,tribute_recipient_first_name:null===(n=t.tribute)||void 0===n?void 0:n.tributeFirstName,tribute_recipient_last_name:null===(r=t.tribute)||void 0===r?void 0:r.tributeLastName,tribute_address1:null===(o=t.tribute)||void 0===o?void 0:o.tributeAddress1,tribute_address2:null===(a=t.tribute)||void 0===a?void 0:a.tributeAddress2,tribute_city:null===(s=t.tribute)||void 0===s?void 0:s.tributeCity,tribute_state:null===(d=t.tribute)||void 0===d?void 0:d.tributeState,tribute_postal_code:null===(l=t.tribute)||void 0===l?void 0:l.tributePostalCode,tribute_country:null===(c=t.tribute)||void 0===c?void 0:c.tributeCountry,tribute_from_name:null===(u=t.tribute)||void 0===u?void 0:u.tributeFromName,tribute_recipient_email:null===(h=t.tribute)||void 0===h?void 0:h.tributeRecipientEmail,honorees:null===(p=t.tribute)||void 0===p?void 0:p.honorees,tribute_send_card:null===(m=t.tribute)||void 0===m?void 0:m.tributeSendCard,tribute_include_amount:null===(y=t.tribute)||void 0===y?void 0:y.tributeIncludeAmount,tribute_skipped:null===(b=t.tribute)||void 0===b?void 0:b.tributeSkipped,tribute_type:null===(v=t.tribute)||void 0===v?void 0:v.tributeType,useOnBillingAddress:null===(f=t.tribute)||void 0===f?void 0:f.useOnBillingAddress,embed_referer:window.location.href,converted_to_recurring:t.convertedToRecurring};t.designations?N.designations=t.designations:N.designations=[],t.designationId&&N.designations.push({id:t.designationId,amount:t.paymentAmount});const I={};return t.utm&&(t.utm.campaign&&(I.utm_campaign=t.utm.campaign),t.utm.content&&(I.utm_content=t.utm.content),t.utm.medium&&(I.utm_medium=t.utm.medium),t.utm.source&&(I.utm_source=t.utm.source),t.utm.term&&(I.utm_term=t.utm.term)),t.customerMeta&&[1,2,3,4,5].forEach(e=>{const i=`custom_note_${e}`;t.customerMeta[i]&&(N[i]=t.customerMeta[i],delete t.customerMeta[i])}),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},N),g),E),_),I),{customer_meta:t.customerMeta||{},recaptcha_token:t.recaptchaToken,recaptcha_type:t.recaptchaType})},t.buildDonationResult=function(e){let t,i,n,r,o;return e._raw_response.transaction&&(o=e._raw_response.transaction),e._raw_response.schedule&&(r=e._raw_response.schedule),e._raw_response.donor&&(n=e._raw_response.donor),e._raw_response.designation&&(i=e._raw_response.designation),e._raw_response.campaign&&(t=e._raw_response.campaign),Object.assign(Object.assign({},e),{campaign:t,designation:i,donor:n,schedule:r,transaction:o})},t.buildCreatePaymentMethodPayload=function(e){return{gateway_id:e.paymentGatewayId,backend_name:e.backendName,payment_method_type:e.paymentMethodType,payment_method_token:e.paymentMethodToken,donor_id:e.donorId,first_name:e.contact.firstName,last_name:e.contact.lastName,company:e.contact.company,email:e.contact.email,phone:e.contact.primaryPhone,country:e.address.country,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip_code:e.address.zip,embed_id:e.embedId,recaptcha_token:e.recaptchaToken,recaptcha_type:e.recaptchaType}},t.collapseClientErrors=function(e){return new n.ClientError(e.map(e=>e.message).join("\n "),{_rawPayload:e})},t.buildCreatePaymentMethodResult=function(e){return Object.assign(Object.assign({},e),{paymentMethodId:e._raw_response.result.id})},t.unpackSpreedlyResponse=function(e){return e.json().then(e=>{if(e.errors)throw new n.ClientError(e.errors.map(e=>e.message).join("\n "),e);return e})},t.extractSpreedlyToken=function(e){if(!e.transaction||!e.transaction.payment_method)throw new n.ClientError("Payment Method not tokenized.");return e.transaction.payment_method.token};const n=i(523)},247:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CLIENT_HEADERS=t.CARD_CONNECT_DEFAULT_STYLE=t.DEFAULT_APP_NAME=t.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL=t.FALLBACK_CF_TURNSTILE_SITE_KEY=t.FALLBACK_PC_SCRIPT_ID=t.FALLBACK_PC_SCRIPT_URL=t.SANDBOX_APPLE_PAY_URL=t.APPLE_PAY_URL=t.SPREEDLY_TOKENIZER_URL=t.SANDBOX_CARD_CONNECT_BASE_URL=t.PRODUCTION_CARD_CONNECT_BASE_URL=t.SANDBOX_BASE_URL=t.PRODUCTION_BASE_URL=t.SDK_VERSION=void 0,t.SDK_VERSION="1.2.0-dev9",t.PRODUCTION_BASE_URL="https://secure-api.idonate.com",t.SANDBOX_BASE_URL="https://api.qa-idonate.com",t.PRODUCTION_CARD_CONNECT_BASE_URL="https://boltgw.cardconnect.com:8443",t.SANDBOX_CARD_CONNECT_BASE_URL="https://boltgw-uat.cardconnect.com",t.SPREEDLY_TOKENIZER_URL="https://core.spreedly.com/v1/payment_methods.json",t.APPLE_PAY_URL="https://apple-pay-gateway.apple.com/paymentservices/paymentSession",t.SANDBOX_APPLE_PAY_URL="https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession",t.FALLBACK_PC_SCRIPT_URL="https://p.idonate.com/r",t.FALLBACK_PC_SCRIPT_ID="_3fd4dad26e8c277bc50fb2ddf8233b50bc8d9704",t.FALLBACK_CF_TURNSTILE_SITE_KEY="0x4AAAAAAAxuRxNZTvX8shIj",t.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL="https://challenges.cloudflare.com/turnstile/v0/api.js",t.DEFAULT_APP_NAME="unnamed-sdk-client",t.CARD_CONNECT_DEFAULT_STYLE="\nbody {\n margin: 0;\n}\n\nform {\n display: flex;\n}\n\nlabel#cccardlabel {\n display: none;\n}\n\nbr {\n display: none;\n}\n\nlabel#cccvvlabel {\n display: none;\n}\n\nlabel#ccexpirylabel {\n display: none;\n}\n\ninput {\n padding: 10px;\n}\n\nselect {\n padding: 10px;\n font-size: 14px;\n color: #8b959d;\n}\n\nselect#ccexpirymonth {\n margin-right: -30px;\n border: 1px solid #b6b8ba;\n border-right: 0;\n}\n\ninput#ccnumfield {\n width: 70%;\n border: 1px solid #b6b8ba;\n border-right: 0;\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n font-size: 14px;\n color: #8b959d;\n}\n\nselect#ccexpiryyear {\n border: 1px solid #b6b8ba;\n border-right: 0;\n}\n\ninput#cccvvfield {\n border: 1px solid #b6b8ba;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n font-size: 14px;\n color: #8b959d;\n}\n".replace(/\s+/gi," "),t.CLIENT_HEADERS={"User-Agent":("undefined"!=typeof navigator?navigator.userAgent:"undefined"!=typeof process&&process.version?`Node.js/${process.version} (${process.platform})`:"unknown-runtime")+` idonate-sdk@${t.SDK_VERSION}`,"Content-Type":"application/json"}},367:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TokenizationError=void 0;class i extends Error{constructor(e,t){super("string"==typeof e?e:e.map(e=>e.message||e).join(", ")),this.name="TokenizationError",this.code=t,Array.isArray(e)?this.errors=e.map(e=>({field:e.field||e.attribute||"unknown",message:e.message||e.error||String(e),code:e.code||e.key})):this.errors=[{field:"cardNumber",message:e,code:t}]}}t.TokenizationError=i},415:function(e,t,i){var n,r=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=n(e),a=0;a<i.length;a++)"default"!==i[a]&&r(t,e,i[a]);return o(t,e),t}),s=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.Tokenizer=void 0;const d=i(631);t.Tokenizer=class{constructor(){this.mode="credit_card",this.eventHandlers=new Map,this._isReady=!1}get isReady(){return this._isReady}getMode(){return this.mode}on(e,t){if(this.eventHandlers.has(e)||this.eventHandlers.set(e,new Set),this.eventHandlers.get(e).add(t),"ready"===e&&this._isReady)try{t()}catch(e){}}off(e,t){const i=this.eventHandlers.get(e);i&&i.delete(t)}emit(e,t){"ready"===e&&(this._isReady=!0);const i=this.eventHandlers.get(e);i&&i.forEach(e=>{try{e(t)}catch(e){}})}isCardData(e){return"credit_card"===this.mode}isBankAccountData(e){return"bank_account"===this.mode}normalizeCardType(e){return{visa:"visa",mastercard:"mastercard",master:"mastercard",americanexpress:"amex",amex:"amex",discover:"discover",dinersclub:"diners",diners:"diners",jcb:"jcb"}[e.toLowerCase().replace(/[\s-_]/g,"")]||"unknown"}addExpiryFormatter(e){e&&(e.addEventListener("input",e=>{const t=e.target;t.value=(0,d.formatExpiryInput)(t.value),this.emit("change",{field:"expiry"})}),e.addEventListener("keypress",e=>{const t=String.fromCharCode(e.which);/[0-9\/]/.test(t)||8===e.which||e.preventDefault()}))}parseExpiry(e){return(null==e?void 0:e.value)?(0,d.parseExpiryDate)(e.value):null}applyInputStyles(e,t,i){const n=t.input,r="0"===t.container.gap;if(Object.assign(e.style,{height:n.height,padding:n.padding,fontSize:n.fontSize,fontFamily:n.fontFamily,backgroundColor:n.backgroundColor,color:n.color,boxSizing:"border-box",width:"100%",transition:n.transition}),r&&i){switch(e.style.borderTop=n.border,e.style.borderBottom=n.border,i){case"left":case"middle":e.style.borderLeft=n.border,e.style.borderRight="none";break;case"right":e.style.borderLeft=n.border,e.style.borderRight=n.border}e.style.borderRadius=(0,d.getConnectedBorderRadius)(n.borderRadius,i,!0)}else e.style.border=n.border,e.style.borderRadius=n.borderRadius;(0,d.addFocusHandlers)(e,t)}generateFieldIds(e){return{numberId:`${e}-card-number`,expiryId:`${e}-expiry`,cvvId:`${e}-cvv`}}static create(e,t,n){return s(this,void 0,void 0,function*(){switch(e.backend_name){case"spreedly":{const{SpreedlyTokenizer:r}=yield Promise.resolve().then(()=>a(i(875)));return r.create(e,t,n)}case"card_connect":{const{CardConnectTokenizer:r}=yield Promise.resolve().then(()=>a(i(601)));return r.create(e,t,n)}case"paypal_checkout":{const{PayPalTokenizer:r}=yield Promise.resolve().then(()=>a(i(138)));return r.create(e,t,n)}default:throw new Error(`Unsupported payment backend: ${e.backend_name}`)}})}}},454:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_UNIFIED_STYLES=void 0,t.mergeStyles=function(e,t){return t?{input:Object.assign(Object.assign({},e.input),t.input),focus:Object.assign(Object.assign({},e.focus),t.focus),error:Object.assign(Object.assign({},e.error),t.error),container:Object.assign(Object.assign({},e.container),t.container),twoLine:Object.assign(Object.assign({},e.twoLine),t.twoLine)}:e},t.getContainerStylesForLayout=function(e,t="single-line"){return"two-line"===t?Object.assign(Object.assign({},e),{container:Object.assign(Object.assign({},e.container),{flexWrap:"wrap",rowGap:e.container.rowGap||e.container.gap})}):e},t.DEFAULT_UNIFIED_STYLES={input:{height:"40px",padding:"10px 12px",fontSize:"14px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',color:"#333",backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",boxSizing:"border-box",width:"100%",transition:"all 0.15s ease-in-out"},focus:{borderColor:"#007bff",outline:"none",boxShadow:"0 0 0 2px rgba(0, 123, 255, 0.25)"},error:{borderColor:"#dc3545"},container:{display:"flex",gap:"1rem",alignItems:"center",flexWrap:"nowrap",rowGap:"1rem"},twoLine:{padding:"",fontSize:"",textAlign:""}}},472:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.receiveEmbedData=function(){let e;return new Promise((t,i)=>{window.parent||i("Cannot receive data without parent"),e=e=>{let i;try{i=JSON.parse(e.data)}catch(e){return}i.embedData&&t(i.embedData)},window.addEventListener("message",e)}).then(t=>(window.removeEventListener("message",e),t))},t.sanitizeString=o,t.sanitizeArray=a,t.sanitizeObject=s,t.splitName=function(e){const t=e.split(" ");return{firstName:t.slice(0,-1).join(" ")||"NOT GIVEN",lastName:t.slice(-1).join(" ")}},t.parseResponse=function(e,t){return e.json().then(i=>{const o=[];if(200!==e.status&&(void 0!==i.result&&Object.keys(i.result).forEach(e=>{o.push(new n.ClientError(e+": "+i.result[e].join("\n "),{field:e}))}),void 0!==i.messages?i.messages.forEach(e=>{"error"===e.category&&o.push(new n.ClientError(e.message))}):o.push(new n.ClientError(i.message))),t&&t.throwErrors&&o.length)throw(0,r.collapseClientErrors)(o);return{errors:o,_raw_response:i}})};const n=i(523),r=i(156);function o(e){if(!e)return e;const t=document.createElement("div");t.innerHTML=e;const i=Array.from(t.getElementsByTagName("script"));for(const e of i)e.parentNode&&e.parentNode.removeChild(e);return t.innerHTML}function a(e){return e.map(s)}function s(e){if(null==e)return e;if(Array.isArray(e))return a(e);if("string"==typeof e)return o(e);if("object"==typeof e){const t={};for(const[i,n]of Object.entries(e))Array.isArray(n)?t[i]=a(n):t[i]="string"==typeof n?o(n):s(n);return t}return e}},523:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ClientError=t.ApplePaySessionStatus=void 0,t.ApplePaySessionStatus={STATUS_SUCCESS:"undefined"!=typeof ApplePaySession?ApplePaySession.STATUS_SUCCESS:1,STATUS_FAILURE:"undefined"!=typeof ApplePaySession?ApplePaySession.STATUS_FAILURE:0};class i extends Error{constructor(e,t){super(e),this.message=e,this.details=t,Error.captureStackTrace&&Error.captureStackTrace(this,i)}}t.ClientError=i},578:function(e,t,i){var n,r=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=n(e),a=0;a<i.length;a++)"default"!==i[a]&&r(t,e,i[a]);return o(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.iats=t.TokenizationError=t.PayPalTokenizer=t.CardConnectTokenizer=t.SpreedlyTokenizer=t.Tokenizer=void 0;const s=a(i(903));t.iats=s;var d=i(415);Object.defineProperty(t,"Tokenizer",{enumerable:!0,get:function(){return d.Tokenizer}});var l=i(875);Object.defineProperty(t,"SpreedlyTokenizer",{enumerable:!0,get:function(){return l.SpreedlyTokenizer}});var c=i(601);Object.defineProperty(t,"CardConnectTokenizer",{enumerable:!0,get:function(){return c.CardConnectTokenizer}});var u=i(138);Object.defineProperty(t,"PayPalTokenizer",{enumerable:!0,get:function(){return u.PayPalTokenizer}});var h=i(367);Object.defineProperty(t,"TokenizationError",{enumerable:!0,get:function(){return h.TokenizationError}})},592:function(e,t){var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.fetchSpreedlySecurityArgs=function(e,t,n){return i(this,void 0,void 0,function*(){if(!e.enableSpreedlySecureTokenization)throw new Error("Secure tokenization is not enabled");const r=()=>i(this,void 0,void 0,function*(){const i=yield fetch(`${e.embedApiBaseUrl}/spreedly/security-args`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organization_id:t,embed_id:n})});if(!i.ok)throw new Error(`Security args request failed: ${i.status}`);return i.json()});try{return yield r()}catch(e){if(e instanceof TypeError&&e.message.includes("fetch"))return yield new Promise(e=>setTimeout(e,1e3)),r();throw e}})}},601:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CardConnectTokenizer=void 0;const o=i(415),a=i(367),s=r(i(731)),d=i(454),l=i(799),c=i(631);class u extends o.Tokenizer{constructor(e,t,i,n="credit_card",r=!1,o="single-line"){super(),this.iframeUrl=t,this.containerId=i,this.layout=o,this.enableTestMode=!1,this.mode=n,this.enableTestMode=r,this.iframe=e;const a=new URL(t);this.expectedOrigin=`${a.protocol}//${a.host}`,this.currentValidationState={isValid:!1,cardNumber:{isValid:!1,isEmpty:!0},cvv:{isValid:!1,isEmpty:!0},expiry:{isValid:!1,isEmpty:!0}}}static create(e,t,i){return n(this,void 0,void 0,function*(){var n;if("bank_account"===t.mode&&"CA"===t.bankCountry)throw new Error("CardConnect does not support Canadian bank accounts");let r="single-line";if("responsive"===t.layout){const e=document.getElementById(t.containerId);r=((null==e?void 0:e.offsetWidth)||0)<(t.responsiveBreakpoint||l.RESPONSIVE_BREAKPOINT)?"two-line":"single-line"}else"two-line"===t.layout&&(r="two-line");const o=Object.assign(Object.assign({},t),{layout:r});let a=(null===(n=e.config)||void 0===n?void 0:n.base_url)||i.clientConfig.cardConnectBaseUrl;i.cardConnectBaseUrl=a;const s=(0,d.mergeStyles)(d.DEFAULT_UNIFIED_STYLES,t.styling),c=u.generateIframeUrl(a,o),h=u.createIframe(c,s),p=new u(h,c,t.containerId,t.mode||"credit_card",t.enableTestMode||!1,r);return p.createInternalElements(o),yield p.init(),p})}createInternalElements(e){const t=document.getElementById(e.containerId);if(!t)throw new Error(`Container element not found: ${e.containerId}`);this.containerEl=t,t.innerHTML="";const i=(0,d.getContainerStylesForLayout)((0,d.mergeStyles)(d.DEFAULT_UNIFIED_STYLES,e.styling),this.layout);Object.assign(t.style,i.container),"bank_account"===this.mode?this.createBankAccountFields(t,i):this.createCreditCardFields(t,i)}createCreditCardFields(e,t){if(this.iframe.style.width="100%","two-line"===this.layout||"responsive"===this.layout){const e=t.input.height||"40px";this.iframe.style.height=`calc((${e}) * 2 + 10px)`}else this.iframe.style.height=t.input.height||"40px";this.iframe.style.border="none",this.iframe.style.display="block",e.appendChild(this.iframe)}createBankAccountFields(e,t){this.iframe.style.display="none","two-line"===this.layout?(this.accountTypeEl=(0,c.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:"1",minWidth:l.BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,t,"left"),e.appendChild(this.accountTypeEl),this.routingNumberEl=(0,c.createInputElement)(`${this.containerId}-routing`,"text","Routing *",9),Object.assign(this.routingNumberEl.style,{flex:"1",minWidth:l.BANK_FIELD_FLEX.routingNumber.minWidth}),this.applyInputStyles(this.routingNumberEl,t,"right"),e.appendChild(this.routingNumberEl),this.accountNumberEl=(0,c.createInputElement)(`${this.containerId}-account`,"text","Account Number *",17),Object.assign(this.accountNumberEl.style,{flex:"1",flexBasis:"100%",minWidth:l.BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,t),e.appendChild(this.accountNumberEl)):(this.routingNumberEl=(0,c.createInputElement)(`${this.containerId}-routing`,"text","Routing *",9),Object.assign(this.routingNumberEl.style,{flex:l.BANK_FIELD_FLEX.routingNumber.flex,minWidth:l.BANK_FIELD_FLEX.routingNumber.minWidth}),this.applyInputStyles(this.routingNumberEl,t,"left"),e.appendChild(this.routingNumberEl),this.accountNumberEl=(0,c.createInputElement)(`${this.containerId}-account`,"text","Account Number *",17),Object.assign(this.accountNumberEl.style,{flex:l.BANK_FIELD_FLEX.accountNumber.flex,minWidth:l.BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,t,"middle"),e.appendChild(this.accountNumberEl),this.accountTypeEl=(0,c.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:l.BANK_FIELD_FLEX.accountType.flex,minWidth:l.BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,t,"right"),e.appendChild(this.accountTypeEl))}init(){return n(this,void 0,void 0,function*(){return"bank_account"===this.mode?(this.enableTestMode&&setTimeout(()=>{this.routingNumberEl&&(this.routingNumberEl.value="021000021",this.routingNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountNumberEl&&(this.accountNumberEl.value="9876543210",this.accountNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountTypeEl&&(this.accountTypeEl.value="checking",this.accountTypeEl.dispatchEvent(new Event("change",{bubbles:!0})))},100),this.emit("ready"),Promise.resolve()):new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("CardConnect initialization timeout"))},l.INIT_TIMEOUT);this.messageHandler=e=>{e.origin===this.expectedOrigin&&this.handleMessage(e)},window.addEventListener("message",this.messageHandler),this.iframe.onload=()=>{clearTimeout(i),this.enableTestMode&&this.mode,this.emit("ready"),e()},this.iframe.onerror=()=>{clearTimeout(i),t(new Error("Failed to load CardConnect iframe"))}})})}tokenize(e){return n(this,void 0,void 0,function*(){if(!this.isReady)throw new Error("Tokenizer not initialized");if("credit_card"===this.mode&&this.hasToken()){const e=this.getToken();if(e)return e}return"bank_account"===this.mode||this.isBankAccountData(e)?this.tokenizeBankAccountInternal(e):this.tokenizeCardInternal(e)})}tokenizeCardInternal(e){return n(this,void 0,void 0,function*(){return this.cachedTokenResult&&"0"===this.cachedTokenResult.errorCode?{token:this.cachedTokenResult.token,lastFour:this.cachedTokenResult.token.slice(-4),cardType:this.normalizeCardType("unknown"),provider:"cardconnect"}:(this.tokenizationPromise||(this.tokenizationPromise=new Promise((e,t)=>{this.tokenizationResolve=e,this.tokenizationReject=t;const i=setTimeout(()=>{this.tokenizationPromise=void 0,this.tokenizationResolve=void 0,this.tokenizationReject=void 0,t(new a.TokenizationError("Tokenization timeout - ensure all card fields are filled in iframe","TIMEOUT"))},l.TOKENIZE_TIMEOUT),n=e=>{clearTimeout(i),this.off("tokenization",n)};this.on("tokenization",n)})),this.tokenizationPromise)})}tokenizeBankAccountInternal(e){return n(this,void 0,void 0,function*(){var e,t,i;const n=null===(e=this.routingNumberEl)||void 0===e?void 0:e.value,r=null===(t=this.accountNumberEl)||void 0===t?void 0:t.value,o=(null===(i=this.accountTypeEl)||void 0===i?void 0:i.value)||"checking";if(!n||!r)throw new a.TokenizationError("Routing number and account number are required","VALIDATION_ERROR");if(!(0,c.validateRoutingNumber)(n))throw new a.TokenizationError("Invalid routing number","VALIDATION_ERROR");if(!(0,c.validateAccountNumber)(r))throw new a.TokenizationError("Invalid account number","VALIDATION_ERROR");const d=new URL(this.iframeUrl).origin,l=new s.default({});return l.cardConnectBaseUrl=d,{token:(yield u.tokenizeBankAccount(n,r,l)).token,lastFour:r.slice(-4),accountType:o,paymentMethodType:"bank_account",provider:"cardconnect"}})}validate(){return n(this,void 0,void 0,function*(){if(!this.isReady)throw new Error("Tokenizer not initialized");return"bank_account"===this.mode?this.validateBankAccountInternal():this.validateCardInternal()})}validateCardInternal(){return n(this,void 0,void 0,function*(){const e=[];return this.currentValidationState.cardNumber?this.currentValidationState.cardNumber.isEmpty?e.push({field:"cardNumber",message:"Card number is required"}):this.currentValidationState.cardNumber.isValid||e.push({field:"cardNumber",message:"Invalid card number"}):e.push({field:"cardNumber",message:"Card number is required"}),this.currentValidationState.expiry?this.currentValidationState.expiry.isEmpty?e.push({field:"expiry",message:"Expiry date is required"}):this.currentValidationState.expiry.isValid||e.push({field:"expiry",message:"Invalid expiry date"}):e.push({field:"expiry",message:"Expiry date is required"}),this.currentValidationState.cvv?this.currentValidationState.cvv.isEmpty?e.push({field:"cvv",message:"CVV is required"}):this.currentValidationState.cvv.isValid||e.push({field:"cvv",message:"Invalid CVV"}):e.push({field:"cvv",message:"CVV is required"}),{isValid:this.currentValidationState.isValid,errors:e}})}validateBankAccountInternal(){return n(this,void 0,void 0,function*(){var e,t;const i=[];return(null===(e=this.routingNumberEl)||void 0===e?void 0:e.value)?(0,c.validateRoutingNumber)(this.routingNumberEl.value)||i.push({field:"routingNumber",message:"Invalid routing number"}):i.push({field:"routingNumber",message:"Routing number is required"}),(null===(t=this.accountNumberEl)||void 0===t?void 0:t.value)?(0,c.validateAccountNumber)(this.accountNumberEl.value)||i.push({field:"accountNumber",message:"Invalid account number"}):i.push({field:"accountNumber",message:"Account number is required"}),{isValid:0===i.length,errors:i}})}clear(){var e;"bank_account"===this.mode?(this.routingNumberEl&&(this.routingNumberEl.value=""),this.accountNumberEl&&(this.accountNumberEl.value=""),this.accountTypeEl&&(this.accountTypeEl.value="checking")):null===(e=this.iframe.contentWindow)||void 0===e||e.postMessage({action:"clear"},this.expectedOrigin),this.currentValidationState={isValid:!1,cardNumber:{isValid:!1,isEmpty:!0},cvv:{isValid:!1,isEmpty:!0},expiry:{isValid:!1,isEmpty:!0}},this.emit("validation",this.currentValidationState)}focus(e){var t;if("bank_account"===this.mode)"routingNumber"===e&&this.routingNumberEl?this.routingNumberEl.focus():"accountNumber"===e&&this.accountNumberEl&&this.accountNumberEl.focus();else{const i={cardNumber:"number",cvv:"cvv",expiry:"expiry"}[e];i&&(null===(t=this.iframe.contentWindow)||void 0===t||t.postMessage({action:"focus",field:i},this.expectedOrigin))}}destroy(){this.messageHandler&&window.removeEventListener("message",this.messageHandler),this.containerEl&&(this.containerEl.innerHTML=""),this.eventHandlers.clear()}hasToken(){var e,t;return"credit_card"===this.mode&&"0"===(null===(e=this.cachedTokenResult)||void 0===e?void 0:e.errorCode)&&!!(null===(t=this.cachedTokenResult)||void 0===t?void 0:t.token)}getToken(){var e;if("credit_card"===this.mode&&"0"===(null===(e=this.cachedTokenResult)||void 0===e?void 0:e.errorCode)){const e=this.cachedTokenResult.cardType?this.normalizeCardType(this.cachedTokenResult.cardType):this.normalizeCardType("unknown");return{token:this.cachedTokenResult.token,lastFour:this.cachedTokenResult.last4||this.cachedTokenResult.token.slice(-4),cardType:e,provider:"cardconnect"}}return null}get tokenizationMode(){return"credit_card"===this.mode?"auto":"manual"}handleMessage(e){try{const t="string"==typeof e.data?JSON.parse(e.data):e.data;if(t.token&&void 0!==t.errorCode)if(this.cachedTokenResult=t,this.emit("tokenization",t),"0"===t.errorCode){const e=t.cardType?this.normalizeCardType(t.cardType):this.normalizeCardType("unknown");t.cardType&&e!==this.currentCardType&&(this.currentCardType=e,this.emit("cardTypeChange",{cardType:e}));const i={token:t.token,lastFour:t.last4||t.token.slice(-4),cardType:e,provider:"cardconnect"};this.tokenizationResolve&&(this.tokenizationResolve(i),this.tokenizationPromise=void 0,this.tokenizationResolve=void 0,this.tokenizationReject=void 0),this.currentValidationState={isValid:!0,cardNumber:{isValid:!0,isEmpty:!1},cvv:{isValid:!0,isEmpty:!1},expiry:{isValid:!0,isEmpty:!1}},this.emit("validation",{isValid:!0}),this.emit("tokenReady",i)}else this.tokenizationReject&&(this.tokenizationReject(new a.TokenizationError(t.errorMessage||"Tokenization failed",t.errorCode||"UNKNOWN")),this.tokenizationPromise=void 0,this.tokenizationResolve=void 0,this.tokenizationReject=void 0);if("validation"!==t.event&&void 0===t.validationError||this.handleValidationMessage(t),"focus"!==t.event&&"blur"!==t.event||this.emit(t.event,{field:t.data}),("input"===t.event||"change"===t.event)&&(this.emit("change",{field:t.data}),t.cardType)){const e=this.normalizeCardType(t.cardType);e!==this.currentCardType&&(this.currentCardType=e,this.emit("cardTypeChange",{cardType:e}))}}catch(e){}}handleValidationMessage(e){var t,i,n,r,o,a;if(e.validationError){const t=e.validationError.toLowerCase();t.includes("card")||t.includes("number")?this.currentValidationState.cardNumber={isValid:!1,isEmpty:!1}:t.includes("cvv")||t.includes("security")?this.currentValidationState.cvv={isValid:!1,isEmpty:!1}:(t.includes("expir")||t.includes("month")||t.includes("year"))&&(this.currentValidationState.expiry={isValid:!1,isEmpty:!1}),this.currentValidationState.isValid=!1,this.emit("validation",this.currentValidationState)}else this.currentValidationState.isValid=null!==(i=null===(t=this.currentValidationState.cardNumber)||void 0===t?void 0:t.isValid)&&void 0!==i&&i&&null!==(r=null===(n=this.currentValidationState.cvv)||void 0===n?void 0:n.isValid)&&void 0!==r&&r&&null!==(a=null===(o=this.currentValidationState.expiry)||void 0===o?void 0:o.isValid)&&void 0!==a&&a}static generateIframeUrl(e,t){const i=new URLSearchParams({invalidinputevent:"true",enhancedresponse:"true",useexpiry:"true",usecvv:"true",formatinput:"true",unique:"true",norsa:"true",placeholder:"Card Number *",placeholdercvv:"CVV",invalidcreditcardevent:"true",invalidexpiry:"true",invalidcvv:"true"});"two-line"===t.layout?(i.set("useexpiryfield","true"),i.set("orientation","horizontal"),i.set("placeholdermonth","MM"),i.set("placeholderyear","YYYY")):(i.set("orientation","horizontal"),i.set("placeholdermonth","MM"),i.set("placeholderyear","YYYY"));const n=(0,d.mergeStyles)(d.DEFAULT_UNIFIED_STYLES,t.styling),r="undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)&&!/Chrome/.test(navigator.userAgent)&&!/Mobile/.test(navigator.userAgent),o=u.generateCardConnectCss(n,t.layout||"single-line",r),a=[];return i.forEach((e,t)=>{a.push(`${encodeURIComponent(t)}=${encodeURIComponent(e)}`)}),a.push(`css=${o}`),`${e}/itoke/ajax-tokenizer.html?${a.join("&")}`}static createIframe(e,t){const i=document.createElement("iframe");return i.src=e,i.style.width="100%",i.style.height=t.input.height,i.style.border="none",i.style.overflow="hidden",i.style.display="block",i.style.minWidth="0",t.container&&(Object.entries(t.container).forEach(([e,t])=>{"height"!==e&&"width"!==e&&(i.style[e]=t)}),t.container.width&&(i.style.width=t.container.width)),i.setAttribute("scrolling","no"),i.setAttribute("title","Secure card input"),i.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),i}static generateCardConnectCss(e,t="single-line",i=!1){var n,r,o,a,s,d,l,c,u;const h=[];"two-line"===t?(h.push("html,form,body{margin:0;padding:0;}"),h.push("label{display:none;}"),h.push("br{display:none;}")):(h.push("body{margin:0;padding:0;display:flex;align-items:center;}"),h.push("form{margin:0;padding:0;display:flex;width:100%;align-items:center;}"),h.push("label{display:none;}"),h.push("br{display:none;}"));const p="0"===e.container.gap,m=p?"0":e.container.gap||"1rem";if(e.input){const t=[];e.input.height&&t.push(`height:${e.input.height}`),e.input.padding&&t.push(`padding:${e.input.padding}`),e.input.fontSize&&t.push(`font-size:${e.input.fontSize}`),e.input.fontFamily&&t.push(`font-family:${e.input.fontFamily}`),e.input.border&&t.push(`border:${e.input.border}`),e.input.backgroundColor&&t.push(`background-color:${e.input.backgroundColor}`),e.input.color&&t.push(`color:${e.input.color}`),t.push("box-sizing:border-box");const n=t.join(";");h.push(`input{${n};}`),i?h.push(`select{${n};-webkit-appearance:none;appearance:none;}`):h.push(`select{${n};}`)}if("two-line"===t){h.push("input#ccnumfield{width:100%;display:block;margin-bottom:8px;}");const t=(null===(n=e.twoLine)||void 0===n?void 0:n.padding)||(null===(r=e.input)||void 0===r?void 0:r.padding)||"10px",i=(null===(o=e.twoLine)||void 0===o?void 0:o.fontSize)||(null===(a=e.input)||void 0===a?void 0:a.fontSize)||"14px",l=(null===(s=e.twoLine)||void 0===s?void 0:s.textAlign)||"left";h.push(`input#ccexpiryfieldmonth{width:25%;padding:${t};font-size:${i};text-align:${l};}`),h.push(`input#ccexpiryfieldyear{width:35%;padding:${t};font-size:${i};text-align:${l};}`),h.push(`input#cccvvfield{width:calc(40% - 16px);padding:${t};font-size:${i};text-align:${l};margin-left:-4px;}`),(null===(d=e.input)||void 0===d?void 0:d.borderRadius)&&h.push(`input{border-radius:${e.input.borderRadius};}`)}else if(p)h.push("input#ccnumfield{width:44%;margin:0;}"),h.push("select#ccexpirymonth{width:16%;margin:0;margin-right:-12px;}"),h.push("select#ccexpiryyear{width:20%;}"),h.push("input#cccvvfield{width:20%;margin:0;margin-left:-12px;}"),(null===(l=e.input)||void 0===l?void 0:l.borderRadius)?(h.push(`input#ccnumfield{border-radius:${e.input.borderRadius} 0 0 ${e.input.borderRadius};border-right:none;}`),h.push("select#ccexpirymonth{border-radius:0;border-right:none;}"),h.push("select#ccexpiryyear{border-radius:0;border-right:none;}"),h.push(`input#cccvvfield{border-radius:0 ${e.input.borderRadius} ${e.input.borderRadius} 0;}`)):(h.push("input#ccnumfield{border-right:none;}"),h.push("select#ccexpirymonth{border-right:none;}"),h.push("select#ccexpiryyear{border-right:none;}"));else{const t="0"===m?"0":"8px";h.push(`input#ccnumfield{width:50%;margin-right:${t};}`),h.push(`select#ccexpirymonth{width:15%;margin-right:${t};}`),h.push(`select#ccexpiryyear{width:20%;margin-right:${t};}`),h.push("input#cccvvfield{width:15%;}"),(null===(c=e.input)||void 0===c?void 0:c.borderRadius)&&h.push(`input,select{border-radius:${e.input.borderRadius};}`)}if(e.focus){const t=[];e.focus.borderColor&&t.push(`border-color:${e.focus.borderColor}`),e.focus.outline&&t.push("outline:none"),e.focus.boxShadow&&t.push(`box-shadow:${e.focus.boxShadow}`),t.length>0&&(h.push(`input:focus{${t.join(";")};}`),h.push(`select:focus{${t.join(";")};}`),p&&(null===(u=e.input)||void 0===u?void 0:u.border)&&(h.push(`input#ccnumfield:focus{border:${e.input.border};${t.join(";")};}`),h.push(`select#ccexpirymonth:focus{border:${e.input.border};${t.join(";")};}`),h.push(`select#ccexpiryyear:focus{border:${e.input.border};${t.join(";")};}`)))}if(e.error){const t=[];e.error.borderColor&&t.push(`border-color:${e.error.borderColor}`),e.error.backgroundColor&&t.push(`background-color:${e.error.backgroundColor}`),t.length>0&&h.push(`.error{${t.join(";")};}`)}return encodeURIComponent(h.join(""))}static tokenizeBankAccount(e,t,i){return fetch(`${i.cardConnectBaseUrl}/cardsecure/api/v1/ccn/tokenize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:`${e}/${t}`,unique:!0})}).then(e=>e.json())}}t.CardConnectTokenizer=u},611:(e,t,i)=>{var n;i.r(t),i.d(t,{NIL:()=>P,parse:()=>b,stringify:()=>c,v1:()=>y,v3:()=>w,v4:()=>S,v5:()=>k,validate:()=>s,version:()=>x});var r=new Uint8Array(16);function o(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)}const a=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,s=function(e){return"string"==typeof e&&a.test(e)};for(var d=[],l=0;l<256;++l)d.push((l+256).toString(16).substr(1));const c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(d[e[t+0]]+d[e[t+1]]+d[e[t+2]]+d[e[t+3]]+"-"+d[e[t+4]]+d[e[t+5]]+"-"+d[e[t+6]]+d[e[t+7]]+"-"+d[e[t+8]]+d[e[t+9]]+"-"+d[e[t+10]]+d[e[t+11]]+d[e[t+12]]+d[e[t+13]]+d[e[t+14]]+d[e[t+15]]).toLowerCase();if(!s(i))throw TypeError("Stringified UUID is invalid");return i};var u,h,p=0,m=0;const y=function(e,t,i){var n=t&&i||0,r=t||new Array(16),a=(e=e||{}).node||u,s=void 0!==e.clockseq?e.clockseq:h;if(null==a||null==s){var d=e.random||(e.rng||o)();null==a&&(a=u=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==s&&(s=h=16383&(d[6]<<8|d[7]))}var l=void 0!==e.msecs?e.msecs:Date.now(),y=void 0!==e.nsecs?e.nsecs:m+1,b=l-p+(y-m)/1e4;if(b<0&&void 0===e.clockseq&&(s=s+1&16383),(b<0||l>p)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=l,m=y,h=s;var v=(1e4*(268435455&(l+=122192928e5))+y)%4294967296;r[n++]=v>>>24&255,r[n++]=v>>>16&255,r[n++]=v>>>8&255,r[n++]=255&v;var f=l/4294967296*1e4&268435455;r[n++]=f>>>8&255,r[n++]=255&f,r[n++]=f>>>24&15|16,r[n++]=f>>>16&255,r[n++]=s>>>8|128,r[n++]=255&s;for(var g=0;g<6;++g)r[n+g]=a[g];return t||c(r)},b=function(e){if(!s(e))throw TypeError("Invalid UUID");var t,i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i};function v(e,t,i){function n(e,n,r,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],i=0;i<e.length;++i)t.push(e.charCodeAt(i));return t}(e)),"string"==typeof n&&(n=b(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+e.length);if(a.set(n),a.set(e,n.length),(a=i(a))[6]=15&a[6]|t,a[8]=63&a[8]|128,r){o=o||0;for(var s=0;s<16;++s)r[o+s]=a[s];return r}return c(a)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function f(e){return 14+(e+64>>>9<<4)+1}function g(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function E(e,t,i,n,r,o){return g((a=g(g(t,e),g(n,o)))<<(s=r)|a>>>32-s,i);var a,s}function _(e,t,i,n,r,o,a){return E(t&i|~t&n,e,t,r,o,a)}function N(e,t,i,n,r,o,a){return E(t&n|i&~n,e,t,r,o,a)}function I(e,t,i,n,r,o,a){return E(t^i^n,e,t,r,o,a)}function T(e,t,i,n,r,o,a){return E(i^(t|~n),e,t,r,o,a)}const w=v("v3",48,function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var i=0;i<t.length;++i)e[i]=t.charCodeAt(i)}return function(e){for(var t=[],i=32*e.length,n="0123456789abcdef",r=0;r<i;r+=8){var o=e[r>>5]>>>r%32&255,a=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);t.push(a)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[f(t)-1]=t;for(var i=1732584193,n=-271733879,r=-1732584194,o=271733878,a=0;a<e.length;a+=16){var s=i,d=n,l=r,c=o;i=_(i,n,r,o,e[a],7,-680876936),o=_(o,i,n,r,e[a+1],12,-389564586),r=_(r,o,i,n,e[a+2],17,606105819),n=_(n,r,o,i,e[a+3],22,-1044525330),i=_(i,n,r,o,e[a+4],7,-176418897),o=_(o,i,n,r,e[a+5],12,1200080426),r=_(r,o,i,n,e[a+6],17,-1473231341),n=_(n,r,o,i,e[a+7],22,-45705983),i=_(i,n,r,o,e[a+8],7,1770035416),o=_(o,i,n,r,e[a+9],12,-1958414417),r=_(r,o,i,n,e[a+10],17,-42063),n=_(n,r,o,i,e[a+11],22,-1990404162),i=_(i,n,r,o,e[a+12],7,1804603682),o=_(o,i,n,r,e[a+13],12,-40341101),r=_(r,o,i,n,e[a+14],17,-1502002290),i=N(i,n=_(n,r,o,i,e[a+15],22,1236535329),r,o,e[a+1],5,-165796510),o=N(o,i,n,r,e[a+6],9,-1069501632),r=N(r,o,i,n,e[a+11],14,643717713),n=N(n,r,o,i,e[a],20,-373897302),i=N(i,n,r,o,e[a+5],5,-701558691),o=N(o,i,n,r,e[a+10],9,38016083),r=N(r,o,i,n,e[a+15],14,-660478335),n=N(n,r,o,i,e[a+4],20,-405537848),i=N(i,n,r,o,e[a+9],5,568446438),o=N(o,i,n,r,e[a+14],9,-1019803690),r=N(r,o,i,n,e[a+3],14,-187363961),n=N(n,r,o,i,e[a+8],20,1163531501),i=N(i,n,r,o,e[a+13],5,-1444681467),o=N(o,i,n,r,e[a+2],9,-51403784),r=N(r,o,i,n,e[a+7],14,1735328473),i=I(i,n=N(n,r,o,i,e[a+12],20,-1926607734),r,o,e[a+5],4,-378558),o=I(o,i,n,r,e[a+8],11,-2022574463),r=I(r,o,i,n,e[a+11],16,1839030562),n=I(n,r,o,i,e[a+14],23,-35309556),i=I(i,n,r,o,e[a+1],4,-1530992060),o=I(o,i,n,r,e[a+4],11,1272893353),r=I(r,o,i,n,e[a+7],16,-155497632),n=I(n,r,o,i,e[a+10],23,-1094730640),i=I(i,n,r,o,e[a+13],4,681279174),o=I(o,i,n,r,e[a],11,-358537222),r=I(r,o,i,n,e[a+3],16,-722521979),n=I(n,r,o,i,e[a+6],23,76029189),i=I(i,n,r,o,e[a+9],4,-640364487),o=I(o,i,n,r,e[a+12],11,-421815835),r=I(r,o,i,n,e[a+15],16,530742520),i=T(i,n=I(n,r,o,i,e[a+2],23,-995338651),r,o,e[a],6,-198630844),o=T(o,i,n,r,e[a+7],10,1126891415),r=T(r,o,i,n,e[a+14],15,-1416354905),n=T(n,r,o,i,e[a+5],21,-57434055),i=T(i,n,r,o,e[a+12],6,1700485571),o=T(o,i,n,r,e[a+3],10,-1894986606),r=T(r,o,i,n,e[a+10],15,-1051523),n=T(n,r,o,i,e[a+1],21,-2054922799),i=T(i,n,r,o,e[a+8],6,1873313359),o=T(o,i,n,r,e[a+15],10,-30611744),r=T(r,o,i,n,e[a+6],15,-1560198380),n=T(n,r,o,i,e[a+13],21,1309151649),i=T(i,n,r,o,e[a+4],6,-145523070),o=T(o,i,n,r,e[a+11],10,-1120210379),r=T(r,o,i,n,e[a+2],15,718787259),n=T(n,r,o,i,e[a+9],21,-343485551),i=g(i,s),n=g(n,d),r=g(r,l),o=g(o,c)}return[i,n,r,o]}(function(e){if(0===e.length)return[];for(var t=8*e.length,i=new Uint32Array(f(t)),n=0;n<t;n+=8)i[n>>5]|=(255&e[n/8])<<n%32;return i}(e),8*e.length))}),S=function(e,t,i){var n=(e=e||{}).random||(e.rng||o)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var r=0;r<16;++r)t[i+r]=n[r];return t}return c(n)};function C(e,t,i,n){switch(e){case 0:return t&i^~t&n;case 1:case 3:return t^i^n;case 2:return t&i^t&n^i&n}}function A(e,t){return e<<t|e>>>32-t}const k=v("v5",80,function(e){var t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var r=0;r<n.length;++r)e.push(n.charCodeAt(r))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var o=e.length/4+2,a=Math.ceil(o/16),s=new Array(a),d=0;d<a;++d){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=e[64*d+4*c]<<24|e[64*d+4*c+1]<<16|e[64*d+4*c+2]<<8|e[64*d+4*c+3];s[d]=l}s[a-1][14]=8*(e.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295;for(var u=0;u<a;++u){for(var h=new Uint32Array(80),p=0;p<16;++p)h[p]=s[u][p];for(var m=16;m<80;++m)h[m]=A(h[m-3]^h[m-8]^h[m-14]^h[m-16],1);for(var y=i[0],b=i[1],v=i[2],f=i[3],g=i[4],E=0;E<80;++E){var _=Math.floor(E/20),N=A(y,5)+C(_,b,v,f)+g+t[_]+h[E]>>>0;g=f,f=v,v=A(b,30)>>>0,b=y,y=N}i[0]=i[0]+y>>>0,i[1]=i[1]+b>>>0,i[2]=i[2]+v>>>0,i[3]=i[3]+f>>>0,i[4]=i[4]+g>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}),P="00000000-0000-0000-0000-000000000000",x=function(e){if(!s(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},631:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseExpiryDate=function(e){const t=e.split("/");if(2!==t.length)return null;const i=t[0],n=t[1];return 2!==i.length||2!==n.length?null:{month:i,year:"20"+n}},t.formatExpiryInput=function(e){let t=e.replace(/\D/g,"");return t=t.substring(0,4),t.length>=2?t.substring(0,2)+"/"+t.substring(2,4):t},t.withTimeout=function(e,t,i){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(new Error(i)),t))])},t.getConnectedBorderRadius=function(e,t,i){if(!i)return e;switch(t){case"left":return`${e} 0 0 ${e}`;case"middle":return"0";case"right":return`0 ${e} ${e} 0`;default:return e}},t.addFocusHandlers=function(e,t,i,n){e.addEventListener("focus",()=>{t.focus&&Object.assign(e.style,t.focus),null==i||i()}),e.addEventListener("blur",()=>{e.style.border=t.input.border,e.style.outline="none",e.style.boxShadow="none",null==n||n()})},t.createFieldContainer=function(e,t,i,n){const r=document.createElement("div");return r.id=e,r.style.flex=t,r.style.display="flex",i&&(r.style.minWidth=i),n&&(r.style.maxWidth=n),r},t.createInputElement=function(e,t,i,n){const r=document.createElement("input");return r.id=e,r.type=t,r.placeholder=i,n&&(r.maxLength=n),r},t.validateRoutingNumber=function(e){const t=e.replace(/\D/g,"");if(9!==t.length)return!1;const i=t.split("").map(Number);return(3*i[0]+7*i[1]+1*i[2]+3*i[3]+7*i[4]+1*i[5]+3*i[6]+7*i[7]+1*i[8])%10==0},t.validateAccountNumber=function(e){const t=e.replace(/\D/g,"");return!(t.length<4||t.length>17)&&/^\d+$/.test(t)},t.maskAccountNumber=function(e){const t=e.replace(/\D/g,"");if(t.length<=4)return t;const i=t.slice(-4);return"*".repeat(t.length-4)+i},t.createAccountTypeSelect=function(e){const t=document.createElement("select");t.id=e;const i=document.createElement("option");i.value="checking",i.text="Checking";const n=document.createElement("option");return n.value="savings",n.text="Savings",t.appendChild(i),t.appendChild(n),t},t.validateInstitutionNumber=function(e){return 3===e.replace(/\D/g,"").length},t.validateTransitNumber=function(e){return 5===e.replace(/\D/g,"").length},t.validateCanadianAccountNumber=function(e){return e.replace(/\D/g,"").length>=7},t.formatCanadianRoutingNumber=function(e,t){return"0"+e.replace(/\D/g,"").padStart(3,"0")+t.replace(/\D/g,"").padStart(5,"0")}},712:function(e,t,i){var n,r=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=n(e),a=0;a<i.length;a++)"default"!==i[a]&&r(t,e,i[a]);return o(t,e),t}),s=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=i(523),c=i(156),u=i(247),h=i(472),p=d(i(953)),m=d(i(731)),y=i(875),b=a(i(777)),v=i(611),f=i(122),g=i(578),E={enableSandboxMode:!1,overrideBaseUrl:void 0,enableDelay:!1,secondsToDelay:0};t.default=class{get organizationId(){if(!this.currentOrganizationId)throw new Error("organizationId undefined");return this.currentOrganizationId}constructor(e,t,i){var n;this.clientKey=e,"string"==typeof t?this.embedId=t:(this.embedConfigCache=t,this.embedId=t.embed_id||"",t.organization_id&&(this.currentOrganizationId=t.organization_id)),this.currentOrganizationId||(this.currentOrganizationId=e),this.options=Object.assign({},E,i),this.allowTransaction=!1,this.config=new m.default(this.options);const r=Object.entries(this.config);for(const[e,t]of r){const i=Object.getOwnPropertyDescriptor(this,e);if(!i||void 0!==i.set)try{this[e]=t}catch(e){}}if(this.options.enableDelay&&this.options.secondsToDelay){const e=1e3*this.options.secondsToDelay;setTimeout(()=>{this.allowTransaction=!0},e)}else this.allowTransaction=!0;this.options.enableSandboxMode&&void 0!==console&&console.info(`[Sandbox] iDonate SDK Configuration (v${u.SDK_VERSION}):`,JSON.parse(JSON.stringify(this)));try{const{pcScriptBase:e,pcScriptId:t}=this.config;if(!e||!t)throw new Error("missing config");const i=(0,v.v4)(),n=window.document.createElement("script");n.setAttribute("src",e+"/"+i+".js"),n.setAttribute("id",t);let r=!1;const o=()=>{var e;try{if(r)return;window.document.body.append(n),r=!0}catch(t){null===(e=null===console||void 0===console?void 0:console.warn)||void 0===e||e.call(console,"not appended")}};o(),window.addEventListener("DOMContentLoaded",()=>{window.document.body.append(n)})}catch(e){null===(n=null===console||void 0===console?void 0:console.warn)||void 0===n||n.call(console,"Warning, partial initialization: ",String(e))}this.currentOrganizationId||this.setOrganizationId(this.clientKey)}createDonation(e){if(!this.allowTransaction)throw new Error("Wow, that was fast - try again");e.embedId||(e.embedId=this.embedId);const t=(0,c.buildCashPaymentPayload)(this.organizationId,e),i=e=>fetch(`${this.config.embedApiBaseUrl}/donate/cash-payment`,{method:"POST",headers:Object.assign(Object.assign(Object.assign({},u.CLIENT_HEADERS),e?{"cf-validation-token":e}:{}),{"User-Agent":u.CLIENT_HEADERS["User-Agent"]+" source:"+this.config.client}),body:JSON.stringify(t),credentials:"include"});return i().then(e=>s(this,void 0,void 0,function*(){if("challenge"===e.headers.get("cf-mitigated")){const t=yield(0,f.handleCFChallenge)(e,this);return i(null==t?void 0:t.token)}return e})).then(e=>(0,h.parseResponse)(e,{throwErrors:!0})).then(e=>(0,c.buildDonationResult)(e))}createTransaction(e){return this.createDonation(e).then(e=>{var t;return{transactionId:null===(t=e.transaction)||void 0===t?void 0:t.id,_raw_response:e._raw_response}})}createPaymentMethod(e){return e.embedId||(e.embedId=this.embedId),b.createPaymentMethod(e,this.config)}setOrganizationId(e){this.currentOrganizationId=e}waitForDonationResult(e,t){return new Promise((i,n)=>{setTimeout(()=>{let r;r=setInterval(()=>{fetch(`${this.config.embedApiBaseUrl}/donate/cash-payment/${e}/payment_status`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>e.result).then(e=>{(function(e){return!!e.processed&&!!e.transaction})(e)&&(r&&(clearInterval(r),r=null),e.error&&n(new l.ClientError(e.error)),i((0,c.buildDonationResult)({_raw_response:Object.assign({campaign:null,designation:{},donor:{},form_data:{},id:null,schedule:{},transaction:{}},e)}))),null==t||t()}).catch(e=>{r&&(clearInterval(r),r=null),n(e)})},2e3)},2e3)})}tokenizeCardConnectApplePay(e){const t=new p.default(e);let i="";const n=t.begin();return new Promise((e,r)=>{n.then(n=>{n.onvalidatemerchant=e=>{const o={apple_pay_url:this.config.applePayUrl,organization_id:this.organizationId};t.createSession(o,this.config.embedApiBaseUrl).then(e=>{i=e.result.merchantSessionIdentifier,n.completeMerchantValidation(e.result)}).catch(e=>{n.abort(),r(e)})},n.onpaymentauthorized=o=>{t.tokenizeWithCardConnect(o.payment,this.config.cardConnectBaseUrl).then(t=>{var r,a;const s=Object.assign(Object.assign({},o.payment.billingContact),{email:null===(r=o.payment.shippingContact)||void 0===r?void 0:r.emailAddress,phone:null===(a=o.payment.shippingContact)||void 0===a?void 0:a.phoneNumber});e({applePaySession:n,cardConnectResponse:t,billingContact:s,merchantSessionId:i})}).catch(e=>{n.abort(),r(e)})},n.oncancel=e=>{r(new Error("Apple Pay has been closed"))}}).catch(e=>r(e))})}createTokenizer(e,t){return s(this,void 0,void 0,function*(){return g.Tokenizer.create(e,t,{organizationId:this.organizationId,embedId:this.embedId,clientConfig:this.config})})}tokenizeSpreedlyPayPal(e){return y.SpreedlyTokenizer.tokenizePayPal(e,this.config)}selectGateway(e,t,i){if(i){const t=e.find(e=>e.id===i);if(t)return t}return e[0]}getEmbedConfig(){return s(this,void 0,void 0,function*(){return this.embedConfigCache?this.embedConfigCache:(this.embedConfigPromise||(this.embedConfigPromise=b.fetchEmbedConfig(this.embedId,this.config).then(e=>(this.embedConfigCache=e,e))),this.embedConfigPromise)})}getGateway(e){return s(this,void 0,void 0,function*(){const t=yield this.getEmbedConfig(),i=t.available_gateways.find(t=>t.id===e);if(!i)throw new Error(`Gateway ${e} not found in embed configuration. Available: ${t.available_gateways.map(e=>e.id).join(", ")}`);return i})}}},731:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=i(247);t.default=class{constructor(e){e.enableSandboxMode?(this.apiBaseUrl=n.SANDBOX_BASE_URL,this.cardConnectBaseUrl=n.SANDBOX_CARD_CONNECT_BASE_URL,this.applePayUrl=n.SANDBOX_APPLE_PAY_URL):(this.apiBaseUrl=n.PRODUCTION_BASE_URL,this.cardConnectBaseUrl=n.PRODUCTION_CARD_CONNECT_BASE_URL,this.applePayUrl=n.APPLE_PAY_URL),this.client=e.sdkClientName||n.DEFAULT_APP_NAME,e.overrideBaseUrl&&(this.apiBaseUrl=e.overrideBaseUrl),this.authApiBaseUrl=e.overrideAuthApiBaseUrl||`${this.apiBaseUrl}/auth`,this.donorApiBaseUrl=e.overrideDonorApiBaseUrl||`${this.apiBaseUrl}/donor`,this.embedApiBaseUrl=e.overrideEmbedApiBaseUrl||`${this.apiBaseUrl}/embed`,e.overrideApplePayUrl&&(this.applePayUrl=e.overrideApplePayUrl),e.overrideCardConnectBaseUrl&&(this.cardConnectBaseUrl=e.overrideCardConnectBaseUrl),this.pcScriptBase=e.pcScriptBase||n.FALLBACK_PC_SCRIPT_URL,this.pcScriptId=e.pcScriptId||n.FALLBACK_PC_SCRIPT_ID,this.turnstileCdnUrl=e.turnstileCdnUrl||n.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL,this.turnstileSiteKey=e.turnstileSiteKey||n.FALLBACK_CF_TURNSTILE_SITE_KEY,(null==e?void 0:e.spreedlyEnvironmentKey)&&(this.spreedlyEnvironmentKey=e.spreedlyEnvironmentKey),this.enableDelay=e.enableDelay||!1,this.secondsToDelay=e.secondsToDelay||0,this.enableSpreedlySecureTokenization=e.enableSpreedlySecureTokenization||!1,this.organizationId=e.organizationId,this.embedId=e.embedId,this.cardConnectTokenizerUrl=`${this.cardConnectBaseUrl}/itoke/ajax-tokenizer.html`}}},740:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});class i{static resolveLib(e){const t=new Date;return new Promise((i,n)=>{!function r(){if(void 0!==window.google&&void 0!==window.google.payments){const t=new google.payments.api.PaymentsClient(e);i(t)}else(new Date).valueOf()-t.valueOf()>15e3?n(new Error("pay.js not loaded after 15 seconds")):setTimeout(r,250)}()})}static injectScript(){if(void 0!==window.google&&void 0!==window.google.payments)throw new Error("google payments is already injected");const e=document.createElement("script");e.src="https://pay.google.com/gp/p/js/pay.js?render=explicit",e.async=!0,e.defer=!0,document.body.appendChild(e)}constructor(e){this.baseRequest={apiVersion:2,apiVersionMinor:0},this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}},this.transactionInfo={countryCode:"US",currencyCode:"USD",totalPriceStatus:"FINAL",totalPrice:""},this.tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:"cardconnect",gatewayMerchantId:""}},this.googlePayOptions={environment:"PRODUCTION"},this.paymentRequestDefaults=Object.assign(Object.assign({},this.baseRequest),{merchantInfo:{merchantId:""},transactionInfo:this.transactionInfo,emailRequired:!0,allowedPaymentMethods:[Object.assign(Object.assign({},this.baseCardPaymentMethod),{tokenizationSpecification:this.tokenizationSpecification})]}),this.paymentsClient=null;const{paymentOptions:t,cardConnectMerchantId:i,paymentDataRequest:n,baseCardPaymentMethodParameters:r={}}=e;this.tokenizationSpecification.parameters.gatewayMerchantId=i,this.paymentRequest=Object.assign({},this.paymentRequestDefaults,n),this.googlePayOptions=Object.assign({},this.googlePayOptions,Object.assign(Object.assign({},t),{merchantInfo:this.paymentRequest.merchantInfo})),this.baseCardPaymentMethod.parameters=Object.assign(Object.assign({},this.baseCardPaymentMethod.parameters),r)}getGoogleIsReadyToPayRequest(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})}getGooglePaymentClient(){return new Promise((e,t)=>{this.paymentsClient?e(this.paymentsClient):i.resolveLib(this.googlePayOptions).then(t=>{this.paymentsClient=t,e(t)}).catch(e=>t(e))})}onGooglePaymentButtonClicked(e){const t=this.paymentRequest;return this.transactionInfo=Object.assign({},this.transactionInfo,e),t.transactionInfo=this.transactionInfo,new Promise((e,i)=>{this.paymentsClient?this.paymentsClient.loadPaymentData(t).then(t=>{e(t)}).catch(e=>{i(e)}):i(new Error("PaymentClient is not initialized"))})}tokenizeWithCardConnect(e,t){return fetch(`${t}/cardsecure/api/v1/ccn/tokenize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encryptionhandler:"EC_GOOGLE_PAY",devicedata:e,unique:!0})}).then(e=>e.json())}}t.default=i},777:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createPaymentMethod=function(e,t){const i=(0,n.buildCreatePaymentMethodPayload)(e);return fetch(`${t.embedApiBaseUrl}/payment/payment-methods`,{method:"POST",headers:r.CLIENT_HEADERS,body:JSON.stringify(i)}).then(e=>(0,o.parseResponse)(e,{throwErrors:!0})).then(e=>(0,n.buildCreatePaymentMethodResult)(e))},t.fetchEmbedConfig=function(e,t){return fetch(`${t.embedApiBaseUrl}/config/${e}`,{method:"GET",headers:r.CLIENT_HEADERS}).then(e=>(0,o.parseResponse)(e,{throwErrors:!0})).then(e=>e._raw_response.result)};const n=i(156),r=i(247),o=i(472)},799:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RESPONSIVE_BREAKPOINT=t.FIELD_CONSTRAINTS=t.PLACEHOLDERS=t.CANADIAN_BANK_FIELD_FLEX=t.BANK_FIELD_FLEX=t.FIELD_FLEX=t.TOKENIZE_TIMEOUT=t.INIT_TIMEOUT=void 0,t.INIT_TIMEOUT=1e4,t.TOKENIZE_TIMEOUT=3e4,t.FIELD_FLEX={cardNumber:{flex:"1 1 60%",minWidth:"150px"},expiry:{flex:"0 1 20%",minWidth:"70px"},cvv:{flex:"0 1 20%",minWidth:"60px"}},t.BANK_FIELD_FLEX={routingNumber:{flex:"0 1 30%",minWidth:"100px"},accountNumber:{flex:"1 1 45%",minWidth:"120px"},accountType:{flex:"0 1 25%",minWidth:"90px"}},t.CANADIAN_BANK_FIELD_FLEX={institutionNumber:{flex:"0 1 15%",minWidth:"60px"},transitNumber:{flex:"0 1 20%",minWidth:"80px"},accountNumber:{flex:"1 1 40%",minWidth:"110px"},accountType:{flex:"0 1 25%",minWidth:"90px"}},t.PLACEHOLDERS={cardNumber:"Card Number *",expiry:"MM/YY *",cvv:"CVV *"},t.FIELD_CONSTRAINTS={expiry:{maxLength:5,pattern:/^\d{0,2}\/?\d{0,2}$/},cvv:{maxLength:4}},t.RESPONSIVE_BREAKPOINT=400},806:function(e,t,i){var n,r=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=n(e),a=0;a<i.length;a++)"default"!==i[a]&&r(t,e,i[a]);return o(t,e),t}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GooglePay=t.ApplePay=t.constants=t.recaptcha=t.ConfigHandler=t.Client=t.shared=t.util=t.tokenize=void 0;const l=a(i(578));t.tokenize=l;const c=a(i(472));t.util=c;const u=a(i(115));t.recaptcha=u;const h=a(i(247));t.constants=h;const p=a(i(777));t.shared=p;const m=d(i(712));t.Client=m.default;const y=d(i(731));t.ConfigHandler=y.default;const b=d(i(953));t.ApplePay=b.default;const v=d(i(740));t.GooglePay=v.default,s(i(523),t)},875:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.SpreedlyTokenizer=void 0;const r=i(415),o=i(367),a=i(247),s=i(156),d=i(592),l=i(454),c=i(799),u=i(631);class h extends r.Tokenizer{constructor(e,t,i,n="credit_card",r="US",o=!1,a="single-line",s=c.RESPONSIVE_BREAKPOINT){if(super(),this.environmentKey=e,this.containerId=t,this.layout=a,this.bankCountry="US",this.enableTestMode=!1,this.effectiveLayout="single-line",this.responsiveBreakpoint=c.RESPONSIVE_BREAKPOINT,this.mode=n,this.bankCountry=r,this.enableTestMode=o,this.responsiveBreakpoint=s,"credit_card"===n){const e=window.SpreedlyPaymentFrame;this.spreedly=e?new e:window.Spreedly}else this.spreedly=window.Spreedly;this.currentValidationState="bank_account"===n?{isValid:!1,routingNumber:{isValid:!1,isEmpty:!0},accountNumber:{isValid:!1,isEmpty:!0}}:{isValid:!1,cardNumber:{isValid:!1,isEmpty:!0},cvv:{isValid:!1,isEmpty:!0},expiry:{isValid:!1,isEmpty:!0}},this.mergedStyles=(0,l.getContainerStylesForLayout)((0,l.mergeStyles)(l.DEFAULT_UNIFIED_STYLES,i),this.layout);const d=this.generateFieldIds(t);this.numberEl=d.numberId,this.cvvEl=d.cvvId,this.expiryId=d.expiryId}static create(e,t,i){return n(this,void 0,void 0,function*(){var n;"bank_account"!==t.mode&&(yield h.ensureSpreedlyLoaded());let r=null===(n=e.config)||void 0===n?void 0:n.environment_key;!r&&i.clientConfig.spreedlyEnvironmentKey&&(r=i.clientConfig.spreedlyEnvironmentKey),r||(r="");const o=new h(r,t.containerId,t.styling,t.mode||"credit_card",t.bankCountry||"US",t.enableTestMode||!1,t.layout||"single-line",t.responsiveBreakpoint||c.RESPONSIVE_BREAKPOINT);let a;if(o.organizationId=i.organizationId,o.embedId=i.embedId,o.clientConfig=i.clientConfig,o.createInternalElements(),"credit_card"===t.mode&&i.clientConfig.enableSpreedlySecureTokenization){if(!i.organizationId||!i.embedId)throw new Error("Secure tokenization is enabled but organizationId and embedId are required");try{a=yield(0,d.fetchSpreedlySecurityArgs)(i.clientConfig,i.organizationId,i.embedId)}catch(e){throw new Error(`Secure tokenization is enabled but failed to initialize: ${e instanceof Error?e.message:"Unknown error"}`)}}return yield o.init(a),o})}init(e){return n(this,void 0,void 0,function*(){return this.containerEl=document.getElementById(this.containerId),"bank_account"===this.mode?(this.enableTestMode&&setTimeout(()=>{"CA"===this.bankCountry?(this.institutionNumberEl&&(this.institutionNumberEl.value="004",this.institutionNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.transitNumberEl&&(this.transitNumberEl.value="12345",this.transitNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountNumberEl&&(this.accountNumberEl.value="1234567",this.accountNumberEl.dispatchEvent(new Event("input",{bubbles:!0})))):(this.routingNumberEl&&(this.routingNumberEl.value="021000021",this.routingNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountNumberEl&&(this.accountNumberEl.value="9876543210",this.accountNumberEl.dispatchEvent(new Event("input",{bubbles:!0}))),this.accountTypeEl&&(this.accountTypeEl.value="checking",this.accountTypeEl.dispatchEvent(new Event("change",{bubbles:!0}))))},100),this.emit("ready"),Promise.resolve()):new Promise((t,i)=>{const n=setTimeout(()=>{i(new Error("Spreedly initialization timeout"))},c.INIT_TIMEOUT);this.spreedly.on("ready",()=>{clearTimeout(n),this.spreedly.setPlaceholder("number",c.PLACEHOLDERS.cardNumber),this.spreedly.setFieldType("number","text"),this.spreedly.setNumberFormat("prettyFormat"),this.spreedly.setPlaceholder("cvv",c.PLACEHOLDERS.cvv),this.spreedly.setFieldType("cvv","text"),this.applyUnifiedStyles(),this.enableTestMode&&"credit_card"===this.mode&&this.spreedly.setValue&&(this.spreedly.setValue("number","4111111111111111"),this.spreedly.setValue("cvv","123"),setTimeout(()=>{this.expiryEl&&(this.expiryEl.value="12/34",this.expiryEl.dispatchEvent(new Event("input",{bubbles:!0})))},100)),this.emit("ready"),t()}),this.spreedly.on("errors",e=>{this.emit("error",new o.TokenizationError(e))}),this.spreedly.on("fieldEvent",(e,t,i,n)=>{this.handleFieldEvent(e,t,n)});const r={numberEl:this.numberEl,cvvEl:this.cvvEl};e&&(r.certificateToken=e.certificate_token,r.signature=e.signature,r.timestamp=e.timestamp,r.nonce=e.nonce),this.spreedly.init(this.environmentKey,r)})})}tokenize(e){return n(this,void 0,void 0,function*(){if(!this.isReady)throw new Error("Tokenizer not initialized");return"bank_account"===this.mode||this.isBankAccountData(e)?this.tokenizeBankAccountInternal(e):this.tokenizeCardInternal(e)})}tokenizeCardInternal(e){return n(this,void 0,void 0,function*(){return new Promise((t,i)=>{var n,r,a,s,d,l;const u=setTimeout(()=>{this.spreedly&&this.spreedly.removeHandlers&&this.spreedly.removeHandlers(),i(new o.TokenizationError("Tokenization timeout","TIMEOUT"))},c.TOKENIZE_TIMEOUT),h=()=>{clearTimeout(u),this.spreedly&&this.spreedly.removeHandlers&&this.spreedly.removeHandlers()};this.spreedly.on("paymentMethod",(e,i)=>{h();const n={token:e,lastFour:i.last_four_digits,cardType:this.normalizeCardType(i.card_type),provider:"spreedly"};this.emit("tokenReady",n),t(n)}),this.spreedly.on("errors",e=>{h(),i(new o.TokenizationError(e))});const p=this.parseExpiry(this.expiryEl);if(!p)return h(),void i(new o.TokenizationError("Expiration date is required","VALIDATION_ERROR"));const m=p.month,y=p.year;this.spreedly.tokenizeCreditCard({first_name:e.firstName,last_name:e.lastName,month:m,year:y,email:e.email,phone_number:e.phone,address1:null===(n=e.address)||void 0===n?void 0:n.address1,address2:null===(r=e.address)||void 0===r?void 0:r.address2,city:null===(a=e.address)||void 0===a?void 0:a.city,state:null===(s=e.address)||void 0===s?void 0:s.state,zip:null===(d=e.address)||void 0===d?void 0:d.zip,country:null===(l=e.address)||void 0===l?void 0:l.country})})})}createCanadianBankAccountFields(e){"two-line"===this.layout?(this.accountTypeEl=(0,u.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:"2",minWidth:c.CANADIAN_BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,this.mergedStyles,"left"),e.appendChild(this.accountTypeEl),this.institutionNumberEl=(0,u.createInputElement)(`${this.containerId}-institution`,"text","Inst *",3),Object.assign(this.institutionNumberEl.style,{flex:"1",minWidth:c.CANADIAN_BANK_FIELD_FLEX.institutionNumber.minWidth}),this.applyInputStyles(this.institutionNumberEl,this.mergedStyles,"middle"),this.institutionNumberEl.addEventListener("blur",()=>{!(0,u.validateInstitutionNumber)(this.institutionNumberEl.value)&&this.institutionNumberEl.value?this.applyErrorStyles(this.institutionNumberEl):this.applyInputStyles(this.institutionNumberEl,this.mergedStyles,"middle"),this.updateBankAccountValidation()}),e.appendChild(this.institutionNumberEl),this.transitNumberEl=(0,u.createInputElement)(`${this.containerId}-transit`,"text","Transit *",5),Object.assign(this.transitNumberEl.style,{flex:"2",minWidth:c.CANADIAN_BANK_FIELD_FLEX.transitNumber.minWidth}),this.applyInputStyles(this.transitNumberEl,this.mergedStyles,"right"),this.transitNumberEl.addEventListener("blur",()=>{!(0,u.validateTransitNumber)(this.transitNumberEl.value)&&this.transitNumberEl.value?this.applyErrorStyles(this.transitNumberEl):this.applyInputStyles(this.transitNumberEl,this.mergedStyles,"right"),this.updateBankAccountValidation()}),e.appendChild(this.transitNumberEl),this.accountNumberEl=(0,u.createInputElement)(`${this.containerId}-account`,"text","Account Number *"),Object.assign(this.accountNumberEl.style,{flex:"1",flexBasis:"100%",minWidth:c.CANADIAN_BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,this.mergedStyles),this.accountNumberEl.addEventListener("blur",()=>{!(0,u.validateCanadianAccountNumber)(this.accountNumberEl.value)&&this.accountNumberEl.value?this.applyErrorStyles(this.accountNumberEl):this.applyInputStyles(this.accountNumberEl,this.mergedStyles),this.updateBankAccountValidation()}),e.appendChild(this.accountNumberEl)):(this.institutionNumberEl=(0,u.createInputElement)(`${this.containerId}-institution`,"text","Inst *",3),Object.assign(this.institutionNumberEl.style,{flex:c.CANADIAN_BANK_FIELD_FLEX.institutionNumber.flex,minWidth:c.CANADIAN_BANK_FIELD_FLEX.institutionNumber.minWidth}),this.applyInputStyles(this.institutionNumberEl,this.mergedStyles,"left"),this.institutionNumberEl.addEventListener("blur",()=>{!(0,u.validateInstitutionNumber)(this.institutionNumberEl.value)&&this.institutionNumberEl.value?this.applyErrorStyles(this.institutionNumberEl):this.applyInputStyles(this.institutionNumberEl,this.mergedStyles,"left"),this.updateBankAccountValidation()}),e.appendChild(this.institutionNumberEl),this.transitNumberEl=(0,u.createInputElement)(`${this.containerId}-transit`,"text","Transit *",5),Object.assign(this.transitNumberEl.style,{flex:c.CANADIAN_BANK_FIELD_FLEX.transitNumber.flex,minWidth:c.CANADIAN_BANK_FIELD_FLEX.transitNumber.minWidth}),this.applyInputStyles(this.transitNumberEl,this.mergedStyles,"middle"),this.transitNumberEl.addEventListener("blur",()=>{!(0,u.validateTransitNumber)(this.transitNumberEl.value)&&this.transitNumberEl.value?this.applyErrorStyles(this.transitNumberEl):this.applyInputStyles(this.transitNumberEl,this.mergedStyles,"middle"),this.updateBankAccountValidation()}),e.appendChild(this.transitNumberEl),this.accountNumberEl=(0,u.createInputElement)(`${this.containerId}-account`,"text","Account Number *"),Object.assign(this.accountNumberEl.style,{flex:c.CANADIAN_BANK_FIELD_FLEX.accountNumber.flex,minWidth:c.CANADIAN_BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,this.mergedStyles,"middle"),this.accountNumberEl.addEventListener("blur",()=>{!(0,u.validateCanadianAccountNumber)(this.accountNumberEl.value)&&this.accountNumberEl.value?this.applyErrorStyles(this.accountNumberEl):this.applyInputStyles(this.accountNumberEl,this.mergedStyles,"middle"),this.updateBankAccountValidation()}),e.appendChild(this.accountNumberEl),this.accountTypeEl=(0,u.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:c.CANADIAN_BANK_FIELD_FLEX.accountType.flex,minWidth:c.CANADIAN_BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,this.mergedStyles,"right"),e.appendChild(this.accountTypeEl))}tokenizeBankAccountInternal(e){return n(this,void 0,void 0,function*(){var t,i,n,r,a,s,d,l,c,p,m,y;if(!this.isReady)throw new Error("Tokenizer not initialized");if("bank_account"!==this.mode)throw new Error("Tokenizer not in bank account mode");let b,v;const f=(null===(t=this.accountTypeEl)||void 0===t?void 0:t.value)||"checking";if("CA"===this.bankCountry){const e=null===(i=this.institutionNumberEl)||void 0===i?void 0:i.value,t=null===(n=this.transitNumberEl)||void 0===n?void 0:n.value;if(v=null===(r=this.accountNumberEl)||void 0===r?void 0:r.value,!e||!t||!v)throw new o.TokenizationError("Institution number, transit number, and account number are required","VALIDATION_ERROR");if(!(0,u.validateInstitutionNumber)(e))throw new o.TokenizationError("Institution number must be 3 digits","VALIDATION_ERROR");if(!(0,u.validateTransitNumber)(t))throw new o.TokenizationError("Transit number must be 5 digits","VALIDATION_ERROR");if(!(0,u.validateCanadianAccountNumber)(v))throw new o.TokenizationError("Invalid account number","VALIDATION_ERROR");b=(0,u.formatCanadianRoutingNumber)(e,t)}else{if(b=null===(a=this.routingNumberEl)||void 0===a?void 0:a.value,v=null===(s=this.accountNumberEl)||void 0===s?void 0:s.value,!b||!v)throw new o.TokenizationError("Routing number and account number are required","VALIDATION_ERROR");if(!(0,u.validateRoutingNumber)(b))throw new o.TokenizationError("Invalid routing number","VALIDATION_ERROR");if(!(0,u.validateAccountNumber)(v))throw new o.TokenizationError("Invalid account number","VALIDATION_ERROR")}return{token:yield h.tokenizeBankAccount({contact:{firstName:e.firstName,lastName:e.lastName,email:e.email,primaryPhone:e.phone},address:{address1:null===(d=e.address)||void 0===d?void 0:d.address1,address2:null===(l=e.address)||void 0===l?void 0:l.address2,city:null===(c=e.address)||void 0===c?void 0:c.city,state:null===(p=e.address)||void 0===p?void 0:p.state,zip:null===(m=e.address)||void 0===m?void 0:m.zip,country:null===(y=e.address)||void 0===y?void 0:y.country},account:{accountNumber:v,routingNumber:b,accountType:f,accountHolderType:"personal"}},this.clientConfig),lastFour:v.slice(-4),accountType:f,paymentMethodType:"bank_account",provider:"spreedly"}})}validate(){return n(this,void 0,void 0,function*(){return"bank_account"===this.mode?this.validateBankAccountInternal():this.validateCardInternal()})}validateCardInternal(){return n(this,void 0,void 0,function*(){var e,t,i,n,r;const o=[];(null===(e=this.currentValidationState.cardNumber)||void 0===e?void 0:e.isEmpty)?o.push({field:"cardNumber",message:"Card number is required"}):(null===(t=this.currentValidationState.cardNumber)||void 0===t?void 0:t.isValid)||o.push({field:"cardNumber",message:"Invalid card number"}),(null===(i=this.currentValidationState.cvv)||void 0===i?void 0:i.isEmpty)?o.push({field:"cvv",message:"CVV is required"}):(null===(n=this.currentValidationState.cvv)||void 0===n?void 0:n.isValid)||o.push({field:"cvv",message:"Invalid CVV"});const a=this.parseExpiry(this.expiryEl);return(null===(r=this.expiryEl)||void 0===r?void 0:r.value)?a||o.push({field:"expiry",message:"Invalid expiration date"}):o.push({field:"expiry",message:"Expiration date is required"}),{isValid:0===o.length,errors:o}})}validateBankAccountInternal(){return n(this,void 0,void 0,function*(){var e,t,i,n,r;const o=[];return"CA"===this.bankCountry?((null===(e=this.institutionNumberEl)||void 0===e?void 0:e.value)?(0,u.validateInstitutionNumber)(this.institutionNumberEl.value)||o.push({field:"routingNumber",message:"Institution number must be 3 digits"}):o.push({field:"routingNumber",message:"Institution number is required"}),(null===(t=this.transitNumberEl)||void 0===t?void 0:t.value)?(0,u.validateTransitNumber)(this.transitNumberEl.value)||o.push({field:"routingNumber",message:"Transit number must be 5 digits"}):o.push({field:"routingNumber",message:"Transit number is required"}),(null===(i=this.accountNumberEl)||void 0===i?void 0:i.value)?(0,u.validateCanadianAccountNumber)(this.accountNumberEl.value)||o.push({field:"accountNumber",message:"Account number must be at least 7 digits"}):o.push({field:"accountNumber",message:"Account number is required"})):((null===(n=this.routingNumberEl)||void 0===n?void 0:n.value)?(0,u.validateRoutingNumber)(this.routingNumberEl.value)||o.push({field:"routingNumber",message:"Invalid routing number"}):o.push({field:"routingNumber",message:"Routing number is required"}),(null===(r=this.accountNumberEl)||void 0===r?void 0:r.value)?(0,u.validateAccountNumber)(this.accountNumberEl.value)||o.push({field:"accountNumber",message:"Invalid account number"}):o.push({field:"accountNumber",message:"Account number is required"})),{isValid:0===o.length,errors:o}})}applyUnifiedStyles(){var e;const t="0"===(null===(e=this.mergedStyles.container)||void 0===e?void 0:e.gap);if(this.mergedStyles.input)if(t){const e=Object.assign(Object.assign({},this.mergedStyles.input),{borderRight:"none",borderRadius:this.mergedStyles.input.borderRadius?`${this.mergedStyles.input.borderRadius} 0 0 ${this.mergedStyles.input.borderRadius}`:"0"}),t=this.stylesToCssString(e);this.spreedly.setStyle("number",t);const i=Object.assign(Object.assign({},this.mergedStyles.input),{borderRadius:this.mergedStyles.input.borderRadius?`0 ${this.mergedStyles.input.borderRadius} ${this.mergedStyles.input.borderRadius} 0`:"0"}),n=this.stylesToCssString(i);this.spreedly.setStyle("cvv",n)}else{const e=this.stylesToCssString(this.mergedStyles.input);this.spreedly.setStyle("number",e),this.spreedly.setStyle("cvv",e)}if(this.mergedStyles.focus){const e=this.stylesToCssString(this.mergedStyles.focus);this.spreedly.setStyle("number:focus",e),this.spreedly.setStyle("cvv:focus",e)}if(this.mergedStyles.error){const e=this.stylesToCssString(this.mergedStyles.error);this.spreedly.setStyle("number.invalid",e),this.spreedly.setStyle("cvv.invalid",e)}}stylesToCssString(e){return Object.entries(e).filter(([e,t])=>null!=t).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}: ${t}`).join("; ")}clear(){"bank_account"===this.mode?("CA"===this.bankCountry?(this.institutionNumberEl&&(this.institutionNumberEl.value=""),this.transitNumberEl&&(this.transitNumberEl.value="")):this.routingNumberEl&&(this.routingNumberEl.value=""),this.accountNumberEl&&(this.accountNumberEl.value=""),this.accountTypeEl&&(this.accountTypeEl.selectedIndex=0)):(this.spreedly.reload(),this.expiryEl&&(this.expiryEl.value=""))}focus(e){if("bank_account"===this.mode)return"routingNumber"===e?void("CA"===this.bankCountry&&this.institutionNumberEl?this.institutionNumberEl.focus():this.routingNumberEl&&this.routingNumberEl.focus()):"accountNumber"===e&&this.accountNumberEl?void this.accountNumberEl.focus():void 0;if("expiry"===e&&this.expiryEl)return void this.expiryEl.focus();const t={cardNumber:this.numberEl,cvv:this.cvvEl,expiry:null,routingNumber:null,accountNumber:null}[e];if(t){const e=document.getElementById(t);null==e||e.focus()}}determineLayout(e){return e<this.responsiveBreakpoint?"two-line":"single-line"}setupResizeObserver(){if("responsive"!==this.layout)return;const e=document.getElementById(this.containerId);if(!e)return;let t;this.resizeObserver=new ResizeObserver(e=>{clearTimeout(t),t=setTimeout(()=>{const t=e[0].contentRect.width,i=this.determineLayout(t);i!==this.effectiveLayout&&this.applyLayoutStyles(i)},100)}),this.resizeObserver.observe(e)}applyLayoutStyles(e){this.effectiveLayout=e;const t=document.getElementById(this.containerId);t&&("two-line"===e?(t.style.flexWrap="wrap",this.cardNumberDiv&&(this.cardNumberDiv.style.flex="1",this.cardNumberDiv.style.flexBasis="100%"),this.expiryEl&&(this.expiryEl.style.flex="1",this.expiryEl.style.flexBasis="auto"),this.cvvDiv&&(this.cvvDiv.style.flex="1",this.cvvDiv.style.flexBasis="auto")):(t.style.flexWrap="nowrap",this.cardNumberDiv&&(this.cardNumberDiv.style.flex=c.FIELD_FLEX.cardNumber.flex),this.expiryEl&&(this.expiryEl.style.flex=c.FIELD_FLEX.expiry.flex),this.cvvDiv&&(this.cvvDiv.style.flex=c.FIELD_FLEX.cvv.flex)))}destroy(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.spreedly&&this.spreedly.removeHandlers&&this.spreedly.removeHandlers(),this.eventHandlers.clear(),this.expiryEl}hasToken(){return!1}getToken(){return null}get tokenizationMode(){return"manual"}updateOverallValidation(){var e,t,i,n,r,o;"credit_card"===this.mode?this.currentValidationState.isValid=null!==(t=null===(e=this.currentValidationState.cardNumber)||void 0===e?void 0:e.isValid)&&void 0!==t&&t&&null!==(n=null===(i=this.currentValidationState.cvv)||void 0===i?void 0:i.isValid)&&void 0!==n&&n&&null!==(o=null===(r=this.currentValidationState.expiry)||void 0===r?void 0:r.isValid)&&void 0!==o&&o:this.currentValidationState.isValid=!0,this.emit("validation",this.currentValidationState)}handleFieldEvent(e,t,i){"input"===t&&("number"===e?(this.currentValidationState.cardNumber={isValid:i.validNumber||!1,isEmpty:0===i.numberLength},i.cardType&&"unknown"!==i.cardType&&this.emit("cardTypeChange",{cardType:this.normalizeCardType(i.cardType)})):"cvv"===e&&(this.currentValidationState.cvv={isValid:i.validCvv||!1,isEmpty:0===i.cvvLength}),this.updateOverallValidation()),"focus"===t?this.emit("focus",{field:e}):"blur"===t?this.emit("blur",{field:e}):"input"===t&&this.emit("change",{field:e})}createInternalElements(){const e=document.getElementById(this.containerId);if(!e)throw new Error(`Container element not found: ${this.containerId}`);e.innerHTML="",Object.assign(e.style,this.mergedStyles.container),"bank_account"===this.mode?this.createBankAccountFields(e):this.createCreditCardFields(e)}createCreditCardFields(e){if("responsive"===this.layout?this.effectiveLayout=this.determineLayout(e.offsetWidth):this.effectiveLayout="two-line"===this.layout?"two-line":"single-line","two-line"===this.effectiveLayout&&"responsive"!==this.layout){const t=(0,u.createFieldContainer)(this.numberEl,"1",c.FIELD_FLEX.cardNumber.minWidth);t.style.height=this.mergedStyles.input.height,t.style.flexBasis="100%",this.cardNumberDiv=t,e.appendChild(t),this.expiryEl=(0,u.createInputElement)(this.expiryId,"text",c.PLACEHOLDERS.expiry,c.FIELD_CONSTRAINTS.expiry.maxLength),Object.assign(this.expiryEl.style,{flex:"1",minWidth:c.FIELD_FLEX.expiry.minWidth}),this.applyInputStyles(this.expiryEl,this.mergedStyles,"left"),this.addExpiryFormatter(this.expiryEl),this.expiryEl.addEventListener("input",()=>{var e;const t=this.parseExpiry(this.expiryEl);this.currentValidationState.expiry={isValid:!!t,isEmpty:!(null===(e=this.expiryEl)||void 0===e?void 0:e.value)},this.updateOverallValidation()}),e.appendChild(this.expiryEl);const i=(0,u.createFieldContainer)(this.cvvEl,"1",c.FIELD_FLEX.cvv.minWidth);i.style.height=this.mergedStyles.input.height,this.cvvDiv=i,e.appendChild(i)}else{const t=(0,u.createFieldContainer)(this.numberEl,c.FIELD_FLEX.cardNumber.flex,c.FIELD_FLEX.cardNumber.minWidth);t.style.height=this.mergedStyles.input.height,this.cardNumberDiv=t,e.appendChild(t),this.expiryEl=(0,u.createInputElement)(this.expiryId,"text",c.PLACEHOLDERS.expiry,c.FIELD_CONSTRAINTS.expiry.maxLength),Object.assign(this.expiryEl.style,{flex:c.FIELD_FLEX.expiry.flex,minWidth:c.FIELD_FLEX.expiry.minWidth}),this.applyInputStyles(this.expiryEl,this.mergedStyles,"middle"),this.addExpiryFormatter(this.expiryEl),this.expiryEl.addEventListener("input",()=>{var e;const t=this.parseExpiry(this.expiryEl);this.currentValidationState.expiry={isValid:!!t,isEmpty:!(null===(e=this.expiryEl)||void 0===e?void 0:e.value)},this.updateOverallValidation()}),e.appendChild(this.expiryEl);const i=(0,u.createFieldContainer)(this.cvvEl,c.FIELD_FLEX.cvv.flex,c.FIELD_FLEX.cvv.minWidth);i.style.height=this.mergedStyles.input.height,this.cvvDiv=i,e.appendChild(i),"responsive"===this.layout&&(this.applyLayoutStyles(this.effectiveLayout),this.setupResizeObserver())}}createBankAccountFields(e){"CA"===this.bankCountry?this.createCanadianBankAccountFields(e):this.createUSBankAccountFields(e)}createUSBankAccountFields(e){"two-line"===this.layout?(this.accountTypeEl=(0,u.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:"1",minWidth:c.BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,this.mergedStyles,"left"),e.appendChild(this.accountTypeEl),this.routingNumberEl=(0,u.createInputElement)(`${this.containerId}-routing`,"text","Routing *",9),Object.assign(this.routingNumberEl.style,{flex:"1",minWidth:c.BANK_FIELD_FLEX.routingNumber.minWidth}),this.applyInputStyles(this.routingNumberEl,this.mergedStyles,"right"),this.routingNumberEl.addEventListener("blur",()=>{!(0,u.validateRoutingNumber)(this.routingNumberEl.value)&&this.routingNumberEl.value?this.applyErrorStyles(this.routingNumberEl):this.applyInputStyles(this.routingNumberEl,this.mergedStyles,"right"),this.updateBankAccountValidation()}),e.appendChild(this.routingNumberEl),this.accountNumberEl=(0,u.createInputElement)(`${this.containerId}-account`,"text","Account Number *",17),Object.assign(this.accountNumberEl.style,{flex:"1",flexBasis:"100%",minWidth:c.BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,this.mergedStyles),this.accountNumberEl.addEventListener("blur",()=>{!(0,u.validateAccountNumber)(this.accountNumberEl.value)&&this.accountNumberEl.value?this.applyErrorStyles(this.accountNumberEl):this.applyInputStyles(this.accountNumberEl,this.mergedStyles),this.updateBankAccountValidation()}),e.appendChild(this.accountNumberEl)):(this.routingNumberEl=(0,u.createInputElement)(`${this.containerId}-routing`,"text","Routing *",9),Object.assign(this.routingNumberEl.style,{flex:c.BANK_FIELD_FLEX.routingNumber.flex,minWidth:c.BANK_FIELD_FLEX.routingNumber.minWidth}),this.applyInputStyles(this.routingNumberEl,this.mergedStyles,"left"),this.routingNumberEl.addEventListener("blur",()=>{!(0,u.validateRoutingNumber)(this.routingNumberEl.value)&&this.routingNumberEl.value?this.applyErrorStyles(this.routingNumberEl):this.applyInputStyles(this.routingNumberEl,this.mergedStyles,"left"),this.updateBankAccountValidation()}),e.appendChild(this.routingNumberEl),this.accountNumberEl=(0,u.createInputElement)(`${this.containerId}-account`,"text","Account Number *",17),Object.assign(this.accountNumberEl.style,{flex:c.BANK_FIELD_FLEX.accountNumber.flex,minWidth:c.BANK_FIELD_FLEX.accountNumber.minWidth}),this.applyInputStyles(this.accountNumberEl,this.mergedStyles,"middle"),this.accountNumberEl.addEventListener("blur",()=>{!(0,u.validateAccountNumber)(this.accountNumberEl.value)&&this.accountNumberEl.value?this.applyErrorStyles(this.accountNumberEl):this.applyInputStyles(this.accountNumberEl,this.mergedStyles,"middle"),this.updateBankAccountValidation()}),e.appendChild(this.accountNumberEl),this.accountTypeEl=(0,u.createAccountTypeSelect)(`${this.containerId}-account-type`),Object.assign(this.accountTypeEl.style,{flex:c.BANK_FIELD_FLEX.accountType.flex,minWidth:c.BANK_FIELD_FLEX.accountType.minWidth}),this.applyInputStyles(this.accountTypeEl,this.mergedStyles,"right"),e.appendChild(this.accountTypeEl))}updateBankAccountValidation(){if("CA"===this.bankCountry){if(!this.institutionNumberEl||!this.transitNumberEl||!this.accountNumberEl)return;const e=(0,u.validateInstitutionNumber)(this.institutionNumberEl.value),t=(0,u.validateTransitNumber)(this.transitNumberEl.value),i=(0,u.validateCanadianAccountNumber)(this.accountNumberEl.value);this.currentValidationState={isValid:e&&t&&i,routingNumber:{isValid:e&&t,isEmpty:!this.institutionNumberEl.value&&!this.transitNumberEl.value,error:e?t?void 0:"Invalid transit number":"Invalid institution number"},accountNumber:{isValid:i,isEmpty:!this.accountNumberEl.value,error:i?void 0:"Account number must be at least 7 digits"}}}else{if(!this.routingNumberEl||!this.accountNumberEl)return;const e=(0,u.validateRoutingNumber)(this.routingNumberEl.value),t=(0,u.validateAccountNumber)(this.accountNumberEl.value);this.currentValidationState={isValid:e&&t,routingNumber:{isValid:e,isEmpty:!this.routingNumberEl.value,error:e?void 0:"Invalid routing number"},accountNumber:{isValid:t,isEmpty:!this.accountNumberEl.value,error:t?void 0:"Invalid account number"}}}this.emit("validation",this.currentValidationState)}validateExpiry(){if(!this.expiryEl)return;const e=this.parseExpiry(this.expiryEl);if(!e)return void this.applyErrorStyles(this.expiryEl);const t=parseInt(e.month,10),i=parseInt(e.year,10);if(t<1||t>12)return void this.applyErrorStyles(this.expiryEl);const n=new Date;new Date(i,t-1)<n?this.applyErrorStyles(this.expiryEl):this.applyInputStyles(this.expiryEl,this.mergedStyles,"middle")}applyErrorStyles(e){this.mergedStyles.error?Object.assign(e.style,this.mergedStyles.error):e.style.borderColor="#dc3545"}static ensureSpreedlyLoaded(){return n(this,void 0,void 0,function*(){window.Spreedly||(yield h.loadScript("https://core.spreedly.com/iframe/iframe-v1.min.js","spreedly-iframe-script"),yield h.waitForGlobal("Spreedly",5e3))})}static loadScript(e,t){return n(this,void 0,void 0,function*(){if(!t||!document.getElementById(t))return Array.from(document.getElementsByTagName("script")).find(t=>t.src===e)?void 0:new Promise((i,n)=>{const r=document.createElement("script");r.src=e,r.async=!0,t&&(r.id=t),r.onload=()=>i(),r.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.body.appendChild(r)})})}static waitForGlobal(e){return n(this,arguments,void 0,function*(e,t=1e4){const i=Date.now();for(;Date.now()-i<t;){const t=window[e];if(t)return t;yield new Promise(e=>setTimeout(e,100))}throw new Error(`Timeout waiting for global: ${e}`)})}static tokenizeBankAccount(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(a.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{bank_account:{first_name:e.contact.firstName||void 0,last_name:e.contact.lastName||void 0,full_name:e.contact.fullName||void 0,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country,bank_account_number:e.account.accountNumber.replace(/\s+/g,""),bank_routing_number:e.account.routingNumber.replace(/\s+/g,""),bank_account_holder_type:e.account.accountHolderType,bank_account_type:e.account.accountType}},retained:!1})}).then(s.unpackSpreedlyResponse).then(s.extractSpreedlyToken)}static tokenizeCreditCard(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(a.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{credit_card:{first_name:e.contact.firstName,last_name:e.contact.lastName,full_name:e.contact.fullName,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country,number:e.card.cardNumber.replace(/\s+/g,""),verification_value:e.card.verificationValue,year:e.card.expirationYear,month:e.card.expirationMonth}},retained:!1})}).then(s.unpackSpreedlyResponse).then(s.extractSpreedlyToken)}static tokenizePayPal(e,t){if(void 0===t.spreedlyEnvironmentKey)throw new Error("Spreedly is not configured.");return fetch(a.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{payment_method_type:"paypal",first_name:e.contact.firstName,last_name:e.contact.lastName,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},retained:!1})}).then(s.unpackSpreedlyResponse).then(s.extractSpreedlyToken)}}t.SpreedlyTokenizer=h},903:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tokenizePaymentBankCanada=function(e,t,i,r,o,a,s,d,l){const c=(0,n.v4)();let u=l.address1;l.address2&&(u+="\n"+l.address2);const h={IATS_DPM_ProcessOption:"TOKEN",IATS_DPM_RecurringOn:"FALSE",IATS_DPM_ProcessID:o,IATS_DPM_RelayURL:a,IATS_DPM_ClientDefined_PaymentId:c,IATS_DPM_ClientDefined_GatewayId:s,IATS_DPM_Title:d.salutation,IATS_DPM_FirstName:d.firstName,IATS_DPM_LastName:d.lastName,IATS_DPM_Address:u,IATS_DPM_City:l.city,IATS_DPM_Province:l.state,IATS_DPM_Country:l.country,IATS_DPM_ZipCode:l.zip,IATS_DPM_Phone:d.primaryPhone,IATS_DPM_EMAIL:d.email,IATS_DPM_AccountNumber:e+t+i,IATS_DPM_MOP:"ACHEFT",IATS_DPM_AccountType:r},p=new FormData;for(const[e,t]of Object.entries(h))p.append(e,t);return fetch("https://www.iatspayments.com/netgate/IATSDPMProcess.aspx",{method:"POST",mode:"no-cors",body:p}).then(e=>e.text().then(()=>c))},t.tokenizePaymentBankUs=function(){throw new Error("US Bank Tokenization Not Yet Implemented")},t.tokenizePaymentCard=function(){throw new Error("Card Tokenization Not Yet Implemented")};const n=i(611)},953:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{d(n.next(e))}catch(e){o(e)}}function s(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const r=i(247);class o{constructor(e){this.appleSession=null,this.paymentRequestDefaults={currencyCode:"USD",countryCode:"US",merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["amex","masterCard","visa","discover"],requiredBillingContactFields:["postalAddress","name"],requiredShippingContactFields:["email","phone"],total:{label:"iDonate",amount:"",type:"final"}},this.paymentRequest=Object.assign({},this.paymentRequestDefaults,e)}static isSupported(){return window.ApplePaySession&&ApplePaySession.canMakePayments()&&ApplePaySession.supportsVersion(o.ApplePayApiVersion)}begin(){return n(this,void 0,void 0,function*(){if(!o.isSupported())throw new Error("Apple Pay Not Supported");return this.appleSession=new ApplePaySession(o.ApplePayApiVersion,this.paymentRequest),this.appleSession.begin(),this.appleSession})}createSession(e,t){return fetch(`${t}/payment/create-session`,{method:"POST",headers:r.CLIENT_HEADERS,body:JSON.stringify(e)}).then(e=>e.json())}tokenizeWithCardConnect(e,t){const i=e.token.paymentData,n=`${i.data}&ectype=apple&ecsig=${i.signature}&eckey=${i.header.ephemeralPublicKey}&ectid=${i.header.transactionId}&echash=&ecpublickeyhash=${i.header.publicKeyHash}`;return fetch(`${t}/cardsecure/api/v1/ccn/tokenize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encryptionhandler:"EC_APPLE_PAY",devicedata:n,unique:!0})}).then(e=>e.json())}}o.ApplePayApiVersion=6,t.default=o}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}return i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(806)})());