dino-validation 0.1.0

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 (535) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +1880 -0
  3. package/dist/dv.esm.js +1667 -0
  4. package/dist/dv.esm.js.map +1 -0
  5. package/dist/dv.js +1684 -0
  6. package/dist/dv.js.map +1 -0
  7. package/dist/dv.min.js +12 -0
  8. package/dist/dv.min.js.map +1 -0
  9. package/dist/localization/messages_ar.esm.js +36 -0
  10. package/dist/localization/messages_ar.esm.js.map +1 -0
  11. package/dist/localization/messages_ar.js +42 -0
  12. package/dist/localization/messages_ar.js.map +1 -0
  13. package/dist/localization/messages_ar.min.js +12 -0
  14. package/dist/localization/messages_ar.min.js.map +1 -0
  15. package/dist/localization/messages_az.esm.js +36 -0
  16. package/dist/localization/messages_az.esm.js.map +1 -0
  17. package/dist/localization/messages_az.js +42 -0
  18. package/dist/localization/messages_az.js.map +1 -0
  19. package/dist/localization/messages_az.min.js +12 -0
  20. package/dist/localization/messages_az.min.js.map +1 -0
  21. package/dist/localization/messages_bg.esm.js +36 -0
  22. package/dist/localization/messages_bg.esm.js.map +1 -0
  23. package/dist/localization/messages_bg.js +42 -0
  24. package/dist/localization/messages_bg.js.map +1 -0
  25. package/dist/localization/messages_bg.min.js +12 -0
  26. package/dist/localization/messages_bg.min.js.map +1 -0
  27. package/dist/localization/messages_bn_BD.esm.js +36 -0
  28. package/dist/localization/messages_bn_BD.esm.js.map +1 -0
  29. package/dist/localization/messages_bn_BD.js +42 -0
  30. package/dist/localization/messages_bn_BD.js.map +1 -0
  31. package/dist/localization/messages_bn_BD.min.js +12 -0
  32. package/dist/localization/messages_bn_BD.min.js.map +1 -0
  33. package/dist/localization/messages_ca.esm.js +36 -0
  34. package/dist/localization/messages_ca.esm.js.map +1 -0
  35. package/dist/localization/messages_ca.js +42 -0
  36. package/dist/localization/messages_ca.js.map +1 -0
  37. package/dist/localization/messages_ca.min.js +12 -0
  38. package/dist/localization/messages_ca.min.js.map +1 -0
  39. package/dist/localization/messages_cs.esm.js +36 -0
  40. package/dist/localization/messages_cs.esm.js.map +1 -0
  41. package/dist/localization/messages_cs.js +42 -0
  42. package/dist/localization/messages_cs.js.map +1 -0
  43. package/dist/localization/messages_cs.min.js +12 -0
  44. package/dist/localization/messages_cs.min.js.map +1 -0
  45. package/dist/localization/messages_da.esm.js +35 -0
  46. package/dist/localization/messages_da.esm.js.map +1 -0
  47. package/dist/localization/messages_da.js +41 -0
  48. package/dist/localization/messages_da.js.map +1 -0
  49. package/dist/localization/messages_da.min.js +12 -0
  50. package/dist/localization/messages_da.min.js.map +1 -0
  51. package/dist/localization/messages_de.esm.js +36 -0
  52. package/dist/localization/messages_de.esm.js.map +1 -0
  53. package/dist/localization/messages_de.js +42 -0
  54. package/dist/localization/messages_de.js.map +1 -0
  55. package/dist/localization/messages_de.min.js +12 -0
  56. package/dist/localization/messages_de.min.js.map +1 -0
  57. package/dist/localization/messages_el.esm.js +36 -0
  58. package/dist/localization/messages_el.esm.js.map +1 -0
  59. package/dist/localization/messages_el.js +42 -0
  60. package/dist/localization/messages_el.js.map +1 -0
  61. package/dist/localization/messages_el.min.js +12 -0
  62. package/dist/localization/messages_el.min.js.map +1 -0
  63. package/dist/localization/messages_es.esm.js +36 -0
  64. package/dist/localization/messages_es.esm.js.map +1 -0
  65. package/dist/localization/messages_es.js +42 -0
  66. package/dist/localization/messages_es.js.map +1 -0
  67. package/dist/localization/messages_es.min.js +12 -0
  68. package/dist/localization/messages_es.min.js.map +1 -0
  69. package/dist/localization/messages_es_AR.esm.js +36 -0
  70. package/dist/localization/messages_es_AR.esm.js.map +1 -0
  71. package/dist/localization/messages_es_AR.js +42 -0
  72. package/dist/localization/messages_es_AR.js.map +1 -0
  73. package/dist/localization/messages_es_AR.min.js +12 -0
  74. package/dist/localization/messages_es_AR.min.js.map +1 -0
  75. package/dist/localization/messages_es_PE.esm.js +36 -0
  76. package/dist/localization/messages_es_PE.esm.js.map +1 -0
  77. package/dist/localization/messages_es_PE.js +42 -0
  78. package/dist/localization/messages_es_PE.js.map +1 -0
  79. package/dist/localization/messages_es_PE.min.js +12 -0
  80. package/dist/localization/messages_es_PE.min.js.map +1 -0
  81. package/dist/localization/messages_et.esm.js +36 -0
  82. package/dist/localization/messages_et.esm.js.map +1 -0
  83. package/dist/localization/messages_et.js +42 -0
  84. package/dist/localization/messages_et.js.map +1 -0
  85. package/dist/localization/messages_et.min.js +12 -0
  86. package/dist/localization/messages_et.min.js.map +1 -0
  87. package/dist/localization/messages_eu.esm.js +36 -0
  88. package/dist/localization/messages_eu.esm.js.map +1 -0
  89. package/dist/localization/messages_eu.js +42 -0
  90. package/dist/localization/messages_eu.js.map +1 -0
  91. package/dist/localization/messages_eu.min.js +12 -0
  92. package/dist/localization/messages_eu.min.js.map +1 -0
  93. package/dist/localization/messages_fa.esm.js +36 -0
  94. package/dist/localization/messages_fa.esm.js.map +1 -0
  95. package/dist/localization/messages_fa.js +42 -0
  96. package/dist/localization/messages_fa.js.map +1 -0
  97. package/dist/localization/messages_fa.min.js +12 -0
  98. package/dist/localization/messages_fa.min.js.map +1 -0
  99. package/dist/localization/messages_fi.esm.js +36 -0
  100. package/dist/localization/messages_fi.esm.js.map +1 -0
  101. package/dist/localization/messages_fi.js +42 -0
  102. package/dist/localization/messages_fi.js.map +1 -0
  103. package/dist/localization/messages_fi.min.js +12 -0
  104. package/dist/localization/messages_fi.min.js.map +1 -0
  105. package/dist/localization/messages_fr.esm.js +33 -0
  106. package/dist/localization/messages_fr.esm.js.map +1 -0
  107. package/dist/localization/messages_fr.js +39 -0
  108. package/dist/localization/messages_fr.js.map +1 -0
  109. package/dist/localization/messages_fr.min.js +12 -0
  110. package/dist/localization/messages_fr.min.js.map +1 -0
  111. package/dist/localization/messages_ge.esm.js +36 -0
  112. package/dist/localization/messages_ge.esm.js.map +1 -0
  113. package/dist/localization/messages_ge.js +42 -0
  114. package/dist/localization/messages_ge.js.map +1 -0
  115. package/dist/localization/messages_ge.min.js +12 -0
  116. package/dist/localization/messages_ge.min.js.map +1 -0
  117. package/dist/localization/messages_gl.esm.js +36 -0
  118. package/dist/localization/messages_gl.esm.js.map +1 -0
  119. package/dist/localization/messages_gl.js +42 -0
  120. package/dist/localization/messages_gl.js.map +1 -0
  121. package/dist/localization/messages_gl.min.js +12 -0
  122. package/dist/localization/messages_gl.min.js.map +1 -0
  123. package/dist/localization/messages_he.esm.js +36 -0
  124. package/dist/localization/messages_he.esm.js.map +1 -0
  125. package/dist/localization/messages_he.js +42 -0
  126. package/dist/localization/messages_he.js.map +1 -0
  127. package/dist/localization/messages_he.min.js +12 -0
  128. package/dist/localization/messages_he.min.js.map +1 -0
  129. package/dist/localization/messages_hi.esm.js +36 -0
  130. package/dist/localization/messages_hi.esm.js.map +1 -0
  131. package/dist/localization/messages_hi.js +42 -0
  132. package/dist/localization/messages_hi.js.map +1 -0
  133. package/dist/localization/messages_hi.min.js +12 -0
  134. package/dist/localization/messages_hi.min.js.map +1 -0
  135. package/dist/localization/messages_hr.esm.js +36 -0
  136. package/dist/localization/messages_hr.esm.js.map +1 -0
  137. package/dist/localization/messages_hr.js +42 -0
  138. package/dist/localization/messages_hr.js.map +1 -0
  139. package/dist/localization/messages_hr.min.js +12 -0
  140. package/dist/localization/messages_hr.min.js.map +1 -0
  141. package/dist/localization/messages_hu.esm.js +36 -0
  142. package/dist/localization/messages_hu.esm.js.map +1 -0
  143. package/dist/localization/messages_hu.js +42 -0
  144. package/dist/localization/messages_hu.js.map +1 -0
  145. package/dist/localization/messages_hu.min.js +12 -0
  146. package/dist/localization/messages_hu.min.js.map +1 -0
  147. package/dist/localization/messages_hy_AM.esm.js +36 -0
  148. package/dist/localization/messages_hy_AM.esm.js.map +1 -0
  149. package/dist/localization/messages_hy_AM.js +42 -0
  150. package/dist/localization/messages_hy_AM.js.map +1 -0
  151. package/dist/localization/messages_hy_AM.min.js +12 -0
  152. package/dist/localization/messages_hy_AM.min.js.map +1 -0
  153. package/dist/localization/messages_id.esm.js +36 -0
  154. package/dist/localization/messages_id.esm.js.map +1 -0
  155. package/dist/localization/messages_id.js +42 -0
  156. package/dist/localization/messages_id.js.map +1 -0
  157. package/dist/localization/messages_id.min.js +12 -0
  158. package/dist/localization/messages_id.min.js.map +1 -0
  159. package/dist/localization/messages_is.esm.js +35 -0
  160. package/dist/localization/messages_is.esm.js.map +1 -0
  161. package/dist/localization/messages_is.js +41 -0
  162. package/dist/localization/messages_is.js.map +1 -0
  163. package/dist/localization/messages_is.min.js +12 -0
  164. package/dist/localization/messages_is.min.js.map +1 -0
  165. package/dist/localization/messages_it.esm.js +36 -0
  166. package/dist/localization/messages_it.esm.js.map +1 -0
  167. package/dist/localization/messages_it.js +42 -0
  168. package/dist/localization/messages_it.js.map +1 -0
  169. package/dist/localization/messages_it.min.js +12 -0
  170. package/dist/localization/messages_it.min.js.map +1 -0
  171. package/dist/localization/messages_ja.esm.js +36 -0
  172. package/dist/localization/messages_ja.esm.js.map +1 -0
  173. package/dist/localization/messages_ja.js +42 -0
  174. package/dist/localization/messages_ja.js.map +1 -0
  175. package/dist/localization/messages_ja.min.js +12 -0
  176. package/dist/localization/messages_ja.min.js.map +1 -0
  177. package/dist/localization/messages_ka.esm.js +36 -0
  178. package/dist/localization/messages_ka.esm.js.map +1 -0
  179. package/dist/localization/messages_ka.js +42 -0
  180. package/dist/localization/messages_ka.js.map +1 -0
  181. package/dist/localization/messages_ka.min.js +12 -0
  182. package/dist/localization/messages_ka.min.js.map +1 -0
  183. package/dist/localization/messages_kk.esm.js +36 -0
  184. package/dist/localization/messages_kk.esm.js.map +1 -0
  185. package/dist/localization/messages_kk.js +42 -0
  186. package/dist/localization/messages_kk.js.map +1 -0
  187. package/dist/localization/messages_kk.min.js +12 -0
  188. package/dist/localization/messages_kk.min.js.map +1 -0
  189. package/dist/localization/messages_ko.esm.js +36 -0
  190. package/dist/localization/messages_ko.esm.js.map +1 -0
  191. package/dist/localization/messages_ko.js +42 -0
  192. package/dist/localization/messages_ko.js.map +1 -0
  193. package/dist/localization/messages_ko.min.js +12 -0
  194. package/dist/localization/messages_ko.min.js.map +1 -0
  195. package/dist/localization/messages_lt.esm.js +36 -0
  196. package/dist/localization/messages_lt.esm.js.map +1 -0
  197. package/dist/localization/messages_lt.js +42 -0
  198. package/dist/localization/messages_lt.js.map +1 -0
  199. package/dist/localization/messages_lt.min.js +12 -0
  200. package/dist/localization/messages_lt.min.js.map +1 -0
  201. package/dist/localization/messages_lv.esm.js +36 -0
  202. package/dist/localization/messages_lv.esm.js.map +1 -0
  203. package/dist/localization/messages_lv.js +42 -0
  204. package/dist/localization/messages_lv.js.map +1 -0
  205. package/dist/localization/messages_lv.min.js +12 -0
  206. package/dist/localization/messages_lv.min.js.map +1 -0
  207. package/dist/localization/messages_mk.esm.js +36 -0
  208. package/dist/localization/messages_mk.esm.js.map +1 -0
  209. package/dist/localization/messages_mk.js +42 -0
  210. package/dist/localization/messages_mk.js.map +1 -0
  211. package/dist/localization/messages_mk.min.js +12 -0
  212. package/dist/localization/messages_mk.min.js.map +1 -0
  213. package/dist/localization/messages_my.esm.js +36 -0
  214. package/dist/localization/messages_my.esm.js.map +1 -0
  215. package/dist/localization/messages_my.js +42 -0
  216. package/dist/localization/messages_my.js.map +1 -0
  217. package/dist/localization/messages_my.min.js +12 -0
  218. package/dist/localization/messages_my.min.js.map +1 -0
  219. package/dist/localization/messages_nl.esm.js +36 -0
  220. package/dist/localization/messages_nl.esm.js.map +1 -0
  221. package/dist/localization/messages_nl.js +42 -0
  222. package/dist/localization/messages_nl.js.map +1 -0
  223. package/dist/localization/messages_nl.min.js +12 -0
  224. package/dist/localization/messages_nl.min.js.map +1 -0
  225. package/dist/localization/messages_no.esm.js +36 -0
  226. package/dist/localization/messages_no.esm.js.map +1 -0
  227. package/dist/localization/messages_no.js +42 -0
  228. package/dist/localization/messages_no.js.map +1 -0
  229. package/dist/localization/messages_no.min.js +12 -0
  230. package/dist/localization/messages_no.min.js.map +1 -0
  231. package/dist/localization/messages_pl.esm.js +36 -0
  232. package/dist/localization/messages_pl.esm.js.map +1 -0
  233. package/dist/localization/messages_pl.js +42 -0
  234. package/dist/localization/messages_pl.js.map +1 -0
  235. package/dist/localization/messages_pl.min.js +12 -0
  236. package/dist/localization/messages_pl.min.js.map +1 -0
  237. package/dist/localization/messages_pt_BR.esm.js +36 -0
  238. package/dist/localization/messages_pt_BR.esm.js.map +1 -0
  239. package/dist/localization/messages_pt_BR.js +42 -0
  240. package/dist/localization/messages_pt_BR.js.map +1 -0
  241. package/dist/localization/messages_pt_BR.min.js +12 -0
  242. package/dist/localization/messages_pt_BR.min.js.map +1 -0
  243. package/dist/localization/messages_pt_PT.esm.js +36 -0
  244. package/dist/localization/messages_pt_PT.esm.js.map +1 -0
  245. package/dist/localization/messages_pt_PT.js +42 -0
  246. package/dist/localization/messages_pt_PT.js.map +1 -0
  247. package/dist/localization/messages_pt_PT.min.js +12 -0
  248. package/dist/localization/messages_pt_PT.min.js.map +1 -0
  249. package/dist/localization/messages_ro.esm.js +36 -0
  250. package/dist/localization/messages_ro.esm.js.map +1 -0
  251. package/dist/localization/messages_ro.js +42 -0
  252. package/dist/localization/messages_ro.js.map +1 -0
  253. package/dist/localization/messages_ro.min.js +12 -0
  254. package/dist/localization/messages_ro.min.js.map +1 -0
  255. package/dist/localization/messages_ru.esm.js +36 -0
  256. package/dist/localization/messages_ru.esm.js.map +1 -0
  257. package/dist/localization/messages_ru.js +42 -0
  258. package/dist/localization/messages_ru.js.map +1 -0
  259. package/dist/localization/messages_ru.min.js +12 -0
  260. package/dist/localization/messages_ru.min.js.map +1 -0
  261. package/dist/localization/messages_sd.esm.js +36 -0
  262. package/dist/localization/messages_sd.esm.js.map +1 -0
  263. package/dist/localization/messages_sd.js +42 -0
  264. package/dist/localization/messages_sd.js.map +1 -0
  265. package/dist/localization/messages_sd.min.js +12 -0
  266. package/dist/localization/messages_sd.min.js.map +1 -0
  267. package/dist/localization/messages_si.esm.js +36 -0
  268. package/dist/localization/messages_si.esm.js.map +1 -0
  269. package/dist/localization/messages_si.js +42 -0
  270. package/dist/localization/messages_si.js.map +1 -0
  271. package/dist/localization/messages_si.min.js +12 -0
  272. package/dist/localization/messages_si.min.js.map +1 -0
  273. package/dist/localization/messages_sk.esm.js +35 -0
  274. package/dist/localization/messages_sk.esm.js.map +1 -0
  275. package/dist/localization/messages_sk.js +41 -0
  276. package/dist/localization/messages_sk.js.map +1 -0
  277. package/dist/localization/messages_sk.min.js +12 -0
  278. package/dist/localization/messages_sk.min.js.map +1 -0
  279. package/dist/localization/messages_sl.esm.js +36 -0
  280. package/dist/localization/messages_sl.esm.js.map +1 -0
  281. package/dist/localization/messages_sl.js +42 -0
  282. package/dist/localization/messages_sl.js.map +1 -0
  283. package/dist/localization/messages_sl.min.js +12 -0
  284. package/dist/localization/messages_sl.min.js.map +1 -0
  285. package/dist/localization/messages_sr.esm.js +36 -0
  286. package/dist/localization/messages_sr.esm.js.map +1 -0
  287. package/dist/localization/messages_sr.js +42 -0
  288. package/dist/localization/messages_sr.js.map +1 -0
  289. package/dist/localization/messages_sr.min.js +12 -0
  290. package/dist/localization/messages_sr.min.js.map +1 -0
  291. package/dist/localization/messages_sr_lat.esm.js +36 -0
  292. package/dist/localization/messages_sr_lat.esm.js.map +1 -0
  293. package/dist/localization/messages_sr_lat.js +42 -0
  294. package/dist/localization/messages_sr_lat.js.map +1 -0
  295. package/dist/localization/messages_sr_lat.min.js +12 -0
  296. package/dist/localization/messages_sr_lat.min.js.map +1 -0
  297. package/dist/localization/messages_sv.esm.js +36 -0
  298. package/dist/localization/messages_sv.esm.js.map +1 -0
  299. package/dist/localization/messages_sv.js +42 -0
  300. package/dist/localization/messages_sv.js.map +1 -0
  301. package/dist/localization/messages_sv.min.js +12 -0
  302. package/dist/localization/messages_sv.min.js.map +1 -0
  303. package/dist/localization/messages_th.esm.js +36 -0
  304. package/dist/localization/messages_th.esm.js.map +1 -0
  305. package/dist/localization/messages_th.js +42 -0
  306. package/dist/localization/messages_th.js.map +1 -0
  307. package/dist/localization/messages_th.min.js +12 -0
  308. package/dist/localization/messages_th.min.js.map +1 -0
  309. package/dist/localization/messages_tj.esm.js +36 -0
  310. package/dist/localization/messages_tj.esm.js.map +1 -0
  311. package/dist/localization/messages_tj.js +42 -0
  312. package/dist/localization/messages_tj.js.map +1 -0
  313. package/dist/localization/messages_tj.min.js +12 -0
  314. package/dist/localization/messages_tj.min.js.map +1 -0
  315. package/dist/localization/messages_tr.esm.js +36 -0
  316. package/dist/localization/messages_tr.esm.js.map +1 -0
  317. package/dist/localization/messages_tr.js +42 -0
  318. package/dist/localization/messages_tr.js.map +1 -0
  319. package/dist/localization/messages_tr.min.js +12 -0
  320. package/dist/localization/messages_tr.min.js.map +1 -0
  321. package/dist/localization/messages_uk.esm.js +36 -0
  322. package/dist/localization/messages_uk.esm.js.map +1 -0
  323. package/dist/localization/messages_uk.js +42 -0
  324. package/dist/localization/messages_uk.js.map +1 -0
  325. package/dist/localization/messages_uk.min.js +12 -0
  326. package/dist/localization/messages_uk.min.js.map +1 -0
  327. package/dist/localization/messages_ur.esm.js +36 -0
  328. package/dist/localization/messages_ur.esm.js.map +1 -0
  329. package/dist/localization/messages_ur.js +42 -0
  330. package/dist/localization/messages_ur.js.map +1 -0
  331. package/dist/localization/messages_ur.min.js +12 -0
  332. package/dist/localization/messages_ur.min.js.map +1 -0
  333. package/dist/localization/messages_vi.esm.js +36 -0
  334. package/dist/localization/messages_vi.esm.js.map +1 -0
  335. package/dist/localization/messages_vi.js +42 -0
  336. package/dist/localization/messages_vi.js.map +1 -0
  337. package/dist/localization/messages_vi.min.js +12 -0
  338. package/dist/localization/messages_vi.min.js.map +1 -0
  339. package/dist/localization/messages_zh.esm.js +36 -0
  340. package/dist/localization/messages_zh.esm.js.map +1 -0
  341. package/dist/localization/messages_zh.js +42 -0
  342. package/dist/localization/messages_zh.js.map +1 -0
  343. package/dist/localization/messages_zh.min.js +12 -0
  344. package/dist/localization/messages_zh.min.js.map +1 -0
  345. package/dist/localization/messages_zh_TW.esm.js +36 -0
  346. package/dist/localization/messages_zh_TW.esm.js.map +1 -0
  347. package/dist/localization/messages_zh_TW.js +42 -0
  348. package/dist/localization/messages_zh_TW.js.map +1 -0
  349. package/dist/localization/messages_zh_TW.min.js +12 -0
  350. package/dist/localization/messages_zh_TW.min.js.map +1 -0
  351. package/dist/localization/methods_de.esm.js +25 -0
  352. package/dist/localization/methods_de.esm.js.map +1 -0
  353. package/dist/localization/methods_de.js +31 -0
  354. package/dist/localization/methods_de.js.map +1 -0
  355. package/dist/localization/methods_de.min.js +12 -0
  356. package/dist/localization/methods_de.min.js.map +1 -0
  357. package/dist/localization/methods_es_CL.esm.js +25 -0
  358. package/dist/localization/methods_es_CL.esm.js.map +1 -0
  359. package/dist/localization/methods_es_CL.js +31 -0
  360. package/dist/localization/methods_es_CL.js.map +1 -0
  361. package/dist/localization/methods_es_CL.min.js +12 -0
  362. package/dist/localization/methods_es_CL.min.js.map +1 -0
  363. package/dist/localization/methods_fi.esm.js +25 -0
  364. package/dist/localization/methods_fi.esm.js.map +1 -0
  365. package/dist/localization/methods_fi.js +31 -0
  366. package/dist/localization/methods_fi.js.map +1 -0
  367. package/dist/localization/methods_fi.min.js +12 -0
  368. package/dist/localization/methods_fi.min.js.map +1 -0
  369. package/dist/localization/methods_it.esm.js +25 -0
  370. package/dist/localization/methods_it.esm.js.map +1 -0
  371. package/dist/localization/methods_it.js +31 -0
  372. package/dist/localization/methods_it.js.map +1 -0
  373. package/dist/localization/methods_it.min.js +12 -0
  374. package/dist/localization/methods_it.min.js.map +1 -0
  375. package/dist/localization/methods_nl.esm.js +25 -0
  376. package/dist/localization/methods_nl.esm.js.map +1 -0
  377. package/dist/localization/methods_nl.js +31 -0
  378. package/dist/localization/methods_nl.js.map +1 -0
  379. package/dist/localization/methods_nl.min.js +12 -0
  380. package/dist/localization/methods_nl.min.js.map +1 -0
  381. package/dist/localization/methods_pt.esm.js +22 -0
  382. package/dist/localization/methods_pt.esm.js.map +1 -0
  383. package/dist/localization/methods_pt.js +28 -0
  384. package/dist/localization/methods_pt.js.map +1 -0
  385. package/dist/localization/methods_pt.min.js +12 -0
  386. package/dist/localization/methods_pt.min.js.map +1 -0
  387. package/dist/types/defaults.d.ts +3 -0
  388. package/dist/types/defaults.d.ts.map +1 -0
  389. package/dist/types/eventManager.d.ts +34 -0
  390. package/dist/types/eventManager.d.ts.map +1 -0
  391. package/dist/types/helpers.d.ts +86 -0
  392. package/dist/types/helpers.d.ts.map +1 -0
  393. package/dist/types/index.d.ts +100 -0
  394. package/dist/types/index.d.ts.map +1 -0
  395. package/dist/types/localization/messages_ar.d.ts +2 -0
  396. package/dist/types/localization/messages_ar.d.ts.map +1 -0
  397. package/dist/types/localization/messages_az.d.ts +2 -0
  398. package/dist/types/localization/messages_az.d.ts.map +1 -0
  399. package/dist/types/localization/messages_bg.d.ts +2 -0
  400. package/dist/types/localization/messages_bg.d.ts.map +1 -0
  401. package/dist/types/localization/messages_bn_BD.d.ts +2 -0
  402. package/dist/types/localization/messages_bn_BD.d.ts.map +1 -0
  403. package/dist/types/localization/messages_ca.d.ts +2 -0
  404. package/dist/types/localization/messages_ca.d.ts.map +1 -0
  405. package/dist/types/localization/messages_cs.d.ts +2 -0
  406. package/dist/types/localization/messages_cs.d.ts.map +1 -0
  407. package/dist/types/localization/messages_da.d.ts +2 -0
  408. package/dist/types/localization/messages_da.d.ts.map +1 -0
  409. package/dist/types/localization/messages_de.d.ts +2 -0
  410. package/dist/types/localization/messages_de.d.ts.map +1 -0
  411. package/dist/types/localization/messages_el.d.ts +2 -0
  412. package/dist/types/localization/messages_el.d.ts.map +1 -0
  413. package/dist/types/localization/messages_es.d.ts +2 -0
  414. package/dist/types/localization/messages_es.d.ts.map +1 -0
  415. package/dist/types/localization/messages_es_AR.d.ts +2 -0
  416. package/dist/types/localization/messages_es_AR.d.ts.map +1 -0
  417. package/dist/types/localization/messages_es_PE.d.ts +2 -0
  418. package/dist/types/localization/messages_es_PE.d.ts.map +1 -0
  419. package/dist/types/localization/messages_et.d.ts +2 -0
  420. package/dist/types/localization/messages_et.d.ts.map +1 -0
  421. package/dist/types/localization/messages_eu.d.ts +2 -0
  422. package/dist/types/localization/messages_eu.d.ts.map +1 -0
  423. package/dist/types/localization/messages_fa.d.ts +2 -0
  424. package/dist/types/localization/messages_fa.d.ts.map +1 -0
  425. package/dist/types/localization/messages_fi.d.ts +2 -0
  426. package/dist/types/localization/messages_fi.d.ts.map +1 -0
  427. package/dist/types/localization/messages_fr.d.ts +2 -0
  428. package/dist/types/localization/messages_fr.d.ts.map +1 -0
  429. package/dist/types/localization/messages_ge.d.ts +2 -0
  430. package/dist/types/localization/messages_ge.d.ts.map +1 -0
  431. package/dist/types/localization/messages_gl.d.ts +2 -0
  432. package/dist/types/localization/messages_gl.d.ts.map +1 -0
  433. package/dist/types/localization/messages_he.d.ts +2 -0
  434. package/dist/types/localization/messages_he.d.ts.map +1 -0
  435. package/dist/types/localization/messages_hi.d.ts +2 -0
  436. package/dist/types/localization/messages_hi.d.ts.map +1 -0
  437. package/dist/types/localization/messages_hr.d.ts +2 -0
  438. package/dist/types/localization/messages_hr.d.ts.map +1 -0
  439. package/dist/types/localization/messages_hu.d.ts +2 -0
  440. package/dist/types/localization/messages_hu.d.ts.map +1 -0
  441. package/dist/types/localization/messages_hy_AM.d.ts +2 -0
  442. package/dist/types/localization/messages_hy_AM.d.ts.map +1 -0
  443. package/dist/types/localization/messages_id.d.ts +2 -0
  444. package/dist/types/localization/messages_id.d.ts.map +1 -0
  445. package/dist/types/localization/messages_is.d.ts +2 -0
  446. package/dist/types/localization/messages_is.d.ts.map +1 -0
  447. package/dist/types/localization/messages_it.d.ts +2 -0
  448. package/dist/types/localization/messages_it.d.ts.map +1 -0
  449. package/dist/types/localization/messages_ja.d.ts +2 -0
  450. package/dist/types/localization/messages_ja.d.ts.map +1 -0
  451. package/dist/types/localization/messages_ka.d.ts +2 -0
  452. package/dist/types/localization/messages_ka.d.ts.map +1 -0
  453. package/dist/types/localization/messages_kk.d.ts +2 -0
  454. package/dist/types/localization/messages_kk.d.ts.map +1 -0
  455. package/dist/types/localization/messages_ko.d.ts +2 -0
  456. package/dist/types/localization/messages_ko.d.ts.map +1 -0
  457. package/dist/types/localization/messages_lt.d.ts +2 -0
  458. package/dist/types/localization/messages_lt.d.ts.map +1 -0
  459. package/dist/types/localization/messages_lv.d.ts +2 -0
  460. package/dist/types/localization/messages_lv.d.ts.map +1 -0
  461. package/dist/types/localization/messages_mk.d.ts +2 -0
  462. package/dist/types/localization/messages_mk.d.ts.map +1 -0
  463. package/dist/types/localization/messages_my.d.ts +2 -0
  464. package/dist/types/localization/messages_my.d.ts.map +1 -0
  465. package/dist/types/localization/messages_nl.d.ts +2 -0
  466. package/dist/types/localization/messages_nl.d.ts.map +1 -0
  467. package/dist/types/localization/messages_no.d.ts +2 -0
  468. package/dist/types/localization/messages_no.d.ts.map +1 -0
  469. package/dist/types/localization/messages_pl.d.ts +2 -0
  470. package/dist/types/localization/messages_pl.d.ts.map +1 -0
  471. package/dist/types/localization/messages_pt_BR.d.ts +2 -0
  472. package/dist/types/localization/messages_pt_BR.d.ts.map +1 -0
  473. package/dist/types/localization/messages_pt_PT.d.ts +2 -0
  474. package/dist/types/localization/messages_pt_PT.d.ts.map +1 -0
  475. package/dist/types/localization/messages_ro.d.ts +2 -0
  476. package/dist/types/localization/messages_ro.d.ts.map +1 -0
  477. package/dist/types/localization/messages_ru.d.ts +2 -0
  478. package/dist/types/localization/messages_ru.d.ts.map +1 -0
  479. package/dist/types/localization/messages_sd.d.ts +2 -0
  480. package/dist/types/localization/messages_sd.d.ts.map +1 -0
  481. package/dist/types/localization/messages_si.d.ts +2 -0
  482. package/dist/types/localization/messages_si.d.ts.map +1 -0
  483. package/dist/types/localization/messages_sk.d.ts +2 -0
  484. package/dist/types/localization/messages_sk.d.ts.map +1 -0
  485. package/dist/types/localization/messages_sl.d.ts +2 -0
  486. package/dist/types/localization/messages_sl.d.ts.map +1 -0
  487. package/dist/types/localization/messages_sr.d.ts +2 -0
  488. package/dist/types/localization/messages_sr.d.ts.map +1 -0
  489. package/dist/types/localization/messages_sr_lat.d.ts +2 -0
  490. package/dist/types/localization/messages_sr_lat.d.ts.map +1 -0
  491. package/dist/types/localization/messages_sv.d.ts +2 -0
  492. package/dist/types/localization/messages_sv.d.ts.map +1 -0
  493. package/dist/types/localization/messages_th.d.ts +2 -0
  494. package/dist/types/localization/messages_th.d.ts.map +1 -0
  495. package/dist/types/localization/messages_tj.d.ts +2 -0
  496. package/dist/types/localization/messages_tj.d.ts.map +1 -0
  497. package/dist/types/localization/messages_tr.d.ts +2 -0
  498. package/dist/types/localization/messages_tr.d.ts.map +1 -0
  499. package/dist/types/localization/messages_uk.d.ts +2 -0
  500. package/dist/types/localization/messages_uk.d.ts.map +1 -0
  501. package/dist/types/localization/messages_ur.d.ts +2 -0
  502. package/dist/types/localization/messages_ur.d.ts.map +1 -0
  503. package/dist/types/localization/messages_vi.d.ts +2 -0
  504. package/dist/types/localization/messages_vi.d.ts.map +1 -0
  505. package/dist/types/localization/messages_zh.d.ts +2 -0
  506. package/dist/types/localization/messages_zh.d.ts.map +1 -0
  507. package/dist/types/localization/messages_zh_TW.d.ts +2 -0
  508. package/dist/types/localization/messages_zh_TW.d.ts.map +1 -0
  509. package/dist/types/localization/methods_de.d.ts +2 -0
  510. package/dist/types/localization/methods_de.d.ts.map +1 -0
  511. package/dist/types/localization/methods_es_CL.d.ts +2 -0
  512. package/dist/types/localization/methods_es_CL.d.ts.map +1 -0
  513. package/dist/types/localization/methods_fi.d.ts +2 -0
  514. package/dist/types/localization/methods_fi.d.ts.map +1 -0
  515. package/dist/types/localization/methods_it.d.ts +2 -0
  516. package/dist/types/localization/methods_it.d.ts.map +1 -0
  517. package/dist/types/localization/methods_nl.d.ts +2 -0
  518. package/dist/types/localization/methods_nl.d.ts.map +1 -0
  519. package/dist/types/localization/methods_pt.d.ts +2 -0
  520. package/dist/types/localization/methods_pt.d.ts.map +1 -0
  521. package/dist/types/messages.d.ts +21 -0
  522. package/dist/types/messages.d.ts.map +1 -0
  523. package/dist/types/methods.d.ts +7 -0
  524. package/dist/types/methods.d.ts.map +1 -0
  525. package/dist/types/objectStore.d.ts +9 -0
  526. package/dist/types/objectStore.d.ts.map +1 -0
  527. package/dist/types/rules.d.ts +29 -0
  528. package/dist/types/rules.d.ts.map +1 -0
  529. package/dist/types/types.d.ts +55 -0
  530. package/dist/types/types.d.ts.map +1 -0
  531. package/dist/types/validator.d.ts +120 -0
  532. package/dist/types/validator.d.ts.map +1 -0
  533. package/dist/types/validatorStore.d.ts +3 -0
  534. package/dist/types/validatorStore.d.ts.map +1 -0
  535. package/package.json +61 -0
package/dist/dv.js ADDED
@@ -0,0 +1,1684 @@
1
+ /*!
2
+ * dino-validation v0.1.0
3
+ * https://github.com/cadamsmith/dino-validation
4
+ *
5
+ * Copyright (c) Jörn Zaefferer (jQuery Validation)
6
+ * Copyright (c) 2026 Adam Smith (dino-validation - vanilla JS port)
7
+ *
8
+ * Released under the MIT License
9
+ * https://github.com/cadamsmith/dino-validation/blob/main/LICENSE
10
+ */
11
+
12
+ (function (global, factory) {
13
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
14
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
15
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.dv = {}));
16
+ })(this, (function (exports) { 'use strict';
17
+
18
+ /**
19
+ * Returns true if the element is visible in the DOM.
20
+ * @param el - element to check visibility
21
+ * @return true if element is visible, false otherwise
22
+ */
23
+ function isVisible(el) {
24
+ return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length);
25
+ }
26
+ /**
27
+ * Returns the number of truthy properties in an object.
28
+ * @param obj - object to count properties
29
+ * @return count of truthy properties
30
+ */
31
+ function objectLength(obj) {
32
+ let count = 0;
33
+ for (const key in obj) {
34
+ // This check allows counting elements with empty error message as invalid elements
35
+ if (obj[key] !== undefined && obj[key] !== null && obj[key] !== false) {
36
+ count++;
37
+ }
38
+ }
39
+ return count;
40
+ }
41
+ /**
42
+ * Finds all form elements with the specified name attribute.
43
+ * @param form - form element to search within
44
+ * @param name - name attribute to search for
45
+ * @return array of matching elements
46
+ */
47
+ function findByName(form, name) {
48
+ const selector = `[name='${escapeCssMeta(name)}']`;
49
+ const elements = Array.from(form.querySelectorAll(selector));
50
+ if (form.id) {
51
+ const outsideElements = Array.from(document.querySelectorAll(selector)).filter((el) => el.matches(`[form="${escapeCssMeta(form.id)}"]`));
52
+ elements.push(...outsideElements);
53
+ }
54
+ return elements;
55
+ }
56
+ /**
57
+ * Returns true if the element is a radio button or checkbox.
58
+ * @param element - element to check
59
+ * @return true if element is radio or checkbox, false otherwise
60
+ */
61
+ function isCheckableElement(element) {
62
+ return /radio|checkbox/i.test(element.type || '');
63
+ }
64
+ /**
65
+ * Escapes CSS meta-characters in a string for use in CSS selectors.
66
+ * See https://api.jquery.com/category/selectors/ for CSS meta-characters that should be escaped.
67
+ * @param text - text to escape
68
+ * @return escaped text safe for CSS selectors
69
+ */
70
+ function escapeCssMeta(text) {
71
+ if (text === undefined) {
72
+ return '';
73
+ }
74
+ return text.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, '\\$1');
75
+ }
76
+ /**
77
+ * Gets the value of a form element, handling special cases for different input types.
78
+ * @param element - form control element to get value of
79
+ * @param form - current html form being validated
80
+ * @return element value or array of values for checkboxes/radios
81
+ */
82
+ function elementValue(element, form) {
83
+ if (element.type === 'radio' || element.type === 'checkbox') {
84
+ const checked = findByName(form, element.name).filter((el) => el.matches(':checked'));
85
+ return checked.map((el) => el.value);
86
+ }
87
+ if (element.type === 'number' && typeof element.validity !== 'undefined') {
88
+ return element.validity.badInput ? 'NaN' : element.value;
89
+ }
90
+ if (element.type === 'file') {
91
+ return fileInputValue(element);
92
+ }
93
+ return element.value.replace(/\r/g, '');
94
+ }
95
+ /**
96
+ * Get the value of a file input element.
97
+ * @param element - file input element
98
+ * @return file path or file name
99
+ */
100
+ function fileInputValue(element) {
101
+ const value = element.value;
102
+ // Modern browser (chrome & safari)
103
+ if (value.substring(0, 12) === 'C:\\fakepath\\') {
104
+ return value.substring(12);
105
+ }
106
+ // Legacy browsers
107
+ // Unix-based path
108
+ let idx = value.lastIndexOf('/');
109
+ if (idx >= 0) {
110
+ return value.substring(idx + 1);
111
+ }
112
+ // Windows-based path
113
+ idx = value.lastIndexOf('\\');
114
+ if (idx >= 0) {
115
+ return value.substring(idx + 1);
116
+ }
117
+ // Just the file name
118
+ return value;
119
+ }
120
+ /**
121
+ * Formats a string by replacing {0}, {1}, etc. placeholders with provided parameters.
122
+ * @param source - template string with placeholders
123
+ * @param params - parameters to substitute into placeholders
124
+ * @return formatted string or curried function if only source provided
125
+ */
126
+ function format(source, params) {
127
+ // If no params provided, return a curried function
128
+ if (params === undefined) {
129
+ return function (args) {
130
+ return formatString(source, args);
131
+ };
132
+ }
133
+ if (!Array.isArray(params)) {
134
+ params = [params];
135
+ }
136
+ return formatString(source, params);
137
+ }
138
+ /**
139
+ * Internal helper to format a string with parameters.
140
+ * @param source - template string with placeholders
141
+ * @param params - parameters to substitute
142
+ * @return formatted string
143
+ */
144
+ function formatString(source, params) {
145
+ if (!Array.isArray(params)) {
146
+ params = [params];
147
+ }
148
+ params.forEach((param, index) => {
149
+ source = source.replace(new RegExp(`\\{${index}\\}`, 'g'), String(param));
150
+ });
151
+ return source;
152
+ }
153
+ /**
154
+ * Returns the id or name attribute of an element, preferring name for checkable elements.
155
+ * @param element - element to get identifier from
156
+ * @return element id or name
157
+ */
158
+ function idOrName(element) {
159
+ return ((isCheckableElement(element) ? element.name : element.id) || element.name);
160
+ }
161
+ /**
162
+ * Gets the length of a form element's value, handling special cases for selects and checkables.
163
+ * @param element - form control element
164
+ * @param form - html form element
165
+ * @return length of the element's value
166
+ */
167
+ function getValueLength(element, form) {
168
+ const nodeName = element.nodeName.toLowerCase();
169
+ const value = elementValue(element, form);
170
+ if (nodeName === 'select') {
171
+ return element.querySelectorAll('option:checked').length;
172
+ }
173
+ else if (nodeName === 'input' && isCheckableElement(element)) {
174
+ return findByName(form, element.name).filter((el) => el.matches(':checked'))
175
+ .length;
176
+ }
177
+ return value.length;
178
+ }
179
+ /**
180
+ * Returns true if the element has no value or is considered blank.
181
+ * @param element - form control element to check
182
+ * @param form - current form element
183
+ * @return true if element is blank, false otherwise
184
+ */
185
+ function isBlankElement(element, form) {
186
+ const value = elementValue(element, form);
187
+ if (element.nodeName.toLowerCase() === 'select' && element.selectedOptions) {
188
+ const selected = Array.from(element.selectedOptions).map((o) => o.value);
189
+ return selected.length === 0 || !selected[0];
190
+ }
191
+ if (isCheckableElement(element)) {
192
+ return getValueLength(element, form) === 0;
193
+ }
194
+ return value === undefined || value === null || value.length === 0;
195
+ }
196
+ const displayDataMap = new WeakMap();
197
+ /**
198
+ * Shows an element by restoring its original display value.
199
+ * Matches jQuery's .show() behavior.
200
+ * @param element - Element to show
201
+ */
202
+ function showElement(element) {
203
+ const storedDisplay = displayDataMap.get(element);
204
+ if (storedDisplay) {
205
+ element.style.display = storedDisplay;
206
+ displayDataMap.delete(element);
207
+ }
208
+ else {
209
+ element.style.display = '';
210
+ }
211
+ }
212
+ /**
213
+ * Hides an element by setting display to none, storing the original display value.
214
+ * Matches jQuery's .hide() behavior.
215
+ * @param element - Element to hide
216
+ */
217
+ function hideElement(element) {
218
+ if (element.style.display !== 'none') {
219
+ // Store current display value
220
+ displayDataMap.set(element, element.style.display || getComputedStyle(element).display);
221
+ element.style.display = 'none';
222
+ }
223
+ }
224
+
225
+ class ObjectStore {
226
+ constructor(data) {
227
+ this._store = {};
228
+ this._store = data;
229
+ }
230
+ keys() {
231
+ return Object.keys(this._store);
232
+ }
233
+ get(key) {
234
+ return this._store[key];
235
+ }
236
+ set(key, value) {
237
+ this._store[key] = value;
238
+ }
239
+ replace(data) {
240
+ Object.entries(data).forEach(([key, value]) => {
241
+ if (key in this._store) {
242
+ this._store[key] = value;
243
+ }
244
+ });
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Public API for accessing and managing validation methods.
250
+ */
251
+ const store$1 = new ObjectStore({
252
+ required,
253
+ minlength: minLength,
254
+ maxlength: maxLength,
255
+ rangelength: rangeLength,
256
+ min,
257
+ max,
258
+ range,
259
+ email,
260
+ url,
261
+ date,
262
+ dateISO,
263
+ number,
264
+ digits,
265
+ equalTo,
266
+ regex,
267
+ nonalphamin: nonAlphaMin,
268
+ creditcard: creditCard,
269
+ });
270
+ /**
271
+ * Validates that the field has a value (is not blank).
272
+ * @return true if field is not blank
273
+ */
274
+ function required({ blank }) {
275
+ return !blank;
276
+ }
277
+ /**
278
+ * Validates that the field value has at least the minimum length.
279
+ * @return true if blank or length meets minimum
280
+ */
281
+ function minLength({ blank, length, param }) {
282
+ return blank || length >= param;
283
+ }
284
+ /**
285
+ * Validates that the field value does not exceed the maximum length.
286
+ * @return true if blank or length within maximum
287
+ */
288
+ function maxLength({ blank, length, param }) {
289
+ return blank || length <= param;
290
+ }
291
+ /**
292
+ * Validates that the field value length is within a specified range.
293
+ * @return true if blank or length within range
294
+ */
295
+ function rangeLength({ blank, length, param }) {
296
+ return blank || (length >= param[0] && length <= param[1]);
297
+ }
298
+ /**
299
+ * Validates that the field value is greater than or equal to a minimum value.
300
+ * @return true if blank or value meets minimum
301
+ */
302
+ function min({ blank, value, param }) {
303
+ return blank || value >= param;
304
+ }
305
+ /**
306
+ * Validates that the field value is less than or equal to a maximum value.
307
+ * @return true if blank or value within maximum
308
+ */
309
+ function max({ blank, value, param }) {
310
+ return blank || value <= param;
311
+ }
312
+ /**
313
+ * Validates that the field value is within a specified numeric range.
314
+ * @return true if blank or value within range
315
+ */
316
+ function range({ blank, value, param }) {
317
+ if (blank) {
318
+ return true;
319
+ }
320
+ return value >= param[0] && value <= param[1];
321
+ }
322
+ /**
323
+ * Validates that the field value is a valid email address format.
324
+ * @param blank - whether the field is blank
325
+ * @param value - field value
326
+ * @return true if blank or valid email format
327
+ */
328
+ function email({ blank, value }) {
329
+ if (blank) {
330
+ return true;
331
+ }
332
+ const re = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
333
+ return re.test(value);
334
+ }
335
+ /**
336
+ * Validates that the field value is a valid URL format.
337
+ * @param blank - whether the field is blank
338
+ * @param value - field value
339
+ * @return true if blank or valid URL format
340
+ */
341
+ function url({ blank, value }) {
342
+ if (blank) {
343
+ return true;
344
+ }
345
+ const re = /^(?:(?:https?|ftp):)?\/\/(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+[a-z\u00a1-\uffff]{2,}\.?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i;
346
+ return re.test(value);
347
+ }
348
+ /**
349
+ * Validates that the field value is a valid date string
350
+ * @param blank - whether the field is blank
351
+ * @param value - field value
352
+ * @return true if blank or valid date string
353
+ */
354
+ function date({ blank, value }) {
355
+ if (blank) {
356
+ return true;
357
+ }
358
+ return !/Invalid|NaN/.test(new Date(value).toString());
359
+ }
360
+ /**
361
+ * Validates that the field value is a valid ISO date format (YYYY-MM-DD or YYYY/MM/DD).
362
+ * @param blank - whether the field is blank
363
+ * @param value - field value
364
+ * @return true if blank or valid ISO date format
365
+ */
366
+ function dateISO({ blank, value }) {
367
+ if (blank) {
368
+ return true;
369
+ }
370
+ const re = /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/;
371
+ return re.test(value);
372
+ }
373
+ /**
374
+ * Validates that the field value is a valid number (including decimals and comma-separated thousands).
375
+ * @param blank - whether the field is blank
376
+ * @param value - field value
377
+ * @return true if blank or valid number format
378
+ */
379
+ function number({ blank, value }) {
380
+ if (blank) {
381
+ return true;
382
+ }
383
+ const re = /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/;
384
+ return re.test(value);
385
+ }
386
+ /**
387
+ * Validates that the field value contains only digits (no decimals or special characters).
388
+ * @param blank - whether the field is blank
389
+ * @param value - field value
390
+ * @return true if blank or contains only digits
391
+ */
392
+ function digits({ blank, value }) {
393
+ if (blank) {
394
+ return true;
395
+ }
396
+ return /^\d+$/.test(value);
397
+ }
398
+ /**
399
+ * Validates that the field value equals the value of another field (e.g., password confirmation).
400
+ * @return true if values match
401
+ */
402
+ function equalTo({ value, param }) {
403
+ const target = document.querySelector(param);
404
+ return value === target.value;
405
+ }
406
+ /**
407
+ * Validates that the field value matches a regular expression.
408
+ * @return true if blank or value matches pattern
409
+ */
410
+ function regex({ blank, value, param }) {
411
+ if (blank) {
412
+ return true;
413
+ }
414
+ const match = new RegExp(param).exec(value);
415
+ return !!match && match.index === 0 && match[0].length === value.length;
416
+ }
417
+ /**
418
+ * Validates that the field value contains at least a minimum number of non-alphanumeric characters.
419
+ * Used for password strength validation.
420
+ * @return true if blank or value has enough non-alphanumeric characters
421
+ */
422
+ function nonAlphaMin({ blank, value, param }) {
423
+ if (blank || !param) {
424
+ return true;
425
+ }
426
+ const match = value.match(/\W/g);
427
+ return !!match && match.length >= param;
428
+ }
429
+ /**
430
+ * Validates that the field value matches a credit card number.
431
+ * based on https://en.wikipedia.org/wiki/Luhn_algorithm
432
+ * @return true if blank or value is a valid credit card number
433
+ */
434
+ function creditCard({ blank, value }) {
435
+ if (blank) {
436
+ return true;
437
+ }
438
+ const strippedValue = value.replace(/\D/g, '');
439
+ let nCheck = 0;
440
+ let bEven = false;
441
+ // Basing min and max length on
442
+ // https://dev.ean.com/general-info/valid-card-types/
443
+ if (strippedValue.length < 13 || strippedValue.length > 19) {
444
+ return false;
445
+ }
446
+ for (let n = strippedValue.length - 1; n >= 0; n--) {
447
+ const cDigit = strippedValue.charAt(n);
448
+ let nDigit = parseInt(cDigit, 10);
449
+ if (bEven) {
450
+ if ((nDigit *= 2) > 9) {
451
+ nDigit -= 9;
452
+ }
453
+ }
454
+ nCheck += nDigit;
455
+ bEven = !bEven;
456
+ }
457
+ return nCheck % 10 === 0;
458
+ }
459
+
460
+ /**
461
+ * Gets all validation rules for an element from multiple sources.
462
+ * Merges rules from CSS classes, HTML attributes, data attributes, and programmatic settings.
463
+ * @param element - form element to get rules for
464
+ * @param settings - validator rule settings
465
+ * @return {Object} - object containing all validation rules with the required rule first
466
+ */
467
+ function getRules(element, settings) {
468
+ // If nothing is selected, return empty object; can't chain anyway
469
+ if (element == null || element.form == null) {
470
+ return {};
471
+ }
472
+ let data = normalizeRules(Object.assign(Object.assign(Object.assign(Object.assign({}, classRules(element)), attributeRules(element)), dataRules(element)), staticRules(element, settings)));
473
+ // Make sure required is at front
474
+ if (data.required) {
475
+ const param = data.required;
476
+ delete data.required;
477
+ data = Object.assign({ required: param }, data);
478
+ }
479
+ return data;
480
+ }
481
+ /**
482
+ * Default mapping of CSS class names to validation rules.
483
+ * Allows class-based rule declaration like class="required email".
484
+ */
485
+ const classRuleSettings = {
486
+ required: { required: true },
487
+ email: { email: true },
488
+ url: { url: true },
489
+ date: { date: true },
490
+ dateISO: { dateISO: true },
491
+ number: { number: true },
492
+ digits: { digits: true },
493
+ creditcard: { creditcard: true },
494
+ };
495
+ /**
496
+ * Adds or updates validation rules for a CSS class name.
497
+ * @param className - class name to associate with rules
498
+ */
499
+ function addClassRule(className) {
500
+ classRuleSettings[className] = normalizeRule(className);
501
+ }
502
+ /**
503
+ * Normalizes and processes validation rules for an element.
504
+ * Removes false rules, evaluates function parameters, and converts string/number values.
505
+ * @param rules - raw validation rules object
506
+ * @return normalized rules object
507
+ */
508
+ function normalizeRules(rules) {
509
+ Object.entries(rules).forEach(([key, value]) => {
510
+ // Ignore rule when param is explicitly false, eg. required:false
511
+ if (value === false) {
512
+ delete rules[key];
513
+ return;
514
+ }
515
+ if (typeof value === 'object' && 'param' in value && value.param) {
516
+ rules[key] = value.param;
517
+ }
518
+ });
519
+ // Clean number parameters
520
+ ['minlength', 'maxlength'].forEach((ruleKey) => {
521
+ if (rules[ruleKey]) {
522
+ rules[ruleKey] = Number(rules[ruleKey]);
523
+ }
524
+ });
525
+ ['rangelength', 'range'].forEach((ruleKey) => {
526
+ if (rules[ruleKey]) {
527
+ if (Array.isArray(rules[ruleKey])) {
528
+ rules[ruleKey] = [rules[ruleKey][0], rules[ruleKey][1]].map(Number);
529
+ }
530
+ else {
531
+ const parts = rules[ruleKey]
532
+ .toString()
533
+ .replace(/[\[\]]/g, '')
534
+ .split(/[\s,]+/);
535
+ rules[ruleKey] = [parts[0], parts[1]].map(Number);
536
+ }
537
+ }
538
+ });
539
+ return rules;
540
+ }
541
+ /**
542
+ * Extracts validation rules from an element's CSS classes.
543
+ * @param element - element to extract rules from
544
+ * @return validation rules derived from CSS classes
545
+ */
546
+ function classRules(element) {
547
+ let rules = {};
548
+ const classes = element.getAttribute('class');
549
+ if (classes) {
550
+ classes.split(' ').forEach((className) => {
551
+ if (className in classRuleSettings) {
552
+ rules = Object.assign(Object.assign({}, rules), classRuleSettings[className]);
553
+ }
554
+ });
555
+ }
556
+ return rules;
557
+ }
558
+ /**
559
+ * Extracts validation rules from HTML attributes (required, minlength, etc.).
560
+ * @param element - element to extract rules from
561
+ * @return validation rules derived from HTML attributes
562
+ */
563
+ function attributeRules(element) {
564
+ const rules = {};
565
+ const type = element.type;
566
+ for (const method of store$1.keys()) {
567
+ let value = element.getAttribute(method);
568
+ // Support for <input required> in both html5 and older browsers
569
+ if (method === 'required') {
570
+ // Some browsers return an empty string for the required attribute
571
+ // and non-HTML5 browsers might have required="" markup
572
+ if (value === '') {
573
+ value = true;
574
+ }
575
+ // Force non-HTML5 browsers to return bool
576
+ value = !!value;
577
+ }
578
+ normalizeAttributeRule(rules, type, method, value);
579
+ }
580
+ // 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
581
+ if (rules.maxlength &&
582
+ /-1|2147483647|524288/.test(rules.maxlength.toString())) {
583
+ delete rules.maxlength;
584
+ }
585
+ return rules;
586
+ }
587
+ /**
588
+ * Extracts validation rules from data attributes (data-rule-required, etc.).
589
+ * @param element - element to extract rules from
590
+ * @return validation rules derived from data attributes
591
+ */
592
+ function dataRules(element) {
593
+ var _a;
594
+ const rules = {};
595
+ const type = element.type;
596
+ for (const method of store$1.keys()) {
597
+ const datasetKey = 'rule' +
598
+ method.charAt(0).toUpperCase() +
599
+ method.substring(1).toLowerCase();
600
+ let value = (_a = element.dataset[datasetKey]) !== null && _a !== void 0 ? _a : null;
601
+ // Cast empty attributes like `data-rule-required` to `true`
602
+ if (value === '' || value === 'true') {
603
+ value = true;
604
+ }
605
+ else if (value === 'false') {
606
+ value = false;
607
+ }
608
+ normalizeAttributeRule(rules, type, method, value);
609
+ }
610
+ return rules;
611
+ }
612
+ /**
613
+ * Gets validation rules defined programmatically in validator settings.
614
+ * @param element - element to get rules for
615
+ * @param settings - Validator rule settings
616
+ * @return validation rules from validator settings
617
+ */
618
+ function staticRules(element, settings) {
619
+ if (!settings || !settings[element.name]) {
620
+ return {};
621
+ }
622
+ return normalizeRule(settings[element.name]) || {};
623
+ }
624
+ /**
625
+ * Normalizes a single attribute rule and adds it to the rules object.
626
+ * Handles type coercion and special cases for different input types.
627
+ * @param rules - rules object to add the rule to
628
+ * @param type - input type attribute value
629
+ * @param method - validation method name
630
+ * @param value - attribute value
631
+ */
632
+ function normalizeAttributeRule(rules, type, method, value) {
633
+ // Convert the value to a number for number inputs, and for text for backwards compatability
634
+ // allows type="date" and others to be compared as strings
635
+ if (/min|max|step/.test(method) &&
636
+ (type === null || /number|range|text/.test(type)) &&
637
+ value !== null) {
638
+ value = Number(value);
639
+ }
640
+ if (value || value === 0) {
641
+ rules[method] = value;
642
+ }
643
+ else if (type === method && type !== 'range') {
644
+ // Exception: the jquery validate 'range' method
645
+ // does not test for the html5 'range' type
646
+ rules[type === 'date' ? 'dateISO' : method] = true;
647
+ }
648
+ }
649
+ /**
650
+ * Converts string-based rule declarations to rule objects.
651
+ * Transforms "required email" to {required: true, email: true}.
652
+ * @param data - rule string or object
653
+ * @return normalized rule object
654
+ */
655
+ function normalizeRule(data) {
656
+ if (typeof data !== 'string') {
657
+ return data;
658
+ }
659
+ const transformed = {};
660
+ data.split(/\s/).forEach((token) => {
661
+ transformed[token] = true;
662
+ });
663
+ return transformed;
664
+ }
665
+
666
+ /**
667
+ * Public API for accessing and managing error messages.
668
+ */
669
+ const store = new ObjectStore({
670
+ required: 'This field is required.',
671
+ email: 'Please enter a valid email address.',
672
+ url: 'Please enter a valid URL.',
673
+ date: 'Please enter a valid date.',
674
+ dateISO: 'Please enter a valid date (ISO).',
675
+ number: 'Please enter a valid number.',
676
+ digits: 'Please enter only digits.',
677
+ equalTo: 'Please enter the same value again.',
678
+ maxlength: 'Please enter no more than {0} characters.',
679
+ minlength: 'Please enter at least {0} characters.',
680
+ rangelength: 'Please enter a value between {0} and {1} characters long.',
681
+ range: 'Please enter a value between {0} and {1}.',
682
+ max: 'Please enter a value less than or equal to {0}.',
683
+ min: 'Please enter a value greater than or equal to {0}.',
684
+ regex: 'Please enter a value that matches the pattern {0}.',
685
+ nonalphamin: 'Please enter at least {0} non-alphabetic characters.',
686
+ creditcard: 'Please enter a valid credit card number.',
687
+ });
688
+ /**
689
+ * Gets the appropriate error message for a validation rule failure.
690
+ * Checks custom messages, data attributes, element title, and default messages in order.
691
+ * @param element - form element that failed validation
692
+ * @param rule - validation rule (string method name or object with method and parameters)
693
+ * @param ignoreTitle - whether to ignore element title
694
+ * @param customMessage - validator settings that may contain custom messages
695
+ * @return formatted error message
696
+ */
697
+ function getMessage(element, rule, ignoreTitle, customMessage) {
698
+ let message = [
699
+ customMessage,
700
+ customDataMessage(element, rule.method),
701
+ (!ignoreTitle && element.title) || undefined,
702
+ store.get(rule.method),
703
+ `<strong>Warning: No message defined for ${element.name}</strong>`,
704
+ ].find((x) => x !== undefined);
705
+ const regex = /\$?\{(\d+)}/g;
706
+ if (/\$?\{(\d+)}/g.test(message)) {
707
+ return format(message.replace(regex, '{$1}'), rule.parameters);
708
+ }
709
+ else {
710
+ return message;
711
+ }
712
+ }
713
+ /**
714
+ * Gets a custom error message from element's data attributes.
715
+ * Checks data-msg-{method} first, then falls back to data-msg.
716
+ * @param element - form element
717
+ * @param method - validation method name
718
+ * @return custom message from data attribute if present
719
+ */
720
+ function customDataMessage(element, method) {
721
+ const dataSetKey = 'msg' + method.charAt(0).toUpperCase() + method.substring(1).toLowerCase();
722
+ if (!(element === null || element === void 0 ? void 0 : element.dataset)) {
723
+ return;
724
+ }
725
+ return element.dataset[dataSetKey] || element.dataset['msg'];
726
+ }
727
+
728
+ const validatorStore = new WeakMap();
729
+
730
+ /**
731
+ * CSS selectors for different types of form elements that should receive validation events
732
+ */
733
+ const EVENT_TARGETS = {
734
+ FOCUS_TARGETS: [
735
+ "[type='text']",
736
+ "[type='password']",
737
+ "[type='file']",
738
+ 'select',
739
+ 'textarea',
740
+ "[type='number']",
741
+ "[type='search']",
742
+ "[type='tel']",
743
+ "[type='url']",
744
+ "[type='email']",
745
+ "[type='datetime']",
746
+ "[type='date']",
747
+ "[type='month']",
748
+ "[type='week']",
749
+ "[type='time']",
750
+ "[type='datetime-local']",
751
+ "[type='range']",
752
+ "[type='color']",
753
+ "[type='radio']",
754
+ "[type='checkbox']",
755
+ 'button',
756
+ "input[type='button']",
757
+ ],
758
+ CLICK_TARGETS: ['select', 'option', "[type='radio']", "[type='checkbox']"],
759
+ };
760
+ /**
761
+ * Manages event delegation for form validation.
762
+ * Handles attaching and removing event listeners with proper delegation logic.
763
+ */
764
+ class FormEventManager {
765
+ constructor(form, settings, validateCallback, focusInvalidCallback, shouldIgnoreElement) {
766
+ this.form = form;
767
+ this.settings = settings;
768
+ this.validateCallback = validateCallback;
769
+ this.focusInvalidCallback = focusInvalidCallback;
770
+ this.shouldIgnoreElement = shouldIgnoreElement;
771
+ this.boundEventHandlers = {
772
+ onFocusIn: null,
773
+ onFocusOut: null,
774
+ onKeyUp: null,
775
+ onClick: null,
776
+ };
777
+ }
778
+ /**
779
+ * Attaches all validation event listeners to the form
780
+ */
781
+ attachEventHandlers() {
782
+ this.boundEventHandlers.onFocusIn = this.createDelegate(EVENT_TARGETS.FOCUS_TARGETS, this.settings.onfocusin);
783
+ this.boundEventHandlers.onFocusOut = this.createDelegate(EVENT_TARGETS.FOCUS_TARGETS, this.settings.onfocusout);
784
+ this.boundEventHandlers.onKeyUp = this.createDelegate(EVENT_TARGETS.FOCUS_TARGETS, this.settings.onkeyup);
785
+ this.boundEventHandlers.onClick = this.createDelegate(EVENT_TARGETS.CLICK_TARGETS, this.settings.onclick);
786
+ this.form.addEventListener('focusin', this.boundEventHandlers.onFocusIn);
787
+ this.form.addEventListener('focusout', this.boundEventHandlers.onFocusOut);
788
+ this.form.addEventListener('keyup', this.boundEventHandlers.onKeyUp);
789
+ this.form.addEventListener('click', this.boundEventHandlers.onClick);
790
+ if (this.settings.onsubmit) {
791
+ this.form.addEventListener('submit', (e) => this.handleSubmitForm(e));
792
+ }
793
+ const invalidHandler = this.settings.invalidHandler;
794
+ if (invalidHandler) {
795
+ this.form.addEventListener('invalid-form', (e) => {
796
+ if (!this.isCustomEvent(e)) {
797
+ return;
798
+ }
799
+ invalidHandler(e);
800
+ });
801
+ }
802
+ }
803
+ triggerInvalidForm(errorList) {
804
+ const event = new CustomEvent('invalid-form', {
805
+ detail: errorList,
806
+ cancelable: true,
807
+ });
808
+ this.form.dispatchEvent(event);
809
+ }
810
+ isCustomEvent(event) {
811
+ return 'detail' in event;
812
+ }
813
+ handleSubmitForm(e) {
814
+ if (this.settings.debug) {
815
+ e.preventDefault();
816
+ }
817
+ const isValid = this.validateCallback();
818
+ if (!isValid) {
819
+ this.focusInvalidCallback();
820
+ e.preventDefault();
821
+ e.stopPropagation();
822
+ }
823
+ }
824
+ /**
825
+ * Removes all validation event listeners from the form
826
+ */
827
+ detachEventHandlers() {
828
+ if (this.boundEventHandlers.onFocusIn) {
829
+ this.form.removeEventListener('focusin', this.boundEventHandlers.onFocusIn);
830
+ }
831
+ if (this.boundEventHandlers.onFocusOut) {
832
+ this.form.removeEventListener('focusout', this.boundEventHandlers.onFocusOut);
833
+ }
834
+ if (this.boundEventHandlers.onKeyUp) {
835
+ this.form.removeEventListener('keyup', this.boundEventHandlers.onKeyUp);
836
+ }
837
+ if (this.boundEventHandlers.onClick) {
838
+ this.form.removeEventListener('click', this.boundEventHandlers.onClick);
839
+ }
840
+ // Clear references
841
+ this.boundEventHandlers.onFocusIn = null;
842
+ this.boundEventHandlers.onFocusOut = null;
843
+ this.boundEventHandlers.onKeyUp = null;
844
+ this.boundEventHandlers.onClick = null;
845
+ }
846
+ /**
847
+ * Creates a delegated event handler for the specified targets and handler
848
+ */
849
+ createDelegate(targets, handler) {
850
+ return (event) => {
851
+ // Skip if handler is disabled (boolean false)
852
+ if (typeof handler === 'boolean') {
853
+ return;
854
+ }
855
+ const element = event.target;
856
+ // Check if element matches any of the target selectors
857
+ if (!element.matches(targets.join(', '))) {
858
+ return;
859
+ }
860
+ // Ensure element belongs to the correct form
861
+ if (!this.isElementInForm(element)) {
862
+ return;
863
+ }
864
+ // Check if element should be ignored based on validator settings
865
+ if (this.shouldIgnoreElement(element)) {
866
+ return;
867
+ }
868
+ // Call the handler with the element and event
869
+ handler(element, event);
870
+ };
871
+ }
872
+ /**
873
+ * Checks if an element belongs to the validator's form
874
+ */
875
+ isElementInForm(element) {
876
+ const elementForm = element.form;
877
+ return this.form === elementForm;
878
+ }
879
+ }
880
+
881
+ const ValidatorDefaults = {
882
+ ignore: ':hidden',
883
+ errorClass: 'error',
884
+ validClass: 'valid',
885
+ errorElement: 'label',
886
+ wrapper: null,
887
+ errorLabelContainer: null,
888
+ errorContainer: null,
889
+ onfocusin: onFocusIn,
890
+ onfocusout: onFocusOut,
891
+ onkeyup: onKeyUp,
892
+ onclick: onClick,
893
+ highlight: highlight,
894
+ unhighlight: unhighlight,
895
+ errorPlacement: null,
896
+ focusCleanup: false,
897
+ rules: {},
898
+ messages: {},
899
+ escapeHtml: false,
900
+ showErrors: null,
901
+ ignoreTitle: false,
902
+ success: null,
903
+ onsubmit: true,
904
+ debug: false,
905
+ invalidHandler: null,
906
+ };
907
+ function onFocusIn(element) {
908
+ this.lastActive = element;
909
+ if (this.settings.focusCleanup) {
910
+ if (typeof this.settings.unhighlight !== 'boolean') {
911
+ this.settings.unhighlight(element, this.errorClasses, this.validClasses);
912
+ }
913
+ this.hideErrors(element);
914
+ }
915
+ }
916
+ function onFocusOut(element) {
917
+ if (isCheckableElement(element)) {
918
+ return;
919
+ }
920
+ if (!(element.name in this.submitted) &&
921
+ isBlankElement(element, this.currentForm)) {
922
+ return;
923
+ }
924
+ this.element(element);
925
+ }
926
+ function onKeyUp(element, event) {
927
+ const keyboardEvent = event;
928
+ if (keyboardEvent.which === 9 &&
929
+ elementValue(element, this.currentForm) === '') {
930
+ return;
931
+ }
932
+ // Avoid revalidate the field when pressing one of the following keys
933
+ // Shift => 16
934
+ // Ctrl => 17
935
+ // Alt => 18
936
+ // Caps lock => 20
937
+ // End => 35
938
+ // Home => 36
939
+ // Left arrow => 37
940
+ // Up arrow => 38
941
+ // Right arrow => 39
942
+ // Down arrow => 40
943
+ // Insert => 45
944
+ // Num lock => 144
945
+ // AltGr key => 225
946
+ const excludedKeys = [16, 17, 18, 20, 35, 36, 37, 38, 39, 40, 45, 144, 225];
947
+ if (excludedKeys.includes(keyboardEvent.keyCode)) {
948
+ return;
949
+ }
950
+ if (!(element.name in this.submitted) && !(element.name in this.invalid)) {
951
+ return;
952
+ }
953
+ this.element(element);
954
+ }
955
+ function onClick(element) {
956
+ // Click on selects, radiobuttons and checkboxes
957
+ if (element.name in this.submitted) {
958
+ this.element(element);
959
+ }
960
+ // Or option elements, check parent select in that case
961
+ else if (element.parentNode && element.parentElement) {
962
+ const name = element.parentElement.getAttribute('name');
963
+ if (name && name in this.submitted) {
964
+ this.element(element.parentNode);
965
+ }
966
+ }
967
+ }
968
+ function highlight(element, errorClasses, validClasses) {
969
+ let targets = [element];
970
+ if (element.type === 'radio') {
971
+ targets = findByName(this.currentForm, element.name);
972
+ }
973
+ targets.forEach((el) => {
974
+ el.classList.add(...errorClasses);
975
+ el.classList.remove(...validClasses);
976
+ });
977
+ }
978
+ function unhighlight(element, errorClasses, validClasses) {
979
+ let targets = [element];
980
+ if (element.type === 'radio') {
981
+ targets = findByName(this.currentForm, element.name);
982
+ }
983
+ targets.forEach((el) => {
984
+ el.classList.remove(...errorClasses);
985
+ el.classList.add(...validClasses);
986
+ });
987
+ }
988
+
989
+ class Validator {
990
+ /**
991
+ * Initializes a new validator instance for the given form with optional configuration settings.
992
+ * @param form - form element to validate
993
+ * @param options - optional user configuration settings
994
+ */
995
+ constructor(form, options) {
996
+ this.submitted = {};
997
+ this.invalid = {};
998
+ this.successList = [];
999
+ this.errorList = [];
1000
+ this.errorMap = {};
1001
+ this.toShow = [];
1002
+ this.toHide = [];
1003
+ this.currentElements = [];
1004
+ this.labelContainer = null;
1005
+ this.containers = [];
1006
+ this.lastActive = null;
1007
+ /** normalized rules */
1008
+ this.rules = {};
1009
+ this.settings = ValidatorDefaults;
1010
+ this.currentForm = form;
1011
+ this.settings = Object.assign(Object.assign({}, this.settings), options);
1012
+ this.normalizeSettings();
1013
+ this.init();
1014
+ }
1015
+ /**
1016
+ * Normalizes Validator settings.
1017
+ * Currently, this only binds function settings to validator instance.
1018
+ */
1019
+ normalizeSettings() {
1020
+ // bind function settings to this validator instance
1021
+ [
1022
+ 'onfocusin',
1023
+ 'onfocusout',
1024
+ 'onkeyup',
1025
+ 'onclick',
1026
+ 'highlight',
1027
+ 'unhighlight',
1028
+ 'errorPlacement',
1029
+ 'invalidHandler',
1030
+ ].forEach((key) => {
1031
+ const setting = this.settings[key];
1032
+ if (setting && typeof setting === 'function') {
1033
+ this.settings[key] = setting.bind(this);
1034
+ }
1035
+ });
1036
+ }
1037
+ /**
1038
+ * Sets up DOM references and attaches event handlers to the form.
1039
+ */
1040
+ init() {
1041
+ if (this.settings.errorLabelContainer) {
1042
+ this.labelContainer = document.querySelector(this.settings.errorLabelContainer);
1043
+ }
1044
+ this.errorContext = this.labelContainer || this.currentForm;
1045
+ const containers = [this.labelContainer];
1046
+ if (this.settings.errorContainer) {
1047
+ containers.push(document.querySelector(this.settings.errorContainer));
1048
+ }
1049
+ this.containers = containers.filter(Boolean);
1050
+ this.rules = {};
1051
+ Object.entries(this.settings.rules).forEach(([key, value]) => {
1052
+ this.rules[key] = normalizeRule(value);
1053
+ });
1054
+ this.eventManager = new FormEventManager(this.currentForm, this.settings, () => this.form(), () => this.focusInvalid(), (element) => this.shouldIgnore(element));
1055
+ this.eventManager.attachEventHandlers();
1056
+ }
1057
+ /**
1058
+ * Resets the validator state.
1059
+ */
1060
+ reset() {
1061
+ this.successList = [];
1062
+ this.errorList = [];
1063
+ this.errorMap = {};
1064
+ this.toShow = [];
1065
+ this.toHide = [];
1066
+ this.currentElements = [];
1067
+ }
1068
+ /**
1069
+ * Validates all form elements.
1070
+ * @return true if the form is valid, false otherwise
1071
+ */
1072
+ form() {
1073
+ this.prepareForm();
1074
+ this.currentElements = this.elements();
1075
+ for (const element of this.currentElements) {
1076
+ this.check(element);
1077
+ }
1078
+ this.submitted = Object.assign(Object.assign({}, this.submitted), this.errorMap);
1079
+ this.invalid = Object.assign({}, this.errorMap);
1080
+ if (!this.valid()) {
1081
+ this.eventManager.triggerInvalidForm(this.errorList);
1082
+ }
1083
+ this.showErrors();
1084
+ return this.valid();
1085
+ }
1086
+ /**
1087
+ * Validates a single element within the form.
1088
+ * @param element - element to validate
1089
+ * @return true if the element is valid, false otherwise
1090
+ */
1091
+ element(element) {
1092
+ const target = this.validationTargetFor(element);
1093
+ if (target === undefined) {
1094
+ delete this.invalid[element.name];
1095
+ return true;
1096
+ }
1097
+ this.prepareElement(target);
1098
+ this.currentElements = [target];
1099
+ const result = this.check(target);
1100
+ if (result) {
1101
+ delete this.invalid[element.name];
1102
+ }
1103
+ else {
1104
+ this.invalid[target.name] = 'Invalid';
1105
+ }
1106
+ if (!this.numberOfInvalids()) {
1107
+ this.toHide.push(...this.containers);
1108
+ }
1109
+ this.showErrors();
1110
+ // add aria-invalid status for screen readers
1111
+ element.setAttribute('aria-invalid', (!result).toString());
1112
+ return result;
1113
+ }
1114
+ prepareElement(element) {
1115
+ this.reset();
1116
+ this.toHide = this.errorsFor(element);
1117
+ }
1118
+ /**
1119
+ * Returns true if there are currently no validation errors.
1120
+ * @return {boolean} - true if there are no validation errors, false otherwise
1121
+ */
1122
+ valid() {
1123
+ return this.size() === 0;
1124
+ }
1125
+ /**
1126
+ * Returns the number of validation errors.
1127
+ * @return number of validation errors
1128
+ */
1129
+ size() {
1130
+ return this.errorList.length;
1131
+ }
1132
+ /**
1133
+ * Returns a list of all form elements that need to be validated.
1134
+ * @return list of form elements
1135
+ */
1136
+ elements() {
1137
+ const rulesCache = {};
1138
+ const selector = 'input, select, textarea';
1139
+ const notSelector = 'input[type="submit"], [type="reset"], [type="image"], [disabled]';
1140
+ const elements = Array.from(this.currentForm.querySelectorAll(selector)).filter((el) => !el.matches(notSelector) && !this.shouldIgnore(el));
1141
+ const formId = this.currentForm.id;
1142
+ if (formId) {
1143
+ const escapedId = escapeCssMeta(formId);
1144
+ const outsideElements = Array.from(document.querySelectorAll(selector)).filter((el) => el.matches(`[form="${escapedId}"]`) &&
1145
+ !el.matches(notSelector) &&
1146
+ !this.shouldIgnore(el));
1147
+ elements.push(...outsideElements);
1148
+ }
1149
+ return elements.filter((el) => {
1150
+ const form = el.form;
1151
+ if (form !== this.currentForm) {
1152
+ return false;
1153
+ }
1154
+ const name = el.name || el.getAttribute('name');
1155
+ if (!name ||
1156
+ name in rulesCache ||
1157
+ !objectLength(getRules(el, this.rules))) {
1158
+ return false;
1159
+ }
1160
+ rulesCache[name] = true;
1161
+ return true;
1162
+ });
1163
+ }
1164
+ /**
1165
+ * Returns an array of currently valid elements from the last validation.
1166
+ * @return list of valid form elements
1167
+ */
1168
+ validElements() {
1169
+ const invalid = this.invalidElements();
1170
+ return this.currentElements.filter((el) => !invalid.includes(el));
1171
+ }
1172
+ /**
1173
+ * Returns an array of currently invalid elements from the last validation.
1174
+ * @return list of invalid form elements
1175
+ */
1176
+ invalidElements() {
1177
+ return this.errorList.map((e) => e.element);
1178
+ }
1179
+ /**
1180
+ * Runs all validation rules against an element and returns true if valid.
1181
+ * @param element - element to validate
1182
+ * @return true if the element is valid, false otherwise
1183
+ */
1184
+ check(element) {
1185
+ var _a;
1186
+ element = this.validationTargetFor(element);
1187
+ const rules = getRules(element, this.rules);
1188
+ const elValue = elementValue(element, this.currentForm);
1189
+ const value = (_a = (Array.isArray(elValue) ? elValue[0] : elValue)) !== null && _a !== void 0 ? _a : '';
1190
+ const values = Array.isArray(elValue) ? elValue : [elValue];
1191
+ const length = getValueLength(element, this.currentForm);
1192
+ const blank = isBlankElement(element, this.currentForm);
1193
+ for (const method in rules) {
1194
+ const rule = { method, parameters: rules[method] };
1195
+ const methodFunc = store$1.get(method);
1196
+ if (!methodFunc) {
1197
+ console.warn(`Validation method "${method}" not found. Skipping.`);
1198
+ continue;
1199
+ }
1200
+ try {
1201
+ const result = methodFunc({
1202
+ blank,
1203
+ value: value,
1204
+ values,
1205
+ length,
1206
+ element,
1207
+ param: rule.parameters,
1208
+ });
1209
+ if (!result) {
1210
+ this.formatAndAdd(element, rule);
1211
+ return false;
1212
+ }
1213
+ }
1214
+ catch (e) {
1215
+ throw e;
1216
+ }
1217
+ }
1218
+ if (objectLength(rules)) {
1219
+ this.successList.push(element);
1220
+ }
1221
+ return true;
1222
+ }
1223
+ /**
1224
+ * Returns all error label elements currently in the DOM.
1225
+ * @return array of error label elements
1226
+ */
1227
+ errors() {
1228
+ const errorClass = this.errorClasses.join('.');
1229
+ return Array.from(this.errorContext.querySelectorAll(`${this.settings.errorElement}.${errorClass}`));
1230
+ }
1231
+ showErrors(errors) {
1232
+ if (errors) {
1233
+ // Add items to error list and map
1234
+ this.errorMap = Object.assign(Object.assign({}, this.errorMap), errors);
1235
+ this.errorList = Object.entries(this.errorMap).map(([name, message]) => ({
1236
+ message,
1237
+ method: message,
1238
+ element: findByName(this.currentForm, name)[0],
1239
+ }));
1240
+ // Remove items from success list
1241
+ this.successList = this.successList.filter((e) => !(e.name in errors));
1242
+ }
1243
+ if (this.settings.showErrors) {
1244
+ return this.settings.showErrors.call(this, this.errorMap, this.errorList);
1245
+ }
1246
+ return this.defaultShowErrors();
1247
+ }
1248
+ defaultShowErrors() {
1249
+ for (const error of this.errorList) {
1250
+ if (this.settings.highlight) {
1251
+ this.settings.highlight(error.element, this.errorClasses, this.validClasses);
1252
+ }
1253
+ this.showLabel(error.element, error.message);
1254
+ }
1255
+ if (this.errorList.length) {
1256
+ this.toShow = this.toShow.concat(this.containers);
1257
+ }
1258
+ if (this.settings.success) {
1259
+ for (const element of this.successList) {
1260
+ this.showLabel(element);
1261
+ }
1262
+ }
1263
+ if (this.settings.unhighlight) {
1264
+ for (const element of this.validElements()) {
1265
+ this.settings.unhighlight(element, this.errorClasses, this.validClasses);
1266
+ }
1267
+ }
1268
+ this.toHide = this.toHide.filter((el) => !this.toShow.includes(el));
1269
+ this.hideErrors();
1270
+ this.addWrapper(...this.toShow).forEach(showElement);
1271
+ }
1272
+ formatAndAdd(element, rule) {
1273
+ const message = this.getMessage(element, rule);
1274
+ this.errorList.push({ message, element, method: rule.method });
1275
+ this.errorMap[element.name] = message;
1276
+ this.submitted[element.name] = message;
1277
+ }
1278
+ prepareForm() {
1279
+ this.reset();
1280
+ this.toHide = this.errors().concat(this.containers);
1281
+ }
1282
+ hideErrors(element) {
1283
+ // we're either hiding all errors, or just the errors for a specific element
1284
+ let targets = this.toHide;
1285
+ if (element) {
1286
+ targets = this.errorsFor(element);
1287
+ }
1288
+ for (const el of targets) {
1289
+ if (!this.containers.includes(el)) {
1290
+ el.innerText = '';
1291
+ }
1292
+ this.addWrapper(el).forEach(hideElement);
1293
+ }
1294
+ }
1295
+ addWrapper(...elements) {
1296
+ const result = Array.isArray(elements) ? elements : [elements];
1297
+ if (!this.settings.wrapper) {
1298
+ return result;
1299
+ }
1300
+ const wrappers = result
1301
+ .map((el) => el.parentElement)
1302
+ .filter((el) => el && el.matches(this.settings.wrapper));
1303
+ result.push(...wrappers);
1304
+ return result;
1305
+ }
1306
+ showLabel(element, message) {
1307
+ var _a;
1308
+ let errors = this.errorsFor(element);
1309
+ const elementID = idOrName(element);
1310
+ const describedBy = element.getAttribute('aria-describedby');
1311
+ if (errors.length) {
1312
+ // Non-label error exists but is not currently associated with element via aria-describedby
1313
+ const labelSelector = `label[for='${escapeCssMeta(elementID)}']`;
1314
+ const nonLabelExists = errors
1315
+ .map((e) => e.closest(labelSelector))
1316
+ .every((e) => e === null);
1317
+ const noDescriberAssociation = () => {
1318
+ var _a, _b;
1319
+ if (describedBy === null) {
1320
+ return true;
1321
+ }
1322
+ const firstErrorId = (_b = (_a = errors[0]) === null || _a === void 0 ? void 0 : _a.getAttribute('id')) !== null && _b !== void 0 ? _b : null;
1323
+ if (firstErrorId === null) {
1324
+ return true;
1325
+ }
1326
+ const split = describedBy.split(' ');
1327
+ return split.indexOf(firstErrorId) === -1;
1328
+ };
1329
+ if (nonLabelExists && noDescriberAssociation()) {
1330
+ const firstErrorId = errors[0].getAttribute('id');
1331
+ this.addErrorAriaDescribedBy(element, firstErrorId);
1332
+ }
1333
+ // Refresh error/success class
1334
+ errors.forEach((el) => {
1335
+ el.classList.remove(this.settings.validClass);
1336
+ el.classList.add(...this.errorClasses);
1337
+ if (this.settings.escapeHtml) {
1338
+ el.innerText = message || '';
1339
+ }
1340
+ else {
1341
+ el.innerHTML = message || '';
1342
+ }
1343
+ });
1344
+ }
1345
+ else {
1346
+ const newError = document.createElement(this.settings.errorElement);
1347
+ newError.setAttribute('id', `${elementID}-error`);
1348
+ newError.classList.add(...this.errorClasses);
1349
+ if (this.settings.escapeHtml) {
1350
+ newError.innerText = message || '';
1351
+ }
1352
+ else {
1353
+ newError.innerHTML = message || '';
1354
+ }
1355
+ // Maintain reference to the element(s) to be placed into the DOM
1356
+ let insert = newError;
1357
+ if (this.settings.wrapper) {
1358
+ const wrapper = document.createElement(this.settings.wrapper);
1359
+ wrapper.appendChild(newError);
1360
+ insert = wrapper;
1361
+ }
1362
+ if (this.labelContainer) {
1363
+ this.labelContainer.appendChild(insert);
1364
+ }
1365
+ else if (this.settings.errorPlacement) {
1366
+ this.settings.errorPlacement(insert, element);
1367
+ }
1368
+ else {
1369
+ element.after(insert);
1370
+ }
1371
+ // Link error back to the element
1372
+ if (newError.matches('label')) {
1373
+ // If the error is a label, then associate using 'for'
1374
+ newError.setAttribute('for', elementID);
1375
+ }
1376
+ // If the element is not a child of an associated label, then it's necessary
1377
+ // to explicitly apply aria-describedby
1378
+ else if (!((_a = newError.parentElement) === null || _a === void 0 ? void 0 : _a.matches(`label[for='${escapeCssMeta(elementID)}']`))) {
1379
+ this.addErrorAriaDescribedBy(element, newError.getAttribute('id'));
1380
+ }
1381
+ errors = [newError];
1382
+ }
1383
+ if (!message && this.settings.success) {
1384
+ errors.forEach((e) => (e.innerText = ''));
1385
+ const successSetting = this.settings.success;
1386
+ if (typeof successSetting === 'string') {
1387
+ errors.forEach((e) => e.classList.add(successSetting));
1388
+ }
1389
+ else {
1390
+ successSetting(errors, element);
1391
+ }
1392
+ }
1393
+ this.toShow.push(...errors);
1394
+ }
1395
+ addErrorAriaDescribedBy(element, errorId) {
1396
+ let describedBy = element.getAttribute('aria-describedby');
1397
+ if (!describedBy) {
1398
+ describedBy = errorId;
1399
+ }
1400
+ else if (!describedBy.match(new RegExp(`\\b${escapeCssMeta(errorId)}\\b`))) {
1401
+ describedBy += ` ${errorId}`;
1402
+ }
1403
+ element.setAttribute('aria-describedby', describedBy);
1404
+ }
1405
+ errorsFor(element) {
1406
+ const name = escapeCssMeta(idOrName(element));
1407
+ const describer = element.getAttribute('aria-describedby');
1408
+ let selector = `label[for='${name}'], label[for='${name}'] *`;
1409
+ if (describer) {
1410
+ const escapedDescriber = escapeCssMeta(describer).replace(/\s+/g, ', #');
1411
+ selector += `, #${escapedDescriber}`;
1412
+ }
1413
+ return this.errors().filter((el) => el.matches(selector));
1414
+ }
1415
+ numberOfInvalids() {
1416
+ return objectLength(this.invalid);
1417
+ }
1418
+ destroy() {
1419
+ this.resetForm();
1420
+ validatorStore.delete(this.currentForm);
1421
+ this.eventManager.detachEventHandlers();
1422
+ }
1423
+ resetForm() {
1424
+ this.invalid = {};
1425
+ this.submitted = {};
1426
+ this.prepareForm();
1427
+ this.hideErrors();
1428
+ this.elements().forEach((el) => el.removeAttribute('aria-invalid'));
1429
+ this.resetElements();
1430
+ }
1431
+ resetElements() {
1432
+ if (this.settings.unhighlight) {
1433
+ for (const element of this.elements()) {
1434
+ this.settings.unhighlight(element, this.errorClasses, []);
1435
+ findByName(this.currentForm, element.name).forEach((el) => el.classList.remove(...this.validClasses));
1436
+ }
1437
+ }
1438
+ else {
1439
+ this.elements().forEach((el) => {
1440
+ el.classList.remove(...this.errorClasses);
1441
+ el.classList.remove(...this.validClasses);
1442
+ });
1443
+ }
1444
+ }
1445
+ validationTargetFor(element) {
1446
+ let targets = [element];
1447
+ if (isCheckableElement(element)) {
1448
+ targets = findByName(this.currentForm, element.name);
1449
+ }
1450
+ return targets.filter((t) => !this.shouldIgnore(t))[0];
1451
+ }
1452
+ /**
1453
+ * Returns true if the element should be skipped from receiving validation.
1454
+ * @param element - element to check
1455
+ * @return true if the element should be skipped, false otherwise
1456
+ */
1457
+ shouldIgnore(element) {
1458
+ if (!this.settings.ignore) {
1459
+ return false;
1460
+ }
1461
+ if (this.settings.ignore === ':hidden') {
1462
+ return !isVisible(element);
1463
+ }
1464
+ return element.matches(this.settings.ignore);
1465
+ }
1466
+ getMessage(element, rule) {
1467
+ if (typeof rule === 'string') {
1468
+ rule = { method: rule };
1469
+ }
1470
+ let customMessage;
1471
+ const msgSettings = this.settings.messages[element.name];
1472
+ if (msgSettings && typeof msgSettings === 'string') {
1473
+ customMessage = msgSettings;
1474
+ }
1475
+ else if (msgSettings && typeof msgSettings === 'object') {
1476
+ customMessage = msgSettings[rule.method];
1477
+ }
1478
+ return getMessage.call(this, element, rule, this.settings.ignoreTitle, customMessage);
1479
+ }
1480
+ focusInvalid() {
1481
+ const lastActive = this.findLastActive();
1482
+ const firstErrorElement = this.errorList.length
1483
+ ? this.errorList[0].element
1484
+ : null;
1485
+ const el = lastActive || firstErrorElement;
1486
+ if (!el || !isVisible(el)) {
1487
+ return;
1488
+ }
1489
+ // Focus the element
1490
+ el.focus();
1491
+ // Manually dispatch "focusin"
1492
+ const focusInEvent = new Event('focusin', { bubbles: true });
1493
+ el.dispatchEvent(focusInEvent);
1494
+ }
1495
+ findLastActive() {
1496
+ const lastActive = this.lastActive;
1497
+ if (!lastActive)
1498
+ return;
1499
+ const matches = this.errorList.filter((n) => n.element.name === lastActive.name);
1500
+ return matches.length === 1 ? lastActive : undefined;
1501
+ }
1502
+ get errorClasses() {
1503
+ return this.settings.errorClass.split(' ').filter(Boolean);
1504
+ }
1505
+ get validClasses() {
1506
+ return this.settings.validClass.split(' ').filter(Boolean);
1507
+ }
1508
+ }
1509
+
1510
+ /**
1511
+ * @fileoverview Core validation library for client-side form validation.
1512
+ * Provides programmatic API for validating forms and form elements.
1513
+ */
1514
+ /**
1515
+ * Creates or retrieves a validator for a form or form element.
1516
+ * If a validator already exists for the element, returns the existing validator.
1517
+ *
1518
+ * @param selector - CSS selector string or HTMLElement to validate
1519
+ * @param [options] - Validation options including rules, messages, and callbacks
1520
+ * @returns Validator instance or undefined if element not found
1521
+ * @example
1522
+ * // Validate a form with rules
1523
+ * dv.validate('#myForm', {
1524
+ * rules: {
1525
+ * email: { required: true, email: true },
1526
+ * password: { required: true, minlength: 8 }
1527
+ * }
1528
+ * });
1529
+ */
1530
+ function validate(selector, options) {
1531
+ if (!selector) {
1532
+ console.warn("No element selected, can't validate.");
1533
+ return;
1534
+ }
1535
+ const element = selector instanceof Element ? selector : document.querySelector(selector);
1536
+ if (!element) {
1537
+ console.warn("No element selected, can't validate.");
1538
+ return;
1539
+ }
1540
+ if (!(element instanceof HTMLFormElement)) {
1541
+ const elementType = element.tagName || 'unknown element';
1542
+ console.warn(`Element must be a form element for validation. Received: ${elementType}`);
1543
+ return;
1544
+ }
1545
+ if (validatorStore.has(element)) {
1546
+ return validatorStore.get(element);
1547
+ }
1548
+ const validator = new Validator(element, options);
1549
+ validatorStore.set(element, validator);
1550
+ return validator;
1551
+ }
1552
+ /**
1553
+ * Validates form or form elements and returns whether they are valid.
1554
+ * Triggers validation and returns the result without submitting the form.
1555
+ *
1556
+ * @param selector - Element(s) to validate:
1557
+ * CSS selector, element, or array of elements
1558
+ * @returns True if all elements are valid, false otherwise
1559
+ * @example
1560
+ * // Check if form is valid
1561
+ * if (dv.valid('#myForm')) {
1562
+ * console.log('Form is valid!');
1563
+ * }
1564
+ *
1565
+ * // Check specific fields
1566
+ * if (dv.valid(['#email', '#password'])) {
1567
+ * console.log('Email and password are valid!');
1568
+ * }
1569
+ */
1570
+ function valid(selector) {
1571
+ var _a, _b;
1572
+ let elements = [];
1573
+ if (typeof selector === 'string') {
1574
+ elements = Array.from(document.querySelectorAll(selector));
1575
+ }
1576
+ else if (selector instanceof HTMLElement) {
1577
+ elements = [selector];
1578
+ }
1579
+ else if (Array.isArray(selector)) {
1580
+ elements = selector;
1581
+ }
1582
+ if (elements[0].matches('form')) {
1583
+ return (_b = (_a = validate(elements[0])) === null || _a === void 0 ? void 0 : _a.form()) !== null && _b !== void 0 ? _b : false;
1584
+ }
1585
+ const errorList = [];
1586
+ let valid = true;
1587
+ const validator = validate(elements[0].form);
1588
+ if (!validator) {
1589
+ return false;
1590
+ }
1591
+ elements.forEach((el) => {
1592
+ valid = validator.element(el) && valid;
1593
+ if (!valid) {
1594
+ errorList.push(...validator.errorList);
1595
+ }
1596
+ });
1597
+ validator.errorList = errorList;
1598
+ return valid;
1599
+ }
1600
+ /**
1601
+ * Gets the validation rules for an element.
1602
+ *
1603
+ * @param selector - CSS selector string or HTMLElement
1604
+ * @returns Object containing validation rules for the element
1605
+ * @example
1606
+ * // Get rules for an input
1607
+ * const emailRules = dv.rules('#email');
1608
+ * console.log(emailRules); // { required: true, email: true }
1609
+ */
1610
+ function rules(selector) {
1611
+ const element = selector instanceof HTMLElement
1612
+ ? selector
1613
+ : document.querySelector(selector);
1614
+ const validator = validate(element.form);
1615
+ if (!validator) {
1616
+ return {};
1617
+ }
1618
+ return getRules(element, validator.rules);
1619
+ }
1620
+ /**
1621
+ * Adds a custom validation method.
1622
+ * The method can be used in validation rules by its name.
1623
+ *
1624
+ * @param name - Name of the validation method
1625
+ * @param method - Validation function that returns true if valid
1626
+ * @param message - Default error message for this validation method
1627
+ * @example
1628
+ * // Add a custom phone validation method
1629
+ * dv.addMethod('phone', function(blank, value, element) {
1630
+ * return blank || /^\d{3}-\d{3}-\d{4}$/.test(value);
1631
+ * }, 'Please enter a valid phone number (xxx-xxx-xxxx)');
1632
+ *
1633
+ * // Use in validation rules
1634
+ * dv.validate('#myForm', {
1635
+ * rules: {
1636
+ * phoneNumber: { phone: true }
1637
+ * }
1638
+ * });
1639
+ */
1640
+ function addMethod(name, method, message) {
1641
+ store$1.set(name, method);
1642
+ if (message) {
1643
+ store.set(name, message);
1644
+ }
1645
+ if (method.length < 3) {
1646
+ addClassRule(name);
1647
+ }
1648
+ }
1649
+ function localize(data) {
1650
+ const firstValue = Object.values(data)[0];
1651
+ if (typeof firstValue === 'string') {
1652
+ store.replace(data);
1653
+ }
1654
+ else {
1655
+ store$1.replace(data);
1656
+ }
1657
+ }
1658
+ /**
1659
+ * Default export containing all validation functions and stores.
1660
+ * @namespace
1661
+ */
1662
+ var index = {
1663
+ validate,
1664
+ valid,
1665
+ rules,
1666
+ addMethod,
1667
+ localize,
1668
+ messages: store,
1669
+ methods: store$1,
1670
+ };
1671
+
1672
+ exports.addMethod = addMethod;
1673
+ exports.default = index;
1674
+ exports.localize = localize;
1675
+ exports.messages = store;
1676
+ exports.methods = store$1;
1677
+ exports.rules = rules;
1678
+ exports.valid = valid;
1679
+ exports.validate = validate;
1680
+
1681
+ Object.defineProperty(exports, '__esModule', { value: true });
1682
+
1683
+ }));
1684
+ //# sourceMappingURL=dv.js.map