tiny-essentials 1.28.0 → 1.28.2

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 (323) hide show
  1. package/changelog/1/28/1.md +23 -0
  2. package/changelog/1/28/2.md +43 -0
  3. package/dist/_/numbers.d.mts +91 -16
  4. package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
  5. package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
  6. package/dist/v1/TinyAnalogClock.min.js +1 -1
  7. package/dist/v1/TinyBasicsEs.min.js +1 -1
  8. package/dist/v1/TinyDayNightCycle.min.js +1 -1
  9. package/dist/v1/TinyDragDropDetector.min.js +1 -1
  10. package/dist/v1/TinyDragger.min.js +1 -1
  11. package/dist/v1/TinyElementObserver.min.js +1 -1
  12. package/dist/v1/TinyEssentials.min.js +1 -1
  13. package/dist/v1/TinyGamepad.min.js +1 -1
  14. package/dist/v1/TinyHtml.min.js +1 -1
  15. package/dist/v1/TinyI18.min.js +1 -1
  16. package/dist/v1/TinyIframeEvents.min.js +1 -1
  17. package/dist/v1/TinyLocalStorage.min.js +1 -1
  18. package/dist/v1/TinyMediaPlayer.min.js +1 -1
  19. package/dist/v1/TinyNewWinEvents.min.js +1 -1
  20. package/dist/v1/TinyNotifyCenter.min.js +1 -1
  21. package/dist/v1/TinyRadioFm.min.js +1 -1
  22. package/dist/v1/TinyRateLimiter.min.js +1 -1
  23. package/dist/v1/TinySmartScroller.min.js +1 -1
  24. package/dist/v1/TinyTextDiffer.min.js +1 -1
  25. package/dist/v1/TinyTextarea.min.js +1 -1
  26. package/dist/v1/TinyTimeout.min.js +1 -1
  27. package/dist/v1/TinyToastNotify.min.js +1 -1
  28. package/dist/v1/TinyUploadClicker.min.js +1 -1
  29. package/dist/v1/UltraRandomMsgGen.min.js +1 -1
  30. package/dist/v1/basics/array.cjs +57 -9
  31. package/dist/v1/basics/array.d.mts +28 -12
  32. package/dist/v1/basics/array.mjs +51 -9
  33. package/dist/v1/basics/clock.cjs +94 -42
  34. package/dist/v1/basics/clock.d.mts +22 -22
  35. package/dist/v1/basics/clock.mjs +91 -54
  36. package/dist/v1/basics/collision.d.mts +245 -104
  37. package/dist/v1/basics/deprecated/html.cjs +246 -0
  38. package/dist/v1/basics/deprecated/html.d.mts +63 -0
  39. package/dist/v1/basics/deprecated/html.mjs +190 -0
  40. package/dist/v1/basics/extendObjType/Buffer.d.mts +1 -1
  41. package/dist/v1/basics/fullScreen.d.mts +47 -7
  42. package/dist/v1/basics/html.cjs +149 -130
  43. package/dist/v1/basics/html.d.mts +69 -113
  44. package/dist/v1/basics/html.mjs +113 -105
  45. package/dist/v1/basics/index.cjs +2 -0
  46. package/dist/v1/basics/index.d.mts +11 -65
  47. package/dist/v1/basics/index.mjs +3 -3
  48. package/dist/v1/basics/mediaContent.cjs +116 -32
  49. package/dist/v1/basics/mediaContent.d.mts +143 -159
  50. package/dist/v1/basics/mediaContent.mjs +105 -33
  51. package/dist/v1/basics/objChecker.cjs +7 -5
  52. package/dist/v1/basics/objChecker.d.mts +5 -4
  53. package/dist/v1/basics/objChecker.mjs +6 -6
  54. package/dist/v1/basics/objFilter.cjs +71 -14
  55. package/dist/v1/basics/objFilter.d.mts +16 -19
  56. package/dist/v1/basics/objFilter.mjs +63 -14
  57. package/dist/v1/basics/simpleMath.cjs +81 -25
  58. package/dist/v1/basics/simpleMath.d.mts +22 -22
  59. package/dist/v1/basics/simpleMath.mjs +70 -27
  60. package/dist/v1/basics/text.cjs +76 -31
  61. package/dist/v1/basics/text.d.mts +64 -14
  62. package/dist/v1/basics/text.mjs +62 -31
  63. package/dist/v1/build/ColorSafeStringify.d.mts +1 -1
  64. package/dist/v1/build/TinyAdvancedRaffle.d.mts +1 -1
  65. package/dist/v1/build/TinyAfterScrollWatcher.d.mts +1 -1
  66. package/dist/v1/build/TinyAnalogClock.d.mts +1 -1
  67. package/dist/v1/build/TinyArrayComparator.d.mts +1 -1
  68. package/dist/v1/build/TinyArrayPaginator.d.mts +1 -1
  69. package/dist/v1/build/TinyClassManager.d.mts +1 -1
  70. package/dist/v1/build/TinyClipboard.d.mts +1 -1
  71. package/dist/v1/build/TinyColorConverter.d.mts +1 -1
  72. package/dist/v1/build/TinyColorValidator.d.mts +1 -1
  73. package/dist/v1/build/TinyCookieConsent.d.mts +1 -1
  74. package/dist/v1/build/TinyDayNightCycle.d.mts +1 -1
  75. package/dist/v1/build/TinyDomReadyManager.d.mts +1 -1
  76. package/dist/v1/build/TinyDragDropDetector.d.mts +1 -1
  77. package/dist/v1/build/TinyDragger.d.mts +1 -1
  78. package/dist/v1/build/TinyElementObserver.d.mts +1 -1
  79. package/dist/v1/build/TinyGamepad.d.mts +1 -1
  80. package/dist/v1/build/TinyHtml.d.mts +1 -1
  81. package/dist/v1/build/TinyI18.d.mts +1 -1
  82. package/dist/v1/build/TinyIframeEvents.d.mts +1 -1
  83. package/dist/v1/build/TinyInventory.d.mts +1 -1
  84. package/dist/v1/build/TinyInventoryTrader.d.mts +1 -1
  85. package/dist/v1/build/TinyLevelUp.d.mts +1 -1
  86. package/dist/v1/build/TinyLoadingScreen.d.mts +1 -1
  87. package/dist/v1/build/TinyLocalStorage.d.mts +1 -1
  88. package/dist/v1/build/TinyMediaPlayer.d.mts +1 -1
  89. package/dist/v1/build/TinyNeedBar.d.mts +1 -1
  90. package/dist/v1/build/TinyNewWinEvents.d.mts +1 -1
  91. package/dist/v1/build/TinyNotifications.d.mts +1 -1
  92. package/dist/v1/build/TinyNotifyCenter.d.mts +1 -1
  93. package/dist/v1/build/TinyPromiseQueue.d.mts +1 -1
  94. package/dist/v1/build/TinyRadioFm.d.mts +1 -1
  95. package/dist/v1/build/TinyRateLimiter.d.mts +1 -1
  96. package/dist/v1/build/TinySimpleDice.d.mts +1 -1
  97. package/dist/v1/build/TinySmartScroller.d.mts +1 -1
  98. package/dist/v1/build/TinyTextDiffer.d.mts +1 -1
  99. package/dist/v1/build/TinyTextRangeEditor.d.mts +1 -1
  100. package/dist/v1/build/TinyTextarea.d.mts +1 -1
  101. package/dist/v1/build/TinyTimeout.d.mts +1 -1
  102. package/dist/v1/build/TinyToastNotify.d.mts +1 -1
  103. package/dist/v1/build/TinyUploadClicker.d.mts +1 -1
  104. package/dist/v1/build/UltraRandomMsgGen.d.mts +1 -1
  105. package/dist/v1/fileManager/asyncFuncs.d.mts +13 -13
  106. package/dist/v1/fileManager/index.d.mts +3 -29
  107. package/dist/v1/fileManager/normalFuncs.d.mts +22 -22
  108. package/dist/v1/index.cjs +4 -0
  109. package/dist/v1/index.d.mts +54 -137
  110. package/dist/v1/index.mjs +4 -3
  111. package/dist/v1/libs/ColorSafeStringify.d.mts +3 -12
  112. package/dist/v1/libs/TinyAdvancedRaffle.cjs +64 -50
  113. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +64 -116
  114. package/dist/v1/libs/TinyAdvancedRaffle.mjs +62 -49
  115. package/dist/v1/libs/TinyAfterScrollWatcher.cjs +17 -1
  116. package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +15 -19
  117. package/dist/v1/libs/TinyAfterScrollWatcher.mjs +15 -1
  118. package/dist/v1/libs/TinyAnalogClock.cjs +60 -0
  119. package/dist/v1/libs/TinyAnalogClock.d.mts +12 -9
  120. package/dist/v1/libs/TinyAnalogClock.mjs +57 -0
  121. package/dist/v1/libs/TinyArrayComparator.d.mts +14 -20
  122. package/dist/v1/libs/TinyArrayPaginator.d.mts +22 -26
  123. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +8 -8
  124. package/dist/v1/libs/TinyClassManager.cjs +5 -7
  125. package/dist/v1/libs/TinyClassManager.d.mts +16 -16
  126. package/dist/v1/libs/TinyClassManager.mjs +5 -6
  127. package/dist/v1/libs/TinyClipboard.cjs +2 -0
  128. package/dist/v1/libs/TinyClipboard.d.mts +12 -5
  129. package/dist/v1/libs/TinyClipboard.mjs +2 -0
  130. package/dist/v1/libs/TinyColorConverter.cjs +1 -0
  131. package/dist/v1/libs/TinyColorConverter.d.mts +10 -32
  132. package/dist/v1/libs/TinyColorConverter.mjs +1 -0
  133. package/dist/v1/libs/TinyColorValidator.d.mts +145 -184
  134. package/dist/v1/libs/TinyCookieConsent.d.mts +17 -17
  135. package/dist/v1/libs/TinyDayNightCycle.cjs +67 -42
  136. package/dist/v1/libs/TinyDayNightCycle.d.mts +87 -117
  137. package/dist/v1/libs/TinyDayNightCycle.mjs +65 -41
  138. package/dist/v1/libs/TinyDomReadyManager.d.mts +8 -16
  139. package/dist/v1/libs/TinyDragDropDetector.cjs +25 -0
  140. package/dist/v1/libs/TinyDragDropDetector.d.mts +32 -26
  141. package/dist/v1/libs/TinyDragDropDetector.mjs +22 -0
  142. package/dist/v1/libs/TinyDragger.cjs +46 -19
  143. package/dist/v1/libs/TinyDragger.d.mts +82 -81
  144. package/dist/v1/libs/TinyDragger.mjs +45 -18
  145. package/dist/v1/libs/TinyElementObserver.cjs +39 -0
  146. package/dist/v1/libs/TinyElementObserver.d.mts +28 -25
  147. package/dist/v1/libs/TinyElementObserver.mjs +36 -0
  148. package/dist/v1/libs/TinyGamepad.cjs +131 -2
  149. package/dist/v1/libs/TinyGamepad.d.mts +50 -122
  150. package/dist/v1/libs/TinyGamepad.mjs +129 -2
  151. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.cjs +2 -25
  152. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.d.mts +19 -25
  153. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.mjs +3 -27
  154. package/dist/v1/libs/TinyHtml/TinyHtmlButton.cjs +2 -1
  155. package/dist/v1/libs/TinyHtml/TinyHtmlButton.d.mts +55 -55
  156. package/dist/v1/libs/TinyHtml/TinyHtmlButton.mjs +2 -1
  157. package/dist/v1/libs/TinyHtml/TinyHtmlCanvas.d.mts +6 -6
  158. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.cjs +8 -4
  159. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.d.mts +19 -21
  160. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.mjs +7 -4
  161. package/dist/v1/libs/TinyHtml/TinyHtmlEmbed.d.mts +8 -8
  162. package/dist/v1/libs/TinyHtml/TinyHtmlForm.d.mts +18 -18
  163. package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +5 -6
  164. package/dist/v1/libs/TinyHtml/TinyHtmlIframe.d.mts +19 -19
  165. package/dist/v1/libs/TinyHtml/TinyHtmlImage.cjs +0 -28
  166. package/dist/v1/libs/TinyHtml/TinyHtmlImage.d.mts +22 -28
  167. package/dist/v1/libs/TinyHtml/TinyHtmlImage.mjs +1 -27
  168. package/dist/v1/libs/TinyHtml/TinyHtmlInput.d.mts +11 -11
  169. package/dist/v1/libs/TinyHtml/TinyHtmlLink.d.mts +23 -23
  170. package/dist/v1/libs/TinyHtml/TinyHtmlMedia.d.mts +26 -26
  171. package/dist/v1/libs/TinyHtml/TinyHtmlScript.cjs +4 -30
  172. package/dist/v1/libs/TinyHtml/TinyHtmlScript.d.mts +20 -26
  173. package/dist/v1/libs/TinyHtml/TinyHtmlScript.mjs +5 -32
  174. package/dist/v1/libs/TinyHtml/TinyHtmlSelect.d.mts +19 -19
  175. package/dist/v1/libs/TinyHtml/TinyHtmlStyle.d.mts +8 -8
  176. package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +26 -28
  177. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.cjs +14 -15
  178. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +32 -32
  179. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.mjs +15 -15
  180. package/dist/v1/libs/TinyHtml/index.d.mts +102 -45
  181. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.cjs +11 -9
  182. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.d.mts +21 -21
  183. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.mjs +11 -9
  184. package/dist/v1/libs/TinyHtml/input/TinyHtmlFileInput.d.mts +11 -11
  185. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.cjs +4 -4
  186. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.d.mts +17 -13
  187. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.mjs +4 -4
  188. package/dist/v1/libs/TinyHtml/input/TinyHtmlImageInput.d.mts +21 -21
  189. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.cjs +5 -4
  190. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.d.mts +14 -14
  191. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.mjs +5 -4
  192. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.cjs +4 -3
  193. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.d.mts +10 -10
  194. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.mjs +4 -3
  195. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.cjs +4 -3
  196. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.d.mts +19 -19
  197. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.mjs +4 -3
  198. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.cjs +5 -4
  199. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.d.mts +11 -11
  200. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.mjs +5 -4
  201. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.cjs +4 -3
  202. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.d.mts +15 -11
  203. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.mjs +4 -3
  204. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.cjs +49 -21
  205. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.d.mts +34 -20
  206. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.mjs +45 -20
  207. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.cjs +1 -1
  208. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.d.mts +14 -14
  209. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.mjs +1 -1
  210. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.cjs +1 -1
  211. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.d.mts +14 -14
  212. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.mjs +1 -1
  213. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.cjs +48 -25
  214. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.d.mts +27 -21
  215. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.mjs +40 -27
  216. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.cjs +1 -1
  217. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.d.mts +14 -14
  218. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.mjs +1 -1
  219. package/dist/v1/libs/TinyHtml/input/number/TinyHtmlNumberInput.d.mts +14 -14
  220. package/dist/v1/libs/TinyHtml/input/number/TinyHtmlRangeInput.d.mts +14 -14
  221. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlEmailInput.d.mts +25 -21
  222. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlPasswordInput.d.mts +18 -18
  223. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlSearchInput.d.mts +33 -29
  224. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTelInput.d.mts +22 -22
  225. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTextInput.d.mts +18 -18
  226. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlUrlInput.d.mts +31 -27
  227. package/dist/v1/libs/TinyHtml/media/TinyHtmlAudio.d.mts +35 -11
  228. package/dist/v1/libs/TinyHtml/media/TinyHtmlObject.d.mts +10 -10
  229. package/dist/v1/libs/TinyHtml/media/TinyHtmlSource.d.mts +12 -12
  230. package/dist/v1/libs/TinyHtml/media/TinyHtmlVideo.d.mts +35 -27
  231. package/dist/v1/libs/TinyHtml.cjs +4 -5
  232. package/dist/v1/libs/TinyHtml.d.mts +1503 -1731
  233. package/dist/v1/libs/TinyHtml.mjs +5 -6
  234. package/dist/v1/libs/TinyI18.cjs +61 -0
  235. package/dist/v1/libs/TinyI18.d.mts +34 -58
  236. package/dist/v1/libs/TinyI18.mjs +55 -0
  237. package/dist/v1/libs/TinyIframeEvents.cjs +19 -2
  238. package/dist/v1/libs/TinyIframeEvents.d.mts +29 -38
  239. package/dist/v1/libs/TinyIframeEvents.mjs +19 -2
  240. package/dist/v1/libs/TinyInventory.d.mts +78 -141
  241. package/dist/v1/libs/TinyInventoryTrader.d.mts +19 -22
  242. package/dist/v1/libs/TinyLevelUp.d.mts +10 -13
  243. package/dist/v1/libs/TinyLoadingScreen.d.mts +21 -31
  244. package/dist/v1/libs/TinyLocalStorage.cjs +48 -0
  245. package/dist/v1/libs/TinyLocalStorage.d.mts +11 -30
  246. package/dist/v1/libs/TinyLocalStorage.mjs +45 -0
  247. package/dist/v1/libs/TinyMamdaniInferenceSystem.d.mts +37 -23
  248. package/dist/v1/libs/TinyMediaPlayer.cjs +77 -3
  249. package/dist/v1/libs/TinyMediaPlayer.d.mts +109 -106
  250. package/dist/v1/libs/TinyMediaPlayer.mjs +71 -3
  251. package/dist/v1/libs/TinyNeedBar.d.mts +25 -37
  252. package/dist/v1/libs/TinyNewWinEvents.cjs +29 -0
  253. package/dist/v1/libs/TinyNewWinEvents.d.mts +32 -29
  254. package/dist/v1/libs/TinyNewWinEvents.mjs +26 -0
  255. package/dist/v1/libs/TinyNotifications.d.mts +6 -6
  256. package/dist/v1/libs/TinyNotifyCenter.cjs +36 -0
  257. package/dist/v1/libs/TinyNotifyCenter.d.mts +15 -15
  258. package/dist/v1/libs/TinyNotifyCenter.mjs +32 -0
  259. package/dist/v1/libs/TinyPromiseQueue.d.mts +11 -11
  260. package/dist/v1/libs/TinyRadioFm.cjs +70 -12
  261. package/dist/v1/libs/TinyRadioFm.d.mts +45 -80
  262. package/dist/v1/libs/TinyRadioFm.mjs +64 -12
  263. package/dist/v1/libs/TinyRateLimiter.cjs +52 -0
  264. package/dist/v1/libs/TinyRateLimiter.d.mts +29 -36
  265. package/dist/v1/libs/TinyRateLimiter.mjs +48 -0
  266. package/dist/v1/libs/TinySimpleDice.d.mts +17 -36
  267. package/dist/v1/libs/TinySmartScroller.cjs +52 -3
  268. package/dist/v1/libs/TinySmartScroller.d.mts +62 -70
  269. package/dist/v1/libs/TinySmartScroller.mjs +51 -5
  270. package/dist/v1/libs/TinyTextDiffer.cjs +19 -18
  271. package/dist/v1/libs/TinyTextDiffer.d.mts +11 -13
  272. package/dist/v1/libs/TinyTextDiffer.mjs +16 -17
  273. package/dist/v1/libs/TinyTextRangeEditor.d.mts +8 -8
  274. package/dist/v1/libs/TinyTextarea.cjs +19 -0
  275. package/dist/v1/libs/TinyTextarea.d.mts +34 -28
  276. package/dist/v1/libs/TinyTextarea.mjs +17 -0
  277. package/dist/v1/libs/TinyTimeout.cjs +11 -1
  278. package/dist/v1/libs/TinyTimeout.d.mts +14 -14
  279. package/dist/v1/libs/TinyTimeout.mjs +9 -1
  280. package/dist/v1/libs/TinyToastNotify.cjs +36 -1
  281. package/dist/v1/libs/TinyToastNotify.d.mts +15 -17
  282. package/dist/v1/libs/TinyToastNotify.mjs +32 -1
  283. package/dist/v1/libs/TinyUploadClicker.cjs +19 -0
  284. package/dist/v1/libs/TinyUploadClicker.d.mts +38 -8
  285. package/dist/v1/libs/TinyUploadClicker.mjs +17 -0
  286. package/dist/v1/libs/UltraRandomMsgGen.cjs +148 -35
  287. package/dist/v1/libs/UltraRandomMsgGen.d.mts +52 -78
  288. package/dist/v1/libs/UltraRandomMsgGen.mjs +133 -34
  289. package/dist/v1/libs/utils.cjs +21 -0
  290. package/dist/v1/libs/utils.d.mts +6 -0
  291. package/dist/v1/libs/utils.mjs +16 -0
  292. package/docs/v1/README.md +1 -0
  293. package/docs/v1/basics/array.md +2 -2
  294. package/docs/v1/basics/deprecated/html.md +17 -0
  295. package/docs/v1/basics/fullScreen.md +1 -1
  296. package/docs/v1/basics/html.md +12 -26
  297. package/docs/v1/basics/mediaContent.md +1 -1
  298. package/docs/v1/basics/objChecker.md +1 -1
  299. package/docs/v1/basics/text.md +2 -2
  300. package/docs/v1/fileManager/main.md +1 -1
  301. package/docs/v1/libs/ColorSafeStringify.md +1 -1
  302. package/docs/v1/libs/TinyAfterScrollWatcher.md +1 -1
  303. package/docs/v1/libs/TinyAnalogClock.md +1 -1
  304. package/docs/v1/libs/TinyArrayComparator.md +1 -1
  305. package/docs/v1/libs/TinyArrayPaginator.md +1 -1
  306. package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +2 -2
  307. package/docs/v1/libs/TinyClassManager.md +1 -1
  308. package/docs/v1/libs/TinyClipboard.md +1 -1
  309. package/docs/v1/libs/TinyCookieConsent.md +1 -1
  310. package/docs/v1/libs/TinyDomReadyManager.md +1 -1
  311. package/docs/v1/libs/TinyDragDropDetector.md +1 -1
  312. package/docs/v1/libs/TinyDragger.md +1 -1
  313. package/docs/v1/libs/TinyElementObserver.md +1 -1
  314. package/docs/v1/libs/TinyHtml.md +1 -1
  315. package/docs/v1/libs/TinyIframeEvents.md +2 -2
  316. package/docs/v1/libs/TinyLevelUp.md +1 -1
  317. package/docs/v1/libs/TinyLoadingScreen.md +1 -1
  318. package/docs/v1/libs/TinyNewWinEvents.md +2 -2
  319. package/docs/v1/libs/TinyNotifications.md +1 -1
  320. package/docs/v1/libs/TinyPromiseQueue.md +2 -2
  321. package/docs/v1/libs/TinyTextDiffer.md +1 -1
  322. package/docs/v1/libs/TinyTextarea.md +1 -1
  323. package/package.json +11 -2
@@ -0,0 +1,23 @@
1
+ ## 🚀 New Features
2
+ * **Destroy Detectors:** Added destroy detectors for the following modules:
3
+ * `TinyTextDiffer`, `TinySmartScroller`, `TinyRadioFm`, `TinyMediaPlayer`, `TinyDragger`, `TinyAfterScrollWatcher`, `UltraRandomMsgGen`, `TinyUploadClicker`, `TinyToastNotify`, `TinyTimeout`, `TinyTextarea`, `TinyRateLimiter`, `TinyNotifyCenter`, `TinyNewWinEvents`, `TinyLocalStorage`, `TinyIframeEvents`, `TinyI18`, `TinyGamepad`, `TinyElementObserver`, `TinyDragDropDetector`, `TinyDayNightCycle`, `TinyAnalogClock`, and `TinyAdvancedRaffle`.
4
+ * **UltraRandomMsgGen:** Expanded with new values.
5
+ * **jsDoc Enhancements:** Added support for template types in jsDoc (e.g., `<string>`) for the following functions:
6
+ * `multiplyArrayBlocks`
7
+ * `diffArrayList`
8
+ * `diffStrings`
9
+
10
+ ## 🛠️ Improvements
11
+ * **Enhanced Validation:**
12
+ * Improved argument validation across all JavaScript files in the `/basics` directory (Note: `fullScreen.mjs` and `collision.mjs` were excluded from this update).
13
+ * `countObj` now throws an error if the provided argument is not an `Array` or an `Object`.
14
+ * **Array Sorting:** `arraySortPositions` now accepts `null` values, enabling direct comparison of elements within the array (optimized for arrays of numbers or strings).
15
+ * **Fetch API Refactor:** In `/basics/html`, the functions `fetchJson`, `fetchText`, and `fetchBlob` have been refactored to use the native Fetch API directly.
16
+
17
+ ## 🐛 Bug Fixes
18
+ * **jsDoc Corrections:** Fixed private jsDoc annotations for:
19
+ * `TinyAdvancedRaffle`, `TinyAfterScrollWatcher`, `TinyClipboard`, `TinyColorConverter`, `TinyDayNightCycle`, and `TinySmartScroller`.
20
+
21
+ ## ⚠️ Breaking Changes & Deprecations
22
+ * **Renaming:** `diffStrings` has been renamed to `diffObjList`.
23
+ * **Deprecation:** The legacy versions of `fetchJson`, `fetchText`, and `fetchBlob` have been moved to `/basics/deprecated/html`. Please update your imports to the new implementations in `/basics/html`.
@@ -0,0 +1,43 @@
1
+ ## 🚀 Features
2
+
3
+ ### `src/v1/libs/TinyRadioFm.mjs`
4
+ * **Enhanced Data Handling:** Added support for direct URL export and import. Previously, the module only supported `BLOB` and `Base64` formats.
5
+
6
+ ## 📝 Documentation
7
+
8
+ ### `src/v1/basics/mediaContent.mjs`
9
+ * **jsDoc Updates:** Updated jsDocs to reflect new template formats.
10
+ * ⚠️ **Note for Developers:** If you are consuming these resources directly in your own implementation, we recommend verifying that your local jsDocs are correctly validated against these changes.
11
+
12
+ ### `src/v1/libs/TinyMediaPlayer.mjs`
13
+ * **jsDoc Alignment:** Adapted jsDocs to align with the new structure implemented in `mediaContent.mjs`.
14
+
15
+ ## 🛠️ Maintenance & Refactoring
16
+
17
+ ### TypeScript Compliance
18
+ The following files have had their jsDocs updated and corrected to ensure full compliance with the latest TypeScript rules:
19
+
20
+ * `src/v1/basics/clock.mjs`
21
+ * `src/v1/basics/objFilter.mjs`
22
+ * `src/v1/libs/TinyClassManager.mjs`
23
+ * `src/v1/libs/TinyGamepad.mjs`
24
+ * `src/v1/libs/TinyHtml.mjs`
25
+ * `src/v1/libs/TinyIframeEvents.mjs`
26
+
27
+ ### TinyHtml Sub-module Updates
28
+ The following `TinyHtml` sub-modules were updated to maintain strict adherence to TypeScript standards:
29
+
30
+ * `src/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.mjs`
31
+ * `src/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.mjs`
32
+ * `src/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.mjs`
33
+ * `src/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.mjs`
34
+ * `src/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.mjs`
35
+ * `src/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.mjs`
36
+ * `src/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.mjs`
37
+ * `src/v1/libs/TinyHtml/input/TinyHtmlColorInput.mjs`
38
+ * `src/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.mjs`
39
+ * `src/v1/libs/TinyHtml/TinyHtmlAnchor.mjs`
40
+ * `src/v1/libs/TinyHtml/TinyHtmlDatalist.mjs`
41
+ * `src/v1/libs/TinyHtml/TinyHtmlImage.mjs`
42
+ * `src/v1/libs/TinyHtml/TinyHtmlScript.mjs`
43
+ * `src/v1/libs/TinyHtml/TinyHtmlTextarea.mjs`
@@ -5,20 +5,95 @@
5
5
  * @param {number} n - Any non-zero number.
6
6
  * @returns {number} The constant value 3.
7
7
  */
8
- export function getTripleRatio(n: number): number;
9
- export function tripleSumOverSelf(n: number): number;
10
- export function fiveTimesOverSelf(n: number): number;
11
- export function mixedMultipliersToThree(n: number): number;
12
- export function squareOverSelf(n: number): number;
13
- export function complexToThree(n: number): number;
14
- export function weightedAverageToThree(n: number): number;
15
- export function nestedMultiplicationToThree(n: number): number;
16
- export function repeatedDivisionSum(n: number): number;
17
- export function cubicOverSquare(n: number): number;
18
- export function multipleModSelf(n: number): number;
19
- export function divideByOne(n: number): number;
20
- export function absRatio(n: number): number;
21
- export function minClampToThree(n: number): number;
22
- export function balancedReductionToOne(n: number): number;
23
- export function alternateSumToThree(n: number): number;
8
+ export declare function getTripleRatio(n: number): number;
9
+ /**
10
+ * Sums the number 3 times and divides by itself.
11
+ * @param {number} n
12
+ * @returns {number} Always 3
13
+ */
14
+ export declare const tripleSumOverSelf: (n: number) => number;
15
+ /**
16
+ * Multiplies the number by 5 and divides by itself.
17
+ * @param {number} n
18
+ * @returns {number} Always 5
19
+ */
20
+ export declare const fiveTimesOverSelf: (n: number) => number;
21
+ /**
22
+ * Performs linear operations that simplify to 3n/n.
23
+ * @param {number} n
24
+ * @returns {number} Always 3
25
+ */
26
+ export declare const mixedMultipliersToThree: (n: number) => number;
27
+ /**
28
+ * Squares the number and divides by itself.
29
+ * @param {number} n
30
+ * @returns {number} Same as input n
31
+ */
32
+ export declare const squareOverSelf: (n: number) => number;
33
+ /**
34
+ * A long expression that simplifies to 3n / n.
35
+ * @param {number} n
36
+ * @returns {number} Always 3
37
+ */
38
+ export declare const complexToThree: (n: number) => number;
39
+ /**
40
+ * Sums weighted values and divides by sum of weights.
41
+ * @param {number} n
42
+ * @returns {number} Always 3
43
+ */
44
+ export declare const weightedAverageToThree: (n: number) => number;
45
+ /**
46
+ * Simplifies to 3 regardless of n.
47
+ * @param {number} n
48
+ * @returns {number} Always 3
49
+ */
50
+ export declare const nestedMultiplicationToThree: (n: number) => number;
51
+ /**
52
+ * Adds three self-divisions.
53
+ * @param {number} n
54
+ * @returns {number} Always 3
55
+ */
56
+ export declare const repeatedDivisionSum: (n: number) => number;
57
+ /**
58
+ * Simplifies exponential division.
59
+ * @param {number} n
60
+ * @returns {number} Same as input n
61
+ */
62
+ export declare const cubicOverSquare: (n: number) => number;
63
+ /**
64
+ * Multiplies and then uses modulus.
65
+ * @param {number} n
66
+ * @returns {number} Always 0
67
+ */
68
+ export declare const multipleModSelf: (n: number) => number;
69
+ /**
70
+ * Expression that simplifies and divides by 1.
71
+ * @param {number} n
72
+ * @returns {number} Always 3
73
+ */
74
+ export declare const divideByOne: (n: number) => number;
75
+ /**
76
+ * Absolute value divided by itself.
77
+ * @param {number} n
78
+ * @returns {number} 1 if n > 0, -1 if n < 0, NaN if n = 0
79
+ */
80
+ export declare const absRatio: (n: number) => number;
81
+ /**
82
+ * Returns minimum between fixed set and input.
83
+ * @param {number} n
84
+ * @returns {number} Always 3 if n ≥ 3
85
+ */
86
+ export declare const minClampToThree: (n: number) => number;
87
+ /**
88
+ * Complex sum that simplifies to 1.
89
+ * @param {number} n
90
+ * @returns {number} Always 1
91
+ */
92
+ export declare const balancedReductionToOne: (n: number) => number;
93
+ /**
94
+ * Weighted sum of multipliers simplifying to 3.
95
+ * @param {number} n
96
+ * @returns {number} Always 3
97
+ */
98
+ export declare const alternateSumToThree: (n: number) => number;
24
99
  //# sourceMappingURL=numbers.d.mts.map
@@ -1 +1 @@
1
- (()=>{"use strict";var e={7(e){var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise(function(r,i){function o(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}d(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&d(e,"error",t,{once:!0})}(e,o)})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var n=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function f(e,t,r,i){var o,s,n,f;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),n=s[t]),void 0===n)n=s[t]=r,++e._eventsCount;else if("function"==typeof n?n=s[t]=i?[r,n]:[n,r]:i?n.unshift(r):n.push(r),(o=u(e))>0&&n.length>o&&!n.warned){n.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+n.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=n.length,f=h,console&&console.warn&&console.warn(f)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=h.bind(i);return o.listener=r,i.wrapFn=o,o}function c(e,t,r){var i=e._events;if(void 0===i)return[];var o=i[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):y(o,o.length)}function m(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function d(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function o(s){i.once&&e.removeEventListener(t,o),r(s)})}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return n},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");n=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,s=this._events;if(void 0!==s)o=o&&void 0===s.error;else if(!o)return!1;if(o){var n;if(t.length>0&&(n=t[0]),n instanceof Error)throw n;var a=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw a.context=n,a}var u=s[e];if(void 0===u)return!1;if("function"==typeof u)i(u,this,t);else{var f=u.length,h=y(u,f);for(r=0;r<f;++r)i(h[r],this,t)}return!0},s.prototype.addListener=function(e,t){return f(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return f(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,o,s,n;if(a(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){n=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,n||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(o=s[i])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return c(this,e,!0)},s.prototype.rawListeners=function(e){return c(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}}};const t={};function r(i){const o=t[i];if(void 0!==o)return o.exports;const s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}r.d=(e,t)=>{if(Array.isArray(t))for(var i=0;i<t.length;){var o=t[i++],s=t[i++];r.o(e,o)?0===s&&i++:0===s?Object.defineProperty(e,o,{enumerable:!0,value:t[i++]}):Object.defineProperty(e,o,{enumerable:!0,get:s})}else for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let i={};r.d(i,{TinyAdvancedRaffle:()=>n});var o=r(7);class s extends o.EventEmitter{#e=!1;#t;#r;#i=[];#o=[];#s=[];#n=new Map;#a=new Set;#u=new Map;#f;#h=new Map;#p=new Map;get isDestroyed(){return this.#e}get freq(){return Object.fromEntries(this.#p)}get size(){return this.#h.size}get normalization(){return this.#t}set normalization(e){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("normalization must be a non-empty string (e.g., 'relative', 'softmax').");this.#t=e}get seed(){return this.#r}set seed(e){if(this._checkDestroyed(),null!==e&&("number"!=typeof e||!Number.isFinite(e)))throw new TypeError("seed must be a finite number or null.");this.#r=e,null!==e&&(this.#f=this._makeSeededRng(e))}get globalModifiers(){return[...this.#i]}set globalModifiers(e){if(this._checkDestroyed(),!Array.isArray(e)||!e.every(e=>"function"==typeof e))throw new TypeError("globalModifiers must be an array of functions (WeightsCallback).");this.#i=e}get temporaryModifiers(){return[...this.#o]}set temporaryModifiers(e){if(this._checkDestroyed(),!Array.isArray(e)||!e.every(e=>e&&"function"==typeof e.fn&&Number.isInteger(e.uses)&&e.uses>0))throw new TypeError("temporaryModifiers must be an array of objects { fn: function, uses: positive integer }.");this.#o=e}get conditionalRules(){return[...this.#s]}set conditionalRules(e){if(this._checkDestroyed(),!Array.isArray(e)||!e.every(e=>"function"==typeof e))throw new TypeError("conditionalRules must be an array of functions (WeightsCallback).");this.#s=e}get pitySystems(){return Object.fromEntries(this.#n)}set pitySystems(e){if(this._checkDestroyed(),!(e instanceof Map&&[...e.values()].every(e=>e&&"number"==typeof e.threshold&&"number"==typeof e.increment&&"number"==typeof e.cap&&"number"==typeof e.counter&&"number"==typeof e.currentAdd)))throw new TypeError("pitySystems must be a Map<string, Pity> with all numeric fields.");this.#n=e}get exclusions(){return Array.from(this.#a)}set exclusions(e){if(this._checkDestroyed(),!(e instanceof Set&&[...e].every(e=>"string"==typeof e)))throw new TypeError("exclusions must be a Set<string>.");this.#a=e}get groups(){const e={};return this.#u.forEach((t,r)=>e[r]=Array.from(t)),e}set groups(e){if(this._checkDestroyed(),!(e instanceof Map&&[...e.values()].every(e=>e instanceof Set&&[...e].every(e=>"string"==typeof e))))throw new TypeError("groups must be a Map<string, Set<string>>.");this.#u=e}get rng(){return this.#f}set rng(e){if(this._checkDestroyed(),"function"!=typeof e||"number"!=typeof e())throw new TypeError("rng must be a function returning a number (RngGenerator).");this.#f=e}get items(){const e={};return this.#h.forEach((t,r)=>{e[r]={...t,groups:Array.from(t.groups)}}),e}set items(e){if(this._checkDestroyed(),!(e instanceof Map&&[...e.values()].every(e=>e&&"string"==typeof e.id&&"string"==typeof e.label&&"number"==typeof e.baseWeight&&e.groups instanceof Set&&"boolean"==typeof e.locked&&"object"==typeof e.meta)))throw new TypeError("items must be a Map<string, ItemData> with valid item structures.");this.clearList(),this.#h=e}constructor(e={}){super();const{rng:t=null,seed:r=null,normalization:i="relative"}=e;this.#t=i,this.#r=r,"function"==typeof t?this.#f=t:null!==this.#r?this.#f=this._makeSeededRng(this.#r):this.#f=Math.random,this.#r=r??null}_checkDestroyed(){if(this.#e)throw new Error("This instance has been destroyed and can no longer be used.")}hasItem(e){if("string"!=typeof e)throw new TypeError("itemId must be a string");return this.#h.has(e)}addItem(e,t={}){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");if("object"!=typeof t||null===t)throw new TypeError("opts must be an object");let{weight:r=1,label:i=e,meta:o={},groups:s=[]}=t;if("number"!=typeof r||!Number.isFinite(r)||r<0)throw new TypeError("weight must be a non-negative number");if("string"!=typeof i)throw new TypeError("label must be a string");if("object"!=typeof o||null===o)throw new TypeError("meta must be an object");if(!(Array.isArray(s)||s instanceof Set))throw new TypeError("groups must be an array or a Set of strings");s=Array.isArray(s)?s:[...s];for(const e of s)if("string"!=typeof e)throw new TypeError("groups must contain only strings");const n={id:e,label:i,baseWeight:Math.max(0,Number(r)||0),meta:{...o},groups:new Set(s),locked:!1};this.#h.set(e,n);for(const t of s)this._ensureGroup(t).add(e);return this.emit("itemAdded",n),n}removeItem(e){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");const t=this.#h.get(e);if(!t)return!1;for(const r of t.groups){const t=this.#u.get(r);t&&t.delete(e)}return this.#h.delete(e),this.emit("itemRemoved",e),this.resetFreq(e),this.resetPity(e),!0}setBaseWeight(e,t){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");if("number"!=typeof t||!Number.isFinite(t)||t<0)throw new TypeError("weight must be a non-negative number");const r=this.#h.get(e);if(!r)throw new Error("Item not found");r.baseWeight=Math.max(0,Number(t)||0),this.emit("weightChanged",{id:e,weight:r.baseWeight})}getItem(e){if("string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");return this.#h.get(e)??null}listItems(){return Array.from(this.#h.values()).map(e=>({...e}))}clearList(){this._checkDestroyed(),this.#h.clear(),this.clearFreqs(),this.clearPities()}hasGlobalModifier(e){if("function"!=typeof e)throw new TypeError("fn must be a function");return this.#i.includes(e)}addGlobalModifier(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("fn must be a function");this.#i.push(e)}removeGlobalModifier(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("fn must be a function");this.#i=this.#i.filter(t=>t!==e)}hasTemporaryModifier(e){if("function"!=typeof e)throw new TypeError("fn must be a function");return this.#o.some(t=>t.fn===e)}addTemporaryModifier(e,t=1){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("fn must be a function");if("number"!=typeof t||Number.isNaN(t))throw new TypeError("uses must be a number");this.#o.push({fn:e,uses:Math.max(1,Math.floor(t))})}removeTemporaryModifier(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("fn must be a function");const t=this.#o.length;return this.#o=this.#o.filter(t=>t.fn!==e),this.#o.length!==t}hasConditionalRule(e){if("function"!=typeof e)throw new TypeError("ruleFn must be a function");return this.#s.includes(e)}addConditionalRule(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("ruleFn must be a function");this.#s.push(e)}removeConditionalRule(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("ruleFn must be a function");const t=this.#s.length;return this.#s=this.#s.filter(t=>t!==e),this.#s.length!==t}hasPity(e){if("string"!=typeof e)throw new TypeError("itemId must be a string");return this.#n.has(e)}configurePity(e,t){if(this._checkDestroyed(),!this.#h.has(e))throw new Error("Item not found");if("object"!=typeof t||null===t)throw new TypeError("cfg must be an object");const{threshold:r,increment:i,cap:o=1/0}=t;if("number"!=typeof r||r<=0)throw new TypeError("threshold must be a positive number");if("number"!=typeof i)throw new TypeError("increment must be a number");if("number"!=typeof o)throw new TypeError("cap must be a number");this.#n.set(e,{threshold:Math.max(1,r),increment:Number(i)||0,cap:Number(o)||1/0,counter:0,currentAdd:0})}resetPity(e){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("itemId must be a non-empty string");const t=this.#n.get(e);t&&(t.counter=0,t.currentAdd=0)}clearPities(){this._checkDestroyed(),this.#n.clear()}hasExclusion(e){if("string"!=typeof e)throw new TypeError("itemId must be a string");return this.#a.has(e)}excludeItem(e){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("itemId must be a string");this.#a.add(e)}includeItem(e){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("itemId must be a string");this.#a.delete(e)}_ensureGroup(e){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("name must be a string");let t=this.#u.get(e);return t||(t=new Set,this.#u.set(e,t)),t}hasInGroup(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("itemId and groupName must be strings");const r=this.#u.get(t);return!!r&&r.has(e)}addToGroup(e,t){if(this._checkDestroyed(),"string"!=typeof e||"string"!=typeof t)throw new TypeError("itemId and groupName must be strings");const r=this.#h.get(e);if(!r)throw new Error("Item missing");r.groups.add(t),this._ensureGroup(t).add(e)}removeFromGroup(e,t){if(this._checkDestroyed(),"string"!=typeof e||"string"!=typeof t)throw new TypeError("itemId and groupName must be strings");const r=this.#u.get(t);r&&r.delete(e);const i=this.#h.get(e);i&&i.groups.delete(t)}clearFreqs(){this._checkDestroyed(),this.#p.clear()}resetFreq(e){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("itemId must be a string");this.#p.delete(e)}computeEffectiveWeights(e={}){if(this._checkDestroyed(),"object"!=typeof e||null===e)throw new TypeError("computeEffectiveWeights: parameter 'context' must be a non-null object, got "+typeof e);if("previousDraws"in e&&!Array.isArray(e.previousDraws))throw new TypeError("computeEffectiveWeights: context.previousDraws must be an array if provided, got "+typeof e.previousDraws);if("metadata"in e&&void 0!==e.metadata&&("object"!=typeof e.metadata||null===e.metadata))throw new TypeError("computeEffectiveWeights: context.metadata must be a non-null object if provided, got "+typeof e.metadata);const t=new Map;for(const[e,r]of this.#h)t.set(e,r.baseWeight);for(const r of this.#i){const i=r(t,e);if(i instanceof Map)for(const[e,r]of i)t.set(e,Math.max(0,(t.get(e)||0)+r))}for(const r of this.#o){const i=r.fn(t,e);if(i instanceof Map)for(const[e,r]of i)t.set(e,Math.max(0,(t.get(e)||0)+r))}for(const r of this.#s){const i=r(t,e);if(i instanceof Map)for(const[e,r]of i)t.set(e,Math.max(0,(t.get(e)||0)+r))}for(const[e,r]of this.#n)if(t.has(e)&&r.counter>r.threshold){r.currentAdd=Math.min(r.cap,r.currentAdd+r.increment);const i=t.get(e);i&&t.set(e,i+r.currentAdd)}for(const e of this.#a)t.delete(e);for(const[e,r]of Array.from(t.entries()))r>0||t.delete(e);return t}_weightsToDistribution(e){if(this._checkDestroyed(),!(e instanceof Map))throw new TypeError("_weightsToDistribution: parameter 'weights' must be a Map, got "+typeof e);for(const[t,r]of e){if("string"!=typeof t)throw new TypeError("_weightsToDistribution: weights Map key must be string, got "+typeof t);if("number"!=typeof r||!Number.isFinite(r)||r<0)throw new TypeError(`_weightsToDistribution: weights Map value must be finite non-negative number, got ${r} for key ${t}`)}const t=Array.from(e.entries()).map(([e,t])=>({id:e,weight:t}));if(0===t.length)return[];if("softmax"===this.#t){const e=Math.max(...t.map(e=>e.weight)),r=t.map(t=>Math.exp(t.weight-e)),i=r.reduce((e,t)=>e+t,0);let o=0;return t.map((e,t)=>{const s=r[t]/i;return o+=s,{id:e.id,weight:e.weight,p:s,cumulative:o}})}{const e=t.reduce((e,t)=>e+t.weight,0);let r=0;return t.map(t=>{const i=t.weight/e;return r+=i,{id:t.id,weight:t.weight,p:i,cumulative:r}})}}drawOne(e={}){if(this._checkDestroyed(),"object"!=typeof e||null===e)throw new TypeError("drawOne: parameter 'opts' must be a non-null object, got "+typeof e);if("previousDraws"in e&&!Array.isArray(e.previousDraws))throw new TypeError("drawOne: opts.previousDraws must be an array if provided, got "+typeof e.previousDraws);if("metadata"in e&&void 0!==e.metadata&&("object"!=typeof e.metadata||null===e.metadata))throw new TypeError("drawOne: opts.metadata must be a non-null object if provided, got "+typeof e.metadata);const t={previousDraws:e.previousDraws??[],metadata:e.metadata??{},activeModifiers:[...this.#o]},r=this.computeEffectiveWeights(t),i=this._weightsToDistribution(r);if(!i.length)return null;const o=this.#f(),s=i.find(e=>o<=e.cumulative)??i[i.length-1];for(const[e,t]of this.#n)e===s.id?(t.counter=0,t.currentAdd=0):t.counter++;this._consumeTemporaryModifiers();const n=this.#h.get(s.id);if(!n)return null;const a={id:n.id,label:n.label,meta:{...n.meta},prob:s.p};return this.emit("draw",a),a&&this.#p.set(a.id,(this.#p.get(a.id)||0)+1),a}_consumeTemporaryModifiers(){this._checkDestroyed();for(let e=this.#o.length-1;e>=0;--e){const t=this.#o[e];t.uses-=1,t.uses<=0&&this.#o.splice(e,1)}}drawMany(e=1,t={}){if(this._checkDestroyed(),!Number.isInteger(e)||e<=0)throw new TypeError(`drawMany: parameter 'count' must be a positive integer, got ${e}`);if("object"!=typeof t||null===t)throw new TypeError("drawMany: parameter 'opts' must be a non-null object, got "+typeof t);if("withReplacement"in t&&"boolean"!=typeof t.withReplacement)throw new TypeError("drawMany: opts.withReplacement must be boolean if provided, got "+typeof t.withReplacement);if("ensureUnique"in t&&"boolean"!=typeof t.ensureUnique)throw new TypeError("drawMany: opts.ensureUnique must be boolean if provided, got "+typeof t.ensureUnique);if("metadata"in t&&void 0!==t.metadata&&("object"!=typeof t.metadata||null===t.metadata))throw new TypeError("drawMany: opts.metadata must be a non-null object if provided, got "+typeof t.metadata);if("previousDraws"in t&&!Array.isArray(t.previousDraws))throw new TypeError("drawMany: opts.previousDraws must be an array if provided, got "+typeof t.previousDraws);const r=t.withReplacement??!0,i=t.ensureUnique??!1,o=[],s=t.previousDraws??[];if(!r&&i){const r=new Set;for(let i=0;i<e;++i){const e=new Set(this.#a);for(const e of r)this.#a.add(e);const i=this.drawOne({previousDraws:s,metadata:t.metadata});if(this.#a=e,!i)break;o.push(i),r.add(i.id),s.push(i)}return o}for(let i=0;i<e;++i){const e=this.drawOne({previousDraws:s,metadata:t.metadata});if(!e)break;o.push(e),s.push(e),r||this.excludeItem(e.id)}if(!r)for(const e of o)this.includeItem(e.id);return o}exportToJson(){return this._checkDestroyed(),{items:Array.from(this.#h.values()).map(e=>({id:e.id,label:e.label,baseWeight:e.baseWeight,meta:e.meta,groups:Array.from(e.groups),locked:!1})),pity:Array.from(this.#n.entries()),exclusions:Array.from(this.#a),normalization:this.#t,seed:this.#r}}loadFromJson(e){if(this._checkDestroyed(),"object"!=typeof e||null===e)throw new TypeError("data must be a non-null object");if(!Array.isArray(e.items)||!Array.isArray(e.pity)||!Array.isArray(e.exclusions))throw new TypeError("data must have items, pity, and exclusions arrays");if("string"!=typeof e.normalization)throw new TypeError("data.normalization must be a string");if(void 0!==e.seed&&null!==e.seed&&"number"!=typeof e.seed)throw new TypeError("data.seed must be a number, null, or undefined");this.clearList();for(const t of e.items){if("object"!=typeof t||null===t)throw new TypeError("Each item must be a non-null object");if("string"!=typeof t.id||!t.id.trim())throw new TypeError("Each item.id must be a non-empty string");if("string"!=typeof t.label)throw new TypeError(`Item with id "${t.id}" has invalid label; must be string`);if("number"!=typeof t.baseWeight||!Number.isFinite(t.baseWeight)||t.baseWeight<0)throw new TypeError(`Item with id "${t.id}" has invalid baseWeight; must be a finite non-negative number`);if(void 0!==t.groups&&!Array.isArray(t.groups))throw new TypeError(`Item with id "${t.id}" has invalid groups; must be an array of strings`);if(t.groups&&!t.groups.every(e=>"string"==typeof e))throw new TypeError(`Item with id "${t.id}" has groups containing non-string values`);if(void 0!==t.meta&&("object"!=typeof t.meta||null===t.meta))throw new TypeError(`Item with id "${t.id}" has invalid meta; must be an object`);this.#h.set(t.id,{id:t.id,label:t.label,baseWeight:t.baseWeight,meta:t.meta||{},groups:new Set(t.groups||[]),locked:!1});for(const e of t.groups||[])this._ensureGroup(e).add(t.id)}this.pitySystems=new Map(e.pity||[]),this.exclusions=new Set(e.exclusions||[]),this.normalization=e.normalization,void 0!==e.seed&&(this.seed=e.seed)}clone(){this._checkDestroyed();const e=new s;return e.#t=this.#t,e.#r=this.#r,e.#i=[...this.#i],e.#o=this.#o.map(e=>({fn:e.fn,uses:e.uses})),e.#s=[...this.#s],e.#n=new Map([...this.#n.entries()].map(([e,t])=>[e,{...t}])),e.#a=new Set(this.#a),e.#u=new Map([...this.#u.entries()].map(([e,t])=>[e,new Set(t)])),e.#f=this.#f,e.#h=new Map([...this.#h.entries()].map(([e,t])=>[e,{...t,groups:new Set(t.groups),meta:{...t.meta}}])),e.#p=new Map(this.#p),e}_makeSeededRng(e){if(this._checkDestroyed(),"number"!=typeof e||!Number.isFinite(e))throw new TypeError("seed must be a finite number");let t=e>>>0;return function(){t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}destroy(){this.#e||(this.#e=!0,this.#n.clear(),this.#a.clear(),this.#u.clear(),this.#h.clear(),this.#p.clear(),this.#i=[],this.#o=[],this.#s=[],this.#r=null)}}const n=s;window.TinyAdvancedRaffle=i.TinyAdvancedRaffle})();
1
+ (()=>{"use strict";var e={7(e){var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise(function(r,i){function s(r){e.removeListener(t,o),i(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}l(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&l(e,"error",t,{once:!0})}(e,s)})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var n=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,r,i){var s,o,n,f;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),n=o[t]),void 0===n)n=o[t]=r,++e._eventsCount;else if("function"==typeof n?n=o[t]=i?[r,n]:[n,r]:i?n.unshift(r):n.push(r),(s=u(e))>0&&n.length>s&&!n.warned){n.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+n.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=n.length,f=h,console&&console.warn&&console.warn(f)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=h.bind(i);return s.listener=r,i.wrapFn=s,s}function y(e,t,r){var i=e._events;if(void 0===i)return[];var s=i[t];return void 0===s?[]:"function"==typeof s?r?[s.listener||s]:[s]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(s):d(s,s.length)}function m(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function d(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function l(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function s(o){i.once&&e.removeEventListener(t,s),r(o)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return n},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");n=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,o=this._events;if(void 0!==o)s=s&&void 0===o.error;else if(!s)return!1;if(s){var n;if(t.length>0&&(n=t[0]),n instanceof Error)throw n;var a=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw a.context=n,a}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)i(u,this,t);else{var f=u.length,h=d(u,f);for(r=0;r<f;++r)i(h[r],this,t)}return!0},o.prototype.addListener=function(e,t){return f(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return f(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,p(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,p(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,i,s,o,n;if(a(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){n=r[o].listener,s=o;break}if(s<0)return this;0===s?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,s),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,n||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var s,o=Object.keys(r);for(i=0;i<o.length;++i)"removeListener"!==(s=o[i])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return y(this,e,!0)},o.prototype.rawListeners=function(e){return y(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},o.prototype.listenerCount=m,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}}};const t={};function r(i){const s=t[i];if(void 0!==s)return s.exports;const o=t[i]={exports:{}};return e[i](o,o.exports,r),o.exports}r.d=(e,t)=>{if(Array.isArray(t))for(var i=0;i<t.length;){var s=t[i++],o=t[i++];r.o(e,s)?0===o&&i++:0===o?Object.defineProperty(e,s,{enumerable:!0,value:t[i++]}):Object.defineProperty(e,s,{enumerable:!0,get:o})}else for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let i={};r.d(i,{TinyAdvancedRaffle:()=>a});var s=r(7);const o=e=>{if(e)throw new Error("This TinyAdvancedRaffle instance has been destroyed and can no longer be used.")};class n extends s.EventEmitter{#e=!1;#t;#r;#i=[];#s=[];#o=[];#n=new Map;#a=new Set;#u=new Map;#f;#h=new Map;#p=new Map;get isDestroyed(){return this.#e}get freq(){return o(this.#e),Object.fromEntries(this.#p)}get size(){return o(this.#e),this.#h.size}get normalization(){return o(this.#e),this.#t}set normalization(e){if(o(this.#e),"string"!=typeof e||!e.trim())throw new TypeError("normalization must be a non-empty string (e.g., 'relative', 'softmax').");this.#t=e}get seed(){return o(this.#e),this.#r}set seed(e){if(o(this.#e),null!==e&&("number"!=typeof e||!Number.isFinite(e)))throw new TypeError("seed must be a finite number or null.");this.#r=e,null!==e&&(this.#f=this._makeSeededRng(e))}get globalModifiers(){return o(this.#e),[...this.#i]}set globalModifiers(e){if(o(this.#e),!Array.isArray(e)||!e.every(e=>"function"==typeof e))throw new TypeError("globalModifiers must be an array of functions (WeightsCallback).");this.#i=e}get temporaryModifiers(){return o(this.#e),[...this.#s]}set temporaryModifiers(e){if(o(this.#e),!Array.isArray(e)||!e.every(e=>e&&"function"==typeof e.fn&&Number.isInteger(e.uses)&&e.uses>0))throw new TypeError("temporaryModifiers must be an array of objects { fn: function, uses: positive integer }.");this.#s=e}get conditionalRules(){return o(this.#e),[...this.#o]}set conditionalRules(e){if(o(this.#e),!Array.isArray(e)||!e.every(e=>"function"==typeof e))throw new TypeError("conditionalRules must be an array of functions (WeightsCallback).");this.#o=e}get pitySystems(){return o(this.#e),Object.fromEntries(this.#n)}set pitySystems(e){if(o(this.#e),!(e instanceof Map&&[...e.values()].every(e=>e&&"number"==typeof e.threshold&&"number"==typeof e.increment&&"number"==typeof e.cap&&"number"==typeof e.counter&&"number"==typeof e.currentAdd)))throw new TypeError("pitySystems must be a Map<string, Pity> with all numeric fields.");this.#n=e}get exclusions(){return o(this.#e),Array.from(this.#a)}set exclusions(e){if(o(this.#e),!(e instanceof Set&&[...e].every(e=>"string"==typeof e)))throw new TypeError("exclusions must be a Set<string>.");this.#a=e}get groups(){o(this.#e);const e={};return this.#u.forEach((t,r)=>e[r]=Array.from(t)),e}set groups(e){if(o(this.#e),!(e instanceof Map&&[...e.values()].every(e=>e instanceof Set&&[...e].every(e=>"string"==typeof e))))throw new TypeError("groups must be a Map<string, Set<string>>.");this.#u=e}get rng(){return o(this.#e),this.#f}set rng(e){if(o(this.#e),"function"!=typeof e||"number"!=typeof e())throw new TypeError("rng must be a function returning a number (RngGenerator).");this.#f=e}get items(){o(this.#e);const e={};return this.#h.forEach((t,r)=>{e[r]={...t,groups:Array.from(t.groups)}}),e}set items(e){if(o(this.#e),!(e instanceof Map&&[...e.values()].every(e=>e&&"string"==typeof e.id&&"string"==typeof e.label&&"number"==typeof e.baseWeight&&e.groups instanceof Set&&"boolean"==typeof e.locked&&"object"==typeof e.meta)))throw new TypeError("items must be a Map<string, ItemData> with valid item structures.");this.clearList(),this.#h=e}constructor(e={}){super();const{rng:t=null,seed:r=null,normalization:i="relative"}=e;this.#t=i,this.#r=r,"function"==typeof t?this.#f=t:null!==this.#r?this.#f=this._makeSeededRng(this.#r):this.#f=Math.random,this.#r=r??null}hasItem(e){if(o(this.#e),"string"!=typeof e)throw new TypeError("itemId must be a string");return this.#h.has(e)}addItem(e,t={}){if(o(this.#e),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");if("object"!=typeof t||null===t)throw new TypeError("opts must be an object");let{weight:r=1,label:i=e,meta:s={},groups:n=[]}=t;if("number"!=typeof r||!Number.isFinite(r)||r<0)throw new TypeError("weight must be a non-negative number");if("string"!=typeof i)throw new TypeError("label must be a string");if("object"!=typeof s||null===s)throw new TypeError("meta must be an object");if(!(Array.isArray(n)||n instanceof Set))throw new TypeError("groups must be an array or a Set of strings");n=Array.isArray(n)?n:[...n];for(const e of n)if("string"!=typeof e)throw new TypeError("groups must contain only strings");const a={id:e,label:i,baseWeight:Math.max(0,Number(r)||0),meta:{...s},groups:new Set(n),locked:!1};this.#h.set(e,a);for(const t of n)this._ensureGroup(t).add(e);return this.emit("itemAdded",a),a}removeItem(e){if(o(this.#e),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");const t=this.#h.get(e);if(!t)return!1;for(const r of t.groups){const t=this.#u.get(r);t&&t.delete(e)}return this.#h.delete(e),this.emit("itemRemoved",e),this.resetFreq(e),this.resetPity(e),!0}setBaseWeight(e,t){if(o(this.#e),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");if("number"!=typeof t||!Number.isFinite(t)||t<0)throw new TypeError("weight must be a non-negative number");const r=this.#h.get(e);if(!r)throw new Error("Item not found");r.baseWeight=Math.max(0,Number(t)||0),this.emit("weightChanged",{id:e,weight:r.baseWeight})}getItem(e){if(o(this.#e),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");return this.#h.get(e)??null}listItems(){return o(this.#e),Array.from(this.#h.values()).map(e=>({...e}))}clearList(){o(this.#e),this.#h.clear(),this.clearFreqs(),this.clearPities()}hasGlobalModifier(e){if(o(this.#e),"function"!=typeof e)throw new TypeError("fn must be a function");return this.#i.includes(e)}addGlobalModifier(e){if(o(this.#e),"function"!=typeof e)throw new TypeError("fn must be a function");this.#i.push(e)}removeGlobalModifier(e){if(o(this.#e),"function"!=typeof e)throw new TypeError("fn must be a function");this.#i=this.#i.filter(t=>t!==e)}hasTemporaryModifier(e){if(o(this.#e),"function"!=typeof e)throw new TypeError("fn must be a function");return this.#s.some(t=>t.fn===e)}addTemporaryModifier(e,t=1){if(o(this.#e),"function"!=typeof e)throw new TypeError("fn must be a function");if("number"!=typeof t||Number.isNaN(t))throw new TypeError("uses must be a number");this.#s.push({fn:e,uses:Math.max(1,Math.floor(t))})}removeTemporaryModifier(e){if(o(this.#e),"function"!=typeof e)throw new TypeError("fn must be a function");const t=this.#s.length;return this.#s=this.#s.filter(t=>t.fn!==e),this.#s.length!==t}hasConditionalRule(e){if(o(this.#e),"function"!=typeof e)throw new TypeError("ruleFn must be a function");return this.#o.includes(e)}addConditionalRule(e){if(o(this.#e),"function"!=typeof e)throw new TypeError("ruleFn must be a function");this.#o.push(e)}removeConditionalRule(e){if(o(this.#e),"function"!=typeof e)throw new TypeError("ruleFn must be a function");const t=this.#o.length;return this.#o=this.#o.filter(t=>t!==e),this.#o.length!==t}hasPity(e){if(o(this.#e),"string"!=typeof e)throw new TypeError("itemId must be a string");return this.#n.has(e)}configurePity(e,t){if(o(this.#e),!this.#h.has(e))throw new Error("Item not found");if("object"!=typeof t||null===t)throw new TypeError("cfg must be an object");const{threshold:r,increment:i,cap:s=1/0}=t;if("number"!=typeof r||r<=0)throw new TypeError("threshold must be a positive number");if("number"!=typeof i)throw new TypeError("increment must be a number");if("number"!=typeof s)throw new TypeError("cap must be a number");this.#n.set(e,{threshold:Math.max(1,r),increment:Number(i)||0,cap:Number(s)||1/0,counter:0,currentAdd:0})}resetPity(e){if(o(this.#e),"string"!=typeof e||!e.trim())throw new TypeError("itemId must be a non-empty string");const t=this.#n.get(e);t&&(t.counter=0,t.currentAdd=0)}clearPities(){o(this.#e),this.#n.clear()}hasExclusion(e){if(o(this.#e),"string"!=typeof e)throw new TypeError("itemId must be a string");return this.#a.has(e)}excludeItem(e){if(o(this.#e),"string"!=typeof e)throw new TypeError("itemId must be a string");this.#a.add(e)}includeItem(e){if(o(this.#e),"string"!=typeof e)throw new TypeError("itemId must be a string");this.#a.delete(e)}_ensureGroup(e){if(o(this.#e),"string"!=typeof e)throw new TypeError("name must be a string");let t=this.#u.get(e);return t||(t=new Set,this.#u.set(e,t)),t}hasInGroup(e,t){if(o(this.#e),"string"!=typeof e||"string"!=typeof t)throw new TypeError("itemId and groupName must be strings");const r=this.#u.get(t);return!!r&&r.has(e)}addToGroup(e,t){if(o(this.#e),"string"!=typeof e||"string"!=typeof t)throw new TypeError("itemId and groupName must be strings");const r=this.#h.get(e);if(!r)throw new Error("Item missing");r.groups.add(t),this._ensureGroup(t).add(e)}removeFromGroup(e,t){if(o(this.#e),"string"!=typeof e||"string"!=typeof t)throw new TypeError("itemId and groupName must be strings");const r=this.#u.get(t);r&&r.delete(e);const i=this.#h.get(e);i&&i.groups.delete(t)}clearFreqs(){o(this.#e),this.#p.clear()}resetFreq(e){if(o(this.#e),"string"!=typeof e)throw new TypeError("itemId must be a string");this.#p.delete(e)}computeEffectiveWeights(e={}){if(o(this.#e),"object"!=typeof e||null===e)throw new TypeError("computeEffectiveWeights: parameter 'context' must be a non-null object, got "+typeof e);if("previousDraws"in e&&!Array.isArray(e.previousDraws))throw new TypeError("computeEffectiveWeights: context.previousDraws must be an array if provided, got "+typeof e.previousDraws);if("metadata"in e&&void 0!==e.metadata&&("object"!=typeof e.metadata||null===e.metadata))throw new TypeError("computeEffectiveWeights: context.metadata must be a non-null object if provided, got "+typeof e.metadata);const t=new Map;for(const[e,r]of this.#h)t.set(e,r.baseWeight);for(const r of this.#i){const i=r(t,e);if(i instanceof Map)for(const[e,r]of i)t.set(e,Math.max(0,(t.get(e)||0)+r))}for(const r of this.#s){const i=r.fn(t,e);if(i instanceof Map)for(const[e,r]of i)t.set(e,Math.max(0,(t.get(e)||0)+r))}for(const r of this.#o){const i=r(t,e);if(i instanceof Map)for(const[e,r]of i)t.set(e,Math.max(0,(t.get(e)||0)+r))}for(const[e,r]of this.#n)if(t.has(e)&&r.counter>r.threshold){r.currentAdd=Math.min(r.cap,r.currentAdd+r.increment);const i=t.get(e);i&&t.set(e,i+r.currentAdd)}for(const e of this.#a)t.delete(e);for(const[e,r]of Array.from(t.entries()))r>0||t.delete(e);return t}_weightsToDistribution(e){if(!(e instanceof Map))throw new TypeError("_weightsToDistribution: parameter 'weights' must be a Map, got "+typeof e);for(const[t,r]of e){if("string"!=typeof t)throw new TypeError("_weightsToDistribution: weights Map key must be string, got "+typeof t);if("number"!=typeof r||!Number.isFinite(r)||r<0)throw new TypeError(`_weightsToDistribution: weights Map value must be finite non-negative number, got ${r} for key ${t}`)}const t=Array.from(e.entries()).map(([e,t])=>({id:e,weight:t}));if(0===t.length)return[];if("softmax"===this.#t){const e=Math.max(...t.map(e=>e.weight)),r=t.map(t=>Math.exp(t.weight-e)),i=r.reduce((e,t)=>e+t,0);let s=0;return t.map((e,t)=>{const o=r[t]/i;return s+=o,{id:e.id,weight:e.weight,p:o,cumulative:s}})}{const e=t.reduce((e,t)=>e+t.weight,0);let r=0;return t.map(t=>{const i=t.weight/e;return r+=i,{id:t.id,weight:t.weight,p:i,cumulative:r}})}}drawOne(e={}){if(o(this.#e),"object"!=typeof e||null===e)throw new TypeError("drawOne: parameter 'opts' must be a non-null object, got "+typeof e);if("previousDraws"in e&&!Array.isArray(e.previousDraws))throw new TypeError("drawOne: opts.previousDraws must be an array if provided, got "+typeof e.previousDraws);if("metadata"in e&&void 0!==e.metadata&&("object"!=typeof e.metadata||null===e.metadata))throw new TypeError("drawOne: opts.metadata must be a non-null object if provided, got "+typeof e.metadata);const t={previousDraws:e.previousDraws??[],metadata:e.metadata??{},activeModifiers:[...this.#s]},r=this.computeEffectiveWeights(t),i=this._weightsToDistribution(r);if(!i.length)return null;const s=this.#f(),n=i.find(e=>s<=e.cumulative)??i[i.length-1];for(const[e,t]of this.#n)e===n.id?(t.counter=0,t.currentAdd=0):t.counter++;this._consumeTemporaryModifiers();const a=this.#h.get(n.id);if(!a)return null;const u={id:a.id,label:a.label,meta:{...a.meta},prob:n.p};return this.emit("draw",u),u&&this.#p.set(u.id,(this.#p.get(u.id)||0)+1),u}_consumeTemporaryModifiers(){for(let e=this.#s.length-1;e>=0;--e){const t=this.#s[e];t.uses-=1,t.uses<=0&&this.#s.splice(e,1)}}drawMany(e=1,t={}){if(o(this.#e),!Number.isInteger(e)||e<=0)throw new TypeError(`drawMany: parameter 'count' must be a positive integer, got ${e}`);if("object"!=typeof t||null===t)throw new TypeError("drawMany: parameter 'opts' must be a non-null object, got "+typeof t);if("withReplacement"in t&&"boolean"!=typeof t.withReplacement)throw new TypeError("drawMany: opts.withReplacement must be boolean if provided, got "+typeof t.withReplacement);if("ensureUnique"in t&&"boolean"!=typeof t.ensureUnique)throw new TypeError("drawMany: opts.ensureUnique must be boolean if provided, got "+typeof t.ensureUnique);if("metadata"in t&&void 0!==t.metadata&&("object"!=typeof t.metadata||null===t.metadata))throw new TypeError("drawMany: opts.metadata must be a non-null object if provided, got "+typeof t.metadata);if("previousDraws"in t&&!Array.isArray(t.previousDraws))throw new TypeError("drawMany: opts.previousDraws must be an array if provided, got "+typeof t.previousDraws);const r=t.withReplacement??!0,i=t.ensureUnique??!1,s=[],n=t.previousDraws??[];if(!r&&i){const r=new Set;for(let i=0;i<e;++i){const e=new Set(this.#a);for(const e of r)this.#a.add(e);const i=this.drawOne({previousDraws:n,metadata:t.metadata});if(this.#a=e,!i)break;s.push(i),r.add(i.id),n.push(i)}return s}for(let i=0;i<e;++i){const e=this.drawOne({previousDraws:n,metadata:t.metadata});if(!e)break;s.push(e),n.push(e),r||this.excludeItem(e.id)}if(!r)for(const e of s)this.includeItem(e.id);return s}exportToJson(){return o(this.#e),{items:Array.from(this.#h.values()).map(e=>({id:e.id,label:e.label,baseWeight:e.baseWeight,meta:e.meta,groups:Array.from(e.groups),locked:!1})),pity:Array.from(this.#n.entries()),exclusions:Array.from(this.#a),normalization:this.#t,seed:this.#r}}loadFromJson(e){if(o(this.#e),"object"!=typeof e||null===e)throw new TypeError("data must be a non-null object");if(!Array.isArray(e.items)||!Array.isArray(e.pity)||!Array.isArray(e.exclusions))throw new TypeError("data must have items, pity, and exclusions arrays");if("string"!=typeof e.normalization)throw new TypeError("data.normalization must be a string");if(void 0!==e.seed&&null!==e.seed&&"number"!=typeof e.seed)throw new TypeError("data.seed must be a number, null, or undefined");this.clearList();for(const t of e.items){if("object"!=typeof t||null===t)throw new TypeError("Each item must be a non-null object");if("string"!=typeof t.id||!t.id.trim())throw new TypeError("Each item.id must be a non-empty string");if("string"!=typeof t.label)throw new TypeError(`Item with id "${t.id}" has invalid label; must be string`);if("number"!=typeof t.baseWeight||!Number.isFinite(t.baseWeight)||t.baseWeight<0)throw new TypeError(`Item with id "${t.id}" has invalid baseWeight; must be a finite non-negative number`);if(void 0!==t.groups&&!Array.isArray(t.groups))throw new TypeError(`Item with id "${t.id}" has invalid groups; must be an array of strings`);if(t.groups&&!t.groups.every(e=>"string"==typeof e))throw new TypeError(`Item with id "${t.id}" has groups containing non-string values`);if(void 0!==t.meta&&("object"!=typeof t.meta||null===t.meta))throw new TypeError(`Item with id "${t.id}" has invalid meta; must be an object`);this.#h.set(t.id,{id:t.id,label:t.label,baseWeight:t.baseWeight,meta:t.meta||{},groups:new Set(t.groups||[]),locked:!1});for(const e of t.groups||[])this._ensureGroup(e).add(t.id)}this.pitySystems=new Map(e.pity||[]),this.exclusions=new Set(e.exclusions||[]),this.normalization=e.normalization,void 0!==e.seed&&(this.seed=e.seed)}clone(){o(this.#e);const e=new n;return e.#t=this.#t,e.#r=this.#r,e.#i=[...this.#i],e.#s=this.#s.map(e=>({fn:e.fn,uses:e.uses})),e.#o=[...this.#o],e.#n=new Map([...this.#n.entries()].map(([e,t])=>[e,{...t}])),e.#a=new Set(this.#a),e.#u=new Map([...this.#u.entries()].map(([e,t])=>[e,new Set(t)])),e.#f=this.#f,e.#h=new Map([...this.#h.entries()].map(([e,t])=>[e,{...t,groups:new Set(t.groups),meta:{...t.meta}}])),e.#p=new Map(this.#p),e}_makeSeededRng(e){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("seed must be a finite number");let t=e>>>0;return function(){t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}destroy(){this.#e||(this.#n.clear(),this.#a.clear(),this.#u.clear(),this.#h.clear(),this.#p.clear(),this.#i=[],this.#s=[],this.#o=[],this.#r=null,this.#e=!0)}}const a=n;window.TinyAdvancedRaffle=i.TinyAdvancedRaffle})();
@@ -1 +1 @@
1
- (()=>{"use strict";const e={d:(t,r)=>{if(Array.isArray(r))for(var i=0;i<r.length;){var o=r[i++],s=r[i++];e.o(t,o)?0===s&&i++:0===s?Object.defineProperty(t,o,{enumerable:!0,value:r[i++]}):Object.defineProperty(t,o,{enumerable:!0,get:s})}else for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyAfterScrollWatcher:()=>r});const r=class{#e;get scrollTarget(){return this.#e}#t=null;#r=[];get afterScrollQueueSize(){return this.#r.length}#i=100;#o=new Set;#s=new Set;#n=!1;get destroyed(){return this.#n}constructor(e,t=100){if(!(e instanceof Element||e instanceof Window))throw new TypeError("scrollTarget must be an Element or the Window object.");this.#e=e,this._checkTimer=this._checkTimer.bind(this),this.#e.addEventListener("scroll",this._checkTimer),this.#i=t}_checkTimer=()=>{this.#t&&clearTimeout(this.#t),this.#t=setTimeout(()=>{this.#t=null,this.#l()},this.#i)};get inactivityTime(){return this.#i}set inactivityTime(e){if("number"!=typeof e||e<=0||!Number.isFinite(e))throw new Error("inactivityTime must be a positive number in milliseconds.");this.#i=e}#l(){if(!this.#n){for(const e of this.#s)"function"==typeof e&&e();for(;this.#r.length;){const e=this.#r.pop();"function"==typeof e&&e()}}}doAfterScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.lastScrollTime=Date.now(),this.#r.push(e)}onStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#s.add(e)}offStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#s.delete(e)}onScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#e.addEventListener("scroll",e),this.#o.add(e)}offScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#o.has(e)&&(this.#e.removeEventListener("scroll",e),this.#o.delete(e))}destroy(){if(!this.#n){this.#n=!0,this.#e.removeEventListener("scroll",this._checkTimer);for(const e of this.#o)this.#e.removeEventListener("scroll",e);this.#o.clear(),this.#s.clear()}}};window.TinyAfterScrollWatcher=t.TinyAfterScrollWatcher})();
1
+ (()=>{"use strict";const e={d:(t,r)=>{if(Array.isArray(r))for(var i=0;i<r.length;){var o=r[i++],s=r[i++];e.o(t,o)?0===s&&i++:0===s?Object.defineProperty(t,o,{enumerable:!0,value:r[i++]}):Object.defineProperty(t,o,{enumerable:!0,get:s})}else for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyAfterScrollWatcher:()=>i});const r=e=>{if(e)throw new Error("This TinyAfterScrollWatcher instance has been destroyed and can no longer be used.")};const i=class{#e;get scrollTarget(){return r(this.#t),this.#e}#r=null;#i=[];get afterScrollQueueSize(){return r(this.#t),this.#i.length}#o=100;#s=new Set;#n=new Set;#t=!1;get destroyed(){return this.#t}constructor(e,t=100){if(!(e instanceof Element||e instanceof Window))throw new TypeError("scrollTarget must be an Element or the Window object.");this.#e=e,this._checkTimer=this._checkTimer.bind(this),this.#e.addEventListener("scroll",this._checkTimer),this.#o=t}_checkTimer=()=>{this.#r&&clearTimeout(this.#r),this.#r=setTimeout(()=>{this.#r=null,this.#l()},this.#o)};get inactivityTime(){return r(this.#t),this.#o}set inactivityTime(e){if(r(this.#t),"number"!=typeof e||e<=0||!Number.isFinite(e))throw new Error("inactivityTime must be a positive number in milliseconds.");this.#o=e}#l(){if(!this.#t){for(const e of this.#n)"function"==typeof e&&e();for(;this.#i.length;){const e=this.#i.pop();"function"==typeof e&&e()}}}doAfterScroll(e){if(r(this.#t),"function"!=typeof e)throw new TypeError("Argument must be a function.");this.lastScrollTime=Date.now(),this.#i.push(e)}onStop(e){if(r(this.#t),"function"!=typeof e)throw new TypeError("Argument must be a function.");this.#n.add(e)}offStop(e){if(r(this.#t),"function"!=typeof e)throw new TypeError("Argument must be a function.");this.#n.delete(e)}onScroll(e){if(r(this.#t),"function"!=typeof e)throw new TypeError("Argument must be a function.");this.#e.addEventListener("scroll",e),this.#s.add(e)}offScroll(e){if(r(this.#t),"function"!=typeof e)throw new TypeError("Argument must be a function.");this.#s.has(e)&&(this.#e.removeEventListener("scroll",e),this.#s.delete(e))}destroy(){if(!this.#t){this.#e.removeEventListener("scroll",this._checkTimer);for(const e of this.#s)this.#e.removeEventListener("scroll",e);this.#s.clear(),this.#n.clear(),this.#t=!0}}};window.TinyAfterScrollWatcher=t.TinyAfterScrollWatcher})();
@@ -1 +1 @@
1
- (()=>{"use strict";const e={d:(t,n)=>{if(Array.isArray(n))for(var o=0;o<n.length;){var i=n[o++],r=n[o++];e.o(t,i)?0===r&&o++:0===r?Object.defineProperty(t,i,{enumerable:!0,value:n[o++]}):Object.defineProperty(t,i,{enumerable:!0,get:r})}else for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyAnalogClock:()=>n});const n=class{#e;#t;#n;#o;#i=null;_getDate(){const e=new Date,t=e.getSeconds(),n=e.getMinutes(),o=e.getHours();return{now:e,s:t,m:n,h:o}}constructor(e={}){this.#o={bgColor:"#f0f0f0",borderColor:"#333",borderWidth:8,markColor:"#333",hourHandColor:"#000",minuteHandColor:"#444",secondHandColor:"#d81c1c",textColor:"#000",skinUrl:null,showNumbers:!0,showSeconds:!0,size:800,sizeAdjust:.04,padding:45,angleDistance:.95,pwH:.008,phH:.08,pwM:.005,phM:.03,...e},this.#e=document.createElement("div"),this.#e.className="analog-clock-container",this.#e.style.position="relative",this.#e.style.borderRadius="50%",this.#e.style.overflow="hidden",this.#e.style.boxSizing="border-box",this.#n=document.createElement("div"),this.#n.style.position="absolute",this.#n.style.inset="0",this.#n.style.backgroundSize="cover",this.#n.style.backgroundPosition="center",this.#n.style.zIndex="0",this.#t=document.createElement("div"),this.#t.style.position="absolute",this.#t.style.inset="0",this.#t.style.zIndex="1",this.#t.style.pointerEvents="none";const t=document.createElement("div");t.style.position="absolute",t.style.inset="0",t.style.zIndex="2",t.style.pointerEvents="none",t.innerHTML='\n <div class="hand hour-hand"></div>\n <div class="hand minute-hand"></div>\n <div class="hand second-hand"></div>\n <div class="center-pin"></div>\n ',this.#e.appendChild(this.#n),this.#e.appendChild(this.#t),this.#e.appendChild(t);const n=document.createElement("style");n.textContent="\n .analog-clock-container .hand {\n position: absolute;\n bottom: 50%;\n left: 50%;\n transform-origin: bottom center;\n border-radius: 4px;\n transform: translateX(-50%) rotate(0deg);\n z-index: 5;\n }\n .analog-clock-container .center-pin {\n position: absolute;\n top: 50%; left: 50%;\n width: 12px; height: 12px;\n background: #333;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n z-index: 10;\n }\n .analog-clock-container .clock-mark {\n position: absolute;\n top: 50%; left: 50%;\n background: currentColor;\n transform-origin: center center;\n }\n .analog-clock-container .clock-number {\n position: absolute;\n top: 50%; left: 50%;\n transform: translate(-50%, -50%);\n font-family: sans-serif;\n font-weight: bold;\n text-align: center;\n line-height: 1;\n }\n ",this.#e.appendChild(n),this._applyConfig(),this._renderFace(),this._startTicker()}_applyConfig(){const e=this.#e.style,t=this.#o;e.width=`${t.size}px`,e.height=`${t.size}px`,e.border=`${t.borderWidth}px solid ${t.borderColor}`,e.backgroundColor=t.bgColor,t.skinUrl?(this.#n.style.backgroundImage=`url(${t.skinUrl})`,this.#n.style.display="block"):this.#n.style.display="none";const n=e=>{const t=this.#e.querySelector(e);if(!(t instanceof HTMLDivElement))throw new Error(`TinyAnalogClock: Element ${e} not found.`);return t},o=n(".hour-hand");o.style.backgroundColor=t.hourHandColor,o.style.width=.025*t.size+"px",o.style.height=.25*t.size+"px",o.style.marginLeft=.025*t.size/-2+"px",o.style.bottom="50%",o.style.left="50%",o.style.transformOrigin="bottom center";const i=n(".minute-hand");i.style.backgroundColor=t.minuteHandColor,i.style.width=.015*t.size+"px",i.style.height=.35*t.size+"px",i.style.marginLeft=.015*t.size/-2+"px";const r=n(".second-hand");t.showSeconds?(r.style.display="block",r.style.backgroundColor=t.secondHandColor,r.style.width=.005*t.size+"px",r.style.height=.4*t.size+"px",r.style.marginLeft=.005*t.size/-2+"px"):r.style.display="none",n(".center-pin").style.background=t.borderColor}_renderFace(){this.#t.innerHTML="";const e=this.#o.size/2-this.#o.borderWidth;for(let t=0;t<60;t++){const n=t%5==0,o=document.createElement("div");o.className="clock-mark";const i=n?this.#o.size*this.#o.pwH:this.#o.size*this.#o.pwM,r=n?this.#o.size*this.#o.phH:this.#o.size*this.#o.phM,s=this.#o.markColor;o.style.width=`${i}px`,o.style.height=`${r}px`,o.style.color=s;const a=e-this.#o.padding-r/2;o.style.transform=`translate(-50%, -50%) rotate(${6*t}deg) translate(0, -${a}px)`,this.#t.appendChild(o)}if(this.#o.showNumbers)for(let t=1;t<=12;t++){const n=30*t*(Math.PI/180),o=e*this.#o.angleDistance,i=e+Math.sin(n)*o,r=e-Math.cos(n)*o,s=document.createElement("div");s.className="clock-number",s.innerText=t.toString(),s.style.left=`${i}px`,s.style.top=`${r}px`,s.style.color=this.#o.textColor,s.style.fontSize=this.#o.size*this.#o.sizeAdjust+"px",this.#t.appendChild(s)}}_startTicker(){if(this.#i)return;const e=()=>{const{s:t,m:n,h:o}=this._getDate(),i=6*t,r=6*n+.1*t,s=o%12*30+.5*n,a=e=>{const t=this.#e.querySelector(e);if(!(t instanceof HTMLDivElement))throw new Error(`${e} not found.`);return t};this.#e.querySelector(".second-hand")&&(a(".second-hand").style.transform=`rotate(${i}deg)`),a(".minute-hand").style.transform=`rotate(${r}deg)`,a(".hour-hand").style.transform=`rotate(${s}deg)`,this.#i=requestAnimationFrame(e)};e()}get element(){return this.#e}set size(e){if("number"!=typeof e||e<=0||isNaN(e))throw new Error(`TinyAnalogClock: 'size' must be a positive number. Received: ${e}`);this.#o.size=e,this._applyConfig(),this._renderFace()}get size(){return this.#o.size}set skinUrl(e){if(null!==e&&"string"!=typeof e)throw new Error("TinyAnalogClock: 'skin' must be a URL string or null. Received type: "+typeof e);this.#o.skinUrl=e,this._applyConfig()}get skinUrl(){return this.#o.skinUrl}set borderColor(e){if("string"!=typeof e||""===e.trim())throw new Error(`TinyAnalogClock: 'borderColor' must be a non-empty string. Received: ${e}`);this.#o.borderColor=e,this._applyConfig(),this._renderFace()}get borderColor(){return this.#o.borderColor}set markColor(e){if("string"!=typeof e||""===e.trim())throw new Error(`TinyAnalogClock: 'markColor' must be a non-empty string. Received: ${e}`);this.#o.markColor=e,this._applyConfig(),this._renderFace()}get markColor(){return this.#o.markColor}set textColor(e){if("string"!=typeof e||""===e.trim())throw new Error(`TinyAnalogClock: 'textColor' must be a non-empty string. Received: ${e}`);this.#o.textColor=e,this._applyConfig(),this._renderFace()}get textColor(){return this.#o.textColor}set showNumbers(e){if("boolean"!=typeof e)throw new Error("TinyAnalogClock: 'showNumbers' must be a boolean. Received type: "+typeof e);this.#o.showNumbers=e,this._renderFace()}get showNumbers(){return this.#o.showNumbers}set bgColor(e){if("string"!=typeof e||!e)throw new Error("TinyAnalogClock: 'bgColor' must be a non-empty string.");this.#o.bgColor=e,this._applyConfig()}get bgColor(){return this.#o.bgColor}set borderWidth(e){if("number"!=typeof e||e<0)throw new Error("TinyAnalogClock: 'borderWidth' must be a non-negative number.");this.#o.borderWidth=e,this._applyConfig(),this._renderFace()}get borderWidth(){return this.#o.borderWidth}set hourHandColor(e){if("string"!=typeof e||!e)throw new Error("TinyAnalogClock: 'hourHandColor' must be a non-empty string.");this.#o.hourHandColor=e,this._applyConfig()}get hourHandColor(){return this.#o.hourHandColor}set minuteHandColor(e){if("string"!=typeof e||!e)throw new Error("TinyAnalogClock: 'minuteHandColor' must be a non-empty string.");this.#o.minuteHandColor=e,this._applyConfig()}get minuteHandColor(){return this.#o.minuteHandColor}set secondHandColor(e){if("string"!=typeof e||!e)throw new Error("TinyAnalogClock: 'secondHandColor' must be a non-empty string.");this.#o.secondHandColor=e,this._applyConfig()}get secondHandColor(){return this.#o.secondHandColor}set showSeconds(e){if("boolean"!=typeof e)throw new Error("TinyAnalogClock: 'showSeconds' must be a boolean.");this.#o.showSeconds=e,this._applyConfig()}get showSeconds(){return this.#o.showSeconds}set sizeAdjust(e){if("number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'sizeAdjust' must be a positive number.");this.#o.sizeAdjust=e,this._renderFace()}get sizeAdjust(){return this.#o.sizeAdjust}set padding(e){if("number"!=typeof e||e<0)throw new Error("TinyAnalogClock: 'padding' must be a non-negative number.");this.#o.padding=e,this._renderFace()}get padding(){return this.#o.padding}set angleDistance(e){if("number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'angleDistance' must be a positive number.");this.#o.angleDistance=e,this._renderFace()}get angleDistance(){return this.#o.angleDistance}set pwH(e){if("number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'pwH' must be a positive number.");this.#o.pwH=e,this._renderFace()}get pwH(){return this.#o.pwH}set phH(e){if("number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'phH' must be a positive number.");this.#o.phH=e,this._renderFace()}get phH(){return this.#o.phH}set pwM(e){if("number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'pwM' must be a positive number.");this.#o.pwM=e,this._renderFace()}get pwM(){return this.#o.pwM}set phM(e){if("number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'phM' must be a positive number.");this.#o.phM=e,this._renderFace()}get phM(){return this.#o.phM}destroy(){this.#i&&(cancelAnimationFrame(this.#i),this.#i=null),this.#e.remove()}};window.TinyAnalogClock=t.TinyAnalogClock})();
1
+ (()=>{"use strict";const e={d:(t,o)=>{if(Array.isArray(o))for(var n=0;n<o.length;){var i=o[n++],r=o[n++];e.o(t,i)?0===r&&n++:0===r?Object.defineProperty(t,i,{enumerable:!0,value:o[n++]}):Object.defineProperty(t,i,{enumerable:!0,get:r})}else for(var i in o)e.o(o,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:o[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyAnalogClock:()=>n});const o=e=>{if(e)throw new Error("This TinyAnalogClock instance has been destroyed and can no longer be used.")};const n=class{#e;#t;#o;#n;#i=null;#r=!1;get destroyed(){return this.#r}_getDate(){const e=new Date,t=e.getSeconds(),o=e.getMinutes(),n=e.getHours();return{now:e,s:t,m:o,h:n}}constructor(e={}){this.#n={bgColor:"#f0f0f0",borderColor:"#333",borderWidth:8,markColor:"#333",hourHandColor:"#000",minuteHandColor:"#444",secondHandColor:"#d81c1c",textColor:"#000",skinUrl:null,showNumbers:!0,showSeconds:!0,size:800,sizeAdjust:.04,padding:45,angleDistance:.95,pwH:.008,phH:.08,pwM:.005,phM:.03,...e},this.#e=document.createElement("div"),this.#e.className="analog-clock-container",this.#e.style.position="relative",this.#e.style.borderRadius="50%",this.#e.style.overflow="hidden",this.#e.style.boxSizing="border-box",this.#o=document.createElement("div"),this.#o.style.position="absolute",this.#o.style.inset="0",this.#o.style.backgroundSize="cover",this.#o.style.backgroundPosition="center",this.#o.style.zIndex="0",this.#t=document.createElement("div"),this.#t.style.position="absolute",this.#t.style.inset="0",this.#t.style.zIndex="1",this.#t.style.pointerEvents="none";const t=document.createElement("div");t.style.position="absolute",t.style.inset="0",t.style.zIndex="2",t.style.pointerEvents="none",t.innerHTML='\n <div class="hand hour-hand"></div>\n <div class="hand minute-hand"></div>\n <div class="hand second-hand"></div>\n <div class="center-pin"></div>\n ',this.#e.appendChild(this.#o),this.#e.appendChild(this.#t),this.#e.appendChild(t);const o=document.createElement("style");o.textContent="\n .analog-clock-container .hand {\n position: absolute;\n bottom: 50%;\n left: 50%;\n transform-origin: bottom center;\n border-radius: 4px;\n transform: translateX(-50%) rotate(0deg);\n z-index: 5;\n }\n .analog-clock-container .center-pin {\n position: absolute;\n top: 50%; left: 50%;\n width: 12px; height: 12px;\n background: #333;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n z-index: 10;\n }\n .analog-clock-container .clock-mark {\n position: absolute;\n top: 50%; left: 50%;\n background: currentColor;\n transform-origin: center center;\n }\n .analog-clock-container .clock-number {\n position: absolute;\n top: 50%; left: 50%;\n transform: translate(-50%, -50%);\n font-family: sans-serif;\n font-weight: bold;\n text-align: center;\n line-height: 1;\n }\n ",this.#e.appendChild(o),this._applyConfig(),this._renderFace(),this._startTicker()}_applyConfig(){const e=this.#e.style,t=this.#n;e.width=`${t.size}px`,e.height=`${t.size}px`,e.border=`${t.borderWidth}px solid ${t.borderColor}`,e.backgroundColor=t.bgColor,t.skinUrl?(this.#o.style.backgroundImage=`url(${t.skinUrl})`,this.#o.style.display="block"):this.#o.style.display="none";const o=e=>{const t=this.#e.querySelector(e);if(!(t instanceof HTMLDivElement))throw new Error(`TinyAnalogClock: Element ${e} not found.`);return t},n=o(".hour-hand");n.style.backgroundColor=t.hourHandColor,n.style.width=.025*t.size+"px",n.style.height=.25*t.size+"px",n.style.marginLeft=.025*t.size/-2+"px",n.style.bottom="50%",n.style.left="50%",n.style.transformOrigin="bottom center";const i=o(".minute-hand");i.style.backgroundColor=t.minuteHandColor,i.style.width=.015*t.size+"px",i.style.height=.35*t.size+"px",i.style.marginLeft=.015*t.size/-2+"px";const r=o(".second-hand");t.showSeconds?(r.style.display="block",r.style.backgroundColor=t.secondHandColor,r.style.width=.005*t.size+"px",r.style.height=.4*t.size+"px",r.style.marginLeft=.005*t.size/-2+"px"):r.style.display="none",o(".center-pin").style.background=t.borderColor}_renderFace(){this.#t.innerHTML="";const e=this.#n.size/2-this.#n.borderWidth;for(let t=0;t<60;t++){const o=t%5==0,n=document.createElement("div");n.className="clock-mark";const i=o?this.#n.size*this.#n.pwH:this.#n.size*this.#n.pwM,r=o?this.#n.size*this.#n.phH:this.#n.size*this.#n.phM,s=this.#n.markColor;n.style.width=`${i}px`,n.style.height=`${r}px`,n.style.color=s;const a=e-this.#n.padding-r/2;n.style.transform=`translate(-50%, -50%) rotate(${6*t}deg) translate(0, -${a}px)`,this.#t.appendChild(n)}if(this.#n.showNumbers)for(let t=1;t<=12;t++){const o=30*t*(Math.PI/180),n=e*this.#n.angleDistance,i=e+Math.sin(o)*n,r=e-Math.cos(o)*n,s=document.createElement("div");s.className="clock-number",s.innerText=t.toString(),s.style.left=`${i}px`,s.style.top=`${r}px`,s.style.color=this.#n.textColor,s.style.fontSize=this.#n.size*this.#n.sizeAdjust+"px",this.#t.appendChild(s)}}_startTicker(){if(this.#i)return;const e=()=>{const{s:t,m:o,h:n}=this._getDate(),i=6*t,r=6*o+.1*t,s=n%12*30+.5*o,a=e=>{const t=this.#e.querySelector(e);if(!(t instanceof HTMLDivElement))throw new Error(`${e} not found.`);return t};this.#e.querySelector(".second-hand")&&(a(".second-hand").style.transform=`rotate(${i}deg)`),a(".minute-hand").style.transform=`rotate(${r}deg)`,a(".hour-hand").style.transform=`rotate(${s}deg)`,this.#i=requestAnimationFrame(e)};e()}get element(){return o(this.#r),this.#e}set size(e){if(o(this.#r),"number"!=typeof e||e<=0||isNaN(e))throw new Error(`TinyAnalogClock: 'size' must be a positive number. Received: ${e}`);this.#n.size=e,this._applyConfig(),this._renderFace()}get size(){return o(this.#r),this.#n.size}set skinUrl(e){if(o(this.#r),null!==e&&"string"!=typeof e)throw new Error("TinyAnalogClock: 'skin' must be a URL string or null. Received type: "+typeof e);this.#n.skinUrl=e,this._applyConfig()}get skinUrl(){return o(this.#r),this.#n.skinUrl}set borderColor(e){if(o(this.#r),"string"!=typeof e||""===e.trim())throw new Error(`TinyAnalogClock: 'borderColor' must be a non-empty string. Received: ${e}`);this.#n.borderColor=e,this._applyConfig(),this._renderFace()}get borderColor(){return o(this.#r),this.#n.borderColor}set markColor(e){if(o(this.#r),"string"!=typeof e||""===e.trim())throw new Error(`TinyAnalogClock: 'markColor' must be a non-empty string. Received: ${e}`);this.#n.markColor=e,this._applyConfig(),this._renderFace()}get markColor(){return o(this.#r),this.#n.markColor}set textColor(e){if(o(this.#r),"string"!=typeof e||""===e.trim())throw new Error(`TinyAnalogClock: 'textColor' must be a non-empty string. Received: ${e}`);this.#n.textColor=e,this._applyConfig(),this._renderFace()}get textColor(){return o(this.#r),this.#n.textColor}set showNumbers(e){if(o(this.#r),"boolean"!=typeof e)throw new Error("TinyAnalogClock: 'showNumbers' must be a boolean. Received type: "+typeof e);this.#n.showNumbers=e,this._renderFace()}get showNumbers(){return o(this.#r),this.#n.showNumbers}set bgColor(e){if(o(this.#r),"string"!=typeof e||!e)throw new Error("TinyAnalogClock: 'bgColor' must be a non-empty string.");this.#n.bgColor=e,this._applyConfig()}get bgColor(){return o(this.#r),this.#n.bgColor}set borderWidth(e){if(o(this.#r),"number"!=typeof e||e<0)throw new Error("TinyAnalogClock: 'borderWidth' must be a non-negative number.");this.#n.borderWidth=e,this._applyConfig(),this._renderFace()}get borderWidth(){return o(this.#r),this.#n.borderWidth}set hourHandColor(e){if(o(this.#r),"string"!=typeof e||!e)throw new Error("TinyAnalogClock: 'hourHandColor' must be a non-empty string.");this.#n.hourHandColor=e,this._applyConfig()}get hourHandColor(){return o(this.#r),this.#n.hourHandColor}set minuteHandColor(e){if(o(this.#r),"string"!=typeof e||!e)throw new Error("TinyAnalogClock: 'minuteHandColor' must be a non-empty string.");this.#n.minuteHandColor=e,this._applyConfig()}get minuteHandColor(){return o(this.#r),this.#n.minuteHandColor}set secondHandColor(e){if(o(this.#r),"string"!=typeof e||!e)throw new Error("TinyAnalogClock: 'secondHandColor' must be a non-empty string.");this.#n.secondHandColor=e,this._applyConfig()}get secondHandColor(){return o(this.#r),this.#n.secondHandColor}set showSeconds(e){if(o(this.#r),"boolean"!=typeof e)throw new Error("TinyAnalogClock: 'showSeconds' must be a boolean.");this.#n.showSeconds=e,this._applyConfig()}get showSeconds(){return o(this.#r),this.#n.showSeconds}set sizeAdjust(e){if(o(this.#r),"number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'sizeAdjust' must be a positive number.");this.#n.sizeAdjust=e,this._renderFace()}get sizeAdjust(){return o(this.#r),this.#n.sizeAdjust}set padding(e){if(o(this.#r),"number"!=typeof e||e<0)throw new Error("TinyAnalogClock: 'padding' must be a non-negative number.");this.#n.padding=e,this._renderFace()}get padding(){return o(this.#r),this.#n.padding}set angleDistance(e){if(o(this.#r),"number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'angleDistance' must be a positive number.");this.#n.angleDistance=e,this._renderFace()}get angleDistance(){return o(this.#r),this.#n.angleDistance}set pwH(e){if(o(this.#r),"number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'pwH' must be a positive number.");this.#n.pwH=e,this._renderFace()}get pwH(){return o(this.#r),this.#n.pwH}set phH(e){if(o(this.#r),"number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'phH' must be a positive number.");this.#n.phH=e,this._renderFace()}get phH(){return o(this.#r),this.#n.phH}set pwM(e){if(o(this.#r),"number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'pwM' must be a positive number.");this.#n.pwM=e,this._renderFace()}get pwM(){return o(this.#r),this.#n.pwM}set phM(e){if(o(this.#r),"number"!=typeof e||e<=0)throw new Error("TinyAnalogClock: 'phM' must be a positive number.");this.#n.phM=e,this._renderFace()}get phM(){return o(this.#r),this.#n.phM}destroy(){this.#r||(this.#i&&(cancelAnimationFrame(this.#i),this.#i=null),this.#e.remove(),this.#r=!0)}};window.TinyAnalogClock=t.TinyAnalogClock})();
@@ -1 +1 @@
1
- (()=>{"use strict";const e={d:(t,r)=>{if(Array.isArray(r))for(var n=0;n<r.length;){var o=r[n++],i=r[n++];e.o(t,o)?0===i&&n++:0===i?Object.defineProperty(t,o,{enumerable:!0,value:r[n++]}):Object.defineProperty(t,o,{enumerable:!0,get:i})}else for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};function r(e){let t,r=e.length;for(;0!==r;)t=Math.floor(Math.random()*r),r--,[e[r],e[t]]=[e[t],e[r]];return e}function n(e,t){const r=e.filter(e=>!t.includes(e));return{added:t.filter(t=>!e.includes(t)),removed:r}}function o(e,t=!1){return t?function(t,r){return t[e]>r[e]?-1:t[e]<r[e]?1:0}:function(t,r){return t[e]<r[e]?-1:t[e]>r[e]?1:0}}function i(e=new Date,t="asSeconds",r=null){if(e instanceof Date){const n=r instanceof Date?r:new Date,o=e.getTime()-n.getTime();switch(t){case"asMilliseconds":return o;case"asSeconds":default:return o/1e3;case"asMinutes":return o/6e4;case"asHours":return o/36e5;case"asDays":return o/864e5}}return null}function a(e,t="seconds",r="{time}"){e=Math.max(0,Math.floor(e));const n=["seconds","minutes","hours","days","months","years"].indexOf(t),o=n>=5,i=n>=4,a=n>=3,s=n>=2,l=n>=1,u=n>=0,c={years:o?0:NaN,months:i?0:NaN,days:a?0:NaN,hours:s?0:NaN,minutes:l?0:NaN,seconds:u?0:NaN,total:NaN};let d=e;if(o||i||a){const e=new Date(1980,0,1),t=new Date(e.getTime()+1e3*d),r=new Date(e);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),c.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),c.months++;if(a)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),c.days++;d=Math.floor((t.getTime()-r.getTime())/1e3)}s&&(c.hours=Math.floor(d/3600),d%=3600),l&&(c.minutes=Math.floor(d/60),d%=60),u&&(c.seconds=d),i&&(c.years,c.months,c.days),o&&(c.years,c.months,c.days),c.total=+e.toFixed(2).replace(/\.00$/,"");const f=e=>{const t="string"==typeof e?parseInt(e):e;return Number.isNaN(t)?"NaN":String(t).padStart(2,"0")},m=[s?f(c.hours):null,l?f(c.minutes):null,u?f(c.seconds):null].filter(e=>null!==e).join(":");return r.replace(/\{years\}/g,String(c.years)).replace(/\{months\}/g,String(c.months)).replace(/\{days\}/g,String(c.days)).replace(/\{hours\}/g,f(c.hours)).replace(/\{minutes\}/g,f(c.minutes)).replace(/\{seconds\}/g,f(c.seconds)).replace(/\{time\}/g,m).replace(/\{total\}/g,String(c.total)).trim()}function s(e){return a(e,"hours","{hours}:{minutes}:{seconds}")}function l(e){return a(e,"days","{days}d {hours}:{minutes}:{seconds}")}function u(e,t="milliseconds"){e=Math.max(0,Math.floor(e));const r=["milliseconds","seconds","minutes","hours","days","months","years"].indexOf(t),n=r>=6,o=r>=5,i=r>=4,a=r>=3,s=r>=2,l=r>=1,u=r>=0,c={years:n?0:NaN,months:o?0:NaN,days:i?0:NaN,hours:a?0:NaN,minutes:s?0:NaN,seconds:l?0:NaN,milliseconds:u?0:NaN,total:NaN};let d=e;if(n||o||i){const e=new Date(1980,0,1),t=new Date(e.getTime()+d),r=new Date(e);if(n)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),c.years++;if(o)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),c.months++;if(i)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),c.days++;d=t.getTime()-r.getTime()}return a&&(c.hours=Math.floor(d/36e5),d%=36e5),s&&(c.minutes=Math.floor(d/6e4),d%=6e4),l&&(c.seconds=Math.floor(d/1e3),d%=1e3),u&&(c.milliseconds=d),o&&(c.years,c.months,c.days),n&&(c.years,c.months,c.days),c.total=+e,c}function c(e){return Array.isArray(e)?e.length:d(e)?Object.keys(e).length:0}function d(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e)}function f(e,t){return new Promise((r,n)=>{const o=new FileReader;o.onload=()=>{try{r(o.result)}catch(e){n(e)}},o.onerror=()=>{n(o.error)},o[t](e)})}function m(e,t=!1){return new Promise((r,n)=>{"string"!=typeof t&&"boolean"!=typeof t&&n(new TypeError("The isDataUrl parameter must be a boolean or a string.")),f(e,"readAsDataURL").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const n=e.match(/^data:(.+);base64,(.*)$/);if(!n||!n[2])throw new Error("Invalid data URL format or missing Base64 content.");const[,o,i]=n;if(!/^[\w/+]+=*$/.test(i))throw new Error("Base64 content is malformed.");if("boolean"==typeof t)return r(t?e:i);if(!/^[\w-]+\/[\w.+-]+$/.test(t))throw new Error(`Invalid MIME type string: ${t}`);return r(`data:${t};base64,${i}`)}).catch(n)})}function p(e){return new Promise((t,r)=>f(e,"readAsText").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const r=e.trim();if(0===r.length)throw new Error("File is empty or contains only whitespace.");const n=JSON.parse(r);if("object"!=typeof n||null===n)throw new Error("Parsed content is not a valid JSON object or array.");t(n)}).catch(r))}function h(e,t,r=2){const n=JSON.stringify(t,null,r),o=new Blob([n],{type:"application/json"}),i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function g(e,t){if("function"!=typeof t)throw new TypeError('The "onProgress" argument must be a function.');if(!e.body)return e;const r=e.headers.get("content-length"),n=r?parseInt(r,10):0;let o=0;const i=e.body.getReader(),a=new ReadableStream({async start(e){for(;;){const{done:r,value:a}=await i.read();if(r)break;o+=a.byteLength,t(o,n),e.enqueue(a)}e.close()}});return new Response(a,{headers:e.headers,status:e.status,statusText:e.statusText})}async function y(e,{method:t="GET",body:r,timeout:n=0,retries:o=0,headers:i={},signal:a=null,onProgress:s}={}){if("string"!=typeof e||!e.startsWith("../")&&!e.startsWith("./")&&!e.startsWith("/")&&!e.startsWith("https://")&&!e.startsWith("http://"))throw new Error("Invalid URL: must be a valid http or https address.");if("string"!=typeof t||!t.trim())throw new Error("Invalid method: must be a non-empty string.");if(!a){if("number"!=typeof n||!Number.isFinite(n)||Number.isNaN(n)||n<0)throw new Error("Invalid timeout: must be a positive number.");if("number"!=typeof o||!Number.isFinite(o)||Number.isNaN(o)||o<0)throw new Error("Invalid retries: must be a positive number.")}const l=a?1:o+1;let u=null;for(let c=0;c<l;c++){const l=a?null:new AbortController,f=a||(l?.signal??null),m=!a&&n&&l?setTimeout(()=>l.abort(),n):null;try{const n=await fetch(e,{method:t.toUpperCase(),headers:{Accept:"application/json",...i},body:void 0!==r?d(r)?JSON.stringify(r):r:void 0,signal:f});if(m&&clearTimeout(m),!n.ok)throw new Error(`HTTP error: ${n.status} ${n.statusText}`);return s?g(n,s):n}catch(e){if(u=e,a)break;c<o&&await new Promise(e=>setTimeout(e,300*(c+1)))}}throw new Error(`Failed to fetch JSON from "${e}"${u?`: ${u.message}`:"."}`)}async function w(e,t){return new Promise((r,n)=>{y(e,t).then(async e=>{const t=e.headers.get("content-type")||"";if(!t.includes("application/json"))throw new Error(`Unexpected content-type: ${t}`);const n=await e.json();if(!Array.isArray(n)&&!d(n))throw new Error("Received invalid data instead of valid JSON.");return r(n)}).catch(n)})}async function b(e,t,r){return new Promise((n,o)=>{y(e,r).then(async e=>{const r=e.headers.get("content-type")||"";if(Array.isArray(t)&&t.length>0&&!t.some(e=>r.includes(e)))throw new Error(`Blocked MIME type: ${r}`);const o=await e.text();return n(o)}).catch(o)})}function E({element:e=document.body,hiddenClass:t="windowHidden",visibleClass:r="windowVisible",onVisible:n,onHidden:o}={}){if(!(e instanceof Element))throw new TypeError('"element" must be an instance of Element.');if("string"!=typeof t)throw new TypeError('"hiddenClass" must be a string.');if("string"!=typeof r)throw new TypeError('"visibleClass" must be a string.');if(void 0!==n&&"function"!=typeof n)throw new TypeError('"onVisible" must be a function if provided.');if(void 0!==o&&"function"!=typeof o)throw new TypeError('"onHidden" must be a function if provided.');let i="",a="";const s=()=>{e.classList.remove(t),e.classList.remove(r)};let l=null;const u=["visibilitychange","mozvisibilitychange","webkitvisibilitychange","msvisibilitychange"],c=["hidden","mozHidden","webkitHidden","msHidden"];for(let e=0;e<c.length;e++)if(c[e]in document){l=c[e];break}const d=function(u){s();const c=u?.type,d=l&&document[l];["focus","focusin","pageshow"].includes(c)?(e.classList.add(r),n?.({type:c,oldClass:a,oldType:i}),a=r):["blur","focusout","pagehide"].includes(c)||d?(e.classList.add(t),o?.({type:c,oldClass:a,oldType:i}),a=t):(e.classList.add(r),n?.({type:c,oldClass:a,oldType:i}),a=r),i=c};let f=()=>{};if(l){const e=u[c.indexOf(l)];document.addEventListener(e,d),window.addEventListener("focus",d),window.addEventListener("blur",d),f=()=>{document.removeEventListener(e,d),window.removeEventListener("focus",d),window.removeEventListener("blur",d),s()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=d,f=()=>{document.onfocusin=document.onfocusout=null,s()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=d,f=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,s()});const m=new Event(l&&document[l]?"blur":"focus");return d(m),f}e.r(t),e.d(t,{addAiMarkerShortcut:()=>X,areElsCollBottom:()=>Z,areElsCollLeft:()=>_,areElsCollPerfBottom:()=>te,areElsCollPerfLeft:()=>re,areElsCollPerfRight:()=>ne,areElsCollPerfTop:()=>ee,areElsCollRight:()=>Q,areElsCollTop:()=>V,areElsColliding:()=>oe,areElsPerfColliding:()=>ie,arraySortPositions:()=>o,asyncReplace:()=>q,breakdownDuration:()=>u,calculateMarketcap:()=>H,cloneObjTypeOrder:()=>F,compareMarketcap:()=>W,countObj:()=>c,diffArrayList:()=>n,diffStrings:()=>K,documentIsFullScreen:()=>S,exitFullScreen:()=>I,extendObjType:()=>N,extractMediaId3Tags:()=>ve,fetchJson:()=>w,fetchText:()=>b,formatBytes:()=>U,formatCustomTimer:()=>a,formatDayTimer:()=>l,formatTimer:()=>s,genFibonacciSeq:()=>Y,getAge:()=>$,getElsCollDetails:()=>me,getElsCollDirDepth:()=>fe,getElsCollOverlap:()=>le,getElsCollOverlapPos:()=>ue,getElsColliding:()=>ae,getElsPerfColliding:()=>se,getElsRelativeCenterOffset:()=>de,getPercentage:()=>B,getRectCenter:()=>ce,getSimplePerc:()=>j,getTimeDuration:()=>i,installWindowHiddenScript:()=>E,isFullScreenMode:()=>D,isJsonObject:()=>d,isScreenFilled:()=>C,objType:()=>k,offFullScreenChange:()=>P,onFullScreenChange:()=>x,parseMediaMetadata:()=>Te,readBase64Blob:()=>m,readFileBlob:()=>f,readJsonBlob:()=>p,reorderObjTypeOrder:()=>M,requestFullScreen:()=>A,ruleOfThree:()=>R,safeTextTrim:()=>G,saveJsonFile:()=>h,shuffleArray:()=>r,toTitleCase:()=>z,toTitleCaseLowerFirst:()=>J,valMediaContentMetadata:()=>be,valMediaContentMetadataPartial:()=>Ee});const v="undefined"!=typeof window&&void 0!==window.document,T={items:{},order:[]};function N(e,t){const r=[],n=Array.isArray(e)?e:Object.entries(e);for(const[e,o]of n)if(!T.items.hasOwnProperty(e)){T.items[e]=o;let n="number"==typeof t?t:-1;if(-1===n){const e=T.order.indexOf("object");n=e>-1?e:T.order.length}n=Math.min(Math.max(0,n),T.order.length),T.order.splice(n,0,e),r.push(e)}return r}function M(e){const t=[...T.order];return!!e.every(e=>t.includes(e))&&(T.order=e.slice(),!0)}function F(){return[...T.order]}const L=e=>{if(null===e)return"null";for(const t of T.order)if("function"!=typeof T.items[t]||T.items[t](e))return t;return"unknown"};function k(e,t){if(void 0===e)return null;const r=L(e);return"string"==typeof t?r===t.toLowerCase():r}N([["undefined",e=>void 0===e],["null",e=>null===e],["boolean",e=>"boolean"==typeof e],["number",e=>"number"==typeof e&&!Number.isNaN(e)],["bigint",e=>"bigint"==typeof e],["string",e=>"string"==typeof e],["symbol",e=>"symbol"==typeof e],["function",e=>"function"==typeof e],["array",e=>Array.isArray(e)]]),v&&N([["file",e=>"undefined"!=typeof File&&e instanceof File]]),N([["date",e=>e instanceof Date],["regexp",e=>e instanceof RegExp],["map",e=>e instanceof Map],["set",e=>e instanceof Set],["weakmap",e=>e instanceof WeakMap],["weakset",e=>e instanceof WeakSet],["promise",e=>e instanceof Promise]]),v&&N([["htmlelement",e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement]]),N([["object",e=>d(e)]]);const S=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),C=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,D=()=>S()||C(),A=e=>new Promise(async(t,r)=>{const n=document.documentElement;try{n.requestFullscreen?await n.requestFullscreen(e):n.mozRequestFullScreen?n.mozRequestFullScreen(e):n.webkitRequestFullScreen?n.webkitRequestFullScreen(e):n.msRequestFullscreen&&n.msRequestFullscreen(e),t()}catch(e){r(e)}}),I=()=>new Promise((e,t)=>{if(document.exitFullscreen)document.exitFullscreen().then(e).catch(t);else try{if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitCancelFullScreen)document.webkitCancelFullScreen();else{if(!document.msExitFullscreen)throw new Error("Fullscreen API is not supported");document.msExitFullscreen()}e()}catch(e){t(e)}}),O=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],x=(e,t)=>{O.forEach(r=>{document.addEventListener(r,e,t)})},P=(e,t)=>{O.forEach(r=>{document.removeEventListener(r,e,t)})};function R(e,t,r,n=!1){return n?Number(e*t)/r:Number(r*t)/e}function j(e,t){return e*(t/100)}function B(e,t){return 0===t?0:e/t*100}function $(e=0,t=null){if(null!=e&&0!==e){const r=new Date(e);if(Number.isNaN(r.getTime()))return null;const n=t instanceof Date?t:new Date;let o=n.getFullYear()-r.getFullYear();const i=n.getMonth(),a=r.getMonth(),s=n.getDate(),l=r.getDate();return(i<a||i===a&&s<l)&&o--,Math.abs(o)}return null}function U(e,t=null,r=null){if("number"!=typeof e||e<0)return{unit:null,value:null};if(0===e)return{unit:"Bytes",value:0};const n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=r&&n.includes(r)?n.indexOf(r):n.length-1,i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),o);let a=e/Math.pow(1024,i);if(null!==t){const e=t<0?0:t;a=parseFloat(a.toFixed(e))}return{unit:n[i],value:a}}function Y({baseValues:e=[0,1],length:t=10,combiner:r=(e,t)=>e+t}={}){if(!Array.isArray(e)||2!==e.length)throw new Error("baseValues must be an array of exactly two numbers");const n=[...e.slice(0,2)];for(let e=2;e<t;e++){const t=r(n[e-2],n[e-1],e);n.push(t)}return n}function H(e,t){if(Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Original market cap must be a number.");if(Number.isNaN(t)||!Number.isFinite(t))throw new TypeError("Circulating supply must be a number.");if(t<=0)throw new Error("Circulating supply must be greater than zero.");return e/t}function W(e,t,r){if(Number.isNaN(r)||!Number.isFinite(r))throw new TypeError("New market cap must be a number.");const n=H(e,t),o="number"==typeof r?r/t:NaN;return{originalPrice:n,newPrice:o,priceChangePercent:"number"==typeof r?(o-n)/n*100:NaN}}async function q(e,t,r){const n=[];e.replace(t,(e,...t)=>(n.push(r(e,...t)),e));const o=await Promise.all(n);return e.replace(t,()=>o.shift())}function z(e){return e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())}function J(e){const t=e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase());return t.charAt(0).toLowerCase()+t.slice(1)}function X({key:e="a",className:t="detect-made-by-ai"}={}){if("undefined"==typeof HTMLElement)throw new Error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.");const r=function(r){if(r.ctrlKey&&r.altKey&&r.key.toLowerCase()===e){if(r.preventDefault(),!document.body)return void console.warn("[AiMarkerShortcut] <body> element not found. Cannot toggle class. Ensure the DOM is fully loaded when using the shortcut.");document.body.classList.toggle(t)}};return document.addEventListener("keydown",r),r}function G(e,t,r=.6){if("string"!=typeof e)throw new TypeError("Expected a string for 'text', but received "+typeof e);if(!Number.isInteger(t)||t<=0)throw new TypeError(`Expected 'limit' to be a positive integer, but received ${t}`);if("number"!=typeof r||r<0||r>1)throw new TypeError(`Expected 'safeCutZone' to be a number between 0 and 1, but received ${r}`);let n=e.trim();if(n.length>t){const e=n.lastIndexOf(" ",t);return e>0&&e>=t*r?`${n.substring(0,e).trim()}...`:`${n.substring(0,t).trim()}...`}return n}function K(e,t){const r={added:{},removed:{},modified:{}};for(const n in e)n in t?e[n]!==t[n]&&(r.modified[n]={old:e[n],new:t[n]}):r.removed[n]=e[n];for(const n in t)n in e||(r.added[n]=t[n]);return r}const V=(e,t)=>e.bottom<t.top,Z=(e,t)=>e.top>t.bottom,_=(e,t)=>e.right<t.left,Q=(e,t)=>e.left>t.right,ee=(e,t)=>e.bottom<=t.top,te=(e,t)=>e.top>=t.bottom,re=(e,t)=>e.right<=t.left,ne=(e,t)=>e.left>=t.right,oe=(e,t)=>!(_(e,t)||Q(e,t)||V(e,t)||Z(e,t)),ie=(e,t)=>!(re(e,t)||ne(e,t)||ee(e,t)||te(e,t)),ae=(e,t)=>_(e,t)?"left":Q(e,t)?"right":V(e,t)?"top":Z(e,t)?"bottom":null,se=(e,t)=>re(e,t)?"left":ne(e,t)?"right":ee(e,t)?"top":te(e,t)?"bottom":null,le=(e,t)=>({overlapLeft:t.right-e.left,overlapRight:e.right-t.left,overlapTop:t.bottom-e.top,overlapBottom:e.bottom-t.top}),ue=({overlapLeft:e=-1,overlapRight:t=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:e<t?"right":"left",dirY:r<n?"bottom":"top"}),ce=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function de(e,t){const r=e.left+e.width/2,n=e.top+e.height/2;return{x:t.left+t.width/2-r,y:t.top+t.height/2-n}}function fe(e,t){if(!ie(e,t))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=le(e,t),{dirX:a,dirY:s}=ue({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),l=Math.min(r,n),u=Math.min(o,i);let c;return c=l<u?a:s,{inDir:c,dirX:a,dirY:s,depthX:l,depthY:u}}function me(e,t){const r=ie(e,t),n={in:null,x:null,y:null},o={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:a,overlapRight:s,overlapTop:l,overlapBottom:u}=le(t,e);i.top=l,i.bottom=u,i.left=a,i.right=s;const c=Object.entries(i).filter(([,e])=>e>0).sort((e,t)=>e[1]-t[1]),{dirX:d,dirY:f}=ue({overlapLeft:s,overlapRight:a,overlapTop:u,overlapBottom:l});return n.y=f,n.x=d,i.bottom<0?o.y="bottom":i.top<0&&(o.y="top"),i.left<0?o.x="left":i.right<0&&(o.x="right"),n.in=r?i.top===i.bottom&&i.bottom===i.left&&i.left===i.right?"center":c.length?c[0][0]:"top":null,{dirs:n,depth:i,isNeg:o}}const pe=new Map;class he extends Error{constructor(e,t,r){super(e),this.name="MediaLoadingError",this.url=t,this.stage=r}}const ge=async e=>{const t=(new TextEncoder).encode(e),r=await crypto.subtle.digest("SHA-1",t);return Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join("").substring(0,8)},ye=(e,t="image/jpeg")=>{const r=e=>{const t=URL.createObjectURL(e),r=pe.get(t);return pe.set(t,"number"==typeof r?r+1:1),t};if(e instanceof Uint8Array)return r(new Blob([e],{type:t}));if("string"==typeof e&&e.startsWith("data:")){const n=e.split(",")[1],o=atob(n),i=new Uint8Array(o.length);for(let e=0;e<o.length;e++)i[e]=o.charCodeAt(e);return r(new Blob([i],{type:t}))}return"string"==typeof e?e:""},we=(e,t)=>{const r=e=>t&&void 0===e,n=e=>r(e)||"string"==typeof e||null===e,o=(e,t)=>!!r(e)||!(!Array.isArray(e)||!e.every(t));if(!n(e.title))throw new TypeError('Invalid metadata: "title" must be a string or null.');if(!n(e.album))throw new TypeError('Invalid metadata: "album" must be a string or null.');if(!n(e.albumartist))throw new TypeError('Invalid metadata: "albumartist" must be a string or null.');if(!n(e.artist))throw new TypeError('Invalid metadata: "artist" must be a string or null.');if(i=e.year,!r(i)&&"number"!=typeof i&&null!==i)throw new TypeError('Invalid metadata: "year" must be a number or null.');var i;if(!o(e.albumartists,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "albumartists" must be an array of string.');if(!o(e.genre,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "genre" must be an array of string.');if(!o(e.label,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "label" must be an array of string.');if(!o(e.composer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "composer" must be an array of string.');if(!o(e.artists,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "artists" must be an array of string.');if(!o(e.picture,e=>!(void 0!==e.description&&"string"!=typeof e.description||void 0!==e.name&&"string"!=typeof e.name||void 0!==e.type&&"string"!=typeof e.type||"string"!=typeof e.format||!(e.data instanceof Uint8Array||"string"==typeof e.data))))throw new TypeError('Invalid metadata: "picture" must be an array of pictures.');const a=(e,t)=>{if(!r(e)){if(null==e)throw new TypeError(`Invalid metadata: "${t}" is required.`);if("object"!=typeof e)throw new TypeError(`Invalid metadata: "${t}" must be an object or null.`);if("number"!=typeof e.no&&null!==e.no)throw new TypeError(`Invalid metadata: "${t}.no" must be a number or null.`);if("number"!=typeof e.of&&null!==e.of)throw new TypeError(`Invalid metadata: "${t}.of" must be a number or null.`)}};a(e.disk,"disk"),a(e.track,"track")},be=e=>we(e,!1),Ee=e=>we(e,!0),ve=async(e,t)=>{if("string"!=typeof e)throw new TypeError(`Expected url to be a string, but received ${typeof e}.`);if("function"!=typeof t)throw new TypeError(`Expected parseFile to be a function, but received ${typeof t}.`);try{const r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch audio file: ${r.status} ${r.statusText}`);const n=await r.blob(),o=await t(n);if(!o||"object"!=typeof o.common)throw new TypeError('Invalid metadata: "common" property is missing or not an object.');const i=o.common;return Ee(i),{title:i?.title??null,album:i?.album??null,albumartist:i?.albumartist??null,albumartists:i?.albumartists??[],genre:i?.genre??[],label:i?.label??[],composer:i?.composer??[],year:i?.year??null,artist:i?.artist??null,artists:i?.artists??[],disk:i?.disk?{no:i.disk.no,of:i.disk.of}:{no:null,of:null},track:i?.track?{no:i.track.no,of:i.track.of}:{no:null,of:null},picture:i?.picture?.map(e=>({...e,data:ye(e.data,e.format)}))??[]}}catch(e){throw e}},Te=async(e,t={},r={},n=e=>new Promise((e,t)=>t(new TypeError("parseFile library not found."))),o={},i="null")=>{if("string"!=typeof e&&!(e instanceof HTMLMediaElement))throw new TypeError("Source must be a string or an HTMLMediaElement.");if(o.onProgress&&"function"!=typeof o.onProgress)throw new TypeError("callbacks.onProgress must be a function.");if(o.onError&&"function"!=typeof o.onError)throw new TypeError("callbacks.onError must be a function.");let a,s="";const l=(t,r)=>{o.onProgress&&o.onProgress({event:r,status:"loading",stage:t,url:s||(e instanceof HTMLMediaElement?e.src:"unknown")})},u=(t,r)=>{o.onError&&o.onError({error:t,url:s||(e instanceof HTMLMediaElement?e.src:"unknown"),stage:r})};try{l("INITIALIZING"),"string"==typeof e?(s=e,a=new Audio(s)):(a=e,s=a.src);try{await new Promise((e,t)=>{const r=e=>l("DOWNLOADING",e),n=()=>{i(),e(void 0)},o=e=>{i(),t(new Error(`HTMLMediaElement failed to load: ${e.message||"Unknown error"}`))},i=()=>{a.removeEventListener("progress",r),a.removeEventListener("loadedmetadata",n),a.removeEventListener("error",o)};a.addEventListener("progress",r),a.addEventListener("loadedmetadata",n),a.addEventListener("error",o),a.readyState>=1&&(i(),e(void 0))}),l("METADATA_LOADED")}catch(e){throw new he(e instanceof Error?e.message:"UNKNOWN ERROR",s,"METADATA")}const c={id:r.id||await ge(s),duration:Math.floor(1e3*a.duration),url:s,weight:r.weight??1};let d={};l("EXTRACTING_ID3");try{d=await ve(s,n)}catch(e){u(e instanceof Error?e:new Error("Unknown Error"),"ID3"),console.warn(`[TinyAudioUtils] ID3 extraction failed for ${s}. Falling back to filename.`)}const f=e=>{try{return(e.split(/[?#]/)[0].split("/").pop()??"").replace(/\.[^/.]+$/,"")||"Unknown Track"}catch{return"Unknown Track"}},m={...c,...t,...d,...r,title:d.title||r.title||f(s),artist:d.artist||r.artist||("string"==typeof i?i:String(i()))};return o.onProgress&&o.onProgress({status:"success",stage:"COMPLETE",url:s}),m}catch(e){if(e instanceof he)throw e;{const t=new he(e instanceof Error?e.message:"UNKNOWN ERROR",s,"INITIALIZING");throw u(t,"INITIALIZING"),t}}};window.TinyBasicsEs=t})();
1
+ (()=>{"use strict";const e={d:(t,r)=>{if(Array.isArray(r))for(var n=0;n<r.length;){var o=r[n++],i=r[n++];e.o(t,o)?0===i&&n++:0===i?Object.defineProperty(t,o,{enumerable:!0,value:r[n++]}):Object.defineProperty(t,o,{enumerable:!0,get:i})}else for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};function r(e){if(!Array.isArray(e))throw new TypeError("Argument 'items' must be an array.");let t,r=e.length;for(;0!==r;)t=Math.floor(Math.random()*r),r--,[e[r],e[t]]=[e[t],e[r]];return e}function n(e,t){if(!Array.isArray(e))throw new TypeError("Argument 'phases' must be an array.");if(!Array.isArray(t))throw new TypeError("Argument 'counts' must be an array.");if(e.length!==t.length)throw new RangeError("The 'phases' and 'counts' arrays must have the same length.");const r=[];for(let n=0;n<e.length;n++){if("number"!=typeof t[n]||Number.isNaN(t[n]))throw new TypeError(`Element at counts[${n}] must be a valid number.`);for(let o=0;o<t[n];o++)r.push(e[n])}return r}function o(e,t){if(!Array.isArray(e))throw new TypeError("Argument 'oldItems' must be an array.");if(!Array.isArray(t))throw new TypeError("Argument 'newItems' must be an array.");const r=e.filter(e=>!t.includes(e));return{added:t.filter(t=>!e.includes(t)),removed:r}}function i(e,t=!1){if(null!=e&&"string"!=typeof e)throw new TypeError("Argument 'item' must be a string or null.");if("boolean"!=typeof t)throw new TypeError("Argument 'isReverse' must be a boolean.");return t?function(t,r){return(e?t[e]:t)>(e?r[e]:r)?-1:(e?t[e]:t)<(e?r[e]:r)?1:0}:function(t,r){return(e?t[e]:t)<(e?r[e]:r)?-1:(e?t[e]:t)>(e?r[e]:r)?1:0}}function a(e=new Date,t="asSeconds",r=null){if(!(e instanceof Date))throw new TypeError("The 'timeData' argument must be an instance of Date.");if("string"!=typeof t)throw new TypeError("The 'durationType' argument must be a string.");const n=["asMilliseconds","asSeconds","asMinutes","asHours","asDays"];if(!n.includes(t))throw new RangeError(`The 'durationType' must be one of: ${n.join(", ")}.`);if(null!==r&&!(r instanceof Date))throw new TypeError("The 'now' argument must be an instance of Date or null.");const o=r instanceof Date?r:new Date,i=e.getTime()-o.getTime();switch(t){case"asMilliseconds":return i;case"asSeconds":default:return i/1e3;case"asMinutes":return i/6e4;case"asHours":return i/36e5;case"asDays":return i/864e5}}function s(e,t="seconds",r="{time}"){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'totalSeconds' argument must be a valid number.");if("string"!=typeof t)throw new TypeError("The 'level' argument must be a string.");const n=["seconds","minutes","hours","days","months","years"];if(!n.includes(t))throw new RangeError(`The 'level' must be one of: ${n.join(", ")}.`);if("string"!=typeof r)throw new TypeError("The 'format' argument must be a string.");e=Math.max(0,Math.floor(e));const o=n.indexOf(t),i=o>=5,a=o>=4,s=o>=3,l=o>=2,u=o>=1,c=o>=0,f={years:i?0:NaN,months:a?0:NaN,days:s?0:NaN,hours:l?0:NaN,minutes:u?0:NaN,seconds:c?0:NaN,total:NaN};let m=e;if(i||a||s){const e=new Date(1980,0,1),t=new Date(e.getTime()+1e3*m),r=new Date(e);if(i)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),f.years++;if(a)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),f.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),f.days++;m=Math.floor((t.getTime()-r.getTime())/1e3)}l&&(f.hours=Math.floor(m/3600),m%=3600),u&&(f.minutes=Math.floor(m/60),m%=60),c&&(f.seconds=m),f.total=+e.toFixed(2).replace(/\.00$/,"");const p=e=>{const t="string"==typeof e?parseInt(e):e;return Number.isNaN(t)?"NaN":String(t).padStart(2,"0")},d=[l?p(f.hours):null,u?p(f.minutes):null,c?p(f.seconds):null].filter(e=>null!==e).join(":");return r.replace(/\{years\}/g,String(f.years)).replace(/\{months\}/g,String(f.months)).replace(/\{days\}/g,String(f.days)).replace(/\{hours\}/g,p(f.hours)).replace(/\{minutes\}/g,p(f.minutes)).replace(/\{seconds\}/g,p(f.seconds)).replace(/\{time\}/g,d).replace(/\{total\}/g,String(f.total)).trim()}function l(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'seconds' argument must be a valid number.");return s(e,"hours","{hours}:{minutes}:{seconds}")}function u(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'seconds' argument must be a valid number.");return s(e,"days","{days}d {hours}:{minutes}:{seconds}")}function c(e,t="milliseconds"){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("The 'totalMs' argument must be a valid number.");if("string"!=typeof t)throw new TypeError("The 'level' argument must be a string.");const r=["milliseconds","seconds","minutes","hours","days","months","years"];if(!r.includes(t))throw new RangeError(`The 'level' must be one of: ${r.join(", ")}.`);e=Math.max(0,Math.floor(e));const n=r.indexOf(t),o=n>=6,i=n>=5,a=n>=4,s=n>=3,l=n>=2,u=n>=1,c=n>=0,f={years:o?0:NaN,months:i?0:NaN,days:a?0:NaN,hours:s?0:NaN,minutes:l?0:NaN,seconds:u?0:NaN,milliseconds:c?0:NaN,total:NaN};let m=e;if(o||i||a){const e=new Date(1980,0,1),t=new Date(e.getTime()+m),r=new Date(e);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),f.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),f.months++;if(a)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),f.days++;m=t.getTime()-r.getTime()}return s&&(f.hours=Math.floor(m/36e5),m%=36e5),l&&(f.minutes=Math.floor(m/6e4),m%=6e4),u&&(f.seconds=Math.floor(m/1e3),m%=1e3),c&&(f.milliseconds=m),f.total=+e,f}function f(e){if(!Array.isArray(e)&&!m(e))throw new TypeError("Argument must be either an Array or a pure JSON Object.");return Array.isArray(e)?e.length:Object.keys(e).length}function m(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e)}function p(e,t){if(!(e instanceof Blob))return Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'));const r=["readAsArrayBuffer","readAsDataURL","readAsText","readAsBinaryString"];return"string"==typeof t&&r.includes(t)?new Promise((r,n)=>{const o=new FileReader;o.onload=()=>{try{r(o.result)}catch(e){n(e)}},o.onerror=()=>{n(o.error)},o[t](e)}):Promise.reject(new TypeError(`The "method" argument must be one of: ${r.join(", ")}.`))}function d(e,t=!1){return e instanceof Blob?"string"!=typeof t&&"boolean"!=typeof t?Promise.reject(new TypeError("The isDataUrl parameter must be a boolean or a string.")):new Promise((r,n)=>{p(e,"readAsDataURL").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const n=e.match(/^data:(.+);base64,(.*)$/);if(!n||!n[2])throw new Error("Invalid data URL format or missing Base64 content.");const[,o,i]=n;if(!/^[\w/+]+=*$/.test(i))throw new Error("Base64 content is malformed.");if("boolean"==typeof t)return r(t?e:i);if(!/^[\w-]+\/[\w.+-]+$/.test(t))throw new Error(`Invalid MIME type string: ${t}`);return r(`data:${t};base64,${i}`)}).catch(n)}):Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'))}function y(e){return e instanceof Blob?new Promise((t,r)=>p(e,"readAsText").then(e=>{if("string"!=typeof e)throw new TypeError("Expected file content to be a string.");const r=e.trim();if(0===r.length)throw new Error("File is empty or contains only whitespace.");const n=JSON.parse(r);if("object"!=typeof n||null===n)throw new Error("Parsed content is not a valid JSON object or array.");t(n)}).catch(r)):Promise.reject(new TypeError('The "file" argument must be an instance of Blob or File.'))}function w(e,t,r=2){if("string"!=typeof e)throw new TypeError('The "filename" argument must be a string.');if("number"!=typeof r||!Number.isInteger(r)||r<0)throw new TypeError('The "spaces" argument must be a non-negative integer.');const n=JSON.stringify(t,null,r),o=new Blob([n],{type:"application/json"}),i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function b(e,t,r=e=>({headers:e.headers,status:e.status,statusText:e.statusText})){if(!(e instanceof Response))throw new TypeError('The "response" argument must be an instance of Response.');if("function"!=typeof t)throw new TypeError('The "onProgress" argument must be a function.');if(!e.body)return e;const n=e.headers.get("content-length"),o=n?parseInt(n,10):0;let i=0;const a=e.body.getReader(),s=new ReadableStream({async start(e){for(;;){const{done:r,value:n}=await a.read();if(r)break;i+=n.byteLength,t(i,o),e.enqueue(n)}e.close()}});return new Response(s,r(e))}async function g(e,t,r){return"string"!=typeof e?Promise.reject(new TypeError('The "url" argument must be a string.')):void 0!==t&&"object"!=typeof t?Promise.reject(new TypeError('The "options" argument must be an object.')):void 0!==r&&"function"!=typeof r?Promise.reject(new TypeError('The "onProgress" option must be a function.')):new Promise((n,o)=>{fetch(e,t??void 0).then(async e=>{const t=r?b(e,r):e,o=t.headers.get("content-type")||"";if(!o.includes("application/json"))throw new Error(`Unexpected content-type: ${o}`);const i=await t.json();if(!Array.isArray(i)&&!m(i))throw new Error("Received invalid data instead of valid JSON.");return n(i)}).catch(o)})}async function h(e,t,r,n){return"string"!=typeof e?Promise.reject(new TypeError('The "url" argument must be a string.')):void 0===t||Array.isArray(t)?void 0!==r&&"object"!=typeof r?Promise.reject(new TypeError('The "options" argument must be an object.')):void 0!==n&&"function"!=typeof n?Promise.reject(new TypeError('The "onProgress" option must be a function.')):new Promise((o,i)=>{fetch(e,r??void 0).then(async e=>{const r=n?b(e,n):e,i=r.headers.get("content-type")||"";if(Array.isArray(t)&&t.length>0&&!t.some(e=>i.includes(e)))throw new Error(`Blocked MIME type: ${i}`);const a=await r.text();return o(a)}).catch(i)}):Promise.reject(new TypeError('The "allowedMimeTypes" argument must be an array of strings.'))}function E(e={}){if(null===e||"object"!=typeof e)throw new TypeError('The "settings" argument must be an object.');const{element:t=document.body,hiddenClass:r="windowHidden",visibleClass:n="windowVisible",onVisible:o,onHidden:i}=e;if(!(t instanceof Element))throw new TypeError('"element" must be an instance of Element.');if("string"!=typeof r)throw new TypeError('"hiddenClass" must be a string.');if("string"!=typeof n)throw new TypeError('"visibleClass" must be a string.');if(void 0!==o&&"function"!=typeof o)throw new TypeError('"onVisible" must be a function if provided.');if(void 0!==i&&"function"!=typeof i)throw new TypeError('"onHidden" must be a function if provided.');let a="",s="";const l=()=>{t.classList.remove(r),t.classList.remove(n)};let u=null;const c=["visibilitychange","mozvisibilitychange","webkitvisibilitychange","msvisibilitychange"],f=["hidden","mozHidden","webkitHidden","msHidden"];for(let e=0;e<f.length;e++)if(f[e]in document){u=f[e];break}const m=function(e){l();const c=e?.type,f=u&&document[u];["focus","focusin","pageshow"].includes(c)?(t.classList.add(n),o?.({type:c,oldClass:s,oldType:a}),s=n):["blur","focusout","pagehide"].includes(c)||f?(t.classList.add(r),i?.({type:c,oldClass:s,oldType:a}),s=r):(t.classList.add(n),o?.({type:c,oldClass:s,oldType:a}),s=n),a=c};let p=()=>{};if(u){const e=c[f.indexOf(u)];document.addEventListener(e,m),window.addEventListener("focus",m),window.addEventListener("blur",m),p=()=>{document.removeEventListener(e,m),window.removeEventListener("focus",m),window.removeEventListener("blur",m),l()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=m,p=()=>{document.onfocusin=document.onfocusout=null,l()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=m,p=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,l()});const d=new Event(u&&document[u]?"blur":"focus");return m(d),p}e.r(t),e.d(t,{addAiMarkerShortcut:()=>W,areElsCollBottom:()=>_,areElsCollLeft:()=>Q,areElsCollPerfBottom:()=>re,areElsCollPerfLeft:()=>ne,areElsCollPerfRight:()=>oe,areElsCollPerfTop:()=>te,areElsCollRight:()=>ee,areElsCollTop:()=>Z,areElsColliding:()=>ie,areElsPerfColliding:()=>ae,arraySortPositions:()=>i,asyncReplace:()=>z,breakdownDuration:()=>c,calculateMarketcap:()=>H,cloneObjTypeOrder:()=>M,compareMarketcap:()=>q,countObj:()=>f,diffArrayList:()=>o,diffObjList:()=>G,diffStrings:()=>K,documentIsFullScreen:()=>j,exitFullScreen:()=>S,extendObjType:()=>N,extractMediaId3Tags:()=>Me,fetchJson:()=>g,fetchText:()=>h,formatBytes:()=>U,formatCustomTimer:()=>s,formatDayTimer:()=>u,formatTimer:()=>l,genFibonacciSeq:()=>Y,getAge:()=>$,getElsCollDetails:()=>de,getElsCollDirDepth:()=>pe,getElsCollOverlap:()=>ue,getElsCollOverlapPos:()=>ce,getElsColliding:()=>se,getElsPerfColliding:()=>le,getElsRelativeCenterOffset:()=>me,getPercentage:()=>B,getRectCenter:()=>fe,getSimplePerc:()=>R,getTimeDuration:()=>a,installWindowHiddenScript:()=>E,isFullScreenMode:()=>k,isJsonObject:()=>m,isScreenFilled:()=>D,multiplyArrayBlocks:()=>n,objType:()=>x,offFullScreenChange:()=>I,onFullScreenChange:()=>C,parseMediaMetadata:()=>Fe,readBase64Blob:()=>d,readFileBlob:()=>p,readJsonBlob:()=>y,reorderObjTypeOrder:()=>A,requestFullScreen:()=>L,ruleOfThree:()=>O,safeTextTrim:()=>X,saveJsonFile:()=>w,shuffleArray:()=>r,toTitleCase:()=>J,toTitleCaseLowerFirst:()=>V,valMediaContentMetadata:()=>Ne,valMediaContentMetadataPartial:()=>Ae});const T="undefined"!=typeof window&&void 0!==window.document,v={items:{},order:[]};function N(e,t){if("object"!=typeof e||null===e)throw new TypeError("Argument 'newItems' must be an object or an array.");if(void 0!==t&&"number"!=typeof t)throw new TypeError("Argument 'index' must be a number.");const r=[],n=Array.isArray(e)?e:Object.entries(e);for(const e of n){if(!Array.isArray(e)||e.length<2)throw new TypeError("Each item in 'newItems' array must be a [key, function] pair.");const[n,o]=e;if("string"!=typeof n)throw new TypeError("Validator key must be a string.");if("function"!=typeof o)throw new TypeError(`Validator for key '${n}' must be a function.`);if(!v.items.hasOwnProperty(n)){v.items[n]=o;let e="number"==typeof t?t:-1;if(-1===e){const t=v.order.indexOf("object");e=t>-1?t:v.order.length}e=Math.min(Math.max(0,e),v.order.length),v.order.splice(e,0,n),r.push(n)}}return r}function A(e){if(!Array.isArray(e))throw new TypeError("Argument 'newOrder' must be an array of strings.");if(!e.every(e=>"string"==typeof e))throw new TypeError("All elements in 'newOrder' must be strings.");const t=[...v.order];return!!e.every(e=>t.includes(e))&&(v.order=e.slice(),!0)}function M(){return[...v.order]}const F=e=>{if(null===e)return"null";for(const t of v.order)if("function"!=typeof v.items[t]||v.items[t](e))return t;return"unknown"};function x(e,t){if(void 0===e)return null;if(void 0!==t&&"string"!=typeof t)throw new TypeError("Argument 'type' must be a string.");const r=F(e);return"string"==typeof t?r===t.toLowerCase():r}N([["undefined",e=>void 0===e],["null",e=>null===e],["boolean",e=>"boolean"==typeof e],["number",e=>"number"==typeof e&&!Number.isNaN(e)],["bigint",e=>"bigint"==typeof e],["string",e=>"string"==typeof e],["symbol",e=>"symbol"==typeof e],["function",e=>"function"==typeof e],["array",e=>Array.isArray(e)]]),T&&N([["file",e=>"undefined"!=typeof File&&e instanceof File]]),N([["date",e=>e instanceof Date],["regexp",e=>e instanceof RegExp],["map",e=>e instanceof Map],["set",e=>e instanceof Set],["weakmap",e=>e instanceof WeakMap],["weakset",e=>e instanceof WeakSet],["promise",e=>e instanceof Promise]]),T&&N([["htmlelement",e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement]]),N([["object",e=>m(e)]]);const j=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),D=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,k=()=>j()||D(),L=e=>new Promise(async(t,r)=>{const n=document.documentElement;try{n.requestFullscreen?await n.requestFullscreen(e):n.mozRequestFullScreen?n.mozRequestFullScreen(e):n.webkitRequestFullScreen?n.webkitRequestFullScreen(e):n.msRequestFullscreen&&n.msRequestFullscreen(e),t()}catch(e){r(e)}}),S=()=>new Promise((e,t)=>{if(document.exitFullscreen)document.exitFullscreen().then(e).catch(t);else try{if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitCancelFullScreen)document.webkitCancelFullScreen();else{if(!document.msExitFullscreen)throw new Error("Fullscreen API is not supported");document.msExitFullscreen()}e()}catch(e){t(e)}}),P=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],C=(e,t)=>{P.forEach(r=>{document.addEventListener(r,e,t)})},I=(e,t)=>{P.forEach(r=>{document.removeEventListener(r,e,t)})};function O(e,t,r,n=!1){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("val1 must be a finite number.");if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("val2 must be a finite number.");if("number"!=typeof r||!Number.isFinite(r))throw new TypeError("val3 must be a finite number.");if("boolean"!=typeof n)throw new TypeError("inverse must be a boolean.");return n?Number(e*t)/r:Number(r*t)/e}function R(e,t){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("price must be a finite number.");if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("percentage must be a finite number.");return e*(t/100)}function B(e,t){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("part must be a finite number.");if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("total must be a finite number.");return 0===t?0:e/t*100}function $(e=0,t=null){if("number"!=typeof e&&"string"!=typeof e&&!(e instanceof Date))throw new TypeError("timeData must be a number, string, or Date object.");if(null!==t&&!(t instanceof Date))throw new TypeError("now must be a Date object or null.");const r=new Date(e);if(Number.isNaN(r.getTime()))return null;const n=t instanceof Date?t:new Date;let o=n.getFullYear()-r.getFullYear();const i=n.getMonth(),a=r.getMonth(),s=n.getDate(),l=r.getDate();return(i<a||i===a&&s<l)&&o--,Math.abs(o)}function U(e,t=null,r=null){if("number"!=typeof e||!Number.isFinite(e)||e<0)throw new TypeError("bytes must be a positive number.");if(0===e)return{unit:"Bytes",value:0};if(null!==t&&("number"!=typeof t||!Number.isFinite(t)))throw new TypeError("decimals must be a number or null.");const n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];if(null!==r){if("string"!=typeof r)throw new TypeError("maxUnit must be a string or null.");if(!n.includes(r))throw new RangeError(`maxUnit must be one of: ${n.join(", ")}`)}const o=r&&n.includes(r)?n.indexOf(r):n.length-1,i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),o);let a=e/Math.pow(1024,i);if(null!==t){const e=t<0?0:t;a=parseFloat(a.toFixed(e))}return{unit:n[i],value:a}}function Y({baseValues:e=[0,1],length:t=10,combiner:r=(e,t)=>e+t}={}){if(!Array.isArray(e)||2!==e.length||!e.every(e=>"number"==typeof e))throw new Error("baseValues must be an array of exactly two numbers.");if("number"!=typeof t||!Number.isInteger(t))throw new RangeError("length must be an integer.");if("function"!=typeof r)throw new TypeError("combiner must be a function.");const n=[...e.slice(0,2)];for(let e=2;e<t;e++){const t=r(n[e-2],n[e-1],e);n.push(t)}return n}function H(e,t){if("number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Original market cap must be a finite number.");if("number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t))throw new TypeError("Circulating supply must be a finite number.");if(t<=0)throw new RangeError("Circulating supply must be greater than zero.");return e/t}function q(e,t,r){if("number"!=typeof r||Number.isNaN(r)||!Number.isFinite(r))throw new TypeError("New market cap must be a finite number.");const n=H(e,t),o="number"==typeof r?r/t:NaN;return{originalPrice:n,newPrice:o,priceChangePercent:"number"==typeof r?(o-n)/n*100:NaN}}async function z(e,t,r){if("string"!=typeof e)throw new TypeError("Expected a string for 'str', but received "+typeof e);if(!(t instanceof RegExp))throw new TypeError("Expected a RegExp for 'regex', but received "+typeof t);if("function"!=typeof r)throw new TypeError("Expected a function for 'asyncFn', but received "+typeof r);const n=[];e.replace(t,(e,...t)=>(n.push(r(e,...t)),e));const o=await Promise.all(n);return e.replace(t,()=>o.shift())}function J(e){if("string"!=typeof e)throw new TypeError("Expected a string for 'str', but received "+typeof e);return e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())}function V(e){if("string"!=typeof e)throw new TypeError("Expected a string for 'str', but received "+typeof e);const t=e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase());return t.charAt(0).toLowerCase()+t.slice(1)}function W({key:e="a",className:t="detect-made-by-ai"}={}){if("undefined"==typeof HTMLElement)throw new Error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.");if("string"!=typeof e)throw new TypeError("Expected a string for 'config.key', but received "+typeof e);if("string"!=typeof t)throw new TypeError("Expected a string for 'config.className', but received "+typeof t);const r=function(r){if(r.ctrlKey&&r.altKey&&r.key.toLowerCase()===e){if(r.preventDefault(),!document.body)return void console.warn("[AiMarkerShortcut] <body> element not found. Cannot toggle class. Ensure the DOM is fully loaded when using the shortcut.");document.body.classList.toggle(t)}};return document.addEventListener("keydown",r),r}function X(e,t,r=.6){if("string"!=typeof e)throw new TypeError("Expected a string for 'text', but received "+typeof e);if(!Number.isInteger(t)||t<=0)throw new TypeError(`Expected 'limit' to be a positive integer, but received ${t}`);if("number"!=typeof r||r<0||r>1)throw new TypeError(`Expected 'safeCutZone' to be a number between 0 and 1, but received ${r}`);let n=e.trim();if(n.length>t){const e=n.lastIndexOf(" ",t);return e>0&&e>=t*r?`${n.substring(0,e).trim()}...`:`${n.substring(0,t).trim()}...`}return n}function G(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw new TypeError("Expected an object for 'oldStrings', but received "+(null===e?"null":typeof e));if("object"!=typeof t||null===t||Array.isArray(t))throw new TypeError("Expected an object for 'newStrings', but received "+(null===t?"null":typeof t));const r={added:{},removed:{},modified:{}};for(const n in e)n in t?e[n]!==t[n]&&(r.modified[n]={old:e[n],new:t[n]}):r.removed[n]=e[n];for(const n in t)n in e||(r.added[n]=t[n]);return r}const K=G,Z=(e,t)=>e.bottom<t.top,_=(e,t)=>e.top>t.bottom,Q=(e,t)=>e.right<t.left,ee=(e,t)=>e.left>t.right,te=(e,t)=>e.bottom<=t.top,re=(e,t)=>e.top>=t.bottom,ne=(e,t)=>e.right<=t.left,oe=(e,t)=>e.left>=t.right,ie=(e,t)=>!(Q(e,t)||ee(e,t)||Z(e,t)||_(e,t)),ae=(e,t)=>!(ne(e,t)||oe(e,t)||te(e,t)||re(e,t)),se=(e,t)=>Q(e,t)?"left":ee(e,t)?"right":Z(e,t)?"top":_(e,t)?"bottom":null,le=(e,t)=>ne(e,t)?"left":oe(e,t)?"right":te(e,t)?"top":re(e,t)?"bottom":null,ue=(e,t)=>({overlapLeft:t.right-e.left,overlapRight:e.right-t.left,overlapTop:t.bottom-e.top,overlapBottom:e.bottom-t.top}),ce=({overlapLeft:e=-1,overlapRight:t=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:e<t?"right":"left",dirY:r<n?"bottom":"top"}),fe=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function me(e,t){const r=e.left+e.width/2,n=e.top+e.height/2;return{x:t.left+t.width/2-r,y:t.top+t.height/2-n}}function pe(e,t){if(!ae(e,t))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=ue(e,t),{dirX:a,dirY:s}=ce({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),l=Math.min(r,n),u=Math.min(o,i);let c;return c=l<u?a:s,{inDir:c,dirX:a,dirY:s,depthX:l,depthY:u}}function de(e,t){const r=ae(e,t),n={in:null,x:null,y:null},o={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:a,overlapRight:s,overlapTop:l,overlapBottom:u}=ue(t,e);i.top=l,i.bottom=u,i.left=a,i.right=s;const c=Object.entries(i).filter(([,e])=>e>0).sort((e,t)=>e[1]-t[1]),{dirX:f,dirY:m}=ce({overlapLeft:s,overlapRight:a,overlapTop:u,overlapBottom:l});return n.y=m,n.x=f,i.bottom<0?o.y="bottom":i.top<0&&(o.y="top"),i.left<0?o.x="left":i.right<0&&(o.x="right"),n.in=r?i.top===i.bottom&&i.bottom===i.left&&i.left===i.right?"center":c.length?c[0][0]:"top":null,{dirs:n,depth:i,isNeg:o}}const ye=(e,t)=>{if("string"!=typeof t)throw new TypeError('Expected "name" to be a string.');if("string"!=typeof e)throw new TypeError(`Expected "${t}" to be a string, but received ${typeof e}.`)},we=(e,t)=>{if("string"!=typeof t)throw new TypeError('Expected "name" to be a string.');if("function"!=typeof e)throw new TypeError(`Expected "${t}" to be a function, but received ${typeof e}.`)},be=(e,t)=>{if("string"!=typeof t)throw new TypeError('Expected "name" to be a string.');if("object"!=typeof e||null===e||Array.isArray(e))throw new TypeError(`Expected "${t}" to be a plain object, but received ${null===e?"null":Array.isArray(e)?"array":typeof e}.`)},ge=new Map;class he extends Error{constructor(e,t,r){if(ye(e,"message"),ye(t,"url"),"string"!=typeof r)throw new TypeError(`Expected "stage" to be a string, but received ${typeof r}.`);super(e),this.name="MediaLoadingError",this.url=t,this.stage=r}}const Ee=async e=>{ye(e,"str");const t=(new TextEncoder).encode(e),r=await crypto.subtle.digest("SHA-1",t);return Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join("").substring(0,8)},Te=(e,t="image/jpeg")=>{if(!(e instanceof Uint8Array)&&"string"!=typeof e)throw new TypeError(`Expected "data" to be an instance of Uint8Array or a string, but received ${typeof e}.`);ye(t,"format");const r=e=>{const t=URL.createObjectURL(e),r=ge.get(t);return ge.set(t,"number"==typeof r?r+1:1),t};if(e instanceof Uint8Array)return r(new Blob([e],{type:t}));if("string"==typeof e&&e.startsWith("data:")){const n=e.split(",")[1],o=atob(n),i=new Uint8Array(o.length);for(let e=0;e<o.length;e++)i[e]=o.charCodeAt(e);return r(new Blob([i],{type:t}))}return"string"==typeof e?e:""},ve=(e,t)=>{if(be(e,"common"),"boolean"!=typeof t)throw new TypeError('Expected "isPartial" to be a boolean.');const r=e=>t&&void 0===e,n=e=>r(e)||"string"==typeof e||null===e,o=(e,t)=>(we(t,"valueValidator"),!!r(e)||!(!Array.isArray(e)||!e.every(t)));if(!n(e.title))throw new TypeError('Invalid metadata: "title" must be a string or null.');if(!n(e.album))throw new TypeError('Invalid metadata: "album" must be a string or null.');if(!n(e.albumartist))throw new TypeError('Invalid metadata: "albumartist" must be a string or null.');if(!n(e.artist))throw new TypeError('Invalid metadata: "artist" must be a string or null.');if(i=e.year,!r(i)&&"number"!=typeof i&&null!==i)throw new TypeError('Invalid metadata: "year" must be a number or null.');var i;if(!o(e.albumartists,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "albumartists" must be an array of string.');if(!o(e.genre,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "genre" must be an array of string.');if(!o(e.label,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "label" must be an array of string.');if(!o(e.composer,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "composer" must be an array of string.');if(!o(e.artists,e=>"string"==typeof e))throw new TypeError('Invalid metadata: "artists" must be an array of string.');if(!o(e.picture,e=>e&&"object"==typeof e&&(void 0===e.description||"string"==typeof e.description)&&(void 0===e.name||"string"==typeof e.name)&&(void 0===e.type||"string"==typeof e.type)&&"string"==typeof e.format&&(e.data instanceof Uint8Array||"string"==typeof e.data)))throw new TypeError('Invalid metadata: "picture" must be an array of pictures.');const a=(e,t)=>{if(ye(e,"name"),!r(t)){if(null==t)throw new TypeError(`Invalid metadata: "${e}" is required.`);if("object"!=typeof t)throw new TypeError(`Invalid metadata: "${e}" must be an object or null.`);if("number"!=typeof t.no&&null!==t.no)throw new TypeError(`Invalid metadata: "${e}.no" must be a number or null.`);if("number"!=typeof t.of&&null!==t.of)throw new TypeError(`Invalid metadata: "${e}.of" must be a number or null.`)}};a("disk",e.disk),a("track",e.track)},Ne=e=>(be(e,"common"),ve(e,!1)),Ae=e=>(be(e,"common"),ve(e,!0)),Me=async(e,t)=>{ye(e,"url"),we(t,"parseFile");try{const r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch audio file: ${r.status} ${r.statusText}`);const n=await r.blob(),o=await t(n);if(!o||"object"!=typeof o.common)throw new TypeError('Invalid metadata: "common" property is missing or not an object.');const i=o.common;return Ae(i),{title:i?.title??null,album:i?.album??null,albumartist:i?.albumartist??null,albumartists:i?.albumartists??[],genre:i?.genre??[],label:i?.label??[],composer:i?.composer??[],year:i?.year??null,artist:i?.artist??null,artists:i?.artists??[],disk:i?.disk?{no:i.disk.no,of:i.disk.of}:{no:null,of:null},track:i?.track?{no:i.track.no,of:i.track.of}:{no:null,of:null},picture:i?.picture?.map(e=>({...e,data:Te(e.data,e.format)}))??[]}}catch(e){throw e}},Fe=async(e,t={},r={},n=e=>{if(!(e instanceof Blob))throw new TypeError('Expected "data" to be a Blob.');return new Promise((e,t)=>t(new TypeError("parseFile library not found.")))},o={},i="null")=>{if("string"!=typeof e&&!(e instanceof HTMLMediaElement))throw new TypeError("Source must be a string or an HTMLMediaElement.");if(be(t,"defaultMetadata"),be(r,"metadata"),we(n,"parseFile"),be(o,"callbacks"),o.onProgress&&"function"!=typeof o.onProgress)throw new TypeError("callbacks.onProgress must be a function.");if(o.onError&&"function"!=typeof o.onError)throw new TypeError("callbacks.onError must be a function.");if("string"!=typeof i&&"function"!=typeof i)throw new TypeError("unknownArtist must be a string or a function returning a string.");let a,s="";const l=(t,r)=>{if(ye(t,"stage"),void 0!==r&&!(r instanceof Event))throw new TypeError('Expected "event" to be an Event or undefined.');o.onProgress&&o.onProgress({event:r,status:"loading",stage:t,url:s||(e instanceof HTMLMediaElement?e.src:"unknown")})},u=(t,r)=>{if(!(t instanceof Error))throw new TypeError('Expected "error" to be an Error.');ye(r,"stage"),o.onError&&o.onError({error:t,url:s||(e instanceof HTMLMediaElement?e.src:"unknown"),stage:r})};try{l("INITIALIZING"),"string"==typeof e?(s=e,a=new Audio(s)):(a=e,s=a.src);try{await new Promise((e,t)=>{const r=e=>l("DOWNLOADING",e),n=()=>{i(),e(void 0)},o=e=>{i(),t(new Error(`HTMLMediaElement failed to load: ${e.message||"Unknown error"}`))},i=()=>{a.removeEventListener("progress",r),a.removeEventListener("loadedmetadata",n),a.removeEventListener("error",o)};a.addEventListener("progress",r),a.addEventListener("loadedmetadata",n),a.addEventListener("error",o),a.readyState>=1&&(i(),e(void 0))}),l("METADATA_LOADED")}catch(e){throw new he(e instanceof Error?e.message:"UNKNOWN ERROR",s,"METADATA")}const c={id:r.id||await Ee(s),duration:Math.floor(1e3*a.duration),url:s,weight:r.weight??1};let f={};l("EXTRACTING_ID3");try{f=await Me(s,n)}catch(e){u(e instanceof Error?e:new Error("Unknown Error"),"ID3"),console.warn(`[TinyAudioUtils] ID3 extraction failed for ${s}. Falling back to filename.`)}const m=e=>{ye(e,"url");try{return(e.split(/[?#]/)[0].split("/").pop()??"").replace(/\.[^/.]+$/,"")||"Unknown Track"}catch{return"Unknown Track"}},p={...c,...t,...f,...r,title:f.title||r.title||m(s),artist:f.artist||r.artist||("string"==typeof i?i:String(i()))};return o.onProgress&&o.onProgress({status:"success",stage:"COMPLETE",url:s}),p}catch(e){if(e instanceof he)throw e;{const t=new he(e instanceof Error?e.message:"UNKNOWN ERROR",s,"INITIALIZING");throw u(t,"INITIALIZING"),t}}};window.TinyBasicsEs=t})();
@@ -1 +1 @@
1
- (()=>{"use strict";const e={d:(t,r)=>{if(Array.isArray(r))for(var i=0;i<r.length;){var s=r[i++],n=r[i++];e.o(t,s)?0===n&&i++:0===n?Object.defineProperty(t,s,{enumerable:!0,value:r[i++]}):Object.defineProperty(t,s,{enumerable:!0,get:n})}else for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyDayNightCycle:()=>r});const r=class{#e=!0;#t=86400;#r=3600;#i=60;#s=new Map;#n=[];#o;#h;#a={main:null};#u=0;#c=0;#y=0;#m="";#d=1;#f=1;#w=1;#S=!1;#g=[31,31,31,31,31,31,31,31,31,31,31,31];#p={default:{},day:{},night:{},hours:{},seasons:{}};#l={min:60,max:180};#b=0;get daySize(){return this.#t}get autoSizeAdjuste(){return this.#e}set autoSizeAdjuste(e){if("boolean"!=typeof e)throw new TypeError("autoSizeAdjuste must be a boolean.");this.#e=e}set daySize(e){if("number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error("daySize must be a positive finite number.");const t=this.#r/this.#t,r=this.#i/this.#t;this.#t=e,this.#e&&(this.#r=e*t,this.#i=e*r)}get hourSize(){return this.#r}set hourSize(e){if("number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error("hourSize must be a positive finite number.");const t=this.#t/this.#r,r=this.#i/this.#r;this.#r=e,this.#e&&(this.#t=e*t,this.#i=e*r)}get minuteSize(){return this.#i}set minuteSize(e){if("number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error("minuteSize must be a positive finite number.");const t=this.#r/this.#i,r=this.#t/this.#i;this.#i=e,this.#e&&(this.#r=e*t,this.#t=e*r)}get isDestroyed(){return this.#S}get currentSeconds(){return this.#u}set currentSeconds(e){if(this._checkDestroyed(),"number"!=typeof e||!Number.isFinite(e))throw new TypeError("currentSeconds must be a finite number, received "+typeof e);if(e<0||e>=this.#t)throw new RangeError(`currentSeconds must be between 0 and 86399, received ${e}`);this.#u=Math.floor(e),this.#c=Math.floor(e/this.#i),this.#y=Math.floor(e/this.#r)}get currentMinutes(){return this.#c}set currentMinutes(e){if(this._checkDestroyed(),"number"!=typeof e||!Number.isFinite(e))throw new TypeError("currentMinutes must be a finite number, received "+typeof e);if(e<0||e>=1440)throw new RangeError(`currentMinutes must be between 0 and 1439, received ${e}`);this.#c=Math.floor(e),this.#y=Math.floor(e/this.#i),this.#u=Math.floor(e*this.#i)}get currentHours(){return this.#y}set currentHours(e){if(this._checkDestroyed(),"number"!=typeof e||!Number.isFinite(e))throw new TypeError("currentHours must be a finite number, received "+typeof e);if(e<0||e>=24)throw new RangeError(`currentHours must be between 0 and less than 24, received ${e}`);this.#y=Math.floor(e),this.#c=Math.floor(e*this.#i),this.#u=Math.floor(e*this.#r)}get moons(){return this.#n.map(e=>this.getMoon(e))}get seasons(){return Array.from(this.#s.keys())}get dayStart(){return this.#o}get nightStart(){return this.#h}get weather(){return{...this.#a}}get currentSeason(){return this.#m}get currentDay(){return this.#d}get currentMonth(){return this.#f}get currentYear(){return this.#w}get monthDays(){return[...this.#g]}get weatherDuration(){return{...this.#l}}get weatherTimeLeft(){return this.#b}set dayStart(e){if(this._checkDestroyed(),"number"!=typeof e||e<1)throw new TypeError("dayStart must be a positive non-zero number, received "+typeof e);this.#o=e}set nightStart(e){if(this._checkDestroyed(),"number"!=typeof e||e<1)throw new TypeError("nightStart must be a positive non-zero number, received "+typeof e);this.#h=e}set weather(e){if(this._checkDestroyed(),"object"!=typeof e||null===e||Array.isArray(e)||!Object.values(e).every(e=>"string"==typeof e))throw new TypeError("weather must be a object with strings, received "+typeof e);this.#a=e}set currentSeason(e){if(this._checkDestroyed(),"string"!=typeof e||!this.#s.has(e))throw new TypeError(`currentSeason must be one of ${Array.from(this.#s).map(e=>e[0]).join(", ")}, received ${e}`);this.#m=e}set currentDay(e){if(this._checkDestroyed(),"number"!=typeof e||e<1||e>this.#g[this.#f-1])throw new TypeError("currentDay must be a valid day number, received "+typeof e);this.#d=e}set currentMonth(e){if(this._checkDestroyed(),"number"!=typeof e||"number"!=typeof this.#g[e-1])throw new TypeError("currentMonth must be a valid month number, received "+typeof e);this.#f=e}set currentYear(e){if(this._checkDestroyed(),"number"!=typeof e||e<1)throw new TypeError("currentYear must be a positive number non-zero, received "+typeof e);this.#w=e}set monthDays(e){if(this._checkDestroyed(),!Array.isArray(e))throw new TypeError("monthDays must be a array");if(!e.every(e=>"number"==typeof e))throw new TypeError("monthDays must have number values");this.#g=[...e]}set weatherDuration(e){if(this._checkDestroyed(),"object"!=typeof e||null===e)throw new TypeError("weatherDuration must be a non-null object");if("number"!=typeof e.min||"number"!=typeof e.max)throw new TypeError("weatherDuration.min and weatherDuration.max must be numbers");this.#l={...e}}set weatherTimeLeft(e){if(this._checkDestroyed(),"number"!=typeof e)throw new TypeError("weatherTimeLeft must be a number, received "+typeof e);this.#b=e}get weatherConfig(){const e={},t={};for(const t in this.#p.hours)e[t]={...this.#p.hours[t]};for(const e in this.#p.seasons)t[e]={...this.#p.seasons[e]};return{default:{...this.#p.default},day:{...this.#p.day},night:{...this.#p.night},hours:e,seasons:t}}set weatherConfig(e){if(this._checkDestroyed(),"object"!=typeof e||null===e)throw new TypeError(`weatherConfig must be a non-null object, received ${e}`);const t=["default","day","night","hours","seasons"];for(const r of t)if(!(r in e))throw new TypeError(`weatherConfig is missing required property "${r}".`);const r={},i={},s=(e,t)=>{if("object"!=typeof e||null===e)throw new TypeError(`${t} must be an object, received ${e}`);for(const r in e){const i=typeof e[r];if("number"!==i&&"function"!==i)throw new TypeError(`${t}["${r}"] must be a number or function, received ${i}`)}};for(const t in e.hours)s(e.hours[t],`hours["${t}"]`),r[t]={...e.hours[t]};for(const t in e.seasons)s(e.seasons[t],`seasons["${t}"]`),i[t]={...e.seasons[t]};const n=(e,t)=>(s(e,t),{...e});this.#p={default:n(e.default,"default"),day:n(e.day,"day"),night:n(e.night,"night"),hours:r,seasons:i}}constructor(e=6,t=18){this.#o=e,this.#h=t}addSeason(e,t){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("Season name must be a string, received "+typeof e);if(!Array.isArray(t)||!t.every(e=>"number"==typeof e))throw new TypeError("Season values must be an array of numbers");this.#s.set(e,t)}removeSeason(e){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("Season name must be a string, received "+typeof e);this.#s.delete(e),this.#m===e&&(this.#m="")}hasSeason(e){if("string"!=typeof e)throw new TypeError("Season name must be a string, received "+typeof e);return this.#s.has(e)}getSeason(e){if("string"!=typeof e)throw new TypeError("Season name must be a string, received "+typeof e);const t=this.#s.get(e);if(!t)throw new Error(`Season "${e}" not found`);return[...t]}setTime({hour:e=0,minute:t=0,second:r=0}){this._checkDestroyed(),this.currentSeconds=(e*this.#r+t*this.#i+r)%this.#t}addTime({hours:e=0,minutes:t=0,seconds:r=0}){this._checkDestroyed();let i=this.currentSeconds+e*this.#r+t*this.#i+r;for(;i>=this.#t;)i-=this.#t,this.nextDay();for(;i<0;)i+=this.#t,this.prevDay();this.currentSeconds=i,this.updateWeatherTimer((e*this.#r+t*this.#i+r)/this.#i)}getTime({withSeconds:e=!1,hourSize:t=this.#r,minuteSize:r=this.#i}={}){const i=Math.floor(this.currentSeconds/t),s=Math.floor(this.currentSeconds%t/r),n=this.currentSeconds%r;return{hour:i,minute:s,second:n,formatted:`${i.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`+(e?`:${n.toString().padStart(2,"0")}`:"")}}isDay(){return this.#o<this.#h?this.#c>=this.#o*this.#i&&this.#c<this.#h*this.#i:this.#c>=this.#o*this.#i||this.#c<this.#h*this.#i}minutesUntilDay(){return this.timeUntil(this.#o,"minutes")}secondsUntilDay(){return this.timeUntil(this.#o,"seconds")}hoursUntilDay(){return this.timeUntil(this.#o,"hours")}minutesUntilNight(){return this.timeUntil(this.#h,"minutes")}secondsUntilNight(){return this.timeUntil(this.#h,"seconds")}hoursUntilNight(){return this.timeUntil(this.#h,"hours")}timeUntil(e,t){this._checkDestroyed();let r=e*this.#r-this.#u;switch(r<=0&&(r+=this.#t),t){case"minutes":return r/this.#i;case"hours":return r/this.#r;default:return r}}setTo(e){this._checkDestroyed(),"day"===e?this.setTime({hour:this.#o}):"night"===e&&this.setTime({hour:this.#h})}nextDay(e=1){this._checkDestroyed();for(let t=0;t<e;t++){this.#d++;const e=this.#g[this.#f-1];if(Number.isNaN(e)||!Number.isFinite(e))throw new Error("Invalid month day count: monthDays must be a finite number.");this.#d>e&&(this.#d=1,this.#f++,this.#f>this.#g.length&&(this.#f=1,this.#w++)),this.updateSeason(),this.advanceMoons(1)}}prevDay(e=1){this._checkDestroyed();for(let t=0;t<e;t++)this.#d--,this.#d<1&&(this.#f--,this.#f<1&&(this.#f=this.#g.length,this.#w--),this.#d=this.#g[this.#f-1]||30),this.updateSeason(),this.rewindMoons(1)}updateSeason(){this._checkDestroyed(),this.#s.forEach((e,t)=>{e.includes(this.#f)&&(this.#m=t)})}setWeatherConfig(e){this._checkDestroyed(),this.#p={...this.#p,...e}}setWeatherDuration(e,t){this._checkDestroyed(),this.#l.min=e,this.#l.max=t}updateWeatherTimer(e){this._checkDestroyed(),this.#b-=e,this.#b<=0&&this.chooseNewWeather()}forceWeather({where:e="main",type:t,duration:r=null}){this._checkDestroyed();const i=this.#a;i[e]=t,this.weather=i,this.#b=r??this._randomInRange(this.#l.min,this.#l.max)}chooseNewWeather({customWeather:e,where:t="main"}={}){this._checkDestroyed();let r={};const i=e=>{for(const[t,i]of Object.entries(e)){let e=i;"function"==typeof e&&(e=e({hour:Math.floor(this.#c/this.#i),minute:this.#c%this.#i,currentMinutes:this.#c,isDay:this.isDay(),season:this.#m,weather:this.#a})),"number"!=typeof e||Number.isNaN(e)||(r[t]=(r[t]||0)+e)}};i(this.#p.default||{});for(const e in this.#p.hours){const[t,r]=e.split("-").map(e=>{const[t,r]=e.split(":").map(Number);return t*this.#i+(r||0)}),s=this.#c;(t<=r?s>=t&&s<=r:s>=t||s<=r)&&i(this.#p.hours[e])}this.isDay()&&this.#p.day?i(this.#p.day):!this.isDay()&&this.#p.night&&i(this.#p.night),this.#p.seasons?.[this.#m]&&i(this.#p.seasons[this.#m]),e&&"object"==typeof e&&i(e);const s=Object.entries(r).filter(([,e])=>e>0);if(!s.length)return this.#a[t]=null,null;const n=s.reduce((e,[,t])=>e+t,0);let o=Math.random()*n;for(const[e,r]of s){if(o<r)return this.#a[t]=e,this.#b=this._randomInRange(this.#l.min,this.#l.max),e;o-=r}return this.#a[t]=null,null}_randomInRange(e,t){return Math.floor(Math.random()*(t-e+1))+e}addMoon(e,t,r,i=0){this._checkDestroyed();const s=Math.max(1,t);return this.#n.push({name:e,cycleLength:s,currentPhase:(i%s+s)%s,phaseNames:r}),this.#n.length-1}removeMoon(e){this._checkDestroyed(),this.#n=this.#n.filter(t=>t.name!==e)}advanceMoons(e=1){for(const t in this.#n)this.advanceMoon(parseInt(t),e)}rewindMoons(e=1){for(const t in this.#n)this.rewindMoon(parseInt(t),e)}advanceMoon(e,t=1){this._checkDestroyed();const r=this.#n[e];if(!r)throw new RangeError(`No moon found at index ${e}`);r.currentPhase=(r.currentPhase+t)%r.cycleLength}rewindMoon(e,t=1){this._checkDestroyed();const r=this.#n[e];if(!r)throw new RangeError(`No moon found at index ${e}`);r.currentPhase=(r.currentPhase-t+r.cycleLength)%r.cycleLength}moonExists(e){return!!this.#n[e]}getMoon(e){let t;if("number"==typeof e){if(t=this.#n[e],!t)throw new RangeError(`No moon found at index ${e}`)}else{if(!e||"object"!=typeof e||"string"!=typeof e.name||"number"!=typeof e.cycleLength||"number"!=typeof e.currentPhase)throw new TypeError("Invalid moon reference. Expected a number index or a MoonRaw object, received "+typeof e);t=e}return{name:t.name,phaseIndex:t.currentPhase,phaseName:t.phaseNames?t.phaseNames[t.currentPhase]??String(t.currentPhase):String(t.currentPhase),cycleLength:t.cycleLength}}_checkDestroyed(){if(this.#S)throw new Error("This instance has been destroyed and can no longer be used.")}destroy(){this.#S||(this.#s.clear(),this.#n.length=0,this.#o=0,this.#h=0,this.#u=0,this.#c=0,this.#y=0,this.#d=1,this.#f=1,this.#w=1,this.#b=0,this.#m="",this.#a={main:null},this.#g=[],this.#p.default={},this.#p.day={},this.#p.night={},this.#p.hours={},this.#p.seasons={},this.#l={min:0,max:0},this.#S=!0)}};window.TinyDayNightCycle=t.TinyDayNightCycle})();
1
+ (()=>{"use strict";const e={d:(t,r)=>{if(Array.isArray(r))for(var s=0;s<r.length;){var i=r[s++],n=r[s++];e.o(t,i)?0===n&&s++:0===n?Object.defineProperty(t,i,{enumerable:!0,value:r[s++]}):Object.defineProperty(t,i,{enumerable:!0,get:n})}else for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyDayNightCycle:()=>s});const r=e=>{if(e)throw new Error("This TinyDayNightCycle instance has been destroyed and can no longer be used.")};const s=class{#e=!0;#t=86400;#r=3600;#s=60;#i=new Map;#n=[];#o;#h;#a={main:null};#u=0;#y=0;#c=0;#d="";#m=1;#f=1;#w=1;#S=!1;#g=[31,31,31,31,31,31,31,31,31,31,31,31];#D={default:{},day:{},night:{},hours:{},seasons:{}};#p={min:60,max:180};#l=0;get daySize(){return r(this.#S),this.#t}get autoSizeAdjuste(){return r(this.#S),this.#e}set autoSizeAdjuste(e){if(r(this.#S),"boolean"!=typeof e)throw new TypeError("autoSizeAdjuste must be a boolean.");this.#e=e}set daySize(e){if(r(this.#S),"number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error("daySize must be a positive finite number.");const t=this.#r/this.#t,s=this.#s/this.#t;this.#t=e,this.#e&&(this.#r=e*t,this.#s=e*s)}get hourSize(){return r(this.#S),this.#r}set hourSize(e){if(r(this.#S),"number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error("hourSize must be a positive finite number.");const t=this.#t/this.#r,s=this.#s/this.#r;this.#r=e,this.#e&&(this.#t=e*t,this.#s=e*s)}get minuteSize(){return r(this.#S),this.#s}set minuteSize(e){if(r(this.#S),"number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error("minuteSize must be a positive finite number.");const t=this.#r/this.#s,s=this.#t/this.#s;this.#s=e,this.#e&&(this.#r=e*t,this.#t=e*s)}get isDestroyed(){return this.#S}get currentSeconds(){return r(this.#S),this.#u}set currentSeconds(e){if(r(this.#S),"number"!=typeof e||!Number.isFinite(e))throw new TypeError("currentSeconds must be a finite number, received "+typeof e);if(e<0||e>=this.#t)throw new RangeError(`currentSeconds must be between 0 and 86399, received ${e}`);this.#u=Math.floor(e),this.#y=Math.floor(e/this.#s),this.#c=Math.floor(e/this.#r)}get currentMinutes(){return r(this.#S),this.#y}set currentMinutes(e){if(r(this.#S),"number"!=typeof e||!Number.isFinite(e))throw new TypeError("currentMinutes must be a finite number, received "+typeof e);if(e<0||e>=1440)throw new RangeError(`currentMinutes must be between 0 and 1439, received ${e}`);this.#y=Math.floor(e),this.#c=Math.floor(e/this.#s),this.#u=Math.floor(e*this.#s)}get currentHours(){return r(this.#S),this.#c}set currentHours(e){if(r(this.#S),"number"!=typeof e||!Number.isFinite(e))throw new TypeError("currentHours must be a finite number, received "+typeof e);if(e<0||e>=24)throw new RangeError(`currentHours must be between 0 and less than 24, received ${e}`);this.#c=Math.floor(e),this.#y=Math.floor(e*this.#s),this.#u=Math.floor(e*this.#r)}get moons(){return r(this.#S),this.#n.map(e=>this.getMoon(e))}get seasons(){return r(this.#S),Array.from(this.#i.keys())}get dayStart(){return r(this.#S),this.#o}get nightStart(){return r(this.#S),this.#h}get weather(){return r(this.#S),{...this.#a}}get currentSeason(){return r(this.#S),this.#d}get currentDay(){return r(this.#S),this.#m}get currentMonth(){return r(this.#S),this.#f}get currentYear(){return r(this.#S),this.#w}get monthDays(){return r(this.#S),[...this.#g]}get weatherDuration(){return r(this.#S),{...this.#p}}get weatherTimeLeft(){return r(this.#S),this.#l}set dayStart(e){if(r(this.#S),"number"!=typeof e||e<1)throw new TypeError("dayStart must be a positive non-zero number, received "+typeof e);this.#o=e}set nightStart(e){if(r(this.#S),"number"!=typeof e||e<1)throw new TypeError("nightStart must be a positive non-zero number, received "+typeof e);this.#h=e}set weather(e){if(r(this.#S),"object"!=typeof e||null===e||Array.isArray(e)||!Object.values(e).every(e=>"string"==typeof e))throw new TypeError("weather must be a object with strings, received "+typeof e);this.#a=e}set currentSeason(e){if(r(this.#S),"string"!=typeof e||!this.#i.has(e))throw new TypeError(`currentSeason must be one of ${Array.from(this.#i).map(e=>e[0]).join(", ")}, received ${e}`);this.#d=e}set currentDay(e){if(r(this.#S),"number"!=typeof e||e<1||e>this.#g[this.#f-1])throw new TypeError("currentDay must be a valid day number, received "+typeof e);this.#m=e}set currentMonth(e){if(r(this.#S),"number"!=typeof e||"number"!=typeof this.#g[e-1])throw new TypeError("currentMonth must be a valid month number, received "+typeof e);this.#f=e}set currentYear(e){if(r(this.#S),"number"!=typeof e||e<1)throw new TypeError("currentYear must be a positive number non-zero, received "+typeof e);this.#w=e}set monthDays(e){if(r(this.#S),!Array.isArray(e))throw new TypeError("monthDays must be a array");if(!e.every(e=>"number"==typeof e))throw new TypeError("monthDays must have number values");this.#g=[...e]}set weatherDuration(e){if(r(this.#S),"object"!=typeof e||null===e)throw new TypeError("weatherDuration must be a non-null object");if("number"!=typeof e.min||"number"!=typeof e.max)throw new TypeError("weatherDuration.min and weatherDuration.max must be numbers");this.#p={...e}}set weatherTimeLeft(e){if(r(this.#S),"number"!=typeof e)throw new TypeError("weatherTimeLeft must be a number, received "+typeof e);this.#l=e}get weatherConfig(){r(this.#S);const e={},t={};for(const t in this.#D.hours)e[t]={...this.#D.hours[t]};for(const e in this.#D.seasons)t[e]={...this.#D.seasons[e]};return{default:{...this.#D.default},day:{...this.#D.day},night:{...this.#D.night},hours:e,seasons:t}}set weatherConfig(e){if(r(this.#S),"object"!=typeof e||null===e)throw new TypeError(`weatherConfig must be a non-null object, received ${e}`);const t=["default","day","night","hours","seasons"];for(const r of t)if(!(r in e))throw new TypeError(`weatherConfig is missing required property "${r}".`);const s={},i={},n=(e,t)=>{if("object"!=typeof e||null===e)throw new TypeError(`${t} must be an object, received ${e}`);for(const r in e){const s=typeof e[r];if("number"!==s&&"function"!==s)throw new TypeError(`${t}["${r}"] must be a number or function, received ${s}`)}};for(const t in e.hours)n(e.hours[t],`hours["${t}"]`),s[t]={...e.hours[t]};for(const t in e.seasons)n(e.seasons[t],`seasons["${t}"]`),i[t]={...e.seasons[t]};const o=(e,t)=>(n(e,t),{...e});this.#D={default:o(e.default,"default"),day:o(e.day,"day"),night:o(e.night,"night"),hours:s,seasons:i}}constructor(e=6,t=18){this.#o=e,this.#h=t}addSeason(e,t){if(r(this.#S),"string"!=typeof e)throw new TypeError("Season name must be a string, received "+typeof e);if(!Array.isArray(t)||!t.every(e=>"number"==typeof e))throw new TypeError("Season values must be an array of numbers");this.#i.set(e,t)}removeSeason(e){if(r(this.#S),"string"!=typeof e)throw new TypeError("Season name must be a string, received "+typeof e);this.#i.delete(e),this.#d===e&&(this.#d="")}hasSeason(e){if(r(this.#S),"string"!=typeof e)throw new TypeError("Season name must be a string, received "+typeof e);return this.#i.has(e)}getSeason(e){if(r(this.#S),"string"!=typeof e)throw new TypeError("Season name must be a string, received "+typeof e);const t=this.#i.get(e);if(!t)throw new Error(`Season "${e}" not found`);return[...t]}setTime({hour:e=0,minute:t=0,second:s=0}){r(this.#S),this.currentSeconds=(e*this.#r+t*this.#s+s)%this.#t}addTime({hours:e=0,minutes:t=0,seconds:s=0}){r(this.#S);let i=this.currentSeconds+e*this.#r+t*this.#s+s;for(;i>=this.#t;)i-=this.#t,this.nextDay();for(;i<0;)i+=this.#t,this.prevDay();this.currentSeconds=i,this.updateWeatherTimer((e*this.#r+t*this.#s+s)/this.#s)}getTime({withSeconds:e=!1,hourSize:t=this.#r,minuteSize:s=this.#s}={}){r(this.#S);const i=Math.floor(this.currentSeconds/t),n=Math.floor(this.currentSeconds%t/s),o=this.currentSeconds%s;return{hour:i,minute:n,second:o,formatted:`${i.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`+(e?`:${o.toString().padStart(2,"0")}`:"")}}isDay(){return r(this.#S),this.#o<this.#h?this.#y>=this.#o*this.#s&&this.#y<this.#h*this.#s:this.#y>=this.#o*this.#s||this.#y<this.#h*this.#s}minutesUntilDay(){return this.timeUntil(this.#o,"minutes")}secondsUntilDay(){return this.timeUntil(this.#o,"seconds")}hoursUntilDay(){return this.timeUntil(this.#o,"hours")}minutesUntilNight(){return this.timeUntil(this.#h,"minutes")}secondsUntilNight(){return this.timeUntil(this.#h,"seconds")}hoursUntilNight(){return this.timeUntil(this.#h,"hours")}timeUntil(e,t){r(this.#S);let s=e*this.#r-this.#u;switch(s<=0&&(s+=this.#t),t){case"minutes":return s/this.#s;case"hours":return s/this.#r;default:return s}}setTo(e){r(this.#S),"day"===e?this.setTime({hour:this.#o}):"night"===e&&this.setTime({hour:this.#h})}nextDay(e=1){r(this.#S);for(let t=0;t<e;t++){this.#m++;const e=this.#g[this.#f-1];if(Number.isNaN(e)||!Number.isFinite(e))throw new Error("Invalid month day count: monthDays must be a finite number.");this.#m>e&&(this.#m=1,this.#f++,this.#f>this.#g.length&&(this.#f=1,this.#w++)),this.updateSeason(),this.advanceMoons(1)}}prevDay(e=1){r(this.#S);for(let t=0;t<e;t++)this.#m--,this.#m<1&&(this.#f--,this.#f<1&&(this.#f=this.#g.length,this.#w--),this.#m=this.#g[this.#f-1]||30),this.updateSeason(),this.rewindMoons(1)}updateSeason(){r(this.#S),this.#i.forEach((e,t)=>{e.includes(this.#f)&&(this.#d=t)})}setWeatherConfig(e){r(this.#S),this.#D={...this.#D,...e}}setWeatherDuration(e,t){r(this.#S),this.#p.min=e,this.#p.max=t}updateWeatherTimer(e){r(this.#S),this.#l-=e,this.#l<=0&&this.chooseNewWeather()}forceWeather({where:e="main",type:t,duration:s=null}){r(this.#S);const i=this.#a;i[e]=t,this.weather=i,this.#l=s??this._randomInRange(this.#p.min,this.#p.max)}chooseNewWeather({customWeather:e,where:t="main"}={}){r(this.#S);let s={};const i=e=>{for(const[t,r]of Object.entries(e)){let e=r;"function"==typeof e&&(e=e({hour:Math.floor(this.#y/this.#s),minute:this.#y%this.#s,currentMinutes:this.#y,isDay:this.isDay(),season:this.#d,weather:this.#a})),"number"!=typeof e||Number.isNaN(e)||(s[t]=(s[t]||0)+e)}};i(this.#D.default||{});for(const e in this.#D.hours){const[t,r]=e.split("-").map(e=>{const[t,r]=e.split(":").map(Number);return t*this.#s+(r||0)}),s=this.#y;(t<=r?s>=t&&s<=r:s>=t||s<=r)&&i(this.#D.hours[e])}this.isDay()&&this.#D.day?i(this.#D.day):!this.isDay()&&this.#D.night&&i(this.#D.night),this.#D.seasons?.[this.#d]&&i(this.#D.seasons[this.#d]),e&&"object"==typeof e&&i(e);const n=Object.entries(s).filter(([,e])=>e>0);if(!n.length)return this.#a[t]=null,null;const o=n.reduce((e,[,t])=>e+t,0);let h=Math.random()*o;for(const[e,r]of n){if(h<r)return this.#a[t]=e,this.#l=this._randomInRange(this.#p.min,this.#p.max),e;h-=r}return this.#a[t]=null,null}_randomInRange(e,t){return Math.floor(Math.random()*(t-e+1))+e}addMoon(e,t,s,i=0){r(this.#S);const n=Math.max(1,t);return this.#n.push({name:e,cycleLength:n,currentPhase:(i%n+n)%n,phaseNames:s}),this.#n.length-1}removeMoon(e){r(this.#S),this.#n=this.#n.filter(t=>t.name!==e)}advanceMoons(e=1){for(const t in this.#n)this.advanceMoon(parseInt(t),e)}rewindMoons(e=1){for(const t in this.#n)this.rewindMoon(parseInt(t),e)}advanceMoon(e,t=1){r(this.#S);const s=this.#n[e];if(!s)throw new RangeError(`No moon found at index ${e}`);s.currentPhase=(s.currentPhase+t)%s.cycleLength}rewindMoon(e,t=1){r(this.#S);const s=this.#n[e];if(!s)throw new RangeError(`No moon found at index ${e}`);s.currentPhase=(s.currentPhase-t+s.cycleLength)%s.cycleLength}moonExists(e){return r(this.#S),!!this.#n[e]}getMoon(e){let t;if(r(this.#S),"number"==typeof e){if(t=this.#n[e],!t)throw new RangeError(`No moon found at index ${e}`)}else{if(!e||"object"!=typeof e||"string"!=typeof e.name||"number"!=typeof e.cycleLength||"number"!=typeof e.currentPhase)throw new TypeError("Invalid moon reference. Expected a number index or a MoonRaw object, received "+typeof e);t=e}return{name:t.name,phaseIndex:t.currentPhase,phaseName:t.phaseNames?t.phaseNames[t.currentPhase]??String(t.currentPhase):String(t.currentPhase),cycleLength:t.cycleLength}}destroy(){this.#S||(this.#i.clear(),this.#n.length=0,this.#o=0,this.#h=0,this.#u=0,this.#y=0,this.#c=0,this.#m=1,this.#f=1,this.#w=1,this.#l=0,this.#d="",this.#a={main:null},this.#g=[],this.#D.default={},this.#D.day={},this.#D.night={},this.#D.hours={},this.#D.seasons={},this.#p={min:0,max:0},this.#S=!0)}};window.TinyDayNightCycle=t.TinyDayNightCycle})();