tiny-essentials 1.26.4 → 1.27.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.
- package/.github/workflows/node.js.yml +1 -1
- package/README.md +0 -1
- package/TinyFork.mjs +7 -7
- package/changelog/1/27/0.md +24 -0
- package/changelog/1/27/1.md +2 -0
- package/dist/v1/ColorSafeStringify.min.js +1 -1
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyAnalogClock.min.js +1 -1
- package/dist/v1/TinyArrayComparator.min.js +1 -1
- package/dist/v1/TinyArrayPaginator.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyClassManager.min.js +1 -1
- package/dist/v1/TinyClipboard.min.js +1 -1
- package/dist/v1/TinyColorConverter.min.js +1 -1
- package/dist/v1/TinyColorValidator.min.js +1 -1
- package/dist/v1/TinyCookieConsent.min.js +1 -1
- package/dist/v1/TinyDayNightCycle.min.js +1 -1
- package/dist/v1/TinyDomReadyManager.min.js +1 -1
- package/dist/v1/TinyDragDropDetector.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyElementObserver.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyEvents.min.js +1 -1
- package/dist/v1/TinyGamepad.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyI18.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyInventory.min.js +1 -1
- package/dist/v1/TinyInventoryTrader.min.js +1 -1
- package/dist/v1/TinyLevelUp.min.js +1 -1
- package/dist/v1/TinyLoadingScreen.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMaInSys.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -0
- package/dist/v1/TinyNeedBar.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyNotifications.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyPromiseQueue.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -0
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinySimpleDice.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextDiffer.min.js +1 -1
- package/dist/v1/TinyTextRangeEditor.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -1
- package/dist/v1/TinyTimeout.min.js +1 -1
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/index.cjs +5 -0
- package/dist/v1/basics/index.d.mts +5 -1
- package/dist/v1/basics/index.mjs +2 -1
- package/dist/v1/basics/mediaContent.cjs +644 -0
- package/dist/v1/basics/mediaContent.d.mts +296 -0
- package/dist/v1/basics/mediaContent.mjs +557 -0
- package/dist/v1/build/TinyMediaPlayer.cjs +7 -0
- package/dist/v1/build/TinyMediaPlayer.d.mts +3 -0
- package/dist/v1/build/TinyMediaPlayer.mjs +2 -0
- package/dist/v1/build/TinyRadioFm.cjs +7 -0
- package/dist/v1/build/TinyRadioFm.d.mts +3 -0
- package/dist/v1/build/TinyRadioFm.mjs +2 -0
- package/dist/v1/index.cjs +9 -0
- package/dist/v1/index.d.mts +7 -1
- package/dist/v1/index.mjs +5 -2
- package/dist/v1/libs/ColorSafeStringify.d.mts +1 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +16 -3
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +7 -3
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +13 -3
- package/dist/v1/libs/TinyArrayComparator.cjs +14 -11
- package/dist/v1/libs/TinyArrayComparator.d.mts +22 -19
- package/dist/v1/libs/TinyArrayComparator.mjs +14 -11
- package/dist/v1/libs/TinyArrayPaginator.cjs +23 -16
- package/dist/v1/libs/TinyArrayPaginator.d.mts +57 -30
- package/dist/v1/libs/TinyArrayPaginator.mjs +22 -16
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.cjs +265 -0
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +92 -0
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.mjs +223 -0
- package/dist/v1/libs/TinyClassManager.cjs +52 -22
- package/dist/v1/libs/TinyClassManager.d.mts +26 -16
- package/dist/v1/libs/TinyClassManager.mjs +50 -21
- package/dist/v1/libs/TinyColorValidator.d.mts +16 -16
- package/dist/v1/libs/TinyDragDropDetector.cjs +9 -34
- package/dist/v1/libs/TinyDragDropDetector.d.mts +7 -21
- package/dist/v1/libs/TinyDragDropDetector.mjs +9 -24
- package/dist/v1/libs/TinyDragger.cjs +5 -5
- package/dist/v1/libs/TinyDragger.d.mts +4 -3
- package/dist/v1/libs/TinyDragger.mjs +5 -5
- package/dist/v1/libs/TinyElementObserver.cjs +6 -21
- package/dist/v1/libs/TinyElementObserver.d.mts +6 -15
- package/dist/v1/libs/TinyElementObserver.mjs +6 -20
- package/dist/v1/libs/TinyGamepad.cjs +4 -6
- package/dist/v1/libs/TinyGamepad.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/index.d.mts +1 -1
- package/dist/v1/libs/TinyHtml.cjs +72 -98
- package/dist/v1/libs/TinyHtml.d.mts +15 -32
- package/dist/v1/libs/TinyHtml.mjs +53 -77
- package/dist/v1/libs/TinyInventory.d.mts +1 -1
- package/dist/v1/libs/TinyMediaPlayer.cjs +844 -0
- package/dist/v1/libs/TinyMediaPlayer.d.mts +306 -0
- package/dist/v1/libs/TinyMediaPlayer.mjs +755 -0
- package/dist/v1/libs/TinyRadioFm.cjs +1378 -0
- package/dist/v1/libs/TinyRadioFm.d.mts +554 -0
- package/dist/v1/libs/TinyRadioFm.mjs +1137 -0
- package/dist/v1/libs/TinySmartScroller.cjs +39 -26
- package/dist/v1/libs/TinySmartScroller.d.mts +16 -62
- package/dist/v1/libs/TinySmartScroller.mjs +35 -26
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +7 -7
- package/docs/v1/README.md +6 -0
- package/docs/v1/basics/mediaContent.md +131 -0
- package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +107 -0
- package/docs/v1/libs/TinyDragDropDetector.md +5 -9
- package/docs/v1/libs/TinyElementObserver.md +3 -6
- package/docs/v1/libs/TinyHtml.md +0 -29
- package/docs/v1/libs/TinyMediaPlayer.md +100 -0
- package/docs/v1/libs/TinyRadioFm.md +141 -0
- package/docs/v1/libs/TinySmartScroller.md +3 -3
- package/package.json +40 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";
|
|
1
|
+
(()=>{"use strict";const e={d:(t,r)=>{if(Array.isArray(r))for(var o=0;o<r.length;){var n=r[o++],a=r[o++];e.o(t,n)?0===a&&o++:0===a?Object.defineProperty(t,n,{enumerable:!0,value:r[o++]}):Object.defineProperty(t,n,{enumerable:!0,get:a})}else for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyClipboard:()=>r});const r=class{#e=!1;#t=!1;#r=null;#o=null;constructor(){void 0!==navigator.clipboard&&null!==navigator.clipboard&&(this.#t=!0,this.#r=e=>navigator.clipboard.writeText(e),this.#o=e=>navigator.clipboard.write([new ClipboardItem({[e.type]:e})])),this.#e=void 0!==document.execCommand&&null!==document.execCommand}setCopyText(e){if("function"!=typeof e)throw new TypeError("setCopyText expected a function that returns Promise<void>.");this.#r=e}setCopyBlob(e){if("function"!=typeof e)throw new TypeError("setCopyBlob expected a function that returns Promise<void>.");this.#o=e}copyText(e){if("string"!=typeof e)throw new TypeError("copyText expected a string.");if(this.#r)return this.#r(e);if(this.#e){const t=document.body,r=document.createElement("input");return r.style.position="fixed",r.style.opacity="0",r.value=e,t.append(r),r.select(),r.setSelectionRange(0,99999),document.execCommand("Copy"),r.remove(),new Promise(e=>e(void 0))}throw new Error("Clipboard API not found!")}copyBlob(e){if(!(e instanceof Blob))throw new TypeError("copyBlob expected a Blob instance.");return new Promise((t,r)=>{if(this.#o)return this.#o(e).then(t).catch(r);throw new Error("Clipboard API not found!")})}_handleBlob(e,t){return t.getType(e)}_handleText(e,t){return this._handleBlob(e,t).then(e=>e.text())}_readData(e=0,t=null,r=null,o=!1){return new Promise((n,a)=>{this._read(e).then(i=>{if(!i)return n(null);const s=[];let l=!0;const c=async(e,n)=>{if(l)if(null!==t&&"custom"!==t||"string"!=typeof r||!(!o&&e.startsWith(r)||o&&e===r))if(null!==t&&"text"!==t||"text/plain"!==e){if(null===t){l=!1;const t=await this._handleBlob(e,n);t&&s.push(t)}}else{l=!1;const t=await this._handleText(e,n);t&&s.push(t)}else{l=!1;const t=await this._handleBlob(e,n);t&&s.push(t)}},d=[],u=e=>{if(!(e instanceof ClipboardItem))throw new Error("Expected ClipboardItem when reading data.");for(const t in e.types)d.push(c(e.types[t],e))};if("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)&&e>-1)u(i),Promise.all(d).then(()=>{s[0]?n(s[0]):n(null)}).catch(a);else if(Array.isArray(i)){for(const e in i)u(i[e]);Promise.all(d).then(()=>n(s)).catch(a)}}).catch(a)})}async readText(e=0){const t=await this._readData(e,"text");if("string"!=typeof t)throw new Error("Failed to read text: expected string result.");return t}async readCustom(e=null,t=!1,r=0){const o=await this._readData(r,"custom",e,t);if(!(o instanceof Blob))throw new Error("Failed to read custom data: expected Blob.");return o}async readAllTexts(){const e=await this._readData(null,"text");if(!Array.isArray(e))throw new Error("Expected array of strings when reading all texts.");if(!e.every(e=>"string"==typeof e))throw new Error("Some values returned were not strings.");return e}async readAllCustom(e=null,t=!1){const r=await this._readData(null,"custom",e,t);if(!Array.isArray(r))throw new Error("Expected array of blobs when reading all custom items.");if(!r.every(e=>e instanceof Blob))throw new Error("Some values returned were not Blob instances.");return r}async readAllData(e=null,t=null){const r=await this._readData(null,e,t);if(!Array.isArray(r))throw new Error("Expected array result when reading all data.");return r}_read(e){return new Promise((t,r)=>{this.#t||r(new Error("Clipboard API not found!")),navigator.clipboard.read().then(r=>{if("number"==typeof e){if(Number.isNaN(e)||!Number.isFinite(e)||e<0)throw new Error(`Invalid index value: ${e}`);r[e]?t(r[e]):t(null)}t(r)}).catch(r)})}async readIndex(e){const t=await this._read(e);if(null!==t&&!(t instanceof ClipboardItem))throw new Error(`Value at index ${e} is not a ClipboardItem.`);return t}async readAll(){const e=await this._read(null);if(!Array.isArray(e))throw new Error("Expected array result from clipboard read.");for(const t of e)if(!(t instanceof ClipboardItem))throw new Error("Invalid item type found in clipboard result.");return e}isExecCommandAvailable(){return this.#e}isNavigatorClipboardAvailable(){return this.#t}getCopyTextFunc(){return this.#r}getCopyBlobFunc(){return this.#o}};window.TinyClipboard=t.TinyClipboard})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";
|
|
1
|
+
(()=>{"use strict";const t={d:(r,a)=>{if(Array.isArray(a))for(var s=0;s<a.length;){var n=a[s++],o=a[s++];t.o(r,n)?0===o&&s++:0===o?Object.defineProperty(r,n,{enumerable:!0,value:a[s++]}):Object.defineProperty(r,n,{enumerable:!0,get:o})}else for(var n in a)t.o(a,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:a[n]})},o:(t,r)=>Object.prototype.hasOwnProperty.call(t,r)};let r={};t.d(r,{TinyColorConverter:()=>s});class a{static _rca(t,r,a){let s=127,n=128;void 0===t&&(t=24),void 0===r&&(r="rgb"),!0===a&&(s=55,n=200);const o=2*Math.PI/t,e=[];for(let a=0;a<t;++a){const t=Math.sin(o*a+2)*s+n,i=Math.sin(o*a+0)*s+n,h=Math.sin(o*a+4)*s+n;switch(r){case"hex":e.push({hex:this.rgbToHex(Math.round(t),Math.round(i),Math.round(h))});break;case"rgb":e.push({r:t,g:i,b:h});break;case"hsl":const[r,a,s]=this.rgbaToHsl(Math.round(t),Math.round(i),Math.round(h));e.push({h:r,s:a,l:s})}}return e}static rcaRgb(t,r){return a._rca(t,"rgb",r)}static rcaHsl(t,r){return a._rca(t,"hsl",r)}static rcaHex(t,r){return a._rca(t,"hex",r)}static randomColor(){return`#${Math.floor(16777216*Math.random()).toString(16).padStart(6,"0")}`}static parseInput(t,r){if("string"==typeof t){if((t=t.trim().toLowerCase()).startsWith("#"))return this.hexToRgba(t);if(t.startsWith("rgb"))return this.rgbStringToRgbaArray(t);if(t.startsWith("hsl"))return this.hslStringToRgbaArray(t)}if("number"==typeof t)return this.intToRgba(t);if(Array.isArray(t)&&(3===t.length||4===t.length)&&t.every(t=>"number"==typeof t)){if(r){const[r,a,s,n]=t;if(r<=360&&a<=100&&s<=100)return this.hslToRgba(r,a,s,n)}return[...t,1].slice(0,4)}throw new Error("Unsupported color format.")}static hslToInt(t,r,s){const[n,o,e]=a.hslToRgba(t,r,s);return a.rgbToInt(n,o,e)}static hslToHex(t,r,s){const[n,o,e]=a.hslToRgba(t,r,s);return a.rgbToHex(n,o,e)}static hslStringToRgbaArray(t){const r=t.match(/[\d.]+/g)?.map(Number);if(!r||r.length<3)return[0,0,0,1];const[a,s,n,o=1]=r;return this.hslToRgba(a,s,n,o)}static hslToRgba(t,r,a,s=1){a/=100;const n=r=>(r+t/30)%12,o=(r/=100)*Math.min(a,1-a),e=t=>a-o*Math.max(-1,Math.min(n(t)-3,Math.min(9-n(t),1)));return[Math.round(255*e(0)),Math.round(255*e(8)),Math.round(255*e(4)),s]}static hslToRgb(t,r,s,n=1){return a.hslToRgba(t,r,s,n).slice(0,3)}static hexToInt(t){return parseInt(t.replace(/^#/,""),16)}static hexToHsl(t){const[r,s,n,o]=a.hexToRgba(t);return a.rgbaToHsl(r,s,n,o)}static hexToHsla(t){const[r,s,n,o]=a.hexToRgba(t);return a.rgbaToHsla(r,s,n,o)}static hexToRgba(t){3===(t=t.replace(/^#/,"")).length&&(t=t.split("").map(t=>t+t).join(""));const r=parseInt(t,16);return[r>>16&255,r>>8&255,255&r,1]}static hexToRgb(t){return this.hexToRgba(t).slice(0,3)}static rgbToHex(t,r,a){return"#"+[t,r,a].map(t=>t.toString(16).padStart(2,"0")).join("")}static rgbToInt(t,r,a){return t<<16|r<<8|a}static rgbaToHsla(t,r,a,s=1){t/=255,r/=255,a/=255;const n=Math.max(t,r,a),o=Math.min(t,r,a);let e=0,i=0,h=(n+o)/2;const c=n-o;if(0!==c){switch(i=c/(1-Math.abs(2*h-1)),n){case t:e=(r-a)/c+(r<a?6:0);break;case r:e=(a-t)/c+2;break;case a:e=(t-r)/c+4}e*=60}return[Math.round(e),Math.round(100*i),Math.round(100*h),s]}static rgbaToHsl(t,r,a,s){return this.rgbaToHsla(t,r,a,s).slice(0,3)}static rgbStringToRgbaArray(t){const r=t.match(/[\d.]+/g)?.map(Number);return r?[...r,1].slice(0,4):[]}static intToHsl(t){const[r,s,n,o]=a.intToRgba(t);return a.rgbaToHsl(r,s,n,o)}static intToHsla(t){const[r,s,n,o]=a.intToRgba(t);return a.rgbaToHsla(r,s,n,o)}static intToHex(t){return"#"+t.toString(16).padStart(6,"0")}static intToRgba(t){return[t>>16&255,t>>8&255,255&t,1]}#t="#000000";#r=[0,0,0,0];#a;constructor(t=null,r=!1){this.#a=r,null!=t&&this.setColor(t)}setColor(t){this.#t=t;const r=this.#a&&Array.isArray(t)&&t[0]<=360&&t[1]<=100&&t[2]<=100;this.#r=a.parseInput(t,r)}toHslaArray(){const[t,r,s,n]=this.#r;return a.rgbaToHsla(t,r,s,n)}toHslString(){const[t,r,s]=this.#r,[n,o,e]=a.rgbaToHsl(t,r,s);return`hsl(${n}, ${o}%, ${e}%)`}toHslaString(){const[t,r,s,n]=this.#r,[o,e,i,h]=a.rgbaToHsla(t,r,s,n);return`hsla(${o}, ${e}%, ${i}%, ${h??1})`}toRgbaArray(){return[...this.#r]}toRgbString(){const[t,r,a]=this.#r;return`rgb(${t}, ${r}, ${a})`}toRgbaString(){const[t,r,a,s]=this.#r;return`rgba(${t}, ${r}, ${a}, ${s??1})`}toHex(){const[t,r,s]=this.#r;return a.rgbToHex(t,r,s)}toInt(){const[t,r,s]=this.#r;return a.rgbToInt(t,r,s)}getOriginal(){return this.#t}}const s=a;window.TinyColorConverter=r.TinyColorConverter})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";
|
|
1
|
+
(()=>{"use strict";const e={d:(r,t)=>{if(Array.isArray(t))for(var s=0;s<t.length;){var a=t[s++],i=t[s++];e.o(r,a)?0===i&&s++:0===i?Object.defineProperty(r,a,{enumerable:!0,value:t[s++]}):Object.defineProperty(r,a,{enumerable:!0,get:i})}else for(var a in t)e.o(t,a)&&!e.o(r,a)&&Object.defineProperty(r,a,{enumerable:!0,get:t[a]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)};let r={};e.d(r,{TinyColorValidator:()=>s});class t{static#e=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;static#r=/^#([A-Fa-f0-9]{8})$/;static#t="(0|1|0?\\.\\d+)";static#s="(0|[1-9]\\d?|1\\d{2}|2[0-4]\\d|25[0-5])";static#a="(0|[1-9]\\d?|[1-2]\\d{2}|3[0-5]\\d|360)";static#i="(0|[1-9]?\\d|100)";static#n=new RegExp(`^rgb\\(\\s*${t.#s}\\s*,\\s*${t.#s}\\s*,\\s*${t.#s}\\s*\\)$`);static#o=new RegExp(`^rgba\\(\\s*${t.#s}\\s*,\\s*${t.#s}\\s*,\\s*${t.#s}\\s*,\\s*${t.#t}\\s*\\)$`);static#l=new RegExp(`^hsl\\(\\s*${t.#a}\\s*,\\s*${t.#i}%\\s*,\\s*${t.#i}%\\s*\\)$`);static#p=new RegExp(`^hsla\\(\\s*${t.#a}\\s*,\\s*${t.#i}%\\s*,\\s*${t.#i}%\\s*,\\s*${t.#t}\\s*\\)$`);static#u=new RegExp(`^hwb\\(\\s*${t.#a}(deg|grad|rad|turn)?\\s*${t.#i}%\\s*${t.#i}%\\s*\\)$`);static#c="(-?\\d+)";static#g=new RegExp(`^lab\\(\\s*${t.#i}%?\\s*${t.#c}%?\\s*${t.#c}%?\\s*\\)$`);static#d=new RegExp(`^lch\\(\\s*${t.#i}%?\\s*${t.#i}%?\\s*${t.#a}(deg|grad|rad|turn)?\\s*\\)$`);static#h=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);static#m=new Set(["transparent","currentColor"]);static getNames(){return Array.from(t.#h)}static addName(e){const r=t.#h.size;return t.#h.add(e.toLowerCase()),t.#h.size>r}static removeName(e){return t.#h.delete(e.toLowerCase())}static hasName(e){return t.#h.has(e.toLowerCase())}static getSpecialNames(){return Array.from(t.#m)}static addSpecialName(e){const r=t.#m.size;return t.#m.add(e),t.#m.size>r}static removeSpecialName(e){return t.#m.delete(e)}static hasSpecialName(e){return t.#m.has(e)}#E;get code(){return this.#E}#b;get type(){return this.#b}constructor(e){this.#E=e,this.#b=t.isColor(this.#E)}static isHex(e){if("string"!=typeof e)throw new TypeError("isHex: input must be a string.");return t.#e.test(e.trim())}isHex(){return t.isHex(this.#E)}static isHexa(e){if("string"!=typeof e)throw new TypeError("isHexa: input must be a string.");return t.#r.test(e.trim())}isHexa(){return t.isHexa(this.#E)}static isRgb(e){if("string"!=typeof e)throw new TypeError("isRgb: input must be a string.");return t.#n.test(e.trim())}isRgb(){return t.isRgb(this.#E)}static isRgba(e){if("string"!=typeof e)throw new TypeError("isRgba: input must be a string.");return t.#o.test(e.trim())}isRgba(){return t.isRgba(this.#E)}static isHsl(e){if("string"!=typeof e)throw new TypeError("isHsl: input must be a string.");return t.#l.test(e.trim())}isHsl(){return t.isHsl(this.#E)}static isHsla(e){if("string"!=typeof e)throw new TypeError("isHsla: input must be a string.");return t.#p.test(e.trim())}isHsla(){return t.isHsla(this.#E)}static isHwb(e){if("string"!=typeof e)throw new TypeError("isHwb: input must be a string.");return t.#u.test(e.trim())}isHwb(){return t.isHwb(this.#E)}static isLab(e){if("string"!=typeof e)throw new TypeError("isLab: input must be a string.");return t.#g.test(e.trim())}isLab(){return t.isLab(this.#E)}static isLch(e){if("string"!=typeof e)throw new TypeError("isLch: input must be a string.");return t.#d.test(e.trim())}isLch(){return t.isLch(this.#E)}static isName(e){if("string"!=typeof e)throw new TypeError("isName: input must be a string.");return t.#h.has(e.trim().toLowerCase())}isName(){return t.isName(this.#E)}static isSpecialName(e){if("string"!=typeof e)throw new TypeError("isSpecialName: input must be a string.");return t.#m.has(e.trim())}isSpecialName(){return t.isSpecialName(this.#E)}static isColor(e){if("string"!=typeof e)throw new TypeError("isColor: input must be a string.");return t.isHex(e)?"hex":t.isHexa(e)?"hexa":t.isRgb(e)?"rgb":t.isRgba(e)?"rgba":t.isHsl(e)?"hsl":t.isHsla(e)?"hsla":t.isHwb(e)?"hwb":t.isLab(e)?"lab":t.isLch(e)?"lch":t.isName(e)?"name":t.isSpecialName(e)?"specialName":null}parse(){switch(this.#b){case"hex":return t.parseHex(this.code);case"hexa":return t.parseHexa(this.code);case"rgb":return t.parseRgb(this.code);case"rgba":return t.parseRgba(this.code);case"hsl":return t.parseHsl(this.code);case"hsla":return t.parseHsla(this.code);case"hwb":return t.parseHwb(this.code);case"lab":return t.parseLab(this.code);case"lch":return t.parseLch(this.code);case"name":case"specialName":return this.#E.trim().toLowerCase();default:return null}}static parseHex(e){if("string"!=typeof e)throw new TypeError("parseHex: input must be a string.");const r=new RegExp(t.#e,"gm").exec(e.trim());return r?r[1]:null}parseHex(){return t.parseHex(this.#E)}static parseHexa(e){if("string"!=typeof e)throw new TypeError("parseHexa: input must be a string.");const r=new RegExp(t.#r,"gm").exec(e.trim());return r?r[1]:null}parseHexa(){return t.parseHexa(this.#E)}static parseRgb(e){if("string"!=typeof e)throw new TypeError("parseRgb: input must be a string.");const r=new RegExp(t.#n,"gm").exec(e.trim());return r?[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])]:null}parseRgb(){return t.parseRgb(this.#E)}static parseRgba(e){if("string"!=typeof e)throw new TypeError("parseRgba: input must be a string.");const r=new RegExp(t.#o,"gm").exec(e.trim());return r?[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3]),parseFloat(r[4])]:null}parseRgba(){return t.parseRgba(this.#E)}static parseHsl(e){if("string"!=typeof e)throw new TypeError("parseHsl: input must be a string.");const r=new RegExp(t.#l,"gm").exec(e.trim());return r?[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])]:null}parseHsl(){return t.parseHsl(this.#E)}static parseHsla(e){if("string"!=typeof e)throw new TypeError("parseHsla: input must be a string.");const r=new RegExp(t.#p,"gm").exec(e.trim());return r?[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3]),parseFloat(r[4])]:null}parseHsla(){return t.parseHsla(this.#E)}static parseHwb(e){if("string"!=typeof e)throw new TypeError("parseHwb: input must be a string.");const r=new RegExp(t.#u,"gm").exec(e.trim());return r?[parseFloat(r[1]),r[2]??null,parseFloat(r[3]),parseFloat(r[4])]:null}parseHwb(){return t.parseHwb(this.#E)}static parseLab(e){if("string"!=typeof e)throw new TypeError("parseLab: input must be a string.");const r=new RegExp(t.#g,"gm").exec(e.trim());return r?[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])]:null}parseLab(){return t.parseLab(this.#E)}static parseLch(e){if("string"!=typeof e)throw new TypeError("parseLch: input must be a string.");const r=new RegExp(t.#d,"gm").exec(e.trim());return r?[parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3]),r[4]??null]:null}parseLch(){return t.parseLch(this.#E)}}const s=t;window.TinyColorValidator=r.TinyColorValidator})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";
|
|
1
|
+
(()=>{"use strict";const e={d:(t,n)=>{if(Array.isArray(n))for(var o=0;o<n.length;){var r=n[o++],i=n[o++];e.o(t,r)?0===i&&o++:0===i?Object.defineProperty(t,r,{enumerable:!0,value:n[o++]}):Object.defineProperty(t,r,{enumerable:!0,get:i})}else for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyCookieConsent:()=>n});const n=class{#e;#t={message:"We use cookies to improve your experience.",acceptText:"Accept All",rejectText:"Reject All",settingsText:"Manage Settings",categories:[],storageKey:"cookie-consent-preferences",onSave:e=>console.log("Preferences saved:",e),animationDuration:400,renderBar:null,renderModal:null};get preferences(){const e=localStorage.getItem(this.#t.storageKey);return e?JSON.parse(e):{}}get config(){return{...this.#t,categories:[...this.#t.categories]}}set config(e){this.validateConfig(e),this.#t=Object.assign(this.#t,e)}constructor(e){if(!e||"object"!=typeof e)throw new TypeError("Config must be an object.");this.config=e;const t=this.loadPreferences();this.#e=t??{},t||this.showConsentBar()}validateConfig(e){if(void 0!==e.message&&"string"!=typeof e.message)throw new TypeError("Config.message must be a string.");if(["acceptText","rejectText","settingsText","storageKey"].forEach(t=>{if(void 0!==e[t]&&"string"!=typeof e[t])throw new TypeError(`Config.${t} must be a string.`)}),void 0!==e.categories){if(!Array.isArray(e.categories))throw new TypeError("Config.categories must be an array of Category objects.");e.categories.forEach((e,t)=>this.validateCategory(e,t))}if(void 0!==e.onSave&&"function"!=typeof e.onSave)throw new TypeError("Config.onSave must be a function.");if(void 0!==e.animationDuration&&("number"!=typeof e.animationDuration||e.animationDuration<0))throw new TypeError("Config.animationDuration must be a positive number.");if(void 0!==e.renderBar&&null!==e.renderBar&&"function"!=typeof e.renderBar)throw new TypeError("Config.renderBar must be a function or null.");if(void 0!==e.renderModal&&null!==e.renderModal&&"function"!=typeof e.renderModal)throw new TypeError("Config.renderModal must be a function or null.")}validateCategory(e,t){if(!e||"object"!=typeof e)throw new TypeError(`Category at index ${t} must be an object.`);if("string"!=typeof e.label)throw new TypeError(`Category.label at index ${t} must be a string.`);if("boolean"!=typeof e.required)throw new TypeError(`Category.required at index ${t} must be a boolean.`);if("boolean"!=typeof e.default)throw new TypeError(`Category.default at index ${t} must be a boolean.`)}loadPreferences(){const e=localStorage.getItem(this.#t.storageKey);return e?JSON.parse(e):null}removeWithAnimation(e){if(!(e instanceof HTMLElement))throw new TypeError("removeWithAnimation expects an HTMLElement.");e.classList.add("closing"),setTimeout(()=>e.remove(),this.#t.animationDuration)}savePreferences(e){if(!e||"object"!=typeof e)throw new TypeError("Preferences must be an object.");localStorage.setItem(this.#t.storageKey,JSON.stringify(e)),this.#t.onSave(e)}showConsentBar(){const e=document.createElement("div");e.className="cookie-consent-bar",e.innerHTML=this.#t.renderBar?this.#t.renderBar(this.#t):`\n <div><p>${this.#t.message}</p></div>\n <div><button class="accept">${this.#t.acceptText}</button></div>\n <div><button class="reject">${this.#t.rejectText}</button></div>\n <div><button class="settings">${this.#t.settingsText}</button></div>\n `,document.body.appendChild(e);const t=e.querySelector(".accept");t instanceof HTMLElement&&(t.onclick=()=>{const t={};this.#t.categories.forEach(e=>t[e.label]=!0),this.savePreferences(t),this.removeWithAnimation(e)});const n=e.querySelector(".reject");n instanceof HTMLElement&&(n.onclick=()=>{const t={};this.#t.categories.forEach(e=>t[e.label]=e.required),this.savePreferences(t),this.removeWithAnimation(e)});const o=e.querySelector(".settings");o instanceof HTMLElement&&(o.onclick=()=>this.showSettingsModal(e))}showSettingsModal(e){const t=document.createElement("div");t.className="cookie-consent-modal",t.innerHTML=this.#t.renderModal?this.#t.renderModal(this.#t):`\n <div class="modal-content">\n <h2>Cookie Settings</h2>\n <form class="settings-form">\n ${this.#t.categories.map(e=>`\n <label>\n <input type="checkbox" name="${e.label}" \n ${e.default?"checked":""} \n ${e.required?"disabled":""}>\n ${e.label}\n </label>\n `).join("")}\n </form>\n <button class="save">Save Preferences</button>\n </div>\n `,document.body.appendChild(t);const n=t.querySelector(".save");n instanceof HTMLElement&&(n.onclick=()=>{const n={};t.querySelectorAll("input[type=checkbox]").forEach(e=>{e instanceof HTMLInputElement&&(n[e.name]=e.checked)}),this.savePreferences(n),this.removeWithAnimation(t),e&&this.removeWithAnimation(e)})}isAllowed(e){if("string"!=typeof e)throw new TypeError("isAllowed expects a string as category.");return!!this.#e&&!!this.#e[e]}};window.TinyCookieConsent=t.TinyCookieConsent})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={d:(t,r)=>{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)},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 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 +1 @@
|
|
|
1
|
-
(()=>{"use strict";
|
|
1
|
+
(()=>{"use strict";const e={d:(r,i)=>{if(Array.isArray(i))for(var a=0;a<i.length;){var n=i[a++],t=i[a++];e.o(r,n)?0===t&&a++:0===t?Object.defineProperty(r,n,{enumerable:!0,value:i[a++]}):Object.defineProperty(r,n,{enumerable:!0,get:t})}else for(var n in i)e.o(i,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:i[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)};let r={};e.d(r,{TinyDomReadyManager:()=>i});const i=class{#e=[];#r=!1;#i=!1;#a=[];#n(){this.#r&&Promise.all(this.#a).then(()=>{this.#i=!0,this.#t(!1)}).catch(e=>{console.error("[TinyDomReadyManager] Promise rejected:",e)})}#t(e){this.#e.filter(r=>r.domOnly===e).sort((e,r)=>r.priority-e.priority).forEach(e=>this.#o(e)),this.#e=this.#e.filter(r=>!(r.once&&(!e||r.domOnly)))}#o(e){if("function"==typeof e.filter)try{if(!e.filter())return}catch(e){return void console.warn("[TinyDomReadyManager] Filter error:",e)}try{e.fn()}catch(e){console.error("[TinyDomReadyManager] Handler error:",e)}}_markDomReady(){this.#r=!0,this.#t(!0),this.#n()}init(){if(this.#r)throw new Error("[TinyDomReadyManager] init() has already been called.");"interactive"===document.readyState||"complete"===document.readyState?this._markDomReady():document.addEventListener("DOMContentLoaded",()=>this._markDomReady())}addPromise(e){if(!(e instanceof Promise))throw new TypeError("[TinyDomReadyManager] promise must be a valid Promise.");this.#i||(this.#a.push(e),this.#r&&this.#n())}onReady(e,{once:r=!0,priority:i=0,filter:a=null,domOnly:n=!1}={}){if("function"!=typeof e)throw new TypeError("[TinyDomReadyManager] fn must be a function.");const t={fn:e,once:r,priority:i,filter:a,domOnly:n};if(n&&this.#r)return this.#o(t),void(r||this.#e.push(t));!n&&this.#i?this.#o(t):this.#e.push(t)}isReady(){return this.#i}isDomReady(){return this.#r}};window.TinyDomReadyManager=r.TinyDomReadyManager})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";
|
|
1
|
+
(()=>{"use strict";const e={d:(t,r)=>{if(Array.isArray(r))for(var n=0;n<r.length;){var a=r[n++],s=r[n++];e.o(t,a)?0===s&&n++:0===s?Object.defineProperty(t,a,{enumerable:!0,value:r[n++]}):Object.defineProperty(t,a,{enumerable:!0,get:s})}else for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};let t={};e.d(t,{TinyDragDropDetector:()=>r});const r=class{#e;#t;#r;#n;#a;#s;#i;constructor(e,t){const{hoverClass:r="dnd-hover",onDrop:n,onEnter:a,onLeave:s}=t;if(!(e instanceof HTMLElement))throw new TypeError('The "target" option must be an instance of HTMLElement.');if("string"!=typeof r)throw new TypeError('The "hoverClass" option must be a string.');if("function"!=typeof n)throw new TypeError('The "onDrop" option must be a function.');if("function"!=typeof a)throw new TypeError('The "onEnter" option must be a function.');if("function"!=typeof s)throw new TypeError('The "onLeave" option must be a function.');this.#e=e,this.#t=r,this.#r=n||(()=>{}),this.#n=a,this.#a=s,this.#s=!1,this.#i=!1,this._handleDragEnter=this._handleDragEnter.bind(this),this._handleDragOver=this._handleDragOver.bind(this),this._handleDragLeave=this._handleDragLeave.bind(this),this._handleDrop=this._handleDrop.bind(this),this.#o()}getTarget(){return this.#e}getHoverClass(){return this.#t}isDragging(){return this.#s}bound(){return this.#i}#o(){if(this.#i)return;const e=this.getTarget();e.addEventListener("dragenter",this._handleDragEnter),e.addEventListener("dragover",this._handleDragOver),e.addEventListener("dragleave",this._handleDragLeave),e.addEventListener("drop",this._handleDrop),this.#i=!0}#h(){if(!this.#i)return;const e=this.getTarget();e.removeEventListener("dragenter",this._handleDragEnter),e.removeEventListener("dragover",this._handleDragOver),e.removeEventListener("dragleave",this._handleDragLeave),e.removeEventListener("drop",this._handleDrop),this.#i=!1}_handleDragEnter(e){if(e.preventDefault(),!this.#s){const t=this.getTarget();this.#s=!0,t.classList.add(this.#t),this.#n(e)}}_handleDragOver(e){e.preventDefault(),e.dataTransfer?e.dataTransfer.dropEffect="copy":console.warn("[TinyDragDropDetector] [handleDragOver] DragOver event missing dataTransfer.")}_handleDragLeave(e){e.preventDefault();const t=this.getTarget();null!==e.relatedTarget&&t.contains(e.relatedTarget)||(this.#s=!1,t.classList.remove(this.#t),this.#a(e))}_handleDrop(e){if(e.preventDefault(),!e.dataTransfer)return void console.warn("[TinyDragDropDetector] [handleDrop] DragOver event missing dataTransfer.");const t=this.getTarget();this.#s=!1,t.classList.remove(this.#t);const r=e.dataTransfer.files;r.length>0&&this.#r(r,e)}destroy(){this.#h(),this.getTarget().classList.remove(this.#t)}};window.TinyDragDropDetector=t.TinyDragDropDetector})();
|