tiny-essentials 1.28.0 → 1.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/changelog/1/28/1.md +23 -0
  2. package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
  3. package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
  4. package/dist/v1/TinyAnalogClock.min.js +1 -1
  5. package/dist/v1/TinyBasicsEs.min.js +1 -1
  6. package/dist/v1/TinyDayNightCycle.min.js +1 -1
  7. package/dist/v1/TinyDragDropDetector.min.js +1 -1
  8. package/dist/v1/TinyDragger.min.js +1 -1
  9. package/dist/v1/TinyElementObserver.min.js +1 -1
  10. package/dist/v1/TinyEssentials.min.js +1 -1
  11. package/dist/v1/TinyGamepad.min.js +1 -1
  12. package/dist/v1/TinyHtml.min.js +1 -1
  13. package/dist/v1/TinyI18.min.js +1 -1
  14. package/dist/v1/TinyIframeEvents.min.js +1 -1
  15. package/dist/v1/TinyLocalStorage.min.js +1 -1
  16. package/dist/v1/TinyMediaPlayer.min.js +1 -1
  17. package/dist/v1/TinyNewWinEvents.min.js +1 -1
  18. package/dist/v1/TinyNotifyCenter.min.js +1 -1
  19. package/dist/v1/TinyRadioFm.min.js +1 -1
  20. package/dist/v1/TinyRateLimiter.min.js +1 -1
  21. package/dist/v1/TinySmartScroller.min.js +1 -1
  22. package/dist/v1/TinyTextDiffer.min.js +1 -1
  23. package/dist/v1/TinyTextarea.min.js +1 -1
  24. package/dist/v1/TinyTimeout.min.js +1 -1
  25. package/dist/v1/TinyToastNotify.min.js +1 -1
  26. package/dist/v1/TinyUploadClicker.min.js +1 -1
  27. package/dist/v1/UltraRandomMsgGen.min.js +1 -1
  28. package/dist/v1/basics/array.cjs +57 -9
  29. package/dist/v1/basics/array.d.mts +27 -11
  30. package/dist/v1/basics/array.mjs +51 -9
  31. package/dist/v1/basics/clock.cjs +94 -42
  32. package/dist/v1/basics/clock.d.mts +10 -10
  33. package/dist/v1/basics/clock.mjs +91 -54
  34. package/dist/v1/basics/deprecated/html.cjs +246 -0
  35. package/dist/v1/basics/deprecated/html.d.mts +63 -0
  36. package/dist/v1/basics/deprecated/html.mjs +190 -0
  37. package/dist/v1/basics/html.cjs +149 -130
  38. package/dist/v1/basics/html.d.mts +26 -61
  39. package/dist/v1/basics/html.mjs +113 -105
  40. package/dist/v1/basics/index.cjs +2 -0
  41. package/dist/v1/basics/index.d.mts +3 -1
  42. package/dist/v1/basics/index.mjs +3 -3
  43. package/dist/v1/basics/mediaContent.cjs +51 -9
  44. package/dist/v1/basics/mediaContent.d.mts +0 -87
  45. package/dist/v1/basics/mediaContent.mjs +40 -10
  46. package/dist/v1/basics/objChecker.cjs +7 -5
  47. package/dist/v1/basics/objChecker.d.mts +3 -2
  48. package/dist/v1/basics/objChecker.mjs +6 -6
  49. package/dist/v1/basics/objFilter.cjs +40 -7
  50. package/dist/v1/basics/objFilter.d.mts +6 -6
  51. package/dist/v1/basics/objFilter.mjs +32 -7
  52. package/dist/v1/basics/simpleMath.cjs +81 -25
  53. package/dist/v1/basics/simpleMath.d.mts +2 -2
  54. package/dist/v1/basics/simpleMath.mjs +70 -27
  55. package/dist/v1/basics/text.cjs +76 -31
  56. package/dist/v1/basics/text.d.mts +69 -7
  57. package/dist/v1/basics/text.mjs +62 -31
  58. package/dist/v1/index.cjs +4 -0
  59. package/dist/v1/index.d.mts +4 -1
  60. package/dist/v1/index.mjs +4 -3
  61. package/dist/v1/libs/TinyAdvancedRaffle.cjs +64 -50
  62. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +4 -13
  63. package/dist/v1/libs/TinyAdvancedRaffle.mjs +62 -49
  64. package/dist/v1/libs/TinyAfterScrollWatcher.cjs +17 -1
  65. package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +4 -1
  66. package/dist/v1/libs/TinyAfterScrollWatcher.mjs +15 -1
  67. package/dist/v1/libs/TinyAnalogClock.cjs +60 -0
  68. package/dist/v1/libs/TinyAnalogClock.d.mts +6 -0
  69. package/dist/v1/libs/TinyAnalogClock.mjs +57 -0
  70. package/dist/v1/libs/TinyClipboard.cjs +2 -0
  71. package/dist/v1/libs/TinyClipboard.d.mts +4 -2
  72. package/dist/v1/libs/TinyClipboard.mjs +2 -0
  73. package/dist/v1/libs/TinyColorConverter.cjs +1 -0
  74. package/dist/v1/libs/TinyColorConverter.d.mts +2 -1
  75. package/dist/v1/libs/TinyColorConverter.mjs +1 -0
  76. package/dist/v1/libs/TinyDayNightCycle.cjs +67 -42
  77. package/dist/v1/libs/TinyDayNightCycle.d.mts +2 -7
  78. package/dist/v1/libs/TinyDayNightCycle.mjs +65 -41
  79. package/dist/v1/libs/TinyDragDropDetector.cjs +25 -0
  80. package/dist/v1/libs/TinyDragDropDetector.d.mts +6 -0
  81. package/dist/v1/libs/TinyDragDropDetector.mjs +22 -0
  82. package/dist/v1/libs/TinyDragger.cjs +46 -19
  83. package/dist/v1/libs/TinyDragger.mjs +45 -18
  84. package/dist/v1/libs/TinyElementObserver.cjs +39 -0
  85. package/dist/v1/libs/TinyElementObserver.d.mts +6 -0
  86. package/dist/v1/libs/TinyElementObserver.mjs +36 -0
  87. package/dist/v1/libs/TinyGamepad.cjs +131 -1
  88. package/dist/v1/libs/TinyGamepad.mjs +129 -1
  89. package/dist/v1/libs/TinyHtml.cjs +1 -1
  90. package/dist/v1/libs/TinyHtml.mjs +2 -2
  91. package/dist/v1/libs/TinyI18.cjs +61 -0
  92. package/dist/v1/libs/TinyI18.d.mts +14 -0
  93. package/dist/v1/libs/TinyI18.mjs +55 -0
  94. package/dist/v1/libs/TinyIframeEvents.cjs +18 -1
  95. package/dist/v1/libs/TinyIframeEvents.mjs +18 -1
  96. package/dist/v1/libs/TinyLocalStorage.cjs +48 -0
  97. package/dist/v1/libs/TinyLocalStorage.d.mts +6 -0
  98. package/dist/v1/libs/TinyLocalStorage.mjs +45 -0
  99. package/dist/v1/libs/TinyMediaPlayer.cjs +72 -0
  100. package/dist/v1/libs/TinyMediaPlayer.d.mts +10 -0
  101. package/dist/v1/libs/TinyMediaPlayer.mjs +66 -0
  102. package/dist/v1/libs/TinyNewWinEvents.cjs +29 -0
  103. package/dist/v1/libs/TinyNewWinEvents.d.mts +6 -0
  104. package/dist/v1/libs/TinyNewWinEvents.mjs +26 -0
  105. package/dist/v1/libs/TinyNotifyCenter.cjs +36 -0
  106. package/dist/v1/libs/TinyNotifyCenter.d.mts +6 -0
  107. package/dist/v1/libs/TinyNotifyCenter.mjs +32 -0
  108. package/dist/v1/libs/TinyRadioFm.cjs +38 -0
  109. package/dist/v1/libs/TinyRadioFm.d.mts +1 -0
  110. package/dist/v1/libs/TinyRadioFm.mjs +35 -0
  111. package/dist/v1/libs/TinyRateLimiter.cjs +52 -0
  112. package/dist/v1/libs/TinyRateLimiter.d.mts +6 -0
  113. package/dist/v1/libs/TinyRateLimiter.mjs +48 -0
  114. package/dist/v1/libs/TinySmartScroller.cjs +52 -3
  115. package/dist/v1/libs/TinySmartScroller.d.mts +17 -15
  116. package/dist/v1/libs/TinySmartScroller.mjs +51 -5
  117. package/dist/v1/libs/TinyTextDiffer.cjs +19 -18
  118. package/dist/v1/libs/TinyTextDiffer.d.mts +1 -0
  119. package/dist/v1/libs/TinyTextDiffer.mjs +16 -17
  120. package/dist/v1/libs/TinyTextarea.cjs +19 -0
  121. package/dist/v1/libs/TinyTextarea.d.mts +6 -0
  122. package/dist/v1/libs/TinyTextarea.mjs +17 -0
  123. package/dist/v1/libs/TinyTimeout.cjs +11 -1
  124. package/dist/v1/libs/TinyTimeout.mjs +9 -1
  125. package/dist/v1/libs/TinyToastNotify.cjs +35 -0
  126. package/dist/v1/libs/TinyToastNotify.d.mts +6 -0
  127. package/dist/v1/libs/TinyToastNotify.mjs +31 -0
  128. package/dist/v1/libs/TinyUploadClicker.cjs +19 -0
  129. package/dist/v1/libs/TinyUploadClicker.d.mts +6 -0
  130. package/dist/v1/libs/TinyUploadClicker.mjs +17 -0
  131. package/dist/v1/libs/UltraRandomMsgGen.cjs +148 -35
  132. package/dist/v1/libs/UltraRandomMsgGen.d.mts +17 -3
  133. package/dist/v1/libs/UltraRandomMsgGen.mjs +133 -34
  134. package/dist/v1/libs/utils.cjs +21 -0
  135. package/dist/v1/libs/utils.d.mts +2 -0
  136. package/dist/v1/libs/utils.mjs +16 -0
  137. package/docs/v1/README.md +1 -0
  138. package/docs/v1/basics/array.md +2 -2
  139. package/docs/v1/basics/deprecated/html.md +17 -0
  140. package/docs/v1/basics/fullScreen.md +1 -1
  141. package/docs/v1/basics/html.md +12 -26
  142. package/docs/v1/basics/mediaContent.md +1 -1
  143. package/docs/v1/basics/objChecker.md +1 -1
  144. package/docs/v1/basics/text.md +2 -2
  145. package/docs/v1/fileManager/main.md +1 -1
  146. package/docs/v1/libs/ColorSafeStringify.md +1 -1
  147. package/docs/v1/libs/TinyAfterScrollWatcher.md +1 -1
  148. package/docs/v1/libs/TinyAnalogClock.md +1 -1
  149. package/docs/v1/libs/TinyArrayComparator.md +1 -1
  150. package/docs/v1/libs/TinyArrayPaginator.md +1 -1
  151. package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +2 -2
  152. package/docs/v1/libs/TinyClassManager.md +1 -1
  153. package/docs/v1/libs/TinyClipboard.md +1 -1
  154. package/docs/v1/libs/TinyCookieConsent.md +1 -1
  155. package/docs/v1/libs/TinyDomReadyManager.md +1 -1
  156. package/docs/v1/libs/TinyDragDropDetector.md +1 -1
  157. package/docs/v1/libs/TinyDragger.md +1 -1
  158. package/docs/v1/libs/TinyElementObserver.md +1 -1
  159. package/docs/v1/libs/TinyHtml.md +1 -1
  160. package/docs/v1/libs/TinyIframeEvents.md +2 -2
  161. package/docs/v1/libs/TinyLevelUp.md +1 -1
  162. package/docs/v1/libs/TinyLoadingScreen.md +1 -1
  163. package/docs/v1/libs/TinyNewWinEvents.md +2 -2
  164. package/docs/v1/libs/TinyNotifications.md +1 -1
  165. package/docs/v1/libs/TinyPromiseQueue.md +2 -2
  166. package/docs/v1/libs/TinyTextDiffer.md +1 -1
  167. package/docs/v1/libs/TinyTextarea.md +1 -1
  168. package/package.json +10 -1
@@ -1 +1 @@
1
- (()=>{"use strict";const e={d:(o,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var i=t[r++],n=t[r++];e.o(o,i)?0===n&&r++:0===n?Object.defineProperty(o,i,{enumerable:!0,value:t[r++]}):Object.defineProperty(o,i,{enumerable:!0,get:n})}else for(var i in t)e.o(t,i)&&!e.o(o,i)&&Object.defineProperty(o,i,{enumerable:!0,get:t[i]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)};let o={};e.d(o,{TinyTimeout:()=>r});class t{#e=!1;#o;#t;#r=null;#i=new Map;constructor({cooldownWatcherTime:e=5e3,allowAutoConfigChange:o=!1}={}){if(!Number.isFinite(e)||e<=0)throw new TypeError("Expected 'cooldownWatcherTime' to be a positive number.");if("boolean"!=typeof o)throw new TypeError("Expected 'allowAutoConfigChange' to be a boolean.");this.#t=e,this.#o=o,this.setCooldownWatcherTime(e)}isDestroyed(){return this.#e}getAllowAutoConfigChange(){return this.#o}getCooldownWatcherTime(){return this.#t}setAllowAutoConfigChange(e){if("boolean"!=typeof e)throw new TypeError("Expected 'value' to be a boolean.");this.#o=e}setCooldownWatcherTime(e){if(this.#e)throw new Error("TinyTimeout has been destroyed.");if(!Number.isFinite(e)||e<=0)throw new TypeError("Expected 'value' to be a positive number.");this.#t=e,this.#r&&clearInterval(this.#r),this.#r=setInterval(()=>{this.#i.forEach(e=>{e.now>0&&e.now--})},this.#t)}set(e,o,t,r=null){if(this.#e)throw new Error("TinyTimeout has been destroyed.");if("string"!=typeof e||""===e.trim())throw new TypeError("Expected 'id' to be a non-empty string.");if("function"!=typeof o)throw new TypeError("Expected 'callback' to be a function.");if(!Number.isFinite(t)||t<0)throw new TypeError("Expected 'value' to be a non-negative number.");if(null!==r&&(!Number.isFinite(r)||r<0))throw new TypeError("Expected 'limit' to be null or a non-negative number.");let i=this.#i.get(e);(!i||this.#o&&t!==i.value)&&(i={value:t,now:0},this.#i.set(e,i));const n=i.value*i.now;return i.now++,setTimeout(o,"number"==typeof r?Math.min(n,r):n)}static waitForTrue(e,o=100){if("function"!=typeof e)throw new TypeError("Expected 'getValue' to be a function.");if(!Number.isFinite(o)||o<=0)throw new TypeError("Expected 'checkInterval' to be a positive number.");return new Promise(t=>{const r=setInterval(()=>{e()&&(clearInterval(r),t())},o)})}waitForTrue(e,o=100){if(this.#e)throw new Error("TinyTimeout has been destroyed.");if("function"!=typeof e)throw new TypeError("Expected 'getValue' to be a function.");if(null!==o&&(!Number.isFinite(o)||o<=0))throw new TypeError("Expected 'checkInterval' to be null or a positive number.");return t.waitForTrue(e,o??this.#t)}destroy(){this.#e||(this.#e=!0,this.#r&&clearInterval(this.#r),this.#r=null,this.#i.clear())}}const r=t;window.TinyTimeout=o.TinyTimeout})();
1
+ (()=>{"use strict";const e={d:(t,o)=>{if(Array.isArray(o))for(var r=0;r<o.length;){var i=o[r++],n=o[r++];e.o(t,i)?0===n&&r++:0===n?Object.defineProperty(t,i,{enumerable:!0,value:o[r++]}):Object.defineProperty(t,i,{enumerable:!0,get:n})}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,{TinyTimeout:()=>i});const o=e=>{if(e)throw new Error("This TinyTimeout instance has been destroyed and can no longer be used.")};class r{#e=!1;#t;#o;#r=null;#i=new Map;constructor({cooldownWatcherTime:e=5e3,allowAutoConfigChange:t=!1}={}){if(!Number.isFinite(e)||e<=0)throw new TypeError("Expected 'cooldownWatcherTime' to be a positive number.");if("boolean"!=typeof t)throw new TypeError("Expected 'allowAutoConfigChange' to be a boolean.");this.#o=e,this.#t=t,this.setCooldownWatcherTime(e)}isDestroyed(){return this.#e}getAllowAutoConfigChange(){return o(this.#e),this.#t}getCooldownWatcherTime(){return o(this.#e),this.#o}setAllowAutoConfigChange(e){if(o(this.#e),"boolean"!=typeof e)throw new TypeError("Expected 'value' to be a boolean.");this.#t=e}setCooldownWatcherTime(e){if(o(this.#e),this.#e)throw new Error("TinyTimeout has been destroyed.");if(!Number.isFinite(e)||e<=0)throw new TypeError("Expected 'value' to be a positive number.");this.#o=e,this.#r&&clearInterval(this.#r),this.#r=setInterval(()=>{this.#i.forEach(e=>{e.now>0&&e.now--})},this.#o)}set(e,t,r,i=null){if(o(this.#e),this.#e)throw new Error("TinyTimeout has been destroyed.");if("string"!=typeof e||""===e.trim())throw new TypeError("Expected 'id' to be a non-empty string.");if("function"!=typeof t)throw new TypeError("Expected 'callback' to be a function.");if(!Number.isFinite(r)||r<0)throw new TypeError("Expected 'value' to be a non-negative number.");if(null!==i&&(!Number.isFinite(i)||i<0))throw new TypeError("Expected 'limit' to be null or a non-negative number.");let n=this.#i.get(e);(!n||this.#t&&r!==n.value)&&(n={value:r,now:0},this.#i.set(e,n));const s=n.value*n.now;return n.now++,setTimeout(t,"number"==typeof i?Math.min(s,i):s)}static waitForTrue(e,t=100){if("function"!=typeof e)throw new TypeError("Expected 'getValue' to be a function.");if(!Number.isFinite(t)||t<=0)throw new TypeError("Expected 'checkInterval' to be a positive number.");return new Promise(o=>{const r=setInterval(()=>{e()&&(clearInterval(r),o())},t)})}waitForTrue(e,t=100){if(o(this.#e),this.#e)throw new Error("TinyTimeout has been destroyed.");if("function"!=typeof e)throw new TypeError("Expected 'getValue' to be a function.");if(null!==t&&(!Number.isFinite(t)||t<=0))throw new TypeError("Expected 'checkInterval' to be null or a positive number.");return r.waitForTrue(e,t??this.#o)}destroy(){this.#e||(this.#r&&clearInterval(this.#r),this.#r=null,this.#i.clear(),this.#e=!0)}}const i=r;window.TinyTimeout=t.TinyTimeout})();
@@ -1 +1 @@
1
- (()=>{"use strict";const t={d:(e,i)=>{if(Array.isArray(i))for(var n=0;n<i.length;){var a=i[n++],r=i[n++];t.o(e,a)?0===r&&n++:0===r?Object.defineProperty(e,a,{enumerable:!0,value:i[n++]}):Object.defineProperty(e,a,{enumerable:!0,get:r})}else for(var a in i)t.o(i,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:i[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};let e={};t.d(e,{TinyToastNotify:()=>i});const i=class{#t;#e;#i;#n;#a;#r;constructor(t="top",e="right",i=3e3,n=50,a=300,r=".notify-container"){this.#o(t),this.#s(e),this.#l(i,"baseDuration"),this.#l(n,"extraPerChar"),this.#l(a,"fadeOutDuration"),this.#t=t,this.#e=e,this.#i=i,this.#n=n,this.#a=a;const o=document.querySelector(`${r}.${t}.${e}`);o instanceof HTMLElement?this.#r=o:(this.#r=document.createElement("div"),this.#r.className=`notify-container ${t} ${e}`,document.body.appendChild(this.#r))}getContainer(){if(!(this.#r instanceof HTMLElement))throw new Error("Container is not a valid HTMLElement.");return this.#r}#o(t){if(!["top","bottom"].includes(t))throw new Error(`Invalid vertical direction "${t}". Expected "top" or "bottom".`)}#s(t){if(!["left","right","center"].includes(t))throw new Error(`Invalid horizontal position "${t}". Expected "left", "right" or "center".`)}#l(t,e){if("number"!=typeof t||t<0||!Number.isFinite(t))throw new Error(`Invalid value for "${e}": ${t}. Must be a non-negative finite number.`)}getY(){return this.#t}setY(t){this.#o(t);const e=this.getContainer();e.classList.remove(this.#t),e.classList.add(t),this.#t=t}getX(){return this.#e}setX(t){this.#s(t);const e=this.getContainer();e.classList.remove(this.#e),e.classList.add(t),this.#e=t}getBaseDuration(){return this.#i}setBaseDuration(t){this.#l(t,"baseDuration"),this.#i=t}getExtraPerChar(){return this.#n}setExtraPerChar(t){this.#l(t,"extraPerChar"),this.#n=t}getFadeOutDuration(){return this.#a}setFadeOutDuration(t){this.#l(t,"fadeOutDuration"),this.#a=t}show(t){let e="",i="",n=null,a=!1,r=null;const o=document.createElement("div");if(o.className="notify enter","string"==typeof t)e=t;else{if("object"!=typeof t||null===t||"string"!=typeof t.message)throw new Error("Invalid argument for show(): expected string or { message: string, title?: string, onClick?: function, html?: boolean, avatar?: string }");if(e=t.message,i="string"==typeof t.title?t.title:"",a=!0===t.html,r="string"==typeof t.avatar?t.avatar:null,void 0!==t.onClick){if("function"!=typeof t.onClick)throw new Error("onClick must be a function if defined");n=t.onClick,o.classList.add("clickable")}}const s=document.createElement("button");if(s.innerHTML="&times;",s.className="close",s.setAttribute("aria-label","Close"),s.addEventListener("mouseenter",()=>{s.style.color="var(--notify-close-color-hover)"}),s.addEventListener("mouseleave",()=>{s.style.color="var(--notify-close-color)"}),r){const t=document.createElement("img");t.src=r,t.alt="avatar",t.className="avatar",o.appendChild(t)}if(i){const t=document.createElement("strong");t.textContent=i,t.style.display="block",o.appendChild(t)}if(a){const t=document.createElement("div");t.innerHTML=e,o.appendChild(t)}else o.appendChild(document.createTextNode(e));o.appendChild(s),this.getContainer().appendChild(o);const l=this.#i+e.length*this.#n+this.#a;let c=!1;const d=()=>{c||(c=!0,o.classList.remove("enter","show"),o.classList.add("exit"),setTimeout(()=>o.remove(),this.#a))};"function"==typeof n&&o.addEventListener("click",t=>{t.target!==s&&n(t,d)}),s.addEventListener("click",t=>{t.stopPropagation(),d()}),setTimeout(()=>{o.classList.remove("enter"),o.classList.add("show")},1),setTimeout(()=>d(),l)}destroy(){this.#r instanceof HTMLElement&&(this.#r.querySelectorAll(".notify").forEach(t=>t.remove()),this.#r.parentNode&&this.#r.parentNode.removeChild(this.#r),this.#r=null)}};window.TinyToastNotify=e.TinyToastNotify})();
1
+ (()=>{"use strict";const t={d:(e,i)=>{if(Array.isArray(i))for(var r=0;r<i.length;){var n=i[r++],a=i[r++];t.o(e,n)?0===a&&r++:0===a?Object.defineProperty(e,n,{enumerable:!0,value:i[r++]}):Object.defineProperty(e,n,{enumerable:!0,get:a})}else for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};let e={};t.d(e,{TinyToastNotify:()=>r});const i=t=>{if(t)throw new Error("This TinyToastNotify instance has been destroyed and can no longer be used.")};const r=class{#t;#e;#i;#r;#n;#a;#o=!1;get destroyed(){return this.#o}constructor(t="top",e="right",i=3e3,r=50,n=300,a=".notify-container"){this.#s(t),this.#d(e),this.#l(i,"baseDuration"),this.#l(r,"extraPerChar"),this.#l(n,"fadeOutDuration"),this.#t=t,this.#e=e,this.#i=i,this.#r=r,this.#n=n;const o=document.querySelector(`${a}.${t}.${e}`);o instanceof HTMLElement?this.#a=o:(this.#a=document.createElement("div"),this.#a.className=`notify-container ${t} ${e}`,document.body.appendChild(this.#a))}getContainer(){if(i(this.#o),!(this.#a instanceof HTMLElement))throw new Error("Container is not a valid HTMLElement.");return this.#a}#s(t){if(!["top","bottom"].includes(t))throw new Error(`Invalid vertical direction "${t}". Expected "top" or "bottom".`)}#d(t){if(!["left","right","center"].includes(t))throw new Error(`Invalid horizontal position "${t}". Expected "left", "right" or "center".`)}#l(t,e){if("number"!=typeof t||t<0||!Number.isFinite(t))throw new Error(`Invalid value for "${e}": ${t}. Must be a non-negative finite number.`)}getY(){return i(this.#o),this.#t}setY(t){i(this.#o),this.#s(t);const e=this.getContainer();e.classList.remove(this.#t),e.classList.add(t),this.#t=t}getX(){return i(this.#o),this.#e}setX(t){i(this.#o),this.#d(t);const e=this.getContainer();e.classList.remove(this.#e),e.classList.add(t),this.#e=t}getBaseDuration(){return i(this.#o),this.#i}setBaseDuration(t){i(this.#o),this.#l(t,"baseDuration"),this.#i=t}getExtraPerChar(){return i(this.#o),this.#r}setExtraPerChar(t){i(this.#o),this.#l(t,"extraPerChar"),this.#r=t}getFadeOutDuration(){return i(this.#o),this.#n}setFadeOutDuration(t){i(this.#o),this.#l(t,"fadeOutDuration"),this.#n=t}show(t){i(this.#o);let e="",r="",n=null,a=!1,o=null;const s=document.createElement("div");if(s.className="notify enter","string"==typeof t)e=t;else{if("object"!=typeof t||null===t||"string"!=typeof t.message)throw new Error("Invalid argument for show(): expected string or { message: string, title?: string, onClick?: function, html?: boolean, avatar?: string }");if(e=t.message,r="string"==typeof t.title?t.title:"",a=!0===t.html,o="string"==typeof t.avatar?t.avatar:null,void 0!==t.onClick){if("function"!=typeof t.onClick)throw new Error("onClick must be a function if defined");n=t.onClick,s.classList.add("clickable")}}const d=document.createElement("button");if(d.innerHTML="&times;",d.className="close",d.setAttribute("aria-label","Close"),d.addEventListener("mouseenter",()=>{d.style.color="var(--notify-close-color-hover)"}),d.addEventListener("mouseleave",()=>{d.style.color="var(--notify-close-color)"}),o){const t=document.createElement("img");t.src=o,t.alt="avatar",t.className="avatar",s.appendChild(t)}if(r){const t=document.createElement("strong");t.textContent=r,t.style.display="block",s.appendChild(t)}if(a){const t=document.createElement("div");t.innerHTML=e,s.appendChild(t)}else s.appendChild(document.createTextNode(e));s.appendChild(d),this.getContainer().appendChild(s);const l=this.#i+e.length*this.#r+this.#n;let c=!1;const h=()=>{c||(c=!0,s.classList.remove("enter","show"),s.classList.add("exit"),setTimeout(()=>s.remove(),this.#n))};"function"==typeof n&&s.addEventListener("click",t=>{t.target!==d&&n(t,h)}),d.addEventListener("click",t=>{t.stopPropagation(),h()}),setTimeout(()=>{s.classList.remove("enter"),s.classList.add("show")},1),setTimeout(()=>h(),l)}destroy(){this.#o||this.#a instanceof HTMLElement&&(this.#a.querySelectorAll(".notify").forEach(t=>t.remove()),this.#a.parentNode&&this.#a.parentNode.removeChild(this.#a),this.#a=null,this.#o=!0)}};window.TinyToastNotify=e.TinyToastNotify})();