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