coinley-checkout 0.1.2 → 0.1.4

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.
@@ -1,5 +1,7 @@
1
- import We, { createContext as Be, useContext as Ze, useState as O, useEffect as X, forwardRef as pt, useImperativeHandle as vt } from "react";
2
- var De = { exports: {} }, le = {};
1
+ import require$$0, { createContext, useContext, useState, useEffect, lazy, forwardRef, useImperativeHandle } from "react";
2
+ const styles = "";
3
+ var jsxRuntime = { exports: {} };
4
+ var reactJsxRuntime_production_min = {};
3
5
  /**
4
6
  * @license React
5
7
  * react-jsx-runtime.production.min.js
@@ -9,25 +11,30 @@ var De = { exports: {} }, le = {};
9
11
  * This source code is licensed under the MIT license found in the
10
12
  * LICENSE file in the root directory of this source tree.
11
13
  */
12
- var Qe;
13
- function Nt() {
14
- if (Qe)
15
- return le;
16
- Qe = 1;
17
- var a = We, n = Symbol.for("react.element"), l = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, u = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
18
- function s(y, i, N) {
19
- var x, T = {}, $ = null, L = null;
20
- N !== void 0 && ($ = "" + N), i.key !== void 0 && ($ = "" + i.key), i.ref !== void 0 && (L = i.ref);
21
- for (x in i)
22
- c.call(i, x) && !f.hasOwnProperty(x) && (T[x] = i[x]);
23
- if (y && y.defaultProps)
24
- for (x in i = y.defaultProps, i)
25
- T[x] === void 0 && (T[x] = i[x]);
26
- return { $$typeof: n, type: y, key: $, ref: L, props: T, _owner: u.current };
14
+ var hasRequiredReactJsxRuntime_production_min;
15
+ function requireReactJsxRuntime_production_min() {
16
+ if (hasRequiredReactJsxRuntime_production_min)
17
+ return reactJsxRuntime_production_min;
18
+ hasRequiredReactJsxRuntime_production_min = 1;
19
+ var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
20
+ function q(c, a, g) {
21
+ var b, d = {}, e = null, h = null;
22
+ void 0 !== g && (e = "" + g);
23
+ void 0 !== a.key && (e = "" + a.key);
24
+ void 0 !== a.ref && (h = a.ref);
25
+ for (b in a)
26
+ m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
27
+ if (c && c.defaultProps)
28
+ for (b in a = c.defaultProps, a)
29
+ void 0 === d[b] && (d[b] = a[b]);
30
+ return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
27
31
  }
28
- return le.Fragment = l, le.jsx = s, le.jsxs = s, le;
32
+ reactJsxRuntime_production_min.Fragment = l;
33
+ reactJsxRuntime_production_min.jsx = q;
34
+ reactJsxRuntime_production_min.jsxs = q;
35
+ return reactJsxRuntime_production_min;
29
36
  }
30
- var ue = {};
37
+ var reactJsxRuntime_development = {};
31
38
  /**
32
39
  * @license React
33
40
  * react-jsx-runtime.development.js
@@ -37,722 +44,1060 @@ var ue = {};
37
44
  * This source code is licensed under the MIT license found in the
38
45
  * LICENSE file in the root directory of this source tree.
39
46
  */
40
- var Ge;
41
- function bt() {
42
- return Ge || (Ge = 1, process.env.NODE_ENV !== "production" && function() {
43
- var a = We, n = Symbol.for("react.element"), l = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), y = Symbol.for("react.context"), i = Symbol.for("react.forward_ref"), N = Symbol.for("react.suspense"), x = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), L = Symbol.for("react.offscreen"), z = Symbol.iterator, U = "@@iterator";
44
- function G(e) {
45
- if (e === null || typeof e != "object")
47
+ var hasRequiredReactJsxRuntime_development;
48
+ function requireReactJsxRuntime_development() {
49
+ if (hasRequiredReactJsxRuntime_development)
50
+ return reactJsxRuntime_development;
51
+ hasRequiredReactJsxRuntime_development = 1;
52
+ if (process.env.NODE_ENV !== "production") {
53
+ (function() {
54
+ var React = require$$0;
55
+ var REACT_ELEMENT_TYPE = Symbol.for("react.element");
56
+ var REACT_PORTAL_TYPE = Symbol.for("react.portal");
57
+ var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
58
+ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
59
+ var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
60
+ var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
61
+ var REACT_CONTEXT_TYPE = Symbol.for("react.context");
62
+ var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
63
+ var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
64
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
65
+ var REACT_MEMO_TYPE = Symbol.for("react.memo");
66
+ var REACT_LAZY_TYPE = Symbol.for("react.lazy");
67
+ var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
68
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
69
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
70
+ function getIteratorFn(maybeIterable) {
71
+ if (maybeIterable === null || typeof maybeIterable !== "object") {
72
+ return null;
73
+ }
74
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
75
+ if (typeof maybeIterator === "function") {
76
+ return maybeIterator;
77
+ }
46
78
  return null;
47
- var r = z && e[z] || e[U];
48
- return typeof r == "function" ? r : null;
49
- }
50
- var D = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
- function v(e) {
52
- {
53
- for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), d = 1; d < r; d++)
54
- o[d - 1] = arguments[d];
55
- se("error", e, o);
56
79
  }
57
- }
58
- function se(e, r, o) {
80
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
81
+ function error(format) {
82
+ {
83
+ {
84
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
85
+ args[_key2 - 1] = arguments[_key2];
86
+ }
87
+ printWarning("error", format, args);
88
+ }
89
+ }
90
+ }
91
+ function printWarning(level, format, args) {
92
+ {
93
+ var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
94
+ var stack = ReactDebugCurrentFrame2.getStackAddendum();
95
+ if (stack !== "") {
96
+ format += "%s";
97
+ args = args.concat([stack]);
98
+ }
99
+ var argsWithFormat = args.map(function(item) {
100
+ return String(item);
101
+ });
102
+ argsWithFormat.unshift("Warning: " + format);
103
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
104
+ }
105
+ }
106
+ var enableScopeAPI = false;
107
+ var enableCacheElement = false;
108
+ var enableTransitionTracing = false;
109
+ var enableLegacyHidden = false;
110
+ var enableDebugTracing = false;
111
+ var REACT_MODULE_REFERENCE;
59
112
  {
60
- var d = D.ReactDebugCurrentFrame, j = d.getStackAddendum();
61
- j !== "" && (r += "%s", o = o.concat([j]));
62
- var w = o.map(function(M) {
63
- return String(M);
64
- });
65
- w.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, w);
113
+ REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
66
114
  }
67
- }
68
- var F = !1, W = !1, J = !1, oe = !1, Y = !1, K;
69
- K = Symbol.for("react.module.reference");
70
- function B(e) {
71
- return !!(typeof e == "string" || typeof e == "function" || e === c || e === f || Y || e === u || e === N || e === x || oe || e === L || F || W || J || typeof e == "object" && e !== null && (e.$$typeof === $ || e.$$typeof === T || e.$$typeof === s || e.$$typeof === y || e.$$typeof === i || // This needs to include all possible module reference object
72
- // types supported by any Flight configuration anywhere since
73
- // we don't know which Flight build this will end up being used
74
- // with.
75
- e.$$typeof === K || e.getModuleId !== void 0));
76
- }
77
- function ee(e, r, o) {
78
- var d = e.displayName;
79
- if (d)
80
- return d;
81
- var j = r.displayName || r.name || "";
82
- return j !== "" ? o + "(" + j + ")" : o;
83
- }
84
- function _(e) {
85
- return e.displayName || "Context";
86
- }
87
- function I(e) {
88
- if (e == null)
89
- return null;
90
- if (typeof e.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
91
- return e.displayName || e.name || null;
92
- if (typeof e == "string")
93
- return e;
94
- switch (e) {
95
- case c:
96
- return "Fragment";
97
- case l:
98
- return "Portal";
99
- case f:
100
- return "Profiler";
101
- case u:
102
- return "StrictMode";
103
- case N:
104
- return "Suspense";
105
- case x:
106
- return "SuspenseList";
115
+ function isValidElementType(type) {
116
+ if (typeof type === "string" || typeof type === "function") {
117
+ return true;
118
+ }
119
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
120
+ return true;
121
+ }
122
+ if (typeof type === "object" && type !== null) {
123
+ if (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 || // This needs to include all possible module reference object
124
+ // types supported by any Flight configuration anywhere since
125
+ // we don't know which Flight build this will end up being used
126
+ // with.
127
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
128
+ return true;
129
+ }
130
+ }
131
+ return false;
107
132
  }
108
- if (typeof e == "object")
109
- switch (e.$$typeof) {
110
- case y:
111
- var r = e;
112
- return _(r) + ".Consumer";
113
- case s:
114
- var o = e;
115
- return _(o._context) + ".Provider";
116
- case i:
117
- return ee(e, e.render, "ForwardRef");
118
- case T:
119
- var d = e.displayName || null;
120
- return d !== null ? d : I(e.type) || "Memo";
121
- case $: {
122
- var j = e, w = j._payload, M = j._init;
123
- try {
124
- return I(M(w));
125
- } catch {
126
- return null;
133
+ function getWrappedName(outerType, innerType, wrapperName) {
134
+ var displayName = outerType.displayName;
135
+ if (displayName) {
136
+ return displayName;
137
+ }
138
+ var functionName = innerType.displayName || innerType.name || "";
139
+ return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
140
+ }
141
+ function getContextName(type) {
142
+ return type.displayName || "Context";
143
+ }
144
+ function getComponentNameFromType(type) {
145
+ if (type == null) {
146
+ return null;
147
+ }
148
+ {
149
+ if (typeof type.tag === "number") {
150
+ error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
151
+ }
152
+ }
153
+ if (typeof type === "function") {
154
+ return type.displayName || type.name || null;
155
+ }
156
+ if (typeof type === "string") {
157
+ return type;
158
+ }
159
+ switch (type) {
160
+ case REACT_FRAGMENT_TYPE:
161
+ return "Fragment";
162
+ case REACT_PORTAL_TYPE:
163
+ return "Portal";
164
+ case REACT_PROFILER_TYPE:
165
+ return "Profiler";
166
+ case REACT_STRICT_MODE_TYPE:
167
+ return "StrictMode";
168
+ case REACT_SUSPENSE_TYPE:
169
+ return "Suspense";
170
+ case REACT_SUSPENSE_LIST_TYPE:
171
+ return "SuspenseList";
172
+ }
173
+ if (typeof type === "object") {
174
+ switch (type.$$typeof) {
175
+ case REACT_CONTEXT_TYPE:
176
+ var context = type;
177
+ return getContextName(context) + ".Consumer";
178
+ case REACT_PROVIDER_TYPE:
179
+ var provider = type;
180
+ return getContextName(provider._context) + ".Provider";
181
+ case REACT_FORWARD_REF_TYPE:
182
+ return getWrappedName(type, type.render, "ForwardRef");
183
+ case REACT_MEMO_TYPE:
184
+ var outerName = type.displayName || null;
185
+ if (outerName !== null) {
186
+ return outerName;
187
+ }
188
+ return getComponentNameFromType(type.type) || "Memo";
189
+ case REACT_LAZY_TYPE: {
190
+ var lazyComponent = type;
191
+ var payload = lazyComponent._payload;
192
+ var init = lazyComponent._init;
193
+ try {
194
+ return getComponentNameFromType(init(payload));
195
+ } catch (x) {
196
+ return null;
197
+ }
127
198
  }
128
199
  }
129
200
  }
130
- return null;
131
- }
132
- var E = Object.assign, p = 0, H, Z, q, C, de, m, h;
133
- function fe() {
134
- }
135
- fe.__reactDisabledLog = !0;
136
- function me() {
137
- {
138
- if (p === 0) {
139
- H = console.log, Z = console.info, q = console.warn, C = console.error, de = console.group, m = console.groupCollapsed, h = console.groupEnd;
140
- var e = {
141
- configurable: !0,
142
- enumerable: !0,
143
- value: fe,
144
- writable: !0
145
- };
146
- Object.defineProperties(console, {
147
- info: e,
148
- log: e,
149
- warn: e,
150
- error: e,
151
- group: e,
152
- groupCollapsed: e,
153
- groupEnd: e
154
- });
201
+ return null;
202
+ }
203
+ var assign = Object.assign;
204
+ var disabledDepth = 0;
205
+ var prevLog;
206
+ var prevInfo;
207
+ var prevWarn;
208
+ var prevError;
209
+ var prevGroup;
210
+ var prevGroupCollapsed;
211
+ var prevGroupEnd;
212
+ function disabledLog() {
213
+ }
214
+ disabledLog.__reactDisabledLog = true;
215
+ function disableLogs() {
216
+ {
217
+ if (disabledDepth === 0) {
218
+ prevLog = console.log;
219
+ prevInfo = console.info;
220
+ prevWarn = console.warn;
221
+ prevError = console.error;
222
+ prevGroup = console.group;
223
+ prevGroupCollapsed = console.groupCollapsed;
224
+ prevGroupEnd = console.groupEnd;
225
+ var props = {
226
+ configurable: true,
227
+ enumerable: true,
228
+ value: disabledLog,
229
+ writable: true
230
+ };
231
+ Object.defineProperties(console, {
232
+ info: props,
233
+ log: props,
234
+ warn: props,
235
+ error: props,
236
+ group: props,
237
+ groupCollapsed: props,
238
+ groupEnd: props
239
+ });
240
+ }
241
+ disabledDepth++;
155
242
  }
156
- p++;
157
243
  }
158
- }
159
- function he() {
160
- {
161
- if (p--, p === 0) {
162
- var e = {
163
- configurable: !0,
164
- enumerable: !0,
165
- writable: !0
166
- };
167
- Object.defineProperties(console, {
168
- log: E({}, e, {
169
- value: H
170
- }),
171
- info: E({}, e, {
172
- value: Z
173
- }),
174
- warn: E({}, e, {
175
- value: q
176
- }),
177
- error: E({}, e, {
178
- value: C
179
- }),
180
- group: E({}, e, {
181
- value: de
182
- }),
183
- groupCollapsed: E({}, e, {
184
- value: m
185
- }),
186
- groupEnd: E({}, e, {
187
- value: h
188
- })
189
- });
244
+ function reenableLogs() {
245
+ {
246
+ disabledDepth--;
247
+ if (disabledDepth === 0) {
248
+ var props = {
249
+ configurable: true,
250
+ enumerable: true,
251
+ writable: true
252
+ };
253
+ Object.defineProperties(console, {
254
+ log: assign({}, props, {
255
+ value: prevLog
256
+ }),
257
+ info: assign({}, props, {
258
+ value: prevInfo
259
+ }),
260
+ warn: assign({}, props, {
261
+ value: prevWarn
262
+ }),
263
+ error: assign({}, props, {
264
+ value: prevError
265
+ }),
266
+ group: assign({}, props, {
267
+ value: prevGroup
268
+ }),
269
+ groupCollapsed: assign({}, props, {
270
+ value: prevGroupCollapsed
271
+ }),
272
+ groupEnd: assign({}, props, {
273
+ value: prevGroupEnd
274
+ })
275
+ });
276
+ }
277
+ if (disabledDepth < 0) {
278
+ error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
279
+ }
190
280
  }
191
- p < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
281
  }
193
- }
194
- var te = D.ReactCurrentDispatcher, je;
195
- function ge(e, r, o) {
196
- {
197
- if (je === void 0)
198
- try {
199
- throw Error();
200
- } catch (j) {
201
- var d = j.stack.trim().match(/\n( *(at )?)/);
202
- je = d && d[1] || "";
282
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
283
+ var prefix;
284
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
285
+ {
286
+ if (prefix === void 0) {
287
+ try {
288
+ throw Error();
289
+ } catch (x) {
290
+ var match = x.stack.trim().match(/\n( *(at )?)/);
291
+ prefix = match && match[1] || "";
292
+ }
203
293
  }
204
- return `
205
- ` + je + e;
294
+ return "\n" + prefix + name;
295
+ }
206
296
  }
207
- }
208
- var we = !1, ye;
209
- {
210
- var Ve = typeof WeakMap == "function" ? WeakMap : Map;
211
- ye = new Ve();
212
- }
213
- function Ce(e, r) {
214
- if (!e || we)
215
- return "";
297
+ var reentry = false;
298
+ var componentFrameCache;
216
299
  {
217
- var o = ye.get(e);
218
- if (o !== void 0)
219
- return o;
300
+ var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
301
+ componentFrameCache = new PossiblyWeakMap();
220
302
  }
221
- var d;
222
- we = !0;
223
- var j = Error.prepareStackTrace;
224
- Error.prepareStackTrace = void 0;
225
- var w;
226
- w = te.current, te.current = null, me();
227
- try {
228
- if (r) {
229
- var M = function() {
230
- throw Error();
231
- };
232
- if (Object.defineProperty(M.prototype, "props", {
233
- set: function() {
303
+ function describeNativeComponentFrame(fn, construct) {
304
+ if (!fn || reentry) {
305
+ return "";
306
+ }
307
+ {
308
+ var frame = componentFrameCache.get(fn);
309
+ if (frame !== void 0) {
310
+ return frame;
311
+ }
312
+ }
313
+ var control;
314
+ reentry = true;
315
+ var previousPrepareStackTrace = Error.prepareStackTrace;
316
+ Error.prepareStackTrace = void 0;
317
+ var previousDispatcher;
318
+ {
319
+ previousDispatcher = ReactCurrentDispatcher.current;
320
+ ReactCurrentDispatcher.current = null;
321
+ disableLogs();
322
+ }
323
+ try {
324
+ if (construct) {
325
+ var Fake = function() {
234
326
  throw Error();
327
+ };
328
+ Object.defineProperty(Fake.prototype, "props", {
329
+ set: function() {
330
+ throw Error();
331
+ }
332
+ });
333
+ if (typeof Reflect === "object" && Reflect.construct) {
334
+ try {
335
+ Reflect.construct(Fake, []);
336
+ } catch (x) {
337
+ control = x;
338
+ }
339
+ Reflect.construct(fn, [], Fake);
340
+ } else {
341
+ try {
342
+ Fake.call();
343
+ } catch (x) {
344
+ control = x;
345
+ }
346
+ fn.call(Fake.prototype);
235
347
  }
236
- }), typeof Reflect == "object" && Reflect.construct) {
237
- try {
238
- Reflect.construct(M, []);
239
- } catch (k) {
240
- d = k;
241
- }
242
- Reflect.construct(e, [], M);
243
348
  } else {
244
349
  try {
245
- M.call();
246
- } catch (k) {
247
- d = k;
350
+ throw Error();
351
+ } catch (x) {
352
+ control = x;
248
353
  }
249
- e.call(M.prototype);
354
+ fn();
250
355
  }
251
- } else {
252
- try {
253
- throw Error();
254
- } catch (k) {
255
- d = k;
356
+ } catch (sample) {
357
+ if (sample && control && typeof sample.stack === "string") {
358
+ var sampleLines = sample.stack.split("\n");
359
+ var controlLines = control.stack.split("\n");
360
+ var s = sampleLines.length - 1;
361
+ var c = controlLines.length - 1;
362
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
363
+ c--;
364
+ }
365
+ for (; s >= 1 && c >= 0; s--, c--) {
366
+ if (sampleLines[s] !== controlLines[c]) {
367
+ if (s !== 1 || c !== 1) {
368
+ do {
369
+ s--;
370
+ c--;
371
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
372
+ var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
373
+ if (fn.displayName && _frame.includes("<anonymous>")) {
374
+ _frame = _frame.replace("<anonymous>", fn.displayName);
375
+ }
376
+ {
377
+ if (typeof fn === "function") {
378
+ componentFrameCache.set(fn, _frame);
379
+ }
380
+ }
381
+ return _frame;
382
+ }
383
+ } while (s >= 1 && c >= 0);
384
+ }
385
+ break;
386
+ }
387
+ }
388
+ }
389
+ } finally {
390
+ reentry = false;
391
+ {
392
+ ReactCurrentDispatcher.current = previousDispatcher;
393
+ reenableLogs();
256
394
  }
257
- e();
395
+ Error.prepareStackTrace = previousPrepareStackTrace;
258
396
  }
259
- } catch (k) {
260
- if (k && d && typeof k.stack == "string") {
261
- for (var g = k.stack.split(`
262
- `), A = d.stack.split(`
263
- `), b = g.length - 1, S = A.length - 1; b >= 1 && S >= 0 && g[b] !== A[S]; )
264
- S--;
265
- for (; b >= 1 && S >= 0; b--, S--)
266
- if (g[b] !== A[S]) {
267
- if (b !== 1 || S !== 1)
268
- do
269
- if (b--, S--, S < 0 || g[b] !== A[S]) {
270
- var R = `
271
- ` + g[b].replace(" at new ", " at ");
272
- return e.displayName && R.includes("<anonymous>") && (R = R.replace("<anonymous>", e.displayName)), typeof e == "function" && ye.set(e, R), R;
273
- }
274
- while (b >= 1 && S >= 0);
275
- break;
276
- }
397
+ var name = fn ? fn.displayName || fn.name : "";
398
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
399
+ {
400
+ if (typeof fn === "function") {
401
+ componentFrameCache.set(fn, syntheticFrame);
402
+ }
277
403
  }
278
- } finally {
279
- we = !1, te.current = w, he(), Error.prepareStackTrace = j;
404
+ return syntheticFrame;
280
405
  }
281
- var ae = e ? e.displayName || e.name : "", V = ae ? ge(ae) : "";
282
- return typeof e == "function" && ye.set(e, V), V;
283
- }
284
- function Xe(e, r, o) {
285
- return Ce(e, !1);
286
- }
287
- function Je(e) {
288
- var r = e.prototype;
289
- return !!(r && r.isReactComponent);
290
- }
291
- function Me(e, r, o) {
292
- if (e == null)
293
- return "";
294
- if (typeof e == "function")
295
- return Ce(e, Je(e));
296
- if (typeof e == "string")
297
- return ge(e);
298
- switch (e) {
299
- case N:
300
- return ge("Suspense");
301
- case x:
302
- return ge("SuspenseList");
406
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
407
+ {
408
+ return describeNativeComponentFrame(fn, false);
409
+ }
303
410
  }
304
- if (typeof e == "object")
305
- switch (e.$$typeof) {
306
- case i:
307
- return Xe(e.render);
308
- case T:
309
- return Me(e.type, r, o);
310
- case $: {
311
- var d = e, j = d._payload, w = d._init;
312
- try {
313
- return Me(w(j), r, o);
314
- } catch {
315
- }
411
+ function shouldConstruct(Component) {
412
+ var prototype = Component.prototype;
413
+ return !!(prototype && prototype.isReactComponent);
414
+ }
415
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
416
+ if (type == null) {
417
+ return "";
418
+ }
419
+ if (typeof type === "function") {
420
+ {
421
+ return describeNativeComponentFrame(type, shouldConstruct(type));
316
422
  }
317
423
  }
318
- return "";
319
- }
320
- var ie = Object.prototype.hasOwnProperty, Ae = {}, Ie = D.ReactDebugCurrentFrame;
321
- function xe(e) {
322
- if (e) {
323
- var r = e._owner, o = Me(e.type, e._source, r ? r.type : null);
324
- Ie.setExtraStackFrame(o);
325
- } else
326
- Ie.setExtraStackFrame(null);
327
- }
328
- function Ke(e, r, o, d, j) {
329
- {
330
- var w = Function.call.bind(ie);
331
- for (var M in e)
332
- if (w(e, M)) {
333
- var g = void 0;
334
- try {
335
- if (typeof e[M] != "function") {
336
- var A = Error((d || "React class") + ": " + o + " type `" + M + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[M] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
- throw A.name = "Invariant Violation", A;
424
+ if (typeof type === "string") {
425
+ return describeBuiltInComponentFrame(type);
426
+ }
427
+ switch (type) {
428
+ case REACT_SUSPENSE_TYPE:
429
+ return describeBuiltInComponentFrame("Suspense");
430
+ case REACT_SUSPENSE_LIST_TYPE:
431
+ return describeBuiltInComponentFrame("SuspenseList");
432
+ }
433
+ if (typeof type === "object") {
434
+ switch (type.$$typeof) {
435
+ case REACT_FORWARD_REF_TYPE:
436
+ return describeFunctionComponentFrame(type.render);
437
+ case REACT_MEMO_TYPE:
438
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
439
+ case REACT_LAZY_TYPE: {
440
+ var lazyComponent = type;
441
+ var payload = lazyComponent._payload;
442
+ var init = lazyComponent._init;
443
+ try {
444
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
445
+ } catch (x) {
338
446
  }
339
- g = e[M](r, M, d, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
- } catch (b) {
341
- g = b;
342
447
  }
343
- g && !(g instanceof Error) && (xe(j), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", o, M, typeof g), xe(null)), g instanceof Error && !(g.message in Ae) && (Ae[g.message] = !0, xe(j), v("Failed %s type: %s", o, g.message), xe(null));
344
448
  }
449
+ }
450
+ return "";
345
451
  }
346
- }
347
- var et = Array.isArray;
348
- function pe(e) {
349
- return et(e);
350
- }
351
- function tt(e) {
352
- {
353
- var r = typeof Symbol == "function" && Symbol.toStringTag, o = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
354
- return o;
452
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
453
+ var loggedTypeFailures = {};
454
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
455
+ function setCurrentlyValidatingElement(element) {
456
+ {
457
+ if (element) {
458
+ var owner = element._owner;
459
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
460
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
461
+ } else {
462
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
463
+ }
464
+ }
355
465
  }
356
- }
357
- function rt(e) {
358
- try {
359
- return ke(e), !1;
360
- } catch {
361
- return !0;
466
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
467
+ {
468
+ var has = Function.call.bind(hasOwnProperty);
469
+ for (var typeSpecName in typeSpecs) {
470
+ if (has(typeSpecs, typeSpecName)) {
471
+ var error$1 = void 0;
472
+ try {
473
+ if (typeof typeSpecs[typeSpecName] !== "function") {
474
+ var err = Error((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`.");
475
+ err.name = "Invariant Violation";
476
+ throw err;
477
+ }
478
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
479
+ } catch (ex) {
480
+ error$1 = ex;
481
+ }
482
+ if (error$1 && !(error$1 instanceof Error)) {
483
+ setCurrentlyValidatingElement(element);
484
+ error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
485
+ setCurrentlyValidatingElement(null);
486
+ }
487
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
488
+ loggedTypeFailures[error$1.message] = true;
489
+ setCurrentlyValidatingElement(element);
490
+ error("Failed %s type: %s", location, error$1.message);
491
+ setCurrentlyValidatingElement(null);
492
+ }
493
+ }
494
+ }
495
+ }
362
496
  }
363
- }
364
- function ke(e) {
365
- return "" + e;
366
- }
367
- function Ee(e) {
368
- if (rt(e))
369
- return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tt(e)), ke(e);
370
- }
371
- var ce = D.ReactCurrentOwner, at = {
372
- key: !0,
373
- ref: !0,
374
- __self: !0,
375
- __source: !0
376
- }, Oe, Pe, ve;
377
- ve = {};
378
- function nt(e) {
379
- if (ie.call(e, "ref")) {
380
- var r = Object.getOwnPropertyDescriptor(e, "ref").get;
381
- if (r && r.isReactWarning)
382
- return !1;
497
+ var isArrayImpl = Array.isArray;
498
+ function isArray(a) {
499
+ return isArrayImpl(a);
383
500
  }
384
- return e.ref !== void 0;
385
- }
386
- function st(e) {
387
- if (ie.call(e, "key")) {
388
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
389
- if (r && r.isReactWarning)
390
- return !1;
501
+ function typeName(value) {
502
+ {
503
+ var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
504
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
505
+ return type;
506
+ }
391
507
  }
392
- return e.key !== void 0;
393
- }
394
- function ot(e, r) {
395
- if (typeof e.ref == "string" && ce.current && r && ce.current.stateNode !== r) {
396
- var o = I(ce.current.type);
397
- ve[o] || (v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', I(ce.current.type), e.ref), ve[o] = !0);
508
+ function willCoercionThrow(value) {
509
+ {
510
+ try {
511
+ testStringCoercion(value);
512
+ return false;
513
+ } catch (e) {
514
+ return true;
515
+ }
516
+ }
398
517
  }
399
- }
400
- function it(e, r) {
401
- {
402
- var o = function() {
403
- Oe || (Oe = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
404
- };
405
- o.isReactWarning = !0, Object.defineProperty(e, "key", {
406
- get: o,
407
- configurable: !0
408
- });
518
+ function testStringCoercion(value) {
519
+ return "" + value;
409
520
  }
410
- }
411
- function ct(e, r) {
412
- {
413
- var o = function() {
414
- Pe || (Pe = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
415
- };
416
- o.isReactWarning = !0, Object.defineProperty(e, "ref", {
417
- get: o,
418
- configurable: !0
419
- });
521
+ function checkKeyStringCoercion(value) {
522
+ {
523
+ if (willCoercionThrow(value)) {
524
+ error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
525
+ return testStringCoercion(value);
526
+ }
527
+ }
420
528
  }
421
- }
422
- var lt = function(e, r, o, d, j, w, M) {
423
- var g = {
424
- // This tag allows us to uniquely identify this as a React Element
425
- $$typeof: n,
426
- // Built-in properties that belong on the element
427
- type: e,
428
- key: r,
429
- ref: o,
430
- props: M,
431
- // Record the component responsible for creating this element.
432
- _owner: w
529
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
530
+ var RESERVED_PROPS = {
531
+ key: true,
532
+ ref: true,
533
+ __self: true,
534
+ __source: true
433
535
  };
434
- return g._store = {}, Object.defineProperty(g._store, "validated", {
435
- configurable: !1,
436
- enumerable: !1,
437
- writable: !0,
438
- value: !1
439
- }), Object.defineProperty(g, "_self", {
440
- configurable: !1,
441
- enumerable: !1,
442
- writable: !1,
443
- value: d
444
- }), Object.defineProperty(g, "_source", {
445
- configurable: !1,
446
- enumerable: !1,
447
- writable: !1,
448
- value: j
449
- }), Object.freeze && (Object.freeze(g.props), Object.freeze(g)), g;
450
- };
451
- function ut(e, r, o, d, j) {
536
+ var specialPropKeyWarningShown;
537
+ var specialPropRefWarningShown;
538
+ var didWarnAboutStringRefs;
452
539
  {
453
- var w, M = {}, g = null, A = null;
454
- o !== void 0 && (Ee(o), g = "" + o), st(r) && (Ee(r.key), g = "" + r.key), nt(r) && (A = r.ref, ot(r, j));
455
- for (w in r)
456
- ie.call(r, w) && !at.hasOwnProperty(w) && (M[w] = r[w]);
457
- if (e && e.defaultProps) {
458
- var b = e.defaultProps;
459
- for (w in b)
460
- M[w] === void 0 && (M[w] = b[w]);
540
+ didWarnAboutStringRefs = {};
541
+ }
542
+ function hasValidRef(config) {
543
+ {
544
+ if (hasOwnProperty.call(config, "ref")) {
545
+ var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
546
+ if (getter && getter.isReactWarning) {
547
+ return false;
548
+ }
549
+ }
461
550
  }
462
- if (g || A) {
463
- var S = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
464
- g && it(M, S), A && ct(M, S);
551
+ return config.ref !== void 0;
552
+ }
553
+ function hasValidKey(config) {
554
+ {
555
+ if (hasOwnProperty.call(config, "key")) {
556
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
557
+ if (getter && getter.isReactWarning) {
558
+ return false;
559
+ }
560
+ }
465
561
  }
466
- return lt(e, g, A, j, d, ce.current, M);
562
+ return config.key !== void 0;
467
563
  }
468
- }
469
- var Ne = D.ReactCurrentOwner, Re = D.ReactDebugCurrentFrame;
470
- function re(e) {
471
- if (e) {
472
- var r = e._owner, o = Me(e.type, e._source, r ? r.type : null);
473
- Re.setExtraStackFrame(o);
474
- } else
475
- Re.setExtraStackFrame(null);
476
- }
477
- var be;
478
- be = !1;
479
- function Le(e) {
480
- return typeof e == "object" && e !== null && e.$$typeof === n;
481
- }
482
- function $e() {
483
- {
484
- if (Ne.current) {
485
- var e = I(Ne.current.type);
486
- if (e)
487
- return `
488
-
489
- Check the render method of \`` + e + "`.";
564
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
565
+ {
566
+ if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
567
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
568
+ if (!didWarnAboutStringRefs[componentName]) {
569
+ error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
570
+ didWarnAboutStringRefs[componentName] = true;
571
+ }
572
+ }
490
573
  }
491
- return "";
492
574
  }
493
- }
494
- function dt(e) {
495
- {
496
- if (e !== void 0) {
497
- var r = e.fileName.replace(/^.*[\\\/]/, ""), o = e.lineNumber;
498
- return `
499
-
500
- Check your code at ` + r + ":" + o + ".";
575
+ function defineKeyPropWarningGetter(props, displayName) {
576
+ {
577
+ var warnAboutAccessingKey = function() {
578
+ if (!specialPropKeyWarningShown) {
579
+ specialPropKeyWarningShown = true;
580
+ error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
581
+ }
582
+ };
583
+ warnAboutAccessingKey.isReactWarning = true;
584
+ Object.defineProperty(props, "key", {
585
+ get: warnAboutAccessingKey,
586
+ configurable: true
587
+ });
501
588
  }
502
- return "";
503
589
  }
504
- }
505
- var ze = {};
506
- function ft(e) {
507
- {
508
- var r = $e();
509
- if (!r) {
510
- var o = typeof e == "string" ? e : e.displayName || e.name;
511
- o && (r = `
512
-
513
- Check the top-level render call using <` + o + ">.");
590
+ function defineRefPropWarningGetter(props, displayName) {
591
+ {
592
+ var warnAboutAccessingRef = function() {
593
+ if (!specialPropRefWarningShown) {
594
+ specialPropRefWarningShown = true;
595
+ error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
596
+ }
597
+ };
598
+ warnAboutAccessingRef.isReactWarning = true;
599
+ Object.defineProperty(props, "ref", {
600
+ get: warnAboutAccessingRef,
601
+ configurable: true
602
+ });
514
603
  }
515
- return r;
516
604
  }
517
- }
518
- function Ue(e, r) {
519
- {
520
- if (!e._store || e._store.validated || e.key != null)
521
- return;
522
- e._store.validated = !0;
523
- var o = ft(r);
524
- if (ze[o])
525
- return;
526
- ze[o] = !0;
527
- var d = "";
528
- e && e._owner && e._owner !== Ne.current && (d = " It was passed a child from " + I(e._owner.type) + "."), re(e), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, d), re(null);
605
+ var ReactElement = function(type, key, ref, self, source, owner, props) {
606
+ var element = {
607
+ // This tag allows us to uniquely identify this as a React Element
608
+ $$typeof: REACT_ELEMENT_TYPE,
609
+ // Built-in properties that belong on the element
610
+ type,
611
+ key,
612
+ ref,
613
+ props,
614
+ // Record the component responsible for creating this element.
615
+ _owner: owner
616
+ };
617
+ {
618
+ element._store = {};
619
+ Object.defineProperty(element._store, "validated", {
620
+ configurable: false,
621
+ enumerable: false,
622
+ writable: true,
623
+ value: false
624
+ });
625
+ Object.defineProperty(element, "_self", {
626
+ configurable: false,
627
+ enumerable: false,
628
+ writable: false,
629
+ value: self
630
+ });
631
+ Object.defineProperty(element, "_source", {
632
+ configurable: false,
633
+ enumerable: false,
634
+ writable: false,
635
+ value: source
636
+ });
637
+ if (Object.freeze) {
638
+ Object.freeze(element.props);
639
+ Object.freeze(element);
640
+ }
641
+ }
642
+ return element;
643
+ };
644
+ function jsxDEV(type, config, maybeKey, source, self) {
645
+ {
646
+ var propName;
647
+ var props = {};
648
+ var key = null;
649
+ var ref = null;
650
+ if (maybeKey !== void 0) {
651
+ {
652
+ checkKeyStringCoercion(maybeKey);
653
+ }
654
+ key = "" + maybeKey;
655
+ }
656
+ if (hasValidKey(config)) {
657
+ {
658
+ checkKeyStringCoercion(config.key);
659
+ }
660
+ key = "" + config.key;
661
+ }
662
+ if (hasValidRef(config)) {
663
+ ref = config.ref;
664
+ warnIfStringRefCannotBeAutoConverted(config, self);
665
+ }
666
+ for (propName in config) {
667
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
668
+ props[propName] = config[propName];
669
+ }
670
+ }
671
+ if (type && type.defaultProps) {
672
+ var defaultProps = type.defaultProps;
673
+ for (propName in defaultProps) {
674
+ if (props[propName] === void 0) {
675
+ props[propName] = defaultProps[propName];
676
+ }
677
+ }
678
+ }
679
+ if (key || ref) {
680
+ var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
681
+ if (key) {
682
+ defineKeyPropWarningGetter(props, displayName);
683
+ }
684
+ if (ref) {
685
+ defineRefPropWarningGetter(props, displayName);
686
+ }
687
+ }
688
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
689
+ }
529
690
  }
530
- }
531
- function Ye(e, r) {
532
- {
533
- if (typeof e != "object")
534
- return;
535
- if (pe(e))
536
- for (var o = 0; o < e.length; o++) {
537
- var d = e[o];
538
- Le(d) && Ue(d, r);
691
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
692
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
693
+ function setCurrentlyValidatingElement$1(element) {
694
+ {
695
+ if (element) {
696
+ var owner = element._owner;
697
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
698
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
699
+ } else {
700
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
539
701
  }
540
- else if (Le(e))
541
- e._store && (e._store.validated = !0);
542
- else if (e) {
543
- var j = G(e);
544
- if (typeof j == "function" && j !== e.entries)
545
- for (var w = j.call(e), M; !(M = w.next()).done; )
546
- Le(M.value) && Ue(M.value, r);
547
702
  }
548
703
  }
549
- }
550
- function gt(e) {
704
+ var propTypesMisspellWarningShown;
551
705
  {
552
- var r = e.type;
553
- if (r == null || typeof r == "string")
554
- return;
555
- var o;
556
- if (typeof r == "function")
557
- o = r.propTypes;
558
- else if (typeof r == "object" && (r.$$typeof === i || // Note: Memo only checks outer props here.
559
- // Inner props are checked in the reconciler.
560
- r.$$typeof === T))
561
- o = r.propTypes;
562
- else
563
- return;
564
- if (o) {
565
- var d = I(r);
566
- Ke(o, e.props, "prop", d, e);
567
- } else if (r.PropTypes !== void 0 && !be) {
568
- be = !0;
569
- var j = I(r);
570
- v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", j || "Unknown");
706
+ propTypesMisspellWarningShown = false;
707
+ }
708
+ function isValidElement(object) {
709
+ {
710
+ return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
571
711
  }
572
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
573
712
  }
574
- }
575
- function yt(e) {
576
- {
577
- for (var r = Object.keys(e.props), o = 0; o < r.length; o++) {
578
- var d = r[o];
579
- if (d !== "children" && d !== "key") {
580
- re(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", d), re(null);
581
- break;
713
+ function getDeclarationErrorAddendum() {
714
+ {
715
+ if (ReactCurrentOwner$1.current) {
716
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
717
+ if (name) {
718
+ return "\n\nCheck the render method of `" + name + "`.";
719
+ }
582
720
  }
721
+ return "";
583
722
  }
584
- e.ref !== null && (re(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), re(null));
585
723
  }
586
- }
587
- var Fe = {};
588
- function _e(e, r, o, d, j, w) {
589
- {
590
- var M = B(e);
591
- if (!M) {
592
- var g = "";
593
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (g += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
594
- var A = dt(j);
595
- A ? g += A : g += $e();
596
- var b;
597
- e === null ? b = "null" : pe(e) ? b = "array" : e !== void 0 && e.$$typeof === n ? (b = "<" + (I(e.type) || "Unknown") + " />", g = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, g);
724
+ function getSourceInfoErrorAddendum(source) {
725
+ {
726
+ if (source !== void 0) {
727
+ var fileName = source.fileName.replace(/^.*[\\\/]/, "");
728
+ var lineNumber = source.lineNumber;
729
+ return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
730
+ }
731
+ return "";
598
732
  }
599
- var S = ut(e, r, o, j, w);
600
- if (S == null)
601
- return S;
602
- if (M) {
603
- var R = r.children;
604
- if (R !== void 0)
605
- if (d)
606
- if (pe(R)) {
607
- for (var ae = 0; ae < R.length; ae++)
608
- Ye(R[ae], e);
609
- Object.freeze && Object.freeze(R);
610
- } else
611
- v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
612
- else
613
- Ye(R, e);
733
+ }
734
+ var ownerHasKeyUseWarning = {};
735
+ function getCurrentComponentErrorInfo(parentType) {
736
+ {
737
+ var info = getDeclarationErrorAddendum();
738
+ if (!info) {
739
+ var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
740
+ if (parentName) {
741
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
742
+ }
743
+ }
744
+ return info;
614
745
  }
615
- if (ie.call(r, "key")) {
616
- var V = I(e), k = Object.keys(r).filter(function(wt) {
617
- return wt !== "key";
618
- }), Se = k.length > 0 ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}";
619
- if (!Fe[V + Se]) {
620
- var jt = k.length > 0 ? "{" + k.join(": ..., ") + ": ...}" : "{}";
621
- v(`A props object containing a "key" prop is being spread into JSX:
622
- let props = %s;
623
- <%s {...props} />
624
- React keys must be passed directly to JSX without using spread:
625
- let props = %s;
626
- <%s key={someKey} {...props} />`, Se, V, jt, V), Fe[V + Se] = !0;
746
+ }
747
+ function validateExplicitKey(element, parentType) {
748
+ {
749
+ if (!element._store || element._store.validated || element.key != null) {
750
+ return;
627
751
  }
752
+ element._store.validated = true;
753
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
754
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
755
+ return;
756
+ }
757
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
758
+ var childOwner = "";
759
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
760
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
761
+ }
762
+ setCurrentlyValidatingElement$1(element);
763
+ error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
764
+ setCurrentlyValidatingElement$1(null);
628
765
  }
629
- return e === c ? yt(S) : gt(S), S;
630
766
  }
631
- }
632
- function Mt(e, r, o) {
633
- return _e(e, r, o, !0);
634
- }
635
- function xt(e, r, o) {
636
- return _e(e, r, o, !1);
637
- }
638
- var mt = xt, ht = Mt;
639
- ue.Fragment = c, ue.jsx = mt, ue.jsxs = ht;
640
- }()), ue;
767
+ function validateChildKeys(node, parentType) {
768
+ {
769
+ if (typeof node !== "object") {
770
+ return;
771
+ }
772
+ if (isArray(node)) {
773
+ for (var i = 0; i < node.length; i++) {
774
+ var child = node[i];
775
+ if (isValidElement(child)) {
776
+ validateExplicitKey(child, parentType);
777
+ }
778
+ }
779
+ } else if (isValidElement(node)) {
780
+ if (node._store) {
781
+ node._store.validated = true;
782
+ }
783
+ } else if (node) {
784
+ var iteratorFn = getIteratorFn(node);
785
+ if (typeof iteratorFn === "function") {
786
+ if (iteratorFn !== node.entries) {
787
+ var iterator = iteratorFn.call(node);
788
+ var step;
789
+ while (!(step = iterator.next()).done) {
790
+ if (isValidElement(step.value)) {
791
+ validateExplicitKey(step.value, parentType);
792
+ }
793
+ }
794
+ }
795
+ }
796
+ }
797
+ }
798
+ }
799
+ function validatePropTypes(element) {
800
+ {
801
+ var type = element.type;
802
+ if (type === null || type === void 0 || typeof type === "string") {
803
+ return;
804
+ }
805
+ var propTypes;
806
+ if (typeof type === "function") {
807
+ propTypes = type.propTypes;
808
+ } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
809
+ // Inner props are checked in the reconciler.
810
+ type.$$typeof === REACT_MEMO_TYPE)) {
811
+ propTypes = type.propTypes;
812
+ } else {
813
+ return;
814
+ }
815
+ if (propTypes) {
816
+ var name = getComponentNameFromType(type);
817
+ checkPropTypes(propTypes, element.props, "prop", name, element);
818
+ } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
819
+ propTypesMisspellWarningShown = true;
820
+ var _name = getComponentNameFromType(type);
821
+ error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
822
+ }
823
+ if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
824
+ error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
825
+ }
826
+ }
827
+ }
828
+ function validateFragmentProps(fragment) {
829
+ {
830
+ var keys = Object.keys(fragment.props);
831
+ for (var i = 0; i < keys.length; i++) {
832
+ var key = keys[i];
833
+ if (key !== "children" && key !== "key") {
834
+ setCurrentlyValidatingElement$1(fragment);
835
+ error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
836
+ setCurrentlyValidatingElement$1(null);
837
+ break;
838
+ }
839
+ }
840
+ if (fragment.ref !== null) {
841
+ setCurrentlyValidatingElement$1(fragment);
842
+ error("Invalid attribute `ref` supplied to `React.Fragment`.");
843
+ setCurrentlyValidatingElement$1(null);
844
+ }
845
+ }
846
+ }
847
+ var didWarnAboutKeySpread = {};
848
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
849
+ {
850
+ var validType = isValidElementType(type);
851
+ if (!validType) {
852
+ var info = "";
853
+ if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
854
+ info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
855
+ }
856
+ var sourceInfo = getSourceInfoErrorAddendum(source);
857
+ if (sourceInfo) {
858
+ info += sourceInfo;
859
+ } else {
860
+ info += getDeclarationErrorAddendum();
861
+ }
862
+ var typeString;
863
+ if (type === null) {
864
+ typeString = "null";
865
+ } else if (isArray(type)) {
866
+ typeString = "array";
867
+ } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
868
+ typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
869
+ info = " Did you accidentally export a JSX literal instead of a component?";
870
+ } else {
871
+ typeString = typeof type;
872
+ }
873
+ error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
874
+ }
875
+ var element = jsxDEV(type, props, key, source, self);
876
+ if (element == null) {
877
+ return element;
878
+ }
879
+ if (validType) {
880
+ var children = props.children;
881
+ if (children !== void 0) {
882
+ if (isStaticChildren) {
883
+ if (isArray(children)) {
884
+ for (var i = 0; i < children.length; i++) {
885
+ validateChildKeys(children[i], type);
886
+ }
887
+ if (Object.freeze) {
888
+ Object.freeze(children);
889
+ }
890
+ } else {
891
+ error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
892
+ }
893
+ } else {
894
+ validateChildKeys(children, type);
895
+ }
896
+ }
897
+ }
898
+ {
899
+ if (hasOwnProperty.call(props, "key")) {
900
+ var componentName = getComponentNameFromType(type);
901
+ var keys = Object.keys(props).filter(function(k) {
902
+ return k !== "key";
903
+ });
904
+ var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
905
+ if (!didWarnAboutKeySpread[componentName + beforeExample]) {
906
+ var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
907
+ error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
908
+ didWarnAboutKeySpread[componentName + beforeExample] = true;
909
+ }
910
+ }
911
+ }
912
+ if (type === REACT_FRAGMENT_TYPE) {
913
+ validateFragmentProps(element);
914
+ } else {
915
+ validatePropTypes(element);
916
+ }
917
+ return element;
918
+ }
919
+ }
920
+ function jsxWithValidationStatic(type, props, key) {
921
+ {
922
+ return jsxWithValidation(type, props, key, true);
923
+ }
924
+ }
925
+ function jsxWithValidationDynamic(type, props, key) {
926
+ {
927
+ return jsxWithValidation(type, props, key, false);
928
+ }
929
+ }
930
+ var jsx = jsxWithValidationDynamic;
931
+ var jsxs = jsxWithValidationStatic;
932
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
933
+ reactJsxRuntime_development.jsx = jsx;
934
+ reactJsxRuntime_development.jsxs = jsxs;
935
+ })();
936
+ }
937
+ return reactJsxRuntime_development;
641
938
  }
642
- process.env.NODE_ENV === "production" ? De.exports = Nt() : De.exports = bt();
643
- var t = De.exports;
644
- const He = Be(), Lt = () => Ze(He), Ut = ({ initialTheme: a = "light", children: n }) => {
645
- const [l, c] = O(a), u = () => {
646
- c((f) => f === "light" ? "dark" : "light");
939
+ if (process.env.NODE_ENV === "production") {
940
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
941
+ } else {
942
+ jsxRuntime.exports = requireReactJsxRuntime_development();
943
+ }
944
+ var jsxRuntimeExports = jsxRuntime.exports;
945
+ const ThemeContext = createContext();
946
+ const useTheme = () => useContext(ThemeContext);
947
+ const ThemeProvider = ({ initialTheme = "light", children }) => {
948
+ const [theme, setTheme] = useState(initialTheme);
949
+ const toggleTheme = () => {
950
+ setTheme((prevTheme) => prevTheme === "light" ? "dark" : "light");
647
951
  };
648
- return X(() => {
649
- document.documentElement.classList.remove("light", "dark"), document.documentElement.classList.add(l);
650
- }, [l]), /* @__PURE__ */ t.jsx(He.Provider, { value: { theme: l, setTheme: c, toggleTheme: u }, children: n });
952
+ useEffect(() => {
953
+ document.documentElement.classList.remove("light", "dark");
954
+ document.documentElement.classList.add(theme);
955
+ }, [theme]);
956
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: { theme, setTheme, toggleTheme }, children });
651
957
  };
652
- let P = {
958
+ let apiConfig = {
653
959
  apiKey: null,
654
960
  apiSecret: null,
655
961
  apiUrl: "https://coinleyserver-production.up.railway.app"
656
962
  };
657
- const St = (a) => {
658
- P = { ...P, ...a }, console.log("API initialized with:", P);
659
- }, ne = () => ({
660
- "Content-Type": "application/json",
661
- "x-api-key": P.apiKey,
662
- "x-api-secret": P.apiSecret
663
- }), Tt = async (a) => {
963
+ const initializeApi = (config) => {
964
+ apiConfig = { ...apiConfig, ...config };
965
+ console.log("API initialized with:", apiConfig);
966
+ };
967
+ const getHeaders = () => {
968
+ return {
969
+ "Content-Type": "application/json",
970
+ "x-api-key": apiConfig.apiKey,
971
+ "x-api-secret": apiConfig.apiSecret
972
+ };
973
+ };
974
+ const createPayment = async (paymentData) => {
664
975
  try {
665
- console.log("Creating payment with data:", a), console.log("API URL:", `${P.apiUrl}/api/payments/create`);
666
- const n = await fetch(`${P.apiUrl}/api/payments/create`, {
976
+ console.log("Creating payment with data:", paymentData);
977
+ console.log("API URL:", `${apiConfig.apiUrl}/api/payments/create`);
978
+ const response = await fetch(`${apiConfig.apiUrl}/api/payments/create`, {
667
979
  method: "POST",
668
- headers: ne(),
669
- body: JSON.stringify(a)
980
+ headers: getHeaders(),
981
+ body: JSON.stringify(paymentData)
670
982
  });
671
- if (console.log("Create payment response status:", n.status), !n.ok) {
672
- const c = await n.json();
673
- throw console.error("Error creating payment:", c), new Error(c.error || `Failed to create payment: ${n.status}`);
983
+ console.log("Create payment response status:", response.status);
984
+ if (!response.ok) {
985
+ const errorData = await response.json();
986
+ console.error("Error creating payment:", errorData);
987
+ throw new Error(errorData.error || `Failed to create payment: ${response.status}`);
674
988
  }
675
- const l = await n.json();
676
- return console.log("Create payment response data:", l), l;
677
- } catch (n) {
678
- throw console.error("Create payment error:", n), n;
989
+ const data = await response.json();
990
+ console.log("Create payment response data:", data);
991
+ return data;
992
+ } catch (error) {
993
+ console.error("Create payment error:", error);
994
+ throw error;
679
995
  }
680
- }, Yt = async (a) => {
996
+ };
997
+ const getPayment = async (paymentId) => {
681
998
  try {
682
- console.log("Getting payment:", a);
683
- const n = await fetch(`${P.apiUrl}/api/payments/${a}`, {
999
+ console.log("Getting payment:", paymentId);
1000
+ const response = await fetch(`${apiConfig.apiUrl}/api/payments/${paymentId}`, {
684
1001
  method: "GET",
685
- headers: ne()
1002
+ headers: getHeaders()
686
1003
  });
687
- if (!n.ok) {
688
- const c = await n.json();
689
- throw console.error("Error getting payment:", c), new Error(c.error || `Failed to get payment: ${n.status}`);
1004
+ if (!response.ok) {
1005
+ const errorData = await response.json();
1006
+ console.error("Error getting payment:", errorData);
1007
+ throw new Error(errorData.error || `Failed to get payment: ${response.status}`);
690
1008
  }
691
- const l = await n.json();
692
- return console.log("Get payment response:", l), l;
693
- } catch (n) {
694
- throw console.error("Get payment error:", n), n;
1009
+ const data = await response.json();
1010
+ console.log("Get payment response:", data);
1011
+ return data;
1012
+ } catch (error) {
1013
+ console.error("Get payment error:", error);
1014
+ throw error;
695
1015
  }
696
- }, Dt = async (a) => {
1016
+ };
1017
+ const processPayment = async (processData) => {
697
1018
  try {
698
- console.log("Processing payment with data:", a), console.log("API URL:", `${P.apiUrl}/api/payments/process`);
699
- const n = await fetch(`${P.apiUrl}/api/payments/process`, {
1019
+ console.log("Processing payment with data:", processData);
1020
+ console.log("API URL:", `${apiConfig.apiUrl}/api/payments/process`);
1021
+ const response = await fetch(`${apiConfig.apiUrl}/api/payments/process`, {
700
1022
  method: "POST",
701
- headers: ne(),
702
- body: JSON.stringify(a)
1023
+ headers: getHeaders(),
1024
+ body: JSON.stringify(processData)
703
1025
  });
704
- if (console.log("Process payment response status:", n.status), !n.ok) {
705
- const c = await n.json();
706
- throw console.error("Error processing payment:", c), new Error(c.error || `Failed to process payment: ${n.status}`);
1026
+ console.log("Process payment response status:", response.status);
1027
+ if (!response.ok) {
1028
+ const errorData = await response.json();
1029
+ console.error("Error processing payment:", errorData);
1030
+ throw new Error(errorData.error || `Failed to process payment: ${response.status}`);
707
1031
  }
708
- const l = await n.json();
709
- return console.log("Process payment response data:", l), l;
710
- } catch (n) {
711
- throw console.error("Process payment error:", n), n;
1032
+ const data = await response.json();
1033
+ console.log("Process payment response data:", data);
1034
+ return data;
1035
+ } catch (error) {
1036
+ console.error("Process payment error:", error);
1037
+ throw error;
712
1038
  }
713
- }, Ft = async (a = {}) => {
1039
+ };
1040
+ const getMerchantPayments = async (options = {}) => {
714
1041
  try {
715
- const { page: n = 1, limit: l = 10, status: c, currency: u, startDate: f, endDate: s, search: y } = a, i = new URLSearchParams();
716
- i.append("page", n), i.append("limit", l), c && i.append("status", c), u && i.append("currency", u), f && i.append("startDate", f), s && i.append("endDate", s), y && i.append("search", y);
717
- const N = `${P.apiUrl}/api/payments/merchant/list?${i.toString()}`, x = await fetch(N, {
1042
+ const { page = 1, limit = 10, status, currency, startDate, endDate, search } = options;
1043
+ const queryParams = new URLSearchParams();
1044
+ queryParams.append("page", page);
1045
+ queryParams.append("limit", limit);
1046
+ if (status)
1047
+ queryParams.append("status", status);
1048
+ if (currency)
1049
+ queryParams.append("currency", currency);
1050
+ if (startDate)
1051
+ queryParams.append("startDate", startDate);
1052
+ if (endDate)
1053
+ queryParams.append("endDate", endDate);
1054
+ if (search)
1055
+ queryParams.append("search", search);
1056
+ const url = `${apiConfig.apiUrl}/api/payments/merchant/list?${queryParams.toString()}`;
1057
+ const response = await fetch(url, {
718
1058
  method: "GET",
719
- headers: ne()
1059
+ headers: getHeaders()
720
1060
  });
721
- if (!x.ok) {
722
- const T = await x.json();
723
- throw new Error(T.error || `Failed to get payments: ${x.status}`);
1061
+ if (!response.ok) {
1062
+ const errorData = await response.json();
1063
+ throw new Error(errorData.error || `Failed to get payments: ${response.status}`);
724
1064
  }
725
- return await x.json();
726
- } catch (n) {
727
- throw console.error("Get merchant payments error:", n), n;
1065
+ return await response.json();
1066
+ } catch (error) {
1067
+ console.error("Get merchant payments error:", error);
1068
+ throw error;
728
1069
  }
729
- }, _t = async () => {
1070
+ };
1071
+ const getMerchantPaymentStats = async () => {
730
1072
  try {
731
- const a = await fetch(`${P.apiUrl}/api/payments/merchant/stats`, {
1073
+ const response = await fetch(`${apiConfig.apiUrl}/api/payments/merchant/stats`, {
732
1074
  method: "GET",
733
- headers: ne()
1075
+ headers: getHeaders()
734
1076
  });
735
- if (!a.ok) {
736
- const n = await a.json();
737
- throw new Error(n.error || `Failed to get payment stats: ${a.status}`);
1077
+ if (!response.ok) {
1078
+ const errorData = await response.json();
1079
+ throw new Error(errorData.error || `Failed to get payment stats: ${response.status}`);
738
1080
  }
739
- return await a.json();
740
- } catch (a) {
741
- throw console.error("Get merchant payment stats error:", a), a;
1081
+ return await response.json();
1082
+ } catch (error) {
1083
+ console.error("Get merchant payment stats error:", error);
1084
+ throw error;
742
1085
  }
743
- }, Qt = async () => {
1086
+ };
1087
+ const getSupportedCurrencies = async () => {
744
1088
  try {
745
- const a = await fetch(`${P.apiUrl}/api/payments/currencies`, {
1089
+ const response = await fetch(`${apiConfig.apiUrl}/api/payments/currencies`, {
746
1090
  method: "GET",
747
- headers: ne()
1091
+ headers: getHeaders()
748
1092
  });
749
- if (!a.ok) {
750
- const n = await a.json();
751
- throw new Error(n.error || `Failed to get currencies: ${a.status}`);
1093
+ if (!response.ok) {
1094
+ const errorData = await response.json();
1095
+ throw new Error(errorData.error || `Failed to get currencies: ${response.status}`);
752
1096
  }
753
- return await a.json();
754
- } catch (a) {
755
- return console.error("Get supported currencies error:", a), {
1097
+ return await response.json();
1098
+ } catch (error) {
1099
+ console.error("Get supported currencies error:", error);
1100
+ return {
756
1101
  currencies: [
757
1102
  { id: "USDT", name: "Tether USD", network: "ethereum" },
758
1103
  { id: "USDC", name: "USD Coin", network: "ethereum" },
@@ -762,37 +1107,72 @@ const St = (a) => {
762
1107
  ]
763
1108
  };
764
1109
  }
765
- }, qe = Be(), Ct = () => Ze(qe), Gt = ({
766
- apiKey: a,
767
- apiSecret: n,
768
- apiUrl: l = "https://coinleyserver-production.up.railway.app",
769
- debug: c = !1,
770
- children: u
1110
+ };
1111
+ const CoinleyContext = createContext();
1112
+ const useCoinley = () => useContext(CoinleyContext);
1113
+ const CoinleyProvider = ({
1114
+ apiKey,
1115
+ apiSecret,
1116
+ apiUrl = "https://coinleyserver-production.up.railway.app",
1117
+ debug = false,
1118
+ children
771
1119
  }) => {
772
- const [f, s] = O(!1), [y, i] = O(null);
773
- X(() => {
774
- if (!a || !n) {
775
- i("API key and secret are required");
1120
+ const [isInitialized, setIsInitialized] = useState(false);
1121
+ const [error, setError] = useState(null);
1122
+ useEffect(() => {
1123
+ if (!apiKey || !apiSecret) {
1124
+ setError("API key and secret are required");
776
1125
  return;
777
1126
  }
778
1127
  try {
779
- St({ apiKey: a, apiSecret: n, apiUrl: l }), s(!0), c && console.log("Coinley SDK initialized with:", { apiKey: a, apiUrl: l });
780
- } catch (x) {
781
- i(x.message), c && console.error("Coinley SDK initialization error:", x);
1128
+ initializeApi({ apiKey, apiSecret, apiUrl });
1129
+ setIsInitialized(true);
1130
+ if (debug) {
1131
+ console.log("Coinley SDK initialized with:", { apiKey, apiUrl });
1132
+ }
1133
+ } catch (err) {
1134
+ setError(err.message);
1135
+ if (debug) {
1136
+ console.error("Coinley SDK initialization error:", err);
1137
+ }
782
1138
  }
783
- }, [a, n, l, c]);
784
- const N = {
785
- apiKey: a,
786
- apiSecret: n,
787
- apiUrl: l,
788
- isInitialized: f,
789
- error: y,
790
- debug: c
1139
+ }, [apiKey, apiSecret, apiUrl, debug]);
1140
+ const value = {
1141
+ apiKey,
1142
+ apiSecret,
1143
+ apiUrl,
1144
+ isInitialized,
1145
+ error,
1146
+ debug
791
1147
  };
792
- return /* @__PURE__ */ t.jsx(qe.Provider, { value: N, children: u });
793
- }, At = ({ onSelect: a, selected: n, theme: l = "light" }) => {
794
- console.log("PaymentMethods render:", { selected: n });
795
- const c = [
1148
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(CoinleyContext.Provider, { value, children });
1149
+ };
1150
+ const QRCode$1 = ({ walletAddress, amount, currency, theme = "light" }) => {
1151
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center", children: [
1152
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-4 rounded-lg ${theme === "dark" ? "bg-gray-700" : "bg-white"} mb-3`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { width: "200px", height: "200px", backgroundColor: "#f0f0f0", display: "flex", alignItems: "center", justifyContent: "center" }, children: [
1153
+ "QR Code: ",
1154
+ currency
1155
+ ] }) }),
1156
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-sm", children: "Scan with your wallet app to pay" }),
1157
+ walletAddress && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 w-full", children: [
1158
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs mb-1", children: [
1159
+ "Send ",
1160
+ amount,
1161
+ " ",
1162
+ currency,
1163
+ " to:"
1164
+ ] }),
1165
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs font-mono p-2 rounded overflow-auto break-all bg-gray-100", children: walletAddress })
1166
+ ] })
1167
+ ] });
1168
+ };
1169
+ const QRCode$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1170
+ __proto__: null,
1171
+ default: QRCode$1
1172
+ }, Symbol.toStringTag, { value: "Module" }));
1173
+ const PaymentMethods = ({ onSelect, selected, theme = "light" }) => {
1174
+ console.log("PaymentMethods render:", { selected });
1175
+ const paymentMethods = [
796
1176
  {
797
1177
  id: "USDT",
798
1178
  name: "USDT",
@@ -823,30 +1203,32 @@ const St = (a) => {
823
1203
  description: "USD Coin on Solana",
824
1204
  logo: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzJCNzVFRCIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMS4yMDkgOS43MzlsLTIuOTQxIDIuOTQxYTMuMTMyIDMuMTMyIDAgMDAtNC41MzYgMGwtMi45NDItMi45NDFhNy42MjMgNy42MjMgMCAwMTEwLjQxOSAwek0xMC43OTEgMjIuMjYxbDIuOTQxLTIuOTQxYTMuMTMyIDMuMTMyIDAgMDA0LjUzNiAwbDIuOTQyIDIuOTQxYTcuNjIzIDcuNjIzIDAgMDEtMTAuNDE5IDB6bTExLjU3NS00LjI2MWgtNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAtNC41MzdoNC4xNTNhNy42MjEgNy42MjEgMCAwMTAgNC41Mzd6bS0xMy43OTMtNC41MzdoNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAgNC41MzdIOS42ODZhNy42MjEgNy42MjEgMCAwMTAtNC41Mzd6Ii8+PC9nPjwvc3ZnPg=="
825
1205
  }
826
- ], u = (f) => {
827
- console.log("Method selected:", f), a(f);
1206
+ ];
1207
+ const handleSelectPaymentMethod = (id) => {
1208
+ console.log("Method selected:", id);
1209
+ onSelect(id);
828
1210
  };
829
- return /* @__PURE__ */ t.jsxs("div", { children: [
830
- /* @__PURE__ */ t.jsx("h3", { className: `text-lg font-medium mb-3 ${l === "dark" ? "text-white" : "text-gray-800"}`, children: "Select Payment Method" }),
831
- /* @__PURE__ */ t.jsx("div", { className: "space-y-2", children: c.map((f) => /* @__PURE__ */ t.jsxs(
1211
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1212
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-lg font-medium mb-3 ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Select Payment Method" }),
1213
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: paymentMethods.map((method) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
832
1214
  "button",
833
1215
  {
834
- onClick: () => u(f.id),
835
- className: `w-full flex items-center p-3 rounded-lg transition-colors ${n === f.id ? l === "dark" ? "bg-blue-900/30 border border-blue-500" : "bg-blue-50 border border-blue-500" : l === "dark" ? "bg-gray-700 hover:bg-gray-600 border border-gray-700" : "bg-white hover:bg-gray-50 border border-gray-200"}`,
1216
+ onClick: () => handleSelectPaymentMethod(method.id),
1217
+ className: `w-full flex items-center p-3 rounded-lg transition-colors ${selected === method.id ? theme === "dark" ? "bg-blue-900/30 border border-blue-500" : "bg-blue-50 border border-blue-500" : theme === "dark" ? "bg-gray-700 hover:bg-gray-600 border border-gray-700" : "bg-white hover:bg-gray-50 border border-gray-200"}`,
836
1218
  children: [
837
- /* @__PURE__ */ t.jsx("div", { className: "flex-shrink-0 h-10 w-10 bg-white rounded-full flex items-center justify-center mr-3", children: /* @__PURE__ */ t.jsx("img", { src: f.logo, alt: f.name, className: "h-6 w-6" }) }),
838
- /* @__PURE__ */ t.jsxs("div", { className: "flex-1 text-left", children: [
839
- /* @__PURE__ */ t.jsx("h4", { className: `font-medium ${l === "dark" ? "text-white" : "text-gray-900"}`, children: f.name }),
840
- /* @__PURE__ */ t.jsx("p", { className: `text-sm ${l === "dark" ? "text-gray-300" : "text-gray-500"}`, children: f.description })
1219
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 h-10 w-10 bg-white rounded-full flex items-center justify-center mr-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: method.logo, alt: method.name, className: "h-6 w-6" }) }),
1220
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 text-left", children: [
1221
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: `font-medium ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: method.name }),
1222
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-500"}`, children: method.description })
841
1223
  ] }),
842
- n === f.id && /* @__PURE__ */ t.jsx(
1224
+ selected === method.id && /* @__PURE__ */ jsxRuntimeExports.jsx(
843
1225
  "svg",
844
1226
  {
845
1227
  xmlns: "http://www.w3.org/2000/svg",
846
1228
  className: "h-5 w-5 text-blue-500",
847
1229
  viewBox: "0 0 20 20",
848
1230
  fill: "currentColor",
849
- children: /* @__PURE__ */ t.jsx(
1231
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
850
1232
  "path",
851
1233
  {
852
1234
  fillRule: "evenodd",
@@ -858,17 +1240,18 @@ const St = (a) => {
858
1240
  )
859
1241
  ]
860
1242
  },
861
- f.id
1243
+ method.id
862
1244
  )) })
863
1245
  ] });
864
- }, Te = ({ status: a, theme: n = "light", message: l }) => {
865
- console.log("PaymentStatus render:", { status: a, message: l });
866
- const c = () => {
867
- switch (a) {
1246
+ };
1247
+ const PaymentStatus = ({ status, theme = "light", message }) => {
1248
+ console.log("PaymentStatus render:", { status, message });
1249
+ const renderIcon = () => {
1250
+ switch (status) {
868
1251
  case "processing":
869
- return /* @__PURE__ */ t.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-4 border-t-blue-500 border-blue-500/20" });
1252
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-4 border-t-blue-500 border-blue-500/20" });
870
1253
  case "success":
871
- return /* @__PURE__ */ t.jsx("div", { className: "rounded-full h-12 w-12 bg-green-100 flex items-center justify-center", children: /* @__PURE__ */ t.jsx(
1254
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-full h-12 w-12 bg-green-100 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
872
1255
  "svg",
873
1256
  {
874
1257
  xmlns: "http://www.w3.org/2000/svg",
@@ -877,11 +1260,11 @@ const St = (a) => {
877
1260
  viewBox: "0 0 24 24",
878
1261
  stroke: "currentColor",
879
1262
  strokeWidth: 2,
880
- children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
1263
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
881
1264
  }
882
1265
  ) });
883
1266
  case "error":
884
- return /* @__PURE__ */ t.jsx("div", { className: "rounded-full h-12 w-12 bg-red-100 flex items-center justify-center", children: /* @__PURE__ */ t.jsx(
1267
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-full h-12 w-12 bg-red-100 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
885
1268
  "svg",
886
1269
  {
887
1270
  xmlns: "http://www.w3.org/2000/svg",
@@ -890,14 +1273,15 @@ const St = (a) => {
890
1273
  viewBox: "0 0 24 24",
891
1274
  stroke: "currentColor",
892
1275
  strokeWidth: 2,
893
- children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1276
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
894
1277
  }
895
1278
  ) });
896
1279
  default:
897
1280
  return null;
898
1281
  }
899
- }, u = () => {
900
- switch (a) {
1282
+ };
1283
+ const getStatusTitle = () => {
1284
+ switch (status) {
901
1285
  case "processing":
902
1286
  return "Processing Payment";
903
1287
  case "success":
@@ -907,300 +1291,334 @@ const St = (a) => {
907
1291
  default:
908
1292
  return "Unknown Status";
909
1293
  }
910
- }, f = () => {
911
- switch (a) {
1294
+ };
1295
+ const getMessageClasses = () => {
1296
+ switch (status) {
912
1297
  case "processing":
913
- return n === "dark" ? "text-blue-300" : "text-blue-600";
1298
+ return theme === "dark" ? "text-blue-300" : "text-blue-600";
914
1299
  case "success":
915
- return n === "dark" ? "text-green-300" : "text-green-600";
1300
+ return theme === "dark" ? "text-green-300" : "text-green-600";
916
1301
  case "error":
917
- return n === "dark" ? "text-red-300" : "text-red-600";
1302
+ return theme === "dark" ? "text-red-300" : "text-red-600";
918
1303
  default:
919
- return n === "dark" ? "text-gray-300" : "text-gray-600";
1304
+ return theme === "dark" ? "text-gray-300" : "text-gray-600";
920
1305
  }
921
1306
  };
922
- return /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
923
- /* @__PURE__ */ t.jsx("div", { className: "mb-4", children: c() }),
924
- /* @__PURE__ */ t.jsx("h3", { className: `text-xl font-bold mb-2 ${n === "dark" ? "text-white" : "text-gray-900"}`, children: u() }),
925
- /* @__PURE__ */ t.jsx("p", { className: `text-center ${f()}`, children: l }),
926
- a === "processing" && /* @__PURE__ */ t.jsx("div", { className: `mt-4 text-xs ${n === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "This may take a few moments. Please do not close this window." }),
927
- a === "success" && /* @__PURE__ */ t.jsx("div", { className: `mt-4 p-2 rounded ${n === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ t.jsx("p", { className: `text-xs ${n === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Your payment has been successfully processed. You will receive a confirmation shortly." }) })
1307
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
1308
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: renderIcon() }),
1309
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-xl font-bold mb-2 ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: getStatusTitle() }),
1310
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-center ${getMessageClasses()}`, children: message }),
1311
+ status === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 text-xs ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "This may take a few moments. Please do not close this window." }),
1312
+ status === "success" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 p-2 rounded ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Your payment has been successfully processed. You will receive a confirmation shortly." }) })
928
1313
  ] });
929
- }, It = ({
930
- walletAddress: a,
931
- amount: n,
932
- currency: l,
933
- theme: c = "light",
934
- size: u = 200
935
- }) => {
936
- const f = () => {
937
- const s = Math.floor(u / 10);
938
- let y = `<svg xmlns="http://www.w3.org/2000/svg" width="${u}" height="${u}" viewBox="0 0 ${u} ${u}">`;
939
- y += `<rect width="${u}" height="${u}" fill="${c === "dark" ? "#1f2937" : "white"}"/>`, y += `<rect x="${s}" y="${s}" width="${s * 3}" height="${s * 3}" fill="${c === "dark" ? "white" : "black"}"/>`, y += `<rect x="${s * 1.5}" y="${s * 1.5}" width="${s * 2}" height="${s * 2}" fill="${c === "dark" ? "#1f2937" : "white"}"/>`, y += `<rect x="${s * 2}" y="${s * 2}" width="${s}" height="${s}" fill="${c === "dark" ? "white" : "black"}"/>`, y += `<rect x="${u - s * 4}" y="${s}" width="${s * 3}" height="${s * 3}" fill="${c === "dark" ? "white" : "black"}"/>`, y += `<rect x="${u - s * 3.5}" y="${s * 1.5}" width="${s * 2}" height="${s * 2}" fill="${c === "dark" ? "#1f2937" : "white"}"/>`, y += `<rect x="${u - s * 3}" y="${s * 2}" width="${s}" height="${s}" fill="${c === "dark" ? "white" : "black"}"/>`, y += `<rect x="${s}" y="${u - s * 4}" width="${s * 3}" height="${s * 3}" fill="${c === "dark" ? "white" : "black"}"/>`, y += `<rect x="${s * 1.5}" y="${u - s * 3.5}" width="${s * 2}" height="${s * 2}" fill="${c === "dark" ? "#1f2937" : "white"}"/>`, y += `<rect x="${s * 2}" y="${u - s * 3}" width="${s}" height="${s}" fill="${c === "dark" ? "white" : "black"}"/>`, l.length + ((a == null ? void 0 : a.length) || 0);
940
- for (let i = 0; i < 50; i++) {
941
- const N = s * (1 + Math.floor(Math.random() * 8)), x = s * (1 + Math.floor(Math.random() * 8));
942
- N < s * 4 && x < s * 4 || N > u - s * 5 && x < s * 4 || N < s * 4 && x > u - s * 5 || (y += `<rect x="${N}" y="${x}" width="${s}" height="${s}" fill="${c === "dark" ? "white" : "black"}"/>`);
943
- }
944
- return y += `<rect x="${u / 2 - s * 3}" y="${u / 2 - s * 1.5}" width="${s * 6}" height="${s * 3}" fill="${c === "dark" ? "#1f2937" : "white"}"/>`, y += `<text x="${u / 2}" y="${u / 2 + s / 2}" font-family="Arial" font-size="${s * 2}" font-weight="bold" text-anchor="middle" fill="${c === "dark" ? "white" : "black"}">${l}</text>`, y += "</svg>", y;
945
- };
946
- return /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col items-center", children: [
947
- /* @__PURE__ */ t.jsx(
948
- "div",
949
- {
950
- className: `p-4 rounded-lg ${c === "dark" ? "bg-gray-700" : "bg-white"} mb-3`,
951
- dangerouslySetInnerHTML: { __html: f() }
952
- }
953
- ),
954
- /* @__PURE__ */ t.jsx("div", { className: `text-center text-sm ${c === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Scan with your wallet app to pay" }),
955
- a && /* @__PURE__ */ t.jsxs("div", { className: "mt-3 w-full", children: [
956
- /* @__PURE__ */ t.jsxs("p", { className: `text-xs ${c === "dark" ? "text-gray-400" : "text-gray-500"} mb-1`, children: [
957
- "Send ",
958
- n,
959
- " ",
960
- l,
961
- " to:"
962
- ] }),
963
- /* @__PURE__ */ t.jsx("div", { className: `text-xs font-mono p-2 rounded overflow-auto break-all ${c === "dark" ? "bg-gray-800 text-gray-300" : "bg-gray-100 text-gray-700"}`, children: a })
964
- ] }),
965
- /* @__PURE__ */ t.jsx("div", { className: "mt-4 w-full", children: /* @__PURE__ */ t.jsxs("div", { className: `p-3 rounded ${c === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
966
- /* @__PURE__ */ t.jsx("h4", { className: `text-sm font-medium mb-2 ${c === "dark" ? "text-white" : "text-gray-800"}`, children: "Payment Instructions" }),
967
- /* @__PURE__ */ t.jsxs("ol", { className: `text-xs space-y-2 ${c === "dark" ? "text-gray-300" : "text-gray-600"}`, children: [
968
- /* @__PURE__ */ t.jsx("li", { children: "1. Open your crypto wallet app" }),
969
- /* @__PURE__ */ t.jsx("li", { children: "2. Scan the QR code above" }),
970
- /* @__PURE__ */ t.jsxs("li", { children: [
971
- "3. Confirm the payment amount (",
972
- n,
973
- " ",
974
- l,
975
- ")"
976
- ] }),
977
- /* @__PURE__ */ t.jsx("li", { children: '4. Click "Pay Now" button below after sending the payment' })
978
- ] })
979
- ] }) })
980
- ] });
981
- }, Q = () => typeof window < "u" && typeof window.ethereum < "u", kt = async () => {
982
- if (!Q())
1314
+ };
1315
+ const isMetaMaskInstalled = () => {
1316
+ return typeof window !== "undefined" && typeof window.ethereum !== "undefined";
1317
+ };
1318
+ const connectWallet = async () => {
1319
+ if (!isMetaMaskInstalled()) {
983
1320
  throw new Error("MetaMask is not installed");
1321
+ }
984
1322
  try {
985
- return await window.ethereum.request({ method: "eth_requestAccounts" });
986
- } catch (a) {
987
- throw console.error("Error connecting to wallet:", a), a;
1323
+ const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
1324
+ return accounts;
1325
+ } catch (error) {
1326
+ console.error("Error connecting to wallet:", error);
1327
+ throw error;
988
1328
  }
989
- }, Et = async () => {
990
- if (!Q())
1329
+ };
1330
+ const getAccounts = async () => {
1331
+ if (!isMetaMaskInstalled()) {
991
1332
  throw new Error("MetaMask is not installed");
1333
+ }
992
1334
  try {
993
- return await window.ethereum.request({ method: "eth_accounts" });
994
- } catch (a) {
995
- throw console.error("Error getting accounts:", a), a;
1335
+ const accounts = await window.ethereum.request({ method: "eth_accounts" });
1336
+ return accounts;
1337
+ } catch (error) {
1338
+ console.error("Error getting accounts:", error);
1339
+ throw error;
996
1340
  }
997
- }, Wt = async () => {
998
- if (!Q())
1341
+ };
1342
+ const getChainId = async () => {
1343
+ if (!isMetaMaskInstalled()) {
999
1344
  throw new Error("MetaMask is not installed");
1345
+ }
1000
1346
  try {
1001
- return await window.ethereum.request({ method: "eth_chainId" });
1002
- } catch (a) {
1003
- throw console.error("Error getting chain ID:", a), a;
1347
+ const chainId = await window.ethereum.request({ method: "eth_chainId" });
1348
+ return chainId;
1349
+ } catch (error) {
1350
+ console.error("Error getting chain ID:", error);
1351
+ throw error;
1004
1352
  }
1005
- }, Ot = async (a) => {
1006
- if (!Q())
1353
+ };
1354
+ const sendTransaction = async (txParams) => {
1355
+ if (!isMetaMaskInstalled()) {
1007
1356
  throw new Error("MetaMask is not installed");
1357
+ }
1008
1358
  try {
1009
- return await window.ethereum.request({
1359
+ const txHash = await window.ethereum.request({
1010
1360
  method: "eth_sendTransaction",
1011
- params: [a]
1361
+ params: [txParams]
1012
1362
  });
1013
- } catch (n) {
1014
- throw console.error("Error sending transaction:", n), n;
1363
+ return txHash;
1364
+ } catch (error) {
1365
+ console.error("Error sending transaction:", error);
1366
+ throw error;
1015
1367
  }
1016
- }, Bt = async (a, n, l) => {
1017
- if (!Q())
1368
+ };
1369
+ const sendToken = async (tokenAddress, toAddress, amount) => {
1370
+ if (!isMetaMaskInstalled()) {
1018
1371
  throw new Error("MetaMask is not installed");
1372
+ }
1019
1373
  try {
1020
- const u = (await window.ethereum.request({ method: "eth_requestAccounts" }))[0], f = "0xa9059cbb", s = n.slice(2).padStart(64, "0"), y = l.toString(16).padStart(64, "0"), i = `${f}${s}${y}`, N = {
1021
- from: u,
1022
- to: a,
1023
- data: i
1374
+ const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
1375
+ const fromAddress = accounts[0];
1376
+ const transferFunctionSignature = "0xa9059cbb";
1377
+ const paddedToAddress = toAddress.slice(2).padStart(64, "0");
1378
+ const paddedAmount = amount.toString(16).padStart(64, "0");
1379
+ const data = `${transferFunctionSignature}${paddedToAddress}${paddedAmount}`;
1380
+ const txParams = {
1381
+ from: fromAddress,
1382
+ to: tokenAddress,
1383
+ data
1024
1384
  };
1025
- return await window.ethereum.request({
1385
+ const txHash = await window.ethereum.request({
1026
1386
  method: "eth_sendTransaction",
1027
- params: [N]
1387
+ params: [txParams]
1028
1388
  });
1029
- } catch (c) {
1030
- throw console.error("Error sending token:", c), c;
1389
+ return txHash;
1390
+ } catch (error) {
1391
+ console.error("Error sending token:", error);
1392
+ throw error;
1031
1393
  }
1032
- }, Zt = async () => {
1394
+ };
1395
+ const isWalletConnected = async () => {
1033
1396
  try {
1034
- return (await Et()).length > 0;
1035
- } catch {
1036
- return !1;
1397
+ const accounts = await getAccounts();
1398
+ return accounts.length > 0;
1399
+ } catch (error) {
1400
+ return false;
1037
1401
  }
1038
- }, Ht = (a) => ({
1039
- "0x1": "Ethereum Mainnet",
1040
- "0x3": "Ropsten Testnet",
1041
- "0x4": "Rinkeby Testnet",
1042
- "0x5": "Goerli Testnet",
1043
- "0x2a": "Kovan Testnet",
1044
- "0x38": "Binance Smart Chain",
1045
- "0x89": "Polygon",
1046
- "0xa86a": "Avalanche"
1047
- })[a] || `Unknown Network (${a})`, qt = async (a, n) => {
1048
- if (!Q())
1402
+ };
1403
+ const getNetworkName = (chainId) => {
1404
+ const networks = {
1405
+ "0x1": "Ethereum Mainnet",
1406
+ "0x3": "Ropsten Testnet",
1407
+ "0x4": "Rinkeby Testnet",
1408
+ "0x5": "Goerli Testnet",
1409
+ "0x2a": "Kovan Testnet",
1410
+ "0x38": "Binance Smart Chain",
1411
+ "0x89": "Polygon",
1412
+ "0xa86a": "Avalanche"
1413
+ };
1414
+ return networks[chainId] || `Unknown Network (${chainId})`;
1415
+ };
1416
+ const getTokenBalance = async (tokenAddress, userAddress) => {
1417
+ if (!isMetaMaskInstalled()) {
1049
1418
  throw new Error("MetaMask is not installed");
1419
+ }
1050
1420
  try {
1051
- const l = "0x70a08231", c = n.slice(2).padStart(64, "0"), u = `${l}${c}`, f = await window.ethereum.request({
1421
+ const balanceOfSignature = "0x70a08231";
1422
+ const paddedAddress = userAddress.slice(2).padStart(64, "0");
1423
+ const data = `${balanceOfSignature}${paddedAddress}`;
1424
+ const balance = await window.ethereum.request({
1052
1425
  method: "eth_call",
1053
1426
  params: [
1054
1427
  {
1055
- to: a,
1056
- data: u
1428
+ to: tokenAddress,
1429
+ data
1057
1430
  },
1058
1431
  "latest"
1059
1432
  ]
1060
1433
  });
1061
- return parseInt(f, 16).toString();
1062
- } catch (l) {
1063
- throw console.error("Error getting token balance:", l), l;
1434
+ return parseInt(balance, 16).toString();
1435
+ } catch (error) {
1436
+ console.error("Error getting token balance:", error);
1437
+ throw error;
1064
1438
  }
1065
- }, Vt = {
1439
+ };
1440
+ const TOKEN_ADDRESSES = {
1066
1441
  USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
1067
1442
  USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1068
1443
  DAI: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
1069
1444
  WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
1070
1445
  WBTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
1071
- }, Pt = "data:image/png;base64,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", Rt = ({
1072
- isOpen: a,
1073
- onClose: n,
1074
- payment: l,
1075
- paymentStatus: c,
1076
- selectedCurrency: u,
1077
- onCurrencySelect: f,
1078
- onPayment: s,
1079
- error: y,
1080
- theme: i = "light",
1081
- merchantName: N,
1082
- transactionHash: x,
1083
- walletConnected: T,
1084
- onConnectWallet: $,
1085
- testMode: L = !1
1446
+ };
1447
+ const Logo = "data:image/png;base64,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";
1448
+ const QRCode = lazy(() => Promise.resolve().then(() => QRCode$2));
1449
+ const CoinleyModal = ({
1450
+ isOpen,
1451
+ onClose,
1452
+ payment,
1453
+ paymentStatus,
1454
+ selectedCurrency,
1455
+ onCurrencySelect,
1456
+ onPayment,
1457
+ error,
1458
+ theme = "light",
1459
+ merchantName,
1460
+ transactionHash,
1461
+ walletConnected,
1462
+ onConnectWallet,
1463
+ testMode = false
1086
1464
  }) => {
1087
- const [z, U] = O("select-currency"), [G, D] = O(!1), [v, se] = O("wallet");
1088
- X(() => {
1089
- typeof window < "u" && D(Q());
1090
- }, []), X(() => {
1091
- c === "loading" ? U("processing") : c === "success" ? U("success") : c === "error" ? U("error") : c === "idle" && l && U("select-currency");
1092
- }, [c, l]);
1093
- const F = (C) => {
1094
- f(C), U("confirm");
1095
- }, W = () => {
1096
- s(v === "qrcode");
1097
- }, J = () => {
1098
- z === "confirm" && U("select-currency");
1099
- }, oe = () => {
1100
- n();
1101
- }, Y = (C) => parseFloat(C).toFixed(2), K = (C) => C ? C.length <= 14 ? C : `${C.slice(0, 8)}...${C.slice(-6)}` : "", B = (C) => {
1102
- se(C);
1103
- }, ee = `fixed inset-0 z-50 overflow-y-auto ${i === "dark" ? "bg-gray-900/75" : "bg-black/50"}`, _ = `relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl ${i === "dark" ? "bg-gray-800 text-white" : "bg-white text-gray-800"}`, I = `text-xl font-bold mb-4 ${i === "dark" ? "text-white" : "text-gray-900"}`, E = `w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${i === "dark" ? "bg-blue-600 hover:bg-blue-700 text-white focus:ring-blue-500" : "bg-blue-500 hover:bg-blue-600 text-white focus:ring-blue-500"}`, p = `w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${i === "dark" ? "bg-gray-700 hover:bg-gray-600 text-white focus:ring-gray-500" : "bg-gray-200 hover:bg-gray-300 text-gray-800 focus:ring-gray-500"}`, H = "py-2 px-4 text-sm font-medium focus:outline-none transition-colors", Z = `${i === "dark" ? "bg-gray-700 text-white" : "bg-gray-100 text-gray-800"} rounded-t-md`, q = `${i === "dark" ? "text-gray-400 hover:text-gray-300" : "text-gray-500 hover:text-gray-700"}`;
1104
- return a ? /* @__PURE__ */ t.jsx("div", { className: ee, children: /* @__PURE__ */ t.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ t.jsxs("div", { className: _, children: [
1105
- /* @__PURE__ */ t.jsxs("div", { className: "flex justify-between items-center mb-6", children: [
1106
- /* @__PURE__ */ t.jsxs("div", { className: "flex items-center", children: [
1107
- /* @__PURE__ */ t.jsx("img", { src: Pt, alt: "Coinley Logo", className: "h-8 mr-2" }),
1108
- /* @__PURE__ */ t.jsx("h2", { className: I, children: "Coinley Pay" })
1465
+ const [step, setStep] = useState("select-currency");
1466
+ const [isMetaMaskAvailable, setIsMetaMaskAvailable] = useState(false);
1467
+ const [paymentMethod, setPaymentMethod] = useState("wallet");
1468
+ useEffect(() => {
1469
+ if (typeof window !== "undefined") {
1470
+ setIsMetaMaskAvailable(isMetaMaskInstalled());
1471
+ }
1472
+ }, []);
1473
+ useEffect(() => {
1474
+ if (paymentStatus === "loading") {
1475
+ setStep("processing");
1476
+ } else if (paymentStatus === "success") {
1477
+ setStep("success");
1478
+ } else if (paymentStatus === "error") {
1479
+ setStep("error");
1480
+ } else if (paymentStatus === "idle" && payment) {
1481
+ setStep("select-currency");
1482
+ }
1483
+ }, [paymentStatus, payment]);
1484
+ const handleCurrencySelect = (currency) => {
1485
+ onCurrencySelect(currency);
1486
+ setStep("confirm");
1487
+ };
1488
+ const handlePaymentConfirm = () => {
1489
+ onPayment(paymentMethod === "qrcode");
1490
+ };
1491
+ const handleBack = () => {
1492
+ if (step === "confirm") {
1493
+ setStep("select-currency");
1494
+ }
1495
+ };
1496
+ const handleClose = () => {
1497
+ onClose();
1498
+ };
1499
+ const formatAmount = (amount) => {
1500
+ return parseFloat(amount).toFixed(2);
1501
+ };
1502
+ const formatTransactionHash = (hash) => {
1503
+ if (!hash)
1504
+ return "";
1505
+ if (hash.length <= 14)
1506
+ return hash;
1507
+ return `${hash.slice(0, 8)}...${hash.slice(-6)}`;
1508
+ };
1509
+ const togglePaymentMethod = (method) => {
1510
+ setPaymentMethod(method);
1511
+ };
1512
+ const modalBaseClasses = `fixed inset-0 z-50 overflow-y-auto ${theme === "dark" ? "bg-gray-900/75" : "bg-black/50"}`;
1513
+ const modalContentClasses = `relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl ${theme === "dark" ? "bg-gray-800 text-white" : "bg-white text-gray-800"}`;
1514
+ const headerClasses = `text-xl font-bold mb-4 ${theme === "dark" ? "text-white" : "text-gray-900"}`;
1515
+ const buttonPrimaryClasses = `w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${theme === "dark" ? "bg-blue-600 hover:bg-blue-700 text-white focus:ring-blue-500" : "bg-blue-500 hover:bg-blue-600 text-white focus:ring-blue-500"}`;
1516
+ const buttonSecondaryClasses = `w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${theme === "dark" ? "bg-gray-700 hover:bg-gray-600 text-white focus:ring-gray-500" : "bg-gray-200 hover:bg-gray-300 text-gray-800 focus:ring-gray-500"}`;
1517
+ const tabButtonClasses = `py-2 px-4 text-sm font-medium focus:outline-none transition-colors`;
1518
+ const activeTabClasses = `${theme === "dark" ? "bg-gray-700 text-white" : "bg-gray-100 text-gray-800"} rounded-t-md`;
1519
+ const inactiveTabClasses = `${theme === "dark" ? "text-gray-400 hover:text-gray-300" : "text-gray-500 hover:text-gray-700"}`;
1520
+ if (!isOpen)
1521
+ return null;
1522
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: modalBaseClasses, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: modalContentClasses, children: [
1523
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center mb-6", children: [
1524
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
1525
+ /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: Logo, alt: "Coinley Logo", className: "h-8 mr-2" }),
1526
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: headerClasses, children: "Coinley Pay" })
1109
1527
  ] }),
1110
- /* @__PURE__ */ t.jsx(
1528
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1111
1529
  "button",
1112
1530
  {
1113
- onClick: oe,
1114
- className: `text-gray-500 hover:text-gray-700 focus:outline-none ${i === "dark" ? "text-gray-400 hover:text-gray-300" : ""}`,
1115
- children: /* @__PURE__ */ t.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
1531
+ onClick: handleClose,
1532
+ className: `text-gray-500 hover:text-gray-700 focus:outline-none ${theme === "dark" ? "text-gray-400 hover:text-gray-300" : ""}`,
1533
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
1116
1534
  }
1117
1535
  )
1118
1536
  ] }),
1119
- /* @__PURE__ */ t.jsxs("div", { className: "mb-6", children: [
1120
- l && /* @__PURE__ */ t.jsxs("div", { className: `mb-6 p-4 rounded-lg ${i === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
1121
- /* @__PURE__ */ t.jsx("p", { className: `text-sm ${i === "dark" ? "text-gray-300" : "text-gray-600"}`, children: N }),
1122
- /* @__PURE__ */ t.jsxs("div", { className: "flex justify-between items-center mt-2", children: [
1123
- /* @__PURE__ */ t.jsx("span", { className: `font-medium ${i === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Amount:" }),
1124
- /* @__PURE__ */ t.jsxs("span", { className: "font-bold text-xl", children: [
1537
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6", children: [
1538
+ payment && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `mb-6 p-4 rounded-lg ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
1539
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: merchantName }),
1540
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center mt-2", children: [
1541
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `font-medium ${theme === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Amount:" }),
1542
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold text-xl", children: [
1125
1543
  "$",
1126
- Y(l.totalAmount || l.amount)
1544
+ formatAmount(payment.totalAmount || payment.amount)
1127
1545
  ] })
1128
1546
  ] }),
1129
- /* @__PURE__ */ t.jsx("div", { className: "text-xs mt-1 text-right", children: /* @__PURE__ */ t.jsxs("span", { className: `${i === "dark" ? "text-gray-400" : "text-gray-500"}`, children: [
1547
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs mt-1 text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: `${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: [
1130
1548
  "Payment ID: ",
1131
- l.id.slice(0, 8),
1549
+ payment.id.slice(0, 8),
1132
1550
  "..."
1133
1551
  ] }) })
1134
1552
  ] }),
1135
- z === "select-currency" && /* @__PURE__ */ t.jsx(
1136
- At,
1553
+ step === "select-currency" && /* @__PURE__ */ jsxRuntimeExports.jsx(
1554
+ PaymentMethods,
1137
1555
  {
1138
- onSelect: F,
1139
- selected: u,
1140
- theme: i
1556
+ onSelect: handleCurrencySelect,
1557
+ selected: selectedCurrency,
1558
+ theme
1141
1559
  }
1142
1560
  ),
1143
- z === "confirm" && l && /* @__PURE__ */ t.jsxs("div", { children: [
1144
- /* @__PURE__ */ t.jsxs("div", { className: `p-4 rounded-lg mb-4 ${i === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
1145
- /* @__PURE__ */ t.jsx("h3", { className: `text-lg font-medium mb-2 ${i === "dark" ? "text-white" : "text-gray-800"}`, children: "Payment Details" }),
1146
- /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
1147
- /* @__PURE__ */ t.jsxs("div", { className: "flex justify-between", children: [
1148
- /* @__PURE__ */ t.jsx("span", { className: i === "dark" ? "text-gray-300" : "text-gray-600", children: "Currency:" }),
1149
- /* @__PURE__ */ t.jsx("span", { className: "font-medium", children: u })
1561
+ step === "confirm" && payment && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1562
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
1563
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-lg font-medium mb-2 ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Payment Details" }),
1564
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
1565
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
1566
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: theme === "dark" ? "text-gray-300" : "text-gray-600", children: "Currency:" }),
1567
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: selectedCurrency })
1150
1568
  ] }),
1151
- /* @__PURE__ */ t.jsxs("div", { className: "flex justify-between", children: [
1152
- /* @__PURE__ */ t.jsx("span", { className: i === "dark" ? "text-gray-300" : "text-gray-600", children: "Network:" }),
1153
- /* @__PURE__ */ t.jsx("span", { className: "font-medium", children: u === "SOL" || u === "USDC_SOL" ? "Solana" : "Ethereum" })
1569
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
1570
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: theme === "dark" ? "text-gray-300" : "text-gray-600", children: "Network:" }),
1571
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: selectedCurrency === "SOL" || selectedCurrency === "USDC_SOL" ? "Solana" : "Ethereum" })
1154
1572
  ] }),
1155
- /* @__PURE__ */ t.jsxs("div", { className: "flex justify-between", children: [
1156
- /* @__PURE__ */ t.jsx("span", { className: i === "dark" ? "text-gray-300" : "text-gray-600", children: "Fee:" }),
1157
- /* @__PURE__ */ t.jsx("span", { className: "font-medium", children: "1.75%" })
1573
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
1574
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: theme === "dark" ? "text-gray-300" : "text-gray-600", children: "Fee:" }),
1575
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "1.75%" })
1158
1576
  ] })
1159
1577
  ] })
1160
1578
  ] }),
1161
- /* @__PURE__ */ t.jsx("div", { className: "mb-4", children: /* @__PURE__ */ t.jsxs("div", { className: "flex border-b border-gray-200", children: [
1162
- /* @__PURE__ */ t.jsx(
1579
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex border-b border-gray-200", children: [
1580
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1163
1581
  "button",
1164
1582
  {
1165
- onClick: () => B("wallet"),
1166
- className: `${H} ${v === "wallet" ? Z : q}`,
1583
+ onClick: () => togglePaymentMethod("wallet"),
1584
+ className: `${tabButtonClasses} ${paymentMethod === "wallet" ? activeTabClasses : inactiveTabClasses}`,
1167
1585
  children: "Connect Wallet"
1168
1586
  }
1169
1587
  ),
1170
- /* @__PURE__ */ t.jsx(
1588
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1171
1589
  "button",
1172
1590
  {
1173
- onClick: () => B("qrcode"),
1174
- className: `${H} ${v === "qrcode" ? Z : q}`,
1591
+ onClick: () => togglePaymentMethod("qrcode"),
1592
+ className: `${tabButtonClasses} ${paymentMethod === "qrcode" ? activeTabClasses : inactiveTabClasses}`,
1175
1593
  children: "QR Code"
1176
1594
  }
1177
1595
  )
1178
1596
  ] }) }),
1179
- L ? (
1597
+ testMode ? (
1180
1598
  // Test mode payment option
1181
- /* @__PURE__ */ t.jsx("div", { className: `p-4 rounded-lg mb-4 ${i === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: /* @__PURE__ */ t.jsxs("div", { className: "flex items-center", children: [
1182
- /* @__PURE__ */ t.jsx("div", { className: "bg-blue-500 rounded-full p-2 mr-3", children: /* @__PURE__ */ t.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
1183
- /* @__PURE__ */ t.jsxs("div", { children: [
1184
- /* @__PURE__ */ t.jsx("h3", { className: `font-medium ${i === "dark" ? "text-white" : "text-gray-800"}`, children: "Test Mode Payment" }),
1185
- /* @__PURE__ */ t.jsx("p", { className: `text-sm ${i === "dark" ? "text-gray-300" : "text-gray-600"}`, children: 'Click "Pay Now" to simulate a successful payment' })
1599
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
1600
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-blue-500 rounded-full p-2 mr-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
1601
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1602
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `font-medium ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Test Mode Payment" }),
1603
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: 'Click "Pay Now" to simulate a successful payment' })
1186
1604
  ] })
1187
1605
  ] }) })
1188
- ) : v === "qrcode" ? (
1606
+ ) : paymentMethod === "qrcode" ? (
1189
1607
  // QR Code payment option
1190
- /* @__PURE__ */ t.jsx("div", { className: `p-4 rounded-lg mb-4 ${i === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: /* @__PURE__ */ t.jsx(
1191
- It,
1608
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1609
+ QRCode,
1192
1610
  {
1193
- walletAddress: l.walletAddress || "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
1194
- amount: l.totalAmount || l.amount,
1195
- currency: u,
1196
- theme: i
1611
+ walletAddress: payment.walletAddress || "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
1612
+ amount: payment.totalAmount || payment.amount,
1613
+ currency: selectedCurrency,
1614
+ theme
1197
1615
  }
1198
1616
  ) })
1199
- ) : G ? (
1617
+ ) : isMetaMaskAvailable ? (
1200
1618
  // MetaMask available option
1201
- /* @__PURE__ */ t.jsxs("div", { className: `p-4 rounded-lg mb-4 ${i === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: [
1202
- /* @__PURE__ */ t.jsxs("div", { className: "flex items-center", children: [
1203
- /* @__PURE__ */ t.jsx(
1619
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: [
1620
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
1621
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1204
1622
  "img",
1205
1623
  {
1206
1624
  src: "https://metamask.io/images/metamask-fox.svg",
@@ -1208,290 +1626,363 @@ const St = (a) => {
1208
1626
  className: "w-8 h-8 mr-2"
1209
1627
  }
1210
1628
  ),
1211
- /* @__PURE__ */ t.jsxs("div", { children: [
1212
- /* @__PURE__ */ t.jsx("h3", { className: `font-medium ${i === "dark" ? "text-white" : "text-gray-800"}`, children: "Pay with MetaMask" }),
1213
- /* @__PURE__ */ t.jsx("p", { className: `text-sm ${i === "dark" ? "text-gray-300" : "text-gray-600"}`, children: T ? "Your wallet is connected. Click 'Pay Now' to proceed." : "Click 'Connect Wallet' to proceed with payment." })
1629
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1630
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `font-medium ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Pay with MetaMask" }),
1631
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: walletConnected ? "Your wallet is connected. Click 'Pay Now' to proceed." : "Click 'Connect Wallet' to proceed with payment." })
1214
1632
  ] })
1215
1633
  ] }),
1216
- !T && /* @__PURE__ */ t.jsx(
1634
+ !walletConnected && /* @__PURE__ */ jsxRuntimeExports.jsx(
1217
1635
  "button",
1218
1636
  {
1219
- onClick: $,
1220
- className: `mt-3 ${E}`,
1637
+ onClick: onConnectWallet,
1638
+ className: `mt-3 ${buttonPrimaryClasses}`,
1221
1639
  children: "Connect Wallet"
1222
1640
  }
1223
1641
  )
1224
1642
  ] })
1225
1643
  ) : (
1226
1644
  // MetaMask not available warning
1227
- /* @__PURE__ */ t.jsxs("div", { className: `p-4 rounded-lg mb-4 ${i === "dark" ? "bg-yellow-900/20" : "bg-yellow-50"}`, children: [
1228
- /* @__PURE__ */ t.jsxs("div", { className: "flex items-center", children: [
1229
- /* @__PURE__ */ t.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-yellow-500 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
1230
- /* @__PURE__ */ t.jsxs("div", { children: [
1231
- /* @__PURE__ */ t.jsx("h3", { className: `font-medium ${i === "dark" ? "text-white" : "text-gray-800"}`, children: "MetaMask Not Detected" }),
1232
- /* @__PURE__ */ t.jsx("p", { className: `text-sm ${i === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Please install MetaMask extension to make payments" })
1645
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-yellow-900/20" : "bg-yellow-50"}`, children: [
1646
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
1647
+ /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-yellow-500 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
1648
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1649
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `font-medium ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "MetaMask Not Detected" }),
1650
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Please install MetaMask extension to make payments" })
1233
1651
  ] })
1234
1652
  ] }),
1235
- /* @__PURE__ */ t.jsx(
1653
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1236
1654
  "a",
1237
1655
  {
1238
1656
  href: "https://metamask.io/download/",
1239
1657
  target: "_blank",
1240
1658
  rel: "noopener noreferrer",
1241
- className: `block mt-3 text-center ${E}`,
1659
+ className: `block mt-3 text-center ${buttonPrimaryClasses}`,
1242
1660
  children: "Install MetaMask"
1243
1661
  }
1244
1662
  )
1245
1663
  ] })
1246
1664
  ),
1247
- /* @__PURE__ */ t.jsxs("div", { className: "mt-6 grid grid-cols-2 gap-3", children: [
1248
- /* @__PURE__ */ t.jsx(
1665
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-6 grid grid-cols-2 gap-3", children: [
1666
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1249
1667
  "button",
1250
1668
  {
1251
1669
  type: "button",
1252
- onClick: J,
1253
- className: p,
1670
+ onClick: handleBack,
1671
+ className: buttonSecondaryClasses,
1254
1672
  children: "Back"
1255
1673
  }
1256
1674
  ),
1257
- /* @__PURE__ */ t.jsx(
1675
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1258
1676
  "button",
1259
1677
  {
1260
1678
  type: "button",
1261
- onClick: W,
1262
- className: E,
1263
- disabled: !L && v === "wallet" && G && !T,
1679
+ onClick: handlePaymentConfirm,
1680
+ className: buttonPrimaryClasses,
1681
+ disabled: !testMode && paymentMethod === "wallet" && isMetaMaskAvailable && !walletConnected,
1264
1682
  children: "Pay Now"
1265
1683
  }
1266
1684
  )
1267
1685
  ] })
1268
1686
  ] }),
1269
- z === "processing" && /* @__PURE__ */ t.jsx(
1270
- Te,
1687
+ step === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx(
1688
+ PaymentStatus,
1271
1689
  {
1272
1690
  status: "processing",
1273
- theme: i,
1691
+ theme,
1274
1692
  message: "Processing your payment..."
1275
1693
  }
1276
1694
  ),
1277
- z === "success" && /* @__PURE__ */ t.jsxs("div", { children: [
1278
- /* @__PURE__ */ t.jsx(
1279
- Te,
1695
+ step === "success" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1696
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1697
+ PaymentStatus,
1280
1698
  {
1281
1699
  status: "success",
1282
- theme: i,
1700
+ theme,
1283
1701
  message: "Payment successful!"
1284
1702
  }
1285
1703
  ),
1286
- x && /* @__PURE__ */ t.jsxs("div", { className: `mt-4 p-3 rounded-lg ${i === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
1287
- /* @__PURE__ */ t.jsx("p", { className: `text-xs ${i === "dark" ? "text-gray-300" : "text-gray-600"} mb-1`, children: "Transaction Hash:" }),
1288
- /* @__PURE__ */ t.jsx("p", { className: `text-sm font-mono break-all ${i === "dark" ? "text-white" : "text-gray-800"}`, children: K(x) }),
1289
- /* @__PURE__ */ t.jsx(
1704
+ transactionHash && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `mt-4 p-3 rounded-lg ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
1705
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${theme === "dark" ? "text-gray-300" : "text-gray-600"} mb-1`, children: "Transaction Hash:" }),
1706
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm font-mono break-all ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: formatTransactionHash(transactionHash) }),
1707
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1290
1708
  "a",
1291
1709
  {
1292
- href: `https://etherscan.io/tx/${x}`,
1710
+ href: `https://etherscan.io/tx/${transactionHash}`,
1293
1711
  target: "_blank",
1294
1712
  rel: "noopener noreferrer",
1295
- className: `text-xs ${i === "dark" ? "text-blue-400" : "text-blue-600"} mt-2 inline-block`,
1713
+ className: `text-xs ${theme === "dark" ? "text-blue-400" : "text-blue-600"} mt-2 inline-block`,
1296
1714
  children: "View on Etherscan →"
1297
1715
  }
1298
1716
  )
1299
1717
  ] })
1300
1718
  ] }),
1301
- z === "error" && /* @__PURE__ */ t.jsxs("div", { children: [
1302
- /* @__PURE__ */ t.jsx(
1303
- Te,
1719
+ step === "error" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1720
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1721
+ PaymentStatus,
1304
1722
  {
1305
1723
  status: "error",
1306
- theme: i,
1307
- message: y || "An error occurred while processing your payment."
1724
+ theme,
1725
+ message: error || "An error occurred while processing your payment."
1308
1726
  }
1309
1727
  ),
1310
- /* @__PURE__ */ t.jsx(
1728
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1311
1729
  "button",
1312
1730
  {
1313
1731
  type: "button",
1314
- onClick: J,
1315
- className: `mt-4 ${p}`,
1732
+ onClick: handleBack,
1733
+ className: `mt-4 ${buttonSecondaryClasses}`,
1316
1734
  children: "Try Again"
1317
1735
  }
1318
1736
  )
1319
1737
  ] })
1320
1738
  ] }),
1321
- /* @__PURE__ */ t.jsx("div", { className: `text-center text-xs ${i === "dark" ? "text-gray-400" : "text-gray-500"}`, children: /* @__PURE__ */ t.jsx("p", { children: "Powered by Coinley - Secure Cryptocurrency Payments" }) })
1322
- ] }) }) }) : null;
1323
- }, $t = pt(({
1324
- apiKey: a,
1325
- apiSecret: n,
1326
- apiUrl: l,
1327
- customerEmail: c,
1328
- merchantName: u = "Merchant",
1329
- onSuccess: f,
1330
- onError: s,
1331
- onClose: y,
1332
- theme: i,
1333
- autoOpen: N = !1,
1334
- debug: x = !1,
1335
- testMode: T = !1
1336
- }, $) => {
1337
- const L = Ct(), { theme: z } = Lt(), [U, G] = O(N), [D, v] = O(null), [se, F] = O("idle"), [W, J] = O("USDT"), [oe, Y] = O(null), [K, B] = O(null), [ee, _] = O(!1);
1338
- a || (L == null || L.apiKey), n || (L == null || L.apiSecret), l || (L == null || L.apiUrl);
1339
- const I = i || z, E = x || (L == null ? void 0 : L.debug);
1340
- vt($, () => ({
1341
- open: (m) => {
1342
- H(m);
1739
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `text-center text-xs ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Powered by Coinley - Secure Cryptocurrency Payments" }) })
1740
+ ] }) }) });
1741
+ };
1742
+ const CoinleyCheckout = forwardRef(({
1743
+ apiKey,
1744
+ apiSecret,
1745
+ apiUrl,
1746
+ customerEmail,
1747
+ merchantName = "Merchant",
1748
+ onSuccess,
1749
+ onError,
1750
+ onClose,
1751
+ theme,
1752
+ autoOpen = false,
1753
+ debug = false,
1754
+ testMode = false
1755
+ }, ref) => {
1756
+ const coinleyContext = useCoinley();
1757
+ const { theme: contextTheme } = useTheme();
1758
+ const [isOpen, setIsOpen] = useState(autoOpen);
1759
+ const [payment, setPayment] = useState(null);
1760
+ const [paymentStatus, setPaymentStatus] = useState("idle");
1761
+ const [selectedCurrency, setSelectedCurrency] = useState("USDT");
1762
+ const [error, setError] = useState(null);
1763
+ const [transactionHash, setTransactionHash] = useState(null);
1764
+ const [walletConnected, setWalletConnected] = useState(false);
1765
+ apiKey || (coinleyContext == null ? void 0 : coinleyContext.apiKey);
1766
+ apiSecret || (coinleyContext == null ? void 0 : coinleyContext.apiSecret);
1767
+ apiUrl || (coinleyContext == null ? void 0 : coinleyContext.apiUrl);
1768
+ const effectiveTheme = theme || contextTheme;
1769
+ const effectiveDebug = debug || (coinleyContext == null ? void 0 : coinleyContext.debug);
1770
+ useImperativeHandle(ref, () => ({
1771
+ open: (paymentDetails) => {
1772
+ handleOpen(paymentDetails);
1343
1773
  },
1344
1774
  close: () => {
1345
- Z();
1775
+ handleClose();
1346
1776
  },
1347
- getPayment: () => D
1777
+ getPayment: () => payment
1348
1778
  }));
1349
- const p = (m, h) => {
1350
- E && console.log(`[Coinley SDK] ${m}`, h);
1779
+ const log = (message, data) => {
1780
+ if (effectiveDebug) {
1781
+ console.log(`[Coinley SDK] ${message}`, data);
1782
+ }
1351
1783
  };
1352
- X(() => {
1353
- (async () => {
1354
- if (Q())
1784
+ useEffect(() => {
1785
+ const checkWalletConnection = async () => {
1786
+ if (isMetaMaskInstalled()) {
1355
1787
  try {
1356
- const h = await window.ethereum.request({ method: "eth_accounts" });
1357
- _(h && h.length > 0);
1358
- } catch (h) {
1359
- p("Error checking wallet connection:", h), _(!1);
1788
+ const accounts = await window.ethereum.request({ method: "eth_accounts" });
1789
+ setWalletConnected(accounts && accounts.length > 0);
1790
+ } catch (err) {
1791
+ log("Error checking wallet connection:", err);
1792
+ setWalletConnected(false);
1360
1793
  }
1361
- else
1362
- _(!1);
1363
- })();
1364
- }, []), X(() => {
1365
- const m = (h) => {
1366
- _(h.length > 0);
1794
+ } else {
1795
+ setWalletConnected(false);
1796
+ }
1367
1797
  };
1368
- return typeof window < "u" && window.ethereum && window.ethereum.on("accountsChanged", m), () => {
1369
- typeof window < "u" && window.ethereum && window.ethereum.removeListener("accountsChanged", m);
1798
+ checkWalletConnection();
1799
+ }, []);
1800
+ useEffect(() => {
1801
+ const handleAccountsChanged = (accounts) => {
1802
+ setWalletConnected(accounts.length > 0);
1803
+ };
1804
+ if (typeof window !== "undefined" && window.ethereum) {
1805
+ window.ethereum.on("accountsChanged", handleAccountsChanged);
1806
+ }
1807
+ return () => {
1808
+ if (typeof window !== "undefined" && window.ethereum) {
1809
+ window.ethereum.removeListener("accountsChanged", handleAccountsChanged);
1810
+ }
1370
1811
  };
1371
1812
  }, []);
1372
- const H = async (m) => {
1373
- if (!m || !m.amount) {
1374
- Y("Payment amount is required"), s && s(new Error("Payment amount is required"));
1813
+ const handleOpen = async (paymentDetails) => {
1814
+ if (!paymentDetails || !paymentDetails.amount) {
1815
+ setError("Payment amount is required");
1816
+ if (onError)
1817
+ onError(new Error("Payment amount is required"));
1375
1818
  return;
1376
1819
  }
1377
- F("loading"), G(!0);
1820
+ setPaymentStatus("loading");
1821
+ setIsOpen(true);
1378
1822
  try {
1379
- p("Creating payment with details:", m);
1380
- const h = await Tt({
1381
- amount: m.amount,
1382
- currency: m.currency || "USDT",
1383
- customerEmail: m.customerEmail || c,
1384
- callbackUrl: m.callbackUrl,
1385
- metadata: m.metadata || {}
1823
+ log("Creating payment with details:", paymentDetails);
1824
+ const paymentResponse = await createPayment({
1825
+ amount: paymentDetails.amount,
1826
+ currency: paymentDetails.currency || "USDT",
1827
+ customerEmail: paymentDetails.customerEmail || customerEmail,
1828
+ callbackUrl: paymentDetails.callbackUrl,
1829
+ metadata: paymentDetails.metadata || {}
1386
1830
  });
1387
- p("Payment created:", h), v(h.payment), F("idle"), Y(null), p("Payment created and state updated:", {
1388
- payment: h.payment,
1831
+ log("Payment created:", paymentResponse);
1832
+ setPayment(paymentResponse.payment);
1833
+ setPaymentStatus("idle");
1834
+ setError(null);
1835
+ log("Payment created and state updated:", {
1836
+ payment: paymentResponse.payment,
1389
1837
  status: "idle"
1390
1838
  });
1391
- } catch (h) {
1392
- p("Error creating payment:", h), Y(h.message || "Failed to create payment"), F("error"), s && s(h);
1839
+ } catch (err) {
1840
+ log("Error creating payment:", err);
1841
+ setError(err.message || "Failed to create payment");
1842
+ setPaymentStatus("error");
1843
+ if (onError)
1844
+ onError(err);
1845
+ }
1846
+ };
1847
+ const handleClose = () => {
1848
+ setIsOpen(false);
1849
+ setTransactionHash(null);
1850
+ if (onClose)
1851
+ onClose();
1852
+ };
1853
+ const handlePaymentMethodSelect = (currency) => {
1854
+ log("Currency selected:", currency);
1855
+ setSelectedCurrency(currency);
1856
+ };
1857
+ const connectToWallet = async () => {
1858
+ if (!isMetaMaskInstalled()) {
1859
+ setError("MetaMask is not installed. Please install MetaMask to make payments.");
1860
+ return false;
1393
1861
  }
1394
- }, Z = () => {
1395
- G(!1), B(null), y && y();
1396
- }, q = (m) => {
1397
- p("Currency selected:", m), J(m);
1398
- }, C = async () => {
1399
- if (!Q())
1400
- return Y("MetaMask is not installed. Please install MetaMask to make payments."), !1;
1401
1862
  try {
1402
- const m = await kt();
1403
- return _(m.length > 0), m.length > 0;
1404
- } catch (m) {
1405
- return p("Error connecting to wallet:", m), Y(m.message || "Failed to connect to wallet"), !1;
1863
+ const accounts = await connectWallet();
1864
+ setWalletConnected(accounts.length > 0);
1865
+ return accounts.length > 0;
1866
+ } catch (err) {
1867
+ log("Error connecting to wallet:", err);
1868
+ setError(err.message || "Failed to connect to wallet");
1869
+ return false;
1406
1870
  }
1407
- }, de = async (m = !1) => {
1408
- if (!D) {
1409
- Y("No active payment to process");
1871
+ };
1872
+ const handlePayment = async (isQrCodeMode = false) => {
1873
+ if (!payment) {
1874
+ setError("No active payment to process");
1410
1875
  return;
1411
1876
  }
1412
- p("Starting payment process...", { isQrCodeMode: m }), F("loading"), B(null);
1877
+ log("Starting payment process...", { isQrCodeMode });
1878
+ setPaymentStatus("loading");
1879
+ setTransactionHash(null);
1413
1880
  try {
1414
- p("Processing payment:", { paymentId: D.id, currency: W, isQrCodeMode: m });
1415
- let h;
1416
- if (T)
1417
- p("Test mode: Generating mock transaction..."), h = `0x${Array.from({ length: 64 }, () => Math.floor(Math.random() * 16).toString(16)).join("")}`;
1418
- else if (m)
1419
- p("QR code payment: User confirms payment was sent"), h = `qrcode_${Date.now().toString(16)}_${Math.random().toString(16).substring(2, 10)}`;
1420
- else {
1421
- if (!ee && !await C())
1422
- throw new Error("Please connect your wallet to proceed with payment");
1423
- const me = D.walletAddress || "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", he = {
1424
- from: await window.ethereum.request({ method: "eth_requestAccounts" }).then((te) => te[0]),
1425
- to: me,
1881
+ log("Processing payment:", { paymentId: payment.id, currency: selectedCurrency, isQrCodeMode });
1882
+ let txHash;
1883
+ if (testMode) {
1884
+ log("Test mode: Generating mock transaction...");
1885
+ txHash = `0x${Array.from({ length: 64 }, () => Math.floor(Math.random() * 16).toString(16)).join("")}`;
1886
+ } else if (isQrCodeMode) {
1887
+ log("QR code payment: User confirms payment was sent");
1888
+ txHash = `qrcode_${Date.now().toString(16)}_${Math.random().toString(16).substring(2, 10)}`;
1889
+ } else {
1890
+ if (!walletConnected) {
1891
+ const connected = await connectToWallet();
1892
+ if (!connected) {
1893
+ throw new Error("Please connect your wallet to proceed with payment");
1894
+ }
1895
+ }
1896
+ const merchantAddress = payment.walletAddress || "0x742d35Cc6634C0532925a3b844Bc454e4438f44e";
1897
+ const txParams = {
1898
+ from: await window.ethereum.request({ method: "eth_requestAccounts" }).then((accounts) => accounts[0]),
1899
+ to: merchantAddress,
1426
1900
  value: "0x0",
1427
1901
  // For ERC-20 tokens, value is 0
1428
1902
  data: "0x"
1429
1903
  // Would include token transfer data for ERC-20
1430
1904
  };
1431
- p("Sending transaction to wallet for approval..."), h = await Ot(he);
1905
+ log("Sending transaction to wallet for approval...");
1906
+ txHash = await sendTransaction(txParams);
1432
1907
  }
1433
- p("Transaction hash:", h), B(h), p("Sending process payment request to API...");
1434
- const fe = await Dt({
1435
- paymentId: D.id,
1436
- transactionHash: h,
1437
- network: W === "SOL" || W === "USDC_SOL" ? "solana" : "ethereum"
1908
+ log("Transaction hash:", txHash);
1909
+ setTransactionHash(txHash);
1910
+ log("Sending process payment request to API...");
1911
+ const processResponse = await processPayment({
1912
+ paymentId: payment.id,
1913
+ transactionHash: txHash,
1914
+ network: selectedCurrency === "SOL" || selectedCurrency === "USDC_SOL" ? "solana" : "ethereum"
1438
1915
  });
1439
- p("Payment processed successfully:", fe), F("success"), f && (p("Calling onSuccess callback..."), f(D.id, h));
1440
- } catch (h) {
1441
- p("Payment error:", h), Y(h.message || "Failed to process payment"), F("error"), s && s(h);
1916
+ log("Payment processed successfully:", processResponse);
1917
+ setPaymentStatus("success");
1918
+ if (onSuccess) {
1919
+ log("Calling onSuccess callback...");
1920
+ onSuccess(payment.id, txHash);
1921
+ }
1922
+ } catch (err) {
1923
+ log("Payment error:", err);
1924
+ setError(err.message || "Failed to process payment");
1925
+ setPaymentStatus("error");
1926
+ if (onError)
1927
+ onError(err);
1442
1928
  }
1443
1929
  };
1444
- return X(() => {
1445
- N && D && G(!0);
1446
- }, [N, D]), /* @__PURE__ */ t.jsx(t.Fragment, { children: U && /* @__PURE__ */ t.jsx(
1447
- Rt,
1930
+ useEffect(() => {
1931
+ if (autoOpen && payment) {
1932
+ setIsOpen(true);
1933
+ }
1934
+ }, [autoOpen, payment]);
1935
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(
1936
+ CoinleyModal,
1448
1937
  {
1449
- isOpen: U,
1450
- onClose: Z,
1451
- payment: D,
1452
- paymentStatus: se,
1453
- selectedCurrency: W,
1454
- onCurrencySelect: q,
1455
- onPayment: de,
1456
- error: oe,
1457
- theme: I,
1458
- merchantName: u,
1459
- transactionHash: K,
1460
- walletConnected: ee,
1461
- onConnectWallet: C,
1462
- testMode: T
1938
+ isOpen,
1939
+ onClose: handleClose,
1940
+ payment,
1941
+ paymentStatus,
1942
+ selectedCurrency,
1943
+ onCurrencySelect: handlePaymentMethodSelect,
1944
+ onPayment: handlePayment,
1945
+ error,
1946
+ theme: effectiveTheme,
1947
+ merchantName,
1948
+ transactionHash,
1949
+ walletConnected,
1950
+ onConnectWallet: connectToWallet,
1951
+ testMode
1463
1952
  }
1464
1953
  ) });
1465
1954
  });
1466
- $t.displayName = "CoinleyCheckout";
1467
- const Xt = {
1955
+ CoinleyCheckout.displayName = "CoinleyCheckout";
1956
+ const DEFAULT_CONFIG = {
1468
1957
  apiUrl: "https://coinleyserver-production.up.railway.app",
1469
- debug: !1,
1470
- testMode: !1,
1958
+ debug: false,
1959
+ testMode: false,
1471
1960
  theme: "light"
1472
- }, Jt = "1.0.2";
1961
+ };
1962
+ const VERSION = "1.0.2";
1473
1963
  export {
1474
- $t as CoinleyCheckout,
1475
- Rt as CoinleyModal,
1476
- Gt as CoinleyProvider,
1477
- Xt as DEFAULT_CONFIG,
1478
- It as QRCode,
1479
- Vt as TOKEN_ADDRESSES,
1480
- Ut as ThemeProvider,
1481
- Jt as VERSION,
1482
- kt as connectWallet,
1483
- Tt as createPayment,
1484
- Et as getAccounts,
1485
- Wt as getChainId,
1486
- _t as getMerchantPaymentStats,
1487
- Ft as getMerchantPayments,
1488
- Ht as getNetworkName,
1489
- Yt as getPayment,
1490
- Qt as getSupportedCurrencies,
1491
- qt as getTokenBalance,
1492
- Q as isMetaMaskInstalled,
1493
- Zt as isWalletConnected,
1494
- Dt as processPayment,
1495
- Bt as sendToken,
1496
- Ot as sendTransaction
1964
+ CoinleyCheckout,
1965
+ CoinleyModal,
1966
+ CoinleyProvider,
1967
+ DEFAULT_CONFIG,
1968
+ QRCode$1 as QRCode,
1969
+ TOKEN_ADDRESSES,
1970
+ ThemeProvider,
1971
+ VERSION,
1972
+ connectWallet,
1973
+ createPayment,
1974
+ getAccounts,
1975
+ getChainId,
1976
+ getMerchantPaymentStats,
1977
+ getMerchantPayments,
1978
+ getNetworkName,
1979
+ getPayment,
1980
+ getSupportedCurrencies,
1981
+ getTokenBalance,
1982
+ isMetaMaskInstalled,
1983
+ isWalletConnected,
1984
+ processPayment,
1985
+ sendToken,
1986
+ sendTransaction
1497
1987
  };
1988
+ //# sourceMappingURL=coinley-checkout.es.js.map