altcha 2.2.4 → 3.0.0-beta.1

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 (503) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +152 -197
  3. package/dist/external/altcha.css +1 -0
  4. package/dist/external/altcha.js +6681 -0
  5. package/dist/external/altcha.min.js +1 -0
  6. package/dist/external/altcha.umd.cjs +6687 -0
  7. package/dist/external/altcha.umd.min.cjs +1 -0
  8. package/dist/external/index.d.ts +1 -0
  9. package/dist/i18n/419.d.ts +1 -0
  10. package/dist/i18n/af.d.ts +1 -0
  11. package/dist/i18n/af.js +22 -0
  12. package/dist/i18n/af.umd.cjs +27 -0
  13. package/dist/i18n/africa.d.ts +1 -0
  14. package/{dist_i18n → dist/i18n}/africa.js +52 -97
  15. package/dist/i18n/africa.umd.cjs +159 -0
  16. package/dist/i18n/all.d.ts +1 -0
  17. package/{dist_i18n → dist/i18n}/all.js +465 -299
  18. package/dist/i18n/all.umd.cjs +1325 -0
  19. package/dist/i18n/am.d.ts +1 -0
  20. package/dist/i18n/am.js +22 -0
  21. package/dist/i18n/am.umd.cjs +27 -0
  22. package/dist/i18n/americas.d.ts +1 -0
  23. package/{dist_i18n → dist/i18n}/americas.js +24 -85
  24. package/dist/i18n/americas.umd.cjs +71 -0
  25. package/dist/i18n/ar.d.ts +1 -0
  26. package/dist/i18n/ar.js +22 -0
  27. package/dist/i18n/ar.umd.cjs +27 -0
  28. package/dist/i18n/asia.d.ts +1 -0
  29. package/{dist_i18n → dist/i18n}/asia.js +177 -158
  30. package/dist/i18n/asia.umd.cjs +511 -0
  31. package/dist/i18n/az.d.ts +1 -0
  32. package/dist/i18n/az.js +22 -0
  33. package/dist/i18n/az.umd.cjs +27 -0
  34. package/dist/i18n/be.d.ts +1 -0
  35. package/dist/i18n/be.js +22 -0
  36. package/dist/i18n/be.umd.cjs +27 -0
  37. package/dist/i18n/bg.d.ts +1 -0
  38. package/dist/i18n/bg.js +22 -0
  39. package/dist/i18n/bg.umd.cjs +27 -0
  40. package/dist/i18n/bn.d.ts +1 -0
  41. package/dist/i18n/bn.js +22 -0
  42. package/dist/i18n/bn.umd.cjs +27 -0
  43. package/dist/i18n/br.d.ts +1 -0
  44. package/dist/i18n/bs.d.ts +1 -0
  45. package/dist/i18n/bs.js +22 -0
  46. package/dist/i18n/bs.umd.cjs +27 -0
  47. package/dist/i18n/ca.d.ts +1 -0
  48. package/dist/i18n/ca.js +22 -0
  49. package/dist/i18n/ca.umd.cjs +27 -0
  50. package/dist/i18n/cn.d.ts +1 -0
  51. package/dist/i18n/cs.d.ts +1 -0
  52. package/dist/i18n/cs.js +22 -0
  53. package/dist/i18n/cs.umd.cjs +27 -0
  54. package/dist/i18n/da.d.ts +1 -0
  55. package/dist/i18n/da.js +22 -0
  56. package/dist/i18n/da.umd.cjs +27 -0
  57. package/dist/i18n/de.d.ts +1 -0
  58. package/dist/i18n/de.js +22 -0
  59. package/dist/i18n/de.umd.cjs +27 -0
  60. package/dist/i18n/el.d.ts +1 -0
  61. package/dist/i18n/el.js +22 -0
  62. package/dist/i18n/el.umd.cjs +27 -0
  63. package/dist/i18n/en.d.ts +1 -0
  64. package/dist/i18n/en.js +22 -0
  65. package/dist/i18n/en.umd.cjs +27 -0
  66. package/dist/i18n/es-419.js +22 -0
  67. package/dist/i18n/es-419.umd.cjs +27 -0
  68. package/dist/i18n/es-es.js +22 -0
  69. package/dist/i18n/es-es.umd.cjs +27 -0
  70. package/dist/i18n/es.d.ts +1 -0
  71. package/dist/i18n/et.d.ts +1 -0
  72. package/dist/i18n/et.js +22 -0
  73. package/dist/i18n/et.umd.cjs +27 -0
  74. package/dist/i18n/eu.d.ts +1 -0
  75. package/dist/i18n/eu.js +22 -0
  76. package/dist/i18n/eu.umd.cjs +27 -0
  77. package/dist/i18n/europe.d.ts +1 -0
  78. package/{dist_i18n → dist/i18n}/europe.js +283 -209
  79. package/dist/i18n/europe.umd.cjs +819 -0
  80. package/dist/i18n/fa.d.ts +1 -0
  81. package/dist/i18n/fa.js +22 -0
  82. package/dist/i18n/fa.umd.cjs +27 -0
  83. package/dist/i18n/fi.d.ts +1 -0
  84. package/dist/i18n/fi.js +22 -0
  85. package/dist/i18n/fi.umd.cjs +27 -0
  86. package/dist/i18n/fr-ca.js +22 -0
  87. package/dist/i18n/fr-ca.umd.cjs +27 -0
  88. package/dist/i18n/fr-fr.js +22 -0
  89. package/dist/i18n/fr-fr.umd.cjs +27 -0
  90. package/dist/i18n/fr.d.ts +1 -0
  91. package/dist/i18n/ga.d.ts +1 -0
  92. package/dist/i18n/ga.js +22 -0
  93. package/dist/i18n/ga.umd.cjs +27 -0
  94. package/dist/i18n/he.d.ts +1 -0
  95. package/dist/i18n/he.js +22 -0
  96. package/dist/i18n/he.umd.cjs +27 -0
  97. package/dist/i18n/hi.d.ts +1 -0
  98. package/dist/i18n/hi.js +22 -0
  99. package/dist/i18n/hi.umd.cjs +27 -0
  100. package/dist/i18n/hr.d.ts +1 -0
  101. package/dist/i18n/hr.js +22 -0
  102. package/dist/i18n/hr.umd.cjs +27 -0
  103. package/dist/i18n/hu.d.ts +1 -0
  104. package/dist/i18n/hu.js +22 -0
  105. package/dist/i18n/hu.umd.cjs +27 -0
  106. package/dist/i18n/hy.d.ts +1 -0
  107. package/dist/i18n/hy.js +22 -0
  108. package/dist/i18n/hy.umd.cjs +27 -0
  109. package/dist/i18n/id.d.ts +1 -0
  110. package/dist/i18n/id.js +22 -0
  111. package/dist/i18n/id.umd.cjs +27 -0
  112. package/dist/i18n/is.d.ts +1 -0
  113. package/dist/i18n/is.js +22 -0
  114. package/dist/i18n/is.umd.cjs +27 -0
  115. package/dist/i18n/it.d.ts +1 -0
  116. package/dist/i18n/it.js +22 -0
  117. package/dist/i18n/it.umd.cjs +27 -0
  118. package/dist/i18n/ja.d.ts +1 -0
  119. package/dist/i18n/ja.js +22 -0
  120. package/dist/i18n/ja.umd.cjs +27 -0
  121. package/dist/i18n/ka.d.ts +1 -0
  122. package/dist/i18n/ka.js +22 -0
  123. package/dist/i18n/ka.umd.cjs +27 -0
  124. package/dist/i18n/kk.d.ts +1 -0
  125. package/dist/i18n/kk.js +22 -0
  126. package/dist/i18n/kk.umd.cjs +27 -0
  127. package/dist/i18n/ko.d.ts +1 -0
  128. package/dist/i18n/ko.js +22 -0
  129. package/dist/i18n/ko.umd.cjs +27 -0
  130. package/dist/i18n/lb.d.ts +1 -0
  131. package/dist/i18n/lb.js +22 -0
  132. package/dist/i18n/lb.umd.cjs +27 -0
  133. package/dist/i18n/lt.d.ts +1 -0
  134. package/dist/i18n/lt.js +22 -0
  135. package/dist/i18n/lt.umd.cjs +27 -0
  136. package/dist/i18n/lv.d.ts +1 -0
  137. package/dist/i18n/lv.js +22 -0
  138. package/dist/i18n/lv.umd.cjs +27 -0
  139. package/dist/i18n/me.d.ts +1 -0
  140. package/dist/i18n/me.js +22 -0
  141. package/dist/i18n/me.umd.cjs +27 -0
  142. package/dist/i18n/mk.d.ts +1 -0
  143. package/dist/i18n/mk.js +22 -0
  144. package/dist/i18n/mk.umd.cjs +27 -0
  145. package/dist/i18n/mr.d.ts +1 -0
  146. package/dist/i18n/mr.js +22 -0
  147. package/dist/i18n/mr.umd.cjs +27 -0
  148. package/dist/i18n/mt.d.ts +1 -0
  149. package/dist/i18n/mt.js +22 -0
  150. package/dist/i18n/mt.umd.cjs +27 -0
  151. package/dist/i18n/nb.d.ts +1 -0
  152. package/dist/i18n/nb.js +22 -0
  153. package/dist/i18n/nb.umd.cjs +27 -0
  154. package/dist/i18n/nl.d.ts +1 -0
  155. package/dist/i18n/nl.js +22 -0
  156. package/dist/i18n/nl.umd.cjs +27 -0
  157. package/dist/i18n/pl.d.ts +1 -0
  158. package/dist/i18n/pl.js +22 -0
  159. package/dist/i18n/pl.umd.cjs +27 -0
  160. package/dist/i18n/pt-br.js +22 -0
  161. package/dist/i18n/pt-br.umd.cjs +27 -0
  162. package/dist/i18n/pt-pt.js +22 -0
  163. package/dist/i18n/pt-pt.umd.cjs +27 -0
  164. package/dist/i18n/pt.d.ts +1 -0
  165. package/dist/i18n/ro.d.ts +1 -0
  166. package/dist/i18n/ro.js +22 -0
  167. package/dist/i18n/ro.umd.cjs +27 -0
  168. package/dist/i18n/ru.d.ts +1 -0
  169. package/dist/i18n/ru.js +22 -0
  170. package/dist/i18n/ru.umd.cjs +27 -0
  171. package/dist/i18n/sk.d.ts +1 -0
  172. package/dist/i18n/sk.js +22 -0
  173. package/dist/i18n/sk.umd.cjs +27 -0
  174. package/dist/i18n/sl.d.ts +1 -0
  175. package/dist/i18n/sl.js +22 -0
  176. package/dist/i18n/sl.umd.cjs +27 -0
  177. package/dist/i18n/sq.d.ts +1 -0
  178. package/dist/i18n/sq.js +22 -0
  179. package/dist/i18n/sq.umd.cjs +27 -0
  180. package/dist/i18n/sr.d.ts +1 -0
  181. package/dist/i18n/sr.js +22 -0
  182. package/dist/i18n/sr.umd.cjs +27 -0
  183. package/dist/i18n/sv.d.ts +1 -0
  184. package/dist/i18n/sv.js +22 -0
  185. package/dist/i18n/sv.umd.cjs +27 -0
  186. package/dist/i18n/sw.d.ts +1 -0
  187. package/dist/i18n/sw.js +22 -0
  188. package/dist/i18n/sw.umd.cjs +27 -0
  189. package/dist/i18n/ta.d.ts +1 -0
  190. package/dist/i18n/ta.js +22 -0
  191. package/dist/i18n/ta.umd.cjs +27 -0
  192. package/dist/i18n/te.d.ts +1 -0
  193. package/dist/i18n/te.js +22 -0
  194. package/dist/i18n/te.umd.cjs +27 -0
  195. package/dist/i18n/th.d.ts +1 -0
  196. package/dist/i18n/th.js +22 -0
  197. package/dist/i18n/th.umd.cjs +27 -0
  198. package/dist/i18n/tk.d.ts +1 -0
  199. package/dist/i18n/tk.js +22 -0
  200. package/dist/i18n/tk.umd.cjs +27 -0
  201. package/dist/i18n/tr.d.ts +1 -0
  202. package/dist/i18n/tr.js +22 -0
  203. package/dist/i18n/tr.umd.cjs +27 -0
  204. package/dist/i18n/tw.d.ts +1 -0
  205. package/dist/i18n/uk.d.ts +1 -0
  206. package/dist/i18n/uk.js +22 -0
  207. package/dist/i18n/uk.umd.cjs +27 -0
  208. package/dist/i18n/ur.d.ts +1 -0
  209. package/dist/i18n/ur.js +22 -0
  210. package/dist/i18n/ur.umd.cjs +27 -0
  211. package/dist/i18n/uz.d.ts +1 -0
  212. package/dist/i18n/uz.js +22 -0
  213. package/dist/i18n/uz.umd.cjs +27 -0
  214. package/dist/i18n/vi.d.ts +1 -0
  215. package/dist/i18n/vi.js +22 -0
  216. package/dist/i18n/vi.umd.cjs +27 -0
  217. package/dist/i18n/yo.d.ts +1 -0
  218. package/dist/i18n/yo.js +22 -0
  219. package/dist/i18n/yo.umd.cjs +27 -0
  220. package/dist/i18n/zh-cn.js +22 -0
  221. package/dist/i18n/zh-cn.umd.cjs +27 -0
  222. package/dist/i18n/zh-tw.js +22 -0
  223. package/dist/i18n/zh-tw.umd.cjs +27 -0
  224. package/dist/lib/index.d.ts +143 -0
  225. package/dist/lib/index.js +1344 -0
  226. package/dist/lib/index.min.js +1 -0
  227. package/dist/lib/index.umd.cjs +1348 -0
  228. package/dist/lib/index.umd.min.cjs +1 -0
  229. package/dist/main/altcha.i18n.js +8389 -0
  230. package/dist/main/altcha.i18n.min.js +1 -0
  231. package/dist/main/altcha.i18n.umd.cjs +8392 -0
  232. package/dist/main/altcha.i18n.umd.min.cjs +1 -0
  233. package/dist/main/altcha.js +7069 -0
  234. package/dist/main/altcha.min.js +1 -0
  235. package/dist/main/altcha.umd.cjs +7072 -0
  236. package/dist/main/altcha.umd.min.cjs +1 -0
  237. package/dist/plugins/obfuscation.plugin.d.ts +1 -0
  238. package/dist/plugins/obfuscation.plugin.js +320 -0
  239. package/dist/plugins/obfuscation.plugin.min.js +1 -0
  240. package/dist/plugins/obfuscation.plugin.umd.cjs +325 -0
  241. package/dist/plugins/obfuscation.plugin.umd.min.cjs +1 -0
  242. package/dist/themes/aqua.css +19 -0
  243. package/dist/themes/aqua.min.css +1 -0
  244. package/dist/themes/business.css +15 -0
  245. package/dist/themes/business.min.css +1 -0
  246. package/dist/themes/caramel.css +19 -0
  247. package/dist/themes/caramel.min.css +1 -0
  248. package/dist/themes/cupcake.css +16 -0
  249. package/dist/themes/cupcake.min.css +1 -0
  250. package/dist/themes/cyberpunk.css +24 -0
  251. package/dist/themes/cyberpunk.min.css +1 -0
  252. package/dist/themes/lime.css +13 -0
  253. package/dist/themes/lime.min.css +1 -0
  254. package/dist/themes/wireframe.css +17 -0
  255. package/dist/themes/wireframe.min.css +1 -0
  256. package/dist/types/generic.d.ts +25 -0
  257. package/dist/types/generic.js +1 -0
  258. package/dist/types/global.d.ts +5 -0
  259. package/dist/types/global.js +1 -0
  260. package/dist/types/index.d.ts +352 -0
  261. package/dist/types/index.js +23 -0
  262. package/dist/types/jsx.d.ts +13 -0
  263. package/dist/types/jsx.js +1 -0
  264. package/dist/types/react.d.ts +35 -0
  265. package/dist/types/react.js +1 -0
  266. package/dist/types/svelte.d.ts +26 -0
  267. package/dist/types/svelte.js +1 -0
  268. package/dist/workers/argon2id.js +786 -0
  269. package/dist/workers/pbkdf2.js +166 -0
  270. package/dist/workers/scrypt.js +739 -0
  271. package/dist/workers/sha.js +160 -0
  272. package/package.json +115 -95
  273. package/dist/altcha.d.ts +0 -183
  274. package/dist/altcha.i18n.d.ts +0 -183
  275. package/dist/altcha.i18n.js +0 -4182
  276. package/dist/altcha.i18n.umd.js +0 -4
  277. package/dist/altcha.js +0 -3105
  278. package/dist/altcha.umd.cjs +0 -4
  279. package/dist_external/altcha.css +0 -1
  280. package/dist_external/altcha.d.ts +0 -183
  281. package/dist_external/altcha.js +0 -3075
  282. package/dist_external/altcha.umd.cjs +0 -3
  283. package/dist_external/worker.js +0 -1
  284. package/dist_i18n/af.d.ts +0 -1
  285. package/dist_i18n/af.js +0 -94
  286. package/dist_i18n/af.umd.cjs +0 -1
  287. package/dist_i18n/africa.d.ts +0 -1
  288. package/dist_i18n/africa.umd.cjs +0 -1
  289. package/dist_i18n/all.d.ts +0 -1
  290. package/dist_i18n/all.umd.cjs +0 -1
  291. package/dist_i18n/am.d.ts +0 -1
  292. package/dist_i18n/am.js +0 -94
  293. package/dist_i18n/am.umd.cjs +0 -1
  294. package/dist_i18n/americas.d.ts +0 -1
  295. package/dist_i18n/americas.umd.cjs +0 -1
  296. package/dist_i18n/ar.d.ts +0 -1
  297. package/dist_i18n/ar.js +0 -94
  298. package/dist_i18n/ar.umd.cjs +0 -1
  299. package/dist_i18n/asia.d.ts +0 -1
  300. package/dist_i18n/asia.umd.cjs +0 -1
  301. package/dist_i18n/az.d.ts +0 -1
  302. package/dist_i18n/az.js +0 -94
  303. package/dist_i18n/az.umd.cjs +0 -1
  304. package/dist_i18n/be.d.ts +0 -1
  305. package/dist_i18n/be.js +0 -94
  306. package/dist_i18n/be.umd.cjs +0 -1
  307. package/dist_i18n/bg.d.ts +0 -1
  308. package/dist_i18n/bg.js +0 -94
  309. package/dist_i18n/bg.umd.cjs +0 -1
  310. package/dist_i18n/bn.d.ts +0 -1
  311. package/dist_i18n/bn.js +0 -94
  312. package/dist_i18n/bn.umd.cjs +0 -1
  313. package/dist_i18n/bs.d.ts +0 -1
  314. package/dist_i18n/bs.js +0 -94
  315. package/dist_i18n/bs.umd.cjs +0 -1
  316. package/dist_i18n/ca.d.ts +0 -1
  317. package/dist_i18n/ca.js +0 -94
  318. package/dist_i18n/ca.umd.cjs +0 -1
  319. package/dist_i18n/cs.d.ts +0 -1
  320. package/dist_i18n/cs.js +0 -94
  321. package/dist_i18n/cs.umd.cjs +0 -1
  322. package/dist_i18n/da.d.ts +0 -1
  323. package/dist_i18n/da.js +0 -94
  324. package/dist_i18n/da.umd.cjs +0 -1
  325. package/dist_i18n/de.d.ts +0 -1
  326. package/dist_i18n/de.js +0 -94
  327. package/dist_i18n/de.umd.cjs +0 -1
  328. package/dist_i18n/el.d.ts +0 -1
  329. package/dist_i18n/el.js +0 -94
  330. package/dist_i18n/el.umd.cjs +0 -1
  331. package/dist_i18n/en.d.ts +0 -1
  332. package/dist_i18n/en.js +0 -94
  333. package/dist_i18n/en.umd.cjs +0 -1
  334. package/dist_i18n/es-419.d.ts +0 -1
  335. package/dist_i18n/es-419.js +0 -94
  336. package/dist_i18n/es-419.umd.cjs +0 -1
  337. package/dist_i18n/es-es.d.ts +0 -1
  338. package/dist_i18n/es-es.js +0 -94
  339. package/dist_i18n/es-es.umd.cjs +0 -1
  340. package/dist_i18n/et.d.ts +0 -1
  341. package/dist_i18n/et.js +0 -94
  342. package/dist_i18n/et.umd.cjs +0 -1
  343. package/dist_i18n/eu.d.ts +0 -1
  344. package/dist_i18n/eu.js +0 -94
  345. package/dist_i18n/eu.umd.cjs +0 -1
  346. package/dist_i18n/europe.d.ts +0 -1
  347. package/dist_i18n/europe.umd.cjs +0 -1
  348. package/dist_i18n/fa.d.ts +0 -1
  349. package/dist_i18n/fa.js +0 -94
  350. package/dist_i18n/fa.umd.cjs +0 -1
  351. package/dist_i18n/fi.d.ts +0 -1
  352. package/dist_i18n/fi.js +0 -94
  353. package/dist_i18n/fi.umd.cjs +0 -1
  354. package/dist_i18n/fr-ca.d.ts +0 -1
  355. package/dist_i18n/fr-ca.js +0 -94
  356. package/dist_i18n/fr-ca.umd.cjs +0 -1
  357. package/dist_i18n/fr-fr.d.ts +0 -1
  358. package/dist_i18n/fr-fr.js +0 -94
  359. package/dist_i18n/fr-fr.umd.cjs +0 -1
  360. package/dist_i18n/ga.d.ts +0 -1
  361. package/dist_i18n/ga.js +0 -94
  362. package/dist_i18n/ga.umd.cjs +0 -1
  363. package/dist_i18n/he.d.ts +0 -1
  364. package/dist_i18n/he.js +0 -94
  365. package/dist_i18n/he.umd.cjs +0 -1
  366. package/dist_i18n/hi.d.ts +0 -1
  367. package/dist_i18n/hi.js +0 -94
  368. package/dist_i18n/hi.umd.cjs +0 -1
  369. package/dist_i18n/hr.d.ts +0 -1
  370. package/dist_i18n/hr.js +0 -94
  371. package/dist_i18n/hr.umd.cjs +0 -1
  372. package/dist_i18n/hu.d.ts +0 -1
  373. package/dist_i18n/hu.js +0 -94
  374. package/dist_i18n/hu.umd.cjs +0 -1
  375. package/dist_i18n/hy.d.ts +0 -1
  376. package/dist_i18n/hy.js +0 -94
  377. package/dist_i18n/hy.umd.cjs +0 -1
  378. package/dist_i18n/id.d.ts +0 -1
  379. package/dist_i18n/id.js +0 -94
  380. package/dist_i18n/id.umd.cjs +0 -1
  381. package/dist_i18n/is.d.ts +0 -1
  382. package/dist_i18n/is.js +0 -94
  383. package/dist_i18n/is.umd.cjs +0 -1
  384. package/dist_i18n/it.d.ts +0 -1
  385. package/dist_i18n/it.js +0 -94
  386. package/dist_i18n/it.umd.cjs +0 -1
  387. package/dist_i18n/ja.d.ts +0 -1
  388. package/dist_i18n/ja.js +0 -94
  389. package/dist_i18n/ja.umd.cjs +0 -1
  390. package/dist_i18n/ka.d.ts +0 -1
  391. package/dist_i18n/ka.js +0 -94
  392. package/dist_i18n/ka.umd.cjs +0 -1
  393. package/dist_i18n/kk.d.ts +0 -1
  394. package/dist_i18n/kk.js +0 -94
  395. package/dist_i18n/kk.umd.cjs +0 -1
  396. package/dist_i18n/ko.d.ts +0 -1
  397. package/dist_i18n/ko.js +0 -94
  398. package/dist_i18n/ko.umd.cjs +0 -1
  399. package/dist_i18n/lb.d.ts +0 -1
  400. package/dist_i18n/lb.js +0 -94
  401. package/dist_i18n/lb.umd.cjs +0 -1
  402. package/dist_i18n/lt.d.ts +0 -1
  403. package/dist_i18n/lt.js +0 -94
  404. package/dist_i18n/lt.umd.cjs +0 -1
  405. package/dist_i18n/lv.d.ts +0 -1
  406. package/dist_i18n/lv.js +0 -94
  407. package/dist_i18n/lv.umd.cjs +0 -1
  408. package/dist_i18n/me.d.ts +0 -1
  409. package/dist_i18n/me.js +0 -94
  410. package/dist_i18n/me.umd.cjs +0 -1
  411. package/dist_i18n/mk.d.ts +0 -1
  412. package/dist_i18n/mk.js +0 -94
  413. package/dist_i18n/mk.umd.cjs +0 -1
  414. package/dist_i18n/mr.d.ts +0 -1
  415. package/dist_i18n/mr.js +0 -94
  416. package/dist_i18n/mr.umd.cjs +0 -1
  417. package/dist_i18n/mt.d.ts +0 -1
  418. package/dist_i18n/mt.js +0 -94
  419. package/dist_i18n/mt.umd.cjs +0 -1
  420. package/dist_i18n/nb.d.ts +0 -1
  421. package/dist_i18n/nb.js +0 -95
  422. package/dist_i18n/nb.umd.cjs +0 -1
  423. package/dist_i18n/nl.d.ts +0 -1
  424. package/dist_i18n/nl.js +0 -94
  425. package/dist_i18n/nl.umd.cjs +0 -1
  426. package/dist_i18n/pl.d.ts +0 -1
  427. package/dist_i18n/pl.js +0 -94
  428. package/dist_i18n/pl.umd.cjs +0 -1
  429. package/dist_i18n/pt-br.d.ts +0 -1
  430. package/dist_i18n/pt-br.js +0 -94
  431. package/dist_i18n/pt-br.umd.cjs +0 -1
  432. package/dist_i18n/pt-pt.d.ts +0 -1
  433. package/dist_i18n/pt-pt.js +0 -94
  434. package/dist_i18n/pt-pt.umd.cjs +0 -1
  435. package/dist_i18n/ro.d.ts +0 -1
  436. package/dist_i18n/ro.js +0 -94
  437. package/dist_i18n/ro.umd.cjs +0 -1
  438. package/dist_i18n/ru.d.ts +0 -1
  439. package/dist_i18n/ru.js +0 -94
  440. package/dist_i18n/ru.umd.cjs +0 -1
  441. package/dist_i18n/sk.d.ts +0 -1
  442. package/dist_i18n/sk.js +0 -94
  443. package/dist_i18n/sk.umd.cjs +0 -1
  444. package/dist_i18n/sl.d.ts +0 -1
  445. package/dist_i18n/sl.js +0 -94
  446. package/dist_i18n/sl.umd.cjs +0 -1
  447. package/dist_i18n/sq.d.ts +0 -1
  448. package/dist_i18n/sq.js +0 -94
  449. package/dist_i18n/sq.umd.cjs +0 -1
  450. package/dist_i18n/sr.d.ts +0 -1
  451. package/dist_i18n/sr.js +0 -94
  452. package/dist_i18n/sr.umd.cjs +0 -1
  453. package/dist_i18n/sv.d.ts +0 -1
  454. package/dist_i18n/sv.js +0 -94
  455. package/dist_i18n/sv.umd.cjs +0 -1
  456. package/dist_i18n/sw.d.ts +0 -1
  457. package/dist_i18n/sw.js +0 -94
  458. package/dist_i18n/sw.umd.cjs +0 -1
  459. package/dist_i18n/ta.d.ts +0 -1
  460. package/dist_i18n/ta.js +0 -94
  461. package/dist_i18n/ta.umd.cjs +0 -1
  462. package/dist_i18n/te.d.ts +0 -1
  463. package/dist_i18n/te.js +0 -94
  464. package/dist_i18n/te.umd.cjs +0 -1
  465. package/dist_i18n/th.d.ts +0 -1
  466. package/dist_i18n/th.js +0 -94
  467. package/dist_i18n/th.umd.cjs +0 -1
  468. package/dist_i18n/tk.d.ts +0 -1
  469. package/dist_i18n/tk.js +0 -94
  470. package/dist_i18n/tk.umd.cjs +0 -1
  471. package/dist_i18n/tr.d.ts +0 -1
  472. package/dist_i18n/tr.js +0 -94
  473. package/dist_i18n/tr.umd.cjs +0 -1
  474. package/dist_i18n/uk.d.ts +0 -1
  475. package/dist_i18n/uk.js +0 -94
  476. package/dist_i18n/uk.umd.cjs +0 -1
  477. package/dist_i18n/ur.d.ts +0 -1
  478. package/dist_i18n/ur.js +0 -94
  479. package/dist_i18n/ur.umd.cjs +0 -1
  480. package/dist_i18n/uz.d.ts +0 -1
  481. package/dist_i18n/uz.js +0 -94
  482. package/dist_i18n/uz.umd.cjs +0 -1
  483. package/dist_i18n/vi.d.ts +0 -1
  484. package/dist_i18n/vi.js +0 -94
  485. package/dist_i18n/vi.umd.cjs +0 -1
  486. package/dist_i18n/yo.d.ts +0 -1
  487. package/dist_i18n/yo.js +0 -94
  488. package/dist_i18n/yo.umd.cjs +0 -1
  489. package/dist_i18n/zh-cn.d.ts +0 -1
  490. package/dist_i18n/zh-cn.js +0 -94
  491. package/dist_i18n/zh-cn.umd.cjs +0 -1
  492. package/dist_i18n/zh-tw.d.ts +0 -1
  493. package/dist_i18n/zh-tw.js +0 -94
  494. package/dist_i18n/zh-tw.umd.cjs +0 -1
  495. package/dist_plugins/analytics.d.ts +0 -1
  496. package/dist_plugins/analytics.js +0 -276
  497. package/dist_plugins/analytics.umd.cjs +0 -1
  498. package/dist_plugins/obfuscation.d.ts +0 -1
  499. package/dist_plugins/obfuscation.js +0 -129
  500. package/dist_plugins/obfuscation.umd.cjs +0 -1
  501. package/dist_plugins/upload.d.ts +0 -1
  502. package/dist_plugins/upload.js +0 -503
  503. package/dist_plugins/upload.umd.cjs +0 -4
@@ -1,94 +0,0 @@
1
- const o = () => {
2
- };
3
- function g(t, e) {
4
- return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
5
- }
6
- let c = !1;
7
- function d(t) {
8
- var e = c;
9
- try {
10
- return c = !0, t();
11
- } finally {
12
- c = e;
13
- }
14
- }
15
- function p(t, e, r) {
16
- if (t == null)
17
- return e(void 0), o;
18
- const i = d(
19
- () => t.subscribe(
20
- e,
21
- // @ts-expect-error
22
- r
23
- )
24
- );
25
- return i.unsubscribe ? () => i.unsubscribe() : i;
26
- }
27
- const s = [];
28
- function T(t, e = o) {
29
- let r = null;
30
- const i = /* @__PURE__ */ new Set();
31
- function a(l) {
32
- if (g(t, l) && (t = l, r)) {
33
- const u = !s.length;
34
- for (const n of i)
35
- n[1](), s.push(n, t);
36
- if (u) {
37
- for (let n = 0; n < s.length; n += 2)
38
- s[n][0](s[n + 1]);
39
- s.length = 0;
40
- }
41
- }
42
- }
43
- function f(l) {
44
- a(l(
45
- /** @type {T} */
46
- t
47
- ));
48
- }
49
- function h(l, u = o) {
50
- const n = [l, u];
51
- return i.add(n), i.size === 1 && (r = e(a, f) || o), l(
52
- /** @type {T} */
53
- t
54
- ), () => {
55
- i.delete(n), i.size === 0 && r && (r(), r = null);
56
- };
57
- }
58
- return { set: a, update: f, subscribe: h };
59
- }
60
- function b(t) {
61
- let e;
62
- return p(t, (r) => e = r)(), e;
63
- }
64
- globalThis.altchaPlugins = globalThis.altchaPlugins || [];
65
- globalThis.altchaI18n = globalThis.altchaI18n || {
66
- get: (t) => b(globalThis.altchaI18n.store)[t],
67
- set: (t, e) => {
68
- Object.assign(b(globalThis.altchaI18n.store), {
69
- [t]: e
70
- }), globalThis.altchaI18n.store.set(b(globalThis.altchaI18n.store));
71
- },
72
- store: T({})
73
- };
74
- const A = {
75
- ariaLinkLabel: "訪問 Altcha.org",
76
- enterCode: "輸入代碼",
77
- enterCodeAria: "輸入您聽到的代碼。按空格鍵播放音頻。",
78
- error: "驗證失敗。稍後再試。",
79
- expired: "驗證已過期。請重試。",
80
- verificationRequired: "需要驗證!",
81
- footer: '由 <a href="https://altcha.org/" target="_blank" aria-label="訪問 Altcha.org">ALTCHA</a> 保護',
82
- getAudioChallenge: "獲取音頻挑戰",
83
- label: "我不是機器人",
84
- loading: "載入中...",
85
- reload: "重新載入",
86
- verify: "驗證",
87
- verified: "已驗證",
88
- verifying: "正在驗證...",
89
- waitAlert: "正在驗證... 請稍等。"
90
- };
91
- globalThis.altchaI18n.set("zh-tw", A);
92
- export {
93
- A as i18n
94
- };
@@ -1 +0,0 @@
1
- (function(l,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(l=typeof globalThis<"u"?globalThis:l||self,o(l["[name]"]={}))})(this,function(l){"use strict";const o=()=>{};function d(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}let a=!1;function p(e){var t=a;try{return a=!0,e()}finally{a=t}}function T(e,t,i){if(e==null)return t(void 0),o;const r=p(()=>e.subscribe(t,i));return r.unsubscribe?()=>r.unsubscribe():r}const u=[];function y(e,t=o){let i=null;const r=new Set;function f(s){if(d(e,s)&&(e=s,i)){const b=!u.length;for(const n of r)n[1](),u.push(n,e);if(b){for(let n=0;n<u.length;n+=2)u[n][0](u[n+1]);u.length=0}}}function g(s){f(s(e))}function A(s,b=o){const n=[s,b];return r.add(n),r.size===1&&(i=t(f,g)||o),s(e),()=>{r.delete(n),r.size===0&&i&&(i(),i=null)}}return{set:f,update:g,subscribe:A}}function c(e){let t;return T(e,i=>t=i)(),t}globalThis.altchaPlugins=globalThis.altchaPlugins||[],globalThis.altchaI18n=globalThis.altchaI18n||{get:e=>c(globalThis.altchaI18n.store)[e],set:(e,t)=>{Object.assign(c(globalThis.altchaI18n.store),{[e]:t}),globalThis.altchaI18n.store.set(c(globalThis.altchaI18n.store))},store:y({})};const h={ariaLinkLabel:"訪問 Altcha.org",enterCode:"輸入代碼",enterCodeAria:"輸入您聽到的代碼。按空格鍵播放音頻。",error:"驗證失敗。稍後再試。",expired:"驗證已過期。請重試。",verificationRequired:"需要驗證!",footer:'由 <a href="https://altcha.org/" target="_blank" aria-label="訪問 Altcha.org">ALTCHA</a> 保護',getAudioChallenge:"獲取音頻挑戰",label:"我不是機器人",loading:"載入中...",reload:"重新載入",verify:"驗證",verified:"已驗證",verifying:"正在驗證...",waitAlert:"正在驗證... 請稍等。"};globalThis.altchaI18n.set("zh-tw",h),l.i18n=h,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
@@ -1 +0,0 @@
1
- declare module 'altcha/analytics';
@@ -1,276 +0,0 @@
1
- new TextEncoder();
2
- function r() {
3
- try {
4
- return Intl.DateTimeFormat().resolvedOptions().timeZone;
5
- } catch {
6
- }
7
- }
8
- class n {
9
- /**
10
- * Constructs a new instance of the Plugin.
11
- *
12
- * @param {PluginContext} context - The context provided to the plugin, containing necessary configurations and dependencies.
13
- */
14
- constructor(t) {
15
- this.context = t;
16
- }
17
- /**
18
- * A distinct name of the plugin. Every plugin must have it's own name.
19
- */
20
- static pluginName;
21
- /**
22
- * Registers a plugin class in the global `altchaPlugins` array.
23
- * Ensures the plugin is added only once.
24
- *
25
- * @param {new(context: PluginContext) => Plugin} cls - The plugin class to register.
26
- */
27
- static register(t) {
28
- typeof globalThis.altchaPlugins != "object" && (globalThis.altchaPlugins = []), globalThis.altchaPlugins.includes(t) || globalThis.altchaPlugins.push(t);
29
- }
30
- /**
31
- * Clean up resources when the plugin is destroyed.
32
- * Override this method in subclasses to implement custom destruction logic.
33
- */
34
- destroy() {
35
- }
36
- /**
37
- * Callback triggered when an error changes.
38
- * Override this method in subclasses to handle error state changes.
39
- *
40
- * @param {string | null} err - The error message or `null` if there's no error.
41
- */
42
- onErrorChange(t) {
43
- }
44
- /**
45
- * Callback triggered when the plugin state changes.
46
- * Override this method in subclasses to handle state changes.
47
- *
48
- * @param {State} state - The new state of the plugin.
49
- */
50
- onStateChange(t) {
51
- }
52
- }
53
- class a extends n {
54
- static pluginName = "analytics";
55
- // HTML form element associated with the plugin
56
- #t;
57
- // Session instance for tracking analytics data
58
- #e;
59
- // Bound method for form submission handling
60
- #i = this.#s.bind(this);
61
- /**
62
- * Creates an instance of PluginAnalytics.
63
- *
64
- * @param {PluginContext} context - The context object containing plugin configurations.
65
- */
66
- constructor(t) {
67
- if (super(t), this.#t = this.context.el.closest("form"), this.#t) {
68
- let e = this.#t.getAttribute("data-beacon-url");
69
- const i = this.#t.getAttribute("action");
70
- !e && i && (e = i + "/beacon"), this.#t.addEventListener("submit", this.#i), this.#e = new h(this.#t, e);
71
- }
72
- }
73
- /**
74
- * Destroys the plugin instance, removing event listeners and cleaning up the session.
75
- */
76
- destroy() {
77
- this.#t?.removeEventListener("submit", this.#i), this.#e?.destroy();
78
- }
79
- /**
80
- * Tracks errors by forwarding them to the session instance.
81
- *
82
- * @param {string | null} err - The error message, or `null` if no error exists.
83
- */
84
- onErrorChange(t) {
85
- this.#e?.trackError(t);
86
- }
87
- /**
88
- * Handles form submission events, appending session data to the form if applicable.
89
- */
90
- #s() {
91
- if (this.#e && !this.#e.submitTime) {
92
- this.#e.end();
93
- const t = this.#e.dataAsBase64();
94
- this.context.dispatch("session", t);
95
- const e = document.createElement("input");
96
- e.type = "hidden", e.name = "__session", e.value = t, this.#t?.appendChild(e);
97
- }
98
- }
99
- }
100
- class h {
101
- /**
102
- * Creates a new Session instance.
103
- *
104
- * @param {HTMLFormElement} elForm - The form element being tracked.
105
- * @param {string | null} [beaconUrl=null] - The URL to send analytics data to.
106
- */
107
- constructor(t, e = null) {
108
- this.elForm = t, this.beaconUrl = e, window.addEventListener("unload", this.#n), this.elForm.addEventListener("change", this.#i), this.elForm.addEventListener("focusin", this.#s);
109
- }
110
- // Error message associated with the session
111
- error = null;
112
- // Timestamp when the form was loaded
113
- loadTime = Date.now();
114
- // Timestamp when the form was submitted
115
- submitTime = null;
116
- // Timestamp when the user started interacting with the form
117
- startTime = null;
118
- // Minimum time in milliseconds required to consider the form "viewed"
119
- viewTimeThresholdMs = 1500;
120
- // Tracks the number of changes made to each form field
121
- #t = {};
122
- // Name of the last input field focused by the user
123
- #e = null;
124
- // Bound method for handling form change events
125
- #i = this.onFormChange.bind(this);
126
- // Bound method for handling form focus events
127
- #s = this.onFormFocus.bind(this);
128
- // Bound method for handling the unload event
129
- #n = this.onUnload.bind(this);
130
- /**
131
- * Collects and returns analytics data about the form interaction.
132
- *
133
- * @returns {Record<string, unknown>} - An object containing analytics data.
134
- */
135
- data() {
136
- const t = Object.entries(this.#t);
137
- return {
138
- correction: t.length && t.filter(([e, i]) => i > 1).length / t.length || 0,
139
- dropoff: !this.submitTime && !this.error && this.#e ? this.#e : null,
140
- error: this.error,
141
- mobile: this.isMobile(),
142
- start: this.startTime,
143
- submit: this.submitTime,
144
- tz: r()
145
- };
146
- }
147
- /**
148
- * Encodes the session data as a base64 string.
149
- *
150
- * @returns {string} - The base64-encoded session data.
151
- */
152
- dataAsBase64() {
153
- try {
154
- return btoa(JSON.stringify(this.data()));
155
- } catch (t) {
156
- console.error("failed to encode ALTCHA session data to base64", t);
157
- }
158
- return "";
159
- }
160
- /**
161
- * Destroys the session, removing event listeners.
162
- */
163
- destroy() {
164
- window.removeEventListener("unload", this.#n), this.elForm.removeEventListener("change", this.#i), this.elForm.removeEventListener("focusin", this.#s);
165
- }
166
- /**
167
- * Marks the session as ended by recording the submission time.
168
- */
169
- end() {
170
- this.submitTime || (this.submitTime = Date.now());
171
- }
172
- /**
173
- * Retrieves the name of a form field, including a group label if available.
174
- *
175
- * @param {HTMLInputElement} el - The input element.
176
- * @param {number} [maxLength=40] - The maximum length of the field name.
177
- * @returns {string} - The field name, truncated to `maxLength` if necessary.
178
- */
179
- getFieldName(t, e = 40) {
180
- const i = t.getAttribute("data-group-label"), o = t.getAttribute("name") || t.getAttribute("aria-label");
181
- return ((i ? i + ": " : "") + o).slice(0, e);
182
- }
183
- /**
184
- * Determines if the current device is a mobile device.
185
- *
186
- * @returns {boolean} - `true` if the device is mobile, otherwise `false`.
187
- */
188
- isMobile() {
189
- const t = "userAgentData" in navigator && navigator.userAgentData ? navigator.userAgentData : {};
190
- return "mobile" in t ? t.mobile === !0 : /Mobi/i.test(window.navigator.userAgent);
191
- }
192
- /**
193
- * Checks if a given element is an input element (input, select, or textarea).
194
- *
195
- * @param {HTMLElement} el - The element to check.
196
- * @returns {boolean} - `true` if the element is an input, otherwise `false`.
197
- */
198
- isInput(t) {
199
- return ["INPUT", "SELECT", "TEXTAREA"].includes(t.tagName);
200
- }
201
- /**
202
- * Tracks changes to a specific form field.
203
- *
204
- * @param {HTMLInputElement} el - The input element that changed.
205
- */
206
- onFormFieldChange(t) {
207
- const e = this.getFieldName(t);
208
- e && this.trackFieldChange(e);
209
- }
210
- /**
211
- * Handles form change events, tracking changes to input fields.
212
- *
213
- * @param {Event} ev - The change event.
214
- */
215
- onFormChange(t) {
216
- const e = t.target;
217
- e && this.isInput(e) && this.onFormFieldChange(e);
218
- }
219
- /**
220
- * Handles form focus events, marking the session start time and tracking the last focused field.
221
- *
222
- * @param {FocusEvent} ev - The focus event.
223
- */
224
- onFormFocus(t) {
225
- const e = t.target;
226
- if (this.startTime || this.start(), e && this.isInput(e)) {
227
- const i = this.getFieldName(e);
228
- i && (this.#e = i);
229
- }
230
- }
231
- /**
232
- * Handles the window unload event, sending a beacon with session data if the form was viewed but not submitted.
233
- */
234
- onUnload() {
235
- this.loadTime <= Date.now() - this.viewTimeThresholdMs && !this.submitTime && this.sendBeacon();
236
- }
237
- /**
238
- * Sends a beacon with session data to the specified beacon URL.
239
- */
240
- async sendBeacon() {
241
- if (this.beaconUrl && "sendBeacon" in navigator)
242
- try {
243
- navigator.sendBeacon(
244
- new URL(this.beaconUrl, location.origin),
245
- JSON.stringify(this.data())
246
- );
247
- } catch {
248
- }
249
- }
250
- /**
251
- * Marks the session as started by recording the start time.
252
- */
253
- start() {
254
- this.startTime = Date.now();
255
- }
256
- /**
257
- * Tracks an error associated with the session.
258
- *
259
- * @param {string | null} err - The error message, or `null` if no error exists.
260
- */
261
- trackError(t) {
262
- this.error = t === null ? null : String(t);
263
- }
264
- /**
265
- * Tracks a change to a specific form field.
266
- *
267
- * @param {string} name - The name of the form field.
268
- */
269
- trackFieldChange(t) {
270
- this.#t[t] = (this.#t[t] || 0) + 1;
271
- }
272
- }
273
- n.register(a);
274
- export {
275
- a as PluginAnalytics
276
- };
@@ -1 +0,0 @@
1
- (function(s,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(s=typeof globalThis<"u"?globalThis:s||self,n(s["[name]"]={}))})(this,function(s){"use strict";new TextEncoder;function n(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}class o{constructor(t){this.context=t}static pluginName;static register(t){typeof globalThis.altchaPlugins!="object"&&(globalThis.altchaPlugins=[]),globalThis.altchaPlugins.includes(t)||globalThis.altchaPlugins.push(t)}destroy(){}onErrorChange(t){}onStateChange(t){}}class r extends o{static pluginName="analytics";#t;#e;#i=this.#s.bind(this);constructor(t){if(super(t),this.#t=this.context.el.closest("form"),this.#t){let e=this.#t.getAttribute("data-beacon-url");const i=this.#t.getAttribute("action");!e&&i&&(e=i+"/beacon"),this.#t.addEventListener("submit",this.#i),this.#e=new h(this.#t,e)}}destroy(){this.#t?.removeEventListener("submit",this.#i),this.#e?.destroy()}onErrorChange(t){this.#e?.trackError(t)}#s(){if(this.#e&&!this.#e.submitTime){this.#e.end();const t=this.#e.dataAsBase64();this.context.dispatch("session",t);const e=document.createElement("input");e.type="hidden",e.name="__session",e.value=t,this.#t?.appendChild(e)}}}class h{constructor(t,e=null){this.elForm=t,this.beaconUrl=e,window.addEventListener("unload",this.#n),this.elForm.addEventListener("change",this.#i),this.elForm.addEventListener("focusin",this.#s)}error=null;loadTime=Date.now();submitTime=null;startTime=null;viewTimeThresholdMs=1500;#t={};#e=null;#i=this.onFormChange.bind(this);#s=this.onFormFocus.bind(this);#n=this.onUnload.bind(this);data(){const t=Object.entries(this.#t);return{correction:t.length&&t.filter(([e,i])=>i>1).length/t.length||0,dropoff:!this.submitTime&&!this.error&&this.#e?this.#e:null,error:this.error,mobile:this.isMobile(),start:this.startTime,submit:this.submitTime,tz:n()}}dataAsBase64(){try{return btoa(JSON.stringify(this.data()))}catch(t){console.error("failed to encode ALTCHA session data to base64",t)}return""}destroy(){window.removeEventListener("unload",this.#n),this.elForm.removeEventListener("change",this.#i),this.elForm.removeEventListener("focusin",this.#s)}end(){this.submitTime||(this.submitTime=Date.now())}getFieldName(t,e=40){const i=t.getAttribute("data-group-label"),l=t.getAttribute("name")||t.getAttribute("aria-label");return((i?i+": ":"")+l).slice(0,e)}isMobile(){const t="userAgentData"in navigator&&navigator.userAgentData?navigator.userAgentData:{};return"mobile"in t?t.mobile===!0:/Mobi/i.test(window.navigator.userAgent)}isInput(t){return["INPUT","SELECT","TEXTAREA"].includes(t.tagName)}onFormFieldChange(t){const e=this.getFieldName(t);e&&this.trackFieldChange(e)}onFormChange(t){const e=t.target;e&&this.isInput(e)&&this.onFormFieldChange(e)}onFormFocus(t){const e=t.target;if(this.startTime||this.start(),e&&this.isInput(e)){const i=this.getFieldName(e);i&&(this.#e=i)}}onUnload(){this.loadTime<=Date.now()-this.viewTimeThresholdMs&&!this.submitTime&&this.sendBeacon()}async sendBeacon(){if(this.beaconUrl&&"sendBeacon"in navigator)try{navigator.sendBeacon(new URL(this.beaconUrl,location.origin),JSON.stringify(this.data()))}catch{}}start(){this.startTime=Date.now()}trackError(t){this.error=t===null?null:String(t)}trackFieldChange(t){this.#t[t]=(this.#t[t]||0)+1}}o.register(r),s.PluginAnalytics=r,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
@@ -1 +0,0 @@
1
- declare module 'altcha/obfuscation';
@@ -1,129 +0,0 @@
1
- class h {
2
- /**
3
- * Constructs a new instance of the Plugin.
4
- *
5
- * @param {PluginContext} context - The context provided to the plugin, containing necessary configurations and dependencies.
6
- */
7
- constructor(t) {
8
- this.context = t;
9
- }
10
- /**
11
- * A distinct name of the plugin. Every plugin must have it's own name.
12
- */
13
- static pluginName;
14
- /**
15
- * Registers a plugin class in the global `altchaPlugins` array.
16
- * Ensures the plugin is added only once.
17
- *
18
- * @param {new(context: PluginContext) => Plugin} cls - The plugin class to register.
19
- */
20
- static register(t) {
21
- typeof globalThis.altchaPlugins != "object" && (globalThis.altchaPlugins = []), globalThis.altchaPlugins.includes(t) || globalThis.altchaPlugins.push(t);
22
- }
23
- /**
24
- * Clean up resources when the plugin is destroyed.
25
- * Override this method in subclasses to implement custom destruction logic.
26
- */
27
- destroy() {
28
- }
29
- /**
30
- * Callback triggered when an error changes.
31
- * Override this method in subclasses to handle error state changes.
32
- *
33
- * @param {string | null} err - The error message or `null` if there's no error.
34
- */
35
- onErrorChange(t) {
36
- }
37
- /**
38
- * Callback triggered when the plugin state changes.
39
- * Override this method in subclasses to handle state changes.
40
- *
41
- * @param {State} state - The new state of the plugin.
42
- */
43
- onStateChange(t) {
44
- }
45
- }
46
- var s = /* @__PURE__ */ ((e) => (e.CODE = "code", e.ERROR = "error", e.VERIFIED = "verified", e.VERIFYING = "verifying", e.UNVERIFIED = "unverified", e.EXPIRED = "expired", e))(s || {});
47
- class R extends h {
48
- static pluginName = "obfuscation";
49
- // The button element associated with revealing the obfuscated data
50
- elButton;
51
- // Bound method for handling button click events
52
- #t = this.#e.bind(this);
53
- /**
54
- * Creates an instance of PluginObfuscation.
55
- *
56
- * @param {PluginContext} context - The context object containing plugin configurations.
57
- */
58
- constructor(t) {
59
- super(t);
60
- const i = t.el;
61
- this.elButton = i.parentElement?.querySelector("[data-clarify-button]") || i.parentElement?.querySelector("button, a"), this.elButton && this.elButton.addEventListener("click", this.#t);
62
- }
63
- /**
64
- * Destroys the plugin instance, removing event listeners.
65
- */
66
- destroy() {
67
- this.elButton && this.elButton.removeEventListener("click", this.#t);
68
- }
69
- /**
70
- * Handles the clarification process by decrypting the obfuscated data and rendering the clear text.
71
- */
72
- async clarify() {
73
- const {
74
- el: t,
75
- getConfiguration: i,
76
- getFloatingAnchor: n,
77
- setFloatingAnchor: r,
78
- reset: f,
79
- solve: d,
80
- setState: c
81
- } = this.context, { delay: g, floating: m, maxnumber: p, obfuscated: u } = i();
82
- if (this.elButton && !n() && r(this.elButton), !u) {
83
- c(s.ERROR);
84
- return;
85
- }
86
- f(s.VERIFYING), await new Promise((l) => setTimeout(l, g || 0));
87
- const [E, y] = u.split("?");
88
- let o = new URLSearchParams(y || "").get("key") || void 0;
89
- if (o) {
90
- const l = o.match(/^\(prompt:?(.*)\)$/);
91
- l && (o = prompt(l[1] || "Enter Key:") || void 0);
92
- }
93
- const { solution: a } = await d({
94
- obfuscated: E,
95
- key: o,
96
- maxnumber: p
97
- });
98
- a && "clearText" in a ? (this.#i(a.clearText), c(s.VERIFIED), this.context.dispatch("cleartext", a.clearText), m && t && (t.style.display = "none")) : c(s.ERROR, "Unable to decrypt data.");
99
- }
100
- /**
101
- * Handles the button click event, triggering the clarification process.
102
- *
103
- * @param {Event} ev - The click event.
104
- */
105
- #e(t) {
106
- t.preventDefault();
107
- const { auto: i } = this.context.getConfiguration();
108
- i === "off" || this.clarify();
109
- }
110
- /**
111
- * Renders the clear text data by creating an appropriate element (e.g., a link or text node).
112
- *
113
- * @param {string} clearText - The decrypted clear text data to render.
114
- */
115
- #i(t) {
116
- const i = t.match(/^(mailto|tel|sms|https?):/);
117
- let n;
118
- if (i) {
119
- const [r] = t.slice(t.indexOf(":") + 1).replace(/^\/\//, "").split("?");
120
- n = document.createElement("a"), n.href = t, n.innerHTML = r;
121
- } else
122
- n = document.createTextNode(t);
123
- this.elButton && n && (this.elButton.after(n), this.elButton.parentElement?.removeChild(this.elButton));
124
- }
125
- }
126
- h.register(R);
127
- export {
128
- R as PluginObfuscation
129
- };
@@ -1 +0,0 @@
1
- (function(o,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o["[name]"]={}))})(this,function(o){"use strict";class s{constructor(t){this.context=t}static pluginName;static register(t){typeof globalThis.altchaPlugins!="object"&&(globalThis.altchaPlugins=[]),globalThis.altchaPlugins.includes(t)||globalThis.altchaPlugins.push(t)}destroy(){}onErrorChange(t){}onStateChange(t){}}var a=(e=>(e.CODE="code",e.ERROR="error",e.VERIFIED="verified",e.VERIFYING="verifying",e.UNVERIFIED="unverified",e.EXPIRED="expired",e))(a||{});class h extends s{static pluginName="obfuscation";elButton;#t=this.#e.bind(this);constructor(t){super(t);const i=t.el;this.elButton=i.parentElement?.querySelector("[data-clarify-button]")||i.parentElement?.querySelector("button, a"),this.elButton&&this.elButton.addEventListener("click",this.#t)}destroy(){this.elButton&&this.elButton.removeEventListener("click",this.#t)}async clarify(){const{el:t,getConfiguration:i,getFloatingAnchor:n,setFloatingAnchor:u,reset:p,solve:m,setState:f}=this.context,{delay:g,floating:E,maxnumber:y,obfuscated:d}=i();if(this.elButton&&!n()&&u(this.elButton),!d){f(a.ERROR);return}p(a.VERIFYING),await new Promise(c=>setTimeout(c,g||0));const[b,R]=d.split("?");let l=new URLSearchParams(R||"").get("key")||void 0;if(l){const c=l.match(/^\(prompt:?(.*)\)$/);c&&(l=prompt(c[1]||"Enter Key:")||void 0)}const{solution:r}=await m({obfuscated:b,key:l,maxnumber:y});r&&"clearText"in r?(this.#i(r.clearText),f(a.VERIFIED),this.context.dispatch("cleartext",r.clearText),E&&t&&(t.style.display="none")):f(a.ERROR,"Unable to decrypt data.")}#e(t){t.preventDefault();const{auto:i}=this.context.getConfiguration();i==="off"||this.clarify()}#i(t){const i=t.match(/^(mailto|tel|sms|https?):/);let n;if(i){const[u]=t.slice(t.indexOf(":")+1).replace(/^\/\//,"").split("?");n=document.createElement("a"),n.href=t,n.innerHTML=u}else n=document.createTextNode(t);this.elButton&&n&&(this.elButton.after(n),this.elButton.parentElement?.removeChild(this.elButton))}}s.register(h),o.PluginObfuscation=h,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
@@ -1 +0,0 @@
1
- declare module 'altcha/upload';