@cedros/pay-react 1.1.23 → 1.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/{AISettingsSection-DAztmwnN.js → AISettingsSection-BvSSiK2G.js} +1 -1
  2. package/dist/{AISettingsSection-DpMIk431.mjs → AISettingsSection-Dg1kazTI.mjs} +2 -2
  3. package/dist/{AutosaveIndicator-BRCqAWqP.mjs → AutosaveIndicator-BHfkV59p.mjs} +1 -1
  4. package/dist/{AutosaveIndicator-BnQkKxzr.js → AutosaveIndicator-D2l7U8R1.js} +1 -1
  5. package/dist/CedrosContext-C2RjHLaQ.js +6 -0
  6. package/dist/{CedrosContext-BlArEF7k.mjs → CedrosContext-CY6zvjvJ.mjs} +768 -617
  7. package/dist/ComplianceSection-BSE2f3Wo.mjs +534 -0
  8. package/dist/ComplianceSection-D6ETKG6b.js +1 -0
  9. package/dist/{CryptoButton-CREryx1l.mjs → CryptoButton-BV9owVe2.mjs} +51 -51
  10. package/dist/{CryptoButton-C1AAOOfj.js → CryptoButton-DpiCnyXE.js} +1 -1
  11. package/dist/{FAQSection-yw64HLy3.js → FAQSection-6nGI0FK9.js} +1 -1
  12. package/dist/{FAQSection-Ruzs7a-0.mjs → FAQSection-uZG5V3pJ.mjs} +1 -1
  13. package/dist/{MessagingSection-Dp_SaXsv.js → MessagingSection-DrXb578q.js} +1 -1
  14. package/dist/{MessagingSection-BLRjfBQT.mjs → MessagingSection-M0lj5yo4.mjs} +2 -2
  15. package/dist/{OrdersSection-l-MtP9EN.mjs → OrdersSection-DteItv_O.mjs} +6 -6
  16. package/dist/{OrdersSection-C2dyWqrR.js → OrdersSection-_-rIw6XW.js} +1 -1
  17. package/dist/{PaymentSettingsSection-Bbq93UtC.mjs → PaymentSettingsSection-CdtdLFTg.mjs} +1 -1
  18. package/dist/{PaymentSettingsSection-C5bhLgU7.js → PaymentSettingsSection-enTbUI95.js} +1 -1
  19. package/dist/SettingsSection-DUTEd6uV.js +1 -0
  20. package/dist/{SettingsSection-DorqCFXE.mjs → SettingsSection-mcT4LEhO.mjs} +19 -13
  21. package/dist/{SingleCategorySettings-BAND8Zkw.mjs → SingleCategorySettings-BvHBVfSe.mjs} +4 -4
  22. package/dist/{SingleCategorySettings-Cg-zuJfr.js → SingleCategorySettings-D2LVM5mn.js} +1 -1
  23. package/dist/{StorefrontSection-FSOxBclu.mjs → StorefrontSection-BqQ36JIS.mjs} +2 -2
  24. package/dist/{StorefrontSection-QZPEZ6Lz.js → StorefrontSection-Du7hV2Gc.js} +1 -1
  25. package/dist/{SubscriptionsSection-C4TDXCX2.mjs → SubscriptionsSection-BYiCBwKZ.mjs} +7 -7
  26. package/dist/{SubscriptionsSection-DYr99VzB.js → SubscriptionsSection-C4BRN1dP.js} +1 -1
  27. package/dist/Token22Section-0c22NM5G.js +1 -0
  28. package/dist/Token22Section-BHvOhz5d.mjs +2260 -0
  29. package/dist/{WalletManager-Bwk3rgr1.js → WalletManager-B3UdQ5pQ.js} +1 -1
  30. package/dist/{WalletManager-peBN6RDH.mjs → WalletManager-BIwH8Dw_.mjs} +1 -1
  31. package/dist/{bn-CHdpZHQm.mjs → bn-Bv2sKQMU.mjs} +1 -1
  32. package/dist/{bn-RbgIlcHc.js → bn-CHyy7EgJ.js} +1 -1
  33. package/dist/{configApi-Ch0Rr7TD.mjs → configApi-6XhAJGKX.mjs} +31 -0
  34. package/dist/{configApi-CxEbCAgG.js → configApi-DkduMQg1.js} +1 -1
  35. package/dist/crypto-only.js +1 -1
  36. package/dist/crypto-only.mjs +85 -83
  37. package/dist/{index-CKNB7XsA.mjs → index-BkDimQDF.mjs} +7988 -7323
  38. package/dist/index-C7MWL6O8.js +84 -0
  39. package/dist/index.js +1 -1
  40. package/dist/index.mjs +42 -40
  41. package/dist/{sections-Cklkxd85.js → sections-5jO2aHAo.js} +1 -1
  42. package/dist/sections-By4H1baL.mjs +9 -0
  43. package/dist/src/admin/plugin.d.ts.map +1 -1
  44. package/dist/src/components/ComplianceGatePage.d.ts +38 -0
  45. package/dist/src/components/ComplianceGatePage.d.ts.map +1 -0
  46. package/dist/src/components/SubscribeButton.d.ts +1 -5
  47. package/dist/src/components/SubscribeButton.d.ts.map +1 -1
  48. package/dist/src/components/admin/AdminAuthManager.d.ts +7 -3
  49. package/dist/src/components/admin/AdminAuthManager.d.ts.map +1 -1
  50. package/dist/src/components/admin/AssetClassesTab.d.ts.map +1 -1
  51. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +1 -1
  52. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
  53. package/dist/src/components/admin/ComplianceSanctionsApi.d.ts +3 -0
  54. package/dist/src/components/admin/ComplianceSanctionsApi.d.ts.map +1 -0
  55. package/dist/src/components/admin/ComplianceSection.d.ts +3 -0
  56. package/dist/src/components/admin/ComplianceSection.d.ts.map +1 -0
  57. package/dist/src/components/admin/GiftCardAnalytics.d.ts +3 -0
  58. package/dist/src/components/admin/GiftCardAnalytics.d.ts.map +1 -0
  59. package/dist/src/components/admin/GiftCardManager.d.ts +3 -0
  60. package/dist/src/components/admin/GiftCardManager.d.ts.map +1 -0
  61. package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -1
  62. package/dist/src/components/admin/PoolManagementView.d.ts +14 -0
  63. package/dist/src/components/admin/PoolManagementView.d.ts.map +1 -0
  64. package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
  65. package/dist/src/components/admin/RefundsSection.d.ts.map +1 -1
  66. package/dist/src/components/admin/SettingsSection.d.ts.map +1 -1
  67. package/dist/src/components/admin/Token22Section.d.ts.map +1 -1
  68. package/dist/src/components/admin/complianceTypes.d.ts +60 -0
  69. package/dist/src/components/admin/complianceTypes.d.ts.map +1 -0
  70. package/dist/src/components/admin/configApi.d.ts.map +1 -1
  71. package/dist/src/components/admin/icons.d.ts +1 -0
  72. package/dist/src/components/admin/icons.d.ts.map +1 -1
  73. package/dist/src/components/admin/useAdminAuth.d.ts +1 -1
  74. package/dist/src/components/admin/useAdminAuth.d.ts.map +1 -1
  75. package/dist/src/context/CedrosContext.d.ts.map +1 -1
  76. package/dist/src/ecommerce/components/catalog/TokenDisplay.d.ts +36 -0
  77. package/dist/src/ecommerce/components/catalog/TokenDisplay.d.ts.map +1 -0
  78. package/dist/src/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -1
  79. package/dist/src/ecommerce/components/checkout/SendAsGiftSection.d.ts +15 -0
  80. package/dist/src/ecommerce/components/checkout/SendAsGiftSection.d.ts.map +1 -0
  81. package/dist/src/ecommerce/components/gift-cards/GiftCardBalanceChecker.d.ts +19 -0
  82. package/dist/src/ecommerce/components/gift-cards/GiftCardBalanceChecker.d.ts.map +1 -0
  83. package/dist/src/ecommerce/components/orders/MyRedemptionsPage.d.ts +13 -0
  84. package/dist/src/ecommerce/components/orders/MyRedemptionsPage.d.ts.map +1 -0
  85. package/dist/src/ecommerce/components/orders/MyTokensPage.d.ts +15 -0
  86. package/dist/src/ecommerce/components/orders/MyTokensPage.d.ts.map +1 -0
  87. package/dist/src/ecommerce/components/orders/OrderDetails.d.ts.map +1 -1
  88. package/dist/src/ecommerce/hooks/useCartInventory.d.ts.map +1 -1
  89. package/dist/src/ecommerce/index.d.ts +10 -0
  90. package/dist/src/ecommerce/index.d.ts.map +1 -1
  91. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts +3 -0
  92. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -1
  93. package/dist/src/ecommerce/state/checkout/useCheckout.d.ts.map +1 -1
  94. package/dist/src/ecommerce/types.d.ts +6 -0
  95. package/dist/src/ecommerce/types.d.ts.map +1 -1
  96. package/dist/src/ecommerce/utils/cartItemMetadata.d.ts.map +1 -1
  97. package/dist/src/hooks/useComplianceCheck.d.ts +30 -0
  98. package/dist/src/hooks/useComplianceCheck.d.ts.map +1 -0
  99. package/dist/src/hooks/useSubscriptionManagement.d.ts.map +1 -1
  100. package/dist/src/index.d.ts +4 -0
  101. package/dist/src/index.d.ts.map +1 -1
  102. package/dist/src/managers/CreditsManager.d.ts.map +1 -1
  103. package/dist/src/managers/ManagerCache.d.ts +2 -2
  104. package/dist/src/managers/ManagerCache.d.ts.map +1 -1
  105. package/dist/src/managers/StripeManager.d.ts +7 -1
  106. package/dist/src/managers/StripeManager.d.ts.map +1 -1
  107. package/dist/src/managers/SubscriptionChangeManager.d.ts.map +1 -1
  108. package/dist/src/managers/SubscriptionManager.d.ts.map +1 -1
  109. package/dist/src/types/index.d.ts +14 -0
  110. package/dist/src/types/index.d.ts.map +1 -1
  111. package/dist/src/types/subscription.d.ts +21 -33
  112. package/dist/src/types/subscription.d.ts.map +1 -1
  113. package/dist/src/utils/exponentialBackoff.d.ts +22 -0
  114. package/dist/src/utils/exponentialBackoff.d.ts.map +1 -1
  115. package/dist/stripe-only.js +1 -1
  116. package/dist/stripe-only.mjs +2 -2
  117. package/dist/styles-BT4bhFey.js +1 -0
  118. package/dist/{styles-2VMpwuaI.mjs → styles-D4SQkuV3.mjs} +647 -650
  119. package/dist/testing/index.js +1 -1
  120. package/dist/testing/index.mjs +1 -1
  121. package/dist/{walletPool-DgQsh7Se.mjs → walletPool-DE-t1wSW.mjs} +1 -1
  122. package/dist/{walletPool-Ddv33tej.js → walletPool-IS7R3MR1.js} +1 -1
  123. package/package.json +6 -1
  124. package/dist/CedrosContext-7dwmEeUY.js +0 -6
  125. package/dist/SettingsSection-D_pKPRrP.js +0 -1
  126. package/dist/Token22Section-Cmn2lKcd.mjs +0 -1685
  127. package/dist/Token22Section-D3nnUyim.js +0 -1
  128. package/dist/index-vEe2Y39x.js +0 -84
  129. package/dist/sections-Dt6vxDU4.mjs +0 -8
  130. package/dist/styles-21F1-oqx.js +0 -1
@@ -1,37 +1,37 @@
1
- import { jsx as K } from "react/jsx-runtime";
2
- import { useContext as ne, createContext as Ae, useState as N, useRef as ge, useEffect as I, useMemo as ee } from "react";
3
- import { g as S } from "./uuid-_z3jSatJ.mjs";
4
- var we = "https://js.stripe.com/v3", qe = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
5
- var je = function() {
6
- for (var e = document.querySelectorAll('script[src^="'.concat(we, '"]')), r = 0; r < e.length; r++) {
1
+ import { jsx as J } from "react/jsx-runtime";
2
+ import { useContext as se, useState as U, useRef as ve, useEffect as F, useMemo as ae, createContext as Ee } from "react";
3
+ import { g as k } from "./uuid-_z3jSatJ.mjs";
4
+ var Ce = "https://js.stripe.com/v3", Qe = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
5
+ var We = function() {
6
+ for (var e = document.querySelectorAll('script[src^="'.concat(Ce, '"]')), r = 0; r < e.length; r++) {
7
7
  var a = e[r];
8
- if (qe.test(a.src))
8
+ if (Qe.test(a.src))
9
9
  return a;
10
10
  }
11
11
  return null;
12
- }, ce = function(e) {
12
+ }, de = function(e) {
13
13
  var r = "", a = document.createElement("script");
14
- a.src = "".concat(we).concat(r);
14
+ a.src = "".concat(Ce).concat(r);
15
15
  var n = document.head || document.body;
16
16
  if (!n)
17
17
  throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
18
18
  return n.appendChild(a), a;
19
- }, ze = function(e, r) {
19
+ }, Ke = function(e, r) {
20
20
  !e || !e._registerWrapper || e._registerWrapper({
21
21
  name: "stripe-js",
22
22
  version: "4.6.0",
23
23
  startTime: r
24
24
  });
25
- }, H = null, z = null, Q = null, Qe = function(e) {
25
+ }, q = null, W = null, K = null, Ge = function(e) {
26
26
  return function() {
27
27
  e(new Error("Failed to load Stripe.js"));
28
28
  };
29
- }, We = function(e, r) {
29
+ }, Ve = function(e, r) {
30
30
  return function() {
31
31
  window.Stripe ? e(window.Stripe) : r(new Error("Stripe.js not available"));
32
32
  };
33
- }, Ke = function(e) {
34
- return H !== null ? H : (H = new Promise(function(r, a) {
33
+ }, Je = function(e) {
34
+ return q !== null ? q : (q = new Promise(function(r, a) {
35
35
  if (typeof window > "u" || typeof document > "u") {
36
36
  r(null);
37
37
  return;
@@ -41,48 +41,48 @@ var je = function() {
41
41
  return;
42
42
  }
43
43
  try {
44
- var n = je();
44
+ var n = We();
45
45
  if (!(n && e)) {
46
46
  if (!n)
47
- n = ce(e);
48
- else if (n && Q !== null && z !== null) {
47
+ n = de(e);
48
+ else if (n && K !== null && W !== null) {
49
49
  var i;
50
- n.removeEventListener("load", Q), n.removeEventListener("error", z), (i = n.parentNode) === null || i === void 0 || i.removeChild(n), n = ce(e);
50
+ n.removeEventListener("load", K), n.removeEventListener("error", W), (i = n.parentNode) === null || i === void 0 || i.removeChild(n), n = de(e);
51
51
  }
52
52
  }
53
- Q = We(r, a), z = Qe(a), n.addEventListener("load", Q), n.addEventListener("error", z);
53
+ K = Ve(r, a), W = Ge(a), n.addEventListener("load", K), n.addEventListener("error", W);
54
54
  } catch (o) {
55
55
  a(o);
56
56
  return;
57
57
  }
58
- }), H.catch(function(r) {
59
- return H = null, Promise.reject(r);
58
+ }), q.catch(function(r) {
59
+ return q = null, Promise.reject(r);
60
60
  }));
61
- }, Ge = function(e, r, a) {
61
+ }, Ye = function(e, r, a) {
62
62
  if (e === null)
63
63
  return null;
64
64
  var n = e.apply(void 0, r);
65
- return ze(n, a), n;
66
- }, L, be = !1, ve = function() {
67
- return L || (L = Ke(null).catch(function(e) {
68
- return L = null, Promise.reject(e);
69
- }), L);
65
+ return Ke(n, a), n;
66
+ }, j, Pe = !1, Se = function() {
67
+ return j || (j = Je(null).catch(function(e) {
68
+ return j = null, Promise.reject(e);
69
+ }), j);
70
70
  };
71
71
  Promise.resolve().then(function() {
72
- return ve();
72
+ return Se();
73
73
  }).catch(function(t) {
74
- be || console.warn(t);
74
+ Pe || console.warn(t);
75
75
  });
76
- var Ce = function() {
76
+ var Te = function() {
77
77
  for (var e = arguments.length, r = new Array(e), a = 0; a < e; a++)
78
78
  r[a] = arguments[a];
79
- be = !0;
79
+ Pe = !0;
80
80
  var n = Date.now();
81
- return ve().then(function(i) {
82
- return Ge(i, r, n);
81
+ return Se().then(function(i) {
82
+ return Ye(i, r, n);
83
83
  });
84
- }, Ve = /* @__PURE__ */ ((t) => (t[t.DEBUG = 0] = "DEBUG", t[t.INFO = 1] = "INFO", t[t.WARN = 2] = "WARN", t[t.ERROR = 3] = "ERROR", t[t.SILENT = 4] = "SILENT", t))(Ve || {});
85
- class Ee {
84
+ }, $e = /* @__PURE__ */ ((t) => (t[t.DEBUG = 0] = "DEBUG", t[t.INFO = 1] = "INFO", t[t.WARN = 2] = "WARN", t[t.ERROR = 3] = "ERROR", t[t.SILENT = 4] = "SILENT", t))($e || {});
85
+ class xe {
86
86
  config;
87
87
  constructor(e) {
88
88
  this.config = e;
@@ -135,24 +135,24 @@ class Ee {
135
135
  r(`[${i}] ${n}[${e}]`, ...a);
136
136
  }
137
137
  }
138
- const Je = () => typeof process < "u" && process.env.NODE_ENV === "development" ? 0 : 2;
139
- let G = null;
138
+ const Xe = () => typeof process < "u" && process.env.NODE_ENV === "development" ? 0 : 2;
139
+ let Y = null;
140
140
  function l() {
141
- return G || (G = new Ee({
142
- level: Je(),
141
+ return Y || (Y = new xe({
142
+ level: Xe(),
143
143
  prefix: "[CedrosPay]"
144
- })), G;
144
+ })), Y;
145
145
  }
146
- function Ye(t) {
147
- G = t;
146
+ function Ze(t) {
147
+ Y = t;
148
148
  }
149
- function Xe(t) {
150
- return new Ee(t);
149
+ function et(t) {
150
+ return new xe(t);
151
151
  }
152
- function k(t, e) {
152
+ function O(t, e) {
153
153
  return t instanceof Error ? t.message : typeof t == "string" ? t : e;
154
154
  }
155
- const Ze = {
155
+ const tt = {
156
156
  service_unavailable: "Service temporarily unavailable. Please try again later or contact support.",
157
157
  server_insufficient_funds: "Service temporarily unavailable. Please try again later or contact support.",
158
158
  insufficient_funds_token: "Insufficient token balance in your wallet. Please add more tokens and try again.",
@@ -162,14 +162,14 @@ const Ze = {
162
162
  send_failed: "Failed to send transaction. Please try again or contact support.",
163
163
  timeout: "Transaction timed out. Please check the blockchain explorer or try again."
164
164
  };
165
- async function g(t, e, r = !1) {
165
+ async function w(t, e, r = !1) {
166
166
  const a = typeof t.clone == "function", n = a ? t.clone() : void 0;
167
167
  try {
168
168
  const i = await t.json();
169
169
  if (r && i.verificationError) {
170
170
  l().debug(`Payment verification failed: ${i.verificationError.code}`);
171
171
  const o = i.verificationError.code;
172
- return Ze[o] || i.verificationError.message || e;
172
+ return tt[o] || i.verificationError.message || e;
173
173
  }
174
174
  return typeof i.error == "string" ? i.error : i.error && typeof i.error == "object" && "message" in i.error ? i.error.message : e;
175
175
  } catch {
@@ -188,8 +188,8 @@ async function g(t, e, r = !1) {
188
188
  return e;
189
189
  }
190
190
  }
191
- const $e = 15e3;
192
- async function p(t, e = {}, r = $e) {
191
+ const rt = 15e3;
192
+ async function p(t, e = {}, r = rt) {
193
193
  const a = new AbortController(), n = e.signal;
194
194
  if (n?.aborted)
195
195
  throw a.abort(), new DOMException("The operation was aborted", "AbortError");
@@ -207,15 +207,15 @@ async function p(t, e = {}, r = $e) {
207
207
  clearTimeout(i), n && o && n.removeEventListener("abort", o);
208
208
  }
209
209
  }
210
- function R(t) {
210
+ function I(t) {
211
211
  const { maxRequests: e, windowMs: r } = t;
212
212
  let a = e, n = Date.now();
213
213
  const i = e / r;
214
214
  function o() {
215
- const u = Date.now(), y = u - n;
215
+ const h = Date.now(), y = h - n;
216
216
  if (y > 0) {
217
- const f = y * i;
218
- a = Math.min(e, a + f), n = u;
217
+ const d = y * i;
218
+ a = Math.min(e, a + d), n = h;
219
219
  }
220
220
  }
221
221
  function s() {
@@ -224,23 +224,23 @@ function R(t) {
224
224
  function c() {
225
225
  return o(), Math.floor(a);
226
226
  }
227
- function d() {
227
+ function u() {
228
228
  if (o(), a >= 1)
229
229
  return 0;
230
230
  const y = (1 - a) / i;
231
231
  return Math.ceil(y);
232
232
  }
233
- function m() {
233
+ function f() {
234
234
  a = e, n = Date.now();
235
235
  }
236
236
  return {
237
237
  tryConsume: s,
238
238
  getAvailableTokens: c,
239
- getTimeUntilRefill: d,
240
- reset: m
239
+ getTimeUntilRefill: u,
240
+ reset: f
241
241
  };
242
242
  }
243
- const M = {
243
+ const B = {
244
244
  /** 10 requests per minute - recommended for payment requests */
245
245
  PAYMENT: { maxRequests: 10, windowMs: 6e4 },
246
246
  /** 30 requests per minute - for quote fetching */
@@ -250,88 +250,88 @@ const M = {
250
250
  /** 100 requests per minute - permissive for UI interactions */
251
251
  PERMISSIVE: { maxRequests: 100, windowMs: 6e4 }
252
252
  };
253
- var et = /* @__PURE__ */ ((t) => (t.CLOSED = "CLOSED", t.OPEN = "OPEN", t.HALF_OPEN = "HALF_OPEN", t))(et || {});
254
- class A extends Error {
253
+ var at = /* @__PURE__ */ ((t) => (t.CLOSED = "CLOSED", t.OPEN = "OPEN", t.HALF_OPEN = "HALF_OPEN", t))(at || {});
254
+ class g extends Error {
255
255
  constructor(e) {
256
256
  super(e), this.name = "CircuitBreakerOpenError";
257
257
  }
258
258
  }
259
- function j(t) {
259
+ function Q(t) {
260
260
  const { failureThreshold: e, timeout: r, failureWindow: a = r * 2, name: n = "circuit-breaker" } = t;
261
- let i = "CLOSED", o = [], s = 0, c = 0, d = null, m = null, u = null, y = !1;
262
- function f() {
263
- const _ = Date.now() - a;
264
- o = o.filter((P) => P > _);
261
+ let i = "CLOSED", o = [], s = 0, c = 0, u = null, f = null, h = null, y = !1;
262
+ function d() {
263
+ const R = Date.now() - a;
264
+ o = o.filter((C) => C > R);
265
265
  }
266
- function h() {
267
- i === "OPEN" && u !== null && Date.now() >= u && (l().debug(`[CircuitBreaker:${n}] Transitioning OPEN → HALF_OPEN (timeout expired)`), i = "HALF_OPEN", u = null);
266
+ function m() {
267
+ i === "OPEN" && h !== null && Date.now() >= h && (l().debug(`[CircuitBreaker:${n}] Transitioning OPEN → HALF_OPEN (timeout expired)`), i = "HALF_OPEN", h = null);
268
268
  }
269
- function w() {
270
- m = Date.now(), s++, i === "HALF_OPEN" ? (l().debug(`[CircuitBreaker:${n}] Success in HALF_OPEN → CLOSED`), i = "CLOSED", o = []) : i === "CLOSED" && (o = []);
269
+ function A() {
270
+ f = Date.now(), s++, i === "HALF_OPEN" ? (l().debug(`[CircuitBreaker:${n}] Success in HALF_OPEN → CLOSED`), i = "CLOSED", o = []) : i === "CLOSED" && (o = []);
271
271
  }
272
- function C(_) {
273
- const P = Date.now();
274
- d = P, o.push(P), f();
275
- const Y = o.length;
276
- l().warn(`[CircuitBreaker:${n}] Failure recorded (${Y}/${e}):`, _.message), i === "HALF_OPEN" ? (l().warn(`[CircuitBreaker:${n}] Failed in HALF_OPEN → OPEN`), i = "OPEN", u = P + r) : i === "CLOSED" && Y >= e && (l().error(`[CircuitBreaker:${n}] Failure threshold reached (${Y}) → OPEN`), i = "OPEN", u = P + r);
272
+ function b(R) {
273
+ const C = Date.now();
274
+ u = C, o.push(C), d();
275
+ const Z = o.length;
276
+ l().warn(`[CircuitBreaker:${n}] Failure recorded (${Z}/${e}):`, R.message), i === "HALF_OPEN" ? (l().warn(`[CircuitBreaker:${n}] Failed in HALF_OPEN → OPEN`), i = "OPEN", h = C + r) : i === "CLOSED" && Z >= e && (l().error(`[CircuitBreaker:${n}] Failure threshold reached (${Z}) → OPEN`), i = "OPEN", h = C + r);
277
277
  }
278
- async function x(_) {
279
- if (h(), i === "OPEN") {
278
+ async function x(R) {
279
+ if (m(), i === "OPEN") {
280
280
  c++;
281
- const P = u ? Math.ceil((u - Date.now()) / 1e3) : 0;
282
- throw new A(
283
- `Circuit breaker is OPEN. Service is unavailable. Retry in ${P}s.`
281
+ const C = h ? Math.ceil((h - Date.now()) / 1e3) : 0;
282
+ throw new g(
283
+ `Circuit breaker is OPEN. Service is unavailable. Retry in ${C}s.`
284
284
  );
285
285
  }
286
286
  if (i === "HALF_OPEN" && y)
287
- throw c++, new A(
287
+ throw c++, new g(
288
288
  "Circuit breaker is HALF_OPEN. A probe request is already in progress."
289
289
  );
290
290
  i === "HALF_OPEN" && (y = !0);
291
291
  try {
292
- const P = await _();
293
- return w(), P;
294
- } catch (P) {
295
- throw C(P instanceof Error ? P : new Error(String(P))), P;
292
+ const C = await R();
293
+ return A(), C;
294
+ } catch (C) {
295
+ throw b(C instanceof Error ? C : new Error(String(C))), C;
296
296
  } finally {
297
297
  y && (y = !1);
298
298
  }
299
299
  }
300
- function B() {
301
- return h(), i;
300
+ function D() {
301
+ return m(), i;
302
302
  }
303
- function T() {
304
- return h(), f(), {
303
+ function M() {
304
+ return m(), d(), {
305
305
  state: i,
306
306
  failures: o.length,
307
307
  successes: s,
308
308
  rejections: c,
309
- lastFailureTime: d,
310
- lastSuccessTime: m
309
+ lastFailureTime: u,
310
+ lastSuccessTime: f
311
311
  };
312
312
  }
313
- function D() {
314
- l().debug(`[CircuitBreaker:${n}] Manual reset → CLOSED`), i = "CLOSED", o = [], s = 0, c = 0, d = null, m = null, u = null;
313
+ function S() {
314
+ l().debug(`[CircuitBreaker:${n}] Manual reset → CLOSED`), i = "CLOSED", o = [], s = 0, c = 0, u = null, f = null, h = null;
315
315
  }
316
- function Le() {
317
- l().warn(`[CircuitBreaker:${n}] Manual trip → OPEN`), i = "OPEN", u = Date.now() + r;
316
+ function _() {
317
+ l().warn(`[CircuitBreaker:${n}] Manual trip → OPEN`), i = "OPEN", h = Date.now() + r;
318
318
  }
319
319
  return {
320
320
  execute: x,
321
- getState: B,
322
- getStats: T,
323
- reset: D,
324
- trip: Le
321
+ getState: D,
322
+ getStats: M,
323
+ reset: S,
324
+ trip: _
325
325
  };
326
326
  }
327
- const Qt = {
327
+ const Yt = {
328
328
  /** Strict: Opens quickly (3 failures), long timeout (60s) */
329
329
  STRICT: { failureThreshold: 3, timeout: 6e4 },
330
330
  /** Standard: Balanced settings (5 failures, 30s timeout) */
331
331
  STANDARD: { failureThreshold: 5, timeout: 3e4 },
332
332
  /** Lenient: Tolerates more failures (10 failures, 15s timeout) */
333
333
  LENIENT: { failureThreshold: 10, timeout: 15e3 }
334
- }, tt = {
334
+ }, nt = {
335
335
  // ===== PAYMENT VERIFICATION ERRORS (402) =====
336
336
  invalid_payment_proof: {
337
337
  message: "Payment verification failed",
@@ -584,14 +584,14 @@ const Qt = {
584
584
  technicalHint: "Server misconfiguration"
585
585
  }
586
586
  };
587
- function rt(t) {
588
- return tt[t] || {
587
+ function it(t) {
588
+ return nt[t] || {
589
589
  message: "An unexpected error occurred",
590
590
  action: "Please try again or contact support if this continues.",
591
591
  technicalHint: `Unknown error code: ${t}`
592
592
  };
593
593
  }
594
- class O extends Error {
594
+ class N extends Error {
595
595
  /** Machine-readable error code enum */
596
596
  code;
597
597
  /** Whether this error can be safely retried */
@@ -601,7 +601,7 @@ class O extends Error {
601
601
  /** HTTP status code (if from API response) */
602
602
  httpStatus;
603
603
  constructor(e, r, a = !1, n, i) {
604
- super(r), this.name = "PaymentError", this.code = e, this.retryable = a, this.details = n, this.httpStatus = i, Object.setPrototypeOf(this, O.prototype);
604
+ super(r), this.name = "PaymentError", this.code = e, this.retryable = a, this.details = n, this.httpStatus = i, Object.setPrototypeOf(this, N.prototype);
605
605
  }
606
606
  /**
607
607
  * Check if this error is retryable
@@ -646,7 +646,7 @@ class O extends Error {
646
646
  * @private
647
647
  */
648
648
  getErrorInfo() {
649
- return rt(this.code);
649
+ return it(this.code);
650
650
  }
651
651
  /**
652
652
  * Create PaymentError from API error response
@@ -655,8 +655,8 @@ class O extends Error {
655
655
  * from error codes using ERROR_CATEGORIES.RETRYABLE.
656
656
  */
657
657
  static fromErrorResponse(e, r) {
658
- const a = e.error.retryable ?? at.RETRYABLE.includes(e.error.code);
659
- return new O(
658
+ const a = e.error.retryable ?? ot.RETRYABLE.includes(e.error.code);
659
+ return new N(
660
660
  e.error.code,
661
661
  e.error.message,
662
662
  a,
@@ -669,18 +669,18 @@ class O extends Error {
669
669
  * Useful for catch blocks where error type is unknown
670
670
  */
671
671
  static fromUnknown(e) {
672
- return e instanceof O ? e : e instanceof Error ? new O(
672
+ return e instanceof N ? e : e instanceof Error ? new N(
673
673
  "internal_error",
674
674
  e.message,
675
675
  !1
676
- ) : new O(
676
+ ) : new N(
677
677
  "internal_error",
678
678
  String(e),
679
679
  !1
680
680
  );
681
681
  }
682
682
  }
683
- const at = {
683
+ const ot = {
684
684
  /** Insufficient funds errors requiring user to add funds */
685
685
  INSUFFICIENT_FUNDS: [
686
686
  "insufficient_funds_sol",
@@ -747,54 +747,105 @@ const at = {
747
747
  "nonce_already_used"
748
748
  /* NONCE_ALREADY_USED */
749
749
  ]
750
- };
751
- function nt(t, e) {
752
- if (t instanceof O && t.httpStatus != null) {
753
- const a = t.httpStatus;
754
- return a === 429 || a >= 500 && a < 600;
750
+ }, fe = 300 * 1e3, G = /* @__PURE__ */ new Map();
751
+ function st(t) {
752
+ if (!t)
753
+ return;
754
+ const e = Number(t);
755
+ if (Number.isFinite(e) && e >= 0)
756
+ return Math.min(e * 1e3, fe);
757
+ const r = Date.parse(t);
758
+ if (!Number.isNaN(r))
759
+ return Math.min(Math.max(r - Date.now(), 0), fe);
760
+ }
761
+ class T extends Error {
762
+ httpStatus;
763
+ retryAfterMs;
764
+ constructor(e, r, a) {
765
+ super(e), this.name = "RetryableHttpError", this.httpStatus = r, this.retryAfterMs = a, Object.setPrototypeOf(this, T.prototype);
766
+ }
767
+ static fromResponse(e, r) {
768
+ const a = e.headers && typeof e.headers.get == "function" ? e.headers.get("Retry-After") : null;
769
+ return new T(
770
+ r,
771
+ e.status,
772
+ st(a)
773
+ );
755
774
  }
756
- const r = t.message.toLowerCase();
757
- return !!(r.includes("network") || r.includes("timeout") || r.includes("fetch failed") || r.includes("econnrefused"));
758
775
  }
759
- function it(t, e, r, a, n) {
776
+ function ct(t) {
777
+ if (t instanceof N || t instanceof T)
778
+ return t.httpStatus;
779
+ }
780
+ function lt(t) {
781
+ if (t instanceof T)
782
+ return t.retryAfterMs;
783
+ }
784
+ function ut(t, e) {
785
+ const r = ct(t);
786
+ if (r != null) {
787
+ const n = r;
788
+ return n === 429 || n >= 500 && n < 600;
789
+ }
790
+ const a = t.message.toLowerCase();
791
+ return !!(a.includes("network") || a.includes("timeout") || a.includes("fetch failed") || a.includes("econnrefused"));
792
+ }
793
+ function dt(t, e, r, a, n) {
760
794
  const i = e * Math.pow(r, t), o = Math.min(i, a);
761
795
  return Math.floor(n ? o * 0.5 + Math.random() * o * 0.5 : o);
762
796
  }
763
- function ot(t) {
797
+ function ft(t) {
764
798
  return new Promise((e) => setTimeout(e, t));
765
799
  }
766
- async function b(t, e = {}) {
800
+ async function E(t, e = {}) {
767
801
  const {
768
802
  maxRetries: r = 3,
769
803
  initialDelayMs: a = 1e3,
770
804
  backoffFactor: n = 2,
771
805
  maxDelayMs: i = 3e4,
772
806
  jitter: o = !0,
773
- shouldRetry: s = nt,
774
- name: c = "retry"
775
- } = e;
776
- let d = null, m = 0;
777
- for (let u = 0; u <= r; u++)
778
- try {
779
- const y = await t();
780
- return u > 0 && l().debug(
781
- `[Retry:${c}] Succeeded on attempt ${u + 1}/${r + 1} after ${m}ms`
782
- ), y;
783
- } catch (y) {
784
- d = y instanceof Error ? y : new Error(String(y));
785
- const f = u === r, h = s(d, u);
786
- if (f || !h)
787
- throw l().warn(
788
- `[Retry:${c}] Failed on attempt ${u + 1}/${r + 1}. ${f ? "No more retries." : "Error not retryable."}`
789
- ), d;
790
- const w = it(u, a, n, i, o);
791
- m += w, l().warn(
792
- `[Retry:${c}] Attempt ${u + 1}/${r + 1} failed: ${d.message}. Retrying in ${w}ms...`
793
- ), await ot(w);
794
- }
795
- throw d || new Error("Retry failed with no error");
807
+ shouldRetry: s = ut,
808
+ name: c = "retry",
809
+ inFlightKey: u
810
+ } = e, f = async () => {
811
+ let d = null, m = 0;
812
+ for (let A = 0; A <= r; A++)
813
+ try {
814
+ const b = await t();
815
+ return A > 0 && l().debug(
816
+ `[Retry:${c}] Succeeded on attempt ${A + 1}/${r + 1} after ${m}ms`
817
+ ), b;
818
+ } catch (b) {
819
+ d = b instanceof Error ? b : new Error(String(b));
820
+ const x = A === r, D = s(d, A);
821
+ if (x || !D)
822
+ throw l().warn(
823
+ `[Retry:${c}] Failed on attempt ${A + 1}/${r + 1}. ${x ? "No more retries." : "Error not retryable."}`
824
+ ), d;
825
+ const S = lt(d) ?? dt(
826
+ A,
827
+ a,
828
+ n,
829
+ i,
830
+ o
831
+ );
832
+ m += S, l().warn(
833
+ `[Retry:${c}] Attempt ${A + 1}/${r + 1} failed: ${d.message}. Retrying in ${S}ms...`
834
+ ), await ft(S);
835
+ }
836
+ throw d || new Error("Retry failed with no error");
837
+ };
838
+ if (!u)
839
+ return f();
840
+ const h = G.get(u);
841
+ if (h)
842
+ return h;
843
+ const y = f().finally(() => {
844
+ G.get(u) === y && G.delete(u);
845
+ });
846
+ return G.set(u, y), y;
796
847
  }
797
- const E = {
848
+ const v = {
798
849
  /** Quick retries for transient errors (3 retries, 1s initial, 2x backoff) */
799
850
  QUICK: {
800
851
  maxRetries: 3,
@@ -822,22 +873,37 @@ const E = {
822
873
  initialDelayMs: 5e3,
823
874
  backoffFactor: 2,
824
875
  maxDelayMs: 6e4
876
+ },
877
+ /** At most one retry for writes with a real idempotency guarantee */
878
+ IDEMPOTENT_WRITE: {
879
+ maxRetries: 1,
880
+ initialDelayMs: 1e3,
881
+ backoffFactor: 2,
882
+ maxDelayMs: 1e4
883
+ },
884
+ /** Never automatically retry non-idempotent writes */
885
+ WRITE_ONCE: {
886
+ maxRetries: 0,
887
+ initialDelayMs: 1e3,
888
+ backoffFactor: 2,
889
+ maxDelayMs: 1e4
825
890
  }
826
891
  };
827
- class st {
892
+ class ht {
828
893
  stripe = null;
829
894
  initPromise = null;
830
895
  publicKey;
831
896
  routeDiscovery;
832
- rateLimiter = R(M.PAYMENT);
833
- circuitBreaker = j({
897
+ complianceCheckEnabled;
898
+ rateLimiter = I(B.PAYMENT);
899
+ circuitBreaker = Q({
834
900
  failureThreshold: 5,
835
901
  timeout: 1e4,
836
902
  // 10 seconds for faster recovery in payment flows
837
903
  name: "stripe-manager"
838
904
  });
839
- constructor(e, r) {
840
- this.publicKey = e, this.routeDiscovery = r;
905
+ constructor(e, r, a = !1) {
906
+ this.publicKey = e, this.routeDiscovery = r, this.complianceCheckEnabled = a;
841
907
  }
842
908
  /**
843
909
  * Initialize Stripe.js library
@@ -847,7 +913,7 @@ class st {
847
913
  async initialize() {
848
914
  this.stripe || (this.initPromise || (this.initPromise = (async () => {
849
915
  try {
850
- if (this.stripe = await Ce(this.publicKey), !this.stripe) throw new Error("Failed to initialize Stripe");
916
+ if (this.stripe = await Te(this.publicKey), !this.stripe) throw new Error("Failed to initialize Stripe");
851
917
  } catch (e) {
852
918
  throw this.initPromise = null, e;
853
919
  }
@@ -859,35 +925,39 @@ class st {
859
925
  async createSession(e) {
860
926
  if (!this.rateLimiter.tryConsume())
861
927
  throw new Error("Rate limit exceeded for Stripe session creation. Please try again later.");
862
- const r = S();
928
+ const r = k(), a = JSON.stringify(e);
863
929
  try {
864
- return await this.circuitBreaker.execute(async () => await b(
930
+ return await this.circuitBreaker.execute(async () => await E(
865
931
  async () => {
866
- const a = await this.routeDiscovery.buildUrl("/paywall/v1/stripe-session");
932
+ const n = await this.routeDiscovery.buildUrl("/paywall/v1/stripe-session");
867
933
  l().debug("[StripeManager] Creating session", {
868
934
  resource: e.resource,
869
935
  hasCouponCode: !!e.couponCode,
870
936
  hasMetadata: !!(e.metadata && Object.keys(e.metadata).length),
871
937
  metadataKeyCount: e.metadata ? Object.keys(e.metadata).length : 0
872
938
  });
873
- const n = await p(a, {
939
+ const i = await p(n, {
874
940
  method: "POST",
875
941
  headers: {
876
942
  "Content-Type": "application/json",
877
943
  "Idempotency-Key": r
878
944
  },
879
- body: JSON.stringify(e)
945
+ body: a
880
946
  });
881
- if (!n.ok) {
882
- const i = await g(n, "Failed to create Stripe session");
883
- throw new Error(i);
947
+ if (!i.ok) {
948
+ const o = await w(i, "Failed to create Stripe session");
949
+ throw T.fromResponse(i, o);
884
950
  }
885
- return await n.json();
951
+ return await i.json();
886
952
  },
887
- { ...E.STANDARD, name: "stripe-create-session" }
953
+ {
954
+ ...v.IDEMPOTENT_WRITE,
955
+ name: "stripe-create-session",
956
+ inFlightKey: `stripe:create-session:${a}`
957
+ }
888
958
  ));
889
- } catch (a) {
890
- throw a instanceof A ? (l().error("[StripeManager] Circuit breaker is OPEN - Stripe service unavailable"), new Error("Stripe payment service is temporarily unavailable. Please try again in a few moments.")) : a;
959
+ } catch (n) {
960
+ throw n instanceof g ? (l().error("[StripeManager] Circuit breaker is OPEN - Stripe service unavailable"), new Error("Stripe payment service is temporarily unavailable. Please try again in a few moments.")) : n;
891
961
  }
892
962
  }
893
963
  /**
@@ -905,17 +975,40 @@ class st {
905
975
  error: r.error.message
906
976
  } : { success: !0 };
907
977
  }
978
+ /**
979
+ * Run a pre-flight compliance check for the given resources.
980
+ * Returns null if cleared, or a PaymentResult with the block reasons.
981
+ */
982
+ async runComplianceCheck(e) {
983
+ if (!this.complianceCheckEnabled) return null;
984
+ try {
985
+ const r = await this.routeDiscovery.buildUrl("/paywall/v1/compliance-check"), a = await p(r, {
986
+ method: "POST",
987
+ headers: { "Content-Type": "application/json" },
988
+ body: JSON.stringify({ resources: e })
989
+ });
990
+ if (!a.ok) return null;
991
+ const n = await a.json();
992
+ if (!n.cleared)
993
+ return { success: !1, error: `Purchase blocked: ${(n.reasons ?? ["Purchase blocked by compliance check"]).join("; ")}` };
994
+ } catch {
995
+ l().warn("[StripeManager] Compliance pre-check failed, proceeding");
996
+ }
997
+ return null;
998
+ }
908
999
  /**
909
1000
  * Handle complete payment flow: create session and redirect
910
1001
  */
911
1002
  async processPayment(e) {
912
1003
  try {
913
- const r = await this.createSession(e);
914
- return await this.redirectToCheckout(r.sessionId);
1004
+ const r = await this.runComplianceCheck([e.resource]);
1005
+ if (r) return r;
1006
+ const a = await this.createSession(e);
1007
+ return await this.redirectToCheckout(a.sessionId);
915
1008
  } catch (r) {
916
1009
  return {
917
1010
  success: !1,
918
- error: k(r, "Unknown error")
1011
+ error: O(r, "Unknown error")
919
1012
  };
920
1013
  }
921
1014
  }
@@ -931,171 +1024,174 @@ class st {
931
1024
  customerEmail: o,
932
1025
  customerName: s,
933
1026
  customerPhone: c,
934
- shippingAddress: d,
935
- billingAddress: m,
936
- couponCode: u,
1027
+ shippingAddress: u,
1028
+ billingAddress: f,
1029
+ couponCode: h,
937
1030
  tipAmount: y,
938
- shippingMethodId: f,
939
- paymentMethodId: h
940
- } = e;
1031
+ shippingMethodId: d,
1032
+ paymentMethodId: m
1033
+ } = e, A = r.map((S) => S.resource), b = await this.runComplianceCheck(A);
1034
+ if (b) return b;
941
1035
  if (!this.rateLimiter.tryConsume())
942
1036
  return {
943
1037
  success: !1,
944
1038
  error: "Rate limit exceeded for cart checkout. Please try again later."
945
1039
  };
946
- const w = S();
1040
+ const x = k(), M = JSON.stringify({
1041
+ items: r,
1042
+ successUrl: a,
1043
+ cancelUrl: n,
1044
+ metadata: i,
1045
+ customerEmail: o,
1046
+ customerName: s,
1047
+ customerPhone: c,
1048
+ shippingAddress: u,
1049
+ billingAddress: f,
1050
+ coupon: h,
1051
+ couponCode: h,
1052
+ tipAmount: y,
1053
+ shippingMethodId: d,
1054
+ paymentMethodId: m
1055
+ });
947
1056
  try {
948
- const C = await this.circuitBreaker.execute(async () => await b(
1057
+ const S = await this.circuitBreaker.execute(async () => await E(
949
1058
  async () => {
950
- const x = await this.routeDiscovery.buildUrl("/paywall/v1/cart/checkout"), T = await p(x, {
1059
+ const _ = await this.routeDiscovery.buildUrl("/paywall/v1/cart/checkout"), R = await p(_, {
951
1060
  method: "POST",
952
1061
  headers: {
953
1062
  "Content-Type": "application/json",
954
- "Idempotency-Key": w
1063
+ "Idempotency-Key": x
955
1064
  },
956
- body: JSON.stringify({
957
- items: r,
958
- successUrl: a,
959
- cancelUrl: n,
960
- metadata: i,
961
- customerEmail: o,
962
- customerName: s,
963
- customerPhone: c,
964
- shippingAddress: d,
965
- billingAddress: m,
966
- coupon: u,
967
- // New Rust server field
968
- couponCode: u,
969
- // Legacy Go server field (backwards compat)
970
- tipAmount: y,
971
- shippingMethodId: f,
972
- paymentMethodId: h
973
- })
1065
+ body: M
974
1066
  });
975
- if (!T.ok) {
976
- const D = await g(T, "Failed to create cart checkout session");
977
- throw new Error(D);
1067
+ if (!R.ok) {
1068
+ const C = await w(R, "Failed to create cart checkout session");
1069
+ throw T.fromResponse(R, C);
978
1070
  }
979
- return await T.json();
1071
+ return await R.json();
980
1072
  },
981
- { ...E.STANDARD, name: "stripe-cart-checkout" }
1073
+ {
1074
+ ...v.IDEMPOTENT_WRITE,
1075
+ name: "stripe-cart-checkout",
1076
+ inFlightKey: `stripe:cart-checkout:${M}`
1077
+ }
982
1078
  ));
983
- return await this.redirectToCheckout(C.sessionId);
984
- } catch (C) {
985
- return C instanceof A ? {
1079
+ return await this.redirectToCheckout(S.sessionId);
1080
+ } catch (S) {
1081
+ return S instanceof g ? {
986
1082
  success: !1,
987
1083
  error: "Stripe payment service is temporarily unavailable. Please try again in a few moments."
988
1084
  } : {
989
1085
  success: !1,
990
- error: k(C, "Cart checkout failed")
1086
+ error: O(S, "Cart checkout failed")
991
1087
  };
992
1088
  }
993
1089
  }
994
1090
  }
995
- const Pe = "3.7.8", ct = Pe, F = typeof Buffer == "function", le = typeof TextDecoder == "function" ? new TextDecoder() : void 0, ue = typeof TextEncoder == "function" ? new TextEncoder() : void 0, lt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", q = Array.prototype.slice.call(lt), W = ((t) => {
1091
+ const ke = "3.7.8", mt = ke, L = typeof Buffer == "function", he = typeof TextDecoder == "function" ? new TextDecoder() : void 0, me = typeof TextEncoder == "function" ? new TextEncoder() : void 0, yt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", z = Array.prototype.slice.call(yt), V = ((t) => {
996
1092
  let e = {};
997
1093
  return t.forEach((r, a) => e[r] = a), e;
998
- })(q), ut = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, v = String.fromCharCode.bind(String), de = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (t) => new Uint8Array(Array.prototype.slice.call(t, 0)), Se = (t) => t.replace(/=/g, "").replace(/[+\/]/g, (e) => e == "+" ? "-" : "_"), xe = (t) => t.replace(/[^A-Za-z0-9\+\/]/g, ""), Te = (t) => {
1094
+ })(z), pt = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, P = String.fromCharCode.bind(String), ye = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (t) => new Uint8Array(Array.prototype.slice.call(t, 0)), Re = (t) => t.replace(/=/g, "").replace(/[+\/]/g, (e) => e == "+" ? "-" : "_"), Me = (t) => t.replace(/[^A-Za-z0-9\+\/]/g, ""), De = (t) => {
999
1095
  let e, r, a, n, i = "";
1000
1096
  const o = t.length % 3;
1001
1097
  for (let s = 0; s < t.length; ) {
1002
1098
  if ((r = t.charCodeAt(s++)) > 255 || (a = t.charCodeAt(s++)) > 255 || (n = t.charCodeAt(s++)) > 255)
1003
1099
  throw new TypeError("invalid character found");
1004
- e = r << 16 | a << 8 | n, i += q[e >> 18 & 63] + q[e >> 12 & 63] + q[e >> 6 & 63] + q[e & 63];
1100
+ e = r << 16 | a << 8 | n, i += z[e >> 18 & 63] + z[e >> 12 & 63] + z[e >> 6 & 63] + z[e & 63];
1005
1101
  }
1006
1102
  return o ? i.slice(0, o - 3) + "===".substring(o) : i;
1007
- }, ie = typeof btoa == "function" ? (t) => btoa(t) : F ? (t) => Buffer.from(t, "binary").toString("base64") : Te, te = F ? (t) => Buffer.from(t).toString("base64") : (t) => {
1103
+ }, ce = typeof btoa == "function" ? (t) => btoa(t) : L ? (t) => Buffer.from(t, "binary").toString("base64") : De, ne = L ? (t) => Buffer.from(t).toString("base64") : (t) => {
1008
1104
  let r = [];
1009
1105
  for (let a = 0, n = t.length; a < n; a += 4096)
1010
- r.push(v.apply(null, t.subarray(a, a + 4096)));
1011
- return ie(r.join(""));
1012
- }, V = (t, e = !1) => e ? Se(te(t)) : te(t), dt = (t) => {
1106
+ r.push(P.apply(null, t.subarray(a, a + 4096)));
1107
+ return ce(r.join(""));
1108
+ }, $ = (t, e = !1) => e ? Re(ne(t)) : ne(t), At = (t) => {
1013
1109
  if (t.length < 2) {
1014
1110
  var e = t.charCodeAt(0);
1015
- return e < 128 ? t : e < 2048 ? v(192 | e >>> 6) + v(128 | e & 63) : v(224 | e >>> 12 & 15) + v(128 | e >>> 6 & 63) + v(128 | e & 63);
1111
+ return e < 128 ? t : e < 2048 ? P(192 | e >>> 6) + P(128 | e & 63) : P(224 | e >>> 12 & 15) + P(128 | e >>> 6 & 63) + P(128 | e & 63);
1016
1112
  } else {
1017
1113
  var e = 65536 + (t.charCodeAt(0) - 55296) * 1024 + (t.charCodeAt(1) - 56320);
1018
- return v(240 | e >>> 18 & 7) + v(128 | e >>> 12 & 63) + v(128 | e >>> 6 & 63) + v(128 | e & 63);
1114
+ return P(240 | e >>> 18 & 7) + P(128 | e >>> 12 & 63) + P(128 | e >>> 6 & 63) + P(128 | e & 63);
1019
1115
  }
1020
- }, ft = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, ke = (t) => t.replace(ft, dt), fe = F ? (t) => Buffer.from(t, "utf8").toString("base64") : ue ? (t) => te(ue.encode(t)) : (t) => ie(ke(t)), U = (t, e = !1) => e ? Se(fe(t)) : fe(t), he = (t) => U(t, !0), ht = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, mt = (t) => {
1116
+ }, gt = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, Oe = (t) => t.replace(gt, At), pe = L ? (t) => Buffer.from(t, "utf8").toString("base64") : me ? (t) => ne(me.encode(t)) : (t) => ce(Oe(t)), H = (t, e = !1) => e ? Re(pe(t)) : pe(t), Ae = (t) => H(t, !0), wt = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, bt = (t) => {
1021
1117
  switch (t.length) {
1022
1118
  case 4:
1023
1119
  var e = (7 & t.charCodeAt(0)) << 18 | (63 & t.charCodeAt(1)) << 12 | (63 & t.charCodeAt(2)) << 6 | 63 & t.charCodeAt(3), r = e - 65536;
1024
- return v((r >>> 10) + 55296) + v((r & 1023) + 56320);
1120
+ return P((r >>> 10) + 55296) + P((r & 1023) + 56320);
1025
1121
  case 3:
1026
- return v((15 & t.charCodeAt(0)) << 12 | (63 & t.charCodeAt(1)) << 6 | 63 & t.charCodeAt(2));
1122
+ return P((15 & t.charCodeAt(0)) << 12 | (63 & t.charCodeAt(1)) << 6 | 63 & t.charCodeAt(2));
1027
1123
  default:
1028
- return v((31 & t.charCodeAt(0)) << 6 | 63 & t.charCodeAt(1));
1124
+ return P((31 & t.charCodeAt(0)) << 6 | 63 & t.charCodeAt(1));
1029
1125
  }
1030
- }, Re = (t) => t.replace(ht, mt), Me = (t) => {
1031
- if (t = t.replace(/\s+/g, ""), !ut.test(t))
1126
+ }, Ie = (t) => t.replace(wt, bt), Be = (t) => {
1127
+ if (t = t.replace(/\s+/g, ""), !pt.test(t))
1032
1128
  throw new TypeError("malformed base64.");
1033
1129
  t += "==".slice(2 - (t.length & 3));
1034
1130
  let e, r, a, n = [];
1035
1131
  for (let i = 0; i < t.length; )
1036
- e = W[t.charAt(i++)] << 18 | W[t.charAt(i++)] << 12 | (r = W[t.charAt(i++)]) << 6 | (a = W[t.charAt(i++)]), r === 64 ? n.push(v(e >> 16 & 255)) : a === 64 ? n.push(v(e >> 16 & 255, e >> 8 & 255)) : n.push(v(e >> 16 & 255, e >> 8 & 255, e & 255));
1132
+ e = V[t.charAt(i++)] << 18 | V[t.charAt(i++)] << 12 | (r = V[t.charAt(i++)]) << 6 | (a = V[t.charAt(i++)]), r === 64 ? n.push(P(e >> 16 & 255)) : a === 64 ? n.push(P(e >> 16 & 255, e >> 8 & 255)) : n.push(P(e >> 16 & 255, e >> 8 & 255, e & 255));
1037
1133
  return n.join("");
1038
- }, oe = typeof atob == "function" ? (t) => atob(xe(t)) : F ? (t) => Buffer.from(t, "base64").toString("binary") : Me, De = F ? (t) => de(Buffer.from(t, "base64")) : (t) => de(oe(t).split("").map((e) => e.charCodeAt(0))), Oe = (t) => De(Be(t)), yt = F ? (t) => Buffer.from(t, "base64").toString("utf8") : le ? (t) => le.decode(De(t)) : (t) => Re(oe(t)), Be = (t) => xe(t.replace(/[-_]/g, (e) => e == "-" ? "+" : "/")), re = (t) => yt(Be(t)), pt = (t) => {
1134
+ }, le = typeof atob == "function" ? (t) => atob(Me(t)) : L ? (t) => Buffer.from(t, "base64").toString("binary") : Be, _e = L ? (t) => ye(Buffer.from(t, "base64")) : (t) => ye(le(t).split("").map((e) => e.charCodeAt(0))), Ne = (t) => _e(Fe(t)), vt = L ? (t) => Buffer.from(t, "base64").toString("utf8") : he ? (t) => he.decode(_e(t)) : (t) => Ie(le(t)), Fe = (t) => Me(t.replace(/[-_]/g, (e) => e == "-" ? "+" : "/")), ie = (t) => vt(Fe(t)), Et = (t) => {
1039
1135
  if (typeof t != "string")
1040
1136
  return !1;
1041
1137
  const e = t.replace(/\s+/g, "").replace(/={0,2}$/, "");
1042
1138
  return !/[^\s0-9a-zA-Z\+/]/.test(e) || !/[^\s0-9a-zA-Z\-_]/.test(e);
1043
- }, _e = (t) => ({
1139
+ }, Ue = (t) => ({
1044
1140
  value: t,
1045
1141
  enumerable: !1,
1046
1142
  writable: !0,
1047
1143
  configurable: !0
1048
- }), Ie = function() {
1049
- const t = (e, r) => Object.defineProperty(String.prototype, e, _e(r));
1144
+ }), He = function() {
1145
+ const t = (e, r) => Object.defineProperty(String.prototype, e, Ue(r));
1050
1146
  t("fromBase64", function() {
1051
- return re(this);
1147
+ return ie(this);
1052
1148
  }), t("toBase64", function(e) {
1053
- return U(this, e);
1149
+ return H(this, e);
1054
1150
  }), t("toBase64URI", function() {
1055
- return U(this, !0);
1151
+ return H(this, !0);
1056
1152
  }), t("toBase64URL", function() {
1057
- return U(this, !0);
1153
+ return H(this, !0);
1058
1154
  }), t("toUint8Array", function() {
1059
- return Oe(this);
1155
+ return Ne(this);
1060
1156
  });
1061
- }, Ne = function() {
1062
- const t = (e, r) => Object.defineProperty(Uint8Array.prototype, e, _e(r));
1157
+ }, Le = function() {
1158
+ const t = (e, r) => Object.defineProperty(Uint8Array.prototype, e, Ue(r));
1063
1159
  t("toBase64", function(e) {
1064
- return V(this, e);
1160
+ return $(this, e);
1065
1161
  }), t("toBase64URI", function() {
1066
- return V(this, !0);
1162
+ return $(this, !0);
1067
1163
  }), t("toBase64URL", function() {
1068
- return V(this, !0);
1164
+ return $(this, !0);
1069
1165
  });
1070
- }, At = () => {
1071
- Ie(), Ne();
1072
- }, me = {
1073
- version: Pe,
1074
- VERSION: ct,
1075
- atob: oe,
1076
- atobPolyfill: Me,
1077
- btoa: ie,
1078
- btoaPolyfill: Te,
1079
- fromBase64: re,
1080
- toBase64: U,
1081
- encode: U,
1082
- encodeURI: he,
1083
- encodeURL: he,
1084
- utob: ke,
1085
- btou: Re,
1086
- decode: re,
1087
- isValid: pt,
1088
- fromUint8Array: V,
1089
- toUint8Array: Oe,
1090
- extendString: Ie,
1091
- extendUint8Array: Ne,
1092
- extendBuiltins: At
1166
+ }, Ct = () => {
1167
+ He(), Le();
1168
+ }, ge = {
1169
+ version: ke,
1170
+ VERSION: mt,
1171
+ atob: le,
1172
+ atobPolyfill: Be,
1173
+ btoa: ce,
1174
+ btoaPolyfill: De,
1175
+ fromBase64: ie,
1176
+ toBase64: H,
1177
+ encode: H,
1178
+ encodeURI: Ae,
1179
+ encodeURL: Ae,
1180
+ utob: Oe,
1181
+ btou: Ie,
1182
+ decode: ie,
1183
+ isValid: Et,
1184
+ fromUint8Array: $,
1185
+ toUint8Array: Ne,
1186
+ extendString: He,
1187
+ extendUint8Array: Le,
1188
+ extendBuiltins: Ct
1093
1189
  };
1094
- class gt {
1190
+ class Pt {
1095
1191
  routeDiscovery;
1096
- quoteRateLimiter = R(M.QUOTE);
1097
- verifyRateLimiter = R(M.PAYMENT);
1098
- circuitBreaker = j({
1192
+ quoteRateLimiter = I(B.QUOTE);
1193
+ verifyRateLimiter = I(B.PAYMENT);
1194
+ circuitBreaker = Q({
1099
1195
  failureThreshold: 5,
1100
1196
  timeout: 1e4,
1101
1197
  // 10 seconds for faster recovery in payment flows
@@ -1114,7 +1210,7 @@ class gt {
1114
1210
  if (!this.quoteRateLimiter.tryConsume())
1115
1211
  throw new Error("Rate limit exceeded for quote requests. Please try again later.");
1116
1212
  try {
1117
- return await this.circuitBreaker.execute(async () => await b(
1213
+ return await this.circuitBreaker.execute(async () => await E(
1118
1214
  async () => {
1119
1215
  const n = "/paywall/v1/quote";
1120
1216
  l().debug(
@@ -1147,10 +1243,10 @@ class gt {
1147
1243
  } else
1148
1244
  throw new Error("Invalid x402 response: missing crypto or accepts field");
1149
1245
  },
1150
- { ...E.QUICK, name: "x402-quote" }
1246
+ { ...v.QUICK, name: "x402-quote" }
1151
1247
  ));
1152
1248
  } catch (n) {
1153
- throw n instanceof A ? (l().error("[X402Manager] Circuit breaker is OPEN - x402 service unavailable"), new Error("Payment service is temporarily unavailable. Please try again in a few moments.")) : n;
1249
+ throw n instanceof g ? (l().error("[X402Manager] Circuit breaker is OPEN - x402 service unavailable"), new Error("Payment service is temporarily unavailable. Please try again in a few moments.")) : n;
1154
1250
  }
1155
1251
  }
1156
1252
  /**
@@ -1160,9 +1256,9 @@ class gt {
1160
1256
  const { items: r, metadata: a, couponCode: n } = e;
1161
1257
  if (!this.quoteRateLimiter.tryConsume())
1162
1258
  throw new Error("Rate limit exceeded for cart quote requests. Please try again later.");
1163
- const i = S();
1259
+ const i = k();
1164
1260
  try {
1165
- return await this.circuitBreaker.execute(async () => await b(
1261
+ return await this.circuitBreaker.execute(async () => await E(
1166
1262
  async () => {
1167
1263
  const o = await this.routeDiscovery.buildUrl("/paywall/v1/cart/quote"), c = await p(o, {
1168
1264
  method: "POST",
@@ -1180,20 +1276,20 @@ class gt {
1180
1276
  })
1181
1277
  });
1182
1278
  if (c.status !== 402 && !c.ok) {
1183
- const m = await g(c, "Failed to get cart quote");
1184
- throw new Error(m);
1279
+ const f = await w(c, "Failed to get cart quote");
1280
+ throw new Error(f);
1185
1281
  }
1186
- const d = await c.json();
1187
- if (!d.cartId || !d.quote)
1282
+ const u = await c.json();
1283
+ if (!u.cartId || !u.quote)
1188
1284
  throw new Error("Invalid cart quote response: missing cartId or quote");
1189
- if (d.quote.crypto && !this.validateRequirement(d.quote.crypto))
1285
+ if (u.quote.crypto && !this.validateRequirement(u.quote.crypto))
1190
1286
  throw new Error("Invalid x402 cart quote: missing required fields in crypto quote");
1191
- return d;
1287
+ return u;
1192
1288
  },
1193
- { ...E.QUICK, name: "x402-cart-quote" }
1289
+ { ...v.QUICK, name: "x402-cart-quote" }
1194
1290
  ));
1195
1291
  } catch (o) {
1196
- throw o instanceof A ? (l().error("[X402Manager] Circuit breaker is OPEN - cart quote service unavailable"), new Error("Payment service is temporarily unavailable. Please try again in a few moments.")) : o;
1292
+ throw o instanceof g ? (l().error("[X402Manager] Circuit breaker is OPEN - cart quote service unavailable"), new Error("Payment service is temporarily unavailable. Please try again in a few moments.")) : o;
1197
1293
  }
1198
1294
  }
1199
1295
  /**
@@ -1201,7 +1297,7 @@ class gt {
1201
1297
  */
1202
1298
  buildPaymentHeader(e) {
1203
1299
  const r = JSON.stringify(e);
1204
- return me.encode(r);
1300
+ return ge.encode(r);
1205
1301
  }
1206
1302
  /**
1207
1303
  * Parse X-PAYMENT-RESPONSE header (base64 encoded settlement response)
@@ -1211,7 +1307,7 @@ class gt {
1211
1307
  if (!r)
1212
1308
  return null;
1213
1309
  try {
1214
- const a = me.decode(r), n = JSON.parse(a);
1310
+ const a = ge.decode(r), n = JSON.parse(a);
1215
1311
  return typeof n.success != "boolean" ? (l().error("Invalid settlement response: missing success field"), null) : n;
1216
1312
  } catch (a) {
1217
1313
  return l().error("Failed to parse settlement response:", a), null;
@@ -1234,11 +1330,11 @@ class gt {
1234
1330
  success: !1,
1235
1331
  error: "Rate limit exceeded for payment verification. Please try again later."
1236
1332
  };
1237
- const s = S();
1333
+ const s = k();
1238
1334
  try {
1239
- return await this.circuitBreaker.execute(async () => await b(
1335
+ return await this.circuitBreaker.execute(async () => await E(
1240
1336
  async () => {
1241
- const d = {
1337
+ const u = {
1242
1338
  ...a,
1243
1339
  payload: {
1244
1340
  ...a.payload,
@@ -1253,45 +1349,45 @@ class gt {
1253
1349
  // Add coupon if present
1254
1350
  }
1255
1351
  }
1256
- }, m = this.buildPaymentHeader(d), u = "/paywall/v1/verify";
1352
+ }, f = this.buildPaymentHeader(u), h = "/paywall/v1/verify";
1257
1353
  l().debug("[X402Manager] Submitting payment", {
1258
1354
  resourceType: o,
1259
1355
  hasCoupon: !!n,
1260
1356
  hasMetadata: !!i
1261
1357
  });
1262
- const y = await this.routeDiscovery.buildUrl(u), f = await p(y, {
1358
+ const y = await this.routeDiscovery.buildUrl(h), d = await p(y, {
1263
1359
  method: "POST",
1264
1360
  headers: {
1265
1361
  "Content-Type": "application/json",
1266
- "X-PAYMENT": m,
1362
+ "X-PAYMENT": f,
1267
1363
  "Idempotency-Key": s
1268
1364
  }
1269
1365
  });
1270
- if (f.ok) {
1271
- const { settlement: w, transactionId: C } = await this.handlePaymentVerification(
1272
- f,
1366
+ if (d.ok) {
1367
+ const { settlement: A, transactionId: b } = await this.handlePaymentVerification(
1368
+ d,
1273
1369
  a.payload.signature
1274
1370
  );
1275
1371
  return {
1276
1372
  success: !0,
1277
- transactionId: C,
1278
- settlement: w || void 0
1373
+ transactionId: b,
1374
+ settlement: A || void 0
1279
1375
  };
1280
1376
  }
1281
1377
  return {
1282
1378
  success: !1,
1283
- error: await g(f, "Payment verification failed", !0)
1379
+ error: await w(d, "Payment verification failed", !0)
1284
1380
  };
1285
1381
  },
1286
1382
  { maxRetries: 0, initialDelayMs: 0, backoffFactor: 1, maxDelayMs: 0, name: "x402-verify" }
1287
1383
  ));
1288
1384
  } catch (c) {
1289
- return c instanceof A ? {
1385
+ return c instanceof g ? {
1290
1386
  success: !1,
1291
1387
  error: "Payment verification service is temporarily unavailable. Please try again in a few moments."
1292
1388
  } : {
1293
1389
  success: !1,
1294
- error: k(c, "Unknown error")
1390
+ error: O(c, "Unknown error")
1295
1391
  };
1296
1392
  }
1297
1393
  }
@@ -1304,7 +1400,7 @@ class gt {
1304
1400
  if (!this.quoteRateLimiter.tryConsume())
1305
1401
  throw new Error("Rate limit exceeded for gasless transaction requests. Please try again later.");
1306
1402
  try {
1307
- return await this.circuitBreaker.execute(async () => await b(
1403
+ return await this.circuitBreaker.execute(async () => await E(
1308
1404
  async () => {
1309
1405
  const o = await this.routeDiscovery.buildUrl(
1310
1406
  "/paywall/v1/gasless-transaction"
@@ -1321,15 +1417,15 @@ class gt {
1321
1417
  })
1322
1418
  });
1323
1419
  if (!s.ok) {
1324
- const c = await g(s, "Failed to build gasless transaction");
1420
+ const c = await w(s, "Failed to build gasless transaction");
1325
1421
  throw new Error(c);
1326
1422
  }
1327
1423
  return await s.json();
1328
1424
  },
1329
- { ...E.QUICK, name: "x402-gasless-build" }
1425
+ { ...v.QUICK, name: "x402-gasless-build" }
1330
1426
  ));
1331
1427
  } catch (o) {
1332
- throw o instanceof A ? (l().error("[X402Manager] Circuit breaker is OPEN - gasless transaction service unavailable"), new Error("Gasless transaction service is temporarily unavailable. Please try again in a few moments.")) : o;
1428
+ throw o instanceof g ? (l().error("[X402Manager] Circuit breaker is OPEN - gasless transaction service unavailable"), new Error("Gasless transaction service is temporarily unavailable. Please try again in a few moments.")) : o;
1333
1429
  }
1334
1430
  }
1335
1431
  /**
@@ -1351,11 +1447,11 @@ class gt {
1351
1447
  success: !1,
1352
1448
  error: "Rate limit exceeded for gasless transaction verification. Please try again later."
1353
1449
  };
1354
- const c = S();
1450
+ const c = k();
1355
1451
  try {
1356
- return await this.circuitBreaker.execute(async () => await b(
1452
+ return await this.circuitBreaker.execute(async () => await E(
1357
1453
  async () => {
1358
- const m = {
1454
+ const f = {
1359
1455
  x402Version: 0,
1360
1456
  scheme: s?.scheme || "solana-spl-transfer",
1361
1457
  network: s?.network || "mainnet-beta",
@@ -1371,39 +1467,39 @@ class gt {
1371
1467
  ...n ? { couponCode: n } : {}
1372
1468
  }
1373
1469
  }
1374
- }, u = this.buildPaymentHeader(m), f = await this.routeDiscovery.buildUrl("/paywall/v1/verify"), h = await p(f, {
1470
+ }, h = this.buildPaymentHeader(f), d = await this.routeDiscovery.buildUrl("/paywall/v1/verify"), m = await p(d, {
1375
1471
  method: "POST",
1376
1472
  headers: {
1377
1473
  "Content-Type": "application/json",
1378
- "X-PAYMENT": u,
1474
+ "X-PAYMENT": h,
1379
1475
  "Idempotency-Key": c
1380
1476
  }
1381
1477
  });
1382
- if (h.ok) {
1383
- const { settlement: C, transactionId: x } = await this.handlePaymentVerification(
1384
- h,
1478
+ if (m.ok) {
1479
+ const { settlement: b, transactionId: x } = await this.handlePaymentVerification(
1480
+ m,
1385
1481
  "gasless-tx"
1386
1482
  );
1387
1483
  return {
1388
1484
  success: !0,
1389
1485
  transactionId: x,
1390
- settlement: C || void 0
1486
+ settlement: b || void 0
1391
1487
  };
1392
1488
  }
1393
1489
  return {
1394
1490
  success: !1,
1395
- error: await g(h, "Gasless transaction failed", !0)
1491
+ error: await w(m, "Gasless transaction failed", !0)
1396
1492
  };
1397
1493
  },
1398
1494
  { maxRetries: 0, initialDelayMs: 0, backoffFactor: 1, maxDelayMs: 0, name: "x402-gasless-verify" }
1399
1495
  ));
1400
- } catch (d) {
1401
- return d instanceof A ? {
1496
+ } catch (u) {
1497
+ return u instanceof g ? {
1402
1498
  success: !1,
1403
1499
  error: "Gasless transaction verification service is temporarily unavailable. Please try again in a few moments."
1404
1500
  } : {
1405
1501
  success: !1,
1406
- error: k(d, "Unknown error")
1502
+ error: O(u, "Unknown error")
1407
1503
  };
1408
1504
  }
1409
1505
  }
@@ -1432,15 +1528,15 @@ class gt {
1432
1528
  return !!(e.scheme && e.network && e.maxAmountRequired && e.resource && e.payTo && e.asset && e.maxTimeoutSeconds > 0);
1433
1529
  }
1434
1530
  }
1435
- class wt {
1531
+ class St {
1436
1532
  stripe = null;
1437
1533
  initPromise = null;
1438
1534
  publicKey;
1439
1535
  routeDiscovery;
1440
1536
  // Separate rate limiters for different operation types
1441
- sessionRateLimiter = R(M.PAYMENT);
1442
- statusRateLimiter = R(M.QUOTE);
1443
- circuitBreaker = j({
1537
+ sessionRateLimiter = I(B.PAYMENT);
1538
+ statusRateLimiter = I(B.QUOTE);
1539
+ circuitBreaker = Q({
1444
1540
  failureThreshold: 5,
1445
1541
  timeout: 1e4,
1446
1542
  // 10 seconds for faster recovery
@@ -1456,19 +1552,19 @@ class wt {
1456
1552
  */
1457
1553
  async initialize() {
1458
1554
  this.stripe || (this.initPromise || (this.initPromise = (async () => {
1459
- if (this.stripe = await Ce(this.publicKey), !this.stripe) throw new Error("Failed to initialize Stripe");
1555
+ if (this.stripe = await Te(this.publicKey), !this.stripe) throw new Error("Failed to initialize Stripe");
1460
1556
  })()), await this.initPromise);
1461
1557
  }
1462
1558
  /** Internal helper: execute with rate limiting, circuit breaker, and retry */
1463
- async executeWithResilience(e, r, a, n) {
1559
+ async executeWithResilience(e, r, a, n, i = v.STANDARD) {
1464
1560
  if (!e.tryConsume())
1465
1561
  throw new Error("Rate limit exceeded. Please try again later.");
1466
1562
  try {
1467
1563
  return await this.circuitBreaker.execute(
1468
- () => b(r, { ...E.STANDARD, name: a })
1564
+ () => E(r, { ...i, name: a })
1469
1565
  );
1470
- } catch (i) {
1471
- throw i instanceof A ? (l().error(`[SubscriptionManager] Circuit breaker OPEN for ${n}`), new Error("Service temporarily unavailable. Please try again in a few moments.")) : i;
1566
+ } catch (o) {
1567
+ throw o instanceof g ? (l().error(`[SubscriptionManager] Circuit breaker OPEN for ${n}`), new Error("Service temporarily unavailable. Please try again in a few moments.")) : o;
1472
1568
  }
1473
1569
  }
1474
1570
  /**
@@ -1477,39 +1573,43 @@ class wt {
1477
1573
  async createSubscriptionSession(e) {
1478
1574
  if (!this.sessionRateLimiter.tryConsume())
1479
1575
  throw new Error("Rate limit exceeded for subscription session creation. Please try again later.");
1480
- const r = S();
1576
+ const r = k(), a = JSON.stringify(e);
1481
1577
  try {
1482
- return await this.circuitBreaker.execute(async () => await b(
1578
+ return await this.circuitBreaker.execute(async () => await E(
1483
1579
  async () => {
1484
- const a = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/stripe-session");
1580
+ const n = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/stripe-session");
1485
1581
  l().debug("[SubscriptionManager] Creating subscription session:", {
1486
1582
  resource: e.resource,
1487
1583
  interval: e.interval,
1488
1584
  trialDays: e.trialDays
1489
1585
  });
1490
- const n = await p(a, {
1586
+ const i = await p(n, {
1491
1587
  method: "POST",
1492
1588
  headers: {
1493
1589
  "Content-Type": "application/json",
1494
1590
  "Idempotency-Key": r
1495
1591
  },
1496
- body: JSON.stringify(e)
1592
+ body: a
1497
1593
  });
1498
- if (!n.ok) {
1499
- const i = await g(
1500
- n,
1594
+ if (!i.ok) {
1595
+ const o = await w(
1596
+ i,
1501
1597
  "Failed to create subscription session"
1502
1598
  );
1503
- throw new Error(i);
1599
+ throw T.fromResponse(i, o);
1504
1600
  }
1505
- return await n.json();
1601
+ return await i.json();
1506
1602
  },
1507
- { ...E.STANDARD, name: "subscription-create-session" }
1603
+ {
1604
+ ...v.IDEMPOTENT_WRITE,
1605
+ name: "subscription-create-session",
1606
+ inFlightKey: `subscription:create-session:${a}`
1607
+ }
1508
1608
  ));
1509
- } catch (a) {
1510
- throw a instanceof A ? (l().error("[SubscriptionManager] Circuit breaker is OPEN - service unavailable"), new Error(
1609
+ } catch (n) {
1610
+ throw n instanceof g ? (l().error("[SubscriptionManager] Circuit breaker is OPEN - service unavailable"), new Error(
1511
1611
  "Subscription service is temporarily unavailable. Please try again in a few moments."
1512
- )) : a;
1612
+ )) : n;
1513
1613
  }
1514
1614
  }
1515
1615
  /**
@@ -1537,7 +1637,7 @@ class wt {
1537
1637
  } catch (r) {
1538
1638
  return {
1539
1639
  success: !1,
1540
- error: k(r, "Subscription failed")
1640
+ error: O(r, "Subscription failed")
1541
1641
  };
1542
1642
  }
1543
1643
  }
@@ -1548,7 +1648,7 @@ class wt {
1548
1648
  if (!this.statusRateLimiter.tryConsume())
1549
1649
  throw new Error("Rate limit exceeded for subscription status check. Please try again later.");
1550
1650
  try {
1551
- return await this.circuitBreaker.execute(async () => await b(
1651
+ return await this.circuitBreaker.execute(async () => await E(
1552
1652
  async () => {
1553
1653
  const r = new URLSearchParams({
1554
1654
  resource: e.resource,
@@ -1564,7 +1664,7 @@ class wt {
1564
1664
  }
1565
1665
  });
1566
1666
  if (!n.ok) {
1567
- const i = await g(
1667
+ const i = await w(
1568
1668
  n,
1569
1669
  "Failed to check subscription status"
1570
1670
  );
@@ -1572,10 +1672,10 @@ class wt {
1572
1672
  }
1573
1673
  return await n.json();
1574
1674
  },
1575
- { ...E.STANDARD, name: "subscription-status-check" }
1675
+ { ...v.STANDARD, name: "subscription-status-check" }
1576
1676
  ));
1577
1677
  } catch (r) {
1578
- throw r instanceof A ? (l().error("[SubscriptionManager] Circuit breaker is OPEN for status check"), new Error(
1678
+ throw r instanceof g ? (l().error("[SubscriptionManager] Circuit breaker is OPEN for status check"), new Error(
1579
1679
  "Subscription status service is temporarily unavailable. Please try again in a few moments."
1580
1680
  )) : r;
1581
1681
  }
@@ -1587,7 +1687,7 @@ class wt {
1587
1687
  if (!this.statusRateLimiter.tryConsume())
1588
1688
  throw new Error("Rate limit exceeded for subscription quote. Please try again later.");
1589
1689
  try {
1590
- return await this.circuitBreaker.execute(async () => await b(
1690
+ return await this.circuitBreaker.execute(async () => await E(
1591
1691
  async () => {
1592
1692
  const n = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/quote"), i = {
1593
1693
  resource: e,
@@ -1604,7 +1704,7 @@ class wt {
1604
1704
  body: JSON.stringify(i)
1605
1705
  });
1606
1706
  if (o.status !== 402 && !o.ok) {
1607
- const s = await g(
1707
+ const s = await w(
1608
1708
  o,
1609
1709
  "Failed to get subscription quote"
1610
1710
  );
@@ -1612,39 +1712,48 @@ class wt {
1612
1712
  }
1613
1713
  return await o.json();
1614
1714
  },
1615
- { ...E.STANDARD, name: "subscription-quote" }
1715
+ { ...v.STANDARD, name: "subscription-quote" }
1616
1716
  ));
1617
1717
  } catch (n) {
1618
- throw n instanceof A ? (l().error("[SubscriptionManager] Circuit breaker is OPEN for quote"), new Error(
1718
+ throw n instanceof g ? (l().error("[SubscriptionManager] Circuit breaker is OPEN for quote"), new Error(
1619
1719
  "Subscription quote service is temporarily unavailable. Please try again in a few moments."
1620
1720
  )) : n;
1621
1721
  }
1622
1722
  }
1623
1723
  /** Activate x402 subscription after payment verification */
1624
1724
  async activateX402Subscription(e) {
1725
+ const r = JSON.stringify(e);
1625
1726
  return this.executeWithResilience(
1626
1727
  this.sessionRateLimiter,
1627
1728
  async () => {
1628
- const r = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/x402/activate");
1729
+ const a = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/x402/activate");
1629
1730
  l().debug("[SubscriptionManager] Activating x402 subscription:", e);
1630
- const a = await p(r, {
1731
+ const n = await p(a, {
1631
1732
  method: "POST",
1632
1733
  headers: { "Content-Type": "application/json" },
1633
- body: JSON.stringify(e)
1734
+ body: r
1634
1735
  });
1635
- if (!a.ok) throw new Error(await g(a, "Failed to activate"));
1636
- return await a.json();
1736
+ if (!n.ok)
1737
+ throw T.fromResponse(
1738
+ n,
1739
+ await w(n, "Failed to activate")
1740
+ );
1741
+ return await n.json();
1637
1742
  },
1638
1743
  "subscription-activate",
1639
- "activation"
1744
+ "activation",
1745
+ {
1746
+ ...v.IDEMPOTENT_WRITE,
1747
+ inFlightKey: `subscription:activate:${r}`
1748
+ }
1640
1749
  );
1641
1750
  }
1642
1751
  }
1643
- class bt {
1752
+ class Tt {
1644
1753
  routeDiscovery;
1645
- rateLimiter = R(M.PAYMENT);
1646
- queryRateLimiter = R(M.QUOTE);
1647
- circuitBreaker = j({
1754
+ rateLimiter = I(B.PAYMENT);
1755
+ queryRateLimiter = I(B.QUOTE);
1756
+ circuitBreaker = Q({
1648
1757
  failureThreshold: 5,
1649
1758
  timeout: 1e4,
1650
1759
  name: "subscription-change-manager"
@@ -1653,36 +1762,43 @@ class bt {
1653
1762
  this.routeDiscovery = e;
1654
1763
  }
1655
1764
  /** Internal helper: execute with rate limiting, circuit breaker, and retry */
1656
- async executeWithResilience(e, r, a, n) {
1765
+ async executeWithResilience(e, r, a, n, i = v.STANDARD) {
1657
1766
  if (!e.tryConsume())
1658
1767
  throw new Error("Rate limit exceeded. Please try again later.");
1659
1768
  try {
1660
1769
  return await this.circuitBreaker.execute(
1661
- () => b(r, { ...E.STANDARD, name: a })
1770
+ () => E(r, { ...i, name: a })
1662
1771
  );
1663
- } catch (i) {
1664
- throw i instanceof A ? (l().error(`[SubscriptionChangeManager] Circuit breaker OPEN for ${n}`), new Error("Service temporarily unavailable. Please try again in a few moments.")) : i;
1772
+ } catch (o) {
1773
+ throw o instanceof g ? (l().error(`[SubscriptionChangeManager] Circuit breaker OPEN for ${n}`), new Error("Service temporarily unavailable. Please try again in a few moments.")) : o;
1665
1774
  }
1666
1775
  }
1667
1776
  /** Change subscription plan (upgrade or downgrade) */
1668
1777
  async changeSubscription(e) {
1669
- const r = S();
1778
+ const r = k(), a = JSON.stringify(e);
1670
1779
  return this.executeWithResilience(
1671
1780
  this.rateLimiter,
1672
1781
  async () => {
1673
- const a = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/change");
1782
+ const n = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/change");
1674
1783
  l().debug("[SubscriptionChangeManager] Changing subscription:", e);
1675
- const n = await p(a, {
1784
+ const i = await p(n, {
1676
1785
  method: "POST",
1677
1786
  headers: { "Content-Type": "application/json", "Idempotency-Key": r },
1678
- body: JSON.stringify(e)
1787
+ body: a
1679
1788
  });
1680
- if (!n.ok)
1681
- throw new Error(await g(n, "Failed to change subscription"));
1682
- return await n.json();
1789
+ if (!i.ok)
1790
+ throw T.fromResponse(
1791
+ i,
1792
+ await w(i, "Failed to change subscription")
1793
+ );
1794
+ return await i.json();
1683
1795
  },
1684
1796
  "subscription-change",
1685
- "plan change"
1797
+ "plan change",
1798
+ {
1799
+ ...v.IDEMPOTENT_WRITE,
1800
+ inFlightKey: `subscription:change:${a}`
1801
+ }
1686
1802
  );
1687
1803
  }
1688
1804
  /** Preview subscription change (get proration details) */
@@ -1698,7 +1814,7 @@ class bt {
1698
1814
  body: JSON.stringify(e)
1699
1815
  });
1700
1816
  if (!a.ok)
1701
- throw new Error(await g(a, "Failed to preview change"));
1817
+ throw new Error(await w(a, "Failed to preview change"));
1702
1818
  return await a.json();
1703
1819
  },
1704
1820
  "subscription-preview",
@@ -1717,7 +1833,7 @@ class bt {
1717
1833
  headers: { "Content-Type": "application/json" }
1718
1834
  });
1719
1835
  if (!i.ok)
1720
- throw new Error(await g(i, "Failed to get subscription details"));
1836
+ throw new Error(await w(i, "Failed to get subscription details"));
1721
1837
  return await i.json();
1722
1838
  },
1723
1839
  "subscription-details",
@@ -1726,49 +1842,65 @@ class bt {
1726
1842
  }
1727
1843
  /** Cancel a subscription */
1728
1844
  async cancel(e) {
1845
+ const r = JSON.stringify(e);
1729
1846
  return this.executeWithResilience(
1730
1847
  this.rateLimiter,
1731
1848
  async () => {
1732
- const r = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/cancel");
1849
+ const a = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/cancel");
1733
1850
  l().debug("[SubscriptionChangeManager] Canceling subscription:", e);
1734
- const a = await p(r, {
1851
+ const n = await p(a, {
1735
1852
  method: "POST",
1736
1853
  headers: { "Content-Type": "application/json" },
1737
- body: JSON.stringify(e)
1854
+ body: r
1738
1855
  });
1739
- if (!a.ok)
1740
- throw new Error(await g(a, "Failed to cancel subscription"));
1741
- return await a.json();
1856
+ if (!n.ok)
1857
+ throw T.fromResponse(
1858
+ n,
1859
+ await w(n, "Failed to cancel subscription")
1860
+ );
1861
+ return await n.json();
1742
1862
  },
1743
1863
  "subscription-cancel",
1744
- "cancellation"
1864
+ "cancellation",
1865
+ {
1866
+ ...v.WRITE_ONCE,
1867
+ inFlightKey: `subscription:cancel:${r}`
1868
+ }
1745
1869
  );
1746
1870
  }
1747
1871
  /** Get Stripe billing portal URL */
1748
1872
  async getBillingPortalUrl(e) {
1873
+ const r = JSON.stringify(e);
1749
1874
  return this.executeWithResilience(
1750
1875
  this.queryRateLimiter,
1751
1876
  async () => {
1752
- const r = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/portal");
1877
+ const a = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/portal");
1753
1878
  l().debug("[SubscriptionChangeManager] Getting billing portal URL:", e);
1754
- const a = await p(r, {
1879
+ const n = await p(a, {
1755
1880
  method: "POST",
1756
1881
  headers: { "Content-Type": "application/json" },
1757
- body: JSON.stringify(e)
1882
+ body: r
1758
1883
  });
1759
- if (!a.ok)
1760
- throw new Error(await g(a, "Failed to get billing portal URL"));
1761
- return await a.json();
1884
+ if (!n.ok)
1885
+ throw T.fromResponse(
1886
+ n,
1887
+ await w(n, "Failed to get billing portal URL")
1888
+ );
1889
+ return await n.json();
1762
1890
  },
1763
1891
  "subscription-portal",
1764
- "portal"
1892
+ "portal",
1893
+ {
1894
+ ...v.WRITE_ONCE,
1895
+ inFlightKey: `subscription:portal:${r}`
1896
+ }
1765
1897
  );
1766
1898
  }
1767
1899
  }
1768
- class vt {
1900
+ class xt {
1769
1901
  routeDiscovery;
1770
- rateLimiter = R(M.PAYMENT);
1771
- circuitBreaker = j({
1902
+ rateLimiter = I(B.PAYMENT);
1903
+ circuitBreaker = Q({
1772
1904
  failureThreshold: 5,
1773
1905
  timeout: 1e4,
1774
1906
  name: "credits-manager"
@@ -1780,7 +1912,7 @@ class vt {
1780
1912
  if (!this.rateLimiter.tryConsume())
1781
1913
  throw new Error("Rate limit exceeded for credits quote. Please try again later.");
1782
1914
  try {
1783
- return await this.circuitBreaker.execute(async () => await b(
1915
+ return await this.circuitBreaker.execute(async () => await E(
1784
1916
  async () => {
1785
1917
  const a = await this.routeDiscovery.buildUrl("/paywall/v1/quote");
1786
1918
  l().debug("[CreditsManager] Requesting quote");
@@ -1792,22 +1924,22 @@ class vt {
1792
1924
  if (n.status === 402)
1793
1925
  return (await n.json()).credits || null;
1794
1926
  if (!n.ok) {
1795
- const i = await g(n, "Failed to get credits quote");
1927
+ const i = await w(n, "Failed to get credits quote");
1796
1928
  throw new Error(i);
1797
1929
  }
1798
1930
  return null;
1799
1931
  },
1800
- { ...E.STANDARD, name: "credits-quote" }
1932
+ { ...v.STANDARD, name: "credits-quote" }
1801
1933
  ));
1802
1934
  } catch (a) {
1803
- throw a instanceof A ? (l().error("[CreditsManager] Circuit breaker is OPEN - credits service unavailable"), new Error("Credits service is temporarily unavailable. Please try again in a few moments.")) : a;
1935
+ throw a instanceof g ? (l().error("[CreditsManager] Circuit breaker is OPEN - credits service unavailable"), new Error("Credits service is temporarily unavailable. Please try again in a few moments.")) : a;
1804
1936
  }
1805
1937
  }
1806
1938
  async requestCartQuote(e, r) {
1807
1939
  if (!this.rateLimiter.tryConsume())
1808
1940
  throw new Error("Rate limit exceeded for cart credits quote. Please try again later.");
1809
1941
  try {
1810
- return await this.circuitBreaker.execute(async () => await b(
1942
+ return await this.circuitBreaker.execute(async () => await E(
1811
1943
  async () => {
1812
1944
  const a = await this.routeDiscovery.buildUrl("/paywall/v1/cart/quote");
1813
1945
  l().debug("[CreditsManager] Requesting cart quote for items:", e.length);
@@ -1823,13 +1955,13 @@ class vt {
1823
1955
  credits: o.credits
1824
1956
  } : null;
1825
1957
  }
1826
- const i = await g(n, "Failed to get cart credits quote");
1958
+ const i = await w(n, "Failed to get cart credits quote");
1827
1959
  throw new Error(i);
1828
1960
  },
1829
- { ...E.STANDARD, name: "credits-cart-quote" }
1961
+ { ...v.STANDARD, name: "credits-cart-quote" }
1830
1962
  ));
1831
1963
  } catch (a) {
1832
- throw a instanceof A ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : a;
1964
+ throw a instanceof g ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : a;
1833
1965
  }
1834
1966
  }
1835
1967
  /**
@@ -1840,31 +1972,35 @@ class vt {
1840
1972
  const { resource: r, couponCode: a, authToken: n } = e;
1841
1973
  if (!this.rateLimiter.tryConsume())
1842
1974
  throw new Error("Rate limit exceeded for credits hold. Please try again later.");
1843
- const i = S();
1975
+ const i = k(), o = JSON.stringify({ resource: r, couponCode: a });
1844
1976
  try {
1845
- return await this.circuitBreaker.execute(async () => await b(
1977
+ return await this.circuitBreaker.execute(async () => await E(
1846
1978
  async () => {
1847
- const o = await this.routeDiscovery.buildUrl("/paywall/v1/credits/hold");
1979
+ const s = await this.routeDiscovery.buildUrl("/paywall/v1/credits/hold");
1848
1980
  l().debug("[CreditsManager] Creating hold");
1849
- const s = await p(o, {
1981
+ const c = await p(s, {
1850
1982
  method: "POST",
1851
1983
  headers: {
1852
1984
  "Content-Type": "application/json",
1853
1985
  Authorization: `Bearer ${n}`,
1854
1986
  "Idempotency-Key": i
1855
1987
  },
1856
- body: JSON.stringify({ resource: r, couponCode: a })
1988
+ body: o
1857
1989
  });
1858
- if (!s.ok) {
1859
- const c = await g(s, "Failed to create credits hold");
1860
- throw new Error(c);
1990
+ if (!c.ok) {
1991
+ const u = await w(c, "Failed to create credits hold");
1992
+ throw T.fromResponse(c, u);
1861
1993
  }
1862
- return await s.json();
1994
+ return await c.json();
1863
1995
  },
1864
- { ...E.STANDARD, name: "credits-create-hold" }
1996
+ {
1997
+ ...v.IDEMPOTENT_WRITE,
1998
+ name: "credits-create-hold",
1999
+ inFlightKey: `credits:create-hold:${n}:${o}`
2000
+ }
1865
2001
  ));
1866
- } catch (o) {
1867
- throw o instanceof A ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : o;
2002
+ } catch (s) {
2003
+ throw s instanceof g ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : s;
1868
2004
  }
1869
2005
  }
1870
2006
  /**
@@ -1875,9 +2011,9 @@ class vt {
1875
2011
  const { cartId: r, authToken: a } = e;
1876
2012
  if (!this.rateLimiter.tryConsume())
1877
2013
  throw new Error("Rate limit exceeded for cart credits hold. Please try again later.");
1878
- const n = S();
2014
+ const n = k();
1879
2015
  try {
1880
- return await this.circuitBreaker.execute(async () => await b(
2016
+ return await this.circuitBreaker.execute(async () => await E(
1881
2017
  async () => {
1882
2018
  const i = await this.routeDiscovery.buildUrl(`/paywall/v1/cart/${encodeURIComponent(r)}/credits/hold`);
1883
2019
  l().debug("[CreditsManager] Creating cart hold for cart:", r);
@@ -1891,15 +2027,19 @@ class vt {
1891
2027
  body: JSON.stringify({})
1892
2028
  });
1893
2029
  if (!o.ok) {
1894
- const s = await g(o, "Failed to create cart credits hold");
1895
- throw new Error(s);
2030
+ const s = await w(o, "Failed to create cart credits hold");
2031
+ throw T.fromResponse(o, s);
1896
2032
  }
1897
2033
  return await o.json();
1898
2034
  },
1899
- { ...E.STANDARD, name: "credits-create-cart-hold" }
2035
+ {
2036
+ ...v.IDEMPOTENT_WRITE,
2037
+ name: "credits-create-cart-hold",
2038
+ inFlightKey: `credits:create-cart-hold:${a}:${r}`
2039
+ }
1900
2040
  ));
1901
2041
  } catch (i) {
1902
- throw i instanceof A ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : i;
2042
+ throw i instanceof g ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : i;
1903
2043
  }
1904
2044
  }
1905
2045
  async authorizePayment(e) {
@@ -1910,49 +2050,52 @@ class vt {
1910
2050
  error: "Rate limit exceeded for credits authorization. Please try again later.",
1911
2051
  errorCode: "rate_limit_exceeded"
1912
2052
  };
1913
- const s = S();
2053
+ const s = k(), c = JSON.stringify({
2054
+ resource: r,
2055
+ holdId: a,
2056
+ couponCode: n,
2057
+ ...o && { metadata: o }
2058
+ });
1914
2059
  try {
1915
- return await this.circuitBreaker.execute(async () => await b(
2060
+ return await this.circuitBreaker.execute(async () => await E(
1916
2061
  async () => {
1917
- const c = await this.routeDiscovery.buildUrl("/paywall/v1/credits/authorize");
2062
+ const u = await this.routeDiscovery.buildUrl("/paywall/v1/credits/authorize");
1918
2063
  l().debug("[CreditsManager] Authorizing payment");
1919
- const d = await p(c, {
2064
+ const f = await p(u, {
1920
2065
  method: "POST",
1921
2066
  headers: {
1922
2067
  "Content-Type": "application/json",
1923
2068
  Authorization: `Bearer ${i}`,
1924
2069
  "Idempotency-Key": s
1925
2070
  },
1926
- body: JSON.stringify({
1927
- resource: r,
1928
- holdId: a,
1929
- couponCode: n,
1930
- ...o && { metadata: o }
1931
- })
2071
+ body: c
1932
2072
  });
1933
- if (!d.ok) {
1934
- const u = await d.json().catch(() => ({}));
1935
- return {
1936
- success: !1,
1937
- error: u.error?.message || "Credits authorization failed",
1938
- errorCode: u.error?.code || "authorization_failed"
1939
- };
2073
+ if (!f.ok) {
2074
+ const y = await f.json().catch(() => ({}));
2075
+ throw T.fromResponse(
2076
+ f,
2077
+ y.error?.message || "Credits authorization failed"
2078
+ );
1940
2079
  }
1941
2080
  return {
1942
2081
  success: !0,
1943
- transactionId: (await d.json()).transactionId
2082
+ transactionId: (await f.json()).transactionId
1944
2083
  };
1945
2084
  },
1946
- { ...E.STANDARD, name: "credits-authorize" }
2085
+ {
2086
+ ...v.IDEMPOTENT_WRITE,
2087
+ name: "credits-authorize",
2088
+ inFlightKey: `credits:authorize:${i}:${c}`
2089
+ }
1947
2090
  ));
1948
- } catch (c) {
1949
- return c instanceof A ? {
2091
+ } catch (u) {
2092
+ return u instanceof g ? {
1950
2093
  success: !1,
1951
2094
  error: "Credits service is temporarily unavailable. Please try again in a few moments.",
1952
2095
  errorCode: "service_unavailable"
1953
2096
  } : {
1954
2097
  success: !1,
1955
- error: k(c, "Credits authorization failed"),
2098
+ error: O(u, "Credits authorization failed"),
1956
2099
  errorCode: "authorization_failed"
1957
2100
  };
1958
2101
  }
@@ -1965,51 +2108,54 @@ class vt {
1965
2108
  error: "Rate limit exceeded for cart credits authorization. Please try again later.",
1966
2109
  errorCode: "rate_limit_exceeded"
1967
2110
  };
1968
- const o = S();
2111
+ const o = k(), s = JSON.stringify({
2112
+ holdId: a,
2113
+ ...i && { metadata: i }
2114
+ });
1969
2115
  try {
1970
- return await this.circuitBreaker.execute(async () => await b(
2116
+ return await this.circuitBreaker.execute(async () => await E(
1971
2117
  async () => {
1972
- const s = await this.routeDiscovery.buildUrl(`/paywall/v1/cart/${encodeURIComponent(r)}/credits/authorize`);
2118
+ const c = await this.routeDiscovery.buildUrl(`/paywall/v1/cart/${encodeURIComponent(r)}/credits/authorize`);
1973
2119
  l().debug("[CreditsManager] Authorizing cart payment for cart:", r);
1974
- const c = await p(s, {
2120
+ const u = await p(c, {
1975
2121
  method: "POST",
1976
2122
  headers: {
1977
2123
  "Content-Type": "application/json",
1978
2124
  Authorization: `Bearer ${n}`,
1979
2125
  "Idempotency-Key": o
1980
2126
  },
1981
- body: JSON.stringify({
1982
- holdId: a,
1983
- ...i && { metadata: i }
1984
- })
2127
+ body: s
1985
2128
  });
1986
- if (!c.ok) {
1987
- const m = await c.json().catch((u) => (l().error("[CreditsManager] Failed to parse error response JSON:", u, {
2129
+ if (!u.ok) {
2130
+ const h = await u.json().catch((y) => (l().error("[CreditsManager] Failed to parse error response JSON:", y, {
1988
2131
  cartId: r,
1989
- status: c.status,
1990
- statusText: c.statusText
2132
+ status: u.status,
2133
+ statusText: u.statusText
1991
2134
  }), {}));
1992
- return {
1993
- success: !1,
1994
- error: m.error?.message || "Cart credits authorization failed",
1995
- errorCode: m.error?.code || "authorization_failed"
1996
- };
2135
+ throw T.fromResponse(
2136
+ u,
2137
+ h.error?.message || "Cart credits authorization failed"
2138
+ );
1997
2139
  }
1998
2140
  return {
1999
2141
  success: !0,
2000
- transactionId: (await c.json()).transactionId
2142
+ transactionId: (await u.json()).transactionId
2001
2143
  };
2002
2144
  },
2003
- { ...E.STANDARD, name: "credits-cart-authorize" }
2145
+ {
2146
+ ...v.IDEMPOTENT_WRITE,
2147
+ name: "credits-cart-authorize",
2148
+ inFlightKey: `credits:cart-authorize:${n}:${r}:${s}`
2149
+ }
2004
2150
  ));
2005
- } catch (s) {
2006
- return s instanceof A ? {
2151
+ } catch (c) {
2152
+ return c instanceof g ? {
2007
2153
  success: !1,
2008
2154
  error: "Credits service is temporarily unavailable. Please try again in a few moments.",
2009
2155
  errorCode: "service_unavailable"
2010
2156
  } : {
2011
2157
  success: !1,
2012
- error: k(s, "Cart credits authorization failed"),
2158
+ error: O(c, "Cart credits authorization failed"),
2013
2159
  errorCode: "authorization_failed"
2014
2160
  };
2015
2161
  }
@@ -2022,16 +2168,16 @@ class vt {
2022
2168
  method: "POST",
2023
2169
  headers: {
2024
2170
  Authorization: `Bearer ${r}`,
2025
- "Idempotency-Key": S()
2171
+ "Idempotency-Key": k()
2026
2172
  }
2027
2173
  });
2028
2174
  if (!n.ok) {
2029
- const i = await g(n, "Failed to release credits hold");
2175
+ const i = await w(n, "Failed to release credits hold");
2030
2176
  throw new Error(i);
2031
2177
  }
2032
2178
  });
2033
2179
  } catch (a) {
2034
- throw a instanceof A ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : a;
2180
+ throw a instanceof g ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : a;
2035
2181
  }
2036
2182
  }
2037
2183
  /**
@@ -2074,7 +2220,7 @@ class vt {
2074
2220
  }
2075
2221
  return {
2076
2222
  success: !1,
2077
- error: k(o, "Credits payment failed")
2223
+ error: O(o, "Credits payment failed")
2078
2224
  };
2079
2225
  }
2080
2226
  }
@@ -2086,17 +2232,17 @@ class vt {
2086
2232
  headers: { Authorization: `Bearer ${e}` }
2087
2233
  });
2088
2234
  if (!a.ok) {
2089
- const n = await g(a, "Failed to fetch credits balance");
2235
+ const n = await w(a, "Failed to fetch credits balance");
2090
2236
  throw new Error(n);
2091
2237
  }
2092
2238
  return await a.json();
2093
2239
  });
2094
2240
  } catch (r) {
2095
- throw r instanceof A ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : r;
2241
+ throw r instanceof g ? new Error("Credits service is temporarily unavailable. Please try again in a few moments.") : r;
2096
2242
  }
2097
2243
  }
2098
2244
  }
2099
- class Ct {
2245
+ class kt {
2100
2246
  serverUrl;
2101
2247
  getLogger;
2102
2248
  fetchWithTimeout;
@@ -2164,131 +2310,134 @@ class Ct {
2164
2310
  this.routePrefix = null, this.discoveryPromise = null, this.failedDiscoveryAt = null;
2165
2311
  }
2166
2312
  }
2167
- class Et extends Ct {
2313
+ class Rt extends kt {
2168
2314
  constructor(e) {
2169
2315
  super(e, { getLogger: l, fetchWithTimeout: p });
2170
2316
  }
2171
2317
  }
2172
- let X = null;
2173
- async function Pt() {
2174
- return X || (X = (await import("./WalletManager-peBN6RDH.mjs")).WalletManager), X;
2318
+ let ee = null;
2319
+ async function Mt() {
2320
+ return ee || (ee = (await import("./WalletManager-BIwH8Dw_.mjs")).WalletManager), ee;
2175
2321
  }
2176
- const J = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
2177
- function Ue(t, e, r, a, n) {
2322
+ const X = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
2323
+ function qe(t, e, r, a, n, i) {
2178
2324
  return JSON.stringify({
2179
2325
  stripePublicKey: t,
2180
2326
  serverUrl: e,
2181
2327
  solanaCluster: r,
2182
2328
  solanaEndpoint: a || "",
2183
- dangerouslyAllowUnknownMint: n || !1
2329
+ dangerouslyAllowUnknownMint: n || !1,
2330
+ complianceCheck: i || !1
2184
2331
  });
2185
2332
  }
2186
- async function St(t, e, r, a, n) {
2187
- const i = Ue(
2333
+ async function Dt(t, e, r, a, n, i) {
2334
+ const o = qe(
2188
2335
  t,
2189
2336
  e,
2190
2337
  r,
2191
2338
  a,
2192
- n
2339
+ n,
2340
+ i
2193
2341
  );
2194
- let o = J.get(i);
2195
- if (o)
2196
- return o.refCount++, l().debug(
2197
- `[ManagerCache] Reusing cached managers (refCount: ${o.refCount}):`,
2198
- { stripePublicKey: t.slice(0, 10) + "...", serverUrl: e }
2199
- ), o;
2200
- const s = Z.get(i);
2342
+ let s = X.get(o);
2201
2343
  if (s)
2202
- return o = await s, o.refCount++, l().debug(
2203
- `[ManagerCache] Reusing in-flight managers (refCount: ${o.refCount}):`,
2344
+ return s.refCount++, l().debug(
2345
+ `[ManagerCache] Reusing cached managers (refCount: ${s.refCount}):`,
2346
+ { stripePublicKey: t.slice(0, 10) + "...", serverUrl: e }
2347
+ ), s;
2348
+ const c = te.get(o);
2349
+ if (c)
2350
+ return s = await c, s.refCount++, l().debug(
2351
+ `[ManagerCache] Reusing in-flight managers (refCount: ${s.refCount}):`,
2204
2352
  { stripePublicKey: t.slice(0, 10) + "...", serverUrl: e }
2205
- ), o;
2353
+ ), s;
2206
2354
  l().debug(
2207
2355
  "[ManagerCache] Creating new manager instances:",
2208
2356
  { stripePublicKey: t.slice(0, 10) + "...", serverUrl: e }
2209
2357
  );
2210
- const c = (async () => {
2211
- const d = new Et(e), m = new st(t, d), u = new gt(d), y = await Pt(), f = new y(
2358
+ const u = (async () => {
2359
+ const f = new Rt(e), h = new ht(t, f, i ?? !1), y = new Pt(f), d = await Mt(), m = new d(
2212
2360
  r,
2213
2361
  a,
2214
2362
  n ?? !1
2215
- ), h = new wt(t, d), w = new bt(d), C = new vt(d);
2363
+ ), A = new St(t, f), b = new Tt(f), x = new xt(f);
2216
2364
  return {
2217
- stripeManager: m,
2218
- x402Manager: u,
2219
- walletManager: f,
2220
- subscriptionManager: h,
2221
- subscriptionChangeManager: w,
2222
- creditsManager: C,
2223
- routeDiscovery: d,
2365
+ stripeManager: h,
2366
+ x402Manager: y,
2367
+ walletManager: m,
2368
+ subscriptionManager: A,
2369
+ subscriptionChangeManager: b,
2370
+ creditsManager: x,
2371
+ routeDiscovery: f,
2224
2372
  refCount: 1
2225
2373
  };
2226
2374
  })();
2227
- Z.set(i, c);
2375
+ te.set(o, u);
2228
2376
  try {
2229
- return o = await c, J.set(i, o), o;
2377
+ return s = await u, X.set(o, s), s;
2230
2378
  } finally {
2231
- Z.delete(i);
2379
+ te.delete(o);
2232
2380
  }
2233
2381
  }
2234
- function ye(t, e, r, a, n) {
2235
- const i = Ue(
2382
+ function we(t, e, r, a, n, i) {
2383
+ const o = qe(
2236
2384
  t,
2237
2385
  e,
2238
2386
  r,
2239
2387
  a,
2240
- n
2241
- ), o = J.get(i);
2242
- if (!o) {
2243
- l().warn("[ManagerCache] Attempted to release non-existent managers:", { cacheKey: i });
2388
+ n,
2389
+ i
2390
+ ), s = X.get(o);
2391
+ if (!s) {
2392
+ l().warn("[ManagerCache] Attempted to release non-existent managers:", { cacheKey: o });
2244
2393
  return;
2245
2394
  }
2246
- o.refCount--, l().debug(
2247
- `[ManagerCache] Released manager reference (refCount: ${o.refCount}):`,
2395
+ s.refCount--, l().debug(
2396
+ `[ManagerCache] Released manager reference (refCount: ${s.refCount}):`,
2248
2397
  { stripePublicKey: t.slice(0, 10) + "...", serverUrl: e }
2249
- ), o.refCount <= 0 && (J.delete(i), l().debug("[ManagerCache] Removed managers from cache (refCount reached 0)"));
2398
+ ), s.refCount <= 0 && (X.delete(o), l().debug("[ManagerCache] Removed managers from cache (refCount reached 0)"));
2250
2399
  }
2251
- const xt = "data:image/webp;base64,UklGRnIIAABXRUJQVlA4WAoAAAAYAAAAOwAAOwAAQUxQSK4BAAABkHPbtrE9+z73/RTbqWw7Lf+BbbNKbTudbZe2qy+VbVv3PmeHj05G6ohg4LaRounNMtN1voB42ABA5R7TNlx5+O7du9e3Tiwb0b4EgFyAOCQM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Unsv8S/4PmE8Hy/vy+Mij+aTAKZvg716IHfHX0/JMeFfmAnsZ39Q0qkfdPtq6+CxbGZ7wKDsK/8l/MVGuyd6faJFt5wyoOXuNrr3JC9EoBmjcOzkVw/6RNP49poZ1xzsX3q7B4HGfI/XSfRQq3HeZ2j12d0E3gCAube4oExaT1sx/v8F+f61QOsGdSaqM2im6qOGkSRkrRQ7L8hvS8vEYJeVkAbFvX5ov7e/egYYNToMHj651c5/rCVYtB9Ned6GvGN8R0x3t7+lsf8+ofhHRzpyvwxd6c5pREZVOKnXzplhJ61mki4JmAAAABFWElGugAAAEV4aWYAAElJKgAIAAAABgASAQMAAQAAAAEAAAAaAQUAAQAAAFYAAAAbAQUAAQAAAF4AAAAoAQMAAQAAAAIAAAATAgMAAQAAAAEAAABphwQAAQAAAGYAAAAAAAAASAAAAAEAAABIAAAAAQAAAAYAAJAHAAQAAAAwMjEwAZEHAAQAAAABAgMAAKAHAAQAAAAwMTAwAaADAAEAAAD//wAAAqAEAAEAAAA8AAAAA6AEAAEAAAA8AAAAAAAAAA==", Tt = "data:image/svg+xml,%3csvg%20width='868'%20height='868'%20viewBox='0%200%20868%20868'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='434'%20cy='434'%20r='434'%20fill='%231B262D'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M234.563%20184H640.697C650.387%20184%20659.339%20189.164%20664.172%20197.542L782.495%20402.657C788.631%20413.294%20786.808%20426.72%20778.056%20435.346L452.368%20756.327C441.818%20766.724%20424.846%20766.724%20414.296%20756.327L89.0484%20435.78C80.0927%20426.954%2078.4157%20413.136%2085.0013%20402.433L211.48%20196.884C216.405%20188.879%20225.146%20184%20234.563%20184ZM588.257%20275.577V333.129H472.567V373.032C553.82%20377.296%20614.782%20394.81%20615.234%20415.802L615.231%20459.563C614.779%20480.556%20553.82%20498.069%20472.567%20502.333V600.259H395.746V502.333C314.492%20498.069%20253.531%20480.555%20253.078%20459.563L253.081%20415.802C253.533%20394.81%20314.492%20377.296%20395.746%20373.032V333.129H280.055V275.577H588.257ZM434.156%20472.268C520.868%20472.268%20593.345%20457.459%20611.082%20437.683C596.041%20420.912%20541.636%20407.713%20472.567%20404.089V445.867C460.187%20446.516%20447.336%20446.858%20434.156%20446.858C420.976%20446.858%20408.125%20446.516%20395.746%20445.867V404.089C326.676%20407.713%20272.271%20420.912%20257.23%20437.683C274.968%20457.459%20347.444%20472.268%20434.156%20472.268Z'%20fill='%23009393'/%3e%3c/svg%3e", kt = "data:image/webp;base64,UklGRqwEAABXRUJQVlA4WAoAAAAYAAAAOwAAOwAAQUxQSL8BAAABkGvbtmlLc5997yvbmW19gBnbDm2kjF5UmW3bthXZVZFdZ+81r+87Z1XlEaHIbSNlMstwos4XUBSTLAFQo/u01Zdf/yLDDze3zB/YwADJEoOoJAKg7oTdH4SF+XxiZlMgSESzwAJdVn2iUJzzOUMiLhQKf+/va2FtBLMBuu1zpHcsincUXhtoTKLsCTVX/KF3wrLhPLm/OWzZtjQWfZ7RhYyAC/lxMowpSzJYJAyFkZDQc21FBMUT7BqGjpHxf3m+XlEPUHE/f3vGgPzmw4awRUaTexkyJhwfNShctVgZXyJDXq4CUyjNy6Y4fVOBIkAPR2GcOE7Jm2NQ/RE9YzXht3a5VYvlOX0xF0fy+tp/ozBuQg6DzZYb6Bi7ed4rB5Mp/1Co4cNhLUo1StLxDIDqrynUoRswiF6nFnIxsDpnZ5WBW0GFZ1qZ8HfLDk5txHHsGDpSa6B0cXZEa+DsTr1M+P4qPdXwjynU4+1/a7oN3Sm6G+meSd27oHsHde++7puj+tYpv7G6b7vun6L7l6n+oZp/t7JmUNUqqhpJV5upakJVLaqqgVW1t6rmV401NGMc1djqH4rpIseSfyPFkgAAVlA4IAQCAABQDACdASo8ADwAPm0yk0akIyGhJgzogA2JaQAThroHvLxu+aPf5G2BYxv+B6XHzx6GPon/o+qz/tOAA/TM82gR0vnExWoiQRM36jlg2UIvwCSqySErzugu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j12d0E3gCAube4oExaT1sx/v8F+f61QOsGdSaqM2im6qOGkSRkrRQ7L8hvS8vEYJeVkAbFvX5ov7e/egYYNToMHj651c5/rCVYtB9Ned6GvGN8R0x3t7+lsf8+ofhHRzpyvwxd6c5pREZVOKnXzplhJ61mki4JmAAAABFWElGugAAAEV4aWYAAElJKgAIAAAABgASAQMAAQAAAAEAAAAaAQUAAQAAAFYAAAAbAQUAAQAAAF4AAAAoAQMAAQAAAAIAAAATAgMAAQAAAAEAAABphwQAAQAAAGYAAAAAAAAASAAAAAEAAABIAAAAAQAAAAYAAJAHAAQAAAAwMjEwAZEHAAQAAAABAgMAAKAHAAQAAAAwMTAwAaADAAEAAAD//wAAAqAEAAEAAAA8AAAAA6AEAAEAAAA8AAAAAAAAAA==", It = "data:image/svg+xml,%3csvg%20width='868'%20height='868'%20viewBox='0%200%20868%20868'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='434'%20cy='434'%20r='434'%20fill='%231B262D'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M234.563%20184H640.697C650.387%20184%20659.339%20189.164%20664.172%20197.542L782.495%20402.657C788.631%20413.294%20786.808%20426.72%20778.056%20435.346L452.368%20756.327C441.818%20766.724%20424.846%20766.724%20414.296%20756.327L89.0484%20435.78C80.0927%20426.954%2078.4157%20413.136%2085.0013%20402.433L211.48%20196.884C216.405%20188.879%20225.146%20184%20234.563%20184ZM588.257%20275.577V333.129H472.567V373.032C553.82%20377.296%20614.782%20394.81%20615.234%20415.802L615.231%20459.563C614.779%20480.556%20553.82%20498.069%20472.567%20502.333V600.259H395.746V502.333C314.492%20498.069%20253.531%20480.555%20253.078%20459.563L253.081%20415.802C253.533%20394.81%20314.492%20377.296%20395.746%20373.032V333.129H280.055V275.577H588.257ZM434.156%20472.268C520.868%20472.268%20593.345%20457.459%20611.082%20437.683C596.041%20420.912%20541.636%20407.713%20472.567%20404.089V445.867C460.187%20446.516%20447.336%20446.858%20434.156%20446.858C420.976%20446.858%20408.125%20446.516%20395.746%20445.867V404.089C326.676%20407.713%20272.271%20420.912%20257.23%20437.683C274.968%20457.459%20347.444%20472.268%20434.156%20472.268Z'%20fill='%23009393'/%3e%3c/svg%3e", Bt = "data:image/webp;base64,UklGRqwEAABXRUJQVlA4WAoAAAAYAAAAOwAAOwAAQUxQSL8BAAABkGvbtmlLc5997yvbmW19gBnbDm2kjF5UmW3bthXZVZFdZ+81r+87Z1XlEaHIbSNlMstwos4XUBSTLAFQo/u01Zdf/yLDDze3zB/YwADJEoOoJAKg7oTdH4SF+XxiZlMgSESzwAJdVn2iUJzzOUMiLhQKf+/va2FtBLMBuu1zpHcsincUXhtoTKLsCTVX/KF3wrLhPLm/OWzZtjQWfZ7RhYyAC/lxMowpSzJYJAyFkZDQc21FBMUT7BqGjpHxf3m+XlEPUHE/f3vGgPzmw4awRUaTexkyJhwfNShctVgZXyJDXq4CUyjNy6Y4fVOBIkAPR2GcOE7Jm2NQ/RE9YzXht3a5VYvlOX0xF0fy+tp/ozBuQg6DzZYb6Bi7ed4rB5Mp/1Co4cNhLUo1StLxDIDqrynUoRswiF6nFnIxsDpnZ5WBW0GFZ1qZ8HfLDk5txHHsGDpSa6B0cXZEa+DsTr1M+P4qPdXwjynU4+1/a7oN3Sm6G+meSd27oHsHde++7puj+tYpv7G6b7vun6L7l6n+oZp/t7JmUNUqqhpJV5upakJVLaqqgVW1t6rmV401NGMc1djqH4rpIseSfyPFkgAAVlA4IAQCAABQDACdASo8ADwAPm0yk0akIyGhJgzogA2JaQAThroHvLxu+aPf5G2BYxv+B6XHzx6GPon/o+qz/tOAA/TM82gR0vnExWoiQRM36jlg2UIvwCSqySErzuguz9EP2x/7hsNazr91aIworWI7AAD+/TZ+6Ipl444OdT+2wU0Ov+T8oJuVP/vUbT/w1Jsv6Awnl6rvF/xetfOPt3gTQZZi0Y/AOx563J7CJkqTR/fc/n34zyeKzR80fhfv4ef+Hjhz/CX5aQo+58zg/FdE+7bLo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v0eKCezuFNHecE11ojwJqWRSTWpalkz5autXp6vFS+FT1tWUsB/fs1CCOZxaA1vR1grOEaiuKe1RYm7e05psWtqbXLVmm1bA8Ly9PFkVdCbc6hR3UuBBsFGnVeGOUeMn2onnfvYhBMcM9YPxGdQkwZLXOk1VuQSTk01Shf3fZrFyRlFauftFdPYhKXwqrr+meav1P+KLKBVosqmHnFFfgExsQ/rOf3TSd+mOqQfJA+cF+HojNU7nmM3uDkoCBi+//Gqp+gPNNW8M4LFrol8rxE+7WsjqMgfwv1f+Nr25RtG1Wa/KkniRCAAAABFWElGugAAAEV4aWYAAElJKgAIAAAABgASAQMAAQAAAAEAAAAaAQUAAQAAAFYAAAAbAQUAAQAAAF4AAAAoAQMAAQAAAAIAAAATAgMAAQAAAAEAAABphwQAAQAAAGYAAAAAAAAASAAAAAEAAABIAAAAAQAAAAYAAJAHAAQAAAAwMjEwAZEHAAQAAAABAgMAAKAHAAQAAAAwMTAwAaADAAEAAAD//wAAAqAEAAEAAAA8AAAAA6AEAAEAAAA8AAAAAAAAAA==", Nt = {
2252
2401
  EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v: {
2253
2402
  symbol: "USDC",
2254
2403
  decimals: 6,
2255
- icon: xt
2404
+ icon: Ot
2256
2405
  },
2257
2406
  Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB: {
2258
2407
  symbol: "USDT",
2259
2408
  decimals: 6,
2260
- icon: Tt
2409
+ icon: It
2261
2410
  },
2262
2411
  "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo": {
2263
2412
  symbol: "PYUSD",
2264
2413
  decimals: 6,
2265
- icon: kt
2414
+ icon: Bt
2266
2415
  },
2267
2416
  CASHx9KJUStyftLFWGvEVf59SGeG9sh5FfcnZMVPCASH: {
2268
2417
  symbol: "CASH",
2269
2418
  decimals: 6,
2270
- icon: Rt
2419
+ icon: _t
2271
2420
  }
2272
- }, ae = Object.fromEntries(
2273
- Object.entries(Mt).map(([t, e]) => [t, e.symbol])
2421
+ }, oe = Object.fromEntries(
2422
+ Object.entries(Nt).map(([t, e]) => [t, e.symbol])
2274
2423
  );
2275
- function Dt(t) {
2276
- return t in ae;
2424
+ function Ft(t) {
2425
+ return t in oe;
2277
2426
  }
2278
- function Fe(t, e = "token mint", r = !1) {
2427
+ function je(t, e = "token mint", r = !1) {
2279
2428
  if (!t || t.trim().length === 0)
2280
2429
  return {
2281
2430
  isValid: !0,
2282
2431
  isKnownStablecoin: !1
2283
2432
  };
2284
2433
  const a = t.trim();
2285
- if (Dt(a))
2434
+ if (Ft(a))
2286
2435
  return {
2287
2436
  isValid: !0,
2288
2437
  isKnownStablecoin: !0,
2289
- symbol: ae[a]
2438
+ symbol: oe[a]
2290
2439
  };
2291
- const n = Object.entries(ae).map(([i, o]) => ` ${o}: ${i}`).join(`
2440
+ const n = Object.entries(oe).map(([i, o]) => ` ${o}: ${i}`).join(`
2292
2441
  `);
2293
2442
  return r ? {
2294
2443
  isValid: !0,
@@ -2337,18 +2486,18 @@ function Fe(t, e = "token mint", r = !1) {
2337
2486
  `)
2338
2487
  };
2339
2488
  }
2340
- function Wt(t, e = "unknown", r = !1) {
2341
- return Fe(t, `X402Requirement (resource: ${e})`, r);
2489
+ function $t(t, e = "unknown", r = !1) {
2490
+ return je(t, `X402Requirement (resource: ${e})`, r);
2342
2491
  }
2343
- const pe = /* @__PURE__ */ new Set(["mainnet-beta", "devnet", "testnet"]);
2344
- function Ot() {
2492
+ const be = /* @__PURE__ */ new Set(["mainnet-beta", "devnet", "testnet"]);
2493
+ function Ut() {
2345
2494
  if (typeof window < "u" && window.location)
2346
2495
  return window.location.origin;
2347
2496
  throw new Error(
2348
2497
  "serverUrl is required in SSR/Node environments. In browser environments, it defaults to window.location.origin"
2349
2498
  );
2350
2499
  }
2351
- function Bt(t) {
2500
+ function Ht(t) {
2352
2501
  const e = [];
2353
2502
  if (t.showCard !== !1) {
2354
2503
  const n = t.stripePublicKey;
@@ -2368,16 +2517,16 @@ function Bt(t) {
2368
2517
  }), a = t.serverUrl);
2369
2518
  else
2370
2519
  try {
2371
- a = Ot();
2520
+ a = Ut();
2372
2521
  } catch (n) {
2373
2522
  e.push({
2374
2523
  field: "serverUrl",
2375
2524
  message: n instanceof Error ? n.message : "failed to determine default"
2376
2525
  }), a = "";
2377
2526
  }
2378
- if (pe.has(t.solanaCluster) || e.push({
2527
+ if (be.has(t.solanaCluster) || e.push({
2379
2528
  field: "solanaCluster",
2380
- message: `must be one of ${Array.from(pe).join(", ")}`
2529
+ message: `must be one of ${Array.from(be).join(", ")}`
2381
2530
  }), t.solanaEndpoint !== void 0 && (typeof t.solanaEndpoint != "string" ? e.push({
2382
2531
  field: "solanaEndpoint",
2383
2532
  message: "must be a string when provided"
@@ -2397,7 +2546,7 @@ function Bt(t) {
2397
2546
  ${n}`);
2398
2547
  }
2399
2548
  if (t.tokenMint) {
2400
- const n = t.dangerouslyAllowUnknownMint === !0, i = Fe(t.tokenMint, "CedrosConfig.tokenMint", n);
2549
+ const n = t.dangerouslyAllowUnknownMint === !0, i = je(t.tokenMint, "CedrosConfig.tokenMint", n);
2401
2550
  if (!i.isValid && i.error)
2402
2551
  throw new Error(i.error);
2403
2552
  i.warning && l().warn(i.warning);
@@ -2407,7 +2556,7 @@ ${n}`);
2407
2556
  serverUrl: a
2408
2557
  };
2409
2558
  }
2410
- const _t = Object.freeze({
2559
+ const Lt = Object.freeze({
2411
2560
  surfaceBackground: "rgba(255, 255, 255, 0)",
2412
2561
  surfaceText: "#111827",
2413
2562
  surfaceBorder: "rgba(15, 23, 42, 0.08)",
@@ -2430,7 +2579,7 @@ const _t = Object.freeze({
2430
2579
  buttonPadding: "0.75rem 1.5rem",
2431
2580
  buttonFontSize: "1rem",
2432
2581
  buttonFontWeight: "600"
2433
- }), It = Object.freeze({
2582
+ }), qt = Object.freeze({
2434
2583
  surfaceBackground: "rgba(17, 24, 39, 0.6)",
2435
2584
  surfaceText: "#f9fafb",
2436
2585
  surfaceBorder: "rgba(148, 163, 184, 0.25)",
@@ -2453,7 +2602,7 @@ const _t = Object.freeze({
2453
2602
  buttonPadding: "0.75rem 1.5rem",
2454
2603
  buttonFontSize: "1rem",
2455
2604
  buttonFontWeight: "600"
2456
- }), Nt = {
2605
+ }), jt = {
2457
2606
  surfaceBackground: "--cedros-surface-bg",
2458
2607
  surfaceText: "--cedros-surface-text",
2459
2608
  surfaceBorder: "--cedros-surface-border",
@@ -2476,175 +2625,177 @@ const _t = Object.freeze({
2476
2625
  buttonPadding: "--cedros-button-padding",
2477
2626
  buttonFontSize: "--cedros-button-font-size",
2478
2627
  buttonFontWeight: "--cedros-button-font-weight"
2479
- }, se = Ae(null);
2480
- function Ut(t, e) {
2628
+ }, ue = Ee(null);
2629
+ function zt(t, e) {
2481
2630
  return {
2482
- ...t === "dark" ? It : _t,
2631
+ ...t === "dark" ? qt : Lt,
2483
2632
  ...e
2484
2633
  };
2485
2634
  }
2486
- function Ft(t) {
2635
+ function Qt(t) {
2487
2636
  const e = Object.entries(t).map(([r, a]) => [
2488
- Nt[r],
2637
+ jt[r],
2489
2638
  a
2490
2639
  ]);
2491
2640
  return Object.fromEntries(e);
2492
2641
  }
2493
- function Ht({
2642
+ function Wt({
2494
2643
  initialMode: t = "light",
2495
2644
  overrides: e,
2496
2645
  unstyled: r = !1,
2497
2646
  children: a
2498
2647
  }) {
2499
- const [n, i] = N(t), [o, s] = N(e), c = ge(e);
2500
- I(() => {
2648
+ const [n, i] = U(t), [o, s] = U(e), c = ve(e);
2649
+ F(() => {
2501
2650
  if (e === c.current)
2502
2651
  return;
2503
2652
  (!e || !c.current ? e !== c.current : Object.keys({ ...e, ...c.current }).some(
2504
- (u) => e[u] !== c.current?.[u]
2653
+ (h) => e[h] !== c.current?.[h]
2505
2654
  )) && (c.current = e, s(e));
2506
2655
  }, [e]);
2507
- const d = ee(() => {
2508
- const m = Ut(n, o), u = r ? {} : Ft(m), y = r ? "" : `cedros-theme-root cedros-theme cedros-theme--${n}`;
2656
+ const u = ae(() => {
2657
+ const f = zt(n, o), h = r ? {} : Qt(f), y = r ? "" : `cedros-theme-root cedros-theme cedros-theme--${n}`;
2509
2658
  return {
2510
2659
  mode: n,
2511
2660
  setMode: i,
2512
- tokens: m,
2661
+ tokens: f,
2513
2662
  className: y,
2514
- style: u,
2663
+ style: h,
2515
2664
  unstyled: r
2516
2665
  };
2517
2666
  }, [n, o, r]);
2518
- return /* @__PURE__ */ K(se.Provider, { value: d, children: a });
2667
+ return /* @__PURE__ */ J(ue.Provider, { value: u, children: a });
2519
2668
  }
2520
- function Kt() {
2521
- const t = ne(se);
2669
+ function Xt() {
2670
+ const t = se(ue);
2522
2671
  if (!t)
2523
2672
  throw new Error("useCedrosTheme must be used within CedrosProvider");
2524
2673
  return t;
2525
2674
  }
2526
- function Gt() {
2527
- return ne(se);
2675
+ function Zt() {
2676
+ return se(ue);
2528
2677
  }
2529
- const $ = {
2678
+ const re = {
2530
2679
  getAdapters: () => [],
2531
2680
  cleanup: async () => {
2532
2681
  },
2533
2682
  isInitialized: () => !1,
2534
2683
  getId: () => "stub"
2535
2684
  };
2536
- function Lt() {
2685
+ function Kt() {
2537
2686
  return typeof process < "u" && process.env.NODE_ENV === "development" ? 0 : 2;
2538
2687
  }
2539
- const He = Ae(null);
2540
- function Vt({ config: t, children: e }) {
2541
- const r = ee(() => Bt(t), [t]), [a, n] = N(null), [i, o] = N($), s = ge($);
2542
- I(() => {
2543
- let f = !1;
2544
- return import("./walletPool-DgQsh7Se.mjs").then(({ createWalletPool: h }) => {
2545
- if (f) return;
2546
- const w = h();
2547
- s.current = w, o(w);
2548
- }).catch((h) => {
2549
- f || (l().error("[CedrosProvider] Wallet pool initialization failed:", h), n("Failed to initialize Cedros provider"));
2688
+ const ze = Ee(null);
2689
+ function er({ config: t, children: e }) {
2690
+ const r = ae(() => Ht(t), [t]), [a, n] = U(null), [i, o] = U(re), s = ve(re);
2691
+ F(() => {
2692
+ let d = !1;
2693
+ return import("./walletPool-DE-t1wSW.mjs").then(({ createWalletPool: m }) => {
2694
+ if (d) return;
2695
+ const A = m();
2696
+ s.current = A, o(A);
2697
+ }).catch((m) => {
2698
+ d || (l().error("[CedrosProvider] Wallet pool initialization failed:", m), n("Failed to initialize Cedros provider"));
2550
2699
  }), () => {
2551
- f = !0;
2700
+ d = !0;
2552
2701
  };
2553
2702
  }, []);
2554
- const [c, d] = N(null);
2555
- I(() => {
2556
- let f = !1;
2703
+ const [c, u] = U(null);
2704
+ F(() => {
2705
+ let d = !1;
2557
2706
  return import("./solanaCheck-IlYsbXDd.mjs").then(
2558
- ({ checkSolanaAvailability: h }) => h()
2559
- ).then((h) => {
2560
- f || (h.available ? d(void 0) : d(h.error || "Solana dependencies not available"));
2561
- }).catch((h) => {
2562
- f || (l().warn("[CedrosProvider] Solana availability check failed:", h), d("Unable to verify Solana availability"));
2707
+ ({ checkSolanaAvailability: m }) => m()
2708
+ ).then((m) => {
2709
+ d || (m.available ? u(void 0) : u(m.error || "Solana dependencies not available"));
2710
+ }).catch((m) => {
2711
+ d || (l().warn("[CedrosProvider] Solana availability check failed:", m), u("Unable to verify Solana availability"));
2563
2712
  }), () => {
2564
- f = !0;
2713
+ d = !0;
2565
2714
  };
2566
- }, []), I(() => {
2567
- const f = r.logLevel ?? Lt(), h = Xe({
2568
- level: f,
2715
+ }, []), F(() => {
2716
+ const d = r.logLevel ?? Kt(), m = et({
2717
+ level: d,
2569
2718
  prefix: "[CedrosPay]"
2570
2719
  });
2571
- Ye(h);
2572
- }, [r.logLevel]), I(() => () => {
2573
- const f = s.current;
2574
- f && f !== $ && f.cleanup().catch((h) => {
2575
- l().warn("[CedrosProvider] Wallet pool cleanup failed:", h);
2720
+ Ze(m);
2721
+ }, [r.logLevel]), F(() => () => {
2722
+ const d = s.current;
2723
+ d && d !== re && d.cleanup().catch((m) => {
2724
+ l().warn("[CedrosProvider] Wallet pool cleanup failed:", m);
2576
2725
  });
2577
2726
  }, []);
2578
- const [m, u] = N(null);
2579
- I(() => {
2580
- let f = !1, h = !1;
2581
- const w = r.stripePublicKey ?? "", C = r.serverUrl ?? "", x = r.solanaCluster, B = r.solanaEndpoint, T = r.dangerouslyAllowUnknownMint;
2582
- return St(w, C, x, B, T).then((D) => {
2583
- if (f) {
2584
- ye(w, C, x, B, T);
2727
+ const [f, h] = U(null);
2728
+ F(() => {
2729
+ let d = !1, m = !1;
2730
+ const A = r.stripePublicKey ?? "", b = r.serverUrl ?? "", x = r.solanaCluster, D = r.solanaEndpoint, M = r.dangerouslyAllowUnknownMint, S = r.complianceCheck;
2731
+ return Dt(A, b, x, D, M, S).then((_) => {
2732
+ if (d) {
2733
+ we(A, b, x, D, M, S);
2585
2734
  return;
2586
2735
  }
2587
- h = !0, u(D);
2588
- }).catch((D) => {
2589
- f || (l().error("[CedrosProvider] Manager initialization failed:", D), n("Failed to initialize Cedros provider"));
2736
+ m = !0, h(_);
2737
+ }).catch((_) => {
2738
+ d || (l().error("[CedrosProvider] Manager initialization failed:", _), n("Failed to initialize Cedros provider"));
2590
2739
  }), () => {
2591
- f = !0, h && ye(w, C, x, B, T);
2740
+ d = !0, m && we(A, b, x, D, M, S);
2592
2741
  };
2593
2742
  }, [
2594
2743
  r.stripePublicKey,
2595
2744
  r.serverUrl,
2596
2745
  r.solanaCluster,
2597
2746
  r.solanaEndpoint,
2598
- r.dangerouslyAllowUnknownMint
2747
+ r.dangerouslyAllowUnknownMint,
2748
+ r.complianceCheck
2599
2749
  ]);
2600
- const y = ee(() => m ? {
2750
+ const y = ae(() => f ? {
2601
2751
  config: r,
2602
- ...m,
2752
+ ...f,
2603
2753
  walletPool: i,
2604
2754
  solanaError: c
2605
- } : null, [r, m, i, c]);
2606
- return a ? /* @__PURE__ */ K("div", { role: "alert", children: a }) : /* @__PURE__ */ K(
2607
- Ht,
2755
+ } : null, [r, f, i, c]);
2756
+ return a ? /* @__PURE__ */ J("div", { role: "alert", children: a }) : /* @__PURE__ */ J(
2757
+ Wt,
2608
2758
  {
2609
2759
  initialMode: r.theme ?? "light",
2610
2760
  overrides: r.themeOverrides,
2611
2761
  unstyled: r.unstyled ?? !1,
2612
- children: y ? /* @__PURE__ */ K(He.Provider, { value: y, children: e }) : null
2762
+ children: y ? /* @__PURE__ */ J(ze.Provider, { value: y, children: e }) : null
2613
2763
  }
2614
2764
  );
2615
2765
  }
2616
- function Jt() {
2617
- const t = ne(He);
2766
+ function tr() {
2767
+ const t = se(ze);
2618
2768
  if (!t)
2619
2769
  throw new Error("useCedrosContext must be used within CedrosProvider");
2620
2770
  return t;
2621
2771
  }
2622
2772
  export {
2623
- Vt as C,
2624
- at as E,
2625
- ae as K,
2626
- Ve as L,
2627
- O as P,
2628
- M as R,
2629
- Mt as S,
2630
- Kt as a,
2631
- j as b,
2632
- R as c,
2633
- et as d,
2634
- A as e,
2635
- Qt as f,
2636
- E as g,
2637
- Ee as h,
2773
+ Yt as C,
2774
+ ot as E,
2775
+ oe as K,
2776
+ $e as L,
2777
+ N as P,
2778
+ B as R,
2779
+ Nt as S,
2780
+ er as a,
2781
+ g as b,
2782
+ at as c,
2783
+ xe as d,
2784
+ v as e,
2785
+ Q as f,
2786
+ et as g,
2787
+ I as h,
2638
2788
  l as i,
2639
- Xe as j,
2640
- Wt as k,
2641
- me as l,
2642
- k as m,
2643
- Fe as n,
2644
- rt as o,
2789
+ Xt as j,
2790
+ $t as k,
2791
+ ge as l,
2792
+ O as m,
2793
+ je as n,
2794
+ it as o,
2645
2795
  p,
2646
- Gt as q,
2647
- b as r,
2648
- Jt as u,
2649
- Bt as v
2796
+ Zt as q,
2797
+ E as r,
2798
+ w as s,
2799
+ tr as u,
2800
+ Ht as v
2650
2801
  };