@unidy.io/sdk 1.1.9 → 1.1.10

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 (518) hide show
  1. package/dist/cjs/app-globals-Pb3mNuRv.js +10 -0
  2. package/dist/cjs/app-globals-Pb3mNuRv.js.map +1 -0
  3. package/dist/cjs/{auth-B83pzi0f.js → auth-ChsE2RD7.js} +45 -13
  4. package/dist/cjs/auth-ChsE2RD7.js.map +1 -0
  5. package/dist/cjs/{auth-store-DPHWWmXf.js → auth-store-BO38Txmj.js} +8 -4
  6. package/dist/cjs/auth-store-BO38Txmj.js.map +1 -0
  7. package/dist/cjs/{component-utils-BpMyeVQo.js → component-utils-bu3SY4dE.js} +9 -2
  8. package/dist/cjs/component-utils-bu3SY4dE.js.map +1 -0
  9. package/dist/cjs/{flash-store-BuIBuQDx.js → flash-store-D5vGuIFc.js} +3 -3
  10. package/dist/cjs/{flash-store-BuIBuQDx.js.map → flash-store-D5vGuIFc.js.map} +1 -1
  11. package/dist/cjs/{i18n-BoDZ8kd2.js → i18n-B2T1e9Mf.js} +432 -596
  12. package/dist/cjs/i18n-B2T1e9Mf.js.map +1 -0
  13. package/dist/cjs/{index-B_N5xKgH.js → index-BzhKFIXk.js} +3416 -735
  14. package/dist/cjs/index-BzhKFIXk.js.map +1 -0
  15. package/dist/cjs/{index-R2MKLaem.js → index-DmDGhWTM.js} +1621 -550
  16. package/dist/cjs/index-DmDGhWTM.js.map +1 -0
  17. package/dist/cjs/{index-DLz3FT7T.js → index-DxENvy7x.js} +92 -23
  18. package/dist/cjs/index-DxENvy7x.js.map +1 -0
  19. package/dist/cjs/index.cjs.js +13 -13
  20. package/dist/cjs/loader.cjs.js +3 -3
  21. package/dist/cjs/{newsletter-helpers-D-V_8kiN.js → newsletter-helpers-B5P7q8Xk.js} +8 -8
  22. package/dist/cjs/{newsletter-helpers-D-V_8kiN.js.map → newsletter-helpers-B5P7q8Xk.js.map} +1 -1
  23. package/dist/cjs/{newsletter-store-BzytX7Qh.js → newsletter-store-f5zhJljn.js} +3 -3
  24. package/dist/cjs/{newsletter-store-BzytX7Qh.js.map → newsletter-store-f5zhJljn.js.map} +1 -1
  25. package/dist/cjs/{pagination-store-BEiW3MQd.js → pagination-store-DjGYEIqm.js} +3 -3
  26. package/dist/cjs/{pagination-store-BEiW3MQd.js.map → pagination-store-DjGYEIqm.js.map} +1 -1
  27. package/dist/cjs/{profile-helpers-B2h2III_.js → profile-helpers-BcLjojeG.js} +4 -4
  28. package/dist/cjs/{profile-helpers-B2h2III_.js.map → profile-helpers-BcLjojeG.js.map} +1 -1
  29. package/dist/cjs/{profile-store-P_BcYkef.js → profile-store-BWJ9qAcg.js} +3 -3
  30. package/dist/cjs/{profile-store-P_BcYkef.js.map → profile-store-BWJ9qAcg.js.map} +1 -1
  31. package/dist/cjs/sdk.cjs.js +31 -4
  32. package/dist/cjs/sdk.cjs.js.map +1 -1
  33. package/dist/cjs/u-conditional-render.cjs.entry.js +12 -12
  34. package/dist/cjs/u-config.cjs.entry.js +18 -14
  35. package/dist/cjs/u-config.entry.cjs.js.map +1 -1
  36. package/dist/cjs/u-email-field.cjs.entry.js +7 -7
  37. package/dist/cjs/u-error-message.cjs.entry.js +7 -7
  38. package/dist/cjs/u-error-message.entry.cjs.js.map +1 -1
  39. package/dist/cjs/u-field.u-raw-field.entry.cjs.js.map +1 -1
  40. package/dist/cjs/u-field_2.cjs.entry.js +17 -21
  41. package/dist/cjs/u-flash-message.cjs.entry.js +4 -4
  42. package/dist/cjs/u-full-profile.cjs.entry.js +6 -6
  43. package/dist/cjs/u-full-profile.entry.cjs.js.map +1 -1
  44. package/dist/cjs/u-logout-button.u-signed-in.entry.cjs.js.map +1 -1
  45. package/dist/cjs/u-logout-button_2.cjs.entry.js +16 -14
  46. package/dist/cjs/u-magic-code-field.cjs.entry.js +11 -11
  47. package/dist/cjs/u-magic-code-field.entry.cjs.js.map +1 -1
  48. package/dist/cjs/u-missing-field.cjs.entry.js +4 -4
  49. package/dist/cjs/u-missing-field.entry.cjs.js.map +1 -1
  50. package/dist/cjs/u-missing-fields-submit-button.cjs.entry.js +9 -9
  51. package/dist/cjs/u-missing-fields-submit-button.entry.cjs.js.map +1 -1
  52. package/dist/cjs/u-newsletter-checkbox.cjs.entry.js +12 -12
  53. package/dist/cjs/u-newsletter-logout-button.cjs.entry.js +19 -14
  54. package/dist/cjs/u-newsletter-logout-button.entry.cjs.js.map +1 -1
  55. package/dist/cjs/u-newsletter-preference-checkbox.cjs.entry.js +13 -13
  56. package/dist/cjs/u-newsletter-preference-checkbox.entry.cjs.js.map +1 -1
  57. package/dist/cjs/u-newsletter-resend-doi-button.cjs.entry.js +13 -13
  58. package/dist/cjs/u-newsletter-root.cjs.entry.js +12 -12
  59. package/dist/cjs/u-newsletter-toggle-subscription-button.cjs.entry.js +13 -13
  60. package/dist/cjs/u-pagination-button.cjs.entry.js +1 -1
  61. package/dist/cjs/u-pagination-button.entry.cjs.js.map +1 -1
  62. package/dist/cjs/u-pagination-page.cjs.entry.js +1 -1
  63. package/dist/cjs/u-pagination-page.entry.cjs.js.map +1 -1
  64. package/dist/cjs/u-passkey.cjs.entry.js +10 -10
  65. package/dist/cjs/u-passkey.entry.cjs.js.map +1 -1
  66. package/dist/cjs/u-password-field.cjs.entry.js +5 -5
  67. package/dist/cjs/u-profile.u-submit-button.entry.cjs.js.map +1 -1
  68. package/dist/cjs/u-profile_2.cjs.entry.js +17 -15
  69. package/dist/cjs/u-registration-button.cjs.entry.js +5 -5
  70. package/dist/cjs/u-registration-button.entry.cjs.js.map +1 -1
  71. package/dist/cjs/u-reset-password-button.cjs.entry.js +10 -10
  72. package/dist/cjs/u-send-magic-code-button.cjs.entry.js +10 -10
  73. package/dist/cjs/u-send-magic-code-button.entry.cjs.js.map +1 -1
  74. package/dist/cjs/u-signin-root.cjs.entry.js +6 -6
  75. package/dist/cjs/u-signin-step.cjs.entry.js +10 -10
  76. package/dist/cjs/u-signin-step.entry.cjs.js.map +1 -1
  77. package/dist/cjs/u-signin-strategy.cjs.entry.js +4 -4
  78. package/dist/cjs/u-social-login-button.cjs.entry.js +11 -11
  79. package/dist/cjs/u-social-login-button.entry.cjs.js.map +1 -1
  80. package/dist/cjs/u-spinner.cjs.entry.js +2 -2
  81. package/dist/cjs/u-spinner.entry.cjs.js.map +1 -1
  82. package/dist/cjs/u-ticketable-list.cjs.entry.js +13 -13
  83. package/dist/cjs/{unidy-store-7AbWnZ6g.js → unidy-store-zhdhlK0a.js} +3 -3
  84. package/dist/cjs/{unidy-store-7AbWnZ6g.js.map → unidy-store-zhdhlK0a.js.map} +1 -1
  85. package/dist/collection/api/client.js.map +1 -1
  86. package/dist/collection/api/index.js +2 -2
  87. package/dist/collection/api/index.js.map +1 -1
  88. package/dist/collection/auth/api/auth.js +12 -2
  89. package/dist/collection/auth/api/auth.js.map +1 -1
  90. package/dist/collection/auth/auth-helpers.js +18 -1
  91. package/dist/collection/auth/auth-helpers.js.map +1 -1
  92. package/dist/collection/auth/auth.js +17 -2
  93. package/dist/collection/auth/auth.js.map +1 -1
  94. package/dist/collection/auth/components/logout-button/logout-button.js +5 -3
  95. package/dist/collection/auth/components/logout-button/logout-button.js.map +1 -1
  96. package/dist/collection/auth/components/magic-code-field/magic-code-field.css +1 -1
  97. package/dist/collection/auth/components/magic-code-field/magic-code-field.js +1 -1
  98. package/dist/collection/auth/components/magic-code-field/magic-code-field.js.map +1 -1
  99. package/dist/collection/auth/components/missing-field/missing-field.js.map +1 -1
  100. package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js +3 -3
  101. package/dist/collection/auth/components/missing-fields-submit-button/missing-fields-submit-button.js.map +1 -1
  102. package/dist/collection/auth/components/passkey/passkey.js +2 -2
  103. package/dist/collection/auth/components/passkey/passkey.js.map +1 -1
  104. package/dist/collection/auth/components/password-field/password-field.js +1 -1
  105. package/dist/collection/auth/components/registration/registration-button.js +2 -2
  106. package/dist/collection/auth/components/registration/registration-button.js.map +1 -1
  107. package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js +1 -1
  108. package/dist/collection/auth/components/send-magic-code-button/send-magic-code-button.js.map +1 -1
  109. package/dist/collection/auth/components/signed-in/signed-in.js.map +1 -1
  110. package/dist/collection/auth/components/signin-step/signin-step.js +1 -1
  111. package/dist/collection/auth/components/signin-step/signin-step.js.map +1 -1
  112. package/dist/collection/auth/components/social-logins/social-login-button.css +1 -1
  113. package/dist/collection/auth/components/social-logins/social-login-button.js +4 -4
  114. package/dist/collection/auth/components/social-logins/social-login-button.js.map +1 -1
  115. package/dist/collection/auth/index.js +1 -2
  116. package/dist/collection/auth/index.js.map +1 -1
  117. package/dist/collection/auth/store/auth-store.js +4 -0
  118. package/dist/collection/auth/store/auth-store.js.map +1 -1
  119. package/dist/collection/globalScript.js +1 -1
  120. package/dist/collection/globalScript.js.map +1 -1
  121. package/dist/collection/i18n.js +1 -1
  122. package/dist/collection/i18n.js.map +1 -1
  123. package/dist/collection/index.js +1 -1
  124. package/dist/collection/index.js.map +1 -1
  125. package/dist/collection/logger.js.map +1 -1
  126. package/dist/collection/newsletter/api/newsletters.js +1 -1
  127. package/dist/collection/newsletter/api/newsletters.js.map +1 -1
  128. package/dist/collection/newsletter/components/logout-button/logout-button.js +10 -5
  129. package/dist/collection/newsletter/components/logout-button/logout-button.js.map +1 -1
  130. package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js +2 -3
  131. package/dist/collection/newsletter/components/preference-checkbox/preference-checkbox.js.map +1 -1
  132. package/dist/collection/newsletter/components/resend-doi-button/resend-doi-button.css +1 -1
  133. package/dist/collection/newsletter/components/toggle-subscription-button/toggle-subscription-button.css +1 -1
  134. package/dist/collection/profile/components/field/field.css +1 -1
  135. package/dist/collection/profile/components/field/field.js +1 -5
  136. package/dist/collection/profile/components/field/field.js.map +1 -1
  137. package/dist/collection/profile/components/full-profile/full-profile.css +1 -1
  138. package/dist/collection/profile/components/raw-field/raw-field.js +5 -5
  139. package/dist/collection/profile/components/raw-field/raw-field.js.map +1 -1
  140. package/dist/collection/profile/index.js +1 -2
  141. package/dist/collection/profile/index.js.map +1 -1
  142. package/dist/collection/profile/profile-helpers.js +1 -1
  143. package/dist/collection/profile/profile-helpers.js.map +1 -1
  144. package/dist/collection/shared/component-utils.js +7 -0
  145. package/dist/collection/shared/component-utils.js.map +1 -1
  146. package/dist/collection/shared/components/config/config.js +28 -4
  147. package/dist/collection/shared/components/config/config.js.map +1 -1
  148. package/dist/collection/shared/components/email-field/email-field.css +1 -1
  149. package/dist/collection/shared/components/error-message/error-message.js.map +1 -1
  150. package/dist/collection/shared/components/flash-message/flash-message.css +1 -1
  151. package/dist/collection/shared/components/spinner/spinner.css +1 -1
  152. package/dist/collection/shared/components/spinner/spinner.js +1 -1
  153. package/dist/collection/shared/components/spinner/spinner.js.map +1 -1
  154. package/dist/collection/shared/components/submit-button/submit-button.css +1 -1
  155. package/dist/collection/shared/components/submit-button/submit-button.js +2 -0
  156. package/dist/collection/shared/components/submit-button/submit-button.js.map +1 -1
  157. package/dist/collection/ticketable/api/get-with-schema.js.map +1 -1
  158. package/dist/collection/ticketable/api/schemas.js +1 -1
  159. package/dist/collection/ticketable/api/schemas.js.map +1 -1
  160. package/dist/collection/ticketable/api/subscriptions.js +2 -2
  161. package/dist/collection/ticketable/api/subscriptions.js.map +1 -1
  162. package/dist/collection/ticketable/api/tickets.js +2 -2
  163. package/dist/collection/ticketable/api/tickets.js.map +1 -1
  164. package/dist/collection/ticketable/components/pagination/pagination-button.js +1 -1
  165. package/dist/collection/ticketable/components/pagination/pagination-button.js.map +1 -1
  166. package/dist/collection/ticketable/components/pagination/pagination-page.js +1 -1
  167. package/dist/collection/ticketable/components/pagination/pagination-page.js.map +1 -1
  168. package/dist/collection/ticketable/index.js +1 -1
  169. package/dist/collection/ticketable/index.js.map +1 -1
  170. package/dist/components/auth-store.js +4 -0
  171. package/dist/components/auth-store.js.map +1 -1
  172. package/dist/components/auth.js +36 -4
  173. package/dist/components/auth.js.map +1 -1
  174. package/dist/components/component-utils.js +7 -0
  175. package/dist/components/component-utils.js.map +1 -1
  176. package/dist/components/exports.js +260 -104
  177. package/dist/components/exports.js.map +1 -1
  178. package/dist/components/field.js +4 -14
  179. package/dist/components/field.js.map +1 -1
  180. package/dist/components/i18n.js +429 -593
  181. package/dist/components/i18n.js.map +1 -1
  182. package/dist/components/index.js +424 -397
  183. package/dist/components/index.js.map +1 -1
  184. package/dist/components/index2.js +1562 -491
  185. package/dist/components/index2.js.map +1 -1
  186. package/dist/components/index3.js +90 -21
  187. package/dist/components/index3.js.map +1 -1
  188. package/dist/components/logger.js.map +1 -1
  189. package/dist/components/profile-helpers.js +1 -1
  190. package/dist/components/profile-helpers.js.map +1 -1
  191. package/dist/components/profile-store.js +1 -1
  192. package/dist/components/profile.js +3 -3
  193. package/dist/components/raw-field.js +11 -11
  194. package/dist/components/raw-field.js.map +1 -1
  195. package/dist/components/spinner.js +1 -1
  196. package/dist/components/spinner.js.map +1 -1
  197. package/dist/components/submit-button.js +3 -1
  198. package/dist/components/submit-button.js.map +1 -1
  199. package/dist/components/u-conditional-render.js +1 -1
  200. package/dist/components/u-config.js +10 -5
  201. package/dist/components/u-config.js.map +1 -1
  202. package/dist/components/u-email-field.js +1 -1
  203. package/dist/components/u-error-message.js.map +1 -1
  204. package/dist/components/u-flash-message.js +1 -1
  205. package/dist/components/u-full-profile.js +1 -1
  206. package/dist/components/u-full-profile.js.map +1 -1
  207. package/dist/components/u-logout-button.js +5 -3
  208. package/dist/components/u-logout-button.js.map +1 -1
  209. package/dist/components/u-magic-code-field.js +2 -2
  210. package/dist/components/u-magic-code-field.js.map +1 -1
  211. package/dist/components/u-missing-field.js +4 -10
  212. package/dist/components/u-missing-field.js.map +1 -1
  213. package/dist/components/u-missing-fields-submit-button.js +3 -3
  214. package/dist/components/u-missing-fields-submit-button.js.map +1 -1
  215. package/dist/components/u-newsletter-logout-button.js +9 -4
  216. package/dist/components/u-newsletter-logout-button.js.map +1 -1
  217. package/dist/components/u-newsletter-preference-checkbox.js +1 -1
  218. package/dist/components/u-newsletter-preference-checkbox.js.map +1 -1
  219. package/dist/components/u-newsletter-resend-doi-button.js +1 -1
  220. package/dist/components/u-newsletter-toggle-subscription-button.js +1 -1
  221. package/dist/components/u-pagination-button.js.map +1 -1
  222. package/dist/components/u-pagination-page.js.map +1 -1
  223. package/dist/components/u-passkey.js +1 -1
  224. package/dist/components/u-passkey.js.map +1 -1
  225. package/dist/components/u-registration-button.js +2 -2
  226. package/dist/components/u-registration-button.js.map +1 -1
  227. package/dist/components/u-send-magic-code-button.js +1 -1
  228. package/dist/components/u-send-magic-code-button.js.map +1 -1
  229. package/dist/components/u-signed-in.js.map +1 -1
  230. package/dist/components/u-signin-step.js +1 -1
  231. package/dist/components/u-signin-step.js.map +1 -1
  232. package/dist/components/u-social-login-button.js +8 -8
  233. package/dist/components/u-social-login-button.js.map +1 -1
  234. package/dist/components/u-ticketable-list.js +1 -1
  235. package/dist/esm/app-globals-BHWOrMsm.js +8 -0
  236. package/dist/esm/app-globals-BHWOrMsm.js.map +1 -0
  237. package/dist/esm/{auth-B0RIcDM-.js → auth-CAHM6e4m.js} +45 -13
  238. package/dist/esm/auth-CAHM6e4m.js.map +1 -0
  239. package/dist/esm/{auth-store-BGMYm_jK.js → auth-store-ItTnEMlF.js} +8 -4
  240. package/dist/esm/auth-store-ItTnEMlF.js.map +1 -0
  241. package/dist/esm/{component-utils-D1lzXl_Z.js → component-utils-BGq0leDV.js} +9 -2
  242. package/dist/esm/component-utils-BGq0leDV.js.map +1 -0
  243. package/dist/esm/{flash-store-CEvWSG0c.js → flash-store-CMXH65i_.js} +3 -3
  244. package/dist/esm/{flash-store-CEvWSG0c.js.map → flash-store-CMXH65i_.js.map} +1 -1
  245. package/dist/esm/{i18n-CLdWzy5J.js → i18n-OKf8uE5j.js} +432 -596
  246. package/dist/esm/i18n-OKf8uE5j.js.map +1 -0
  247. package/dist/esm/{index-Ci3aTmzp.js → index-COQ27Nb6.js} +3411 -734
  248. package/dist/esm/index-COQ27Nb6.js.map +1 -0
  249. package/dist/esm/{index-Bjp1XO-f.js → index-DVkRTYPC.js} +92 -23
  250. package/dist/esm/index-DVkRTYPC.js.map +1 -0
  251. package/dist/esm/{index-DSDkaHWI.js → index-Du3hUdhU.js} +1622 -551
  252. package/dist/esm/index-Du3hUdhU.js.map +1 -0
  253. package/dist/esm/index.js +11 -11
  254. package/dist/esm/loader.js +4 -4
  255. package/dist/esm/{newsletter-helpers-CONtbKYi.js → newsletter-helpers-ChXON0f4.js} +8 -8
  256. package/dist/esm/{newsletter-helpers-CONtbKYi.js.map → newsletter-helpers-ChXON0f4.js.map} +1 -1
  257. package/dist/esm/{newsletter-store-DBL1A203.js → newsletter-store-CIsyE51r.js} +3 -3
  258. package/dist/esm/{newsletter-store-DBL1A203.js.map → newsletter-store-CIsyE51r.js.map} +1 -1
  259. package/dist/esm/{pagination-store-DzdJOp-n.js → pagination-store-B9lk_lqK.js} +3 -3
  260. package/dist/esm/{pagination-store-DzdJOp-n.js.map → pagination-store-B9lk_lqK.js.map} +1 -1
  261. package/dist/esm/{profile-helpers-CglNd6Nw.js → profile-helpers-Beduxnin.js} +4 -4
  262. package/dist/esm/{profile-helpers-CglNd6Nw.js.map → profile-helpers-Beduxnin.js.map} +1 -1
  263. package/dist/esm/{profile-store-RmZB2PTc.js → profile-store-CsSDT9Tb.js} +4 -4
  264. package/dist/esm/{profile-store-RmZB2PTc.js.map → profile-store-CsSDT9Tb.js.map} +1 -1
  265. package/dist/esm/sdk.js +32 -5
  266. package/dist/esm/sdk.js.map +1 -1
  267. package/dist/esm/u-conditional-render.entry.js +12 -12
  268. package/dist/esm/u-config.entry.js +18 -14
  269. package/dist/esm/u-config.entry.js.map +1 -1
  270. package/dist/esm/u-email-field.entry.js +7 -7
  271. package/dist/esm/u-error-message.entry.js +7 -7
  272. package/dist/esm/u-error-message.entry.js.map +1 -1
  273. package/dist/esm/u-field.u-raw-field.entry.js.map +1 -1
  274. package/dist/esm/u-field_2.entry.js +17 -21
  275. package/dist/esm/u-flash-message.entry.js +4 -4
  276. package/dist/esm/u-full-profile.entry.js +6 -6
  277. package/dist/esm/u-full-profile.entry.js.map +1 -1
  278. package/dist/esm/u-logout-button.u-signed-in.entry.js.map +1 -1
  279. package/dist/esm/u-logout-button_2.entry.js +16 -14
  280. package/dist/esm/u-magic-code-field.entry.js +11 -11
  281. package/dist/esm/u-magic-code-field.entry.js.map +1 -1
  282. package/dist/esm/u-missing-field.entry.js +4 -4
  283. package/dist/esm/u-missing-field.entry.js.map +1 -1
  284. package/dist/esm/u-missing-fields-submit-button.entry.js +9 -9
  285. package/dist/esm/u-missing-fields-submit-button.entry.js.map +1 -1
  286. package/dist/esm/u-newsletter-checkbox.entry.js +12 -12
  287. package/dist/esm/u-newsletter-logout-button.entry.js +19 -14
  288. package/dist/esm/u-newsletter-logout-button.entry.js.map +1 -1
  289. package/dist/esm/u-newsletter-preference-checkbox.entry.js +13 -13
  290. package/dist/esm/u-newsletter-preference-checkbox.entry.js.map +1 -1
  291. package/dist/esm/u-newsletter-resend-doi-button.entry.js +13 -13
  292. package/dist/esm/u-newsletter-root.entry.js +12 -12
  293. package/dist/esm/u-newsletter-toggle-subscription-button.entry.js +13 -13
  294. package/dist/esm/u-pagination-button.entry.js +1 -1
  295. package/dist/esm/u-pagination-button.entry.js.map +1 -1
  296. package/dist/esm/u-pagination-page.entry.js +1 -1
  297. package/dist/esm/u-pagination-page.entry.js.map +1 -1
  298. package/dist/esm/u-passkey.entry.js +10 -10
  299. package/dist/esm/u-passkey.entry.js.map +1 -1
  300. package/dist/esm/u-password-field.entry.js +5 -5
  301. package/dist/esm/u-profile.u-submit-button.entry.js.map +1 -1
  302. package/dist/esm/u-profile_2.entry.js +17 -15
  303. package/dist/esm/u-registration-button.entry.js +5 -5
  304. package/dist/esm/u-registration-button.entry.js.map +1 -1
  305. package/dist/esm/u-reset-password-button.entry.js +10 -10
  306. package/dist/esm/u-send-magic-code-button.entry.js +10 -10
  307. package/dist/esm/u-send-magic-code-button.entry.js.map +1 -1
  308. package/dist/esm/u-signin-root.entry.js +6 -6
  309. package/dist/esm/u-signin-step.entry.js +10 -10
  310. package/dist/esm/u-signin-step.entry.js.map +1 -1
  311. package/dist/esm/u-signin-strategy.entry.js +4 -4
  312. package/dist/esm/u-social-login-button.entry.js +11 -11
  313. package/dist/esm/u-social-login-button.entry.js.map +1 -1
  314. package/dist/esm/u-spinner.entry.js +2 -2
  315. package/dist/esm/u-spinner.entry.js.map +1 -1
  316. package/dist/esm/u-ticketable-list.entry.js +13 -13
  317. package/dist/esm/{unidy-store-BldTAtO0.js → unidy-store-CAcMVdD8.js} +3 -3
  318. package/dist/esm/{unidy-store-BldTAtO0.js.map → unidy-store-CAcMVdD8.js.map} +1 -1
  319. package/dist/sdk/index.esm.js +1 -1
  320. package/dist/sdk/{p-93200fb4.entry.js → p-1bad3fd0.entry.js} +2 -2
  321. package/dist/sdk/{p-22e4d08b.entry.js → p-1d6982cd.entry.js} +2 -2
  322. package/dist/sdk/p-23d8e922.entry.js +2 -0
  323. package/dist/sdk/p-2855d3bb.entry.js +2 -0
  324. package/dist/sdk/p-2855d3bb.entry.js.map +1 -0
  325. package/dist/sdk/{p-339f32c1.entry.js → p-288f37c3.entry.js} +2 -2
  326. package/dist/sdk/{p-339f32c1.entry.js.map → p-288f37c3.entry.js.map} +1 -1
  327. package/dist/sdk/p-32842e98.entry.js +2 -0
  328. package/dist/sdk/p-32842e98.entry.js.map +1 -0
  329. package/dist/sdk/p-34af7470.entry.js +2 -0
  330. package/dist/sdk/p-39126514.entry.js +2 -0
  331. package/dist/sdk/{p-2af8b45f.entry.js.map → p-39126514.entry.js.map} +1 -1
  332. package/dist/sdk/{p-ad796888.entry.js → p-438f62e5.entry.js} +2 -2
  333. package/dist/sdk/{p-ad796888.entry.js.map → p-438f62e5.entry.js.map} +1 -1
  334. package/dist/sdk/{p-bb603b00.entry.js → p-46013b2f.entry.js} +2 -2
  335. package/dist/sdk/{p-08ff2de2.entry.js → p-46cdb255.entry.js} +2 -2
  336. package/dist/sdk/{p-a5db968f.entry.js → p-4d9bde6e.entry.js} +2 -2
  337. package/dist/sdk/{p-b0917777.entry.js → p-5c40c6ea.entry.js} +2 -2
  338. package/dist/sdk/p-5c8b31bd.entry.js +2 -0
  339. package/dist/sdk/p-5c8b31bd.entry.js.map +1 -0
  340. package/dist/sdk/{p-c31dbbb4.entry.js → p-69172b22.entry.js} +2 -2
  341. package/dist/sdk/p-69172b22.entry.js.map +1 -0
  342. package/dist/sdk/p-7381aca7.entry.js +2 -0
  343. package/dist/sdk/{p-6893d167.entry.js.map → p-7381aca7.entry.js.map} +1 -1
  344. package/dist/sdk/{p-D1lzXl_Z.js → p-BGq0leDV.js} +1 -1
  345. package/dist/sdk/p-BGq0leDV.js.map +1 -0
  346. package/dist/sdk/p-BR6L248H.js +2 -0
  347. package/dist/sdk/p-BR6L248H.js.map +1 -0
  348. package/dist/sdk/p-BhrvnKAS.js +2 -0
  349. package/dist/sdk/{p-Ce8zGAi1.js.map → p-BhrvnKAS.js.map} +1 -1
  350. package/dist/sdk/p-CMw6v6sC.js +2 -0
  351. package/dist/sdk/p-CMw6v6sC.js.map +1 -0
  352. package/dist/sdk/p-COQ27Nb6.js +14 -0
  353. package/dist/sdk/p-COQ27Nb6.js.map +1 -0
  354. package/dist/sdk/p-CSLU6kes.js +2 -0
  355. package/dist/sdk/{p-CPPYdoIv.js.map → p-CSLU6kes.js.map} +1 -1
  356. package/dist/sdk/p-Cai8JwlG.js +2 -0
  357. package/dist/sdk/p-Cai8JwlG.js.map +1 -0
  358. package/dist/sdk/{p-DYtgart8.js → p-CpJghKnM.js} +2 -2
  359. package/dist/sdk/{p-DYtgart8.js.map → p-CpJghKnM.js.map} +1 -1
  360. package/dist/sdk/p-DAn4FkxC.js +2 -0
  361. package/dist/sdk/{p-C0feI0p8.js.map → p-DAn4FkxC.js.map} +1 -1
  362. package/dist/sdk/p-FFRhPCmc.js +2 -0
  363. package/dist/sdk/{p-DA84OuuU.js.map → p-FFRhPCmc.js.map} +1 -1
  364. package/dist/sdk/p-Jrp0G45B.js +2 -0
  365. package/dist/sdk/{p-BlOjABPD.js.map → p-Jrp0G45B.js.map} +1 -1
  366. package/dist/sdk/p-MA26cw6g.js +2 -0
  367. package/dist/sdk/p-MA26cw6g.js.map +1 -0
  368. package/dist/sdk/p-P0eZf5rH.js +2 -0
  369. package/dist/sdk/p-P0eZf5rH.js.map +1 -0
  370. package/dist/sdk/{p-S3-2d2Qd.js → p-PSIHL0wP.js} +2 -2
  371. package/dist/sdk/{p-S3-2d2Qd.js.map → p-PSIHL0wP.js.map} +1 -1
  372. package/dist/sdk/p-a341c7f6.entry.js +2 -0
  373. package/dist/sdk/p-a341c7f6.entry.js.map +1 -0
  374. package/dist/sdk/p-a38cd448.entry.js +2 -0
  375. package/dist/sdk/{p-593c6dde.entry.js.map → p-a38cd448.entry.js.map} +1 -1
  376. package/dist/sdk/{p-87d10077.entry.js → p-a45ef398.entry.js} +2 -2
  377. package/dist/sdk/{p-87d10077.entry.js.map → p-a45ef398.entry.js.map} +1 -1
  378. package/dist/sdk/p-b5a6ad01.entry.js +2 -0
  379. package/dist/sdk/p-b5a6ad01.entry.js.map +1 -0
  380. package/dist/sdk/{p-9f59909b.entry.js → p-b93bf91d.entry.js} +2 -2
  381. package/dist/sdk/{p-9f59909b.entry.js.map → p-b93bf91d.entry.js.map} +1 -1
  382. package/dist/sdk/{p-09cd77e6.entry.js → p-baf5dcb7.entry.js} +2 -2
  383. package/dist/sdk/p-c07a43e2.entry.js +2 -0
  384. package/dist/sdk/p-c07a43e2.entry.js.map +1 -0
  385. package/dist/sdk/p-c98ad60d.entry.js +2 -0
  386. package/dist/sdk/p-c98ad60d.entry.js.map +1 -0
  387. package/dist/sdk/{p-f5615938.entry.js → p-d0c0fb6b.entry.js} +2 -2
  388. package/dist/sdk/p-d47aaf26.entry.js +2 -0
  389. package/dist/sdk/p-d47aaf26.entry.js.map +1 -0
  390. package/dist/sdk/p-e5ef30ef.entry.js +2 -0
  391. package/dist/sdk/p-eb348798.entry.js +2 -0
  392. package/dist/sdk/{p-73c2ec89.entry.js.map → p-eb348798.entry.js.map} +1 -1
  393. package/dist/sdk/p-f82f500d.entry.js +2 -0
  394. package/dist/sdk/p-f82f500d.entry.js.map +1 -0
  395. package/dist/sdk/p-f88ed6e8.entry.js +2 -0
  396. package/dist/sdk/p-f88ed6e8.entry.js.map +1 -0
  397. package/dist/sdk/{p-afc65acd.entry.js → p-f9affafe.entry.js} +2 -2
  398. package/dist/sdk/p-jyF1XwDG.js +2 -0
  399. package/dist/sdk/p-jyF1XwDG.js.map +1 -0
  400. package/dist/sdk/sdk.esm.js +1 -1
  401. package/dist/sdk/sdk.esm.js.map +1 -1
  402. package/dist/sdk/u-config.entry.esm.js.map +1 -1
  403. package/dist/sdk/u-error-message.entry.esm.js.map +1 -1
  404. package/dist/sdk/u-field.u-raw-field.entry.esm.js.map +1 -1
  405. package/dist/sdk/u-full-profile.entry.esm.js.map +1 -1
  406. package/dist/sdk/u-logout-button.u-signed-in.entry.esm.js.map +1 -1
  407. package/dist/sdk/u-magic-code-field.entry.esm.js.map +1 -1
  408. package/dist/sdk/u-missing-field.entry.esm.js.map +1 -1
  409. package/dist/sdk/u-missing-fields-submit-button.entry.esm.js.map +1 -1
  410. package/dist/sdk/u-newsletter-logout-button.entry.esm.js.map +1 -1
  411. package/dist/sdk/u-newsletter-preference-checkbox.entry.esm.js.map +1 -1
  412. package/dist/sdk/u-pagination-button.entry.esm.js.map +1 -1
  413. package/dist/sdk/u-pagination-page.entry.esm.js.map +1 -1
  414. package/dist/sdk/u-passkey.entry.esm.js.map +1 -1
  415. package/dist/sdk/u-profile.u-submit-button.entry.esm.js.map +1 -1
  416. package/dist/sdk/u-registration-button.entry.esm.js.map +1 -1
  417. package/dist/sdk/u-send-magic-code-button.entry.esm.js.map +1 -1
  418. package/dist/sdk/u-signin-step.entry.esm.js.map +1 -1
  419. package/dist/sdk/u-social-login-button.entry.esm.js.map +1 -1
  420. package/dist/sdk/u-spinner.entry.esm.js.map +1 -1
  421. package/dist/types/api/index.d.ts +2 -2
  422. package/dist/types/auth/api/auth.d.ts +3 -1
  423. package/dist/types/auth/auth-helpers.d.ts +1 -0
  424. package/dist/types/auth/auth.d.ts +9 -1
  425. package/dist/types/auth/components/logout-button/logout-button.d.ts +1 -1
  426. package/dist/types/auth/index.d.ts +3 -4
  427. package/dist/types/auth/store/auth-store.d.ts +2 -0
  428. package/dist/types/components.d.ts +8 -0
  429. package/dist/types/index.d.ts +2 -2
  430. package/dist/types/logger.d.ts +1 -1
  431. package/dist/types/newsletter/api/newsletters.d.ts +1 -1
  432. package/dist/types/newsletter/components/logout-button/logout-button.d.ts +2 -0
  433. package/dist/types/profile/components/field/field.d.ts +0 -1
  434. package/dist/types/profile/components/raw-field/raw-field.d.ts +2 -2
  435. package/dist/types/profile/index.d.ts +2 -3
  436. package/dist/types/shared/component-utils.d.ts +7 -0
  437. package/dist/types/shared/components/config/config.d.ts +1 -0
  438. package/dist/types/ticketable/api/get-with-schema.d.ts +1 -1
  439. package/dist/types/ticketable/index.d.ts +1 -1
  440. package/package.json +23 -18
  441. package/dist/cjs/app-globals-DSKjcXX_.js +0 -10
  442. package/dist/cjs/app-globals-DSKjcXX_.js.map +0 -1
  443. package/dist/cjs/auth-B83pzi0f.js.map +0 -1
  444. package/dist/cjs/auth-store-DPHWWmXf.js.map +0 -1
  445. package/dist/cjs/component-utils-BpMyeVQo.js.map +0 -1
  446. package/dist/cjs/i18n-BoDZ8kd2.js.map +0 -1
  447. package/dist/cjs/index-B_N5xKgH.js.map +0 -1
  448. package/dist/cjs/index-DLz3FT7T.js.map +0 -1
  449. package/dist/cjs/index-R2MKLaem.js.map +0 -1
  450. package/dist/esm/app-globals-CPU9ZcqZ.js +0 -8
  451. package/dist/esm/app-globals-CPU9ZcqZ.js.map +0 -1
  452. package/dist/esm/auth-B0RIcDM-.js.map +0 -1
  453. package/dist/esm/auth-store-BGMYm_jK.js.map +0 -1
  454. package/dist/esm/component-utils-D1lzXl_Z.js.map +0 -1
  455. package/dist/esm/i18n-CLdWzy5J.js.map +0 -1
  456. package/dist/esm/index-Bjp1XO-f.js.map +0 -1
  457. package/dist/esm/index-Ci3aTmzp.js.map +0 -1
  458. package/dist/esm/index-DSDkaHWI.js.map +0 -1
  459. package/dist/sdk/p-1176c407.entry.js +0 -2
  460. package/dist/sdk/p-1176c407.entry.js.map +0 -1
  461. package/dist/sdk/p-2a65bcbb.entry.js +0 -2
  462. package/dist/sdk/p-2a65bcbb.entry.js.map +0 -1
  463. package/dist/sdk/p-2af8b45f.entry.js +0 -2
  464. package/dist/sdk/p-56abb377.entry.js +0 -2
  465. package/dist/sdk/p-56abb377.entry.js.map +0 -1
  466. package/dist/sdk/p-593c6dde.entry.js +0 -2
  467. package/dist/sdk/p-5b627aea.entry.js +0 -2
  468. package/dist/sdk/p-5b627aea.entry.js.map +0 -1
  469. package/dist/sdk/p-628ccd68.entry.js +0 -2
  470. package/dist/sdk/p-675eb13d.entry.js +0 -2
  471. package/dist/sdk/p-675eb13d.entry.js.map +0 -1
  472. package/dist/sdk/p-6893d167.entry.js +0 -2
  473. package/dist/sdk/p-6a642433.entry.js +0 -2
  474. package/dist/sdk/p-73c2ec89.entry.js +0 -2
  475. package/dist/sdk/p-91bb8b59.entry.js +0 -2
  476. package/dist/sdk/p-91bb8b59.entry.js.map +0 -1
  477. package/dist/sdk/p-BZ1kW_eK.js +0 -2
  478. package/dist/sdk/p-BZ1kW_eK.js.map +0 -1
  479. package/dist/sdk/p-BlAULXyw.js +0 -2
  480. package/dist/sdk/p-BlAULXyw.js.map +0 -1
  481. package/dist/sdk/p-BlOjABPD.js +0 -2
  482. package/dist/sdk/p-C0feI0p8.js +0 -2
  483. package/dist/sdk/p-C3fhudPT.js +0 -2
  484. package/dist/sdk/p-C3fhudPT.js.map +0 -1
  485. package/dist/sdk/p-CFiZLMAA.js +0 -2
  486. package/dist/sdk/p-CFiZLMAA.js.map +0 -1
  487. package/dist/sdk/p-CPPYdoIv.js +0 -2
  488. package/dist/sdk/p-CbRhHGU5.js +0 -2
  489. package/dist/sdk/p-CbRhHGU5.js.map +0 -1
  490. package/dist/sdk/p-Ce8zGAi1.js +0 -2
  491. package/dist/sdk/p-Ci3aTmzp.js +0 -3
  492. package/dist/sdk/p-Ci3aTmzp.js.map +0 -1
  493. package/dist/sdk/p-D1lzXl_Z.js.map +0 -1
  494. package/dist/sdk/p-DA84OuuU.js +0 -2
  495. package/dist/sdk/p-DdUvQelg.js +0 -2
  496. package/dist/sdk/p-DdUvQelg.js.map +0 -1
  497. package/dist/sdk/p-b0728464.entry.js +0 -2
  498. package/dist/sdk/p-b0728464.entry.js.map +0 -1
  499. package/dist/sdk/p-c197fdb3.entry.js +0 -2
  500. package/dist/sdk/p-c197fdb3.entry.js.map +0 -1
  501. package/dist/sdk/p-c31dbbb4.entry.js.map +0 -1
  502. package/dist/sdk/p-c5bffd90.entry.js +0 -2
  503. package/dist/sdk/p-f0598e42.entry.js +0 -2
  504. package/dist/sdk/p-f0598e42.entry.js.map +0 -1
  505. package/dist/sdk/p-ffac964c.entry.js +0 -2
  506. package/dist/sdk/p-ffac964c.entry.js.map +0 -1
  507. /package/dist/sdk/{p-93200fb4.entry.js.map → p-1bad3fd0.entry.js.map} +0 -0
  508. /package/dist/sdk/{p-22e4d08b.entry.js.map → p-1d6982cd.entry.js.map} +0 -0
  509. /package/dist/sdk/{p-6a642433.entry.js.map → p-23d8e922.entry.js.map} +0 -0
  510. /package/dist/sdk/{p-c5bffd90.entry.js.map → p-34af7470.entry.js.map} +0 -0
  511. /package/dist/sdk/{p-bb603b00.entry.js.map → p-46013b2f.entry.js.map} +0 -0
  512. /package/dist/sdk/{p-08ff2de2.entry.js.map → p-46cdb255.entry.js.map} +0 -0
  513. /package/dist/sdk/{p-a5db968f.entry.js.map → p-4d9bde6e.entry.js.map} +0 -0
  514. /package/dist/sdk/{p-b0917777.entry.js.map → p-5c40c6ea.entry.js.map} +0 -0
  515. /package/dist/sdk/{p-09cd77e6.entry.js.map → p-baf5dcb7.entry.js.map} +0 -0
  516. /package/dist/sdk/{p-f5615938.entry.js.map → p-d0c0fb6b.entry.js.map} +0 -0
  517. /package/dist/sdk/{p-628ccd68.entry.js.map → p-e5ef30ef.entry.js.map} +0 -0
  518. /package/dist/sdk/{p-afc65acd.entry.js.map → p-f9affafe.entry.js.map} +0 -0
@@ -1,167 +1,35 @@
1
- import { t } from './i18n-CLdWzy5J.js';
2
- import { e as createLogger, d as captureException } from './index-Ci3aTmzp.js';
3
- import './profile-store-RmZB2PTc.js';
4
- import { u as unidyState } from './unidy-store-BldTAtO0.js';
5
-
6
- class ApiClient {
7
- baseUrl;
8
- api_key;
9
- static CONNECTION_ERROR_MESSAGES = [
10
- "Failed to fetch",
11
- "NetworkError",
12
- "ERR_CONNECTION_REFUSED",
13
- "ERR_NETWORK",
14
- "ERR_INTERNET_DISCONNECTED",
15
- ];
16
- onConnectionChange;
17
- logger = createLogger("ApiClient");
18
- constructor(baseUrl, api_key, onConnectionChange) {
19
- this.baseUrl = baseUrl;
20
- this.api_key = api_key;
21
- this.api_key = api_key;
22
- this.onConnectionChange = onConnectionChange;
23
- }
24
- isConnectionError(error) {
25
- if (error instanceof Error) {
26
- return ApiClient.CONNECTION_ERROR_MESSAGES.some((msg) => error.message.includes(msg));
27
- }
28
- return false;
29
- }
30
- setConnectionStatus(isConnected) {
31
- if (this.onConnectionChange) {
32
- this.onConnectionChange(isConnected);
33
- }
34
- }
35
- baseHeaders() {
36
- const h = new Headers();
37
- h.set("Content-Type", "application/json");
38
- h.set("Accept", "application/json");
39
- h.set("Authorization", `Bearer ${this.api_key}`);
40
- return h;
41
- }
42
- mergeHeaders(base, extra) {
43
- const out = new Headers(base);
44
- if (extra) {
45
- new Headers(extra).forEach((v, k) => {
46
- out.set(k, v);
47
- });
48
- }
49
- return out;
50
- }
51
- async request(method, endpoint, body, headers) {
52
- let res = null;
53
- try {
54
- res = await fetch(`${this.baseUrl}${endpoint}`, {
55
- method,
56
- mode: "cors",
57
- credentials: "include",
58
- headers: this.mergeHeaders(this.baseHeaders(), headers),
59
- body: JSON.stringify(body) || undefined,
60
- });
61
- let data;
62
- try {
63
- data = await res.json();
64
- }
65
- catch {
66
- data = undefined;
67
- }
68
- this.setConnectionStatus(true);
69
- const response = {
70
- data,
71
- status: res.status,
72
- headers: res.headers,
73
- success: res.ok,
74
- connectionError: false,
75
- };
76
- return response;
77
- }
78
- catch (error) {
79
- const connectionFailed = this.isConnectionError(error);
80
- if (connectionFailed) {
81
- this.setConnectionStatus(false);
82
- captureException(error, {
83
- tags: { error_type: "connection_error" },
84
- extra: { endpoint, method },
85
- });
86
- }
87
- const response = {
88
- status: res ? res.status : connectionFailed ? 0 : 500,
89
- error: error instanceof Error ? error.message : String(error),
90
- headers: res ? res.headers : new Headers(),
91
- success: false,
92
- data: undefined,
93
- connectionError: connectionFailed,
94
- };
95
- return response;
96
- }
97
- }
98
- async get(endpoint, headers) {
99
- return this.request("GET", endpoint, undefined, headers);
100
- }
101
- async post(endpoint, body, headers) {
102
- return this.request("POST", endpoint, body, headers);
103
- }
104
- async patch(endpoint, body, headers) {
105
- return this.request("PATCH", endpoint, body, headers);
106
- }
107
- async delete(endpoint, headers) {
108
- return this.request("DELETE", endpoint, undefined, headers);
109
- }
110
- getWithSchema(returnSchema, urlBuilder, paramSchema) {
111
- const fn = async (args, params) => {
112
- // Build URL
113
- const baseUrl = urlBuilder(args);
114
- // Validate and parse params with Zod if provided
115
- let queryString = "";
116
- if (paramSchema && params) {
117
- const validatedParams = paramSchema.parse(params);
118
- queryString = `?${new URLSearchParams(validatedParams).toString()}`;
119
- }
120
- const fullUrl = `${baseUrl}${queryString}`;
121
- const response = await this.get(fullUrl);
122
- if (!response.success || !response.data) {
123
- return response;
124
- }
125
- const parsed = returnSchema.safeParse(response.data);
126
- if (!parsed.success) {
127
- this.logger.error("Invalid response format", parsed.error);
128
- return {
129
- ...response,
130
- success: false,
131
- error: t("errors.invalid_response_format", {
132
- defaultValue: "Invalid response format",
133
- }),
134
- data: undefined,
135
- };
136
- }
137
- return {
138
- ...response,
139
- data: parsed.data,
140
- };
141
- };
142
- // biome-ignore lint/suspicious/noExplicitAny: fn can literally be any function
143
- return fn;
144
- }
145
- }
1
+ import { f as captureException, i as createLogger } from './index-COQ27Nb6.js';
2
+ import './profile-store-CsSDT9Tb.js';
3
+ import { u as unidyState } from './unidy-store-CAcMVdD8.js';
4
+ import { t } from './i18n-OKf8uE5j.js';
146
5
 
147
6
  /** A special constant with type `never` */
148
7
  function $constructor(name, initializer, params) {
149
8
  function init(inst, def) {
150
- var _a;
151
- Object.defineProperty(inst, "_zod", {
152
- value: inst._zod ?? {},
153
- enumerable: false,
154
- });
155
- (_a = inst._zod).traits ?? (_a.traits = new Set());
9
+ if (!inst._zod) {
10
+ Object.defineProperty(inst, "_zod", {
11
+ value: {
12
+ def,
13
+ constr: _,
14
+ traits: new Set(),
15
+ },
16
+ enumerable: false,
17
+ });
18
+ }
19
+ if (inst._zod.traits.has(name)) {
20
+ return;
21
+ }
156
22
  inst._zod.traits.add(name);
157
23
  initializer(inst, def);
158
24
  // support prototype modifications
159
- for (const k in _.prototype) {
160
- if (!(k in inst))
161
- Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
25
+ const proto = _.prototype;
26
+ const keys = Object.keys(proto);
27
+ for (let i = 0; i < keys.length; i++) {
28
+ const k = keys[i];
29
+ if (!(k in inst)) {
30
+ inst[k] = proto[k].bind(inst);
31
+ }
162
32
  }
163
- inst._zod.constr = _;
164
- inst._zod.def = def;
165
33
  }
166
34
  // doesn't work if Parent has a constructor with arguments
167
35
  const Parent = params?.Parent ?? Object;
@@ -296,6 +164,14 @@ function mergeDefs(...defs) {
296
164
  function esc(str) {
297
165
  return JSON.stringify(str);
298
166
  }
167
+ function slugify(input) {
168
+ return input
169
+ .toLowerCase()
170
+ .trim()
171
+ .replace(/[^\w\s-]/g, "")
172
+ .replace(/[\s_-]+/g, "-")
173
+ .replace(/^-+|-+$/g, "");
174
+ }
299
175
  const captureStackTrace = ("captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => { });
300
176
  function isObject(data) {
301
177
  return typeof data === "object" && data !== null && !Array.isArray(data);
@@ -321,6 +197,8 @@ function isPlainObject(o) {
321
197
  const ctor = o.constructor;
322
198
  if (ctor === undefined)
323
199
  return true;
200
+ if (typeof ctor !== "function")
201
+ return true;
324
202
  // modified prototype
325
203
  const prot = ctor.prototype;
326
204
  if (isObject(prot) === false)
@@ -379,6 +257,11 @@ const NUMBER_FORMAT_RANGES = {
379
257
  };
380
258
  function pick(schema, mask) {
381
259
  const currDef = schema._zod.def;
260
+ const checks = currDef.checks;
261
+ const hasChecks = checks && checks.length > 0;
262
+ if (hasChecks) {
263
+ throw new Error(".pick() cannot be used on object schemas containing refinements");
264
+ }
382
265
  const def = mergeDefs(schema._zod.def, {
383
266
  get shape() {
384
267
  const newShape = {};
@@ -399,6 +282,11 @@ function pick(schema, mask) {
399
282
  }
400
283
  function omit(schema, mask) {
401
284
  const currDef = schema._zod.def;
285
+ const checks = currDef.checks;
286
+ const hasChecks = checks && checks.length > 0;
287
+ if (hasChecks) {
288
+ throw new Error(".omit() cannot be used on object schemas containing refinements");
289
+ }
402
290
  const def = mergeDefs(schema._zod.def, {
403
291
  get shape() {
404
292
  const newShape = { ...schema._zod.def.shape };
@@ -424,7 +312,14 @@ function extend(schema, shape) {
424
312
  const checks = schema._zod.def.checks;
425
313
  const hasChecks = checks && checks.length > 0;
426
314
  if (hasChecks) {
427
- throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
315
+ // Only throw if new shape overlaps with existing shape
316
+ // Use getOwnPropertyDescriptor to check key existence without accessing values
317
+ const existingShape = schema._zod.def.shape;
318
+ for (const key in shape) {
319
+ if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
320
+ throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
321
+ }
322
+ }
428
323
  }
429
324
  const def = mergeDefs(schema._zod.def, {
430
325
  get shape() {
@@ -432,7 +327,6 @@ function extend(schema, shape) {
432
327
  assignProp(this, "shape", _shape); // self-caching
433
328
  return _shape;
434
329
  },
435
- checks: [],
436
330
  });
437
331
  return clone(schema, def);
438
332
  }
@@ -440,15 +334,13 @@ function safeExtend(schema, shape) {
440
334
  if (!isPlainObject(shape)) {
441
335
  throw new Error("Invalid input to safeExtend: expected a plain object");
442
336
  }
443
- const def = {
444
- ...schema._zod.def,
337
+ const def = mergeDefs(schema._zod.def, {
445
338
  get shape() {
446
339
  const _shape = { ...schema._zod.def.shape, ...shape };
447
340
  assignProp(this, "shape", _shape); // self-caching
448
341
  return _shape;
449
342
  },
450
- checks: schema._zod.def.checks,
451
- };
343
+ });
452
344
  return clone(schema, def);
453
345
  }
454
346
  function merge(a, b) {
@@ -466,6 +358,12 @@ function merge(a, b) {
466
358
  return clone(a, def);
467
359
  }
468
360
  function partial(Class, schema, mask) {
361
+ const currDef = schema._zod.def;
362
+ const checks = currDef.checks;
363
+ const hasChecks = checks && checks.length > 0;
364
+ if (hasChecks) {
365
+ throw new Error(".partial() cannot be used on object schemas containing refinements");
366
+ }
469
367
  const def = mergeDefs(schema._zod.def, {
470
368
  get shape() {
471
369
  const oldShape = schema._zod.def.shape;
@@ -535,7 +433,6 @@ function required(Class, schema, mask) {
535
433
  assignProp(this, "shape", shape); // self-caching
536
434
  return shape;
537
435
  },
538
- checks: [],
539
436
  });
540
437
  return clone(schema, def);
541
438
  }
@@ -786,11 +683,9 @@ const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?:
786
683
  // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
787
684
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
788
685
  const base64url = /^[A-Za-z0-9_-]*$/;
789
- // based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
790
- // export const hostname: RegExp = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
791
- const hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
792
686
  // https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
793
- const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
687
+ // E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15
688
+ const e164 = /^\+[1-9]\d{6,14}$/;
794
689
  // const dateSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
795
690
  const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
796
691
  const date$2 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
@@ -825,8 +720,8 @@ const string$2 = (params) => {
825
720
  return new RegExp(`^${regex}$`);
826
721
  };
827
722
  const integer = /^-?\d+$/;
828
- const number$2 = /^-?\d+(?:\.\d+)?/;
829
- const boolean$2 = /^(?:true|false)$/i;
723
+ const number$2 = /^-?\d+(?:\.\d+)?$/;
724
+ const boolean$1 = /^(?:true|false)$/i;
830
725
  const _null$3 = /^null$/i;
831
726
  // regex for string with no uppercase letters
832
727
  const lowercase = /^[^A-Z]*$/;
@@ -865,7 +760,7 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
865
760
  payload.issues.push({
866
761
  origin,
867
762
  code: "too_big",
868
- maximum: def.value,
763
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
869
764
  input: payload.value,
870
765
  inclusive: def.inclusive,
871
766
  inst,
@@ -893,7 +788,7 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
893
788
  payload.issues.push({
894
789
  origin,
895
790
  code: "too_small",
896
- minimum: def.value,
791
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
897
792
  input: payload.value,
898
793
  inclusive: def.inclusive,
899
794
  inst,
@@ -981,6 +876,7 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
981
876
  note: "Integers must be within the safe integer range.",
982
877
  inst,
983
878
  origin,
879
+ inclusive: true,
984
880
  continue: !def.abort,
985
881
  });
986
882
  }
@@ -993,6 +889,7 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
993
889
  note: "Integers must be within the safe integer range.",
994
890
  inst,
995
891
  origin,
892
+ inclusive: true,
996
893
  continue: !def.abort,
997
894
  });
998
895
  }
@@ -1016,7 +913,9 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
1016
913
  input,
1017
914
  code: "too_big",
1018
915
  maximum,
916
+ inclusive: true,
1019
917
  inst,
918
+ continue: !def.abort,
1020
919
  });
1021
920
  }
1022
921
  };
@@ -1279,8 +1178,8 @@ class Doc {
1279
1178
 
1280
1179
  const version = {
1281
1180
  major: 4,
1282
- minor: 1,
1283
- patch: 12,
1181
+ minor: 3,
1182
+ patch: 5,
1284
1183
  };
1285
1184
 
1286
1185
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
@@ -1350,16 +1249,6 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1350
1249
  }
1351
1250
  return payload;
1352
1251
  };
1353
- // const handleChecksResult = (
1354
- // checkResult: ParsePayload,
1355
- // originalResult: ParsePayload,
1356
- // ctx: ParseContextInternal
1357
- // ): util.MaybeAsync<ParsePayload> => {
1358
- // // if the checks mutated the value && there are no issues, re-parse the result
1359
- // if (checkResult.value !== originalResult.value && !checkResult.issues.length)
1360
- // return inst._zod.parse(checkResult, ctx);
1361
- // return originalResult;
1362
- // };
1363
1252
  const handleCanaryResult = (canary, payload, ctx) => {
1364
1253
  // abort if the canary is aborted
1365
1254
  if (aborted(canary)) {
@@ -1400,7 +1289,8 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1400
1289
  return runChecks(result, checks, ctx);
1401
1290
  };
1402
1291
  }
1403
- inst["~standard"] = {
1292
+ // Lazy initialize ~standard to avoid creating objects for every schema
1293
+ defineLazy(inst, "~standard", () => ({
1404
1294
  validate: (value) => {
1405
1295
  try {
1406
1296
  const r = safeParse$1(inst, value);
@@ -1412,7 +1302,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1412
1302
  },
1413
1303
  vendor: "zod",
1414
1304
  version: 1,
1415
- };
1305
+ }));
1416
1306
  });
1417
1307
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1418
1308
  $ZodType.init(inst, def);
@@ -1483,7 +1373,7 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
1483
1373
  code: "invalid_format",
1484
1374
  format: "url",
1485
1375
  note: "Invalid hostname",
1486
- pattern: hostname.source,
1376
+ pattern: def.hostname.source,
1487
1377
  input: payload.value,
1488
1378
  inst,
1489
1379
  continue: !def.abort,
@@ -1573,18 +1463,12 @@ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def
1573
1463
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
1574
1464
  def.pattern ?? (def.pattern = ipv4);
1575
1465
  $ZodStringFormat.init(inst, def);
1576
- inst._zod.onattach.push((inst) => {
1577
- const bag = inst._zod.bag;
1578
- bag.format = `ipv4`;
1579
- });
1466
+ inst._zod.bag.format = `ipv4`;
1580
1467
  });
1581
1468
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1582
1469
  def.pattern ?? (def.pattern = ipv6);
1583
1470
  $ZodStringFormat.init(inst, def);
1584
- inst._zod.onattach.push((inst) => {
1585
- const bag = inst._zod.bag;
1586
- bag.format = `ipv6`;
1587
- });
1471
+ inst._zod.bag.format = `ipv6`;
1588
1472
  inst._zod.check = (payload) => {
1589
1473
  try {
1590
1474
  // @ts-ignore
@@ -1654,9 +1538,7 @@ function isValidBase64(data) {
1654
1538
  const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
1655
1539
  def.pattern ?? (def.pattern = base64);
1656
1540
  $ZodStringFormat.init(inst, def);
1657
- inst._zod.onattach.push((inst) => {
1658
- inst._zod.bag.contentEncoding = "base64";
1659
- });
1541
+ inst._zod.bag.contentEncoding = "base64";
1660
1542
  inst._zod.check = (payload) => {
1661
1543
  if (isValidBase64(payload.value))
1662
1544
  return;
@@ -1680,9 +1562,7 @@ function isValidBase64URL(data) {
1680
1562
  const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
1681
1563
  def.pattern ?? (def.pattern = base64url);
1682
1564
  $ZodStringFormat.init(inst, def);
1683
- inst._zod.onattach.push((inst) => {
1684
- inst._zod.bag.contentEncoding = "base64url";
1685
- });
1565
+ inst._zod.bag.contentEncoding = "base64url";
1686
1566
  inst._zod.check = (payload) => {
1687
1567
  if (isValidBase64URL(payload.value))
1688
1568
  return;
@@ -1766,13 +1646,13 @@ const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
1766
1646
  return payload;
1767
1647
  };
1768
1648
  });
1769
- const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
1649
+ const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, def) => {
1770
1650
  $ZodCheckNumberFormat.init(inst, def);
1771
- $ZodNumber.init(inst, def); // no format checksp
1651
+ $ZodNumber.init(inst, def); // no format checks
1772
1652
  });
1773
1653
  const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
1774
1654
  $ZodType.init(inst, def);
1775
- inst._zod.pattern = boolean$2;
1655
+ inst._zod.pattern = boolean$1;
1776
1656
  inst._zod.parse = (payload, _ctx) => {
1777
1657
  if (def.coerce)
1778
1658
  try {
@@ -1892,8 +1772,12 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1892
1772
  return payload; //handleArrayResultsAsync(parseResults, final);
1893
1773
  };
1894
1774
  });
1895
- function handlePropertyResult(result, final, key, input) {
1775
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
1896
1776
  if (result.issues.length) {
1777
+ // For optional-out schemas, ignore errors on absent keys
1778
+ if (isOptionalOut && !(key in input)) {
1779
+ return;
1780
+ }
1897
1781
  final.issues.push(...prefixIssues(key, result.issues));
1898
1782
  }
1899
1783
  if (result.value === undefined) {
@@ -1927,7 +1811,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1927
1811
  const keySet = def.keySet;
1928
1812
  const _catchall = def.catchall._zod;
1929
1813
  const t = _catchall.def.type;
1930
- for (const key of Object.keys(input)) {
1814
+ const isOptionalOut = _catchall.optout === "optional";
1815
+ for (const key in input) {
1931
1816
  if (keySet.has(key))
1932
1817
  continue;
1933
1818
  if (t === "never") {
@@ -1936,10 +1821,10 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1936
1821
  }
1937
1822
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1938
1823
  if (r instanceof Promise) {
1939
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
1824
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1940
1825
  }
1941
1826
  else {
1942
- handlePropertyResult(r, payload, key, input);
1827
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
1943
1828
  }
1944
1829
  }
1945
1830
  if (unrecognized.length) {
@@ -2007,12 +1892,13 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2007
1892
  const shape = value.shape;
2008
1893
  for (const key of value.keys) {
2009
1894
  const el = shape[key];
1895
+ const isOptionalOut = el._zod.optout === "optional";
2010
1896
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
2011
1897
  if (r instanceof Promise) {
2012
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
1898
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
2013
1899
  }
2014
1900
  else {
2015
- handlePropertyResult(r, payload, key, input);
1901
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
2016
1902
  }
2017
1903
  }
2018
1904
  if (!catchall) {
@@ -2044,8 +1930,33 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
2044
1930
  for (const key of normalized.keys) {
2045
1931
  const id = ids[key];
2046
1932
  const k = esc(key);
1933
+ const schema = shape[key];
1934
+ const isOptionalOut = schema?._zod?.optout === "optional";
2047
1935
  doc.write(`const ${id} = ${parseStr(key)};`);
2048
- doc.write(`
1936
+ if (isOptionalOut) {
1937
+ // For optional-out schemas, ignore errors on absent keys
1938
+ doc.write(`
1939
+ if (${id}.issues.length) {
1940
+ if (${k} in input) {
1941
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1942
+ ...iss,
1943
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1944
+ })));
1945
+ }
1946
+ }
1947
+
1948
+ if (${id}.value === undefined) {
1949
+ if (${k} in input) {
1950
+ newResult[${k}] = undefined;
1951
+ }
1952
+ } else {
1953
+ newResult[${k}] = ${id}.value;
1954
+ }
1955
+
1956
+ `);
1957
+ }
1958
+ else {
1959
+ doc.write(`
2049
1960
  if (${id}.issues.length) {
2050
1961
  payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2051
1962
  ...iss,
@@ -2053,7 +1964,6 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
2053
1964
  })));
2054
1965
  }
2055
1966
 
2056
-
2057
1967
  if (${id}.value === undefined) {
2058
1968
  if (${k} in input) {
2059
1969
  newResult[${k}] = undefined;
@@ -2063,6 +1973,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
2063
1973
  }
2064
1974
 
2065
1975
  `);
1976
+ }
2066
1977
  }
2067
1978
  doc.write(`payload.value = newResult;`);
2068
1979
  doc.write(`return payload;`);
@@ -2229,11 +2140,38 @@ function mergeValues(a, b) {
2229
2140
  return { valid: false, mergeErrorPath: [] };
2230
2141
  }
2231
2142
  function handleIntersectionResults(result, left, right) {
2232
- if (left.issues.length) {
2233
- result.issues.push(...left.issues);
2143
+ // Track which side(s) report each key as unrecognized
2144
+ const unrecKeys = new Map();
2145
+ let unrecIssue;
2146
+ for (const iss of left.issues) {
2147
+ if (iss.code === "unrecognized_keys") {
2148
+ unrecIssue ?? (unrecIssue = iss);
2149
+ for (const k of iss.keys) {
2150
+ if (!unrecKeys.has(k))
2151
+ unrecKeys.set(k, {});
2152
+ unrecKeys.get(k).l = true;
2153
+ }
2154
+ }
2155
+ else {
2156
+ result.issues.push(iss);
2157
+ }
2158
+ }
2159
+ for (const iss of right.issues) {
2160
+ if (iss.code === "unrecognized_keys") {
2161
+ for (const k of iss.keys) {
2162
+ if (!unrecKeys.has(k))
2163
+ unrecKeys.set(k, {});
2164
+ unrecKeys.get(k).r = true;
2165
+ }
2166
+ }
2167
+ else {
2168
+ result.issues.push(iss);
2169
+ }
2234
2170
  }
2235
- if (right.issues.length) {
2236
- result.issues.push(...right.issues);
2171
+ // Report only keys unrecognized by BOTH sides
2172
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
2173
+ if (bothKeys.length && unrecIssue) {
2174
+ result.issues.push({ ...unrecIssue, keys: bothKeys });
2237
2175
  }
2238
2176
  if (aborted(result))
2239
2177
  return result;
@@ -2247,7 +2185,6 @@ function handleIntersectionResults(result, left, right) {
2247
2185
  const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
2248
2186
  $ZodType.init(inst, def);
2249
2187
  const items = def.items;
2250
- const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
2251
2188
  inst._zod.parse = (payload, ctx) => {
2252
2189
  const input = payload.value;
2253
2190
  if (!Array.isArray(input)) {
@@ -2261,12 +2198,16 @@ const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
2261
2198
  }
2262
2199
  payload.value = [];
2263
2200
  const proms = [];
2201
+ const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
2202
+ const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
2264
2203
  if (!def.rest) {
2265
2204
  const tooBig = input.length > items.length;
2266
2205
  const tooSmall = input.length < optStart - 1;
2267
2206
  if (tooBig || tooSmall) {
2268
2207
  payload.issues.push({
2269
- ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
2208
+ ...(tooBig
2209
+ ? { code: "too_big", maximum: items.length, inclusive: true }
2210
+ : { code: "too_small", minimum: items.length }),
2270
2211
  input,
2271
2212
  inst,
2272
2213
  origin: "array",
@@ -2332,11 +2273,13 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
2332
2273
  return payload;
2333
2274
  }
2334
2275
  const proms = [];
2335
- if (def.keyType._zod.values) {
2336
- const values = def.keyType._zod.values;
2276
+ const values = def.keyType._zod.values;
2277
+ if (values) {
2337
2278
  payload.value = {};
2279
+ const recordKeys = new Set();
2338
2280
  for (const key of values) {
2339
2281
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2282
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
2340
2283
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2341
2284
  if (result instanceof Promise) {
2342
2285
  proms.push(result.then((result) => {
@@ -2356,7 +2299,7 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
2356
2299
  }
2357
2300
  let unrecognized;
2358
2301
  for (const key in input) {
2359
- if (!values.has(key)) {
2302
+ if (!recordKeys.has(key)) {
2360
2303
  unrecognized = unrecognized ?? [];
2361
2304
  unrecognized.push(key);
2362
2305
  }
@@ -2375,20 +2318,40 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
2375
2318
  for (const key of Reflect.ownKeys(input)) {
2376
2319
  if (key === "__proto__")
2377
2320
  continue;
2378
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2321
+ let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2379
2322
  if (keyResult instanceof Promise) {
2380
2323
  throw new Error("Async schemas not supported in object keys currently");
2381
2324
  }
2325
+ // Numeric string fallback: if key failed with "expected number", retry with Number(key)
2326
+ const checkNumericKey = typeof key === "string" &&
2327
+ number$2.test(key) &&
2328
+ keyResult.issues.length &&
2329
+ keyResult.issues.some((iss) => iss.code === "invalid_type" && iss.expected === "number");
2330
+ if (checkNumericKey) {
2331
+ const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
2332
+ if (retryResult instanceof Promise) {
2333
+ throw new Error("Async schemas not supported in object keys currently");
2334
+ }
2335
+ if (retryResult.issues.length === 0) {
2336
+ keyResult = retryResult;
2337
+ }
2338
+ }
2382
2339
  if (keyResult.issues.length) {
2383
- payload.issues.push({
2384
- code: "invalid_key",
2385
- origin: "record",
2386
- issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2387
- input: key,
2388
- path: [key],
2389
- inst,
2390
- });
2391
- payload.value[keyResult.value] = keyResult.value;
2340
+ if (def.mode === "loose") {
2341
+ // Pass through unchanged
2342
+ payload.value[key] = input[key];
2343
+ }
2344
+ else {
2345
+ // Default "strict" behavior: error on invalid key
2346
+ payload.issues.push({
2347
+ code: "invalid_key",
2348
+ origin: "record",
2349
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2350
+ input: key,
2351
+ path: [key],
2352
+ inst,
2353
+ });
2354
+ }
2392
2355
  continue;
2393
2356
  }
2394
2357
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
@@ -2442,13 +2405,14 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
2442
2405
  if (def.values.length === 0) {
2443
2406
  throw new Error("Cannot create literal schema with no valid values");
2444
2407
  }
2445
- inst._zod.values = new Set(def.values);
2408
+ const values = new Set(def.values);
2409
+ inst._zod.values = values;
2446
2410
  inst._zod.pattern = new RegExp(`^(${def.values
2447
2411
  .map((o) => (typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)))
2448
2412
  .join("|")})$`);
2449
2413
  inst._zod.parse = (payload, _ctx) => {
2450
2414
  const input = payload.value;
2451
- if (inst._zod.values.has(input)) {
2415
+ if (values.has(input)) {
2452
2416
  return payload;
2453
2417
  }
2454
2418
  payload.issues.push({
@@ -2511,6 +2475,17 @@ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
2511
2475
  return def.innerType._zod.run(payload, ctx);
2512
2476
  };
2513
2477
  });
2478
+ const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
2479
+ // Call parent init - inherits optin/optout = "optional"
2480
+ $ZodOptional.init(inst, def);
2481
+ // Override values/pattern to NOT add undefined
2482
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2483
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
2484
+ // Override parse to just delegate (no undefined handling)
2485
+ inst._zod.parse = (payload, ctx) => {
2486
+ return def.innerType._zod.run(payload, ctx);
2487
+ };
2488
+ });
2514
2489
  const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
2515
2490
  $ZodType.init(inst, def);
2516
2491
  defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
@@ -2674,8 +2649,8 @@ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2674
2649
  $ZodType.init(inst, def);
2675
2650
  defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
2676
2651
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2677
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2678
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2652
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
2653
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
2679
2654
  inst._zod.parse = (payload, ctx) => {
2680
2655
  if (ctx.direction === "backward") {
2681
2656
  return def.innerType._zod.run(payload, ctx);
@@ -2723,6 +2698,7 @@ function handleRefineResult(result, payload, input, inst) {
2723
2698
  }
2724
2699
  }
2725
2700
 
2701
+ var _a;
2726
2702
  class $ZodRegistry {
2727
2703
  constructor() {
2728
2704
  this._map = new WeakMap();
@@ -2732,9 +2708,6 @@ class $ZodRegistry {
2732
2708
  const meta = _meta[0];
2733
2709
  this._map.set(schema, meta);
2734
2710
  if (meta && typeof meta === "object" && "id" in meta) {
2735
- if (this._idmap.has(meta.id)) {
2736
- throw new Error(`ID ${meta.id} already exists in the registry`);
2737
- }
2738
2711
  this._idmap.set(meta.id, schema);
2739
2712
  }
2740
2713
  return this;
@@ -2772,14 +2745,17 @@ class $ZodRegistry {
2772
2745
  function registry() {
2773
2746
  return new $ZodRegistry();
2774
2747
  }
2775
- const globalRegistry = /*@__PURE__*/ registry();
2748
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2749
+ const globalRegistry = globalThis.__zod_globalRegistry;
2776
2750
 
2751
+ // @__NO_SIDE_EFFECTS__
2777
2752
  function _string(Class, params) {
2778
2753
  return new Class({
2779
2754
  type: "string",
2780
2755
  ...normalizeParams(params),
2781
2756
  });
2782
2757
  }
2758
+ // @__NO_SIDE_EFFECTS__
2783
2759
  function _email(Class, params) {
2784
2760
  return new Class({
2785
2761
  type: "string",
@@ -2789,6 +2765,7 @@ function _email(Class, params) {
2789
2765
  ...normalizeParams(params),
2790
2766
  });
2791
2767
  }
2768
+ // @__NO_SIDE_EFFECTS__
2792
2769
  function _guid(Class, params) {
2793
2770
  return new Class({
2794
2771
  type: "string",
@@ -2798,6 +2775,7 @@ function _guid(Class, params) {
2798
2775
  ...normalizeParams(params),
2799
2776
  });
2800
2777
  }
2778
+ // @__NO_SIDE_EFFECTS__
2801
2779
  function _uuid(Class, params) {
2802
2780
  return new Class({
2803
2781
  type: "string",
@@ -2807,6 +2785,7 @@ function _uuid(Class, params) {
2807
2785
  ...normalizeParams(params),
2808
2786
  });
2809
2787
  }
2788
+ // @__NO_SIDE_EFFECTS__
2810
2789
  function _uuidv4(Class, params) {
2811
2790
  return new Class({
2812
2791
  type: "string",
@@ -2817,6 +2796,7 @@ function _uuidv4(Class, params) {
2817
2796
  ...normalizeParams(params),
2818
2797
  });
2819
2798
  }
2799
+ // @__NO_SIDE_EFFECTS__
2820
2800
  function _uuidv6(Class, params) {
2821
2801
  return new Class({
2822
2802
  type: "string",
@@ -2827,6 +2807,7 @@ function _uuidv6(Class, params) {
2827
2807
  ...normalizeParams(params),
2828
2808
  });
2829
2809
  }
2810
+ // @__NO_SIDE_EFFECTS__
2830
2811
  function _uuidv7(Class, params) {
2831
2812
  return new Class({
2832
2813
  type: "string",
@@ -2837,6 +2818,7 @@ function _uuidv7(Class, params) {
2837
2818
  ...normalizeParams(params),
2838
2819
  });
2839
2820
  }
2821
+ // @__NO_SIDE_EFFECTS__
2840
2822
  function _url(Class, params) {
2841
2823
  return new Class({
2842
2824
  type: "string",
@@ -2846,6 +2828,7 @@ function _url(Class, params) {
2846
2828
  ...normalizeParams(params),
2847
2829
  });
2848
2830
  }
2831
+ // @__NO_SIDE_EFFECTS__
2849
2832
  function _emoji(Class, params) {
2850
2833
  return new Class({
2851
2834
  type: "string",
@@ -2855,6 +2838,7 @@ function _emoji(Class, params) {
2855
2838
  ...normalizeParams(params),
2856
2839
  });
2857
2840
  }
2841
+ // @__NO_SIDE_EFFECTS__
2858
2842
  function _nanoid(Class, params) {
2859
2843
  return new Class({
2860
2844
  type: "string",
@@ -2864,6 +2848,7 @@ function _nanoid(Class, params) {
2864
2848
  ...normalizeParams(params),
2865
2849
  });
2866
2850
  }
2851
+ // @__NO_SIDE_EFFECTS__
2867
2852
  function _cuid(Class, params) {
2868
2853
  return new Class({
2869
2854
  type: "string",
@@ -2873,6 +2858,7 @@ function _cuid(Class, params) {
2873
2858
  ...normalizeParams(params),
2874
2859
  });
2875
2860
  }
2861
+ // @__NO_SIDE_EFFECTS__
2876
2862
  function _cuid2(Class, params) {
2877
2863
  return new Class({
2878
2864
  type: "string",
@@ -2882,6 +2868,7 @@ function _cuid2(Class, params) {
2882
2868
  ...normalizeParams(params),
2883
2869
  });
2884
2870
  }
2871
+ // @__NO_SIDE_EFFECTS__
2885
2872
  function _ulid(Class, params) {
2886
2873
  return new Class({
2887
2874
  type: "string",
@@ -2891,6 +2878,7 @@ function _ulid(Class, params) {
2891
2878
  ...normalizeParams(params),
2892
2879
  });
2893
2880
  }
2881
+ // @__NO_SIDE_EFFECTS__
2894
2882
  function _xid(Class, params) {
2895
2883
  return new Class({
2896
2884
  type: "string",
@@ -2900,6 +2888,7 @@ function _xid(Class, params) {
2900
2888
  ...normalizeParams(params),
2901
2889
  });
2902
2890
  }
2891
+ // @__NO_SIDE_EFFECTS__
2903
2892
  function _ksuid(Class, params) {
2904
2893
  return new Class({
2905
2894
  type: "string",
@@ -2909,6 +2898,7 @@ function _ksuid(Class, params) {
2909
2898
  ...normalizeParams(params),
2910
2899
  });
2911
2900
  }
2901
+ // @__NO_SIDE_EFFECTS__
2912
2902
  function _ipv4(Class, params) {
2913
2903
  return new Class({
2914
2904
  type: "string",
@@ -2918,6 +2908,7 @@ function _ipv4(Class, params) {
2918
2908
  ...normalizeParams(params),
2919
2909
  });
2920
2910
  }
2911
+ // @__NO_SIDE_EFFECTS__
2921
2912
  function _ipv6(Class, params) {
2922
2913
  return new Class({
2923
2914
  type: "string",
@@ -2927,6 +2918,7 @@ function _ipv6(Class, params) {
2927
2918
  ...normalizeParams(params),
2928
2919
  });
2929
2920
  }
2921
+ // @__NO_SIDE_EFFECTS__
2930
2922
  function _cidrv4(Class, params) {
2931
2923
  return new Class({
2932
2924
  type: "string",
@@ -2936,6 +2928,7 @@ function _cidrv4(Class, params) {
2936
2928
  ...normalizeParams(params),
2937
2929
  });
2938
2930
  }
2931
+ // @__NO_SIDE_EFFECTS__
2939
2932
  function _cidrv6(Class, params) {
2940
2933
  return new Class({
2941
2934
  type: "string",
@@ -2945,6 +2938,7 @@ function _cidrv6(Class, params) {
2945
2938
  ...normalizeParams(params),
2946
2939
  });
2947
2940
  }
2941
+ // @__NO_SIDE_EFFECTS__
2948
2942
  function _base64(Class, params) {
2949
2943
  return new Class({
2950
2944
  type: "string",
@@ -2954,6 +2948,7 @@ function _base64(Class, params) {
2954
2948
  ...normalizeParams(params),
2955
2949
  });
2956
2950
  }
2951
+ // @__NO_SIDE_EFFECTS__
2957
2952
  function _base64url(Class, params) {
2958
2953
  return new Class({
2959
2954
  type: "string",
@@ -2963,6 +2958,7 @@ function _base64url(Class, params) {
2963
2958
  ...normalizeParams(params),
2964
2959
  });
2965
2960
  }
2961
+ // @__NO_SIDE_EFFECTS__
2966
2962
  function _e164(Class, params) {
2967
2963
  return new Class({
2968
2964
  type: "string",
@@ -2972,6 +2968,7 @@ function _e164(Class, params) {
2972
2968
  ...normalizeParams(params),
2973
2969
  });
2974
2970
  }
2971
+ // @__NO_SIDE_EFFECTS__
2975
2972
  function _jwt(Class, params) {
2976
2973
  return new Class({
2977
2974
  type: "string",
@@ -2981,6 +2978,7 @@ function _jwt(Class, params) {
2981
2978
  ...normalizeParams(params),
2982
2979
  });
2983
2980
  }
2981
+ // @__NO_SIDE_EFFECTS__
2984
2982
  function _isoDateTime(Class, params) {
2985
2983
  return new Class({
2986
2984
  type: "string",
@@ -2992,6 +2990,7 @@ function _isoDateTime(Class, params) {
2992
2990
  ...normalizeParams(params),
2993
2991
  });
2994
2992
  }
2993
+ // @__NO_SIDE_EFFECTS__
2995
2994
  function _isoDate(Class, params) {
2996
2995
  return new Class({
2997
2996
  type: "string",
@@ -3000,6 +2999,7 @@ function _isoDate(Class, params) {
3000
2999
  ...normalizeParams(params),
3001
3000
  });
3002
3001
  }
3002
+ // @__NO_SIDE_EFFECTS__
3003
3003
  function _isoTime(Class, params) {
3004
3004
  return new Class({
3005
3005
  type: "string",
@@ -3009,6 +3009,7 @@ function _isoTime(Class, params) {
3009
3009
  ...normalizeParams(params),
3010
3010
  });
3011
3011
  }
3012
+ // @__NO_SIDE_EFFECTS__
3012
3013
  function _isoDuration(Class, params) {
3013
3014
  return new Class({
3014
3015
  type: "string",
@@ -3017,6 +3018,7 @@ function _isoDuration(Class, params) {
3017
3018
  ...normalizeParams(params),
3018
3019
  });
3019
3020
  }
3021
+ // @__NO_SIDE_EFFECTS__
3020
3022
  function _number(Class, params) {
3021
3023
  return new Class({
3022
3024
  type: "number",
@@ -3024,6 +3026,7 @@ function _number(Class, params) {
3024
3026
  ...normalizeParams(params),
3025
3027
  });
3026
3028
  }
3029
+ // @__NO_SIDE_EFFECTS__
3027
3030
  function _int(Class, params) {
3028
3031
  return new Class({
3029
3032
  type: "number",
@@ -3033,34 +3036,40 @@ function _int(Class, params) {
3033
3036
  ...normalizeParams(params),
3034
3037
  });
3035
3038
  }
3039
+ // @__NO_SIDE_EFFECTS__
3036
3040
  function _boolean(Class, params) {
3037
3041
  return new Class({
3038
3042
  type: "boolean",
3039
3043
  ...normalizeParams(params),
3040
3044
  });
3041
3045
  }
3046
+ // @__NO_SIDE_EFFECTS__
3042
3047
  function _null$2(Class, params) {
3043
3048
  return new Class({
3044
3049
  type: "null",
3045
3050
  ...normalizeParams(params),
3046
3051
  });
3047
3052
  }
3053
+ // @__NO_SIDE_EFFECTS__
3048
3054
  function _any(Class) {
3049
3055
  return new Class({
3050
3056
  type: "any",
3051
3057
  });
3052
3058
  }
3059
+ // @__NO_SIDE_EFFECTS__
3053
3060
  function _unknown(Class) {
3054
3061
  return new Class({
3055
3062
  type: "unknown",
3056
3063
  });
3057
3064
  }
3065
+ // @__NO_SIDE_EFFECTS__
3058
3066
  function _never(Class, params) {
3059
3067
  return new Class({
3060
3068
  type: "never",
3061
3069
  ...normalizeParams(params),
3062
3070
  });
3063
3071
  }
3072
+ // @__NO_SIDE_EFFECTS__
3064
3073
  function _coercedDate(Class, params) {
3065
3074
  return new Class({
3066
3075
  type: "date",
@@ -3068,6 +3077,7 @@ function _coercedDate(Class, params) {
3068
3077
  ...normalizeParams(params),
3069
3078
  });
3070
3079
  }
3080
+ // @__NO_SIDE_EFFECTS__
3071
3081
  function _lt(value, params) {
3072
3082
  return new $ZodCheckLessThan({
3073
3083
  check: "less_than",
@@ -3076,6 +3086,7 @@ function _lt(value, params) {
3076
3086
  inclusive: false,
3077
3087
  });
3078
3088
  }
3089
+ // @__NO_SIDE_EFFECTS__
3079
3090
  function _lte(value, params) {
3080
3091
  return new $ZodCheckLessThan({
3081
3092
  check: "less_than",
@@ -3084,6 +3095,7 @@ function _lte(value, params) {
3084
3095
  inclusive: true,
3085
3096
  });
3086
3097
  }
3098
+ // @__NO_SIDE_EFFECTS__
3087
3099
  function _gt(value, params) {
3088
3100
  return new $ZodCheckGreaterThan({
3089
3101
  check: "greater_than",
@@ -3092,6 +3104,7 @@ function _gt(value, params) {
3092
3104
  inclusive: false,
3093
3105
  });
3094
3106
  }
3107
+ // @__NO_SIDE_EFFECTS__
3095
3108
  function _gte(value, params) {
3096
3109
  return new $ZodCheckGreaterThan({
3097
3110
  check: "greater_than",
@@ -3100,6 +3113,7 @@ function _gte(value, params) {
3100
3113
  inclusive: true,
3101
3114
  });
3102
3115
  }
3116
+ // @__NO_SIDE_EFFECTS__
3103
3117
  function _multipleOf(value, params) {
3104
3118
  return new $ZodCheckMultipleOf({
3105
3119
  check: "multiple_of",
@@ -3107,6 +3121,7 @@ function _multipleOf(value, params) {
3107
3121
  value,
3108
3122
  });
3109
3123
  }
3124
+ // @__NO_SIDE_EFFECTS__
3110
3125
  function _maxLength(maximum, params) {
3111
3126
  const ch = new $ZodCheckMaxLength({
3112
3127
  check: "max_length",
@@ -3115,6 +3130,7 @@ function _maxLength(maximum, params) {
3115
3130
  });
3116
3131
  return ch;
3117
3132
  }
3133
+ // @__NO_SIDE_EFFECTS__
3118
3134
  function _minLength(minimum, params) {
3119
3135
  return new $ZodCheckMinLength({
3120
3136
  check: "min_length",
@@ -3122,6 +3138,7 @@ function _minLength(minimum, params) {
3122
3138
  minimum,
3123
3139
  });
3124
3140
  }
3141
+ // @__NO_SIDE_EFFECTS__
3125
3142
  function _length(length, params) {
3126
3143
  return new $ZodCheckLengthEquals({
3127
3144
  check: "length_equals",
@@ -3129,6 +3146,7 @@ function _length(length, params) {
3129
3146
  length,
3130
3147
  });
3131
3148
  }
3149
+ // @__NO_SIDE_EFFECTS__
3132
3150
  function _regex(pattern, params) {
3133
3151
  return new $ZodCheckRegex({
3134
3152
  check: "string_format",
@@ -3137,6 +3155,7 @@ function _regex(pattern, params) {
3137
3155
  pattern,
3138
3156
  });
3139
3157
  }
3158
+ // @__NO_SIDE_EFFECTS__
3140
3159
  function _lowercase(params) {
3141
3160
  return new $ZodCheckLowerCase({
3142
3161
  check: "string_format",
@@ -3144,6 +3163,7 @@ function _lowercase(params) {
3144
3163
  ...normalizeParams(params),
3145
3164
  });
3146
3165
  }
3166
+ // @__NO_SIDE_EFFECTS__
3147
3167
  function _uppercase(params) {
3148
3168
  return new $ZodCheckUpperCase({
3149
3169
  check: "string_format",
@@ -3151,6 +3171,7 @@ function _uppercase(params) {
3151
3171
  ...normalizeParams(params),
3152
3172
  });
3153
3173
  }
3174
+ // @__NO_SIDE_EFFECTS__
3154
3175
  function _includes(includes, params) {
3155
3176
  return new $ZodCheckIncludes({
3156
3177
  check: "string_format",
@@ -3159,6 +3180,7 @@ function _includes(includes, params) {
3159
3180
  includes,
3160
3181
  });
3161
3182
  }
3183
+ // @__NO_SIDE_EFFECTS__
3162
3184
  function _startsWith(prefix, params) {
3163
3185
  return new $ZodCheckStartsWith({
3164
3186
  check: "string_format",
@@ -3167,6 +3189,7 @@ function _startsWith(prefix, params) {
3167
3189
  prefix,
3168
3190
  });
3169
3191
  }
3192
+ // @__NO_SIDE_EFFECTS__
3170
3193
  function _endsWith(suffix, params) {
3171
3194
  return new $ZodCheckEndsWith({
3172
3195
  check: "string_format",
@@ -3175,6 +3198,7 @@ function _endsWith(suffix, params) {
3175
3198
  suffix,
3176
3199
  });
3177
3200
  }
3201
+ // @__NO_SIDE_EFFECTS__
3178
3202
  function _overwrite(tx) {
3179
3203
  return new $ZodCheckOverwrite({
3180
3204
  check: "overwrite",
@@ -3182,21 +3206,31 @@ function _overwrite(tx) {
3182
3206
  });
3183
3207
  }
3184
3208
  // normalize
3209
+ // @__NO_SIDE_EFFECTS__
3185
3210
  function _normalize(form) {
3186
3211
  return _overwrite((input) => input.normalize(form));
3187
3212
  }
3188
3213
  // trim
3214
+ // @__NO_SIDE_EFFECTS__
3189
3215
  function _trim() {
3190
3216
  return _overwrite((input) => input.trim());
3191
3217
  }
3192
3218
  // toLowerCase
3219
+ // @__NO_SIDE_EFFECTS__
3193
3220
  function _toLowerCase() {
3194
3221
  return _overwrite((input) => input.toLowerCase());
3195
3222
  }
3196
3223
  // toUpperCase
3224
+ // @__NO_SIDE_EFFECTS__
3197
3225
  function _toUpperCase() {
3198
3226
  return _overwrite((input) => input.toUpperCase());
3199
3227
  }
3228
+ // slugify
3229
+ // @__NO_SIDE_EFFECTS__
3230
+ function _slugify() {
3231
+ return _overwrite((input) => slugify(input));
3232
+ }
3233
+ // @__NO_SIDE_EFFECTS__
3200
3234
  function _array(Class, element, params) {
3201
3235
  return new Class({
3202
3236
  type: "array",
@@ -3208,6 +3242,7 @@ function _array(Class, element, params) {
3208
3242
  });
3209
3243
  }
3210
3244
  // same as _custom but defaults to abort:false
3245
+ // @__NO_SIDE_EFFECTS__
3211
3246
  function _refine(Class, fn, _params) {
3212
3247
  const schema = new Class({
3213
3248
  type: "custom",
@@ -3217,6 +3252,7 @@ function _refine(Class, fn, _params) {
3217
3252
  });
3218
3253
  return schema;
3219
3254
  }
3255
+ // @__NO_SIDE_EFFECTS__
3220
3256
  function _superRefine(fn) {
3221
3257
  const ch = _check((payload) => {
3222
3258
  payload.addIssue = (issue$1) => {
@@ -3239,6 +3275,7 @@ function _superRefine(fn) {
3239
3275
  });
3240
3276
  return ch;
3241
3277
  }
3278
+ // @__NO_SIDE_EFFECTS__
3242
3279
  function _check(fn, params) {
3243
3280
  const ch = new $ZodCheck({
3244
3281
  check: "custom",
@@ -3248,26 +3285,886 @@ function _check(fn, params) {
3248
3285
  return ch;
3249
3286
  }
3250
3287
 
3251
- const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
3252
- $ZodISODateTime.init(inst, def);
3253
- ZodStringFormat.init(inst, def);
3254
- });
3255
- function datetime(params) {
3256
- return _isoDateTime(ZodISODateTime, params);
3257
- }
3258
- const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
3259
- $ZodISODate.init(inst, def);
3260
- ZodStringFormat.init(inst, def);
3261
- });
3262
- function date$1(params) {
3263
- return _isoDate(ZodISODate, params);
3264
- }
3265
- const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
3266
- $ZodISOTime.init(inst, def);
3267
- ZodStringFormat.init(inst, def);
3268
- });
3269
- function time(params) {
3270
- return _isoTime(ZodISOTime, params);
3288
+ // function initializeContext<T extends schemas.$ZodType>(inputs: JSONSchemaGeneratorParams<T>): ToJSONSchemaContext<T> {
3289
+ // return {
3290
+ // processor: inputs.processor,
3291
+ // metadataRegistry: inputs.metadata ?? globalRegistry,
3292
+ // target: inputs.target ?? "draft-2020-12",
3293
+ // unrepresentable: inputs.unrepresentable ?? "throw",
3294
+ // };
3295
+ // }
3296
+ function initializeContext(params) {
3297
+ // Normalize target: convert old non-hyphenated versions to hyphenated versions
3298
+ let target = params?.target ?? "draft-2020-12";
3299
+ if (target === "draft-4")
3300
+ target = "draft-04";
3301
+ if (target === "draft-7")
3302
+ target = "draft-07";
3303
+ return {
3304
+ processors: params.processors ?? {},
3305
+ metadataRegistry: params?.metadata ?? globalRegistry,
3306
+ target,
3307
+ unrepresentable: params?.unrepresentable ?? "throw",
3308
+ override: params?.override ?? (() => { }),
3309
+ io: params?.io ?? "output",
3310
+ counter: 0,
3311
+ seen: new Map(),
3312
+ cycles: params?.cycles ?? "ref",
3313
+ reused: params?.reused ?? "inline",
3314
+ external: params?.external ?? undefined,
3315
+ };
3316
+ }
3317
+ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
3318
+ var _a;
3319
+ const def = schema._zod.def;
3320
+ // check for schema in seens
3321
+ const seen = ctx.seen.get(schema);
3322
+ if (seen) {
3323
+ seen.count++;
3324
+ // check if cycle
3325
+ const isCycle = _params.schemaPath.includes(schema);
3326
+ if (isCycle) {
3327
+ seen.cycle = _params.path;
3328
+ }
3329
+ return seen.schema;
3330
+ }
3331
+ // initialize
3332
+ const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
3333
+ ctx.seen.set(schema, result);
3334
+ // custom method overrides default behavior
3335
+ const overrideSchema = schema._zod.toJSONSchema?.();
3336
+ if (overrideSchema) {
3337
+ result.schema = overrideSchema;
3338
+ }
3339
+ else {
3340
+ const params = {
3341
+ ..._params,
3342
+ schemaPath: [..._params.schemaPath, schema],
3343
+ path: _params.path,
3344
+ };
3345
+ if (schema._zod.processJSONSchema) {
3346
+ schema._zod.processJSONSchema(ctx, result.schema, params);
3347
+ }
3348
+ else {
3349
+ const _json = result.schema;
3350
+ const processor = ctx.processors[def.type];
3351
+ if (!processor) {
3352
+ throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
3353
+ }
3354
+ processor(schema, ctx, _json, params);
3355
+ }
3356
+ const parent = schema._zod.parent;
3357
+ if (parent) {
3358
+ // Also set ref if processor didn't (for inheritance)
3359
+ if (!result.ref)
3360
+ result.ref = parent;
3361
+ process(parent, ctx, params);
3362
+ ctx.seen.get(parent).isParent = true;
3363
+ }
3364
+ }
3365
+ // metadata
3366
+ const meta = ctx.metadataRegistry.get(schema);
3367
+ if (meta)
3368
+ Object.assign(result.schema, meta);
3369
+ if (ctx.io === "input" && isTransforming(schema)) {
3370
+ // examples/defaults only apply to output type of pipe
3371
+ delete result.schema.examples;
3372
+ delete result.schema.default;
3373
+ }
3374
+ // set prefault as default
3375
+ if (ctx.io === "input" && result.schema._prefault)
3376
+ (_a = result.schema).default ?? (_a.default = result.schema._prefault);
3377
+ delete result.schema._prefault;
3378
+ // pulling fresh from ctx.seen in case it was overwritten
3379
+ const _result = ctx.seen.get(schema);
3380
+ return _result.schema;
3381
+ }
3382
+ function extractDefs(ctx, schema
3383
+ // params: EmitParams
3384
+ ) {
3385
+ // iterate over seen map;
3386
+ const root = ctx.seen.get(schema);
3387
+ if (!root)
3388
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
3389
+ // Track ids to detect duplicates across different schemas
3390
+ const idToSchema = new Map();
3391
+ for (const entry of ctx.seen.entries()) {
3392
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
3393
+ if (id) {
3394
+ const existing = idToSchema.get(id);
3395
+ if (existing && existing !== entry[0]) {
3396
+ throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
3397
+ }
3398
+ idToSchema.set(id, entry[0]);
3399
+ }
3400
+ }
3401
+ // returns a ref to the schema
3402
+ // defId will be empty if the ref points to an external schema (or #)
3403
+ const makeURI = (entry) => {
3404
+ // comparing the seen objects because sometimes
3405
+ // multiple schemas map to the same seen object.
3406
+ // e.g. lazy
3407
+ // external is configured
3408
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
3409
+ if (ctx.external) {
3410
+ const externalId = ctx.external.registry.get(entry[0])?.id; // ?? "__shared";// `__schema${ctx.counter++}`;
3411
+ // check if schema is in the external registry
3412
+ const uriGenerator = ctx.external.uri ?? ((id) => id);
3413
+ if (externalId) {
3414
+ return { ref: uriGenerator(externalId) };
3415
+ }
3416
+ // otherwise, add to __shared
3417
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
3418
+ entry[1].defId = id; // set defId so it will be reused if needed
3419
+ return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
3420
+ }
3421
+ if (entry[1] === root) {
3422
+ return { ref: "#" };
3423
+ }
3424
+ // self-contained schema
3425
+ const uriPrefix = `#`;
3426
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
3427
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
3428
+ return { defId, ref: defUriPrefix + defId };
3429
+ };
3430
+ // stored cached version in `def` property
3431
+ // remove all properties, set $ref
3432
+ const extractToDef = (entry) => {
3433
+ // if the schema is already a reference, do not extract it
3434
+ if (entry[1].schema.$ref) {
3435
+ return;
3436
+ }
3437
+ const seen = entry[1];
3438
+ const { ref, defId } = makeURI(entry);
3439
+ seen.def = { ...seen.schema };
3440
+ // defId won't be set if the schema is a reference to an external schema
3441
+ // or if the schema is the root schema
3442
+ if (defId)
3443
+ seen.defId = defId;
3444
+ // wipe away all properties except $ref
3445
+ const schema = seen.schema;
3446
+ for (const key in schema) {
3447
+ delete schema[key];
3448
+ }
3449
+ schema.$ref = ref;
3450
+ };
3451
+ // throw on cycles
3452
+ // break cycles
3453
+ if (ctx.cycles === "throw") {
3454
+ for (const entry of ctx.seen.entries()) {
3455
+ const seen = entry[1];
3456
+ if (seen.cycle) {
3457
+ throw new Error("Cycle detected: " +
3458
+ `#/${seen.cycle?.join("/")}/<root>` +
3459
+ '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
3460
+ }
3461
+ }
3462
+ }
3463
+ // extract schemas into $defs
3464
+ for (const entry of ctx.seen.entries()) {
3465
+ const seen = entry[1];
3466
+ // convert root schema to # $ref
3467
+ if (schema === entry[0]) {
3468
+ extractToDef(entry); // this has special handling for the root schema
3469
+ continue;
3470
+ }
3471
+ // extract schemas that are in the external registry
3472
+ if (ctx.external) {
3473
+ const ext = ctx.external.registry.get(entry[0])?.id;
3474
+ if (schema !== entry[0] && ext) {
3475
+ extractToDef(entry);
3476
+ continue;
3477
+ }
3478
+ }
3479
+ // extract schemas with `id` meta
3480
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
3481
+ if (id) {
3482
+ extractToDef(entry);
3483
+ continue;
3484
+ }
3485
+ // break cycles
3486
+ if (seen.cycle) {
3487
+ // any
3488
+ extractToDef(entry);
3489
+ continue;
3490
+ }
3491
+ // extract reused schemas
3492
+ if (seen.count > 1) {
3493
+ if (ctx.reused === "ref") {
3494
+ extractToDef(entry);
3495
+ // biome-ignore lint:
3496
+ continue;
3497
+ }
3498
+ }
3499
+ }
3500
+ }
3501
+ function finalize(ctx, schema) {
3502
+ const root = ctx.seen.get(schema);
3503
+ if (!root)
3504
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
3505
+ // flatten refs - inherit properties from parent schemas
3506
+ const flattenRef = (zodSchema) => {
3507
+ const seen = ctx.seen.get(zodSchema);
3508
+ // already processed
3509
+ if (seen.ref === null)
3510
+ return;
3511
+ const schema = seen.def ?? seen.schema;
3512
+ const _cached = { ...schema };
3513
+ const ref = seen.ref;
3514
+ seen.ref = null; // prevent infinite recursion
3515
+ if (ref) {
3516
+ flattenRef(ref);
3517
+ const refSeen = ctx.seen.get(ref);
3518
+ const refSchema = refSeen.schema;
3519
+ // merge referenced schema into current
3520
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
3521
+ // older drafts can't combine $ref with other properties
3522
+ schema.allOf = schema.allOf ?? [];
3523
+ schema.allOf.push(refSchema);
3524
+ }
3525
+ else {
3526
+ Object.assign(schema, refSchema);
3527
+ }
3528
+ // restore child's own properties (child wins)
3529
+ Object.assign(schema, _cached);
3530
+ const isParentRef = zodSchema._zod.parent === ref;
3531
+ // For parent chain, child is a refinement - remove parent-only properties
3532
+ if (isParentRef) {
3533
+ for (const key in schema) {
3534
+ if (key === "$ref" || key === "allOf")
3535
+ continue;
3536
+ if (!(key in _cached)) {
3537
+ delete schema[key];
3538
+ }
3539
+ }
3540
+ }
3541
+ // When ref was extracted to $defs, remove properties that match the definition
3542
+ if (refSchema.$ref) {
3543
+ for (const key in schema) {
3544
+ if (key === "$ref" || key === "allOf")
3545
+ continue;
3546
+ if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) {
3547
+ delete schema[key];
3548
+ }
3549
+ }
3550
+ }
3551
+ }
3552
+ // If parent was extracted (has $ref), propagate $ref to this schema
3553
+ // This handles cases like: readonly().meta({id}).describe()
3554
+ // where processor sets ref to innerType but parent should be referenced
3555
+ const parent = zodSchema._zod.parent;
3556
+ if (parent && parent !== ref) {
3557
+ // Ensure parent is processed first so its def has inherited properties
3558
+ flattenRef(parent);
3559
+ const parentSeen = ctx.seen.get(parent);
3560
+ if (parentSeen?.schema.$ref) {
3561
+ schema.$ref = parentSeen.schema.$ref;
3562
+ // De-duplicate with parent's definition
3563
+ if (parentSeen.def) {
3564
+ for (const key in schema) {
3565
+ if (key === "$ref" || key === "allOf")
3566
+ continue;
3567
+ if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) {
3568
+ delete schema[key];
3569
+ }
3570
+ }
3571
+ }
3572
+ }
3573
+ }
3574
+ // execute overrides
3575
+ ctx.override({
3576
+ zodSchema: zodSchema,
3577
+ jsonSchema: schema,
3578
+ path: seen.path ?? [],
3579
+ });
3580
+ };
3581
+ for (const entry of [...ctx.seen.entries()].reverse()) {
3582
+ flattenRef(entry[0]);
3583
+ }
3584
+ const result = {};
3585
+ if (ctx.target === "draft-2020-12") {
3586
+ result.$schema = "https://json-schema.org/draft/2020-12/schema";
3587
+ }
3588
+ else if (ctx.target === "draft-07") {
3589
+ result.$schema = "http://json-schema.org/draft-07/schema#";
3590
+ }
3591
+ else if (ctx.target === "draft-04") {
3592
+ result.$schema = "http://json-schema.org/draft-04/schema#";
3593
+ }
3594
+ else ;
3595
+ if (ctx.external?.uri) {
3596
+ const id = ctx.external.registry.get(schema)?.id;
3597
+ if (!id)
3598
+ throw new Error("Schema is missing an `id` property");
3599
+ result.$id = ctx.external.uri(id);
3600
+ }
3601
+ Object.assign(result, root.def ?? root.schema);
3602
+ // build defs object
3603
+ const defs = ctx.external?.defs ?? {};
3604
+ for (const entry of ctx.seen.entries()) {
3605
+ const seen = entry[1];
3606
+ if (seen.def && seen.defId) {
3607
+ defs[seen.defId] = seen.def;
3608
+ }
3609
+ }
3610
+ // set definitions in result
3611
+ if (ctx.external) ;
3612
+ else {
3613
+ if (Object.keys(defs).length > 0) {
3614
+ if (ctx.target === "draft-2020-12") {
3615
+ result.$defs = defs;
3616
+ }
3617
+ else {
3618
+ result.definitions = defs;
3619
+ }
3620
+ }
3621
+ }
3622
+ try {
3623
+ // this "finalizes" this schema and ensures all cycles are removed
3624
+ // each call to finalize() is functionally independent
3625
+ // though the seen map is shared
3626
+ const finalized = JSON.parse(JSON.stringify(result));
3627
+ Object.defineProperty(finalized, "~standard", {
3628
+ value: {
3629
+ ...schema["~standard"],
3630
+ jsonSchema: {
3631
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
3632
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors),
3633
+ },
3634
+ },
3635
+ enumerable: false,
3636
+ writable: false,
3637
+ });
3638
+ return finalized;
3639
+ }
3640
+ catch (_err) {
3641
+ throw new Error("Error converting schema to JSON.");
3642
+ }
3643
+ }
3644
+ function isTransforming(_schema, _ctx) {
3645
+ const ctx = _ctx ?? { seen: new Set() };
3646
+ if (ctx.seen.has(_schema))
3647
+ return false;
3648
+ ctx.seen.add(_schema);
3649
+ const def = _schema._zod.def;
3650
+ if (def.type === "transform")
3651
+ return true;
3652
+ if (def.type === "array")
3653
+ return isTransforming(def.element, ctx);
3654
+ if (def.type === "set")
3655
+ return isTransforming(def.valueType, ctx);
3656
+ if (def.type === "lazy")
3657
+ return isTransforming(def.getter(), ctx);
3658
+ if (def.type === "promise" ||
3659
+ def.type === "optional" ||
3660
+ def.type === "nonoptional" ||
3661
+ def.type === "nullable" ||
3662
+ def.type === "readonly" ||
3663
+ def.type === "default" ||
3664
+ def.type === "prefault") {
3665
+ return isTransforming(def.innerType, ctx);
3666
+ }
3667
+ if (def.type === "intersection") {
3668
+ return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
3669
+ }
3670
+ if (def.type === "record" || def.type === "map") {
3671
+ return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
3672
+ }
3673
+ if (def.type === "pipe") {
3674
+ return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
3675
+ }
3676
+ if (def.type === "object") {
3677
+ for (const key in def.shape) {
3678
+ if (isTransforming(def.shape[key], ctx))
3679
+ return true;
3680
+ }
3681
+ return false;
3682
+ }
3683
+ if (def.type === "union") {
3684
+ for (const option of def.options) {
3685
+ if (isTransforming(option, ctx))
3686
+ return true;
3687
+ }
3688
+ return false;
3689
+ }
3690
+ if (def.type === "tuple") {
3691
+ for (const item of def.items) {
3692
+ if (isTransforming(item, ctx))
3693
+ return true;
3694
+ }
3695
+ if (def.rest && isTransforming(def.rest, ctx))
3696
+ return true;
3697
+ return false;
3698
+ }
3699
+ return false;
3700
+ }
3701
+ /**
3702
+ * Creates a toJSONSchema method for a schema instance.
3703
+ * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
3704
+ */
3705
+ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
3706
+ const ctx = initializeContext({ ...params, processors });
3707
+ process(schema, ctx);
3708
+ extractDefs(ctx, schema);
3709
+ return finalize(ctx, schema);
3710
+ };
3711
+ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
3712
+ const { libraryOptions, target } = params ?? {};
3713
+ const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
3714
+ process(schema, ctx);
3715
+ extractDefs(ctx, schema);
3716
+ return finalize(ctx, schema);
3717
+ };
3718
+
3719
+ const formatMap = {
3720
+ guid: "uuid",
3721
+ url: "uri",
3722
+ datetime: "date-time",
3723
+ json_string: "json-string",
3724
+ regex: "", // do not set
3725
+ };
3726
+ // ==================== SIMPLE TYPE PROCESSORS ====================
3727
+ const stringProcessor = (schema, ctx, _json, _params) => {
3728
+ const json = _json;
3729
+ json.type = "string";
3730
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod
3731
+ .bag;
3732
+ if (typeof minimum === "number")
3733
+ json.minLength = minimum;
3734
+ if (typeof maximum === "number")
3735
+ json.maxLength = maximum;
3736
+ // custom pattern overrides format
3737
+ if (format) {
3738
+ json.format = formatMap[format] ?? format;
3739
+ if (json.format === "")
3740
+ delete json.format; // empty format is not valid
3741
+ // JSON Schema format: "time" requires a full time with offset or Z
3742
+ // z.iso.time() does not include timezone information, so format: "time" should never be used
3743
+ if (format === "time") {
3744
+ delete json.format;
3745
+ }
3746
+ }
3747
+ if (contentEncoding)
3748
+ json.contentEncoding = contentEncoding;
3749
+ if (patterns && patterns.size > 0) {
3750
+ const regexes = [...patterns];
3751
+ if (regexes.length === 1)
3752
+ json.pattern = regexes[0].source;
3753
+ else if (regexes.length > 1) {
3754
+ json.allOf = [
3755
+ ...regexes.map((regex) => ({
3756
+ ...(ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0"
3757
+ ? { type: "string" }
3758
+ : {}),
3759
+ pattern: regex.source,
3760
+ })),
3761
+ ];
3762
+ }
3763
+ }
3764
+ };
3765
+ const numberProcessor = (schema, ctx, _json, _params) => {
3766
+ const json = _json;
3767
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3768
+ if (typeof format === "string" && format.includes("int"))
3769
+ json.type = "integer";
3770
+ else
3771
+ json.type = "number";
3772
+ if (typeof exclusiveMinimum === "number") {
3773
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
3774
+ json.minimum = exclusiveMinimum;
3775
+ json.exclusiveMinimum = true;
3776
+ }
3777
+ else {
3778
+ json.exclusiveMinimum = exclusiveMinimum;
3779
+ }
3780
+ }
3781
+ if (typeof minimum === "number") {
3782
+ json.minimum = minimum;
3783
+ if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
3784
+ if (exclusiveMinimum >= minimum)
3785
+ delete json.minimum;
3786
+ else
3787
+ delete json.exclusiveMinimum;
3788
+ }
3789
+ }
3790
+ if (typeof exclusiveMaximum === "number") {
3791
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
3792
+ json.maximum = exclusiveMaximum;
3793
+ json.exclusiveMaximum = true;
3794
+ }
3795
+ else {
3796
+ json.exclusiveMaximum = exclusiveMaximum;
3797
+ }
3798
+ }
3799
+ if (typeof maximum === "number") {
3800
+ json.maximum = maximum;
3801
+ if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
3802
+ if (exclusiveMaximum <= maximum)
3803
+ delete json.maximum;
3804
+ else
3805
+ delete json.exclusiveMaximum;
3806
+ }
3807
+ }
3808
+ if (typeof multipleOf === "number")
3809
+ json.multipleOf = multipleOf;
3810
+ };
3811
+ const booleanProcessor = (_schema, _ctx, json, _params) => {
3812
+ json.type = "boolean";
3813
+ };
3814
+ const nullProcessor = (_schema, ctx, json, _params) => {
3815
+ if (ctx.target === "openapi-3.0") {
3816
+ json.type = "string";
3817
+ json.nullable = true;
3818
+ json.enum = [null];
3819
+ }
3820
+ else {
3821
+ json.type = "null";
3822
+ }
3823
+ };
3824
+ const neverProcessor = (_schema, _ctx, json, _params) => {
3825
+ json.not = {};
3826
+ };
3827
+ const anyProcessor = (_schema, _ctx, _json, _params) => {
3828
+ // empty schema accepts anything
3829
+ };
3830
+ const unknownProcessor = (_schema, _ctx, _json, _params) => {
3831
+ // empty schema accepts anything
3832
+ };
3833
+ const dateProcessor = (_schema, ctx, _json, _params) => {
3834
+ if (ctx.unrepresentable === "throw") {
3835
+ throw new Error("Date cannot be represented in JSON Schema");
3836
+ }
3837
+ };
3838
+ const enumProcessor = (schema, _ctx, json, _params) => {
3839
+ const def = schema._zod.def;
3840
+ const values = getEnumValues(def.entries);
3841
+ // Number enums can have both string and number values
3842
+ if (values.every((v) => typeof v === "number"))
3843
+ json.type = "number";
3844
+ if (values.every((v) => typeof v === "string"))
3845
+ json.type = "string";
3846
+ json.enum = values;
3847
+ };
3848
+ const literalProcessor = (schema, ctx, json, _params) => {
3849
+ const def = schema._zod.def;
3850
+ const vals = [];
3851
+ for (const val of def.values) {
3852
+ if (val === undefined) {
3853
+ if (ctx.unrepresentable === "throw") {
3854
+ throw new Error("Literal `undefined` cannot be represented in JSON Schema");
3855
+ }
3856
+ }
3857
+ else if (typeof val === "bigint") {
3858
+ if (ctx.unrepresentable === "throw") {
3859
+ throw new Error("BigInt literals cannot be represented in JSON Schema");
3860
+ }
3861
+ else {
3862
+ vals.push(Number(val));
3863
+ }
3864
+ }
3865
+ else {
3866
+ vals.push(val);
3867
+ }
3868
+ }
3869
+ if (vals.length === 0) ;
3870
+ else if (vals.length === 1) {
3871
+ const val = vals[0];
3872
+ json.type = val === null ? "null" : typeof val;
3873
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
3874
+ json.enum = [val];
3875
+ }
3876
+ else {
3877
+ json.const = val;
3878
+ }
3879
+ }
3880
+ else {
3881
+ if (vals.every((v) => typeof v === "number"))
3882
+ json.type = "number";
3883
+ if (vals.every((v) => typeof v === "string"))
3884
+ json.type = "string";
3885
+ if (vals.every((v) => typeof v === "boolean"))
3886
+ json.type = "boolean";
3887
+ if (vals.every((v) => v === null))
3888
+ json.type = "null";
3889
+ json.enum = vals;
3890
+ }
3891
+ };
3892
+ const customProcessor = (_schema, ctx, _json, _params) => {
3893
+ if (ctx.unrepresentable === "throw") {
3894
+ throw new Error("Custom types cannot be represented in JSON Schema");
3895
+ }
3896
+ };
3897
+ const transformProcessor = (_schema, ctx, _json, _params) => {
3898
+ if (ctx.unrepresentable === "throw") {
3899
+ throw new Error("Transforms cannot be represented in JSON Schema");
3900
+ }
3901
+ };
3902
+ // ==================== COMPOSITE TYPE PROCESSORS ====================
3903
+ const arrayProcessor = (schema, ctx, _json, params) => {
3904
+ const json = _json;
3905
+ const def = schema._zod.def;
3906
+ const { minimum, maximum } = schema._zod.bag;
3907
+ if (typeof minimum === "number")
3908
+ json.minItems = minimum;
3909
+ if (typeof maximum === "number")
3910
+ json.maxItems = maximum;
3911
+ json.type = "array";
3912
+ json.items = process(def.element, ctx, { ...params, path: [...params.path, "items"] });
3913
+ };
3914
+ const objectProcessor = (schema, ctx, _json, params) => {
3915
+ const json = _json;
3916
+ const def = schema._zod.def;
3917
+ json.type = "object";
3918
+ json.properties = {};
3919
+ const shape = def.shape;
3920
+ for (const key in shape) {
3921
+ json.properties[key] = process(shape[key], ctx, {
3922
+ ...params,
3923
+ path: [...params.path, "properties", key],
3924
+ });
3925
+ }
3926
+ // required keys
3927
+ const allKeys = new Set(Object.keys(shape));
3928
+ const requiredKeys = new Set([...allKeys].filter((key) => {
3929
+ const v = def.shape[key]._zod;
3930
+ if (ctx.io === "input") {
3931
+ return v.optin === undefined;
3932
+ }
3933
+ else {
3934
+ return v.optout === undefined;
3935
+ }
3936
+ }));
3937
+ if (requiredKeys.size > 0) {
3938
+ json.required = Array.from(requiredKeys);
3939
+ }
3940
+ // catchall
3941
+ if (def.catchall?._zod.def.type === "never") {
3942
+ // strict
3943
+ json.additionalProperties = false;
3944
+ }
3945
+ else if (!def.catchall) {
3946
+ // regular
3947
+ if (ctx.io === "output")
3948
+ json.additionalProperties = false;
3949
+ }
3950
+ else if (def.catchall) {
3951
+ json.additionalProperties = process(def.catchall, ctx, {
3952
+ ...params,
3953
+ path: [...params.path, "additionalProperties"],
3954
+ });
3955
+ }
3956
+ };
3957
+ const unionProcessor = (schema, ctx, json, params) => {
3958
+ const def = schema._zod.def;
3959
+ // Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches)
3960
+ // This includes both z.xor() and discriminated unions
3961
+ const isExclusive = def.inclusive === false;
3962
+ const options = def.options.map((x, i) => process(x, ctx, {
3963
+ ...params,
3964
+ path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
3965
+ }));
3966
+ if (isExclusive) {
3967
+ json.oneOf = options;
3968
+ }
3969
+ else {
3970
+ json.anyOf = options;
3971
+ }
3972
+ };
3973
+ const intersectionProcessor = (schema, ctx, json, params) => {
3974
+ const def = schema._zod.def;
3975
+ const a = process(def.left, ctx, {
3976
+ ...params,
3977
+ path: [...params.path, "allOf", 0],
3978
+ });
3979
+ const b = process(def.right, ctx, {
3980
+ ...params,
3981
+ path: [...params.path, "allOf", 1],
3982
+ });
3983
+ const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3984
+ const allOf = [
3985
+ ...(isSimpleIntersection(a) ? a.allOf : [a]),
3986
+ ...(isSimpleIntersection(b) ? b.allOf : [b]),
3987
+ ];
3988
+ json.allOf = allOf;
3989
+ };
3990
+ const tupleProcessor = (schema, ctx, _json, params) => {
3991
+ const json = _json;
3992
+ const def = schema._zod.def;
3993
+ json.type = "array";
3994
+ const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
3995
+ const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
3996
+ const prefixItems = def.items.map((x, i) => process(x, ctx, {
3997
+ ...params,
3998
+ path: [...params.path, prefixPath, i],
3999
+ }));
4000
+ const rest = def.rest
4001
+ ? process(def.rest, ctx, {
4002
+ ...params,
4003
+ path: [...params.path, restPath, ...(ctx.target === "openapi-3.0" ? [def.items.length] : [])],
4004
+ })
4005
+ : null;
4006
+ if (ctx.target === "draft-2020-12") {
4007
+ json.prefixItems = prefixItems;
4008
+ if (rest) {
4009
+ json.items = rest;
4010
+ }
4011
+ }
4012
+ else if (ctx.target === "openapi-3.0") {
4013
+ json.items = {
4014
+ anyOf: prefixItems,
4015
+ };
4016
+ if (rest) {
4017
+ json.items.anyOf.push(rest);
4018
+ }
4019
+ json.minItems = prefixItems.length;
4020
+ if (!rest) {
4021
+ json.maxItems = prefixItems.length;
4022
+ }
4023
+ }
4024
+ else {
4025
+ json.items = prefixItems;
4026
+ if (rest) {
4027
+ json.additionalItems = rest;
4028
+ }
4029
+ }
4030
+ // length
4031
+ const { minimum, maximum } = schema._zod.bag;
4032
+ if (typeof minimum === "number")
4033
+ json.minItems = minimum;
4034
+ if (typeof maximum === "number")
4035
+ json.maxItems = maximum;
4036
+ };
4037
+ const recordProcessor = (schema, ctx, _json, params) => {
4038
+ const json = _json;
4039
+ const def = schema._zod.def;
4040
+ json.type = "object";
4041
+ // For looseRecord with regex patterns, use patternProperties
4042
+ // This correctly represents "only validate keys matching the pattern" semantics
4043
+ // and composes well with allOf (intersections)
4044
+ const keyType = def.keyType;
4045
+ const keyBag = keyType._zod.bag;
4046
+ const patterns = keyBag?.patterns;
4047
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
4048
+ // Use patternProperties for looseRecord with regex patterns
4049
+ const valueSchema = process(def.valueType, ctx, {
4050
+ ...params,
4051
+ path: [...params.path, "patternProperties", "*"],
4052
+ });
4053
+ json.patternProperties = {};
4054
+ for (const pattern of patterns) {
4055
+ json.patternProperties[pattern.source] = valueSchema;
4056
+ }
4057
+ }
4058
+ else {
4059
+ // Default behavior: use propertyNames + additionalProperties
4060
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
4061
+ json.propertyNames = process(def.keyType, ctx, {
4062
+ ...params,
4063
+ path: [...params.path, "propertyNames"],
4064
+ });
4065
+ }
4066
+ json.additionalProperties = process(def.valueType, ctx, {
4067
+ ...params,
4068
+ path: [...params.path, "additionalProperties"],
4069
+ });
4070
+ }
4071
+ // Add required for keys with discrete values (enum, literal, etc.)
4072
+ const keyValues = keyType._zod.values;
4073
+ if (keyValues) {
4074
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
4075
+ if (validKeyValues.length > 0) {
4076
+ json.required = validKeyValues;
4077
+ }
4078
+ }
4079
+ };
4080
+ const nullableProcessor = (schema, ctx, json, params) => {
4081
+ const def = schema._zod.def;
4082
+ const inner = process(def.innerType, ctx, params);
4083
+ const seen = ctx.seen.get(schema);
4084
+ if (ctx.target === "openapi-3.0") {
4085
+ seen.ref = def.innerType;
4086
+ json.nullable = true;
4087
+ }
4088
+ else {
4089
+ json.anyOf = [inner, { type: "null" }];
4090
+ }
4091
+ };
4092
+ const nonoptionalProcessor = (schema, ctx, _json, params) => {
4093
+ const def = schema._zod.def;
4094
+ process(def.innerType, ctx, params);
4095
+ const seen = ctx.seen.get(schema);
4096
+ seen.ref = def.innerType;
4097
+ };
4098
+ const defaultProcessor = (schema, ctx, json, params) => {
4099
+ const def = schema._zod.def;
4100
+ process(def.innerType, ctx, params);
4101
+ const seen = ctx.seen.get(schema);
4102
+ seen.ref = def.innerType;
4103
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
4104
+ };
4105
+ const prefaultProcessor = (schema, ctx, json, params) => {
4106
+ const def = schema._zod.def;
4107
+ process(def.innerType, ctx, params);
4108
+ const seen = ctx.seen.get(schema);
4109
+ seen.ref = def.innerType;
4110
+ if (ctx.io === "input")
4111
+ json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
4112
+ };
4113
+ const catchProcessor = (schema, ctx, json, params) => {
4114
+ const def = schema._zod.def;
4115
+ process(def.innerType, ctx, params);
4116
+ const seen = ctx.seen.get(schema);
4117
+ seen.ref = def.innerType;
4118
+ let catchValue;
4119
+ try {
4120
+ catchValue = def.catchValue(undefined);
4121
+ }
4122
+ catch {
4123
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
4124
+ }
4125
+ json.default = catchValue;
4126
+ };
4127
+ const pipeProcessor = (schema, ctx, _json, params) => {
4128
+ const def = schema._zod.def;
4129
+ const innerType = ctx.io === "input" ? (def.in._zod.def.type === "transform" ? def.out : def.in) : def.out;
4130
+ process(innerType, ctx, params);
4131
+ const seen = ctx.seen.get(schema);
4132
+ seen.ref = innerType;
4133
+ };
4134
+ const readonlyProcessor = (schema, ctx, json, params) => {
4135
+ const def = schema._zod.def;
4136
+ process(def.innerType, ctx, params);
4137
+ const seen = ctx.seen.get(schema);
4138
+ seen.ref = def.innerType;
4139
+ json.readOnly = true;
4140
+ };
4141
+ const optionalProcessor = (schema, ctx, _json, params) => {
4142
+ const def = schema._zod.def;
4143
+ process(def.innerType, ctx, params);
4144
+ const seen = ctx.seen.get(schema);
4145
+ seen.ref = def.innerType;
4146
+ };
4147
+
4148
+ const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
4149
+ $ZodISODateTime.init(inst, def);
4150
+ ZodStringFormat.init(inst, def);
4151
+ });
4152
+ function datetime(params) {
4153
+ return _isoDateTime(ZodISODateTime, params);
4154
+ }
4155
+ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
4156
+ $ZodISODate.init(inst, def);
4157
+ ZodStringFormat.init(inst, def);
4158
+ });
4159
+ function date$1(params) {
4160
+ return _isoDate(ZodISODate, params);
4161
+ }
4162
+ const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
4163
+ $ZodISOTime.init(inst, def);
4164
+ ZodStringFormat.init(inst, def);
4165
+ });
4166
+ function time(params) {
4167
+ return _isoTime(ZodISOTime, params);
3271
4168
  }
3272
4169
  const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
3273
4170
  $ZodISODuration.init(inst, def);
@@ -3338,6 +4235,13 @@ const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3338
4235
 
3339
4236
  const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3340
4237
  $ZodType.init(inst, def);
4238
+ Object.assign(inst["~standard"], {
4239
+ jsonSchema: {
4240
+ input: createStandardJSONSchemaMethod(inst, "input"),
4241
+ output: createStandardJSONSchemaMethod(inst, "output"),
4242
+ },
4243
+ });
4244
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
3341
4245
  inst.def = def;
3342
4246
  inst.type = def.type;
3343
4247
  Object.defineProperty(inst, "_def", { value: def });
@@ -3348,8 +4252,11 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3348
4252
  ...(def.checks ?? []),
3349
4253
  ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
3350
4254
  ],
3351
- }));
4255
+ }), {
4256
+ parent: true,
4257
+ });
3352
4258
  };
4259
+ inst.with = inst.check;
3353
4260
  inst.clone = (def, params) => clone(inst, def, params);
3354
4261
  inst.brand = () => inst;
3355
4262
  inst.register = ((reg, meta) => {
@@ -3377,6 +4284,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3377
4284
  inst.overwrite = (fn) => inst.check(_overwrite(fn));
3378
4285
  // wrappers
3379
4286
  inst.optional = () => optional$1(inst);
4287
+ inst.exactOptional = () => exactOptional(inst);
3380
4288
  inst.nullable = () => nullable(inst);
3381
4289
  inst.nullish = () => optional$1(nullable(inst));
3382
4290
  inst.nonoptional = (params) => nonoptional(inst, params);
@@ -3413,12 +4321,14 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3413
4321
  // helpers
3414
4322
  inst.isOptional = () => inst.safeParse(undefined).success;
3415
4323
  inst.isNullable = () => inst.safeParse(null).success;
4324
+ inst.apply = (fn) => fn(inst);
3416
4325
  return inst;
3417
4326
  });
3418
4327
  /** @internal */
3419
4328
  const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
3420
4329
  $ZodString.init(inst, def);
3421
4330
  ZodType.init(inst, def);
4331
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json);
3422
4332
  const bag = inst._zod.bag;
3423
4333
  inst.format = bag.format ?? null;
3424
4334
  inst.minLength = bag.minimum ?? null;
@@ -3439,6 +4349,7 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
3439
4349
  inst.normalize = (...args) => inst.check(_normalize(...args));
3440
4350
  inst.toLowerCase = () => inst.check(_toLowerCase());
3441
4351
  inst.toUpperCase = () => inst.check(_toUpperCase());
4352
+ inst.slugify = () => inst.check(_slugify());
3442
4353
  });
3443
4354
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
3444
4355
  $ZodString.init(inst, def);
@@ -3578,6 +4489,7 @@ const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => {
3578
4489
  const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
3579
4490
  $ZodNumber.init(inst, def);
3580
4491
  ZodType.init(inst, def);
4492
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json);
3581
4493
  inst.gt = (value, params) => inst.check(_gt(value, params));
3582
4494
  inst.gte = (value, params) => inst.check(_gte(value, params));
3583
4495
  inst.min = (value, params) => inst.check(_gte(value, params));
@@ -3616,13 +4528,15 @@ function int(params) {
3616
4528
  const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
3617
4529
  $ZodBoolean.init(inst, def);
3618
4530
  ZodType.init(inst, def);
4531
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json);
3619
4532
  });
3620
- function boolean$1(params) {
4533
+ function boolean(params) {
3621
4534
  return _boolean(ZodBoolean, params);
3622
4535
  }
3623
4536
  const ZodNull = /*@__PURE__*/ $constructor("ZodNull", (inst, def) => {
3624
4537
  $ZodNull.init(inst, def);
3625
4538
  ZodType.init(inst, def);
4539
+ inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json);
3626
4540
  });
3627
4541
  function _null$1(params) {
3628
4542
  return _null$2(ZodNull, params);
@@ -3630,6 +4544,7 @@ function _null$1(params) {
3630
4544
  const ZodAny = /*@__PURE__*/ $constructor("ZodAny", (inst, def) => {
3631
4545
  $ZodAny.init(inst, def);
3632
4546
  ZodType.init(inst, def);
4547
+ inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor();
3633
4548
  });
3634
4549
  function any() {
3635
4550
  return _any(ZodAny);
@@ -3637,6 +4552,7 @@ function any() {
3637
4552
  const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
3638
4553
  $ZodUnknown.init(inst, def);
3639
4554
  ZodType.init(inst, def);
4555
+ inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor();
3640
4556
  });
3641
4557
  function unknown$1() {
3642
4558
  return _unknown(ZodUnknown);
@@ -3644,6 +4560,7 @@ function unknown$1() {
3644
4560
  const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
3645
4561
  $ZodNever.init(inst, def);
3646
4562
  ZodType.init(inst, def);
4563
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json);
3647
4564
  });
3648
4565
  function never(params) {
3649
4566
  return _never(ZodNever, params);
@@ -3651,6 +4568,7 @@ function never(params) {
3651
4568
  const ZodDate = /*@__PURE__*/ $constructor("ZodDate", (inst, def) => {
3652
4569
  $ZodDate.init(inst, def);
3653
4570
  ZodType.init(inst, def);
4571
+ inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx);
3654
4572
  inst.min = (value, params) => inst.check(_gte(value, params));
3655
4573
  inst.max = (value, params) => inst.check(_lte(value, params));
3656
4574
  const c = inst._zod.bag;
@@ -3660,6 +4578,7 @@ const ZodDate = /*@__PURE__*/ $constructor("ZodDate", (inst, def) => {
3660
4578
  const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
3661
4579
  $ZodArray.init(inst, def);
3662
4580
  ZodType.init(inst, def);
4581
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3663
4582
  inst.element = def.element;
3664
4583
  inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
3665
4584
  inst.nonempty = (params) => inst.check(_minLength(1, params));
@@ -3673,6 +4592,7 @@ function array$1(element, params) {
3673
4592
  const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
3674
4593
  $ZodObjectJIT.init(inst, def);
3675
4594
  ZodType.init(inst, def);
4595
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
3676
4596
  defineLazy(inst, "shape", () => {
3677
4597
  return def.shape;
3678
4598
  });
@@ -3705,6 +4625,7 @@ function object$1(shape, params) {
3705
4625
  const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
3706
4626
  $ZodUnion.init(inst, def);
3707
4627
  ZodType.init(inst, def);
4628
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
3708
4629
  inst.options = def.options;
3709
4630
  });
3710
4631
  function union$1(options, params) {
@@ -3717,6 +4638,7 @@ function union$1(options, params) {
3717
4638
  const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
3718
4639
  $ZodIntersection.init(inst, def);
3719
4640
  ZodType.init(inst, def);
4641
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
3720
4642
  });
3721
4643
  function intersection(left, right) {
3722
4644
  return new ZodIntersection({
@@ -3728,6 +4650,7 @@ function intersection(left, right) {
3728
4650
  const ZodTuple = /*@__PURE__*/ $constructor("ZodTuple", (inst, def) => {
3729
4651
  $ZodTuple.init(inst, def);
3730
4652
  ZodType.init(inst, def);
4653
+ inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
3731
4654
  inst.rest = (rest) => inst.clone({
3732
4655
  ...inst._zod.def,
3733
4656
  rest: rest,
@@ -3747,6 +4670,7 @@ function tuple(items, _paramsOrRest, _params) {
3747
4670
  const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
3748
4671
  $ZodRecord.init(inst, def);
3749
4672
  ZodType.init(inst, def);
4673
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
3750
4674
  inst.keyType = def.keyType;
3751
4675
  inst.valueType = def.valueType;
3752
4676
  });
@@ -3761,6 +4685,7 @@ function record$1(keyType, valueType, params) {
3761
4685
  const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
3762
4686
  $ZodEnum.init(inst, def);
3763
4687
  ZodType.init(inst, def);
4688
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json);
3764
4689
  inst.enum = def.entries;
3765
4690
  inst.options = Object.values(def.entries);
3766
4691
  const keys = new Set(Object.keys(def.entries));
@@ -3808,6 +4733,7 @@ function _enum(values, params) {
3808
4733
  const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
3809
4734
  $ZodLiteral.init(inst, def);
3810
4735
  ZodType.init(inst, def);
4736
+ inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json);
3811
4737
  inst.values = new Set(def.values);
3812
4738
  Object.defineProperty(inst, "value", {
3813
4739
  get() {
@@ -3828,6 +4754,7 @@ function literal$1(value, params) {
3828
4754
  const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
3829
4755
  $ZodTransform.init(inst, def);
3830
4756
  ZodType.init(inst, def);
4757
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx);
3831
4758
  inst._zod.parse = (payload, _ctx) => {
3832
4759
  if (_ctx.direction === "backward") {
3833
4760
  throw new $ZodEncodeError(inst.constructor.name);
@@ -3868,6 +4795,7 @@ function transform(fn) {
3868
4795
  const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => {
3869
4796
  $ZodOptional.init(inst, def);
3870
4797
  ZodType.init(inst, def);
4798
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
3871
4799
  inst.unwrap = () => inst._zod.def.innerType;
3872
4800
  });
3873
4801
  function optional$1(innerType) {
@@ -3876,9 +4804,22 @@ function optional$1(innerType) {
3876
4804
  innerType: innerType,
3877
4805
  });
3878
4806
  }
4807
+ const ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => {
4808
+ $ZodExactOptional.init(inst, def);
4809
+ ZodType.init(inst, def);
4810
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
4811
+ inst.unwrap = () => inst._zod.def.innerType;
4812
+ });
4813
+ function exactOptional(innerType) {
4814
+ return new ZodExactOptional({
4815
+ type: "optional",
4816
+ innerType: innerType,
4817
+ });
4818
+ }
3879
4819
  const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
3880
4820
  $ZodNullable.init(inst, def);
3881
4821
  ZodType.init(inst, def);
4822
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
3882
4823
  inst.unwrap = () => inst._zod.def.innerType;
3883
4824
  });
3884
4825
  function nullable(innerType) {
@@ -3890,6 +4831,7 @@ function nullable(innerType) {
3890
4831
  const ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => {
3891
4832
  $ZodDefault.init(inst, def);
3892
4833
  ZodType.init(inst, def);
4834
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
3893
4835
  inst.unwrap = () => inst._zod.def.innerType;
3894
4836
  inst.removeDefault = inst.unwrap;
3895
4837
  });
@@ -3905,6 +4847,7 @@ function _default(innerType, defaultValue) {
3905
4847
  const ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def) => {
3906
4848
  $ZodPrefault.init(inst, def);
3907
4849
  ZodType.init(inst, def);
4850
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
3908
4851
  inst.unwrap = () => inst._zod.def.innerType;
3909
4852
  });
3910
4853
  function prefault(innerType, defaultValue) {
@@ -3919,6 +4862,7 @@ function prefault(innerType, defaultValue) {
3919
4862
  const ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => {
3920
4863
  $ZodNonOptional.init(inst, def);
3921
4864
  ZodType.init(inst, def);
4865
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
3922
4866
  inst.unwrap = () => inst._zod.def.innerType;
3923
4867
  });
3924
4868
  function nonoptional(innerType, params) {
@@ -3931,6 +4875,7 @@ function nonoptional(innerType, params) {
3931
4875
  const ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
3932
4876
  $ZodCatch.init(inst, def);
3933
4877
  ZodType.init(inst, def);
4878
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
3934
4879
  inst.unwrap = () => inst._zod.def.innerType;
3935
4880
  inst.removeCatch = inst.unwrap;
3936
4881
  });
@@ -3944,6 +4889,7 @@ function _catch(innerType, catchValue) {
3944
4889
  const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
3945
4890
  $ZodPipe.init(inst, def);
3946
4891
  ZodType.init(inst, def);
4892
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
3947
4893
  inst.in = def.in;
3948
4894
  inst.out = def.out;
3949
4895
  });
@@ -3958,6 +4904,7 @@ function pipe(in_, out) {
3958
4904
  const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
3959
4905
  $ZodReadonly.init(inst, def);
3960
4906
  ZodType.init(inst, def);
4907
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
3961
4908
  inst.unwrap = () => inst._zod.def.innerType;
3962
4909
  });
3963
4910
  function readonly(innerType) {
@@ -3969,6 +4916,7 @@ function readonly(innerType) {
3969
4916
  const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
3970
4917
  $ZodCustom.init(inst, def);
3971
4918
  ZodType.init(inst, def);
4919
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx);
3972
4920
  });
3973
4921
  function refine(fn, _params = {}) {
3974
4922
  return _refine(ZodCustom, fn, _params);
@@ -3984,10 +4932,10 @@ function date(params) {
3984
4932
 
3985
4933
  const FieldType = _enum(["text", "textarea", "number", "boolean", "select", "radio", "date", "datetime-local", "checkbox", "tel"]);
3986
4934
  const BaseFieldDataSchema = object$1({
3987
- required: boolean$1(),
4935
+ required: boolean(),
3988
4936
  label: string$1(),
3989
4937
  attr_name: string$1(),
3990
- locked: boolean$1().optional(),
4938
+ locked: boolean().optional(),
3991
4939
  locked_text: string$1().optional(),
3992
4940
  })
3993
4941
  .strict();
@@ -3996,11 +4944,11 @@ const SelectOptionSchema = object$1({
3996
4944
  label: string$1(),
3997
4945
  })
3998
4946
  .strict();
3999
- const RadioValue = union$1([string$1(), literal$1("_NOT_SET_"), boolean$1()]).nullable();
4947
+ const RadioValue = union$1([string$1(), literal$1("_NOT_SET_"), boolean()]).nullable();
4000
4948
  const RadioOptionSchema = object$1({
4001
4949
  value: RadioValue,
4002
4950
  label: string$1(),
4003
- checked: boolean$1(),
4951
+ checked: boolean(),
4004
4952
  })
4005
4953
  .strict();
4006
4954
  const TextFieldSchema = BaseFieldDataSchema.extend({
@@ -4026,9 +4974,9 @@ const DateFieldSchema = BaseFieldDataSchema.extend({
4026
4974
  type: _enum(["date", "datetime-local"]),
4027
4975
  }).strict();
4028
4976
  const CustomFieldSchema = BaseFieldDataSchema.extend({
4029
- value: union$1([string$1(), _null$1(), boolean$1(), number$1(), array$1(string$1())]),
4977
+ value: union$1([string$1(), _null$1(), boolean(), number$1(), array$1(string$1())]),
4030
4978
  type: FieldType,
4031
- readonly: boolean$1(),
4979
+ readonly: boolean(),
4032
4980
  radio_options: array$1(RadioOptionSchema).optional(),
4033
4981
  options: array$1(SelectOptionSchema).optional(),
4034
4982
  }).strict();
@@ -4143,16 +5091,16 @@ class ProfileService {
4143
5091
  }
4144
5092
 
4145
5093
  const LoginOptionsSchema = object$1({
4146
- magic_link: boolean$1(),
4147
- password: boolean$1(),
5094
+ magic_link: boolean(),
5095
+ password: boolean(),
4148
5096
  social_logins: array$1(string$1()),
4149
- passkey: boolean$1(),
5097
+ passkey: boolean(),
4150
5098
  });
4151
5099
  const CreateSignInResponseSchema = object$1({
4152
5100
  sid: string$1(),
4153
5101
  status: _enum(["pending_verification", "authenticated", "completed"]),
4154
5102
  email: string$1(),
4155
- expired: boolean$1(),
5103
+ expired: boolean(),
4156
5104
  login_options: LoginOptionsSchema,
4157
5105
  });
4158
5106
  const ErrorSchema = object$1({
@@ -4348,8 +5296,8 @@ class AuthService {
4348
5296
  return [null, null];
4349
5297
  });
4350
5298
  }
4351
- async signOut(signInId) {
4352
- const response = await this.client.post(`/api/sdk/v1/sign_ins/${signInId}/sign_out`, {});
5299
+ async signOut(signInId, globalLogout = false) {
5300
+ const response = await this.client.post(`/api/sdk/v1/sign_ins/${signInId}/sign_out`, { globalLogout });
4353
5301
  return this.handleResponse(response, () => {
4354
5302
  if (!response.success) {
4355
5303
  const error_response = ErrorSchema.parse(response.data);
@@ -4358,15 +5306,25 @@ class AuthService {
4358
5306
  return [null, null];
4359
5307
  });
4360
5308
  }
4361
- async getPasskeyOptions(sid) {
4362
- const endpoint = sid ? `/api/sdk/v1/passkeys/new?sid=${encodeURIComponent(sid)}` : "/api/sdk/v1/passkeys/new";
4363
- const response = await this.client.get(endpoint);
5309
+ async signedIn() {
5310
+ const response = await this.client.get("/api/sdk/v1/sign_ins/signed_in");
4364
5311
  return this.handleResponse(response, () => {
4365
5312
  if (!response.success) {
4366
5313
  const error_response = ErrorSchema.parse(response.data);
4367
- return ["bad_request", error_response];
5314
+ return ["not_found", error_response];
4368
5315
  }
4369
- return [null, PasskeyOptionsResponseSchema.parse(response.data)];
5316
+ return [null, TokenResponseSchema.parse(response.data)];
5317
+ });
5318
+ }
5319
+ async getPasskeyOptions(sid) {
5320
+ const endpoint = sid ? `/api/sdk/v1/passkeys/new?sid=${encodeURIComponent(sid)}` : "/api/sdk/v1/passkeys/new";
5321
+ const response = await this.client.get(endpoint);
5322
+ return this.handleResponse(response, () => {
5323
+ if (!response.success) {
5324
+ const error_response = ErrorSchema.parse(response.data);
5325
+ return ["bad_request", error_response];
5326
+ }
5327
+ return [null, PasskeyOptionsResponseSchema.parse(response.data)];
4370
5328
  });
4371
5329
  }
4372
5330
  async authenticateWithPasskey(credential) {
@@ -4401,138 +5359,6 @@ class AuthService {
4401
5359
  }
4402
5360
  }
4403
5361
 
4404
- const ZodMiniType = /*@__PURE__*/ $constructor("ZodMiniType", (inst, def) => {
4405
- if (!inst._zod)
4406
- throw new Error("Uninitialized schema in ZodMiniType.");
4407
- $ZodType.init(inst, def);
4408
- inst.def = def;
4409
- inst.type = def.type;
4410
- inst.parse = (data, params) => parse$1(inst, data, params, { callee: inst.parse });
4411
- inst.safeParse = (data, params) => safeParse$1(inst, data, params);
4412
- inst.parseAsync = async (data, params) => parseAsync$1(inst, data, params, { callee: inst.parseAsync });
4413
- inst.safeParseAsync = async (data, params) => safeParseAsync$1(inst, data, params);
4414
- inst.check = (...checks) => {
4415
- return inst.clone({
4416
- ...def,
4417
- checks: [
4418
- ...(def.checks ?? []),
4419
- ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
4420
- ],
4421
- }
4422
- // { parent: true }
4423
- );
4424
- };
4425
- inst.clone = (_def, params) => clone(inst, _def, params);
4426
- inst.brand = () => inst;
4427
- inst.register = ((reg, meta) => {
4428
- reg.add(inst, meta);
4429
- return inst;
4430
- });
4431
- });
4432
- const ZodMiniString = /*@__PURE__*/ $constructor("ZodMiniString", (inst, def) => {
4433
- $ZodString.init(inst, def);
4434
- ZodMiniType.init(inst, def);
4435
- });
4436
- function string(params) {
4437
- return _string(ZodMiniString, params);
4438
- }
4439
- const ZodMiniNumber = /*@__PURE__*/ $constructor("ZodMiniNumber", (inst, def) => {
4440
- $ZodNumber.init(inst, def);
4441
- ZodMiniType.init(inst, def);
4442
- });
4443
- function number(params) {
4444
- return _number(ZodMiniNumber, params);
4445
- }
4446
- const ZodMiniBoolean = /*@__PURE__*/ $constructor("ZodMiniBoolean", (inst, def) => {
4447
- $ZodBoolean.init(inst, def);
4448
- ZodMiniType.init(inst, def);
4449
- });
4450
- function boolean(params) {
4451
- return _boolean(ZodMiniBoolean, params);
4452
- }
4453
- const ZodMiniNull = /*@__PURE__*/ $constructor("ZodMiniNull", (inst, def) => {
4454
- $ZodNull.init(inst, def);
4455
- ZodMiniType.init(inst, def);
4456
- });
4457
- function _null(params) {
4458
- return _null$2(ZodMiniNull, params);
4459
- }
4460
- const ZodMiniUnknown = /*@__PURE__*/ $constructor("ZodMiniUnknown", (inst, def) => {
4461
- $ZodUnknown.init(inst, def);
4462
- ZodMiniType.init(inst, def);
4463
- });
4464
- function unknown() {
4465
- return _unknown(ZodMiniUnknown);
4466
- }
4467
- const ZodMiniArray = /*@__PURE__*/ $constructor("ZodMiniArray", (inst, def) => {
4468
- $ZodArray.init(inst, def);
4469
- ZodMiniType.init(inst, def);
4470
- });
4471
- function array(element, params) {
4472
- return new ZodMiniArray({
4473
- type: "array",
4474
- element: element,
4475
- ...normalizeParams(params),
4476
- });
4477
- }
4478
- const ZodMiniObject = /*@__PURE__*/ $constructor("ZodMiniObject", (inst, def) => {
4479
- $ZodObject.init(inst, def);
4480
- ZodMiniType.init(inst, def);
4481
- defineLazy(inst, "shape", () => def.shape);
4482
- });
4483
- function object(shape, params) {
4484
- const def = {
4485
- type: "object",
4486
- shape: shape ?? {},
4487
- ...normalizeParams(params),
4488
- };
4489
- return new ZodMiniObject(def);
4490
- }
4491
- const ZodMiniUnion = /*@__PURE__*/ $constructor("ZodMiniUnion", (inst, def) => {
4492
- $ZodUnion.init(inst, def);
4493
- ZodMiniType.init(inst, def);
4494
- });
4495
- function union(options, params) {
4496
- return new ZodMiniUnion({
4497
- type: "union",
4498
- options: options,
4499
- ...normalizeParams(params),
4500
- });
4501
- }
4502
- const ZodMiniRecord = /*@__PURE__*/ $constructor("ZodMiniRecord", (inst, def) => {
4503
- $ZodRecord.init(inst, def);
4504
- ZodMiniType.init(inst, def);
4505
- });
4506
- function record(keyType, valueType, params) {
4507
- return new ZodMiniRecord({
4508
- type: "record",
4509
- keyType,
4510
- valueType: valueType,
4511
- ...normalizeParams(params),
4512
- });
4513
- }
4514
- const ZodMiniLiteral = /*@__PURE__*/ $constructor("ZodMiniLiteral", (inst, def) => {
4515
- $ZodLiteral.init(inst, def);
4516
- ZodMiniType.init(inst, def);
4517
- });
4518
- function literal(value, params) {
4519
- return new ZodMiniLiteral({
4520
- type: "literal",
4521
- values: Array.isArray(value) ? value : [value],
4522
- ...normalizeParams(params),
4523
- });
4524
- }
4525
- const ZodMiniOptional = /*@__PURE__*/ $constructor("ZodMiniOptional", (inst, def) => {
4526
- $ZodOptional.init(inst, def);
4527
- ZodMiniType.init(inst, def);
4528
- });
4529
- function optional(innerType) {
4530
- return new ZodMiniOptional({
4531
- type: "optional",
4532
- innerType: innerType,
4533
- });
4534
- }
4535
-
4536
5362
  function getDefaultExportFromCjs (x) {
4537
5363
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
4538
5364
  }
@@ -4887,93 +5713,197 @@ function requireEventemitter3 () {
4887
5713
  var eventemitter3Exports = requireEventemitter3();
4888
5714
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
4889
5715
 
4890
- const NewsletterSubscriptionSchema = object({
4891
- id: number(),
4892
- email: string(),
4893
- newsletter_internal_name: string(),
4894
- preference_identifiers: array(string()),
4895
- preference_token: string(),
4896
- confirmed_at: union([string(), _null()]),
4897
- });
4898
- const NewsletterSubscriptionErrorSchema = object({
4899
- error_identifier: string(),
4900
- error_details: optional(record(string(), array(string()))),
4901
- meta: object({
4902
- newsletter_internal_name: string(),
4903
- }),
4904
- });
4905
- const CreateSubscriptionsResponseSchema = object({
4906
- results: array(NewsletterSubscriptionSchema),
4907
- errors: array(NewsletterSubscriptionErrorSchema),
4908
- });
4909
- const AdditionalFieldsSchema = object({
4910
- first_name: optional(union([string(), _null()])),
4911
- last_name: optional(union([string(), _null()])),
4912
- salutation: optional(union([literal("mr"), literal("mrs"), literal("mx"), _null()])),
4913
- phone_number: optional(union([string(), _null()])),
4914
- date_of_birth: optional(union([string(), _null()])),
4915
- company_name: optional(union([string(), _null()])),
4916
- address_line_1: optional(union([string(), _null()])),
4917
- address_line_2: optional(union([string(), _null()])),
4918
- city: optional(union([string(), _null()])),
4919
- postal_code: optional(union([string(), _null()])),
4920
- country_code: optional(union([string(), _null()])),
4921
- preferred_language: optional(union([string(), _null()])),
4922
- custom_attributes: optional(union([record(string(), unknown()), _null()])),
5716
+ const ZodMiniType = /*@__PURE__*/ $constructor("ZodMiniType", (inst, def) => {
5717
+ if (!inst._zod)
5718
+ throw new Error("Uninitialized schema in ZodMiniType.");
5719
+ $ZodType.init(inst, def);
5720
+ inst.def = def;
5721
+ inst.type = def.type;
5722
+ inst.parse = (data, params) => parse$1(inst, data, params, { callee: inst.parse });
5723
+ inst.safeParse = (data, params) => safeParse$1(inst, data, params);
5724
+ inst.parseAsync = async (data, params) => parseAsync$1(inst, data, params, { callee: inst.parseAsync });
5725
+ inst.safeParseAsync = async (data, params) => safeParseAsync$1(inst, data, params);
5726
+ inst.check = (...checks) => {
5727
+ return inst.clone({
5728
+ ...def,
5729
+ checks: [
5730
+ ...(def.checks ?? []),
5731
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
5732
+ ],
5733
+ }, { parent: true });
5734
+ };
5735
+ inst.with = inst.check;
5736
+ inst.clone = (_def, params) => clone(inst, _def, params);
5737
+ inst.brand = () => inst;
5738
+ inst.register = ((reg, meta) => {
5739
+ reg.add(inst, meta);
5740
+ return inst;
5741
+ });
5742
+ inst.apply = (fn) => fn(inst);
4923
5743
  });
4924
- const CreateSubscriptionsPayloadSchema = object({
4925
- email: string(),
4926
- additional_fields: optional(AdditionalFieldsSchema),
4927
- newsletter_subscriptions: array(object({
4928
- newsletter_internal_name: string(),
4929
- preference_identifiers: optional(array(string())),
4930
- })),
4931
- redirect_to_after_confirmation: optional(string()),
5744
+ const ZodMiniString = /*@__PURE__*/ $constructor("ZodMiniString", (inst, def) => {
5745
+ $ZodString.init(inst, def);
5746
+ ZodMiniType.init(inst, def);
4932
5747
  });
4933
- const UpdateSubscriptionPayloadSchema = object({
4934
- preference_identifiers: array(string()),
5748
+ // @__NO_SIDE_EFFECTS__
5749
+ function string(params) {
5750
+ return _string(ZodMiniString, params);
5751
+ }
5752
+ const ZodMiniNumber = /*@__PURE__*/ $constructor("ZodMiniNumber", (inst, def) => {
5753
+ $ZodNumber.init(inst, def);
5754
+ ZodMiniType.init(inst, def);
4935
5755
  });
4936
- const LoginEmailPayloadSchema = object({
4937
- email: string(),
4938
- redirect_uri: string(),
5756
+ // @__NO_SIDE_EFFECTS__
5757
+ function number(params) {
5758
+ return _number(ZodMiniNumber, params);
5759
+ }
5760
+ const ZodMiniNull = /*@__PURE__*/ $constructor("ZodMiniNull", (inst, def) => {
5761
+ $ZodNull.init(inst, def);
5762
+ ZodMiniType.init(inst, def);
4939
5763
  });
4940
- const ResendDoiPayloadSchema = object({
4941
- redirect_to_after_confirmation: optional(string()),
5764
+ // @__NO_SIDE_EFFECTS__
5765
+ function _null(params) {
5766
+ return _null$2(ZodMiniNull, params);
5767
+ }
5768
+ const ZodMiniUnknown = /*@__PURE__*/ $constructor("ZodMiniUnknown", (inst, def) => {
5769
+ $ZodUnknown.init(inst, def);
5770
+ ZodMiniType.init(inst, def);
4942
5771
  });
4943
- const PreferenceSchema = object({
4944
- id: number(),
4945
- name: string(),
4946
- description: union([string(), _null()]),
4947
- plugin_identifier: union([string(), _null()]),
4948
- position: number(),
4949
- default: boolean(),
4950
- hidden: boolean(),
4951
- });
4952
- const PreferenceGroupSchema = object({
4953
- id: number(),
4954
- name: string(),
4955
- position: number(),
4956
- flat: boolean(),
4957
- preferences: array(PreferenceSchema),
5772
+ // @__NO_SIDE_EFFECTS__
5773
+ function unknown() {
5774
+ return _unknown(ZodMiniUnknown);
5775
+ }
5776
+ const ZodMiniArray = /*@__PURE__*/ $constructor("ZodMiniArray", (inst, def) => {
5777
+ $ZodArray.init(inst, def);
5778
+ ZodMiniType.init(inst, def);
4958
5779
  });
4959
- const NewsletterSchema = object({
4960
- id: number(),
4961
- internal_name: string(),
4962
- default: boolean(),
4963
- position: number(),
4964
- opt_in_type: string(),
4965
- title: string(),
4966
- description: union([string(), _null()]),
4967
- created_at: string(),
4968
- updated_at: string(),
4969
- preference_groups: array(PreferenceGroupSchema),
4970
- });
4971
- object({
4972
- newsletters: array(NewsletterSchema),
5780
+ // @__NO_SIDE_EFFECTS__
5781
+ function array(element, params) {
5782
+ return new ZodMiniArray({
5783
+ type: "array",
5784
+ element: element,
5785
+ ...normalizeParams(params),
5786
+ });
5787
+ }
5788
+ const ZodMiniObject = /*@__PURE__*/ $constructor("ZodMiniObject", (inst, def) => {
5789
+ $ZodObject.init(inst, def);
5790
+ ZodMiniType.init(inst, def);
5791
+ defineLazy(inst, "shape", () => def.shape);
4973
5792
  });
4974
- class NewsletterService extends EventEmitter {
4975
- client;
4976
- logger = createLogger("NewsletterService");
5793
+ // @__NO_SIDE_EFFECTS__
5794
+ function object(shape, params) {
5795
+ const def = {
5796
+ type: "object",
5797
+ shape: shape ?? {},
5798
+ ...normalizeParams(params),
5799
+ };
5800
+ return new ZodMiniObject(def);
5801
+ }
5802
+ const ZodMiniUnion = /*@__PURE__*/ $constructor("ZodMiniUnion", (inst, def) => {
5803
+ $ZodUnion.init(inst, def);
5804
+ ZodMiniType.init(inst, def);
5805
+ });
5806
+ // @__NO_SIDE_EFFECTS__
5807
+ function union(options, params) {
5808
+ return new ZodMiniUnion({
5809
+ type: "union",
5810
+ options: options,
5811
+ ...normalizeParams(params),
5812
+ });
5813
+ }
5814
+ const ZodMiniRecord = /*@__PURE__*/ $constructor("ZodMiniRecord", (inst, def) => {
5815
+ $ZodRecord.init(inst, def);
5816
+ ZodMiniType.init(inst, def);
5817
+ });
5818
+ // @__NO_SIDE_EFFECTS__
5819
+ function record(keyType, valueType, params) {
5820
+ return new ZodMiniRecord({
5821
+ type: "record",
5822
+ keyType,
5823
+ valueType: valueType,
5824
+ ...normalizeParams(params),
5825
+ });
5826
+ }
5827
+ const ZodMiniLiteral = /*@__PURE__*/ $constructor("ZodMiniLiteral", (inst, def) => {
5828
+ $ZodLiteral.init(inst, def);
5829
+ ZodMiniType.init(inst, def);
5830
+ });
5831
+ // @__NO_SIDE_EFFECTS__
5832
+ function literal(value, params) {
5833
+ return new ZodMiniLiteral({
5834
+ type: "literal",
5835
+ values: Array.isArray(value) ? value : [value],
5836
+ ...normalizeParams(params),
5837
+ });
5838
+ }
5839
+ const ZodMiniOptional = /*@__PURE__*/ $constructor("ZodMiniOptional", (inst, def) => {
5840
+ $ZodOptional.init(inst, def);
5841
+ ZodMiniType.init(inst, def);
5842
+ });
5843
+ // @__NO_SIDE_EFFECTS__
5844
+ function optional(innerType) {
5845
+ return new ZodMiniOptional({
5846
+ type: "optional",
5847
+ innerType: innerType,
5848
+ });
5849
+ }
5850
+
5851
+ const NewsletterSubscriptionSchema = object({
5852
+ id: number(),
5853
+ email: string(),
5854
+ newsletter_internal_name: string(),
5855
+ preference_identifiers: array(string()),
5856
+ preference_token: string(),
5857
+ confirmed_at: union([string(), _null()]),
5858
+ });
5859
+ const NewsletterSubscriptionErrorSchema = object({
5860
+ error_identifier: string(),
5861
+ error_details: optional(record(string(), array(string()))),
5862
+ meta: object({
5863
+ newsletter_internal_name: string(),
5864
+ }),
5865
+ });
5866
+ const CreateSubscriptionsResponseSchema = object({
5867
+ results: array(NewsletterSubscriptionSchema),
5868
+ errors: array(NewsletterSubscriptionErrorSchema),
5869
+ });
5870
+ const AdditionalFieldsSchema = object({
5871
+ first_name: optional(union([string(), _null()])),
5872
+ last_name: optional(union([string(), _null()])),
5873
+ salutation: optional(union([literal("mr"), literal("mrs"), literal("mx"), _null()])),
5874
+ phone_number: optional(union([string(), _null()])),
5875
+ date_of_birth: optional(union([string(), _null()])),
5876
+ company_name: optional(union([string(), _null()])),
5877
+ address_line_1: optional(union([string(), _null()])),
5878
+ address_line_2: optional(union([string(), _null()])),
5879
+ city: optional(union([string(), _null()])),
5880
+ postal_code: optional(union([string(), _null()])),
5881
+ country_code: optional(union([string(), _null()])),
5882
+ preferred_language: optional(union([string(), _null()])),
5883
+ custom_attributes: optional(union([record(string(), unknown()), _null()])),
5884
+ });
5885
+ const CreateSubscriptionsPayloadSchema = object({
5886
+ email: string(),
5887
+ additional_fields: optional(AdditionalFieldsSchema),
5888
+ newsletter_subscriptions: array(object({
5889
+ newsletter_internal_name: string(),
5890
+ preference_identifiers: optional(array(string())),
5891
+ })),
5892
+ redirect_to_after_confirmation: optional(string()),
5893
+ });
5894
+ const UpdateSubscriptionPayloadSchema = object({
5895
+ preference_identifiers: array(string()),
5896
+ });
5897
+ const LoginEmailPayloadSchema = object({
5898
+ email: string(),
5899
+ redirect_uri: string(),
5900
+ });
5901
+ const ResendDoiPayloadSchema = object({
5902
+ redirect_to_after_confirmation: optional(string()),
5903
+ });
5904
+ class NewsletterService extends EventEmitter {
5905
+ client;
5906
+ logger = createLogger("NewsletterService");
4977
5907
  constructor(client) {
4978
5908
  super();
4979
5909
  this.client = client;
@@ -5072,32 +6002,6 @@ class NewsletterService extends EventEmitter {
5072
6002
  }
5073
6003
  }
5074
6004
 
5075
- const SchemaValidationErrorSchema = object$1({
5076
- error_identifier: string$1(), // unprocessable entity etc. TODO we can define enum later
5077
- errors: array$1(string$1()),
5078
- });
5079
- const PaginationMetaSchema = object$1({
5080
- count: number$1(),
5081
- page: number$1(),
5082
- limit: number$1(),
5083
- last: number$1(),
5084
- prev: number$1().nullable(),
5085
- next: number$1().nullable(),
5086
- });
5087
- const PaginationParamsSchema = object$1({
5088
- page: number$1().int().min(1),
5089
- limit: number$1().int().min(0).max(250),
5090
- });
5091
-
5092
- const TicketableListParamsBaseSchema = object$1({
5093
- service_id: number$1().nullable(),
5094
- state: string$1(),
5095
- payment_state: string$1(),
5096
- order_by: _enum(["starts_at", "ends_at", "reference", "created_at"]),
5097
- order_direction: _enum(["asc", "desc"]),
5098
- })
5099
- .merge(PaginationParamsSchema);
5100
-
5101
6005
  function getWithSchema(client, returnSchema, urlBuilder, paramSchema) {
5102
6006
  const fn = async (args, params) => {
5103
6007
  // Build URL
@@ -5132,90 +6036,257 @@ function getWithSchema(client, returnSchema, urlBuilder, paramSchema) {
5132
6036
  return fn;
5133
6037
  }
5134
6038
 
6039
+ const SchemaValidationErrorSchema = object$1({
6040
+ error_identifier: string$1(), // unprocessable entity etc. TODO we can define enum later
6041
+ errors: array$1(string$1()),
6042
+ });
6043
+ const PaginationMetaSchema = object$1({
6044
+ count: number$1(),
6045
+ page: number$1(),
6046
+ limit: number$1(),
6047
+ last: number$1(),
6048
+ prev: number$1().nullable(),
6049
+ next: number$1().nullable(),
6050
+ });
6051
+ const PaginationParamsSchema = object$1({
6052
+ page: number$1().int().min(1),
6053
+ limit: number$1().int().min(0).max(250),
6054
+ });
6055
+
6056
+ const TicketableListParamsBaseSchema = object$1({
6057
+ service_id: number$1().nullable(),
6058
+ state: string$1(),
6059
+ payment_state: string$1(),
6060
+ order_by: _enum(["starts_at", "ends_at", "reference", "created_at"]),
6061
+ order_direction: _enum(["asc", "desc"]),
6062
+ })
6063
+ .merge(PaginationParamsSchema);
6064
+
5135
6065
  // Date transformer for ISO8601 strings
5136
6066
  const dateTransformer$1 = date();
5137
6067
  const nullableDateTransformer$1 = date().nullable();
5138
- // Ticket types based on TicketSerializer
5139
- const TicketSchema = object$1({
6068
+ // Subscription types based on SubscriptionSerializer
6069
+ const SubscriptionSchema = object$1({
5140
6070
  id: uuid(), // unidy_id
5141
6071
  title: string$1(),
5142
- text: string$1().nullable(),
5143
- reference: string$1(),
6072
+ text: string$1(),
6073
+ payment_frequency: string$1().nullable(),
5144
6074
  metadata: record$1(string$1(), unknown$1()).nullable(),
5145
6075
  wallet_export: record$1(string$1(), unknown$1()).nullable(),
5146
6076
  state: string$1(),
6077
+ reference: string$1(),
5147
6078
  payment_state: string$1().nullable(),
5148
- button_cta_url: string$1().nullable(),
5149
- info_banner: string$1().nullable(),
5150
- seating: string$1().nullable(),
5151
- venue: string$1().nullable(),
5152
6079
  currency: string$1().nullable(),
5153
- starts_at: dateTransformer$1, // ISO8601(3) -> Date
5154
- ends_at: nullableDateTransformer$1, // ISO8601(3) -> Date | null
6080
+ button_cta_url: string$1().nullable(),
5155
6081
  created_at: dateTransformer$1, // ISO8601(3) -> Date
5156
6082
  updated_at: dateTransformer$1, // ISO8601(3) -> Date
6083
+ starts_at: nullableDateTransformer$1, // ISO8601(3) -> Date | null
6084
+ ends_at: nullableDateTransformer$1, // ISO8601(3) -> Date | null
6085
+ next_payment_at: nullableDateTransformer$1, // ISO8601(3) -> Date | null
5157
6086
  price: number$1(), // decimal(8, 2) -> float
5158
6087
  user_id: uuid(),
5159
- ticket_category_id: uuid(),
6088
+ subscription_category_id: uuid(),
5160
6089
  });
5161
6090
  // List response
5162
- const TicketsListResponseSchema = object$1({
6091
+ const SubscriptionsListResponseSchema = object$1({
5163
6092
  meta: PaginationMetaSchema,
5164
- results: array$1(TicketSchema),
6093
+ results: array$1(SubscriptionSchema),
5165
6094
  });
5166
6095
  // Query params schema with validations
5167
- const TicketsListParamsSchema = TicketableListParamsBaseSchema.extend({ ticket_category_id: string$1().uuid() }).partial();
5168
- class TicketsService {
6096
+ const SubscriptionsListParamsSchema = TicketableListParamsBaseSchema.extend({ subscription_category_id: string$1().uuid() }).partial();
6097
+ class SubscriptionsService {
5169
6098
  client;
5170
6099
  list;
5171
6100
  get;
5172
6101
  constructor(client) {
5173
6102
  this.client = client;
5174
- this.list = getWithSchema(this.client, TicketsListResponseSchema, (_args) => "/api/sdk/v1/tickets", TicketsListParamsSchema);
5175
- this.get = getWithSchema(this.client, TicketSchema, (args) => `/api/sdk/v1/tickets/${args.id}`);
6103
+ this.list = getWithSchema(this.client, SubscriptionsListResponseSchema, (_args) => "/api/sdk/v1/subscriptions", SubscriptionsListParamsSchema);
6104
+ this.get = getWithSchema(this.client, SubscriptionSchema, (args) => `/api/sdk/v1/subscriptions/${args.id}`);
5176
6105
  }
5177
6106
  }
5178
6107
 
5179
6108
  // Date transformer for ISO8601 strings
5180
6109
  const dateTransformer = date();
5181
6110
  const nullableDateTransformer = date().nullable();
5182
- // Subscription types based on SubscriptionSerializer
5183
- const SubscriptionSchema = object$1({
6111
+ // Ticket types based on TicketSerializer
6112
+ const TicketSchema = object$1({
5184
6113
  id: uuid(), // unidy_id
5185
6114
  title: string$1(),
5186
- text: string$1(),
5187
- payment_frequency: string$1().nullable(),
6115
+ text: string$1().nullable(),
6116
+ reference: string$1(),
5188
6117
  metadata: record$1(string$1(), unknown$1()).nullable(),
5189
6118
  wallet_export: record$1(string$1(), unknown$1()).nullable(),
5190
6119
  state: string$1(),
5191
- reference: string$1(),
5192
6120
  payment_state: string$1().nullable(),
5193
- currency: string$1().nullable(),
5194
6121
  button_cta_url: string$1().nullable(),
6122
+ info_banner: string$1().nullable(),
6123
+ seating: string$1().nullable(),
6124
+ venue: string$1().nullable(),
6125
+ currency: string$1().nullable(),
6126
+ starts_at: dateTransformer, // ISO8601(3) -> Date
6127
+ ends_at: nullableDateTransformer, // ISO8601(3) -> Date | null
5195
6128
  created_at: dateTransformer, // ISO8601(3) -> Date
5196
6129
  updated_at: dateTransformer, // ISO8601(3) -> Date
5197
- starts_at: nullableDateTransformer, // ISO8601(3) -> Date | null
5198
- ends_at: nullableDateTransformer, // ISO8601(3) -> Date | null
5199
- next_payment_at: nullableDateTransformer, // ISO8601(3) -> Date | null
5200
6130
  price: number$1(), // decimal(8, 2) -> float
5201
6131
  user_id: uuid(),
5202
- subscription_category_id: uuid(),
6132
+ ticket_category_id: uuid(),
5203
6133
  });
5204
6134
  // List response
5205
- const SubscriptionsListResponseSchema = object$1({
6135
+ const TicketsListResponseSchema = object$1({
5206
6136
  meta: PaginationMetaSchema,
5207
- results: array$1(SubscriptionSchema),
6137
+ results: array$1(TicketSchema),
5208
6138
  });
5209
6139
  // Query params schema with validations
5210
- const SubscriptionsListParamsSchema = TicketableListParamsBaseSchema.extend({ subscription_category_id: string$1().uuid() }).partial();
5211
- class SubscriptionsService {
6140
+ const TicketsListParamsSchema = TicketableListParamsBaseSchema.extend({ ticket_category_id: string$1().uuid() }).partial();
6141
+ class TicketsService {
5212
6142
  client;
5213
6143
  list;
5214
6144
  get;
5215
6145
  constructor(client) {
5216
6146
  this.client = client;
5217
- this.list = getWithSchema(this.client, SubscriptionsListResponseSchema, (_args) => "/api/sdk/v1/subscriptions", SubscriptionsListParamsSchema);
5218
- this.get = getWithSchema(this.client, SubscriptionSchema, (args) => `/api/sdk/v1/subscriptions/${args.id}`);
6147
+ this.list = getWithSchema(this.client, TicketsListResponseSchema, (_args) => "/api/sdk/v1/tickets", TicketsListParamsSchema);
6148
+ this.get = getWithSchema(this.client, TicketSchema, (args) => `/api/sdk/v1/tickets/${args.id}`);
6149
+ }
6150
+ }
6151
+
6152
+ class ApiClient {
6153
+ baseUrl;
6154
+ api_key;
6155
+ static CONNECTION_ERROR_MESSAGES = [
6156
+ "Failed to fetch",
6157
+ "NetworkError",
6158
+ "ERR_CONNECTION_REFUSED",
6159
+ "ERR_NETWORK",
6160
+ "ERR_INTERNET_DISCONNECTED",
6161
+ ];
6162
+ onConnectionChange;
6163
+ logger = createLogger("ApiClient");
6164
+ constructor(baseUrl, api_key, onConnectionChange) {
6165
+ this.baseUrl = baseUrl;
6166
+ this.api_key = api_key;
6167
+ this.api_key = api_key;
6168
+ this.onConnectionChange = onConnectionChange;
6169
+ }
6170
+ isConnectionError(error) {
6171
+ if (error instanceof Error) {
6172
+ return ApiClient.CONNECTION_ERROR_MESSAGES.some((msg) => error.message.includes(msg));
6173
+ }
6174
+ return false;
6175
+ }
6176
+ setConnectionStatus(isConnected) {
6177
+ if (this.onConnectionChange) {
6178
+ this.onConnectionChange(isConnected);
6179
+ }
6180
+ }
6181
+ baseHeaders() {
6182
+ const h = new Headers();
6183
+ h.set("Content-Type", "application/json");
6184
+ h.set("Accept", "application/json");
6185
+ h.set("Authorization", `Bearer ${this.api_key}`);
6186
+ return h;
6187
+ }
6188
+ mergeHeaders(base, extra) {
6189
+ const out = new Headers(base);
6190
+ if (extra) {
6191
+ new Headers(extra).forEach((v, k) => {
6192
+ out.set(k, v);
6193
+ });
6194
+ }
6195
+ return out;
6196
+ }
6197
+ async request(method, endpoint, body, headers) {
6198
+ let res = null;
6199
+ try {
6200
+ res = await fetch(`${this.baseUrl}${endpoint}`, {
6201
+ method,
6202
+ mode: "cors",
6203
+ credentials: "include",
6204
+ headers: this.mergeHeaders(this.baseHeaders(), headers),
6205
+ body: JSON.stringify(body) || undefined,
6206
+ });
6207
+ let data;
6208
+ try {
6209
+ data = await res.json();
6210
+ }
6211
+ catch {
6212
+ data = undefined;
6213
+ }
6214
+ this.setConnectionStatus(true);
6215
+ const response = {
6216
+ data,
6217
+ status: res.status,
6218
+ headers: res.headers,
6219
+ success: res.ok,
6220
+ connectionError: false,
6221
+ };
6222
+ return response;
6223
+ }
6224
+ catch (error) {
6225
+ const connectionFailed = this.isConnectionError(error);
6226
+ if (connectionFailed) {
6227
+ this.setConnectionStatus(false);
6228
+ captureException(error, {
6229
+ tags: { error_type: "connection_error" },
6230
+ extra: { endpoint, method },
6231
+ });
6232
+ }
6233
+ const response = {
6234
+ status: res ? res.status : connectionFailed ? 0 : 500,
6235
+ error: error instanceof Error ? error.message : String(error),
6236
+ headers: res ? res.headers : new Headers(),
6237
+ success: false,
6238
+ data: undefined,
6239
+ connectionError: connectionFailed,
6240
+ };
6241
+ return response;
6242
+ }
6243
+ }
6244
+ async get(endpoint, headers) {
6245
+ return this.request("GET", endpoint, undefined, headers);
6246
+ }
6247
+ async post(endpoint, body, headers) {
6248
+ return this.request("POST", endpoint, body, headers);
6249
+ }
6250
+ async patch(endpoint, body, headers) {
6251
+ return this.request("PATCH", endpoint, body, headers);
6252
+ }
6253
+ async delete(endpoint, headers) {
6254
+ return this.request("DELETE", endpoint, undefined, headers);
6255
+ }
6256
+ getWithSchema(returnSchema, urlBuilder, paramSchema) {
6257
+ const fn = async (args, params) => {
6258
+ // Build URL
6259
+ const baseUrl = urlBuilder(args);
6260
+ // Validate and parse params with Zod if provided
6261
+ let queryString = "";
6262
+ if (paramSchema && params) {
6263
+ const validatedParams = paramSchema.parse(params);
6264
+ queryString = `?${new URLSearchParams(validatedParams).toString()}`;
6265
+ }
6266
+ const fullUrl = `${baseUrl}${queryString}`;
6267
+ const response = await this.get(fullUrl);
6268
+ if (!response.success || !response.data) {
6269
+ return response;
6270
+ }
6271
+ const parsed = returnSchema.safeParse(response.data);
6272
+ if (!parsed.success) {
6273
+ this.logger.error("Invalid response format", parsed.error);
6274
+ return {
6275
+ ...response,
6276
+ success: false,
6277
+ error: t("errors.invalid_response_format", {
6278
+ defaultValue: "Invalid response format",
6279
+ }),
6280
+ data: undefined,
6281
+ };
6282
+ }
6283
+ return {
6284
+ ...response,
6285
+ data: parsed.data,
6286
+ };
6287
+ };
6288
+ // biome-ignore lint/suspicious/noExplicitAny: fn can literally be any function
6289
+ return fn;
5219
6290
  }
5220
6291
  }
5221
6292
 
@@ -5248,7 +6319,7 @@ function getUnidyClient() {
5248
6319
  return instance;
5249
6320
  }
5250
6321
 
5251
- export { ApiClient as A, NewsletterService as N, ProfileService as P, SchemaValidationErrorSchema as S, TicketsService as T, UnidyClient as U, AuthService as a, UserProfileSchema as b, PaginationMetaSchema as c, PaginationParamsSchema as d, SubscriptionsService as e, getUnidyClient as g };
5252
- //# sourceMappingURL=index-DSDkaHWI.js.map
6322
+ export { ApiClient as A, NewsletterService as N, ProfileService as P, SubscriptionsService as S, TicketsService as T, UnidyClient as U, AuthService as a, UserProfileSchema as b, SchemaValidationErrorSchema as c, PaginationMetaSchema as d, PaginationParamsSchema as e, getUnidyClient as g };
6323
+ //# sourceMappingURL=index-Du3hUdhU.js.map
5253
6324
 
5254
- //# sourceMappingURL=index-DSDkaHWI.js.map
6325
+ //# sourceMappingURL=index-Du3hUdhU.js.map