@cedros/pay-react 1.1.24 → 1.1.26

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 (174) hide show
  1. package/dist/{AISettingsSection-Dw0ZlxMf.mjs → AISettingsSection-BlIv3CzS.mjs} +2 -2
  2. package/dist/{AISettingsSection-IXS1Wt_1.js → AISettingsSection-DELur7D2.js} +1 -1
  3. package/dist/{AutosaveIndicator-BJsg_kFZ.mjs → AutosaveIndicator-Bed0-ekg.mjs} +1 -1
  4. package/dist/{AutosaveIndicator-CY_YHM1D.js → AutosaveIndicator-Dn_qA2hK.js} +1 -1
  5. package/dist/CedrosContext-C2RjHLaQ.js +6 -0
  6. package/dist/{CedrosContext-DQUbL8yP.mjs → CedrosContext-CY6zvjvJ.mjs} +768 -617
  7. package/dist/ChatLogsSection-BH5tLA4T.js +1 -0
  8. package/dist/ChatLogsSection-v4zwzCTC.mjs +201 -0
  9. package/dist/ComplianceSection-CemgfDrL.mjs +650 -0
  10. package/dist/ComplianceSection-DP2a9-S0.js +1 -0
  11. package/dist/{CryptoButton-D1BCZBk4.mjs → CryptoButton-BV9owVe2.mjs} +2 -2
  12. package/dist/{CryptoButton-C1AAOOfj.js → CryptoButton-DpiCnyXE.js} +1 -1
  13. package/dist/CustomersSection-CBwy_waO.js +1 -0
  14. package/dist/CustomersSection-D_j7OrfS.mjs +207 -0
  15. package/dist/DisputesSection-BLjIk60n.js +1 -0
  16. package/dist/DisputesSection-BcAbXp3K.mjs +230 -0
  17. package/dist/{FAQSection-C78MnK4k.mjs → FAQSection-Dn38OhB_.mjs} +1 -1
  18. package/dist/{FAQSection-BmgmzDN5.js → FAQSection-wNeH0i6Q.js} +1 -1
  19. package/dist/ImagesSection-0ZzKlzMJ.js +1 -0
  20. package/dist/ImagesSection-Ctw9Icym.mjs +216 -0
  21. package/dist/InventorySection-DmhjUlRZ.mjs +150 -0
  22. package/dist/InventorySection-zV6lTmue.js +1 -0
  23. package/dist/{MessagingSection-De3t8bSI.mjs → MessagingSection-B1FaGxkp.mjs} +2 -2
  24. package/dist/{MessagingSection-CWLZcg11.js → MessagingSection-B_wdFR0j.js} +1 -1
  25. package/dist/{OrdersSection-_xKVzjSZ.mjs → OrdersSection-Bj8bPdg8.mjs} +6 -6
  26. package/dist/{OrdersSection-BKOxsZw0.js → OrdersSection-Dw2FX-1d.js} +1 -1
  27. package/dist/{PaymentSettingsSection-BTEn9Dxb.js → PaymentSettingsSection-BYF4D-GR.js} +1 -1
  28. package/dist/{PaymentSettingsSection-KjU_dN_d.mjs → PaymentSettingsSection-EnMxeWjv.mjs} +1 -1
  29. package/dist/ReturnsSection-BC0L8r2e.mjs +267 -0
  30. package/dist/ReturnsSection-D_pJVxuG.js +1 -0
  31. package/dist/{SettingsSection-8QHZB59k.mjs → SettingsSection-KYdEizq_.mjs} +19 -13
  32. package/dist/SettingsSection-vdYFSNxB.js +1 -0
  33. package/dist/ShippingSection-1DRSTu49.js +1 -0
  34. package/dist/ShippingSection-BOgto6_9.mjs +434 -0
  35. package/dist/{SingleCategorySettings-CRXTMTo5.js → SingleCategorySettings-DwCnBdRf.js} +1 -1
  36. package/dist/{SingleCategorySettings--LK0TZW0.mjs → SingleCategorySettings-suJ8z9d8.mjs} +4 -4
  37. package/dist/{StorefrontSection-CeCpr8hn.mjs → StorefrontSection-BRvIGBEJ.mjs} +2 -2
  38. package/dist/{StorefrontSection-C9DzCmOf.js → StorefrontSection-RumGkb3C.js} +1 -1
  39. package/dist/{SubscriptionsSection-Dn5SY6S_.js → SubscriptionsSection-C2aLLn7L.js} +1 -1
  40. package/dist/{SubscriptionsSection-C2xk8ApF.mjs → SubscriptionsSection-D60qrX9a.mjs} +7 -7
  41. package/dist/TaxSection-C7-pv-Rl.mjs +294 -0
  42. package/dist/TaxSection-Dt1DnM51.js +1 -0
  43. package/dist/Token22Section-CrHLQ0EB.mjs +2260 -0
  44. package/dist/Token22Section-DY3mUwTY.js +1 -0
  45. package/dist/{WalletManager-Bwk3rgr1.js → WalletManager-B3UdQ5pQ.js} +1 -1
  46. package/dist/{WalletManager-CXvQ0Zu9.mjs → WalletManager-BIwH8Dw_.mjs} +1 -1
  47. package/dist/WebhooksSection-CKeiJ7Py.js +1 -0
  48. package/dist/WebhooksSection-COPW4Ec0.mjs +223 -0
  49. package/dist/{configApi-Ch0Rr7TD.mjs → configApi-6XhAJGKX.mjs} +31 -0
  50. package/dist/{configApi-CxEbCAgG.js → configApi-DkduMQg1.js} +1 -1
  51. package/dist/crypto-only.js +1 -1
  52. package/dist/crypto-only.mjs +85 -83
  53. package/dist/index-C0g-JxJk.js +84 -0
  54. package/dist/{index-BHF82XBB.mjs → index-DXnuQp5x.mjs} +8643 -7678
  55. package/dist/index.js +1 -1
  56. package/dist/index.mjs +42 -40
  57. package/dist/{sections-C1rb9YRh.mjs → sections-C1NpK7hk.mjs} +2 -2
  58. package/dist/{sections-8e5Y3ukY.js → sections-DVVSZBhW.js} +1 -1
  59. package/dist/src/admin/plugin.d.ts.map +1 -1
  60. package/dist/src/components/ComplianceGatePage.d.ts +40 -0
  61. package/dist/src/components/ComplianceGatePage.d.ts.map +1 -0
  62. package/dist/src/components/SubscribeButton.d.ts +1 -5
  63. package/dist/src/components/SubscribeButton.d.ts.map +1 -1
  64. package/dist/src/components/admin/AdminAuthManager.d.ts +7 -3
  65. package/dist/src/components/admin/AdminAuthManager.d.ts.map +1 -1
  66. package/dist/src/components/admin/AssetClassesTab.d.ts.map +1 -1
  67. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +1 -1
  68. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
  69. package/dist/src/components/admin/ChatLogsSection.d.ts +3 -0
  70. package/dist/src/components/admin/ChatLogsSection.d.ts.map +1 -0
  71. package/dist/src/components/admin/ComplianceKycTab.d.ts +3 -0
  72. package/dist/src/components/admin/ComplianceKycTab.d.ts.map +1 -0
  73. package/dist/src/components/admin/ComplianceRequirementsEditor.d.ts +8 -0
  74. package/dist/src/components/admin/ComplianceRequirementsEditor.d.ts.map +1 -0
  75. package/dist/src/components/admin/ComplianceSanctionsApi.d.ts +3 -0
  76. package/dist/src/components/admin/ComplianceSanctionsApi.d.ts.map +1 -0
  77. package/dist/src/components/admin/ComplianceSection.d.ts +3 -0
  78. package/dist/src/components/admin/ComplianceSection.d.ts.map +1 -0
  79. package/dist/src/components/admin/CustomersSection.d.ts +3 -0
  80. package/dist/src/components/admin/CustomersSection.d.ts.map +1 -0
  81. package/dist/src/components/admin/DisputesSection.d.ts +3 -0
  82. package/dist/src/components/admin/DisputesSection.d.ts.map +1 -0
  83. package/dist/src/components/admin/GiftCardAnalytics.d.ts +3 -0
  84. package/dist/src/components/admin/GiftCardAnalytics.d.ts.map +1 -0
  85. package/dist/src/components/admin/GiftCardManager.d.ts +3 -0
  86. package/dist/src/components/admin/GiftCardManager.d.ts.map +1 -0
  87. package/dist/src/components/admin/ImagesSection.d.ts +3 -0
  88. package/dist/src/components/admin/ImagesSection.d.ts.map +1 -0
  89. package/dist/src/components/admin/InventorySection.d.ts +3 -0
  90. package/dist/src/components/admin/InventorySection.d.ts.map +1 -0
  91. package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -1
  92. package/dist/src/components/admin/NftMetadataPreview.d.ts +20 -0
  93. package/dist/src/components/admin/NftMetadataPreview.d.ts.map +1 -0
  94. package/dist/src/components/admin/PoolManagementView.d.ts +14 -0
  95. package/dist/src/components/admin/PoolManagementView.d.ts.map +1 -0
  96. package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
  97. package/dist/src/components/admin/RefundsSection.d.ts.map +1 -1
  98. package/dist/src/components/admin/ReturnsSection.d.ts +3 -0
  99. package/dist/src/components/admin/ReturnsSection.d.ts.map +1 -0
  100. package/dist/src/components/admin/SettingsSection.d.ts.map +1 -1
  101. package/dist/src/components/admin/ShippingSection.d.ts +3 -0
  102. package/dist/src/components/admin/ShippingSection.d.ts.map +1 -0
  103. package/dist/src/components/admin/TaxSection.d.ts +3 -0
  104. package/dist/src/components/admin/TaxSection.d.ts.map +1 -0
  105. package/dist/src/components/admin/Token22Section.d.ts.map +1 -1
  106. package/dist/src/components/admin/WebhooksSection.d.ts +3 -0
  107. package/dist/src/components/admin/WebhooksSection.d.ts.map +1 -0
  108. package/dist/src/components/admin/complianceTypes.d.ts +74 -0
  109. package/dist/src/components/admin/complianceTypes.d.ts.map +1 -0
  110. package/dist/src/components/admin/configApi.d.ts.map +1 -1
  111. package/dist/src/components/admin/icons.d.ts +1 -0
  112. package/dist/src/components/admin/icons.d.ts.map +1 -1
  113. package/dist/src/components/admin/useAdminAuth.d.ts +1 -1
  114. package/dist/src/components/admin/useAdminAuth.d.ts.map +1 -1
  115. package/dist/src/context/CedrosContext.d.ts.map +1 -1
  116. package/dist/src/ecommerce/adapters/CommerceAdapter.d.ts +36 -0
  117. package/dist/src/ecommerce/adapters/CommerceAdapter.d.ts.map +1 -1
  118. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
  119. package/dist/src/ecommerce/components/catalog/TokenDisplay.d.ts +36 -0
  120. package/dist/src/ecommerce/components/catalog/TokenDisplay.d.ts.map +1 -0
  121. package/dist/src/ecommerce/components/chat/ShopChatPanel.d.ts +8 -5
  122. package/dist/src/ecommerce/components/chat/ShopChatPanel.d.ts.map +1 -1
  123. package/dist/src/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -1
  124. package/dist/src/ecommerce/components/checkout/SendAsGiftSection.d.ts +15 -0
  125. package/dist/src/ecommerce/components/checkout/SendAsGiftSection.d.ts.map +1 -0
  126. package/dist/src/ecommerce/components/gift-cards/GiftCardBalanceChecker.d.ts +19 -0
  127. package/dist/src/ecommerce/components/gift-cards/GiftCardBalanceChecker.d.ts.map +1 -0
  128. package/dist/src/ecommerce/components/orders/MyRedemptionsPage.d.ts +13 -0
  129. package/dist/src/ecommerce/components/orders/MyRedemptionsPage.d.ts.map +1 -0
  130. package/dist/src/ecommerce/components/orders/MyTokensPage.d.ts +15 -0
  131. package/dist/src/ecommerce/components/orders/MyTokensPage.d.ts.map +1 -0
  132. package/dist/src/ecommerce/components/orders/OrderDetails.d.ts.map +1 -1
  133. package/dist/src/ecommerce/hooks/useCartInventory.d.ts.map +1 -1
  134. package/dist/src/ecommerce/index.d.ts +12 -2
  135. package/dist/src/ecommerce/index.d.ts.map +1 -1
  136. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts +3 -0
  137. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -1
  138. package/dist/src/ecommerce/state/checkout/useCheckout.d.ts.map +1 -1
  139. package/dist/src/ecommerce/types.d.ts +6 -0
  140. package/dist/src/ecommerce/types.d.ts.map +1 -1
  141. package/dist/src/ecommerce/utils/cartItemMetadata.d.ts.map +1 -1
  142. package/dist/src/hooks/useComplianceCheck.d.ts +30 -0
  143. package/dist/src/hooks/useComplianceCheck.d.ts.map +1 -0
  144. package/dist/src/hooks/useSubscriptionManagement.d.ts.map +1 -1
  145. package/dist/src/index.d.ts +4 -0
  146. package/dist/src/index.d.ts.map +1 -1
  147. package/dist/src/managers/CreditsManager.d.ts.map +1 -1
  148. package/dist/src/managers/ManagerCache.d.ts +2 -2
  149. package/dist/src/managers/ManagerCache.d.ts.map +1 -1
  150. package/dist/src/managers/StripeManager.d.ts +7 -1
  151. package/dist/src/managers/StripeManager.d.ts.map +1 -1
  152. package/dist/src/managers/SubscriptionChangeManager.d.ts.map +1 -1
  153. package/dist/src/managers/SubscriptionManager.d.ts.map +1 -1
  154. package/dist/src/types/index.d.ts +14 -0
  155. package/dist/src/types/index.d.ts.map +1 -1
  156. package/dist/src/types/subscription.d.ts +21 -33
  157. package/dist/src/types/subscription.d.ts.map +1 -1
  158. package/dist/src/utils/exponentialBackoff.d.ts +22 -0
  159. package/dist/src/utils/exponentialBackoff.d.ts.map +1 -1
  160. package/dist/stripe-only.js +1 -1
  161. package/dist/stripe-only.mjs +2 -2
  162. package/dist/styles-BT4bhFey.js +1 -0
  163. package/dist/{styles-Ag-7ZvAB.mjs → styles-D4SQkuV3.mjs} +606 -609
  164. package/dist/testing/index.js +1 -1
  165. package/dist/testing/index.mjs +1 -1
  166. package/dist/{walletPool-C_0P4mTw.mjs → walletPool-DE-t1wSW.mjs} +1 -1
  167. package/dist/{walletPool-Ddv33tej.js → walletPool-IS7R3MR1.js} +1 -1
  168. package/package.json +1 -1
  169. package/dist/CedrosContext-7dwmEeUY.js +0 -6
  170. package/dist/SettingsSection-cKF0tLnS.js +0 -1
  171. package/dist/Token22Section-DUUl59dZ.js +0 -1
  172. package/dist/Token22Section-HygkDNtL.mjs +0 -1685
  173. package/dist/index-OaWkrl0G.js +0 -84
  174. package/dist/styles-21F1-oqx.js +0 -1
@@ -0,0 +1,2260 @@
1
+ import { jsxs as t, jsx as e, Fragment as O } from "react/jsx-runtime";
2
+ import { useState as p, useCallback as M, useEffect as H, useRef as Te } from "react";
3
+ import { E as Ne, I as Be } from "./index-DXnuQp5x.mjs";
4
+ import { a as ae } from "./configApi-6XhAJGKX.mjs";
5
+ const ke = [
6
+ { value: "text", label: "Short Text" },
7
+ { value: "email", label: "Email" },
8
+ { value: "phone", label: "Phone" },
9
+ { value: "address", label: "Address" },
10
+ { value: "textarea", label: "Long Text" },
11
+ { value: "dropdown", label: "Dropdown" },
12
+ { value: "file_upload", label: "File Upload" }
13
+ ], ve = { fields: [], requiresApproval: !0 }, K = { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem", boxSizing: "border-box" }, V = { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, ie = { padding: "0.4rem 1rem", borderRadius: 6, border: "1px solid rgba(0,0,0,0.2)", background: "white", cursor: "pointer", fontSize: "0.85rem" };
14
+ function Re() {
15
+ return { id: Math.random().toString(36).slice(2), label: "", fieldType: "text", required: !1, options: [], placeholder: "" };
16
+ }
17
+ function Ce({ field: n, onSave: r, onCancel: a }) {
18
+ const [i, s] = p(n), [c, f] = p(""), h = (o) => s((l) => ({ ...l, ...o })), S = () => {
19
+ const o = c.trim();
20
+ o && (h({ options: [...i.options, o] }), f(""));
21
+ };
22
+ return /* @__PURE__ */ t("div", { style: { padding: "0.75rem", border: "1px solid rgba(37,99,235,0.3)", borderRadius: 6, background: "#eff6ff", marginTop: 6 }, children: [
23
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.6rem", marginBottom: "0.6rem" }, children: [
24
+ /* @__PURE__ */ t("div", { children: [
25
+ /* @__PURE__ */ e("label", { style: V, children: "Label *" }),
26
+ /* @__PURE__ */ e("input", { style: K, value: i.label, onChange: (o) => h({ label: o.target.value }), placeholder: "e.g., Full Name" })
27
+ ] }),
28
+ /* @__PURE__ */ t("div", { children: [
29
+ /* @__PURE__ */ e("label", { style: V, children: "Field Type" }),
30
+ /* @__PURE__ */ e("select", { style: K, value: i.fieldType, onChange: (o) => h({ fieldType: o.target.value, options: [] }), children: ke.map((o) => /* @__PURE__ */ e("option", { value: o.value, children: o.label }, o.value)) })
31
+ ] })
32
+ ] }),
33
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr auto", gap: "0.6rem", alignItems: "end", marginBottom: "0.6rem" }, children: [
34
+ /* @__PURE__ */ t("div", { children: [
35
+ /* @__PURE__ */ e("label", { style: V, children: "Placeholder" }),
36
+ /* @__PURE__ */ e("input", { style: K, value: i.placeholder ?? "", onChange: (o) => h({ placeholder: o.target.value }), placeholder: "Optional hint text" })
37
+ ] }),
38
+ /* @__PURE__ */ t("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: "0.85rem", cursor: "pointer", paddingBottom: 2 }, children: [
39
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: i.required, onChange: (o) => h({ required: o.target.checked }) }),
40
+ " Required"
41
+ ] })
42
+ ] }),
43
+ i.fieldType === "dropdown" && /* @__PURE__ */ t("div", { style: { marginBottom: "0.6rem" }, children: [
44
+ /* @__PURE__ */ e("label", { style: V, children: "Options" }),
45
+ i.options.map((o, l) => /* @__PURE__ */ t("div", { style: { display: "flex", gap: 6, marginBottom: 4 }, children: [
46
+ /* @__PURE__ */ e("span", { style: { flex: 1, fontSize: "0.85rem", padding: "0.25rem 0.5rem", background: "white", border: "1px solid rgba(0,0,0,0.15)", borderRadius: 4 }, children: o }),
47
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => h({ options: i.options.filter((m, w) => w !== l) }), style: { padding: "0.2rem 0.5rem", borderRadius: 4, border: "1px solid rgba(0,0,0,0.2)", background: "white", cursor: "pointer", fontSize: "0.8rem", color: "#dc2626" }, children: "x" })
48
+ ] }, l)),
49
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 6 }, children: [
50
+ /* @__PURE__ */ e("input", { style: { ...K, flex: 1 }, value: c, onChange: (o) => f(o.target.value), onKeyDown: (o) => o.key === "Enter" && (o.preventDefault(), S()), placeholder: "Add option..." }),
51
+ /* @__PURE__ */ e("button", { type: "button", onClick: S, style: ie, children: "Add" })
52
+ ] })
53
+ ] }),
54
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 6 }, children: [
55
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => r(i), disabled: !i.label.trim(), style: { padding: "0.35rem 1rem", borderRadius: 6, border: "none", background: "#2563eb", color: "white", cursor: i.label.trim() ? "pointer" : "not-allowed", fontSize: "0.85rem", opacity: i.label.trim() ? 1 : 0.5 }, children: "Save Field" }),
56
+ /* @__PURE__ */ e("button", { type: "button", onClick: a, style: ie, children: "Cancel" })
57
+ ] })
58
+ ] });
59
+ }
60
+ function ze({ fields: n, instructions: r }) {
61
+ const a = { ...K, fontSize: "0.85rem", background: "white", opacity: 0.6 };
62
+ return /* @__PURE__ */ t("div", { style: { padding: "1rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 8, background: "rgba(0,0,0,0.02)" }, children: [
63
+ /* @__PURE__ */ e("div", { style: { fontSize: "0.75rem", fontWeight: 600, color: "rgba(0,0,0,0.4)", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: "0.75rem" }, children: "Preview — Redeemer View" }),
64
+ r && /* @__PURE__ */ e("div", { style: { padding: "0.6rem 0.75rem", background: "#fffbeb", border: "1px solid #fcd34d", borderRadius: 6, fontSize: "0.85rem", marginBottom: "0.75rem", color: "#92400e" }, children: r }),
65
+ n.length === 0 && /* @__PURE__ */ e("div", { style: { fontSize: "0.85rem", color: "rgba(0,0,0,0.35)", fontStyle: "italic" }, children: "No fields added yet." }),
66
+ n.map((i) => /* @__PURE__ */ t("div", { style: { marginBottom: "0.6rem" }, children: [
67
+ /* @__PURE__ */ t("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: [
68
+ i.label || "Unlabelled field",
69
+ i.required && /* @__PURE__ */ e("span", { style: { color: "#dc2626", marginLeft: 2 }, children: "*" })
70
+ ] }),
71
+ i.fieldType === "textarea" && /* @__PURE__ */ e("textarea", { disabled: !0, rows: 2, placeholder: i.placeholder ?? "", style: { ...a, resize: "none" } }),
72
+ i.fieldType === "file_upload" && /* @__PURE__ */ e("div", { style: { padding: "0.5rem", border: "1px dashed rgba(0,0,0,0.25)", borderRadius: 4, fontSize: "0.8rem", color: "rgba(0,0,0,0.4)", textAlign: "center" }, children: "File upload" }),
73
+ i.fieldType === "dropdown" && /* @__PURE__ */ t("select", { disabled: !0, style: a, children: [
74
+ /* @__PURE__ */ e("option", { children: i.placeholder || "Select..." }),
75
+ i.options.map((s, c) => /* @__PURE__ */ e("option", { children: s }, c))
76
+ ] }),
77
+ !["textarea", "file_upload", "dropdown"].includes(i.fieldType) && /* @__PURE__ */ e("input", { disabled: !0, type: i.fieldType === "email" ? "email" : i.fieldType === "phone" ? "tel" : "text", placeholder: i.placeholder ?? "", style: a })
78
+ ] }, i.id))
79
+ ] });
80
+ }
81
+ function Ie({ value: n, onChange: r }) {
82
+ const a = n !== null, i = n ?? ve, [s, c] = p(null), [f, h] = p(null), [S, o] = p(!1), l = (g) => r({ ...i, ...g }), m = () => {
83
+ c(null), h(null);
84
+ }, w = (g) => {
85
+ r(g ? { ...ve } : null), m();
86
+ }, b = () => {
87
+ const g = Re();
88
+ h(g), c("new");
89
+ }, _ = (g) => {
90
+ h({ ...g }), c(g.id);
91
+ }, v = (g) => {
92
+ l({ fields: s === "new" ? [...i.fields, g] : i.fields.map((x) => x.id === g.id ? g : x) }), m();
93
+ }, T = (g) => {
94
+ s === g && m(), l({ fields: i.fields.filter((x) => x.id !== g) });
95
+ };
96
+ return /* @__PURE__ */ t("div", { children: [
97
+ /* @__PURE__ */ t("label", { style: { display: "flex", alignItems: "center", gap: 8, cursor: "pointer", marginBottom: a ? "1rem" : 4, fontSize: "0.9rem", fontWeight: 500 }, children: [
98
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: a, onChange: (g) => w(g.target.checked) }),
99
+ "Enable Redemption Form"
100
+ ] }),
101
+ !a && /* @__PURE__ */ e("div", { style: { fontSize: "0.8rem", color: "rgba(0,0,0,0.4)" }, children: "No redemption form — token holders cannot request physical redemption." }),
102
+ a && /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
103
+ /* @__PURE__ */ t("div", { children: [
104
+ /* @__PURE__ */ e("label", { style: V, children: "Instructions shown to redeemer" }),
105
+ /* @__PURE__ */ e("textarea", { value: i.instructions ?? "", onChange: (g) => l({ instructions: g.target.value || void 0 }), placeholder: "Describe requirements, turnaround times, etc.", rows: 3, style: { ...K, resize: "vertical" } })
106
+ ] }),
107
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "auto 1fr", gap: "1rem", alignItems: "center", padding: "0.6rem 0.75rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 6, background: "rgba(0,0,0,0.02)" }, children: [
108
+ /* @__PURE__ */ t("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: "0.85rem", cursor: "pointer", whiteSpace: "nowrap" }, children: [
109
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: i.requiresApproval, onChange: (g) => l({ requiresApproval: g.target.checked }) }),
110
+ " Requires admin approval"
111
+ ] }),
112
+ /* @__PURE__ */ t("div", { children: [
113
+ /* @__PURE__ */ e("label", { style: V, children: "Estimated processing days" }),
114
+ /* @__PURE__ */ e("input", { type: "number", min: 0, value: i.estimatedProcessingDays ?? "", onChange: (g) => l({ estimatedProcessingDays: g.target.value ? Number(g.target.value) : void 0 }), placeholder: "e.g., 5", style: { ...K, maxWidth: 120 } })
115
+ ] })
116
+ ] }),
117
+ /* @__PURE__ */ t("div", { children: [
118
+ /* @__PURE__ */ t("div", { style: { fontSize: "0.8rem", fontWeight: 500, marginBottom: "0.5rem" }, children: [
119
+ "Form Fields (",
120
+ i.fields.length,
121
+ ")"
122
+ ] }),
123
+ i.fields.length === 0 && s !== "new" && /* @__PURE__ */ e("div", { style: { fontSize: "0.85rem", color: "rgba(0,0,0,0.35)", fontStyle: "italic", marginBottom: "0.5rem" }, children: "No fields yet. Add fields below." }),
124
+ /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "0.4rem" }, children: [
125
+ i.fields.map((g) => /* @__PURE__ */ t("div", { children: [
126
+ /* @__PURE__ */ t("div", { style: { padding: "0.5rem 0.75rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 6, background: "white", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
127
+ /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
128
+ /* @__PURE__ */ e("span", { style: { fontSize: "0.9rem" }, children: g.label || /* @__PURE__ */ e("em", { style: { color: "rgba(0,0,0,0.35)" }, children: "Unlabelled" }) }),
129
+ /* @__PURE__ */ e("span", { style: { padding: "2px 8px", borderRadius: 10, background: "#dbeafe", color: "#1d4ed8", fontSize: "0.75rem" }, children: ke.find((x) => x.value === g.fieldType)?.label ?? g.fieldType }),
130
+ g.required && /* @__PURE__ */ e("span", { style: { padding: "2px 8px", borderRadius: 10, background: "#fef3c7", color: "#92400e", fontSize: "0.75rem" }, children: "required" })
131
+ ] }),
132
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 4 }, children: [
133
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => _(g), style: { ...ie, padding: "0.25rem 0.6rem", fontSize: "0.8rem" }, children: "Edit" }),
134
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => T(g.id), style: { padding: "0.25rem 0.6rem", borderRadius: 4, border: "1px solid rgba(220,38,38,0.3)", background: "white", cursor: "pointer", fontSize: "0.8rem", color: "#dc2626" }, children: "Delete" })
135
+ ] })
136
+ ] }),
137
+ s === g.id && f && /* @__PURE__ */ e(Ce, { field: f, onSave: v, onCancel: m })
138
+ ] }, g.id)),
139
+ s === "new" && f && /* @__PURE__ */ e(Ce, { field: f, onSave: v, onCancel: m })
140
+ ] }),
141
+ s === null && /* @__PURE__ */ e("button", { type: "button", onClick: b, style: { ...ie, marginTop: "0.5rem" }, children: "+ Add Field" })
142
+ ] }),
143
+ /* @__PURE__ */ t("div", { children: [
144
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => o((g) => !g), style: { ...ie, background: S ? "rgba(0,0,0,0.05)" : "white" }, children: S ? "Hide Preview" : "Show Preview" }),
145
+ S && /* @__PURE__ */ e("div", { style: { marginTop: "0.75rem" }, children: /* @__PURE__ */ e(ze, { fields: i.fields, instructions: i.instructions }) })
146
+ ] })
147
+ ] })
148
+ ] });
149
+ }
150
+ const De = [
151
+ { value: "securities", label: "Securities (fungible)" },
152
+ { value: "commodities", label: "Commodities (fungible)" },
153
+ { value: "property", label: "Property (non-fungible)" },
154
+ { value: "collectibles", label: "Collectibles (non-fungible)" }
155
+ ], Me = (n) => n === "securities" || n === "commodities";
156
+ function Pe({ c: n, onDeployPool: r, onEdit: a, onDelete: i }) {
157
+ const s = n.tokenizationConfig, c = Me(s.assetClass);
158
+ return /* @__PURE__ */ t("div", { style: { padding: "0.75rem 1rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 8, background: "white" }, children: [
159
+ /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
160
+ /* @__PURE__ */ t("div", { children: [
161
+ /* @__PURE__ */ e("strong", { children: n.name }),
162
+ /* @__PURE__ */ e("span", { style: { marginLeft: 8, fontSize: "0.8rem", padding: "2px 8px", borderRadius: 10, background: c ? "#dbeafe" : "#fef3c7", color: c ? "#1d4ed8" : "#92400e" }, children: s.assetClass }),
163
+ s.tokenSymbol && /* @__PURE__ */ e("span", { style: { marginLeft: 6, fontSize: "0.8rem", color: "rgba(0,0,0,0.5)" }, children: s.tokenSymbol })
164
+ ] }),
165
+ /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: "0.8rem" }, children: [
166
+ s.mintAddress ? /* @__PURE__ */ e("span", { style: { color: "#16a34a" }, children: "Mint initialized" }) : /* @__PURE__ */ e("span", { style: { color: "rgba(0,0,0,0.4)" }, children: "No mint" }),
167
+ c && s.mintAddress && (s.liquidityPoolAddress ? /* @__PURE__ */ t("span", { style: { padding: "2px 8px", borderRadius: 10, background: "#dcfce7", color: "#15803d", fontSize: "0.75rem" }, children: [
168
+ "Pool Active · ",
169
+ s.liquidityPoolAddress.slice(0, 4),
170
+ "...",
171
+ s.liquidityPoolAddress.slice(-4)
172
+ ] }) : /* @__PURE__ */ e(
173
+ "button",
174
+ {
175
+ type: "button",
176
+ onClick: r,
177
+ style: { padding: 0, border: "none", background: "none", color: "#2563eb", cursor: "pointer", fontSize: "0.8rem", textDecoration: "underline" },
178
+ children: "Deploy Pool"
179
+ }
180
+ ))
181
+ ] })
182
+ ] }),
183
+ n.description && /* @__PURE__ */ e("div", { style: { fontSize: "0.85rem", color: "rgba(0,0,0,0.5)", marginTop: 4 }, children: n.description }),
184
+ /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginTop: 6 }, children: [
185
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "1rem", flexWrap: "wrap", fontSize: "0.8rem", color: "rgba(0,0,0,0.4)" }, children: [
186
+ /* @__PURE__ */ t("span", { children: [
187
+ "Fee: ",
188
+ s.transferFeeBps,
189
+ " bps"
190
+ ] }),
191
+ s.treasuryAddress && /* @__PURE__ */ t("span", { children: [
192
+ "Treasury: ",
193
+ s.treasuryAddress.slice(0, 8),
194
+ "..."
195
+ ] }),
196
+ s.allowedJurisdictions?.length > 0 && /* @__PURE__ */ t("span", { style: { padding: "1px 7px", borderRadius: 10, background: "#f3f4f6", color: "rgba(0,0,0,0.55)" }, children: [
197
+ s.allowedJurisdictions.length,
198
+ " jurisdiction",
199
+ s.allowedJurisdictions.length !== 1 ? "s" : "",
200
+ ": ",
201
+ s.allowedJurisdictions.join(", ")
202
+ ] })
203
+ ] }),
204
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 6 }, children: [
205
+ a && /* @__PURE__ */ e("button", { type: "button", onClick: a, style: { padding: "2px 10px", border: "1px solid rgba(0,0,0,0.15)", borderRadius: 4, background: "white", cursor: "pointer", fontSize: "0.75rem", color: "#2563eb" }, children: "Edit" }),
206
+ i && /* @__PURE__ */ e("button", { type: "button", onClick: i, style: { padding: "2px 10px", border: "1px solid rgba(0,0,0,0.15)", borderRadius: 4, background: "white", cursor: "pointer", fontSize: "0.75rem", color: "#dc2626" }, children: "Delete" })
207
+ ] })
208
+ ] })
209
+ ] });
210
+ }
211
+ const ye = {
212
+ name: "",
213
+ description: "",
214
+ assetClass: "securities",
215
+ tokenSymbol: "",
216
+ tokenDecimals: 2,
217
+ transferFeeBps: 250,
218
+ maxTransferFee: 500,
219
+ treasuryAddress: "",
220
+ regulatoryNotice: "",
221
+ jurisdictions: "",
222
+ redemptionConfig: null
223
+ };
224
+ function Fe({ serverUrl: n, apiKey: r, authManager: a, onNavigateToLiquidity: i }) {
225
+ const [s, c] = p([]), [f, h] = p(!0), [S, o] = p(null), [l, m] = p(!1), [w, b] = p(!1), [_, v] = p(ye), [T, g] = p(null), x = M(async (y, u) => {
226
+ if (a?.isAuthenticated())
227
+ return a.fetchWithAuth(y, u);
228
+ const R = { "Content-Type": "application/json" };
229
+ r && (R["X-API-Key"] = r);
230
+ const k = await fetch(`${n}${y}`, { ...u, headers: { ...R, ...u?.headers } });
231
+ if (!k.ok) {
232
+ const D = await k.text().catch(() => `HTTP ${k.status}`);
233
+ throw new Error(D);
234
+ }
235
+ return k.json();
236
+ }, [n, r, a]), B = M(async () => {
237
+ try {
238
+ h(!0), o(null);
239
+ const y = await x("/admin/collections");
240
+ c((y.collections || []).filter((u) => u.tokenizationConfig));
241
+ } catch (y) {
242
+ o(y instanceof Error ? y.message : "Failed to load asset classes");
243
+ } finally {
244
+ h(!1);
245
+ }
246
+ }, [x]);
247
+ H(() => {
248
+ B();
249
+ }, [B]);
250
+ const d = () => ({
251
+ name: _.name.trim(),
252
+ description: _.description || void 0,
253
+ active: !0,
254
+ productIds: [],
255
+ tokenizationConfig: {
256
+ assetClass: _.assetClass,
257
+ tokenSymbol: _.tokenSymbol || void 0,
258
+ tokenDecimals: _.tokenDecimals,
259
+ transferFeeBps: _.transferFeeBps,
260
+ maxTransferFee: _.maxTransferFee,
261
+ treasuryAddress: _.treasuryAddress || void 0,
262
+ regulatoryNotice: _.regulatoryNotice || void 0,
263
+ allowedJurisdictions: _.jurisdictions ? _.jurisdictions.split(",").map((y) => y.trim().toUpperCase()).filter(Boolean) : [],
264
+ redemptionConfig: _.redemptionConfig || void 0
265
+ }
266
+ }), A = async () => {
267
+ if (_.name.trim()) {
268
+ b(!0), o(null);
269
+ try {
270
+ T ? await x(`/admin/collections/${encodeURIComponent(T)}`, {
271
+ method: "PUT",
272
+ body: JSON.stringify(d())
273
+ }) : await x("/admin/collections", {
274
+ method: "POST",
275
+ body: JSON.stringify(d())
276
+ }), v(ye), m(!1), g(null), await B();
277
+ } catch (y) {
278
+ o(y instanceof Error ? y.message : `Failed to ${T ? "update" : "create"} asset class`);
279
+ } finally {
280
+ b(!1);
281
+ }
282
+ }
283
+ }, C = (y) => {
284
+ const u = y.tokenizationConfig;
285
+ v({
286
+ name: y.name,
287
+ description: y.description ?? "",
288
+ assetClass: u.assetClass,
289
+ tokenSymbol: u.tokenSymbol ?? "",
290
+ tokenDecimals: u.tokenDecimals,
291
+ transferFeeBps: u.transferFeeBps,
292
+ maxTransferFee: u.maxTransferFee,
293
+ treasuryAddress: u.treasuryAddress ?? "",
294
+ regulatoryNotice: u.regulatoryNotice ?? "",
295
+ jurisdictions: u.allowedJurisdictions.join(", "),
296
+ redemptionConfig: u.redemptionConfig ?? null
297
+ }), g(y.id), m(!0);
298
+ }, N = async (y) => {
299
+ if (window.confirm(`Delete asset class "${y.name}"? This cannot be undone.`)) {
300
+ o(null);
301
+ try {
302
+ await x(`/admin/collections/${encodeURIComponent(y.id)}`, { method: "DELETE" }), await B();
303
+ } catch (u) {
304
+ o(u instanceof Error ? u.message : "Failed to delete asset class");
305
+ }
306
+ }
307
+ };
308
+ return f ? /* @__PURE__ */ e("div", { style: { padding: "1rem 0", color: "rgba(0,0,0,0.5)" }, children: "Loading asset classes..." }) : /* @__PURE__ */ t("div", { children: [
309
+ S && /* @__PURE__ */ e("div", { style: { padding: "0.75rem 1rem", background: "#fef2f2", border: "1px solid #fecaca", borderRadius: 6, color: "#dc2626", marginBottom: "1rem", fontSize: "0.9rem" }, children: S }),
310
+ /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "1rem" }, children: [
311
+ /* @__PURE__ */ t("h4", { style: { margin: 0 }, children: [
312
+ "Asset Classes (",
313
+ s.length,
314
+ ")"
315
+ ] }),
316
+ /* @__PURE__ */ e(
317
+ "button",
318
+ {
319
+ type: "button",
320
+ onClick: () => {
321
+ m(!l), l && (g(null), v(ye));
322
+ },
323
+ style: { padding: "0.4rem 1rem", borderRadius: 6, border: "1px solid rgba(0,0,0,0.2)", background: l ? "rgba(0,0,0,0.05)" : "white", cursor: "pointer", fontSize: "0.85rem" },
324
+ children: l ? "Cancel" : "+ New Asset Class"
325
+ }
326
+ )
327
+ ] }),
328
+ l && /* @__PURE__ */ t("div", { style: { padding: "1rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 8, marginBottom: "1rem", background: "rgba(0,0,0,0.02)" }, children: [
329
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.75rem", marginBottom: "0.75rem" }, children: [
330
+ /* @__PURE__ */ t("div", { children: [
331
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Name *" }),
332
+ /* @__PURE__ */ e(
333
+ "input",
334
+ {
335
+ type: "text",
336
+ value: _.name,
337
+ onChange: (y) => v((u) => ({ ...u, name: y.target.value })),
338
+ placeholder: "e.g., Gold Tokens",
339
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
340
+ }
341
+ )
342
+ ] }),
343
+ /* @__PURE__ */ t("div", { children: [
344
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Asset Class *" }),
345
+ /* @__PURE__ */ e(
346
+ "select",
347
+ {
348
+ value: _.assetClass,
349
+ onChange: (y) => v((u) => ({ ...u, assetClass: y.target.value })),
350
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" },
351
+ children: De.map((y) => /* @__PURE__ */ e("option", { value: y.value, children: y.label }, y.value))
352
+ }
353
+ )
354
+ ] })
355
+ ] }),
356
+ /* @__PURE__ */ t("div", { style: { marginBottom: "0.75rem" }, children: [
357
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Description" }),
358
+ /* @__PURE__ */ e(
359
+ "input",
360
+ {
361
+ type: "text",
362
+ value: _.description,
363
+ onChange: (y) => v((u) => ({ ...u, description: y.target.value })),
364
+ placeholder: "Brief description of this asset class",
365
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
366
+ }
367
+ )
368
+ ] }),
369
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: "0.75rem", marginBottom: "0.75rem" }, children: [
370
+ /* @__PURE__ */ t("div", { children: [
371
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Token Symbol" }),
372
+ /* @__PURE__ */ e(
373
+ "input",
374
+ {
375
+ type: "text",
376
+ value: _.tokenSymbol,
377
+ onChange: (y) => v((u) => ({ ...u, tokenSymbol: y.target.value })),
378
+ placeholder: "e.g., GOLD",
379
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
380
+ }
381
+ )
382
+ ] }),
383
+ /* @__PURE__ */ t("div", { children: [
384
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Transfer Fee (bps)" }),
385
+ /* @__PURE__ */ e(
386
+ "input",
387
+ {
388
+ type: "number",
389
+ value: _.transferFeeBps,
390
+ onChange: (y) => v((u) => ({ ...u, transferFeeBps: Number(y.target.value) })),
391
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
392
+ }
393
+ )
394
+ ] }),
395
+ /* @__PURE__ */ t("div", { children: [
396
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Treasury Address" }),
397
+ /* @__PURE__ */ e(
398
+ "input",
399
+ {
400
+ type: "text",
401
+ value: _.treasuryAddress,
402
+ onChange: (y) => v((u) => ({ ...u, treasuryAddress: y.target.value })),
403
+ placeholder: "Solana address",
404
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
405
+ }
406
+ )
407
+ ] })
408
+ ] }),
409
+ /* @__PURE__ */ t("div", { style: { marginBottom: "0.75rem" }, children: [
410
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Allowed Jurisdictions" }),
411
+ /* @__PURE__ */ e(
412
+ "input",
413
+ {
414
+ type: "text",
415
+ value: _.jurisdictions,
416
+ onChange: (y) => v((u) => ({ ...u, jurisdictions: y.target.value })),
417
+ placeholder: "US, CA, GB (comma-separated, leave empty for all)",
418
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
419
+ }
420
+ )
421
+ ] }),
422
+ /* @__PURE__ */ t("div", { style: { marginBottom: "0.75rem" }, children: [
423
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Regulatory Notice" }),
424
+ /* @__PURE__ */ e(
425
+ "textarea",
426
+ {
427
+ value: _.regulatoryNotice,
428
+ onChange: (y) => v((u) => ({ ...u, regulatoryNotice: y.target.value })),
429
+ placeholder: "Shown to buyers before purchase",
430
+ rows: 2,
431
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem", resize: "vertical" }
432
+ }
433
+ )
434
+ ] }),
435
+ /* @__PURE__ */ t("div", { style: { marginBottom: "0.75rem" }, children: [
436
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 600, marginBottom: 8 }, children: "Redemption Form" }),
437
+ /* @__PURE__ */ e(
438
+ Ie,
439
+ {
440
+ value: _.redemptionConfig,
441
+ onChange: (y) => v((u) => ({ ...u, redemptionConfig: y }))
442
+ }
443
+ )
444
+ ] }),
445
+ /* @__PURE__ */ e(
446
+ "button",
447
+ {
448
+ type: "button",
449
+ onClick: A,
450
+ disabled: w || !_.name.trim(),
451
+ style: { padding: "0.5rem 1.5rem", borderRadius: 6, border: "none", background: "#2563eb", color: "white", cursor: w ? "wait" : "pointer", fontSize: "0.9rem", opacity: w ? 0.6 : 1 },
452
+ children: w ? "Saving..." : T ? "Save Changes" : "Create Asset Class"
453
+ }
454
+ )
455
+ ] }),
456
+ s.length === 0 ? /* @__PURE__ */ e("div", { style: { padding: "2rem", textAlign: "center", color: "rgba(0,0,0,0.4)", fontSize: "0.9rem" }, children: "No asset classes configured. Create one to start tokenizing off-chain assets." }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: s.map((y) => /* @__PURE__ */ e(
457
+ Pe,
458
+ {
459
+ c: y,
460
+ onDeployPool: i,
461
+ onEdit: () => C(y),
462
+ onDelete: () => N(y)
463
+ },
464
+ y.id
465
+ )) })
466
+ ] });
467
+ }
468
+ const Le = [
469
+ { value: "", label: "All statuses" },
470
+ { value: "pending_info", label: "Pending Info" },
471
+ { value: "info_submitted", label: "Info Submitted" },
472
+ { value: "under_review", label: "Under Review" },
473
+ { value: "approved", label: "Approved" },
474
+ { value: "completed", label: "Completed" },
475
+ { value: "rejected", label: "Rejected" }
476
+ ];
477
+ function Ee(n) {
478
+ switch (n) {
479
+ case "pending_info":
480
+ return "cedros-admin__badge cedros-admin__badge--muted";
481
+ case "info_submitted":
482
+ return "cedros-admin__badge cedros-admin__badge--info";
483
+ case "under_review":
484
+ return "cedros-admin__badge cedros-admin__badge--warning";
485
+ case "approved":
486
+ return "cedros-admin__badge cedros-admin__badge--success";
487
+ case "completed":
488
+ return "cedros-admin__badge cedros-admin__badge--success";
489
+ case "rejected":
490
+ return "cedros-admin__badge cedros-admin__badge--failed";
491
+ default:
492
+ return "cedros-admin__badge cedros-admin__badge--muted";
493
+ }
494
+ }
495
+ function $e(n) {
496
+ return n.replace(/_/g, " ").replace(/\b\w/g, (r) => r.toUpperCase());
497
+ }
498
+ function qe(n) {
499
+ return new Date(n).toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
500
+ }
501
+ function X(n) {
502
+ return n.length > 12 ? `${n.slice(0, 8)}…` : n;
503
+ }
504
+ function Se(n) {
505
+ return `https://solscan.io/tx/${n}`;
506
+ }
507
+ function Oe({ redemption: n, onAction: r, onComplete: a, actionBusy: i }) {
508
+ const [s, c] = p(n.adminNotes ?? ""), f = Object.entries(n.formData ?? {});
509
+ return /* @__PURE__ */ e("div", { style: { padding: "1rem 1.25rem", background: "rgba(0,0,0,0.02)", borderTop: "1px solid rgba(0,0,0,0.08)" }, children: /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "1.5rem" }, children: [
510
+ /* @__PURE__ */ t("div", { children: [
511
+ /* @__PURE__ */ e("div", { style: { fontWeight: 600, fontSize: "0.8rem", marginBottom: 8, textTransform: "uppercase", letterSpacing: "0.05em", opacity: 0.6 }, children: "Form Data" }),
512
+ f.length === 0 ? /* @__PURE__ */ e("div", { style: { fontSize: "0.85rem", opacity: 0.5 }, children: "No form data submitted." }) : /* @__PURE__ */ e("dl", { style: { margin: 0, display: "grid", gridTemplateColumns: "auto 1fr", gap: "4px 12px", fontSize: "0.85rem" }, children: f.map(([h, S]) => /* @__PURE__ */ t(O, { children: [
513
+ /* @__PURE__ */ e("dt", { style: { fontWeight: 500, color: "rgba(0,0,0,0.6)", whiteSpace: "nowrap" }, children: h }, `k-${h}`),
514
+ /* @__PURE__ */ e("dd", { style: { margin: 0, wordBreak: "break-word" }, children: String(S ?? "—") }, `v-${h}`)
515
+ ] })) }),
516
+ (n.tokenMintSignature || n.tokenBurnSignature) && /* @__PURE__ */ t("div", { style: { marginTop: 12, fontSize: "0.8rem" }, children: [
517
+ /* @__PURE__ */ e("div", { style: { fontWeight: 600, marginBottom: 4, opacity: 0.6, textTransform: "uppercase", letterSpacing: "0.05em" }, children: "Signatures" }),
518
+ n.tokenMintSignature && /* @__PURE__ */ t("div", { children: [
519
+ "Mint:",
520
+ " ",
521
+ /* @__PURE__ */ e("a", { href: Se(n.tokenMintSignature), target: "_blank", rel: "noopener noreferrer", style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: X(n.tokenMintSignature) })
522
+ ] }),
523
+ n.tokenBurnSignature && /* @__PURE__ */ t("div", { children: [
524
+ "Burn:",
525
+ " ",
526
+ /* @__PURE__ */ e("a", { href: Se(n.tokenBurnSignature), target: "_blank", rel: "noopener noreferrer", style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: X(n.tokenBurnSignature) })
527
+ ] })
528
+ ] })
529
+ ] }),
530
+ /* @__PURE__ */ t("div", { children: [
531
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Admin Notes" }),
532
+ /* @__PURE__ */ e(
533
+ "textarea",
534
+ {
535
+ value: s,
536
+ onChange: (h) => c(h.target.value),
537
+ rows: 4,
538
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.85rem", resize: "vertical", boxSizing: "border-box" },
539
+ placeholder: "Internal notes (not shown to user)..."
540
+ }
541
+ ),
542
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "0.5rem", marginTop: 8, flexWrap: "wrap" }, children: [
543
+ n.status === "info_submitted" && /* @__PURE__ */ e(
544
+ "button",
545
+ {
546
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
547
+ disabled: i,
548
+ onClick: () => r(n.id, "under_review", s),
549
+ children: i ? "Saving..." : "Mark Under Review"
550
+ }
551
+ ),
552
+ n.status === "under_review" && /* @__PURE__ */ t(O, { children: [
553
+ /* @__PURE__ */ e(
554
+ "button",
555
+ {
556
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
557
+ disabled: i,
558
+ onClick: () => r(n.id, "approved", s),
559
+ children: i ? "Saving..." : "Approve"
560
+ }
561
+ ),
562
+ /* @__PURE__ */ e(
563
+ "button",
564
+ {
565
+ className: "cedros-admin__button cedros-admin__button--outline cedros-admin__button--danger cedros-admin__button--sm",
566
+ disabled: i,
567
+ onClick: () => r(n.id, "rejected", s),
568
+ children: i ? "Saving..." : "Reject"
569
+ }
570
+ )
571
+ ] }),
572
+ n.status === "approved" && /* @__PURE__ */ e(
573
+ "button",
574
+ {
575
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
576
+ disabled: i,
577
+ onClick: () => a(n.id),
578
+ children: i ? "Processing..." : "Complete"
579
+ }
580
+ )
581
+ ] })
582
+ ] })
583
+ ] }) });
584
+ }
585
+ function We({ serverUrl: n, apiKey: r, authManager: a }) {
586
+ const [i, s] = p([]), [c, f] = p(!0), [h, S] = p(null), [o, l] = p(""), [m, w] = p(null), [b, _] = p(null), v = M(async (d, A) => {
587
+ if (a?.isAuthenticated())
588
+ return a.fetchWithAuth(d, A);
589
+ const C = { "Content-Type": "application/json" };
590
+ r && (C["X-API-Key"] = r);
591
+ const N = await fetch(`${n}${d}`, { ...A, headers: { ...C, ...A?.headers } });
592
+ if (!N.ok) {
593
+ const y = await N.text().catch(() => `HTTP ${N.status}`);
594
+ throw new Error(y);
595
+ }
596
+ return N.json();
597
+ }, [n, r, a]), T = M(async () => {
598
+ f(!0), S(null);
599
+ try {
600
+ const d = o ? `?status=${encodeURIComponent(o)}&limit=50&offset=0` : "?limit=50&offset=0", A = await v(`/admin/asset-redemptions${d}`);
601
+ s(A.redemptions ?? []);
602
+ } catch (d) {
603
+ S(d instanceof Error ? d.message : "Failed to load redemptions");
604
+ } finally {
605
+ f(!1);
606
+ }
607
+ }, [v, o]);
608
+ H(() => {
609
+ T();
610
+ }, [T]);
611
+ const g = M(async (d, A, C) => {
612
+ _(d), S(null);
613
+ try {
614
+ await v(`/admin/asset-redemptions/${d}/status`, {
615
+ method: "PATCH",
616
+ body: JSON.stringify({ status: A, adminNotes: C })
617
+ }), w(null), await T();
618
+ } catch (N) {
619
+ S(N instanceof Error ? N.message : "Failed to update status");
620
+ } finally {
621
+ _(null);
622
+ }
623
+ }, [v, T]), x = M(async (d) => {
624
+ _(d), S(null);
625
+ try {
626
+ await v(`/admin/asset-redemptions/${d}/complete`, { method: "POST" }), w(null), await T();
627
+ } catch (A) {
628
+ S(A instanceof Error ? A.message : "Failed to complete redemption");
629
+ } finally {
630
+ _(null);
631
+ }
632
+ }, [v, T]), B = (d) => {
633
+ w((A) => A === d ? null : d);
634
+ };
635
+ return /* @__PURE__ */ t("div", { className: "cedros-admin__page", children: [
636
+ /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem", marginBottom: "1rem", flexWrap: "wrap" }, children: [
637
+ /* @__PURE__ */ t("div", { children: [
638
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Status" }),
639
+ /* @__PURE__ */ e(
640
+ "select",
641
+ {
642
+ value: o,
643
+ onChange: (d) => {
644
+ l(d.target.value), w(null);
645
+ },
646
+ style: { padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem", minWidth: 160 },
647
+ children: Le.map((d) => /* @__PURE__ */ e("option", { value: d.value, children: d.label }, d.value))
648
+ }
649
+ )
650
+ ] }),
651
+ /* @__PURE__ */ e("div", { style: { alignSelf: "flex-end" }, children: /* @__PURE__ */ e(
652
+ "button",
653
+ {
654
+ className: "cedros-admin__button cedros-admin__button--outline",
655
+ onClick: T,
656
+ disabled: c,
657
+ children: c ? "Loading..." : "Refresh"
658
+ }
659
+ ) })
660
+ ] }),
661
+ h && /* @__PURE__ */ e("div", { style: { padding: "0.75rem 1rem", background: "#fef2f2", border: "1px solid #fecaca", borderRadius: 6, color: "#dc2626", marginBottom: "1rem", fontSize: "0.9rem" }, children: h }),
662
+ c ? /* @__PURE__ */ e("div", { className: "cedros-admin__loading", children: "Loading redemptions..." }) : i.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin__empty", children: "No redemption requests found." }) : /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", children: /* @__PURE__ */ t("table", { className: "cedros-admin__table", children: [
663
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
664
+ /* @__PURE__ */ e("th", { children: "Date" }),
665
+ /* @__PURE__ */ e("th", { children: "Order" }),
666
+ /* @__PURE__ */ e("th", { children: "Product" }),
667
+ /* @__PURE__ */ e("th", { children: "Collection" }),
668
+ /* @__PURE__ */ e("th", { children: "User" }),
669
+ /* @__PURE__ */ e("th", { children: "Status" }),
670
+ /* @__PURE__ */ e("th", { children: "Actions" })
671
+ ] }) }),
672
+ /* @__PURE__ */ e("tbody", { children: i.map((d) => /* @__PURE__ */ t(O, { children: [
673
+ /* @__PURE__ */ t("tr", { style: { cursor: "pointer" }, onClick: () => B(d.id), children: [
674
+ /* @__PURE__ */ e("td", { children: qe(d.createdAt) }),
675
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { title: d.orderId, children: X(d.orderId) }) }),
676
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { title: d.productId, children: X(d.productId) }) }),
677
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { title: d.collectionId, children: X(d.collectionId) }) }),
678
+ /* @__PURE__ */ e("td", { children: d.userId ? /* @__PURE__ */ e("code", { title: d.userId, children: X(d.userId) }) : /* @__PURE__ */ e("span", { style: { opacity: 0.4 }, children: "—" }) }),
679
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: Ee(d.status), children: $e(d.status) }) }),
680
+ /* @__PURE__ */ e("td", { onClick: (A) => A.stopPropagation(), children: /* @__PURE__ */ t("div", { style: { display: "flex", gap: "0.4rem", flexWrap: "wrap" }, children: [
681
+ (d.status === "info_submitted" || d.status === "under_review" || d.status === "approved") && /* @__PURE__ */ e(
682
+ "button",
683
+ {
684
+ className: "cedros-admin__button cedros-admin__button--outline cedros-admin__button--sm",
685
+ onClick: () => B(d.id),
686
+ children: m === d.id ? "Close" : "Review"
687
+ }
688
+ ),
689
+ d.status === "under_review" && /* @__PURE__ */ t(O, { children: [
690
+ /* @__PURE__ */ e(
691
+ "button",
692
+ {
693
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
694
+ disabled: b === d.id,
695
+ onClick: () => g(d.id, "approved", d.adminNotes ?? ""),
696
+ children: "Approve"
697
+ }
698
+ ),
699
+ /* @__PURE__ */ e(
700
+ "button",
701
+ {
702
+ className: "cedros-admin__button cedros-admin__button--outline cedros-admin__button--danger cedros-admin__button--sm",
703
+ disabled: b === d.id,
704
+ onClick: () => g(d.id, "rejected", d.adminNotes ?? ""),
705
+ children: "Reject"
706
+ }
707
+ )
708
+ ] }),
709
+ d.status === "approved" && /* @__PURE__ */ e(
710
+ "button",
711
+ {
712
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
713
+ disabled: b === d.id,
714
+ onClick: () => x(d.id),
715
+ children: b === d.id ? "Processing..." : "Complete"
716
+ }
717
+ )
718
+ ] }) })
719
+ ] }, d.id),
720
+ m === d.id && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 7, style: { padding: 0 }, children: /* @__PURE__ */ e(
721
+ Oe,
722
+ {
723
+ redemption: d,
724
+ onAction: g,
725
+ onComplete: x,
726
+ actionBusy: b === d.id
727
+ }
728
+ ) }) }, `${d.id}-detail`)
729
+ ] })) })
730
+ ] }) })
731
+ ] });
732
+ }
733
+ const Ue = {
734
+ CA: { cashOutCents: 1500, expirationProhibited: !0, escheatmentYears: 3, notes: "Cash-out threshold increases to $15 on April 1, 2026." },
735
+ CO: { cashOutCents: 500, escheatmentYears: 5 },
736
+ CT: { cashOutCents: 300, escheatmentYears: 3 },
737
+ FL: { expirationProhibited: !0, escheatmentYears: 5 },
738
+ ME: { cashOutCents: 500, escheatmentYears: 3 },
739
+ MA: { cashOutCents: 500, escheatmentYears: 3, notes: "Cash-out also required when 90% of value is used." },
740
+ MT: { cashOutCents: 500, escheatmentYears: 5 },
741
+ NJ: { cashOutCents: 500, escheatmentYears: 3 },
742
+ OR: { cashOutCents: 500, escheatmentYears: 3, notes: "May require at least one prior transaction." },
743
+ RI: { cashOutCents: 100, escheatmentYears: 3 },
744
+ TX: { cashOutCents: 250, escheatmentYears: 3 },
745
+ VT: { cashOutCents: 100, escheatmentYears: 3 },
746
+ WA: { cashOutCents: 500, escheatmentYears: 5 },
747
+ PR: { cashOutCents: 500, escheatmentYears: 5 }
748
+ }, _e = {
749
+ escheatmentYears: 5
750
+ }, ce = 1e6, je = {
751
+ AL: "Alabama",
752
+ AK: "Alaska",
753
+ AZ: "Arizona",
754
+ AR: "Arkansas",
755
+ CA: "California",
756
+ CO: "Colorado",
757
+ CT: "Connecticut",
758
+ DE: "Delaware",
759
+ FL: "Florida",
760
+ GA: "Georgia",
761
+ HI: "Hawaii",
762
+ ID: "Idaho",
763
+ IL: "Illinois",
764
+ IN: "Indiana",
765
+ IA: "Iowa",
766
+ KS: "Kansas",
767
+ KY: "Kentucky",
768
+ LA: "Louisiana",
769
+ ME: "Maine",
770
+ MD: "Maryland",
771
+ MA: "Massachusetts",
772
+ MI: "Michigan",
773
+ MN: "Minnesota",
774
+ MS: "Mississippi",
775
+ MO: "Missouri",
776
+ MT: "Montana",
777
+ NE: "Nebraska",
778
+ NV: "Nevada",
779
+ NH: "New Hampshire",
780
+ NJ: "New Jersey",
781
+ NM: "New Mexico",
782
+ NY: "New York",
783
+ NC: "North Carolina",
784
+ ND: "North Dakota",
785
+ OH: "Ohio",
786
+ OK: "Oklahoma",
787
+ OR: "Oregon",
788
+ PA: "Pennsylvania",
789
+ RI: "Rhode Island",
790
+ SC: "South Carolina",
791
+ SD: "South Dakota",
792
+ TN: "Tennessee",
793
+ TX: "Texas",
794
+ UT: "Utah",
795
+ VT: "Vermont",
796
+ VA: "Virginia",
797
+ WA: "Washington",
798
+ WV: "West Virginia",
799
+ WI: "Wisconsin",
800
+ WY: "Wyoming",
801
+ DC: "District of Columbia",
802
+ PR: "Puerto Rico"
803
+ };
804
+ function Ye({ serverUrl: n, authManager: r }) {
805
+ const [a, i] = p(null), [s, c] = p(null), [f, h] = p(null), [S, o] = p(!0), l = M(async () => {
806
+ try {
807
+ const v = (await new ae(n, void 0, r).getConfig("gift_cards")).config ?? {};
808
+ i(v.business_state || null), c(v.min_gift_card_value_cents != null ? Number(v.min_gift_card_value_cents) : null), h(v.max_gift_card_value_cents != null ? Number(v.max_gift_card_value_cents) : null);
809
+ } catch {
810
+ } finally {
811
+ o(!1);
812
+ }
813
+ }, [n, r]);
814
+ if (H(() => {
815
+ l();
816
+ }, [l]), S)
817
+ return /* @__PURE__ */ e("div", { style: { padding: "2rem", textAlign: "center", opacity: 0.6 }, children: "Loading compliance data..." });
818
+ const m = a ? Ue[a] ?? _e : null, w = a ? je[a] ?? a : null;
819
+ return /* @__PURE__ */ e("div", { children: a ? /* @__PURE__ */ t(O, { children: [
820
+ /* @__PURE__ */ t("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: [
821
+ "Compliance Guidance — ",
822
+ w
823
+ ] }),
824
+ /* @__PURE__ */ t("div", { style: { display: "grid", gap: "1rem", maxWidth: 720 }, children: [
825
+ /* @__PURE__ */ e(Ke, { reg: m, minValueCents: s }),
826
+ /* @__PURE__ */ e(He, { reg: m }),
827
+ /* @__PURE__ */ e(Je, { reg: m }),
828
+ /* @__PURE__ */ e(Ve, { maxValueCents: f })
829
+ ] }),
830
+ /* @__PURE__ */ e(Xe, { reg: m, minValueCents: s, maxValueCents: f })
831
+ ] }) : /* @__PURE__ */ e(Ge, {}) });
832
+ }
833
+ function Ge() {
834
+ return /* @__PURE__ */ t("div", { style: { padding: "2rem", textAlign: "center" }, children: [
835
+ /* @__PURE__ */ e("p", { style: { fontSize: 15, opacity: 0.7, marginBottom: "0.5rem" }, children: "No business state configured." }),
836
+ /* @__PURE__ */ t("p", { style: { fontSize: 13, opacity: 0.5 }, children: [
837
+ "Set your ",
838
+ /* @__PURE__ */ e("strong", { children: "business_state" }),
839
+ " in the Gift Cards config category to see state-specific compliance guidance."
840
+ ] })
841
+ ] });
842
+ }
843
+ function re({ title: n, children: r }) {
844
+ return /* @__PURE__ */ t("div", { style: {
845
+ border: "1px solid rgba(0,0,0,0.1)",
846
+ borderRadius: 8,
847
+ padding: "1rem 1.25rem"
848
+ }, children: [
849
+ /* @__PURE__ */ e("h4", { style: { margin: "0 0 0.5rem", fontSize: 14, fontWeight: 600 }, children: n }),
850
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, lineHeight: 1.6 }, children: r })
851
+ ] });
852
+ }
853
+ function Ke({ reg: n, minValueCents: r }) {
854
+ if (!n.cashOutCents)
855
+ return /* @__PURE__ */ e(re, { title: "Cash-Out Threshold", children: /* @__PURE__ */ e("p", { style: { margin: 0 }, children: "Your state does not have a specific cash-out threshold for gift cards. Federal law does not require cash redemption." }) });
856
+ const a = (n.cashOutCents / 100).toFixed(2), i = r != null && r > n.cashOutCents;
857
+ return /* @__PURE__ */ t(re, { title: "Cash-Out Threshold", children: [
858
+ /* @__PURE__ */ t("p", { style: { margin: "0 0 0.5rem" }, children: [
859
+ "Your state requires cash redemption for gift cards with a remaining balance of ",
860
+ /* @__PURE__ */ t("strong", { children: [
861
+ "$",
862
+ a
863
+ ] }),
864
+ " or less."
865
+ ] }),
866
+ /* @__PURE__ */ t("p", { style: { margin: "0 0 0.5rem" }, children: [
867
+ "Since this system uses ",
868
+ /* @__PURE__ */ e("strong", { children: "one-shot full redemption" }),
869
+ " (entire gift card value is converted to credits at once), cash-out is avoided by setting the minimum gift card face value above the threshold."
870
+ ] }),
871
+ i ? /* @__PURE__ */ t(me, { ok: !0, children: [
872
+ "Min value ($",
873
+ ((r ?? 0) / 100).toFixed(2),
874
+ ") exceeds threshold"
875
+ ] }) : /* @__PURE__ */ t(me, { ok: !1, children: [
876
+ "Set ",
877
+ /* @__PURE__ */ e("code", { children: "min_gift_card_value_cents" }),
878
+ " above ",
879
+ n.cashOutCents,
880
+ " to avoid cash-out obligations"
881
+ ] }),
882
+ n.notes && /* @__PURE__ */ e("p", { style: { margin: "0.5rem 0 0", opacity: 0.7, fontStyle: "italic" }, children: n.notes })
883
+ ] });
884
+ }
885
+ function He({ reg: n }) {
886
+ return /* @__PURE__ */ e(re, { title: "Expiration Rules", children: n.expirationProhibited ? /* @__PURE__ */ t("p", { style: { margin: 0 }, children: [
887
+ "Your state ",
888
+ /* @__PURE__ */ e("strong", { children: "prohibits" }),
889
+ " gift card expiration. Do not set expiration dates on gift cards."
890
+ ] }) : /* @__PURE__ */ t("p", { style: { margin: 0 }, children: [
891
+ "Federal law (CARD Act) requires gift cards to remain valid for at least ",
892
+ /* @__PURE__ */ e("strong", { children: "5 years" }),
893
+ " from purchase or last reload. Your state follows the federal minimum."
894
+ ] }) });
895
+ }
896
+ function Je({ reg: n }) {
897
+ const r = n.escheatmentYears ?? _e.escheatmentYears;
898
+ return /* @__PURE__ */ t(re, { title: "Escheatment (Unclaimed Property)", children: [
899
+ /* @__PURE__ */ t("p", { style: { margin: "0 0 0.5rem" }, children: [
900
+ "Gift card balances unredeemed for ",
901
+ /* @__PURE__ */ t("strong", { children: [
902
+ r,
903
+ " years"
904
+ ] }),
905
+ " may need to be reported and remitted to the state as unclaimed property."
906
+ ] }),
907
+ /* @__PURE__ */ t("p", { style: { margin: 0, opacity: 0.7 }, children: [
908
+ "The system tracks ",
909
+ /* @__PURE__ */ e("code", { children: "last_activity_at" }),
910
+ " on gift card redemptions to help identify dormant balances approaching the escheatment window."
911
+ ] })
912
+ ] });
913
+ }
914
+ function Ve({ maxValueCents: n }) {
915
+ const r = n ?? ce, a = r <= ce;
916
+ return /* @__PURE__ */ t(re, { title: "Anti-Money Laundering (AML)", children: [
917
+ /* @__PURE__ */ t("p", { style: { margin: "0 0 0.5rem" }, children: [
918
+ "FinCEN requires closed-loop prepaid cards to stay at or below ",
919
+ /* @__PURE__ */ e("strong", { children: "$10,000" }),
920
+ " per card. The server enforces this cap on product creation."
921
+ ] }),
922
+ a ? /* @__PURE__ */ t(me, { ok: !0, children: [
923
+ "Max value ($",
924
+ (r / 100).toFixed(2),
925
+ ") within AML limit"
926
+ ] }) : /* @__PURE__ */ t(me, { ok: !1, children: [
927
+ /* @__PURE__ */ e("code", { children: "max_gift_card_value_cents" }),
928
+ " exceeds $10,000 AML cap"
929
+ ] })
930
+ ] });
931
+ }
932
+ function me({ ok: n, children: r }) {
933
+ return /* @__PURE__ */ t("div", { style: {
934
+ display: "inline-flex",
935
+ alignItems: "center",
936
+ gap: 6,
937
+ padding: "4px 10px",
938
+ borderRadius: 6,
939
+ fontSize: 13,
940
+ fontWeight: 500,
941
+ background: n ? "rgba(34,197,94,0.1)" : "rgba(234,179,8,0.15)",
942
+ color: n ? "#16a34a" : "#a16207"
943
+ }, children: [
944
+ /* @__PURE__ */ e("span", { children: n ? "✓" : "⚠" }),
945
+ r
946
+ ] });
947
+ }
948
+ function Xe({
949
+ reg: n,
950
+ minValueCents: r,
951
+ maxValueCents: a
952
+ }) {
953
+ const s = [
954
+ {
955
+ label: "AML: Max card value ≤ $10,000",
956
+ ok: (a ?? ce) <= ce
957
+ },
958
+ ...n.cashOutCents ? [{
959
+ label: `Cash-out: Min value > $${(n.cashOutCents / 100).toFixed(2)} threshold`,
960
+ ok: r != null && r > n.cashOutCents
961
+ }] : [],
962
+ {
963
+ label: n.expirationProhibited ? "Expiration: State prohibits expiration (no action needed)" : "Expiration: Federal 5-year minimum applies",
964
+ ok: !0
965
+ },
966
+ {
967
+ label: `Escheatment: ${n.escheatmentYears ?? _e.escheatmentYears}-year dormancy tracking enabled`,
968
+ ok: !0
969
+ }
970
+ ];
971
+ return /* @__PURE__ */ t("div", { style: { marginTop: "1.5rem" }, children: [
972
+ /* @__PURE__ */ e("h4", { style: { fontSize: 14, fontWeight: 600, marginBottom: "0.75rem" }, children: "Compliance Checklist" }),
973
+ /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: s.map((c, f) => /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 13 }, children: [
974
+ /* @__PURE__ */ e("span", { style: { color: c.ok ? "#16a34a" : "#d97706", fontWeight: 600 }, children: c.ok ? "✓" : "⚠" }),
975
+ /* @__PURE__ */ e("span", { children: c.label })
976
+ ] }, f)) })
977
+ ] });
978
+ }
979
+ function Ze({ serverUrl: n, apiKey: r, authManager: a }) {
980
+ const [i, s] = p(null), [c, f] = p(!0), [h, S] = p(null), o = M(async (b) => {
981
+ if (a?.isAuthenticated())
982
+ return a.fetchWithAuth(b);
983
+ const _ = { "Content-Type": "application/json" };
984
+ r && (_["X-API-Key"] = r);
985
+ const v = await fetch(`${n}${b}`, { headers: _ });
986
+ if (!v.ok) throw new Error(`HTTP ${v.status}`);
987
+ return v.json();
988
+ }, [n, r, a]), l = M(async () => {
989
+ f(!0), S(null);
990
+ try {
991
+ const [b, _] = await Promise.all([
992
+ o("/admin/gift-cards?limit=50"),
993
+ o("/admin/gift-card-redemptions?limit=50").catch(() => ({ redemptions: [] }))
994
+ ]), v = b.giftCards ?? [], T = _.redemptions ?? [], g = /* @__PURE__ */ new Date(), x = v.filter((u) => u.active && (!u.expiresAt || new Date(u.expiresAt) > g)).length, B = v.filter((u) => u.expiresAt && new Date(u.expiresAt) <= g).length, d = v.reduce((u, R) => u + R.initialBalance, 0), A = v.reduce((u, R) => u + R.balance, 0), C = T.reduce((u, R) => u + R.faceValueCents, 0), N = T.filter((u) => u.tokenMinted).length, y = v[0]?.currency || T[0]?.currency || "USD";
995
+ s({
996
+ totalCards: v.length,
997
+ activeCards: x,
998
+ expiredCards: B,
999
+ totalIssuedCents: d,
1000
+ totalRemainingCents: A,
1001
+ totalRedeemedCents: C,
1002
+ redemptionCount: T.length,
1003
+ tokensMinted: N,
1004
+ currency: y.toUpperCase()
1005
+ });
1006
+ } catch (b) {
1007
+ S(b instanceof Error ? b.message : "Failed to load analytics");
1008
+ } finally {
1009
+ f(!1);
1010
+ }
1011
+ }, [o]);
1012
+ H(() => {
1013
+ l();
1014
+ }, [l]);
1015
+ const m = (b) => `$${(b / 100).toFixed(2)}`;
1016
+ if (c) return /* @__PURE__ */ e("div", { className: "cedros-admin__loading", children: "Loading analytics..." });
1017
+ if (h) return /* @__PURE__ */ t("div", { style: { padding: "0.75rem", background: "rgba(220,38,38,0.08)", borderRadius: 6, fontSize: 13, color: "#b91c1c" }, children: [
1018
+ h,
1019
+ /* @__PURE__ */ e("button", { className: "cedros-admin__button cedros-admin__button--sm", style: { marginLeft: 8 }, onClick: l, children: "Retry" })
1020
+ ] });
1021
+ if (!i) return null;
1022
+ const w = i.totalIssuedCents > 0 ? ((i.totalIssuedCents - i.totalRemainingCents) / i.totalIssuedCents * 100).toFixed(1) : "0.0";
1023
+ return /* @__PURE__ */ t("div", { children: [
1024
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: "Gift Card & Token Analytics" }),
1025
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))", gap: "0.75rem", marginBottom: "1.5rem" }, children: [
1026
+ /* @__PURE__ */ e(U, { label: "Total Cards", value: String(i.totalCards) }),
1027
+ /* @__PURE__ */ e(U, { label: "Active", value: String(i.activeCards), accent: "green" }),
1028
+ /* @__PURE__ */ e(U, { label: "Expired", value: String(i.expiredCards), accent: i.expiredCards > 0 ? "amber" : void 0 }),
1029
+ /* @__PURE__ */ e(U, { label: "Total Issued", value: m(i.totalIssuedCents), sub: i.currency }),
1030
+ /* @__PURE__ */ e(U, { label: "Remaining Balance", value: m(i.totalRemainingCents), sub: i.currency }),
1031
+ /* @__PURE__ */ e(U, { label: "Usage Rate", value: `${w}%`, sub: "issued vs. spent" }),
1032
+ /* @__PURE__ */ e(U, { label: "Redemptions", value: String(i.redemptionCount) }),
1033
+ /* @__PURE__ */ e(U, { label: "Tokens Minted", value: String(i.tokensMinted), sub: `of ${i.redemptionCount} redemptions` })
1034
+ ] }),
1035
+ i.totalIssuedCents > 0 && /* @__PURE__ */ t("div", { children: [
1036
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, fontWeight: 500, marginBottom: 6 }, children: "Balance Breakdown" }),
1037
+ /* @__PURE__ */ t("div", { style: { display: "flex", height: 24, borderRadius: 6, overflow: "hidden", background: "rgba(0,0,0,0.05)" }, children: [
1038
+ /* @__PURE__ */ e(
1039
+ "div",
1040
+ {
1041
+ style: {
1042
+ width: `${(i.totalIssuedCents - i.totalRemainingCents) / i.totalIssuedCents * 100}%`,
1043
+ background: "#2563eb",
1044
+ minWidth: 2
1045
+ },
1046
+ title: `Spent: ${m(i.totalIssuedCents - i.totalRemainingCents)}`
1047
+ }
1048
+ ),
1049
+ /* @__PURE__ */ e(
1050
+ "div",
1051
+ {
1052
+ style: {
1053
+ width: `${i.totalRemainingCents / i.totalIssuedCents * 100}%`,
1054
+ background: "#60a5fa",
1055
+ minWidth: 2
1056
+ },
1057
+ title: `Remaining: ${m(i.totalRemainingCents)}`
1058
+ }
1059
+ )
1060
+ ] }),
1061
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "1rem", marginTop: 6, fontSize: 12, opacity: 0.7 }, children: [
1062
+ /* @__PURE__ */ t("span", { children: [
1063
+ /* @__PURE__ */ e("span", { style: { display: "inline-block", width: 10, height: 10, background: "#2563eb", borderRadius: 2, marginRight: 4 } }),
1064
+ "Spent"
1065
+ ] }),
1066
+ /* @__PURE__ */ t("span", { children: [
1067
+ /* @__PURE__ */ e("span", { style: { display: "inline-block", width: 10, height: 10, background: "#60a5fa", borderRadius: 2, marginRight: 4 } }),
1068
+ "Remaining"
1069
+ ] })
1070
+ ] })
1071
+ ] })
1072
+ ] });
1073
+ }
1074
+ function U({ label: n, value: r, sub: a, accent: i }) {
1075
+ return /* @__PURE__ */ t("div", { style: {
1076
+ padding: "0.75rem 1rem",
1077
+ borderRadius: 8,
1078
+ border: "1px solid rgba(0,0,0,0.08)",
1079
+ background: "rgba(0,0,0,0.01)"
1080
+ }, children: [
1081
+ /* @__PURE__ */ e("div", { style: { fontSize: 12, opacity: 0.6, marginBottom: 4 }, children: n }),
1082
+ /* @__PURE__ */ e("div", { style: { fontSize: 20, fontWeight: 700, color: i === "green" ? "#166534" : i === "amber" ? "#92400e" : void 0 }, children: r }),
1083
+ a && /* @__PURE__ */ e("div", { style: { fontSize: 11, opacity: 0.5, marginTop: 2 }, children: a })
1084
+ ] });
1085
+ }
1086
+ function Qe({ serverUrl: n, apiKey: r, authManager: a }) {
1087
+ const [i, s] = p([]), [c, f] = p(!0), [h, S] = p(null), [o, l] = p("list"), [m, w] = p(null), [b, _] = p(!1), [v, T] = p(null), g = M(async (C, N) => {
1088
+ if (a?.isAuthenticated())
1089
+ return a.fetchWithAuth(C, N);
1090
+ const y = { "Content-Type": "application/json" };
1091
+ r && (y["X-API-Key"] = r);
1092
+ const u = await fetch(`${n}${C}`, { ...N, headers: { ...y, ...N?.headers } });
1093
+ if (!u.ok) {
1094
+ const R = await u.text().catch(() => `HTTP ${u.status}`);
1095
+ throw new Error(R);
1096
+ }
1097
+ return u.json();
1098
+ }, [n, r, a]), x = M(async () => {
1099
+ f(!0), S(null);
1100
+ try {
1101
+ const N = await g(`/admin/gift-cards${b ? "?activeOnly=true&limit=50" : "?limit=50"}`);
1102
+ s(N.giftCards ?? []);
1103
+ } catch (C) {
1104
+ S(C instanceof Error ? C.message : "Failed to load gift cards");
1105
+ } finally {
1106
+ f(!1);
1107
+ }
1108
+ }, [g, b]);
1109
+ H(() => {
1110
+ x();
1111
+ }, [x]);
1112
+ const B = (C, N) => `$${(C / 100).toFixed(2)} ${N.toUpperCase()}`, d = (C) => {
1113
+ try {
1114
+ return new Date(C).toLocaleDateString(void 0, {
1115
+ month: "short",
1116
+ day: "numeric",
1117
+ year: "numeric"
1118
+ });
1119
+ } catch {
1120
+ return C;
1121
+ }
1122
+ }, A = (C) => {
1123
+ w(C), l("adjust"), T(null);
1124
+ };
1125
+ return o === "create" ? /* @__PURE__ */ e(
1126
+ et,
1127
+ {
1128
+ onSubmit: async (C) => {
1129
+ await g("/admin/gift-cards", {
1130
+ method: "POST",
1131
+ body: JSON.stringify(C)
1132
+ }), l("list"), x();
1133
+ },
1134
+ onCancel: () => l("list")
1135
+ }
1136
+ ) : o === "adjust" && m ? /* @__PURE__ */ e(
1137
+ tt,
1138
+ {
1139
+ card: m,
1140
+ formatCents: B,
1141
+ onSubmit: async (C) => {
1142
+ await g(`/admin/gift-cards/${encodeURIComponent(m.code)}/adjust`, {
1143
+ method: "POST",
1144
+ body: JSON.stringify({ newBalance: C })
1145
+ }), l("list"), x();
1146
+ },
1147
+ onToggleActive: async () => {
1148
+ await g(`/admin/gift-cards/${encodeURIComponent(m.code)}`, {
1149
+ method: "PUT",
1150
+ body: JSON.stringify({
1151
+ initialBalance: m.initialBalance,
1152
+ balance: m.balance,
1153
+ currency: m.currency,
1154
+ active: !m.active,
1155
+ expiresAt: m.expiresAt,
1156
+ metadata: m.metadata
1157
+ })
1158
+ }), l("list"), x();
1159
+ },
1160
+ onCancel: () => {
1161
+ l("list"), w(null);
1162
+ }
1163
+ }
1164
+ ) : /* @__PURE__ */ t("div", { children: [
1165
+ /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "1rem" }, children: [
1166
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { margin: 0 }, children: "Gift Card Inventory" }),
1167
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center" }, children: [
1168
+ /* @__PURE__ */ t("label", { style: { fontSize: 13, display: "flex", alignItems: "center", gap: 4 }, children: [
1169
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: b, onChange: (C) => _(C.target.checked) }),
1170
+ "Active only"
1171
+ ] }),
1172
+ /* @__PURE__ */ e(
1173
+ "button",
1174
+ {
1175
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
1176
+ onClick: () => {
1177
+ l("create"), T(null);
1178
+ },
1179
+ children: "+ New Gift Card"
1180
+ }
1181
+ )
1182
+ ] })
1183
+ ] }),
1184
+ h && /* @__PURE__ */ t("div", { style: { padding: "0.75rem", background: "rgba(220,38,38,0.08)", borderRadius: 6, marginBottom: "1rem", fontSize: 13, color: "#b91c1c" }, children: [
1185
+ h,
1186
+ /* @__PURE__ */ e("button", { className: "cedros-admin__button cedros-admin__button--sm", style: { marginLeft: 8 }, onClick: x, children: "Retry" })
1187
+ ] }),
1188
+ v && /* @__PURE__ */ e("div", { style: { padding: "0.75rem", background: "rgba(22,163,74,0.08)", borderRadius: 6, marginBottom: "1rem", fontSize: 13, color: "#166534" }, children: v }),
1189
+ c ? /* @__PURE__ */ e("div", { className: "cedros-admin__loading", children: "Loading..." }) : i.length ? /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", children: /* @__PURE__ */ t("table", { className: "cedros-admin__table", children: [
1190
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
1191
+ /* @__PURE__ */ e("th", { children: "Code" }),
1192
+ /* @__PURE__ */ e("th", { children: "Balance" }),
1193
+ /* @__PURE__ */ e("th", { children: "Initial" }),
1194
+ /* @__PURE__ */ e("th", { children: "Status" }),
1195
+ /* @__PURE__ */ e("th", { children: "Expires" }),
1196
+ /* @__PURE__ */ e("th", { children: "Created" }),
1197
+ /* @__PURE__ */ e("th", {})
1198
+ ] }) }),
1199
+ /* @__PURE__ */ e("tbody", { children: i.map((C) => /* @__PURE__ */ t("tr", { children: [
1200
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ t("code", { style: { fontSize: 12 }, children: [
1201
+ C.code.slice(0, 12),
1202
+ "..."
1203
+ ] }) }),
1204
+ /* @__PURE__ */ e("td", { style: { fontWeight: 600 }, children: B(C.balance, C.currency) }),
1205
+ /* @__PURE__ */ e("td", { style: { opacity: 0.7 }, children: B(C.initialBalance, C.currency) }),
1206
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `cedros-admin__badge ${C.active ? "cedros-admin__badge--success" : "cedros-admin__badge--muted"}`, children: C.active ? "Active" : "Inactive" }) }),
1207
+ /* @__PURE__ */ e("td", { style: { fontSize: 13 }, children: C.expiresAt ? d(C.expiresAt) : "—" }),
1208
+ /* @__PURE__ */ e("td", { style: { fontSize: 13 }, children: d(C.createdAt) }),
1209
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
1210
+ "button",
1211
+ {
1212
+ className: "cedros-admin__button cedros-admin__button--outline cedros-admin__button--sm",
1213
+ onClick: () => A(C),
1214
+ children: "Manage"
1215
+ }
1216
+ ) })
1217
+ ] }, C.code)) })
1218
+ ] }) }) : /* @__PURE__ */ e("div", { className: "cedros-admin__empty", style: { padding: "2rem", textAlign: "center", opacity: 0.6 }, children: "No gift cards found." })
1219
+ ] });
1220
+ }
1221
+ function et({
1222
+ onSubmit: n,
1223
+ onCancel: r
1224
+ }) {
1225
+ const [a, i] = p({
1226
+ code: "",
1227
+ initialBalance: "",
1228
+ currency: "USD",
1229
+ expiresAt: ""
1230
+ }), [s, c] = p(!1), [f, h] = p(null);
1231
+ return /* @__PURE__ */ t("div", { children: [
1232
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: "Create Gift Card" }),
1233
+ f && /* @__PURE__ */ e("div", { style: { padding: "0.75rem", background: "rgba(220,38,38,0.08)", borderRadius: 6, marginBottom: "1rem", fontSize: 13, color: "#b91c1c" }, children: f }),
1234
+ /* @__PURE__ */ t("form", { onSubmit: async (o) => {
1235
+ o.preventDefault();
1236
+ const l = Math.round(parseFloat(a.initialBalance) * 100);
1237
+ if (!l || l < 0) {
1238
+ h("Initial balance must be positive");
1239
+ return;
1240
+ }
1241
+ c(!0), h(null);
1242
+ try {
1243
+ await n({
1244
+ ...a.code.trim() ? { code: a.code.trim().toUpperCase() } : {},
1245
+ initialBalance: l,
1246
+ currency: a.currency.toUpperCase(),
1247
+ ...a.expiresAt ? { expiresAt: new Date(a.expiresAt).toISOString() } : {}
1248
+ });
1249
+ } catch (m) {
1250
+ h(m instanceof Error ? m.message : "Failed to create gift card");
1251
+ } finally {
1252
+ c(!1);
1253
+ }
1254
+ }, children: [
1255
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-row", children: [
1256
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1257
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Code (optional, auto-generated if empty)" }),
1258
+ /* @__PURE__ */ e(
1259
+ "input",
1260
+ {
1261
+ type: "text",
1262
+ className: "cedros-admin__input",
1263
+ value: a.code,
1264
+ onChange: (o) => i((l) => ({ ...l, code: o.target.value })),
1265
+ placeholder: "Leave blank to auto-generate"
1266
+ }
1267
+ )
1268
+ ] }),
1269
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1270
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Initial Balance ($)" }),
1271
+ /* @__PURE__ */ e(
1272
+ "input",
1273
+ {
1274
+ type: "number",
1275
+ className: "cedros-admin__input",
1276
+ value: a.initialBalance,
1277
+ onChange: (o) => i((l) => ({ ...l, initialBalance: o.target.value })),
1278
+ placeholder: "25.00",
1279
+ step: "0.01",
1280
+ min: "0",
1281
+ required: !0
1282
+ }
1283
+ )
1284
+ ] })
1285
+ ] }),
1286
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-row", children: [
1287
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1288
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Currency" }),
1289
+ /* @__PURE__ */ e(
1290
+ "input",
1291
+ {
1292
+ type: "text",
1293
+ className: "cedros-admin__input",
1294
+ value: a.currency,
1295
+ onChange: (o) => i((l) => ({ ...l, currency: o.target.value })),
1296
+ maxLength: 3,
1297
+ required: !0
1298
+ }
1299
+ )
1300
+ ] }),
1301
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1302
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Expiration date (optional)" }),
1303
+ /* @__PURE__ */ e(
1304
+ "input",
1305
+ {
1306
+ type: "date",
1307
+ className: "cedros-admin__input",
1308
+ value: a.expiresAt,
1309
+ onChange: (o) => i((l) => ({ ...l, expiresAt: o.target.value }))
1310
+ }
1311
+ )
1312
+ ] })
1313
+ ] }),
1314
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-actions", style: { marginTop: "1rem" }, children: [
1315
+ /* @__PURE__ */ e("button", { type: "submit", className: "cedros-admin__button cedros-admin__button--primary", disabled: s, children: s ? "Creating..." : "Create Gift Card" }),
1316
+ /* @__PURE__ */ e("button", { type: "button", className: "cedros-admin__button cedros-admin__button--outline", onClick: r, children: "Cancel" })
1317
+ ] })
1318
+ ] })
1319
+ ] });
1320
+ }
1321
+ function tt({
1322
+ card: n,
1323
+ formatCents: r,
1324
+ onSubmit: a,
1325
+ onToggleActive: i,
1326
+ onCancel: s
1327
+ }) {
1328
+ const [c, f] = p((n.balance / 100).toFixed(2)), [h, S] = p(!1), [o, l] = p(null), m = async (b) => {
1329
+ b.preventDefault();
1330
+ const _ = Math.round(parseFloat(c) * 100);
1331
+ if (isNaN(_) || _ < 0) {
1332
+ l("Balance must be >= 0");
1333
+ return;
1334
+ }
1335
+ S(!0), l(null);
1336
+ try {
1337
+ await a(_);
1338
+ } catch (v) {
1339
+ l(v instanceof Error ? v.message : "Failed to adjust balance");
1340
+ } finally {
1341
+ S(!1);
1342
+ }
1343
+ }, w = async () => {
1344
+ S(!0), l(null);
1345
+ try {
1346
+ await i();
1347
+ } catch (b) {
1348
+ l(b instanceof Error ? b.message : "Failed to update status"), S(!1);
1349
+ }
1350
+ };
1351
+ return /* @__PURE__ */ t("div", { children: [
1352
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: "Manage Gift Card" }),
1353
+ o && /* @__PURE__ */ e("div", { style: { padding: "0.75rem", background: "rgba(220,38,38,0.08)", borderRadius: 6, marginBottom: "1rem", fontSize: 13, color: "#b91c1c" }, children: o }),
1354
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.5rem", maxWidth: 500, marginBottom: "1.5rem", fontSize: 13 }, children: [
1355
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500 }, children: "Code" }),
1356
+ /* @__PURE__ */ e("div", { style: { fontFamily: "monospace", wordBreak: "break-all" }, children: n.code }),
1357
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500 }, children: "Current Balance" }),
1358
+ /* @__PURE__ */ e("div", { style: { fontWeight: 600 }, children: r(n.balance, n.currency) }),
1359
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500 }, children: "Initial Balance" }),
1360
+ /* @__PURE__ */ e("div", { children: r(n.initialBalance, n.currency) }),
1361
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500 }, children: "Status" }),
1362
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `cedros-admin__badge ${n.active ? "cedros-admin__badge--success" : "cedros-admin__badge--muted"}`, children: n.active ? "Active" : "Inactive" }) }),
1363
+ n.expiresAt && /* @__PURE__ */ t(O, { children: [
1364
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500 }, children: "Expires" }),
1365
+ /* @__PURE__ */ e("div", { children: new Date(n.expiresAt).toLocaleDateString() })
1366
+ ] })
1367
+ ] }),
1368
+ /* @__PURE__ */ t("form", { onSubmit: m, children: [
1369
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", style: { maxWidth: 250 }, children: [
1370
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "New Balance ($)" }),
1371
+ /* @__PURE__ */ e(
1372
+ "input",
1373
+ {
1374
+ type: "number",
1375
+ className: "cedros-admin__input",
1376
+ value: c,
1377
+ onChange: (b) => f(b.target.value),
1378
+ step: "0.01",
1379
+ min: "0",
1380
+ required: !0
1381
+ }
1382
+ )
1383
+ ] }),
1384
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-actions", style: { marginTop: "1rem", display: "flex", gap: "0.5rem" }, children: [
1385
+ /* @__PURE__ */ e("button", { type: "submit", className: "cedros-admin__button cedros-admin__button--primary", disabled: h, children: h ? "Saving..." : "Adjust Balance" }),
1386
+ /* @__PURE__ */ e(
1387
+ "button",
1388
+ {
1389
+ type: "button",
1390
+ className: `cedros-admin__button ${n.active ? "cedros-admin__button--danger" : "cedros-admin__button--outline"}`,
1391
+ onClick: w,
1392
+ disabled: h,
1393
+ children: n.active ? "Deactivate" : "Reactivate"
1394
+ }
1395
+ ),
1396
+ /* @__PURE__ */ e("button", { type: "button", className: "cedros-admin__button cedros-admin__button--outline", onClick: s, children: "Back" })
1397
+ ] })
1398
+ ] })
1399
+ ] });
1400
+ }
1401
+ const nt = 0;
1402
+ class Ae {
1403
+ dlmmModule = null;
1404
+ bnClass = null;
1405
+ keypairClass = null;
1406
+ /** Dynamic import of @meteora-ag/dlmm. Throws descriptive error if not installed. */
1407
+ async loadDLMM() {
1408
+ if (this.dlmmModule) return this.dlmmModule;
1409
+ try {
1410
+ const r = await import("./pay-react_false-CPX8Vyp9.mjs");
1411
+ return this.dlmmModule = r.default ?? r, this.dlmmModule;
1412
+ } catch {
1413
+ throw new Error(
1414
+ "Install @meteora-ag/dlmm to enable pool deployment: npm install @meteora-ag/dlmm"
1415
+ );
1416
+ }
1417
+ }
1418
+ /** Dynamic import of BN.js (bundled with @solana/web3.js) */
1419
+ async loadBN() {
1420
+ if (this.bnClass) return this.bnClass;
1421
+ const r = await import("./bn-Bv2sKQMU.mjs").then((a) => a.b);
1422
+ return this.bnClass = r.default ?? r, this.bnClass;
1423
+ }
1424
+ /** Dynamic import of Keypair */
1425
+ async loadKeypair() {
1426
+ if (this.keypairClass) return this.keypairClass;
1427
+ const { Keypair: r } = await import("@solana/web3.js");
1428
+ return this.keypairClass = r, this.keypairClass;
1429
+ }
1430
+ /**
1431
+ * Compute the DLMM bin ID for a given buyback price.
1432
+ *
1433
+ * @param buybackPrice - Price per gift card token in USDC (e.g., 0.80)
1434
+ * @param giftCardDecimals - Decimals of the gift card token (e.g., 2)
1435
+ * @param usdcDecimals - Decimals of USDC (typically 6)
1436
+ * @param binStep - Pool bin step (default 1 = finest granularity)
1437
+ * @returns bin ID
1438
+ */
1439
+ async computeBinId(r, a, i, s = 1) {
1440
+ const c = await this.loadDLMM(), f = c.getPricePerLamport(a, i, r);
1441
+ return c.getBinIdFromPrice(f, s, !0);
1442
+ }
1443
+ /**
1444
+ * Find a suitable PresetParameter2 account for the desired bin step.
1445
+ *
1446
+ * @returns The preset parameter public key to use with createLbPair2
1447
+ */
1448
+ async findPresetParameter(r, a, i) {
1449
+ const s = await this.loadDLMM(), c = i ? { cluster: i } : void 0, { presetParameter2: f } = await s.getAllPresetParameters(r, c), h = f.find((S) => S.account.binStep === a);
1450
+ if (!h)
1451
+ throw new Error(
1452
+ `No PresetParameter2 found for binStep=${a}. Available: ${f.map((S) => S.account.binStep).join(", ")}`
1453
+ );
1454
+ return h.publicKey;
1455
+ }
1456
+ /**
1457
+ * Build transaction to create a new DLMM pool.
1458
+ *
1459
+ * @param connection - Solana RPC connection
1460
+ * @param funder - Admin wallet public key (pays for account creation)
1461
+ * @param giftCardMint - Token-22 gift card mint address
1462
+ * @param usdcMint - USDC mint address
1463
+ * @param activeBinId - Bin ID representing the initial price ($1.00 face value)
1464
+ * @param binStep - Pool bin step (default 1)
1465
+ * @param cluster - Solana cluster name
1466
+ * @returns Transaction to sign and pool address
1467
+ */
1468
+ async createPool(r, a, i, s, c, f = 1, h) {
1469
+ const S = await this.loadDLMM(), o = await this.loadBN(), l = h ? { cluster: h } : void 0, m = await this.findPresetParameter(r, f, h), w = await S.createLbPair2(
1470
+ r,
1471
+ a,
1472
+ i,
1473
+ s,
1474
+ m,
1475
+ new o(c),
1476
+ l
1477
+ ), b = w.instructions[0]?.keys?.[1]?.pubkey;
1478
+ if (!b)
1479
+ throw new Error("Failed to extract pool address from transaction");
1480
+ return { transaction: w, poolAddress: b };
1481
+ }
1482
+ /**
1483
+ * Build transaction to add one-sided USDC liquidity at the buyback price.
1484
+ *
1485
+ * @param connection - Solana RPC connection
1486
+ * @param user - Admin wallet public key
1487
+ * @param poolAddress - DLMM pool address from createPool
1488
+ * @param usdcAmountLamports - Amount of USDC in lamports (e.g., 250_000_000 for $250)
1489
+ * @param buybackBinId - Bin ID for the buyback price
1490
+ * @param cluster - Solana cluster name
1491
+ * @returns Transaction and position keypair (must be included as signer)
1492
+ */
1493
+ async addBuybackLiquidity(r, a, i, s, c, f) {
1494
+ const h = await this.loadDLMM(), S = await this.loadBN(), o = await this.loadKeypair(), l = f ? { cluster: f } : void 0, m = await h.create(r, i, l), w = o.generate(), b = c - 1, _ = c;
1495
+ return {
1496
+ transaction: await m.initializePositionAndAddLiquidityByStrategy({
1497
+ positionPubKey: w.publicKey,
1498
+ totalXAmount: new S(0),
1499
+ // No gift card tokens (buy-side only)
1500
+ totalYAmount: new S(s),
1501
+ // Admin's USDC
1502
+ strategy: {
1503
+ maxBinId: _,
1504
+ minBinId: b,
1505
+ strategyType: nt
1506
+ },
1507
+ user: a,
1508
+ slippage: 1
1509
+ // 1% slippage tolerance
1510
+ }),
1511
+ positionKeypair: w
1512
+ };
1513
+ }
1514
+ /**
1515
+ * Fetch on-chain pool status for display.
1516
+ *
1517
+ * @returns Pool status or null if pool doesn't exist
1518
+ */
1519
+ async getPoolStatus(r, a, i) {
1520
+ const s = await this.loadDLMM(), c = i ? { cluster: i } : void 0, f = await s.create(r, a, c), h = await f.getActiveBin();
1521
+ return {
1522
+ address: a.toBase58(),
1523
+ activeBinId: h.binId,
1524
+ activeBinPrice: h.price,
1525
+ binStep: f.lbPair.binStep
1526
+ };
1527
+ }
1528
+ }
1529
+ const fe = 6, it = 1, at = "https://solscan.io/account", rt = "https://app.meteora.ag/dlmm";
1530
+ function ot({
1531
+ serverUrl: n,
1532
+ authManager: r,
1533
+ poolAddress: a,
1534
+ buybackRateBps: i,
1535
+ usdcAmount: s,
1536
+ deployedAt: c,
1537
+ mintAddress: f,
1538
+ tokenDecimals: h = 2,
1539
+ onConfigUpdated: S
1540
+ }) {
1541
+ const [o, l] = p("none"), [m, w] = p(
1542
+ i != null ? i / 100 : 80
1543
+ ), [b, _] = p(100), [v, T] = p(!1), [g, x] = p(!1), [B, d] = p(null), [A, C] = p(null), N = i != null ? `$${(i / 1e4).toFixed(2)}` : "Unknown", y = s != null ? `$${(s / 10 ** fe).toFixed(2)}` : null, u = c ? new Date(c).toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" }) : null, R = a.length > 16 ? `${a.slice(0, 8)}...${a.slice(-8)}` : a, k = async () => {
1544
+ T(!0), C(null), d(null);
1545
+ try {
1546
+ const z = new ae(n, void 0, r), I = Math.round(m * 100);
1547
+ await z.patchConfig("gift_cards", {
1548
+ buyback_rate_bps: I
1549
+ }, `Buyback rate adjusted to ${m} cents`), d("Buyback rate updated"), l("none"), S();
1550
+ } catch (z) {
1551
+ C(z instanceof Error ? z.message : "Failed to update rate");
1552
+ } finally {
1553
+ T(!1);
1554
+ }
1555
+ }, D = async () => {
1556
+ if (f) {
1557
+ x(!0), C(null), d(null);
1558
+ try {
1559
+ const { Connection: z, PublicKey: I, Keypair: E } = await import("@solana/web3.js"), $ = new ae(n, void 0, r), P = await $.getConfig("x402"), F = P.config?.rpc_url || "", L = P.config?.token_mint || "";
1560
+ if (!F || !L) throw new Error("RPC URL or USDC mint not configured");
1561
+ const W = new z(F, "confirmed"), Y = window.solana;
1562
+ if (!Y?.publicKey || !Y.signTransaction)
1563
+ throw new Error("Wallet not connected");
1564
+ const oe = new Ae(), ue = new I(Y.publicKey.toBase58()), q = m / 100, pe = await oe.computeBinId(q, h, fe, it), se = new I(a), Z = Math.round(b * 10 ** fe), { transaction: Q, positionKeypair: G } = await oe.addBuybackLiquidity(
1565
+ W,
1566
+ ue,
1567
+ se,
1568
+ Z,
1569
+ pe
1570
+ ), ee = E.fromSecretKey(G.secretKey);
1571
+ Q.partialSign(ee);
1572
+ const J = await Y.signTransaction(Q), te = await W.sendRawTransaction(J.serialize());
1573
+ await W.confirmTransaction(te, "confirmed");
1574
+ const ne = s ?? 0;
1575
+ await $.patchConfig("gift_cards", {
1576
+ liquidity_usdc_amount: ne + Z
1577
+ }, `Added ${b} USDC liquidity`), d(`Added $${b} USDC liquidity`), l("none"), S();
1578
+ } catch (z) {
1579
+ C(z instanceof Error ? z.message : "Failed to add liquidity");
1580
+ } finally {
1581
+ x(!1);
1582
+ }
1583
+ }
1584
+ };
1585
+ return /* @__PURE__ */ t("div", { children: [
1586
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: "Liquidity Pool Active" }),
1587
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.75rem", maxWidth: 600 }, children: [
1588
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: "Pool Address" }),
1589
+ /* @__PURE__ */ t("div", { style: { fontSize: 13, fontFamily: "monospace", wordBreak: "break-all" }, children: [
1590
+ R,
1591
+ /* @__PURE__ */ t("span", { style: { marginLeft: 8, display: "inline-flex", gap: 6 }, children: [
1592
+ /* @__PURE__ */ e(st, { text: a }),
1593
+ /* @__PURE__ */ e(we, { href: `${at}/${a}`, label: "Solscan" }),
1594
+ /* @__PURE__ */ e(we, { href: `${rt}/${a}`, label: "Meteora" })
1595
+ ] })
1596
+ ] }),
1597
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: "Buyback Rate" }),
1598
+ /* @__PURE__ */ t("div", { style: { fontSize: 13 }, children: [
1599
+ N,
1600
+ " per $1.00"
1601
+ ] }),
1602
+ y && /* @__PURE__ */ t(O, { children: [
1603
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: "USDC Deposited" }),
1604
+ /* @__PURE__ */ e("div", { style: { fontSize: 13 }, children: y })
1605
+ ] }),
1606
+ u && /* @__PURE__ */ t(O, { children: [
1607
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: "Deployed" }),
1608
+ /* @__PURE__ */ e("div", { style: { fontSize: 13 }, children: u })
1609
+ ] })
1610
+ ] }),
1611
+ /* @__PURE__ */ t("div", { style: { marginTop: "1.25rem", display: "flex", gap: "0.5rem" }, children: [
1612
+ /* @__PURE__ */ e(
1613
+ "button",
1614
+ {
1615
+ className: "cedros-admin__button",
1616
+ onClick: () => l(o === "adjust_rate" ? "none" : "adjust_rate"),
1617
+ disabled: g || v,
1618
+ children: "Adjust Rate"
1619
+ }
1620
+ ),
1621
+ /* @__PURE__ */ e(
1622
+ "button",
1623
+ {
1624
+ className: "cedros-admin__button",
1625
+ onClick: () => l(o === "add_liquidity" ? "none" : "add_liquidity"),
1626
+ disabled: g || v || !f,
1627
+ children: "Add Liquidity"
1628
+ }
1629
+ )
1630
+ ] }),
1631
+ o === "adjust_rate" && /* @__PURE__ */ t("div", { style: { marginTop: "1rem", padding: "1rem", borderRadius: 8, border: "1px solid var(--cedros-admin-border, #e5e7eb)" }, children: [
1632
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1633
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "New buyback rate (cents per $1.00)" }),
1634
+ /* @__PURE__ */ e(
1635
+ "input",
1636
+ {
1637
+ type: "number",
1638
+ className: "cedros-admin__input",
1639
+ value: m,
1640
+ onChange: (z) => w(Math.max(1, Math.min(99, parseInt(z.target.value) || 80))),
1641
+ min: "1",
1642
+ max: "99",
1643
+ style: { maxWidth: 200 }
1644
+ }
1645
+ ),
1646
+ /* @__PURE__ */ t("div", { style: { marginTop: 4, fontSize: 12, opacity: 0.75 }, children: [
1647
+ "Profit per redemption: $",
1648
+ ((100 - m) / 100).toFixed(2)
1649
+ ] })
1650
+ ] }),
1651
+ /* @__PURE__ */ e(
1652
+ "button",
1653
+ {
1654
+ className: "cedros-admin__button cedros-admin__button--primary",
1655
+ onClick: k,
1656
+ disabled: v,
1657
+ style: { marginTop: "0.75rem" },
1658
+ children: v ? "Saving..." : "Save Rate"
1659
+ }
1660
+ )
1661
+ ] }),
1662
+ o === "add_liquidity" && /* @__PURE__ */ t("div", { style: { marginTop: "1rem", padding: "1rem", borderRadius: 8, border: "1px solid var(--cedros-admin-border, #e5e7eb)" }, children: [
1663
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1664
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "USDC amount to add" }),
1665
+ /* @__PURE__ */ e(
1666
+ "input",
1667
+ {
1668
+ type: "number",
1669
+ className: "cedros-admin__input",
1670
+ value: b,
1671
+ onChange: (z) => _(Math.max(1, parseFloat(z.target.value) || 100)),
1672
+ min: "1",
1673
+ step: "1",
1674
+ style: { maxWidth: 200 }
1675
+ }
1676
+ )
1677
+ ] }),
1678
+ /* @__PURE__ */ e(
1679
+ "button",
1680
+ {
1681
+ className: "cedros-admin__button cedros-admin__button--primary",
1682
+ onClick: D,
1683
+ disabled: g,
1684
+ style: { marginTop: "0.75rem" },
1685
+ children: g ? "Adding liquidity..." : `Add $${b} USDC`
1686
+ }
1687
+ ),
1688
+ /* @__PURE__ */ e("div", { style: { marginTop: 4, fontSize: 12, opacity: 0.75 }, children: "Requires a connected wallet and USDC balance." })
1689
+ ] }),
1690
+ B && /* @__PURE__ */ e("div", { style: { marginTop: "0.75rem", padding: "0.5rem 0.75rem", borderRadius: 6, background: "rgba(22,163,74,0.1)", color: "#16a34a", fontSize: 13 }, children: B }),
1691
+ A && /* @__PURE__ */ e("div", { style: { marginTop: "0.75rem", padding: "0.5rem 0.75rem", borderRadius: 6, background: "rgba(239,68,68,0.1)", color: "#dc2626", fontSize: 13 }, children: A })
1692
+ ] });
1693
+ }
1694
+ function st({ text: n }) {
1695
+ const [r, a] = p(!1);
1696
+ return /* @__PURE__ */ e(
1697
+ "button",
1698
+ {
1699
+ type: "button",
1700
+ onClick: () => {
1701
+ navigator.clipboard.writeText(n).then(() => {
1702
+ a(!0), setTimeout(() => a(!1), 1500);
1703
+ });
1704
+ },
1705
+ style: { background: "none", border: "none", cursor: "pointer", fontSize: 12, opacity: 0.7, padding: 0 },
1706
+ children: r ? "Copied" : "Copy"
1707
+ }
1708
+ );
1709
+ }
1710
+ function we({ href: n, label: r }) {
1711
+ return /* @__PURE__ */ e(
1712
+ "a",
1713
+ {
1714
+ href: n,
1715
+ target: "_blank",
1716
+ rel: "noopener noreferrer",
1717
+ style: { fontSize: 12, opacity: 0.7 },
1718
+ children: r
1719
+ }
1720
+ );
1721
+ }
1722
+ const de = 6, be = 1;
1723
+ function dt({
1724
+ serverUrl: n,
1725
+ authManager: r,
1726
+ mintConfigured: a,
1727
+ mintAddress: i,
1728
+ tokenDecimals: s = 2
1729
+ }) {
1730
+ const [c, f] = p({
1731
+ liquidityPoolAddress: null,
1732
+ buybackRateBps: null,
1733
+ rpcUrl: null,
1734
+ usdcMint: null,
1735
+ usdcAmount: null,
1736
+ deployedAt: null
1737
+ }), [h, S] = p(!0), [o, l] = p(80), [m, w] = p(250), [b, _] = p("idle"), [v, T] = p(null), [g, x] = p(null), [B, d] = p(null), A = Te(new Ae()), C = M(async () => {
1738
+ try {
1739
+ const I = new ae(n, void 0, r), [E, $] = await Promise.all([
1740
+ I.getConfig("gift_cards"),
1741
+ I.getConfig("x402")
1742
+ ]), P = E.config ?? {}, F = $.config ?? {}, L = P.liquidity_pool_address || null;
1743
+ f({
1744
+ liquidityPoolAddress: L,
1745
+ buybackRateBps: P.buyback_rate_bps != null ? Number(P.buyback_rate_bps) : null,
1746
+ rpcUrl: F.rpc_url || null,
1747
+ usdcMint: F.token_mint || null,
1748
+ usdcAmount: P.liquidity_usdc_amount != null ? Number(P.liquidity_usdc_amount) : null,
1749
+ deployedAt: P.liquidity_deployed_at || null
1750
+ }), L && x(L), P.buyback_rate_bps != null && l(Number(P.buyback_rate_bps) / 100);
1751
+ } catch {
1752
+ } finally {
1753
+ S(!1);
1754
+ }
1755
+ }, [n, r]);
1756
+ H(() => {
1757
+ C();
1758
+ }, [C]);
1759
+ const N = typeof window < "u" && !!window.solana?.publicKey, y = !!c.rpcUrl, u = !!c.usdcMint, R = a && N && y && u && b === "idle", k = async (I) => {
1760
+ if (!(!i || !c.rpcUrl || !c.usdcMint)) {
1761
+ _(I), T(null), d(null);
1762
+ try {
1763
+ const { Connection: E, PublicKey: $, Keypair: P } = await import("@solana/web3.js"), F = new E(c.rpcUrl, "confirmed"), L = window.solana;
1764
+ if (!L?.publicKey || !L.signTransaction)
1765
+ throw new Error("Wallet not connected");
1766
+ const W = A.current, Y = new $(L.publicKey.toBase58()), oe = o / 100, ue = await W.computeBinId(oe, s, de, be);
1767
+ let q = g;
1768
+ if (I === "creating_pool") {
1769
+ const G = new $(i), ee = new $(c.usdcMint), J = await W.computeBinId(1, s, de, be), { transaction: te, poolAddress: ne } = await W.createPool(
1770
+ F,
1771
+ Y,
1772
+ G,
1773
+ ee,
1774
+ J,
1775
+ be
1776
+ ), he = await L.signTransaction(te), ge = await F.sendRawTransaction(he.serialize());
1777
+ await F.confirmTransaction(ge, "confirmed"), q = ne.toBase58(), x(q);
1778
+ }
1779
+ if (I === "creating_pool" || I === "adding_liquidity") {
1780
+ if (_("adding_liquidity"), !q) throw new Error("Pool address not available");
1781
+ const G = new $(q), ee = Math.round(m * 10 ** de), { transaction: J, positionKeypair: te } = await W.addBuybackLiquidity(
1782
+ F,
1783
+ Y,
1784
+ G,
1785
+ ee,
1786
+ ue
1787
+ ), ne = P.fromSecretKey(te.secretKey);
1788
+ J.partialSign(ne);
1789
+ const he = await L.signTransaction(J), ge = await F.sendRawTransaction(he.serialize());
1790
+ await F.confirmTransaction(ge, "confirmed");
1791
+ }
1792
+ if (_("saving_config"), !q) throw new Error("Pool address not available");
1793
+ const pe = new ae(n, void 0, r), se = Math.round(o * 100), Z = Math.round(m * 10 ** de), Q = (/* @__PURE__ */ new Date()).toISOString();
1794
+ await pe.patchConfig("gift_cards", {
1795
+ liquidity_pool_address: q,
1796
+ buyback_rate_bps: se,
1797
+ liquidity_usdc_amount: Z,
1798
+ liquidity_deployed_at: Q
1799
+ }, "Meteora DLMM pool deployed for gift card buyback"), f((G) => ({
1800
+ ...G,
1801
+ liquidityPoolAddress: q,
1802
+ buybackRateBps: se,
1803
+ usdcAmount: Z,
1804
+ deployedAt: Q
1805
+ })), _("done");
1806
+ } catch (E) {
1807
+ d(b === "idle" ? I : b), T(E instanceof Error ? E.message : "Deployment failed"), _("error");
1808
+ }
1809
+ }
1810
+ }, D = () => {
1811
+ R && k("creating_pool");
1812
+ }, z = () => {
1813
+ !B || B === "idle" || B === "done" || B === "error" || k(B);
1814
+ };
1815
+ return h ? /* @__PURE__ */ e("div", { style: { padding: "2rem", textAlign: "center", opacity: 0.6 }, children: "Loading pool configuration..." }) : c.liquidityPoolAddress ? /* @__PURE__ */ e(
1816
+ ot,
1817
+ {
1818
+ serverUrl: n,
1819
+ authManager: r,
1820
+ poolAddress: c.liquidityPoolAddress,
1821
+ buybackRateBps: c.buybackRateBps,
1822
+ usdcAmount: c.usdcAmount,
1823
+ deployedAt: c.deployedAt,
1824
+ mintAddress: i,
1825
+ tokenDecimals: s,
1826
+ onConfigUpdated: C
1827
+ }
1828
+ ) : b !== "idle" && b !== "error" ? /* @__PURE__ */ e(ct, { step: b, poolAddress: g }) : /* @__PURE__ */ e(
1829
+ lt,
1830
+ {
1831
+ buybackCents: o,
1832
+ setBuybackCents: l,
1833
+ usdcAmount: m,
1834
+ setUsdcAmount: w,
1835
+ mintConfigured: a,
1836
+ walletConnected: N,
1837
+ hasRpcUrl: y,
1838
+ hasUsdcMint: u,
1839
+ canDeploy: R,
1840
+ onDeploy: D,
1841
+ errorMessage: v,
1842
+ canRetry: !!B && B !== "creating_pool",
1843
+ onRetry: z
1844
+ }
1845
+ );
1846
+ }
1847
+ function lt({
1848
+ buybackCents: n,
1849
+ setBuybackCents: r,
1850
+ usdcAmount: a,
1851
+ setUsdcAmount: i,
1852
+ mintConfigured: s,
1853
+ walletConnected: c,
1854
+ hasRpcUrl: f,
1855
+ hasUsdcMint: h,
1856
+ canDeploy: S,
1857
+ onDeploy: o,
1858
+ errorMessage: l,
1859
+ canRetry: m,
1860
+ onRetry: w
1861
+ }) {
1862
+ const b = ((100 - n) / 100).toFixed(2);
1863
+ return /* @__PURE__ */ t("div", { children: [
1864
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "0.5rem" }, children: "Deploy Buyback Liquidity Pool" }),
1865
+ /* @__PURE__ */ e("p", { style: { opacity: 0.7, marginBottom: "1rem", fontSize: 14 }, children: "Create a Meteora DLMM pool to buy back gift card tokens at a discount. You earn the spread when tokens are resold at face value." }),
1866
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-row", children: [
1867
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1868
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Buyback rate (cents per $1.00)" }),
1869
+ /* @__PURE__ */ e(
1870
+ "input",
1871
+ {
1872
+ type: "number",
1873
+ className: "cedros-admin__input",
1874
+ value: n,
1875
+ onChange: (_) => r(Math.max(1, Math.min(99, parseInt(_.target.value) || 80))),
1876
+ min: "1",
1877
+ max: "99"
1878
+ }
1879
+ ),
1880
+ /* @__PURE__ */ t("div", { style: { marginTop: 4, fontSize: 12, opacity: 0.75 }, children: [
1881
+ "You earn $",
1882
+ b,
1883
+ " profit per gift card redeemed"
1884
+ ] })
1885
+ ] }),
1886
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1887
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "USDC amount" }),
1888
+ /* @__PURE__ */ e(
1889
+ "input",
1890
+ {
1891
+ type: "number",
1892
+ className: "cedros-admin__input",
1893
+ value: a,
1894
+ onChange: (_) => i(Math.max(1, parseFloat(_.target.value) || 250)),
1895
+ min: "1",
1896
+ step: "1"
1897
+ }
1898
+ ),
1899
+ /* @__PURE__ */ e("div", { style: { marginTop: 4, fontSize: 12, opacity: 0.75 }, children: "Minimum recommended: $250" })
1900
+ ] })
1901
+ ] }),
1902
+ /* @__PURE__ */ t("div", { style: { margin: "1rem 0", display: "flex", flexDirection: "column", gap: 6 }, children: [
1903
+ /* @__PURE__ */ e(le, { label: "Token-22 mint initialized", met: s }),
1904
+ /* @__PURE__ */ e(le, { label: "Wallet connected", met: c }),
1905
+ /* @__PURE__ */ e(le, { label: "RPC URL configured", met: f }),
1906
+ /* @__PURE__ */ e(le, { label: "USDC mint configured", met: h })
1907
+ ] }),
1908
+ l && /* @__PURE__ */ e("div", { style: {
1909
+ padding: "0.5rem 0.75rem",
1910
+ marginBottom: "0.75rem",
1911
+ borderRadius: 6,
1912
+ background: "rgba(239,68,68,0.1)",
1913
+ color: "#dc2626",
1914
+ fontSize: 13
1915
+ }, children: l }),
1916
+ /* @__PURE__ */ e("div", { style: { display: "flex", gap: "0.75rem", alignItems: "center" }, children: m ? /* @__PURE__ */ e(
1917
+ "button",
1918
+ {
1919
+ className: "cedros-admin__button cedros-admin__button--primary",
1920
+ onClick: w,
1921
+ children: "Retry (Resume from Failed Step)"
1922
+ }
1923
+ ) : /* @__PURE__ */ e(
1924
+ "button",
1925
+ {
1926
+ className: "cedros-admin__button cedros-admin__button--primary",
1927
+ onClick: o,
1928
+ disabled: !S,
1929
+ children: "Deploy Liquidity Pool"
1930
+ }
1931
+ ) })
1932
+ ] });
1933
+ }
1934
+ const xe = [
1935
+ { key: "creating_pool", label: "Creating DLMM pool..." },
1936
+ { key: "adding_liquidity", label: "Depositing USDC liquidity..." },
1937
+ { key: "saving_config", label: "Saving configuration..." },
1938
+ { key: "done", label: "Complete" }
1939
+ ];
1940
+ function ct({ step: n, poolAddress: r }) {
1941
+ return /* @__PURE__ */ t("div", { children: [
1942
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: "Deploying Pool..." }),
1943
+ /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: xe.map((a, i) => {
1944
+ const s = xe.findIndex((S) => S.key === n), c = i, f = c < s || n === "done", h = c === s && n !== "done";
1945
+ return /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 14 }, children: [
1946
+ /* @__PURE__ */ e("span", { style: { width: 20, textAlign: "center", fontWeight: 600 }, children: f ? "✓" : h ? "▶" : "○" }),
1947
+ /* @__PURE__ */ e("span", { style: { opacity: f || h ? 1 : 0.4 }, children: a.label })
1948
+ ] }, a.key);
1949
+ }) }),
1950
+ r && /* @__PURE__ */ t("div", { style: { marginTop: "1rem", fontSize: 13, opacity: 0.7 }, children: [
1951
+ "Pool: ",
1952
+ /* @__PURE__ */ e("code", { style: { fontSize: 12 }, children: r })
1953
+ ] })
1954
+ ] });
1955
+ }
1956
+ function le({ label: n, met: r }) {
1957
+ return /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 13 }, children: [
1958
+ /* @__PURE__ */ e("span", { style: { color: r ? "#16a34a" : "#dc2626", fontWeight: 600 }, children: r ? "✓" : "✗" }),
1959
+ /* @__PURE__ */ e("span", { style: { opacity: r ? 0.8 : 0.5 }, children: n })
1960
+ ] });
1961
+ }
1962
+ function ft({ serverUrl: n, apiKey: r, authManager: a }) {
1963
+ const [i, s] = p(null), [c, f] = p([]), [h, S] = p(!0), [o, l] = p(null), [m, w] = p("mint"), [b, _] = p({
1964
+ treasuryAddress: "",
1965
+ tokenSymbol: "storeUSD",
1966
+ tokenDecimals: 2,
1967
+ transferFeeBps: 250,
1968
+ maxTransferFee: 500
1969
+ }), [v, T] = p(!1), [g, x] = p(!1), [B, d] = p(null), A = M(async (k, D) => {
1970
+ if (a?.isAuthenticated())
1971
+ return a.fetchWithAuth(k, D);
1972
+ const z = { "Content-Type": "application/json" };
1973
+ r && (z["X-API-Key"] = r);
1974
+ const I = await fetch(`${n}${k}`, { ...D, headers: { ...z, ...D?.headers } });
1975
+ if (!I.ok) {
1976
+ const E = await I.text().catch(() => `HTTP ${I.status}`);
1977
+ throw new Error(E);
1978
+ }
1979
+ return I.json();
1980
+ }, [n, r, a]), C = M(async () => {
1981
+ try {
1982
+ l(null);
1983
+ const k = await A("/admin/token22/status");
1984
+ s(k);
1985
+ } catch {
1986
+ l("Failed to load Token-22 status");
1987
+ } finally {
1988
+ S(!1);
1989
+ }
1990
+ }, [A]), N = M(async () => {
1991
+ try {
1992
+ const k = await A("/admin/gift-card-redemptions?limit=50");
1993
+ f(k.redemptions || []);
1994
+ } catch {
1995
+ f([]);
1996
+ }
1997
+ }, [A]);
1998
+ H(() => {
1999
+ C(), N();
2000
+ }, [C, N]);
2001
+ const y = async (k) => {
2002
+ if (k.preventDefault(), !!b.treasuryAddress) {
2003
+ T(!0), d(null);
2004
+ try {
2005
+ const D = await A("/admin/token22/initialize", {
2006
+ method: "POST",
2007
+ body: JSON.stringify({
2008
+ treasuryAddress: b.treasuryAddress,
2009
+ tokenSymbol: b.tokenSymbol,
2010
+ tokenDecimals: b.tokenDecimals,
2011
+ transferFeeBps: b.transferFeeBps,
2012
+ maxTransferFee: b.maxTransferFee
2013
+ })
2014
+ });
2015
+ d(`Mint created: ${D.mintAddress}`), C();
2016
+ } catch (D) {
2017
+ d(`Error: ${D instanceof Error ? D.message : "Failed to initialize"}`);
2018
+ } finally {
2019
+ T(!1);
2020
+ }
2021
+ }
2022
+ }, u = async () => {
2023
+ x(!0), d(null);
2024
+ try {
2025
+ const k = await A("/admin/token22/harvest-fees", {
2026
+ method: "POST"
2027
+ });
2028
+ d(k.message);
2029
+ } catch (k) {
2030
+ d(`Error: ${k instanceof Error ? k.message : "Failed to harvest"}`);
2031
+ } finally {
2032
+ x(!1);
2033
+ }
2034
+ }, R = (k) => {
2035
+ try {
2036
+ return new Date(k).toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric", hour: "2-digit", minute: "2-digit" });
2037
+ } catch {
2038
+ return k;
2039
+ }
2040
+ };
2041
+ return /* @__PURE__ */ t("div", { className: "cedros-admin__page", children: [
2042
+ /* @__PURE__ */ e(Ne, { message: o, onRetry: C }),
2043
+ /* @__PURE__ */ e("div", { style: { display: "flex", gap: 0, borderBottom: "1px solid rgba(0,0,0,0.1)", marginBottom: "1rem" }, children: ["mint", "inventory", "analytics", "redemptions", "compliance", "liquidity", "asset-classes", "asset-redemptions"].map((k) => /* @__PURE__ */ e(
2044
+ "button",
2045
+ {
2046
+ type: "button",
2047
+ onClick: () => w(k),
2048
+ style: {
2049
+ padding: "0.5rem 1rem",
2050
+ background: "none",
2051
+ border: "none",
2052
+ borderBottom: m === k ? "2px solid currentColor" : "2px solid transparent",
2053
+ fontWeight: m === k ? 600 : 400,
2054
+ cursor: "pointer",
2055
+ opacity: m === k ? 1 : 0.6
2056
+ },
2057
+ children: { mint: "Token-22 Mint", inventory: "Gift Cards", analytics: "Analytics", redemptions: "Redemptions", compliance: "Compliance", liquidity: "Liquidity", "asset-classes": "Asset Classes", "asset-redemptions": "Asset Redemptions" }[k]
2058
+ },
2059
+ k
2060
+ )) }),
2061
+ h ? /* @__PURE__ */ t("div", { className: "cedros-admin__loading", children: [
2062
+ Be.loading,
2063
+ " Loading..."
2064
+ ] }) : m === "mint" ? /* @__PURE__ */ e(
2065
+ mt,
2066
+ {
2067
+ mintStatus: i,
2068
+ initForm: b,
2069
+ setInitForm: _,
2070
+ isInitializing: v,
2071
+ isHarvesting: g,
2072
+ actionMessage: B,
2073
+ onInitialize: y,
2074
+ onHarvestFees: u,
2075
+ formatDate: R
2076
+ }
2077
+ ) : m === "inventory" ? /* @__PURE__ */ e(Qe, { serverUrl: n, apiKey: r, authManager: a }) : m === "analytics" ? /* @__PURE__ */ e(Ze, { serverUrl: n, apiKey: r, authManager: a }) : m === "redemptions" ? /* @__PURE__ */ e(ut, { redemptions: c, formatDate: R }) : m === "compliance" ? /* @__PURE__ */ e(Ye, { serverUrl: n, apiKey: r, authManager: a }) : m === "liquidity" ? /* @__PURE__ */ e(
2078
+ dt,
2079
+ {
2080
+ serverUrl: n,
2081
+ authManager: a,
2082
+ mintConfigured: !!i?.configured,
2083
+ mintAddress: i?.mintAddress,
2084
+ tokenDecimals: i?.tokenDecimals
2085
+ }
2086
+ ) : m === "asset-classes" ? /* @__PURE__ */ e(Fe, { serverUrl: n, apiKey: r, authManager: a, onNavigateToLiquidity: () => w("liquidity") }) : /* @__PURE__ */ e(We, { serverUrl: n, apiKey: r, authManager: a })
2087
+ ] });
2088
+ }
2089
+ function mt({
2090
+ mintStatus: n,
2091
+ initForm: r,
2092
+ setInitForm: a,
2093
+ isInitializing: i,
2094
+ isHarvesting: s,
2095
+ actionMessage: c,
2096
+ onInitialize: f,
2097
+ onHarvestFees: h,
2098
+ formatDate: S
2099
+ }) {
2100
+ return n?.configured ? /* @__PURE__ */ t("div", { children: [
2101
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: "Token-22 Mint Status" }),
2102
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.75rem", maxWidth: 600 }, children: [
2103
+ /* @__PURE__ */ e(j, { label: "Mint Address", value: n.mintAddress, mono: !0 }),
2104
+ /* @__PURE__ */ e(j, { label: "Token Symbol", value: n.tokenSymbol }),
2105
+ /* @__PURE__ */ e(j, { label: "Decimals", value: String(n.tokenDecimals) }),
2106
+ /* @__PURE__ */ e(j, { label: "Transfer Fee", value: `${n.transferFeeBps} bps (${((n.transferFeeBps ?? 0) / 100).toFixed(2)}%)` }),
2107
+ /* @__PURE__ */ e(j, { label: "Max Transfer Fee", value: String(n.maxTransferFee) }),
2108
+ /* @__PURE__ */ e(j, { label: "Treasury", value: n.treasuryAddress, mono: !0 }),
2109
+ /* @__PURE__ */ e(j, { label: "Authority", value: n.mintAuthority, mono: !0 }),
2110
+ /* @__PURE__ */ e(j, { label: "Created", value: n.createdAt ? S(n.createdAt) : "—" })
2111
+ ] }),
2112
+ /* @__PURE__ */ t("div", { style: { marginTop: "1.5rem", display: "flex", gap: "0.75rem", alignItems: "center" }, children: [
2113
+ /* @__PURE__ */ e(
2114
+ "button",
2115
+ {
2116
+ className: "cedros-admin__button cedros-admin__button--primary",
2117
+ onClick: h,
2118
+ disabled: s,
2119
+ children: s ? "Harvesting..." : "Harvest Transfer Fees"
2120
+ }
2121
+ ),
2122
+ c && /* @__PURE__ */ e("span", { style: { fontSize: 13, opacity: 0.8 }, children: c })
2123
+ ] })
2124
+ ] }) : /* @__PURE__ */ t("div", { children: [
2125
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "0.5rem" }, children: "Initialize Token-22 Mint" }),
2126
+ /* @__PURE__ */ e("p", { style: { opacity: 0.7, marginBottom: "1rem", fontSize: 14 }, children: "Create a Token-22 mint with transfer fee extension for the secondary market. This is a one-time operation per tenant." }),
2127
+ /* @__PURE__ */ t("form", { onSubmit: f, children: [
2128
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-row", children: [
2129
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
2130
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Treasury address (Solana)" }),
2131
+ /* @__PURE__ */ e(
2132
+ "input",
2133
+ {
2134
+ type: "text",
2135
+ className: "cedros-admin__input",
2136
+ value: r.treasuryAddress,
2137
+ onChange: (o) => a((l) => ({ ...l, treasuryAddress: o.target.value })),
2138
+ placeholder: "e.g., 7xKX...",
2139
+ required: !0
2140
+ }
2141
+ )
2142
+ ] }),
2143
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
2144
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Token symbol" }),
2145
+ /* @__PURE__ */ e(
2146
+ "input",
2147
+ {
2148
+ type: "text",
2149
+ className: "cedros-admin__input",
2150
+ value: r.tokenSymbol,
2151
+ onChange: (o) => a((l) => ({ ...l, tokenSymbol: o.target.value })),
2152
+ placeholder: "storeUSD"
2153
+ }
2154
+ )
2155
+ ] })
2156
+ ] }),
2157
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-row", children: [
2158
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
2159
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Token decimals" }),
2160
+ /* @__PURE__ */ e(
2161
+ "input",
2162
+ {
2163
+ type: "number",
2164
+ className: "cedros-admin__input",
2165
+ value: r.tokenDecimals,
2166
+ onChange: (o) => a((l) => ({ ...l, tokenDecimals: parseInt(o.target.value) || 2 })),
2167
+ min: "0",
2168
+ max: "9"
2169
+ }
2170
+ )
2171
+ ] }),
2172
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
2173
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Transfer fee (basis points)" }),
2174
+ /* @__PURE__ */ e(
2175
+ "input",
2176
+ {
2177
+ type: "number",
2178
+ className: "cedros-admin__input",
2179
+ value: r.transferFeeBps,
2180
+ onChange: (o) => a((l) => ({ ...l, transferFeeBps: parseInt(o.target.value) || 0 })),
2181
+ min: "0",
2182
+ max: "10000"
2183
+ }
2184
+ ),
2185
+ /* @__PURE__ */ e("div", { style: { marginTop: 4, fontSize: 12, opacity: 0.75 }, children: "e.g., 250 = 2.5% fee on secondary market transfers" })
2186
+ ] }),
2187
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
2188
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Max transfer fee (atomic)" }),
2189
+ /* @__PURE__ */ e(
2190
+ "input",
2191
+ {
2192
+ type: "number",
2193
+ className: "cedros-admin__input",
2194
+ value: r.maxTransferFee,
2195
+ onChange: (o) => a((l) => ({ ...l, maxTransferFee: parseInt(o.target.value) || 0 })),
2196
+ min: "0"
2197
+ }
2198
+ )
2199
+ ] })
2200
+ ] }),
2201
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-actions", style: { marginTop: "1rem" }, children: [
2202
+ /* @__PURE__ */ e("button", { type: "submit", className: "cedros-admin__button cedros-admin__button--primary", disabled: i, children: i ? "Creating Mint..." : "Initialize Mint" }),
2203
+ c && /* @__PURE__ */ e("span", { style: { marginLeft: "0.75rem", fontSize: 13, opacity: 0.8 }, children: c })
2204
+ ] })
2205
+ ] })
2206
+ ] });
2207
+ }
2208
+ function j({ label: n, value: r, mono: a }) {
2209
+ return /* @__PURE__ */ t(O, { children: [
2210
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: n }),
2211
+ /* @__PURE__ */ e("div", { style: {
2212
+ fontSize: 13,
2213
+ fontFamily: a ? "monospace" : "inherit",
2214
+ wordBreak: a ? "break-all" : "normal",
2215
+ opacity: r ? 1 : 0.5
2216
+ }, children: r || "—" })
2217
+ ] });
2218
+ }
2219
+ function ut({
2220
+ redemptions: n,
2221
+ formatDate: r
2222
+ }) {
2223
+ return n.length ? /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", children: /* @__PURE__ */ t("table", { className: "cedros-admin__table", children: [
2224
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
2225
+ /* @__PURE__ */ e("th", { children: "Date" }),
2226
+ /* @__PURE__ */ e("th", { children: "Order" }),
2227
+ /* @__PURE__ */ e("th", { children: "Product" }),
2228
+ /* @__PURE__ */ e("th", { children: "Buyer" }),
2229
+ /* @__PURE__ */ e("th", { children: "Recipient" }),
2230
+ /* @__PURE__ */ e("th", { children: "Value" }),
2231
+ /* @__PURE__ */ e("th", { children: "Token Minted" })
2232
+ ] }) }),
2233
+ /* @__PURE__ */ e("tbody", { children: n.map((a) => /* @__PURE__ */ t("tr", { children: [
2234
+ /* @__PURE__ */ e("td", { style: { whiteSpace: "nowrap" }, children: r(a.createdAt) }),
2235
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ t("code", { style: { fontSize: 12 }, children: [
2236
+ a.orderId.slice(0, 8),
2237
+ "..."
2238
+ ] }) }),
2239
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { style: { fontSize: 12 }, children: a.productId }) }),
2240
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ t("code", { style: { fontSize: 12 }, children: [
2241
+ a.buyerUserId.slice(0, 8),
2242
+ "..."
2243
+ ] }) }),
2244
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ t("code", { style: { fontSize: 12 }, children: [
2245
+ a.recipientUserId.slice(0, 8),
2246
+ "..."
2247
+ ] }) }),
2248
+ /* @__PURE__ */ t("td", { children: [
2249
+ "$",
2250
+ (a.faceValueCents / 100).toFixed(2),
2251
+ " ",
2252
+ a.currency.toUpperCase()
2253
+ ] }),
2254
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `cedros-admin__badge ${a.tokenMinted ? "cedros-admin__badge--success" : "cedros-admin__badge--muted"}`, children: a.tokenMinted ? "Yes" : "No" }) })
2255
+ ] }, a.id)) })
2256
+ ] }) }) : /* @__PURE__ */ e("div", { style: { padding: "2rem", textAlign: "center", opacity: 0.6 }, children: "No gift card redemptions yet." });
2257
+ }
2258
+ export {
2259
+ ft as Token22Section
2260
+ };