autumn-js 0.0.79 → 0.0.81

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 (211) hide show
  1. package/dist/libraries/backend/better-auth.js +30 -0
  2. package/dist/libraries/backend/better-auth.mjs +7 -7
  3. package/dist/libraries/backend/{chunk-J7UA442M.mjs → chunk-3VWJMYUQ.mjs} +13 -0
  4. package/dist/libraries/backend/{chunk-T4YSUMNB.mjs → chunk-6YOFMAEQ.mjs} +6 -6
  5. package/dist/libraries/backend/{chunk-Y2VYFWJD.mjs → chunk-7NHMUGUP.mjs} +1 -1
  6. package/dist/libraries/backend/{chunk-GUZSIYGF.mjs → chunk-CPLIRBCA.mjs} +1 -1
  7. package/dist/libraries/backend/{chunk-PBBWXVWW.mjs → chunk-HDGYVYU5.mjs} +1 -1
  8. package/dist/libraries/backend/{chunk-ZF4V3SVZ.mjs → chunk-MIWNIVVB.mjs} +1 -1
  9. package/dist/libraries/backend/{chunk-2JZFMBVR.mjs → chunk-PCYIWHGN.mjs} +18 -1
  10. package/dist/libraries/backend/express.d.mts +1 -1
  11. package/dist/libraries/backend/express.d.ts +1 -1
  12. package/dist/libraries/backend/express.js +30 -0
  13. package/dist/libraries/backend/express.mjs +7 -7
  14. package/dist/libraries/backend/fastify.js +30 -0
  15. package/dist/libraries/backend/fastify.mjs +7 -7
  16. package/dist/libraries/backend/hono.js +30 -0
  17. package/dist/libraries/backend/hono.mjs +7 -7
  18. package/dist/libraries/backend/next.js +30 -0
  19. package/dist/libraries/backend/next.mjs +7 -7
  20. package/dist/libraries/backend/react-router.js +30 -0
  21. package/dist/libraries/backend/react-router.mjs +7 -7
  22. package/dist/libraries/backend/{referralTypes-PidjhXlJ.d.ts → referralTypes-BZ4WOVK5.d.ts} +13 -0
  23. package/dist/libraries/backend/{referralTypes-DUHggPfB.d.mts → referralTypes-C6ao6j-_.d.mts} +13 -0
  24. package/dist/libraries/backend/remix_dep.js +30 -0
  25. package/dist/libraries/backend/remix_dep.mjs +7 -7
  26. package/dist/libraries/backend/routes/backendRouter.js +30 -0
  27. package/dist/libraries/backend/routes/backendRouter.mjs +7 -7
  28. package/dist/libraries/backend/routes/entityRoutes.js +13 -0
  29. package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
  30. package/dist/libraries/backend/routes/genRoutes.js +30 -0
  31. package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
  32. package/dist/libraries/backend/routes/productRoutes.js +13 -0
  33. package/dist/libraries/backend/routes/productRoutes.mjs +3 -3
  34. package/dist/libraries/backend/routes/referralRoutes.js +13 -0
  35. package/dist/libraries/backend/routes/referralRoutes.mjs +3 -3
  36. package/dist/libraries/backend/supabase.js +30 -0
  37. package/dist/libraries/backend/supabase.mjs +7 -7
  38. package/dist/libraries/backend/tanstack.js +30 -0
  39. package/dist/libraries/backend/tanstack.mjs +7 -7
  40. package/dist/libraries/backend/utils/backendRes.js +13 -0
  41. package/dist/libraries/backend/utils/backendRes.mjs +1 -1
  42. package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
  43. package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
  44. package/dist/libraries/backend/utils/withAuth.js +13 -0
  45. package/dist/libraries/backend/utils/withAuth.mjs +2 -2
  46. package/dist/libraries/react/AutumnContext.d.mts +4 -4
  47. package/dist/libraries/react/AutumnContext.d.ts +4 -4
  48. package/dist/libraries/react/AutumnContext.js +19 -0
  49. package/dist/libraries/react/AutumnContext.mjs +4 -4
  50. package/dist/libraries/react/BaseAutumnProvider.d.mts +4 -4
  51. package/dist/libraries/react/BaseAutumnProvider.d.ts +4 -4
  52. package/dist/libraries/react/BaseAutumnProvider.js +190 -5670
  53. package/dist/libraries/react/BaseAutumnProvider.mjs +9 -19
  54. package/dist/libraries/react/{ReactAutumnClient-DykUHFzU.d.ts → ReactAutumnClient-CD6wjJoS.d.ts} +5 -4
  55. package/dist/libraries/react/{ReactAutumnClient-BUpLpfaT.d.mts → ReactAutumnClient-DglSetDZ.d.mts} +5 -4
  56. package/dist/libraries/react/ReactAutumnProvider.d.mts +1 -1
  57. package/dist/libraries/react/ReactAutumnProvider.d.ts +1 -1
  58. package/dist/libraries/react/ReactAutumnProvider.js +194 -5670
  59. package/dist/libraries/react/ReactAutumnProvider.mjs +10 -19
  60. package/dist/libraries/react/chunk-4DZUJMZF.mjs +170 -0
  61. package/dist/libraries/react/chunk-6XKT4CR3.mjs +20 -0
  62. package/dist/libraries/react/{chunk-ANT5FRPE.mjs → chunk-DFKCNRXM.mjs} +1 -1
  63. package/dist/libraries/react/chunk-DSHLYZWS.mjs +83 -0
  64. package/dist/libraries/react/chunk-EI2TXOE2.mjs +569 -0
  65. package/dist/libraries/react/chunk-ELPGPLUJ.mjs +77 -0
  66. package/dist/libraries/react/{chunk-KGHDNAQT.mjs → chunk-ET534E5H.mjs} +4 -2
  67. package/dist/libraries/react/chunk-I2TAKPWB.mjs +53 -0
  68. package/dist/libraries/react/{chunk-77N4ARHR.mjs → chunk-JNM4BLTM.mjs} +6 -0
  69. package/dist/libraries/react/chunk-KOX2RKIK.mjs +17 -0
  70. package/dist/libraries/react/{chunk-2E22VDNL.mjs → chunk-LLOLCHBX.mjs} +2 -2
  71. package/dist/libraries/react/chunk-QEYI3IGZ.mjs +17 -0
  72. package/dist/libraries/react/{chunk-EH2VPTFH.mjs → chunk-RRXCG32N.mjs} +13 -0
  73. package/dist/libraries/react/{chunk-QMPP4FVB.mjs → chunk-XNJDRLWX.mjs} +2 -2
  74. package/dist/libraries/react/chunk-ZLYUPJN5.mjs +85 -0
  75. package/dist/libraries/react/client/ReactAutumnClient.d.mts +4 -4
  76. package/dist/libraries/react/client/ReactAutumnClient.d.ts +4 -4
  77. package/dist/libraries/react/client/ReactAutumnClient.js +19 -0
  78. package/dist/libraries/react/client/ReactAutumnClient.mjs +3 -3
  79. package/dist/libraries/react/client/clientCompMethods.d.mts +4 -4
  80. package/dist/libraries/react/client/clientCompMethods.d.ts +4 -4
  81. package/dist/libraries/react/client/clientCusMethods.d.mts +4 -4
  82. package/dist/libraries/react/client/clientCusMethods.d.ts +4 -4
  83. package/dist/libraries/react/client/clientEntityMethods.d.mts +4 -4
  84. package/dist/libraries/react/client/clientEntityMethods.d.ts +4 -4
  85. package/dist/libraries/react/client/clientGenMethods.d.mts +7 -6
  86. package/dist/libraries/react/client/clientGenMethods.d.ts +7 -6
  87. package/dist/libraries/react/client/clientGenMethods.js +7 -0
  88. package/dist/libraries/react/client/clientGenMethods.mjs +3 -1
  89. package/dist/libraries/react/client/clientProdMethods.d.mts +4 -4
  90. package/dist/libraries/react/client/clientProdMethods.d.ts +4 -4
  91. package/dist/libraries/react/client/clientReferralMethods.d.mts +4 -4
  92. package/dist/libraries/react/client/clientReferralMethods.d.ts +4 -4
  93. package/dist/libraries/react/client/types/clientGenTypes.d.mts +6 -1
  94. package/dist/libraries/react/client/types/clientGenTypes.d.ts +6 -1
  95. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.mts +1 -1
  96. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.ts +1 -1
  97. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.js +44 -3
  98. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.mjs +19 -11
  99. package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.mts +1 -1
  100. package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.ts +1 -1
  101. package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.mts +1 -1
  102. package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.ts +1 -1
  103. package/dist/libraries/react/components/check-dialog/check-dialog-synced.mjs +2 -2
  104. package/dist/libraries/react/components/check-dialog/lib/check-content.d.mts +1 -1
  105. package/dist/libraries/react/components/check-dialog/lib/check-content.d.ts +1 -1
  106. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
  107. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
  108. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +5299 -5258
  109. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +19 -11
  110. package/dist/libraries/react/{cusTypes-CrTZaKED.d.ts → cusTypes-JFEvVZLp.d.mts} +3 -1
  111. package/dist/libraries/react/{cusTypes-CrTZaKED.d.mts → cusTypes-JFEvVZLp.d.ts} +3 -1
  112. package/dist/libraries/react/{entTypes-C-4aVfR8.d.mts → entTypes-CIemXnyX.d.mts} +1 -1
  113. package/dist/libraries/react/{entTypes-DWKPjkGS.d.ts → entTypes-CJ3jqOWR.d.ts} +1 -1
  114. package/dist/libraries/react/errorUtils/logAuthError.js +13 -0
  115. package/dist/libraries/react/errorUtils/logAuthError.mjs +1 -1
  116. package/dist/libraries/react/hooks/handleAllowed.d.mts +2 -2
  117. package/dist/libraries/react/hooks/handleAllowed.d.ts +2 -2
  118. package/dist/libraries/react/hooks/useAutumn.d.mts +4 -3
  119. package/dist/libraries/react/hooks/useAutumn.d.ts +4 -3
  120. package/dist/libraries/react/hooks/useAutumn.js +158 -5755
  121. package/dist/libraries/react/hooks/useAutumn.mjs +7 -20
  122. package/dist/libraries/react/hooks/useAutumnBase.d.mts +6 -5
  123. package/dist/libraries/react/hooks/useAutumnBase.d.ts +6 -5
  124. package/dist/libraries/react/hooks/useAutumnBase.js +154 -5751
  125. package/dist/libraries/react/hooks/useAutumnBase.mjs +6 -20
  126. package/dist/libraries/react/hooks/useCustomer.d.mts +4 -4
  127. package/dist/libraries/react/hooks/useCustomer.d.ts +4 -4
  128. package/dist/libraries/react/hooks/useCustomer.js +184 -5665
  129. package/dist/libraries/react/hooks/useCustomer.mjs +9 -20
  130. package/dist/libraries/react/hooks/useCustomerBase.d.mts +6 -5
  131. package/dist/libraries/react/hooks/useCustomerBase.d.ts +6 -5
  132. package/dist/libraries/react/hooks/useCustomerBase.js +184 -5673
  133. package/dist/libraries/react/hooks/useCustomerBase.mjs +8 -20
  134. package/dist/libraries/react/hooks/useEntity.d.mts +3 -3
  135. package/dist/libraries/react/hooks/useEntity.d.ts +3 -3
  136. package/dist/libraries/react/hooks/useEntity.js +179 -5726
  137. package/dist/libraries/react/hooks/useEntity.mjs +9 -20
  138. package/dist/libraries/react/hooks/useEntityBase.d.mts +4 -4
  139. package/dist/libraries/react/hooks/useEntityBase.d.ts +4 -4
  140. package/dist/libraries/react/hooks/useEntityBase.js +179 -5726
  141. package/dist/libraries/react/hooks/useEntityBase.mjs +8 -20
  142. package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
  143. package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
  144. package/dist/libraries/react/hooks/usePricingTable.js +19 -0
  145. package/dist/libraries/react/hooks/usePricingTable.mjs +6 -6
  146. package/dist/libraries/react/hooks/usePricingTableBase.d.mts +4 -4
  147. package/dist/libraries/react/hooks/usePricingTableBase.d.ts +4 -4
  148. package/dist/libraries/react/hooks/usePricingTableBase.js +19 -0
  149. package/dist/libraries/react/hooks/usePricingTableBase.mjs +5 -5
  150. package/dist/libraries/react/hooks/useProductsBase.js +19 -0
  151. package/dist/libraries/react/hooks/useProductsBase.mjs +4 -4
  152. package/dist/libraries/react/index.d.ts +13 -0
  153. package/dist/libraries/react/index.js +1551 -1510
  154. package/dist/libraries/react/index.mjs +1553 -1512
  155. package/dist/libraries/react/{response-D0CcXse-.d.ts → response-BIBRaj58.d.ts} +6 -2
  156. package/dist/libraries/react/{response-DwYxo3Li.d.mts → response-CCcWrbaE.d.mts} +6 -2
  157. package/dist/next/{AutumnProvider-CGdXoZNQ.d.mts → AutumnProvider-DPcEuE_Q.d.mts} +2 -0
  158. package/dist/next/{AutumnProvider-CGdXoZNQ.d.ts → AutumnProvider-DPcEuE_Q.d.ts} +2 -0
  159. package/dist/next/AutumnProvider.d.mts +1 -1
  160. package/dist/next/AutumnProvider.d.ts +1 -1
  161. package/dist/next/client/NextAutumnClient.d.mts +4 -3
  162. package/dist/next/client/NextAutumnClient.d.ts +4 -3
  163. package/dist/next/client/NextAutumnProvider.d.mts +1 -1
  164. package/dist/next/client/NextAutumnProvider.d.ts +1 -1
  165. package/dist/next/client/{clientGenTypes-_eDeut4m.d.ts → clientGenTypes-CAv4hwb4.d.ts} +11 -2
  166. package/dist/next/client/{clientGenTypes-KQqk1H9-.d.mts → clientGenTypes-Dlpw9wy_.d.mts} +11 -2
  167. package/dist/next/client/clientUtils.d.mts +2 -2
  168. package/dist/next/client/clientUtils.d.ts +2 -2
  169. package/dist/next/client/{cusTypes-CSbB7Wu9.d.mts → cusTypes-CJI8rdlY.d.mts} +2 -0
  170. package/dist/next/client/{cusTypes-CSbB7Wu9.d.ts → cusTypes-CJI8rdlY.d.ts} +2 -0
  171. package/dist/next/client/{entTypes-B3R2yjLW.d.ts → entTypes-CqHWTcCX.d.ts} +1 -1
  172. package/dist/next/client/{entTypes-6xEkbn32.d.mts → entTypes-okM0aeOM.d.mts} +1 -1
  173. package/dist/next/client/hooks/useAutumn.d.mts +4 -3
  174. package/dist/next/client/hooks/useAutumn.d.ts +4 -3
  175. package/dist/next/client/hooks/useCustomer.d.mts +4 -3
  176. package/dist/next/client/hooks/useCustomer.d.ts +4 -3
  177. package/dist/next/client/hooks/useEntity.d.mts +4 -4
  178. package/dist/next/client/hooks/useEntity.d.ts +4 -4
  179. package/dist/next/client/hooks/usePricingTable.d.mts +1 -1
  180. package/dist/next/client/hooks/usePricingTable.d.ts +1 -1
  181. package/dist/next/client/types.d.mts +2 -2
  182. package/dist/next/client/types.d.ts +2 -2
  183. package/dist/next/index.d.mts +14 -2
  184. package/dist/next/index.d.ts +14 -2
  185. package/dist/next/server/auth/withNextAuth.d.mts +1 -1
  186. package/dist/next/server/auth/withNextAuth.d.ts +1 -1
  187. package/dist/next/server/componentActions.d.mts +1 -1
  188. package/dist/next/server/componentActions.d.ts +1 -1
  189. package/dist/next/server/cusActions.d.mts +12 -1
  190. package/dist/next/server/cusActions.d.ts +12 -1
  191. package/dist/next/server/{cusTypes-ASrCF4fa.d.mts → cusTypes-DuSwXVmp.d.mts} +2 -0
  192. package/dist/next/server/{cusTypes-ASrCF4fa.d.ts → cusTypes-DuSwXVmp.d.ts} +2 -0
  193. package/dist/next/server/genActions.d.mts +1 -1
  194. package/dist/next/server/genActions.d.ts +1 -1
  195. package/dist/sdk/index.d.mts +14 -1
  196. package/dist/sdk/index.d.ts +14 -1
  197. package/dist/sdk/index.js +13 -0
  198. package/dist/sdk/index.mjs +13 -0
  199. package/dist/utils/encryptUtils.js +13 -0
  200. package/dist/utils/encryptUtils.mjs +13 -0
  201. package/package.json +1 -1
  202. package/dist/libraries/react/BaseAutumnProvider.css +0 -1264
  203. package/dist/libraries/react/ReactAutumnProvider.css +0 -1264
  204. package/dist/libraries/react/chunk-4FM7BXFT.mjs +0 -992
  205. package/dist/libraries/react/hooks/useAutumn.css +0 -1264
  206. package/dist/libraries/react/hooks/useAutumnBase.css +0 -1264
  207. package/dist/libraries/react/hooks/useCustomer.css +0 -1264
  208. package/dist/libraries/react/hooks/useCustomerBase.css +0 -1264
  209. package/dist/libraries/react/hooks/useEntity.css +0 -1264
  210. package/dist/libraries/react/hooks/useEntityBase.css +0 -1264
  211. package/dist/libraries/react/{chunk-QJEJ7E65.mjs → chunk-27OTS3Q5.mjs} +3 -3
@@ -26,7 +26,7 @@ function styleInject(css, { insertAt } = {}) {
26
26
  styleInject('*:where(.au-root, .au-root *),\n:where(.au-root, .au-root *)::before,\n:where(.au-root, .au-root *)::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: #e5e7eb;\n}\n:where(.au-root, .au-root *)::before,\n:where(.au-root, .au-root *)::after {\n --tw-content: "";\n}\n.au-root {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n font-family:\n ui-sans-serif,\n system-ui,\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n font-feature-settings: normal;\n font-variation-settings: normal;\n -webkit-tap-highlight-color: transparent;\n}\n.au-root {\n margin: 0;\n line-height: inherit;\n}\nhr:where(.au-root, .au-root *) {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n}\nabbr:where([title]):where(.au-root, .au-root *) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\nh1:where(.au-root, .au-root *),\nh2:where(.au-root, .au-root *),\nh3:where(.au-root, .au-root *),\nh4:where(.au-root, .au-root *),\nh5:where(.au-root, .au-root *),\nh6:where(.au-root, .au-root *) {\n font-size: inherit;\n font-weight: inherit;\n}\na:where(.au-root, .au-root *) {\n color: inherit;\n text-decoration: inherit;\n}\nb:where(.au-root, .au-root *),\nstrong:where(.au-root, .au-root *) {\n font-weight: bolder;\n}\ncode:where(.au-root, .au-root *),\nkbd:where(.au-root, .au-root *),\nsamp:where(.au-root, .au-root *),\npre:where(.au-root, .au-root *) {\n font-family:\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n "Liberation Mono",\n "Courier New",\n monospace;\n font-feature-settings: normal;\n font-variation-settings: normal;\n font-size: 1em;\n}\nsmall:where(.au-root, .au-root *) {\n font-size: 80%;\n}\nsub:where(.au-root, .au-root *),\nsup:where(.au-root, .au-root *) {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\nsub:where(.au-root, .au-root *) {\n bottom: -0.25em;\n}\nsup:where(.au-root, .au-root *) {\n top: -0.5em;\n}\ntable:where(.au-root, .au-root *) {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n}\nbutton:where(.au-root, .au-root *),\ninput:where(.au-root, .au-root *),\noptgroup:where(.au-root, .au-root *),\nselect:where(.au-root, .au-root *),\ntextarea:where(.au-root, .au-root *) {\n font-family: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n}\nbutton:where(.au-root, .au-root *),\nselect:where(.au-root, .au-root *) {\n text-transform: none;\n}\nbutton:where(.au-root, .au-root *),\n[type=button]:where(.au-root, .au-root *),\n[type=reset]:where(.au-root, .au-root *),\n[type=submit]:where(.au-root, .au-root *) {\n -webkit-appearance: button;\n background-color: transparent;\n background-image: none;\n}\n:-moz-focusring:where(.au-root, .au-root *) {\n outline: auto;\n}\n:-moz-ui-invalid:where(.au-root, .au-root *) {\n box-shadow: none;\n}\nprogress:where(.au-root, .au-root *) {\n vertical-align: baseline;\n}\n:where(.au-root, .au-root *) ::-webkit-inner-spin-button,\n:where(.au-root, .au-root *) ::-webkit-outer-spin-button {\n height: auto;\n}\n[type=search]:where(.au-root, .au-root *) {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n}\n:where(.au-root, .au-root *) ::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n:where(.au-root, .au-root *) ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n}\nsummary:where(.au-root, .au-root *) {\n display: list-item;\n}\nblockquote:where(.au-root, .au-root *),\ndl:where(.au-root, .au-root *),\ndd:where(.au-root, .au-root *),\nh1:where(.au-root, .au-root *),\nh2:where(.au-root, .au-root *),\nh3:where(.au-root, .au-root *),\nh4:where(.au-root, .au-root *),\nh5:where(.au-root, .au-root *),\nh6:where(.au-root, .au-root *),\nhr:where(.au-root, .au-root *),\nfigure:where(.au-root, .au-root *),\np:where(.au-root, .au-root *),\npre:where(.au-root, .au-root *) {\n margin: 0;\n}\nfieldset:where(.au-root, .au-root *) {\n margin: 0;\n padding: 0;\n}\nlegend:where(.au-root, .au-root *) {\n padding: 0;\n}\nol:where(.au-root, .au-root *),\nul:where(.au-root, .au-root *),\nmenu:where(.au-root, .au-root *) {\n list-style: none;\n margin: 0;\n padding: 0;\n}\ndialog:where(.au-root, .au-root *) {\n padding: 0;\n}\ntextarea:where(.au-root, .au-root *) {\n resize: vertical;\n}\n:where(.au-root, .au-root *) input::-moz-placeholder,\n:where(.au-root, .au-root *) textarea::-moz-placeholder {\n opacity: 1;\n color: #9ca3af;\n}\n:where(.au-root, .au-root *) input::placeholder,\n:where(.au-root, .au-root *) textarea::placeholder {\n opacity: 1;\n color: #9ca3af;\n}\nbutton:where(.au-root, .au-root *),\n[role=button]:where(.au-root, .au-root *) {\n cursor: pointer;\n}\n:disabled:where(.au-root, .au-root *) {\n cursor: default;\n}\nimg:where(.au-root, .au-root *),\nsvg:where(.au-root, .au-root *),\nvideo:where(.au-root, .au-root *),\ncanvas:where(.au-root, .au-root *),\naudio:where(.au-root, .au-root *),\niframe:where(.au-root, .au-root *),\nembed:where(.au-root, .au-root *),\nobject:where(.au-root, .au-root *) {\n display: block;\n vertical-align: middle;\n}\nimg:where(.au-root, .au-root *),\nvideo:where(.au-root, .au-root *) {\n max-width: 100%;\n height: auto;\n}\n[hidden]:where(.au-root, .au-root *) {\n display: none;\n}\n.au-root *,\n.au-root ::before,\n.au-root ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.au-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n.au-pointer-events-none {\n pointer-events: none;\n}\n.au-fixed {\n position: fixed;\n}\n.au-absolute {\n position: absolute;\n}\n.au-relative {\n position: relative;\n}\n.au-inset-0 {\n inset: 0px;\n}\n.au-left-\\[50\\%\\] {\n left: 50%;\n}\n.au-right-4 {\n right: 1rem;\n}\n.au-right-\\[-1px\\] {\n right: -1px;\n}\n.au-top-4 {\n top: 1rem;\n}\n.au-top-\\[-1px\\] {\n top: -1px;\n}\n.au-top-\\[50\\%\\] {\n top: 50%;\n}\n.au-z-50 {\n z-index: 50;\n}\n.au-my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.au-mb-1 {\n margin-bottom: 0.25rem;\n}\n.au-mb-2 {\n margin-bottom: 0.5rem;\n}\n.au-mb-4 {\n margin-bottom: 1rem;\n}\n.au-mb-6 {\n margin-bottom: 1.5rem;\n}\n.au-mb-8 {\n margin-bottom: 2rem;\n}\n.au-mr-2 {\n margin-right: 0.5rem;\n}\n.au-mt-0 {\n margin-top: 0px;\n}\n.au-mt-0\\.5 {\n margin-top: 0.125rem;\n}\n.au-mt-1 {\n margin-top: 0.25rem;\n}\n.au-mt-2 {\n margin-top: 0.5rem;\n}\n.au-mt-4 {\n margin-top: 1rem;\n}\n.au-line-clamp-2 {\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n}\n.au-block {\n display: block;\n}\n.au-flex {\n display: flex;\n}\n.au-inline-flex {\n display: inline-flex;\n}\n.au-grid {\n display: grid;\n}\n.au-size-4 {\n width: 1rem;\n height: 1rem;\n}\n.\\!au-h-3 {\n height: 0.75rem !important;\n}\n.au-h-10 {\n height: 2.5rem;\n}\n.au-h-16 {\n height: 4rem;\n}\n.au-h-4 {\n height: 1rem;\n}\n.au-h-5 {\n height: 1.25rem;\n}\n.au-h-6 {\n height: 1.5rem;\n}\n.au-h-7 {\n height: 1.75rem;\n}\n.au-h-8 {\n height: 2rem;\n}\n.au-h-9 {\n height: 2.25rem;\n}\n.au-h-full {\n height: 100%;\n}\n.au-w-4 {\n width: 1rem;\n}\n.au-w-6 {\n width: 1.5rem;\n}\n.au-w-8 {\n width: 2rem;\n}\n.au-w-9 {\n width: 2.25rem;\n}\n.au-w-full {\n width: 100%;\n}\n.au-min-w-16 {\n min-width: 4rem;\n}\n.au-min-w-20 {\n min-width: 5rem;\n}\n.au-max-w-lg {\n max-width: 32rem;\n}\n.au-max-w-xl {\n max-width: 36rem;\n}\n.au-flex-1 {\n flex: 1 1 0%;\n}\n.au-flex-shrink-0 {\n flex-shrink: 0;\n}\n.au-shrink-0 {\n flex-shrink: 0;\n}\n.au-flex-grow {\n flex-grow: 1;\n}\n.au--translate-y-12 {\n --tw-translate-y: -3rem;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.au--translate-y-6 {\n --tw-translate-y: -1.5rem;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.au-translate-x-\\[-50\\%\\] {\n --tw-translate-x: -50%;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.au-translate-y-0 {\n --tw-translate-y: 0px;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.au-translate-y-6 {\n --tw-translate-y: 1.5rem;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.au-translate-y-\\[-50\\%\\] {\n --tw-translate-y: -50%;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.au-translate-y-\\[130\\%\\] {\n --tw-translate-y: 130%;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n@keyframes au-spin {\n to {\n transform: rotate(360deg);\n }\n}\n.au-animate-spin {\n animation: au-spin 1s linear infinite;\n}\n.au-cursor-pointer {\n cursor: pointer;\n}\n.au-grid-cols-1 {\n grid-template-columns: repeat(1, minmax(0, 1fr));\n}\n.au-grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.au-flex-row {\n flex-direction: row;\n}\n.au-flex-col {\n flex-direction: column;\n}\n.au-flex-col-reverse {\n flex-direction: column-reverse;\n}\n.au-items-start {\n align-items: flex-start;\n}\n.au-items-center {\n align-items: center;\n}\n.au-justify-end {\n justify-content: flex-end;\n}\n.au-justify-center {\n justify-content: center;\n}\n.au-justify-between {\n justify-content: space-between;\n}\n.au-gap-0 {\n gap: 0px;\n}\n.au-gap-1 {\n gap: 0.25rem;\n}\n.au-gap-2 {\n gap: 0.5rem;\n}\n.au-gap-4 {\n gap: 1rem;\n}\n.au-gap-x-4 {\n -moz-column-gap: 1rem;\n column-gap: 1rem;\n}\n.au-space-x-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.5rem * var(--tw-space-x-reverse));\n margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));\n}\n.au-space-y-1 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.25rem * var(--tw-space-y-reverse));\n}\n.au-space-y-1\\.5 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.375rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.375rem * var(--tw-space-y-reverse));\n}\n.au-space-y-3 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));\n}\n.au-overflow-hidden {\n overflow: hidden;\n}\n.au-truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.au-whitespace-nowrap {\n white-space: nowrap;\n}\n.au-rounded-full {\n border-radius: 9999px;\n}\n.au-rounded-lg {\n border-radius: var(--au-radius);\n}\n.au-rounded-md {\n border-radius: calc(var(--au-radius) - 2px);\n}\n.au-rounded-sm {\n border-radius: calc(var(--au-radius) - 4px);\n}\n.au-rounded-bl-lg {\n border-bottom-left-radius: var(--au-radius);\n}\n.au-border {\n border-width: 1px;\n}\n.au-border-2 {\n border-width: 2px;\n}\n.au-border-y {\n border-top-width: 1px;\n border-bottom-width: 1px;\n}\n.au-border-t {\n border-top-width: 1px;\n}\n.au-border-input {\n border-color: hsl(var(--au-input));\n}\n.au-border-transparent {\n border-color: transparent;\n}\n.au-bg-background {\n background-color: hsl(var(--au-background));\n}\n.au-bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n.au-bg-black\\/80 {\n background-color: rgb(0 0 0 / 0.8);\n}\n.au-bg-destructive {\n background-color: hsl(var(--au-destructive));\n}\n.au-bg-primary {\n background-color: hsl(var(--au-primary));\n}\n.au-bg-secondary {\n background-color: hsl(var(--au-secondary));\n}\n.au-bg-secondary\\/40 {\n background-color: hsl(var(--au-secondary) / 0.4);\n}\n.au-p-0 {\n padding: 0px;\n}\n.au-p-6 {\n padding: 1.5rem;\n}\n.\\!au-py-10 {\n padding-top: 2.5rem !important;\n padding-bottom: 2.5rem !important;\n}\n.au-px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.au-px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.au-px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.au-px-8 {\n padding-left: 2rem;\n padding-right: 2rem;\n}\n.au-py-0 {\n padding-top: 0px;\n padding-bottom: 0px;\n}\n.au-py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.au-py-3 {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n}\n.au-py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.au-pb-0 {\n padding-bottom: 0px;\n}\n.au-pb-0\\.5 {\n padding-bottom: 0.125rem;\n}\n.au-pb-4 {\n padding-bottom: 1rem;\n}\n.au-pl-6 {\n padding-left: 1.5rem;\n}\n.au-pr-3 {\n padding-right: 0.75rem;\n}\n.au-pt-4 {\n padding-top: 1rem;\n}\n.au-text-left {\n text-align: left;\n}\n.au-text-center {\n text-align: center;\n}\n.au-text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.au-text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.au-text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.au-text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.au-text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.au-font-bold {\n font-weight: 700;\n}\n.au-font-medium {\n font-weight: 500;\n}\n.au-font-normal {\n font-weight: 400;\n}\n.au-font-semibold {\n font-weight: 600;\n}\n.au-leading-none {\n line-height: 1;\n}\n.au-tracking-tight {\n letter-spacing: -0.025em;\n}\n.au-text-destructive-foreground {\n color: hsl(var(--au-destructive-foreground));\n}\n.au-text-foreground {\n color: hsl(var(--au-foreground));\n}\n.au-text-muted-foreground {\n color: hsl(var(--au-muted-foreground));\n}\n.au-text-primary {\n color: hsl(var(--au-primary));\n}\n.au-text-primary-foreground {\n color: hsl(var(--au-primary-foreground));\n}\n.au-text-secondary-foreground {\n color: hsl(var(--au-secondary-foreground));\n}\n.au-text-zinc-400 {\n --tw-text-opacity: 1;\n color: rgb(161 161 170 / var(--tw-text-opacity));\n}\n.au-underline-offset-4 {\n text-underline-offset: 4px;\n}\n.au-opacity-70 {\n opacity: 0.7;\n}\n.au-shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow:\n var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000),\n var(--tw-shadow);\n}\n.au-shadow-inner {\n --tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);\n --tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);\n box-shadow:\n var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000),\n var(--tw-shadow);\n}\n.au-shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow:\n var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000),\n var(--tw-shadow);\n}\n.au-shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);\n box-shadow:\n var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000),\n var(--tw-shadow);\n}\n.au-shadow-stone-400 {\n --tw-shadow-color: #a8a29e;\n --tw-shadow: var(--tw-shadow-colored);\n}\n.au-shadow-zinc-800 {\n --tw-shadow-color: #27272a;\n --tw-shadow: var(--tw-shadow-colored);\n}\n.au-ring-0 {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow:\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow, 0 0 #0000);\n}\n.au-ring-offset-background {\n --tw-ring-offset-color: hsl(var(--au-background));\n}\n.au-transition {\n transition-property:\n color,\n background-color,\n border-color,\n text-decoration-color,\n fill,\n stroke,\n opacity,\n box-shadow,\n transform,\n filter,\n -webkit-backdrop-filter;\n transition-property:\n color,\n background-color,\n border-color,\n text-decoration-color,\n fill,\n stroke,\n opacity,\n box-shadow,\n transform,\n filter,\n backdrop-filter;\n transition-property:\n color,\n background-color,\n border-color,\n text-decoration-color,\n fill,\n stroke,\n opacity,\n box-shadow,\n transform,\n filter,\n backdrop-filter,\n -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.au-transition-all {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.au-transition-colors {\n transition-property:\n color,\n background-color,\n border-color,\n text-decoration-color,\n fill,\n stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.au-transition-opacity {\n transition-property: opacity;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.au-transition-transform {\n transition-property: transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.au-duration-200 {\n transition-duration: 200ms;\n}\n.au-duration-300 {\n transition-duration: 300ms;\n}\n@keyframes enter {\n from {\n opacity: var(--tw-enter-opacity, 1);\n transform: translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0));\n }\n}\n@keyframes exit {\n to {\n opacity: var(--tw-exit-opacity, 1);\n transform: translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0));\n }\n}\n.au-slide-in-from-left-1 {\n --tw-enter-translate-x: -0.25rem;\n}\n.au-slide-out-to-left-1 {\n --tw-exit-translate-x: -0.25rem;\n}\n.au-duration-200 {\n animation-duration: 200ms;\n}\n.au-duration-300 {\n animation-duration: 300ms;\n}\n:root {\n --au-background: 0 0% 100%;\n --au-foreground: 240 10% 3.9%;\n --au-card: 0 0% 100%;\n --au-card-foreground: 240 10% 3.9%;\n --au-popover: 0 0% 100%;\n --au-popover-foreground: 240 10% 3.9%;\n --au-primary: 240 5.9% 10%;\n --au-primary-foreground: 0 0% 98%;\n --au-secondary: 240 4.8% 95.9%;\n --au-secondary-foreground: 240 5.9% 10%;\n --au-muted: 240 4.8% 95.9%;\n --au-muted-foreground: 240 3.8% 46.1%;\n --au-accent: 240 4.8% 95.9%;\n --au-accent-foreground: 240 5.9% 10%;\n --au-destructive: 0 84.2% 60.2%;\n --au-destructive-foreground: 0 0% 98%;\n --au-border: 240 5.9% 90%;\n --au-input: 240 5.9% 90%;\n --au-ring: 240 10% 3.9%;\n --au-chart-1: 12 76% 61%;\n --au-chart-2: 173 58% 39%;\n --au-chart-3: 197 37% 24%;\n --au-chart-4: 43 74% 66%;\n --au-chart-5: 27 87% 67%;\n --au-radius: 0.5rem;\n --au-sidebar-background: 0 0% 98%;\n --au-sidebar-foreground: 240 5.3% 26.1%;\n --au-sidebar-primary: 240 5.9% 10%;\n --au-sidebar-primary-foreground: 0 0% 98%;\n --au-sidebar-accent: 240 4.8% 95.9%;\n --au-sidebar-accent-foreground: 240 5.9% 10%;\n --au-sidebar-border: 220 13% 91%;\n --au-sidebar-ring: 217.2 91.2% 59.8%;\n}\n.dark {\n --au-background: 240 10% 3.9%;\n --au-foreground: 0 0% 98%;\n --au-card: 240 10% 3.9%;\n --au-card-foreground: 0 0% 98%;\n --au-popover: 240 10% 3.9%;\n --au-popover-foreground: 0 0% 98%;\n --au-primary: 0 0% 98%;\n --au-primary-foreground: 240 5.9% 10%;\n --au-secondary: 240 3.7% 15.9%;\n --au-secondary-foreground: 0 0% 98%;\n --au-muted: 240 3.7% 15.9%;\n --au-muted-foreground: 240 5% 64.9%;\n --au-accent: 240 3.7% 15.9%;\n --au-accent-foreground: 0 0% 98%;\n --au-destructive: 0 62.8% 30.6%;\n --au-destructive-foreground: 0 0% 98%;\n --au-border: 240 3.7% 15.9%;\n --au-input: 240 3.7% 15.9%;\n --au-ring: 240 4.9% 83.9%;\n --au-chart-1: 220 70% 50%;\n --au-chart-2: 160 60% 45%;\n --au-chart-3: 30 80% 55%;\n --au-chart-4: 280 65% 60%;\n --au-chart-5: 340 75% 55%;\n --au-sidebar-background: 240 5.9% 10%;\n --au-sidebar-foreground: 240 4.8% 95.9%;\n --au-sidebar-primary: 224.3 76.3% 48%;\n --au-sidebar-primary-foreground: 0 0% 100%;\n --au-sidebar-accent: 240 3.7% 15.9%;\n --au-sidebar-accent-foreground: 240 4.8% 95.9%;\n --au-sidebar-border: 240 3.7% 15.9%;\n --au-sidebar-ring: 217.2 91.2% 59.8%;\n}\n.hover\\:au-bg-accent:hover {\n background-color: hsl(var(--au-accent));\n}\n.hover\\:au-bg-destructive\\/90:hover {\n background-color: hsl(var(--au-destructive) / 0.9);\n}\n.hover\\:au-bg-primary\\/90:hover {\n background-color: hsl(var(--au-primary) / 0.9);\n}\n.hover\\:au-bg-secondary\\/80:hover {\n background-color: hsl(var(--au-secondary) / 0.8);\n}\n.hover\\:au-text-accent-foreground:hover {\n color: hsl(var(--au-accent-foreground));\n}\n.hover\\:au-underline:hover {\n text-decoration-line: underline;\n}\n.hover\\:au-opacity-100:hover {\n opacity: 1;\n}\n.hover\\:au-brightness-90:hover {\n --tw-brightness: brightness(.9);\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.focus\\:au-outline-none:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n.focus\\:au-ring-2:focus {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow:\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow, 0 0 #0000);\n}\n.focus\\:au-ring-ring:focus {\n --tw-ring-color: hsl(var(--au-ring));\n}\n.focus\\:au-ring-offset-2:focus {\n --tw-ring-offset-width: 2px;\n}\n.focus-visible\\:au-outline-none:focus-visible {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n.focus-visible\\:au-ring-1:focus-visible {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow:\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow, 0 0 #0000);\n}\n.focus-visible\\:au-ring-2:focus-visible {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow:\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow, 0 0 #0000);\n}\n.focus-visible\\:au-ring-ring:focus-visible {\n --tw-ring-color: hsl(var(--au-ring));\n}\n.focus-visible\\:au-ring-offset-2:focus-visible {\n --tw-ring-offset-width: 2px;\n}\n.focus-visible\\:au-ring-offset-background:focus-visible {\n --tw-ring-offset-color: hsl(var(--au-background));\n}\n.disabled\\:au-pointer-events-none:disabled {\n pointer-events: none;\n}\n.disabled\\:au-opacity-50:disabled {\n opacity: 0.5;\n}\n.au-group:hover .group-hover\\:au-mt-0 {\n margin-top: 0px;\n}\n.au-group:hover .group-hover\\:au-translate-y-0 {\n --tw-translate-y: 0px;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.au-group:hover .group-hover\\:au-translate-y-\\[-130\\%\\] {\n --tw-translate-y: -130%;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.data-\\[state\\=checked\\]\\:au-translate-x-4[data-state=checked] {\n --tw-translate-x: 1rem;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.data-\\[state\\=unchecked\\]\\:au-translate-x-0[data-state=unchecked] {\n --tw-translate-x: 0px;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.data-\\[state\\=checked\\]\\:au-bg-primary[data-state=checked] {\n background-color: hsl(var(--au-primary));\n}\n.data-\\[state\\=open\\]\\:au-bg-accent[data-state=open] {\n background-color: hsl(var(--au-accent));\n}\n.data-\\[state\\=unchecked\\]\\:au-bg-input[data-state=unchecked] {\n background-color: hsl(var(--au-input));\n}\n.data-\\[state\\=open\\]\\:au-text-muted-foreground[data-state=open] {\n color: hsl(var(--au-muted-foreground));\n}\n.data-\\[state\\=open\\]\\:au-animate-in[data-state=open] {\n animation-name: enter;\n animation-duration: 150ms;\n --tw-enter-opacity: initial;\n --tw-enter-scale: initial;\n --tw-enter-rotate: initial;\n --tw-enter-translate-x: initial;\n --tw-enter-translate-y: initial;\n}\n.data-\\[state\\=closed\\]\\:au-animate-out[data-state=closed] {\n animation-name: exit;\n animation-duration: 150ms;\n --tw-exit-opacity: initial;\n --tw-exit-scale: initial;\n --tw-exit-rotate: initial;\n --tw-exit-translate-x: initial;\n --tw-exit-translate-y: initial;\n}\n.data-\\[state\\=closed\\]\\:au-fade-out-0[data-state=closed] {\n --tw-exit-opacity: 0;\n}\n.data-\\[state\\=open\\]\\:au-fade-in-0[data-state=open] {\n --tw-enter-opacity: 0;\n}\n.data-\\[state\\=closed\\]\\:au-zoom-out-95[data-state=closed] {\n --tw-exit-scale: .95;\n}\n.data-\\[state\\=open\\]\\:au-zoom-in-95[data-state=open] {\n --tw-enter-scale: .95;\n}\n.data-\\[state\\=closed\\]\\:au-slide-out-to-left-1\\/2[data-state=closed] {\n --tw-exit-translate-x: -50%;\n}\n.data-\\[state\\=closed\\]\\:au-slide-out-to-top-\\[48\\%\\][data-state=closed] {\n --tw-exit-translate-y: -48%;\n}\n.data-\\[state\\=open\\]\\:au-slide-in-from-left-1\\/2[data-state=open] {\n --tw-enter-translate-x: -50%;\n}\n.data-\\[state\\=open\\]\\:au-slide-in-from-top-\\[48\\%\\][data-state=open] {\n --tw-enter-translate-y: -48%;\n}\n:is(.au-dark .dark\\:au-shadow-zinc-800\\/80) {\n --tw-shadow-color: rgb(39 39 42 / 0.8);\n --tw-shadow: var(--tw-shadow-colored);\n}\n@media (min-width: 640px) {\n .sm\\:au-h-7 {\n height: 1.75rem;\n }\n .sm\\:au-grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n .sm\\:au-flex-row {\n flex-direction: row;\n }\n .sm\\:au-items-center {\n align-items: center;\n }\n .sm\\:au-justify-end {\n justify-content: flex-end;\n }\n .sm\\:au-gap-2 {\n gap: 0.5rem;\n }\n .sm\\:au-space-x-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.5rem * var(--tw-space-x-reverse));\n margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));\n }\n .sm\\:au-rounded-lg {\n border-radius: var(--au-radius);\n }\n .sm\\:au-pb-0 {\n padding-bottom: 0px;\n }\n .sm\\:au-text-left {\n text-align: left;\n }\n}\n@media (min-width: 1024px) {\n .lg\\:au-right-4 {\n right: 1rem;\n }\n .lg\\:au-top-4 {\n top: 1rem;\n }\n .lg\\:au-h-\\[calc\\(100\\%\\+48px\\)\\] {\n height: calc(100% + 48px);\n }\n .lg\\:au--translate-y-12 {\n --tw-translate-y: -3rem;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n }\n .lg\\:au--translate-y-6 {\n --tw-translate-y: -1.5rem;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n }\n .lg\\:au-translate-y-6 {\n --tw-translate-y: 1.5rem;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n }\n .lg\\:au-grid-cols-\\[repeat\\(auto-fit\\,minmax\\(200px\\,1fr\\)\\)\\] {\n grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n }\n .lg\\:au-rounded-full {\n border-radius: 9999px;\n }\n .lg\\:au-py-0 {\n padding-top: 0px;\n padding-bottom: 0px;\n }\n .lg\\:au-py-0\\.5 {\n padding-top: 0.125rem;\n padding-bottom: 0.125rem;\n }\n .lg\\:au-shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow:\n var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000),\n var(--tw-shadow);\n }\n}\n.\\[\\&_svg\\]\\:au-pointer-events-none svg {\n pointer-events: none;\n}\n.\\[\\&_svg\\]\\:au-size-4 svg {\n width: 1rem;\n height: 1rem;\n}\n.\\[\\&_svg\\]\\:au-shrink-0 svg {\n flex-shrink: 0;\n}\n');
27
27
 
28
28
  // src/libraries/react/BaseAutumnProvider.tsx
29
- import { useState as useState12 } from "react";
29
+ import { useState as useState2 } from "react";
30
30
 
31
31
  // src/libraries/react/hooks/useDialog.tsx
32
32
  import { useState, useEffect } from "react";
@@ -79,6 +79,12 @@ var handleAttach = async ({
79
79
  }) => {
80
80
  return instance.post("/attach", params);
81
81
  };
82
+ var handleSetupPayment = async ({
83
+ instance,
84
+ params
85
+ }) => {
86
+ return instance.post("/setup_payment", params);
87
+ };
82
88
  var handleCancel = async ({
83
89
  instance,
84
90
  params
@@ -445,6 +451,13 @@ var Autumn = class {
445
451
  params
446
452
  });
447
453
  }
454
+ static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
455
+ async setupPayment(params) {
456
+ return handleSetupPayment({
457
+ instance: this,
458
+ params
459
+ });
460
+ }
448
461
  static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
449
462
  async cancel(params) {
450
463
  return handleCancel({
@@ -585,6 +598,11 @@ async function attachMethod(params) {
585
598
  const res = await this.post("/api/autumn/attach", snakeParams);
586
599
  return res;
587
600
  }
601
+ async function setupPaymentMethod(params) {
602
+ let snakeParams = toSnakeCase(params, ["checkoutSessionParams"]);
603
+ const res = await this.post("/api/autumn/setup_payment", snakeParams);
604
+ return res;
605
+ }
588
606
  async function cancelMethod(params) {
589
607
  let snakeParams = toSnakeCase(params);
590
608
  const res = await this.post("/api/autumn/cancel", snakeParams);
@@ -723,6 +741,7 @@ var AutumnClient = class {
723
741
  check = checkMethod.bind(this);
724
742
  track = trackMethod.bind(this);
725
743
  openBillingPortal = openBillingPortalMethod.bind(this);
744
+ setupPayment = setupPaymentMethod.bind(this);
726
745
  entities = {
727
746
  create: createEntityMethod.bind(this),
728
747
  get: getEntityMethod.bind(this),
@@ -954,328 +973,798 @@ var usePricingTableBase = ({
954
973
  };
955
974
  };
956
975
 
957
- // src/libraries/react/components/attach-dialog/attach-dialog-synced.tsx
958
- import { useEffect as useEffect15, useState as useState11 } from "react";
959
-
960
- // ../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
961
- function r(e) {
962
- var t, f, n = "";
963
- if ("string" == typeof e || "number" == typeof e) n += e;
964
- else if ("object" == typeof e) if (Array.isArray(e)) {
965
- var o = e.length;
966
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
967
- } else for (f in e) e[f] && (n && (n += " "), n += f);
968
- return n;
969
- }
970
- function clsx() {
971
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
972
- return n;
973
- }
974
-
975
- // ../node_modules/.pnpm/tailwind-merge@2.6.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs
976
- var CLASS_PART_SEPARATOR = "-";
977
- var createClassGroupUtils = (config) => {
978
- const classMap = createClassMap(config);
979
- const {
980
- conflictingClassGroups,
981
- conflictingClassGroupModifiers
982
- } = config;
983
- const getClassGroupId = (className) => {
984
- const classParts = className.split(CLASS_PART_SEPARATOR);
985
- if (classParts[0] === "" && classParts.length !== 1) {
986
- classParts.shift();
976
+ // src/libraries/react/hooks/useAutumnBase.tsx
977
+ var useAutumnBase = ({
978
+ AutumnContext: AutumnContext2
979
+ }) => {
980
+ const context = useAutumnContext({ AutumnContext: AutumnContext2, name: "useAutumn" });
981
+ const { attachDialog, paywallDialog } = context;
982
+ const client = context.client;
983
+ const { refetch: refetchPricingTable } = usePricingTableBase({
984
+ AutumnContext: AutumnContext2
985
+ });
986
+ let {
987
+ open: attachOpen,
988
+ setProps: setAttachProps,
989
+ setOpen: setAttachOpen,
990
+ setComponent: setAttachComponent
991
+ } = attachDialog;
992
+ let {
993
+ setProps: setCheckProps,
994
+ setOpen: setCheckOpen,
995
+ setComponent: setPaywallComponent
996
+ } = paywallDialog;
997
+ const attachWithoutDialog = async (params) => {
998
+ const result = await client.attach(params);
999
+ if (result.error) {
1000
+ return result;
987
1001
  }
988
- return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
989
- };
990
- const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
991
- const conflicts = conflictingClassGroups[classGroupId] || [];
992
- if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
993
- return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
1002
+ let data = result.data;
1003
+ if (data?.checkout_url && typeof window !== "undefined") {
1004
+ if (params.openInNewTab) {
1005
+ window.open(data.checkout_url, "_blank");
1006
+ } else {
1007
+ window.location.href = data.checkout_url;
1008
+ }
994
1009
  }
995
- return conflicts;
1010
+ await refetchPricingTable();
1011
+ if (setAttachOpen) {
1012
+ setAttachOpen(false);
1013
+ }
1014
+ return result;
996
1015
  };
997
- return {
998
- getClassGroupId,
999
- getConflictingClassGroupIds
1016
+ const attachWithDialog = async (params) => {
1017
+ let { dialog, ...rest } = params;
1018
+ const { productId, entityId, entityData } = params;
1019
+ const checkRes = await client.check({
1020
+ productId,
1021
+ entityId,
1022
+ entityData,
1023
+ withPreview: true
1024
+ });
1025
+ if (checkRes.error) {
1026
+ return checkRes;
1027
+ }
1028
+ let preview = checkRes.data.preview;
1029
+ if (!preview) {
1030
+ return await attachWithoutDialog(rest);
1031
+ } else {
1032
+ setAttachProps({ preview, attachParams: rest });
1033
+ setAttachOpen(true);
1034
+ }
1035
+ return checkRes;
1000
1036
  };
1001
- };
1002
- var getGroupRecursive = (classParts, classPartObject) => {
1003
- if (classParts.length === 0) {
1004
- return classPartObject.classGroupId;
1005
- }
1006
- const currentClassPart = classParts[0];
1007
- const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
1008
- const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
1009
- if (classGroupFromNextClassPart) {
1010
- return classGroupFromNextClassPart;
1011
- }
1012
- if (classPartObject.validators.length === 0) {
1013
- return void 0;
1014
- }
1015
- const classRest = classParts.join(CLASS_PART_SEPARATOR);
1016
- return classPartObject.validators.find(({
1017
- validator
1018
- }) => validator(classRest))?.classGroupId;
1019
- };
1020
- var arbitraryPropertyRegex = /^\[(.+)\]$/;
1021
- var getGroupIdForArbitraryProperty = (className) => {
1022
- if (arbitraryPropertyRegex.test(className)) {
1023
- const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
1024
- const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(":"));
1025
- if (property) {
1026
- return "arbitrary.." + property;
1037
+ const attach = async (params) => {
1038
+ const { dialog, openInNewTab } = params;
1039
+ let finalDialog = dialog;
1040
+ if (finalDialog && !attachOpen) {
1041
+ setAttachComponent(finalDialog);
1042
+ return await attachWithDialog(params);
1027
1043
  }
1028
- }
1029
- };
1030
- var createClassMap = (config) => {
1031
- const {
1032
- theme,
1033
- prefix
1034
- } = config;
1035
- const classMap = {
1036
- nextPart: /* @__PURE__ */ new Map(),
1037
- validators: []
1044
+ return await attachWithoutDialog(params);
1038
1045
  };
1039
- const prefixedClassGroupEntries = getPrefixedClassGroupEntries(Object.entries(config.classGroups), prefix);
1040
- prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {
1041
- processClassesRecursively(classGroup, classMap, classGroupId, theme);
1042
- });
1043
- return classMap;
1044
- };
1045
- var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
1046
- classGroup.forEach((classDefinition) => {
1047
- if (typeof classDefinition === "string") {
1048
- const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
1049
- classPartObjectToEdit.classGroupId = classGroupId;
1050
- return;
1046
+ const cancel = async (params) => {
1047
+ const res = await client.cancel(params);
1048
+ if (res.error) {
1049
+ return res;
1051
1050
  }
1052
- if (typeof classDefinition === "function") {
1053
- if (isThemeGetter(classDefinition)) {
1054
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
1055
- return;
1056
- }
1057
- classPartObject.validators.push({
1058
- validator: classDefinition,
1059
- classGroupId
1060
- });
1061
- return;
1051
+ return res;
1052
+ };
1053
+ const check = async (params) => {
1054
+ let { dialog, withPreview } = params;
1055
+ if (dialog) {
1056
+ setPaywallComponent(dialog);
1062
1057
  }
1063
- Object.entries(classDefinition).forEach(([key, classGroup2]) => {
1064
- processClassesRecursively(classGroup2, getPart(classPartObject, key), classGroupId, theme);
1058
+ const res = await client.check({
1059
+ ...params,
1060
+ withPreview: withPreview || dialog ? true : false
1065
1061
  });
1066
- });
1067
- };
1068
- var getPart = (classPartObject, path) => {
1069
- let currentClassPartObject = classPartObject;
1070
- path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
1071
- if (!currentClassPartObject.nextPart.has(pathPart)) {
1072
- currentClassPartObject.nextPart.set(pathPart, {
1073
- nextPart: /* @__PURE__ */ new Map(),
1074
- validators: []
1075
- });
1062
+ if (res.error) {
1063
+ return res;
1076
1064
  }
1077
- currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
1078
- });
1079
- return currentClassPartObject;
1080
- };
1081
- var isThemeGetter = (func) => func.isThemeGetter;
1082
- var getPrefixedClassGroupEntries = (classGroupEntries, prefix) => {
1083
- if (!prefix) {
1084
- return classGroupEntries;
1085
- }
1086
- return classGroupEntries.map(([classGroupId, classGroup]) => {
1087
- const prefixedClassGroup = classGroup.map((classDefinition) => {
1088
- if (typeof classDefinition === "string") {
1089
- return prefix + classDefinition;
1090
- }
1091
- if (typeof classDefinition === "object") {
1092
- return Object.fromEntries(Object.entries(classDefinition).map(([key, value]) => [prefix + key, value]));
1093
- }
1094
- return classDefinition;
1095
- });
1096
- return [classGroupId, prefixedClassGroup];
1097
- });
1098
- };
1099
- var createLruCache = (maxCacheSize) => {
1100
- if (maxCacheSize < 1) {
1101
- return {
1102
- get: () => void 0,
1103
- set: () => {
1104
- }
1105
- };
1106
- }
1107
- let cacheSize = 0;
1108
- let cache = /* @__PURE__ */ new Map();
1109
- let previousCache = /* @__PURE__ */ new Map();
1110
- const update = (key, value) => {
1111
- cache.set(key, value);
1112
- cacheSize++;
1113
- if (cacheSize > maxCacheSize) {
1114
- cacheSize = 0;
1115
- previousCache = cache;
1116
- cache = /* @__PURE__ */ new Map();
1065
+ let data = res.data;
1066
+ if (data && data.preview && dialog) {
1067
+ let preview = data.preview;
1068
+ setCheckProps({ preview });
1069
+ setCheckOpen(true);
1117
1070
  }
1071
+ return res;
1118
1072
  };
1119
- return {
1120
- get(key) {
1121
- let value = cache.get(key);
1122
- if (value !== void 0) {
1123
- return value;
1124
- }
1125
- if ((value = previousCache.get(key)) !== void 0) {
1126
- update(key, value);
1127
- return value;
1128
- }
1129
- },
1130
- set(key, value) {
1131
- if (cache.has(key)) {
1132
- cache.set(key, value);
1073
+ const track = async (params) => {
1074
+ const res = await client.track(params);
1075
+ if (res.error) {
1076
+ return res;
1077
+ }
1078
+ return res;
1079
+ };
1080
+ const openBillingPortal = async (params) => {
1081
+ let defaultParams = {
1082
+ openInNewTab: false
1083
+ };
1084
+ let finalParams = {
1085
+ ...defaultParams,
1086
+ ...params
1087
+ };
1088
+ const res = await client.openBillingPortal(finalParams);
1089
+ if (res.error) {
1090
+ return res;
1091
+ }
1092
+ let data = res.data;
1093
+ if (data?.url && typeof window !== "undefined") {
1094
+ if (finalParams.openInNewTab) {
1095
+ window.open(data.url, "_blank");
1133
1096
  } else {
1134
- update(key, value);
1097
+ window.open(data.url, "_self");
1135
1098
  }
1099
+ return res;
1100
+ } else {
1101
+ return res;
1136
1102
  }
1137
1103
  };
1138
- };
1139
- var IMPORTANT_MODIFIER = "!";
1140
- var createParseClassName = (config) => {
1141
- const {
1142
- separator,
1143
- experimentalParseClassName
1144
- } = config;
1145
- const isSeparatorSingleCharacter = separator.length === 1;
1146
- const firstSeparatorCharacter = separator[0];
1147
- const separatorLength = separator.length;
1148
- const parseClassName = (className) => {
1149
- const modifiers = [];
1150
- let bracketDepth = 0;
1151
- let modifierStart = 0;
1152
- let postfixModifierPosition;
1153
- for (let index = 0; index < className.length; index++) {
1154
- let currentCharacter = className[index];
1155
- if (bracketDepth === 0) {
1156
- if (currentCharacter === firstSeparatorCharacter && (isSeparatorSingleCharacter || className.slice(index, index + separatorLength) === separator)) {
1157
- modifiers.push(className.slice(modifierStart, index));
1158
- modifierStart = index + separatorLength;
1159
- continue;
1160
- }
1161
- if (currentCharacter === "/") {
1162
- postfixModifierPosition = index;
1163
- continue;
1164
- }
1165
- }
1166
- if (currentCharacter === "[") {
1167
- bracketDepth++;
1168
- } else if (currentCharacter === "]") {
1169
- bracketDepth--;
1104
+ const setupPayment = async (params) => {
1105
+ let defaultParams = {
1106
+ openInNewTab: false
1107
+ };
1108
+ let finalParams = {
1109
+ ...defaultParams,
1110
+ ...params || {}
1111
+ };
1112
+ const res = await client.setupPayment(finalParams);
1113
+ if (res.data?.url && typeof window !== "undefined") {
1114
+ if (finalParams.openInNewTab) {
1115
+ window.open(res.data.url, "_blank");
1116
+ } else {
1117
+ window.open(res.data.url, "_self");
1170
1118
  }
1119
+ return res;
1120
+ } else {
1121
+ return res;
1171
1122
  }
1172
- const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
1173
- const hasImportantModifier = baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER);
1174
- const baseClassName = hasImportantModifier ? baseClassNameWithImportantModifier.substring(1) : baseClassNameWithImportantModifier;
1175
- const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
1123
+ };
1124
+ return {
1125
+ attach,
1126
+ check,
1127
+ track,
1128
+ cancel,
1129
+ openBillingPortal,
1130
+ setupPayment
1131
+ };
1132
+ };
1133
+
1134
+ // src/libraries/react/hooks/handleAllowed.ts
1135
+ var getCusFeature = ({
1136
+ customer,
1137
+ featureId,
1138
+ requiredBalance = 1
1139
+ }) => {
1140
+ let creditSchema = Object.values(customer.features).find((f) => f.credit_schema && f.credit_schema.some((c) => c.feature_id === featureId));
1141
+ if (creditSchema) {
1142
+ let schemaItem = creditSchema.credit_schema?.find((c) => c.feature_id === featureId);
1176
1143
  return {
1177
- modifiers,
1178
- hasImportantModifier,
1179
- baseClassName,
1180
- maybePostfixModifierPosition
1144
+ feature: creditSchema,
1145
+ requiredBalance: schemaItem.credit_amount * requiredBalance
1181
1146
  };
1182
- };
1183
- if (experimentalParseClassName) {
1184
- return (className) => experimentalParseClassName({
1185
- className,
1186
- parseClassName
1187
- });
1188
1147
  }
1189
- return parseClassName;
1148
+ return {
1149
+ cusFeature: customer.features[featureId],
1150
+ requiredBalance
1151
+ };
1190
1152
  };
1191
- var sortModifiers = (modifiers) => {
1192
- if (modifiers.length <= 1) {
1193
- return modifiers;
1153
+ var handleFeatureAllowed = ({ customer, params }) => {
1154
+ let { cusFeature, requiredBalance } = getCusFeature({ customer, featureId: params.featureId });
1155
+ if (!cusFeature) return false;
1156
+ if (cusFeature.type == "static") return true;
1157
+ if (cusFeature.unlimited || cusFeature.overage_allowed) return true;
1158
+ return (cusFeature.balance || 0) >= requiredBalance;
1159
+ };
1160
+ var handleAllowed = ({ customer, params }) => {
1161
+ if (!customer) return false;
1162
+ if (!params.featureId && !params.productId) {
1163
+ throw new Error("allowed() requires either featureId or productId");
1194
1164
  }
1195
- const sortedModifiers = [];
1196
- let unsortedModifiers = [];
1197
- modifiers.forEach((modifier) => {
1198
- const isArbitraryVariant = modifier[0] === "[";
1199
- if (isArbitraryVariant) {
1200
- sortedModifiers.push(...unsortedModifiers.sort(), modifier);
1201
- unsortedModifiers = [];
1202
- } else {
1203
- unsortedModifiers.push(modifier);
1204
- }
1205
- });
1206
- sortedModifiers.push(...unsortedModifiers.sort());
1207
- return sortedModifiers;
1165
+ if (params.featureId) {
1166
+ return handleFeatureAllowed({ customer, params });
1167
+ }
1168
+ if (params.productId) {
1169
+ let product = customer.products.find((p) => p.id == params.productId);
1170
+ if (!product) return false;
1171
+ let status = product.status;
1172
+ if (status == "scheduled") return false;
1173
+ return true;
1174
+ }
1175
+ return false;
1208
1176
  };
1209
- var createConfigUtils = (config) => ({
1210
- cache: createLruCache(config.cacheSize),
1211
- parseClassName: createParseClassName(config),
1212
- ...createClassGroupUtils(config)
1213
- });
1214
- var SPLIT_CLASSES_REGEX = /\s+/;
1215
- var mergeClassList = (classList, configUtils) => {
1216
- const {
1217
- parseClassName,
1218
- getClassGroupId,
1219
- getConflictingClassGroupIds
1220
- } = configUtils;
1221
- const classGroupsInConflict = [];
1222
- const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
1223
- let result = "";
1224
- for (let index = classNames.length - 1; index >= 0; index -= 1) {
1225
- const originalClassName = classNames[index];
1226
- const {
1227
- modifiers,
1228
- hasImportantModifier,
1229
- baseClassName,
1230
- maybePostfixModifierPosition
1231
- } = parseClassName(originalClassName);
1232
- let hasPostfixModifier = Boolean(maybePostfixModifierPosition);
1233
- let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
1234
- if (!classGroupId) {
1235
- if (!hasPostfixModifier) {
1236
- result = originalClassName + (result.length > 0 ? " " + result : result);
1237
- continue;
1238
- }
1239
- classGroupId = getClassGroupId(baseClassName);
1240
- if (!classGroupId) {
1241
- result = originalClassName + (result.length > 0 ? " " + result : result);
1242
- continue;
1243
- }
1244
- hasPostfixModifier = false;
1245
- }
1246
- const variantModifier = sortModifiers(modifiers).join(":");
1247
- const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
1248
- const classId = modifierId + classGroupId;
1249
- if (classGroupsInConflict.includes(classId)) {
1250
- continue;
1177
+
1178
+ // src/libraries/react/hooks/useCustomerBase.tsx
1179
+ var emptyDefaultFunctions = {
1180
+ attach: "",
1181
+ check: "",
1182
+ track: "",
1183
+ cancel: "",
1184
+ openBillingPortal: "",
1185
+ setupPayment: ""
1186
+ };
1187
+ var useCustomerBase = ({
1188
+ params,
1189
+ AutumnContext: AutumnContext2,
1190
+ client
1191
+ }) => {
1192
+ const queryKey = ["customer", params?.expand];
1193
+ let context;
1194
+ if (AutumnContext2) {
1195
+ context = useAutumnContext({ AutumnContext: AutumnContext2, name: "useCustomer" });
1196
+ }
1197
+ if (!client) {
1198
+ client = context.client;
1199
+ }
1200
+ const fetchCustomer = async () => {
1201
+ const { data, error: error2 } = await client.createCustomer({
1202
+ errorOnNotFound: params?.errorOnNotFound,
1203
+ expand: params?.expand
1204
+ });
1205
+ if (error2) {
1206
+ throw error2;
1251
1207
  }
1252
- classGroupsInConflict.push(classId);
1253
- const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
1254
- for (let i = 0; i < conflictGroups.length; ++i) {
1255
- const group = conflictGroups[i];
1256
- classGroupsInConflict.push(modifierId + group);
1208
+ if (!data) {
1209
+ return null;
1257
1210
  }
1258
- result = originalClassName + (result.length > 0 ? " " + result : result);
1259
- }
1260
- return result;
1261
- };
1262
- function twJoin() {
1263
- let index = 0;
1264
- let argument;
1265
- let resolvedValue;
1266
- let string = "";
1267
- while (index < arguments.length) {
1268
- if (argument = arguments[index++]) {
1269
- if (resolvedValue = toValue(argument)) {
1270
- string && (string += " ");
1271
- string += resolvedValue;
1211
+ return data;
1212
+ };
1213
+ const { data: customer, error, isLoading, mutate } = useSWR2(queryKey, fetchCustomer, {
1214
+ fallbackData: null,
1215
+ onErrorRetry: (error2, key, config) => {
1216
+ if (error2.code == "entity_not_found") {
1217
+ return false;
1272
1218
  }
1219
+ return true;
1273
1220
  }
1221
+ });
1222
+ let autumnFunctions = emptyDefaultFunctions;
1223
+ if (AutumnContext2) {
1224
+ autumnFunctions = useAutumnBase({ AutumnContext: AutumnContext2 });
1274
1225
  }
1275
- return string;
1276
- }
1277
- var toValue = (mix) => {
1278
- if (typeof mix === "string") {
1226
+ return {
1227
+ customer: error ? null : customer,
1228
+ isLoading,
1229
+ error,
1230
+ refetch: mutate,
1231
+ ...autumnFunctions,
1232
+ createEntity: client.entities.create,
1233
+ createReferralCode: client.referrals.createCode,
1234
+ redeemReferralCode: client.referrals.redeemCode,
1235
+ allowed: (params2) => handleAllowed({ customer, params: params2 })
1236
+ };
1237
+ };
1238
+
1239
+ // src/libraries/react/BaseAutumnProvider.tsx
1240
+ import { jsx, jsxs } from "react/jsx-runtime";
1241
+ function BaseAutumnProvider({
1242
+ client,
1243
+ children,
1244
+ AutumnContext: AutumnContext2,
1245
+ disableDialogs = false
1246
+ }) {
1247
+ const [components, setComponents] = useState2({});
1248
+ const [paywallProps, setPaywallProps, paywallOpen, setPaywallOpen] = useDialog(components.paywallDialog);
1249
+ const [
1250
+ productChangeProps,
1251
+ setProductChangeProps,
1252
+ productChangeOpen,
1253
+ setProductChangeOpen
1254
+ ] = useDialog(components.productChangeDialog);
1255
+ useCustomerBase({ client, params: { errorOnNotFound: false } });
1256
+ return /* @__PURE__ */ jsxs(
1257
+ AutumnContext2.Provider,
1258
+ {
1259
+ value: {
1260
+ initialized: true,
1261
+ client,
1262
+ disableDialogs,
1263
+ paywallDialog: {
1264
+ props: paywallProps,
1265
+ setProps: setPaywallProps,
1266
+ open: paywallOpen,
1267
+ setOpen: setPaywallOpen,
1268
+ setComponent: (component) => {
1269
+ setComponents({
1270
+ ...components,
1271
+ paywallDialog: component
1272
+ });
1273
+ }
1274
+ },
1275
+ attachDialog: {
1276
+ props: productChangeProps,
1277
+ setProps: setProductChangeProps,
1278
+ open: productChangeOpen,
1279
+ setOpen: setProductChangeOpen,
1280
+ setComponent: (component) => {
1281
+ setComponents({
1282
+ ...components,
1283
+ productChangeDialog: component
1284
+ });
1285
+ }
1286
+ }
1287
+ },
1288
+ children: [
1289
+ components.paywallDialog && /* @__PURE__ */ jsx(
1290
+ components.paywallDialog,
1291
+ {
1292
+ open: paywallOpen,
1293
+ setOpen: setPaywallOpen,
1294
+ ...paywallProps
1295
+ }
1296
+ ),
1297
+ components.productChangeDialog && /* @__PURE__ */ jsx(
1298
+ components.productChangeDialog,
1299
+ {
1300
+ open: productChangeOpen,
1301
+ setOpen: setProductChangeOpen,
1302
+ ...productChangeProps
1303
+ }
1304
+ ),
1305
+ children
1306
+ ]
1307
+ }
1308
+ );
1309
+ }
1310
+
1311
+ // src/libraries/react/ReactAutumnProvider.tsx
1312
+ import { useEffect as useEffect3 } from "react";
1313
+ import { jsx as jsx2 } from "react/jsx-runtime";
1314
+ var ReactAutumnProvider = ({
1315
+ children,
1316
+ getBearerToken,
1317
+ backendUrl,
1318
+ customerData,
1319
+ includeCredentials = true,
1320
+ disableDialogs = false,
1321
+ authClient
1322
+ }) => {
1323
+ if (backendUrl && !backendUrl.startsWith("http")) {
1324
+ console.warn(`backendUrl is not a valid URL: ${backendUrl}`);
1325
+ }
1326
+ let client = new AutumnClient({
1327
+ backendUrl: backendUrl || "",
1328
+ getBearerToken,
1329
+ customerData,
1330
+ includeCredentials
1331
+ });
1332
+ const analyseAuthClient = async () => {
1333
+ console.log("Auth client:", authClient);
1334
+ };
1335
+ useEffect3(() => {
1336
+ analyseAuthClient();
1337
+ }, [authClient]);
1338
+ return /* @__PURE__ */ jsx2(
1339
+ BaseAutumnProvider,
1340
+ {
1341
+ client,
1342
+ AutumnContext,
1343
+ disableDialogs,
1344
+ children
1345
+ }
1346
+ );
1347
+ };
1348
+
1349
+ // src/libraries/react/hooks/useCustomer.tsx
1350
+ var useCustomer = (params) => {
1351
+ return useCustomerBase({
1352
+ params,
1353
+ AutumnContext
1354
+ });
1355
+ };
1356
+
1357
+ // src/libraries/react/hooks/usePricingTable.tsx
1358
+ var usePricingTable = (params) => {
1359
+ return usePricingTableBase({
1360
+ AutumnContext,
1361
+ params
1362
+ });
1363
+ };
1364
+
1365
+ // src/libraries/react/hooks/useEntityBase.tsx
1366
+ import useSWR3 from "swr";
1367
+ import { useContext as useContext2 } from "react";
1368
+ var useEntityBase = ({
1369
+ entityId,
1370
+ params,
1371
+ AutumnContext: AutumnContext2
1372
+ }) => {
1373
+ const { client } = useContext2(AutumnContext2);
1374
+ const queryKey = ["entity", entityId, params?.expand];
1375
+ const fetchEntity = async () => {
1376
+ if (!entityId) {
1377
+ return null;
1378
+ }
1379
+ const { data: data2, error: error2 } = await client.entities.get(entityId, params);
1380
+ if (error2) {
1381
+ throw error2;
1382
+ }
1383
+ if (!data2) {
1384
+ return null;
1385
+ }
1386
+ return data2;
1387
+ };
1388
+ const { data, error, isLoading, mutate } = useSWR3(queryKey, fetchEntity, {
1389
+ fallbackData: null,
1390
+ onErrorRetry: (error2, key, config) => {
1391
+ if (error2.code == "entity_not_found") {
1392
+ return false;
1393
+ }
1394
+ return true;
1395
+ }
1396
+ });
1397
+ const {
1398
+ check: checkAutumn,
1399
+ attach: attachAutumn,
1400
+ cancel: cancelAutumn,
1401
+ track: trackAutumn
1402
+ } = useAutumnBase({
1403
+ AutumnContext: AutumnContext2
1404
+ });
1405
+ const allowed = (params2) => handleAllowed({ customer: data, params: params2 });
1406
+ const check = (params2) => checkAutumn({ ...params2, entityId: entityId || void 0 });
1407
+ const attach = (params2) => attachAutumn({ ...params2, entityId: entityId || void 0 });
1408
+ const cancel = (params2) => cancelAutumn({ ...params2, entityId: entityId || void 0 });
1409
+ const track = (params2) => trackAutumn({ ...params2, entityId: entityId || void 0 });
1410
+ if (!entityId) {
1411
+ return {
1412
+ entity: null,
1413
+ isLoading: false,
1414
+ error: null,
1415
+ refetch: mutate,
1416
+ allowed,
1417
+ check,
1418
+ attach,
1419
+ cancel,
1420
+ track
1421
+ };
1422
+ }
1423
+ return {
1424
+ entity: error ? null : data,
1425
+ isLoading,
1426
+ error,
1427
+ refetch: mutate,
1428
+ allowed,
1429
+ check,
1430
+ attach,
1431
+ cancel,
1432
+ track
1433
+ };
1434
+ };
1435
+
1436
+ // src/libraries/react/hooks/useEntity.tsx
1437
+ var useEntity = (entityId, params) => {
1438
+ return useEntityBase({ AutumnContext, entityId, params });
1439
+ };
1440
+
1441
+ // src/libraries/react/hooks/useAutumn.tsx
1442
+ var useAutumn = () => {
1443
+ return useAutumnBase({ AutumnContext });
1444
+ };
1445
+
1446
+ // src/libraries/react/components/attach-dialog/attach-dialog-synced.tsx
1447
+ import { useEffect as useEffect17, useState as useState12 } from "react";
1448
+
1449
+ // ../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
1450
+ function r(e) {
1451
+ var t, f, n = "";
1452
+ if ("string" == typeof e || "number" == typeof e) n += e;
1453
+ else if ("object" == typeof e) if (Array.isArray(e)) {
1454
+ var o = e.length;
1455
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
1456
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
1457
+ return n;
1458
+ }
1459
+ function clsx() {
1460
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
1461
+ return n;
1462
+ }
1463
+
1464
+ // ../node_modules/.pnpm/tailwind-merge@2.6.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs
1465
+ var CLASS_PART_SEPARATOR = "-";
1466
+ var createClassGroupUtils = (config) => {
1467
+ const classMap = createClassMap(config);
1468
+ const {
1469
+ conflictingClassGroups,
1470
+ conflictingClassGroupModifiers
1471
+ } = config;
1472
+ const getClassGroupId = (className) => {
1473
+ const classParts = className.split(CLASS_PART_SEPARATOR);
1474
+ if (classParts[0] === "" && classParts.length !== 1) {
1475
+ classParts.shift();
1476
+ }
1477
+ return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
1478
+ };
1479
+ const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
1480
+ const conflicts = conflictingClassGroups[classGroupId] || [];
1481
+ if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
1482
+ return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
1483
+ }
1484
+ return conflicts;
1485
+ };
1486
+ return {
1487
+ getClassGroupId,
1488
+ getConflictingClassGroupIds
1489
+ };
1490
+ };
1491
+ var getGroupRecursive = (classParts, classPartObject) => {
1492
+ if (classParts.length === 0) {
1493
+ return classPartObject.classGroupId;
1494
+ }
1495
+ const currentClassPart = classParts[0];
1496
+ const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
1497
+ const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
1498
+ if (classGroupFromNextClassPart) {
1499
+ return classGroupFromNextClassPart;
1500
+ }
1501
+ if (classPartObject.validators.length === 0) {
1502
+ return void 0;
1503
+ }
1504
+ const classRest = classParts.join(CLASS_PART_SEPARATOR);
1505
+ return classPartObject.validators.find(({
1506
+ validator
1507
+ }) => validator(classRest))?.classGroupId;
1508
+ };
1509
+ var arbitraryPropertyRegex = /^\[(.+)\]$/;
1510
+ var getGroupIdForArbitraryProperty = (className) => {
1511
+ if (arbitraryPropertyRegex.test(className)) {
1512
+ const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
1513
+ const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(":"));
1514
+ if (property) {
1515
+ return "arbitrary.." + property;
1516
+ }
1517
+ }
1518
+ };
1519
+ var createClassMap = (config) => {
1520
+ const {
1521
+ theme,
1522
+ prefix
1523
+ } = config;
1524
+ const classMap = {
1525
+ nextPart: /* @__PURE__ */ new Map(),
1526
+ validators: []
1527
+ };
1528
+ const prefixedClassGroupEntries = getPrefixedClassGroupEntries(Object.entries(config.classGroups), prefix);
1529
+ prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {
1530
+ processClassesRecursively(classGroup, classMap, classGroupId, theme);
1531
+ });
1532
+ return classMap;
1533
+ };
1534
+ var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
1535
+ classGroup.forEach((classDefinition) => {
1536
+ if (typeof classDefinition === "string") {
1537
+ const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
1538
+ classPartObjectToEdit.classGroupId = classGroupId;
1539
+ return;
1540
+ }
1541
+ if (typeof classDefinition === "function") {
1542
+ if (isThemeGetter(classDefinition)) {
1543
+ processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
1544
+ return;
1545
+ }
1546
+ classPartObject.validators.push({
1547
+ validator: classDefinition,
1548
+ classGroupId
1549
+ });
1550
+ return;
1551
+ }
1552
+ Object.entries(classDefinition).forEach(([key, classGroup2]) => {
1553
+ processClassesRecursively(classGroup2, getPart(classPartObject, key), classGroupId, theme);
1554
+ });
1555
+ });
1556
+ };
1557
+ var getPart = (classPartObject, path) => {
1558
+ let currentClassPartObject = classPartObject;
1559
+ path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
1560
+ if (!currentClassPartObject.nextPart.has(pathPart)) {
1561
+ currentClassPartObject.nextPart.set(pathPart, {
1562
+ nextPart: /* @__PURE__ */ new Map(),
1563
+ validators: []
1564
+ });
1565
+ }
1566
+ currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
1567
+ });
1568
+ return currentClassPartObject;
1569
+ };
1570
+ var isThemeGetter = (func) => func.isThemeGetter;
1571
+ var getPrefixedClassGroupEntries = (classGroupEntries, prefix) => {
1572
+ if (!prefix) {
1573
+ return classGroupEntries;
1574
+ }
1575
+ return classGroupEntries.map(([classGroupId, classGroup]) => {
1576
+ const prefixedClassGroup = classGroup.map((classDefinition) => {
1577
+ if (typeof classDefinition === "string") {
1578
+ return prefix + classDefinition;
1579
+ }
1580
+ if (typeof classDefinition === "object") {
1581
+ return Object.fromEntries(Object.entries(classDefinition).map(([key, value]) => [prefix + key, value]));
1582
+ }
1583
+ return classDefinition;
1584
+ });
1585
+ return [classGroupId, prefixedClassGroup];
1586
+ });
1587
+ };
1588
+ var createLruCache = (maxCacheSize) => {
1589
+ if (maxCacheSize < 1) {
1590
+ return {
1591
+ get: () => void 0,
1592
+ set: () => {
1593
+ }
1594
+ };
1595
+ }
1596
+ let cacheSize = 0;
1597
+ let cache = /* @__PURE__ */ new Map();
1598
+ let previousCache = /* @__PURE__ */ new Map();
1599
+ const update = (key, value) => {
1600
+ cache.set(key, value);
1601
+ cacheSize++;
1602
+ if (cacheSize > maxCacheSize) {
1603
+ cacheSize = 0;
1604
+ previousCache = cache;
1605
+ cache = /* @__PURE__ */ new Map();
1606
+ }
1607
+ };
1608
+ return {
1609
+ get(key) {
1610
+ let value = cache.get(key);
1611
+ if (value !== void 0) {
1612
+ return value;
1613
+ }
1614
+ if ((value = previousCache.get(key)) !== void 0) {
1615
+ update(key, value);
1616
+ return value;
1617
+ }
1618
+ },
1619
+ set(key, value) {
1620
+ if (cache.has(key)) {
1621
+ cache.set(key, value);
1622
+ } else {
1623
+ update(key, value);
1624
+ }
1625
+ }
1626
+ };
1627
+ };
1628
+ var IMPORTANT_MODIFIER = "!";
1629
+ var createParseClassName = (config) => {
1630
+ const {
1631
+ separator,
1632
+ experimentalParseClassName
1633
+ } = config;
1634
+ const isSeparatorSingleCharacter = separator.length === 1;
1635
+ const firstSeparatorCharacter = separator[0];
1636
+ const separatorLength = separator.length;
1637
+ const parseClassName = (className) => {
1638
+ const modifiers = [];
1639
+ let bracketDepth = 0;
1640
+ let modifierStart = 0;
1641
+ let postfixModifierPosition;
1642
+ for (let index = 0; index < className.length; index++) {
1643
+ let currentCharacter = className[index];
1644
+ if (bracketDepth === 0) {
1645
+ if (currentCharacter === firstSeparatorCharacter && (isSeparatorSingleCharacter || className.slice(index, index + separatorLength) === separator)) {
1646
+ modifiers.push(className.slice(modifierStart, index));
1647
+ modifierStart = index + separatorLength;
1648
+ continue;
1649
+ }
1650
+ if (currentCharacter === "/") {
1651
+ postfixModifierPosition = index;
1652
+ continue;
1653
+ }
1654
+ }
1655
+ if (currentCharacter === "[") {
1656
+ bracketDepth++;
1657
+ } else if (currentCharacter === "]") {
1658
+ bracketDepth--;
1659
+ }
1660
+ }
1661
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
1662
+ const hasImportantModifier = baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER);
1663
+ const baseClassName = hasImportantModifier ? baseClassNameWithImportantModifier.substring(1) : baseClassNameWithImportantModifier;
1664
+ const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
1665
+ return {
1666
+ modifiers,
1667
+ hasImportantModifier,
1668
+ baseClassName,
1669
+ maybePostfixModifierPosition
1670
+ };
1671
+ };
1672
+ if (experimentalParseClassName) {
1673
+ return (className) => experimentalParseClassName({
1674
+ className,
1675
+ parseClassName
1676
+ });
1677
+ }
1678
+ return parseClassName;
1679
+ };
1680
+ var sortModifiers = (modifiers) => {
1681
+ if (modifiers.length <= 1) {
1682
+ return modifiers;
1683
+ }
1684
+ const sortedModifiers = [];
1685
+ let unsortedModifiers = [];
1686
+ modifiers.forEach((modifier) => {
1687
+ const isArbitraryVariant = modifier[0] === "[";
1688
+ if (isArbitraryVariant) {
1689
+ sortedModifiers.push(...unsortedModifiers.sort(), modifier);
1690
+ unsortedModifiers = [];
1691
+ } else {
1692
+ unsortedModifiers.push(modifier);
1693
+ }
1694
+ });
1695
+ sortedModifiers.push(...unsortedModifiers.sort());
1696
+ return sortedModifiers;
1697
+ };
1698
+ var createConfigUtils = (config) => ({
1699
+ cache: createLruCache(config.cacheSize),
1700
+ parseClassName: createParseClassName(config),
1701
+ ...createClassGroupUtils(config)
1702
+ });
1703
+ var SPLIT_CLASSES_REGEX = /\s+/;
1704
+ var mergeClassList = (classList, configUtils) => {
1705
+ const {
1706
+ parseClassName,
1707
+ getClassGroupId,
1708
+ getConflictingClassGroupIds
1709
+ } = configUtils;
1710
+ const classGroupsInConflict = [];
1711
+ const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
1712
+ let result = "";
1713
+ for (let index = classNames.length - 1; index >= 0; index -= 1) {
1714
+ const originalClassName = classNames[index];
1715
+ const {
1716
+ modifiers,
1717
+ hasImportantModifier,
1718
+ baseClassName,
1719
+ maybePostfixModifierPosition
1720
+ } = parseClassName(originalClassName);
1721
+ let hasPostfixModifier = Boolean(maybePostfixModifierPosition);
1722
+ let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
1723
+ if (!classGroupId) {
1724
+ if (!hasPostfixModifier) {
1725
+ result = originalClassName + (result.length > 0 ? " " + result : result);
1726
+ continue;
1727
+ }
1728
+ classGroupId = getClassGroupId(baseClassName);
1729
+ if (!classGroupId) {
1730
+ result = originalClassName + (result.length > 0 ? " " + result : result);
1731
+ continue;
1732
+ }
1733
+ hasPostfixModifier = false;
1734
+ }
1735
+ const variantModifier = sortModifiers(modifiers).join(":");
1736
+ const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
1737
+ const classId = modifierId + classGroupId;
1738
+ if (classGroupsInConflict.includes(classId)) {
1739
+ continue;
1740
+ }
1741
+ classGroupsInConflict.push(classId);
1742
+ const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
1743
+ for (let i = 0; i < conflictGroups.length; ++i) {
1744
+ const group = conflictGroups[i];
1745
+ classGroupsInConflict.push(modifierId + group);
1746
+ }
1747
+ result = originalClassName + (result.length > 0 ? " " + result : result);
1748
+ }
1749
+ return result;
1750
+ };
1751
+ function twJoin() {
1752
+ let index = 0;
1753
+ let argument;
1754
+ let resolvedValue;
1755
+ let string = "";
1756
+ while (index < arguments.length) {
1757
+ if (argument = arguments[index++]) {
1758
+ if (resolvedValue = toValue(argument)) {
1759
+ string && (string += " ");
1760
+ string += resolvedValue;
1761
+ }
1762
+ }
1763
+ }
1764
+ return string;
1765
+ }
1766
+ var toValue = (mix) => {
1767
+ if (typeof mix === "string") {
1279
1768
  return mix;
1280
1769
  }
1281
1770
  let resolvedValue;
@@ -3526,7 +4015,7 @@ function useComposedRefs(...refs) {
3526
4015
  }
3527
4016
 
3528
4017
  // ../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.mjs
3529
- import { Fragment as Fragment2, jsx } from "react/jsx-runtime";
4018
+ import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
3530
4019
  // @__NO_SIDE_EFFECTS__
3531
4020
  function createSlot(ownerName) {
3532
4021
  const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
@@ -3544,9 +4033,9 @@ function createSlot(ownerName) {
3544
4033
  return child;
3545
4034
  }
3546
4035
  });
3547
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React2.isValidElement(newElement) ? React2.cloneElement(newElement, void 0, newChildren) : null });
4036
+ return /* @__PURE__ */ jsx3(SlotClone, { ...slotProps, ref: forwardedRef, children: React2.isValidElement(newElement) ? React2.cloneElement(newElement, void 0, newChildren) : null });
3548
4037
  }
3549
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
4038
+ return /* @__PURE__ */ jsx3(SlotClone, { ...slotProps, ref: forwardedRef, children });
3550
4039
  });
3551
4040
  Slot22.displayName = `${ownerName}.Slot`;
3552
4041
  return Slot22;
@@ -3654,7 +4143,7 @@ var cva = (base, config) => (props) => {
3654
4143
  };
3655
4144
 
3656
4145
  // src/libraries/react/components/ui/button.tsx
3657
- import { jsx as jsx2 } from "react/jsx-runtime";
4146
+ import { jsx as jsx4 } from "react/jsx-runtime";
3658
4147
  var buttonVariants = cva(
3659
4148
  "au-inline-flex au-items-center au-justify-center au-gap-2 au-whitespace-nowrap au-rounded-md au-text-sm au-font-medium au-transition-colors focus-visible:au-outline-none focus-visible:au-ring-1 focus-visible:au-ring-ring disabled:au-pointer-events-none disabled:au-opacity-50 [&_svg]:au-pointer-events-none [&_svg]:au-size-4 [&_svg]:au-shrink-0",
3660
4149
  {
@@ -3683,7 +4172,7 @@ var buttonVariants = cva(
3683
4172
  var Button = React3.forwardRef(
3684
4173
  ({ className, variant, size, asChild = false, ...props }, ref) => {
3685
4174
  const Comp = asChild ? Slot : "button";
3686
- return /* @__PURE__ */ jsx2(
4175
+ return /* @__PURE__ */ jsx4(
3687
4176
  Comp,
3688
4177
  {
3689
4178
  className: cn(buttonVariants({ variant, size }), className),
@@ -3817,13 +4306,13 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
3817
4306
 
3818
4307
  // ../node_modules/.pnpm/@radix-ui+react-context@1.1.2_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-context/dist/index.mjs
3819
4308
  import * as React4 from "react";
3820
- import { jsx as jsx3 } from "react/jsx-runtime";
4309
+ import { jsx as jsx5 } from "react/jsx-runtime";
3821
4310
  function createContext22(rootComponentName, defaultContext) {
3822
4311
  const Context = React4.createContext(defaultContext);
3823
4312
  const Provider = (props) => {
3824
4313
  const { children, ...context } = props;
3825
4314
  const value = React4.useMemo(() => context, Object.values(context));
3826
- return /* @__PURE__ */ jsx3(Context.Provider, { value, children });
4315
+ return /* @__PURE__ */ jsx5(Context.Provider, { value, children });
3827
4316
  };
3828
4317
  Provider.displayName = rootComponentName + "Provider";
3829
4318
  function useContext22(consumerName) {
@@ -3844,7 +4333,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
3844
4333
  const { scope, children, ...context } = props;
3845
4334
  const Context = scope?.[scopeName]?.[index] || BaseContext;
3846
4335
  const value = React4.useMemo(() => context, Object.values(context));
3847
- return /* @__PURE__ */ jsx3(Context.Provider, { value, children });
4336
+ return /* @__PURE__ */ jsx5(Context.Provider, { value, children });
3848
4337
  };
3849
4338
  Provider.displayName = rootComponentName + "Provider";
3850
4339
  function useContext22(consumerName, scope) {
@@ -3986,7 +4475,7 @@ import * as React11 from "react";
3986
4475
  // ../node_modules/.pnpm/@radix-ui+react-primitive@2.1.3_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18_t6r7cxmbmoheujv3t43yqlikou/node_modules/@radix-ui/react-primitive/dist/index.mjs
3987
4476
  import * as React8 from "react";
3988
4477
  import * as ReactDOM from "react-dom";
3989
- import { jsx as jsx4 } from "react/jsx-runtime";
4478
+ import { jsx as jsx6 } from "react/jsx-runtime";
3990
4479
  var NODES = [
3991
4480
  "a",
3992
4481
  "button",
@@ -4014,7 +4503,7 @@ var Primitive = NODES.reduce((primitive, node) => {
4014
4503
  if (typeof window !== "undefined") {
4015
4504
  window[Symbol.for("radix-ui")] = true;
4016
4505
  }
4017
- return /* @__PURE__ */ jsx4(Comp, { ...primitiveProps, ref: forwardedRef });
4506
+ return /* @__PURE__ */ jsx6(Comp, { ...primitiveProps, ref: forwardedRef });
4018
4507
  });
4019
4508
  Node2.displayName = `Primitive.${node}`;
4020
4509
  return { ...primitive, [node]: Node2 };
@@ -4049,7 +4538,7 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
4049
4538
  }
4050
4539
 
4051
4540
  // ../node_modules/.pnpm/@radix-ui+react-dismissable-layer@1.1.10_@types+react-dom@18.3.5_@types+react@18.3.14__@types_dcs2l2jzs5flmzhfcv6rimpkfe/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
4052
- import { jsx as jsx5 } from "react/jsx-runtime";
4541
+ import { jsx as jsx7 } from "react/jsx-runtime";
4053
4542
  var DISMISSABLE_LAYER_NAME = "DismissableLayer";
4054
4543
  var CONTEXT_UPDATE = "dismissableLayer.update";
4055
4544
  var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
@@ -4137,7 +4626,7 @@ var DismissableLayer = React11.forwardRef(
4137
4626
  document.addEventListener(CONTEXT_UPDATE, handleUpdate);
4138
4627
  return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
4139
4628
  }, []);
4140
- return /* @__PURE__ */ jsx5(
4629
+ return /* @__PURE__ */ jsx7(
4141
4630
  Primitive.div,
4142
4631
  {
4143
4632
  ...layerProps,
@@ -4171,7 +4660,7 @@ var DismissableLayerBranch = React11.forwardRef((props, forwardedRef) => {
4171
4660
  };
4172
4661
  }
4173
4662
  }, [context.branches]);
4174
- return /* @__PURE__ */ jsx5(Primitive.div, { ...props, ref: composedRefs });
4663
+ return /* @__PURE__ */ jsx7(Primitive.div, { ...props, ref: composedRefs });
4175
4664
  });
4176
4665
  DismissableLayerBranch.displayName = BRANCH_NAME;
4177
4666
  function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
@@ -4255,7 +4744,7 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
4255
4744
 
4256
4745
  // ../node_modules/.pnpm/@radix-ui+react-focus-scope@1.1.7_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@_r3i6zfw7jzc6qbfsmvmyzd6wgu/node_modules/@radix-ui/react-focus-scope/dist/index.mjs
4257
4746
  import * as React12 from "react";
4258
- import { jsx as jsx6 } from "react/jsx-runtime";
4747
+ import { jsx as jsx8 } from "react/jsx-runtime";
4259
4748
  var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
4260
4749
  var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
4261
4750
  var EVENT_OPTIONS = { bubbles: false, cancelable: true };
@@ -4374,7 +4863,7 @@ var FocusScope = React12.forwardRef((props, forwardedRef) => {
4374
4863
  },
4375
4864
  [loop, trapped, focusScope.paused]
4376
4865
  );
4377
- return /* @__PURE__ */ jsx6(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
4866
+ return /* @__PURE__ */ jsx8(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
4378
4867
  });
4379
4868
  FocusScope.displayName = FOCUS_SCOPE_NAME;
4380
4869
  function focusFirst(candidates, { select = false } = {}) {
@@ -4460,14 +4949,14 @@ function removeLinks(items) {
4460
4949
  // ../node_modules/.pnpm/@radix-ui+react-portal@1.1.9_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3._nlwlfidmfjbhuhdac2s4gonhum/node_modules/@radix-ui/react-portal/dist/index.mjs
4461
4950
  import * as React13 from "react";
4462
4951
  import ReactDOM2 from "react-dom";
4463
- import { jsx as jsx7 } from "react/jsx-runtime";
4952
+ import { jsx as jsx9 } from "react/jsx-runtime";
4464
4953
  var PORTAL_NAME = "Portal";
4465
4954
  var Portal = React13.forwardRef((props, forwardedRef) => {
4466
4955
  const { container: containerProp, ...portalProps } = props;
4467
4956
  const [mounted, setMounted] = React13.useState(false);
4468
4957
  useLayoutEffect2(() => setMounted(true), []);
4469
4958
  const container = containerProp || mounted && globalThis?.document?.body;
4470
- return container ? ReactDOM2.createPortal(/* @__PURE__ */ jsx7(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
4959
+ return container ? ReactDOM2.createPortal(/* @__PURE__ */ jsx9(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
4471
4960
  });
4472
4961
  Portal.displayName = PORTAL_NAME;
4473
4962
 
@@ -4680,9 +5169,9 @@ function assignRef(ref, value) {
4680
5169
  }
4681
5170
 
4682
5171
  // ../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@18.3.14_react@18.3.1/node_modules/use-callback-ref/dist/es2015/useRef.js
4683
- import { useState as useState8 } from "react";
5172
+ import { useState as useState9 } from "react";
4684
5173
  function useCallbackRef2(initialValue, callback) {
4685
- var ref = useState8(function() {
5174
+ var ref = useState9(function() {
4686
5175
  return {
4687
5176
  // value
4688
5177
  value: initialValue,
@@ -5350,1268 +5839,820 @@ var getDefaultParent = function(originalTarget) {
5350
5839
  var counterMap = /* @__PURE__ */ new WeakMap();
5351
5840
  var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
5352
5841
  var markerMap = {};
5353
- var lockCount = 0;
5354
- var unwrapHost = function(node) {
5355
- return node && (node.host || unwrapHost(node.parentNode));
5356
- };
5357
- var correctTargets = function(parent, targets) {
5358
- return targets.map(function(target) {
5359
- if (parent.contains(target)) {
5360
- return target;
5361
- }
5362
- var correctedTarget = unwrapHost(target);
5363
- if (correctedTarget && parent.contains(correctedTarget)) {
5364
- return correctedTarget;
5365
- }
5366
- console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
5367
- return null;
5368
- }).filter(function(x) {
5369
- return Boolean(x);
5370
- });
5371
- };
5372
- var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
5373
- var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
5374
- if (!markerMap[markerName]) {
5375
- markerMap[markerName] = /* @__PURE__ */ new WeakMap();
5376
- }
5377
- var markerCounter = markerMap[markerName];
5378
- var hiddenNodes = [];
5379
- var elementsToKeep = /* @__PURE__ */ new Set();
5380
- var elementsToStop = new Set(targets);
5381
- var keep = function(el) {
5382
- if (!el || elementsToKeep.has(el)) {
5383
- return;
5384
- }
5385
- elementsToKeep.add(el);
5386
- keep(el.parentNode);
5387
- };
5388
- targets.forEach(keep);
5389
- var deep = function(parent) {
5390
- if (!parent || elementsToStop.has(parent)) {
5391
- return;
5392
- }
5393
- Array.prototype.forEach.call(parent.children, function(node) {
5394
- if (elementsToKeep.has(node)) {
5395
- deep(node);
5396
- } else {
5397
- try {
5398
- var attr = node.getAttribute(controlAttribute);
5399
- var alreadyHidden = attr !== null && attr !== "false";
5400
- var counterValue = (counterMap.get(node) || 0) + 1;
5401
- var markerValue = (markerCounter.get(node) || 0) + 1;
5402
- counterMap.set(node, counterValue);
5403
- markerCounter.set(node, markerValue);
5404
- hiddenNodes.push(node);
5405
- if (counterValue === 1 && alreadyHidden) {
5406
- uncontrolledNodes.set(node, true);
5407
- }
5408
- if (markerValue === 1) {
5409
- node.setAttribute(markerName, "true");
5410
- }
5411
- if (!alreadyHidden) {
5412
- node.setAttribute(controlAttribute, "true");
5413
- }
5414
- } catch (e) {
5415
- console.error("aria-hidden: cannot operate on ", node, e);
5416
- }
5417
- }
5418
- });
5419
- };
5420
- deep(parentNode);
5421
- elementsToKeep.clear();
5422
- lockCount++;
5423
- return function() {
5424
- hiddenNodes.forEach(function(node) {
5425
- var counterValue = counterMap.get(node) - 1;
5426
- var markerValue = markerCounter.get(node) - 1;
5427
- counterMap.set(node, counterValue);
5428
- markerCounter.set(node, markerValue);
5429
- if (!counterValue) {
5430
- if (!uncontrolledNodes.has(node)) {
5431
- node.removeAttribute(controlAttribute);
5432
- }
5433
- uncontrolledNodes.delete(node);
5434
- }
5435
- if (!markerValue) {
5436
- node.removeAttribute(markerName);
5437
- }
5438
- });
5439
- lockCount--;
5440
- if (!lockCount) {
5441
- counterMap = /* @__PURE__ */ new WeakMap();
5442
- counterMap = /* @__PURE__ */ new WeakMap();
5443
- uncontrolledNodes = /* @__PURE__ */ new WeakMap();
5444
- markerMap = {};
5445
- }
5446
- };
5447
- };
5448
- var hideOthers = function(originalTarget, parentNode, markerName) {
5449
- if (markerName === void 0) {
5450
- markerName = "data-aria-hidden";
5451
- }
5452
- var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
5453
- var activeParentNode = parentNode || getDefaultParent(originalTarget);
5454
- if (!activeParentNode) {
5455
- return function() {
5456
- return null;
5457
- };
5458
- }
5459
- targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
5460
- return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
5461
- };
5462
-
5463
- // ../node_modules/.pnpm/@radix-ui+react-dialog@1.1.14_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3_osy3texbcyy7oe3sqigksqvg74/node_modules/@radix-ui/react-dialog/dist/index.mjs
5464
- import { Fragment as Fragment5, jsx as jsx8, jsxs } from "react/jsx-runtime";
5465
- var DIALOG_NAME = "Dialog";
5466
- var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
5467
- var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
5468
- var Dialog = (props) => {
5469
- const {
5470
- __scopeDialog,
5471
- children,
5472
- open: openProp,
5473
- defaultOpen,
5474
- onOpenChange,
5475
- modal = true
5476
- } = props;
5477
- const triggerRef = React25.useRef(null);
5478
- const contentRef = React25.useRef(null);
5479
- const [open, setOpen] = useControllableState({
5480
- prop: openProp,
5481
- defaultProp: defaultOpen ?? false,
5482
- onChange: onOpenChange,
5483
- caller: DIALOG_NAME
5484
- });
5485
- return /* @__PURE__ */ jsx8(
5486
- DialogProvider,
5487
- {
5488
- scope: __scopeDialog,
5489
- triggerRef,
5490
- contentRef,
5491
- contentId: useId(),
5492
- titleId: useId(),
5493
- descriptionId: useId(),
5494
- open,
5495
- onOpenChange: setOpen,
5496
- onOpenToggle: React25.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
5497
- modal,
5498
- children
5499
- }
5500
- );
5501
- };
5502
- Dialog.displayName = DIALOG_NAME;
5503
- var TRIGGER_NAME = "DialogTrigger";
5504
- var DialogTrigger = React25.forwardRef(
5505
- (props, forwardedRef) => {
5506
- const { __scopeDialog, ...triggerProps } = props;
5507
- const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
5508
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
5509
- return /* @__PURE__ */ jsx8(
5510
- Primitive.button,
5511
- {
5512
- type: "button",
5513
- "aria-haspopup": "dialog",
5514
- "aria-expanded": context.open,
5515
- "aria-controls": context.contentId,
5516
- "data-state": getState(context.open),
5517
- ...triggerProps,
5518
- ref: composedTriggerRef,
5519
- onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
5520
- }
5521
- );
5522
- }
5523
- );
5524
- DialogTrigger.displayName = TRIGGER_NAME;
5525
- var PORTAL_NAME2 = "DialogPortal";
5526
- var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
5527
- forceMount: void 0
5528
- });
5529
- var DialogPortal = (props) => {
5530
- const { __scopeDialog, forceMount, children, container } = props;
5531
- const context = useDialogContext(PORTAL_NAME2, __scopeDialog);
5532
- return /* @__PURE__ */ jsx8(PortalProvider, { scope: __scopeDialog, forceMount, children: React25.Children.map(children, (child) => /* @__PURE__ */ jsx8(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx8(Portal, { asChild: true, container, children: child }) })) });
5533
- };
5534
- DialogPortal.displayName = PORTAL_NAME2;
5535
- var OVERLAY_NAME = "DialogOverlay";
5536
- var DialogOverlay = React25.forwardRef(
5537
- (props, forwardedRef) => {
5538
- const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
5539
- const { forceMount = portalContext.forceMount, ...overlayProps } = props;
5540
- const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
5541
- return context.modal ? /* @__PURE__ */ jsx8(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx8(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
5542
- }
5543
- );
5544
- DialogOverlay.displayName = OVERLAY_NAME;
5545
- var Slot2 = createSlot("DialogOverlay.RemoveScroll");
5546
- var DialogOverlayImpl = React25.forwardRef(
5547
- (props, forwardedRef) => {
5548
- const { __scopeDialog, ...overlayProps } = props;
5549
- const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
5550
- return (
5551
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
5552
- // ie. when `Overlay` and `Content` are siblings
5553
- /* @__PURE__ */ jsx8(Combination_default, { as: Slot2, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx8(
5554
- Primitive.div,
5555
- {
5556
- "data-state": getState(context.open),
5557
- ...overlayProps,
5558
- ref: forwardedRef,
5559
- style: { pointerEvents: "auto", ...overlayProps.style }
5560
- }
5561
- ) })
5562
- );
5563
- }
5564
- );
5565
- var CONTENT_NAME = "DialogContent";
5566
- var DialogContent = React25.forwardRef(
5567
- (props, forwardedRef) => {
5568
- const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
5569
- const { forceMount = portalContext.forceMount, ...contentProps } = props;
5570
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
5571
- return /* @__PURE__ */ jsx8(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx8(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx8(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
5572
- }
5573
- );
5574
- DialogContent.displayName = CONTENT_NAME;
5575
- var DialogContentModal = React25.forwardRef(
5576
- (props, forwardedRef) => {
5577
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
5578
- const contentRef = React25.useRef(null);
5579
- const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
5580
- React25.useEffect(() => {
5581
- const content = contentRef.current;
5582
- if (content) return hideOthers(content);
5583
- }, []);
5584
- return /* @__PURE__ */ jsx8(
5585
- DialogContentImpl,
5586
- {
5587
- ...props,
5588
- ref: composedRefs,
5589
- trapFocus: context.open,
5590
- disableOutsidePointerEvents: true,
5591
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
5592
- event.preventDefault();
5593
- context.triggerRef.current?.focus();
5594
- }),
5595
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
5596
- const originalEvent = event.detail.originalEvent;
5597
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
5598
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
5599
- if (isRightClick) event.preventDefault();
5600
- }),
5601
- onFocusOutside: composeEventHandlers(
5602
- props.onFocusOutside,
5603
- (event) => event.preventDefault()
5604
- )
5605
- }
5606
- );
5842
+ var lockCount = 0;
5843
+ var unwrapHost = function(node) {
5844
+ return node && (node.host || unwrapHost(node.parentNode));
5845
+ };
5846
+ var correctTargets = function(parent, targets) {
5847
+ return targets.map(function(target) {
5848
+ if (parent.contains(target)) {
5849
+ return target;
5850
+ }
5851
+ var correctedTarget = unwrapHost(target);
5852
+ if (correctedTarget && parent.contains(correctedTarget)) {
5853
+ return correctedTarget;
5854
+ }
5855
+ console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
5856
+ return null;
5857
+ }).filter(function(x) {
5858
+ return Boolean(x);
5859
+ });
5860
+ };
5861
+ var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
5862
+ var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
5863
+ if (!markerMap[markerName]) {
5864
+ markerMap[markerName] = /* @__PURE__ */ new WeakMap();
5607
5865
  }
5608
- );
5609
- var DialogContentNonModal = React25.forwardRef(
5610
- (props, forwardedRef) => {
5611
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
5612
- const hasInteractedOutsideRef = React25.useRef(false);
5613
- const hasPointerDownOutsideRef = React25.useRef(false);
5614
- return /* @__PURE__ */ jsx8(
5615
- DialogContentImpl,
5616
- {
5617
- ...props,
5618
- ref: forwardedRef,
5619
- trapFocus: false,
5620
- disableOutsidePointerEvents: false,
5621
- onCloseAutoFocus: (event) => {
5622
- props.onCloseAutoFocus?.(event);
5623
- if (!event.defaultPrevented) {
5624
- if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
5625
- event.preventDefault();
5866
+ var markerCounter = markerMap[markerName];
5867
+ var hiddenNodes = [];
5868
+ var elementsToKeep = /* @__PURE__ */ new Set();
5869
+ var elementsToStop = new Set(targets);
5870
+ var keep = function(el) {
5871
+ if (!el || elementsToKeep.has(el)) {
5872
+ return;
5873
+ }
5874
+ elementsToKeep.add(el);
5875
+ keep(el.parentNode);
5876
+ };
5877
+ targets.forEach(keep);
5878
+ var deep = function(parent) {
5879
+ if (!parent || elementsToStop.has(parent)) {
5880
+ return;
5881
+ }
5882
+ Array.prototype.forEach.call(parent.children, function(node) {
5883
+ if (elementsToKeep.has(node)) {
5884
+ deep(node);
5885
+ } else {
5886
+ try {
5887
+ var attr = node.getAttribute(controlAttribute);
5888
+ var alreadyHidden = attr !== null && attr !== "false";
5889
+ var counterValue = (counterMap.get(node) || 0) + 1;
5890
+ var markerValue = (markerCounter.get(node) || 0) + 1;
5891
+ counterMap.set(node, counterValue);
5892
+ markerCounter.set(node, markerValue);
5893
+ hiddenNodes.push(node);
5894
+ if (counterValue === 1 && alreadyHidden) {
5895
+ uncontrolledNodes.set(node, true);
5626
5896
  }
5627
- hasInteractedOutsideRef.current = false;
5628
- hasPointerDownOutsideRef.current = false;
5629
- },
5630
- onInteractOutside: (event) => {
5631
- props.onInteractOutside?.(event);
5632
- if (!event.defaultPrevented) {
5633
- hasInteractedOutsideRef.current = true;
5634
- if (event.detail.originalEvent.type === "pointerdown") {
5635
- hasPointerDownOutsideRef.current = true;
5636
- }
5897
+ if (markerValue === 1) {
5898
+ node.setAttribute(markerName, "true");
5637
5899
  }
5638
- const target = event.target;
5639
- const targetIsTrigger = context.triggerRef.current?.contains(target);
5640
- if (targetIsTrigger) event.preventDefault();
5641
- if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
5642
- event.preventDefault();
5900
+ if (!alreadyHidden) {
5901
+ node.setAttribute(controlAttribute, "true");
5643
5902
  }
5903
+ } catch (e) {
5904
+ console.error("aria-hidden: cannot operate on ", node, e);
5644
5905
  }
5645
5906
  }
5646
- );
5647
- }
5648
- );
5649
- var DialogContentImpl = React25.forwardRef(
5650
- (props, forwardedRef) => {
5651
- const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
5652
- const context = useDialogContext(CONTENT_NAME, __scopeDialog);
5653
- const contentRef = React25.useRef(null);
5654
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
5655
- useFocusGuards();
5656
- return /* @__PURE__ */ jsxs(Fragment5, { children: [
5657
- /* @__PURE__ */ jsx8(
5658
- FocusScope,
5659
- {
5660
- asChild: true,
5661
- loop: true,
5662
- trapped: trapFocus,
5663
- onMountAutoFocus: onOpenAutoFocus,
5664
- onUnmountAutoFocus: onCloseAutoFocus,
5665
- children: /* @__PURE__ */ jsx8(
5666
- DismissableLayer,
5667
- {
5668
- role: "dialog",
5669
- id: context.contentId,
5670
- "aria-describedby": context.descriptionId,
5671
- "aria-labelledby": context.titleId,
5672
- "data-state": getState(context.open),
5673
- ...contentProps,
5674
- ref: composedRefs,
5675
- onDismiss: () => context.onOpenChange(false)
5676
- }
5677
- )
5907
+ });
5908
+ };
5909
+ deep(parentNode);
5910
+ elementsToKeep.clear();
5911
+ lockCount++;
5912
+ return function() {
5913
+ hiddenNodes.forEach(function(node) {
5914
+ var counterValue = counterMap.get(node) - 1;
5915
+ var markerValue = markerCounter.get(node) - 1;
5916
+ counterMap.set(node, counterValue);
5917
+ markerCounter.set(node, markerValue);
5918
+ if (!counterValue) {
5919
+ if (!uncontrolledNodes.has(node)) {
5920
+ node.removeAttribute(controlAttribute);
5678
5921
  }
5679
- ),
5680
- /* @__PURE__ */ jsxs(Fragment5, { children: [
5681
- /* @__PURE__ */ jsx8(TitleWarning, { titleId: context.titleId }),
5682
- /* @__PURE__ */ jsx8(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
5683
- ] })
5684
- ] });
5685
- }
5686
- );
5687
- var TITLE_NAME = "DialogTitle";
5688
- var DialogTitle = React25.forwardRef(
5689
- (props, forwardedRef) => {
5690
- const { __scopeDialog, ...titleProps } = props;
5691
- const context = useDialogContext(TITLE_NAME, __scopeDialog);
5692
- return /* @__PURE__ */ jsx8(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
5693
- }
5694
- );
5695
- DialogTitle.displayName = TITLE_NAME;
5696
- var DESCRIPTION_NAME = "DialogDescription";
5697
- var DialogDescription = React25.forwardRef(
5698
- (props, forwardedRef) => {
5699
- const { __scopeDialog, ...descriptionProps } = props;
5700
- const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
5701
- return /* @__PURE__ */ jsx8(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
5702
- }
5703
- );
5704
- DialogDescription.displayName = DESCRIPTION_NAME;
5705
- var CLOSE_NAME = "DialogClose";
5706
- var DialogClose = React25.forwardRef(
5707
- (props, forwardedRef) => {
5708
- const { __scopeDialog, ...closeProps } = props;
5709
- const context = useDialogContext(CLOSE_NAME, __scopeDialog);
5710
- return /* @__PURE__ */ jsx8(
5711
- Primitive.button,
5712
- {
5713
- type: "button",
5714
- ...closeProps,
5715
- ref: forwardedRef,
5716
- onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
5922
+ uncontrolledNodes.delete(node);
5717
5923
  }
5718
- );
5719
- }
5720
- );
5721
- DialogClose.displayName = CLOSE_NAME;
5722
- function getState(open) {
5723
- return open ? "open" : "closed";
5724
- }
5725
- var TITLE_WARNING_NAME = "DialogTitleWarning";
5726
- var [WarningProvider, useWarningContext] = createContext22(TITLE_WARNING_NAME, {
5727
- contentName: CONTENT_NAME,
5728
- titleName: TITLE_NAME,
5729
- docsSlug: "dialog"
5730
- });
5731
- var TitleWarning = ({ titleId }) => {
5732
- const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
5733
- const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
5734
-
5735
- If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
5736
-
5737
- For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
5738
- React25.useEffect(() => {
5739
- if (titleId) {
5740
- const hasTitle = document.getElementById(titleId);
5741
- if (!hasTitle) console.error(MESSAGE);
5742
- }
5743
- }, [MESSAGE, titleId]);
5744
- return null;
5745
- };
5746
- var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
5747
- var DescriptionWarning = ({ contentRef, descriptionId }) => {
5748
- const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
5749
- const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
5750
- React25.useEffect(() => {
5751
- const describedById = contentRef.current?.getAttribute("aria-describedby");
5752
- if (descriptionId && describedById) {
5753
- const hasDescription = document.getElementById(descriptionId);
5754
- if (!hasDescription) console.warn(MESSAGE);
5924
+ if (!markerValue) {
5925
+ node.removeAttribute(markerName);
5926
+ }
5927
+ });
5928
+ lockCount--;
5929
+ if (!lockCount) {
5930
+ counterMap = /* @__PURE__ */ new WeakMap();
5931
+ counterMap = /* @__PURE__ */ new WeakMap();
5932
+ uncontrolledNodes = /* @__PURE__ */ new WeakMap();
5933
+ markerMap = {};
5755
5934
  }
5756
- }, [MESSAGE, contentRef, descriptionId]);
5757
- return null;
5758
- };
5759
- var Root = Dialog;
5760
- var Portal2 = DialogPortal;
5761
- var Overlay = DialogOverlay;
5762
- var Content = DialogContent;
5763
- var Title = DialogTitle;
5764
- var Description = DialogDescription;
5765
- var Close = DialogClose;
5766
-
5767
- // src/libraries/react/components/ui/dialog.tsx
5768
- import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
5769
- var Dialog2 = Root;
5770
- var DialogPortal2 = ({
5771
- children,
5772
- ...props
5773
- }) => {
5774
- return /* @__PURE__ */ jsx9(Portal2, { ...props, children: /* @__PURE__ */ jsx9("div", { className: "au-root", children }) });
5935
+ };
5775
5936
  };
5776
- var DialogOverlay2 = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
5777
- Overlay,
5778
- {
5779
- ref,
5780
- className: cn(
5781
- "au-fixed au-inset-0 au-z-50 au-bg-black/80 data-[state=open]:au-animate-in data-[state=closed]:au-animate-out data-[state=closed]:au-fade-out-0 data-[state=open]:au-fade-in-0",
5782
- className
5783
- ),
5784
- ...props
5937
+ var hideOthers = function(originalTarget, parentNode, markerName) {
5938
+ if (markerName === void 0) {
5939
+ markerName = "data-aria-hidden";
5785
5940
  }
5786
- ));
5787
- DialogOverlay2.displayName = Overlay.displayName;
5788
- var DialogContent2 = React26.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(DialogPortal2, { children: [
5789
- /* @__PURE__ */ jsx9(DialogOverlay2, {}),
5790
- /* @__PURE__ */ jsxs2(
5791
- Content,
5941
+ var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
5942
+ var activeParentNode = parentNode || getDefaultParent(originalTarget);
5943
+ if (!activeParentNode) {
5944
+ return function() {
5945
+ return null;
5946
+ };
5947
+ }
5948
+ targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
5949
+ return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
5950
+ };
5951
+
5952
+ // ../node_modules/.pnpm/@radix-ui+react-dialog@1.1.14_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3_osy3texbcyy7oe3sqigksqvg74/node_modules/@radix-ui/react-dialog/dist/index.mjs
5953
+ import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
5954
+ var DIALOG_NAME = "Dialog";
5955
+ var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
5956
+ var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
5957
+ var Dialog = (props) => {
5958
+ const {
5959
+ __scopeDialog,
5960
+ children,
5961
+ open: openProp,
5962
+ defaultOpen,
5963
+ onOpenChange,
5964
+ modal = true
5965
+ } = props;
5966
+ const triggerRef = React25.useRef(null);
5967
+ const contentRef = React25.useRef(null);
5968
+ const [open, setOpen] = useControllableState({
5969
+ prop: openProp,
5970
+ defaultProp: defaultOpen ?? false,
5971
+ onChange: onOpenChange,
5972
+ caller: DIALOG_NAME
5973
+ });
5974
+ return /* @__PURE__ */ jsx10(
5975
+ DialogProvider,
5792
5976
  {
5793
- ref,
5794
- className: cn(
5795
- `au-fixed au-left-[50%] au-top-[50%] au-z-50 au-grid au-w-full au-max-w-lg au-translate-x-[-50%] au-translate-y-[-50%] au-gap-4 au-border au-bg-background au-p-6 au-shadow-lg au-duration-200 data-[state=open]:au-animate-in data-[state=closed]:au-animate-out data-[state=closed]:au-fade-out-0 data-[state=open]:au-fade-in-0 data-[state=closed]:au-zoom-out-95 data-[state=open]:au-zoom-in-95 data-[state=closed]:au-slide-out-to-left-1/2 data-[state=closed]:au-slide-out-to-top-[48%] data-[state=open]:au-slide-in-from-left-1/2 data-[state=open]:au-slide-in-from-top-[48%] sm:au-rounded-lg`,
5796
- className
5797
- ),
5798
- ...props,
5799
- children: [
5800
- children,
5801
- /* @__PURE__ */ jsxs2(Close, { className: "au-absolute au-right-4 au-top-4 au-rounded-sm au-opacity-70 au-ring-offset-background au-transition-opacity hover:au-opacity-100 focus:au-outline-none focus:au-ring-2 focus:au-ring-ring focus:au-ring-offset-2 disabled:au-pointer-events-none data-[state=open]:au-bg-accent data-[state=open]:au-text-muted-foreground", children: [
5802
- /* @__PURE__ */ jsx9(X, { className: "au-h-4 au-w-4" }),
5803
- /* @__PURE__ */ jsx9("span", { className: "au-sr-only", children: "Close" })
5804
- ] })
5805
- ]
5977
+ scope: __scopeDialog,
5978
+ triggerRef,
5979
+ contentRef,
5980
+ contentId: useId(),
5981
+ titleId: useId(),
5982
+ descriptionId: useId(),
5983
+ open,
5984
+ onOpenChange: setOpen,
5985
+ onOpenToggle: React25.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
5986
+ modal,
5987
+ children
5806
5988
  }
5807
- )
5808
- ] }));
5809
- DialogContent2.displayName = Content.displayName;
5810
- var DialogHeader = ({
5811
- className,
5812
- ...props
5813
- }) => /* @__PURE__ */ jsx9(
5814
- "div",
5815
- {
5816
- className: cn(
5817
- "au-flex au-flex-col au-space-y-1.5 au-text-center sm:au-text-left",
5818
- className
5819
- ),
5820
- ...props
5989
+ );
5990
+ };
5991
+ Dialog.displayName = DIALOG_NAME;
5992
+ var TRIGGER_NAME = "DialogTrigger";
5993
+ var DialogTrigger = React25.forwardRef(
5994
+ (props, forwardedRef) => {
5995
+ const { __scopeDialog, ...triggerProps } = props;
5996
+ const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
5997
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
5998
+ return /* @__PURE__ */ jsx10(
5999
+ Primitive.button,
6000
+ {
6001
+ type: "button",
6002
+ "aria-haspopup": "dialog",
6003
+ "aria-expanded": context.open,
6004
+ "aria-controls": context.contentId,
6005
+ "data-state": getState(context.open),
6006
+ ...triggerProps,
6007
+ ref: composedTriggerRef,
6008
+ onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
6009
+ }
6010
+ );
5821
6011
  }
5822
6012
  );
5823
- DialogHeader.displayName = "DialogHeader";
5824
- var DialogFooter = ({
5825
- className,
5826
- ...props
5827
- }) => /* @__PURE__ */ jsx9(
5828
- "div",
5829
- {
5830
- className: cn(
5831
- "au-flex au-flex-col-reverse sm:au-flex-row sm:au-justify-end sm:au-space-x-2",
5832
- className
5833
- ),
5834
- ...props
6013
+ DialogTrigger.displayName = TRIGGER_NAME;
6014
+ var PORTAL_NAME2 = "DialogPortal";
6015
+ var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
6016
+ forceMount: void 0
6017
+ });
6018
+ var DialogPortal = (props) => {
6019
+ const { __scopeDialog, forceMount, children, container } = props;
6020
+ const context = useDialogContext(PORTAL_NAME2, __scopeDialog);
6021
+ return /* @__PURE__ */ jsx10(PortalProvider, { scope: __scopeDialog, forceMount, children: React25.Children.map(children, (child) => /* @__PURE__ */ jsx10(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx10(Portal, { asChild: true, container, children: child }) })) });
6022
+ };
6023
+ DialogPortal.displayName = PORTAL_NAME2;
6024
+ var OVERLAY_NAME = "DialogOverlay";
6025
+ var DialogOverlay = React25.forwardRef(
6026
+ (props, forwardedRef) => {
6027
+ const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
6028
+ const { forceMount = portalContext.forceMount, ...overlayProps } = props;
6029
+ const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
6030
+ return context.modal ? /* @__PURE__ */ jsx10(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx10(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
5835
6031
  }
5836
6032
  );
5837
- DialogFooter.displayName = "DialogFooter";
5838
- var DialogTitle2 = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
5839
- Title,
5840
- {
5841
- ref,
5842
- className: cn(
5843
- "au-text-lg au-font-semibold au-leading-none au-tracking-tight",
5844
- className
5845
- ),
5846
- ...props
6033
+ DialogOverlay.displayName = OVERLAY_NAME;
6034
+ var Slot2 = createSlot("DialogOverlay.RemoveScroll");
6035
+ var DialogOverlayImpl = React25.forwardRef(
6036
+ (props, forwardedRef) => {
6037
+ const { __scopeDialog, ...overlayProps } = props;
6038
+ const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
6039
+ return (
6040
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
6041
+ // ie. when `Overlay` and `Content` are siblings
6042
+ /* @__PURE__ */ jsx10(Combination_default, { as: Slot2, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx10(
6043
+ Primitive.div,
6044
+ {
6045
+ "data-state": getState(context.open),
6046
+ ...overlayProps,
6047
+ ref: forwardedRef,
6048
+ style: { pointerEvents: "auto", ...overlayProps.style }
6049
+ }
6050
+ ) })
6051
+ );
5847
6052
  }
5848
- ));
5849
- DialogTitle2.displayName = Title.displayName;
5850
- var DialogDescription2 = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
5851
- Description,
5852
- {
5853
- ref,
5854
- className: cn("au-text-sm au-text-muted-foreground", className),
5855
- ...props
6053
+ );
6054
+ var CONTENT_NAME = "DialogContent";
6055
+ var DialogContent = React25.forwardRef(
6056
+ (props, forwardedRef) => {
6057
+ const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
6058
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
6059
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
6060
+ return /* @__PURE__ */ jsx10(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx10(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx10(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
5856
6061
  }
5857
- ));
5858
- DialogDescription2.displayName = Description.displayName;
5859
-
5860
- // src/libraries/react/components/attach-dialog/lib/attach-content.tsx
5861
- import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
5862
- var getAttachContent = (preview) => {
5863
- const {
5864
- scenario,
5865
- product_name,
5866
- recurring,
5867
- current_product_name,
5868
- next_cycle_at
5869
- } = preview;
5870
- const nextCycleAtStr = next_cycle_at ? new Date(next_cycle_at).toLocaleDateString() : void 0;
5871
- switch (scenario) {
5872
- case "scheduled":
5873
- return {
5874
- title: /* @__PURE__ */ jsxs3("p", { children: [
5875
- product_name,
5876
- " product already scheduled"
5877
- ] }),
5878
- message: /* @__PURE__ */ jsxs3("p", { children: [
5879
- "You are currently on product ",
5880
- current_product_name,
5881
- " and are scheduled to start ",
5882
- product_name,
5883
- " on ",
5884
- nextCycleAtStr,
5885
- "."
5886
- ] })
5887
- };
5888
- case "active":
5889
- return {
5890
- title: /* @__PURE__ */ jsx10("p", { children: "Product already active" }),
5891
- message: /* @__PURE__ */ jsx10("p", { children: "You are already subscribed to this product." })
5892
- };
5893
- case "new":
5894
- if (recurring) {
5895
- return {
5896
- title: /* @__PURE__ */ jsxs3("p", { children: [
5897
- "Subscribe to ",
5898
- product_name
5899
- ] }),
5900
- message: /* @__PURE__ */ jsxs3("p", { children: [
5901
- "By clicking confirm, you will be subscribed to ",
5902
- product_name,
5903
- " and your card will be charged immediately."
5904
- ] })
5905
- };
5906
- } else {
5907
- return {
5908
- title: /* @__PURE__ */ jsxs3("p", { children: [
5909
- "Purchase ",
5910
- product_name
5911
- ] }),
5912
- message: /* @__PURE__ */ jsxs3("p", { children: [
5913
- "By clicking confirm, you will purchase ",
5914
- product_name,
5915
- " and your card will be charged immediately."
5916
- ] })
5917
- };
5918
- }
5919
- case "renew":
5920
- return {
5921
- title: /* @__PURE__ */ jsx10("p", { children: "Renew" }),
5922
- message: /* @__PURE__ */ jsxs3("p", { children: [
5923
- "By clicking confirm, you will renew your subscription to",
5924
- " ",
5925
- product_name,
5926
- "."
5927
- ] })
5928
- };
5929
- case "upgrade":
5930
- return {
5931
- title: /* @__PURE__ */ jsxs3("p", { children: [
5932
- "Upgrade to ",
5933
- product_name
5934
- ] }),
5935
- message: /* @__PURE__ */ jsxs3("p", { children: [
5936
- "By clicking confirm, you will upgrade to ",
5937
- product_name,
5938
- " and your payment method will be charged immediately."
5939
- ] })
5940
- };
5941
- case "downgrade":
5942
- return {
5943
- title: /* @__PURE__ */ jsxs3("p", { children: [
5944
- "Downgrade to ",
5945
- product_name
5946
- ] }),
5947
- message: /* @__PURE__ */ jsxs3("p", { children: [
5948
- "By clicking confirm, your current subscription to",
5949
- " ",
5950
- current_product_name,
5951
- " will be cancelled and a new subscription to",
5952
- " ",
5953
- product_name,
5954
- " will begin on ",
5955
- nextCycleAtStr,
5956
- "."
5957
- ] })
5958
- };
5959
- case "cancel":
5960
- return {
5961
- title: /* @__PURE__ */ jsx10("p", { children: "Cancel" }),
5962
- message: /* @__PURE__ */ jsxs3("p", { children: [
5963
- "By clicking confirm, your subscription to ",
5964
- current_product_name,
5965
- " ",
5966
- "will end on ",
5967
- nextCycleAtStr,
5968
- "."
5969
- ] })
5970
- };
5971
- default:
5972
- return {
5973
- title: /* @__PURE__ */ jsx10("p", { children: "Change Subscription" }),
5974
- message: /* @__PURE__ */ jsx10("p", { children: "You are about to change your subscription." })
5975
- };
6062
+ );
6063
+ DialogContent.displayName = CONTENT_NAME;
6064
+ var DialogContentModal = React25.forwardRef(
6065
+ (props, forwardedRef) => {
6066
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
6067
+ const contentRef = React25.useRef(null);
6068
+ const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
6069
+ React25.useEffect(() => {
6070
+ const content = contentRef.current;
6071
+ if (content) return hideOthers(content);
6072
+ }, []);
6073
+ return /* @__PURE__ */ jsx10(
6074
+ DialogContentImpl,
6075
+ {
6076
+ ...props,
6077
+ ref: composedRefs,
6078
+ trapFocus: context.open,
6079
+ disableOutsidePointerEvents: true,
6080
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
6081
+ event.preventDefault();
6082
+ context.triggerRef.current?.focus();
6083
+ }),
6084
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
6085
+ const originalEvent = event.detail.originalEvent;
6086
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
6087
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
6088
+ if (isRightClick) event.preventDefault();
6089
+ }),
6090
+ onFocusOutside: composeEventHandlers(
6091
+ props.onFocusOutside,
6092
+ (event) => event.preventDefault()
6093
+ )
6094
+ }
6095
+ );
5976
6096
  }
5977
- };
5978
-
5979
- // src/libraries/react/components/attach-dialog/attach-dialog-synced.tsx
5980
- import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
5981
- function AttachDialog(params) {
5982
- const { attach } = useCustomer();
5983
- const [loading, setLoading] = useState11(false);
5984
- const [optionsInput, setOptionsInput] = useState11(
5985
- params?.preview?.options || []
5986
- );
5987
- const getTotalPrice = () => {
5988
- let sum = due_today?.price || 0;
5989
- optionsInput.forEach((option) => {
5990
- if (option.price && option.quantity) {
5991
- sum += option.price * (option.quantity / option.billing_units);
6097
+ );
6098
+ var DialogContentNonModal = React25.forwardRef(
6099
+ (props, forwardedRef) => {
6100
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
6101
+ const hasInteractedOutsideRef = React25.useRef(false);
6102
+ const hasPointerDownOutsideRef = React25.useRef(false);
6103
+ return /* @__PURE__ */ jsx10(
6104
+ DialogContentImpl,
6105
+ {
6106
+ ...props,
6107
+ ref: forwardedRef,
6108
+ trapFocus: false,
6109
+ disableOutsidePointerEvents: false,
6110
+ onCloseAutoFocus: (event) => {
6111
+ props.onCloseAutoFocus?.(event);
6112
+ if (!event.defaultPrevented) {
6113
+ if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
6114
+ event.preventDefault();
6115
+ }
6116
+ hasInteractedOutsideRef.current = false;
6117
+ hasPointerDownOutsideRef.current = false;
6118
+ },
6119
+ onInteractOutside: (event) => {
6120
+ props.onInteractOutside?.(event);
6121
+ if (!event.defaultPrevented) {
6122
+ hasInteractedOutsideRef.current = true;
6123
+ if (event.detail.originalEvent.type === "pointerdown") {
6124
+ hasPointerDownOutsideRef.current = true;
6125
+ }
6126
+ }
6127
+ const target = event.target;
6128
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
6129
+ if (targetIsTrigger) event.preventDefault();
6130
+ if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
6131
+ event.preventDefault();
6132
+ }
6133
+ }
5992
6134
  }
5993
- });
5994
- return sum;
5995
- };
5996
- useEffect15(() => {
5997
- setOptionsInput(params?.preview?.options || []);
5998
- }, [params?.preview?.options]);
5999
- if (!params || !params.preview) {
6000
- return /* @__PURE__ */ jsx11(Fragment6, {});
6135
+ );
6001
6136
  }
6002
- const { open, setOpen, preview } = params;
6003
- const { items, due_today } = preview;
6004
- const { title, message } = getAttachContent(preview);
6005
- return /* @__PURE__ */ jsx11(Dialog2, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs4(
6006
- DialogContent2,
6007
- {
6008
- className: cn(
6009
- "au-p-0 au-pt-4 au-gap-0 au-text-foreground au-overflow-hidden au-text-sm"
6010
- ),
6011
- children: [
6012
- /* @__PURE__ */ jsx11(DialogTitle2, { className: cn("au-px-6 au-mb-1 "), children: title }),
6013
- /* @__PURE__ */ jsx11("div", { className: cn("au-px-6 au-mt-1 au-mb-4 au-text-muted-foreground"), children: message }),
6014
- (items || optionsInput.length > 0) && /* @__PURE__ */ jsxs4("div", { className: "au-mb-6 au-px-6", children: [
6015
- items?.map((item) => /* @__PURE__ */ jsxs4(PriceItem, { children: [
6016
- /* @__PURE__ */ jsx11("span", { className: "au-truncate au-flex-1", children: item.description }),
6017
- /* @__PURE__ */ jsx11("span", { children: item.price })
6018
- ] }, item.description)),
6019
- optionsInput?.map((option, index) => {
6020
- return /* @__PURE__ */ jsx11(
6021
- OptionsInput,
6022
- {
6023
- option,
6024
- optionsInput,
6025
- setOptionsInput,
6026
- index
6027
- },
6028
- option.feature_name
6029
- );
6030
- })
6031
- ] }),
6032
- /* @__PURE__ */ jsxs4(DialogFooter, { className: "au-flex au-flex-col sm:au-flex-row au-justify-between au-gap-x-4 au-py-2 au-pl-6 au-pr-3 au-bg-secondary au-border-t au-shadow-inner", children: [
6033
- due_today && /* @__PURE__ */ jsxs4(TotalPrice, { children: [
6034
- /* @__PURE__ */ jsx11("span", { children: "Due Today" }),
6035
- /* @__PURE__ */ jsx11("span", { children: new Intl.NumberFormat("en-US", {
6036
- style: "currency",
6037
- currency: due_today.currency
6038
- }).format(getTotalPrice()) })
6039
- ] }),
6040
- /* @__PURE__ */ jsx11(
6041
- Button,
6137
+ );
6138
+ var DialogContentImpl = React25.forwardRef(
6139
+ (props, forwardedRef) => {
6140
+ const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
6141
+ const context = useDialogContext(CONTENT_NAME, __scopeDialog);
6142
+ const contentRef = React25.useRef(null);
6143
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
6144
+ useFocusGuards();
6145
+ return /* @__PURE__ */ jsxs2(Fragment5, { children: [
6146
+ /* @__PURE__ */ jsx10(
6147
+ FocusScope,
6148
+ {
6149
+ asChild: true,
6150
+ loop: true,
6151
+ trapped: trapFocus,
6152
+ onMountAutoFocus: onOpenAutoFocus,
6153
+ onUnmountAutoFocus: onCloseAutoFocus,
6154
+ children: /* @__PURE__ */ jsx10(
6155
+ DismissableLayer,
6042
6156
  {
6043
- size: "sm",
6044
- onClick: async () => {
6045
- setLoading(true);
6046
- await attach({
6047
- productId: preview.product_id,
6048
- options: optionsInput.map((option) => ({
6049
- featureId: option.feature_id,
6050
- quantity: option.quantity || 0
6051
- }))
6052
- });
6053
- setOpen(false);
6054
- setLoading(false);
6055
- },
6056
- disabled: loading,
6057
- className: "au-min-w-16 au-flex au-items-center au-gap-2",
6058
- children: loading ? /* @__PURE__ */ jsx11(LoaderCircle, { className: "au-w-4 au-h-4 au-animate-spin" }) : /* @__PURE__ */ jsx11(Fragment6, { children: /* @__PURE__ */ jsx11("span", { className: "au-whitespace-nowrap au-flex au-gap-1", children: "Confirm" }) })
6157
+ role: "dialog",
6158
+ id: context.contentId,
6159
+ "aria-describedby": context.descriptionId,
6160
+ "aria-labelledby": context.titleId,
6161
+ "data-state": getState(context.open),
6162
+ ...contentProps,
6163
+ ref: composedRefs,
6164
+ onDismiss: () => context.onOpenChange(false)
6059
6165
  }
6060
6166
  )
6061
- ] })
6062
- ]
6063
- }
6064
- ) });
6065
- }
6066
- var PriceItem = ({
6067
- children,
6068
- className,
6069
- ...props
6070
- }) => {
6071
- return /* @__PURE__ */ jsx11(
6072
- "div",
6073
- {
6074
- className: cn(
6075
- "au-flex au-flex-col au-pb-4 sm:au-pb-0 au-gap-1 sm:au-flex-row au-justify-between sm:au-h-7 sm:au-gap-2 sm:au-items-center",
6076
- className
6167
+ }
6077
6168
  ),
6078
- ...props,
6079
- children
6169
+ /* @__PURE__ */ jsxs2(Fragment5, { children: [
6170
+ /* @__PURE__ */ jsx10(TitleWarning, { titleId: context.titleId }),
6171
+ /* @__PURE__ */ jsx10(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
6172
+ ] })
6173
+ ] });
6174
+ }
6175
+ );
6176
+ var TITLE_NAME = "DialogTitle";
6177
+ var DialogTitle = React25.forwardRef(
6178
+ (props, forwardedRef) => {
6179
+ const { __scopeDialog, ...titleProps } = props;
6180
+ const context = useDialogContext(TITLE_NAME, __scopeDialog);
6181
+ return /* @__PURE__ */ jsx10(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
6182
+ }
6183
+ );
6184
+ DialogTitle.displayName = TITLE_NAME;
6185
+ var DESCRIPTION_NAME = "DialogDescription";
6186
+ var DialogDescription = React25.forwardRef(
6187
+ (props, forwardedRef) => {
6188
+ const { __scopeDialog, ...descriptionProps } = props;
6189
+ const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
6190
+ return /* @__PURE__ */ jsx10(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
6191
+ }
6192
+ );
6193
+ DialogDescription.displayName = DESCRIPTION_NAME;
6194
+ var CLOSE_NAME = "DialogClose";
6195
+ var DialogClose = React25.forwardRef(
6196
+ (props, forwardedRef) => {
6197
+ const { __scopeDialog, ...closeProps } = props;
6198
+ const context = useDialogContext(CLOSE_NAME, __scopeDialog);
6199
+ return /* @__PURE__ */ jsx10(
6200
+ Primitive.button,
6201
+ {
6202
+ type: "button",
6203
+ ...closeProps,
6204
+ ref: forwardedRef,
6205
+ onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
6206
+ }
6207
+ );
6208
+ }
6209
+ );
6210
+ DialogClose.displayName = CLOSE_NAME;
6211
+ function getState(open) {
6212
+ return open ? "open" : "closed";
6213
+ }
6214
+ var TITLE_WARNING_NAME = "DialogTitleWarning";
6215
+ var [WarningProvider, useWarningContext] = createContext22(TITLE_WARNING_NAME, {
6216
+ contentName: CONTENT_NAME,
6217
+ titleName: TITLE_NAME,
6218
+ docsSlug: "dialog"
6219
+ });
6220
+ var TitleWarning = ({ titleId }) => {
6221
+ const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
6222
+ const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
6223
+
6224
+ If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
6225
+
6226
+ For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
6227
+ React25.useEffect(() => {
6228
+ if (titleId) {
6229
+ const hasTitle = document.getElementById(titleId);
6230
+ if (!hasTitle) console.error(MESSAGE);
6080
6231
  }
6081
- );
6232
+ }, [MESSAGE, titleId]);
6233
+ return null;
6082
6234
  };
6083
- var OptionsInput = ({
6084
- className,
6085
- option,
6086
- optionsInput,
6087
- setOptionsInput,
6088
- index,
6089
- ...props
6090
- }) => {
6091
- const { feature_name, billing_units, quantity, price } = option;
6092
- return /* @__PURE__ */ jsxs4(PriceItem, { children: [
6093
- /* @__PURE__ */ jsx11("span", { children: feature_name }),
6094
- /* @__PURE__ */ jsx11(
6095
- QuantityInput,
6096
- {
6097
- value: quantity ? quantity / billing_units : "",
6098
- onChange: (e) => {
6099
- const newOptions = [...optionsInput];
6100
- newOptions[index].quantity = parseInt(e.target.value) * billing_units;
6101
- setOptionsInput(newOptions);
6102
- },
6103
- children: /* @__PURE__ */ jsxs4("span", { className: "", children: [
6104
- "\xD7 $",
6105
- price,
6106
- " per ",
6107
- billing_units === 1 ? " " : billing_units,
6108
- " ",
6109
- feature_name
6110
- ] })
6111
- },
6112
- feature_name
6113
- )
6114
- ] }, feature_name);
6235
+ var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
6236
+ var DescriptionWarning = ({ contentRef, descriptionId }) => {
6237
+ const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
6238
+ const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
6239
+ React25.useEffect(() => {
6240
+ const describedById = contentRef.current?.getAttribute("aria-describedby");
6241
+ if (descriptionId && describedById) {
6242
+ const hasDescription = document.getElementById(descriptionId);
6243
+ if (!hasDescription) console.warn(MESSAGE);
6244
+ }
6245
+ }, [MESSAGE, contentRef, descriptionId]);
6246
+ return null;
6115
6247
  };
6116
- var QuantityInput = ({
6248
+ var Root = Dialog;
6249
+ var Portal2 = DialogPortal;
6250
+ var Overlay = DialogOverlay;
6251
+ var Content = DialogContent;
6252
+ var Title = DialogTitle;
6253
+ var Description = DialogDescription;
6254
+ var Close = DialogClose;
6255
+
6256
+ // src/libraries/react/components/ui/dialog.tsx
6257
+ import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
6258
+ var Dialog2 = Root;
6259
+ var DialogPortal2 = ({
6117
6260
  children,
6118
- onChange,
6119
- value,
6120
- className,
6121
6261
  ...props
6122
6262
  }) => {
6123
- const currentValue = Number(value) || 0;
6124
- const handleValueChange = (newValue) => {
6125
- const syntheticEvent = {
6126
- target: { value: String(newValue) }
6127
- };
6128
- onChange(syntheticEvent);
6129
- };
6130
- return /* @__PURE__ */ jsxs4(
6131
- "div",
6263
+ return /* @__PURE__ */ jsx11(Portal2, { ...props, children: /* @__PURE__ */ jsx11("div", { className: "au-root", children }) });
6264
+ };
6265
+ var DialogOverlay2 = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
6266
+ Overlay,
6267
+ {
6268
+ ref,
6269
+ className: cn(
6270
+ "au-fixed au-inset-0 au-z-50 au-bg-black/80 data-[state=open]:au-animate-in data-[state=closed]:au-animate-out data-[state=closed]:au-fade-out-0 data-[state=open]:au-fade-in-0",
6271
+ className
6272
+ ),
6273
+ ...props
6274
+ }
6275
+ ));
6276
+ DialogOverlay2.displayName = Overlay.displayName;
6277
+ var DialogContent2 = React26.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs3(DialogPortal2, { children: [
6278
+ /* @__PURE__ */ jsx11(DialogOverlay2, {}),
6279
+ /* @__PURE__ */ jsxs3(
6280
+ Content,
6132
6281
  {
6133
- className: cn(className, "au-flex au-flex-row au-items-center au-gap-4"),
6282
+ ref,
6283
+ className: cn(
6284
+ `au-fixed au-left-[50%] au-top-[50%] au-z-50 au-grid au-w-full au-max-w-lg au-translate-x-[-50%] au-translate-y-[-50%] au-gap-4 au-border au-bg-background au-p-6 au-shadow-lg au-duration-200 data-[state=open]:au-animate-in data-[state=closed]:au-animate-out data-[state=closed]:au-fade-out-0 data-[state=open]:au-fade-in-0 data-[state=closed]:au-zoom-out-95 data-[state=open]:au-zoom-in-95 data-[state=closed]:au-slide-out-to-left-1/2 data-[state=closed]:au-slide-out-to-top-[48%] data-[state=open]:au-slide-in-from-left-1/2 data-[state=open]:au-slide-in-from-top-[48%] sm:au-rounded-lg`,
6285
+ className
6286
+ ),
6134
6287
  ...props,
6135
6288
  children: [
6136
- /* @__PURE__ */ jsxs4("div", { className: "au-flex au-items-center au-gap-1", children: [
6137
- /* @__PURE__ */ jsx11(
6138
- Button,
6139
- {
6140
- variant: "outline",
6141
- size: "icon",
6142
- onClick: () => currentValue > 0 && handleValueChange(currentValue - 1),
6143
- disabled: currentValue <= 0,
6144
- className: "au-h-6 au-w-6 au-pb-0.5",
6145
- children: "-"
6146
- }
6147
- ),
6148
- /* @__PURE__ */ jsx11("span", { className: "au-w-8 au-text-center au-text-foreground", children: currentValue }),
6149
- /* @__PURE__ */ jsx11(
6150
- Button,
6151
- {
6152
- variant: "outline",
6153
- size: "icon",
6154
- onClick: () => handleValueChange(currentValue + 1),
6155
- className: "au-h-6 au-w-6 au-pb-0.5",
6156
- children: "+"
6157
- }
6158
- )
6159
- ] }),
6160
- children
6289
+ children,
6290
+ /* @__PURE__ */ jsxs3(Close, { className: "au-absolute au-right-4 au-top-4 au-rounded-sm au-opacity-70 au-ring-offset-background au-transition-opacity hover:au-opacity-100 focus:au-outline-none focus:au-ring-2 focus:au-ring-ring focus:au-ring-offset-2 disabled:au-pointer-events-none data-[state=open]:au-bg-accent data-[state=open]:au-text-muted-foreground", children: [
6291
+ /* @__PURE__ */ jsx11(X, { className: "au-h-4 au-w-4" }),
6292
+ /* @__PURE__ */ jsx11("span", { className: "au-sr-only", children: "Close" })
6293
+ ] })
6161
6294
  ]
6162
6295
  }
6163
- );
6164
- };
6165
- var TotalPrice = ({ children }) => {
6166
- return /* @__PURE__ */ jsx11("div", { className: "au-w-full au-font-semibold au-flex au-justify-between au-items-center", children });
6167
- };
6168
-
6169
- // src/libraries/react/hooks/useAutumnBase.tsx
6170
- var useAutumnBase = ({
6171
- AutumnContext: AutumnContext2
6172
- }) => {
6173
- const context = useAutumnContext({ AutumnContext: AutumnContext2, name: "useAutumn" });
6174
- const { attachDialog, paywallDialog } = context;
6175
- const client = context.client;
6176
- const { refetch: refetchPricingTable } = usePricingTableBase({
6177
- AutumnContext: AutumnContext2
6178
- });
6179
- let {
6180
- open: attachOpen,
6181
- setProps: setAttachProps,
6182
- setOpen: setAttachOpen,
6183
- setComponent: setAttachComponent
6184
- } = attachDialog;
6185
- let {
6186
- setProps: setCheckProps,
6187
- setOpen: setCheckOpen,
6188
- setComponent: setPaywallComponent
6189
- } = paywallDialog;
6190
- const attachWithoutDialog = async (params) => {
6191
- const result = await client.attach(params);
6192
- if (result.error) {
6193
- return result;
6194
- }
6195
- let data = result.data;
6196
- if (data?.checkout_url && typeof window !== "undefined") {
6197
- if (params.openInNewTab) {
6198
- window.open(data.checkout_url, "_blank");
6199
- } else {
6200
- window.location.href = data.checkout_url;
6201
- }
6202
- }
6203
- await refetchPricingTable();
6204
- if (setAttachOpen) {
6205
- setAttachOpen(false);
6206
- }
6207
- return result;
6208
- };
6209
- const attachWithDialog = async (params) => {
6210
- let { dialog, ...rest } = params;
6211
- const { productId, entityId, entityData } = params;
6212
- const checkRes = await client.check({
6213
- productId,
6214
- entityId,
6215
- entityData,
6216
- withPreview: true
6217
- });
6218
- if (checkRes.error) {
6219
- return checkRes;
6220
- }
6221
- let preview = checkRes.data.preview;
6222
- if (!preview) {
6223
- return await attachWithoutDialog(rest);
6224
- } else {
6225
- setAttachProps({ preview, attachParams: rest });
6226
- setAttachOpen(true);
6227
- }
6228
- return checkRes;
6229
- };
6230
- const attach = async (params) => {
6231
- const { dialog, openInNewTab } = params;
6232
- let finalDialog = dialog ? dialog : context.disableDialogs ? void 0 : AttachDialog;
6233
- if (finalDialog && !attachOpen) {
6234
- setAttachComponent(finalDialog);
6235
- return await attachWithDialog(params);
6236
- }
6237
- return await attachWithoutDialog(params);
6238
- };
6239
- const cancel = async (params) => {
6240
- const res = await client.cancel(params);
6241
- if (res.error) {
6242
- return res;
6243
- }
6244
- return res;
6245
- };
6246
- const check = async (params) => {
6247
- let { dialog, withPreview } = params;
6248
- if (dialog) {
6249
- setPaywallComponent(dialog);
6250
- }
6251
- const res = await client.check({
6252
- ...params,
6253
- withPreview: withPreview || dialog ? true : false
6254
- });
6255
- if (res.error) {
6256
- return res;
6257
- }
6258
- let data = res.data;
6259
- if (data && data.preview && dialog) {
6260
- let preview = data.preview;
6261
- setCheckProps({ preview });
6262
- setCheckOpen(true);
6263
- }
6264
- return res;
6265
- };
6266
- const track = async (params) => {
6267
- const res = await client.track(params);
6268
- if (res.error) {
6269
- return res;
6270
- }
6271
- return res;
6272
- };
6273
- const openBillingPortal = async (params) => {
6274
- let defaultParams = {
6275
- openInNewTab: false
6276
- };
6277
- let finalParams = {
6278
- ...defaultParams,
6279
- ...params
6280
- };
6281
- const res = await client.openBillingPortal(finalParams);
6282
- if (res.error) {
6283
- return res;
6284
- }
6285
- let data = res.data;
6286
- if (data?.url && typeof window !== "undefined") {
6287
- if (finalParams.openInNewTab) {
6288
- window.open(data.url, "_blank");
6289
- } else {
6290
- window.open(data.url, "_self");
6291
- }
6292
- return res;
6293
- } else {
6294
- return res;
6295
- }
6296
- };
6297
- return {
6298
- attach,
6299
- check,
6300
- track,
6301
- cancel,
6302
- openBillingPortal
6303
- };
6304
- };
6305
-
6306
- // src/libraries/react/hooks/handleAllowed.ts
6307
- var getCusFeature = ({
6308
- customer,
6309
- featureId,
6310
- requiredBalance = 1
6311
- }) => {
6312
- let creditSchema = Object.values(customer.features).find((f) => f.credit_schema && f.credit_schema.some((c) => c.feature_id === featureId));
6313
- if (creditSchema) {
6314
- let schemaItem = creditSchema.credit_schema?.find((c) => c.feature_id === featureId);
6315
- return {
6316
- feature: creditSchema,
6317
- requiredBalance: schemaItem.credit_amount * requiredBalance
6318
- };
6296
+ )
6297
+ ] }));
6298
+ DialogContent2.displayName = Content.displayName;
6299
+ var DialogHeader = ({
6300
+ className,
6301
+ ...props
6302
+ }) => /* @__PURE__ */ jsx11(
6303
+ "div",
6304
+ {
6305
+ className: cn(
6306
+ "au-flex au-flex-col au-space-y-1.5 au-text-center sm:au-text-left",
6307
+ className
6308
+ ),
6309
+ ...props
6319
6310
  }
6320
- return {
6321
- cusFeature: customer.features[featureId],
6322
- requiredBalance
6323
- };
6324
- };
6325
- var handleFeatureAllowed = ({ customer, params }) => {
6326
- let { cusFeature, requiredBalance } = getCusFeature({ customer, featureId: params.featureId });
6327
- if (!cusFeature) return false;
6328
- if (cusFeature.type == "static") return true;
6329
- if (cusFeature.unlimited || cusFeature.overage_allowed) return true;
6330
- return (cusFeature.balance || 0) >= requiredBalance;
6331
- };
6332
- var handleAllowed = ({ customer, params }) => {
6333
- if (!customer) return false;
6334
- if (!params.featureId && !params.productId) {
6335
- throw new Error("allowed() requires either featureId or productId");
6311
+ );
6312
+ DialogHeader.displayName = "DialogHeader";
6313
+ var DialogFooter = ({
6314
+ className,
6315
+ ...props
6316
+ }) => /* @__PURE__ */ jsx11(
6317
+ "div",
6318
+ {
6319
+ className: cn(
6320
+ "au-flex au-flex-col-reverse sm:au-flex-row sm:au-justify-end sm:au-space-x-2",
6321
+ className
6322
+ ),
6323
+ ...props
6336
6324
  }
6337
- if (params.featureId) {
6338
- return handleFeatureAllowed({ customer, params });
6325
+ );
6326
+ DialogFooter.displayName = "DialogFooter";
6327
+ var DialogTitle2 = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
6328
+ Title,
6329
+ {
6330
+ ref,
6331
+ className: cn(
6332
+ "au-text-lg au-font-semibold au-leading-none au-tracking-tight",
6333
+ className
6334
+ ),
6335
+ ...props
6339
6336
  }
6340
- if (params.productId) {
6341
- let product = customer.products.find((p) => p.id == params.productId);
6342
- if (!product) return false;
6343
- let status = product.status;
6344
- if (status == "scheduled") return false;
6345
- return true;
6337
+ ));
6338
+ DialogTitle2.displayName = Title.displayName;
6339
+ var DialogDescription2 = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
6340
+ Description,
6341
+ {
6342
+ ref,
6343
+ className: cn("au-text-sm au-text-muted-foreground", className),
6344
+ ...props
6346
6345
  }
6347
- return false;
6348
- };
6346
+ ));
6347
+ DialogDescription2.displayName = Description.displayName;
6349
6348
 
6350
- // src/libraries/react/hooks/useCustomerBase.tsx
6351
- var emptyDefaultFunctions = {
6352
- attach: "",
6353
- check: "",
6354
- track: "",
6355
- cancel: "",
6356
- openBillingPortal: ""
6357
- };
6358
- var useCustomerBase = ({
6359
- params,
6360
- AutumnContext: AutumnContext2,
6361
- client
6362
- }) => {
6363
- const queryKey = ["customer", params?.expand];
6364
- let context;
6365
- if (AutumnContext2) {
6366
- context = useAutumnContext({ AutumnContext: AutumnContext2, name: "useCustomer" });
6367
- }
6368
- if (!client) {
6369
- client = context.client;
6370
- }
6371
- const fetchCustomer = async () => {
6372
- const { data, error: error2 } = await client.createCustomer({
6373
- errorOnNotFound: params?.errorOnNotFound,
6374
- expand: params?.expand
6375
- });
6376
- if (error2) {
6377
- throw error2;
6378
- }
6379
- if (!data) {
6380
- return null;
6381
- }
6382
- return data;
6383
- };
6384
- const { data: customer, error, isLoading, mutate } = useSWR2(queryKey, fetchCustomer, {
6385
- fallbackData: null,
6386
- onErrorRetry: (error2, key, config) => {
6387
- if (error2.code == "entity_not_found") {
6388
- return false;
6349
+ // src/libraries/react/components/attach-dialog/lib/attach-content.tsx
6350
+ import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
6351
+ var getAttachContent = (preview) => {
6352
+ const {
6353
+ scenario,
6354
+ product_name,
6355
+ recurring,
6356
+ current_product_name,
6357
+ next_cycle_at
6358
+ } = preview;
6359
+ const nextCycleAtStr = next_cycle_at ? new Date(next_cycle_at).toLocaleDateString() : void 0;
6360
+ switch (scenario) {
6361
+ case "scheduled":
6362
+ return {
6363
+ title: /* @__PURE__ */ jsxs4("p", { children: [
6364
+ product_name,
6365
+ " product already scheduled"
6366
+ ] }),
6367
+ message: /* @__PURE__ */ jsxs4("p", { children: [
6368
+ "You are currently on product ",
6369
+ current_product_name,
6370
+ " and are scheduled to start ",
6371
+ product_name,
6372
+ " on ",
6373
+ nextCycleAtStr,
6374
+ "."
6375
+ ] })
6376
+ };
6377
+ case "active":
6378
+ return {
6379
+ title: /* @__PURE__ */ jsx12("p", { children: "Product already active" }),
6380
+ message: /* @__PURE__ */ jsx12("p", { children: "You are already subscribed to this product." })
6381
+ };
6382
+ case "new":
6383
+ if (recurring) {
6384
+ return {
6385
+ title: /* @__PURE__ */ jsxs4("p", { children: [
6386
+ "Subscribe to ",
6387
+ product_name
6388
+ ] }),
6389
+ message: /* @__PURE__ */ jsxs4("p", { children: [
6390
+ "By clicking confirm, you will be subscribed to ",
6391
+ product_name,
6392
+ " and your card will be charged immediately."
6393
+ ] })
6394
+ };
6395
+ } else {
6396
+ return {
6397
+ title: /* @__PURE__ */ jsxs4("p", { children: [
6398
+ "Purchase ",
6399
+ product_name
6400
+ ] }),
6401
+ message: /* @__PURE__ */ jsxs4("p", { children: [
6402
+ "By clicking confirm, you will purchase ",
6403
+ product_name,
6404
+ " and your card will be charged immediately."
6405
+ ] })
6406
+ };
6389
6407
  }
6390
- return true;
6391
- }
6392
- });
6393
- let autumnFunctions = emptyDefaultFunctions;
6394
- if (AutumnContext2) {
6395
- autumnFunctions = useAutumnBase({ AutumnContext: AutumnContext2 });
6408
+ case "renew":
6409
+ return {
6410
+ title: /* @__PURE__ */ jsx12("p", { children: "Renew" }),
6411
+ message: /* @__PURE__ */ jsxs4("p", { children: [
6412
+ "By clicking confirm, you will renew your subscription to",
6413
+ " ",
6414
+ product_name,
6415
+ "."
6416
+ ] })
6417
+ };
6418
+ case "upgrade":
6419
+ return {
6420
+ title: /* @__PURE__ */ jsxs4("p", { children: [
6421
+ "Upgrade to ",
6422
+ product_name
6423
+ ] }),
6424
+ message: /* @__PURE__ */ jsxs4("p", { children: [
6425
+ "By clicking confirm, you will upgrade to ",
6426
+ product_name,
6427
+ " and your payment method will be charged immediately."
6428
+ ] })
6429
+ };
6430
+ case "downgrade":
6431
+ return {
6432
+ title: /* @__PURE__ */ jsxs4("p", { children: [
6433
+ "Downgrade to ",
6434
+ product_name
6435
+ ] }),
6436
+ message: /* @__PURE__ */ jsxs4("p", { children: [
6437
+ "By clicking confirm, your current subscription to",
6438
+ " ",
6439
+ current_product_name,
6440
+ " will be cancelled and a new subscription to",
6441
+ " ",
6442
+ product_name,
6443
+ " will begin on ",
6444
+ nextCycleAtStr,
6445
+ "."
6446
+ ] })
6447
+ };
6448
+ case "cancel":
6449
+ return {
6450
+ title: /* @__PURE__ */ jsx12("p", { children: "Cancel" }),
6451
+ message: /* @__PURE__ */ jsxs4("p", { children: [
6452
+ "By clicking confirm, your subscription to ",
6453
+ current_product_name,
6454
+ " ",
6455
+ "will end on ",
6456
+ nextCycleAtStr,
6457
+ "."
6458
+ ] })
6459
+ };
6460
+ default:
6461
+ return {
6462
+ title: /* @__PURE__ */ jsx12("p", { children: "Change Subscription" }),
6463
+ message: /* @__PURE__ */ jsx12("p", { children: "You are about to change your subscription." })
6464
+ };
6396
6465
  }
6397
- return {
6398
- customer: error ? null : customer,
6399
- isLoading,
6400
- error,
6401
- refetch: mutate,
6402
- ...autumnFunctions,
6403
- createEntity: client.entities.create,
6404
- createReferralCode: client.referrals.createCode,
6405
- redeemReferralCode: client.referrals.redeemCode,
6406
- allowed: (params2) => handleAllowed({ customer, params: params2 })
6407
- };
6408
6466
  };
6409
6467
 
6410
- // src/libraries/react/BaseAutumnProvider.tsx
6411
- import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
6412
- function BaseAutumnProvider({
6413
- client,
6414
- children,
6415
- AutumnContext: AutumnContext2,
6416
- disableDialogs = false
6417
- }) {
6418
- const [components, setComponents] = useState12({});
6419
- const [paywallProps, setPaywallProps, paywallOpen, setPaywallOpen] = useDialog(components.paywallDialog);
6420
- const [
6421
- productChangeProps,
6422
- setProductChangeProps,
6423
- productChangeOpen,
6424
- setProductChangeOpen
6425
- ] = useDialog(components.productChangeDialog);
6426
- useCustomerBase({ client, params: { errorOnNotFound: false } });
6427
- return /* @__PURE__ */ jsxs5(
6428
- AutumnContext2.Provider,
6429
- {
6430
- value: {
6431
- initialized: true,
6432
- client,
6433
- disableDialogs,
6434
- paywallDialog: {
6435
- props: paywallProps,
6436
- setProps: setPaywallProps,
6437
- open: paywallOpen,
6438
- setOpen: setPaywallOpen,
6439
- setComponent: (component) => {
6440
- setComponents({
6441
- ...components,
6442
- paywallDialog: component
6443
- });
6444
- }
6445
- },
6446
- attachDialog: {
6447
- props: productChangeProps,
6448
- setProps: setProductChangeProps,
6449
- open: productChangeOpen,
6450
- setOpen: setProductChangeOpen,
6451
- setComponent: (component) => {
6452
- setComponents({
6453
- ...components,
6454
- productChangeDialog: component
6455
- });
6456
- }
6457
- }
6458
- },
6468
+ // src/libraries/react/components/attach-dialog/attach-dialog-synced.tsx
6469
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
6470
+ function AttachDialog(params) {
6471
+ const { attach } = useCustomer();
6472
+ const [loading, setLoading] = useState12(false);
6473
+ const [optionsInput, setOptionsInput] = useState12(
6474
+ params?.preview?.options || []
6475
+ );
6476
+ const getTotalPrice = () => {
6477
+ let sum = due_today?.price || 0;
6478
+ optionsInput.forEach((option) => {
6479
+ if (option.price && option.quantity) {
6480
+ sum += option.price * (option.quantity / option.billing_units);
6481
+ }
6482
+ });
6483
+ return sum;
6484
+ };
6485
+ useEffect17(() => {
6486
+ setOptionsInput(params?.preview?.options || []);
6487
+ }, [params?.preview?.options]);
6488
+ if (!params || !params.preview) {
6489
+ return /* @__PURE__ */ jsx13(Fragment6, {});
6490
+ }
6491
+ const { open, setOpen, preview } = params;
6492
+ const { items, due_today } = preview;
6493
+ const { title, message } = getAttachContent(preview);
6494
+ return /* @__PURE__ */ jsx13(Dialog2, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs5(
6495
+ DialogContent2,
6496
+ {
6497
+ className: cn(
6498
+ "au-p-0 au-pt-4 au-gap-0 au-text-foreground au-overflow-hidden au-text-sm"
6499
+ ),
6459
6500
  children: [
6460
- components.paywallDialog && /* @__PURE__ */ jsx12(
6461
- components.paywallDialog,
6462
- {
6463
- open: paywallOpen,
6464
- setOpen: setPaywallOpen,
6465
- ...paywallProps
6466
- }
6467
- ),
6468
- components.productChangeDialog && /* @__PURE__ */ jsx12(
6469
- components.productChangeDialog,
6470
- {
6471
- open: productChangeOpen,
6472
- setOpen: setProductChangeOpen,
6473
- ...productChangeProps
6474
- }
6475
- ),
6476
- children
6501
+ /* @__PURE__ */ jsx13(DialogTitle2, { className: cn("au-px-6 au-mb-1 "), children: title }),
6502
+ /* @__PURE__ */ jsx13("div", { className: cn("au-px-6 au-mt-1 au-mb-4 au-text-muted-foreground"), children: message }),
6503
+ (items || optionsInput.length > 0) && /* @__PURE__ */ jsxs5("div", { className: "au-mb-6 au-px-6", children: [
6504
+ items?.map((item) => /* @__PURE__ */ jsxs5(PriceItem, { children: [
6505
+ /* @__PURE__ */ jsx13("span", { className: "au-truncate au-flex-1", children: item.description }),
6506
+ /* @__PURE__ */ jsx13("span", { children: item.price })
6507
+ ] }, item.description)),
6508
+ optionsInput?.map((option, index) => {
6509
+ return /* @__PURE__ */ jsx13(
6510
+ OptionsInput,
6511
+ {
6512
+ option,
6513
+ optionsInput,
6514
+ setOptionsInput,
6515
+ index
6516
+ },
6517
+ option.feature_name
6518
+ );
6519
+ })
6520
+ ] }),
6521
+ /* @__PURE__ */ jsxs5(DialogFooter, { className: "au-flex au-flex-col sm:au-flex-row au-justify-between au-gap-x-4 au-py-2 au-pl-6 au-pr-3 au-bg-secondary au-border-t au-shadow-inner", children: [
6522
+ due_today && /* @__PURE__ */ jsxs5(TotalPrice, { children: [
6523
+ /* @__PURE__ */ jsx13("span", { children: "Due Today" }),
6524
+ /* @__PURE__ */ jsx13("span", { children: new Intl.NumberFormat("en-US", {
6525
+ style: "currency",
6526
+ currency: due_today.currency
6527
+ }).format(getTotalPrice()) })
6528
+ ] }),
6529
+ /* @__PURE__ */ jsx13(
6530
+ Button,
6531
+ {
6532
+ size: "sm",
6533
+ onClick: async () => {
6534
+ setLoading(true);
6535
+ await attach({
6536
+ productId: preview.product_id,
6537
+ options: optionsInput.map((option) => ({
6538
+ featureId: option.feature_id,
6539
+ quantity: option.quantity || 0
6540
+ }))
6541
+ });
6542
+ setOpen(false);
6543
+ setLoading(false);
6544
+ },
6545
+ disabled: loading,
6546
+ className: "au-min-w-16 au-flex au-items-center au-gap-2",
6547
+ children: loading ? /* @__PURE__ */ jsx13(LoaderCircle, { className: "au-w-4 au-h-4 au-animate-spin" }) : /* @__PURE__ */ jsx13(Fragment6, { children: /* @__PURE__ */ jsx13("span", { className: "au-whitespace-nowrap au-flex au-gap-1", children: "Confirm" }) })
6548
+ }
6549
+ )
6550
+ ] })
6477
6551
  ]
6478
6552
  }
6479
- );
6553
+ ) });
6480
6554
  }
6481
-
6482
- // src/libraries/react/ReactAutumnProvider.tsx
6483
- import { useEffect as useEffect17 } from "react";
6484
- import { jsx as jsx13 } from "react/jsx-runtime";
6485
- var ReactAutumnProvider = ({
6555
+ var PriceItem = ({
6486
6556
  children,
6487
- getBearerToken,
6488
- backendUrl,
6489
- customerData,
6490
- includeCredentials = true,
6491
- disableDialogs = false,
6492
- authClient
6557
+ className,
6558
+ ...props
6493
6559
  }) => {
6494
- if (backendUrl && !backendUrl.startsWith("http")) {
6495
- console.warn(`backendUrl is not a valid URL: ${backendUrl}`);
6496
- }
6497
- let client = new AutumnClient({
6498
- backendUrl: backendUrl || "",
6499
- getBearerToken,
6500
- customerData,
6501
- includeCredentials
6502
- });
6503
- const analyseAuthClient = async () => {
6504
- console.log("Auth client:", authClient);
6505
- };
6506
- useEffect17(() => {
6507
- analyseAuthClient();
6508
- }, [authClient]);
6509
6560
  return /* @__PURE__ */ jsx13(
6510
- BaseAutumnProvider,
6561
+ "div",
6511
6562
  {
6512
- client,
6513
- AutumnContext,
6514
- disableDialogs,
6563
+ className: cn(
6564
+ "au-flex au-flex-col au-pb-4 sm:au-pb-0 au-gap-1 sm:au-flex-row au-justify-between sm:au-h-7 sm:au-gap-2 sm:au-items-center",
6565
+ className
6566
+ ),
6567
+ ...props,
6515
6568
  children
6516
6569
  }
6517
6570
  );
6518
6571
  };
6519
-
6520
- // src/libraries/react/hooks/useCustomer.tsx
6521
- var useCustomer = (params) => {
6522
- return useCustomerBase({
6523
- params,
6524
- AutumnContext
6525
- });
6526
- };
6527
-
6528
- // src/libraries/react/hooks/usePricingTable.tsx
6529
- var usePricingTable = (params) => {
6530
- return usePricingTableBase({
6531
- AutumnContext,
6532
- params
6533
- });
6572
+ var OptionsInput = ({
6573
+ className,
6574
+ option,
6575
+ optionsInput,
6576
+ setOptionsInput,
6577
+ index,
6578
+ ...props
6579
+ }) => {
6580
+ const { feature_name, billing_units, quantity, price } = option;
6581
+ return /* @__PURE__ */ jsxs5(PriceItem, { children: [
6582
+ /* @__PURE__ */ jsx13("span", { children: feature_name }),
6583
+ /* @__PURE__ */ jsx13(
6584
+ QuantityInput,
6585
+ {
6586
+ value: quantity ? quantity / billing_units : "",
6587
+ onChange: (e) => {
6588
+ const newOptions = [...optionsInput];
6589
+ newOptions[index].quantity = parseInt(e.target.value) * billing_units;
6590
+ setOptionsInput(newOptions);
6591
+ },
6592
+ children: /* @__PURE__ */ jsxs5("span", { className: "", children: [
6593
+ "\xD7 $",
6594
+ price,
6595
+ " per ",
6596
+ billing_units === 1 ? " " : billing_units,
6597
+ " ",
6598
+ feature_name
6599
+ ] })
6600
+ },
6601
+ feature_name
6602
+ )
6603
+ ] }, feature_name);
6534
6604
  };
6535
-
6536
- // src/libraries/react/hooks/useEntityBase.tsx
6537
- import useSWR3 from "swr";
6538
- import { useContext as useContext4 } from "react";
6539
- var useEntityBase = ({
6540
- entityId,
6541
- params,
6542
- AutumnContext: AutumnContext2
6605
+ var QuantityInput = ({
6606
+ children,
6607
+ onChange,
6608
+ value,
6609
+ className,
6610
+ ...props
6543
6611
  }) => {
6544
- const { client } = useContext4(AutumnContext2);
6545
- const queryKey = ["entity", entityId, params?.expand];
6546
- const fetchEntity = async () => {
6547
- if (!entityId) {
6548
- return null;
6549
- }
6550
- const { data: data2, error: error2 } = await client.entities.get(entityId, params);
6551
- if (error2) {
6552
- throw error2;
6553
- }
6554
- if (!data2) {
6555
- return null;
6556
- }
6557
- return data2;
6558
- };
6559
- const { data, error, isLoading, mutate } = useSWR3(queryKey, fetchEntity, {
6560
- fallbackData: null,
6561
- onErrorRetry: (error2, key, config) => {
6562
- if (error2.code == "entity_not_found") {
6563
- return false;
6564
- }
6565
- return true;
6566
- }
6567
- });
6568
- const {
6569
- check: checkAutumn,
6570
- attach: attachAutumn,
6571
- cancel: cancelAutumn,
6572
- track: trackAutumn
6573
- } = useAutumnBase({
6574
- AutumnContext: AutumnContext2
6575
- });
6576
- const allowed = (params2) => handleAllowed({ customer: data, params: params2 });
6577
- const check = (params2) => checkAutumn({ ...params2, entityId: entityId || void 0 });
6578
- const attach = (params2) => attachAutumn({ ...params2, entityId: entityId || void 0 });
6579
- const cancel = (params2) => cancelAutumn({ ...params2, entityId: entityId || void 0 });
6580
- const track = (params2) => trackAutumn({ ...params2, entityId: entityId || void 0 });
6581
- if (!entityId) {
6582
- return {
6583
- entity: null,
6584
- isLoading: false,
6585
- error: null,
6586
- refetch: mutate,
6587
- allowed,
6588
- check,
6589
- attach,
6590
- cancel,
6591
- track
6612
+ const currentValue = Number(value) || 0;
6613
+ const handleValueChange = (newValue) => {
6614
+ const syntheticEvent = {
6615
+ target: { value: String(newValue) }
6592
6616
  };
6593
- }
6594
- return {
6595
- entity: error ? null : data,
6596
- isLoading,
6597
- error,
6598
- refetch: mutate,
6599
- allowed,
6600
- check,
6601
- attach,
6602
- cancel,
6603
- track
6617
+ onChange(syntheticEvent);
6604
6618
  };
6619
+ return /* @__PURE__ */ jsxs5(
6620
+ "div",
6621
+ {
6622
+ className: cn(className, "au-flex au-flex-row au-items-center au-gap-4"),
6623
+ ...props,
6624
+ children: [
6625
+ /* @__PURE__ */ jsxs5("div", { className: "au-flex au-items-center au-gap-1", children: [
6626
+ /* @__PURE__ */ jsx13(
6627
+ Button,
6628
+ {
6629
+ variant: "outline",
6630
+ size: "icon",
6631
+ onClick: () => currentValue > 0 && handleValueChange(currentValue - 1),
6632
+ disabled: currentValue <= 0,
6633
+ className: "au-h-6 au-w-6 au-pb-0.5",
6634
+ children: "-"
6635
+ }
6636
+ ),
6637
+ /* @__PURE__ */ jsx13("span", { className: "au-w-8 au-text-center au-text-foreground", children: currentValue }),
6638
+ /* @__PURE__ */ jsx13(
6639
+ Button,
6640
+ {
6641
+ variant: "outline",
6642
+ size: "icon",
6643
+ onClick: () => handleValueChange(currentValue + 1),
6644
+ className: "au-h-6 au-w-6 au-pb-0.5",
6645
+ children: "+"
6646
+ }
6647
+ )
6648
+ ] }),
6649
+ children
6650
+ ]
6651
+ }
6652
+ );
6605
6653
  };
6606
-
6607
- // src/libraries/react/hooks/useEntity.tsx
6608
- var useEntity = (entityId, params) => {
6609
- return useEntityBase({ AutumnContext, entityId, params });
6610
- };
6611
-
6612
- // src/libraries/react/hooks/useAutumn.tsx
6613
- var useAutumn = () => {
6614
- return useAutumnBase({ AutumnContext });
6654
+ var TotalPrice = ({ children }) => {
6655
+ return /* @__PURE__ */ jsx13("div", { className: "au-w-full au-font-semibold au-flex au-justify-between au-items-center", children });
6615
6656
  };
6616
6657
 
6617
6658
  // src/libraries/react/components/check-dialog/check-dialog-synced.tsx