@appfunnel-dev/sdk 2.0.0-canary.1 → 2.0.0-canary.2

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.
Files changed (43) hide show
  1. package/dist/capabilities-7_hy5f5G.d.cts +114 -0
  2. package/dist/capabilities-7_hy5f5G.d.ts +114 -0
  3. package/dist/checkout-CZmEvWfC.d.cts +317 -0
  4. package/dist/checkout-DiQvRT5q.d.ts +317 -0
  5. package/dist/chunk-7UC5VXOR.js +446 -0
  6. package/dist/chunk-7UC5VXOR.js.map +1 -0
  7. package/dist/chunk-LJYLGLFS.cjs +153 -0
  8. package/dist/chunk-LJYLGLFS.cjs.map +1 -0
  9. package/dist/chunk-UIR6TGEW.js +97 -0
  10. package/dist/chunk-UIR6TGEW.js.map +1 -0
  11. package/dist/chunk-VQOD2Z6Q.cjs +104 -0
  12. package/dist/chunk-VQOD2Z6Q.cjs.map +1 -0
  13. package/dist/chunk-YY375F2B.js +140 -0
  14. package/dist/chunk-YY375F2B.js.map +1 -0
  15. package/dist/chunk-Z3TWO2PW.cjs +475 -0
  16. package/dist/chunk-Z3TWO2PW.cjs.map +1 -0
  17. package/dist/driver-paddle.cjs +814 -0
  18. package/dist/driver-paddle.cjs.map +1 -0
  19. package/dist/driver-paddle.d.cts +10 -0
  20. package/dist/driver-paddle.d.ts +10 -0
  21. package/dist/driver-paddle.js +811 -0
  22. package/dist/driver-paddle.js.map +1 -0
  23. package/dist/driver-stripe.cjs +2253 -0
  24. package/dist/driver-stripe.cjs.map +1 -0
  25. package/dist/driver-stripe.d.cts +8 -0
  26. package/dist/driver-stripe.d.ts +8 -0
  27. package/dist/driver-stripe.js +2247 -0
  28. package/dist/driver-stripe.js.map +1 -0
  29. package/dist/index.cjs +1949 -811
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +175 -933
  32. package/dist/index.d.ts +175 -933
  33. package/dist/index.js +1669 -652
  34. package/dist/index.js.map +1 -1
  35. package/dist/manifest-DQThneiG.d.cts +777 -0
  36. package/dist/manifest-DQThneiG.d.ts +777 -0
  37. package/dist/manifest-entry.cjs +203 -0
  38. package/dist/manifest-entry.cjs.map +1 -0
  39. package/dist/manifest-entry.d.cts +184 -0
  40. package/dist/manifest-entry.d.ts +184 -0
  41. package/dist/manifest-entry.js +98 -0
  42. package/dist/manifest-entry.js.map +1 -0
  43. package/package.json +37 -4
@@ -0,0 +1,2247 @@
1
+ import { completeWithPoll, postSession, leaveForRedirect, settlementToResult, toCheckoutError, postComplete } from './chunk-UIR6TGEW.js';
2
+ import { __commonJS, __export, __toESM, checkoutError } from './chunk-YY375F2B.js';
3
+ import React, { createElement, useState, useRef, useEffect } from 'react';
4
+
5
+ // ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
6
+ var require_react_is_production_min = __commonJS({
7
+ "../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
8
+ var b = "function" === typeof Symbol && Symbol.for;
9
+ var c = b ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
10
+ var d = b ? /* @__PURE__ */ Symbol.for("react.portal") : 60106;
11
+ var e = b ? /* @__PURE__ */ Symbol.for("react.fragment") : 60107;
12
+ var f = b ? /* @__PURE__ */ Symbol.for("react.strict_mode") : 60108;
13
+ var g = b ? /* @__PURE__ */ Symbol.for("react.profiler") : 60114;
14
+ var h = b ? /* @__PURE__ */ Symbol.for("react.provider") : 60109;
15
+ var k = b ? /* @__PURE__ */ Symbol.for("react.context") : 60110;
16
+ var l = b ? /* @__PURE__ */ Symbol.for("react.async_mode") : 60111;
17
+ var m = b ? /* @__PURE__ */ Symbol.for("react.concurrent_mode") : 60111;
18
+ var n = b ? /* @__PURE__ */ Symbol.for("react.forward_ref") : 60112;
19
+ var p = b ? /* @__PURE__ */ Symbol.for("react.suspense") : 60113;
20
+ var q = b ? /* @__PURE__ */ Symbol.for("react.suspense_list") : 60120;
21
+ var r = b ? /* @__PURE__ */ Symbol.for("react.memo") : 60115;
22
+ var t = b ? /* @__PURE__ */ Symbol.for("react.lazy") : 60116;
23
+ var v = b ? /* @__PURE__ */ Symbol.for("react.block") : 60121;
24
+ var w = b ? /* @__PURE__ */ Symbol.for("react.fundamental") : 60117;
25
+ var x = b ? /* @__PURE__ */ Symbol.for("react.responder") : 60118;
26
+ var y = b ? /* @__PURE__ */ Symbol.for("react.scope") : 60119;
27
+ function z(a) {
28
+ if ("object" === typeof a && null !== a) {
29
+ var u = a.$$typeof;
30
+ switch (u) {
31
+ case c:
32
+ switch (a = a.type, a) {
33
+ case l:
34
+ case m:
35
+ case e:
36
+ case g:
37
+ case f:
38
+ case p:
39
+ return a;
40
+ default:
41
+ switch (a = a && a.$$typeof, a) {
42
+ case k:
43
+ case n:
44
+ case t:
45
+ case r:
46
+ case h:
47
+ return a;
48
+ default:
49
+ return u;
50
+ }
51
+ }
52
+ case d:
53
+ return u;
54
+ }
55
+ }
56
+ }
57
+ function A(a) {
58
+ return z(a) === m;
59
+ }
60
+ exports.AsyncMode = l;
61
+ exports.ConcurrentMode = m;
62
+ exports.ContextConsumer = k;
63
+ exports.ContextProvider = h;
64
+ exports.Element = c;
65
+ exports.ForwardRef = n;
66
+ exports.Fragment = e;
67
+ exports.Lazy = t;
68
+ exports.Memo = r;
69
+ exports.Portal = d;
70
+ exports.Profiler = g;
71
+ exports.StrictMode = f;
72
+ exports.Suspense = p;
73
+ exports.isAsyncMode = function(a) {
74
+ return A(a) || z(a) === l;
75
+ };
76
+ exports.isConcurrentMode = A;
77
+ exports.isContextConsumer = function(a) {
78
+ return z(a) === k;
79
+ };
80
+ exports.isContextProvider = function(a) {
81
+ return z(a) === h;
82
+ };
83
+ exports.isElement = function(a) {
84
+ return "object" === typeof a && null !== a && a.$$typeof === c;
85
+ };
86
+ exports.isForwardRef = function(a) {
87
+ return z(a) === n;
88
+ };
89
+ exports.isFragment = function(a) {
90
+ return z(a) === e;
91
+ };
92
+ exports.isLazy = function(a) {
93
+ return z(a) === t;
94
+ };
95
+ exports.isMemo = function(a) {
96
+ return z(a) === r;
97
+ };
98
+ exports.isPortal = function(a) {
99
+ return z(a) === d;
100
+ };
101
+ exports.isProfiler = function(a) {
102
+ return z(a) === g;
103
+ };
104
+ exports.isStrictMode = function(a) {
105
+ return z(a) === f;
106
+ };
107
+ exports.isSuspense = function(a) {
108
+ return z(a) === p;
109
+ };
110
+ exports.isValidElementType = function(a) {
111
+ return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
112
+ };
113
+ exports.typeOf = z;
114
+ }
115
+ });
116
+
117
+ // ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js
118
+ var require_react_is_development = __commonJS({
119
+ "../../node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js"(exports) {
120
+ if (process.env.NODE_ENV !== "production") {
121
+ (function() {
122
+ var hasSymbol = typeof Symbol === "function" && Symbol.for;
123
+ var REACT_ELEMENT_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
124
+ var REACT_PORTAL_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.portal") : 60106;
125
+ var REACT_FRAGMENT_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.fragment") : 60107;
126
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.strict_mode") : 60108;
127
+ var REACT_PROFILER_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.profiler") : 60114;
128
+ var REACT_PROVIDER_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.provider") : 60109;
129
+ var REACT_CONTEXT_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.context") : 60110;
130
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.async_mode") : 60111;
131
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.concurrent_mode") : 60111;
132
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.forward_ref") : 60112;
133
+ var REACT_SUSPENSE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.suspense") : 60113;
134
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.suspense_list") : 60120;
135
+ var REACT_MEMO_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.memo") : 60115;
136
+ var REACT_LAZY_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.lazy") : 60116;
137
+ var REACT_BLOCK_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.block") : 60121;
138
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.fundamental") : 60117;
139
+ var REACT_RESPONDER_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.responder") : 60118;
140
+ var REACT_SCOPE_TYPE = hasSymbol ? /* @__PURE__ */ Symbol.for("react.scope") : 60119;
141
+ function isValidElementType(type) {
142
+ return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
143
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
144
+ }
145
+ function typeOf(object) {
146
+ if (typeof object === "object" && object !== null) {
147
+ var $$typeof = object.$$typeof;
148
+ switch ($$typeof) {
149
+ case REACT_ELEMENT_TYPE:
150
+ var type = object.type;
151
+ switch (type) {
152
+ case REACT_ASYNC_MODE_TYPE:
153
+ case REACT_CONCURRENT_MODE_TYPE:
154
+ case REACT_FRAGMENT_TYPE:
155
+ case REACT_PROFILER_TYPE:
156
+ case REACT_STRICT_MODE_TYPE:
157
+ case REACT_SUSPENSE_TYPE:
158
+ return type;
159
+ default:
160
+ var $$typeofType = type && type.$$typeof;
161
+ switch ($$typeofType) {
162
+ case REACT_CONTEXT_TYPE:
163
+ case REACT_FORWARD_REF_TYPE:
164
+ case REACT_LAZY_TYPE:
165
+ case REACT_MEMO_TYPE:
166
+ case REACT_PROVIDER_TYPE:
167
+ return $$typeofType;
168
+ default:
169
+ return $$typeof;
170
+ }
171
+ }
172
+ case REACT_PORTAL_TYPE:
173
+ return $$typeof;
174
+ }
175
+ }
176
+ return void 0;
177
+ }
178
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
179
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
180
+ var ContextConsumer = REACT_CONTEXT_TYPE;
181
+ var ContextProvider = REACT_PROVIDER_TYPE;
182
+ var Element = REACT_ELEMENT_TYPE;
183
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
184
+ var Fragment = REACT_FRAGMENT_TYPE;
185
+ var Lazy = REACT_LAZY_TYPE;
186
+ var Memo = REACT_MEMO_TYPE;
187
+ var Portal = REACT_PORTAL_TYPE;
188
+ var Profiler = REACT_PROFILER_TYPE;
189
+ var StrictMode = REACT_STRICT_MODE_TYPE;
190
+ var Suspense = REACT_SUSPENSE_TYPE;
191
+ var hasWarnedAboutDeprecatedIsAsyncMode = false;
192
+ function isAsyncMode(object) {
193
+ {
194
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
195
+ hasWarnedAboutDeprecatedIsAsyncMode = true;
196
+ console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
197
+ }
198
+ }
199
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
200
+ }
201
+ function isConcurrentMode(object) {
202
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
203
+ }
204
+ function isContextConsumer(object) {
205
+ return typeOf(object) === REACT_CONTEXT_TYPE;
206
+ }
207
+ function isContextProvider(object) {
208
+ return typeOf(object) === REACT_PROVIDER_TYPE;
209
+ }
210
+ function isElement(object) {
211
+ return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
212
+ }
213
+ function isForwardRef(object) {
214
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
215
+ }
216
+ function isFragment(object) {
217
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
218
+ }
219
+ function isLazy(object) {
220
+ return typeOf(object) === REACT_LAZY_TYPE;
221
+ }
222
+ function isMemo(object) {
223
+ return typeOf(object) === REACT_MEMO_TYPE;
224
+ }
225
+ function isPortal(object) {
226
+ return typeOf(object) === REACT_PORTAL_TYPE;
227
+ }
228
+ function isProfiler(object) {
229
+ return typeOf(object) === REACT_PROFILER_TYPE;
230
+ }
231
+ function isStrictMode(object) {
232
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
233
+ }
234
+ function isSuspense(object) {
235
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
236
+ }
237
+ exports.AsyncMode = AsyncMode;
238
+ exports.ConcurrentMode = ConcurrentMode;
239
+ exports.ContextConsumer = ContextConsumer;
240
+ exports.ContextProvider = ContextProvider;
241
+ exports.Element = Element;
242
+ exports.ForwardRef = ForwardRef;
243
+ exports.Fragment = Fragment;
244
+ exports.Lazy = Lazy;
245
+ exports.Memo = Memo;
246
+ exports.Portal = Portal;
247
+ exports.Profiler = Profiler;
248
+ exports.StrictMode = StrictMode;
249
+ exports.Suspense = Suspense;
250
+ exports.isAsyncMode = isAsyncMode;
251
+ exports.isConcurrentMode = isConcurrentMode;
252
+ exports.isContextConsumer = isContextConsumer;
253
+ exports.isContextProvider = isContextProvider;
254
+ exports.isElement = isElement;
255
+ exports.isForwardRef = isForwardRef;
256
+ exports.isFragment = isFragment;
257
+ exports.isLazy = isLazy;
258
+ exports.isMemo = isMemo;
259
+ exports.isPortal = isPortal;
260
+ exports.isProfiler = isProfiler;
261
+ exports.isStrictMode = isStrictMode;
262
+ exports.isSuspense = isSuspense;
263
+ exports.isValidElementType = isValidElementType;
264
+ exports.typeOf = typeOf;
265
+ })();
266
+ }
267
+ }
268
+ });
269
+
270
+ // ../../node_modules/prop-types/node_modules/react-is/index.js
271
+ var require_react_is = __commonJS({
272
+ "../../node_modules/prop-types/node_modules/react-is/index.js"(exports, module) {
273
+ if (process.env.NODE_ENV === "production") {
274
+ module.exports = require_react_is_production_min();
275
+ } else {
276
+ module.exports = require_react_is_development();
277
+ }
278
+ }
279
+ });
280
+
281
+ // ../../node_modules/object-assign/index.js
282
+ var require_object_assign = __commonJS({
283
+ "../../node_modules/object-assign/index.js"(exports, module) {
284
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
285
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
286
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
287
+ function toObject(val) {
288
+ if (val === null || val === void 0) {
289
+ throw new TypeError("Object.assign cannot be called with null or undefined");
290
+ }
291
+ return Object(val);
292
+ }
293
+ function shouldUseNative() {
294
+ try {
295
+ if (!Object.assign) {
296
+ return false;
297
+ }
298
+ var test1 = new String("abc");
299
+ test1[5] = "de";
300
+ if (Object.getOwnPropertyNames(test1)[0] === "5") {
301
+ return false;
302
+ }
303
+ var test2 = {};
304
+ for (var i = 0; i < 10; i++) {
305
+ test2["_" + String.fromCharCode(i)] = i;
306
+ }
307
+ var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
308
+ return test2[n];
309
+ });
310
+ if (order2.join("") !== "0123456789") {
311
+ return false;
312
+ }
313
+ var test3 = {};
314
+ "abcdefghijklmnopqrst".split("").forEach(function(letter) {
315
+ test3[letter] = letter;
316
+ });
317
+ if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
318
+ return false;
319
+ }
320
+ return true;
321
+ } catch (err) {
322
+ return false;
323
+ }
324
+ }
325
+ module.exports = shouldUseNative() ? Object.assign : function(target, source) {
326
+ var from;
327
+ var to = toObject(target);
328
+ var symbols;
329
+ for (var s = 1; s < arguments.length; s++) {
330
+ from = Object(arguments[s]);
331
+ for (var key in from) {
332
+ if (hasOwnProperty.call(from, key)) {
333
+ to[key] = from[key];
334
+ }
335
+ }
336
+ if (getOwnPropertySymbols) {
337
+ symbols = getOwnPropertySymbols(from);
338
+ for (var i = 0; i < symbols.length; i++) {
339
+ if (propIsEnumerable.call(from, symbols[i])) {
340
+ to[symbols[i]] = from[symbols[i]];
341
+ }
342
+ }
343
+ }
344
+ }
345
+ return to;
346
+ };
347
+ }
348
+ });
349
+
350
+ // ../../node_modules/prop-types/lib/ReactPropTypesSecret.js
351
+ var require_ReactPropTypesSecret = __commonJS({
352
+ "../../node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
353
+ var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
354
+ module.exports = ReactPropTypesSecret;
355
+ }
356
+ });
357
+
358
+ // ../../node_modules/prop-types/lib/has.js
359
+ var require_has = __commonJS({
360
+ "../../node_modules/prop-types/lib/has.js"(exports, module) {
361
+ module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
362
+ }
363
+ });
364
+
365
+ // ../../node_modules/prop-types/checkPropTypes.js
366
+ var require_checkPropTypes = __commonJS({
367
+ "../../node_modules/prop-types/checkPropTypes.js"(exports, module) {
368
+ var printWarning = function() {
369
+ };
370
+ if (process.env.NODE_ENV !== "production") {
371
+ ReactPropTypesSecret = require_ReactPropTypesSecret();
372
+ loggedTypeFailures = {};
373
+ has = require_has();
374
+ printWarning = function(text) {
375
+ var message = "Warning: " + text;
376
+ if (typeof console !== "undefined") {
377
+ console.error(message);
378
+ }
379
+ try {
380
+ throw new Error(message);
381
+ } catch (x) {
382
+ }
383
+ };
384
+ }
385
+ var ReactPropTypesSecret;
386
+ var loggedTypeFailures;
387
+ var has;
388
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
389
+ if (process.env.NODE_ENV !== "production") {
390
+ for (var typeSpecName in typeSpecs) {
391
+ if (has(typeSpecs, typeSpecName)) {
392
+ var error;
393
+ try {
394
+ if (typeof typeSpecs[typeSpecName] !== "function") {
395
+ var err = Error(
396
+ (componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
397
+ );
398
+ err.name = "Invariant Violation";
399
+ throw err;
400
+ }
401
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
402
+ } catch (ex) {
403
+ error = ex;
404
+ }
405
+ if (error && !(error instanceof Error)) {
406
+ printWarning(
407
+ (componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
408
+ );
409
+ }
410
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
411
+ loggedTypeFailures[error.message] = true;
412
+ var stack = getStack ? getStack() : "";
413
+ printWarning(
414
+ "Failed " + location + " type: " + error.message + (stack != null ? stack : "")
415
+ );
416
+ }
417
+ }
418
+ }
419
+ }
420
+ }
421
+ checkPropTypes.resetWarningCache = function() {
422
+ if (process.env.NODE_ENV !== "production") {
423
+ loggedTypeFailures = {};
424
+ }
425
+ };
426
+ module.exports = checkPropTypes;
427
+ }
428
+ });
429
+
430
+ // ../../node_modules/prop-types/factoryWithTypeCheckers.js
431
+ var require_factoryWithTypeCheckers = __commonJS({
432
+ "../../node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
433
+ var ReactIs = require_react_is();
434
+ var assign = require_object_assign();
435
+ var ReactPropTypesSecret = require_ReactPropTypesSecret();
436
+ var has = require_has();
437
+ var checkPropTypes = require_checkPropTypes();
438
+ var printWarning = function() {
439
+ };
440
+ if (process.env.NODE_ENV !== "production") {
441
+ printWarning = function(text) {
442
+ var message = "Warning: " + text;
443
+ if (typeof console !== "undefined") {
444
+ console.error(message);
445
+ }
446
+ try {
447
+ throw new Error(message);
448
+ } catch (x) {
449
+ }
450
+ };
451
+ }
452
+ function emptyFunctionThatReturnsNull() {
453
+ return null;
454
+ }
455
+ module.exports = function(isValidElement, throwOnDirectAccess) {
456
+ var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
457
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
458
+ function getIteratorFn(maybeIterable) {
459
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
460
+ if (typeof iteratorFn === "function") {
461
+ return iteratorFn;
462
+ }
463
+ }
464
+ var ANONYMOUS = "<<anonymous>>";
465
+ var ReactPropTypes = {
466
+ array: createPrimitiveTypeChecker("array"),
467
+ bigint: createPrimitiveTypeChecker("bigint"),
468
+ bool: createPrimitiveTypeChecker("boolean"),
469
+ func: createPrimitiveTypeChecker("function"),
470
+ number: createPrimitiveTypeChecker("number"),
471
+ object: createPrimitiveTypeChecker("object"),
472
+ string: createPrimitiveTypeChecker("string"),
473
+ symbol: createPrimitiveTypeChecker("symbol"),
474
+ any: createAnyTypeChecker(),
475
+ arrayOf: createArrayOfTypeChecker,
476
+ element: createElementTypeChecker(),
477
+ elementType: createElementTypeTypeChecker(),
478
+ instanceOf: createInstanceTypeChecker,
479
+ node: createNodeChecker(),
480
+ objectOf: createObjectOfTypeChecker,
481
+ oneOf: createEnumTypeChecker,
482
+ oneOfType: createUnionTypeChecker,
483
+ shape: createShapeTypeChecker,
484
+ exact: createStrictShapeTypeChecker
485
+ };
486
+ function is(x, y) {
487
+ if (x === y) {
488
+ return x !== 0 || 1 / x === 1 / y;
489
+ } else {
490
+ return x !== x && y !== y;
491
+ }
492
+ }
493
+ function PropTypeError(message, data) {
494
+ this.message = message;
495
+ this.data = data && typeof data === "object" ? data : {};
496
+ this.stack = "";
497
+ }
498
+ PropTypeError.prototype = Error.prototype;
499
+ function createChainableTypeChecker(validate) {
500
+ if (process.env.NODE_ENV !== "production") {
501
+ var manualPropTypeCallCache = {};
502
+ var manualPropTypeWarningCount = 0;
503
+ }
504
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
505
+ componentName = componentName || ANONYMOUS;
506
+ propFullName = propFullName || propName;
507
+ if (secret !== ReactPropTypesSecret) {
508
+ if (throwOnDirectAccess) {
509
+ var err = new Error(
510
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
511
+ );
512
+ err.name = "Invariant Violation";
513
+ throw err;
514
+ } else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
515
+ var cacheKey = componentName + ":" + propName;
516
+ if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
517
+ manualPropTypeWarningCount < 3) {
518
+ printWarning(
519
+ "You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
520
+ );
521
+ manualPropTypeCallCache[cacheKey] = true;
522
+ manualPropTypeWarningCount++;
523
+ }
524
+ }
525
+ }
526
+ if (props[propName] == null) {
527
+ if (isRequired) {
528
+ if (props[propName] === null) {
529
+ return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
530
+ }
531
+ return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
532
+ }
533
+ return null;
534
+ } else {
535
+ return validate(props, propName, componentName, location, propFullName);
536
+ }
537
+ }
538
+ var chainedCheckType = checkType.bind(null, false);
539
+ chainedCheckType.isRequired = checkType.bind(null, true);
540
+ return chainedCheckType;
541
+ }
542
+ function createPrimitiveTypeChecker(expectedType) {
543
+ function validate(props, propName, componentName, location, propFullName, secret) {
544
+ var propValue = props[propName];
545
+ var propType = getPropType(propValue);
546
+ if (propType !== expectedType) {
547
+ var preciseType = getPreciseType(propValue);
548
+ return new PropTypeError(
549
+ "Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
550
+ { expectedType }
551
+ );
552
+ }
553
+ return null;
554
+ }
555
+ return createChainableTypeChecker(validate);
556
+ }
557
+ function createAnyTypeChecker() {
558
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
559
+ }
560
+ function createArrayOfTypeChecker(typeChecker) {
561
+ function validate(props, propName, componentName, location, propFullName) {
562
+ if (typeof typeChecker !== "function") {
563
+ return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
564
+ }
565
+ var propValue = props[propName];
566
+ if (!Array.isArray(propValue)) {
567
+ var propType = getPropType(propValue);
568
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
569
+ }
570
+ for (var i = 0; i < propValue.length; i++) {
571
+ var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
572
+ if (error instanceof Error) {
573
+ return error;
574
+ }
575
+ }
576
+ return null;
577
+ }
578
+ return createChainableTypeChecker(validate);
579
+ }
580
+ function createElementTypeChecker() {
581
+ function validate(props, propName, componentName, location, propFullName) {
582
+ var propValue = props[propName];
583
+ if (!isValidElement(propValue)) {
584
+ var propType = getPropType(propValue);
585
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
586
+ }
587
+ return null;
588
+ }
589
+ return createChainableTypeChecker(validate);
590
+ }
591
+ function createElementTypeTypeChecker() {
592
+ function validate(props, propName, componentName, location, propFullName) {
593
+ var propValue = props[propName];
594
+ if (!ReactIs.isValidElementType(propValue)) {
595
+ var propType = getPropType(propValue);
596
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
597
+ }
598
+ return null;
599
+ }
600
+ return createChainableTypeChecker(validate);
601
+ }
602
+ function createInstanceTypeChecker(expectedClass) {
603
+ function validate(props, propName, componentName, location, propFullName) {
604
+ if (!(props[propName] instanceof expectedClass)) {
605
+ var expectedClassName = expectedClass.name || ANONYMOUS;
606
+ var actualClassName = getClassName(props[propName]);
607
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
608
+ }
609
+ return null;
610
+ }
611
+ return createChainableTypeChecker(validate);
612
+ }
613
+ function createEnumTypeChecker(expectedValues) {
614
+ if (!Array.isArray(expectedValues)) {
615
+ if (process.env.NODE_ENV !== "production") {
616
+ if (arguments.length > 1) {
617
+ printWarning(
618
+ "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
619
+ );
620
+ } else {
621
+ printWarning("Invalid argument supplied to oneOf, expected an array.");
622
+ }
623
+ }
624
+ return emptyFunctionThatReturnsNull;
625
+ }
626
+ function validate(props, propName, componentName, location, propFullName) {
627
+ var propValue = props[propName];
628
+ for (var i = 0; i < expectedValues.length; i++) {
629
+ if (is(propValue, expectedValues[i])) {
630
+ return null;
631
+ }
632
+ }
633
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
634
+ var type = getPreciseType(value);
635
+ if (type === "symbol") {
636
+ return String(value);
637
+ }
638
+ return value;
639
+ });
640
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
641
+ }
642
+ return createChainableTypeChecker(validate);
643
+ }
644
+ function createObjectOfTypeChecker(typeChecker) {
645
+ function validate(props, propName, componentName, location, propFullName) {
646
+ if (typeof typeChecker !== "function") {
647
+ return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
648
+ }
649
+ var propValue = props[propName];
650
+ var propType = getPropType(propValue);
651
+ if (propType !== "object") {
652
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
653
+ }
654
+ for (var key in propValue) {
655
+ if (has(propValue, key)) {
656
+ var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
657
+ if (error instanceof Error) {
658
+ return error;
659
+ }
660
+ }
661
+ }
662
+ return null;
663
+ }
664
+ return createChainableTypeChecker(validate);
665
+ }
666
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
667
+ if (!Array.isArray(arrayOfTypeCheckers)) {
668
+ process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
669
+ return emptyFunctionThatReturnsNull;
670
+ }
671
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
672
+ var checker = arrayOfTypeCheckers[i];
673
+ if (typeof checker !== "function") {
674
+ printWarning(
675
+ "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
676
+ );
677
+ return emptyFunctionThatReturnsNull;
678
+ }
679
+ }
680
+ function validate(props, propName, componentName, location, propFullName) {
681
+ var expectedTypes = [];
682
+ for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
683
+ var checker2 = arrayOfTypeCheckers[i2];
684
+ var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
685
+ if (checkerResult == null) {
686
+ return null;
687
+ }
688
+ if (checkerResult.data && has(checkerResult.data, "expectedType")) {
689
+ expectedTypes.push(checkerResult.data.expectedType);
690
+ }
691
+ }
692
+ var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
693
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
694
+ }
695
+ return createChainableTypeChecker(validate);
696
+ }
697
+ function createNodeChecker() {
698
+ function validate(props, propName, componentName, location, propFullName) {
699
+ if (!isNode(props[propName])) {
700
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
701
+ }
702
+ return null;
703
+ }
704
+ return createChainableTypeChecker(validate);
705
+ }
706
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
707
+ return new PropTypeError(
708
+ (componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
709
+ );
710
+ }
711
+ function createShapeTypeChecker(shapeTypes) {
712
+ function validate(props, propName, componentName, location, propFullName) {
713
+ var propValue = props[propName];
714
+ var propType = getPropType(propValue);
715
+ if (propType !== "object") {
716
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
717
+ }
718
+ for (var key in shapeTypes) {
719
+ var checker = shapeTypes[key];
720
+ if (typeof checker !== "function") {
721
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
722
+ }
723
+ var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
724
+ if (error) {
725
+ return error;
726
+ }
727
+ }
728
+ return null;
729
+ }
730
+ return createChainableTypeChecker(validate);
731
+ }
732
+ function createStrictShapeTypeChecker(shapeTypes) {
733
+ function validate(props, propName, componentName, location, propFullName) {
734
+ var propValue = props[propName];
735
+ var propType = getPropType(propValue);
736
+ if (propType !== "object") {
737
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
738
+ }
739
+ var allKeys = assign({}, props[propName], shapeTypes);
740
+ for (var key in allKeys) {
741
+ var checker = shapeTypes[key];
742
+ if (has(shapeTypes, key) && typeof checker !== "function") {
743
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
744
+ }
745
+ if (!checker) {
746
+ return new PropTypeError(
747
+ "Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
748
+ );
749
+ }
750
+ var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
751
+ if (error) {
752
+ return error;
753
+ }
754
+ }
755
+ return null;
756
+ }
757
+ return createChainableTypeChecker(validate);
758
+ }
759
+ function isNode(propValue) {
760
+ switch (typeof propValue) {
761
+ case "number":
762
+ case "string":
763
+ case "undefined":
764
+ return true;
765
+ case "boolean":
766
+ return !propValue;
767
+ case "object":
768
+ if (Array.isArray(propValue)) {
769
+ return propValue.every(isNode);
770
+ }
771
+ if (propValue === null || isValidElement(propValue)) {
772
+ return true;
773
+ }
774
+ var iteratorFn = getIteratorFn(propValue);
775
+ if (iteratorFn) {
776
+ var iterator = iteratorFn.call(propValue);
777
+ var step;
778
+ if (iteratorFn !== propValue.entries) {
779
+ while (!(step = iterator.next()).done) {
780
+ if (!isNode(step.value)) {
781
+ return false;
782
+ }
783
+ }
784
+ } else {
785
+ while (!(step = iterator.next()).done) {
786
+ var entry = step.value;
787
+ if (entry) {
788
+ if (!isNode(entry[1])) {
789
+ return false;
790
+ }
791
+ }
792
+ }
793
+ }
794
+ } else {
795
+ return false;
796
+ }
797
+ return true;
798
+ default:
799
+ return false;
800
+ }
801
+ }
802
+ function isSymbol(propType, propValue) {
803
+ if (propType === "symbol") {
804
+ return true;
805
+ }
806
+ if (!propValue) {
807
+ return false;
808
+ }
809
+ if (propValue["@@toStringTag"] === "Symbol") {
810
+ return true;
811
+ }
812
+ if (typeof Symbol === "function" && propValue instanceof Symbol) {
813
+ return true;
814
+ }
815
+ return false;
816
+ }
817
+ function getPropType(propValue) {
818
+ var propType = typeof propValue;
819
+ if (Array.isArray(propValue)) {
820
+ return "array";
821
+ }
822
+ if (propValue instanceof RegExp) {
823
+ return "object";
824
+ }
825
+ if (isSymbol(propType, propValue)) {
826
+ return "symbol";
827
+ }
828
+ return propType;
829
+ }
830
+ function getPreciseType(propValue) {
831
+ if (typeof propValue === "undefined" || propValue === null) {
832
+ return "" + propValue;
833
+ }
834
+ var propType = getPropType(propValue);
835
+ if (propType === "object") {
836
+ if (propValue instanceof Date) {
837
+ return "date";
838
+ } else if (propValue instanceof RegExp) {
839
+ return "regexp";
840
+ }
841
+ }
842
+ return propType;
843
+ }
844
+ function getPostfixForTypeWarning(value) {
845
+ var type = getPreciseType(value);
846
+ switch (type) {
847
+ case "array":
848
+ case "object":
849
+ return "an " + type;
850
+ case "boolean":
851
+ case "date":
852
+ case "regexp":
853
+ return "a " + type;
854
+ default:
855
+ return type;
856
+ }
857
+ }
858
+ function getClassName(propValue) {
859
+ if (!propValue.constructor || !propValue.constructor.name) {
860
+ return ANONYMOUS;
861
+ }
862
+ return propValue.constructor.name;
863
+ }
864
+ ReactPropTypes.checkPropTypes = checkPropTypes;
865
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
866
+ ReactPropTypes.PropTypes = ReactPropTypes;
867
+ return ReactPropTypes;
868
+ };
869
+ }
870
+ });
871
+
872
+ // ../../node_modules/prop-types/factoryWithThrowingShims.js
873
+ var require_factoryWithThrowingShims = __commonJS({
874
+ "../../node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
875
+ var ReactPropTypesSecret = require_ReactPropTypesSecret();
876
+ function emptyFunction() {
877
+ }
878
+ function emptyFunctionWithReset() {
879
+ }
880
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
881
+ module.exports = function() {
882
+ function shim(props, propName, componentName, location, propFullName, secret) {
883
+ if (secret === ReactPropTypesSecret) {
884
+ return;
885
+ }
886
+ var err = new Error(
887
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
888
+ );
889
+ err.name = "Invariant Violation";
890
+ throw err;
891
+ }
892
+ shim.isRequired = shim;
893
+ function getShim() {
894
+ return shim;
895
+ }
896
+ var ReactPropTypes = {
897
+ array: shim,
898
+ bigint: shim,
899
+ bool: shim,
900
+ func: shim,
901
+ number: shim,
902
+ object: shim,
903
+ string: shim,
904
+ symbol: shim,
905
+ any: shim,
906
+ arrayOf: getShim,
907
+ element: shim,
908
+ elementType: shim,
909
+ instanceOf: getShim,
910
+ node: shim,
911
+ objectOf: getShim,
912
+ oneOf: getShim,
913
+ oneOfType: getShim,
914
+ shape: getShim,
915
+ exact: getShim,
916
+ checkPropTypes: emptyFunctionWithReset,
917
+ resetWarningCache: emptyFunction
918
+ };
919
+ ReactPropTypes.PropTypes = ReactPropTypes;
920
+ return ReactPropTypes;
921
+ };
922
+ }
923
+ });
924
+
925
+ // ../../node_modules/prop-types/index.js
926
+ var require_prop_types = __commonJS({
927
+ "../../node_modules/prop-types/index.js"(exports, module) {
928
+ if (process.env.NODE_ENV !== "production") {
929
+ ReactIs = require_react_is();
930
+ throwOnDirectAccess = true;
931
+ module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
932
+ } else {
933
+ module.exports = require_factoryWithThrowingShims()();
934
+ }
935
+ var ReactIs;
936
+ var throwOnDirectAccess;
937
+ }
938
+ });
939
+
940
+ // node_modules/@stripe/stripe-js/dist/index.mjs
941
+ function _typeof(obj) {
942
+ "@babel/helpers - typeof";
943
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
944
+ _typeof = function(obj2) {
945
+ return typeof obj2;
946
+ };
947
+ } else {
948
+ _typeof = function(obj2) {
949
+ return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
950
+ };
951
+ }
952
+ return _typeof(obj);
953
+ }
954
+ var RELEASE_TRAIN = "dahlia";
955
+ var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
956
+ return version === 3 ? "v3" : version;
957
+ };
958
+ var ORIGIN = "https://js.stripe.com";
959
+ var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
960
+ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
961
+ var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
962
+ var EXISTING_SCRIPT_MESSAGE = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";
963
+ var isStripeJSURL = function isStripeJSURL2(url) {
964
+ return V3_URL_REGEX.test(url) || STRIPE_JS_URL_REGEX.test(url);
965
+ };
966
+ var findScript = function findScript2() {
967
+ var scripts = document.querySelectorAll('script[src^="'.concat(ORIGIN, '"]'));
968
+ for (var i = 0; i < scripts.length; i++) {
969
+ var script = scripts[i];
970
+ if (!isStripeJSURL(script.src)) {
971
+ continue;
972
+ }
973
+ return script;
974
+ }
975
+ return null;
976
+ };
977
+ var injectScript = function injectScript2(params) {
978
+ var queryString = "";
979
+ var script = document.createElement("script");
980
+ script.src = "".concat(STRIPE_JS_URL).concat(queryString);
981
+ var headOrBody = document.head || document.body;
982
+ if (!headOrBody) {
983
+ throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
984
+ }
985
+ headOrBody.appendChild(script);
986
+ return script;
987
+ };
988
+ var registerWrapper = function registerWrapper2(stripe, startTime) {
989
+ if (!stripe || !stripe._registerWrapper) {
990
+ return;
991
+ }
992
+ stripe._registerWrapper({
993
+ name: "stripe-js",
994
+ version: "9.9.0",
995
+ startTime
996
+ });
997
+ };
998
+ var stripePromise$1 = null;
999
+ var onErrorListener = null;
1000
+ var onLoadListener = null;
1001
+ var onError = function onError2(reject) {
1002
+ return function(cause) {
1003
+ reject(new Error("Failed to load Stripe.js", {
1004
+ cause
1005
+ }));
1006
+ };
1007
+ };
1008
+ var onLoad = function onLoad2(resolve, reject) {
1009
+ return function() {
1010
+ if (window.Stripe) {
1011
+ resolve(window.Stripe);
1012
+ } else {
1013
+ reject(new Error("Stripe.js not available"));
1014
+ }
1015
+ };
1016
+ };
1017
+ var loadScript = function loadScript2(params) {
1018
+ if (stripePromise$1 !== null) {
1019
+ return stripePromise$1;
1020
+ }
1021
+ stripePromise$1 = new Promise(function(resolve, reject) {
1022
+ if (typeof window === "undefined" || typeof document === "undefined") {
1023
+ resolve(null);
1024
+ return;
1025
+ }
1026
+ if (window.Stripe) {
1027
+ resolve(window.Stripe);
1028
+ return;
1029
+ }
1030
+ try {
1031
+ var script = findScript();
1032
+ if (script && params) ; else if (!script) {
1033
+ script = injectScript(params);
1034
+ } else if (script && onLoadListener !== null && onErrorListener !== null) {
1035
+ var _script$parentNode;
1036
+ script.removeEventListener("load", onLoadListener);
1037
+ script.removeEventListener("error", onErrorListener);
1038
+ (_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
1039
+ script = injectScript(params);
1040
+ }
1041
+ onLoadListener = onLoad(resolve, reject);
1042
+ onErrorListener = onError(reject);
1043
+ script.addEventListener("load", onLoadListener);
1044
+ script.addEventListener("error", onErrorListener);
1045
+ } catch (error) {
1046
+ reject(error);
1047
+ return;
1048
+ }
1049
+ });
1050
+ return stripePromise$1["catch"](function(error) {
1051
+ stripePromise$1 = null;
1052
+ return Promise.reject(error);
1053
+ });
1054
+ };
1055
+ var initStripe = function initStripe2(maybeStripe, args, startTime) {
1056
+ if (maybeStripe === null) {
1057
+ return null;
1058
+ }
1059
+ var pk = args[0];
1060
+ if (typeof pk !== "string") {
1061
+ throw new Error("Expected publishable key to be of type string, got type ".concat(_typeof(pk), " instead."));
1062
+ }
1063
+ var isTestKey = pk.match(/^pk_test/);
1064
+ var version = runtimeVersionToUrlVersion(maybeStripe.version);
1065
+ var expectedVersion = RELEASE_TRAIN;
1066
+ if (isTestKey && version !== expectedVersion) {
1067
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
1068
+ }
1069
+ var stripe = maybeStripe.apply(void 0, args);
1070
+ registerWrapper(stripe, startTime);
1071
+ return stripe;
1072
+ };
1073
+ var stripePromise;
1074
+ var loadCalled = false;
1075
+ var getStripePromise = function getStripePromise2() {
1076
+ if (stripePromise) {
1077
+ return stripePromise;
1078
+ }
1079
+ stripePromise = loadScript(null)["catch"](function(error) {
1080
+ stripePromise = null;
1081
+ return Promise.reject(error);
1082
+ });
1083
+ return stripePromise;
1084
+ };
1085
+ Promise.resolve().then(function() {
1086
+ return getStripePromise();
1087
+ })["catch"](function(error) {
1088
+ if (!loadCalled) {
1089
+ console.warn(error);
1090
+ }
1091
+ });
1092
+ var loadStripe = function loadStripe2() {
1093
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1094
+ args[_key] = arguments[_key];
1095
+ }
1096
+ loadCalled = true;
1097
+ var startTime = Date.now();
1098
+ return getStripePromise().then(function(maybeStripe) {
1099
+ return initStripe(maybeStripe, args, startTime);
1100
+ });
1101
+ };
1102
+
1103
+ // node_modules/@stripe/react-stripe-js/dist/react-stripe.esm.mjs
1104
+ var react_stripe_esm_exports = {};
1105
+ __export(react_stripe_esm_exports, {
1106
+ AddressElement: () => AddressElement,
1107
+ AuBankAccountElement: () => AuBankAccountElement,
1108
+ CardCvcElement: () => CardCvcElement,
1109
+ CardElement: () => CardElement,
1110
+ CardExpiryElement: () => CardExpiryElement,
1111
+ CardNumberElement: () => CardNumberElement,
1112
+ ContactDetailsElement: () => ContactDetailsElement,
1113
+ CurrencySelectorElement: () => CurrencySelectorElement,
1114
+ Elements: () => Elements,
1115
+ ElementsConsumer: () => ElementsConsumer,
1116
+ EmbeddedCheckout: () => EmbeddedCheckout,
1117
+ EmbeddedCheckoutProvider: () => EmbeddedCheckoutProvider,
1118
+ ExpressCheckoutElement: () => ExpressCheckoutElement,
1119
+ FinancialAccountDisclosure: () => FinancialAccountDisclosure,
1120
+ IbanElement: () => IbanElement,
1121
+ IssuingCardCopyButtonElement: () => IssuingCardCopyButtonElement,
1122
+ IssuingCardCvcDisplayElement: () => IssuingCardCvcDisplayElement,
1123
+ IssuingCardExpiryDisplayElement: () => IssuingCardExpiryDisplayElement,
1124
+ IssuingCardNumberDisplayElement: () => IssuingCardNumberDisplayElement,
1125
+ IssuingCardPinDisplayElement: () => IssuingCardPinDisplayElement,
1126
+ IssuingDisclosure: () => IssuingDisclosure,
1127
+ LinkAuthenticationElement: () => LinkAuthenticationElement,
1128
+ PaymentElement: () => PaymentElement,
1129
+ PaymentMethodMessagingElement: () => PaymentMethodMessagingElement,
1130
+ PaymentRequestButtonElement: () => PaymentRequestButtonElement,
1131
+ ShippingAddressElement: () => ShippingAddressElement,
1132
+ TaxIdElement: () => TaxIdElement,
1133
+ useElements: () => useElements,
1134
+ useStripe: () => useStripe
1135
+ });
1136
+ var import_prop_types = __toESM(require_prop_types(), 1);
1137
+ function _arrayLikeToArray(r, a) {
1138
+ (null == a || a > r.length) && (a = r.length);
1139
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
1140
+ return n;
1141
+ }
1142
+ function _arrayWithHoles(r) {
1143
+ if (Array.isArray(r)) return r;
1144
+ }
1145
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
1146
+ try {
1147
+ var i = n[a](c), u = i.value;
1148
+ } catch (n2) {
1149
+ return void e(n2);
1150
+ }
1151
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
1152
+ }
1153
+ function _asyncToGenerator(n) {
1154
+ return function() {
1155
+ var t = this, e = arguments;
1156
+ return new Promise(function(r, o) {
1157
+ var a = n.apply(t, e);
1158
+ function _next(n2) {
1159
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n2);
1160
+ }
1161
+ function _throw(n2) {
1162
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2);
1163
+ }
1164
+ _next(void 0);
1165
+ });
1166
+ };
1167
+ }
1168
+ function _defineProperty(e, r, t) {
1169
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1170
+ value: t,
1171
+ enumerable: true,
1172
+ configurable: true,
1173
+ writable: true
1174
+ }) : e[r] = t, e;
1175
+ }
1176
+ function _iterableToArrayLimit(r, l) {
1177
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1178
+ if (null != t) {
1179
+ var e, n, i, u, a = [], f = true, o = false;
1180
+ try {
1181
+ if (i = (t = t.call(r)).next, 0 === l) ;
1182
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
1183
+ } catch (r2) {
1184
+ o = true, n = r2;
1185
+ } finally {
1186
+ try {
1187
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
1188
+ } finally {
1189
+ if (o) throw n;
1190
+ }
1191
+ }
1192
+ return a;
1193
+ }
1194
+ }
1195
+ function _nonIterableRest() {
1196
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1197
+ }
1198
+ function ownKeys(e, r) {
1199
+ var t = Object.keys(e);
1200
+ if (Object.getOwnPropertySymbols) {
1201
+ var o = Object.getOwnPropertySymbols(e);
1202
+ r && (o = o.filter(function(r2) {
1203
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
1204
+ })), t.push.apply(t, o);
1205
+ }
1206
+ return t;
1207
+ }
1208
+ function _objectSpread2(e) {
1209
+ for (var r = 1; r < arguments.length; r++) {
1210
+ var t = null != arguments[r] ? arguments[r] : {};
1211
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
1212
+ _defineProperty(e, r2, t[r2]);
1213
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
1214
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
1215
+ });
1216
+ }
1217
+ return e;
1218
+ }
1219
+ function _objectWithoutProperties(e, t) {
1220
+ if (null == e) return {};
1221
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
1222
+ if (Object.getOwnPropertySymbols) {
1223
+ var n = Object.getOwnPropertySymbols(e);
1224
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
1225
+ }
1226
+ return i;
1227
+ }
1228
+ function _objectWithoutPropertiesLoose(r, e) {
1229
+ if (null == r) return {};
1230
+ var t = {};
1231
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1232
+ if (-1 !== e.indexOf(n)) continue;
1233
+ t[n] = r[n];
1234
+ }
1235
+ return t;
1236
+ }
1237
+ function _slicedToArray(r, e) {
1238
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
1239
+ }
1240
+ function _toPrimitive(t, r) {
1241
+ if ("object" != typeof t || !t) return t;
1242
+ var e = t[Symbol.toPrimitive];
1243
+ if (void 0 !== e) {
1244
+ var i = e.call(t, r);
1245
+ if ("object" != typeof i) return i;
1246
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1247
+ }
1248
+ return ("string" === r ? String : Number)(t);
1249
+ }
1250
+ function _toPropertyKey(t) {
1251
+ var i = _toPrimitive(t, "string");
1252
+ return "symbol" == typeof i ? i : i + "";
1253
+ }
1254
+ function _typeof2(o) {
1255
+ "@babel/helpers - typeof";
1256
+ return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
1257
+ return typeof o2;
1258
+ } : function(o2) {
1259
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
1260
+ }, _typeof2(o);
1261
+ }
1262
+ function _unsupportedIterableToArray(r, a) {
1263
+ if (r) {
1264
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
1265
+ var t = {}.toString.call(r).slice(8, -1);
1266
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
1267
+ }
1268
+ }
1269
+ var useAttachEvent = function useAttachEvent2(element, event, cb) {
1270
+ var cbDefined = !!cb;
1271
+ var cbRef = React.useRef(cb);
1272
+ React.useEffect(function() {
1273
+ cbRef.current = cb;
1274
+ }, [cb]);
1275
+ React.useEffect(function() {
1276
+ if (!cbDefined || !element) {
1277
+ return function() {
1278
+ };
1279
+ }
1280
+ var decoratedCb = function decoratedCb2() {
1281
+ if (cbRef.current) {
1282
+ return cbRef.current.apply(cbRef, arguments);
1283
+ }
1284
+ return void 0;
1285
+ };
1286
+ element.on(event, decoratedCb);
1287
+ return function() {
1288
+ element.off(event, decoratedCb);
1289
+ };
1290
+ }, [cbDefined, event, element, cbRef]);
1291
+ };
1292
+ var usePrevious = function usePrevious2(value) {
1293
+ var ref = React.useRef(value);
1294
+ React.useEffect(function() {
1295
+ ref.current = value;
1296
+ }, [value]);
1297
+ return ref.current;
1298
+ };
1299
+ var isUnknownObject = function isUnknownObject2(raw) {
1300
+ return raw !== null && _typeof2(raw) === "object";
1301
+ };
1302
+ var isPromise = function isPromise2(raw) {
1303
+ return isUnknownObject(raw) && typeof raw.then === "function";
1304
+ };
1305
+ var isStripe = function isStripe2(raw) {
1306
+ return isUnknownObject(raw) && typeof raw.elements === "function" && typeof raw.createToken === "function" && typeof raw.createPaymentMethod === "function" && typeof raw.confirmCardPayment === "function";
1307
+ };
1308
+ var PLAIN_OBJECT_STR = "[object Object]";
1309
+ var isEqual = function isEqual2(left, right) {
1310
+ if (!isUnknownObject(left) || !isUnknownObject(right)) {
1311
+ return left === right;
1312
+ }
1313
+ var leftArray = Array.isArray(left);
1314
+ var rightArray = Array.isArray(right);
1315
+ if (leftArray !== rightArray) return false;
1316
+ var leftPlainObject = Object.prototype.toString.call(left) === PLAIN_OBJECT_STR;
1317
+ var rightPlainObject = Object.prototype.toString.call(right) === PLAIN_OBJECT_STR;
1318
+ if (leftPlainObject !== rightPlainObject) return false;
1319
+ if (!leftPlainObject && !leftArray) return left === right;
1320
+ var leftKeys = Object.keys(left);
1321
+ var rightKeys = Object.keys(right);
1322
+ if (leftKeys.length !== rightKeys.length) return false;
1323
+ var keySet = {};
1324
+ for (var i = 0; i < leftKeys.length; i += 1) {
1325
+ keySet[leftKeys[i]] = true;
1326
+ }
1327
+ for (var _i = 0; _i < rightKeys.length; _i += 1) {
1328
+ keySet[rightKeys[_i]] = true;
1329
+ }
1330
+ var allKeys = Object.keys(keySet);
1331
+ if (allKeys.length !== leftKeys.length) {
1332
+ return false;
1333
+ }
1334
+ var l = left;
1335
+ var r = right;
1336
+ var pred = function pred2(key) {
1337
+ return isEqual2(l[key], r[key]);
1338
+ };
1339
+ return allKeys.every(pred);
1340
+ };
1341
+ var extractAllowedOptionsUpdates = function extractAllowedOptionsUpdates2(options, prevOptions, immutableKeys) {
1342
+ if (!isUnknownObject(options)) {
1343
+ return null;
1344
+ }
1345
+ return Object.keys(options).reduce(function(newOptions, key) {
1346
+ var isUpdated = !isUnknownObject(prevOptions) || !isEqual(options[key], prevOptions[key]);
1347
+ if (immutableKeys.includes(key)) {
1348
+ if (isUpdated) {
1349
+ console.warn("Unsupported prop change: options.".concat(key, " is not a mutable property."));
1350
+ }
1351
+ return newOptions;
1352
+ }
1353
+ if (!isUpdated) {
1354
+ return newOptions;
1355
+ }
1356
+ return _objectSpread2(_objectSpread2({}, newOptions || {}), {}, _defineProperty({}, key, options[key]));
1357
+ }, null);
1358
+ };
1359
+ var INVALID_STRIPE_ERROR$1 = "Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.";
1360
+ var validateStripe = function validateStripe2(maybeStripe) {
1361
+ var errorMsg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : INVALID_STRIPE_ERROR$1;
1362
+ if (maybeStripe === null || isStripe(maybeStripe)) {
1363
+ return maybeStripe;
1364
+ }
1365
+ throw new Error(errorMsg);
1366
+ };
1367
+ var parseStripeProp = function parseStripeProp2(raw) {
1368
+ var errorMsg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : INVALID_STRIPE_ERROR$1;
1369
+ if (isPromise(raw)) {
1370
+ return {
1371
+ tag: "async",
1372
+ stripePromise: Promise.resolve(raw).then(function(result) {
1373
+ return validateStripe(result, errorMsg);
1374
+ })
1375
+ };
1376
+ }
1377
+ var stripe = validateStripe(raw, errorMsg);
1378
+ if (stripe === null) {
1379
+ return {
1380
+ tag: "empty"
1381
+ };
1382
+ }
1383
+ return {
1384
+ tag: "sync",
1385
+ stripe
1386
+ };
1387
+ };
1388
+ var registerWithStripeJs = function registerWithStripeJs2(stripe) {
1389
+ if (!stripe || !stripe._registerWrapper || !stripe.registerAppInfo) {
1390
+ return;
1391
+ }
1392
+ stripe._registerWrapper({
1393
+ name: "react-stripe-js",
1394
+ version: "6.7.0"
1395
+ });
1396
+ stripe.registerAppInfo({
1397
+ name: "react-stripe-js",
1398
+ version: "6.7.0",
1399
+ url: "https://stripe.com/docs/stripe-js/react"
1400
+ });
1401
+ };
1402
+ var ElementsContext = /* @__PURE__ */ React.createContext(null);
1403
+ ElementsContext.displayName = "ElementsContext";
1404
+ var parseElementsContext = function parseElementsContext2(ctx, useCase) {
1405
+ if (!ctx) {
1406
+ throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(useCase, " in an <Elements> provider."));
1407
+ }
1408
+ return ctx;
1409
+ };
1410
+ var Elements = function Elements2(_ref) {
1411
+ var rawStripeProp = _ref.stripe, options = _ref.options, children = _ref.children;
1412
+ var parsed = React.useMemo(function() {
1413
+ return parseStripeProp(rawStripeProp);
1414
+ }, [rawStripeProp]);
1415
+ var _React$useState = React.useState(function() {
1416
+ return {
1417
+ stripe: parsed.tag === "sync" ? parsed.stripe : null,
1418
+ elements: parsed.tag === "sync" ? parsed.stripe.elements(options) : null
1419
+ };
1420
+ }), _React$useState2 = _slicedToArray(_React$useState, 2), ctx = _React$useState2[0], setContext = _React$useState2[1];
1421
+ React.useEffect(function() {
1422
+ var isMounted = true;
1423
+ var safeSetContext = function safeSetContext2(stripe) {
1424
+ setContext(function(ctx2) {
1425
+ if (ctx2.stripe) return ctx2;
1426
+ return {
1427
+ stripe,
1428
+ elements: stripe.elements(options)
1429
+ };
1430
+ });
1431
+ };
1432
+ if (parsed.tag === "async" && !ctx.stripe) {
1433
+ parsed.stripePromise.then(function(stripe) {
1434
+ if (stripe && isMounted) {
1435
+ safeSetContext(stripe);
1436
+ }
1437
+ });
1438
+ } else if (parsed.tag === "sync" && !ctx.stripe) {
1439
+ safeSetContext(parsed.stripe);
1440
+ }
1441
+ return function() {
1442
+ isMounted = false;
1443
+ };
1444
+ }, [parsed, ctx, options]);
1445
+ var prevStripe = usePrevious(rawStripeProp);
1446
+ React.useEffect(function() {
1447
+ if (prevStripe !== null && prevStripe !== rawStripeProp) {
1448
+ console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.");
1449
+ }
1450
+ }, [prevStripe, rawStripeProp]);
1451
+ var prevOptions = usePrevious(options);
1452
+ React.useEffect(function() {
1453
+ if (!ctx.elements) {
1454
+ return;
1455
+ }
1456
+ var updates = extractAllowedOptionsUpdates(options, prevOptions, ["clientSecret", "fonts"]);
1457
+ if (updates) {
1458
+ ctx.elements.update(updates);
1459
+ }
1460
+ }, [options, prevOptions, ctx.elements]);
1461
+ React.useEffect(function() {
1462
+ registerWithStripeJs(ctx.stripe);
1463
+ }, [ctx.stripe]);
1464
+ return /* @__PURE__ */ React.createElement(ElementsContext.Provider, {
1465
+ value: ctx
1466
+ }, children);
1467
+ };
1468
+ Elements.propTypes = {
1469
+ stripe: import_prop_types.default.any,
1470
+ options: import_prop_types.default.object
1471
+ };
1472
+ var useElementsContextWithUseCase = function useElementsContextWithUseCase2(useCaseMessage) {
1473
+ var ctx = React.useContext(ElementsContext);
1474
+ return parseElementsContext(ctx, useCaseMessage);
1475
+ };
1476
+ var useElements = function useElements2() {
1477
+ var _useElementsContextWi = useElementsContextWithUseCase("calls useElements()"), elements = _useElementsContextWi.elements;
1478
+ return elements;
1479
+ };
1480
+ var ElementsConsumer = function ElementsConsumer2(_ref2) {
1481
+ var children = _ref2.children;
1482
+ var ctx = useElementsContextWithUseCase("mounts <ElementsConsumer>");
1483
+ return children(ctx);
1484
+ };
1485
+ ElementsConsumer.propTypes = {
1486
+ children: import_prop_types.default.func.isRequired
1487
+ };
1488
+ var CheckoutContext = /* @__PURE__ */ React.createContext(null);
1489
+ CheckoutContext.displayName = "CheckoutContext";
1490
+ var useElementsOrCheckoutContextWithUseCase = function useElementsOrCheckoutContextWithUseCase2(useCaseString) {
1491
+ var checkout = React.useContext(CheckoutContext);
1492
+ var elements = React.useContext(ElementsContext);
1493
+ if (checkout) {
1494
+ if (elements) {
1495
+ throw new Error("You cannot wrap the part of your app that ".concat(useCaseString, " in both a checkout provider and <Elements> provider."));
1496
+ } else {
1497
+ return checkout;
1498
+ }
1499
+ } else {
1500
+ return parseElementsContext(elements, useCaseString);
1501
+ }
1502
+ };
1503
+ var _excluded = ["mode"];
1504
+ var capitalized = function capitalized2(str) {
1505
+ return str.charAt(0).toUpperCase() + str.slice(1);
1506
+ };
1507
+ var createElementComponent = function createElementComponent2(type, isServer2, customDisplayName) {
1508
+ var displayName = "".concat(capitalized(type), "Element");
1509
+ var ClientElement = function ClientElement2(_ref) {
1510
+ var id = _ref.id, className = _ref.className, _ref$options = _ref.options, options = _ref$options === void 0 ? {} : _ref$options, onBlur = _ref.onBlur, onFocus = _ref.onFocus, onReady = _ref.onReady, onChange = _ref.onChange, onEscape = _ref.onEscape, onClick = _ref.onClick, onLoadError = _ref.onLoadError, onLoaderStart = _ref.onLoaderStart, onNetworksChange = _ref.onNetworksChange, onConfirm = _ref.onConfirm, onCancel = _ref.onCancel, onShippingAddressChange = _ref.onShippingAddressChange, onShippingRateChange = _ref.onShippingRateChange, onSavedPaymentMethodRemove = _ref.onSavedPaymentMethodRemove, onSavedPaymentMethodUpdate = _ref.onSavedPaymentMethodUpdate, onAvailablePaymentMethodsChange = _ref.onAvailablePaymentMethodsChange;
1511
+ var ctx = useElementsOrCheckoutContextWithUseCase("mounts <".concat(displayName, ">"));
1512
+ var elements = "elements" in ctx ? ctx.elements : null;
1513
+ var checkoutState = "checkoutState" in ctx ? ctx.checkoutState : null;
1514
+ var checkoutSdk = (checkoutState === null || checkoutState === void 0 ? void 0 : checkoutState.type) === "success" || (checkoutState === null || checkoutState === void 0 ? void 0 : checkoutState.type) === "loading" ? checkoutState.sdk : null;
1515
+ var _React$useState = React.useState(null), _React$useState2 = _slicedToArray(_React$useState, 2), element = _React$useState2[0], setElement = _React$useState2[1];
1516
+ var elementRef = React.useRef(null);
1517
+ var domNode = React.useRef(null);
1518
+ useAttachEvent(element, "blur", onBlur);
1519
+ useAttachEvent(element, "focus", onFocus);
1520
+ useAttachEvent(element, "escape", onEscape);
1521
+ useAttachEvent(element, "click", onClick);
1522
+ useAttachEvent(element, "loaderror", onLoadError);
1523
+ useAttachEvent(element, "loaderstart", onLoaderStart);
1524
+ useAttachEvent(element, "networkschange", onNetworksChange);
1525
+ useAttachEvent(element, "confirm", onConfirm);
1526
+ useAttachEvent(element, "cancel", onCancel);
1527
+ useAttachEvent(element, "shippingaddresschange", onShippingAddressChange);
1528
+ useAttachEvent(element, "shippingratechange", onShippingRateChange);
1529
+ useAttachEvent(element, "savedpaymentmethodremove", onSavedPaymentMethodRemove);
1530
+ useAttachEvent(element, "savedpaymentmethodupdate", onSavedPaymentMethodUpdate);
1531
+ useAttachEvent(element, "availablepaymentmethodschange", onAvailablePaymentMethodsChange);
1532
+ useAttachEvent(element, "change", onChange);
1533
+ var readyCallback;
1534
+ if (onReady) {
1535
+ if (type === "expressCheckout") {
1536
+ readyCallback = onReady;
1537
+ } else {
1538
+ readyCallback = function readyCallback2() {
1539
+ onReady(element);
1540
+ };
1541
+ }
1542
+ }
1543
+ useAttachEvent(element, "ready", readyCallback);
1544
+ React.useLayoutEffect(function() {
1545
+ if (elementRef.current === null && domNode.current !== null && (elements || checkoutSdk)) {
1546
+ var newElement = null;
1547
+ if (checkoutSdk) {
1548
+ var elementsSdk = checkoutSdk;
1549
+ var formSdk = checkoutSdk;
1550
+ switch (type) {
1551
+ case "paymentForm":
1552
+ newElement = formSdk.createForm(options);
1553
+ break;
1554
+ case "payment":
1555
+ newElement = elementsSdk.createPaymentElement(options);
1556
+ break;
1557
+ case "address":
1558
+ if ("mode" in options) {
1559
+ var mode = options.mode, restOptions = _objectWithoutProperties(options, _excluded);
1560
+ if (mode === "shipping") {
1561
+ newElement = elementsSdk.createShippingAddressElement(restOptions);
1562
+ } else if (mode === "billing") {
1563
+ newElement = elementsSdk.createBillingAddressElement(restOptions);
1564
+ } else {
1565
+ throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.");
1566
+ }
1567
+ } else {
1568
+ throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");
1569
+ }
1570
+ break;
1571
+ case "expressCheckout":
1572
+ newElement = elementsSdk.createExpressCheckoutElement(options);
1573
+ break;
1574
+ case "currencySelector":
1575
+ newElement = checkoutSdk.createCurrencySelectorElement();
1576
+ break;
1577
+ case "taxId":
1578
+ newElement = elementsSdk.createTaxIdElement(options);
1579
+ break;
1580
+ case "contactDetails":
1581
+ newElement = elementsSdk.createContactDetailsElement();
1582
+ break;
1583
+ default:
1584
+ throw new Error("<".concat(displayName, "> is not supported inside a checkout provider. Use an <Elements> provider instead."));
1585
+ }
1586
+ } else if (elements) {
1587
+ newElement = elements.create(type, options);
1588
+ }
1589
+ elementRef.current = newElement;
1590
+ setElement(newElement);
1591
+ if (newElement) {
1592
+ newElement.mount(domNode.current);
1593
+ }
1594
+ }
1595
+ }, [elements, checkoutSdk, options]);
1596
+ var prevOptions = usePrevious(options);
1597
+ React.useEffect(function() {
1598
+ if (!elementRef.current) {
1599
+ return;
1600
+ }
1601
+ var updates = extractAllowedOptionsUpdates(options, prevOptions, ["paymentRequest"]);
1602
+ if (updates && "update" in elementRef.current) {
1603
+ elementRef.current.update(updates);
1604
+ }
1605
+ }, [options, prevOptions]);
1606
+ React.useLayoutEffect(function() {
1607
+ return function() {
1608
+ if (elementRef.current && typeof elementRef.current.destroy === "function") {
1609
+ try {
1610
+ elementRef.current.destroy();
1611
+ elementRef.current = null;
1612
+ } catch (error) {
1613
+ }
1614
+ }
1615
+ };
1616
+ }, []);
1617
+ return /* @__PURE__ */ React.createElement("div", {
1618
+ id,
1619
+ className,
1620
+ ref: domNode
1621
+ });
1622
+ };
1623
+ var ServerElement = function ServerElement2(props) {
1624
+ useElementsOrCheckoutContextWithUseCase("mounts <".concat(displayName, ">"));
1625
+ var id = props.id, className = props.className;
1626
+ return /* @__PURE__ */ React.createElement("div", {
1627
+ id,
1628
+ className
1629
+ });
1630
+ };
1631
+ var Element = isServer2 ? ServerElement : ClientElement;
1632
+ Element.propTypes = {
1633
+ id: import_prop_types.default.string,
1634
+ className: import_prop_types.default.string,
1635
+ onChange: import_prop_types.default.func,
1636
+ onBlur: import_prop_types.default.func,
1637
+ onFocus: import_prop_types.default.func,
1638
+ onReady: import_prop_types.default.func,
1639
+ onEscape: import_prop_types.default.func,
1640
+ onClick: import_prop_types.default.func,
1641
+ onLoadError: import_prop_types.default.func,
1642
+ onLoaderStart: import_prop_types.default.func,
1643
+ onNetworksChange: import_prop_types.default.func,
1644
+ onConfirm: import_prop_types.default.func,
1645
+ onCancel: import_prop_types.default.func,
1646
+ onShippingAddressChange: import_prop_types.default.func,
1647
+ onShippingRateChange: import_prop_types.default.func,
1648
+ onSavedPaymentMethodRemove: import_prop_types.default.func,
1649
+ onSavedPaymentMethodUpdate: import_prop_types.default.func,
1650
+ onAvailablePaymentMethodsChange: import_prop_types.default.func,
1651
+ options: import_prop_types.default.object
1652
+ };
1653
+ Element.displayName = displayName;
1654
+ Element.__elementType = type;
1655
+ return Element;
1656
+ };
1657
+ var isServer = typeof window === "undefined";
1658
+ var EmbeddedCheckoutContext = /* @__PURE__ */ React.createContext(null);
1659
+ EmbeddedCheckoutContext.displayName = "EmbeddedCheckoutProviderContext";
1660
+ var useEmbeddedCheckoutContext = function useEmbeddedCheckoutContext2() {
1661
+ var ctx = React.useContext(EmbeddedCheckoutContext);
1662
+ if (!ctx) {
1663
+ throw new Error("<EmbeddedCheckout> must be used within <EmbeddedCheckoutProvider>");
1664
+ }
1665
+ return ctx;
1666
+ };
1667
+ var INVALID_STRIPE_ERROR = "Invalid prop `stripe` supplied to `EmbeddedCheckoutProvider`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.";
1668
+ var EmbeddedCheckoutProvider = function EmbeddedCheckoutProvider2(_ref) {
1669
+ var rawStripeProp = _ref.stripe, options = _ref.options, children = _ref.children;
1670
+ var parsed = React.useMemo(function() {
1671
+ return parseStripeProp(rawStripeProp, INVALID_STRIPE_ERROR);
1672
+ }, [rawStripeProp]);
1673
+ var embeddedCheckoutPromise = React.useRef(null);
1674
+ var loadedStripe = React.useRef(null);
1675
+ var _React$useState = React.useState({
1676
+ embeddedCheckout: null
1677
+ }), _React$useState2 = _slicedToArray(_React$useState, 2), ctx = _React$useState2[0], setContext = _React$useState2[1];
1678
+ React.useEffect(function() {
1679
+ if (loadedStripe.current || embeddedCheckoutPromise.current) {
1680
+ return;
1681
+ }
1682
+ var setStripeAndInitEmbeddedCheckout = function setStripeAndInitEmbeddedCheckout2(stripe) {
1683
+ if (loadedStripe.current || embeddedCheckoutPromise.current) return;
1684
+ loadedStripe.current = stripe;
1685
+ embeddedCheckoutPromise.current = loadedStripe.current.createEmbeddedCheckoutPage(options).then(function(embeddedCheckout) {
1686
+ setContext({
1687
+ embeddedCheckout
1688
+ });
1689
+ });
1690
+ };
1691
+ if (parsed.tag === "async" && !loadedStripe.current && (options.clientSecret || options.fetchClientSecret)) {
1692
+ parsed.stripePromise.then(function(stripe) {
1693
+ if (stripe) {
1694
+ setStripeAndInitEmbeddedCheckout(stripe);
1695
+ }
1696
+ });
1697
+ } else if (parsed.tag === "sync" && !loadedStripe.current && (options.clientSecret || options.fetchClientSecret)) {
1698
+ setStripeAndInitEmbeddedCheckout(parsed.stripe);
1699
+ }
1700
+ }, [parsed, options, ctx, loadedStripe]);
1701
+ React.useEffect(function() {
1702
+ return function() {
1703
+ if (ctx.embeddedCheckout) {
1704
+ embeddedCheckoutPromise.current = null;
1705
+ ctx.embeddedCheckout.destroy();
1706
+ } else if (embeddedCheckoutPromise.current) {
1707
+ embeddedCheckoutPromise.current.then(function() {
1708
+ embeddedCheckoutPromise.current = null;
1709
+ if (ctx.embeddedCheckout) {
1710
+ ctx.embeddedCheckout.destroy();
1711
+ }
1712
+ });
1713
+ }
1714
+ };
1715
+ }, [ctx.embeddedCheckout]);
1716
+ React.useEffect(function() {
1717
+ registerWithStripeJs(loadedStripe);
1718
+ }, [loadedStripe]);
1719
+ var prevStripe = usePrevious(rawStripeProp);
1720
+ React.useEffect(function() {
1721
+ if (prevStripe !== null && prevStripe !== rawStripeProp) {
1722
+ console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the `stripe` prop after setting it.");
1723
+ }
1724
+ }, [prevStripe, rawStripeProp]);
1725
+ var prevOptions = usePrevious(options);
1726
+ React.useEffect(function() {
1727
+ if (prevOptions == null) {
1728
+ return;
1729
+ }
1730
+ if (options == null) {
1731
+ console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot unset options after setting them.");
1732
+ return;
1733
+ }
1734
+ if (options.clientSecret === void 0 && options.fetchClientSecret === void 0) {
1735
+ console.warn("Invalid props passed to EmbeddedCheckoutProvider: You must provide one of either `options.fetchClientSecret` or `options.clientSecret`.");
1736
+ }
1737
+ if (prevOptions.clientSecret != null && options.clientSecret !== prevOptions.clientSecret) {
1738
+ console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the client secret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead.");
1739
+ }
1740
+ if (prevOptions.fetchClientSecret != null && options.fetchClientSecret !== prevOptions.fetchClientSecret) {
1741
+ console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change fetchClientSecret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead.");
1742
+ }
1743
+ if (prevOptions.onComplete != null && options.onComplete !== prevOptions.onComplete) {
1744
+ console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onComplete option after setting it.");
1745
+ }
1746
+ if (prevOptions.onShippingDetailsChange != null && options.onShippingDetailsChange !== prevOptions.onShippingDetailsChange) {
1747
+ console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onShippingDetailsChange option after setting it.");
1748
+ }
1749
+ if (prevOptions.onLineItemsChange != null && options.onLineItemsChange !== prevOptions.onLineItemsChange) {
1750
+ console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onLineItemsChange option after setting it.");
1751
+ }
1752
+ }, [prevOptions, options]);
1753
+ return /* @__PURE__ */ React.createElement(EmbeddedCheckoutContext.Provider, {
1754
+ value: ctx
1755
+ }, children);
1756
+ };
1757
+ var EmbeddedCheckoutClientElement = function EmbeddedCheckoutClientElement2(_ref) {
1758
+ var id = _ref.id, className = _ref.className;
1759
+ var _useEmbeddedCheckoutC = useEmbeddedCheckoutContext(), embeddedCheckout = _useEmbeddedCheckoutC.embeddedCheckout;
1760
+ var isMounted = React.useRef(false);
1761
+ var domNode = React.useRef(null);
1762
+ React.useLayoutEffect(function() {
1763
+ if (!isMounted.current && embeddedCheckout && domNode.current !== null) {
1764
+ embeddedCheckout.mount(domNode.current);
1765
+ isMounted.current = true;
1766
+ }
1767
+ return function() {
1768
+ if (isMounted.current && embeddedCheckout) {
1769
+ try {
1770
+ embeddedCheckout.unmount();
1771
+ isMounted.current = false;
1772
+ } catch (e) {
1773
+ }
1774
+ }
1775
+ };
1776
+ }, [embeddedCheckout]);
1777
+ return /* @__PURE__ */ React.createElement("div", {
1778
+ ref: domNode,
1779
+ id,
1780
+ className
1781
+ });
1782
+ };
1783
+ var EmbeddedCheckoutServerElement = function EmbeddedCheckoutServerElement2(_ref2) {
1784
+ var id = _ref2.id, className = _ref2.className;
1785
+ useEmbeddedCheckoutContext();
1786
+ return /* @__PURE__ */ React.createElement("div", {
1787
+ id,
1788
+ className
1789
+ });
1790
+ };
1791
+ var EmbeddedCheckout = isServer ? EmbeddedCheckoutServerElement : EmbeddedCheckoutClientElement;
1792
+ var FinancialAccountDisclosure = function FinancialAccountDisclosure2(_ref) {
1793
+ var rawStripeProp = _ref.stripe, onLoad3 = _ref.onLoad, onError3 = _ref.onError, options = _ref.options;
1794
+ var businessName = options === null || options === void 0 ? void 0 : options.businessName;
1795
+ var learnMoreLink = options === null || options === void 0 ? void 0 : options.learnMoreLink;
1796
+ var containerRef = React.useRef(null);
1797
+ var parsed = React.useMemo(function() {
1798
+ return parseStripeProp(rawStripeProp);
1799
+ }, [rawStripeProp]);
1800
+ var _React$useState = React.useState(parsed.tag === "sync" ? parsed.stripe : null), _React$useState2 = _slicedToArray(_React$useState, 2), stripeState = _React$useState2[0], setStripeState = _React$useState2[1];
1801
+ React.useEffect(function() {
1802
+ var isMounted = true;
1803
+ if (parsed.tag === "async") {
1804
+ parsed.stripePromise.then(function(stripePromise2) {
1805
+ if (stripePromise2 && isMounted) {
1806
+ setStripeState(stripePromise2);
1807
+ }
1808
+ });
1809
+ } else if (parsed.tag === "sync") {
1810
+ setStripeState(parsed.stripe);
1811
+ }
1812
+ return function() {
1813
+ isMounted = false;
1814
+ };
1815
+ }, [parsed]);
1816
+ var prevStripe = usePrevious(rawStripeProp);
1817
+ React.useEffect(function() {
1818
+ if (prevStripe !== null && prevStripe !== rawStripeProp) {
1819
+ console.warn("Unsupported prop change on FinancialAccountDisclosure: You cannot change the `stripe` prop after setting it.");
1820
+ }
1821
+ }, [prevStripe, rawStripeProp]);
1822
+ React.useEffect(function() {
1823
+ registerWithStripeJs(stripeState);
1824
+ }, [stripeState]);
1825
+ React.useEffect(function() {
1826
+ var createDisclosure = /* @__PURE__ */ (function() {
1827
+ var _ref2 = _asyncToGenerator(/* @__PURE__ */ regeneratorRuntime.mark(function _callee() {
1828
+ var _yield$stripeState$cr, disclosureContent, error, container;
1829
+ return regeneratorRuntime.wrap(function _callee$(_context) {
1830
+ while (1) {
1831
+ switch (_context.prev = _context.next) {
1832
+ case 0:
1833
+ if (!(!stripeState || !containerRef.current)) {
1834
+ _context.next = 2;
1835
+ break;
1836
+ }
1837
+ return _context.abrupt("return");
1838
+ case 2:
1839
+ _context.next = 4;
1840
+ return stripeState.createFinancialAccountDisclosure({
1841
+ businessName,
1842
+ learnMoreLink
1843
+ });
1844
+ case 4:
1845
+ _yield$stripeState$cr = _context.sent;
1846
+ disclosureContent = _yield$stripeState$cr.htmlElement;
1847
+ error = _yield$stripeState$cr.error;
1848
+ if (error && onError3) {
1849
+ onError3(error);
1850
+ } else if (disclosureContent) {
1851
+ container = containerRef.current;
1852
+ container.innerHTML = "";
1853
+ container.appendChild(disclosureContent);
1854
+ if (onLoad3) {
1855
+ onLoad3();
1856
+ }
1857
+ }
1858
+ case 8:
1859
+ case "end":
1860
+ return _context.stop();
1861
+ }
1862
+ }
1863
+ }, _callee);
1864
+ }));
1865
+ return function createDisclosure2() {
1866
+ return _ref2.apply(this, arguments);
1867
+ };
1868
+ })();
1869
+ createDisclosure();
1870
+ }, [stripeState, businessName, learnMoreLink, onLoad3, onError3]);
1871
+ return /* @__PURE__ */ React.createElement("div", {
1872
+ ref: containerRef
1873
+ });
1874
+ };
1875
+ var IssuingDisclosure = function IssuingDisclosure2(_ref) {
1876
+ var rawStripeProp = _ref.stripe, onLoad3 = _ref.onLoad, onError3 = _ref.onError, options = _ref.options;
1877
+ var issuingProgramID = options === null || options === void 0 ? void 0 : options.issuingProgramID;
1878
+ var publicCardProgramName = options === null || options === void 0 ? void 0 : options.publicCardProgramName;
1879
+ var learnMoreLink = options === null || options === void 0 ? void 0 : options.learnMoreLink;
1880
+ var containerRef = React.useRef(null);
1881
+ var parsed = React.useMemo(function() {
1882
+ return parseStripeProp(rawStripeProp);
1883
+ }, [rawStripeProp]);
1884
+ var _React$useState = React.useState(parsed.tag === "sync" ? parsed.stripe : null), _React$useState2 = _slicedToArray(_React$useState, 2), stripeState = _React$useState2[0], setStripeState = _React$useState2[1];
1885
+ React.useEffect(function() {
1886
+ var isMounted = true;
1887
+ if (parsed.tag === "async") {
1888
+ parsed.stripePromise.then(function(stripePromise2) {
1889
+ if (stripePromise2 && isMounted) {
1890
+ setStripeState(stripePromise2);
1891
+ }
1892
+ });
1893
+ } else if (parsed.tag === "sync") {
1894
+ setStripeState(parsed.stripe);
1895
+ }
1896
+ return function() {
1897
+ isMounted = false;
1898
+ };
1899
+ }, [parsed]);
1900
+ var prevStripe = usePrevious(rawStripeProp);
1901
+ React.useEffect(function() {
1902
+ if (prevStripe !== null && prevStripe !== rawStripeProp) {
1903
+ console.warn("Unsupported prop change on IssuingDisclosure: You cannot change the `stripe` prop after setting it.");
1904
+ }
1905
+ }, [prevStripe, rawStripeProp]);
1906
+ React.useEffect(function() {
1907
+ registerWithStripeJs(stripeState);
1908
+ }, [stripeState]);
1909
+ React.useEffect(function() {
1910
+ var createDisclosure = /* @__PURE__ */ (function() {
1911
+ var _ref2 = _asyncToGenerator(/* @__PURE__ */ regeneratorRuntime.mark(function _callee() {
1912
+ var _yield$stripeState$cr, disclosureContent, error, container;
1913
+ return regeneratorRuntime.wrap(function _callee$(_context) {
1914
+ while (1) {
1915
+ switch (_context.prev = _context.next) {
1916
+ case 0:
1917
+ if (!(!stripeState || !containerRef.current)) {
1918
+ _context.next = 2;
1919
+ break;
1920
+ }
1921
+ return _context.abrupt("return");
1922
+ case 2:
1923
+ _context.next = 4;
1924
+ return stripeState.createIssuingDisclosure({
1925
+ issuingProgramID,
1926
+ publicCardProgramName,
1927
+ learnMoreLink
1928
+ });
1929
+ case 4:
1930
+ _yield$stripeState$cr = _context.sent;
1931
+ disclosureContent = _yield$stripeState$cr.htmlElement;
1932
+ error = _yield$stripeState$cr.error;
1933
+ if (error && onError3) {
1934
+ onError3(error);
1935
+ } else if (disclosureContent) {
1936
+ container = containerRef.current;
1937
+ container.innerHTML = "";
1938
+ container.appendChild(disclosureContent);
1939
+ if (onLoad3) {
1940
+ onLoad3();
1941
+ }
1942
+ }
1943
+ case 8:
1944
+ case "end":
1945
+ return _context.stop();
1946
+ }
1947
+ }
1948
+ }, _callee);
1949
+ }));
1950
+ return function createDisclosure2() {
1951
+ return _ref2.apply(this, arguments);
1952
+ };
1953
+ })();
1954
+ createDisclosure();
1955
+ }, [stripeState, issuingProgramID, publicCardProgramName, learnMoreLink, onLoad3, onError3]);
1956
+ return /* @__PURE__ */ React.createElement("div", {
1957
+ ref: containerRef
1958
+ });
1959
+ };
1960
+ var useStripe = function useStripe2() {
1961
+ var _useElementsOrCheckou = useElementsOrCheckoutContextWithUseCase("calls useStripe()"), stripe = _useElementsOrCheckou.stripe;
1962
+ return stripe;
1963
+ };
1964
+ var AuBankAccountElement = createElementComponent("auBankAccount", isServer);
1965
+ var CardElement = createElementComponent("card", isServer);
1966
+ var CardNumberElement = createElementComponent("cardNumber", isServer);
1967
+ var CardExpiryElement = createElementComponent("cardExpiry", isServer);
1968
+ var CardCvcElement = createElementComponent("cardCvc", isServer);
1969
+ var CurrencySelectorElement = createElementComponent("currencySelector", isServer);
1970
+ var IbanElement = createElementComponent("iban", isServer);
1971
+ var PaymentElement = createElementComponent("payment", isServer);
1972
+ var ExpressCheckoutElement = createElementComponent("expressCheckout", isServer);
1973
+ var PaymentRequestButtonElement = createElementComponent("paymentRequestButton", isServer);
1974
+ var LinkAuthenticationElement = createElementComponent("linkAuthentication", isServer);
1975
+ var ContactDetailsElement = createElementComponent("contactDetails", isServer);
1976
+ var AddressElement = createElementComponent("address", isServer);
1977
+ var ShippingAddressElement = createElementComponent("shippingAddress", isServer);
1978
+ var PaymentMethodMessagingElement = createElementComponent("paymentMethodMessaging", isServer);
1979
+ var TaxIdElement = createElementComponent("taxId", isServer);
1980
+ var IssuingCardNumberDisplayElement = createElementComponent("issuingCardNumberDisplay", isServer);
1981
+ var IssuingCardCvcDisplayElement = createElementComponent("issuingCardCvcDisplay", isServer);
1982
+ var IssuingCardExpiryDisplayElement = createElementComponent("issuingCardExpiryDisplay", isServer);
1983
+ var IssuingCardPinDisplayElement = createElementComponent("issuingCardPinDisplay", isServer);
1984
+ var IssuingCardCopyButtonElement = createElementComponent("issuingCardCopyButton", isServer);
1985
+
1986
+ // src/drivers/stripe.tsx
1987
+ var stripeInstances = /* @__PURE__ */ new Map();
1988
+ async function loadProvider(publishableKey) {
1989
+ let stripe = stripeInstances.get(publishableKey);
1990
+ if (!stripe) {
1991
+ stripe = loadStripe(publishableKey);
1992
+ stripeInstances.set(publishableKey, stripe);
1993
+ }
1994
+ return { rsj: react_stripe_esm_exports, stripe };
1995
+ }
1996
+ function fromStripeError(err) {
1997
+ const decline = err.decline_code;
1998
+ const code = err.code;
1999
+ const message = err.message ?? "Payment failed";
2000
+ if (decline === "insufficient_funds") return checkoutError("insufficient_funds", message, { declineCode: decline });
2001
+ if (code === "expired_card" || decline === "expired_card")
2002
+ return checkoutError("expired_card", message, { declineCode: decline ?? code });
2003
+ if (code === "card_declined") return checkoutError("card_declined", message, { declineCode: decline ?? code });
2004
+ if (code === "payment_intent_authentication_failure" || code === "setup_intent_authentication_failure")
2005
+ return checkoutError("authentication_required", message, { declineCode: code });
2006
+ return checkoutError("processing_error", message, { declineCode: decline ?? code });
2007
+ }
2008
+ function stripeCheckoutDriver(ctx) {
2009
+ return {
2010
+ provider: "stripe",
2011
+ async start(req) {
2012
+ const correlationId = crypto.randomUUID();
2013
+ try {
2014
+ const session = await postSession(ctx, req, correlationId);
2015
+ switch (session.step) {
2016
+ case "settled":
2017
+ return settlementToResult(session.result);
2018
+ case "failed":
2019
+ return { ok: false, error: session.error };
2020
+ case "redirect":
2021
+ return leaveForRedirect(session.url);
2022
+ case "pending":
2023
+ return {
2024
+ ok: false,
2025
+ error: checkoutError(
2026
+ "processing_error",
2027
+ "Stripe returned 'pending' for a trigger start \u2014 Stripe opens settle synchronously"
2028
+ )
2029
+ };
2030
+ default:
2031
+ return {
2032
+ ok: false,
2033
+ error: checkoutError(
2034
+ "processing_error",
2035
+ `Stripe returned '${session.step}' for a trigger start \u2014 use an inline surface (element/express/sheet) instead`
2036
+ )
2037
+ };
2038
+ }
2039
+ } catch (e) {
2040
+ return { ok: false, error: toCheckoutError(e) };
2041
+ }
2042
+ },
2043
+ renderInline(req, cb) {
2044
+ return createElement(StripeInline, { ctx, req, cb });
2045
+ },
2046
+ // Redirect-return resume: verify an existing attempt (Stripe settles /complete
2047
+ // synchronously — the bounded poll only covers a `processing` intent tail).
2048
+ resume(correlationId) {
2049
+ return completeWithPoll(ctx, correlationId);
2050
+ }
2051
+ };
2052
+ }
2053
+ function StripeInline({
2054
+ ctx,
2055
+ req,
2056
+ cb
2057
+ }) {
2058
+ const [correlationId] = useState(() => crypto.randomUUID());
2059
+ const [phase, setPhase] = useState({ at: "boot" });
2060
+ const cbRef = useRef(cb);
2061
+ cbRef.current = cb;
2062
+ useEffect(() => {
2063
+ let disposed = false;
2064
+ void (async () => {
2065
+ try {
2066
+ const session = await postSession(ctx, req, correlationId);
2067
+ if (disposed) return;
2068
+ switch (session.step) {
2069
+ case "client_confirm":
2070
+ case "embedded": {
2071
+ const { rsj, stripe } = await loadProvider(session.publishableKey);
2072
+ if (disposed) return;
2073
+ setPhase(
2074
+ session.step === "client_confirm" ? { at: "confirm", session, rsj, stripe } : { at: "embedded", session, rsj, stripe }
2075
+ );
2076
+ return;
2077
+ }
2078
+ case "settled":
2079
+ cbRef.current.onSuccess(settlementToResult(session.result));
2080
+ return;
2081
+ case "failed":
2082
+ cbRef.current.onError(session.error);
2083
+ return;
2084
+ case "redirect": {
2085
+ const result = await leaveForRedirect(session.url);
2086
+ if (!disposed && !result.ok) {
2087
+ cbRef.current.onError(result.error ?? checkoutError("canceled", "Checkout was canceled"));
2088
+ }
2089
+ return;
2090
+ }
2091
+ default:
2092
+ cbRef.current.onError(
2093
+ checkoutError("processing_error", "unexpected step for a Stripe inline surface")
2094
+ );
2095
+ }
2096
+ } catch (e) {
2097
+ if (!disposed) cbRef.current.onError(toCheckoutError(e));
2098
+ }
2099
+ })();
2100
+ return () => {
2101
+ disposed = true;
2102
+ };
2103
+ }, []);
2104
+ const finish = async (providerRef) => {
2105
+ const result = await completeWithPoll(ctx, correlationId, { providerRef });
2106
+ if (result.ok) cbRef.current.onSuccess(result);
2107
+ else cbRef.current.onError(result.error ?? checkoutError("unknown", "Checkout failed"));
2108
+ };
2109
+ const reportFailure = (providerRef) => {
2110
+ void postComplete(ctx, correlationId, providerRef).catch(() => {
2111
+ });
2112
+ };
2113
+ let inner = null;
2114
+ if (phase.at === "confirm") {
2115
+ inner = createElement(
2116
+ phase.rsj.Elements,
2117
+ { stripe: phase.stripe, options: { clientSecret: phase.session.clientSecret } },
2118
+ createElement(ConfirmForm, {
2119
+ rsj: phase.rsj,
2120
+ surface: req.surface,
2121
+ secretKind: phase.session.secretKind,
2122
+ onStart: () => cbRef.current.onStart?.(),
2123
+ onPaymentAdded: () => cbRef.current.onPaymentAdded?.(),
2124
+ onError: (err) => cbRef.current.onError(err),
2125
+ reportFailure,
2126
+ finish
2127
+ })
2128
+ );
2129
+ } else if (phase.at === "embedded") {
2130
+ inner = createElement(
2131
+ phase.rsj.EmbeddedCheckoutProvider,
2132
+ {
2133
+ stripe: phase.stripe,
2134
+ // Stripe's managed embedded checkout confirms internally; onComplete is our
2135
+ // signal to have the server verify + settle (the source of truth).
2136
+ options: { clientSecret: phase.session.clientSecret, onComplete: () => void finish() }
2137
+ },
2138
+ createElement(phase.rsj.EmbeddedCheckout)
2139
+ );
2140
+ }
2141
+ return createElement(
2142
+ "div",
2143
+ { "data-appfunnel-checkout": "stripe", "data-checkout-surface": req.surface },
2144
+ inner
2145
+ );
2146
+ }
2147
+ function ConfirmForm({
2148
+ rsj,
2149
+ surface,
2150
+ secretKind,
2151
+ onStart,
2152
+ onPaymentAdded,
2153
+ onError: onError3,
2154
+ reportFailure,
2155
+ finish
2156
+ }) {
2157
+ const stripe = rsj.useStripe();
2158
+ const elements = rsj.useElements();
2159
+ const [submitting, setSubmitting] = useState(false);
2160
+ const addedRef = useRef(false);
2161
+ const confirm = async () => {
2162
+ if (!stripe || !elements || submitting) return;
2163
+ onStart();
2164
+ setSubmitting(true);
2165
+ try {
2166
+ if (secretKind === "setup_intent") {
2167
+ const { error, setupIntent } = await stripe.confirmSetup({ elements, redirect: "if_required" });
2168
+ if (error) {
2169
+ reportFailure(error.setup_intent?.id);
2170
+ return onError3(fromStripeError(error));
2171
+ }
2172
+ await finish(setupIntent?.id);
2173
+ } else {
2174
+ const { error, paymentIntent } = await stripe.confirmPayment({ elements, redirect: "if_required" });
2175
+ if (error) {
2176
+ reportFailure(error.payment_intent?.id);
2177
+ return onError3(fromStripeError(error));
2178
+ }
2179
+ await finish(paymentIntent?.id);
2180
+ }
2181
+ } catch (e) {
2182
+ onError3(toCheckoutError(e));
2183
+ } finally {
2184
+ setSubmitting(false);
2185
+ }
2186
+ };
2187
+ if (surface === "express") {
2188
+ return createElement(rsj.ExpressCheckoutElement, { onConfirm: () => void confirm() });
2189
+ }
2190
+ return createElement(
2191
+ "div",
2192
+ null,
2193
+ createElement(rsj.PaymentElement, {
2194
+ // `complete` = a chargeable method is fully entered → the SDK's
2195
+ // `checkout.payment_added` step. Fire once per mounted surface.
2196
+ onChange: (event) => {
2197
+ if (event.complete && !addedRef.current) {
2198
+ addedRef.current = true;
2199
+ onPaymentAdded();
2200
+ }
2201
+ }
2202
+ }),
2203
+ createElement(
2204
+ "button",
2205
+ {
2206
+ type: "button",
2207
+ "data-checkout-submit": true,
2208
+ disabled: !stripe || submitting,
2209
+ onClick: () => void confirm()
2210
+ },
2211
+ submitting ? "Processing\u2026" : "Pay now"
2212
+ )
2213
+ );
2214
+ }
2215
+ /*! Bundled license information:
2216
+
2217
+ react-is/cjs/react-is.production.min.js:
2218
+ (** @license React v16.13.1
2219
+ * react-is.production.min.js
2220
+ *
2221
+ * Copyright (c) Facebook, Inc. and its affiliates.
2222
+ *
2223
+ * This source code is licensed under the MIT license found in the
2224
+ * LICENSE file in the root directory of this source tree.
2225
+ *)
2226
+
2227
+ react-is/cjs/react-is.development.js:
2228
+ (** @license React v16.13.1
2229
+ * react-is.development.js
2230
+ *
2231
+ * Copyright (c) Facebook, Inc. and its affiliates.
2232
+ *
2233
+ * This source code is licensed under the MIT license found in the
2234
+ * LICENSE file in the root directory of this source tree.
2235
+ *)
2236
+
2237
+ object-assign/index.js:
2238
+ (*
2239
+ object-assign
2240
+ (c) Sindre Sorhus
2241
+ @license MIT
2242
+ *)
2243
+ */
2244
+
2245
+ export { stripeCheckoutDriver };
2246
+ //# sourceMappingURL=driver-stripe.js.map
2247
+ //# sourceMappingURL=driver-stripe.js.map