@splendidlabz/utils 1.11.3 → 1.11.5

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 (408) hide show
  1. package/dist/cjs/dom/accessibility.cjs +53 -0
  2. package/dist/cjs/dom/actions/index.cjs +410 -0
  3. package/dist/cjs/dom/actions/masonry.cjs +152 -0
  4. package/dist/cjs/dom/actions/prefer-horizontal-scroll.cjs +157 -0
  5. package/dist/cjs/dom/actions/sticky.cjs +213 -0
  6. package/dist/cjs/dom/bounding-box.cjs +70 -0
  7. package/dist/cjs/dom/clipboard.cjs +37 -0
  8. package/dist/cjs/dom/cookie.cjs +57 -0
  9. package/dist/cjs/dom/css-vars.cjs +57 -0
  10. package/dist/cjs/dom/events.cjs +59 -0
  11. package/{src/dom/focusable.js → dist/cjs/dom/focusable.cjs} +51 -73
  12. package/dist/cjs/dom/font-size.cjs +80 -0
  13. package/dist/cjs/dom/get-element.cjs +98 -0
  14. package/dist/cjs/dom/hash.cjs +35 -0
  15. package/dist/cjs/dom/index.cjs +1267 -0
  16. package/dist/cjs/dom/keyboard.cjs +51 -0
  17. package/dist/cjs/dom/local-store.cjs +79 -0
  18. package/dist/cjs/dom/media.cjs +59 -0
  19. package/dist/cjs/dom/observers/index.cjs +253 -0
  20. package/dist/cjs/dom/observers/intersection-observer.cjs +91 -0
  21. package/dist/cjs/dom/observers/mutation-observer.cjs +95 -0
  22. package/dist/cjs/dom/observers/observer.cjs +48 -0
  23. package/dist/cjs/dom/observers/resize-observer.cjs +84 -0
  24. package/dist/cjs/dom/observers/scroll-observer.cjs +177 -0
  25. package/dist/cjs/dom/pkce.cjs +53 -0
  26. package/dist/cjs/dom/query-params.cjs +38 -0
  27. package/dist/cjs/dom/random-string.cjs +38 -0
  28. package/dist/cjs/dom/sanitize.cjs +65 -0
  29. package/dist/cjs/dom/session-store.cjs +49 -0
  30. package/dist/cjs/dom/spam-prevention.cjs +50 -0
  31. package/dist/cjs/dom/trap-focus.cjs +197 -0
  32. package/dist/cjs/dom/ui/aria-current.cjs +43 -0
  33. package/dist/cjs/dom/ui/inconsistent-button-fix.cjs +35 -0
  34. package/dist/cjs/dom/ui/index.cjs +105 -0
  35. package/dist/cjs/dom/ui/scroll-container.cjs +47 -0
  36. package/dist/cjs/dom/ui/traverse-and-scramble.cjs +50 -0
  37. package/dist/cjs/lib/arrays/index.cjs +139 -0
  38. package/dist/cjs/lib/arrays/item-position.cjs +42 -0
  39. package/dist/cjs/lib/arrays/join.cjs +43 -0
  40. package/dist/cjs/lib/arrays/shuffle.cjs +42 -0
  41. package/dist/cjs/lib/arrays/sort.cjs +67 -0
  42. package/dist/cjs/lib/arrays/split-array.cjs +41 -0
  43. package/dist/cjs/lib/arrays/unique.cjs +31 -0
  44. package/dist/cjs/lib/auth/index.cjs +53 -0
  45. package/dist/cjs/lib/auth/route-manager.cjs +51 -0
  46. package/dist/cjs/lib/checks.cjs +63 -0
  47. package/dist/cjs/lib/date/days.cjs +37 -0
  48. package/dist/cjs/lib/date/index.cjs +208 -0
  49. package/dist/cjs/lib/date/months.cjs +102 -0
  50. package/dist/cjs/lib/date/time.cjs +117 -0
  51. package/dist/cjs/lib/form/form-data.cjs +83 -0
  52. package/dist/cjs/lib/form/index.cjs +122 -0
  53. package/dist/cjs/lib/form/sanitize.cjs +61 -0
  54. package/dist/cjs/lib/functions/callback.cjs +31 -0
  55. package/dist/cjs/lib/functions/debounce.cjs +43 -0
  56. package/dist/cjs/lib/functions/env.cjs +32 -0
  57. package/dist/cjs/lib/functions/functional.cjs +82 -0
  58. package/dist/cjs/lib/functions/index.cjs +142 -0
  59. package/dist/cjs/lib/functions/throttle.cjs +38 -0
  60. package/dist/cjs/lib/functions/timeout.cjs +41 -0
  61. package/dist/cjs/lib/hash.cjs +43 -0
  62. package/dist/cjs/lib/index.cjs +1178 -0
  63. package/dist/cjs/lib/numbers/index.cjs +49 -0
  64. package/dist/cjs/lib/numbers/math.cjs +36 -0
  65. package/dist/cjs/lib/objects/camelcase-keys.cjs +80 -0
  66. package/dist/cjs/lib/objects/empty.cjs +39 -0
  67. package/dist/cjs/lib/objects/equal.cjs +47 -0
  68. package/dist/cjs/lib/objects/extend.cjs +147 -0
  69. package/dist/cjs/lib/objects/flatten.cjs +48 -0
  70. package/dist/cjs/lib/objects/index.cjs +378 -0
  71. package/dist/cjs/lib/objects/json.cjs +35 -0
  72. package/dist/cjs/lib/objects/loop.cjs +40 -0
  73. package/dist/cjs/lib/objects/mix/mix.cjs +115 -0
  74. package/dist/cjs/lib/objects/nested-property.cjs +45 -0
  75. package/dist/cjs/lib/objects/normalize-object.cjs +106 -0
  76. package/dist/cjs/lib/objects/omit-empty.cjs +40 -0
  77. package/dist/cjs/lib/objects/size.cjs +63 -0
  78. package/dist/cjs/lib/objects/split.cjs +39 -0
  79. package/dist/cjs/lib/promises/index.cjs +69 -0
  80. package/dist/cjs/lib/promises/reject.cjs +67 -0
  81. package/dist/cjs/lib/sse.cjs +99 -0
  82. package/dist/cjs/lib/strings/convert-case/convert-case.cjs +96 -0
  83. package/dist/cjs/lib/strings/index.cjs +197 -0
  84. package/dist/cjs/lib/strings/markdown.cjs +76 -0
  85. package/dist/cjs/lib/strings/name.cjs +46 -0
  86. package/dist/cjs/lib/strings/pluralize.cjs +40 -0
  87. package/dist/cjs/lib/strings/query-string.cjs +43 -0
  88. package/dist/cjs/lib/style/index.cjs +64 -0
  89. package/dist/cjs/lib/symbols/index.cjs +40 -0
  90. package/dist/cjs/lib/symbols/symbols.cjs +38 -0
  91. package/dist/cjs/node/dirname.cjs +49 -0
  92. package/dist/cjs/node/file-cache.cjs +200 -0
  93. package/dist/cjs/node/file.cjs +50 -0
  94. package/dist/cjs/node/hash.cjs +42 -0
  95. package/dist/cjs/node/index.cjs +296 -0
  96. package/dist/cjs/node/pkce.cjs +64 -0
  97. package/dist/cjs/node/random-string.cjs +43 -0
  98. package/dist/cjs/node/sanitize.cjs +65 -0
  99. package/dist/cjs/node/uuid.cjs +42 -0
  100. package/dist/esm/dom/accessibility.js +26 -0
  101. package/dist/esm/dom/actions/index.js +3 -0
  102. package/dist/esm/dom/actions/masonry.js +38 -0
  103. package/dist/esm/dom/actions/prefer-horizontal-scroll.js +90 -0
  104. package/dist/esm/dom/actions/sticky.js +70 -0
  105. package/dist/esm/dom/bounding-box.js +44 -0
  106. package/dist/esm/dom/clipboard.js +12 -0
  107. package/dist/esm/dom/cookie.js +31 -0
  108. package/dist/esm/dom/css-vars.js +21 -0
  109. package/dist/esm/dom/events.js +31 -0
  110. package/dist/esm/dom/focusable.js +117 -0
  111. package/dist/esm/dom/font-size.js +40 -0
  112. package/dist/esm/dom/get-element.js +66 -0
  113. package/dist/esm/dom/hash.js +10 -0
  114. package/dist/esm/dom/index.js +23 -0
  115. package/dist/esm/dom/keyboard.js +22 -0
  116. package/{src → dist/esm}/dom/local-store.js +16 -28
  117. package/dist/esm/dom/media.js +32 -0
  118. package/dist/esm/dom/observers/index.js +4 -0
  119. package/dist/esm/dom/observers/intersection-observer.js +36 -0
  120. package/dist/esm/dom/observers/mutation-observer.js +40 -0
  121. package/dist/esm/dom/observers/observer.js +15 -0
  122. package/dist/esm/dom/observers/resize-observer.js +29 -0
  123. package/dist/esm/dom/observers/scroll-observer.js +95 -0
  124. package/dist/esm/dom/pkce.js +20 -0
  125. package/dist/esm/dom/query-params.js +13 -0
  126. package/dist/esm/dom/random-string.js +12 -0
  127. package/dist/esm/dom/sanitize.js +8 -0
  128. package/dist/esm/dom/session-store.js +24 -0
  129. package/dist/esm/dom/spam-prevention.js +25 -0
  130. package/dist/esm/dom/trap-focus.js +51 -0
  131. package/dist/esm/dom/ui/aria-current.js +17 -0
  132. package/dist/esm/dom/ui/inconsistent-button-fix.js +10 -0
  133. package/dist/esm/dom/ui/index.js +4 -0
  134. package/dist/esm/dom/ui/scroll-container.js +22 -0
  135. package/dist/esm/dom/ui/traverse-and-scramble.js +25 -0
  136. package/dist/esm/lib/arrays/index.js +6 -0
  137. package/dist/esm/lib/arrays/item-position.js +15 -0
  138. package/dist/esm/lib/arrays/join.js +12 -0
  139. package/dist/esm/lib/arrays/shuffle.js +17 -0
  140. package/dist/esm/lib/arrays/sort.js +36 -0
  141. package/dist/esm/lib/arrays/split-array.js +16 -0
  142. package/dist/esm/lib/arrays/unique.js +6 -0
  143. package/dist/esm/lib/auth/index.js +1 -0
  144. package/dist/esm/lib/auth/route-manager.js +25 -0
  145. package/dist/esm/lib/checks.js +34 -0
  146. package/dist/esm/lib/date/days.js +12 -0
  147. package/dist/esm/lib/date/index.js +3 -0
  148. package/dist/esm/lib/date/months.js +77 -0
  149. package/dist/esm/lib/date/time.js +75 -0
  150. package/dist/esm/lib/form/form-data.js +57 -0
  151. package/dist/esm/lib/form/index.js +2 -0
  152. package/dist/esm/lib/form/sanitize.js +34 -0
  153. package/dist/esm/lib/functions/callback.js +6 -0
  154. package/dist/esm/lib/functions/debounce.js +18 -0
  155. package/dist/esm/lib/functions/env.js +7 -0
  156. package/dist/esm/lib/functions/functional.js +52 -0
  157. package/dist/esm/lib/functions/index.js +5 -0
  158. package/dist/esm/lib/functions/throttle.js +13 -0
  159. package/dist/esm/lib/functions/timeout.js +14 -0
  160. package/dist/esm/lib/hash.js +18 -0
  161. package/dist/esm/lib/index.js +14 -0
  162. package/dist/esm/lib/numbers/index.js +11 -0
  163. package/dist/esm/lib/numbers/math.js +10 -0
  164. package/dist/esm/lib/objects/camelcase-keys.js +16 -0
  165. package/dist/esm/lib/objects/empty.js +13 -0
  166. package/dist/esm/lib/objects/equal.js +11 -0
  167. package/dist/esm/lib/objects/extend.js +13 -0
  168. package/dist/esm/lib/objects/flatten.js +17 -0
  169. package/dist/esm/lib/objects/index.js +13 -0
  170. package/dist/esm/lib/objects/json.js +10 -0
  171. package/dist/esm/lib/objects/loop.js +14 -0
  172. package/dist/esm/lib/objects/mix/mix.js +88 -0
  173. package/dist/esm/lib/objects/nested-property.js +18 -0
  174. package/dist/esm/lib/objects/normalize-object.js +9 -0
  175. package/dist/esm/lib/objects/omit-empty.js +15 -0
  176. package/dist/esm/lib/objects/size.js +38 -0
  177. package/dist/esm/lib/objects/split.js +14 -0
  178. package/dist/esm/lib/promises/index.js +1 -0
  179. package/dist/esm/lib/promises/reject.js +17 -0
  180. package/dist/esm/lib/sse.js +50 -0
  181. package/dist/esm/lib/strings/convert-case/convert-case.js +64 -0
  182. package/dist/esm/lib/strings/index.js +5 -0
  183. package/dist/esm/lib/strings/markdown.js +40 -0
  184. package/dist/esm/lib/strings/name.js +21 -0
  185. package/dist/esm/lib/strings/pluralize.js +5 -0
  186. package/dist/esm/lib/strings/query-string.js +16 -0
  187. package/dist/esm/lib/style/index.js +12 -0
  188. package/dist/esm/lib/symbols/index.js +1 -0
  189. package/dist/esm/lib/symbols/symbols.js +12 -0
  190. package/dist/esm/node/context.js +0 -0
  191. package/dist/esm/node/dirname.js +13 -0
  192. package/dist/esm/node/file-cache.js +121 -0
  193. package/dist/esm/node/file.js +14 -0
  194. package/dist/esm/node/hash.js +7 -0
  195. package/dist/esm/node/index.js +7 -0
  196. package/dist/esm/node/pkce.js +20 -0
  197. package/dist/esm/node/random-string.js +8 -0
  198. package/dist/esm/node/sanitize.js +8 -0
  199. package/dist/esm/node/uuid.js +7 -0
  200. package/dist/types/dom/accessibility.d.cts +30 -0
  201. package/dist/types/dom/actions/index.d.cts +3 -0
  202. package/dist/types/dom/actions/masonry.d.cts +5 -0
  203. package/dist/types/dom/actions/prefer-horizontal-scroll.d.cts +5 -0
  204. package/dist/types/dom/actions/sticky.d.cts +5 -0
  205. package/{src/dom/bounding-box.js → dist/types/dom/bounding-box.d.cts} +8 -49
  206. package/dist/types/dom/clipboard.d.cts +7 -0
  207. package/dist/types/dom/cookie.d.cts +7 -0
  208. package/dist/types/dom/css-vars.d.cts +6 -0
  209. package/{src/dom/events.js → dist/types/dom/events.d.cts} +52 -31
  210. package/dist/types/dom/focusable.d.cts +78 -0
  211. package/dist/types/dom/font-size.d.cts +8 -0
  212. package/{src/dom/get-element.js → dist/types/dom/get-element.d.cts} +25 -99
  213. package/dist/types/dom/hash.d.cts +3 -0
  214. package/dist/types/dom/index.d.cts +31 -0
  215. package/{src/dom/keyboard.js → dist/types/dom/keyboard.d.cts} +7 -19
  216. package/dist/types/dom/local-store.d.cts +31 -0
  217. package/dist/types/dom/media.d.cts +5 -0
  218. package/dist/types/dom/observers/index.d.cts +4 -0
  219. package/dist/types/dom/observers/intersection-observer.d.cts +10 -0
  220. package/dist/types/dom/observers/mutation-observer.d.cts +9 -0
  221. package/dist/types/dom/observers/observer.d.cts +3 -0
  222. package/{src/dom/observers/resize-observer.js → dist/types/dom/observers/resize-observer.d.cts} +6 -32
  223. package/dist/types/dom/observers/scroll-observer.d.cts +40 -0
  224. package/dist/types/dom/pkce.d.cts +8 -0
  225. package/dist/types/dom/query-params.d.cts +6 -0
  226. package/dist/types/dom/random-string.d.cts +9 -0
  227. package/dist/types/dom/sanitize.d.cts +10 -0
  228. package/dist/types/dom/session-store.d.cts +7 -0
  229. package/dist/types/dom/spam-prevention.d.cts +14 -0
  230. package/dist/types/dom/trap-focus.d.cts +32 -0
  231. package/dist/types/dom/ui/aria-current.d.cts +7 -0
  232. package/{src/dom/ui/inconsistent-button-fix.js → dist/types/dom/ui/inconsistent-button-fix.d.cts} +5 -11
  233. package/dist/types/dom/ui/index.d.cts +4 -0
  234. package/dist/types/dom/ui/scroll-container.d.cts +3 -0
  235. package/dist/types/dom/ui/traverse-and-scramble.d.cts +21 -0
  236. package/dist/types/lib/arrays/index.d.cts +6 -0
  237. package/{src/lib/arrays/item-position.js → dist/types/lib/arrays/item-position.d.cts} +5 -12
  238. package/{src/lib/arrays/join.js → dist/types/lib/arrays/join.d.cts} +4 -9
  239. package/dist/types/lib/arrays/shuffle.d.cts +3 -0
  240. package/dist/types/lib/arrays/sort.d.cts +32 -0
  241. package/dist/types/lib/arrays/split-array.d.cts +6 -0
  242. package/dist/types/lib/arrays/unique.d.cts +3 -0
  243. package/dist/types/lib/auth/index.d.cts +1 -0
  244. package/dist/types/lib/auth/route-manager.d.cts +28 -0
  245. package/dist/types/lib/checks.d.cts +33 -0
  246. package/dist/types/lib/date/days.d.cts +7 -0
  247. package/dist/types/lib/date/index.d.cts +3 -0
  248. package/dist/types/lib/date/months.d.cts +11 -0
  249. package/dist/types/lib/date/time.d.cts +21 -0
  250. package/dist/types/lib/form/form-data.d.cts +9 -0
  251. package/dist/types/lib/form/index.d.cts +2 -0
  252. package/{src/lib/form/sanitize.js → dist/types/lib/form/sanitize.d.cts} +19 -39
  253. package/{src/lib/functions/callback.js → dist/types/lib/functions/callback.d.cts} +3 -3
  254. package/dist/types/lib/functions/debounce.d.cts +3 -0
  255. package/dist/types/lib/functions/env.d.cts +3 -0
  256. package/{src/lib/functions/functional.js → dist/types/lib/functions/functional.d.cts} +8 -49
  257. package/dist/types/lib/functions/index.d.cts +5 -0
  258. package/dist/types/lib/functions/throttle.d.cts +3 -0
  259. package/dist/types/lib/functions/timeout.d.cts +5 -0
  260. package/dist/types/lib/hash.d.cts +3 -0
  261. package/dist/types/lib/index.d.cts +43 -0
  262. package/dist/types/lib/numbers/index.d.cts +5 -0
  263. package/dist/types/lib/numbers/math.d.cts +4 -0
  264. package/dist/types/lib/objects/camelcase-keys.d.cts +3 -0
  265. package/dist/types/lib/objects/empty.d.cts +4 -0
  266. package/dist/types/lib/objects/equal.d.cts +4 -0
  267. package/dist/types/lib/objects/extend.d.cts +6 -0
  268. package/dist/types/lib/objects/flatten.d.cts +6 -0
  269. package/dist/types/lib/objects/index.d.cts +13 -0
  270. package/dist/types/lib/objects/json.d.cts +3 -0
  271. package/dist/types/lib/objects/loop.d.cts +4 -0
  272. package/dist/types/lib/objects/mix/mix.d.cts +44 -0
  273. package/{src/lib/objects/nested-property.js → dist/types/lib/objects/nested-property.d.cts} +4 -21
  274. package/dist/types/lib/objects/normalize-object.d.cts +3 -0
  275. package/dist/types/lib/objects/omit-empty.d.cts +3 -0
  276. package/dist/types/lib/objects/size.d.cts +3 -0
  277. package/dist/types/lib/objects/split.d.cts +14 -0
  278. package/dist/types/lib/promises/index.d.cts +1 -0
  279. package/dist/types/lib/promises/reject.d.cts +5 -0
  280. package/dist/types/lib/sse.d.cts +18 -0
  281. package/dist/types/lib/strings/convert-case/convert-case.d.cts +10 -0
  282. package/dist/types/lib/strings/index.d.cts +5 -0
  283. package/dist/types/lib/strings/markdown.d.cts +25 -0
  284. package/dist/types/lib/strings/name.d.cts +7 -0
  285. package/dist/types/lib/strings/pluralize.d.cts +3 -0
  286. package/dist/types/lib/strings/query-string.d.cts +10 -0
  287. package/dist/types/lib/style/index.d.cts +3 -0
  288. package/dist/types/lib/symbols/index.d.cts +1 -0
  289. package/dist/types/lib/symbols/symbols.d.cts +4 -0
  290. package/dist/types/node/context.d.cts +2 -0
  291. package/dist/types/node/dirname.d.cts +9 -0
  292. package/dist/types/node/file-cache.d.cts +56 -0
  293. package/dist/types/node/file.d.cts +4 -0
  294. package/dist/types/node/hash.d.cts +3 -0
  295. package/dist/types/node/index.d.cts +7 -0
  296. package/dist/types/node/pkce.d.cts +14 -0
  297. package/dist/types/node/random-string.d.cts +3 -0
  298. package/{src/node/sanitize.js → dist/types/node/sanitize.d.cts} +3 -6
  299. package/dist/types/node/uuid.d.cts +3 -0
  300. package/package.json +18 -15
  301. package/CHANGELOG.md +0 -237
  302. package/eslint.config.js +0 -2
  303. package/src/dom/accessibility.js +0 -58
  304. package/src/dom/actions/index.js +0 -3
  305. package/src/dom/actions/masonry.js +0 -43
  306. package/src/dom/actions/prefer-horizontal-scroll.js +0 -121
  307. package/src/dom/actions/sticky.js +0 -85
  308. package/src/dom/clipboard.js +0 -14
  309. package/src/dom/cookie.js +0 -32
  310. package/src/dom/css-vars.js +0 -19
  311. package/src/dom/font-size.js +0 -40
  312. package/src/dom/hash.js +0 -9
  313. package/src/dom/index.js +0 -23
  314. package/src/dom/media.js +0 -30
  315. package/src/dom/observers/index.js +0 -4
  316. package/src/dom/observers/intersection-observer.js +0 -43
  317. package/src/dom/observers/mutation-observer.js +0 -51
  318. package/src/dom/observers/observer.js +0 -18
  319. package/src/dom/observers/scroll-observer.js +0 -146
  320. package/src/dom/pkce.js +0 -34
  321. package/src/dom/query-params.js +0 -14
  322. package/src/dom/random-string.js +0 -18
  323. package/src/dom/random-string.test.js +0 -13
  324. package/src/dom/sanitize.js +0 -16
  325. package/src/dom/session-store.js +0 -29
  326. package/src/dom/spam-prevention.js +0 -40
  327. package/src/dom/trap-focus.js +0 -70
  328. package/src/dom/ui/aria-current.js +0 -20
  329. package/src/dom/ui/index.js +0 -4
  330. package/src/dom/ui/scroll-container.js +0 -25
  331. package/src/dom/ui/traverse-and-scramble.js +0 -61
  332. package/src/lib/arrays/index.js +0 -6
  333. package/src/lib/arrays/shuffle.js +0 -21
  334. package/src/lib/arrays/sort.js +0 -88
  335. package/src/lib/arrays/sort.spec.js +0 -123
  336. package/src/lib/arrays/split-array.js +0 -15
  337. package/src/lib/arrays/unique.js +0 -3
  338. package/src/lib/auth/index.js +0 -1
  339. package/src/lib/auth/route-manager.js +0 -45
  340. package/src/lib/checks.js +0 -57
  341. package/src/lib/date/days.js +0 -9
  342. package/src/lib/date/index.js +0 -3
  343. package/src/lib/date/months.js +0 -74
  344. package/src/lib/date/time.js +0 -83
  345. package/src/lib/form/form-data.js +0 -73
  346. package/src/lib/form/index.js +0 -2
  347. package/src/lib/form/sanitize.spec.js +0 -126
  348. package/src/lib/functions/debounce.js +0 -18
  349. package/src/lib/functions/env.js +0 -5
  350. package/src/lib/functions/functional.test.js +0 -196
  351. package/src/lib/functions/index.js +0 -5
  352. package/src/lib/functions/throttle.js +0 -11
  353. package/src/lib/functions/timeout.js +0 -15
  354. package/src/lib/hash.js +0 -18
  355. package/src/lib/hash.spec.js +0 -163
  356. package/src/lib/index.js +0 -14
  357. package/src/lib/numbers/index.js +0 -12
  358. package/src/lib/numbers/math.js +0 -9
  359. package/src/lib/numbers/split-unit.test.js +0 -45
  360. package/src/lib/objects/camelcase-keys.js +0 -17
  361. package/src/lib/objects/camelcase-keys.test.js +0 -72
  362. package/src/lib/objects/empty.js +0 -10
  363. package/src/lib/objects/equal.js +0 -9
  364. package/src/lib/objects/extend.js +0 -16
  365. package/src/lib/objects/extend.test.js +0 -35
  366. package/src/lib/objects/flatten.js +0 -19
  367. package/src/lib/objects/index.js +0 -13
  368. package/src/lib/objects/json.js +0 -7
  369. package/src/lib/objects/loop.js +0 -11
  370. package/src/lib/objects/loop.test.js +0 -31
  371. package/src/lib/objects/mix/mix.js +0 -191
  372. package/src/lib/objects/mix/mix.md +0 -78
  373. package/src/lib/objects/mix/mix.test.js +0 -445
  374. package/src/lib/objects/normalize-object.js +0 -10
  375. package/src/lib/objects/omit-empty.js +0 -23
  376. package/src/lib/objects/omit-empty.test.js +0 -85
  377. package/src/lib/objects/size.js +0 -41
  378. package/src/lib/objects/split.js +0 -19
  379. package/src/lib/promises/index.js +0 -1
  380. package/src/lib/promises/reject.js +0 -17
  381. package/src/lib/sse.js +0 -61
  382. package/src/lib/strings/convert-case/convert-case.js +0 -86
  383. package/src/lib/strings/convert-case/convert-case.md +0 -44
  384. package/src/lib/strings/convert-case/convert-case.test.js +0 -50
  385. package/src/lib/strings/index.js +0 -5
  386. package/src/lib/strings/markdown.js +0 -71
  387. package/src/lib/strings/markdown.spec.js +0 -73
  388. package/src/lib/strings/name.js +0 -24
  389. package/src/lib/strings/name.test.js +0 -67
  390. package/src/lib/strings/pluralize.js +0 -2
  391. package/src/lib/strings/query-string.js +0 -18
  392. package/src/lib/style/index.js +0 -13
  393. package/src/lib/symbols/index.js +0 -1
  394. package/src/lib/symbols/symbols.js +0 -9
  395. package/src/node/dirname.js +0 -17
  396. package/src/node/file-cache.js +0 -184
  397. package/src/node/file.js +0 -13
  398. package/src/node/hash.js +0 -5
  399. package/src/node/index.js +0 -7
  400. package/src/node/pkce.js +0 -33
  401. package/src/node/random-string.js +0 -10
  402. package/src/node/random-string.test.js +0 -15
  403. package/src/node/sanitize.spec.js +0 -142
  404. package/src/node/uuid.js +0 -5
  405. package/tsconfig.json +0 -23
  406. package/tsup.config.js +0 -38
  407. package/tsup.config.mjs +0 -63
  408. /package/{src/node/context.js → dist/cjs/node/context.cjs} +0 -0
@@ -0,0 +1,1267 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/dom/index.js
30
+ var dom_exports = {};
31
+ __export(dom_exports, {
32
+ Focusable: () => Focusable,
33
+ PKCE: () => PKCE,
34
+ addListeners: () => addListeners,
35
+ boundingBox: () => boundingBox,
36
+ boundingBoxRelativeToAncestor: () => boundingBoxRelativeToAncestor,
37
+ checkForAccessibleName: () => checkForAccessibleName,
38
+ cookies: () => cookies,
39
+ copyRichText: () => copyRichText,
40
+ dispatchEvent: () => dispatchEvent,
41
+ em: () => em,
42
+ findScrollContainer: () => findScrollContainer,
43
+ getAncestorWithSiblings: () => getAncestorWithSiblings,
44
+ getCSSValue: () => getCSSValue,
45
+ getCSSVar: () => getCSSVar,
46
+ getChildrenElements: () => getChildrenElements,
47
+ getCookie: () => getCookie,
48
+ getElement: () => getElement,
49
+ getFocusableElements: () => getFocusableElements,
50
+ getNodeType: () => getNodeType,
51
+ getParentElement: () => getParentElement,
52
+ getSelfIndex: () => getSelfIndex,
53
+ getSiblingElements: () => getSiblingElements,
54
+ getUnit: () => getUnit,
55
+ hasAccessibleName: () => hasAccessibleName,
56
+ imagesLoaded: () => imagesLoaded,
57
+ inconsistentButtonFix: () => inconsistentButtonFix,
58
+ intersectionObserver: () => intersectionObserver,
59
+ isAncestor: () => isAncestor,
60
+ isArrowKey: () => isArrowKey,
61
+ isEscapeKey: () => isEscapeKey,
62
+ isInvalidAriaPopup: () => isInvalidAriaPopup,
63
+ isShiftTab: () => isShiftTab,
64
+ isTab: () => isTab,
65
+ isTabKey: () => isTabKey,
66
+ lh: () => lh,
67
+ localStore: () => localStore,
68
+ manageFocus: () => manageFocus,
69
+ markActiveAnchorIn: () => markActiveAnchorIn,
70
+ masonry: () => masonry,
71
+ mediaLoaded: () => mediaLoaded,
72
+ mutationObserver: () => mutationObserver,
73
+ preferHorizontalScroll: () => preferHorizontalScroll,
74
+ preventSpam: () => preventSpam,
75
+ queryParams: () => queryParams,
76
+ randomString: () => randomString,
77
+ rem: () => rem,
78
+ removeListeners: () => removeListeners,
79
+ resizeObserver: () => resizeObserver,
80
+ rlh: () => rlh,
81
+ sanitize: () => sanitize2,
82
+ scrollObserver: () => scrollObserver,
83
+ scrollToElement: () => scrollToElement,
84
+ sessionStore: () => sessionStore,
85
+ setCSSValue: () => setCSSValue,
86
+ setCSSVar: () => setCSSVar,
87
+ sha256Hash: () => sha256Hash,
88
+ sticky: () => sticky,
89
+ toPx: () => toPx,
90
+ trapFocus: () => trapFocus,
91
+ traverseAndScramble: () => traverseAndScramble,
92
+ updateEvent: () => updateEvent,
93
+ uuid: () => uuid,
94
+ videosLoaded: () => videosLoaded
95
+ });
96
+ module.exports = __toCommonJS(dom_exports);
97
+
98
+ // src/dom/accessibility.js
99
+ function hasAccessibleName(label, labelledBy) {
100
+ if (label || labelledBy) return true;
101
+ return false;
102
+ }
103
+ function checkForAccessibleName({
104
+ name,
105
+ ariaLabel,
106
+ ariaLabelledBy,
107
+ severity = "warn"
108
+ } = {}) {
109
+ if (ariaLabel || ariaLabelledBy) return true;
110
+ const message = `${name} is missing an accessible name. Please provide an accessible name with 'aria-label' or 'aria-labelledby'.`;
111
+ if (severity === "warn") console.warn(message);
112
+ if (severity === "error") console.error(message);
113
+ return false;
114
+ }
115
+ function isInvalidAriaPopup(value) {
116
+ const allowedPopoupValues = ["dialog", "menu", "listbox", "grid", "tree"];
117
+ if (!allowedPopoupValues.includes(value)) return true;
118
+ return false;
119
+ }
120
+
121
+ // src/dom/get-element.js
122
+ var astroNodes = ["ASTRO-SLOT", "ASTRO-ISLAND"];
123
+ function getNodeType(node) {
124
+ if (node instanceof Element) return "element";
125
+ if (node instanceof NodeList) return "nodelist";
126
+ if (Array.isArray(node)) return "array";
127
+ }
128
+ function getElement(selector) {
129
+ if (!selector) return;
130
+ if (selector instanceof Element) return selector;
131
+ return document.querySelector(selector);
132
+ }
133
+ function getChildrenElements(node) {
134
+ let children = node.children;
135
+ if (children[0]?.nodeName === "ASTRO-SLOT") children = children[0].children;
136
+ return Array.from(children);
137
+ }
138
+ function getParentElement(element) {
139
+ const parent = element.parentElement;
140
+ if (astroNodes.includes(parent.nodeName)) return getParentElement(parent);
141
+ return parent;
142
+ }
143
+ function getSiblingElements(element) {
144
+ return Array.from(element.parentElement.children).filter(
145
+ (child) => child !== element
146
+ );
147
+ }
148
+ function getSelfIndex(element) {
149
+ return Array.from(element.parentElement.children).indexOf(element);
150
+ }
151
+ function isAncestor(ancestor, element, { searchLevels = 0 } = {}) {
152
+ if (ancestor === element) return true;
153
+ let parent = element.parentElement;
154
+ if (searchLevels === 0) {
155
+ while (parent) {
156
+ if (ancestor === parent) return true;
157
+ parent = parent.parentElement;
158
+ }
159
+ } else {
160
+ for (let i = 0; i < searchLevels; i++) {
161
+ if (ancestor === parent) return true;
162
+ parent = parent.parentElement;
163
+ }
164
+ }
165
+ return false;
166
+ }
167
+ function getAncestorWithSiblings(element, { limit = false } = {}) {
168
+ const ancestor = element.parentElement;
169
+ const siblings = getSiblingElements(ancestor);
170
+ if (siblings.length) return siblings;
171
+ if (!ancestor) return null;
172
+ if (limit === false) return getAncestorWithSiblings(ancestor);
173
+ if (typeof limit === "number" && limit > 0) {
174
+ return getAncestorWithSiblings(ancestor, { limit: limit - 1 });
175
+ }
176
+ if (limit === 0) return null;
177
+ }
178
+
179
+ // src/dom/media.js
180
+ async function imagesLoaded(node) {
181
+ const images = Array.from(node.querySelectorAll("img"));
182
+ const promises = images.map((img) => {
183
+ return new Promise((resolve, reject) => {
184
+ if (img.complete) return resolve();
185
+ img.onload = resolve;
186
+ img.onerror = (e) => {
187
+ reject("Image failed to load");
188
+ };
189
+ });
190
+ });
191
+ return Promise.all(promises);
192
+ }
193
+ async function videosLoaded(node) {
194
+ const videos = Array.from(node.querySelectorAll("video"));
195
+ const promises = videos.map((video) => {
196
+ return new Promise((resolve, reject) => {
197
+ if (video.readyState === 4) return resolve();
198
+ video.onloadedmetadata = resolve;
199
+ video.onerror = reject;
200
+ });
201
+ });
202
+ return Promise.all(promises);
203
+ }
204
+ async function mediaLoaded(node) {
205
+ return Promise.all([imagesLoaded(node), videosLoaded(node)]);
206
+ }
207
+
208
+ // src/dom/events.js
209
+ function addListeners(listeners) {
210
+ listeners.forEach(({ node, event, handler }) => {
211
+ node.addEventListener(event, handler);
212
+ });
213
+ }
214
+ function removeListeners(listeners) {
215
+ listeners.forEach(({ node, event, handler }) => {
216
+ node.removeEventListener(event, handler);
217
+ });
218
+ }
219
+ function dispatchEvent(node, eventName, detail, options = {}) {
220
+ node.dispatchEvent(
221
+ new CustomEvent(eventName, {
222
+ ...options,
223
+ detail
224
+ })
225
+ );
226
+ }
227
+ function updateEvent(event, updates) {
228
+ const { type, ...rest } = event;
229
+ return new CustomEvent(event.type, {
230
+ ...rest,
231
+ ...updates
232
+ });
233
+ }
234
+
235
+ // src/dom/observers/observer.js
236
+ function useObserverMethodOnTarget(target, observer, method = "observe", options = void 0) {
237
+ const targetType = getNodeType(target);
238
+ if (targetType === "element") observer[method](target, options);
239
+ if (targetType === "nodelist") {
240
+ const elements = Array.from(target);
241
+ elements.forEach((element) => observer[method](element, options));
242
+ }
243
+ if (targetType === "array") {
244
+ target.forEach((element) => observer[method](element, options));
245
+ }
246
+ }
247
+
248
+ // src/dom/observers/resize-observer.js
249
+ function resizeObserver(target, options) {
250
+ const { callback, ...opts } = options;
251
+ const observer = new ResizeObserver(observerFn);
252
+ if (target === window || target === document)
253
+ target = document.documentElement;
254
+ useObserverMethodOnTarget(target, observer, "observe", opts);
255
+ function observerFn(entries) {
256
+ for (const entry of entries) {
257
+ if (callback) callback({ entry, entries, observer });
258
+ else
259
+ dispatchEvent(entry.target, "resize-obs", { entry, entries, observer });
260
+ }
261
+ }
262
+ return {
263
+ observe(target2) {
264
+ useObserverMethodOnTarget(target2, observer, "observe", options);
265
+ },
266
+ unobserve(target2) {
267
+ useObserverMethodOnTarget(target2, observer, "unobserve");
268
+ },
269
+ disconnect: (_) => observer.disconnect(),
270
+ destroy: (_) => observer.disconnect()
271
+ };
272
+ }
273
+
274
+ // src/dom/actions/masonry.js
275
+ async function masonry(node) {
276
+ if (nativeMasonrySupport(node)) return;
277
+ const colGap = parseFloat(getComputedStyle(node).columnGap);
278
+ const items = getChildrenElements(node);
279
+ node.style.setProperty("row-gap", "1px", "important");
280
+ node.style.gridAutoRows = "0px";
281
+ node.updateMasonryLayout = (_) => layout({ colGap, items });
282
+ try {
283
+ await mediaLoaded(node);
284
+ } catch (e) {
285
+ }
286
+ layout({ colGap, items });
287
+ const obs = resizeObserver(node, {
288
+ async callback(opts) {
289
+ layout({ colGap, items });
290
+ }
291
+ });
292
+ async function layout({ colGap: colGap2, items: items2 }) {
293
+ items2.forEach((item) => {
294
+ const ib = item.getBoundingClientRect();
295
+ item.style.gridRowEnd = `span ${Math.round(ib.height + colGap2)}`;
296
+ });
297
+ }
298
+ return {
299
+ destroy() {
300
+ obs.disconnect();
301
+ }
302
+ };
303
+ }
304
+ function nativeMasonrySupport(node) {
305
+ return getComputedStyle(node).gridTemplateRows === "masonry";
306
+ }
307
+
308
+ // src/lib/objects/omit-empty.js
309
+ function omitEmpty(obj, shallow = false) {
310
+ if (typeof obj !== "object" || obj === null) return obj;
311
+ if (obj instanceof Date) return obj;
312
+ const result = Array.isArray(obj) ? [] : {};
313
+ for (const [key, value] of Object.entries(obj)) {
314
+ if (value === null || value === void 0 || value === "" || typeof value === "object" && !(value instanceof Date) && Object.keys(value).length === 0) {
315
+ continue;
316
+ }
317
+ result[key] = shallow ? value : omitEmpty(value);
318
+ }
319
+ return result;
320
+ }
321
+
322
+ // src/dom/css-vars.js
323
+ function getCSSValue(element, prop) {
324
+ return getCSSVar(element, prop);
325
+ }
326
+ function setCSSValue(element, prop, value) {
327
+ setCSSVar(element, prop, value);
328
+ }
329
+ function getCSSVar(element, prop) {
330
+ element = getElement(element);
331
+ return getComputedStyle(element).getPropertyValue(prop);
332
+ }
333
+ function setCSSVar(element, prop, value) {
334
+ element = getElement(element);
335
+ element.style.setProperty(prop, value);
336
+ }
337
+
338
+ // src/dom/actions/prefer-horizontal-scroll.js
339
+ var DEFAULT_OPTIONS = {
340
+ scrollSnapDelay: 1e3
341
+ };
342
+ function preferHorizontalScroll(node, props = {}) {
343
+ if (!node.classList.contains("scrollable-prefer-horizontal")) return;
344
+ const state = {
345
+ origSnapType: null,
346
+ currentSnapType: null,
347
+ snapTimeoutID: null
348
+ };
349
+ const options = {
350
+ ...DEFAULT_OPTIONS,
351
+ ...omitEmpty({
352
+ scrollSnapDelay: getCSSVar(node, "--scroll-snap-delay")
353
+ }),
354
+ ...omitEmpty(props)
355
+ };
356
+ const listeners = [
357
+ {
358
+ event: "wheel",
359
+ node,
360
+ handler: handleWheel
361
+ },
362
+ {
363
+ event: "pointerenter",
364
+ node,
365
+ handler: handlePointerEnter
366
+ },
367
+ {
368
+ event: "pointerleave",
369
+ node,
370
+ handler: handlePointerLeave
371
+ }
372
+ ];
373
+ addListeners(listeners);
374
+ function handleWheel(event) {
375
+ const direction = event.deltaY > 0 ? "down" : "up";
376
+ const updatedDelta = event.deltaY;
377
+ if (isTrackpad(event)) return false;
378
+ setCSSVar(node, "--snap-type", "none");
379
+ const scrolledAmount = node.scrollLeft;
380
+ const scrollWidth = node.scrollWidth;
381
+ const clientWidth = node.clientWidth;
382
+ const scrollableAmount = scrollWidth - clientWidth;
383
+ if (direction === "down" && scrolledAmount < scrollableAmount) {
384
+ node.scrollLeft += updatedDelta;
385
+ event.preventDefault();
386
+ }
387
+ if (direction === "up" && scrolledAmount > 0) {
388
+ node.scrollLeft += updatedDelta;
389
+ event.preventDefault();
390
+ }
391
+ const { snapTimeoutID } = state;
392
+ if (snapTimeoutID) clearTimeout(snapTimeoutID);
393
+ state.snapTimeoutID = setTimeout((_) => {
394
+ restoreHijackedState(node, state);
395
+ }, options.scrollSnapDelay);
396
+ }
397
+ function handlePointerEnter(event) {
398
+ state.origSnapType = getCSSVar(node, "--snap-type") || "proximity";
399
+ }
400
+ function handlePointerLeave(event) {
401
+ restoreHijackedState(node, state);
402
+ }
403
+ return {
404
+ destroy() {
405
+ removeListeners(listeners);
406
+ }
407
+ };
408
+ }
409
+ function restoreHijackedState(node, state) {
410
+ const scrollLeft = node.scrollLeft;
411
+ setCSSVar(node, "--snap-type", state.origSnapType);
412
+ const finalScrollLeft = node.scrollLeft;
413
+ setCSSVar(node, "--snap-type", "none");
414
+ node.scrollTo({ left: scrollLeft, behavior: "instant" });
415
+ node.scrollTo({ left: finalScrollLeft, behavior: "smooth" });
416
+ setTimeout((_) => {
417
+ setCSSVar(node, "--snap-type", state.origSnapType);
418
+ }, 250);
419
+ }
420
+ function isTrackpad(event) {
421
+ if (event.wheelDeltaY === event.deltaY * -3) return true;
422
+ }
423
+
424
+ // src/dom/bounding-box.js
425
+ function boundingBox(element, { containsPadding = true } = {}) {
426
+ const box = element.getBoundingClientRect();
427
+ const ret = {};
428
+ for (const prop in box) ret[prop] = box[prop];
429
+ if (!containsPadding) {
430
+ const style = getComputedStyle(element);
431
+ const paddingTop = parseFloat(style.paddingTop);
432
+ const paddingRight = parseFloat(style.paddingRight);
433
+ const paddingBottom = parseFloat(style.paddingBottom);
434
+ const paddingLeft = parseFloat(style.paddingLeft);
435
+ ret.x = ret.x + paddingLeft;
436
+ ret.y = ret.y + paddingTop;
437
+ ret.width = ret.width - paddingLeft - paddingRight;
438
+ ret.height = ret.height - paddingTop - paddingBottom;
439
+ ret.top = ret.top + paddingTop;
440
+ ret.bottom = ret.bottom - paddingBottom;
441
+ ret.right = ret.right - paddingRight;
442
+ ret.left = ret.left + paddingLeft;
443
+ }
444
+ ret.xCenter = (ret.left + ret.right) / 2;
445
+ ret.yCenter = (ret.top + ret.bottom) / 2;
446
+ return ret;
447
+ }
448
+ function boundingBoxRelativeToAncestor({ element, ancestorElement }) {
449
+ ancestorElement = ancestorElement || element.parentElement;
450
+ const box = boundingBox(element);
451
+ const ancestorBox = boundingBox(ancestorElement, {
452
+ containsPadding: false
453
+ });
454
+ return {
455
+ top: box.top - ancestorBox.top,
456
+ right: box.right - ancestorBox.right,
457
+ bottom: box.bottom - ancestorBox.bottom,
458
+ left: box.left - ancestorBox.left,
459
+ width: box.width,
460
+ height: box.height,
461
+ xCenter: (box.left + box.right) / 2 - ancestorBox.left,
462
+ yCenter: (box.top + box.bottom) / 2 - ancestorBox.top
463
+ };
464
+ }
465
+
466
+ // src/dom/ui/scroll-container.js
467
+ function findScrollContainer(element, direction = "both") {
468
+ if (!element) return;
469
+ let parent = element.parentElement;
470
+ while (parent) {
471
+ const { overflow, overflowX, overflowY } = getComputedStyle(parent);
472
+ if (direction === "both") {
473
+ if (overflow.includes("auto") || overflow.includes("scroll"))
474
+ return parent;
475
+ }
476
+ if (direction === "horizontal") {
477
+ if (overflowX === "auto" || overflowX === "scroll") return parent;
478
+ }
479
+ if (direction === "vertical") {
480
+ if (overflowY === "auto" || overflowY === "scroll") return parent;
481
+ }
482
+ parent = parent.parentElement;
483
+ }
484
+ return document.documentElement;
485
+ }
486
+
487
+ // src/dom/actions/sticky.js
488
+ function sticky(node, props = {}) {
489
+ const scrollContainer = findScrollContainer(node);
490
+ let stickyTBLR = getComputedTBLR(node);
491
+ const obs = resizeObserver(node, {
492
+ callback: ({ entry }) => {
493
+ stickyTBLR = getComputedTBLR(node);
494
+ isSticking();
495
+ scrollContainer === document.documentElement ? window.addEventListener("scroll", scrollEventListener) : scrollContainer.addEventListener("scroll", scrollEventListener);
496
+ }
497
+ });
498
+ function scrollEventListener(event) {
499
+ isSticking();
500
+ }
501
+ function isSticking() {
502
+ const { top, bottom, left, right } = stickyTBLR;
503
+ const relativeRect = boundingBoxRelativeToAncestor({
504
+ element: node,
505
+ ancestorElement: scrollContainer
506
+ });
507
+ if (!isNaN(top)) {
508
+ if (relativeRect.top - top <= 1) {
509
+ node.classList.add("sticking");
510
+ } else {
511
+ node.classList.remove("sticking");
512
+ }
513
+ }
514
+ if (!isNaN(bottom)) {
515
+ if (relativeRect.bottom + bottom >= -1) {
516
+ node.classList.add("sticking");
517
+ } else {
518
+ node.classList.remove("sticking");
519
+ }
520
+ }
521
+ if (!isNaN(left)) {
522
+ if (relativeRect.left - left <= 1) {
523
+ node.classList.add("sticking");
524
+ } else {
525
+ node.classList.remove("sticking");
526
+ }
527
+ }
528
+ if (!isNaN(right)) {
529
+ if (relativeRect.right + right >= -1) {
530
+ node.classList.add("sticking");
531
+ } else {
532
+ node.classList.remove("sticking");
533
+ }
534
+ }
535
+ }
536
+ return {
537
+ destroy() {
538
+ obs.disconnect();
539
+ scrollContainer.removeEventListener("scroll", scrollEventListener);
540
+ }
541
+ };
542
+ }
543
+ function getComputedTBLR(element) {
544
+ const style = getComputedStyle(element);
545
+ return {
546
+ top: parseFloat(style.top),
547
+ bottom: parseFloat(style.bottom),
548
+ left: parseFloat(style.left),
549
+ right: parseFloat(style.right)
550
+ };
551
+ }
552
+
553
+ // src/dom/clipboard.js
554
+ function copyRichText(element) {
555
+ const range = document.createRange();
556
+ range.selectNode(element);
557
+ const selection = window.getSelection();
558
+ selection.removeAllRanges();
559
+ selection.addRange(range);
560
+ document.execCommand("copy");
561
+ selection.removeAllRanges();
562
+ }
563
+
564
+ // src/dom/cookie.js
565
+ var cookies = {
566
+ get(name) {
567
+ return getCookie(name);
568
+ },
569
+ set(name, value, days) {
570
+ setCookie(name, value, days);
571
+ }
572
+ };
573
+ function getCookie(name) {
574
+ const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
575
+ if (!match) return null;
576
+ const decoded = decodeURIComponent(match[2]);
577
+ try {
578
+ return JSON.parse(decoded);
579
+ } catch (e) {
580
+ return decoded;
581
+ }
582
+ }
583
+ function setCookie(name, value, days) {
584
+ let expires = "";
585
+ if (days) {
586
+ const date = /* @__PURE__ */ new Date();
587
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
588
+ expires = "; expires=" + date.toUTCString();
589
+ }
590
+ document.cookie = name + "=" + (value || "") + expires + "; path=/";
591
+ }
592
+
593
+ // src/dom/focusable.js
594
+ function getFocusableElements(container = document.body) {
595
+ return {
596
+ /**
597
+ * Gets the number of keyboard focusable elements.
598
+ * This is useful for checking if there are any focusable elements
599
+ * before attempting to focus them.
600
+ *
601
+ * @returns {number} The number of keyboard focusable elements
602
+ */
603
+ get length() {
604
+ return this.keyboard.length;
605
+ },
606
+ /**
607
+ * Gets all focusable elements within the container that are visible and enabled.
608
+ * This includes elements that can be focused via mouse or programmatically,
609
+ * but may not be keyboard focusable.
610
+ *
611
+ * Elements are considered focusable if they:
612
+ * - Are not disabled
613
+ * - Are not hidden
614
+ * - Are not display:none
615
+ *
616
+ * @returns {HTMLElement[]} Array of focusable elements that are visible and enabled
617
+ */
618
+ get all() {
619
+ const elements = Array.from(
620
+ container.querySelectorAll(
621
+ `a,
622
+ button,
623
+ input,
624
+ textarea,
625
+ select,
626
+ details,
627
+ iframe,
628
+ embed,
629
+ object,
630
+ summary,
631
+ dialog,
632
+ audio[controls],
633
+ video[controls],
634
+ [contenteditable],
635
+ [tabindex]
636
+ `
637
+ )
638
+ );
639
+ return elements.filter((el) => {
640
+ if (el.hasAttribute("disabled")) return false;
641
+ if (el.hasAttribute("hidden")) return false;
642
+ if (window.getComputedStyle(el).display === "none") return false;
643
+ return true;
644
+ });
645
+ },
646
+ /**
647
+ * Gets elements that can be focused via keyboard (tabIndex > -1).
648
+ * These are the elements that will be focused when using the Tab key.
649
+ *
650
+ * @returns {HTMLElement[]} Array of keyboard focusable elements
651
+ */
652
+ get keyboard() {
653
+ return this.all.filter((el) => el instanceof HTMLElement && el.tabIndex > -1);
654
+ },
655
+ /**
656
+ * Alias for keyboard focusable elements.
657
+ * This is provided for semantic clarity in certain contexts.
658
+ *
659
+ * @returns {HTMLElement[]} Array of keyboard focusable elements
660
+ */
661
+ get keyboardOnly() {
662
+ return this.keyboard;
663
+ },
664
+ /**
665
+ * Gets the first keyboard focusable element.
666
+ * This is useful for setting initial focus when opening a modal or dialog.
667
+ *
668
+ * @returns {HTMLElement|null} The first focusable element or null if none exist
669
+ */
670
+ get first() {
671
+ return this.keyboard[0] || null;
672
+ },
673
+ /**
674
+ * Gets the last keyboard focusable element.
675
+ * This is useful for focus trapping when using Shift+Tab.
676
+ *
677
+ * @returns {HTMLElement|null} The last focusable element or null if none exist
678
+ */
679
+ get last() {
680
+ return this.keyboard[this.length - 1] || null;
681
+ },
682
+ /**
683
+ * Gets the next focusable element after the given index.
684
+ * This is useful for implementing custom tab order or focus management.
685
+ *
686
+ * @param {number} index - The current element's index in the keyboard focusable array
687
+ * @returns {HTMLElement|null} The next focusable element or null if none exists
688
+ */
689
+ next(index) {
690
+ return this.keyboard[index + 1] || null;
691
+ },
692
+ /**
693
+ * Gets the previous focusable element before the given index.
694
+ * This is useful for implementing custom tab order or focus management.
695
+ *
696
+ * @param {number} index - The current element's index in the keyboard focusable array
697
+ * @returns {HTMLElement|null} The previous focusable element or null if none exists
698
+ */
699
+ prev(index) {
700
+ return this.keyboard[index - 1] || null;
701
+ }
702
+ };
703
+ }
704
+ function Focusable(container = document.body) {
705
+ return getFocusableElements(container);
706
+ }
707
+
708
+ // src/lib/numbers/index.js
709
+ function splitUnit(string) {
710
+ if (typeof string === "number") return [string, null];
711
+ const regex = /(-?\d*\.?\d+)\s*([a-z]+)/i;
712
+ const match = string.match(regex);
713
+ if (match) return [parseFloat(match[1]), match[2]];
714
+ return [parseFloat(string), null];
715
+ }
716
+
717
+ // src/dom/font-size.js
718
+ function getUnit(value) {
719
+ const [, unit] = splitUnit(value);
720
+ return unit;
721
+ }
722
+ function rem(multiple = 1) {
723
+ const value = parseFloat(getComputedStyle(document.body)["font-size"]);
724
+ return Math.round(value * multiple);
725
+ }
726
+ function em(element = document.body, multiple = 1) {
727
+ const value = parseFloat(getComputedStyle(element)["font-size"]);
728
+ return Math.round(value * multiple);
729
+ }
730
+ function rlh(multiple = 1) {
731
+ const lineHeight = parseFloat(getComputedStyle(document.body)["line-height"]);
732
+ return Math.round(lineHeight * multiple);
733
+ }
734
+ function lh(element = document.body, multiple = 1) {
735
+ const lineHeight = getComputedStyle(element)["line-height"];
736
+ const value = parseFloat(lineHeight);
737
+ return Math.round(value * multiple);
738
+ }
739
+ function toPx(value, element = null) {
740
+ const [numeric, unit] = splitUnit(value);
741
+ let finalValue = 0;
742
+ if (unit === "rem") finalValue = rem(numeric);
743
+ if (unit === "em") finalValue = em(element, numeric);
744
+ if (unit === "lh") finalValue = lh(element, numeric);
745
+ if (unit === "px") finalValue = numeric;
746
+ if (!unit) finalValue = numeric;
747
+ return finalValue;
748
+ }
749
+
750
+ // src/dom/hash.js
751
+ async function sha256Hash(string) {
752
+ const utf8 = new TextEncoder().encode(string);
753
+ const hashBuffer = await crypto.subtle.digest("SHA-256", utf8);
754
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
755
+ const hashHex = hashArray.map((bytes) => bytes.toString(16).padStart(2, "0")).join("");
756
+ return hashHex;
757
+ }
758
+
759
+ // src/dom/keyboard.js
760
+ function isTab(event) {
761
+ return !event.shiftKey && event.key === "Tab";
762
+ }
763
+ function isShiftTab(event) {
764
+ return event.shiftKey && event.key === "Tab";
765
+ }
766
+ function isTabKey(key) {
767
+ return key === "Tab";
768
+ }
769
+ function isArrowKey(key) {
770
+ return ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(key);
771
+ }
772
+ function isEscapeKey(key) {
773
+ return key === "Escape";
774
+ }
775
+
776
+ // src/dom/local-store.js
777
+ var localStore = {
778
+ /**
779
+ * Retrieves a value from localStorage
780
+ * @param {string} key - The key to retrieve from localStorage
781
+ * @returns {any} The stored value. Returns parsed JSON if the value was stored as JSON. Returns the original string if not JSON, or undefined if key doesn't exist
782
+ */
783
+ get(key) {
784
+ const value = localStorage.getItem(key);
785
+ if (!value) return;
786
+ try {
787
+ return JSON.parse(value);
788
+ } catch (error) {
789
+ return value;
790
+ }
791
+ },
792
+ /**
793
+ * Stores a value in localStorage
794
+ * @param {string} key - The key to store the value under
795
+ * @param {any} value - The value to store. Objects will be stringified to JSON
796
+ */
797
+ set(key, value) {
798
+ if (typeof value === "string") {
799
+ localStorage.setItem(key, value);
800
+ } else {
801
+ localStorage.setItem(key, JSON.stringify(value));
802
+ }
803
+ },
804
+ /**
805
+ * Stores multiple key-value pairs in localStorage
806
+ * @param {Object|Map} data - An object or Map containing key-value pairs to store
807
+ */
808
+ setMultiple(data) {
809
+ for (const [key, value] of Object.entries(data)) {
810
+ this.set(key, value);
811
+ }
812
+ },
813
+ /**
814
+ * Removes a value from localStorage
815
+ * @param {string} key - The key to remove from localStorage
816
+ */
817
+ remove(key) {
818
+ localStorage.removeItem(key);
819
+ },
820
+ /**
821
+ * Removes multiple keys from localStorage
822
+ * @param {string[]} keys - Array of keys to remove from localStorage
823
+ */
824
+ removeMultiple(keys) {
825
+ keys.forEach((key) => this.remove(key));
826
+ }
827
+ };
828
+
829
+ // src/dom/observers/intersection-observer.js
830
+ function intersectionObserver(target, options = {}) {
831
+ const { callback, ...opts } = options;
832
+ const observer = new IntersectionObserver(observerFn, opts);
833
+ useObserverMethodOnTarget(target, observer, "observe");
834
+ function observerFn(entries) {
835
+ for (const entry of entries) {
836
+ if (callback) callback({ entry, entries, observer });
837
+ else dispatchEvent(target, "intersect", { entry, entries, observer });
838
+ }
839
+ }
840
+ return {
841
+ observer,
842
+ observe(target2) {
843
+ useObserverMethodOnTarget(target2, observer, "observe", options);
844
+ },
845
+ unobserve(target2) {
846
+ useObserverMethodOnTarget(target2, observer, "unobserve");
847
+ },
848
+ takeRecords() {
849
+ return observer.takeRecords();
850
+ },
851
+ disconnect() {
852
+ const records = observer.takeRecords();
853
+ observer.disconnect();
854
+ if (records.length > 0) observerFn(records);
855
+ },
856
+ destroy() {
857
+ observer.disconnect();
858
+ }
859
+ };
860
+ }
861
+
862
+ // src/dom/observers/mutation-observer.js
863
+ var defaultOptions = {
864
+ attributes: false,
865
+ childList: false,
866
+ subtree: false
867
+ };
868
+ function mutationObserver(target, options) {
869
+ options = { ...defaultOptions, ...options };
870
+ const { callback, ...opts } = options;
871
+ const observer = new MutationObserver(observerFn);
872
+ if (target === window) target = document.body;
873
+ useObserverMethodOnTarget(target, observer, "observe", opts);
874
+ function observerFn(entries) {
875
+ for (const entry of entries) {
876
+ if (callback) callback({ entry, entries, observer });
877
+ else dispatchEvent(target, "mutate", { entry, entries, observer });
878
+ }
879
+ }
880
+ return {
881
+ observer,
882
+ observe(target2) {
883
+ useObserverMethodOnTarget(target2, observer, "observe", options);
884
+ },
885
+ takeRecords() {
886
+ return observer.takeRecords();
887
+ },
888
+ disconnect() {
889
+ const records = observer.takeRecords();
890
+ observer.disconnect();
891
+ if (records.length > 0) observerFn(records);
892
+ },
893
+ destroy() {
894
+ observer.disconnect();
895
+ }
896
+ };
897
+ }
898
+
899
+ // src/dom/observers/scroll-observer.js
900
+ var defaultOptions2 = {
901
+ threshold: 0,
902
+ // Float between 0 to 1.
903
+ tolerance: 0.1,
904
+ // Float between 0 to 1. Tolerance for event firing
905
+ once: false
906
+ // Only fire threshold callback once
907
+ };
908
+ function getScrollElement(node) {
909
+ if (node === document || node === window || node === document.documentElement) {
910
+ return document.documentElement;
911
+ }
912
+ return (
913
+ /** @type {Element} */
914
+ node
915
+ );
916
+ }
917
+ function scrollObserver(node, options = {}) {
918
+ const { callback, onScrollDown, onScrollUp, onEnterThreshold, ...userOpts } = options;
919
+ const opts = { ...defaultOptions2, ...userOpts };
920
+ const { threshold, tolerance, once } = opts;
921
+ let prevScrollDirection = null;
922
+ let prevScrollTop = 0;
923
+ let prevScrollPercent = 0;
924
+ let thresholdFired = false;
925
+ let rafId = null;
926
+ const isDocumentScroll = node === document || node === window || node === document.documentElement;
927
+ const scrollElement = getScrollElement(node);
928
+ const eventTarget = isDocumentScroll ? window : node;
929
+ let cachedScrollHeight = 0;
930
+ let cachedClientHeight = 0;
931
+ updateCache();
932
+ const cacheObserver = resizeObserver(scrollElement, {
933
+ callback: updateCache
934
+ });
935
+ eventTarget.addEventListener("scroll", throttledObserve, { passive: true });
936
+ function throttledObserve() {
937
+ rafId = requestAnimationFrame(observe);
938
+ }
939
+ function updateCache() {
940
+ cachedScrollHeight = scrollElement.scrollHeight;
941
+ cachedClientHeight = scrollElement.clientHeight;
942
+ }
943
+ function observe() {
944
+ const scrollTop = scrollElement.scrollTop;
945
+ if (Math.abs(scrollTop - prevScrollTop) < 1) return;
946
+ const scrollDirection = scrollTop > prevScrollTop ? "down" : "up";
947
+ const maxScroll = Math.max(1, cachedScrollHeight - cachedClientHeight);
948
+ const scrollPercent = Math.min(1, Math.max(0, scrollTop / maxScroll));
949
+ const thresholdMin = threshold - tolerance / 2;
950
+ const thresholdMax = threshold + tolerance / 2;
951
+ const wasInThreshold = prevScrollPercent >= thresholdMin && prevScrollPercent <= thresholdMax;
952
+ const isInThreshold = scrollPercent >= thresholdMin && scrollPercent <= thresholdMax;
953
+ const hasEnteredThreshold = !wasInThreshold && isInThreshold && (!once || !thresholdFired);
954
+ if (hasEnteredThreshold && once) {
955
+ thresholdFired = true;
956
+ }
957
+ const callbackData = {
958
+ scrollTop,
959
+ scrollDirection,
960
+ scrollPercent,
961
+ directionChanged: scrollDirection !== prevScrollDirection,
962
+ hasEnteredThreshold,
963
+ isInThreshold
964
+ };
965
+ if (typeof callback === "function") {
966
+ callback(callbackData);
967
+ }
968
+ if (scrollDirection !== prevScrollDirection) {
969
+ if (scrollDirection === "down" && typeof onScrollDown === "function") {
970
+ onScrollDown(callbackData);
971
+ }
972
+ if (scrollDirection === "up" && typeof onScrollUp === "function") {
973
+ onScrollUp(callbackData);
974
+ }
975
+ }
976
+ if (hasEnteredThreshold && typeof onEnterThreshold === "function") {
977
+ onEnterThreshold(callbackData);
978
+ }
979
+ prevScrollTop = scrollTop;
980
+ prevScrollPercent = scrollPercent;
981
+ prevScrollDirection = scrollDirection;
982
+ }
983
+ return {
984
+ destroy() {
985
+ eventTarget.removeEventListener("scroll", throttledObserve);
986
+ if (rafId) cancelAnimationFrame(rafId);
987
+ cacheObserver.destroy();
988
+ }
989
+ };
990
+ }
991
+
992
+ // src/dom/random-string.js
993
+ function randomString(length = 10) {
994
+ const firstLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26));
995
+ const others = Math.random().toString(36).substring(2, 2 + length - 1);
996
+ return firstLetter + others;
997
+ }
998
+ function uuid() {
999
+ return crypto.randomUUID();
1000
+ }
1001
+
1002
+ // src/dom/pkce.js
1003
+ async function PKCE() {
1004
+ const codeVerifier = await randomString();
1005
+ const codeChallenge = await getCodeChallenge(codeVerifier);
1006
+ return {
1007
+ state: await randomString(),
1008
+ code_verifier: codeVerifier,
1009
+ code_challenge: codeChallenge,
1010
+ code_challenge_method: "S256"
1011
+ };
1012
+ }
1013
+ async function getCodeChallenge(verifier) {
1014
+ const encoder = new TextEncoder();
1015
+ const data = encoder.encode(verifier);
1016
+ const hashed = await window.crypto.subtle.digest("SHA-256", data);
1017
+ return window.btoa(String.fromCharCode.apply(null, new Uint8Array(hashed))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1018
+ }
1019
+
1020
+ // src/dom/query-params.js
1021
+ var queryParams = {
1022
+ get(key) {
1023
+ const searchParams = new URLSearchParams(location.search);
1024
+ return searchParams.get(key);
1025
+ },
1026
+ stringify(params) {
1027
+ const searchParams = new URLSearchParams(location.search);
1028
+ return searchParams.toString();
1029
+ }
1030
+ };
1031
+
1032
+ // src/dom/sanitize.js
1033
+ var import_dompurify = __toESM(require("dompurify"), 1);
1034
+
1035
+ // src/lib/form/sanitize.js
1036
+ function sanitize(value, options = {}) {
1037
+ const { sanitizer, ...rest } = options;
1038
+ if (!sanitizer) throw new Error("sanitizer function is required");
1039
+ if (typeof value === "string") return sanitizer(value, rest);
1040
+ if (Array.isArray(value)) return sanitizeArray(value, { sanitizer, ...rest });
1041
+ if (value && typeof value === "object") {
1042
+ return Object.fromEntries(
1043
+ Object.entries(value).map(([key, val]) => [
1044
+ key,
1045
+ sanitize(val, { sanitizer, ...rest })
1046
+ ])
1047
+ );
1048
+ }
1049
+ return value;
1050
+ }
1051
+ function sanitizeArray(arr, { sanitizer, ...rest }) {
1052
+ if (!sanitizer) throw new Error("sanitizer function is required");
1053
+ return arr.map((item) => sanitize(item, { sanitizer, ...rest }));
1054
+ }
1055
+
1056
+ // src/dom/sanitize.js
1057
+ function sanitize2(value, options = {}) {
1058
+ return sanitize(value, { sanitizer: import_dompurify.default.sanitize, ...options });
1059
+ }
1060
+
1061
+ // src/dom/session-store.js
1062
+ var sessionStore = {
1063
+ get(key) {
1064
+ const value = sessionStorage.getItem(key);
1065
+ if (!value) return;
1066
+ try {
1067
+ return JSON.parse(value);
1068
+ } catch (error) {
1069
+ return value;
1070
+ }
1071
+ },
1072
+ set(key, value) {
1073
+ if (typeof value === "string") {
1074
+ sessionStorage.setItem(key, value);
1075
+ } else {
1076
+ sessionStorage.setItem(key, JSON.stringify(value));
1077
+ }
1078
+ },
1079
+ remove(key) {
1080
+ sessionStorage.removeItem(key);
1081
+ }
1082
+ };
1083
+
1084
+ // src/dom/spam-prevention.js
1085
+ function preventSpam(form, { honeypotField = "hp", honeypotDuration = 2e3 } = {}) {
1086
+ const startTime = Date.now();
1087
+ let hasInteraction = false;
1088
+ function checkForInteraction() {
1089
+ hasInteraction = true;
1090
+ }
1091
+ const events = ["keydown", "mousemove", "touchstart", "click"];
1092
+ events.forEach((event) => {
1093
+ form.addEventListener(event, checkForInteraction, { once: true });
1094
+ });
1095
+ form.containsSpam = function() {
1096
+ const fillTime = Date.now() - startTime;
1097
+ const isTooFast = fillTime < honeypotDuration;
1098
+ const honeypotInput = form.querySelector(`[name="${honeypotField}"]`);
1099
+ const hasHoneypotValue = honeypotInput?.value?.trim();
1100
+ const noInteraction = !hasInteraction;
1101
+ events.forEach(
1102
+ (event) => form.removeEventListener(event, checkForInteraction)
1103
+ );
1104
+ return isTooFast || !!hasHoneypotValue || noInteraction;
1105
+ };
1106
+ }
1107
+
1108
+ // src/dom/trap-focus.js
1109
+ function trapFocus({ event, focusables }) {
1110
+ if (event.key !== "Tab") return;
1111
+ if (isTab(event) && document.activeElement === focusables.last) {
1112
+ event.preventDefault();
1113
+ focusables.first.focus();
1114
+ }
1115
+ if (isShiftTab(event) && document.activeElement === focusables.first) {
1116
+ event.preventDefault();
1117
+ focusables.last.focus();
1118
+ }
1119
+ }
1120
+ function manageFocus({
1121
+ event,
1122
+ triggerNode,
1123
+ contentNode,
1124
+ focusables,
1125
+ tabOutFocus = "next",
1126
+ // 'trigger'
1127
+ onLeave = function() {
1128
+ }
1129
+ }) {
1130
+ const activeEl = document.activeElement;
1131
+ if (activeEl === contentNode && isShiftTab(event)) return backFocus();
1132
+ if (activeEl === contentNode && focusables.length === 0 && isTab(event))
1133
+ return nextFocus();
1134
+ if (activeEl === focusables.last && isTab(event)) return nextFocus();
1135
+ if (activeEl === focusables.first && isShiftTab(event)) return backFocus();
1136
+ function backFocus() {
1137
+ event.preventDefault();
1138
+ triggerNode.focus();
1139
+ onLeave("back");
1140
+ }
1141
+ function nextFocus() {
1142
+ if (tabOutFocus === "trigger") triggerNode.focus();
1143
+ if (tabOutFocus === "next") {
1144
+ event.preventDefault();
1145
+ const DOMFocusables = getFocusableElements().keyboard;
1146
+ const index = DOMFocusables.findIndex((e) => e === triggerNode);
1147
+ const next = DOMFocusables[index + 1];
1148
+ if (next) next.focus();
1149
+ else triggerNode.focus();
1150
+ }
1151
+ onLeave("forward");
1152
+ }
1153
+ }
1154
+
1155
+ // src/dom/ui/aria-current.js
1156
+ function markActiveAnchorIn(container, anchorType = "page") {
1157
+ if (!container) return;
1158
+ const { pathname } = window.location;
1159
+ const element = container.querySelector(`[href="${pathname}"]`);
1160
+ if (!element) return;
1161
+ element.setAttribute("aria-current", "page");
1162
+ return element;
1163
+ }
1164
+ function scrollToElement(element, { scrollBehaviour = "instant", scrollMargin = "3rem" } = {}) {
1165
+ if (!element) return;
1166
+ element.style.scrollMarginTop = scrollMargin;
1167
+ element.scrollIntoView({ behavior: scrollBehaviour });
1168
+ }
1169
+
1170
+ // src/dom/ui/inconsistent-button-fix.js
1171
+ function inconsistentButtonFix() {
1172
+ document.addEventListener("click", (event) => {
1173
+ if (event.target instanceof HTMLButtonElement) {
1174
+ event.target.focus();
1175
+ }
1176
+ });
1177
+ }
1178
+
1179
+ // src/dom/ui/traverse-and-scramble.js
1180
+ function traverseAndScramble(node, { excludes = [] } = {}) {
1181
+ if (node instanceof Element && excludes.some((selector) => node.matches(selector))) {
1182
+ return;
1183
+ }
1184
+ node.childNodes.forEach((child) => {
1185
+ if (child.nodeType === 3) {
1186
+ child.nodeValue = scrambleText(child.nodeValue);
1187
+ } else if (child.nodeType === 1 && child instanceof Element) {
1188
+ traverseAndScramble(child, { excludes });
1189
+ }
1190
+ });
1191
+ }
1192
+ function scrambleText(text) {
1193
+ return text.split("").map((char) => {
1194
+ if (/^[A-Za-z0-9]$/.test(char)) {
1195
+ const randomCharCode = Math.random() < 26 / 36 ? Math.floor(Math.random() * 26) + (char === char.toUpperCase() ? 65 : 97) : Math.floor(Math.random() * 10) + 48;
1196
+ return String.fromCharCode(randomCharCode);
1197
+ } else {
1198
+ return char;
1199
+ }
1200
+ }).join("");
1201
+ }
1202
+ // Annotate the CommonJS export names for ESM import in node:
1203
+ 0 && (module.exports = {
1204
+ Focusable,
1205
+ PKCE,
1206
+ addListeners,
1207
+ boundingBox,
1208
+ boundingBoxRelativeToAncestor,
1209
+ checkForAccessibleName,
1210
+ cookies,
1211
+ copyRichText,
1212
+ dispatchEvent,
1213
+ em,
1214
+ findScrollContainer,
1215
+ getAncestorWithSiblings,
1216
+ getCSSValue,
1217
+ getCSSVar,
1218
+ getChildrenElements,
1219
+ getCookie,
1220
+ getElement,
1221
+ getFocusableElements,
1222
+ getNodeType,
1223
+ getParentElement,
1224
+ getSelfIndex,
1225
+ getSiblingElements,
1226
+ getUnit,
1227
+ hasAccessibleName,
1228
+ imagesLoaded,
1229
+ inconsistentButtonFix,
1230
+ intersectionObserver,
1231
+ isAncestor,
1232
+ isArrowKey,
1233
+ isEscapeKey,
1234
+ isInvalidAriaPopup,
1235
+ isShiftTab,
1236
+ isTab,
1237
+ isTabKey,
1238
+ lh,
1239
+ localStore,
1240
+ manageFocus,
1241
+ markActiveAnchorIn,
1242
+ masonry,
1243
+ mediaLoaded,
1244
+ mutationObserver,
1245
+ preferHorizontalScroll,
1246
+ preventSpam,
1247
+ queryParams,
1248
+ randomString,
1249
+ rem,
1250
+ removeListeners,
1251
+ resizeObserver,
1252
+ rlh,
1253
+ sanitize,
1254
+ scrollObserver,
1255
+ scrollToElement,
1256
+ sessionStore,
1257
+ setCSSValue,
1258
+ setCSSVar,
1259
+ sha256Hash,
1260
+ sticky,
1261
+ toPx,
1262
+ trapFocus,
1263
+ traverseAndScramble,
1264
+ updateEvent,
1265
+ uuid,
1266
+ videosLoaded
1267
+ });