@pithy-sh/payments 0.1.4 → 0.1.5

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 (271) hide show
  1. package/dist/admin/coverage.d.ts +2 -0
  2. package/dist/admin/coverage.js +2 -0
  3. package/dist/admin/read.d.ts +2 -0
  4. package/dist/admin/read.js +2 -0
  5. package/dist/audit/actions.d.ts +2 -0
  6. package/dist/audit/actions.js +2 -0
  7. package/dist/capability.d.ts +2 -0
  8. package/dist/capability.js +2 -0
  9. package/dist/client/api.d.ts +2 -0
  10. package/dist/client/api.js +2 -0
  11. package/dist/client/checkout.d.ts +2 -0
  12. package/dist/client/checkout.js +2 -0
  13. package/dist/client/fixtures/price-preview-de.js +2 -0
  14. package/dist/client/fixtures/price-preview-gb.js +2 -0
  15. package/dist/client/fixtures/price-preview-jp-yen.js +2 -0
  16. package/dist/client/fixtures/price-preview-us-country-only.js +2 -0
  17. package/dist/client/fixtures/price-preview-us-new-york.js +2 -0
  18. package/dist/client/fixtures/pricePreview.d.ts +2 -0
  19. package/dist/client/fixtures/pricePreview.js +2 -0
  20. package/dist/client/hooks.d.ts +2 -0
  21. package/dist/client/hooks.js +2 -0
  22. package/dist/client/paddle.d.ts +2 -0
  23. package/dist/client/paddle.js +2 -0
  24. package/dist/client/paddleCache.d.ts +2 -0
  25. package/dist/client/paddleCache.js +2 -0
  26. package/dist/client/paddlePrices.d.ts +2 -0
  27. package/dist/client/paddlePrices.js +2 -0
  28. package/dist/client/paddlePricesTag.d.ts +2 -0
  29. package/dist/client/paddlePricesTag.js +2 -0
  30. package/dist/client/projection.d.ts +2 -0
  31. package/dist/client/projection.js +2 -0
  32. package/dist/client/test-utils/cacheStore.d.ts +2 -0
  33. package/dist/client/test-utils/cacheStore.js +2 -0
  34. package/dist/client/wholeUnits.d.ts +2 -0
  35. package/dist/client/wholeUnits.js +2 -0
  36. package/dist/config/config.d.ts +2 -0
  37. package/dist/config/config.js +2 -0
  38. package/dist/data/discount.d.ts +2 -0
  39. package/dist/data/discount.js +2 -0
  40. package/dist/data/entitlement.d.ts +2 -0
  41. package/dist/data/entitlement.js +2 -0
  42. package/dist/data/money.d.ts +2 -0
  43. package/dist/data/money.js +2 -0
  44. package/dist/data/pause.d.ts +2 -0
  45. package/dist/data/pause.js +2 -0
  46. package/dist/data/providerAccount.d.ts +2 -0
  47. package/dist/data/providerAccount.js +2 -0
  48. package/dist/data/purchase.d.ts +2 -0
  49. package/dist/data/purchase.js +2 -0
  50. package/dist/data/rail.d.ts +2 -0
  51. package/dist/data/rail.js +2 -0
  52. package/dist/data/reconcileRun.d.ts +2 -0
  53. package/dist/data/reconcileRun.js +2 -0
  54. package/dist/data/renderMoney.d.ts +2 -0
  55. package/dist/data/renderMoney.js +2 -0
  56. package/dist/data/status.d.ts +2 -0
  57. package/dist/data/status.js +2 -0
  58. package/dist/data/subject.d.ts +2 -0
  59. package/dist/data/subject.js +2 -0
  60. package/dist/data/subscription.d.ts +2 -0
  61. package/dist/data/subscription.js +2 -0
  62. package/dist/data/syncCursor.d.ts +2 -0
  63. package/dist/data/syncCursor.js +2 -0
  64. package/dist/data/tables.d.ts +2 -0
  65. package/dist/data/tables.js +2 -0
  66. package/dist/data/webhookEvent.d.ts +2 -0
  67. package/dist/data/webhookEvent.js +2 -0
  68. package/dist/entitlement/manual.d.ts +2 -0
  69. package/dist/entitlement/manual.js +2 -0
  70. package/dist/entitlement/resolver.d.ts +2 -0
  71. package/dist/entitlement/resolver.js +2 -0
  72. package/dist/entitlement/subjectSeam.d.ts +2 -0
  73. package/dist/entitlement/subjectSeam.js +2 -0
  74. package/dist/error/errors.d.ts +2 -0
  75. package/dist/error/errors.js +2 -0
  76. package/dist/grants/apply.d.ts +2 -0
  77. package/dist/grants/apply.js +2 -0
  78. package/dist/grants/clawback.d.ts +2 -0
  79. package/dist/grants/clawback.js +2 -0
  80. package/dist/grants/ledgerSeam.d.ts +2 -0
  81. package/dist/grants/ledgerSeam.js +2 -0
  82. package/dist/http/dispatch.d.ts +2 -0
  83. package/dist/http/dispatch.js +2 -0
  84. package/dist/http/guards.d.ts +2 -0
  85. package/dist/http/guards.js +2 -0
  86. package/dist/http/manifestConfig.d.ts +2 -0
  87. package/dist/http/manifestConfig.js +2 -0
  88. package/dist/http/responses.d.ts +2 -0
  89. package/dist/http/responses.js +2 -0
  90. package/dist/http/routes.d.ts +2 -0
  91. package/dist/http/routes.js +2 -0
  92. package/dist/http/schemas.d.ts +2 -0
  93. package/dist/http/schemas.js +2 -0
  94. package/dist/http/scopes.d.ts +2 -0
  95. package/dist/http/scopes.js +2 -0
  96. package/dist/http/view.d.ts +2 -0
  97. package/dist/http/view.js +2 -0
  98. package/dist/http/webhookGuard.d.ts +2 -0
  99. package/dist/http/webhookGuard.js +2 -0
  100. package/dist/index.d.ts +2 -0
  101. package/dist/index.js +2 -0
  102. package/dist/migrations/0001_purchases.d.ts +2 -0
  103. package/dist/migrations/0001_purchases.js +2 -0
  104. package/dist/paddle-prices.iife.js +1 -0
  105. package/dist/pricing/location.d.ts +2 -0
  106. package/dist/pricing/location.js +2 -0
  107. package/dist/pricing/visitor.d.ts +2 -0
  108. package/dist/pricing/visitor.js +2 -0
  109. package/dist/projection/event.d.ts +2 -0
  110. package/dist/projection/event.js +2 -0
  111. package/dist/projection/orphans.d.ts +2 -0
  112. package/dist/projection/orphans.js +2 -0
  113. package/dist/projection/owner.d.ts +2 -0
  114. package/dist/projection/owner.js +2 -0
  115. package/dist/projection/resolve.d.ts +2 -0
  116. package/dist/projection/resolve.js +2 -0
  117. package/dist/projection/writer.d.ts +2 -0
  118. package/dist/projection/writer.js +2 -0
  119. package/dist/provision/resolvePaymentsConfig.d.ts +2 -0
  120. package/dist/provision/resolvePaymentsConfig.js +2 -0
  121. package/dist/rails/apple/certs.d.ts +2 -0
  122. package/dist/rails/apple/certs.js +2 -0
  123. package/dist/rails/apple/der.d.ts +2 -0
  124. package/dist/rails/apple/der.js +2 -0
  125. package/dist/rails/apple/fixtures/chain.d.ts +2 -0
  126. package/dist/rails/apple/fixtures/chain.js +2 -0
  127. package/dist/rails/apple/http.d.ts +2 -0
  128. package/dist/rails/apple/http.js +2 -0
  129. package/dist/rails/apple/jws.d.ts +2 -0
  130. package/dist/rails/apple/jws.js +2 -0
  131. package/dist/rails/apple/notification.d.ts +2 -0
  132. package/dist/rails/apple/notification.js +2 -0
  133. package/dist/rails/apple/rail.d.ts +2 -0
  134. package/dist/rails/apple/rail.js +2 -0
  135. package/dist/rails/apple/serverApi.d.ts +2 -0
  136. package/dist/rails/apple/serverApi.js +2 -0
  137. package/dist/rails/apple/verify.d.ts +2 -0
  138. package/dist/rails/apple/verify.js +2 -0
  139. package/dist/rails/apple/x509.d.ts +2 -0
  140. package/dist/rails/apple/x509.js +2 -0
  141. package/dist/rails/contract.d.ts +2 -0
  142. package/dist/rails/contract.js +2 -0
  143. package/dist/rails/google/fixtures/push.d.ts +2 -0
  144. package/dist/rails/google/fixtures/push.js +2 -0
  145. package/dist/rails/google/http.d.ts +2 -0
  146. package/dist/rails/google/http.js +2 -0
  147. package/dist/rails/google/jwt.d.ts +2 -0
  148. package/dist/rails/google/jwt.js +2 -0
  149. package/dist/rails/google/oidc.d.ts +2 -0
  150. package/dist/rails/google/oidc.js +2 -0
  151. package/dist/rails/google/playApi.d.ts +2 -0
  152. package/dist/rails/google/playApi.js +2 -0
  153. package/dist/rails/google/rail.d.ts +2 -0
  154. package/dist/rails/google/rail.js +2 -0
  155. package/dist/rails/google/rtdn.d.ts +2 -0
  156. package/dist/rails/google/rtdn.js +2 -0
  157. package/dist/rails/google/verify.d.ts +2 -0
  158. package/dist/rails/google/verify.js +2 -0
  159. package/dist/rails/lemonSqueezy/api.d.ts +2 -0
  160. package/dist/rails/lemonSqueezy/api.js +2 -0
  161. package/dist/rails/lemonSqueezy/checkout.d.ts +2 -0
  162. package/dist/rails/lemonSqueezy/checkout.js +2 -0
  163. package/dist/rails/lemonSqueezy/discounts.d.ts +2 -0
  164. package/dist/rails/lemonSqueezy/discounts.js +2 -0
  165. package/dist/rails/lemonSqueezy/fixtures/events.d.ts +2 -0
  166. package/dist/rails/lemonSqueezy/fixtures/events.js +2 -0
  167. package/dist/rails/lemonSqueezy/objects.d.ts +2 -0
  168. package/dist/rails/lemonSqueezy/objects.js +2 -0
  169. package/dist/rails/lemonSqueezy/portal.d.ts +2 -0
  170. package/dist/rails/lemonSqueezy/portal.js +2 -0
  171. package/dist/rails/lemonSqueezy/pricing.d.ts +2 -0
  172. package/dist/rails/lemonSqueezy/pricing.js +2 -0
  173. package/dist/rails/lemonSqueezy/rail.d.ts +2 -0
  174. package/dist/rails/lemonSqueezy/rail.js +2 -0
  175. package/dist/rails/lemonSqueezy/read.d.ts +2 -0
  176. package/dist/rails/lemonSqueezy/read.js +2 -0
  177. package/dist/rails/lemonSqueezy/refresh.d.ts +2 -0
  178. package/dist/rails/lemonSqueezy/refresh.js +2 -0
  179. package/dist/rails/lemonSqueezy/signature.d.ts +2 -0
  180. package/dist/rails/lemonSqueezy/signature.js +2 -0
  181. package/dist/rails/lemonSqueezy/verify.d.ts +2 -0
  182. package/dist/rails/lemonSqueezy/verify.js +2 -0
  183. package/dist/rails/lemonSqueezy/webhook.d.ts +2 -0
  184. package/dist/rails/lemonSqueezy/webhook.js +2 -0
  185. package/dist/rails/paddle/adjustments.d.ts +2 -0
  186. package/dist/rails/paddle/adjustments.js +2 -0
  187. package/dist/rails/paddle/api.d.ts +2 -0
  188. package/dist/rails/paddle/api.js +2 -0
  189. package/dist/rails/paddle/checkout.d.ts +2 -0
  190. package/dist/rails/paddle/checkout.js +2 -0
  191. package/dist/rails/paddle/discounts.d.ts +2 -0
  192. package/dist/rails/paddle/discounts.js +2 -0
  193. package/dist/rails/paddle/events.d.ts +2 -0
  194. package/dist/rails/paddle/events.js +2 -0
  195. package/dist/rails/paddle/fixtures/browserForged.d.ts +2 -0
  196. package/dist/rails/paddle/fixtures/browserForged.js +2 -0
  197. package/dist/rails/paddle/fixtures/pausedSubscription.d.ts +2 -0
  198. package/dist/rails/paddle/fixtures/pausedSubscription.js +2 -0
  199. package/dist/rails/paddle/objects.d.ts +2 -0
  200. package/dist/rails/paddle/objects.js +2 -0
  201. package/dist/rails/paddle/portal.d.ts +2 -0
  202. package/dist/rails/paddle/portal.js +2 -0
  203. package/dist/rails/paddle/rail.d.ts +2 -0
  204. package/dist/rails/paddle/rail.js +2 -0
  205. package/dist/rails/paddle/read.d.ts +2 -0
  206. package/dist/rails/paddle/read.js +2 -0
  207. package/dist/rails/paddle/recorded.d.ts +2 -0
  208. package/dist/rails/paddle/recorded.js +2 -0
  209. package/dist/rails/paddle/refresh.d.ts +2 -0
  210. package/dist/rails/paddle/refresh.js +2 -0
  211. package/dist/rails/paddle/refund.d.ts +2 -0
  212. package/dist/rails/paddle/refund.js +2 -0
  213. package/dist/rails/paddle/signature.d.ts +2 -0
  214. package/dist/rails/paddle/signature.js +2 -0
  215. package/dist/rails/paddle/subscription.d.ts +2 -0
  216. package/dist/rails/paddle/subscription.js +2 -0
  217. package/dist/rails/paddle/verify.d.ts +2 -0
  218. package/dist/rails/paddle/verify.js +2 -0
  219. package/dist/rails/paddle/webhook.d.ts +2 -0
  220. package/dist/rails/paddle/webhook.js +2 -0
  221. package/dist/rails/providers.d.ts +2 -0
  222. package/dist/rails/providers.js +2 -0
  223. package/dist/rails/stripe/api.d.ts +2 -0
  224. package/dist/rails/stripe/api.js +2 -0
  225. package/dist/rails/stripe/checkout.d.ts +2 -0
  226. package/dist/rails/stripe/checkout.js +2 -0
  227. package/dist/rails/stripe/discounts.d.ts +2 -0
  228. package/dist/rails/stripe/discounts.js +2 -0
  229. package/dist/rails/stripe/fixtures/events.d.ts +2 -0
  230. package/dist/rails/stripe/fixtures/events.js +2 -0
  231. package/dist/rails/stripe/objects.d.ts +2 -0
  232. package/dist/rails/stripe/objects.js +2 -0
  233. package/dist/rails/stripe/portal.d.ts +2 -0
  234. package/dist/rails/stripe/portal.js +2 -0
  235. package/dist/rails/stripe/pricing.d.ts +2 -0
  236. package/dist/rails/stripe/pricing.js +2 -0
  237. package/dist/rails/stripe/rail.d.ts +2 -0
  238. package/dist/rails/stripe/rail.js +2 -0
  239. package/dist/rails/stripe/refresh.d.ts +2 -0
  240. package/dist/rails/stripe/refresh.js +2 -0
  241. package/dist/rails/stripe/signature.d.ts +2 -0
  242. package/dist/rails/stripe/signature.js +2 -0
  243. package/dist/rails/stripe/verify.d.ts +2 -0
  244. package/dist/rails/stripe/verify.js +2 -0
  245. package/dist/rails/stripe/webhook.d.ts +2 -0
  246. package/dist/rails/stripe/webhook.js +2 -0
  247. package/dist/secret/registry.d.ts +2 -0
  248. package/dist/secret/registry.js +2 -0
  249. package/dist/seeds/example.d.ts +2 -0
  250. package/dist/seeds/example.js +2 -0
  251. package/dist/version.generated.d.ts +3 -1
  252. package/dist/version.generated.js +3 -1
  253. package/dist/workflows/paddleSweep.d.ts +2 -0
  254. package/dist/workflows/paddleSweep.js +2 -0
  255. package/dist/workflows/railAccess.d.ts +2 -0
  256. package/dist/workflows/railAccess.js +2 -0
  257. package/dist/workflows/reconcile.d.ts +2 -0
  258. package/dist/workflows/reconcile.js +2 -0
  259. package/dist/workflows/report.d.ts +2 -0
  260. package/dist/workflows/report.js +2 -0
  261. package/dist/workflows/retryPolicy.d.ts +2 -0
  262. package/dist/workflows/retryPolicy.js +2 -0
  263. package/dist/workflows/specs.d.ts +2 -0
  264. package/dist/workflows/specs.js +2 -0
  265. package/dist/workflows/worker.d.ts +2 -0
  266. package/dist/workflows/worker.js +2 -0
  267. package/dist/workflows/workerConfig.d.ts +2 -0
  268. package/dist/workflows/workerConfig.js +2 -0
  269. package/package.json +5 -5
  270. package/src/version.generated.ts +1 -1
  271. package/src/workflows/paddleSweep.ts +1 -1
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { CapabilityManifestConfig } from "@pithy-sh/core/src/controlPlane/discovery/configuration";
2
4
  import { PaymentsSubjectType } from "../data/subject";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsSubjectType } from "../data/subject.js";
2
4
  import { defineManifestConfig } from "@pithy-sh/core/src/controlPlane/discovery/configuration";
3
5
  //#region src/http/manifestConfig.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  /**
3
5
  * What the payments routes return, as Zod objects a client can validate against.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsHostedRail, PaymentsRail } from "../data/rail.js";
2
4
  import { PaymentsSubject } from "../data/subject.js";
3
5
  import { PaymentsProductType } from "../config/config.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { D1Database } from "@cloudflare/workers-types";
2
4
  import type { PithyHonoEnv } from "@pithy-sh/core/src/capability/capability";
3
5
  import type { Hono } from "hono";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PAYMENTS_HOSTED_RAILS } from "../data/rail.js";
2
4
  import { decodeSubjectReference, encodeSubjectReference, sameSubject } from "../data/subject.js";
3
5
  import { providerProductId, railEnabled, resolveProduct } from "../config/config.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  export declare const PurchaseSubmission: z.ZodObject<{
3
5
  rail: z.ZodEnum<{
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsHostedRail, PaymentsRail } from "../data/rail.js";
2
4
  import { PaymentsSubject } from "../data/subject.js";
3
5
  import { PurchaseStatus } from "../data/status.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { AdminRoute } from "@pithy-sh/core/src/controlPlane/discovery/adminRoute";
2
4
  import type { ControlPlaneScope } from "@pithy-sh/core/src/controlPlane/scope/scope";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/http/scopes.ts
2
4
  /**
3
5
  * Payments' control-plane scopes, and the admin surface a manifest advertises.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsPurchaseRecord } from "../admin/read";
2
4
  import type { PaymentsConfig } from "../config/config";
3
5
  import type { PaymentsEntitlement } from "../data/entitlement";
package/dist/http/view.js CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/http/view.ts
2
4
  /**
3
5
  * What a client is shown. Nothing in this package ever returns a raw row.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { D1Database } from "@cloudflare/workers-types";
2
4
  import type { PithyHonoEnv } from "@pithy-sh/core/src/capability/capability";
3
5
  import type { Context, MiddlewareHandler } from "hono";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsWebhookEvent, isWebhookEventFinished, webhookEventState } from "../data/webhookEvent.js";
2
4
  import { PAYMENTS_WEBHOOK_EVENTS_TABLE, paymentsDatabase } from "../data/tables.js";
3
5
  import { PaymentsWebhookUnverifiedError } from "../error/errors.js";
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * The package entrypoint — the surface `pithy add payments` wires into `pithy.config.ts`. Deliberately
3
5
  * narrow: the capability factory, its catalog types and lookups, the four table schemas, and the projection
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PAYMENTS_RAILS, PaymentsRail } from "./data/rail.js";
2
4
  import { PaymentsSubject, PaymentsSubjectType, decodeSubjectReference, encodeSubjectReference, sameSubject } from "./data/subject.js";
3
5
  import { PaymentsAppleProduct, PaymentsConfig, PaymentsGoogleProduct, PaymentsGrants, PaymentsLedgerGrant, PaymentsLemonSqueezyProduct, PaymentsLemonSqueezySettings, PaymentsPaddleProduct, PaymentsPaddleSettings, PaymentsProduct, PaymentsProductType, PaymentsRailToggles, PaymentsStripeProduct, PaymentsStripeSettings, entitlementsForProduct, grantableEntitlements, productForProviderSku, providerProductId, railEnabled, resolveProduct } from "./config/config.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { Migration } from "kysely/migration";
2
4
  /**
3
5
  * Payments' six tables: the purchase projection, the materialized entitlement read model, the
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { sql } from "kysely";
2
4
  //#region src/migrations/0001_purchases.ts
3
5
  /**
@@ -1 +1,2 @@
1
+ /*! SPDX-FileCopyrightText: 2026 Pithy | SPDX-License-Identifier: MIT */
1
2
  (function(){function e(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.getItem==`function`&&typeof t.setItem==`function`&&typeof t.removeItem==`function`}function t(t){let n=typeof t.key==`string`?t.key.trim():``,r=e(t.store)?t.store:null,i=typeof t.ttlMs==`number`&&Number.isFinite(t.ttlMs)&&t.ttlMs>0?t.ttlMs:null;if(n!==``&&r!==null&&i!==null)return{key:n,store:r,ttlMs:i};if((t.key??t.store??t.ttlMs)==null)return null;let a=[n===``?`key`:null,r===null?`store`:null,i===null?`ttlMs`:null].filter(e=>e!==null).join(`, `);return console.warn(`Paddle price cache ignored. Missing: ${a}. A cache needs key, store and ttlMs together, so that where a customer's price rests and how long it stands are both stated. Pass all three, or none.`),null}function n(e){return`pithy.paddle.price.${e.key}.`}function r(e,t){return`${n(e)}${t}`}function i(e){if(e===null)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t;return typeof n.at!=`number`||!(`answer`in n)?null:{at:n.at,answer:n.answer}}function a(e,t){let n=Date.now()-e;return n<0||n>t}function o(e,t){try{e.store.removeItem(r(e,t))}catch{}}function s(e,t){let n;try{n=e.store.getItem(r(e,t))}catch{return null}if(n===null)return null;let s=i(n);return s===null||a(s.at,e.ttlMs)?(o(e,t),null):s.answer}function c(e){let t=e.store;if(typeof t.key==`function`&&typeof t.length==`number`)try{let r=[],o=n(e);for(let n=0;n<t.length;n+=1){let s=t.key(n);if(s==null||!s.startsWith(o))continue;let c=i(t.getItem(s));(c===null||a(c.at,e.ttlMs))&&r.push(s)}for(let e of r)t.removeItem(e)}catch{}}function l(e,t,n){c(e);let i;try{i=JSON.stringify({at:Date.now(),answer:n})}catch{return}try{e.store.setItem(r(e,t),i)}catch{}}function u(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){u(a,r,i,o,s,`next`,e)}function s(e){u(a,r,i,o,s,`throw`,e)}o(void 0)})}}function f(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?p(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t){if(e==null)return{};var n,r,i=g(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function _(){_=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},a=typeof Symbol==`function`?Symbol:{},o=a.iterator||`@@iterator`,s=a.asyncIterator||`@@asyncIterator`,c=a.toStringTag||`@@toStringTag`;function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},``)}catch{l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,o=Object.create(a.prototype);return i(o,`_invoke`,{value:D(e,n,new j(r||[]))}),o}function d(e,t,n){try{return{type:`normal`,arg:e.call(t,n)}}catch(e){return{type:`throw`,arg:e}}}t.wrap=u;var f=`suspendedStart`,p=`suspendedYield`,m=`executing`,h=`completed`,g={};function v(){}function y(){}function b(){}var x={};l(x,o,function(){return this});var S=Object.getPrototypeOf,C=S&&S(S(M([])));C&&C!==n&&r.call(C,o)&&(x=C);var w=b.prototype=v.prototype=Object.create(x);function T(e){[`next`,`throw`,`return`].forEach(function(t){l(e,t,function(e){return this._invoke(t,e)})})}function E(e,t){function n(i,a,o,s){var c=d(e[i],e,a);if(c.type!==`throw`){var l=c.arg,u=l.value;return u&&typeof u==`object`&&r.call(u,`__await`)?t.resolve(u.__await).then(function(e){n(`next`,e,o,s)},function(e){n(`throw`,e,o,s)}):t.resolve(u).then(function(e){l.value=e,o(l)},function(e){return n(`throw`,e,o,s)})}s(c.arg)}var a;i(this,`_invoke`,{value:function(e,r){function i(){return new t(function(t,i){n(e,r,t,i)})}return a=a?a.then(i,i):i()}})}function D(t,n,r){var i=f;return function(a,o){if(i===m)throw Error(`Generator is already running`);if(i===h){if(a===`throw`)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=O(s,r);if(c){if(c===g)continue;return c}}if(r.method===`next`)r.sent=r._sent=r.arg;else if(r.method===`throw`){if(i===f)throw i=h,r.arg;r.dispatchException(r.arg)}else r.method===`return`&&r.abrupt(`return`,r.arg);i=m;var l=d(t,n,r);if(l.type===`normal`){if(i=r.done?h:p,l.arg===g)continue;return{value:l.arg,done:r.done}}l.type===`throw`&&(i=h,r.method=`throw`,r.arg=l.arg)}}}function O(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,r===`throw`&&t.iterator.return&&(n.method=`return`,n.arg=e,O(t,n),n.method===`throw`)||r!==`return`&&(n.method=`throw`,n.arg=TypeError(`The iterator does not provide a '`+r+`' method`)),g;var a=d(i,t.iterator,n.arg);if(a.type===`throw`)return n.method=`throw`,n.arg=a.arg,n.delegate=null,g;var o=a.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,n.method!==`return`&&(n.method=`next`,n.arg=e),n.delegate=null,g):o:(n.method=`throw`,n.arg=TypeError(`iterator result is not an object`),n.delegate=null,g)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type=`normal`,delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:`root`}],e.forEach(k,this),this.reset(!0)}function M(t){if(t||t===``){var n=t[o];if(n)return n.call(t);if(typeof t.next==`function`)return t;if(!isNaN(t.length)){var i=-1,a=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw TypeError(typeof t+` is not iterable`)}return y.prototype=b,i(w,`constructor`,{value:b,configurable:!0}),i(b,`constructor`,{value:y,configurable:!0}),y.displayName=l(b,c,`GeneratorFunction`),t.isGeneratorFunction=function(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===y||(t.displayName||t.name)===`GeneratorFunction`)},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,c,`GeneratorFunction`)),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},T(E.prototype),l(E.prototype,s,function(){return this}),t.AsyncIterator=E,t.async=function(e,n,r,i,a){a===void 0&&(a=Promise);var o=new E(u(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},T(w),l(w,c,`Generator`),l(w,o,function(){return this}),l(w,`toString`,function(){return`[object Generator]`}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=`next`,this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)n.charAt(0)===`t`&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type===`throw`)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type=`throw`,s.arg=t,n.next=r,i&&(n.method=`next`,n.arg=e),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if(o.tryLoc===`root`)return i(`end`);if(o.tryLoc<=this.prev){var c=r.call(o,`catchLoc`),l=r.call(o,`finallyLoc`);if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw Error(`try statement without catch or finally`);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,`finallyLoc`)&&this.prev<i.finallyLoc){var a=i;break}}a&&(e===`break`||e===`continue`)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method=`next`,this.next=a.finallyLoc,g):this.complete(o)},complete:function(e,t){if(e.type===`throw`)throw e.arg;return e.type===`break`||e.type===`continue`?this.next=e.arg:e.type===`return`?(this.rval=this.arg=e.arg,this.method=`return`,this.next=`end`):e.type===`normal`&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if(r.type===`throw`){var i=r.arg;A(n)}return i}}throw Error(`illegal catch attempt`)},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},this.method===`next`&&(this.arg=e),g}},t}function v(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function y(e){var t=v(e,`string`);return typeof t==`symbol`?t:t+``}var b={CLASSIC:`classic`,V1:`v1`},x=b.V1,S=`https://cdn.paddle.com/paddle/paddle.js`,C=`https://cdn.paddle.com/paddle/v2/paddle.js`,w={url:S},T={url:C};function E(e){return document.querySelector(`script[src="${e}"]`)||void 0}function D(e){var t=document.createElement(`script`);t.src=e;var n=document.head||document.body;if(!n)throw Error(`Cannot inject Paddle.js. It needs a <head> or <body> element.`);return n.appendChild(t),t}var O={classic:void 0,v1:void 0},k={classic:`PaddleClassic`,v1:`PaddleBillingV1`};function A(e){var t=j(e)?.url;if(t){var n=O[e],r=k[e];return n===void 0?(O[e]=new Promise(function(n,i){if(typeof window>`u`){n(void 0);return}if(window[r]){n(window[r]);return}try{var a=E(t);a||=D(t),a.addEventListener(`load`,function(){window[r]?n(window[r]):i(Error(`Paddle.js not available`))}),a.addEventListener(`error`,function(){i(Error(`Failed to load Paddle.js - ${e}`))})}catch(e){i(e);return}}),O[e]):n}}function j(e){if(e===b.CLASSIC)return w;if(e===b.V1)return T;console.error(`[Paddle] Unknown Paddle Version`)}var M=[`environment`,`version`],ee=[`environment`,`version`];function N(e,t){var n=e.environment;e.version;var r=h(e,M);try{n&&t.Environment.set(n),t.Initialized?t.Update(m({},r)):t.Initialize(m({},r))}catch(e){console.warn(`[Paddle] Paddle Initialization failed. Please check the inputs`,e)}}function te(e,t){var n=e.environment;e.version;var r=h(e,ee);try{n&&t.Environment.set(n),t.Setup(m({},r))}catch(e){console.warn(`[Paddle] Paddle Initialization failed. Please check the inputs`,e)}}var ne;(function(e){e.CHECKOUT_LOADED=`checkout.loaded`,e.CHECKOUT_CLOSED=`checkout.closed`,e.CHECKOUT_UPDATED=`checkout.updated`,e.CHECKOUT_COMPLETED=`checkout.completed`,e.CHECKOUT_ERROR=`checkout.error`,e.CHECKOUT_FAILED=`checkout.failed`,e.CHECKOUT_ITEMS_UPDATED=`checkout.items.updated`,e.CHECKOUT_ITEMS_REMOVED=`checkout.items.removed`,e.CHECKOUT_CUSTOMER_CREATED=`checkout.customer.created`,e.CHECKOUT_CUSTOMER_UPDATED=`checkout.customer.updated`,e.CHECKOUT_CUSTOMER_REMOVED=`checkout.customer.removed`,e.CHECKOUT_PAYMENT_SELECTED=`checkout.payment.selected`,e.CHECKOUT_PAYMENT_INITIATED=`checkout.payment.initiated`,e.CHECKOUT_PAYMENT_FAILED=`checkout.payment.failed`,e.CHECKOUT_PAYMENT_ERROR=`checkout.payment.error`,e.CHECKOUT_DISCOUNT_APPLIED=`checkout.discount.applied`,e.CHECKOUT_DISCOUNT_REMOVED=`checkout.discount.removed`,e.CHECKOUT_UPSELL_CANCELED=`checkout.upsell.canceled`})(ne||={});var re;(function(e){e.DAY=`day`,e.WEEK=`week`,e.MONTH=`month`,e.YEAR=`year`})(re||={});var ie;(function(e){e.ALIPAY=`alipay`,e.APPLE_PAY=`apple-pay`,e.CARD=`card`,e.GOOGLE_PAY=`google-pay`,e.IDEAL=`ideal`,e.PAYPAL=`paypal`,e.WECHAT_PAY=`wechat-pay`,e.WIRE_TRANSFER=`wire-transfer`,e.NONE=`none`})(ie||={});var ae;(function(e){e.AMERICAN_EXPRESS=`american_express`,e.DINERS_CLUB=`diners_club`,e.DISCOVER=`discover`,e.JCB=`jcb`,e.MADA=`mada`,e.MAESTRO=`maestro`,e.MASTER_CARD=`mastercard`,e.UNION_PAY=`union_pay`,e.VISA=`visa`,e.UNKNOWN=`unknown`})(ae||={});var oe;(function(e){e.DRAFT=`draft`,e.READY=`ready`,e.COMPLETED=`completed`,e.BILLED=`billed`,e.canceled=`canceled`,e.PAST_DUE=`past_due`})(oe||={});function se(e){return P.apply(this,arguments)}function P(){return P=d(_().mark(function e(t){var n,r;return _().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t?.version||x,e.next=3,A(n);case 3:if(r=e.sent,!r){e.next=9;break}return t&&(n===b.V1?N(t,r):n===b.CLASSIC&&te(t,r)),e.abrupt(`return`,r);case 9:return console.error(`[Paddle] Error Loading Paddle`),e.abrupt(`return`);case 11:case`end`:return e.stop()}},e)})),P.apply(this,arguments)}let ce={code:`client/unreadable`,message:`The store answered with something we couldn't read.`,action:`Try again. If it keeps happening, the app and the backend are out of step.`},le={code:`client/no_browser`,message:`There's no browser to send you to the payment page.`,action:`Start checkout from the page in the browser, not before it has loaded.`},ue=new Set([`BIF`,`CLP`,`DJF`,`GNF`,`ISK`,`JPY`,`KMF`,`KRW`,`PYG`,`RWF`,`UGX`,`UYI`,`VND`,`VUV`,`XAF`,`XOF`,`XPF`]),F=new Set([`BHD`,`IQD`,`JOD`,`KWD`,`LYD`,`OMR`,`TND`]);function I(e){let t=e.toUpperCase();return ue.has(t)?0:F.has(t)?3:2}let L=/\p{Nd}/u,R=/^-?[0-9]+$/;function z(e){return e!==void 0&&L.test(e)}function B(e){if(e===void 0||!z(e))return!1;let t=e.codePointAt(0);return t!==void 0&&!z(String.fromCodePoint(t-1))}function V(e,t){let n=[...e],r=n.length;for(;r>0&&!z(n[r-1]);)--r;let i=r-t;if(i<2)return e;for(let t=i;t<r;t+=1)if(!B(n[t]))return e;return z(n[i-1])||!z(n[i-2])?e:[...n.slice(0,i-1),...n.slice(r)].join(``)}function H(e){let t=I(e.currency);if(t===0||!R.test(e.minorAmount))return e.formatted;let n=Number(e.minorAmount);return!Number.isSafeInteger(n)||n%10**t!=0?e.formatted:V(e.formatted,t)}let U={code:`client/paddle_unavailable`,message:`We couldn't load the payment provider.`,action:`Check your connection or any content blockers, then reload.`},de={code:`client/paddle_not_initialized`,message:`The payment provider wouldn't start.`,action:`Reload. If it keeps happening, this project's payment settings are wrong.`},fe={code:`client/paddle_account_conflict`,message:`The payment provider is already running for a different account.`,action:`One page serves one Paddle account. Reload before switching.`},pe={code:`client/paddle_preview_refused`,message:`We couldn't get a price for you.`,action:`Try again in a moment.`},me={};function W(e){return`${e.environment}:${e.clientToken}`}let he=e=>se(e);function ge(e,t){let n=t?.registry??me,r=W(e),i=n.current;if(i)return i.key===r?i.paddle:Promise.resolve({ok:!1,failure:fe});let a=t?.initialize??he,o=new Promise(t=>{t(a({token:e.clientToken,environment:e.environment}))}).then(e=>e?e.Initialized?{ok:!0,value:e}:{ok:!1,failure:de}:{ok:!1,failure:le},()=>({ok:!1,failure:U})).then(e=>(!e.ok&&n.current?.key===r&&(n.current=void 0),e));return n.current={key:r,paddle:o},o}function G(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e){if(!G(e))return null;let{subtotal:t,discount:n,tax:r,total:i}=e;return typeof t!=`string`||typeof n!=`string`||typeof r!=`string`||typeof i!=`string`?null:{subtotal:t,discount:n,tax:r,total:i}}function q(e){return typeof e==`string`&&e.length>0?e:null}function _e(e,t){let n=e.unitPriceOverrides;if(t!==null&&Array.isArray(n))for(let e of n){if(!G(e)||!Array.isArray(e.countryCodes)||!e.countryCodes.includes(t))continue;let n=e.unitPrice;return!G(n)||typeof n.amount!=`string`||typeof n.currencyCode!=`string`?null:{amount:n.amount,currency:n.currencyCode}}let r=e.unitPrice;return!G(r)||typeof r.amount!=`string`||typeof r.currencyCode!=`string`?null:{amount:r.amount,currency:r.currencyCode}}function ve(e,t,n,r){if(e.tax===`0`)return`none`;let i=_e(t,r);return i===null||i.currency!==n?`unknown`:e.subtotal===i.amount?`added`:e.total===i.amount?`included`:`unknown`}function ye(e,t,n){if(!G(e))return null;let r=e.price,i=e.product;if(!G(r)||!G(i)||typeof r.id!=`string`||typeof i.name!=`string`||typeof e.quantity!=`number`||typeof e.taxRate!=`string`)return null;let a=K(e.unitTotals),o=K(e.totals),s=K(e.formattedUnitTotals),c=K(e.formattedTotals);if(!a||!o||!s||!c)return null;let l=r.billingCycle,u=G(l)&&typeof l.interval==`string`&&typeof l.frequency==`number`?{interval:l.interval,frequency:l.frequency}:null;return{priceId:r.id,productName:i.name,priceName:q(r.name),quantity:e.quantity,taxRate:e.taxRate,billingCycle:u,unitTotals:a,totals:o,formattedUnitTotals:s,formattedTotals:c,taxTreatment:ve(a,r,t,n)}}function J(e){if(!G(e))return null;let t=G(e.data)?e.data:e;if(typeof t.currencyCode!=`string`)return null;let n=t.details;if(!G(n)||!Array.isArray(n.lineItems))return null;let r=G(t.address)?t.address:null,i=r?q(r.countryCode):null,a=r?q(r.postalCode):null,o=[];for(let e of n.lineItems){let n=ye(e,t.currencyCode,i);if(n===null)return null;o.push(n)}return{currencyCode:t.currencyCode,countryCode:i,postalCode:a,lines:o}}async function be(e,n,r){let i=r?.cache===void 0?null:t(r.cache),a=i===null?``:`${W(e)}|${Se(n)}`;if(i!==null){let e=s(i,a),t=e===null?null:J(e);if(t!==null)return{ok:!0,value:t}}let o=await ge(e,r);if(!o.ok)return o;let c=await new Promise(e=>e(o.value.PricePreview(n))).then(e=>({answered:!0,value:e}),()=>({answered:!1,value:void 0}));if(!c.answered)return{ok:!1,failure:pe};let u=J(c.value);return u===null?{ok:!1,failure:ce}:(i!==null&&l(i,a,c.value),{ok:!0,value:u})}function xe(e,t,n){let r=e.postalCode===null,i=t.formattedUnitTotals,a=r=>n?.wholeUnits===!0?H({formatted:i[r],minorAmount:t.unitTotals[r],currency:e.currencyCode}):i[r];return t.taxTreatment===`added`?{headline:a(`subtotal`),note:`Plus ${i.tax} tax.`,estimated:r}:t.taxTreatment===`included`?{headline:a(`total`),note:`Includes ${i.tax} tax.`,estimated:r}:t.taxTreatment===`none`?{headline:a(`total`),note:r?`Tax is settled at checkout.`:null,estimated:r}:{headline:a(`total`),note:`Includes ${i.tax} tax.`,estimated:r}}function Se(e){return JSON.stringify([e.items.map(e=>[e.priceId,e.quantity]),e.address?[e.address.countryCode,e.address.postalCode??null]:null,e.customerId??null,e.customerIpAddress??null,e.currencyCode??null,e.discountId??null])}async function Ce(e,t,n){let r=Object.entries(t);if(r.length===0)return{ok:!0,value:[]};let i=[...new Set(r.map(([,e])=>e))],a=await be(e,{...n?.query,items:i.map(e=>({priceId:e,quantity:1}))},n);if(!a.ok)return a;let o=[];for(let[e,t]of r){let r=a.value.lines.find(e=>e.priceId===t);if(r===void 0)continue;let i=xe(a.value,r,{wholeUnits:n?.wholeUnits});o.push({plan:e,priceId:t,headline:i.headline,note:i.note,estimated:i.estimated,currency:a.value.currencyCode})}return{ok:!0,value:o}}let we={code:`client/paddle_prices_not_configured`,message:`Prices aren't available right now.`,action:`Set data-paddle-env, data-paddle-token and every data-paddle-price-<name> id on the paddle-prices script tag.`},Y={sandbox:`test_`,production:`live_`},Te=/^pri_/,Ee=/^ctm_/;function X(e){try{return globalThis[e]??null}catch{return null}}function De(e,t){return e===`local`?t?.local===void 0?X(`localStorage`)??e:t.local:e===`session`?t?.session===void 0?X(`sessionStorage`)??e:t.session:e}function Oe(e){if(e===null)return null;let t=Number(e);return Number.isFinite(t)?t*1e3:NaN}function ke(e,n){if(e===null)return null;let r=e.getAttribute(`data-paddle-env`);if(r!==`sandbox`&&r!==`production`)return null;let i=e.getAttribute(`data-paddle-token`);if(i===null||!i.startsWith(Y[r]))return null;let a={};for(let t of e.getAttributeNames()){if(!t.startsWith(`data-paddle-price-`))continue;let n=e.getAttribute(t);if(n===null||!Te.test(n))return null;a[t.slice(18)]=n}if(Object.keys(a).length===0)return null;let o=e.getAttribute(`data-paddle-customer`)?.trim()??``,s=Ee.test(o)?{customerId:o}:{},c=t({key:e.getAttribute(`data-paddle-cache`),store:De(e.getAttribute(`data-paddle-cache-store`),n),ttlMs:Oe(e.getAttribute(`data-paddle-cache-ttl`))});return{setup:{clientToken:i,environment:r},plans:a,paint:e.getAttribute(`data-paddle-paint`)!==`off`,wholeUnits:e.getAttribute(`data-paddle-whole-units`)===`on`,query:s,cache:c}}let Z=`data-price-plan`,Q=`data-price-note`;function $(e,t){return e!==null&&e.toLowerCase()===t.toLowerCase()}function Ae(e,t){for(let n of Array.from(e.querySelectorAll(`[${Z}]`))){let e=t.find(e=>$(n.getAttribute(Z),e.plan));e!==void 0&&(n.textContent=e.headline)}for(let n of Array.from(e.querySelectorAll(`[${Q}]`))){let e=t.find(e=>$(n.getAttribute(Q),e.plan));e!==void 0&&e.note!==null&&(n.textContent=e.note)}}function je(e){return e.readyState===`loading`?new Promise(t=>{e.addEventListener(`DOMContentLoaded`,()=>t(),{once:!0})}):Promise.resolve()}async function Me(e,t,n){let{stores:r,...i}=n??{},a=ke(t,r);if(a===null)return{ok:!1,failure:we};let o=await Ce(a.setup,a.plans,{...i,query:{...a.query,...i.query},cache:i.cache??a.cache??void 0,wholeUnits:i.wholeUnits??a.wholeUnits});return!o.ok||!a.paint?o:(await je(e),Ae(e,o.value),o)}globalThis.pithyPaddlePrices={quotes:Me(document,document.currentScript)}})();
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * Where a price quote's location comes from, decided in one place.
3
5
  *
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/pricing/location.ts
2
4
  /**
3
5
  * Pick the best location available, and say which one it is.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { type PaymentsClientOptions } from "../client/api";
2
4
  import type { PriceVisitor } from "./location";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { callPayments } from "../client/api.js";
2
4
  //#region src/pricing/visitor.ts
3
5
  /** Whether a value is a plain record — the first step of the guard. */
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  /**
3
5
  * A provider event, normalized. This is the writer's whole input, and the seam between "how a rail talks"
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsRail } from "../data/rail.js";
2
4
  import { PaymentsSubject } from "../data/subject.js";
3
5
  import { PurchaseStatus } from "../data/status.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { D1Database } from "@cloudflare/workers-types";
2
4
  import type { PaymentsConfig } from "../config/config";
3
5
  import type { PurchaseEnvironment } from "../data/purchase";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsWebhookEvent, WEBHOOK_EVENT_ORPHANED, webhookEventAwaitsOwner } from "../data/webhookEvent.js";
2
4
  import { PAYMENTS_WEBHOOK_EVENTS_TABLE, paymentsDatabase } from "../data/tables.js";
3
5
  import { resolveNotificationOwner } from "./owner.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { D1Database } from "@cloudflare/workers-types";
2
4
  import type { PaymentsRail } from "../data/rail";
3
5
  import { PaymentsSubject } from "../data/subject";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsSubject } from "../data/subject.js";
2
4
  import { PaymentsProviderAccount } from "../data/providerAccount.js";
3
5
  import { PAYMENTS_PROVIDER_ACCOUNTS_TABLE, PAYMENTS_PURCHASES_TABLE, paymentsDatabase } from "../data/tables.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { Entitlement } from "@pithy-sh/core/src/entitlement/entitlement";
2
4
  import type { PaymentsSubject } from "../data/subject";
3
5
  import { type PaymentsDatabase } from "../data/tables";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsEntitlement } from "../data/entitlement.js";
2
4
  import { PAYMENTS_ENTITLEMENTS_TABLE } from "../data/tables.js";
3
5
  //#region src/projection/resolve.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { D1Database, D1PreparedStatement } from "@cloudflare/workers-types";
2
4
  import { type PaymentsConfig } from "../config/config";
3
5
  import { PaymentsEntitlement } from "../data/entitlement";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { encodeSubjectReference, sameSubject } from "../data/subject.js";
2
4
  import { entitlementsForProduct, productForProviderSku } from "../config/config.js";
3
5
  import { PaymentsEntitlement } from "../data/entitlement.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { type WorkflowHostTemplate } from "@pithy-sh/core/src/workflow/host";
2
4
  import type { ManagedEnvironment } from "@pithy-sh/secrets/src/scope";
3
5
  import type { PaymentsConfig } from "../config/config";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PAYMENTS_CAPABILITY, paymentsWorkflowRegistry } from "../workflows/specs.js";
2
4
  import { resourceNames } from "@pithy-sh/core/src/naming/resourceNames";
3
5
  import { hostWorkflowsFor, resolveWorkflowHost } from "@pithy-sh/core/src/workflow/host";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * Every Apple root a chain may terminate in, base64 DER. The last certificate in a JWS `x5c` must be
3
5
  * byte-identical to one of these — a stronger check than re-verifying a self-signature, which only proves
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * Every Apple root a chain may terminate in, base64 DER. The last certificate in a JWS `x5c` must be
3
5
  * byte-identical to one of these — a stronger check than re-verifying a self-signature, which only proves
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * The byte encodings Apple's signed data is built from: base64 and base64url, and just enough ASN.1 DER
3
5
  * to walk an X.509 certificate.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError } from "../../error/errors.js";
2
4
  //#region src/rails/apple/der.ts
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * Test material: a real X.509 certificate chain and real JWS signatures, minted at test time.
3
5
  *
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/rails/apple/fixtures/chain.ts
2
4
  const OID_COMMON_NAME = "2.5.4.3";
3
5
  const OID_ECDSA_SHA256 = "1.2.840.10045.4.3.2";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * The one door out to Apple, and the mapping from how it answered to what that means.
3
5
  *
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsProviderUnavailableError, PaymentsRailNotConfiguredError } from "../../error/errors.js";
2
4
  //#region src/rails/apple/http.ts
3
5
  /** The default transport: the runtime's own `fetch`. */
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /** Which roots to trust and what clock to judge certificate validity against. */
2
4
  export interface VerifyAppleJwsOptions {
3
5
  /** base64 DER of every acceptable root. Defaults to the pinned Apple roots. */
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { APPLE_ROOT_CERTIFICATES } from "./certs.js";
3
5
  import { decodeBase64, decodeBase64Url } from "./der.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  import type { PurchaseEnvironment } from "../../data/purchase";
3
5
  import type { PurchaseStatus } from "../../data/status";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { minorUnitsFromScaled } from "../../data/money.js";
3
5
  import { verifyAppleJws } from "./jws.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsAppleCredentials } from "../../secret/registry";
2
4
  import type { PaymentsRailProvider } from "../contract";
3
5
  import type { AppleHttpFetch } from "./http";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError } from "../../error/errors.js";
2
4
  import { APPLE_ROOT_CERTIFICATES } from "./certs.js";
3
5
  import { parseAppleNotification } from "./notification.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  import type { PaymentsPurchase, PurchaseEnvironment } from "../../data/purchase";
3
5
  import type { PurchaseStatus } from "../../data/status";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsRailNotConfiguredError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { minorUnitsFromScaled } from "../../data/money.js";
3
5
  import { decodeBase64 } from "./der.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { VerifiedPurchase } from "../contract";
2
4
  /**
3
5
  * The client-submission path: a StoreKit 2 signed transaction, verified locally.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError } from "../../error/errors.js";
2
4
  import { minorUnitsFromScaled } from "../../data/money.js";
3
5
  import { verifyAppleJws } from "./jws.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * Apple's marker on the certificate that signs App Store Server Notifications and transactions, and on the
3
5
  * WWDR intermediate that issues it. Published by Apple and checked by Apple's own `app-store-server-library`,
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { asn1Children, bytesEqual, decodeBase64, derSignatureToRaw, readAsn1, readBits, readBoolean, readInteger, readOid } from "./der.js";
3
5
  //#region src/rails/apple/x509.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { CreatedDiscount, DiscountTerms, SubscriptionPricing } from "../data/discount";
2
4
  import type { PaymentsPurchase } from "../data/purchase";
3
5
  import type { PaymentsRail } from "../data/rail";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/rails/contract.ts
2
4
  /** The note's text, whichever kind it is. An operator reads the two the same way; the row does not. */
3
5
  function noteText(note) {
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { GoogleJwk } from "../oidc";
2
4
  /**
3
5
  * Test material for Google's rail: a real RSA key, real RS256 signatures, and the Pub/Sub push envelope
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/rails/google/fixtures/push.ts
2
4
  /** RS256, which is the only algorithm Google signs a Pub/Sub push token with. */
3
5
  const RS256 = {
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * The one door out to Google, and the mapping from how it answered to what that means.
3
5
  *
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsProviderUnavailableError } from "../../error/errors.js";
2
4
  //#region src/rails/google/http.ts
3
5
  /** The default transport: the runtime's own `fetch`. */
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * The JWT primitives Google's two token jobs share.
3
5
  *
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError, PaymentsRailNotConfiguredError } from "../../error/errors.js";
2
4
  //#region src/rails/google/jwt.ts
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  import { type GoogleHttpFetch } from "./http";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { googleHttpFetch, googleJson } from "./http.js";
3
5
  import { base64UrlDecode, decodeJwtJson, splitJwt } from "./jwt.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  import type { PaymentsPurchase } from "../../data/purchase";
3
5
  import type { PurchaseStatus } from "../../data/status";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsProviderUnavailableError, PaymentsRailNotConfiguredError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { googleHttpFetch, googleJson } from "./http.js";
3
5
  import { base64UrlEncode, pemPrivateKey } from "./jwt.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsGoogleCredentials } from "../../secret/registry";
2
4
  import type { PaymentsRailProvider } from "../contract";
3
5
  import type { GoogleHttpFetch } from "./http";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { verifyGoogleOidcToken } from "./oidc.js";
3
5
  import { refreshPlayPurchase, resolvePlayPointer } from "./playApi.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  import type { PurchaseStatus } from "../../data/status";
3
5
  /** The Pub/Sub push envelope. `.loose()` so a new envelope field never refuses a real notification. */
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { base64UrlDecode } from "./jwt.js";
3
5
  import { z } from "zod";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  import type { VerifiedPurchase } from "../contract";
3
5
  import { type PlayApiOptions } from "./playApi";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { fetchPlayProduct, fetchPlaySubscription, playProductEvent, playSubscriptionEvent } from "./playApi.js";
3
5
  import { z } from "zod";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * The one door out to Lemon Squeezy, and the mapping from how it answered to what that means.
3
5
  *
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsProviderUnavailableError, PaymentsRailNotConfiguredError } from "../../error/errors.js";
2
4
  import { z } from "zod";
3
5
  //#region src/rails/lemonSqueezy/api.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsLemonSqueezyCredentials } from "../../secret/registry";
2
4
  import type { CheckoutHandoff, CheckoutSessionInput } from "../contract";
3
5
  import { type LemonSqueezyHttpFetch } from "./api";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { encodeSubjectReference } from "../../data/subject.js";
2
4
  import { PaymentsDiscountInvalidError, PaymentsProviderUnavailableError } from "../../error/errors.js";
3
5
  import { lemonSqueezyHttpFetch, lemonSqueezyJson } from "./api.js";