tiny-essentials 1.20.2 → 1.20.3
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/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -0
- package/dist/v1/basics/index.mjs +1 -1
- package/dist/v1/build/TinyTextarea.cjs +7 -0
- package/dist/v1/build/TinyTextarea.d.mts +3 -0
- package/dist/v1/build/TinyTextarea.mjs +2 -0
- package/dist/v1/index.cjs +2 -0
- package/dist/v1/index.d.mts +2 -1
- package/dist/v1/index.mjs +2 -1
- package/dist/v1/libs/TinySmartScroller.cjs +87 -0
- package/dist/v1/libs/TinySmartScroller.d.mts +52 -0
- package/dist/v1/libs/TinySmartScroller.mjs +76 -0
- package/dist/v1/libs/TinyTextarea.cjs +230 -0
- package/dist/v1/libs/TinyTextarea.d.mts +128 -0
- package/dist/v1/libs/TinyTextarea.mjs +198 -0
- package/docs/v1/README.md +1 -0
- package/docs/v1/libs/TinySmartScroller.md +4 -4
- package/docs/v1/libs/TinyTextarea.md +156 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see TinyEssentials.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var e={133:()=>{},251:(e,t)=>{t.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,l=(1<<a)-1,u=l>>1,c=-7,h=r?o-1:0,d=r?-1:1,f=e[t+h];for(h+=d,i=f&(1<<-c)-1,f>>=-c,c+=a;c>0;i=256*i+e[t+h],h+=d,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+e[t+h],h+=d,c-=8);if(0===i)i=1-u;else{if(i===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var s,a,l,u=8*i-o-1,c=(1<<u)-1,h=c>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,m=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*l-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[r+f]=255&a,f+=m,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[r+f]=255&s,f+=m,s/=256,u-=8);e[r+f-m]|=128*p}},287:(e,t,r)=>{"use strict";var n=r(526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=l,t.IS=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|p(e,t),n=a(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(F(e,Uint8Array)){var t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);var o=function(e){if(l.isBuffer(e)){var t=0|m(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||$(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return c(e),a(e<0?0:0|m(e))}function d(e){for(var t=e.length<0?0:0|m(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,l.prototype),n}function m(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return P(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(e).length;default:if(o)return n?-1:P(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return _(this,t,r);case"latin1":case"binary":return D(this,t,r);case"base64":return L(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),$(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,n,o){var i,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var c=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===l)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+l>a&&(r=a-l),i=r;i>=0;i--){for(var h=!0,d=0;d<l;d++)if(u(e,i+d)!==u(t,d)){h=!1;break}if(h)return i}return-1}function v(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if($(a))return s;e[r+s]=a}return s}function E(e,t,r,n){return W(P(t,e.length-r),e,r,n)}function T(e,t,r,n){return W(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function x(e,t,r,n){return W(H(t),e,r,n)}function S(e,t,r,n){return W(function(e,t){for(var r,n,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function L(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function C(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,l,u=e[o],c=null,h=u>239?4:u>223?3:u>191?2:1;if(o+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(l=(15&u)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=A));return r}(n)}l.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,r){return function(e,t,r){return c(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},l.allocUnsafe=function(e){return h(e)},l.allocUnsafeSlow=function(e){return h(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=l.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(F(i,Uint8Array))o+i.length>n.length?l.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!l.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},l.byteLength=p,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):g.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,o){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(n,o),c=e.slice(t,r),h=0;h<a;++h)if(u[h]!==c[h]){i=u[h],s=c[h];break}return i<s?-1:s<i?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return T(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function _(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function D(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function M(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=U[e[i]];return o}function k(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function N(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,r,n,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,i){return t=+t,r>>>=0,i||B(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,i){return t=+t,r>>>=0,i||B(e,0,r,8),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||I(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||I(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);I(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);I(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=l.isBuffer(e)?e:l.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%a]}return this};var O=/[^+/0-9A-Za-z-_]/g;function P(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function F(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}var U=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()},370:()=>{},526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=a(e),s=i[0],l=i[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,l)),c=0,h=l>0?s-4:s;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===l&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===l&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=16383,a=0,l=n-o;a<l;a+=s)i.push(u(e,a,a+s>l?l:a+s));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function u(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(l(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},606:e=>{var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],u=!1,c=-1;function h(){u&&a&&(u=!1,a.length?l=a.concat(l):c=-1,l.length&&d())}function d(){if(!u){var e=s(h);u=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new f(e,t)),1!==l.length||u||s(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},975:(e,t,r)=>{"use strict";var n=r(606);function o(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var r,n="",o=0,i=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(i===a-1||1===s);else if(i!==a-1&&2===s){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),i=a,s=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=a,s=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),o=a-i-1;i=a,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var s={resolve:function(){for(var e,t="",r=!1,s=arguments.length-1;s>=-1&&!r;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=n.cwd()),a=e),o(a),0!==a.length&&(t=a+"/"+t,r=47===a.charCodeAt(0))}return t=i(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(o(e),0===e.length)return".";var t=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return o(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var r=arguments[t];o(r),r.length>0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":s.normalize(e)},relative:function(e,t){if(o(e),o(t),e===t)return"";if((e=s.resolve(e))===(t=s.resolve(t)))return"";for(var r=1;r<e.length&&47===e.charCodeAt(r);++r);for(var n=e.length,i=n-r,a=1;a<t.length&&47===t.charCodeAt(a);++a);for(var l=t.length-a,u=i<l?i:l,c=-1,h=0;h<=u;++h){if(h===u){if(l>u){if(47===t.charCodeAt(a+h))return t.slice(a+h+1);if(0===h)return t.slice(a+h)}else i>u&&(47===e.charCodeAt(r+h)?c=h:0===h&&(c=0));break}var d=e.charCodeAt(r+h);if(d!==t.charCodeAt(a+h))break;47===d&&(c=h)}var f="";for(h=r+c+1;h<=n;++h)h!==n&&47!==e.charCodeAt(h)||(0===f.length?f+="..":f+="/..");return f.length>0?f+t.slice(a+c):(a+=c,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(o(e),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,n=-1,i=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){n=s;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"//":e.slice(0,n)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');o(e);var r,n=0,i=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,l=-1;for(r=e.length-1;r>=0;--r){var u=e.charCodeAt(r);if(47===u){if(!s){n=r+1;break}}else-1===l&&(s=!1,l=r+1),a>=0&&(u===t.charCodeAt(a)?-1===--a&&(i=r):(a=-1,i=l))}return n===i?i=l:-1===i&&(i=e.length),e.slice(n,i)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!s){n=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":e.slice(n,i)},extname:function(e){o(e);for(var t=-1,r=0,n=-1,i=!0,s=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===n&&(i=!1,n=a+1),46===l?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){r=a+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){o(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,n=e.charCodeAt(0),i=47===n;i?(t.root="/",r=1):r=0;for(var s=-1,a=0,l=-1,u=!0,c=e.length-1,h=0;c>=r;--c)if(47!==(n=e.charCodeAt(c)))-1===l&&(u=!1,l=c+1),46===n?-1===s?s=c:1!==h&&(h=1):-1!==s&&(h=-1);else if(!u){a=c+1;break}return-1===s||-1===l||0===h||1===h&&s===l-1&&s===a+1?-1!==l&&(t.base=t.name=0===a&&i?e.slice(1,l):e.slice(a,l)):(0===a&&i?(t.name=e.slice(1,s),t.base=e.slice(1,l)):(t.name=e.slice(a,s),t.base=e.slice(a,l)),t.ext=e.slice(s,l)),a>0?t.dir=e.slice(0,a-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{ColorSafeStringify:()=>F,TinyAfterScrollWatcher:()=>wt,TinyClipboard:()=>kt,TinyColorConverter:()=>It,TinyDomReadyManager:()=>yt,TinyDragDropDetector:()=>Oe,TinyDragger:()=>gt,TinyEvents:()=>At,TinyHtml:()=>De,TinyIframeEvents:()=>$t,TinyLevelUp:()=>o,TinyLocalStorage:()=>Wt,TinyNewWinEvents:()=>Jt,TinyNotifications:()=>bt,TinyNotifyCenter:()=>V,TinyPromiseQueue:()=>$,TinyRateLimiter:()=>U,TinySmartScroller:()=>Dt,TinyTextRangeEditor:()=>Mt,TinyTimeout:()=>jt,TinyToastNotify:()=>z,UltraRandomMsgGen:()=>Ct,addAiMarkerShortcut:()=>P,areElsCollBottom:()=>re,areElsCollLeft:()=>ne,areElsCollPerfBottom:()=>se,areElsCollPerfLeft:()=>ae,areElsCollPerfRight:()=>le,areElsCollPerfTop:()=>ie,areElsCollRight:()=>oe,areElsCollTop:()=>te,areElsColliding:()=>ue,areElsPerfColliding:()=>ce,areHtmlElsColliding:()=>Me,arraySortPositions:()=>i,asyncReplace:()=>t,backupFile:()=>et,checkObj:()=>E,clearDirectory:()=>Ue,clearDirectoryAsync:()=>ut,cloneObjTypeOrder:()=>b,countObj:()=>d,dirExists:()=>Ve,dirSize:()=>Ze,dirSizeAsync:()=>mt,documentIsFullScreen:()=>T,ensureCopyFile:()=>qe,ensureDirectory:()=>$e,exitFullScreen:()=>C,extendObjType:()=>g,fetchJson:()=>X,fetchText:()=>Z,fileExists:()=>Je,fileSize:()=>Xe,fileSizeAsync:()=>ft,formatBytes:()=>B,formatCustomTimer:()=>l,formatDayTimer:()=>c,formatTimer:()=>u,genFibonacciSeq:()=>j,getAge:()=>I,getElsCollDetails:()=>be,getElsCollDirDepth:()=>ye,getElsCollOverlap:()=>fe,getElsCollOverlapPos:()=>me,getElsColliding:()=>he,getElsPerfColliding:()=>de,getElsRelativeCenterOffset:()=>ge,getHtmlElBorders:()=>Ne,getHtmlElBordersWidth:()=>ke,getHtmlElMargin:()=>Ie,getHtmlElPadding:()=>Be,getLatestBackupPath:()=>tt,getPercentage:()=>N,getRectCenter:()=>pe,getSimplePerc:()=>k,getTimeDuration:()=>a,installWindowHiddenScript:()=>ee,isDirEmpty:()=>ze,isDirEmptyAsync:()=>ct,isFullScreenMode:()=>S,isInViewport:()=>je,isJsonObject:()=>f,isScreenFilled:()=>x,isScrolledIntoView:()=>Re,listDirs:()=>Qe,listDirsAsync:()=>dt,listFiles:()=>Ke,listFilesAsync:()=>ht,objType:()=>v,offFullScreenChange:()=>D,onFullScreenChange:()=>_,readBase64Blob:()=>G,readFileBlob:()=>q,readJsonBlob:()=>Y,readJsonFile:()=>We,renameFileAddPrefixSuffix:()=>it,renameFileBatch:()=>nt,renameFileNormalizeCase:()=>st,renameFilePadNumbers:()=>at,renameFileRegex:()=>ot,reorderObjTypeOrder:()=>y,requestFullScreen:()=>L,restoreLatestBackup:()=>rt,ruleOfThree:()=>M,safeTextTrim:()=>H,saveJsonFile:()=>K,shuffleArray:()=>s,toTitleCase:()=>R,toTitleCaseLowerFirst:()=>O,tryDeleteFile:()=>Ge,writeJsonFile:()=>Fe,writeTextFile:()=>Ye});var e={};async function t(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())}r.r(e),r.d(e,{areElsCollBottom:()=>re,areElsCollLeft:()=>ne,areElsCollPerfBottom:()=>se,areElsCollPerfLeft:()=>ae,areElsCollPerfRight:()=>le,areElsCollPerfTop:()=>ie,areElsCollRight:()=>oe,areElsCollTop:()=>te,areElsColliding:()=>ue,areElsPerfColliding:()=>ce,getElsCollDetails:()=>be,getElsCollDirDepth:()=>ye,getElsCollOverlap:()=>fe,getElsCollOverlapPos:()=>me,getElsColliding:()=>he,getElsPerfColliding:()=>de,getElsRelativeCenterOffset:()=>ge,getRectCenter:()=>pe});const o=class{constructor(e,t){if("number"!=typeof e||Number.isNaN(e))throw new Error("giveExp must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("expLevel must be a valid number");this.giveExp=e,this.expLevel=t}createUser(){return{exp:0,level:1,totalExp:0}}validateUser(e){if("number"!=typeof e.exp||Number.isNaN(e.exp))throw new Error("exp must be a valid number");if("number"!=typeof e.level||Number.isNaN(e.level))throw new Error("level must be a valid number");if(e.level<1)throw new Error("level must be at least 1");if("number"!=typeof e.totalExp||Number.isNaN(e.totalExp))throw new Error("totalExp must be a valid number")}isValidUser(e){return!("number"!=typeof e.exp||Number.isNaN(e.exp)||"number"!=typeof e.level||Number.isNaN(e.level)||e.level<1||"number"!=typeof e.totalExp||Number.isNaN(e.totalExp))}getGiveExpBase(){if("number"!=typeof this.giveExp||Number.isNaN(this.giveExp))throw new Error("giveExp must be a valid number");return this.giveExp}getExpLevelBase(){if("number"!=typeof this.expLevel||Number.isNaN(this.expLevel))throw new Error("expLevel must be a valid number");return this.expLevel}expValidator(e){const t=this.getExpLevelBase();this.validateUser(e);let r=0;const n=t*e.level;return e.exp>=n&&(e.level++,r=e.exp-n,e.exp=0,r>0)?this.give(e,r,"extra"):e.exp<1&&e.level>1&&(e.level--,r=Math.abs(e.exp),e.exp=t*e.level,r>0)?this.remove(e,r,"extra"):e}getTotalExp(e){this.validateUser(e);let t=0;for(let r=1;r<=e.level;r++)t+=this.getExpLevelBase()*r;return t+=e.exp,t}expGenerator(e=1){if("number"!=typeof e||Number.isNaN(e))throw new Error("multi must be a valid number");return Math.floor(Math.random()*this.getGiveExpBase())*e}getMissingExp(e){return this.getProgress(e)-e.exp}progress(e){return this.getProgress(e)}getProgress(e){return this.validateUser(e),this.getExpLevelBase()*e.level}set(e,t){if("number"!=typeof t||Number.isNaN(t))throw new Error("value must be a valid number");return e.exp=t,this.expValidator(e),e.totalExp=this.getTotalExp(e),e}give(e,t=0,r="add",n=1){if("number"!=typeof n||Number.isNaN(n))throw new Error("multi must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("extraExp must be a valid number");if("string"!=typeof r)throw new Error("type must be a valid string");return"add"===r?e.exp+=this.expGenerator(n)+t:"extra"===r&&(e.exp+=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}remove(e,t=0,r="add",n=1){if("number"!=typeof n||Number.isNaN(n))throw new Error("multi must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("extraExp must be a valid number");if("string"!=typeof r)throw new Error("type must be a valid string");return"add"===r?e.exp-=this.expGenerator(n)+t:"extra"===r&&(e.exp-=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}};function i(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 s(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 a(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 l(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,s=n>=3,a=n>=2,l=n>=1,u=n>=0,c={years:o?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:a?0:NaN,minutes:l?0:NaN,seconds:u?0:NaN,total:NaN};let h=e;if(o||i||s){const e=new Date(1980,0,1),t=new Date(e.getTime()+1e3*h),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(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),c.days++;h=Math.floor((t.getTime()-r.getTime())/1e3)}a&&(c.hours=Math.floor(h/3600),h%=3600),l&&(c.minutes=Math.floor(h/60),h%=60),u&&(c.seconds=h);const d={seconds:u?e:NaN,minutes:l?e/60:NaN,hours:a?e/3600:NaN,days:s?e/86400:NaN,months:i?12*c.years+c.months+(c.days||0)/30:NaN,years:o?c.years+(c.months||0)/12+(c.days||0)/365:NaN};c.total=+(d[t]||0).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=[a?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 u(e){return l(e,"hours","{hours}:{minutes}:{seconds}")}function c(e){return l(e,"days","{days}d {hours}:{minutes}:{seconds}")}var h=r(287);function d(e){return Array.isArray(e)?e.length:f(e)?Object.keys(e).length:0}function f(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e)}const m="undefined"!=typeof window&&void 0!==window.document,p={items:{},order:[]};function g(e,t){const r=[],n=Array.isArray(e)?e:Object.entries(e);for(const[e,o]of n)if(!p.items.hasOwnProperty(e)){p.items[e]=o;let n="number"==typeof t?t:-1;if(-1===n){const e=p.order.indexOf("object");n=e>-1?e:p.order.length}n=Math.min(Math.max(0,n),p.order.length),p.order.splice(n,0,e),r.push(e)}return r}function y(e){const t=[...p.order];return!!e.every(e=>t.includes(e))&&(p.order=e.slice(),!0)}function b(){return[...p.order]}const w=e=>{if(null===e)return"null";for(const t of p.order)if("function"!=typeof p.items[t]||p.items[t](e))return t;return"unknown"};function v(e,t){if(void 0===e)return null;const r=w(e);return"string"==typeof t?r===t.toLowerCase():r}function E(e){const t={valid:null,type:null};for(const r of p.order)if("function"==typeof p.items[r]){const n=p.items[r](e);if(n){t.valid=n,t.type=r;break}}return t}g([["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)]]),m||g([["buffer",e=>void 0!==h.hp&&h.hp.isBuffer(e)]]),m&&g([["file",e=>"undefined"!=typeof File&&e instanceof File]]),g([["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]]),m&&g([["htmlelement",e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement]]),g([["object",e=>f(e)]]);const T=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),x=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,S=()=>T()||x(),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)}}),C=()=>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)}}),A=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],_=(e,t)=>{A.forEach(r=>{document.addEventListener(r,e,t)})},D=(e,t)=>{A.forEach(r=>{document.removeEventListener(r,e,t)})};function M(e,t,r,n=!1){return n?Number(e*t)/r:Number(r*t)/e}function k(e,t){return e*(t/100)}function N(e,t){return 0===t?0:e/t*100}function I(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(),s=r.getMonth(),a=n.getDate(),l=r.getDate();return(i<s||i===s&&a<l)&&o--,Math.abs(o)}return null}function B(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 s=e/Math.pow(1024,i);if(null!==t){const e=t<0?0:t;s=parseFloat(s.toFixed(e))}return{unit:n[i],value:s}}function j({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 R(e){return e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())}function O(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 P(e="a"){"undefined"!=typeof HTMLElement?document.addEventListener("keydown",function(t){if(t.ctrlKey&&t.altKey&&t.key.toLowerCase()===e){if(t.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("detect-made-by-ai")}}):console.error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.")}function H(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}class W{#e;static#t={default:{reset:"[0m",key:"[36m",string:"[32m",string_url:"[34m",string_bool:"[35m",string_number:"[33m",number:"[33m",boolean:"[35m",null:"[1;30m",special:"[31m",func:"[90m"},solarized:{reset:"[0m",key:"[38;5;37m",string:"[38;5;136m",string_url:"[38;5;33m",string_bool:"[38;5;166m",string_number:"[38;5;136m",number:"[38;5;136m",boolean:"[38;5;166m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;244m"},monokai:{reset:"[0m",key:"[38;5;81m",string:"[38;5;114m",string_url:"[38;5;75m",string_bool:"[38;5;204m",string_number:"[38;5;221m",number:"[38;5;221m",boolean:"[38;5;204m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;102m"}};constructor(e={}){this.#e={...W.#t.default,...e}}#r(e,t){const r=[];e=(e=(e=e.replace(/(?<!")\b(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b(?!")/g,`${t.number}$1${t.reset}`)).replace(/"([^"]+)":/g,(e,t)=>{const n=`___KEY${r.length}___`;return r.push({marker:n,key:t}),`${n}:`})).replace(/"(?:\\.|[^"\\])*?"/g,e=>{const r=e.slice(1,-1);return/^(https?|ftp):\/\/[^\s]+$/i.test(r)?`${t.string_url}${e}${t.reset}`:/^(true|false|null)$/.test(r)?`${t.string_bool}${e}${t.reset}`:/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(r)?`${t.string_number}${e}${t.reset}`:`${t.string}${e}${t.reset}`});for(const{marker:n,key:o}of r){const r=new RegExp(n,"g");e=e.replace(r,`${t.key}"${o}"${t.reset}`)}return(e=(e=(e=(e=e.replace(/(?<!")\b(true|false)\b(?!")/g,`${t.boolean}$1${t.reset}`)).replace(/(?<!")\bnull\b(?!")/g,`${t.null}null${t.reset}`)).replace(/\[Circular\]/g,`${t.special}[Circular]${t.reset}`)).replace(/\[undefined\]/g,`${t.special}[undefined]${t.reset}`)).replace(/"function.*?[^\\]"/gs,`${t.func}$&${t.reset}`)}colorize(e,t={}){const r={...this.#e,...t};return this.#r(e,r)}getColors(){return{...this.#e}}updateColors(e){Object.assign(this.#e,e)}resetColors(){this.#e={...W.#t.default}}loadColorPreset(e){const t=W.#t[e];if(!t)throw new Error(`Preset "${e}" not found.`);this.#e={...t}}saveColorPreset(e,t){W.#t[e]={...t}}getAvailablePresets(){return Object.keys(W.#t)}}const F=W,$=class{#n=[];#o=!1;#i={};#s=new Set;isRunning(){return this.#o}async#a(e){if(e&&"function"==typeof e.task&&"function"==typeof e.resolve&&"function"==typeof e.reject){const{task:t,resolve:r,reject:n,delay:o,id:i}=e;try{if(i&&this.#s.has(i))return n(new Error("The function was canceled on TinyPromiseQueue.")),this.#s.delete(i),this.#o=!1,void this.#l();o&&i&&await new Promise(e=>{const t=setTimeout(()=>{delete this.#i[i],e(null)},o);this.#i[i]=t}),r(await t())}catch(e){n(e)}finally{this.#o=!1,this.#l()}}}async#u(){const e=[];for(;this.#n.length&&"POINT_MARKER"===this.#n[0]?.marker;)e.push(this.#n.shift());if(0===e.length)return this.#o=!1,void this.#l();await Promise.all(e.map(({task:e,resolve:t,reject:r,id:n})=>new Promise(async o=>{if(n&&this.#s.has(n))return this.#s.delete(n),r(new Error("The function was canceled on TinyPromiseQueue.")),void o(!0);await e().then(t).catch(r),o(!0)}))),this.#o=!1,this.#l()}async#l(){if(!this.#o&&0!==this.#n.length)if(this.#o=!0,"string"!=typeof this.#n[0]?.marker||"POINT_MARKER"!==this.#n[0]?.marker){const e=this.#n.shift();this.#a(e)}else this.#u()}getIndexById(e){return this.#n.findIndex(t=>t.id===e)}getQueuedIds(){return this.#n.map((e,t)=>({index:t,id:e.id})).filter(e=>"string"==typeof e.id)}reorderQueue(e,t){if("number"!=typeof e||"number"!=typeof t||e<0||t<0||e>=this.#n.length||t>=this.#n.length)return;const[r]=this.#n.splice(e,1);this.#n.splice(t,0,r)}async enqueuePoint(e,t){if("function"!=typeof e)return Promise.reject(new Error("Task must be a function returning a Promise."));if(void 0!==t&&"string"!=typeof t)throw new Error('The "id" parameter must be a string.');return this.#o?new Promise((r,n)=>{this.#n.push({marker:"POINT_MARKER",task:e,resolve:r,reject:n,id:t}),this.#l()}):e()}enqueue(e,t,r){if("function"!=typeof e)return Promise.reject(new Error("Task must be a function returning a Promise."));if(void 0!==t&&("number"!=typeof t||t<0))return Promise.reject(new Error("Delay must be a positive number or undefined."));if(void 0!==r&&"string"!=typeof r)throw new Error('The "id" parameter must be a string.');return new Promise((n,o)=>{this.#n.push({task:e,resolve:n,reject:o,id:r,delay:t}),this.#l()})}cancelTask(e){if("string"!=typeof e)throw new Error('The "id" parameter must be a string.');let t=!1;e in this.#i&&(clearTimeout(this.#i[e]),delete this.#i[e],t=!0);const r=this.getIndexById(e);if(-1!==r){const[e]=this.#n.splice(r,1);e?.reject?.(new Error("The function was canceled on TinyPromiseQueue.")),t=!0}return t&&this.#s.add(e),t}},U=class{#c=null;#h=null;#d=null;#f=null;#m=null;#p=null;groupData=new Map;lastSeen=new Map;userToGroup=new Map;groupFlags=new Map;groupTTL=new Map;#g=null;setOnMemoryExceeded(e){if("function"!=typeof e)throw new Error("onMemoryExceeded must be a function");this.#g=e}clearOnMemoryExceeded(){this.#g=null}#y=null;setOnGroupExpired(e){if("function"!=typeof e)throw new Error("onGroupExpired must be a function");this.#y=e}clearOnGroupExpired(){this.#y=null}constructor({maxHits:e,interval:t,cleanupInterval:r,maxIdle:n=3e5,maxMemory:o=1e5}){const i=e=>"number"==typeof e&&Number.isFinite(e)&&e>=1&&Number.isInteger(e),s=i(e),a=i(t),l=i(r),u=i(n);if(!s&&!a)throw new Error("RateLimiter requires at least one valid option: 'maxHits' or 'interval'.");if(void 0!==e&&!s)throw new Error("'maxHits' must be a positive integer if defined.");if(void 0!==t&&!a)throw new Error("'interval' must be a positive integer in milliseconds if defined.");if(void 0!==r&&!l)throw new Error("'cleanupInterval' must be a positive integer in milliseconds if defined.");if(!u)throw new Error("'maxIdle' must be a positive integer in milliseconds.");if("number"==typeof o&&Number.isFinite(o)&&o>0)this.#c=Math.floor(o);else{if(null!=o)throw new Error("maxMemory must be a positive number or null");this.#c=null}this.#d=s?e:null,this.#f=a?t:null,this.#m=l?r:null,this.#p=n,null!==this.#m&&(this.#h=setInterval(()=>this._cleanup(),this.#m))}isGroupId(e){const t=this.groupFlags.get(e);return"boolean"==typeof t&&t}getUsersInGroup(e){const t=[];for(const[r,n]of this.userToGroup.entries())n===e&&t.push(r);return t}setGroupTTL(e,t){if("number"!=typeof t||!Number.isFinite(t)||t<=0)throw new Error("TTL must be a positive number in milliseconds");this.groupTTL.set(e,t)}getGroupTTL(e){return this.groupTTL.get(e)??null}deleteGroupTTL(e){this.groupTTL.delete(e)}assignToGroup(e,t){const r=this.userToGroup.get(e);if(r&&r!==t)throw new Error(`User ${e} is already assigned to group ${r}`);if(r===t)return;const n=this.groupData.get(e);if(this.isGroupId(e)){for(const[r,n]of this.userToGroup.entries())n===e&&this.userToGroup.set(r,t);this.userToGroup.delete(e)}else this.userToGroup.set(e,t);if(!n)return;const o=this.groupData.get(t);if(o)for(const e of n)o.push(e);else{const e=[];for(const t of n)e.push(t);this.groupData.set(t,e)}this.lastSeen.set(t,Date.now()),this.groupFlags.delete(e),this.groupData.delete(e),this.lastSeen.delete(e),this.groupTTL.delete(e),this.groupFlags.set(t,!0)}getGroupId(e){return this.userToGroup.get(e)||e}hit(e){const t=this.getGroupId(e),r=Date.now();this.groupData.has(t)||(this.groupData.set(t,[]),this.groupFlags.set(t,!1));const n=this.groupData.get(t);if(!n)throw new Error(`No data found for groupId: ${t}`);if(n.push(r),this.lastSeen.set(t,r),null!==this.#f){const e=r-this.getInterval();for(;n.length&&n[0]<e;)n.shift()}null!==this.#c&&"number"==typeof this.#c&&n.length>this.#c&&(n.splice(0,n.length-this.#c),"function"==typeof this.#g&&this.#g(t))}isRateLimited(e){const t=this.getGroupId(e);if(!this.groupData.has(t))return!1;const r=this.groupData.get(t);if(!r)throw new Error(`No data found for groupId: ${t}`);if(null!==this.#f){const e=Date.now()-this.getInterval();let t=0;for(let n=r.length-1;n>=0&&r[n]>e;n--)t++;return null!==this.#d?t>this.getMaxHits():t>0}return null!==this.#d&&r.length>this.getMaxHits()}resetGroup(e){this.groupFlags.delete(e),this.groupData.delete(e),this.lastSeen.delete(e),this.groupTTL.delete(e)}reset(e){return this.resetUserGroup(e)}resetUserGroup(e){this.userToGroup.delete(e)}setData(e,t){if(!Array.isArray(t))throw new Error("timestamps must be an array of numbers.");for(const e of t)if("number"!=typeof e||!Number.isFinite(e))throw new Error("All timestamps must be finite numbers.");this.groupData.has(e)||this.groupFlags.set(e,!1),this.groupData.set(e,t),this.lastSeen.set(e,Date.now())}hasData(e){return this.groupData.has(e)}getData(e){return this.groupData.get(e)||[]}getMaxIdle(){if("number"!=typeof this.#p||!Number.isFinite(this.#p)||this.#p<0)throw new Error("'maxIdle' must be a non-negative finite number.");return this.#p}setMaxIdle(e){if("number"!=typeof e||!Number.isFinite(e)||e<0)throw new Error("'maxIdle' must be a non-negative finite number.");this.#p=e}_cleanup(){const e=Date.now();for(const[t,r]of this.lastSeen.entries())e-r>(this.getGroupTTL(t)??this.getMaxIdle())&&(this.groupFlags.delete(t),this.groupData.delete(t),this.lastSeen.delete(t),this.groupTTL.delete(t),"function"==typeof this.#y&&this.#y(t))}getActiveGroups(){return Array.from(this.groupData.keys())}getAllUserMappings(){return Object.fromEntries(this.userToGroup)}getInterval(){if("number"!=typeof this.#f||!Number.isFinite(this.#f))throw new Error("'interval' is not a valid finite number.");return this.#f}getMaxHits(){if("number"!=typeof this.#d||!Number.isFinite(this.#d))throw new Error("'maxHits' is not a valid finite number.");return this.#d}getTotalHits(e){const t=this.groupData.get(e);return Array.isArray(t)?t.length:0}getLastHit(e){const t=this.groupData.get(e);return t?.length?t[t.length-1]:null}getTimeSinceLastHit(e){const t=this.getLastHit(e);return null!==t?Date.now()-t:null}_calculateAverageSpacing(e){if(!Array.isArray(e)||e.length<2)return null;let t=0;for(let r=1;r<e.length;r++)t+=e[r]-e[r-1];return t/(e.length-1)}getAverageHitSpacing(e){return this._calculateAverageSpacing(this.groupData.get(e))}getMetrics(e){const t=this.groupData.get(e);if(!Array.isArray(t)||0===t.length)return{totalHits:0,lastHit:null,timeSinceLastHit:null,averageHitSpacing:null};const r=t.length,n=t[r-1];return{totalHits:r,lastHit:n,timeSinceLastHit:Date.now()-n,averageHitSpacing:this._calculateAverageSpacing(t)}}destroy(){this.#h&&clearInterval(this.#h),this._cleanup(),this.groupData.clear(),this.lastSeen.clear(),this.userToGroup.clear(),this.groupTTL.clear(),this.groupFlags.clear()}};class J{static getTemplate(){return'\n<div class="notify-overlay hidden">\n <div class="notify-center" id="notifCenter">\n <div class="header">\n <div>Notifications</div>\n <div class="options">\n <button class="clear-all" type="button">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n fill="currentColor"\n >\n <path\n d="M21.6 2.4a1 1 0 0 0-1.4 0L13 9.6l-1.3-1.3a1 1 0 0 0-1.4 0L3 15.6a1 1 0 0 0 0 1.4l4 4a1 1 0 0 0 1.4 0l7.3-7.3a1 1 0 0 0 0-1.4l-1.3-1.3 7.2-7.2a1 1 0 0 0 0-1.4zM6 17l3.5-3.5 1.5 1.5L7.5 18.5 6 17z"\n />\n </svg>\n </button>\n <button class="close">×</button>\n </div>\n </div>\n <div class="list"></div>\n </div>\n</div>\n\n<button class="notify-bell" aria-label="Open notifications">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="20"\n height="20"\n fill="currentColor"\n viewBox="0 0 24 24"\n >\n <path\n d="M12 2C10.3 2 9 3.3 9 5v1.1C6.7 7.2 5 9.4 5 12v5l-1 1v1h16v-1l-1-1v-5c0-2.6-1.7-4.8-4-5.9V5c0-1.7-1.3-3-3-3zm0 20c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2z"\n />\n </svg>\n <span class="badge" id="notifBadge">0</span>\n</button>\n '}static insertTemplate(e="afterbegin"){document.body.insertAdjacentHTML(e,J.getTemplate())}#b;#w;#v;#E;#T;#x=0;#S=99;#L=300;#C=!1;#A=new WeakMap;#_(e){if(this.#A.delete(e),!(e instanceof HTMLElement))throw new Error("Invalid HTMLElement to clear.");e.classList.add("removing"),setTimeout(()=>{this.markAsRead(e),e.remove()},this.#L)}#D(e){this.#x=Math.max(0,e),this.#v.setAttribute("data-value",String(this.#x)),this.#v.textContent=this.#x>this.#S?`${this.#S}+`:String(this.#x)}constructor(e={}){const{center:t=document.getElementById("notifCenter"),badge:r=document.getElementById("notifBadge"),button:n=document.querySelector(".notify-bell"),overlay:o=document.querySelector(".notify-overlay")}=e;if(!(t instanceof HTMLElement))throw new Error(`NotificationCenter: "center" must be an HTMLElement. Got: ${t}`);if(!(o instanceof HTMLElement))throw new Error(`NotificationCenter: "overlay" must be an HTMLElement. Got: ${o}`);if(!(r instanceof HTMLElement))throw new Error(`NotificationCenter: "badge" must be an HTMLElement. Got: ${r}`);if(!(n instanceof HTMLElement))throw new Error(`NotificationCenter: "button" must be an HTMLElement. Got: ${n}`);const i=t?.querySelector(".clear-all"),s=t?.querySelector(".list")??null;if(!(s instanceof HTMLElement))throw new Error(`NotificationCenter: ".list" inside center must be an HTMLElement. Got: ${s}`);this.#b=t,this.#w=s,this.#v=r,this.#E=n,this.#T=o,this.#E.addEventListener("click",()=>this.toggle()),this.#b.querySelector(".close")?.addEventListener("click",()=>this.close()),i&&i.addEventListener("click",()=>this.clear()),this.#T.addEventListener("click",e=>{e.target===this.#T&&this.close()})}setMarkAllAsReadOnClose(e){if("boolean"!=typeof e)throw new TypeError("Expected boolean for markAllAsReadOnClose, got "+typeof e);this.#C=e}setRemoveDelay(e){if("number"!=typeof e)throw new Error('NotificationCenter: "ms" must be an number.');this.#L=e}getItemMode(e){const t=this.getItem(e);return t?this.#A.get(t):null}getItem(e){const t=this.#w.children.item(e);if(!(t instanceof HTMLElement))throw new Error(`NotificationCenter: "item" must be an HTMLElement. Got: ${t}`);return t}hasItem(e){return e>=0&&e<this.#w.children.length}markAsRead(e){const t=e instanceof HTMLElement?e:this.getItem(e);t.classList.contains("unread")&&(t.classList.remove("unread"),this.#D(this.#x-1))}add(e,t="text"){const r=document.createElement("div");r.className="item unread";let n=null,o=null,i=null,s=null;if("object"==typeof e&&null!==e?(n=e.title,o=e.message,i=e.avatar,s=e.onClick):o=e,i){const e=document.createElement("div");e.className="avatar",e.style.backgroundImage=`url("${i}")`,r.appendChild(e)}const a=document.createElement("div");if(a.className="content",n){const e=document.createElement("div");e.className="title",e.textContent=n,a.appendChild(e)}const l=document.createElement("div");l.className="message","html"===t?l.innerHTML=o:l.textContent=o,a.appendChild(l),"function"==typeof s&&(r.classList.add("clickable"),r.addEventListener("click",e=>{e.target instanceof HTMLElement&&!e.target.closest(".notify-close")&&s(e)}));const u=document.createElement("button");u.className="notify-close",u.setAttribute("type","button"),u.innerHTML="×",u.addEventListener("click",e=>{e.stopPropagation(),this.#_(r)}),r.append(a,u),this.#w.prepend(r),this.#A.set(r,t),this.#D(this.#x+1)}remove(e){const t=this.getItem(e);this.#_(t)}clear(){let e=!0;for(;e;){e=!1;const t=Array.from(this.#w.children);for(const r of t)r instanceof HTMLElement&&!r.classList.contains("removing")&&(this.#_(r),e=!0)}}open(){this.#T.classList.remove("hidden"),this.#b.classList.add("open")}close(){if(this.#T.classList.add("hidden"),this.#b.classList.remove("open"),this.#C){const e=this.#w.querySelectorAll(".item.unread");for(const t of e)t instanceof HTMLElement&&this.markAsRead(t)}}toggle(){this.#b.classList.contains("open")?this.close():this.open()}recount(){const e=this.#w.querySelectorAll(".item.unread").length;this.#D(e)}get count(){return this.#x}destroy(){this.#E?.removeEventListener("click",this.toggle),this.#b?.querySelector(".close")?.removeEventListener("click",this.close),this.#b?.querySelector(".clear-all")?.removeEventListener("click",this.clear),this.#T?.removeEventListener("click",this.close),this.clear(),this.#b?.remove(),this.#T?.remove(),this.#E?.remove(),this.#x=0,this.#A=new WeakMap}}const V=J,z=class{#M;#k;#N;#I;#B;#j;constructor(e="top",t="right",r=3e3,n=50,o=300,i=".notify-container"){this.#R(e),this.#O(t),this.#P(r,"baseDuration"),this.#P(n,"extraPerChar"),this.#P(o,"fadeOutDuration"),this.#M=e,this.#k=t,this.#N=r,this.#I=n,this.#B=o;const s=document.querySelector(`${i}.${e}.${t}`);s instanceof HTMLElement?this.#j=s:(this.#j=document.createElement("div"),this.#j.className=`notify-container ${e} ${t}`,document.body.appendChild(this.#j))}getContainer(){if(!(this.#j instanceof HTMLElement))throw new Error("Container is not a valid HTMLElement.");return this.#j}#R(e){if(!["top","bottom"].includes(e))throw new Error(`Invalid vertical direction "${e}". Expected "top" or "bottom".`)}#O(e){if(!["left","right","center"].includes(e))throw new Error(`Invalid horizontal position "${e}". Expected "left", "right" or "center".`)}#P(e,t){if("number"!=typeof e||e<0||!Number.isFinite(e))throw new Error(`Invalid value for "${t}": ${e}. Must be a non-negative finite number.`)}getY(){return this.#M}setY(e){this.#R(e);const t=this.getContainer();t.classList.remove(this.#M),t.classList.add(e),this.#M=e}getX(){return this.#k}setX(e){this.#O(e);const t=this.getContainer();t.classList.remove(this.#k),t.classList.add(e),this.#k=e}getBaseDuration(){return this.#N}setBaseDuration(e){this.#P(e,"baseDuration"),this.#N=e}getExtraPerChar(){return this.#I}setExtraPerChar(e){this.#P(e,"extraPerChar"),this.#I=e}getFadeOutDuration(){return this.#B}setFadeOutDuration(e){this.#P(e,"fadeOutDuration"),this.#B=e}show(e){let t="",r="",n=null,o=!1,i=null;const s=document.createElement("div");if(s.className="notify enter","string"==typeof e)t=e;else{if("object"!=typeof e||null===e||"string"!=typeof e.message)throw new Error("Invalid argument for show(): expected string or { message: string, title?: string, onClick?: function, html?: boolean, avatar?: string }");if(t=e.message,r="string"==typeof e.title?e.title:"",o=!0===e.html,i="string"==typeof e.avatar?e.avatar:null,void 0!==e.onClick){if("function"!=typeof e.onClick)throw new Error("onClick must be a function if defined");n=e.onClick,s.classList.add("clickable")}}const a=document.createElement("button");if(a.innerHTML="×",a.className="close",a.setAttribute("aria-label","Close"),a.addEventListener("mouseenter",()=>{a.style.color="var(--notif-close-color-hover)"}),a.addEventListener("mouseleave",()=>{a.style.color="var(--notif-close-color)"}),i){const e=document.createElement("img");e.src=i,e.alt="avatar",e.className="avatar",s.appendChild(e)}if(r){const e=document.createElement("strong");e.textContent=r,e.style.display="block",s.appendChild(e)}if(o){const e=document.createElement("div");e.innerHTML=t,s.appendChild(e)}else s.appendChild(document.createTextNode(t));s.appendChild(a),this.getContainer().appendChild(s);const l=this.#N+t.length*this.#I+this.#B;let u=!1;const c=()=>{u||(u=!0,s.classList.remove("enter","show"),s.classList.add("exit"),setTimeout(()=>s.remove(),this.#B))};"function"==typeof n&&s.addEventListener("click",e=>{e.target!==a&&n(e,c)}),a.addEventListener("click",e=>{e.stopPropagation(),c()}),setTimeout(()=>{s.classList.remove("enter"),s.classList.add("show")},1),setTimeout(()=>c(),l)}destroy(){this.#j instanceof HTMLElement&&(this.#j.querySelectorAll(".notify").forEach(e=>e.remove()),this.#j.parentNode&&this.#j.parentNode.removeChild(this.#j),this.#j=null)}};function q(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 G(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.")),q(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 Y(e){return new Promise((t,r)=>q(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 K(e,t,r=2){const n=JSON.stringify(t,null,r),o=new Blob([n],{type:"application/json"}),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}async function Q(e,{method:t="GET",body:r,timeout:n=0,retries:o=0,headers:i={},signal:s=null}={}){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(!s){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 a=s?1:o+1;let l=null;for(let u=0;u<a;u++){const a=s?null:new AbortController,c=s||(a?.signal??null),h=!s&&n&&a?setTimeout(()=>a.abort(),n):null;try{const n=await fetch(e,{method:t.toUpperCase(),headers:{Accept:"application/json",...i},body:void 0!==r?f(r)?JSON.stringify(r):r:void 0,signal:c});if(h&&clearTimeout(h),!n.ok)throw new Error(`HTTP error: ${n.status} ${n.statusText}`);return n}catch(e){if(l=e,s)break;u<o&&await new Promise(e=>setTimeout(e,300*(u+1)))}}throw new Error(`Failed to fetch JSON from "${e}"${l?`: ${l.message}`:"."}`)}async function X(e,t){return new Promise((r,n)=>{Q(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)&&!f(n))throw new Error("Received invalid data instead of valid JSON.");return r(n)}).catch(n)})}async function Z(e,t,r){return new Promise((n,o)=>{Q(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 ee({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="",s="";const a=()=>{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 h=function(u){a();const c=u?.type,h=l&&document[l];["focus","focusin","pageshow"].includes(c)?(e.classList.add(r),n?.({type:c,oldClass:s,oldType:i}),s=r):["blur","focusout","pagehide"].includes(c)||h?(e.classList.add(t),o?.({type:c,oldClass:s,oldType:i}),s=t):(e.classList.add(r),n?.({type:c,oldClass:s,oldType:i}),s=r),i=c};let d=()=>{};if(l){const e=u[c.indexOf(l)];document.addEventListener(e,h),window.addEventListener("focus",h),window.addEventListener("blur",h),d=()=>{document.removeEventListener(e,h),window.removeEventListener("focus",h),window.removeEventListener("blur",h),a()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=h,d=()=>{document.onfocusin=document.onfocusout=null,a()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=h,d=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,a()});const f=new Event(l&&document[l]?"blur":"focus");return h(f),d}const 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)=>e.bottom<=t.top,se=(e,t)=>e.top>=t.bottom,ae=(e,t)=>e.right<=t.left,le=(e,t)=>e.left>=t.right,ue=(e,t)=>!(ne(e,t)||oe(e,t)||te(e,t)||re(e,t)),ce=(e,t)=>!(ae(e,t)||le(e,t)||ie(e,t)||se(e,t)),he=(e,t)=>ne(e,t)?"left":oe(e,t)?"right":te(e,t)?"top":re(e,t)?"bottom":null,de=(e,t)=>ae(e,t)?"left":le(e,t)?"right":ie(e,t)?"top":se(e,t)?"bottom":null,fe=(e,t)=>({overlapLeft:t.right-e.left,overlapRight:e.right-t.left,overlapTop:t.bottom-e.top,overlapBottom:e.bottom-t.top}),me=({overlapLeft:e=-1,overlapRight:t=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:e<t?"right":"left",dirY:r<n?"bottom":"top"}),pe=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function ge(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 ye(e,t){if(!ce(e,t))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=fe(e,t),{dirX:s,dirY:a}=me({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),l=Math.min(r,n),u=Math.min(o,i);let c;return c=l<u?s:a,{inDir:c,dirX:s,dirY:a,depthX:l,depthY:u}}function be(e,t){const r=ce(e,t),n={in:null,x:null,y:null},o={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:s,overlapRight:a,overlapTop:l,overlapBottom:u}=fe(t,e);i.top=l,i.bottom=u,i.left=s,i.right=a;const c=Object.entries(i).filter(([,e])=>e>0).sort((e,t)=>e[1]-t[1]),{dirX:h,dirY:d}=me({overlapLeft:a,overlapRight:s,overlapTop:u,overlapBottom:l});return n.y=d,n.x=h,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{areElsColliding:we,areElsPerfColliding:ve,areElsCollTop:Ee,areElsCollBottom:Te,areElsCollLeft:xe,areElsCollRight:Se}=e,Le=new WeakMap,Ce=new WeakMap,Ae={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class _e{static Utils={...e};static async fetchHtmlFile(e,t={method:"GET"}){const r=await fetch(e,t),n=r.headers.get("Content-Type")||"";if(!r.ok)throw new Error(`Failed to fetch: ${r.status} ${r.statusText}`);if(!n.includes("text/html"))throw new Error(`Invalid content type: ${n} (expected text/html)`);const o=await r.text();return _e.htmlToJson(o)}static async fetchHtmlNodes(e,t){const r=await _e.fetchHtmlFile(e,t);return _e.jsonToNodes(r)}static async fetchHtmlTinyElems(e,t){const r=await _e.fetchHtmlNodes(e,t);return _e.toTinyElm(r)}static templateToJson(e){return _e.htmlToJson([...e.content.childNodes].map(e=>e instanceof Element?e.getHTML():e instanceof Text?e.textContent:"").join(""))}static templateToNodes(e){const t=[];return[...e.content.cloneNode(!0).childNodes].map(e=>{if(!(e instanceof Element||e instanceof Text||e instanceof Comment))throw new Error(`Expected only Element nodes in <template>, but found: ${e.constructor.name}`);e instanceof Comment||t.push(e)}),t}static templateToTinyElems(e){return _e.toTinyElm(_e.templateToNodes(e))}static htmlToJson(e){const t=document.createElement("div");t.innerHTML=e.trim();const r=[],n=e=>{if(e instanceof Comment)return null;if(e instanceof Text){const t=e.textContent?.trim();return t||null}if(!(e instanceof Element))return null;const t=e.tagName.toLowerCase(),r={};for(const t of e.attributes)r[_e.getPropName(t.name)]=t.value;const o=Array.from(e.childNodes).map(n).filter(Boolean);return o.length>0?[t,r,...o]:[t,r]};for(const e of t.childNodes){const t=n(e);t&&r.push(t)}return t.innerHTML="",r}static jsonToNodes(e){const t=e=>{if("string"==typeof e)return document.createTextNode(e);if(!Array.isArray(e))return document.createTextNode("");const[r,n,...o]=e,i=document.createElement(r);for(const[e,t]of Object.entries(n))i.setAttribute(_e.getAttrName(e),t);for(const e of o){const r=t(e);r instanceof Comment||i.appendChild(r)}return i};return e.map(t).filter(e=>!(e instanceof Comment))}static jsonToTinyElems(e){return _e.toTinyElm(_e.jsonToNodes(e))}static createFrom(e,t){if("string"!=typeof e)throw new TypeError('The "tagName" must be a string.');if(void 0!==t&&"object"!=typeof t)throw new TypeError('The "attrs" must be a object.');const r=_e.createElement(e);if("object"==typeof t)for(const e in t)r.setAttr(e,t[e]);return r}static createElement(e,t){if("string"!=typeof e)throw new TypeError("[TinyHtml] createElement(): The tagName must be a string.");if(void 0!==t&&"object"!=typeof t)throw new TypeError("[TinyHtml] createElement(): The ops must be a object.");return new _e(document.createElement(e,t))}static createTextNode(e){if("string"!=typeof e)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new _e(document.createTextNode(e))}static createElementFromHTML(e){const t=document.createElement("template");if(!(e=e.trim()).startsWith("<"))return _e.createTextNode(e);if(t.innerHTML=e,!(t.content.firstChild instanceof Element))throw new Error("The HTML string must contain a valid HTML element.");return new _e(t.content.firstChild)}static query(e,t=document){const r=t.querySelector(e);return r?new _e(r):null}querySelector(e){return _e.query(e,_e._preElem(this,"query"))}static queryAll(e,t=document){return new _e(t.querySelectorAll(e))}querySelectorAll(e){return _e.queryAll(e,_e._preElem(this,"queryAll"))}static getById(e){const t=document.getElementById(e);return t?new _e(t):null}static getByClassName(e,t=document){return new _e(t.getElementsByClassName(e))}getElementsByClassName(e){return _e.getByClassName(e,_e._preElem(this,"getByClassName"))}static getByName(e){return new _e(document.getElementsByName(e))}static getByTagNameNS(e,t="http://www.w3.org/1999/xhtml",r=document){return new _e(r.getElementsByTagNameNS(t,e))}getElementsByTagNameNS(e,t="http://www.w3.org/1999/xhtml"){return _e.getByTagNameNS(e,t,_e._preElem(this,"getByTagNameNS"))}get(e){if("number"!=typeof e)throw new TypeError("The index must be a number.");if(!this.#H[e])throw new Error(`No element found at index ${e}.`);return this.#H[e]}extract(e){if("number"!=typeof e)throw new TypeError("The index must be a number.");if(!this.#H[e])throw new Error(`Cannot extract: no element exists at index ${e}.`);return new _e(this.#H[e])}exists(e){if("number"!=typeof e)throw new TypeError("The index must be a number.");return!!this.#H[e]}getAll(){return[...this.#H]}_getElement(e,t){if(!(this.#H[t]instanceof Element||this.#H[t]instanceof Window||this.#H[t]instanceof Document||this.#H[t]instanceof Text))throw new Error(`[TinyHtml] Invalid Element in ${e}().`);return this.#H[t]}_getElements(e){if(!this.#H.every(e=>e instanceof Element||e instanceof Window||e instanceof Document||e instanceof Text))throw new Error(`[TinyHtml] Invalid Element in ${e}().`);return[...this.#H]}static _preElemsTemplate(e,t,r,n){const o=e=>{const o=[];return e.map(e=>(e instanceof _e?e._getElements(t):[e]).map(e=>{let i=!1;for(const t of r)if(e instanceof t){i=!0;break}if(!i)throw new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return o.push(e),e})),o};return Array.isArray(e)?o(e):o([e])}static _preElemTemplate(e,t,r,n,o=!1){const i=e=>{const i=e[0],s=i instanceof _e?i._getElements(t):[i];if(s.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${t}() (Received ${s.length}/1).`);let a=!1;for(const e of r)if(s[0]instanceof e){a=!0;break}if(!o||null!==s[0]&&void 0!==s[0]||(s[0]=null,a=!0),!a)throw new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return s[0]};if(!Array.isArray(e))return i([e]);if(e.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${t}() (Received ${e.length}/1).`);return i(e)}static _preElems(e,t){return _e._preElemsTemplate(e,t,[Element],["Element"])}static _preElem(e,t){return _e._preElemTemplate(e,t,[Element],["Element"])}static _preNodeElems(e,t){return _e._preElemsTemplate(e,t,[Node],["Node"])}static _preNodeElem(e,t){return _e._preElemTemplate(e,t,[Node],["Node"])}static _preNodeElemWithNull(e,t){return _e._preElemTemplate(e,t,[Node],["Node"],!0)}static _preHtmlElems(e,t){return _e._preElemsTemplate(e,t,[HTMLElement],["HTMLElement"])}static _preHtmlElem(e,t){return _e._preElemTemplate(e,t,[HTMLElement],["HTMLElement"])}static _preInputElems(e,t){return _e._preElemsTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preInputElem(e,t){return _e._preElemTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preEventTargetElems(e,t){return _e._preElemsTemplate(e,t,[EventTarget],["EventTarget"])}static _preEventTargetElem(e,t){return _e._preElemTemplate(e,t,[EventTarget],["EventTarget"])}static _preElemsAndWindow(e,t){return _e._preElemsTemplate(e,t,[Element,Window],["Element","Window"])}static _preElemAndWindow(e,t){return _e._preElemTemplate(e,t,[Element,Window],["Element","Window"])}static _preElemsAndWinAndDoc(e,t){return _e._preElemsTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]).map(e=>e instanceof Document?e.documentElement:e)}static _preElemAndWinAndDoc(e,t){const r=_e._preElemTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}static _preElemsWithDoc(e,t){return _e._preElemsTemplate(e,t,[Element,Document],["Element","Document"])}static _preElemWithDoc(e,t){return _e._preElemTemplate(e,t,[Element,Document],["Element","Document"])}static toTinyElm(e){const t=e=>e.map(e=>e instanceof _e?e:new _e(e));return Array.isArray(e)?t(e):t([e])}static fromTinyElm(e){const t=e=>{const t=[];return e.map(e=>(e instanceof _e?e._getElements("fromTinyElm"):[e]).map(e=>t.push(e))),t};return Array.isArray(e)?t(e):t([e])}static winnow(e,t,r,n=!1){if("boolean"!=typeof n)throw new TypeError('The "not" must be a boolean.');if("function"==typeof t)return _e._preElems(e,r).filter((e,r)=>!!t.call(e,r,e)!==n);if(t instanceof Element)return _e._preElems(e,r).filter(e=>e===t!==n);if(Array.isArray(t)||"string"!=typeof t&&null!=t.length)return _e._preElems(e,r).filter(e=>t.includes(e)!==n);let o=t;return n&&(o=`:not(${o})`),_e._preElems(e,r).filter(e=>1===e.nodeType&&e.matches(o))}static filter(e,t,r=!1){return r&&(t=`:not(${t})`),_e._preElems(e,"filter").filter(e=>1===e.nodeType&&e.matches(t))}static filterOnly(e,t){return _e.winnow(e,t,"filterOnly",!1)}static not(e,t){return _e.winnow(e,t,"not",!0)}not(e){return _e.not(this,e)}static find(e,t){const r=[];for(const n of _e._preElems(e,"find"))r.push(...n.querySelectorAll(t));return[...new Set(r)]}find(e){return _e.find(this,e)}static is(e,t){return _e.winnow(e,t,"is",!1).length>0}is(e){return _e.is(this,e)}static has(e,t){const r="string"==typeof t?[...document.querySelectorAll(t)]:_e._preElems(t,"has");return _e._preElems(e,"has").filter(e=>r.some(t=>e&&e.contains(t)))}has(e){return _e.has(this,e).length>0}static closest(e,t,r){const n=[];for(const o of _e._preElems(e,"closest")){let e=o;for(;e&&e!==r;){if(1===e.nodeType&&("string"==typeof t?e.matches(t):e===t)){n.push(e);break}e=e.parentElement}}return[...new Set(n)]}closest(e,t){return _e.closest(this,e,t)}static isSameDom(e,t){return _e._preNodeElem(e,"isSameDom")===_e._preNodeElem(t,"isSameDom")}isSameDom(e){return _e.isSameDom(this,e)}_data={};static _dataSelector={public:(e,t)=>{const r=_e._preElem(t,e);let n=Ce.get(r);return n||(n={},Ce.set(r,n)),n},private:(e,t)=>{if(!(t instanceof _e))throw new Error(`Element must be a TinyHtml instance to execute ${e}().`);return t._data}};static data(e,t,r=!1){const n=_e._dataSelector[r?"private":"public"]("data",e);if(null==t)return{...n};if("string"!=typeof t)throw new TypeError("The key must be a string.");return n.hasOwnProperty(t)?n[t]:void 0}data(e,t){return _e.data(this,e,t)}static setData(e,t,r,n=!1){const o=_e._dataSelector[n?"private":"public"]("setData",e);if("string"!=typeof t)throw new TypeError("The key must be a string.");return o[t]=r,e}setData(e,t,r=!1){return _e.setData(this,e,t,r)}static _getSibling(e,t,r){let n=_e._preNodeElemWithNull(e,r);for(;n&&(n=n[t])&&1!==n.nodeType;);return n instanceof Node?n:null}static _getSiblings(e,t){let r=e;const n=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==t&&n.push(r);return n}static domDir(e,t,r,n="domDir"){if("string"!=typeof t)throw new TypeError('The "direction" must be a string.');let o=_e._preNodeElemWithNull(e,n);const i=[];for(;o&&(o=o[t]);)if(1===o.nodeType){if(r&&("string"==typeof r?o.matches(r):o===r))break;i.push(o)}return i}static parent(e){let t=_e._preNodeElemWithNull(e,"parent");const r=t?t.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return _e.parent(this)}static parents(e,t){return _e.domDir(e,"parentNode",t,"parents")}parents(e){return _e.parents(this,e)}static next(e){return _e._getSibling(e,"nextSibling","next")}next(){return _e.next(this)}static prev(e){return _e._getSibling(e,"previousSibling","prev")}prev(){return _e.prev(this)}static nextAll(e){return _e.domDir(e,"nextSibling",void 0,"nextAll")}nextAll(){return _e.nextAll(this)}static prevAll(e){return _e.domDir(e,"previousSibling",void 0,"prevAll")}prevAll(){return _e.prevAll(this)}static nextUntil(e,t){return _e.domDir(e,"nextSibling",t,"nextUtil")}nextUntil(e){return _e.nextUntil(this,e)}static prevUntil(e,t){return _e.domDir(e,"previousSibling",t,"prevUtil")}prevUntil(e){return _e.prevUntil(this,e)}static siblings(e){const t=_e._preNodeElemWithNull(e,"siblings");return _e._getSiblings(t&&t.parentNode?t.parentNode.firstChild:null,t)}siblings(){return _e.siblings(this)}static children(e){const t=_e._preNodeElemWithNull(e,"children");return _e._getSiblings(t?t.firstChild:null)}children(){return _e.children(this)}static contents(e){const t=_e._preNodeElemWithNull(e,"contents");return t instanceof HTMLIFrameElement&&null!=t.contentDocument&&Object.getPrototypeOf(t.contentDocument)?[t.contentDocument]:t instanceof HTMLTemplateElement?Array.from((t.content||t).childNodes):t?Array.from(t.childNodes):[]}contents(){return _e.contents(this)}static clone(e,t=!0){if("boolean"!=typeof t)throw new TypeError('The "deep" must be a boolean.');return _e._preNodeElems(e,"clone").map(e=>e.cloneNode(t))}clone(e){return _e.clone(this,e)[0]}static _appendChecker(e,...t){const r=[],n=[...t];for(const t in n)"string"!=typeof n[t]?r.push(_e._preNodeElem(n[t],e)):r.push(n[t]);return r}static append(e,...t){return _e._preElem(e,"append").append(..._e._appendChecker("append",...t)),e}append(...e){return _e.append(this,...e)}static prepend(e,...t){return _e._preElem(e,"prepend").prepend(..._e._appendChecker("prepend",...t)),e}prepend(...e){return _e.prepend(this,...e)}static before(e,...t){return _e._preElem(e,"before").before(..._e._appendChecker("before",...t)),e}before(...e){return _e.before(this,...e)}static after(e,...t){return _e._preElem(e,"after").after(..._e._appendChecker("after",...t)),e}after(...e){return _e.after(this,...e)}static replaceWith(e,...t){return _e._preElem(e,"replaceWith").replaceWith(..._e._appendChecker("replaceWith",...t)),e}replaceWith(...e){return _e.replaceWith(this,...e)}static appendTo(e,t){const r=_e._preNodeElems(e,"appendTo"),n=_e._preNodeElems(t,"appendTo");return n.forEach((e,t)=>{r.forEach(r=>e.appendChild(t===n.length-1?r:r.cloneNode(!0)))}),e}appendTo(e){return _e.appendTo(this,e)}static prependTo(e,t){const r=_e._preElems(e,"prependTo"),n=_e._preElems(t,"prependTo");return n.forEach((e,t)=>{r.slice().reverse().forEach(r=>e.prepend(t===n.length-1?r:r.cloneNode(!0)))}),e}prependTo(e){return _e.prependTo(this,e)}static insertBefore(e,t,r=null){const n=_e._preNodeElem(e,"insertBefore"),o=_e._preNodeElem(t,"insertBefore"),i=_e._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("The target element has no parent node to insert before.");return o.parentNode.insertBefore(n,i||o),e}insertBefore(e,t){return _e.insertBefore(this,e,t)}static insertAfter(e,t,r=null){const n=_e._preNodeElem(e,"insertAfter"),o=_e._preNodeElem(t,"insertBefore"),i=_e._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("The target element has no parent node to insert after.");return o.parentNode.insertBefore(n,i||o.nextSibling),e}insertAfter(e,t){return _e.insertAfter(this,e,t)}static replaceAll(e,t){const r=_e._preNodeElems(e,"replaceAll"),n=_e._preNodeElems(t,"replaceAll");return n.forEach((e,t)=>{const o=e.parentNode;r.forEach(r=>{o&&o.replaceChild(t===n.length-1?r:r.cloneNode(!0),e)})}),e}replaceAll(e){return _e.replaceAll(this,e)}#H;get size(){return this.#H.length}constructor(e){if(e instanceof _e)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");const t=e=>{if(!e.every(e=>e instanceof Element||e instanceof Window||e instanceof Document||e instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.")};if(Array.isArray(e))t(e),this.#H=e;else if(e instanceof NodeList||e instanceof HTMLCollection){const r=[...e];t(r),this.#H=r}else{const r=[e];t(r),this.#H=r}}static isWindow(e){return null!=e&&e===e.window}static css(e){const t=_e._preElem(e,"css");return window.getComputedStyle(t)}css(){return _e.css(this)}static cssString(e,t){const r=_e._preElem(e,"cssString");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return"string"==typeof n?n:"number"==typeof n?n.toString():null}cssString(e){return _e.cssString(this,e)}static cssList(e,t){const r=_e._preElem(e,"cssList");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)void 0!==e&&(o[e]=n.getPropertyValue(e));return o}cssList(e){return _e.cssList(this,e)}static cssFloat(e,t){const r=_e._preElem(e,"cssFloat");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return parseFloat(n)||0}cssFloat(e){return _e.cssFloat(this,e)}static cssFloats(e,t){const r=_e._preElem(e,"cssFloats");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)o[e]=parseFloat(n[e])||0;return o}cssFloats(e){return _e.cssFloats(this,e)}static#W={alignContent:"align-content",alignItems:"align-items",alignSelf:"align-self",animationDelay:"animation-delay",animationDirection:"animation-direction",animationDuration:"animation-duration",animationFillMode:"animation-fill-mode",animationIterationCount:"animation-iteration-count",animationName:"animation-name",animationPlayState:"animation-play-state",animationTimingFunction:"animation-timing-function",backfaceVisibility:"backface-visibility",backgroundAttachment:"background-attachment",backgroundBlendMode:"background-blend-mode",backgroundClip:"background-clip",backgroundColor:"background-color",backgroundImage:"background-image",backgroundOrigin:"background-origin",backgroundPosition:"background-position",backgroundRepeat:"background-repeat",backgroundSize:"background-size",borderBottom:"border-bottom",borderBottomColor:"border-bottom-color",borderBottomLeftRadius:"border-bottom-left-radius",borderBottomRightRadius:"border-bottom-right-radius",borderBottomStyle:"border-bottom-style",borderBottomWidth:"border-bottom-width",borderCollapse:"border-collapse",borderColor:"border-color",borderImage:"border-image",borderImageOutset:"border-image-outset",borderImageRepeat:"border-image-repeat",borderImageSlice:"border-image-slice",borderImageSource:"border-image-source",borderImageWidth:"border-image-width",borderLeft:"border-left",borderLeftColor:"border-left-color",borderLeftStyle:"border-left-style",borderLeftWidth:"border-left-width",borderRadius:"border-radius",borderRight:"border-right",borderRightColor:"border-right-color",borderRightStyle:"border-right-style",borderRightWidth:"border-right-width",borderSpacing:"border-spacing",borderStyle:"border-style",borderTop:"border-top",borderTopColor:"border-top-color",borderTopLeftRadius:"border-top-left-radius",borderTopRightRadius:"border-top-right-radius",borderTopStyle:"border-top-style",borderTopWidth:"border-top-width",borderWidth:"border-width",boxDecorationBreak:"box-decoration-break",boxShadow:"box-shadow",boxSizing:"box-sizing",breakAfter:"break-after",breakBefore:"break-before",breakInside:"break-inside",captionSide:"caption-side",caretColor:"caret-color",clipPath:"clip-path",columnCount:"column-count",columnFill:"column-fill",columnGap:"column-gap",columnRule:"column-rule",columnRuleColor:"column-rule-color",columnRuleStyle:"column-rule-style",columnRuleWidth:"column-rule-width",columnSpan:"column-span",columnWidth:"column-width",counterIncrement:"counter-increment",counterReset:"counter-reset",emptyCells:"empty-cells",flexBasis:"flex-basis",flexDirection:"flex-direction",flexFlow:"flex-flow",flexGrow:"flex-grow",flexShrink:"flex-shrink",flexWrap:"flex-wrap",fontFamily:"font-family",fontFeatureSettings:"font-feature-settings",fontKerning:"font-kerning",fontLanguageOverride:"font-language-override",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontSynthesis:"font-synthesis",fontVariant:"font-variant",fontVariantAlternates:"font-variant-alternates",fontVariantCaps:"font-variant-caps",fontVariantEastAsian:"font-variant-east-asian",fontVariantLigatures:"font-variant-ligatures",fontVariantNumeric:"font-variant-numeric",fontVariantPosition:"font-variant-position",fontWeight:"font-weight",gridArea:"grid-area",gridAutoColumns:"grid-auto-columns",gridAutoFlow:"grid-auto-flow",gridAutoRows:"grid-auto-rows",gridColumn:"grid-column",gridColumnEnd:"grid-column-end",gridColumnGap:"grid-column-gap",gridColumnStart:"grid-column-start",gridGap:"grid-gap",gridRow:"grid-row",gridRowEnd:"grid-row-end",gridRowGap:"grid-row-gap",gridRowStart:"grid-row-start",gridTemplate:"grid-template",gridTemplateAreas:"grid-template-areas",gridTemplateColumns:"grid-template-columns",gridTemplateRows:"grid-template-rows",imageRendering:"image-rendering",justifyContent:"justify-content",letterSpacing:"letter-spacing",lineBreak:"line-break",lineHeight:"line-height",listStyle:"list-style",listStyleImage:"list-style-image",listStylePosition:"list-style-position",listStyleType:"list-style-type",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",maskClip:"mask-clip",maskComposite:"mask-composite",maskImage:"mask-image",maskMode:"mask-mode",maskOrigin:"mask-origin",maskPosition:"mask-position",maskRepeat:"mask-repeat",maskSize:"mask-size",maskType:"mask-type",maxHeight:"max-height",maxWidth:"max-width",minHeight:"min-height",minWidth:"min-width",mixBlendMode:"mix-blend-mode",objectFit:"object-fit",objectPosition:"object-position",offsetAnchor:"offset-anchor",offsetDistance:"offset-distance",offsetPath:"offset-path",offsetRotate:"offset-rotate",outlineColor:"outline-color",outlineOffset:"outline-offset",outlineStyle:"outline-style",outlineWidth:"outline-width",overflowAnchor:"overflow-anchor",overflowWrap:"overflow-wrap",overflowX:"overflow-x",overflowY:"overflow-y",paddingBottom:"padding-bottom",paddingLeft:"padding-left",paddingRight:"padding-right",paddingTop:"padding-top",pageBreakAfter:"page-break-after",pageBreakBefore:"page-break-before",pageBreakInside:"page-break-inside",perspectiveOrigin:"perspective-origin",placeContent:"place-content",placeItems:"place-items",placeSelf:"place-self",pointerEvents:"pointer-events",rowGap:"row-gap",scrollBehavior:"scroll-behavior",scrollMargin:"scroll-margin",scrollMarginBlock:"scroll-margin-block",scrollMarginBlockEnd:"scroll-margin-block-end",scrollMarginBlockStart:"scroll-margin-block-start",scrollMarginBottom:"scroll-margin-bottom",scrollMarginInline:"scroll-margin-inline",scrollMarginInlineEnd:"scroll-margin-inline-end",scrollMarginInlineStart:"scroll-margin-inline-start",scrollMarginLeft:"scroll-margin-left",scrollMarginRight:"scroll-margin-right",scrollMarginTop:"scroll-margin-top",scrollPadding:"scroll-padding",scrollPaddingBlock:"scroll-padding-block",scrollPaddingBlockEnd:"scroll-padding-block-end",scrollPaddingBlockStart:"scroll-padding-block-start",scrollPaddingBottom:"scroll-padding-bottom",scrollPaddingInline:"scroll-padding-inline",scrollPaddingInlineEnd:"scroll-padding-inline-end",scrollPaddingInlineStart:"scroll-padding-inline-start",scrollPaddingLeft:"scroll-padding-left",scrollPaddingRight:"scroll-padding-right",scrollPaddingTop:"scroll-padding-top",scrollSnapAlign:"scroll-snap-align",scrollSnapStop:"scroll-snap-stop",scrollSnapType:"scroll-snap-type",shapeImageThreshold:"shape-image-threshold",shapeMargin:"shape-margin",shapeOutside:"shape-outside",tabSize:"tab-size",tableLayout:"table-layout",textAlign:"text-align",textAlignLast:"text-align-last",textCombineUpright:"text-combine-upright",textDecoration:"text-decoration",textDecorationColor:"text-decoration-color",textDecorationLine:"text-decoration-line",textDecorationStyle:"text-decoration-style",textIndent:"text-indent",textJustify:"text-justify",textOrientation:"text-orientation",textOverflow:"text-overflow",textShadow:"text-shadow",textTransform:"text-transform",transformBox:"transform-box",transformOrigin:"transform-origin",transformStyle:"transform-style",transitionDelay:"transition-delay",transitionDuration:"transition-duration",transitionProperty:"transition-property",transitionTimingFunction:"transition-timing-function",unicodeBidi:"unicode-bidi",userSelect:"user-select",verticalAlign:"vertical-align",whiteSpace:"white-space",willChange:"will-change",wordBreak:"word-break",wordSpacing:"word-spacing",wordWrap:"word-wrap",writingMode:"writing-mode",zIndex:"z-index",WebkitTransform:"-webkit-transform",WebkitTransition:"-webkit-transition",WebkitBoxShadow:"-webkit-box-shadow",MozBoxShadow:"-moz-box-shadow",MozTransform:"-moz-transform",MozTransition:"-moz-transition",msTransform:"-ms-transform",msTransition:"-ms-transition"};static cssPropAliases=new Proxy(_e.#W,{set:(e,t,r)=>(e[t]=r,_e.cssPropRevAliases[r]=t,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(_e.#W).map(([e,t])=>[t,e]));static toStyleKc(e){return"string"==typeof _e.cssPropAliases[e]?_e.cssPropAliases[e]:e}static toStyleCc(e){return"string"==typeof _e.cssPropRevAliases[e]?_e.cssPropRevAliases[e]:e}static setStyle(e,t,r=null){return _e._preHtmlElems(e,"setStyle").forEach(e=>{if("object"==typeof t)for(const[r,n]of Object.entries(t))e.style.setProperty(_e.toStyleKc(r),"string"==typeof n?n:"number"==typeof n?`${n}px`:String(n));else e.style.setProperty(_e.toStyleKc(t),r)}),e}setStyle(e,t){return _e.setStyle(this,e,t)}static getStyle(e,t){return _e._preHtmlElem(e,"getStyle").style.getPropertyValue(_e.toStyleKc(t))}getStyle(e){return _e.getStyle(this,e)}static style(e,{camelCase:t=!1,rawAttr:r=!1}={}){if("boolean"!=typeof t)throw new TypeError('"camelCase" must be a boolean. Received: '+typeof t);if("boolean"!=typeof r)throw new TypeError('"rawAttr" must be a boolean. Received: '+typeof r);const n=_e._preHtmlElem(e,"style"),o={};if(r){const e=(n.getAttribute("style")||"").split(";");for(const r of e){const[e,n]=r.split(":");if(!e||!n)continue;const i=e.trim(),s=n.trim();o[t?_e.toStyleCc(i):i]=s}}else{const e=n.style;for(let r=0;r<e.length;r++){const n=e[r],i=e.getPropertyValue(n);o[t?_e.toStyleCc(n):n]=i}}return o}style(e){return _e.style(this,e)}static removeStyle(e,t){return _e._preHtmlElems(e,"removeStyle").forEach(e=>{if(Array.isArray(t))for(const r of t)e.style.removeProperty(_e.toStyleKc(r));else e.style.removeProperty(_e.toStyleKc(t))}),e}removeStyle(e){return _e.removeStyle(this,e)}static toggleStyle(e,t,r,n){return _e._preHtmlElems(e,"toggleStyle").forEach(e=>{const o=_e.getStyle(e,t).trim()===_e.toStyleKc(r)?n:r;_e.setStyle(e,t,o)}),e}toggleStyle(e,t,r){return _e.toggleStyle(this,e,t,r)}static clearStyle(e){return _e._preElems(e,"clearStyle").forEach(e=>e.removeAttribute("style")),e}clearStyle(){return _e.clearStyle(this)}static focus(e){return _e._preHtmlElem(e,"focus").focus(),e}focus(){return _e.focus(this)}static blur(e){return _e._preHtmlElem(e,"blur").blur(),e}blur(){return _e.blur(this)}static boolCheck(e){return void 0!==e&&("true"===e||"1"===e||!0===e||"on"===e||"number"==typeof e&&e>0)}static setWinScrollTop(e){if("number"!=typeof e)throw new TypeError("The value must be a number.");_e.setScrollTop(window,e)}static setWinScrollLeft(e){if("number"!=typeof e)throw new TypeError("The value must be a number.");_e.setScrollLeft(window,e)}static winScrollTop(){return window.scrollY||document.documentElement.scrollTop}static winScrollLeft(){return window.scrollX||document.documentElement.scrollLeft}static winInnerHeight(){return window.innerHeight||document.documentElement.clientHeight}static winInnerWidth(){return window.innerWidth||document.documentElement.clientWidth}static isPageTop(){return 0===window.scrollY}static isPageBottom(){return window.innerHeight+window.scrollY>=document.body.offsetHeight}static getDimension(e,t,r="content"){const n=_e._preElemAndWinAndDoc(e,"getDimension");if("string"!=typeof t)throw new TypeError("The type must be a string.");if("string"!=typeof r)throw new TypeError("The extra must be a string.");const o="width"===t?"Width":"Height";if(_e.isWindow(n))return"margin"===r?n["inner"+o]:n.document.documentElement["client"+o];const i=n;if(9===i.nodeType){const e=i.documentElement;return Math.max(i.body["scroll"+o],e["scroll"+o],i.body["offset"+o],e["offset"+o],e["client"+o])}let s=i.getBoundingClientRect()[t];function a(e){return"width"===t?_e.cssFloat(i,e+"Left")+_e.cssFloat(i,e+"Right"):_e.cssFloat(i,e+"Top")+_e.cssFloat(i,e+"Bottom")}switch(r){case"content":s-=a("padding"),s-=a("border");break;case"padding":s-=a("border");break;case"border":break;case"margin":s+=a("margin")}return s}getDimension(e,t){return _e.getDimension(this,e,t)}static setHeight(e,t){const r=_e._preHtmlElem(e,"setHeight");if("number"!=typeof t&&"string"!=typeof t)throw new TypeError("The value must be a string or number.");return r.style.height="number"==typeof t?`${t}px`:t,e}setHeight(e){return _e.setHeight(this,e)}static setWidth(e,t){const r=_e._preHtmlElem(e,"setWidth");if("number"!=typeof t&&"string"!=typeof t)throw new TypeError("The value must be a string or number.");return r.style.width="number"==typeof t?`${t}px`:t,e}setWidth(e){return _e.setWidth(this,e)}static height(e){const t=_e._preElemAndWinAndDoc(e,"height");return _e.getDimension(t,"height","content")}height(){return _e.height(this)}static width(e){const t=_e._preElemAndWinAndDoc(e,"width");return _e.getDimension(t,"width","content")}width(){return _e.width(this)}static innerHeight(e){const t=_e._preElemAndWinAndDoc(e,"innerHeight");return _e.getDimension(t,"height","padding")}innerHeight(){return _e.innerHeight(this)}static innerWidth(e){const t=_e._preElemAndWinAndDoc(e,"innerWidth");return _e.getDimension(t,"width","padding")}innerWidth(){return _e.innerWidth(this)}static outerHeight(e,t=!1){if("boolean"!=typeof t)throw new TypeError('The "includeMargin" must be a boolean.');const r=_e._preElemAndWinAndDoc(e,"outerHeight");return _e.getDimension(r,"height",t?"margin":"border")}outerHeight(e){return _e.outerHeight(this,e)}static outerWidth(e,t=!1){if("boolean"!=typeof t)throw new TypeError('The "includeMargin" must be a boolean.');const r=_e._preElemAndWinAndDoc(e,"outerWidth");return _e.getDimension(r,"width",t?"margin":"border")}outerWidth(e){return _e.outerWidth(this,e)}static animate(e,t,r){return _e._preElems(e,"animate").forEach(e=>e.animate(t,r)),e}animate(e,t){return _e.animate(this,e,t)}static offset(e){const t=_e._preElem(e,"offset").getBoundingClientRect(),r=window.scrollY||document.documentElement.scrollTop,n=window.scrollX||document.documentElement.scrollLeft;return{top:t.top+r,left:t.left+n}}offset(){return _e.offset(this)}static position(e){const t=_e._preHtmlElem(e,"position");let r,n,o={top:0,left:0};if("fixed"===window.getComputedStyle(t).position)n=t.getBoundingClientRect();else{n=_e.offset(t),r=t.offsetParent||document.documentElement;const{position:e}=window.getComputedStyle(r);for(;r instanceof HTMLElement&&(r===document.body||r===document.documentElement)&&"static"===e;)r=r.parentNode;if(r instanceof HTMLElement&&r!==t&&1===r.nodeType){const{borderTopWidth:e,borderLeftWidth:t}=_e.cssFloats(r,["borderTopWidth","borderLeftWidth"]);o=_e.offset(r),o.top+=e,o.left+=t}}return{top:n.top-o.top-_e.cssFloat(t,"marginTop"),left:n.left-o.left-_e.cssFloat(t,"marginLeft")}}position(){return _e.position(this)}static offsetParent(e){let t=_e._preHtmlElem(e,"offsetParent").offsetParent;for(;t instanceof HTMLElement&&"static"===window.getComputedStyle(t).position;)t=t.offsetParent;return t instanceof HTMLElement?t:document.documentElement}offsetParent(){return _e.offsetParent(this)}static scrollTop(e){const t=_e._preElemAndWindow(e,"scrollTop");return _e.isWindow(t)?t.pageYOffset:9===t.nodeType?t.defaultView.pageYOffset:t.scrollTop}scrollTop(){return _e.scrollTop(this)}static scrollLeft(e){const t=_e._preElemAndWindow(e,"scrollLeft");return _e.isWindow(t)?t.pageXOffset:9===t.nodeType?t.defaultView.pageXOffset:t.scrollLeft}scrollLeft(){return _e.scrollLeft(this)}static easings={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1};static scrollToXY(e,{targetX:t,targetY:r,duration:n,easing:o,onAnimation:i}={}){if(void 0!==t&&"number"!=typeof t)throw new TypeError("`targetX` must be a number if provided.");if(void 0!==r&&"number"!=typeof r)throw new TypeError("`targetY` must be a number if provided.");if(void 0!==n&&"number"!=typeof n)throw new TypeError("`duration` must be a number if provided.");if(void 0!==o&&"string"!=typeof o)throw new TypeError("`easing` must be a string if provided.");if(void 0!==o&&"function"!=typeof _e.easings[o])throw new TypeError(`Unknown easing function: "${o}".`);if(void 0!==i&&"function"!=typeof i)throw new TypeError("`onAnimation` must be a function if provided.");const s=(e,t,r,n)=>{if(e instanceof Window)window.scrollTo(t,r);else if(9===e.nodeType)e.defaultView.scrollTo(t,r);else{const n=e instanceof Window?window.scrollX:e.scrollLeft,o=e instanceof Window?window.scrollY:e.scrollTop;n!==t&&(e.scrollLeft=t),o!==r&&(e.scrollTop=r)}"function"==typeof i&&i({x:t,y:r,isComplete:n>=1,time:n})};return _e._preElemsAndWindow(e,"scrollToXY").forEach(e=>{const i=e instanceof Window?window.scrollX:e.scrollLeft,a=e instanceof Window?window.scrollY:e.scrollTop,l=t??i,u=r??a,c=l-i,h=u-a,d="string"==typeof o&&_e.easings[o]||null;if("number"!=typeof n||"function"!=typeof d)return s(e,l,u,1);const f=performance.now(),m=n??0;requestAnimationFrame(function t(r){if("function"!=typeof d)return;const n=Math.min(1,(r-f)/m),o=d(n);s(e,i+c*o,a+h*o,n),n<1&&requestAnimationFrame(t)})}),e}scrollToXY({targetX:e,targetY:t,duration:r,easing:n,onAnimation:o}={}){return _e.scrollToXY(this,{targetX:e,targetY:t,duration:r,easing:n,onAnimation:o})}static setScrollTop(e,t){if("number"!=typeof t)throw new TypeError("ScrollTop value must be a number.");return _e.scrollToXY(e,{targetY:t})}setScrollTop(e){return _e.setScrollTop(this,e)}static setScrollLeft(e,t){if("number"!=typeof t)throw new TypeError("ScrollLeft value must be a number.");return _e.scrollToXY(e,{targetX:t})}setScrollLeft(e){return _e.setScrollLeft(this,e)}static borderWidth(e){const t=_e._preElem(e,"borderWidth"),{borderLeftWidth:r,borderRightWidth:n,borderTopWidth:o,borderBottomWidth:i}=_e.cssFloats(t,["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}borderWidth(){return _e.borderWidth(this)}static border(e){const t=_e._preElem(e,"border"),{borderLeft:r,borderRight:n,borderTop:o,borderBottom:i}=_e.cssFloats(t,["borderLeft","borderRight","borderTop","borderBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}border(){return _e.border(this)}static margin(e){const t=_e._preElem(e,"margin"),{marginLeft:r,marginRight:n,marginTop:o,marginBottom:i}=_e.cssFloats(t,["marginLeft","marginRight","marginTop","marginBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}margin(){return _e.margin(this)}static padding(e){const t=_e._preElem(e,"padding"),{paddingLeft:r,paddingRight:n,paddingTop:o,paddingBottom:i}=_e.cssFloats(t,["paddingLeft","paddingRight","paddingTop","paddingBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}padding(){return _e.padding(this)}static addClass(e,...t){return _e._preElems(e,"addClass").forEach(e=>e.classList.add(...t)),e}addClass(...e){return _e.addClass(this,...e)}static removeClass(e,...t){return _e._preElems(e,"removeClass").forEach(e=>e.classList.remove(...t)),e}removeClass(...e){return _e.removeClass(this,...e)}static replaceClass(e,t,r){if("string"!=typeof t)throw new TypeError('The "token" parameter must be a string.');if("string"!=typeof r)throw new TypeError('The "newToken" parameter must be a string.');const n=[];return _e._preElems(e,"replaceClass").forEach(e=>n.push(e.classList.replace(t,r))),n}replaceClass(e,t){return _e.replaceClass(this,e,t)[0]}static classItem(e,t){const r=_e._preElem(e,"classItem");if("number"!=typeof t)throw new TypeError('The "index" parameter must be a number.');return r.classList.item(t)}classItem(e){return _e.classItem(this,e)}static toggleClass(e,t,r){if("string"!=typeof t)throw new TypeError('The "token" parameter must be a string.');if(void 0!==r&&"boolean"!=typeof r)throw new TypeError('The "force" parameter must be a boolean.');const n=[];return _e._preElems(e,"toggleClass").forEach(e=>n.push(e.classList.toggle(t,r))),n}toggleClass(e,t){return _e.toggleClass(this,e,t)[0]}static hasClass(e,t){const r=_e._preElem(e,"hasClass");if("string"!=typeof t)throw new TypeError('The "token" parameter must be a string.');return r.classList.contains(t)}hasClass(e){return _e.hasClass(this,e)}static classLength(e){return _e._preElem(e,"classLength").classList.length}classLength(){return _e.classLength(this)}static classList(e){return _e._preElem(e,"classList").classList.values().toArray()}classList(){return _e.classList(this)}static tagName(e){return _e._preElem(e,"tagName").tagName}tagName(){return _e.tagName(this)}static id(e){return _e._preElem(e,"id").id}id(){return _e.id(this)}static text(e){return _e._preElem(e,"text").textContent}text(){return _e.text(this)}static setText(e,t){if("string"!=typeof t)throw new Error("Value is not a valid string.");return _e._preElems(e,"setText").forEach(e=>e.textContent=t),e}setText(e){return _e.setText(this,e)}static empty(e){return _e._preElems(e,"empty").forEach(e=>e.textContent=""),e}empty(){return _e.empty(this)}static html(e,t){return _e._preElem(e,"html").getHTML(t)}html(e){return _e.html(this,e)}static setHtml(e,t){if("string"!=typeof t)throw new Error("Value is not a valid string.");return _e._preElems(e,"setHtml").forEach(e=>e.innerHTML=t),e}setHtml(e){return _e.setHtml(this,e)}static _valHooks={option:{get:e=>{const t=e.getAttribute("value");return null!=t?t:e.textContent}},select:{get:e=>{const t=e.options,r=e.selectedIndex,n="select-one"===e.type,o=n?r+1:t.length,i=[];let s=r<0?o:n?r:0;for(;s<o;s++){const e=t[s],o=e.parentNode;if((e.selected||s===r)&&!e.disabled&&(!o||!o.disabled||"OPTGROUP"!==o.tagName)){const t=_e._valHooks.option.get(e);if(n)return t;i.push(t)}}return i},set:(e,t)=>{const r=e.options,n=Array.isArray(t)?t.map(String):[String(t)];let o=!1;for(let e=0;e<r.length;e++){const t=r[e],i=_e._valHooks.option.get(t);"string"==typeof i&&(t.selected=n.includes(i))&&(o=!0)}return o||(e.selectedIndex=-1),n}},radio:{get:e=>e.checked?"on":"off",set(e,t){if("boolean"==typeof t){const r=e.closest("label");return t&&r&&r.querySelectorAll('input[type="radio"]').forEach(t=>{t instanceof HTMLInputElement&&t!==e&&(t.checked=!1)}),e.checked=t,t}}},checkbox:{get:e=>e.checked?"on":"off",set(e,t){if("boolean"==typeof t)return e.checked=t,t}}};static setVal(e,t){return _e._preInputElems(e,"setVal").forEach(e=>{if(1!==e.nodeType)return;let r="function"==typeof t?t(e,_e.val(e)):t;null==r?r="":"number"==typeof r?r=String(r):Array.isArray(r)&&(r=((e,t)=>{const r=[];for(let n=0;n<e.length;n++)r.push(t(e[n]));return r})(r,e=>null==e?"":String(e)));const n=_e._valHooks[e.type]||_e._valHooks[e.nodeName.toLowerCase()];if(!n||"function"!=typeof n.set||void 0===n.set(e,r,"value")){if("string"!=typeof r&&"boolean"!=typeof r)throw new Error(`Invalid setValue "${typeof r}" value.`);"string"==typeof r&&(e.value=r)}}),e}setVal(e){return _e.setVal(this,e)}static _valTypes={string:e=>e.value,date:e=>e.valueAsDate,number:e=>e.valueAsNumber};static _getValByType(e,t,r){if("string"!=typeof t)throw new TypeError('The "type" must be a string.');if("string"!=typeof r)throw new TypeError('The "where" must be a string.');if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error(`Provided element is not an HTMLInputElement in ${r}().`);if("function"!=typeof _e._valTypes[t])throw new Error(`No handler found for type "${t}" in ${r}().`);return _e._valTypes[t](e)}static _val(e,t,r){const n=_e._preInputElem(e,t),o=_e._valHooks[n.type]||_e._valHooks[n.nodeName.toLowerCase()];if(o&&"function"==typeof o.get){const e=o.get(n,"value",r);if(void 0!==e)return"string"==typeof e?e.replace(/\r/g,""):e}return _e._getValByType(n,r,t)}_val(e,t){return _e._val(this,e,t)}static val(e){return _e._val(e,"val","string")}val(){return _e.val(this)}static valTxt(e){const t=_e._val(e,"valTxt","string");if("string"!=typeof t&&null!==t)throw new Error("Value is not a valid string.");return null==t?"":"string"==typeof t?t.replace(/\r/g,""):t}valTxt(){return _e.valTxt(this)}static _valArr(e,t,r){const n=_e._val(e,t,r);if(!Array.isArray(n))throw new Error(`Value expected an array but got ${typeof n}.`);return n}_valArr(e,t){return _e._valArr(this,e,t)}static valArr(e){return _e._valArr(e,"valArr","string")}valArr(){return _e.valArr(this)}static valNb(e){if(!(_e._preInputElem(e,"valNb")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const t=_e._val(e,"valNb","number");if(Number.isNaN(t))throw new Error("Value is not a valid number.");return t}valNb(){return _e.valNb(this)}static valDate(e){if(!(_e._preInputElem(e,"valDate")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const t=_e._val(e,"valDate","date");if(!(t instanceof Date))throw new Error("Value is not a valid date.");return t}valDate(){return _e.valDate(this)}static valBool(e){const t=_e._preInputElem(e,"valBool");if(!(t instanceof HTMLInputElement))throw new Error("Element must be an input element.");return"on"===_e.val(t)}valBool(){return _e.valBool(this)}static listenForPaste(e,{onFilePaste:t,onTextPaste:r}={}){if(void 0!==t&&"function"!=typeof t)throw new TypeError("onFilePaste must be a function.");if(void 0!==r&&"function"!=typeof r)throw new TypeError("onTextPaste must be a function.");const n=e=>{if(!(e instanceof ClipboardEvent))return;const n=e.clipboardData?.items||[];for(const e of n)if("file"===e.kind){if("function"==typeof t){const r=e.getAsFile();r&&t(e,r)}}else"string"===e.kind&&"function"==typeof r&&e.getAsString(t=>r(e,t))};return _e._preElemsWithDoc(e,"listenForPaste").forEach(e=>_e.on(e,"paste",n)),n}listenForPaste({onFilePaste:e,onTextPaste:t}={}){return _e.listenForPaste(this,{onFilePaste:e,onTextPaste:t})}static hasEventListener(e,t){const r=_e._preEventTargetElem(e,"hasEventListener");if(!Le.has(r))return!1;const n=Le.get(r);return!!(n&&Array.isArray(n[t])&&n[t].length>0)}hasEventListener(e){return _e.hasEventListener(this,e)}static hasExactEventListener(e,t,r){const n=_e._preEventTargetElem(e,"hasExactEventListener");if("function"!=typeof r)throw new TypeError('The "handler" must be a function.');if(!Le.has(n))return!1;const o=Le.get(n);return!(!o||!Array.isArray(o[t]))&&o[t].some(e=>e.handler===r)}hasExactEventListener(e,t){return _e.hasExactEventListener(this,e,t)}static on(e,t,r,n){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"on").forEach(e=>{e.addEventListener(t,r,n),Le.has(e)||Le.set(e,{});const o=Le.get(e);o&&(Array.isArray(o[t])||(o[t]=[]),o[t].push({handler:r,options:n}))}),e}on(e,t,r){return _e.on(this,e,t,r)}static once(e,t,r,n={}){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"once").forEach(e=>{const o=n=>{_e.off(e,t,o),"function"==typeof r&&r(n)};_e.on(e,t,o,"boolean"==typeof n?n:{...n,once:!0})}),e}once(e,t,r={}){return _e.once(this,e,t,r)}static off(e,t,r,n){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"off").forEach(e=>{e.removeEventListener(t,r,n);const o=Le.get(e);o&&o[t]&&(o[t]=o[t].filter(e=>e.handler!==r),0===o[t].length&&delete o[t])}),e}off(e,t,r){return _e.off(this,e,t,r)}static offAll(e,t){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"offAll").forEach(e=>{const r=Le.get(e);if(r&&r[t]){for(const n of r[t])e.removeEventListener(t,n.handler,n.options);delete r[t]}}),e}offAll(e){return _e.offAll(this,e)}static offAllTypes(e,t=null){if(null!==t&&"function"!=typeof t)throw new TypeError('The "filterFn" must be a function.');return _e._preEventTargetElems(e,"offAllTypes").forEach(e=>{const r=Le.get(e);if(r){for(const n in r)for(const o of r[n])("function"!=typeof t||t(o.handler,n))&&e.removeEventListener(n,o.handler,o.options);Le.delete(e)}}),e}offAllTypes(e=null){return _e.offAllTypes(this,e)}static trigger(e,t,r={}){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"trigger").forEach(e=>{const n=r instanceof Event||r instanceof CustomEvent?r:new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e.dispatchEvent(n)}),e}trigger(e,t={}){return _e.trigger(this,e,t)}static#F={for:"htmlFor",class:"className"};static propFix=new Proxy(_e.#F,{set:(e,t,r)=>(e[t]=r,_e.attrFix[r]=t,!0)});static attrFix=Object.fromEntries(Object.entries(_e.#F).map(([e,t])=>[t,e]));static getPropName(e){return"string"==typeof _e.propFix[e]?_e.propFix[e]:e}static getAttrName(e){return"string"==typeof _e.attrFix[e]?_e.attrFix[e]:e}static attr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElem(e,"attr").getAttribute(_e.getAttrName(t))}attr(e){return _e.attr(this,e)}static setAttr(e,t,r=null){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');if(null!==r&&"string"!=typeof r)throw new TypeError('The "value" must be a string.');return _e._preElems(e,"setAttr").forEach(e=>{null===r?e.removeAttribute(_e.getAttrName(t)):e.setAttribute(_e.getAttrName(t),r)}),e}setAttr(e,t){return _e.setAttr(this,e,t)}static removeAttr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElems(e,"removeAttr").forEach(e=>e.removeAttribute(_e.getAttrName(t))),e}removeAttr(e){return _e.removeAttr(this,e)}static hasAttr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElem(e,"hasAttr").hasAttribute(_e.getAttrName(t))}hasAttr(e){return _e.hasAttr(this,e)}static hasProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return!!_e._preElem(e,"hasProp")[_e.getPropName(t)]}hasProp(e){return _e.hasProp(this,e)}static addProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElems(e,"addProp").forEach(e=>{e[_e.getPropName(t)]=!0}),e}addProp(e){return _e.addProp(this,e)}static removeProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElems(e,"removeProp").forEach(e=>{e[_e.getPropName(t)]=!1}),e}removeProp(e){return _e.removeProp(this,e)}static toggleProp(e,t,r){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');if(void 0!==r&&"boolean"!=typeof r)throw new TypeError('The "force" must be a boolean.');_e._preElems(e,"toggleProp").forEach(e=>{(void 0===r?!e[_e.getPropName(t)]:r)?_e.addProp(e,t):_e.removeProp(e,t)})}toggleProp(e,t){return _e.toggleProp(this,e,t)}static remove(e){return _e._preElems(e,"remove").forEach(e=>e.remove()),e}remove(){return _e.remove(this)}static index(e,t=null){const r=_e._preElem(e,"index");if(!r)return-1;if(!t)return Array.prototype.indexOf.call(r.parentNode?.children||[],r);if(t){const e="string"==typeof t?document.querySelectorAll(t):_e._preElems(t,"index");return Array.prototype.indexOf.call(e,r)}return-1}index(e){return _e.index(this,e)}static _getCustomRect(e,t){const r={height:0,width:0,x:0,y:0,bottom:0,left:0,right:0,top:0,toJSON:function(){throw new Error("Function not implemented.")}};for(const t in e)"number"==typeof e[t]&&(r[t]=e[t]);if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("extraRect must be a non-null object.");const{height:n=0,width:o=0,top:i=0,bottom:s=0,left:a=0,right:l=0}=t;if("number"!=typeof n)throw new Error("extraRect.height must be a number.");if("number"!=typeof o)throw new Error("extraRect.width must be a number.");if("number"!=typeof i)throw new Error("extraRect.top must be a number.");if("number"!=typeof s)throw new Error("extraRect.bottom must be a number.");if("number"!=typeof a)throw new Error("extraRect.left must be a number.");if("number"!=typeof l)throw new Error("extraRect.right must be a number.");return r.height+=n,r.width+=o,r.top+=i,r.bottom+=s,r.left+=a,r.right+=l,r}static isCollWith(e,t,r={}){const n=_e._getCustomRect(_e._preElem(e,"isCollWith").getBoundingClientRect(),r),o=_e._preElem(t,"isCollWith").getBoundingClientRect();return we(n,o)}isCollWith(e,t){return _e.isCollWith(this,e,t)}static isCollPerfWith(e,t,r={}){const n=_e._getCustomRect(_e._preElem(e,"isCollPerfWith").getBoundingClientRect(),r),o=_e._preElem(t,"isCollPerfWith").getBoundingClientRect();return ve(n,o)}isCollPerfWith(e,t){return _e.isCollPerfWith(this,e,t)}static _isCollWithLock(e,t,r,n,o){const i=Ae[o];if(e)return i.has(n)||i.set(n,!0),!0;if(i.has(n)){let e=!1;switch(o){case"top":e=Ee(t,r);break;case"bottom":e=Te(t,r);break;case"left":e=xe(t,r);break;case"right":e=Se(t,r)}return e&&i.delete(n),i.has(n)}return!1}static isCollWithLock(e,t,r,n={}){const o=_e._preElem(e,"isCollWithLock"),i=_e._preElem(t,"isCollWithLock"),s=_e._getCustomRect(o.getBoundingClientRect(),n),a=i.getBoundingClientRect(),l=we(s,a);return _e._isCollWithLock(l,s,a,o,r)}isCollWithLock(e,t,r){return _e.isCollWithLock(this,e,t,r)}static isCollPerfWithLock(e,t,r,n={}){const o=_e._preElem(e,"isCollPerfWithLock"),i=_e._preElem(t,"isCollPerfWithLock"),s=_e._getCustomRect(o.getBoundingClientRect(),n),a=i.getBoundingClientRect(),l=ve(s,a);return _e._isCollWithLock(l,s,a,o,r)}isCollPerfWithLock(e,t,r){return _e.isCollPerfWithLock(this,e,t,r)}static resetCollLock(e){const t=_e._preElem(e,"resetCollLock");let r=!1;for(const e of["top","bottom","left","right"])Ae[e].has(t)&&(Ae[e].delete(t),r=!0);return r}resetCollLock(){return _e.resetCollLock(this)}static resetCollLockDir(e,t){const r=_e._preElem(e,"resetCollLockDir"),n=Ae[t];return!!n.has(r)&&(n.delete(r),!0)}resetCollLockDir(e){return _e.resetCollLockDir(this,e)}static isInViewport(e){const t=_e._preElem(e,"isInViewport");if(!t.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=_e.offset(t).top,n=r+_e.outerHeight(t),o=_e.scrollTop(window),i=o+_e.height(window);return n>o&&r<i}isInViewport(){return _e.isInViewport(this)}static isScrolledIntoView(e){const t=_e._preElem(e,"isScrolledIntoView");if(!t.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=_e.scrollTop(window),n=r+_e.height(window),o=_e.offset(t).top;return o+_e.height(t)<=n&&o>=r}isScrolledIntoView(){return _e.isScrolledIntoView(this)}static isInContainer(e,t){const r=_e._preElem(e,"isInContainer"),n=_e._preElem(t,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const o=r.getBoundingClientRect(),i=n.getBoundingClientRect(),s=o.bottom>i.top&&o.top<i.bottom,a=o.right>i.left&&o.left<i.right;return s&&a}isInContainer(e){return _e.isInContainer(this,e)}static isFullyInContainer(e,t){const r=_e._preElem(e,"isScrolledIntoView"),n=_e._preElem(t,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const o=r.getBoundingClientRect(),i=n.getBoundingClientRect();return o.top>=i.top&&o.bottom<=i.bottom&&o.left>=i.left&&o.right<=i.right}isFullyInContainer(e){return _e.isFullyInContainer(this,e)}static hasScroll(e){const t=_e._preElem(e,"hasScroll");return{v:t.scrollHeight>t.clientHeight,h:t.scrollWidth>t.clientWidth}}hasScroll(){return _e.hasScroll(this)}}const De=_e;function Me(e,t){return De.isCollWith(e,t)}const ke=e=>De.borderWidth(e),Ne=e=>De.border(e),Ie=e=>De.margin(e),Be=e=>De.padding(e);function je(e){const t=e.offsetTop,r=t+e.offsetHeight,n=window.scrollY,o=n+window.innerHeight;return r>n&&t<o}function Re(e){const t=window.scrollY,r=t+window.innerHeight,n=e.offsetTop;return n+e.offsetHeight<=r&&n>=t}const Oe=class{#$;#U;#J;#V;#z;#q;#G;#Y;constructor(e={}){const{target:t,fullscreen:r=!0,hoverClass:n="dnd-hover",onDrop:o,onEnter:i,onLeave:s}=e;if("boolean"!=typeof r)throw new TypeError('The "fullscreen" option must be a boolean.');const a=r?document.body:t||document.body;if(!(a instanceof HTMLElement))throw new TypeError('The "target" option must be an instance of HTMLElement.');if("string"!=typeof n)throw new TypeError('The "hoverClass" option must be a string.');if("function"!=typeof o)throw new TypeError('The "onDrop" option must be a function.');if("function"!=typeof i)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.#$=a,this.#U=r,this.#J=n,this.#V=o||(()=>{}),this.#z=i,this.#q=s,this.#G=!1,this.#Y=!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.#K()}getTarget(){return this.#$}getHoverClass(){return this.#J}isFullScreen(){return this.#U}isDragging(){return this.#G}bound(){return this.#Y}#K(){if(this.#Y)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.#Y=!0}#Q(){if(!this.#Y)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.#Y=!1}_handleDragEnter(e){if(e.preventDefault(),!this.#G){const t=this.getTarget();this.#G=!0,t.classList.add(this.#J),this.#z(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.#G=!1,t.classList.remove(this.#J),this.#q(e))}_handleDrop(e){if(e.preventDefault(),!e.dataTransfer)return void console.warn("[TinyDragDropDetector] [handleDrop] DragOver event missing dataTransfer.");const t=this.getTarget();this.#G=!1,t.classList.remove(this.#J);const r=e.dataTransfer.files;r.length>0&&this.#V(r,e)}destroy(){this.#Q(),this.getTarget().classList.remove(this.#J)}};var Pe=r(133),He=r(975);function We(e){if(!(0,Pe.existsSync)(e))throw new Error(`File not found: ${e}`);const t=(0,Pe.readFileSync)(e,"utf-8");return JSON.parse(t)}function Fe(e,t,r=2){const n=JSON.stringify(t,null,r);(0,Pe.writeFileSync)(e,n,"utf-8")}function $e(e){(0,Pe.existsSync)(e)||(0,Pe.mkdirSync)(e,{recursive:!0})}function Ue(e){if(!(0,Pe.existsSync)(e))return;const t=(0,Pe.readdirSync)(e);for(const r of t){const t=(0,He.join)(e,r);(0,Pe.lstatSync)(t).isDirectory()?(0,Pe.rmSync)(t,{recursive:!0,force:!0}):(0,Pe.unlinkSync)(t)}}function Je(e){return(0,Pe.existsSync)(e)&&(0,Pe.lstatSync)(e).isFile()}function Ve(e){return(0,Pe.existsSync)(e)&&(0,Pe.lstatSync)(e).isDirectory()}function ze(e){return 0===(0,Pe.readdirSync)(e).length}function qe(e,t,r){$e((0,He.dirname)(t)),(0,Pe.copyFileSync)(e,t,r)}function Ge(e){return!!Je(e)&&((0,Pe.unlinkSync)(e),!0)}function Ye(e,t,r="utf-8"){$e((0,He.dirname)(e)),(0,Pe.writeFileSync)(e,t,r)}function Ke(e,t=!1){const r={files:[],dirs:[]};if(!Ve(e))return r;const n=(0,Pe.readdirSync)(e);for(const o of n){const n=(0,He.join)(e,o);if((0,Pe.lstatSync)(n).isDirectory()){if(r.dirs.push(n),t){const e=Ke(n,!0);r.files.push(...e.files),r.dirs.push(...e.dirs)}}else r.files.push(n)}return r}function Qe(e,t=!1){const r=[];if(!Ve(e))return r;const n=(0,Pe.readdirSync)(e);for(const o of n){const n=(0,He.join)(e,o);(0,Pe.lstatSync)(n).isDirectory()&&(r.push(n),t&&r.push(...Qe(n,!0)))}return r}function Xe(e){return Je(e)?(0,Pe.statSync)(e).size:0}function Ze(e){let t=0;const r=Ke(e,!0).files;for(const e of r)t+=Xe(e);return t}function et(e,t="bak"){Je(e)&&qe(e,`${e}.${t}.${(new Date).toISOString().replace(/[:.]/g,"-")}`)}function tt(e,t="bak"){const r=(0,He.dirname)(e),n=(0,He.basename)(e),o=(0,Pe.readdirSync)(r).filter(e=>e.startsWith(`${n}.${t}.`)).sort().reverse();if(0===o.length)throw new Error(`No backups found for ${e}`);return(0,He.join)(r,o[0])}function rt(e,t="bak"){qe(tt(e,t),e)}function nt(e,t,r=[]){if("string"!=typeof e)throw new TypeError("dirPath must be a string");if("function"!=typeof t)throw new TypeError("renameFn must be a function");if(!Array.isArray(r))throw new TypeError("extensions must be an array of strings");if(!(0,Pe.existsSync)(e)||!(0,Pe.statSync)(e).isDirectory())throw new Error(`Directory not found or invalid: ${e}`);for(const e of r)if("string"!=typeof e||!e.startsWith("."))throw new TypeError(`Invalid extension: ${e}`);const n=Ke(e).files;let o=0;for(const i of n){const n=(0,He.extname)(i);if(r.length&&!r.includes(n))continue;const s=(0,He.basename)(i),a=t(s,o++),l=(0,He.join)(e,a);s!==a&&(0,Pe.renameSync)(i,l)}}function ot(e,t,r,n=[]){nt(e,e=>{const n=(0,He.extname)(e);return`${(0,He.basename)(e,n).replace(t,r)}${n}`},n)}function it(e,{prefix:t="",suffix:r=""},n=[]){nt(e,e=>{const n=(0,He.extname)(e),o=(0,He.basename)(e,n);return`${t}${o}${r}${n}`},n)}function st(e,t="lower",r=[],n=!1){if("string"!=typeof t||!["lower","upper","title"].includes(t))throw new Error(`Invalid mode "${t}". Must be 'lower', 'upper' or 'title'.`);nt(e,e=>{const r=e=>"lower"===t?e.toLowerCase():"upper"===t?e.toUpperCase():"title"===t?R(e):e,o=(0,He.extname)(e),i=n?r(o):o;return`${r((0,He.basename)(e,o))}${i}`},r)}function at(e,t=3,r=[]){nt(e,e=>e.replace(/\d+/,e=>e.padStart(t,"0")),r)}var lt=r(370);async function ut(e){if(!(0,Pe.existsSync)(e))return;const t=await(0,lt.readdir)(e),r={},n=[];for(const o of t){const t=(0,He.join)(e,o),i=(0,lt.lstat)(t);i.then(e=>(r[t]=e,e)),n.push(i)}await Promise.all(n);const o=[];for(const e in r)r[e].isDirectory()?o.push((0,lt.rm)(e,{recursive:!0,force:!0})):o.push((0,lt.unlink)(e));await Promise.all(o)}async function ct(e){return 0===(await(0,lt.readdir)(e)).length}async function ht(e,t=!1){const r={files:[],dirs:[]};if(!Ve(e))return r;const n=await(0,lt.readdir)(e);for(const o of n){const n=(0,He.join)(e,o);if((await(0,lt.lstat)(n)).isDirectory()){if(r.dirs.push(n),t){const e=await ht(n,!0);r.files.push(...e.files),r.dirs.push(...e.dirs)}}else r.files.push(n)}return r}async function dt(e,t=!1){const r=[];if(!Ve(e))return r;const n=await(0,lt.readdir)(e);for(const o of n){const n=(0,He.join)(e,o);(await(0,lt.lstat)(n)).isDirectory()&&(r.push(n),t&&r.push(...await dt(n,!0)))}return r}async function ft(e){return Je(e)?(await(0,lt.stat)(e)).size:0}async function mt(e){let t=0;const{files:r}=await ht(e,!0),n=[];for(const e of r){const r=ft(e);r.then(e=>(t+=e,e)),n.push(r)}return await Promise.all(n),t}class pt{static Utils={...e,TinyHtml:De};#X=!0;#Z=!1;#ee=0;#te=0;#re=!0;#ne=!1;#oe=!1;#ie=!1;#se=!1;#ae=!1;#le=!1;#ue=null;#ce=[];#he=null;#de={start:!1,end:!1,collide:!1,move:!1};#fe=null;#$;#me="drag-hidden";#pe="dragging";#ge="drag-active";#ye="jail-drag-active";#be="jail-drag-disabled";#we="dragging-collision";#ve=9999;constructor(e,t={}){const r=e instanceof De?e.get(0):e;if(!(r instanceof HTMLElement))throw new Error("TinyDragger requires a valid target HTMLElement to initialize.");if(this.#$=r,void 0!==t.jail&&!(t.jail instanceof HTMLElement))throw new Error('The "jail" option must be an HTMLElement if provided.');if(void 0!==t.defaultZIndex&&this.setDefaultZIndex(t.defaultZIndex),void 0!==t.vibration&&!1!==t.vibration&&!f(t.vibration))throw new Error('The "vibration" option must be an object or false.');const n=(e,t)=>{if(void 0!==e&&"boolean"!=typeof e)throw new Error(`The "${t}" option must be a boolean.`)},o=(e,t)=>{if(void 0!==e&&"string"!=typeof e)throw new Error(`The "${t}" option must be a string.`)};n(t.mirrorElem,"mirrorElem"),n(t.collisionByMouse,"collisionByMouse"),n(t.lockInsideJail,"lockInsideJail"),n(t.dropInJailOnly,"dropInJailOnly"),n(t.revertOnDrop,"revertOnDrop"),n(t.multiCollision,"multiCollision"),o(t.classDragging,"classDragging"),o(t.classBodyDragging,"classBodyDragging"),o(t.classJailDragging,"classJailDragging"),o(t.classJailDragDisabled,"classJailDragDisabled"),o(t.classDragCollision,"classDragCollision"),o(t.classHidden,"classHidden"),t.jail instanceof HTMLElement&&(this.#fe=t.jail),this.#de=Object.assign({start:!1,end:!1,collide:!1,move:!1},f(t.vibration)?t.vibration:{}),"string"==typeof t.classDragging&&(this.#pe=t.classDragging),"string"==typeof t.classBodyDragging&&(this.#ge=t.classBodyDragging),"string"==typeof t.classJailDragging&&(this.#ye=t.classJailDragging),"string"==typeof t.classJailDragDisabled&&(this.#be=t.classJailDragDisabled),"string"==typeof t.classHidden&&(this.#me=t.classHidden),"string"==typeof t.classDragCollision&&(this.#we=t.classDragCollision),"boolean"==typeof t.collisionByMouse&&(this.#ae=t.collisionByMouse),"boolean"==typeof t.mirrorElem&&(this.#re=t.mirrorElem),"boolean"==typeof t.revertOnDrop&&(this.#ie=t.revertOnDrop),"boolean"==typeof t.lockInsideJail&&(this.#oe=t.lockInsideJail),"boolean"==typeof t.dropInJailOnly&&(this.#le=t.dropInJailOnly),"boolean"==typeof t.multiCollision&&(this.#ne=t.multiCollision),this._onMouseDown=this.#Ee.bind(this),this._onMouseMove=this.#Te.bind(this),this._onMouseUp=this.#xe.bind(this),this._onTouchStart=e=>this.#Ee(e.touches[0]),this._onTouchMove=e=>this.#Te(e.touches[0]),this._onTouchEnd=e=>this.#xe(e.changedTouches[0]),this.#$.addEventListener("mousedown",this._onMouseDown),this.#$.addEventListener("touchstart",this._onTouchStart,{passive:!1})}enable(){this.#Se(),this.#fe&&this.#fe.classList.add(this.#be),this.#X=!0}disable(){this.#fe&&this.#fe.classList.remove(this.#be),this.#X=!1}addCollidable(e){if(this.#Se(),!(e instanceof HTMLElement))throw new Error("addCollidable expects an HTMLElement as argument.");this.#ce.includes(e)||this.#ce.push(e)}removeCollidable(e){if(this.#Se(),!(e instanceof HTMLElement))throw new Error("removeCollidable expects an HTMLElement as argument.");this.#ce=this.#ce.filter(t=>t!==e)}setVibrationPattern({startPattern:e=!1,endPattern:t=!1,collidePattern:r=!1,movePattern:n=!1}={}){this.#Se();const o=e=>!1===e||Array.isArray(e)&&e.every(e=>"number"==typeof e);if(!o(e))throw new Error('Invalid "startPattern": must be false or an array of numbers.');if(!o(t))throw new Error('Invalid "endPattern": must be false or an array of numbers.');if(!o(r))throw new Error('Invalid "collidePattern": must be false or an array of numbers.');if(!o(n))throw new Error('Invalid "movePattern": must be false or an array of numbers.');this.#de={start:e,end:t,collide:r,move:n}}disableVibration(){this.#Se(),this.#de={start:!1,end:!1,collide:!1,move:!1}}getOffset(e){if(this.#Se(),!(e instanceof MouseEvent||e instanceof Touch)||"number"!=typeof e.clientX||"number"!=typeof e.clientY)throw new Error("getOffset expects an event with valid clientX and clientY coordinates.");const t=this.#$.getBoundingClientRect(),{left:r,top:n}=De.borderWidth(this.#$);return{x:e.clientX-t.left+r,y:e.clientY-t.top+n}}#Ee(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#Z||!this.#X||!this.#$.parentElement)return;if(this.#re){const e=this.#$.cloneNode(!0);if(!(e instanceof HTMLElement))throw new Error("[TinyDragger] INVALID DRAG ELEMENT!");this.#he=e}else this.#he=this.#$;this.#se=!0;const t=this.#$.getBoundingClientRect();Object.assign(this.#he.style,{position:"absolute",pointerEvents:"none",left:`${this.#$.offsetLeft}px`,top:`${this.#$.offsetTop}px`,width:`${t.width}px`,height:`${t.height}px`,zIndex:this.#ve}),this.#re&&(this.#$.classList.add(this.#me),this.#$.parentElement.appendChild(this.#he));const{x:r,y:n}=this.getOffset(e);this.#te=r,this.#ee=n,this.#he.classList.add(this.#pe),document.body.classList.add(this.#ge),this.#fe&&this.#fe.classList.add(this.#ye),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),document.addEventListener("touchmove",this._onTouchMove,{passive:!1}),document.addEventListener("touchend",this._onTouchEnd),navigator.vibrate&&Array.isArray(this.#de.start)&&navigator.vibrate(this.#de.start),this.checkDragCollision(e),this.#Le("drag")}#Ce=[];#Ae(e){e&&(e.classList.add(this.#we),this.#Ce.push(e))}#_e(){for(;this.#Ce.length>0;){const e=this.#Ce.shift();e&&e.classList.remove(this.#we)}this.#ue&&this.#ue.classList.remove(this.#we)}checkDragCollision(e){const{collidedElements:t}=this.execCollision(e),r=t[0]||null;this.#ue&&!t.includes(this.#ue)&&this.#_e(),t.forEach(e=>this.#Ae(e)),this.#ce.forEach(e=>{t.includes(e)||e.classList.remove(this.#we)}),navigator.vibrate&&Array.isArray(this.#de.collide)&&t.length>0&&navigator.vibrate(this.#de.collide),this.#ue=r}#Te(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#Z||!this.#se||!this.#X||!this.#he)return;const t=(this.#he.offsetParent||document.body).getBoundingClientRect();let r=e.clientX-t.left-this.#te,n=e.clientY-t.top-this.#ee;if(this.#oe&&this.#fe){const e=this.#fe.getBoundingClientRect(),o=this.#he.getBoundingClientRect(),i=e.left-t.left,s=e.top-t.top,{x:a,y:l}=De.borderWidth(this.#fe),u=i+e.width-o.width-l,c=s+e.height-o.height-a;r=Math.max(i,Math.min(r,u)),n=Math.max(s,Math.min(n,c))}this.#he.style.position="absolute",this.#he.style.left=`${r}px`,this.#he.style.top=`${n}px`,navigator.vibrate&&Array.isArray(this.#de.move)&&navigator.vibrate(this.#de.move),this.checkDragCollision(e),this.#Le("dragging")}execCollision(e){if(this.#Z||!this.#he)return{inJail:!1,collidedElements:[]};let t=[],r=!0;const n=this.#fe?.getBoundingClientRect();if(this.#ae){const o=e.clientX,i=e.clientY;this.#le&&this.#fe&&n&&(r=o>=n.left&&o<=n.right&&i>=n.top&&i<=n.bottom),t=r?this.#ne?this.getAllCollidedElements(o,i):[this.getCollidedElement(o,i)].filter(Boolean):[]}else{const e=this.#he.getBoundingClientRect();this.#le&&this.#fe&&n&&(r=e.left>=n.left&&e.right<=n.right&&e.top>=n.top&&e.bottom<=n.bottom),t=r?this.#ne?this.getAllCollidedElementsByRect(e):[this.getCollidedElementByRect(e)].filter(Boolean):[]}return{inJail:r,collidedElements:t}}#xe(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#Z||!this.#se)return;if(this.#se=!1,!this.#he)return;this.#$.classList.remove(this.#pe),document.body.classList.remove(this.#ge),this.#fe&&this.#fe.classList.remove(this.#ye),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd);const{collidedElements:t}=this.execCollision(e);navigator.vibrate&&Array.isArray(this.#de.end)&&navigator.vibrate(this.#de.end);const r=this.#he.style.left,n=this.#he.style.top;this.#he&&(this.#re?this.#he.remove():Object.assign(this.#he.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#he=null),this.#ue&&this.#_e(),this.#ue=null,this.#re&&this.#$.classList.remove(this.#me),this.#ie||(this.#$.style.left=r,this.#$.style.top=n);const o=new CustomEvent("drop",{detail:{targets:t,first:t[0]||null}});this.#$.dispatchEvent(o)}#De(e,t){const r=e.getBoundingClientRect();return!(t.right<r.left||t.left>r.right||t.bottom<r.top||t.top>r.bottom)}getAllCollidedElementsByRect(e){if(this.#Se(),!(e instanceof DOMRect)||"number"!=typeof e.left||"number"!=typeof e.right||"number"!=typeof e.top||"number"!=typeof e.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#ce.filter(t=>this.#De(t,e))}getCollidedElementByRect(e){if(this.#Se(),!(e instanceof DOMRect)||"number"!=typeof e.left||"number"!=typeof e.right||"number"!=typeof e.top||"number"!=typeof e.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#ce.find(t=>this.#De(t,e))||null}#Me(e,t,r){const n=e.getBoundingClientRect();return t>=n.left&&t<=n.right&&r>=n.top&&r<=n.bottom}getAllCollidedElements(e,t){if(this.#Se(),"number"!=typeof e||"number"!=typeof t)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#ce.filter(r=>this.#Me(r,e,t))}getCollidedElement(e,t){if(this.#Se(),"number"!=typeof e||"number"!=typeof t)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#ce.find(r=>this.#Me(r,e,t))||null}#Le(e){const t=new CustomEvent(e);this.#$.dispatchEvent(t)}getDragging(){return this.#se}getLockInsideJail(){return this.#oe}setLockInsideJail(e){if("boolean"!=typeof e)throw new Error("lockInsideJail must be a boolean.");this.#oe=e}getRevertOnDrop(){return this.#ie}setRevertOnDrop(e){if("boolean"!=typeof e)throw new Error("revertOnDrop must be a boolean.");this.#ie=e}getCollisionByMouse(){return this.#ae}setCollisionByMouse(e){if("boolean"!=typeof e)throw new Error("collisionByMouse must be a boolean.");this.#ae=e}getDropInJailOnly(){return this.#le}setDropInJailOnly(e){if("boolean"!=typeof e)throw new Error("dropInJailOnly must be a boolean.");this.#le=e}getDefaultZIndex(){return this.#ve}setDefaultZIndex(e){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("Z-index must be a finite number.");this.#ve=e}isMirrorEnabled(){return this.#re}setMirrorEnabled(e){if("boolean"!=typeof e)throw new TypeError("Mirror setting must be a boolean.");this.#re=e}getTarget(){return this.#$}getJail(){return this.#fe}getDragProxy(){return this.#he}getLastCollision(){return this.#ue}getCollidables(){return[...this.#ce]}getDragHiddenClass(){return this.#me}getClassDragging(){return this.#pe}getClassBodyDragging(){return this.#ge}getClassJailDragging(){return this.#ye}getClassJailDragDisabled(){return this.#be}getClassDragCollision(){return this.#we}getVibrations(){return{...this.#de}}getStartVibration(){return this.#de.start}getEndVibration(){return this.#de.end}getCollideVibration(){return this.#de.collide}getMoveVibration(){return this.#de.move}isEnabled(){return this.#X}#Se(){if(this.#Z)throw new Error("This TinyDragger instance has been destroyed and can no longer be used.")}destroy(){this.#Z||(this.disable(),this.#$.removeEventListener("mousedown",this._onMouseDown),this.#$.removeEventListener("touchstart",this._onTouchStart),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),this.#ue&&this.#_e(),this.#he&&(this.#re?this.#he.remove():Object.assign(this.#he.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#he=null),this.#ce=[],this.#se=!1,this.#ue=null,this.#re&&this.#$.classList.remove(this.#me),this.#$.classList.remove(this.#pe),document.body.classList.remove(this.#ge),this.#fe&&this.#fe.classList.remove(this.#ye,this.#be),this.#Z=!0)}}const gt=pt,yt=class{#ke=[];#Ne=!1;#Ie=!1;#Be=[];#je(){this.#Ne&&Promise.all(this.#Be).then(()=>{this.#Ie=!0,this.#Re(!1)}).catch(e=>{console.error("[TinyDomReadyManager] Promise rejected:",e)})}#Re(e){this.#ke.filter(t=>t.domOnly===e).sort((e,t)=>t.priority-e.priority).forEach(e=>this.#Oe(e)),this.#ke=this.#ke.filter(t=>!(t.once&&(!e||t.domOnly)))}#Oe(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.#Ne=!0,this.#Re(!0),this.#je()}init(){if(this.#Ne)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.#Ie||(this.#Be.push(e),this.#Ne&&this.#je())}onReady(e,{once:t=!0,priority:r=0,filter:n=null,domOnly:o=!1}={}){if("function"!=typeof e)throw new TypeError("[TinyDomReadyManager] fn must be a function.");const i={fn:e,once:t,priority:r,filter:n,domOnly:o};if(o&&this.#Ne)return this.#Oe(i),void(t||this.#ke.push(i));!o&&this.#Ie?this.#Oe(i):this.#ke.push(i)}isReady(){return this.#Ie}isDomReady(){return this.#Ne}},bt=class{#Pe=!1;#He=!1;#We=null;#Fe=100;#$e=null;#Ue;constructor({audio:e=null,defaultIcon:t=null,bodyLimit:r=100,defaultOnClick:n=function(e){e.preventDefault(),window.focus&&window.focus(),this.close()}}={}){if(!(e instanceof HTMLAudioElement)&&"string"!=typeof e&&null!==e)throw new TypeError("audio must be an instance of HTMLAudioElement or null.");if(null!==t&&"string"!=typeof t)throw new TypeError("defaultIcon must be a string or null.");if(!Number.isFinite(r)||r<0)throw new TypeError("bodyLimit must be a non-negative number.");if("function"!=typeof n)throw new TypeError("defaultOnClick must be a function.");this.#We="string"!=typeof e?e:new Audio(e),this.#$e=t,this.#Fe=r,this.#Ue=n}requestPerm(){const e=this;return new Promise((t,r)=>{e.isCompatible()?"default"===Notification.permission?Notification.requestPermission().then(r=>{this.#He=!0,e.#Pe="granted"===r,t(e.#Pe)}).catch(r):(this.#He=!0,e.#Pe="granted"===Notification.permission,t(e.#Pe)):(this.#He=!0,e.#Pe=!1,t(!1))})}isCompatible(){return"Notification"in window}send(e,t={}){if(!this.#He)throw new Error("You must call requestPerm() before sending a notification.");if("string"!=typeof e)throw new TypeError("title must be a string.");if("object"!=typeof t||null===t)throw new TypeError("config must be a non-null object.");if(!this.#Pe)return null;const{icon:r=this.#$e||void 0,vibrate:n=[200,100,200]}=t,o={...t};"string"==typeof r&&(o.icon=r),Array.isArray(n)&&(o.vibrate=n),"string"==typeof o.body&&(o.body=H(o.body,this.#Fe));const i=new Notification(e,o);return i.addEventListener("show",()=>{this.#We instanceof HTMLAudioElement&&(this.#We.currentTime=0,this.#We.play().catch(e=>console.error(e)))}),"function"==typeof this.#Ue&&i.addEventListener("click",this.#Ue),i}wasPermissionRequested(){return this.#He}isAllowed(){return this.#Pe}getAudio(){return this.#We}setAudio(e){if(!(e instanceof HTMLAudioElement)&&"string"!=typeof e&&null!==e)throw new TypeError("sound must be an instance of HTMLAudioElement or null.");this.#We="string"!=typeof e?e:new Audio(e)}getBodyLimit(){return this.#Fe}setBodyLimit(e){if(!Number.isFinite(e)||e<0)throw new TypeError("bodyLimit must be a non-negative number.");this.#Fe=e}getDefaultAvatar(){return this.#$e}setDefaultAvatar(e){if("string"!=typeof e&&null!==e)throw new TypeError("defaultIcon must be a string or null.");this.#$e=e}getDefaultOnClick(){return this.#Ue}setDefaultOnClick(e){if("function"!=typeof e)throw new TypeError("defaultOnClick must be a function.");this.#Ue=e}},wt=class{#Je;#Ve=null;#ze=[];#qe=100;#Ge=new Set;#Ye=new Set;#Z=!1;constructor(e=window,t=100){if(!(e instanceof Element||e instanceof Window))throw new TypeError("scrollTarget must be an Element or the Window object.");this.#Je=e,this._checkTimer=this._checkTimer.bind(this),this.#Je.addEventListener("scroll",this._checkTimer),this.#qe=t}_checkTimer=()=>{this.#Ve&&clearTimeout(this.#Ve),this.#Ve=setTimeout(()=>{this.#Ve=null,this.#Ke()},this.#qe)};get inactivityTime(){return this.#qe}set inactivityTime(e){if("number"!=typeof e||e<=0||!Number.isFinite(e))throw new Error("inactivityTime must be a positive number in milliseconds.");this.#qe=e}#Ke(){if(!this.#Z){for(const e of this.#Ye)"function"==typeof e&&e();for(;this.#ze.length;){const e=this.#ze.pop();"function"==typeof e&&e()}}}doAfterScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.lastScrollTime=Date.now(),this.#ze.push(e)}onStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ye.add(e)}offStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ye.delete(e)}onScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Je.addEventListener("scroll",e),this.#Ge.add(e)}offScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ge.has(e)&&(this.#Je.removeEventListener("scroll",e),this.#Ge.delete(e))}destroy(){if(!this.#Z){this.#Z=!0,this.#Je.removeEventListener("scroll",this._checkTimer);for(const e of this.#Ge)this.#Je.removeEventListener("scroll",e);this.#Ge.clear(),this.#Ye.clear()}}},vt=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","sed","do","eiusmod","tempor","incididunt","ut","labore","et","dolore","magna","aliqua"],Et=["😂","🌈","🤖","💥","🐸","🍕","🦄","🧠","🧬","🚀","🫠","💫","🍩","👾","🎉","🥴","🐙","🧃","🪐","🎈","🧸","👻","🥳","🍭","💖","😺","🌮","🪅","🎮","🥓","🍮"],Tt=["pudding","bean","snuggle","bloop","jelly","unicorn","floof","giggle","bubble","muffin","puff","pickle","goblin","waffle","sprinkle","cupcake","fizzle","marshmallow","duckling","sock","cloud","teacup","nugget","gnome","hug","moonbean","crayon","jiggle","glitter","carrot","goober"],xt=["wiggles","bounces","flies","splats","scoots","giggles","wigglesnacks","twirls","boops","pops","sings","hugs","floats","glows","flaps","mlems","dances","puddles","nomnoms","wigglejumps","sniffs","tumbles","slides","chirps","burps","sparkles","waddles","rambles","blinks","mews"],St=["fluffy","silly","yummy","squishy","wobbly","magical","tiny","sleepy","wiggly","bubbly","glittery","fuzzy","jiggly","sparkly","giggly","crunchy","goofy","soft","mushy","sweet","loopy","floaty","bonkers","chewy","ticklish","dreamy","pastel","cozy","teensy","grumbly"],Lt=["Boop!","Wiggle achieved.","Oops, {noun} everywhere!","Tiny {adj} {noun}, big {adj} {noun}.","Snuggle initiated with a {adj} {noun}.","{adj} vibes only, powered by {noun}.","No {noun}, no {noun}.","Bounce first, {verb} later.","Mlem. {verb}. {noun}.","{noun} go brrr and {verb}.","Why not? {noun} did. Then {noun} followed.","A {adj} {noun} just {verb} near the {adj} window.","That {adj} {noun} stole my {noun}!","Look, a {adj} {noun} trying to {verb} again!","Every {noun} deserves a {adj} nap.","The {adj} {noun} is my {adj} spirit animal.","Someone call the {noun}, it’s {verb}ing and {verb}ing again!","Don’t touch the {adj} {noun}. It {verb}s loudly.","{noun} forgot how {noun}s work and just {verb}ed.","There once was a {adj} {noun} who loved to {verb} with a {adj} {noun} all day.","Apparently, {noun}s are banned from {verb}ing and {verb}ing in the {noun} library.","That {adj} noise? Just a {noun} learning to {verb} on a {adj} {noun}.","I saw a {adj} {noun} {verb} so hard, it became a {adj} muffin.","The {adj} {noun} met a {adj} pickle and everything {verb}ed.","{noun}s are like {noun}: {adj}, unpredictable, and wiggly.","Don’t judge a {adj} {noun} by its ability to {verb}, or by its {adj} hat.","All I wanted was peace, but a {adj} {noun} with a {adj} {noun} had other plans.","One {adj} morning, a {adj} {noun} decided it was finally time to {verb}, but halfway through, it tripped on a {noun} and turned into a {adj} marshmallow.","I tried to be {adj} today, but then a {noun} {verb}ed across my {noun} and typed “asdfgh{noun}” repeatedly.","If you think you’ve seen everything, wait until a {adj} {noun} {verb}s on a {noun} wearing {adj} socks with tiny {noun}s.","No one ever believed the stories about the ancient {adj} {noun} who could {verb} with such {adj} grace that entire {noun}s turned pink out of embarrassment.","A curious {adj} {noun} wandered into a {noun} shop, not knowing that its destiny involved twelve {adj} {noun}s, one rubber {noun}, and a suspiciously quiet {adj} llama.","In a land where every {adj} {noun} was made of pudding and the sky was {adj} whipped cream, one brave {adj} {noun} set out to discover the legendary Spoon of {noun}s, facing obstacles like bouncing {noun}s, sassy {noun}s, and the Great Wobble of the {noun}.","Once upon a {adj} time, long before the {noun}s learned to {verb}, there existed a tiny {adj} {noun} who dreamed of swimming in a pool made entirely of {adj} glitter pudding while {verb}ing off-key lullabies to passing {noun}s with monocles.","The Council of {noun}s gathered in {adj} secret when the sacred {adj} {noun} started to {verb} uncontrollably, threatening the entire {adj} dessert-based civilization with spontaneous {noun} jiggles and uncontainable {noun} fits across the {noun}.","Hey... do you ever wonder if {noun}s dream of {noun}s?","Okay but hear me out: what if the {adj} {noun} could actually {verb} backwards?","Can we talk about the {noun} that just {verb}ed and vanished?","So I was talking to a {noun}, and it told me to stop being {adj}. Rude.","Not to alarm you, but there’s a {adj} {noun} behind you doing the {verb}.","Why does this {noun} keep staring at me like I owe it pudding?","Is this a safe space to admit I accidentally {verb}ed a {noun}?","I just walked into the room and someone shouted “{adj} {noun}!” — what did I miss?","Wait... we were supposed to bring a {noun}? No one told me!","Okay but what if the {adj} {noun} has feelings too?","Be honest, do I look like a {noun} that forgot how to {verb}?",'If I say "oops", do I still have to explain why the {noun} is glowing?',"I don’t know what’s going on but I brought snacks and a confused {noun}.","Do you think pudding knows it’s pudding? Just a thought.","Is this about the time I {verb}ed the {adj} {noun} by accident? Because I can explain.","Wait, are we talking about {noun}s or am I on the wrong chat again?",'What is this group even about? I just saw "pudding" and joined.',"Hi! I have no idea what’s happening but I’m here and I brought a {noun}.","I blinked and now there’s a {adj} {noun} in charge of everything.","Can someone please explain why the {noun} is floating and chanting?","Okay who gave the {noun} access to glitter and emotional support pickles?","I came for a calm discussion and now there’s a {adj} battle between {noun}s.","Not sure if I’m early, late, or inside a {noun} dream.","I was gone for 3 minutes and now someone’s riding a {noun} into the pudding realm.","This isn’t the pudding appreciation group, is it? ...oh no.","So... who summoned the {adj} {noun} this time? Be honest.","I came here for vibes and stayed for the {noun}s.","Does anyone else hear faint giggling or is that just the {adj} {noun} again?","I feel like I missed step one, two, and also three of this conversation.","All I asked was “what’s up?” and now I’m emotionally attached to a {noun}.",'Me: "I’ll be normal today." Also me: *{verb}s into a meeting riding a {adj} {noun}*','"It’s just pudding," they said. "It can’t hurt you," they said. They were wrong.',"I said one nice thing to a {noun} and now it follows me everywhere.","Can we take a moment to appreciate how the {adj} {noun} is just vibing?","Who put a tiny hat on the {noun}? Because that’s adorable.","My life has been different ever since the {noun} started {verb}ing.","Raise your hand if you’ve ever been personally attacked by a {adj} {noun}.",'"Don’t be weird," they said. So I became a {noun} instead.',"Do {noun}s have feelings? Asking for a {adj} friend.","I trusted the {noun} and all I got was a glitter-covered sock.","Plot twist: the {adj} {noun} was inside us all along.","The {adj} {noun} {verb} and {verb} all over the {adj} {noun}!","Oops! {noun}s {verb}ed into the {adj} {noun} while {verb}ing crazily.","{adj}, {adj}, and more {adj} {noun}s just {verb}ed by!","Why does the {adj} {noun} keep {verb}ing and {verb}ing without stopping?","Look! A {adj} {noun}, a {adj} {noun}, and a {noun} all {verb}ing together!","Sometimes, the {noun} just {verb}s, then {verb}s again, and never stops being {adj}.","{noun}, {noun}, and {noun} — all {verb}ing and {verb}ing in a {adj} {noun}.","I saw a {adj} {noun} {verb}, then another {noun} {verb}ing with a {adj} {noun}.","The {noun} {verb}s {verb} while the {adj} {noun} {verb}s and the {noun} just {verb}s.","Can a {adj} {noun} {verb} {verb} without a {adj} {noun} watching?","Whoa! The {adj} {noun} just {verb}ed... and then {verb}ed again!","Hey... did you see that {adj} {noun} {verb} over there?","Umm, the {noun} is {verb}ing but also {verb}ing and {verb}ing!","Lol! {noun}s {verb} so {adj}ly, it’s impossible not to giggle.",'"Hey! What’s up?" asked the {adj} {noun}, who {verb}ed loudly.','"I’m just a {adj} {noun} trying to {verb}, you know?"','"Did you see the {adj} {noun} that just {verb}ed in the pudding?"','"No way! The {noun} {verb}s better than me!"','"Wait, the {adj} {noun} said it would {verb}, but it {verb}ed instead!"',"Once upon a {adj} {noun}, a group of {adj} {noun}s {verb}ed through the {adj} forest, singing {adj} songs and eating {noun}s made of pudding.","The legend tells of a {adj} {noun} who could {verb} faster than any {noun} ever seen, leaving trails of {adj} sparkles behind.","Every day, the {adj} {noun} would {verb} around the {adj} meadow, trying to convince the {noun}s to join the grand pudding party.","No one knows why the {adj} {noun} suddenly {verb}ed and then {verb}ed again, but everyone agrees it was the cutest thing they ever saw.","In the kingdom of {adj} {noun}s, only the bravest {noun} dared to {verb} the giant pudding monster, armed with nothing but {adj} smiles and jellybeans.","{adj} {noun} {verb} {verb} {verb} {noun} {verb} {adj} {noun} {verb} {noun}!","{noun} {noun} {verb} {adj} {noun} and then {verb} {verb} the {adj} {noun}.","{verb} the {adj} {noun}, then {verb} the {noun} while {verb}ing {adj}ly.","Can the {adj} {noun} {verb} and {verb} the {adj} {noun} at the same time?","{noun} {verb} {noun} {verb}, but the {adj} {noun} {verb}s better.","Boop! The {adj} {noun} just {verb}ed in the pudding.","Bloop bloop, the {noun} is {verb}ing all over again!","Mlem mlem, a {adj} {noun} {verb}s quietly in the corner.","Splat! {noun} {verb}ed right on the {adj} {noun}.","Yum! A {adj} {noun} just {verb}ed in my mouth.","Do {noun}s really {verb} when nobody’s watching?","Why does the {adj} {noun} always {verb} at midnight?","Can a {noun} be too {adj} to {verb} properly?","Is it normal for a {adj} {noun} to {verb} three times in a row?","Who taught the {noun} to {verb} like that?","Wait, did the {adj} {noun} just {verb} itself?","I can’t believe the {noun} {verb}ed into a {adj} {noun}!","Suddenly, a {adj} {noun} appeared and started to {verb} wildly.","That {noun} was {verb}ing so {adj}ly it broke the pudding meter.","Everyone’s talking about the {adj} {noun} that {verb}ed out of nowhere."],Ct=class{static defaultWords=vt;static defaultEmojis=Et;static defaultNouns=Tt;static defaultVerbs=xt;static defaultAdjectives=St;static defaultTemplates=Lt;config={minLength:10,maxLength:300,readable:!0,useEmojis:!0,includeNumbers:!0,includeSymbols:!0,allowWeirdSpacing:!1,emojiSet:[],wordSet:[],mode:"mixed",grammar:{templates:[],nouns:[],verbs:[],adjectives:[]},repeatWords:!0,emojiPlacement:"inline",line:{minLength:20,maxLength:120,emojiChance:.3}};constructor(e={}){this.symbols="!@#$%^&*()-_=+[]{}|;:,.<>?/\\~".split("");const{minLength:t,maxLength:r,readable:n,useEmojis:o,includeNumbers:i,includeSymbols:s,allowWeirdSpacing:a,emojiSet:l,wordSet:u,mode:c,grammar:h,repeatWords:d,emojiPlacement:f,paragraphs:m,line:p}=e;if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.minLength must be an integer >= 1");if(void 0!==r&&(!Number.isInteger(r)||r<1))throw new TypeError("config.maxLength must be an integer >= 1");if(void 0!==t&&void 0!==r&&t>r)throw new RangeError("config.minLength cannot be greater than config.maxLength");if(void 0!==n&&"boolean"!=typeof n)throw new TypeError("config.readable must be a boolean");if(void 0!==o&&"boolean"!=typeof o)throw new TypeError("config.useEmojis must be a boolean");if(void 0!==i&&"boolean"!=typeof i)throw new TypeError("config.includeNumbers must be a boolean");if(void 0!==s&&"boolean"!=typeof s)throw new TypeError("config.includeSymbols must be a boolean");if(void 0!==a&&"boolean"!=typeof a)throw new TypeError("config.allowWeirdSpacing must be a boolean");if(void 0!==l&&!Array.isArray(l))throw new TypeError("config.emojiSet must be an array of strings");if(void 0!==u&&!Array.isArray(u))throw new TypeError("config.wordSet must be an array of strings");if(void 0!==c&&!["mixed","readable","chaotic","natural"].includes(c))throw new RangeError('config.mode must be one of: "mixed", "readable", "chaotic", "natural');if(void 0!==h){if("object"!=typeof h||null===h)throw new TypeError("config.grammar must be an object");const{templates:e,nouns:t,verbs:r,adjectives:n}=h;if(void 0!==e&&!Array.isArray(e))throw new TypeError("config.grammar.templates must be an array of strings");if(void 0!==t&&!Array.isArray(t))throw new TypeError("config.grammar.nouns must be an array of strings");if(void 0!==r&&!Array.isArray(r))throw new TypeError("config.grammar.verbs must be an array of strings");if(void 0!==n&&!Array.isArray(n))throw new TypeError("config.grammar.adjectives must be an array of strings")}if(void 0!==d&&"boolean"!=typeof d)throw new TypeError("config.repeatWords must be a boolean");if(void 0!==f&&!["inline","end","none"].includes(f))throw new RangeError('config.emojiPlacement must be one of: "inline", "end", "none"');if(void 0!==m){if("object"!=typeof m)throw new TypeError("config.paragraphs must be an object or null");const{min:e,max:t}=m;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.paragraphs.min must be an integer >= 1");if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.paragraphs.max must be an integer >= 1");if(void 0!==e&&void 0!==t&&e>t)throw new RangeError("config.paragraphs.min cannot be greater than config.paragraphs.max")}if(void 0!==p){if("object"!=typeof p||null===p)throw new TypeError("config.line must be an object");const{minLength:e,maxLength:t,emojiChance:r}=p;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.line.minLength must be an integer >= 1");if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.line.maxLength must be an integer >= 1");if(void 0!==e&&void 0!==t&&e>t)throw new RangeError("config.line.minLength cannot be greater than config.line.maxLength");if(void 0!==r&&("number"!=typeof r||r<0||r>1))throw new RangeError("config.line.emojiChance must be a number between 0 and 1")}this.config.emojiSet=[...Et],this.config.wordSet=[...vt],this.config.grammar.templates=[...Lt],this.config.grammar.nouns=[...Tt],this.config.grammar.verbs=[...xt],this.config.grammar.adjectives=[...St],Object.assign(this.config,e)}configure(e={}){return Object.assign(this.config,e),this}setGrammarTemplates(...e){return this.config.grammar.templates=e.flat(),this}addGrammarTemplates(...e){return this.config.grammar.templates.push(...e.flat()),this}setGrammarNouns(...e){return this.config.grammar.nouns=e.flat(),this}addGrammarNouns(...e){return this.config.grammar.nouns.push(...e.flat()),this}setGrammarVerbs(...e){return this.config.grammar.verbs=e.flat(),this}addGrammarVerbs(...e){return this.config.grammar.verbs.push(...e.flat()),this}setGrammarAdjectives(...e){return this.config.grammar.adjectives=e.flat(),this}addGrammarAdjectives(...e){return this.config.grammar.adjectives.push(...e.flat()),this}removeGrammarTemplates(...e){const t=new Set(e.flat());return this.config.grammar.templates=this.config.grammar.templates.filter(e=>!t.has(e)),this}removeGrammarNouns(...e){const t=new Set(e.flat());return this.config.grammar.nouns=this.config.grammar.nouns.filter(e=>!t.has(e)),this}removeGrammarVerbs(...e){const t=new Set(e.flat());return this.config.grammar.verbs=this.config.grammar.verbs.filter(e=>!t.has(e)),this}removeGrammarAdjectives(...e){const t=new Set(e.flat());return this.config.grammar.adjectives=this.config.grammar.adjectives.filter(e=>!t.has(e)),this}setWords(...e){return this.config.wordSet=e.flat(),this}addWords(...e){return this.config.wordSet.push(...e.flat()),this}removeWords(...e){const t=new Set(e.flat());return this.config.wordSet=this.config.wordSet.filter(e=>!t.has(e)),this}setEmojis(...e){return this.config.emojiSet=e.flat(),this}addEmojis(...e){return this.config.emojiSet.push(...e.flat()),this}removeEmojis(...e){const t=new Set(e.flat());return this.config.emojiSet=this.config.emojiSet.filter(e=>!t.has(e)),this}_getRandomItem(e){return e[Math.floor(Math.random()*e.length)]}_generateChunk(){const{wordSet:e,emojiSet:t,includeNumbers:r,includeSymbols:n,useEmojis:o,readable:i,mode:s,emojiPlacement:a}=this.config;if("natural"===s)return this._generateNaturalSentence();const l=[];return(i||"readable"===s||"mixed"===s)&&l.push(this._getRandomItem(e)),"chaotic"!==s&&"mixed"!==s||l.push(Math.random().toString(36).slice(2)),r&&l.push(Math.floor(99999*Math.random()).toString()),n&&l.push(this._getRandomItem(this.symbols)),"inline"===a&&o&&t.length&&l.push(this._getRandomItem(t)),this._getRandomItem(l)}_generateNaturalSentence(){const{templates:e,nouns:t,verbs:r,adjectives:n}=this.config.grammar;return this._getRandomItem(e).replace(/{noun}/g,()=>this._getRandomItem(t)).replace(/{verb}/g,()=>this._getRandomItem(r)).replace(/{adj}/g,()=>this._getRandomItem(n))}_generateLine(e,t){const{allowWeirdSpacing:r,repeatWords:n,readable:o,emojiSet:i,useEmojis:s,emojiPlacement:a,line:l}=this.config,u=[];for(t??=new Set;u.join(" ").length<e;){let e=this._generateChunk();!n&&t.has(e)||(t.add(e),r&&(Math.random()<.1&&(e="\n"+e),Math.random()<.1&&(e=" "+e),Math.random()<.05&&(e=e.toUpperCase())),u.push(e))}let c=u.join(o?" ":"");return"end"===a&&s&&i.length&&Math.random()<(l?.emojiChance||0)&&(c+=" "+this._getRandomItem(i)),c}_generateParagraphLines(e){const{line:t}=this.config,r=[],n=new Set;let o=0;for(;o<e;){const i=Math.floor(Math.random()*(t.maxLength-t.minLength+1)+t.minLength),s=Math.min(i,e-o);r.push(this._generateLine(s,n)),o+=s}return r}generate(){const{minLength:e,maxLength:t,paragraphs:r}=this.config,n=Math.floor(Math.random()*(t-e+1))+e;if(r&&"object"==typeof r){const e=Math.floor(Math.random()*(r.max-r.min+1))+r.min,t=Math.floor(n/e),o=[];for(let r=0;r<e;r++){const e=this._generateParagraphLines(t);o.push(e.join("\n"))}return o.join("\n\n")}return this._generateParagraphLines(n).join("\n")}},At=class{#Qe=new Map;#Xe=10;#Ze=!1;setThrowOnMaxListeners(e){if("boolean"!=typeof e)throw new TypeError("setThrowOnMaxListeners(value): value must be a boolean");this.#Ze=e}getThrowOnMaxListeners(){return this.#Ze}#et(e,t,{once:r=!1}={}){let n=this.#Qe.get(e);Array.isArray(n)||(n=[],this.#Qe.set(e,n)),n.unshift({handler:t,config:{once:r}});const o=this.#Xe;if(o>0&&n.length>o){const t=`Possible memory leak detected. ${n.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#Ze)throw new Error(t);console.warn(t)}}prependListener(e,t){if("string"!=typeof e)throw new TypeError("prepend(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("prepend(event, handler): handler must be a function");this.#et(e,t)}prependListenerOnce(e,t){if("string"!=typeof e)throw new TypeError("prependOnceListener(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("prependOnceListener(event, handler): handler must be a function");const r=(...n)=>{this.off(e,r),t(...n)};return this.#et(e,r,{once:!0}),r}#tt(e,t,{once:r=!1}={}){let n=this.#Qe.get(e);Array.isArray(n)||(n=[],this.#Qe.set(e,n)),n.push({handler:t,config:{once:r}});const o=this.#Xe;if(o>0&&n.length>o){const t=`Possible memory leak detected. ${n.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#Ze)throw new Error(t);console.warn(t)}}on(e,t){if("string"!=typeof e)throw new TypeError("on(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("on(event, handler): handler must be a function");return this.#tt(e,t)}once(e,t){if("string"!=typeof e)throw new TypeError("The event name must be a string.");if("function"!=typeof t)throw new TypeError("once(event, handler): handler must be a function");const r=n=>{this.off(e,r),"function"==typeof t&&t(n)};return this.#tt(e,r,{once:!0}),r}appendListener(e,t){return this.on(e,t)}appendListenerOnce(e,t){return this.once(e,t)}off(e,t){if("string"!=typeof e)throw new TypeError("off(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("off(event, handler): handler must be a function");const r=this.#Qe.get(e);if(!Array.isArray(r))return;const n=r.findIndex(e=>e.handler===t);-1!==n&&r.splice(n,1),0===r.length&&this.#Qe.delete(e)}offAll(e){if("string"!=typeof e)throw new TypeError("The event name must be a string.");this.#Qe.delete(e)}offAllTypes(){this.#Qe.clear()}listenerCount(e){if("string"!=typeof e)throw new TypeError("listenerCount(event): event name must be a string");const t=this.#Qe.get(e);return Array.isArray(t)?t.length:0}listeners(e){if("string"!=typeof e)throw new TypeError("listeners(event): event name must be a string");const t=this.#Qe.get(e);return Array.isArray(t)?[...t].filter(e=>!e.config.once).map(e=>e.handler):[]}onceListeners(e){if("string"!=typeof e)throw new TypeError("onceListeners(event): event name must be a string");const t=this.#Qe.get(e);return Array.isArray(t)?[...t].filter(e=>e.config.once).map(e=>e.handler):[]}allListeners(e){if("string"!=typeof e)throw new TypeError("allListeners(event): event name must be a string");const t=this.#Qe.get(e);return Array.isArray(t)?[...t].map(e=>e.handler):[]}eventNames(){return[...this.#Qe.keys()]}emit(e,...t){if("string"!=typeof e)throw new TypeError("emit(event, data): event name must be a string");const r=this.#Qe.get(e);return!(!Array.isArray(r)||0===r.length||(r.forEach(e=>e.handler(...t)),0))}setMaxListeners(e){if(!Number.isInteger(e)||e<0)throw new TypeError("setMaxListeners(n): n must be a non-negative integer");this.#Xe=e}getMaxListeners(){return this.#Xe}};class _t{static Utils={...e,TinyHtml:De};#rt=new At;setThrowOnMaxListeners(e){return this.#rt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#rt.getThrowOnMaxListeners()}prependListener(e,t){return this.#rt.prependListener(e,t)}prependListenerOnce(e,t){return this.#rt.prependListenerOnce(e,t)}appendListener(e,t){return this.#rt.appendListener(e,t)}appendListenerOnce(e,t){return this.#rt.appendListenerOnce(e,t)}on(e,t){return this.#rt.on(e,t)}once(e,t){return this.#rt.once(e,t)}off(e,t){return this.#rt.off(e,t)}offAll(e){return this.#rt.offAll(e)}offAllTypes(){return this.#rt.offAllTypes()}listenerCount(e){return this.#rt.listenerCount(e)}listeners(e){return this.#rt.listeners(e)}onceListeners(e){return this.#rt.onceListeners(e)}allListeners(e){return this.#rt.allListeners(e)}eventNames(){return this.#rt.eventNames()}emit(e,...t){return this.#rt.emit(e,...t)}setMaxListeners(e){return this.#rt.setMaxListeners(e)}getMaxListeners(){return this.#rt.getMaxListeners()}#nt=new WeakMap;#ot=new WeakMap;#it=new WeakMap;#st=new WeakMap;#at=new WeakMap;#lt=new WeakMap;#ut=null;#ct=null;#ht=new Set(["IMG","IFRAME","VIDEO"]);#dt=null;#ft=!1;#mt=!1;#pt=!1;#gt=!1;#yt="";#bt=!1;#Z=!1;#wt=!1;#vt=!1;#Et=!1;#Tt=!1;#xt=0;#St=0;#Lt=0;#Ct=0;#At=0;#_t;#$;#Dt=new Set;constructor(e,{extraScrollBoundary:t=0,autoScrollBottom:r=!0,observeMutations:n=!0,preserveScrollOnLayoutShift:o=!0,debounceTime:i=100,querySelector:s=null,attributeFilter:a=["class","style","src","data-*","height","width"]}={}){if(!(e instanceof Element||e===window))throw new TypeError("TinySmartScroller: 'target' must be a DOM Element or 'window', but got "+typeof e);if("number"!=typeof t||Number.isNaN(t))throw new TypeError(`TinySmartScroller: 'extraScrollBoundary' must be a valid number, received ${t}`);if("boolean"!=typeof r)throw new TypeError("TinySmartScroller: 'autoScrollBottom' must be a boolean, received "+typeof r);if("boolean"!=typeof n)throw new TypeError("TinySmartScroller: 'observeMutations' must be a boolean, received "+typeof n);if("boolean"!=typeof o)throw new TypeError("TinySmartScroller: 'preserveScrollOnLayoutShift' must be a boolean, received "+typeof o);if("number"!=typeof i||i<0||Number.isNaN(i))throw new TypeError(`TinySmartScroller: 'debounceTime' must be a non-negative number, received ${i}`);if(null!==s&&"string"!=typeof s)throw new TypeError("TinySmartScroller: 'querySelector' must be a string or null, received "+typeof s);if(!(null===a||Array.isArray(a)||a instanceof Set))throw new TypeError("TinySmartScroller: 'attributeFilter' must be an array, Set, or null. Got "+typeof a);let l;this.#$=e instanceof Window?document.documentElement:e,this.#bt=e instanceof Window,this.#vt=r,this.#Et=n,this.#Tt=o,this.#xt=i,this.#At=t,this.#yt=s||"",this.#_t=new Set(a||void 0),this.#dt=()=>{this._scrollDataUpdater(),clearTimeout(l),l=setTimeout(()=>this._onScroll(),this.#xt)},(this.#bt?window:this.#$).addEventListener("scroll",this.#dt,{passive:!0}),this.#Et&&(this._observeMutations(),this._observeResizes(this.#$.children)),this._scrollDataUpdater()}getSimpleOnHeight(e=[]){if(!Array.isArray(e))throw new TypeError("getSimpleOnHeight(filter): filter must be an array of tag names");return(t,r,n)=>{if(e.length>0&&!e.includes(t.tagName)||n.now!==n.old)return;const o=r.old;return{height:r.now.height-o.height,width:0}}}addSimpleOnHeight(e){if(!Array.isArray(e))throw new TypeError("addSimpleOnHeight(filter): filter must be an array of tag names");const t=this.getSimpleOnHeight(e);return this.onSize(t),t}getLoadTags(){return Array.from(this.#ht)}addLoadTag(e){if("string"!=typeof e)throw new TypeError("addLoadTag(tag): tag must be a string");this.#ht.add(e.toUpperCase())}removeLoadTag(e){if("string"!=typeof e)throw new TypeError("removeLoadTag(tag): tag must be a string");this.#ht.delete(e.toUpperCase())}hasLoadTag(e){if("string"!=typeof e)throw new TypeError("hasLoadTag(tag): tag must be a string");return this.#ht.has(e.toUpperCase())}resetLoadTags(e=!1){if("boolean"!=typeof e)throw new TypeError("resetLoadTags(addDefault): addDefault must be a boolean");this.#ht.clear(),e&&(this.#ht.add("IMG"),this.#ht.add("IFRAME"),this.#ht.add("VIDEO"))}getAttributeFilters(){return Array.from(this.#_t)}addAttributeFilter(e){if("string"!=typeof e)throw new TypeError("addAttributeFilter(attr): attr must be a string");this.#_t.add(e)}removeAttributeFilter(e){if("string"!=typeof e)throw new TypeError("removeAttributeFilter(attr): attr must be a string");this.#_t.delete(e)}hasAttributeFilter(e){if("string"!=typeof e)throw new TypeError("hasAttributeFilter(attr): attr must be a string");return this.#_t.has(e)}resetAttributeFilters(e=!1){if("boolean"!=typeof e)throw new TypeError("resetAttributeFilters(addDefault): addDefault must be a boolean");this.#_t.clear(),e&&["class","style","src","data-*","height","width"].forEach(e=>this.#_t.add(e))}onSize(e){if(!this.#Z){if("function"!=typeof e)throw new TypeError("onSize(handler): handler must be a function");this.#Dt.add(e)}}offSize(e){if(!this.#Z){if("function"!=typeof e)throw new TypeError("offSize(handler): handler must be a function");this.#Dt.delete(e)}}_scrollDataUpdater(){const e=new Map;return this.#$.querySelectorAll(this.#yt||"*").forEach(t=>{const r=this.#it.get(t)??!1;this.#st.set(t,r);const n=De.isInContainer(this.#$,t);this.#it.set(t,n),e.set(t,{oldIsVisible:r,isVisible:n})}),e}_emit(e,t){this.emit(e,t)}_onScroll(){if(this.#Z)return;const e=this._scrollDataUpdater(),t=this.#$,r=t.scrollTop,n=t.scrollHeight,o=t.clientHeight,i={scrollTop:r,scrollHeight:n,clientHeight:o};let s=null,a=null;const l=0===r,u=r+o>=n-1,c=r<=0+this.#At,h=r+o>=n-1-this.#At;l&&u?s="all":l?s="top":u&&(s="bottom"),c&&h?a="all":c?a="top":h&&(a="bottom"),this.#mt=l,this.#ft=u,this.#pt=c,this.#gt=h,this.#wt=!(this.#vt&&this.#ft),this.#Ct=n-r-o,this.emit("onScrollBoundary",{status:s,...i,scrollCache:e}),this.emit("onExtraScrollBoundary",{status:a,...i,scrollCache:e}),this.#wt?this.emit("onScrollPause",{...i,scrollCache:e}):this.emit("onAutoScroll",{...i,scrollCache:e})}_fixScroll(e=[]){if(this.#Z)return;if(!Array.isArray(e))throw new TypeError("_fixScroll: targets must be an array of Elements");const t=this.#$.scrollHeight,r=this.#$.scrollTop,n=this.#$.scrollHeight-this.#$.scrollTop-this.#$.clientHeight,o=this.#$.scrollHeight-t,i=()=>{const t={height:0,width:0};for(const r of e){const e=this.#nt.get(r)||{height:0,width:0},n=this.#ot.get(r)||{height:0,width:0};this.#Dt.forEach(o=>{const i=o(r,{old:e,now:n},{old:this.#Lt,now:this.#St});if(this.#it.get(r)||this.#at.get(r)){if(void 0!==i&&"object"!=typeof i)throw new Error("_fixScroll: size filter must return an object or undefined");if(void 0===i)return;t.height=i.height,t.width=i.width}})}if("number"!=typeof t.height&&t.height<0)throw new Error("_fixScroll: invalid scrollSize.height value");if("number"!=typeof t.width&&t.width<0)throw new Error("_fixScroll: invalid scrollSize.width value");if(0!==t.height||0!==t.width)for(const t of e)this.#at.set(t,this.#it.get(t)??!1),this.#lt.set(t,this.#st.get(t)??!1);return t};if(this.#Lt>0&&De.hasScroll(this.#$).v&&this.#vt&&this.#Tt&&!this.#ft&&!this.#mt){const e=i();this.#$.scrollTop=r+o+e.height,e.width>0&&(this.#$.scrollLeft=this.#$.scrollLeft+e.width)}else!this.#wt&&this.#vt?(i(),this.scrollToBottom()):this.#vt||this.#ft||(i(),this.#$.scrollTop=this.#$.scrollHeight-this.#$.clientHeight-n)}_observeMutations(){this.#ct=new MutationObserver(e=>{this.#Z||(this._scrollDataUpdater(),this.#Lt=this.#St,this.#St=this.#$.childElementCount,e.forEach(e=>{e.addedNodes.forEach(e=>{if(e instanceof Element&&1===e.nodeType&&(this._observeResizes([e]),this._listenLoadEvents(e),this.#yt)){const t=e.querySelectorAll(this.#yt);this._observeResizes(t),this._listenLoadEvents(t)}})}),this._fixScroll())}),this.#ct.observe(this.#$,{childList:!0,subtree:!0,attributes:!0,attributeFilter:this.#_t.size>0?Array.from(this.#_t):void 0})}_observeResizes(e){this.#ut||(this.#ut=new ResizeObserver(e=>{if(this.#Z)return;this._scrollDataUpdater();const t=[];for(const r of e){const e=r.target,n=this.#ot.get(e);n&&this.#nt.set(e,n);const{width:o,height:i}=r.contentRect;this.#ot.set(e,{width:o,height:i}),t.push(e)}this._fixScroll(t)})),Array.from(e).forEach(e=>{if(!this.#ut)throw new Error("_observeResizes: ResizeObserver instance is not initialized");this.#ut.observe(e)})}_listenLoadEvents(e){this.#Z||(e instanceof NodeList?Array.from(e):[e]).forEach(e=>{this.#ht.has(e.tagName)&&(e.complete||e.addEventListener("load",()=>{this._scrollDataUpdater(),!this.#wt&&this.#vt&&this.scrollToBottom()}))})}get target(){return this.#$}getOldSize(e){return this.#nt.get(e)??null}getNewSize(e){return this.#ot.get(e)??null}wasVisible(e){return this.#st.get(e)??!1}isVisible(e){return this.#it.get(e)??!1}wasTimedVisible(e){return this.#lt.get(e)??!1}isTimedVisible(e){return this.#at.get(e)??!1}setExtraScrollBoundary(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("setExtraScrollBoundary(value): value must be a valid number");this.#At=e}getExtraScrollBoundary(){return this.#At}getLastKnownScrollBottomOffset(){return this.#Ct}scrollToBottom(){this.#$.scrollTop=this.#$.scrollHeight}scrollToTop(){this.#$.scrollTop=0}isUserAtCustomBottom(){return this.#gt}isUserAtCustomTop(){return this.#pt}isUserAtBottom(){return this.#ft}isUserAtTop(){return this.#mt}isScrollPaused(){return this.#wt}isWindow(){return this.#bt}isDestroyed(){return this.#Z}getAutoScrollBottom(){return this.#vt}getObserveMutations(){return this.#Et}getPreserveScrollOnLayoutShift(){return this.#Tt}getDebounceTime(){return this.#xt}getElemAmount(){return this.#St}getPrevElemAmount(){return this.#Lt}getQuerySelector(){return this.#yt}destroy(){if(this.#Z)return;this.#Z=!0,this.#ct&&(this.#ct.disconnect(),this.#ct=null),this.#ut&&(this.#ut.disconnect(),this.#ut=null);const e=this.#bt?window:this.#$;this.#dt&&e.removeEventListener("scroll",this.#dt),this.#nt=new WeakMap,this.#ot=new WeakMap,this.#it=new WeakMap,this.#st=new WeakMap,this.#at=new WeakMap,this.#lt=new WeakMap,this.#rt.offAllTypes(),this.#Dt.clear(),this.#ht.clear()}}const Dt=_t,Mt=class{#H;#Mt;#kt;constructor(e,{openTag:t="[",closeTag:r="]"}={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new TypeError("Element must be an input or textarea.");if("string"!=typeof t)throw new TypeError("openTag must be a string.");if("string"!=typeof r)throw new TypeError("closeTag must be a string.");this.#H=e,this.#Mt=t,this.#kt=r}getOpenTag(){return this.#Mt}getCloseTag(){return this.#kt}setOpenTag(e){if("string"!=typeof e)throw new TypeError("Open tag must be a string.");this.#Mt=e}setCloseTag(e){if("string"!=typeof e)throw new TypeError("Close tag must be a string.");this.#kt=e}ensureFocus(){return document.activeElement!==this.#H&&this.#H.focus(),this}focus(){return this.#H.focus(),this}getSelectionRange(){return{start:this.#H.selectionStart??NaN,end:this.#H.selectionEnd??NaN}}setSelectionRange(e,t,r=!0){if("number"!=typeof e||"number"!=typeof t)throw new TypeError("start and end must be numbers.");if("boolean"!=typeof r)throw new TypeError("preserveScroll must be a boolean.");const n=this.#H.scrollTop,o=this.#H.scrollLeft;return this.#H.setSelectionRange(e,t),r&&(this.#H.scrollTop=n,this.#H.scrollLeft=o),this}getValue(){return this.#H.value}setValue(e){if("string"!=typeof e)throw new TypeError("Value must be a string.");return this.#H.value=e,this}getSelectedText(){const{start:e,end:t}=this.getSelectionRange();return this.#H.value.slice(e,t)}insertText(e,{newCursor:t="end",autoSpacing:r=!1,autoSpaceLeft:n=r,autoSpaceRight:o=r}={}){if("string"!=typeof e)throw new TypeError("Text must be a string.");if(!["start","end","preserve"].includes(t))throw new TypeError("newCursor must be one of 'start', 'end', or 'preserve'.");if("boolean"!=typeof r)throw new TypeError("autoSpacing must be a boolean.");if("boolean"!=typeof n)throw new TypeError("autoSpaceLeft must be a boolean.");if("boolean"!=typeof o)throw new TypeError("autoSpaceRight must be a boolean.");const{start:i,end:s}=this.getSelectionRange(),a=this.#H.value,l=a[i-1]||"",u=a[s]||"",c=`${n&&l&&!/\s/.test(l)?" ":""}${e}${o&&u&&!/\s/.test(u)?" ":""}`,h=a.slice(0,i)+c+a.slice(s);this.setValue(h);let d=i;return"end"===t?d=i+c.length:"preserve"===t&&(d=i),this.setSelectionRange(d,d),this}deleteSelection(){return this.insertText(""),this}transformSelection(e){if("function"!=typeof e)throw new TypeError("transformer must be a function.");const{start:t}=this.getSelectionRange(),r=e(this.getSelectedText());return this.insertText(r),this.setSelectionRange(t,t+r.length),this}surroundSelection(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("prefix and suffix must be strings.");const r=this.getSelectedText();return this.insertText(`${e}${r}${t}`),this}moveCaret(e){if("number"!=typeof e)throw new TypeError("offset must be a number.");const{start:t}=this.getSelectionRange(),r=Math.max(0,t+e);return this.setSelectionRange(r,r),this}selectAll(){return this.setSelectionRange(0,this.#H.value.length),this}expandSelection(e,t){if("number"!=typeof e||"number"!=typeof t)throw new TypeError("before and after must be numbers.");const{start:r,end:n}=this.getSelectionRange(),o=Math.max(0,r-e),i=Math.min(this.#H.value.length,n+t);return this.setSelectionRange(o,i),this}replaceAll(e,t){if(!(e instanceof RegExp))throw new TypeError("regex must be a RegExp.");if("function"!=typeof t)throw new TypeError("replacer must be a function.");const r=this.#H.value.replace(e,t);return this.setValue(r),this}replaceInSelection(e,t){if(!(e instanceof RegExp))throw new TypeError("regex must be a RegExp.");if("function"!=typeof t)throw new TypeError("replacer must be a function.");const{start:r,end:n}=this.getSelectionRange(),o=this.#H.value,i=o.slice(r,n).replace(e,t),s=o.slice(0,r)+i+o.slice(n);return this.setValue(s),this.setSelectionRange(r,r+i.length),this}toggleCode(e){if("string"!=typeof e)throw new TypeError("codeName must be a string.");const t=this.getSelectedText();if(t.startsWith(e)&&t.endsWith(e)){const r=t.slice(e.length,t.length-e.length);this.insertText(r)}else this.insertText(`${e}${t}${e}`);return this}_insertAttr(e){let t="";if(Array.isArray(e)){if(!e.every(e=>"string"==typeof e))throw new TypeError("All entries in attributes array must be strings.");t=e.map(e=>`${e}`).join(" ")}else{if("object"!=typeof e||null===e)throw new TypeError("attributes must be an object or an array of strings.");t=Object.entries(e).map(([e,t])=>{if("string"!=typeof t)throw new TypeError("All entries in attributes object must be strings.");return`${e}${t.length>0?`="${t}"`:""}`}).join(" ")}return t}wrapWithTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this._insertAttr(t),n=r?`${this.#Mt}${e} ${r}${this.#kt}`:`${this.#Mt}${e}${this.#kt}`,o=`${this.#Mt}/${e}${this.#kt}`;return this.surroundSelection(n,o),this}insertTag(e,t="",r={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");if("string"!=typeof t)throw new TypeError("content must be a string.");const n=this._insertAttr(r),o=n?`${this.#Mt}${e} ${n}${this.#kt}`:`${this.#Mt}${e}${this.#kt}`,i=`${this.#Mt}/${e}${this.#kt}`;return this.insertText(`${o}${t}${i}`),this}insertSelfClosingTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this._insertAttr(t),n=r?`${this.#Mt}${e} ${r}${this.#kt}`:`${this.#Mt}${e}${this.#kt}`;return this.insertText(n),this}toggleTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this.getSelectedText(),n=new RegExp(`^\\[${e}(\\s+[^\\]]*)?\\]`),o=new RegExp(`\\[/${e}\\]$`),i=n.test(r),s=o.test(r);if(i&&s){const e=r.replace(n,"").replace(o,"");this.insertText(e)}else{const n=this._insertAttr(t),o=n?`${this.#Mt}${e} ${n}${this.#kt}`:`${this.#Mt}${e}${this.#kt}`,i=`${this.#Mt}/${e}${this.#kt}`;this.insertText(`${o}${r}${i}`)}return this}},kt=class{#Nt=!1;#It=!1;#Bt=null;#jt=null;constructor(){void 0!==navigator.clipboard&&null!==navigator.clipboard&&(this.#It=!0,this.#Bt=e=>navigator.clipboard.writeText(e),this.#jt=e=>navigator.clipboard.write([new ClipboardItem({[e.type]:e})])),this.#Nt=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.#Bt=e}setCopyBlob(e){if("function"!=typeof e)throw new TypeError("setCopyBlob expected a function that returns Promise<void>.");this.#jt=e}copyText(e){if("string"!=typeof e)throw new TypeError("copyText expected a string.");if(this.#Bt)return this.#Bt(e);if(this.#Nt){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.#jt)return this.#jt(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,n=!1){return new Promise((o,i)=>{this._read(e).then(s=>{if(!s)return o(null);const a=[];let l=!0;const u=async(e,o)=>{if(l)if(null!==t&&"custom"!==t||"string"!=typeof r||!(!n&&e.startsWith(r)||n&&e===r))if(null!==t&&"text"!==t||"text/plain"!==e){if(null===t){l=!1;const t=await this._handleBlob(e,o);t&&a.push(t)}}else{l=!1;const t=await this._handleText(e,o);t&&a.push(t)}else{l=!1;const t=await this._handleBlob(e,o);t&&a.push(t)}},c=[],h=e=>{if(!(e instanceof ClipboardItem))throw new Error("Expected ClipboardItem when reading data.");for(const t in e.types)c.push(u(e.types[t],e))};if("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)&&e>-1)h(s),Promise.all(c).then(()=>{a[0]?o(a[0]):o(null)}).catch(i);else if(Array.isArray(s)){for(const e in s)h(s[e]);Promise.all(c).then(()=>o(a)).catch(i)}}).catch(i)})}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 n=await this._readData(r,"custom",e,t);if(!(n instanceof Blob))throw new Error("Failed to read custom data: expected Blob.");return n}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.#It||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.#Nt}isNavigatorClipboardAvailable(){return this.#It}getCopyTextFunc(){return this.#Bt}getCopyBlobFunc(){return this.#jt}};class Nt{static _rca(e,t,r){let n=127,o=128;void 0===e&&(e=24),void 0===t&&(t="rgb"),!0===r&&(n=55,o=200);const i=2*Math.PI/e,s=[];for(let r=0;r<e;++r){const e=Math.sin(i*r+2)*n+o,a=Math.sin(i*r+0)*n+o,l=Math.sin(i*r+4)*n+o;switch(t){case"hex":s.push({hex:this.rgbToHex(Math.round(e),Math.round(a),Math.round(l))});break;case"rgb":s.push({r:e,g:a,b:l});break;case"hsl":const[t,r,n]=this.rgbaToHsl(Math.round(e),Math.round(a),Math.round(l));s.push({h:t,s:r,l:n})}}return s}static rcaRgb(e,t){return Nt._rca(e,"rgb",t)}static rcaHsl(e,t){return Nt._rca(e,"hsl",t)}static rcaHex(e,t){return Nt._rca(e,"hex",t)}static randomColor(){return`#${Math.floor(16777216*Math.random()).toString(16).padStart(6,"0")}`}static parseInput(e,t){if("string"==typeof e){if((e=e.trim().toLowerCase()).startsWith("#"))return this.hexToRgba(e);if(e.startsWith("rgb"))return this.rgbStringToRgbaArray(e);if(e.startsWith("hsl"))return this.hslStringToRgbaArray(e)}if("number"==typeof e)return this.intToRgba(e);if(Array.isArray(e)&&(3===e.length||4===e.length)&&e.every(e=>"number"==typeof e)){if(t){const[t,r,n,o]=e;if(t<=360&&r<=100&&n<=100)return this.hslToRgba(t,r,n,o)}return[...e,1].slice(0,4)}throw new Error("Unsupported color format.")}static hslToInt(e,t,r){const[n,o,i]=Nt.hslToRgba(e,t,r);return Nt.rgbToInt(n,o,i)}static hslToHex(e,t,r){const[n,o,i]=Nt.hslToRgba(e,t,r);return Nt.rgbToHex(n,o,i)}static hslStringToRgbaArray(e){const t=e.match(/[\d.]+/g)?.map(Number);if(!t||t.length<3)return[0,0,0,1];const[r,n,o,i=1]=t;return this.hslToRgba(r,n,o,i)}static hslToRgba(e,t,r,n=1){r/=100;const o=t=>(t+e/30)%12,i=(t/=100)*Math.min(r,1-r),s=e=>r-i*Math.max(-1,Math.min(o(e)-3,Math.min(9-o(e),1)));return[Math.round(255*s(0)),Math.round(255*s(8)),Math.round(255*s(4)),n]}static hslToRgb(e,t,r,n=1){return Nt.hslToRgba(e,t,r,n).slice(0,3)}static hexToInt(e){return parseInt(e.replace(/^#/,""),16)}static hexToHsl(e){const[t,r,n,o]=Nt.hexToRgba(e);return Nt.rgbaToHsl(t,r,n,o)}static hexToHsla(e){const[t,r,n,o]=Nt.hexToRgba(e);return Nt.rgbaToHsla(t,r,n,o)}static hexToRgba(e){3===(e=e.replace(/^#/,"")).length&&(e=e.split("").map(e=>e+e).join(""));const t=parseInt(e,16);return[t>>16&255,t>>8&255,255&t,1]}static hexToRgb(e){return this.hexToRgba(e).slice(0,3)}static rgbToHex(e,t,r){return"#"+[e,t,r].map(e=>e.toString(16).padStart(2,"0")).join("")}static rgbToInt(e,t,r){return e<<16|t<<8|r}static rgbaToHsla(e,t,r,n=1){e/=255,t/=255,r/=255;const o=Math.max(e,t,r),i=Math.min(e,t,r);let s=0,a=0,l=(o+i)/2;const u=o-i;if(0!==u){switch(a=u/(1-Math.abs(2*l-1)),o){case e:s=(t-r)/u+(t<r?6:0);break;case t:s=(r-e)/u+2;break;case r:s=(e-t)/u+4}s*=60}return[Math.round(s),Math.round(100*a),Math.round(100*l),n]}static rgbaToHsl(e,t,r,n){return this.rgbaToHsla(e,t,r,n).slice(0,3)}static rgbStringToRgbaArray(e){const t=e.match(/[\d.]+/g)?.map(Number);return t?[...t,1].slice(0,4):[]}static intToHsl(e){const[t,r,n,o]=Nt.intToRgba(e);return Nt.rgbaToHsl(t,r,n,o)}static intToHsla(e){const[t,r,n,o]=Nt.intToRgba(e);return Nt.rgbaToHsla(t,r,n,o)}static intToHex(e){return"#"+e.toString(16).padStart(6,"0")}static intToRgba(e){return[e>>16&255,e>>8&255,255&e,1]}#Rt="#000000";#Ot=[0,0,0,0];#Pt;constructor(e=null,t=!1){this.#Pt=t,null!=e&&this.setColor(e)}setColor(e){this.#Rt=e;const t=this.#Pt&&Array.isArray(e)&&e[0]<=360&&e[1]<=100&&e[2]<=100;this.#Ot=Nt.parseInput(e,t)}toHslaArray(){const[e,t,r,n]=this.#Ot;return Nt.rgbaToHsla(e,t,r,n)}toHslString(){const[e,t,r]=this.#Ot,[n,o,i]=Nt.rgbaToHsl(e,t,r);return`hsl(${n}, ${o}%, ${i}%)`}toHslaString(){const[e,t,r,n]=this.#Ot,[o,i,s,a]=Nt.rgbaToHsla(e,t,r,n);return`hsla(${o}, ${i}%, ${s}%, ${a??1})`}toRgbaArray(){return[...this.#Ot]}toRgbString(){const[e,t,r]=this.#Ot;return`rgb(${e}, ${t}, ${r})`}toRgbaString(){const[e,t,r,n]=this.#Ot;return`rgba(${e}, ${t}, ${r}, ${n??1})`}toHex(){const[e,t,r]=this.#Ot;return Nt.rgbToHex(e,t,r)}toInt(){const[e,t,r]=this.#Ot;return Nt.rgbToInt(e,t,r)}getOriginal(){return this.#Rt}}const It=Nt;class Bt{#Ht=!1;#Wt;#Ft;#$t=null;#Ut=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.#Ft=e,this.#Wt=t,this.setCooldownWatcherTime(e)}isDestroyed(){return this.#Ht}getAllowAutoConfigChange(){return this.#Wt}getCooldownWatcherTime(){return this.#Ft}setAllowAutoConfigChange(e){if("boolean"!=typeof e)throw new TypeError("Expected 'value' to be a boolean.");this.#Wt=e}setCooldownWatcherTime(e){if(this.#Ht)throw new Error("TinyTimeout has been destroyed.");if(!Number.isFinite(e)||e<=0)throw new TypeError("Expected 'value' to be a positive number.");this.#Ft=e,this.#$t&&clearInterval(this.#$t),this.#$t=setInterval(()=>{this.#Ut.forEach(e=>{e.now>0&&e.now--})},this.#Ft)}set(e,t,r,n=null){if(this.#Ht)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!==n&&(!Number.isFinite(n)||n<0))throw new TypeError("Expected 'limit' to be null or a non-negative number.");let o=this.#Ut.get(e);(!o||this.#Wt&&r!==o.value)&&(o={value:r,now:0},this.#Ut.set(e,o));const i=o.value*o.now;return o.now++,setTimeout(t,"number"==typeof n?Math.min(i,n):i)}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(r=>{const n=setInterval(()=>{e()&&(clearInterval(n),r())},t)})}waitForTrue(e,t=100){if(this.#Ht)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 Bt.waitForTrue(e,t??this.#Ft)}destroy(){this.#Ht||(this.#Ht=!0,this.#$t&&clearInterval(this.#$t),this.#$t=null,this.#Ut.clear())}}const jt=Bt,Rt=new Map,Ot=new Map,Pt=new Set(["string","boolean","number","object","array",String,Boolean,Number,Object,Array,BigInt,Symbol]);class Ht{#rt=new At;setThrowOnMaxListeners(e){return this.#rt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#rt.getThrowOnMaxListeners()}prependListener(e,t){return this.#rt.prependListener(e,t)}prependListenerOnce(e,t){return this.#rt.prependListenerOnce(e,t)}appendListener(e,t){return this.#rt.appendListener(e,t)}appendListenerOnce(e,t){return this.#rt.appendListenerOnce(e,t)}on(e,t){return this.#rt.on(e,t)}once(e,t){return this.#rt.once(e,t)}off(e,t){return this.#rt.off(e,t)}offAll(e){return this.#rt.offAll(e)}offAllTypes(){return this.#rt.offAllTypes()}listenerCount(e){return this.#rt.listenerCount(e)}listeners(e){return this.#rt.listeners(e)}onceListeners(e){return this.#rt.onceListeners(e)}allListeners(e){return this.#rt.allListeners(e)}eventNames(){return this.#rt.eventNames()}emit(e,...t){return this.#rt.emit(e,...t)}setMaxListeners(e){return this.#rt.setMaxListeners(e)}getMaxListeners(){return this.#rt.getMaxListeners()}static hasJsonType(e){return Rt.has(e)&&Ot.has(e)||Pt.has(e)}static registerJsonType(e,t,r,n=!1){if(Pt.has(e))throw new Error(`Cannot register type "${e}" because it is frozen.`);Rt.set(e,t),Ot.set(e,r),n&&Pt.add(e)}static deleteJsonType(e){if(Pt.has(e))throw new Error(`Cannot remove type "${e}" because it is frozen.`);let t=!1;return Rt.delete(e)&&(t=!0),Ot.delete(e)&&(t=!0),t}static encodeSpecialJson(e){if(void 0===e)return{__undefined__:!0};if(null===e)return{__null__:!0};for(const[t,r]of Rt.entries())if("string"!=typeof t&&e instanceof t||typeof e===t)return r(e,Ht.encodeSpecialJson);if(Array.isArray(e))return e.map(Ht.encodeSpecialJson);if(f(e)){const t={};for(const r in e)t[r]=Ht.encodeSpecialJson(e[r]);return t}return e}static decodeSpecialJson(e){const t=f(e);if(t){if(e.__undefined__)return;if(e.__null__)return null}if(Array.isArray(e))return e.map(Ht.decodeSpecialJson);if(t){for(const[t,r]of Ot.entries())if(r.check&&r.check(e))return r.decode(e,Ht.decodeSpecialJson);const t={};for(const r in e)t[r]=Ht.decodeSpecialJson(e[r]);return t}return e}#Jt=window.localStorage;#Vt=null;#zt=0;#qt=e=>this.emit("storage",e);constructor(e){if(void 0!==e&&"string"!=typeof e)throw new TypeError("TinyLocalStorage: dbName must be a string if provided.");"string"==typeof e&&(this.#Vt=`LSDB::${e}`),window.addEventListener("storage",this.#qt)}#Gt(e){if("string"==typeof e&&e.startsWith("LSDB::"))throw new Error(`TinyLocalStorage: Key "${e}" may conflict with reserved dbKeys.`)}updateStorageVersion(e,t){if("string"!=typeof this.#Vt)throw new Error("TinyLocalStorage: Database key is not initialized. Set a valid dbName in the constructor.");if("number"!=typeof e||Number.isNaN(e)||e<1)throw new TypeError("TinyLocalStorage: version must be a positive number.");if("function"!=typeof t)throw new TypeError("TinyLocalStorage: onUpgrade must be a function.");const r=parseInt(localStorage.getItem(this.#Vt),10)||0;if("number"!=typeof r||Number.isNaN(r)||r<0)throw new TypeError("TinyLocalStorage: saved version in localStorage is not a valid number.");if(e<r)throw new Error(`TinyLocalStorage: Cannot downgrade database version from ${r} to ${e}.`);e>r&&(t(r,e),localStorage.setItem(this.#Vt,String(e)),this.#zt=e)}getDbKey(){return this.#Vt}getVersion(){return this.#zt}setLocalStorage(e){if(!(e instanceof Storage))throw new TypeError("Argument must be a valid instance of Storage.");this.#Jt=e}localStorageExists(){return this.#Jt instanceof Storage}#Yt(e,t){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");return Ht.encodeSpecialJson(t)}setJson(e,t){if(this.#Gt(e),!(f(t)||Array.isArray(t)||t instanceof Map||t instanceof Set))throw new TypeError("The storage value is not a valid JSON-compatible structure.");const r=this.#Yt(e,t);return this.emit("setJson",e,t),this.#Jt.setItem(e,JSON.stringify(r))}#Kt(e,t){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");const r=this.#Jt.getItem(e),n={obj:()=>({}),array:()=>[],map:()=>new Map,set:()=>new Set},o="function"==typeof n[t]?n[t]():null;let i;try{i=JSON.parse(r)}catch{return o}return{decoded:Ht.decodeSpecialJson(i),fallback:o}}getJson(e,t){const{decoded:r,fallback:n}=this.#Kt(e,t);return r instanceof Map||r instanceof Set||Array.isArray(r)||f(r)?r:n}setDate(e,t){if(this.#Gt(e),!(t instanceof Date))throw new TypeError("Value must be a Date.");const r=this.#Yt(e,t);return this.emit("setDate",e,t),this.#Jt.setItem(e,JSON.stringify(r))}getDate(e){const t=this.#Kt(e).decoded;return t instanceof Date?t:null}setRegExp(e,t){if(this.#Gt(e),!(t instanceof RegExp))throw new TypeError("Value must be a RegExp.");const r=this.#Yt(e,t);return this.emit("setRegExp",e,t),this.#Jt.setItem(e,JSON.stringify(r))}getRegExp(e){const t=this.#Kt(e).decoded;return t instanceof RegExp?t:null}setBigInt(e,t){if(this.#Gt(e),"bigint"!=typeof t)throw new TypeError("Value must be a BigInt.");const r=this.#Yt(e,t);return this.emit("setBigInt",e,t),this.#Jt.setItem(e,JSON.stringify(r))}getBigInt(e){const t=this.#Kt(e).decoded;return"bigint"==typeof t?t:null}setSymbol(e,t){if(this.#Gt(e),"symbol"!=typeof t)throw new TypeError("Value must be a Symbol.");const r=this.#Yt(e,t);return this.emit("setSymbol",e,t),this.#Jt.setItem(e,JSON.stringify(r))}getSymbol(e){const t=this.#Kt(e).decoded;return"symbol"==typeof t?t:null}getValue(e){return this.#Kt(e).decoded??null}setItem(e,t){if(this.#Gt(e),"string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");return this.emit("setItem",e,t),this.#Jt.setItem(e,t)}getItem(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");return this.#Jt.getItem(e)}setString(e,t){if(this.#Gt(e),"string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");if("string"!=typeof t)throw new TypeError("Value must be a string.");return this.emit("setString",e,t),this.#Jt.setItem(e,JSON.stringify({__string__:!0,value:t}))}getString(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");let t=this.#Jt.getItem(e);try{if(t=JSON.parse(t),!f(t)||!t.__string__||"string"!=typeof t.value)return null;t=t.value}catch{t=null}return"string"==typeof t?t:null}setNumber(e,t){if(this.#Gt(e),"string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");if("number"!=typeof t)throw new TypeError("Value must be a number.");return this.emit("setNumber",e,t),this.#Jt.setItem(e,String(t))}getNumber(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");let t=this.#Jt.getItem(e);return"number"==typeof t||"string"==typeof t&&t.length>0&&(t=parseFloat(t),!Number.isNaN(t))?t:null}setBool(e,t){if(this.#Gt(e),"string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");if("boolean"!=typeof t)throw new TypeError("Value must be a boolean.");return this.emit("setBool",e,t),this.#Jt.setItem(e,String(t))}getBool(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");const t=this.#Jt.getItem(e);if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===t)return!0;if("false"===t)return!1}return null}removeItem(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");return this.emit("removeItem",e),this.#Jt.removeItem(e)}clearLocalStorage(){return this.#Jt.clear()}destroy(){window.removeEventListener("storage",this.#qt),this.#rt.offAllTypes()}}Ht.registerJsonType(Map,(e,t)=>({__map__:!0,data:Array.from(e.entries()).map(([e,r])=>[e,t(r)])}),{check:e=>e.__map__,decode:(e,t)=>new Map(e.data.map(([e,r])=>[e,t(r)]))},!0),Ht.registerJsonType(Set,(e,t)=>({__set__:!0,data:Array.from(e).map(t)}),{check:e=>e.__set__,decode:(e,t)=>new Set(e.data.map(t))},!0),Ht.registerJsonType(Date,e=>({__date__:!0,value:e.toISOString()}),{check:e=>e.__date__,decode:e=>new Date(e.value)},!0),Ht.registerJsonType(RegExp,e=>({__regexp__:!0,source:e.source,flags:e.flags}),{check:e=>e.__regexp__,decode:e=>new RegExp(e.source,e.flags)},!0),Ht.registerJsonType("bigint",e=>({__bigint__:!0,value:e.toString()}),{check:e=>e.__bigint__,decode:e=>BigInt(e.value)},!0),Ht.registerJsonType("symbol",e=>({__symbol__:!0,key:Symbol.keyFor(e)??e.description??null}),{check:e=>e.__symbol__,decode:e=>{const t=e.key;return null!=t?Symbol.for(t):Symbol()}},!0);const Wt=Ht,Ft=new WeakMap,$t=class{#rt=new At;setThrowOnMaxListeners(e){return this.#rt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#rt.getThrowOnMaxListeners()}prependListener(e,t){return this.#rt.prependListener(e,t)}prependListenerOnce(e,t){return this.#rt.prependListenerOnce(e,t)}appendListener(e,t){return this.#rt.appendListener(e,t)}appendListenerOnce(e,t){return this.#rt.appendListenerOnce(e,t)}on(e,t){return this.#rt.on(e,t)}once(e,t){return this.#rt.once(e,t)}off(e,t){return this.#rt.off(e,t)}offAll(e){return this.#rt.offAll(e)}offAllTypes(){return this.#rt.offAllTypes()}listenerCount(e){return this.#rt.listenerCount(e)}listeners(e){return this.#rt.listeners(e)}onceListeners(e){return this.#rt.onceListeners(e)}allListeners(e){return this.#rt.allListeners(e)}eventNames(){return this.#rt.eventNames()}setMaxListeners(e){return this.#rt.setMaxListeners(e)}getMaxListeners(){return this.#rt.getMaxListeners()}#Qt;#Xt;#Zt;#Ht=!1;#er=!1;#tr=[];#rr="__tinyIframeEvent__";get secretEventName(){return this.#rr}set secretEventName(e){if("string"!=typeof e)throw new TypeError("TinyIframeEvents: secretEventName must be a string.");this.#rr=e}constructor({targetIframe:e,targetOrigin:t}={}){if(!(void 0===e||e instanceof HTMLIFrameElement&&e.contentWindow))throw new TypeError('[TinyIframeEvents] Invalid "targetIframe" provided: expected a HTML Iframe Element, received '+typeof e);if(void 0!==t&&"string"!=typeof t)throw new TypeError('[TinyIframeEvents] Invalid "targetOrigin" provided: expected a string, received '+typeof t);if(this.#Qt=e?.contentWindow??window.parent,this.#Xt=t??window.location.origin,this.#Zt=e?"parent":"iframe",Ft.has(this.#Qt))throw new Error("Duplicate window reference.");this._boundOnMessage=this.#nr.bind(this),this._boundOnceMessage=this.#or.bind(this),"complete"===this.#Qt.document.readyState||"interactive"===this.#Qt.document.readyState?this.#or():(this.#Qt.addEventListener("load",this._boundOnceMessage,!1),this.#Qt.addEventListener("DOMContentLoaded",this._boundOnceMessage,!1)),window.addEventListener("message",this._boundOnMessage,!1),Ft.set(this.#Qt,this)}#or(){this.#er||(this.#er=!0,this.#ir())}#nr(e){const{data:t,source:r}=e;if(!f(t)||!t[this.#rr])return;const{eventName:n,payload:o,direction:i}=t;r===this.#Qt&&("iframe"===this.#Zt&&"iframe"!==i||"parent"===this.#Zt&&"parent"!==i||this.#rt.emit(n,o,e))}emit(e,t){if("string"!=typeof e)throw new TypeError("Event name must be a string.");if(this.#Ht)throw new Error("Cannot emit: instance has been destroyed.");const r={[this.#rr]:!0,eventName:e,payload:t,direction:"parent"===this.#Zt?"iframe":"parent"};this.#er?this.#Qt.postMessage(r,this.#Xt):this.#tr.push(r)}#ir(){for(;this.#tr.length;){const e=this.#tr.shift();e&&this.#Qt.postMessage(e,this.#Xt)}}isDestroyed(){return this.#Ht}destroy(){this.#Ht=!0,window.removeEventListener("message",this._boundOnMessage),this.#Qt.removeEventListener("load",this._boundOnceMessage,!1),this.#Qt.removeEventListener("DOMContentLoaded",this._boundOnceMessage,!1),this.#rt.offAllTypes(),this.#tr=[],Ft.delete(this.#Qt)}},Ut=new WeakMap,Jt=class{#rt=new At;setThrowOnMaxListeners(e){return this.#rt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#rt.getThrowOnMaxListeners()}prependListener(e,t){return this.#rt.prependListener(e,t)}prependListenerOnce(e,t){return this.#rt.prependListenerOnce(e,t)}appendListener(e,t){return this.#rt.appendListener(e,t)}appendListenerOnce(e,t){return this.#rt.appendListenerOnce(e,t)}on(e,t){return this.#rt.on(e,t)}once(e,t){return this.#rt.once(e,t)}off(e,t){return this.#rt.off(e,t)}offAll(e){return this.#rt.offAll(e)}offAllTypes(){return this.#rt.offAllTypes()}listenerCount(e){return this.#rt.listenerCount(e)}listeners(e){return this.#rt.listeners(e)}onceListeners(e){return this.#rt.onceListeners(e)}allListeners(e){return this.#rt.allListeners(e)}eventNames(){return this.#rt.eventNames()}setMaxListeners(e){return this.#rt.setMaxListeners(e)}getMaxListeners(){return this.#rt.getMaxListeners()}#sr;#Xt;#tr=[];#er=!1;#ar=!1;#lr=null;#ur="__TNE_READY__";#cr="__TNE_ROUTE__";get readyEventName(){return this.#ur}set readyEventName(e){if("string"!=typeof e)throw new TypeError("TinyNewWinEvents: readyEventName must be a string.");this.#ur=e}get routeEventName(){return this.#cr}set routeEventName(e){if("string"!=typeof e)throw new TypeError("TinyNewWinEvents: routeEventName must be a string.");this.#cr=e}constructor({targetOrigin:e,url:t,name:r,features:n}={}){if("string"==typeof r&&"_blank"===r)throw new Error('TinyNewWinEvents: The window name "_blank" is not supported. Please use a custom name to allow tracking.');if(void 0!==e&&"string"!=typeof e)throw new TypeError('TinyNewWinEvents: The "targetOrigin" option must be a string.');if(void 0!==t&&"string"!=typeof t)throw new TypeError('TinyNewWinEvents: The "url" option must be a string.');if(void 0!==n&&"string"!=typeof n)throw new TypeError('TinyNewWinEvents: The "features" option must be a string if provided.');if(void 0===t?this.#sr=window.opener:(this.#sr="string"==typeof t?window.open(t,r,n):t,this.#ar=!0),!this.#sr||Ut.has(this.#sr))throw new Error("Invalid or duplicate window reference.");this.#Xt=e??window.location.origin,this._handleMessage=this.#hr.bind(this),window.addEventListener("message",this._handleMessage,!1),this.#ar||(this.#dr(this.#ur,null),this.#fr())}getWin(){return this.#sr}#hr(e){if(!e.source||this.#sr&&e.source!==this.#sr)return;const{type:t,route:r,payload:n}=e.data||{};if(t===this.#ur)return this.#er=!0,this.#ir(),this.#fr(),void(this.#ar&&this.#dr(this.#ur,null));t===this.#cr&&this.#rt.emit(r,n,e)}#ir(){for(;this.#tr.length;){const e=this.#tr.shift();if(e){const{route:t,payload:r}=e;this.emit(t,r)}}}#dr(e,t,r=""){this.#sr&&this.#sr.closed||this.#sr?.postMessage({type:e,route:r,payload:t},this.#Xt)}close(){if(!this.#ar)throw new Error("Only host can close the window.");this.#sr&&!this.#sr.closed&&this.#sr.close()}emit(e,t){if("string"!=typeof e)throw new TypeError("Event name must be a string.");if(this.isDestroyed())throw new Error("Cannot emit: instance has been destroyed.");this.#er?this.#dr(this.#cr,t,e):this.#tr.push({route:e,payload:t})}isConnected(){return!(!this.#er||!this.#sr||this.#sr.closed)}#fr(){this.#sr&&!this.#lr&&(this.#lr=setInterval(()=>{this.#sr?.closed&&(this.#rt.emit("WINDOW_REF_CLOSED"),this.destroy())},500),Ut.set(this.#sr,this.#lr))}onClose(e){return this.#rt.on("WINDOW_REF_CLOSED",e)}offClose(e){return this.#rt.off("WINDOW_REF_CLOSED",e)}isDestroyed(){return!this.#sr}destroy(){this.#sr&&(this.#lr&&(clearInterval(this.#lr),this.#lr=null,Ut.delete(this.#sr)),window.removeEventListener("message",this._handleMessage),this.#tr=[],this.#er=!1,this.#sr=null,this.#rt.offAllTypes())}}})(),window.TinyEssentials=n})();
|
|
2
|
+
(()=>{var e={133:()=>{},251:(e,t)=>{t.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,l=(1<<a)-1,u=l>>1,h=-7,c=r?o-1:0,d=r?-1:1,f=e[t+c];for(c+=d,i=f&(1<<-h)-1,f>>=-h,h+=a;h>0;i=256*i+e[t+c],c+=d,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+e[t+c],c+=d,h-=8);if(0===i)i=1-u;else{if(i===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var s,a,l,u=8*i-o-1,h=(1<<u)-1,c=h>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,m=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(t*l-1)*Math.pow(2,o),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;e[r+f]=255&a,f+=m,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[r+f]=255&s,f+=m,s/=256,u-=8);e[r+f-m]|=128*p}},287:(e,t,r)=>{"use strict";var n=r(526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=l,t.IS=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|p(e,t),n=a(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(F(e,Uint8Array)){var t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);var o=function(e){if(l.isBuffer(e)){var t=0|m(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||$(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return h(e),a(e<0?0:0|m(e))}function d(e){for(var t=e.length<0?0:0|m(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,l.prototype),n}function m(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return P(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(e).length;default:if(o)return n?-1:P(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return _(this,t,r);case"latin1":case"binary":return D(this,t,r);case"base64":return L(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),$(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,n,o){var i,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var h=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===l)return h*s}else-1!==h&&(i-=i-h),h=-1}else for(r+l>a&&(r=a-l),i=r;i>=0;i--){for(var c=!0,d=0;d<l;d++)if(u(e,i+d)!==u(t,d)){c=!1;break}if(c)return i}return-1}function v(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if($(a))return s;e[r+s]=a}return s}function E(e,t,r,n){return W(P(t,e.length-r),e,r,n)}function T(e,t,r,n){return W(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function x(e,t,r,n){return W(H(t),e,r,n)}function S(e,t,r,n){return W(function(e,t){for(var r,n,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function L(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function C(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,l,u=e[o],h=null,c=u>239?4:u>223?3:u>191?2:1;if(o+c<=r)switch(c){case 1:u<128&&(h=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(h=l);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(l=(15&u)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(h=l)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=A));return r}(n)}l.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,r){return function(e,t,r){return h(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},l.allocUnsafe=function(e){return c(e)},l.allocUnsafeSlow=function(e){return c(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=l.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(F(i,Uint8Array))o+i.length>n.length?l.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!l.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},l.byteLength=p,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):g.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,o){if(F(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(n,o),h=e.slice(t,r),c=0;c<a;++c)if(u[c]!==h[c]){i=u[c],s=h[c];break}return i<s?-1:s<i?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return T(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function _(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function D(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function M(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=U[e[i]];return o}function N(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function k(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,r,n,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function R(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,n,i){return t=+t,r>>>=0,i||R(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,i){return t=+t,r>>>=0,i||R(e,0,r,8),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||k(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||k(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||k(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||k(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||k(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||k(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||k(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||k(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||k(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||k(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||I(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||I(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);I(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);I(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=l.isBuffer(e)?e:l.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%a]}return this};var O=/[^+/0-9A-Za-z-_]/g;function P(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function F(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}var U=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()},370:()=>{},526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=a(e),s=i[0],l=i[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,l)),h=0,c=l>0?s-4:s;for(r=0;r<c;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=255&t;return 2===l&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[h++]=255&t),1===l&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=16383,a=0,l=n-o;a<l;a+=s)i.push(u(e,a,a+s>l?l:a+s));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function u(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(l(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},606:e=>{var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],u=!1,h=-1;function c(){u&&a&&(u=!1,a.length?l=a.concat(l):h=-1,l.length&&d())}function d(){if(!u){var e=s(c);u=!0;for(var t=l.length;t;){for(a=l,l=[];++h<t;)a&&a[h].run();h=-1,t=l.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new f(e,t)),1!==l.length||u||s(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},975:(e,t,r)=>{"use strict";var n=r(606);function o(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var r,n="",o=0,i=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(i===a-1||1===s);else if(i!==a-1&&2===s){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),i=a,s=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=a,s=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),o=a-i-1;i=a,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var s={resolve:function(){for(var e,t="",r=!1,s=arguments.length-1;s>=-1&&!r;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=n.cwd()),a=e),o(a),0!==a.length&&(t=a+"/"+t,r=47===a.charCodeAt(0))}return t=i(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(o(e),0===e.length)return".";var t=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return o(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var r=arguments[t];o(r),r.length>0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":s.normalize(e)},relative:function(e,t){if(o(e),o(t),e===t)return"";if((e=s.resolve(e))===(t=s.resolve(t)))return"";for(var r=1;r<e.length&&47===e.charCodeAt(r);++r);for(var n=e.length,i=n-r,a=1;a<t.length&&47===t.charCodeAt(a);++a);for(var l=t.length-a,u=i<l?i:l,h=-1,c=0;c<=u;++c){if(c===u){if(l>u){if(47===t.charCodeAt(a+c))return t.slice(a+c+1);if(0===c)return t.slice(a+c)}else i>u&&(47===e.charCodeAt(r+c)?h=c:0===c&&(h=0));break}var d=e.charCodeAt(r+c);if(d!==t.charCodeAt(a+c))break;47===d&&(h=c)}var f="";for(c=r+h+1;c<=n;++c)c!==n&&47!==e.charCodeAt(c)||(0===f.length?f+="..":f+="/..");return f.length>0?f+t.slice(a+h):(a+=h,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(o(e),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,n=-1,i=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){n=s;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"//":e.slice(0,n)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');o(e);var r,n=0,i=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,l=-1;for(r=e.length-1;r>=0;--r){var u=e.charCodeAt(r);if(47===u){if(!s){n=r+1;break}}else-1===l&&(s=!1,l=r+1),a>=0&&(u===t.charCodeAt(a)?-1===--a&&(i=r):(a=-1,i=l))}return n===i?i=l:-1===i&&(i=e.length),e.slice(n,i)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!s){n=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":e.slice(n,i)},extname:function(e){o(e);for(var t=-1,r=0,n=-1,i=!0,s=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===n&&(i=!1,n=a+1),46===l?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){r=a+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){o(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,n=e.charCodeAt(0),i=47===n;i?(t.root="/",r=1):r=0;for(var s=-1,a=0,l=-1,u=!0,h=e.length-1,c=0;h>=r;--h)if(47!==(n=e.charCodeAt(h)))-1===l&&(u=!1,l=h+1),46===n?-1===s?s=h:1!==c&&(c=1):-1!==s&&(c=-1);else if(!u){a=h+1;break}return-1===s||-1===l||0===c||1===c&&s===l-1&&s===a+1?-1!==l&&(t.base=t.name=0===a&&i?e.slice(1,l):e.slice(a,l)):(0===a&&i?(t.name=e.slice(1,s),t.base=e.slice(1,l)):(t.name=e.slice(a,s),t.base=e.slice(a,l)),t.ext=e.slice(s,l)),a>0?t.dir=e.slice(0,a-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{ColorSafeStringify:()=>F,TinyAfterScrollWatcher:()=>wt,TinyClipboard:()=>Nt,TinyColorConverter:()=>It,TinyDomReadyManager:()=>yt,TinyDragDropDetector:()=>Oe,TinyDragger:()=>gt,TinyEvents:()=>At,TinyHtml:()=>De,TinyIframeEvents:()=>$t,TinyLevelUp:()=>o,TinyLocalStorage:()=>Wt,TinyNewWinEvents:()=>zt,TinyNotifications:()=>bt,TinyNotifyCenter:()=>J,TinyPromiseQueue:()=>$,TinyRateLimiter:()=>U,TinySmartScroller:()=>Dt,TinyTextRangeEditor:()=>Mt,TinyTextarea:()=>Jt,TinyTimeout:()=>Bt,TinyToastNotify:()=>V,UltraRandomMsgGen:()=>Ct,addAiMarkerShortcut:()=>P,areElsCollBottom:()=>re,areElsCollLeft:()=>ne,areElsCollPerfBottom:()=>se,areElsCollPerfLeft:()=>ae,areElsCollPerfRight:()=>le,areElsCollPerfTop:()=>ie,areElsCollRight:()=>oe,areElsCollTop:()=>te,areElsColliding:()=>ue,areElsPerfColliding:()=>he,areHtmlElsColliding:()=>Me,arraySortPositions:()=>i,asyncReplace:()=>t,backupFile:()=>et,checkObj:()=>E,clearDirectory:()=>Ue,clearDirectoryAsync:()=>ut,cloneObjTypeOrder:()=>b,countObj:()=>d,dirExists:()=>Je,dirSize:()=>Ze,dirSizeAsync:()=>mt,documentIsFullScreen:()=>T,ensureCopyFile:()=>qe,ensureDirectory:()=>$e,exitFullScreen:()=>C,extendObjType:()=>g,fetchJson:()=>X,fetchText:()=>Z,fileExists:()=>ze,fileSize:()=>Xe,fileSizeAsync:()=>ft,formatBytes:()=>R,formatCustomTimer:()=>l,formatDayTimer:()=>h,formatTimer:()=>u,genFibonacciSeq:()=>B,getAge:()=>I,getElsCollDetails:()=>be,getElsCollDirDepth:()=>ye,getElsCollOverlap:()=>fe,getElsCollOverlapPos:()=>me,getElsColliding:()=>ce,getElsPerfColliding:()=>de,getElsRelativeCenterOffset:()=>ge,getHtmlElBorders:()=>ke,getHtmlElBordersWidth:()=>Ne,getHtmlElMargin:()=>Ie,getHtmlElPadding:()=>Re,getLatestBackupPath:()=>tt,getPercentage:()=>k,getRectCenter:()=>pe,getSimplePerc:()=>N,getTimeDuration:()=>a,installWindowHiddenScript:()=>ee,isDirEmpty:()=>Ve,isDirEmptyAsync:()=>ht,isFullScreenMode:()=>S,isInViewport:()=>Be,isJsonObject:()=>f,isScreenFilled:()=>x,isScrolledIntoView:()=>je,listDirs:()=>Qe,listDirsAsync:()=>dt,listFiles:()=>Ke,listFilesAsync:()=>ct,objType:()=>v,offFullScreenChange:()=>D,onFullScreenChange:()=>_,readBase64Blob:()=>G,readFileBlob:()=>q,readJsonBlob:()=>Y,readJsonFile:()=>We,renameFileAddPrefixSuffix:()=>it,renameFileBatch:()=>nt,renameFileNormalizeCase:()=>st,renameFilePadNumbers:()=>at,renameFileRegex:()=>ot,reorderObjTypeOrder:()=>y,requestFullScreen:()=>L,restoreLatestBackup:()=>rt,ruleOfThree:()=>M,safeTextTrim:()=>H,saveJsonFile:()=>K,shuffleArray:()=>s,toTitleCase:()=>j,toTitleCaseLowerFirst:()=>O,tryDeleteFile:()=>Ge,writeJsonFile:()=>Fe,writeTextFile:()=>Ye});var e={};async function t(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())}r.r(e),r.d(e,{areElsCollBottom:()=>re,areElsCollLeft:()=>ne,areElsCollPerfBottom:()=>se,areElsCollPerfLeft:()=>ae,areElsCollPerfRight:()=>le,areElsCollPerfTop:()=>ie,areElsCollRight:()=>oe,areElsCollTop:()=>te,areElsColliding:()=>ue,areElsPerfColliding:()=>he,getElsCollDetails:()=>be,getElsCollDirDepth:()=>ye,getElsCollOverlap:()=>fe,getElsCollOverlapPos:()=>me,getElsColliding:()=>ce,getElsPerfColliding:()=>de,getElsRelativeCenterOffset:()=>ge,getRectCenter:()=>pe});const o=class{constructor(e,t){if("number"!=typeof e||Number.isNaN(e))throw new Error("giveExp must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("expLevel must be a valid number");this.giveExp=e,this.expLevel=t}createUser(){return{exp:0,level:1,totalExp:0}}validateUser(e){if("number"!=typeof e.exp||Number.isNaN(e.exp))throw new Error("exp must be a valid number");if("number"!=typeof e.level||Number.isNaN(e.level))throw new Error("level must be a valid number");if(e.level<1)throw new Error("level must be at least 1");if("number"!=typeof e.totalExp||Number.isNaN(e.totalExp))throw new Error("totalExp must be a valid number")}isValidUser(e){return!("number"!=typeof e.exp||Number.isNaN(e.exp)||"number"!=typeof e.level||Number.isNaN(e.level)||e.level<1||"number"!=typeof e.totalExp||Number.isNaN(e.totalExp))}getGiveExpBase(){if("number"!=typeof this.giveExp||Number.isNaN(this.giveExp))throw new Error("giveExp must be a valid number");return this.giveExp}getExpLevelBase(){if("number"!=typeof this.expLevel||Number.isNaN(this.expLevel))throw new Error("expLevel must be a valid number");return this.expLevel}expValidator(e){const t=this.getExpLevelBase();this.validateUser(e);let r=0;const n=t*e.level;return e.exp>=n&&(e.level++,r=e.exp-n,e.exp=0,r>0)?this.give(e,r,"extra"):e.exp<1&&e.level>1&&(e.level--,r=Math.abs(e.exp),e.exp=t*e.level,r>0)?this.remove(e,r,"extra"):e}getTotalExp(e){this.validateUser(e);let t=0;for(let r=1;r<=e.level;r++)t+=this.getExpLevelBase()*r;return t+=e.exp,t}expGenerator(e=1){if("number"!=typeof e||Number.isNaN(e))throw new Error("multi must be a valid number");return Math.floor(Math.random()*this.getGiveExpBase())*e}getMissingExp(e){return this.getProgress(e)-e.exp}progress(e){return this.getProgress(e)}getProgress(e){return this.validateUser(e),this.getExpLevelBase()*e.level}set(e,t){if("number"!=typeof t||Number.isNaN(t))throw new Error("value must be a valid number");return e.exp=t,this.expValidator(e),e.totalExp=this.getTotalExp(e),e}give(e,t=0,r="add",n=1){if("number"!=typeof n||Number.isNaN(n))throw new Error("multi must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("extraExp must be a valid number");if("string"!=typeof r)throw new Error("type must be a valid string");return"add"===r?e.exp+=this.expGenerator(n)+t:"extra"===r&&(e.exp+=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}remove(e,t=0,r="add",n=1){if("number"!=typeof n||Number.isNaN(n))throw new Error("multi must be a valid number");if("number"!=typeof t||Number.isNaN(t))throw new Error("extraExp must be a valid number");if("string"!=typeof r)throw new Error("type must be a valid string");return"add"===r?e.exp-=this.expGenerator(n)+t:"extra"===r&&(e.exp-=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}};function i(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 s(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 a(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 l(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,s=n>=3,a=n>=2,l=n>=1,u=n>=0,h={years:o?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:a?0:NaN,minutes:l?0:NaN,seconds:u?0:NaN,total:NaN};let c=e;if(o||i||s){const e=new Date(1980,0,1),t=new Date(e.getTime()+1e3*c),r=new Date(e);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),h.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),h.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),h.days++;c=Math.floor((t.getTime()-r.getTime())/1e3)}a&&(h.hours=Math.floor(c/3600),c%=3600),l&&(h.minutes=Math.floor(c/60),c%=60),u&&(h.seconds=c);const d={seconds:u?e:NaN,minutes:l?e/60:NaN,hours:a?e/3600:NaN,days:s?e/86400:NaN,months:i?12*h.years+h.months+(h.days||0)/30:NaN,years:o?h.years+(h.months||0)/12+(h.days||0)/365:NaN};h.total=+(d[t]||0).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=[a?f(h.hours):null,l?f(h.minutes):null,u?f(h.seconds):null].filter(e=>null!==e).join(":");return r.replace(/\{years\}/g,String(h.years)).replace(/\{months\}/g,String(h.months)).replace(/\{days\}/g,String(h.days)).replace(/\{hours\}/g,f(h.hours)).replace(/\{minutes\}/g,f(h.minutes)).replace(/\{seconds\}/g,f(h.seconds)).replace(/\{time\}/g,m).replace(/\{total\}/g,String(h.total)).trim()}function u(e){return l(e,"hours","{hours}:{minutes}:{seconds}")}function h(e){return l(e,"days","{days}d {hours}:{minutes}:{seconds}")}var c=r(287);function d(e){return Array.isArray(e)?e.length:f(e)?Object.keys(e).length:0}function f(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e)}const m="undefined"!=typeof window&&void 0!==window.document,p={items:{},order:[]};function g(e,t){const r=[],n=Array.isArray(e)?e:Object.entries(e);for(const[e,o]of n)if(!p.items.hasOwnProperty(e)){p.items[e]=o;let n="number"==typeof t?t:-1;if(-1===n){const e=p.order.indexOf("object");n=e>-1?e:p.order.length}n=Math.min(Math.max(0,n),p.order.length),p.order.splice(n,0,e),r.push(e)}return r}function y(e){const t=[...p.order];return!!e.every(e=>t.includes(e))&&(p.order=e.slice(),!0)}function b(){return[...p.order]}const w=e=>{if(null===e)return"null";for(const t of p.order)if("function"!=typeof p.items[t]||p.items[t](e))return t;return"unknown"};function v(e,t){if(void 0===e)return null;const r=w(e);return"string"==typeof t?r===t.toLowerCase():r}function E(e){const t={valid:null,type:null};for(const r of p.order)if("function"==typeof p.items[r]){const n=p.items[r](e);if(n){t.valid=n,t.type=r;break}}return t}g([["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)]]),m||g([["buffer",e=>void 0!==c.hp&&c.hp.isBuffer(e)]]),m&&g([["file",e=>"undefined"!=typeof File&&e instanceof File]]),g([["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]]),m&&g([["htmlelement",e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement]]),g([["object",e=>f(e)]]);const T=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),x=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,S=()=>T()||x(),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)}}),C=()=>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)}}),A=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],_=(e,t)=>{A.forEach(r=>{document.addEventListener(r,e,t)})},D=(e,t)=>{A.forEach(r=>{document.removeEventListener(r,e,t)})};function M(e,t,r,n=!1){return n?Number(e*t)/r:Number(r*t)/e}function N(e,t){return e*(t/100)}function k(e,t){return 0===t?0:e/t*100}function I(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(),s=r.getMonth(),a=n.getDate(),l=r.getDate();return(i<s||i===s&&a<l)&&o--,Math.abs(o)}return null}function R(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 s=e/Math.pow(1024,i);if(null!==t){const e=t<0?0:t;s=parseFloat(s.toFixed(e))}return{unit:n[i],value:s}}function B({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 j(e){return e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())}function O(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 P(e="a"){"undefined"!=typeof HTMLElement?document.addEventListener("keydown",function(t){if(t.ctrlKey&&t.altKey&&t.key.toLowerCase()===e){if(t.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("detect-made-by-ai")}}):console.error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.")}function H(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}class W{#e;static#t={default:{reset:"[0m",key:"[36m",string:"[32m",string_url:"[34m",string_bool:"[35m",string_number:"[33m",number:"[33m",boolean:"[35m",null:"[1;30m",special:"[31m",func:"[90m"},solarized:{reset:"[0m",key:"[38;5;37m",string:"[38;5;136m",string_url:"[38;5;33m",string_bool:"[38;5;166m",string_number:"[38;5;136m",number:"[38;5;136m",boolean:"[38;5;166m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;244m"},monokai:{reset:"[0m",key:"[38;5;81m",string:"[38;5;114m",string_url:"[38;5;75m",string_bool:"[38;5;204m",string_number:"[38;5;221m",number:"[38;5;221m",boolean:"[38;5;204m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;102m"}};constructor(e={}){this.#e={...W.#t.default,...e}}#r(e,t){const r=[];e=(e=(e=e.replace(/(?<!")\b(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b(?!")/g,`${t.number}$1${t.reset}`)).replace(/"([^"]+)":/g,(e,t)=>{const n=`___KEY${r.length}___`;return r.push({marker:n,key:t}),`${n}:`})).replace(/"(?:\\.|[^"\\])*?"/g,e=>{const r=e.slice(1,-1);return/^(https?|ftp):\/\/[^\s]+$/i.test(r)?`${t.string_url}${e}${t.reset}`:/^(true|false|null)$/.test(r)?`${t.string_bool}${e}${t.reset}`:/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(r)?`${t.string_number}${e}${t.reset}`:`${t.string}${e}${t.reset}`});for(const{marker:n,key:o}of r){const r=new RegExp(n,"g");e=e.replace(r,`${t.key}"${o}"${t.reset}`)}return(e=(e=(e=(e=e.replace(/(?<!")\b(true|false)\b(?!")/g,`${t.boolean}$1${t.reset}`)).replace(/(?<!")\bnull\b(?!")/g,`${t.null}null${t.reset}`)).replace(/\[Circular\]/g,`${t.special}[Circular]${t.reset}`)).replace(/\[undefined\]/g,`${t.special}[undefined]${t.reset}`)).replace(/"function.*?[^\\]"/gs,`${t.func}$&${t.reset}`)}colorize(e,t={}){const r={...this.#e,...t};return this.#r(e,r)}getColors(){return{...this.#e}}updateColors(e){Object.assign(this.#e,e)}resetColors(){this.#e={...W.#t.default}}loadColorPreset(e){const t=W.#t[e];if(!t)throw new Error(`Preset "${e}" not found.`);this.#e={...t}}saveColorPreset(e,t){W.#t[e]={...t}}getAvailablePresets(){return Object.keys(W.#t)}}const F=W,$=class{#n=[];#o=!1;#i={};#s=new Set;isRunning(){return this.#o}async#a(e){if(e&&"function"==typeof e.task&&"function"==typeof e.resolve&&"function"==typeof e.reject){const{task:t,resolve:r,reject:n,delay:o,id:i}=e;try{if(i&&this.#s.has(i))return n(new Error("The function was canceled on TinyPromiseQueue.")),this.#s.delete(i),this.#o=!1,void this.#l();o&&i&&await new Promise(e=>{const t=setTimeout(()=>{delete this.#i[i],e(null)},o);this.#i[i]=t}),r(await t())}catch(e){n(e)}finally{this.#o=!1,this.#l()}}}async#u(){const e=[];for(;this.#n.length&&"POINT_MARKER"===this.#n[0]?.marker;)e.push(this.#n.shift());if(0===e.length)return this.#o=!1,void this.#l();await Promise.all(e.map(({task:e,resolve:t,reject:r,id:n})=>new Promise(async o=>{if(n&&this.#s.has(n))return this.#s.delete(n),r(new Error("The function was canceled on TinyPromiseQueue.")),void o(!0);await e().then(t).catch(r),o(!0)}))),this.#o=!1,this.#l()}async#l(){if(!this.#o&&0!==this.#n.length)if(this.#o=!0,"string"!=typeof this.#n[0]?.marker||"POINT_MARKER"!==this.#n[0]?.marker){const e=this.#n.shift();this.#a(e)}else this.#u()}getIndexById(e){return this.#n.findIndex(t=>t.id===e)}getQueuedIds(){return this.#n.map((e,t)=>({index:t,id:e.id})).filter(e=>"string"==typeof e.id)}reorderQueue(e,t){if("number"!=typeof e||"number"!=typeof t||e<0||t<0||e>=this.#n.length||t>=this.#n.length)return;const[r]=this.#n.splice(e,1);this.#n.splice(t,0,r)}async enqueuePoint(e,t){if("function"!=typeof e)return Promise.reject(new Error("Task must be a function returning a Promise."));if(void 0!==t&&"string"!=typeof t)throw new Error('The "id" parameter must be a string.');return this.#o?new Promise((r,n)=>{this.#n.push({marker:"POINT_MARKER",task:e,resolve:r,reject:n,id:t}),this.#l()}):e()}enqueue(e,t,r){if("function"!=typeof e)return Promise.reject(new Error("Task must be a function returning a Promise."));if(void 0!==t&&("number"!=typeof t||t<0))return Promise.reject(new Error("Delay must be a positive number or undefined."));if(void 0!==r&&"string"!=typeof r)throw new Error('The "id" parameter must be a string.');return new Promise((n,o)=>{this.#n.push({task:e,resolve:n,reject:o,id:r,delay:t}),this.#l()})}cancelTask(e){if("string"!=typeof e)throw new Error('The "id" parameter must be a string.');let t=!1;e in this.#i&&(clearTimeout(this.#i[e]),delete this.#i[e],t=!0);const r=this.getIndexById(e);if(-1!==r){const[e]=this.#n.splice(r,1);e?.reject?.(new Error("The function was canceled on TinyPromiseQueue.")),t=!0}return t&&this.#s.add(e),t}},U=class{#h=null;#c=null;#d=null;#f=null;#m=null;#p=null;groupData=new Map;lastSeen=new Map;userToGroup=new Map;groupFlags=new Map;groupTTL=new Map;#g=null;setOnMemoryExceeded(e){if("function"!=typeof e)throw new Error("onMemoryExceeded must be a function");this.#g=e}clearOnMemoryExceeded(){this.#g=null}#y=null;setOnGroupExpired(e){if("function"!=typeof e)throw new Error("onGroupExpired must be a function");this.#y=e}clearOnGroupExpired(){this.#y=null}constructor({maxHits:e,interval:t,cleanupInterval:r,maxIdle:n=3e5,maxMemory:o=1e5}){const i=e=>"number"==typeof e&&Number.isFinite(e)&&e>=1&&Number.isInteger(e),s=i(e),a=i(t),l=i(r),u=i(n);if(!s&&!a)throw new Error("RateLimiter requires at least one valid option: 'maxHits' or 'interval'.");if(void 0!==e&&!s)throw new Error("'maxHits' must be a positive integer if defined.");if(void 0!==t&&!a)throw new Error("'interval' must be a positive integer in milliseconds if defined.");if(void 0!==r&&!l)throw new Error("'cleanupInterval' must be a positive integer in milliseconds if defined.");if(!u)throw new Error("'maxIdle' must be a positive integer in milliseconds.");if("number"==typeof o&&Number.isFinite(o)&&o>0)this.#h=Math.floor(o);else{if(null!=o)throw new Error("maxMemory must be a positive number or null");this.#h=null}this.#d=s?e:null,this.#f=a?t:null,this.#m=l?r:null,this.#p=n,null!==this.#m&&(this.#c=setInterval(()=>this._cleanup(),this.#m))}isGroupId(e){const t=this.groupFlags.get(e);return"boolean"==typeof t&&t}getUsersInGroup(e){const t=[];for(const[r,n]of this.userToGroup.entries())n===e&&t.push(r);return t}setGroupTTL(e,t){if("number"!=typeof t||!Number.isFinite(t)||t<=0)throw new Error("TTL must be a positive number in milliseconds");this.groupTTL.set(e,t)}getGroupTTL(e){return this.groupTTL.get(e)??null}deleteGroupTTL(e){this.groupTTL.delete(e)}assignToGroup(e,t){const r=this.userToGroup.get(e);if(r&&r!==t)throw new Error(`User ${e} is already assigned to group ${r}`);if(r===t)return;const n=this.groupData.get(e);if(this.isGroupId(e)){for(const[r,n]of this.userToGroup.entries())n===e&&this.userToGroup.set(r,t);this.userToGroup.delete(e)}else this.userToGroup.set(e,t);if(!n)return;const o=this.groupData.get(t);if(o)for(const e of n)o.push(e);else{const e=[];for(const t of n)e.push(t);this.groupData.set(t,e)}this.lastSeen.set(t,Date.now()),this.groupFlags.delete(e),this.groupData.delete(e),this.lastSeen.delete(e),this.groupTTL.delete(e),this.groupFlags.set(t,!0)}getGroupId(e){return this.userToGroup.get(e)||e}hit(e){const t=this.getGroupId(e),r=Date.now();this.groupData.has(t)||(this.groupData.set(t,[]),this.groupFlags.set(t,!1));const n=this.groupData.get(t);if(!n)throw new Error(`No data found for groupId: ${t}`);if(n.push(r),this.lastSeen.set(t,r),null!==this.#f){const e=r-this.getInterval();for(;n.length&&n[0]<e;)n.shift()}null!==this.#h&&"number"==typeof this.#h&&n.length>this.#h&&(n.splice(0,n.length-this.#h),"function"==typeof this.#g&&this.#g(t))}isRateLimited(e){const t=this.getGroupId(e);if(!this.groupData.has(t))return!1;const r=this.groupData.get(t);if(!r)throw new Error(`No data found for groupId: ${t}`);if(null!==this.#f){const e=Date.now()-this.getInterval();let t=0;for(let n=r.length-1;n>=0&&r[n]>e;n--)t++;return null!==this.#d?t>this.getMaxHits():t>0}return null!==this.#d&&r.length>this.getMaxHits()}resetGroup(e){this.groupFlags.delete(e),this.groupData.delete(e),this.lastSeen.delete(e),this.groupTTL.delete(e)}reset(e){return this.resetUserGroup(e)}resetUserGroup(e){this.userToGroup.delete(e)}setData(e,t){if(!Array.isArray(t))throw new Error("timestamps must be an array of numbers.");for(const e of t)if("number"!=typeof e||!Number.isFinite(e))throw new Error("All timestamps must be finite numbers.");this.groupData.has(e)||this.groupFlags.set(e,!1),this.groupData.set(e,t),this.lastSeen.set(e,Date.now())}hasData(e){return this.groupData.has(e)}getData(e){return this.groupData.get(e)||[]}getMaxIdle(){if("number"!=typeof this.#p||!Number.isFinite(this.#p)||this.#p<0)throw new Error("'maxIdle' must be a non-negative finite number.");return this.#p}setMaxIdle(e){if("number"!=typeof e||!Number.isFinite(e)||e<0)throw new Error("'maxIdle' must be a non-negative finite number.");this.#p=e}_cleanup(){const e=Date.now();for(const[t,r]of this.lastSeen.entries())e-r>(this.getGroupTTL(t)??this.getMaxIdle())&&(this.groupFlags.delete(t),this.groupData.delete(t),this.lastSeen.delete(t),this.groupTTL.delete(t),"function"==typeof this.#y&&this.#y(t))}getActiveGroups(){return Array.from(this.groupData.keys())}getAllUserMappings(){return Object.fromEntries(this.userToGroup)}getInterval(){if("number"!=typeof this.#f||!Number.isFinite(this.#f))throw new Error("'interval' is not a valid finite number.");return this.#f}getMaxHits(){if("number"!=typeof this.#d||!Number.isFinite(this.#d))throw new Error("'maxHits' is not a valid finite number.");return this.#d}getTotalHits(e){const t=this.groupData.get(e);return Array.isArray(t)?t.length:0}getLastHit(e){const t=this.groupData.get(e);return t?.length?t[t.length-1]:null}getTimeSinceLastHit(e){const t=this.getLastHit(e);return null!==t?Date.now()-t:null}_calculateAverageSpacing(e){if(!Array.isArray(e)||e.length<2)return null;let t=0;for(let r=1;r<e.length;r++)t+=e[r]-e[r-1];return t/(e.length-1)}getAverageHitSpacing(e){return this._calculateAverageSpacing(this.groupData.get(e))}getMetrics(e){const t=this.groupData.get(e);if(!Array.isArray(t)||0===t.length)return{totalHits:0,lastHit:null,timeSinceLastHit:null,averageHitSpacing:null};const r=t.length,n=t[r-1];return{totalHits:r,lastHit:n,timeSinceLastHit:Date.now()-n,averageHitSpacing:this._calculateAverageSpacing(t)}}destroy(){this.#c&&clearInterval(this.#c),this._cleanup(),this.groupData.clear(),this.lastSeen.clear(),this.userToGroup.clear(),this.groupTTL.clear(),this.groupFlags.clear()}};class z{static getTemplate(){return'\n<div class="notify-overlay hidden">\n <div class="notify-center" id="notifCenter">\n <div class="header">\n <div>Notifications</div>\n <div class="options">\n <button class="clear-all" type="button">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 24 24"\n width="24"\n height="24"\n fill="currentColor"\n >\n <path\n d="M21.6 2.4a1 1 0 0 0-1.4 0L13 9.6l-1.3-1.3a1 1 0 0 0-1.4 0L3 15.6a1 1 0 0 0 0 1.4l4 4a1 1 0 0 0 1.4 0l7.3-7.3a1 1 0 0 0 0-1.4l-1.3-1.3 7.2-7.2a1 1 0 0 0 0-1.4zM6 17l3.5-3.5 1.5 1.5L7.5 18.5 6 17z"\n />\n </svg>\n </button>\n <button class="close">×</button>\n </div>\n </div>\n <div class="list"></div>\n </div>\n</div>\n\n<button class="notify-bell" aria-label="Open notifications">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="20"\n height="20"\n fill="currentColor"\n viewBox="0 0 24 24"\n >\n <path\n d="M12 2C10.3 2 9 3.3 9 5v1.1C6.7 7.2 5 9.4 5 12v5l-1 1v1h16v-1l-1-1v-5c0-2.6-1.7-4.8-4-5.9V5c0-1.7-1.3-3-3-3zm0 20c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2z"\n />\n </svg>\n <span class="badge" id="notifBadge">0</span>\n</button>\n '}static insertTemplate(e="afterbegin"){document.body.insertAdjacentHTML(e,z.getTemplate())}#b;#w;#v;#E;#T;#x=0;#S=99;#L=300;#C=!1;#A=new WeakMap;#_(e){if(this.#A.delete(e),!(e instanceof HTMLElement))throw new Error("Invalid HTMLElement to clear.");e.classList.add("removing"),setTimeout(()=>{this.markAsRead(e),e.remove()},this.#L)}#D(e){this.#x=Math.max(0,e),this.#v.setAttribute("data-value",String(this.#x)),this.#v.textContent=this.#x>this.#S?`${this.#S}+`:String(this.#x)}constructor(e={}){const{center:t=document.getElementById("notifCenter"),badge:r=document.getElementById("notifBadge"),button:n=document.querySelector(".notify-bell"),overlay:o=document.querySelector(".notify-overlay")}=e;if(!(t instanceof HTMLElement))throw new Error(`NotificationCenter: "center" must be an HTMLElement. Got: ${t}`);if(!(o instanceof HTMLElement))throw new Error(`NotificationCenter: "overlay" must be an HTMLElement. Got: ${o}`);if(!(r instanceof HTMLElement))throw new Error(`NotificationCenter: "badge" must be an HTMLElement. Got: ${r}`);if(!(n instanceof HTMLElement))throw new Error(`NotificationCenter: "button" must be an HTMLElement. Got: ${n}`);const i=t?.querySelector(".clear-all"),s=t?.querySelector(".list")??null;if(!(s instanceof HTMLElement))throw new Error(`NotificationCenter: ".list" inside center must be an HTMLElement. Got: ${s}`);this.#b=t,this.#w=s,this.#v=r,this.#E=n,this.#T=o,this.#E.addEventListener("click",()=>this.toggle()),this.#b.querySelector(".close")?.addEventListener("click",()=>this.close()),i&&i.addEventListener("click",()=>this.clear()),this.#T.addEventListener("click",e=>{e.target===this.#T&&this.close()})}setMarkAllAsReadOnClose(e){if("boolean"!=typeof e)throw new TypeError("Expected boolean for markAllAsReadOnClose, got "+typeof e);this.#C=e}setRemoveDelay(e){if("number"!=typeof e)throw new Error('NotificationCenter: "ms" must be an number.');this.#L=e}getItemMode(e){const t=this.getItem(e);return t?this.#A.get(t):null}getItem(e){const t=this.#w.children.item(e);if(!(t instanceof HTMLElement))throw new Error(`NotificationCenter: "item" must be an HTMLElement. Got: ${t}`);return t}hasItem(e){return e>=0&&e<this.#w.children.length}markAsRead(e){const t=e instanceof HTMLElement?e:this.getItem(e);t.classList.contains("unread")&&(t.classList.remove("unread"),this.#D(this.#x-1))}add(e,t="text"){const r=document.createElement("div");r.className="item unread";let n=null,o=null,i=null,s=null;if("object"==typeof e&&null!==e?(n=e.title,o=e.message,i=e.avatar,s=e.onClick):o=e,i){const e=document.createElement("div");e.className="avatar",e.style.backgroundImage=`url("${i}")`,r.appendChild(e)}const a=document.createElement("div");if(a.className="content",n){const e=document.createElement("div");e.className="title",e.textContent=n,a.appendChild(e)}const l=document.createElement("div");l.className="message","html"===t?l.innerHTML=o:l.textContent=o,a.appendChild(l),"function"==typeof s&&(r.classList.add("clickable"),r.addEventListener("click",e=>{e.target instanceof HTMLElement&&!e.target.closest(".notify-close")&&s(e)}));const u=document.createElement("button");u.className="notify-close",u.setAttribute("type","button"),u.innerHTML="×",u.addEventListener("click",e=>{e.stopPropagation(),this.#_(r)}),r.append(a,u),this.#w.prepend(r),this.#A.set(r,t),this.#D(this.#x+1)}remove(e){const t=this.getItem(e);this.#_(t)}clear(){let e=!0;for(;e;){e=!1;const t=Array.from(this.#w.children);for(const r of t)r instanceof HTMLElement&&!r.classList.contains("removing")&&(this.#_(r),e=!0)}}open(){this.#T.classList.remove("hidden"),this.#b.classList.add("open")}close(){if(this.#T.classList.add("hidden"),this.#b.classList.remove("open"),this.#C){const e=this.#w.querySelectorAll(".item.unread");for(const t of e)t instanceof HTMLElement&&this.markAsRead(t)}}toggle(){this.#b.classList.contains("open")?this.close():this.open()}recount(){const e=this.#w.querySelectorAll(".item.unread").length;this.#D(e)}get count(){return this.#x}destroy(){this.#E?.removeEventListener("click",this.toggle),this.#b?.querySelector(".close")?.removeEventListener("click",this.close),this.#b?.querySelector(".clear-all")?.removeEventListener("click",this.clear),this.#T?.removeEventListener("click",this.close),this.clear(),this.#b?.remove(),this.#T?.remove(),this.#E?.remove(),this.#x=0,this.#A=new WeakMap}}const J=z,V=class{#M;#N;#k;#I;#R;#B;constructor(e="top",t="right",r=3e3,n=50,o=300,i=".notify-container"){this.#j(e),this.#O(t),this.#P(r,"baseDuration"),this.#P(n,"extraPerChar"),this.#P(o,"fadeOutDuration"),this.#M=e,this.#N=t,this.#k=r,this.#I=n,this.#R=o;const s=document.querySelector(`${i}.${e}.${t}`);s instanceof HTMLElement?this.#B=s:(this.#B=document.createElement("div"),this.#B.className=`notify-container ${e} ${t}`,document.body.appendChild(this.#B))}getContainer(){if(!(this.#B instanceof HTMLElement))throw new Error("Container is not a valid HTMLElement.");return this.#B}#j(e){if(!["top","bottom"].includes(e))throw new Error(`Invalid vertical direction "${e}". Expected "top" or "bottom".`)}#O(e){if(!["left","right","center"].includes(e))throw new Error(`Invalid horizontal position "${e}". Expected "left", "right" or "center".`)}#P(e,t){if("number"!=typeof e||e<0||!Number.isFinite(e))throw new Error(`Invalid value for "${t}": ${e}. Must be a non-negative finite number.`)}getY(){return this.#M}setY(e){this.#j(e);const t=this.getContainer();t.classList.remove(this.#M),t.classList.add(e),this.#M=e}getX(){return this.#N}setX(e){this.#O(e);const t=this.getContainer();t.classList.remove(this.#N),t.classList.add(e),this.#N=e}getBaseDuration(){return this.#k}setBaseDuration(e){this.#P(e,"baseDuration"),this.#k=e}getExtraPerChar(){return this.#I}setExtraPerChar(e){this.#P(e,"extraPerChar"),this.#I=e}getFadeOutDuration(){return this.#R}setFadeOutDuration(e){this.#P(e,"fadeOutDuration"),this.#R=e}show(e){let t="",r="",n=null,o=!1,i=null;const s=document.createElement("div");if(s.className="notify enter","string"==typeof e)t=e;else{if("object"!=typeof e||null===e||"string"!=typeof e.message)throw new Error("Invalid argument for show(): expected string or { message: string, title?: string, onClick?: function, html?: boolean, avatar?: string }");if(t=e.message,r="string"==typeof e.title?e.title:"",o=!0===e.html,i="string"==typeof e.avatar?e.avatar:null,void 0!==e.onClick){if("function"!=typeof e.onClick)throw new Error("onClick must be a function if defined");n=e.onClick,s.classList.add("clickable")}}const a=document.createElement("button");if(a.innerHTML="×",a.className="close",a.setAttribute("aria-label","Close"),a.addEventListener("mouseenter",()=>{a.style.color="var(--notif-close-color-hover)"}),a.addEventListener("mouseleave",()=>{a.style.color="var(--notif-close-color)"}),i){const e=document.createElement("img");e.src=i,e.alt="avatar",e.className="avatar",s.appendChild(e)}if(r){const e=document.createElement("strong");e.textContent=r,e.style.display="block",s.appendChild(e)}if(o){const e=document.createElement("div");e.innerHTML=t,s.appendChild(e)}else s.appendChild(document.createTextNode(t));s.appendChild(a),this.getContainer().appendChild(s);const l=this.#k+t.length*this.#I+this.#R;let u=!1;const h=()=>{u||(u=!0,s.classList.remove("enter","show"),s.classList.add("exit"),setTimeout(()=>s.remove(),this.#R))};"function"==typeof n&&s.addEventListener("click",e=>{e.target!==a&&n(e,h)}),a.addEventListener("click",e=>{e.stopPropagation(),h()}),setTimeout(()=>{s.classList.remove("enter"),s.classList.add("show")},1),setTimeout(()=>h(),l)}destroy(){this.#B instanceof HTMLElement&&(this.#B.querySelectorAll(".notify").forEach(e=>e.remove()),this.#B.parentNode&&this.#B.parentNode.removeChild(this.#B),this.#B=null)}};function q(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 G(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.")),q(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 Y(e){return new Promise((t,r)=>q(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 K(e,t,r=2){const n=JSON.stringify(t,null,r),o=new Blob([n],{type:"application/json"}),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}async function Q(e,{method:t="GET",body:r,timeout:n=0,retries:o=0,headers:i={},signal:s=null}={}){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(!s){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 a=s?1:o+1;let l=null;for(let u=0;u<a;u++){const a=s?null:new AbortController,h=s||(a?.signal??null),c=!s&&n&&a?setTimeout(()=>a.abort(),n):null;try{const n=await fetch(e,{method:t.toUpperCase(),headers:{Accept:"application/json",...i},body:void 0!==r?f(r)?JSON.stringify(r):r:void 0,signal:h});if(c&&clearTimeout(c),!n.ok)throw new Error(`HTTP error: ${n.status} ${n.statusText}`);return n}catch(e){if(l=e,s)break;u<o&&await new Promise(e=>setTimeout(e,300*(u+1)))}}throw new Error(`Failed to fetch JSON from "${e}"${l?`: ${l.message}`:"."}`)}async function X(e,t){return new Promise((r,n)=>{Q(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)&&!f(n))throw new Error("Received invalid data instead of valid JSON.");return r(n)}).catch(n)})}async function Z(e,t,r){return new Promise((n,o)=>{Q(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 ee({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="",s="";const a=()=>{e.classList.remove(t),e.classList.remove(r)};let l=null;const u=["visibilitychange","mozvisibilitychange","webkitvisibilitychange","msvisibilitychange"],h=["hidden","mozHidden","webkitHidden","msHidden"];for(let e=0;e<h.length;e++)if(h[e]in document){l=h[e];break}const c=function(u){a();const h=u?.type,c=l&&document[l];["focus","focusin","pageshow"].includes(h)?(e.classList.add(r),n?.({type:h,oldClass:s,oldType:i}),s=r):["blur","focusout","pagehide"].includes(h)||c?(e.classList.add(t),o?.({type:h,oldClass:s,oldType:i}),s=t):(e.classList.add(r),n?.({type:h,oldClass:s,oldType:i}),s=r),i=h};let d=()=>{};if(l){const e=u[h.indexOf(l)];document.addEventListener(e,c),window.addEventListener("focus",c),window.addEventListener("blur",c),d=()=>{document.removeEventListener(e,c),window.removeEventListener("focus",c),window.removeEventListener("blur",c),a()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=c,d=()=>{document.onfocusin=document.onfocusout=null,a()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=c,d=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,a()});const f=new Event(l&&document[l]?"blur":"focus");return c(f),d}const 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)=>e.bottom<=t.top,se=(e,t)=>e.top>=t.bottom,ae=(e,t)=>e.right<=t.left,le=(e,t)=>e.left>=t.right,ue=(e,t)=>!(ne(e,t)||oe(e,t)||te(e,t)||re(e,t)),he=(e,t)=>!(ae(e,t)||le(e,t)||ie(e,t)||se(e,t)),ce=(e,t)=>ne(e,t)?"left":oe(e,t)?"right":te(e,t)?"top":re(e,t)?"bottom":null,de=(e,t)=>ae(e,t)?"left":le(e,t)?"right":ie(e,t)?"top":se(e,t)?"bottom":null,fe=(e,t)=>({overlapLeft:t.right-e.left,overlapRight:e.right-t.left,overlapTop:t.bottom-e.top,overlapBottom:e.bottom-t.top}),me=({overlapLeft:e=-1,overlapRight:t=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:e<t?"right":"left",dirY:r<n?"bottom":"top"}),pe=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function ge(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 ye(e,t){if(!he(e,t))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=fe(e,t),{dirX:s,dirY:a}=me({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),l=Math.min(r,n),u=Math.min(o,i);let h;return h=l<u?s:a,{inDir:h,dirX:s,dirY:a,depthX:l,depthY:u}}function be(e,t){const r=he(e,t),n={in:null,x:null,y:null},o={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:s,overlapRight:a,overlapTop:l,overlapBottom:u}=fe(t,e);i.top=l,i.bottom=u,i.left=s,i.right=a;const h=Object.entries(i).filter(([,e])=>e>0).sort((e,t)=>e[1]-t[1]),{dirX:c,dirY:d}=me({overlapLeft:a,overlapRight:s,overlapTop:u,overlapBottom:l});return n.y=d,n.x=c,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":h.length?h[0][0]:"top":null,{dirs:n,depth:i,isNeg:o}}const{areElsColliding:we,areElsPerfColliding:ve,areElsCollTop:Ee,areElsCollBottom:Te,areElsCollLeft:xe,areElsCollRight:Se}=e,Le=new WeakMap,Ce=new WeakMap,Ae={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class _e{static Utils={...e};static async fetchHtmlFile(e,t={method:"GET"}){const r=await fetch(e,t),n=r.headers.get("Content-Type")||"";if(!r.ok)throw new Error(`Failed to fetch: ${r.status} ${r.statusText}`);if(!n.includes("text/html"))throw new Error(`Invalid content type: ${n} (expected text/html)`);const o=await r.text();return _e.htmlToJson(o)}static async fetchHtmlNodes(e,t){const r=await _e.fetchHtmlFile(e,t);return _e.jsonToNodes(r)}static async fetchHtmlTinyElems(e,t){const r=await _e.fetchHtmlNodes(e,t);return _e.toTinyElm(r)}static templateToJson(e){return _e.htmlToJson([...e.content.childNodes].map(e=>e instanceof Element?e.getHTML():e instanceof Text?e.textContent:"").join(""))}static templateToNodes(e){const t=[];return[...e.content.cloneNode(!0).childNodes].map(e=>{if(!(e instanceof Element||e instanceof Text||e instanceof Comment))throw new Error(`Expected only Element nodes in <template>, but found: ${e.constructor.name}`);e instanceof Comment||t.push(e)}),t}static templateToTinyElems(e){return _e.toTinyElm(_e.templateToNodes(e))}static htmlToJson(e){const t=document.createElement("div");t.innerHTML=e.trim();const r=[],n=e=>{if(e instanceof Comment)return null;if(e instanceof Text){const t=e.textContent?.trim();return t||null}if(!(e instanceof Element))return null;const t=e.tagName.toLowerCase(),r={};for(const t of e.attributes)r[_e.getPropName(t.name)]=t.value;const o=Array.from(e.childNodes).map(n).filter(Boolean);return o.length>0?[t,r,...o]:[t,r]};for(const e of t.childNodes){const t=n(e);t&&r.push(t)}return t.innerHTML="",r}static jsonToNodes(e){const t=e=>{if("string"==typeof e)return document.createTextNode(e);if(!Array.isArray(e))return document.createTextNode("");const[r,n,...o]=e,i=document.createElement(r);for(const[e,t]of Object.entries(n))i.setAttribute(_e.getAttrName(e),t);for(const e of o){const r=t(e);r instanceof Comment||i.appendChild(r)}return i};return e.map(t).filter(e=>!(e instanceof Comment))}static jsonToTinyElems(e){return _e.toTinyElm(_e.jsonToNodes(e))}static createFrom(e,t){if("string"!=typeof e)throw new TypeError('The "tagName" must be a string.');if(void 0!==t&&"object"!=typeof t)throw new TypeError('The "attrs" must be a object.');const r=_e.createElement(e);if("object"==typeof t)for(const e in t)r.setAttr(e,t[e]);return r}static createElement(e,t){if("string"!=typeof e)throw new TypeError("[TinyHtml] createElement(): The tagName must be a string.");if(void 0!==t&&"object"!=typeof t)throw new TypeError("[TinyHtml] createElement(): The ops must be a object.");return new _e(document.createElement(e,t))}static createTextNode(e){if("string"!=typeof e)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new _e(document.createTextNode(e))}static createElementFromHTML(e){const t=document.createElement("template");if(!(e=e.trim()).startsWith("<"))return _e.createTextNode(e);if(t.innerHTML=e,!(t.content.firstChild instanceof Element))throw new Error("The HTML string must contain a valid HTML element.");return new _e(t.content.firstChild)}static query(e,t=document){const r=t.querySelector(e);return r?new _e(r):null}querySelector(e){return _e.query(e,_e._preElem(this,"query"))}static queryAll(e,t=document){return new _e(t.querySelectorAll(e))}querySelectorAll(e){return _e.queryAll(e,_e._preElem(this,"queryAll"))}static getById(e){const t=document.getElementById(e);return t?new _e(t):null}static getByClassName(e,t=document){return new _e(t.getElementsByClassName(e))}getElementsByClassName(e){return _e.getByClassName(e,_e._preElem(this,"getByClassName"))}static getByName(e){return new _e(document.getElementsByName(e))}static getByTagNameNS(e,t="http://www.w3.org/1999/xhtml",r=document){return new _e(r.getElementsByTagNameNS(t,e))}getElementsByTagNameNS(e,t="http://www.w3.org/1999/xhtml"){return _e.getByTagNameNS(e,t,_e._preElem(this,"getByTagNameNS"))}get(e){if("number"!=typeof e)throw new TypeError("The index must be a number.");if(!this.#H[e])throw new Error(`No element found at index ${e}.`);return this.#H[e]}extract(e){if("number"!=typeof e)throw new TypeError("The index must be a number.");if(!this.#H[e])throw new Error(`Cannot extract: no element exists at index ${e}.`);return new _e(this.#H[e])}exists(e){if("number"!=typeof e)throw new TypeError("The index must be a number.");return!!this.#H[e]}getAll(){return[...this.#H]}_getElement(e,t){if(!(this.#H[t]instanceof Element||this.#H[t]instanceof Window||this.#H[t]instanceof Document||this.#H[t]instanceof Text))throw new Error(`[TinyHtml] Invalid Element in ${e}().`);return this.#H[t]}_getElements(e){if(!this.#H.every(e=>e instanceof Element||e instanceof Window||e instanceof Document||e instanceof Text))throw new Error(`[TinyHtml] Invalid Element in ${e}().`);return[...this.#H]}static _preElemsTemplate(e,t,r,n){const o=e=>{const o=[];return e.map(e=>(e instanceof _e?e._getElements(t):[e]).map(e=>{let i=!1;for(const t of r)if(e instanceof t){i=!0;break}if(!i)throw new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return o.push(e),e})),o};return Array.isArray(e)?o(e):o([e])}static _preElemTemplate(e,t,r,n,o=!1){const i=e=>{const i=e[0],s=i instanceof _e?i._getElements(t):[i];if(s.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${t}() (Received ${s.length}/1).`);let a=!1;for(const e of r)if(s[0]instanceof e){a=!0;break}if(!o||null!==s[0]&&void 0!==s[0]||(s[0]=null,a=!0),!a)throw new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return s[0]};if(!Array.isArray(e))return i([e]);if(e.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${t}() (Received ${e.length}/1).`);return i(e)}static _preElems(e,t){return _e._preElemsTemplate(e,t,[Element],["Element"])}static _preElem(e,t){return _e._preElemTemplate(e,t,[Element],["Element"])}static _preNodeElems(e,t){return _e._preElemsTemplate(e,t,[Node],["Node"])}static _preNodeElem(e,t){return _e._preElemTemplate(e,t,[Node],["Node"])}static _preNodeElemWithNull(e,t){return _e._preElemTemplate(e,t,[Node],["Node"],!0)}static _preHtmlElems(e,t){return _e._preElemsTemplate(e,t,[HTMLElement],["HTMLElement"])}static _preHtmlElem(e,t){return _e._preElemTemplate(e,t,[HTMLElement],["HTMLElement"])}static _preInputElems(e,t){return _e._preElemsTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preInputElem(e,t){return _e._preElemTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preEventTargetElems(e,t){return _e._preElemsTemplate(e,t,[EventTarget],["EventTarget"])}static _preEventTargetElem(e,t){return _e._preElemTemplate(e,t,[EventTarget],["EventTarget"])}static _preElemsAndWindow(e,t){return _e._preElemsTemplate(e,t,[Element,Window],["Element","Window"])}static _preElemAndWindow(e,t){return _e._preElemTemplate(e,t,[Element,Window],["Element","Window"])}static _preElemsAndWinAndDoc(e,t){return _e._preElemsTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]).map(e=>e instanceof Document?e.documentElement:e)}static _preElemAndWinAndDoc(e,t){const r=_e._preElemTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}static _preElemsWithDoc(e,t){return _e._preElemsTemplate(e,t,[Element,Document],["Element","Document"])}static _preElemWithDoc(e,t){return _e._preElemTemplate(e,t,[Element,Document],["Element","Document"])}static toTinyElm(e){const t=e=>e.map(e=>e instanceof _e?e:new _e(e));return Array.isArray(e)?t(e):t([e])}static fromTinyElm(e){const t=e=>{const t=[];return e.map(e=>(e instanceof _e?e._getElements("fromTinyElm"):[e]).map(e=>t.push(e))),t};return Array.isArray(e)?t(e):t([e])}static winnow(e,t,r,n=!1){if("boolean"!=typeof n)throw new TypeError('The "not" must be a boolean.');if("function"==typeof t)return _e._preElems(e,r).filter((e,r)=>!!t.call(e,r,e)!==n);if(t instanceof Element)return _e._preElems(e,r).filter(e=>e===t!==n);if(Array.isArray(t)||"string"!=typeof t&&null!=t.length)return _e._preElems(e,r).filter(e=>t.includes(e)!==n);let o=t;return n&&(o=`:not(${o})`),_e._preElems(e,r).filter(e=>1===e.nodeType&&e.matches(o))}static filter(e,t,r=!1){return r&&(t=`:not(${t})`),_e._preElems(e,"filter").filter(e=>1===e.nodeType&&e.matches(t))}static filterOnly(e,t){return _e.winnow(e,t,"filterOnly",!1)}static not(e,t){return _e.winnow(e,t,"not",!0)}not(e){return _e.not(this,e)}static find(e,t){const r=[];for(const n of _e._preElems(e,"find"))r.push(...n.querySelectorAll(t));return[...new Set(r)]}find(e){return _e.find(this,e)}static is(e,t){return _e.winnow(e,t,"is",!1).length>0}is(e){return _e.is(this,e)}static has(e,t){const r="string"==typeof t?[...document.querySelectorAll(t)]:_e._preElems(t,"has");return _e._preElems(e,"has").filter(e=>r.some(t=>e&&e.contains(t)))}has(e){return _e.has(this,e).length>0}static closest(e,t,r){const n=[];for(const o of _e._preElems(e,"closest")){let e=o;for(;e&&e!==r;){if(1===e.nodeType&&("string"==typeof t?e.matches(t):e===t)){n.push(e);break}e=e.parentElement}}return[...new Set(n)]}closest(e,t){return _e.closest(this,e,t)}static isSameDom(e,t){return _e._preNodeElem(e,"isSameDom")===_e._preNodeElem(t,"isSameDom")}isSameDom(e){return _e.isSameDom(this,e)}_data={};static _dataSelector={public:(e,t)=>{const r=_e._preElem(t,e);let n=Ce.get(r);return n||(n={},Ce.set(r,n)),n},private:(e,t)=>{if(!(t instanceof _e))throw new Error(`Element must be a TinyHtml instance to execute ${e}().`);return t._data}};static data(e,t,r=!1){const n=_e._dataSelector[r?"private":"public"]("data",e);if(null==t)return{...n};if("string"!=typeof t)throw new TypeError("The key must be a string.");return n.hasOwnProperty(t)?n[t]:void 0}data(e,t){return _e.data(this,e,t)}static setData(e,t,r,n=!1){const o=_e._dataSelector[n?"private":"public"]("setData",e);if("string"!=typeof t)throw new TypeError("The key must be a string.");return o[t]=r,e}setData(e,t,r=!1){return _e.setData(this,e,t,r)}static _getSibling(e,t,r){let n=_e._preNodeElemWithNull(e,r);for(;n&&(n=n[t])&&1!==n.nodeType;);return n instanceof Node?n:null}static _getSiblings(e,t){let r=e;const n=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==t&&n.push(r);return n}static domDir(e,t,r,n="domDir"){if("string"!=typeof t)throw new TypeError('The "direction" must be a string.');let o=_e._preNodeElemWithNull(e,n);const i=[];for(;o&&(o=o[t]);)if(1===o.nodeType){if(r&&("string"==typeof r?o.matches(r):o===r))break;i.push(o)}return i}static parent(e){let t=_e._preNodeElemWithNull(e,"parent");const r=t?t.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return _e.parent(this)}static parents(e,t){return _e.domDir(e,"parentNode",t,"parents")}parents(e){return _e.parents(this,e)}static next(e){return _e._getSibling(e,"nextSibling","next")}next(){return _e.next(this)}static prev(e){return _e._getSibling(e,"previousSibling","prev")}prev(){return _e.prev(this)}static nextAll(e){return _e.domDir(e,"nextSibling",void 0,"nextAll")}nextAll(){return _e.nextAll(this)}static prevAll(e){return _e.domDir(e,"previousSibling",void 0,"prevAll")}prevAll(){return _e.prevAll(this)}static nextUntil(e,t){return _e.domDir(e,"nextSibling",t,"nextUtil")}nextUntil(e){return _e.nextUntil(this,e)}static prevUntil(e,t){return _e.domDir(e,"previousSibling",t,"prevUtil")}prevUntil(e){return _e.prevUntil(this,e)}static siblings(e){const t=_e._preNodeElemWithNull(e,"siblings");return _e._getSiblings(t&&t.parentNode?t.parentNode.firstChild:null,t)}siblings(){return _e.siblings(this)}static children(e){const t=_e._preNodeElemWithNull(e,"children");return _e._getSiblings(t?t.firstChild:null)}children(){return _e.children(this)}static contents(e){const t=_e._preNodeElemWithNull(e,"contents");return t instanceof HTMLIFrameElement&&null!=t.contentDocument&&Object.getPrototypeOf(t.contentDocument)?[t.contentDocument]:t instanceof HTMLTemplateElement?Array.from((t.content||t).childNodes):t?Array.from(t.childNodes):[]}contents(){return _e.contents(this)}static clone(e,t=!0){if("boolean"!=typeof t)throw new TypeError('The "deep" must be a boolean.');return _e._preNodeElems(e,"clone").map(e=>e.cloneNode(t))}clone(e){return _e.clone(this,e)[0]}static _appendChecker(e,...t){const r=[],n=[...t];for(const t in n)"string"!=typeof n[t]?r.push(_e._preNodeElem(n[t],e)):r.push(n[t]);return r}static append(e,...t){return _e._preElem(e,"append").append(..._e._appendChecker("append",...t)),e}append(...e){return _e.append(this,...e)}static prepend(e,...t){return _e._preElem(e,"prepend").prepend(..._e._appendChecker("prepend",...t)),e}prepend(...e){return _e.prepend(this,...e)}static before(e,...t){return _e._preElem(e,"before").before(..._e._appendChecker("before",...t)),e}before(...e){return _e.before(this,...e)}static after(e,...t){return _e._preElem(e,"after").after(..._e._appendChecker("after",...t)),e}after(...e){return _e.after(this,...e)}static replaceWith(e,...t){return _e._preElem(e,"replaceWith").replaceWith(..._e._appendChecker("replaceWith",...t)),e}replaceWith(...e){return _e.replaceWith(this,...e)}static appendTo(e,t){const r=_e._preNodeElems(e,"appendTo"),n=_e._preNodeElems(t,"appendTo");return n.forEach((e,t)=>{r.forEach(r=>e.appendChild(t===n.length-1?r:r.cloneNode(!0)))}),e}appendTo(e){return _e.appendTo(this,e)}static prependTo(e,t){const r=_e._preElems(e,"prependTo"),n=_e._preElems(t,"prependTo");return n.forEach((e,t)=>{r.slice().reverse().forEach(r=>e.prepend(t===n.length-1?r:r.cloneNode(!0)))}),e}prependTo(e){return _e.prependTo(this,e)}static insertBefore(e,t,r=null){const n=_e._preNodeElem(e,"insertBefore"),o=_e._preNodeElem(t,"insertBefore"),i=_e._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("The target element has no parent node to insert before.");return o.parentNode.insertBefore(n,i||o),e}insertBefore(e,t){return _e.insertBefore(this,e,t)}static insertAfter(e,t,r=null){const n=_e._preNodeElem(e,"insertAfter"),o=_e._preNodeElem(t,"insertBefore"),i=_e._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("The target element has no parent node to insert after.");return o.parentNode.insertBefore(n,i||o.nextSibling),e}insertAfter(e,t){return _e.insertAfter(this,e,t)}static replaceAll(e,t){const r=_e._preNodeElems(e,"replaceAll"),n=_e._preNodeElems(t,"replaceAll");return n.forEach((e,t)=>{const o=e.parentNode;r.forEach(r=>{o&&o.replaceChild(t===n.length-1?r:r.cloneNode(!0),e)})}),e}replaceAll(e){return _e.replaceAll(this,e)}#H;get size(){return this.#H.length}constructor(e){if(e instanceof _e)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");const t=e=>{if(!e.every(e=>e instanceof Element||e instanceof Window||e instanceof Document||e instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.")};if(Array.isArray(e))t(e),this.#H=e;else if(e instanceof NodeList||e instanceof HTMLCollection){const r=[...e];t(r),this.#H=r}else{const r=[e];t(r),this.#H=r}}static isWindow(e){return null!=e&&e===e.window}static css(e){const t=_e._preElem(e,"css");return window.getComputedStyle(t)}css(){return _e.css(this)}static cssString(e,t){const r=_e._preElem(e,"cssString");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return"string"==typeof n?n:"number"==typeof n?n.toString():null}cssString(e){return _e.cssString(this,e)}static cssList(e,t){const r=_e._preElem(e,"cssList");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)void 0!==e&&(o[e]=n.getPropertyValue(e));return o}cssList(e){return _e.cssList(this,e)}static cssFloat(e,t){const r=_e._preElem(e,"cssFloat");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return parseFloat(n)||0}cssFloat(e){return _e.cssFloat(this,e)}static cssFloats(e,t){const r=_e._preElem(e,"cssFloats");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)o[e]=parseFloat(n[e])||0;return o}cssFloats(e){return _e.cssFloats(this,e)}static#W={alignContent:"align-content",alignItems:"align-items",alignSelf:"align-self",animationDelay:"animation-delay",animationDirection:"animation-direction",animationDuration:"animation-duration",animationFillMode:"animation-fill-mode",animationIterationCount:"animation-iteration-count",animationName:"animation-name",animationPlayState:"animation-play-state",animationTimingFunction:"animation-timing-function",backfaceVisibility:"backface-visibility",backgroundAttachment:"background-attachment",backgroundBlendMode:"background-blend-mode",backgroundClip:"background-clip",backgroundColor:"background-color",backgroundImage:"background-image",backgroundOrigin:"background-origin",backgroundPosition:"background-position",backgroundRepeat:"background-repeat",backgroundSize:"background-size",borderBottom:"border-bottom",borderBottomColor:"border-bottom-color",borderBottomLeftRadius:"border-bottom-left-radius",borderBottomRightRadius:"border-bottom-right-radius",borderBottomStyle:"border-bottom-style",borderBottomWidth:"border-bottom-width",borderCollapse:"border-collapse",borderColor:"border-color",borderImage:"border-image",borderImageOutset:"border-image-outset",borderImageRepeat:"border-image-repeat",borderImageSlice:"border-image-slice",borderImageSource:"border-image-source",borderImageWidth:"border-image-width",borderLeft:"border-left",borderLeftColor:"border-left-color",borderLeftStyle:"border-left-style",borderLeftWidth:"border-left-width",borderRadius:"border-radius",borderRight:"border-right",borderRightColor:"border-right-color",borderRightStyle:"border-right-style",borderRightWidth:"border-right-width",borderSpacing:"border-spacing",borderStyle:"border-style",borderTop:"border-top",borderTopColor:"border-top-color",borderTopLeftRadius:"border-top-left-radius",borderTopRightRadius:"border-top-right-radius",borderTopStyle:"border-top-style",borderTopWidth:"border-top-width",borderWidth:"border-width",boxDecorationBreak:"box-decoration-break",boxShadow:"box-shadow",boxSizing:"box-sizing",breakAfter:"break-after",breakBefore:"break-before",breakInside:"break-inside",captionSide:"caption-side",caretColor:"caret-color",clipPath:"clip-path",columnCount:"column-count",columnFill:"column-fill",columnGap:"column-gap",columnRule:"column-rule",columnRuleColor:"column-rule-color",columnRuleStyle:"column-rule-style",columnRuleWidth:"column-rule-width",columnSpan:"column-span",columnWidth:"column-width",counterIncrement:"counter-increment",counterReset:"counter-reset",emptyCells:"empty-cells",flexBasis:"flex-basis",flexDirection:"flex-direction",flexFlow:"flex-flow",flexGrow:"flex-grow",flexShrink:"flex-shrink",flexWrap:"flex-wrap",fontFamily:"font-family",fontFeatureSettings:"font-feature-settings",fontKerning:"font-kerning",fontLanguageOverride:"font-language-override",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontSynthesis:"font-synthesis",fontVariant:"font-variant",fontVariantAlternates:"font-variant-alternates",fontVariantCaps:"font-variant-caps",fontVariantEastAsian:"font-variant-east-asian",fontVariantLigatures:"font-variant-ligatures",fontVariantNumeric:"font-variant-numeric",fontVariantPosition:"font-variant-position",fontWeight:"font-weight",gridArea:"grid-area",gridAutoColumns:"grid-auto-columns",gridAutoFlow:"grid-auto-flow",gridAutoRows:"grid-auto-rows",gridColumn:"grid-column",gridColumnEnd:"grid-column-end",gridColumnGap:"grid-column-gap",gridColumnStart:"grid-column-start",gridGap:"grid-gap",gridRow:"grid-row",gridRowEnd:"grid-row-end",gridRowGap:"grid-row-gap",gridRowStart:"grid-row-start",gridTemplate:"grid-template",gridTemplateAreas:"grid-template-areas",gridTemplateColumns:"grid-template-columns",gridTemplateRows:"grid-template-rows",imageRendering:"image-rendering",justifyContent:"justify-content",letterSpacing:"letter-spacing",lineBreak:"line-break",lineHeight:"line-height",listStyle:"list-style",listStyleImage:"list-style-image",listStylePosition:"list-style-position",listStyleType:"list-style-type",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",maskClip:"mask-clip",maskComposite:"mask-composite",maskImage:"mask-image",maskMode:"mask-mode",maskOrigin:"mask-origin",maskPosition:"mask-position",maskRepeat:"mask-repeat",maskSize:"mask-size",maskType:"mask-type",maxHeight:"max-height",maxWidth:"max-width",minHeight:"min-height",minWidth:"min-width",mixBlendMode:"mix-blend-mode",objectFit:"object-fit",objectPosition:"object-position",offsetAnchor:"offset-anchor",offsetDistance:"offset-distance",offsetPath:"offset-path",offsetRotate:"offset-rotate",outlineColor:"outline-color",outlineOffset:"outline-offset",outlineStyle:"outline-style",outlineWidth:"outline-width",overflowAnchor:"overflow-anchor",overflowWrap:"overflow-wrap",overflowX:"overflow-x",overflowY:"overflow-y",paddingBottom:"padding-bottom",paddingLeft:"padding-left",paddingRight:"padding-right",paddingTop:"padding-top",pageBreakAfter:"page-break-after",pageBreakBefore:"page-break-before",pageBreakInside:"page-break-inside",perspectiveOrigin:"perspective-origin",placeContent:"place-content",placeItems:"place-items",placeSelf:"place-self",pointerEvents:"pointer-events",rowGap:"row-gap",scrollBehavior:"scroll-behavior",scrollMargin:"scroll-margin",scrollMarginBlock:"scroll-margin-block",scrollMarginBlockEnd:"scroll-margin-block-end",scrollMarginBlockStart:"scroll-margin-block-start",scrollMarginBottom:"scroll-margin-bottom",scrollMarginInline:"scroll-margin-inline",scrollMarginInlineEnd:"scroll-margin-inline-end",scrollMarginInlineStart:"scroll-margin-inline-start",scrollMarginLeft:"scroll-margin-left",scrollMarginRight:"scroll-margin-right",scrollMarginTop:"scroll-margin-top",scrollPadding:"scroll-padding",scrollPaddingBlock:"scroll-padding-block",scrollPaddingBlockEnd:"scroll-padding-block-end",scrollPaddingBlockStart:"scroll-padding-block-start",scrollPaddingBottom:"scroll-padding-bottom",scrollPaddingInline:"scroll-padding-inline",scrollPaddingInlineEnd:"scroll-padding-inline-end",scrollPaddingInlineStart:"scroll-padding-inline-start",scrollPaddingLeft:"scroll-padding-left",scrollPaddingRight:"scroll-padding-right",scrollPaddingTop:"scroll-padding-top",scrollSnapAlign:"scroll-snap-align",scrollSnapStop:"scroll-snap-stop",scrollSnapType:"scroll-snap-type",shapeImageThreshold:"shape-image-threshold",shapeMargin:"shape-margin",shapeOutside:"shape-outside",tabSize:"tab-size",tableLayout:"table-layout",textAlign:"text-align",textAlignLast:"text-align-last",textCombineUpright:"text-combine-upright",textDecoration:"text-decoration",textDecorationColor:"text-decoration-color",textDecorationLine:"text-decoration-line",textDecorationStyle:"text-decoration-style",textIndent:"text-indent",textJustify:"text-justify",textOrientation:"text-orientation",textOverflow:"text-overflow",textShadow:"text-shadow",textTransform:"text-transform",transformBox:"transform-box",transformOrigin:"transform-origin",transformStyle:"transform-style",transitionDelay:"transition-delay",transitionDuration:"transition-duration",transitionProperty:"transition-property",transitionTimingFunction:"transition-timing-function",unicodeBidi:"unicode-bidi",userSelect:"user-select",verticalAlign:"vertical-align",whiteSpace:"white-space",willChange:"will-change",wordBreak:"word-break",wordSpacing:"word-spacing",wordWrap:"word-wrap",writingMode:"writing-mode",zIndex:"z-index",WebkitTransform:"-webkit-transform",WebkitTransition:"-webkit-transition",WebkitBoxShadow:"-webkit-box-shadow",MozBoxShadow:"-moz-box-shadow",MozTransform:"-moz-transform",MozTransition:"-moz-transition",msTransform:"-ms-transform",msTransition:"-ms-transition"};static cssPropAliases=new Proxy(_e.#W,{set:(e,t,r)=>(e[t]=r,_e.cssPropRevAliases[r]=t,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(_e.#W).map(([e,t])=>[t,e]));static toStyleKc(e){return"string"==typeof _e.cssPropAliases[e]?_e.cssPropAliases[e]:e}static toStyleCc(e){return"string"==typeof _e.cssPropRevAliases[e]?_e.cssPropRevAliases[e]:e}static setStyle(e,t,r=null){return _e._preHtmlElems(e,"setStyle").forEach(e=>{if("object"==typeof t)for(const[r,n]of Object.entries(t))e.style.setProperty(_e.toStyleKc(r),"string"==typeof n?n:"number"==typeof n?`${n}px`:String(n));else e.style.setProperty(_e.toStyleKc(t),r)}),e}setStyle(e,t){return _e.setStyle(this,e,t)}static getStyle(e,t){return _e._preHtmlElem(e,"getStyle").style.getPropertyValue(_e.toStyleKc(t))}getStyle(e){return _e.getStyle(this,e)}static style(e,{camelCase:t=!1,rawAttr:r=!1}={}){if("boolean"!=typeof t)throw new TypeError('"camelCase" must be a boolean. Received: '+typeof t);if("boolean"!=typeof r)throw new TypeError('"rawAttr" must be a boolean. Received: '+typeof r);const n=_e._preHtmlElem(e,"style"),o={};if(r){const e=(n.getAttribute("style")||"").split(";");for(const r of e){const[e,n]=r.split(":");if(!e||!n)continue;const i=e.trim(),s=n.trim();o[t?_e.toStyleCc(i):i]=s}}else{const e=n.style;for(let r=0;r<e.length;r++){const n=e[r],i=e.getPropertyValue(n);o[t?_e.toStyleCc(n):n]=i}}return o}style(e){return _e.style(this,e)}static removeStyle(e,t){return _e._preHtmlElems(e,"removeStyle").forEach(e=>{if(Array.isArray(t))for(const r of t)e.style.removeProperty(_e.toStyleKc(r));else e.style.removeProperty(_e.toStyleKc(t))}),e}removeStyle(e){return _e.removeStyle(this,e)}static toggleStyle(e,t,r,n){return _e._preHtmlElems(e,"toggleStyle").forEach(e=>{const o=_e.getStyle(e,t).trim()===_e.toStyleKc(r)?n:r;_e.setStyle(e,t,o)}),e}toggleStyle(e,t,r){return _e.toggleStyle(this,e,t,r)}static clearStyle(e){return _e._preElems(e,"clearStyle").forEach(e=>e.removeAttribute("style")),e}clearStyle(){return _e.clearStyle(this)}static focus(e){return _e._preHtmlElem(e,"focus").focus(),e}focus(){return _e.focus(this)}static blur(e){return _e._preHtmlElem(e,"blur").blur(),e}blur(){return _e.blur(this)}static boolCheck(e){return void 0!==e&&("true"===e||"1"===e||!0===e||"on"===e||"number"==typeof e&&e>0)}static setWinScrollTop(e){if("number"!=typeof e)throw new TypeError("The value must be a number.");_e.setScrollTop(window,e)}static setWinScrollLeft(e){if("number"!=typeof e)throw new TypeError("The value must be a number.");_e.setScrollLeft(window,e)}static winScrollTop(){return window.scrollY||document.documentElement.scrollTop}static winScrollLeft(){return window.scrollX||document.documentElement.scrollLeft}static winInnerHeight(){return window.innerHeight||document.documentElement.clientHeight}static winInnerWidth(){return window.innerWidth||document.documentElement.clientWidth}static isPageTop(){return 0===window.scrollY}static isPageBottom(){return window.innerHeight+window.scrollY>=document.body.offsetHeight}static getDimension(e,t,r="content"){const n=_e._preElemAndWinAndDoc(e,"getDimension");if("string"!=typeof t)throw new TypeError("The type must be a string.");if("string"!=typeof r)throw new TypeError("The extra must be a string.");const o="width"===t?"Width":"Height";if(_e.isWindow(n))return"margin"===r?n["inner"+o]:n.document.documentElement["client"+o];const i=n;if(9===i.nodeType){const e=i.documentElement;return Math.max(i.body["scroll"+o],e["scroll"+o],i.body["offset"+o],e["offset"+o],e["client"+o])}let s=i.getBoundingClientRect()[t];function a(e){return"width"===t?_e.cssFloat(i,e+"Left")+_e.cssFloat(i,e+"Right"):_e.cssFloat(i,e+"Top")+_e.cssFloat(i,e+"Bottom")}switch(r){case"content":s-=a("padding"),s-=a("border");break;case"padding":s-=a("border");break;case"border":break;case"margin":s+=a("margin")}return s}getDimension(e,t){return _e.getDimension(this,e,t)}static setHeight(e,t){const r=_e._preHtmlElem(e,"setHeight");if("number"!=typeof t&&"string"!=typeof t)throw new TypeError("The value must be a string or number.");return r.style.height="number"==typeof t?`${t}px`:t,e}setHeight(e){return _e.setHeight(this,e)}static setWidth(e,t){const r=_e._preHtmlElem(e,"setWidth");if("number"!=typeof t&&"string"!=typeof t)throw new TypeError("The value must be a string or number.");return r.style.width="number"==typeof t?`${t}px`:t,e}setWidth(e){return _e.setWidth(this,e)}static height(e){const t=_e._preElemAndWinAndDoc(e,"height");return _e.getDimension(t,"height","content")}height(){return _e.height(this)}static width(e){const t=_e._preElemAndWinAndDoc(e,"width");return _e.getDimension(t,"width","content")}width(){return _e.width(this)}static innerHeight(e){const t=_e._preElemAndWinAndDoc(e,"innerHeight");return _e.getDimension(t,"height","padding")}innerHeight(){return _e.innerHeight(this)}static innerWidth(e){const t=_e._preElemAndWinAndDoc(e,"innerWidth");return _e.getDimension(t,"width","padding")}innerWidth(){return _e.innerWidth(this)}static outerHeight(e,t=!1){if("boolean"!=typeof t)throw new TypeError('The "includeMargin" must be a boolean.');const r=_e._preElemAndWinAndDoc(e,"outerHeight");return _e.getDimension(r,"height",t?"margin":"border")}outerHeight(e){return _e.outerHeight(this,e)}static outerWidth(e,t=!1){if("boolean"!=typeof t)throw new TypeError('The "includeMargin" must be a boolean.');const r=_e._preElemAndWinAndDoc(e,"outerWidth");return _e.getDimension(r,"width",t?"margin":"border")}outerWidth(e){return _e.outerWidth(this,e)}static animate(e,t,r){return _e._preElems(e,"animate").forEach(e=>e.animate(t,r)),e}animate(e,t){return _e.animate(this,e,t)}static offset(e){const t=_e._preElem(e,"offset").getBoundingClientRect(),r=window.scrollY||document.documentElement.scrollTop,n=window.scrollX||document.documentElement.scrollLeft;return{top:t.top+r,left:t.left+n}}offset(){return _e.offset(this)}static position(e){const t=_e._preHtmlElem(e,"position");let r,n,o={top:0,left:0};if("fixed"===window.getComputedStyle(t).position)n=t.getBoundingClientRect();else{n=_e.offset(t),r=t.offsetParent||document.documentElement;const{position:e}=window.getComputedStyle(r);for(;r instanceof HTMLElement&&(r===document.body||r===document.documentElement)&&"static"===e;)r=r.parentNode;if(r instanceof HTMLElement&&r!==t&&1===r.nodeType){const{borderTopWidth:e,borderLeftWidth:t}=_e.cssFloats(r,["borderTopWidth","borderLeftWidth"]);o=_e.offset(r),o.top+=e,o.left+=t}}return{top:n.top-o.top-_e.cssFloat(t,"marginTop"),left:n.left-o.left-_e.cssFloat(t,"marginLeft")}}position(){return _e.position(this)}static offsetParent(e){let t=_e._preHtmlElem(e,"offsetParent").offsetParent;for(;t instanceof HTMLElement&&"static"===window.getComputedStyle(t).position;)t=t.offsetParent;return t instanceof HTMLElement?t:document.documentElement}offsetParent(){return _e.offsetParent(this)}static scrollTop(e){const t=_e._preElemAndWindow(e,"scrollTop");return _e.isWindow(t)?t.pageYOffset:9===t.nodeType?t.defaultView.pageYOffset:t.scrollTop}scrollTop(){return _e.scrollTop(this)}static scrollLeft(e){const t=_e._preElemAndWindow(e,"scrollLeft");return _e.isWindow(t)?t.pageXOffset:9===t.nodeType?t.defaultView.pageXOffset:t.scrollLeft}scrollLeft(){return _e.scrollLeft(this)}static easings={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1};static scrollToXY(e,{targetX:t,targetY:r,duration:n,easing:o,onAnimation:i}={}){if(void 0!==t&&"number"!=typeof t)throw new TypeError("`targetX` must be a number if provided.");if(void 0!==r&&"number"!=typeof r)throw new TypeError("`targetY` must be a number if provided.");if(void 0!==n&&"number"!=typeof n)throw new TypeError("`duration` must be a number if provided.");if(void 0!==o&&"string"!=typeof o)throw new TypeError("`easing` must be a string if provided.");if(void 0!==o&&"function"!=typeof _e.easings[o])throw new TypeError(`Unknown easing function: "${o}".`);if(void 0!==i&&"function"!=typeof i)throw new TypeError("`onAnimation` must be a function if provided.");const s=(e,t,r,n)=>{if(e instanceof Window)window.scrollTo(t,r);else if(9===e.nodeType)e.defaultView.scrollTo(t,r);else{const n=e instanceof Window?window.scrollX:e.scrollLeft,o=e instanceof Window?window.scrollY:e.scrollTop;n!==t&&(e.scrollLeft=t),o!==r&&(e.scrollTop=r)}"function"==typeof i&&i({x:t,y:r,isComplete:n>=1,time:n})};return _e._preElemsAndWindow(e,"scrollToXY").forEach(e=>{const i=e instanceof Window?window.scrollX:e.scrollLeft,a=e instanceof Window?window.scrollY:e.scrollTop,l=t??i,u=r??a,h=l-i,c=u-a,d="string"==typeof o&&_e.easings[o]||null;if("number"!=typeof n||"function"!=typeof d)return s(e,l,u,1);const f=performance.now(),m=n??0;requestAnimationFrame(function t(r){if("function"!=typeof d)return;const n=Math.min(1,(r-f)/m),o=d(n);s(e,i+h*o,a+c*o,n),n<1&&requestAnimationFrame(t)})}),e}scrollToXY({targetX:e,targetY:t,duration:r,easing:n,onAnimation:o}={}){return _e.scrollToXY(this,{targetX:e,targetY:t,duration:r,easing:n,onAnimation:o})}static setScrollTop(e,t){if("number"!=typeof t)throw new TypeError("ScrollTop value must be a number.");return _e.scrollToXY(e,{targetY:t})}setScrollTop(e){return _e.setScrollTop(this,e)}static setScrollLeft(e,t){if("number"!=typeof t)throw new TypeError("ScrollLeft value must be a number.");return _e.scrollToXY(e,{targetX:t})}setScrollLeft(e){return _e.setScrollLeft(this,e)}static borderWidth(e){const t=_e._preElem(e,"borderWidth"),{borderLeftWidth:r,borderRightWidth:n,borderTopWidth:o,borderBottomWidth:i}=_e.cssFloats(t,["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}borderWidth(){return _e.borderWidth(this)}static border(e){const t=_e._preElem(e,"border"),{borderLeft:r,borderRight:n,borderTop:o,borderBottom:i}=_e.cssFloats(t,["borderLeft","borderRight","borderTop","borderBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}border(){return _e.border(this)}static margin(e){const t=_e._preElem(e,"margin"),{marginLeft:r,marginRight:n,marginTop:o,marginBottom:i}=_e.cssFloats(t,["marginLeft","marginRight","marginTop","marginBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}margin(){return _e.margin(this)}static padding(e){const t=_e._preElem(e,"padding"),{paddingLeft:r,paddingRight:n,paddingTop:o,paddingBottom:i}=_e.cssFloats(t,["paddingLeft","paddingRight","paddingTop","paddingBottom"]);return{x:r+n,y:o+i,left:r,right:n,top:o,bottom:i}}padding(){return _e.padding(this)}static addClass(e,...t){return _e._preElems(e,"addClass").forEach(e=>e.classList.add(...t)),e}addClass(...e){return _e.addClass(this,...e)}static removeClass(e,...t){return _e._preElems(e,"removeClass").forEach(e=>e.classList.remove(...t)),e}removeClass(...e){return _e.removeClass(this,...e)}static replaceClass(e,t,r){if("string"!=typeof t)throw new TypeError('The "token" parameter must be a string.');if("string"!=typeof r)throw new TypeError('The "newToken" parameter must be a string.');const n=[];return _e._preElems(e,"replaceClass").forEach(e=>n.push(e.classList.replace(t,r))),n}replaceClass(e,t){return _e.replaceClass(this,e,t)[0]}static classItem(e,t){const r=_e._preElem(e,"classItem");if("number"!=typeof t)throw new TypeError('The "index" parameter must be a number.');return r.classList.item(t)}classItem(e){return _e.classItem(this,e)}static toggleClass(e,t,r){if("string"!=typeof t)throw new TypeError('The "token" parameter must be a string.');if(void 0!==r&&"boolean"!=typeof r)throw new TypeError('The "force" parameter must be a boolean.');const n=[];return _e._preElems(e,"toggleClass").forEach(e=>n.push(e.classList.toggle(t,r))),n}toggleClass(e,t){return _e.toggleClass(this,e,t)[0]}static hasClass(e,t){const r=_e._preElem(e,"hasClass");if("string"!=typeof t)throw new TypeError('The "token" parameter must be a string.');return r.classList.contains(t)}hasClass(e){return _e.hasClass(this,e)}static classLength(e){return _e._preElem(e,"classLength").classList.length}classLength(){return _e.classLength(this)}static classList(e){return _e._preElem(e,"classList").classList.values().toArray()}classList(){return _e.classList(this)}static tagName(e){return _e._preElem(e,"tagName").tagName}tagName(){return _e.tagName(this)}static id(e){return _e._preElem(e,"id").id}id(){return _e.id(this)}static text(e){return _e._preElem(e,"text").textContent}text(){return _e.text(this)}static setText(e,t){if("string"!=typeof t)throw new Error("Value is not a valid string.");return _e._preElems(e,"setText").forEach(e=>e.textContent=t),e}setText(e){return _e.setText(this,e)}static empty(e){return _e._preElems(e,"empty").forEach(e=>e.textContent=""),e}empty(){return _e.empty(this)}static html(e,t){return _e._preElem(e,"html").getHTML(t)}html(e){return _e.html(this,e)}static setHtml(e,t){if("string"!=typeof t)throw new Error("Value is not a valid string.");return _e._preElems(e,"setHtml").forEach(e=>e.innerHTML=t),e}setHtml(e){return _e.setHtml(this,e)}static _valHooks={option:{get:e=>{const t=e.getAttribute("value");return null!=t?t:e.textContent}},select:{get:e=>{const t=e.options,r=e.selectedIndex,n="select-one"===e.type,o=n?r+1:t.length,i=[];let s=r<0?o:n?r:0;for(;s<o;s++){const e=t[s],o=e.parentNode;if((e.selected||s===r)&&!e.disabled&&(!o||!o.disabled||"OPTGROUP"!==o.tagName)){const t=_e._valHooks.option.get(e);if(n)return t;i.push(t)}}return i},set:(e,t)=>{const r=e.options,n=Array.isArray(t)?t.map(String):[String(t)];let o=!1;for(let e=0;e<r.length;e++){const t=r[e],i=_e._valHooks.option.get(t);"string"==typeof i&&(t.selected=n.includes(i))&&(o=!0)}return o||(e.selectedIndex=-1),n}},radio:{get:e=>e.checked?"on":"off",set(e,t){if("boolean"==typeof t){const r=e.closest("label");return t&&r&&r.querySelectorAll('input[type="radio"]').forEach(t=>{t instanceof HTMLInputElement&&t!==e&&(t.checked=!1)}),e.checked=t,t}}},checkbox:{get:e=>e.checked?"on":"off",set(e,t){if("boolean"==typeof t)return e.checked=t,t}}};static setVal(e,t){return _e._preInputElems(e,"setVal").forEach(e=>{if(1!==e.nodeType)return;let r="function"==typeof t?t(e,_e.val(e)):t;null==r?r="":"number"==typeof r?r=String(r):Array.isArray(r)&&(r=((e,t)=>{const r=[];for(let n=0;n<e.length;n++)r.push(t(e[n]));return r})(r,e=>null==e?"":String(e)));const n=_e._valHooks[e.type]||_e._valHooks[e.nodeName.toLowerCase()];if(!n||"function"!=typeof n.set||void 0===n.set(e,r,"value")){if("string"!=typeof r&&"boolean"!=typeof r)throw new Error(`Invalid setValue "${typeof r}" value.`);"string"==typeof r&&(e.value=r)}}),e}setVal(e){return _e.setVal(this,e)}static _valTypes={string:e=>e.value,date:e=>e.valueAsDate,number:e=>e.valueAsNumber};static _getValByType(e,t,r){if("string"!=typeof t)throw new TypeError('The "type" must be a string.');if("string"!=typeof r)throw new TypeError('The "where" must be a string.');if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error(`Provided element is not an HTMLInputElement in ${r}().`);if("function"!=typeof _e._valTypes[t])throw new Error(`No handler found for type "${t}" in ${r}().`);return _e._valTypes[t](e)}static _val(e,t,r){const n=_e._preInputElem(e,t),o=_e._valHooks[n.type]||_e._valHooks[n.nodeName.toLowerCase()];if(o&&"function"==typeof o.get){const e=o.get(n,"value",r);if(void 0!==e)return"string"==typeof e?e.replace(/\r/g,""):e}return _e._getValByType(n,r,t)}_val(e,t){return _e._val(this,e,t)}static val(e){return _e._val(e,"val","string")}val(){return _e.val(this)}static valTxt(e){const t=_e._val(e,"valTxt","string");if("string"!=typeof t&&null!==t)throw new Error("Value is not a valid string.");return null==t?"":"string"==typeof t?t.replace(/\r/g,""):t}valTxt(){return _e.valTxt(this)}static _valArr(e,t,r){const n=_e._val(e,t,r);if(!Array.isArray(n))throw new Error(`Value expected an array but got ${typeof n}.`);return n}_valArr(e,t){return _e._valArr(this,e,t)}static valArr(e){return _e._valArr(e,"valArr","string")}valArr(){return _e.valArr(this)}static valNb(e){if(!(_e._preInputElem(e,"valNb")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const t=_e._val(e,"valNb","number");if(Number.isNaN(t))throw new Error("Value is not a valid number.");return t}valNb(){return _e.valNb(this)}static valDate(e){if(!(_e._preInputElem(e,"valDate")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const t=_e._val(e,"valDate","date");if(!(t instanceof Date))throw new Error("Value is not a valid date.");return t}valDate(){return _e.valDate(this)}static valBool(e){const t=_e._preInputElem(e,"valBool");if(!(t instanceof HTMLInputElement))throw new Error("Element must be an input element.");return"on"===_e.val(t)}valBool(){return _e.valBool(this)}static listenForPaste(e,{onFilePaste:t,onTextPaste:r}={}){if(void 0!==t&&"function"!=typeof t)throw new TypeError("onFilePaste must be a function.");if(void 0!==r&&"function"!=typeof r)throw new TypeError("onTextPaste must be a function.");const n=e=>{if(!(e instanceof ClipboardEvent))return;const n=e.clipboardData?.items||[];for(const e of n)if("file"===e.kind){if("function"==typeof t){const r=e.getAsFile();r&&t(e,r)}}else"string"===e.kind&&"function"==typeof r&&e.getAsString(t=>r(e,t))};return _e._preElemsWithDoc(e,"listenForPaste").forEach(e=>_e.on(e,"paste",n)),n}listenForPaste({onFilePaste:e,onTextPaste:t}={}){return _e.listenForPaste(this,{onFilePaste:e,onTextPaste:t})}static hasEventListener(e,t){const r=_e._preEventTargetElem(e,"hasEventListener");if(!Le.has(r))return!1;const n=Le.get(r);return!!(n&&Array.isArray(n[t])&&n[t].length>0)}hasEventListener(e){return _e.hasEventListener(this,e)}static hasExactEventListener(e,t,r){const n=_e._preEventTargetElem(e,"hasExactEventListener");if("function"!=typeof r)throw new TypeError('The "handler" must be a function.');if(!Le.has(n))return!1;const o=Le.get(n);return!(!o||!Array.isArray(o[t]))&&o[t].some(e=>e.handler===r)}hasExactEventListener(e,t){return _e.hasExactEventListener(this,e,t)}static on(e,t,r,n){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"on").forEach(e=>{e.addEventListener(t,r,n),Le.has(e)||Le.set(e,{});const o=Le.get(e);o&&(Array.isArray(o[t])||(o[t]=[]),o[t].push({handler:r,options:n}))}),e}on(e,t,r){return _e.on(this,e,t,r)}static once(e,t,r,n={}){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"once").forEach(e=>{const o=n=>{_e.off(e,t,o),"function"==typeof r&&r(n)};_e.on(e,t,o,"boolean"==typeof n?n:{...n,once:!0})}),e}once(e,t,r={}){return _e.once(this,e,t,r)}static off(e,t,r,n){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"off").forEach(e=>{e.removeEventListener(t,r,n);const o=Le.get(e);o&&o[t]&&(o[t]=o[t].filter(e=>e.handler!==r),0===o[t].length&&delete o[t])}),e}off(e,t,r){return _e.off(this,e,t,r)}static offAll(e,t){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"offAll").forEach(e=>{const r=Le.get(e);if(r&&r[t]){for(const n of r[t])e.removeEventListener(t,n.handler,n.options);delete r[t]}}),e}offAll(e){return _e.offAll(this,e)}static offAllTypes(e,t=null){if(null!==t&&"function"!=typeof t)throw new TypeError('The "filterFn" must be a function.');return _e._preEventTargetElems(e,"offAllTypes").forEach(e=>{const r=Le.get(e);if(r){for(const n in r)for(const o of r[n])("function"!=typeof t||t(o.handler,n))&&e.removeEventListener(n,o.handler,o.options);Le.delete(e)}}),e}offAllTypes(e=null){return _e.offAllTypes(this,e)}static trigger(e,t,r={}){if("string"!=typeof t)throw new TypeError("The event name must be a string.");return _e._preEventTargetElems(e,"trigger").forEach(e=>{const n=r instanceof Event||r instanceof CustomEvent?r:new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e.dispatchEvent(n)}),e}trigger(e,t={}){return _e.trigger(this,e,t)}static#F={for:"htmlFor",class:"className"};static propFix=new Proxy(_e.#F,{set:(e,t,r)=>(e[t]=r,_e.attrFix[r]=t,!0)});static attrFix=Object.fromEntries(Object.entries(_e.#F).map(([e,t])=>[t,e]));static getPropName(e){return"string"==typeof _e.propFix[e]?_e.propFix[e]:e}static getAttrName(e){return"string"==typeof _e.attrFix[e]?_e.attrFix[e]:e}static attr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElem(e,"attr").getAttribute(_e.getAttrName(t))}attr(e){return _e.attr(this,e)}static setAttr(e,t,r=null){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');if(null!==r&&"string"!=typeof r)throw new TypeError('The "value" must be a string.');return _e._preElems(e,"setAttr").forEach(e=>{null===r?e.removeAttribute(_e.getAttrName(t)):e.setAttribute(_e.getAttrName(t),r)}),e}setAttr(e,t){return _e.setAttr(this,e,t)}static removeAttr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElems(e,"removeAttr").forEach(e=>e.removeAttribute(_e.getAttrName(t))),e}removeAttr(e){return _e.removeAttr(this,e)}static hasAttr(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElem(e,"hasAttr").hasAttribute(_e.getAttrName(t))}hasAttr(e){return _e.hasAttr(this,e)}static hasProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return!!_e._preElem(e,"hasProp")[_e.getPropName(t)]}hasProp(e){return _e.hasProp(this,e)}static addProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElems(e,"addProp").forEach(e=>{e[_e.getPropName(t)]=!0}),e}addProp(e){return _e.addProp(this,e)}static removeProp(e,t){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');return _e._preElems(e,"removeProp").forEach(e=>{e[_e.getPropName(t)]=!1}),e}removeProp(e){return _e.removeProp(this,e)}static toggleProp(e,t,r){if("string"!=typeof t)throw new TypeError('The "name" must be a string.');if(void 0!==r&&"boolean"!=typeof r)throw new TypeError('The "force" must be a boolean.');_e._preElems(e,"toggleProp").forEach(e=>{(void 0===r?!e[_e.getPropName(t)]:r)?_e.addProp(e,t):_e.removeProp(e,t)})}toggleProp(e,t){return _e.toggleProp(this,e,t)}static remove(e){return _e._preElems(e,"remove").forEach(e=>e.remove()),e}remove(){return _e.remove(this)}static index(e,t=null){const r=_e._preElem(e,"index");if(!r)return-1;if(!t)return Array.prototype.indexOf.call(r.parentNode?.children||[],r);if(t){const e="string"==typeof t?document.querySelectorAll(t):_e._preElems(t,"index");return Array.prototype.indexOf.call(e,r)}return-1}index(e){return _e.index(this,e)}static _getCustomRect(e,t){const r={height:0,width:0,x:0,y:0,bottom:0,left:0,right:0,top:0,toJSON:function(){throw new Error("Function not implemented.")}};for(const t in e)"number"==typeof e[t]&&(r[t]=e[t]);if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("extraRect must be a non-null object.");const{height:n=0,width:o=0,top:i=0,bottom:s=0,left:a=0,right:l=0}=t;if("number"!=typeof n)throw new Error("extraRect.height must be a number.");if("number"!=typeof o)throw new Error("extraRect.width must be a number.");if("number"!=typeof i)throw new Error("extraRect.top must be a number.");if("number"!=typeof s)throw new Error("extraRect.bottom must be a number.");if("number"!=typeof a)throw new Error("extraRect.left must be a number.");if("number"!=typeof l)throw new Error("extraRect.right must be a number.");return r.height+=n,r.width+=o,r.top+=i,r.bottom+=s,r.left+=a,r.right+=l,r}static isCollWith(e,t,r={}){const n=_e._getCustomRect(_e._preElem(e,"isCollWith").getBoundingClientRect(),r),o=_e._preElem(t,"isCollWith").getBoundingClientRect();return we(n,o)}isCollWith(e,t){return _e.isCollWith(this,e,t)}static isCollPerfWith(e,t,r={}){const n=_e._getCustomRect(_e._preElem(e,"isCollPerfWith").getBoundingClientRect(),r),o=_e._preElem(t,"isCollPerfWith").getBoundingClientRect();return ve(n,o)}isCollPerfWith(e,t){return _e.isCollPerfWith(this,e,t)}static _isCollWithLock(e,t,r,n,o){const i=Ae[o];if(e)return i.has(n)||i.set(n,!0),!0;if(i.has(n)){let e=!1;switch(o){case"top":e=Ee(t,r);break;case"bottom":e=Te(t,r);break;case"left":e=xe(t,r);break;case"right":e=Se(t,r)}return e&&i.delete(n),i.has(n)}return!1}static isCollWithLock(e,t,r,n={}){const o=_e._preElem(e,"isCollWithLock"),i=_e._preElem(t,"isCollWithLock"),s=_e._getCustomRect(o.getBoundingClientRect(),n),a=i.getBoundingClientRect(),l=we(s,a);return _e._isCollWithLock(l,s,a,o,r)}isCollWithLock(e,t,r){return _e.isCollWithLock(this,e,t,r)}static isCollPerfWithLock(e,t,r,n={}){const o=_e._preElem(e,"isCollPerfWithLock"),i=_e._preElem(t,"isCollPerfWithLock"),s=_e._getCustomRect(o.getBoundingClientRect(),n),a=i.getBoundingClientRect(),l=ve(s,a);return _e._isCollWithLock(l,s,a,o,r)}isCollPerfWithLock(e,t,r){return _e.isCollPerfWithLock(this,e,t,r)}static resetCollLock(e){const t=_e._preElem(e,"resetCollLock");let r=!1;for(const e of["top","bottom","left","right"])Ae[e].has(t)&&(Ae[e].delete(t),r=!0);return r}resetCollLock(){return _e.resetCollLock(this)}static resetCollLockDir(e,t){const r=_e._preElem(e,"resetCollLockDir"),n=Ae[t];return!!n.has(r)&&(n.delete(r),!0)}resetCollLockDir(e){return _e.resetCollLockDir(this,e)}static isInViewport(e){const t=_e._preElem(e,"isInViewport");if(!t.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=_e.offset(t).top,n=r+_e.outerHeight(t),o=_e.scrollTop(window),i=o+_e.height(window);return n>o&&r<i}isInViewport(){return _e.isInViewport(this)}static isScrolledIntoView(e){const t=_e._preElem(e,"isScrolledIntoView");if(!t.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=_e.scrollTop(window),n=r+_e.height(window),o=_e.offset(t).top;return o+_e.height(t)<=n&&o>=r}isScrolledIntoView(){return _e.isScrolledIntoView(this)}static isInContainer(e,t){const r=_e._preElem(e,"isInContainer"),n=_e._preElem(t,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const o=r.getBoundingClientRect(),i=n.getBoundingClientRect(),s=o.bottom>i.top&&o.top<i.bottom,a=o.right>i.left&&o.left<i.right;return s&&a}isInContainer(e){return _e.isInContainer(this,e)}static isFullyInContainer(e,t){const r=_e._preElem(e,"isScrolledIntoView"),n=_e._preElem(t,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const o=r.getBoundingClientRect(),i=n.getBoundingClientRect();return o.top>=i.top&&o.bottom<=i.bottom&&o.left>=i.left&&o.right<=i.right}isFullyInContainer(e){return _e.isFullyInContainer(this,e)}static hasScroll(e){const t=_e._preElem(e,"hasScroll");return{v:t.scrollHeight>t.clientHeight,h:t.scrollWidth>t.clientWidth}}hasScroll(){return _e.hasScroll(this)}}const De=_e;function Me(e,t){return De.isCollWith(e,t)}const Ne=e=>De.borderWidth(e),ke=e=>De.border(e),Ie=e=>De.margin(e),Re=e=>De.padding(e);function Be(e){const t=e.offsetTop,r=t+e.offsetHeight,n=window.scrollY,o=n+window.innerHeight;return r>n&&t<o}function je(e){const t=window.scrollY,r=t+window.innerHeight,n=e.offsetTop;return n+e.offsetHeight<=r&&n>=t}const Oe=class{#$;#U;#z;#J;#V;#q;#G;#Y;constructor(e={}){const{target:t,fullscreen:r=!0,hoverClass:n="dnd-hover",onDrop:o,onEnter:i,onLeave:s}=e;if("boolean"!=typeof r)throw new TypeError('The "fullscreen" option must be a boolean.');const a=r?document.body:t||document.body;if(!(a instanceof HTMLElement))throw new TypeError('The "target" option must be an instance of HTMLElement.');if("string"!=typeof n)throw new TypeError('The "hoverClass" option must be a string.');if("function"!=typeof o)throw new TypeError('The "onDrop" option must be a function.');if("function"!=typeof i)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.#$=a,this.#U=r,this.#z=n,this.#J=o||(()=>{}),this.#V=i,this.#q=s,this.#G=!1,this.#Y=!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.#K()}getTarget(){return this.#$}getHoverClass(){return this.#z}isFullScreen(){return this.#U}isDragging(){return this.#G}bound(){return this.#Y}#K(){if(this.#Y)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.#Y=!0}#Q(){if(!this.#Y)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.#Y=!1}_handleDragEnter(e){if(e.preventDefault(),!this.#G){const t=this.getTarget();this.#G=!0,t.classList.add(this.#z),this.#V(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.#G=!1,t.classList.remove(this.#z),this.#q(e))}_handleDrop(e){if(e.preventDefault(),!e.dataTransfer)return void console.warn("[TinyDragDropDetector] [handleDrop] DragOver event missing dataTransfer.");const t=this.getTarget();this.#G=!1,t.classList.remove(this.#z);const r=e.dataTransfer.files;r.length>0&&this.#J(r,e)}destroy(){this.#Q(),this.getTarget().classList.remove(this.#z)}};var Pe=r(133),He=r(975);function We(e){if(!(0,Pe.existsSync)(e))throw new Error(`File not found: ${e}`);const t=(0,Pe.readFileSync)(e,"utf-8");return JSON.parse(t)}function Fe(e,t,r=2){const n=JSON.stringify(t,null,r);(0,Pe.writeFileSync)(e,n,"utf-8")}function $e(e){(0,Pe.existsSync)(e)||(0,Pe.mkdirSync)(e,{recursive:!0})}function Ue(e){if(!(0,Pe.existsSync)(e))return;const t=(0,Pe.readdirSync)(e);for(const r of t){const t=(0,He.join)(e,r);(0,Pe.lstatSync)(t).isDirectory()?(0,Pe.rmSync)(t,{recursive:!0,force:!0}):(0,Pe.unlinkSync)(t)}}function ze(e){return(0,Pe.existsSync)(e)&&(0,Pe.lstatSync)(e).isFile()}function Je(e){return(0,Pe.existsSync)(e)&&(0,Pe.lstatSync)(e).isDirectory()}function Ve(e){return 0===(0,Pe.readdirSync)(e).length}function qe(e,t,r){$e((0,He.dirname)(t)),(0,Pe.copyFileSync)(e,t,r)}function Ge(e){return!!ze(e)&&((0,Pe.unlinkSync)(e),!0)}function Ye(e,t,r="utf-8"){$e((0,He.dirname)(e)),(0,Pe.writeFileSync)(e,t,r)}function Ke(e,t=!1){const r={files:[],dirs:[]};if(!Je(e))return r;const n=(0,Pe.readdirSync)(e);for(const o of n){const n=(0,He.join)(e,o);if((0,Pe.lstatSync)(n).isDirectory()){if(r.dirs.push(n),t){const e=Ke(n,!0);r.files.push(...e.files),r.dirs.push(...e.dirs)}}else r.files.push(n)}return r}function Qe(e,t=!1){const r=[];if(!Je(e))return r;const n=(0,Pe.readdirSync)(e);for(const o of n){const n=(0,He.join)(e,o);(0,Pe.lstatSync)(n).isDirectory()&&(r.push(n),t&&r.push(...Qe(n,!0)))}return r}function Xe(e){return ze(e)?(0,Pe.statSync)(e).size:0}function Ze(e){let t=0;const r=Ke(e,!0).files;for(const e of r)t+=Xe(e);return t}function et(e,t="bak"){ze(e)&&qe(e,`${e}.${t}.${(new Date).toISOString().replace(/[:.]/g,"-")}`)}function tt(e,t="bak"){const r=(0,He.dirname)(e),n=(0,He.basename)(e),o=(0,Pe.readdirSync)(r).filter(e=>e.startsWith(`${n}.${t}.`)).sort().reverse();if(0===o.length)throw new Error(`No backups found for ${e}`);return(0,He.join)(r,o[0])}function rt(e,t="bak"){qe(tt(e,t),e)}function nt(e,t,r=[]){if("string"!=typeof e)throw new TypeError("dirPath must be a string");if("function"!=typeof t)throw new TypeError("renameFn must be a function");if(!Array.isArray(r))throw new TypeError("extensions must be an array of strings");if(!(0,Pe.existsSync)(e)||!(0,Pe.statSync)(e).isDirectory())throw new Error(`Directory not found or invalid: ${e}`);for(const e of r)if("string"!=typeof e||!e.startsWith("."))throw new TypeError(`Invalid extension: ${e}`);const n=Ke(e).files;let o=0;for(const i of n){const n=(0,He.extname)(i);if(r.length&&!r.includes(n))continue;const s=(0,He.basename)(i),a=t(s,o++),l=(0,He.join)(e,a);s!==a&&(0,Pe.renameSync)(i,l)}}function ot(e,t,r,n=[]){nt(e,e=>{const n=(0,He.extname)(e);return`${(0,He.basename)(e,n).replace(t,r)}${n}`},n)}function it(e,{prefix:t="",suffix:r=""},n=[]){nt(e,e=>{const n=(0,He.extname)(e),o=(0,He.basename)(e,n);return`${t}${o}${r}${n}`},n)}function st(e,t="lower",r=[],n=!1){if("string"!=typeof t||!["lower","upper","title"].includes(t))throw new Error(`Invalid mode "${t}". Must be 'lower', 'upper' or 'title'.`);nt(e,e=>{const r=e=>"lower"===t?e.toLowerCase():"upper"===t?e.toUpperCase():"title"===t?j(e):e,o=(0,He.extname)(e),i=n?r(o):o;return`${r((0,He.basename)(e,o))}${i}`},r)}function at(e,t=3,r=[]){nt(e,e=>e.replace(/\d+/,e=>e.padStart(t,"0")),r)}var lt=r(370);async function ut(e){if(!(0,Pe.existsSync)(e))return;const t=await(0,lt.readdir)(e),r={},n=[];for(const o of t){const t=(0,He.join)(e,o),i=(0,lt.lstat)(t);i.then(e=>(r[t]=e,e)),n.push(i)}await Promise.all(n);const o=[];for(const e in r)r[e].isDirectory()?o.push((0,lt.rm)(e,{recursive:!0,force:!0})):o.push((0,lt.unlink)(e));await Promise.all(o)}async function ht(e){return 0===(await(0,lt.readdir)(e)).length}async function ct(e,t=!1){const r={files:[],dirs:[]};if(!Je(e))return r;const n=await(0,lt.readdir)(e);for(const o of n){const n=(0,He.join)(e,o);if((await(0,lt.lstat)(n)).isDirectory()){if(r.dirs.push(n),t){const e=await ct(n,!0);r.files.push(...e.files),r.dirs.push(...e.dirs)}}else r.files.push(n)}return r}async function dt(e,t=!1){const r=[];if(!Je(e))return r;const n=await(0,lt.readdir)(e);for(const o of n){const n=(0,He.join)(e,o);(await(0,lt.lstat)(n)).isDirectory()&&(r.push(n),t&&r.push(...await dt(n,!0)))}return r}async function ft(e){return ze(e)?(await(0,lt.stat)(e)).size:0}async function mt(e){let t=0;const{files:r}=await ct(e,!0),n=[];for(const e of r){const r=ft(e);r.then(e=>(t+=e,e)),n.push(r)}return await Promise.all(n),t}class pt{static Utils={...e,TinyHtml:De};#X=!0;#Z=!1;#ee=0;#te=0;#re=!0;#ne=!1;#oe=!1;#ie=!1;#se=!1;#ae=!1;#le=!1;#ue=null;#he=[];#ce=null;#de={start:!1,end:!1,collide:!1,move:!1};#fe=null;#$;#me="drag-hidden";#pe="dragging";#ge="drag-active";#ye="jail-drag-active";#be="jail-drag-disabled";#we="dragging-collision";#ve=9999;constructor(e,t={}){const r=e instanceof De?e.get(0):e;if(!(r instanceof HTMLElement))throw new Error("TinyDragger requires a valid target HTMLElement to initialize.");if(this.#$=r,void 0!==t.jail&&!(t.jail instanceof HTMLElement))throw new Error('The "jail" option must be an HTMLElement if provided.');if(void 0!==t.defaultZIndex&&this.setDefaultZIndex(t.defaultZIndex),void 0!==t.vibration&&!1!==t.vibration&&!f(t.vibration))throw new Error('The "vibration" option must be an object or false.');const n=(e,t)=>{if(void 0!==e&&"boolean"!=typeof e)throw new Error(`The "${t}" option must be a boolean.`)},o=(e,t)=>{if(void 0!==e&&"string"!=typeof e)throw new Error(`The "${t}" option must be a string.`)};n(t.mirrorElem,"mirrorElem"),n(t.collisionByMouse,"collisionByMouse"),n(t.lockInsideJail,"lockInsideJail"),n(t.dropInJailOnly,"dropInJailOnly"),n(t.revertOnDrop,"revertOnDrop"),n(t.multiCollision,"multiCollision"),o(t.classDragging,"classDragging"),o(t.classBodyDragging,"classBodyDragging"),o(t.classJailDragging,"classJailDragging"),o(t.classJailDragDisabled,"classJailDragDisabled"),o(t.classDragCollision,"classDragCollision"),o(t.classHidden,"classHidden"),t.jail instanceof HTMLElement&&(this.#fe=t.jail),this.#de=Object.assign({start:!1,end:!1,collide:!1,move:!1},f(t.vibration)?t.vibration:{}),"string"==typeof t.classDragging&&(this.#pe=t.classDragging),"string"==typeof t.classBodyDragging&&(this.#ge=t.classBodyDragging),"string"==typeof t.classJailDragging&&(this.#ye=t.classJailDragging),"string"==typeof t.classJailDragDisabled&&(this.#be=t.classJailDragDisabled),"string"==typeof t.classHidden&&(this.#me=t.classHidden),"string"==typeof t.classDragCollision&&(this.#we=t.classDragCollision),"boolean"==typeof t.collisionByMouse&&(this.#ae=t.collisionByMouse),"boolean"==typeof t.mirrorElem&&(this.#re=t.mirrorElem),"boolean"==typeof t.revertOnDrop&&(this.#ie=t.revertOnDrop),"boolean"==typeof t.lockInsideJail&&(this.#oe=t.lockInsideJail),"boolean"==typeof t.dropInJailOnly&&(this.#le=t.dropInJailOnly),"boolean"==typeof t.multiCollision&&(this.#ne=t.multiCollision),this._onMouseDown=this.#Ee.bind(this),this._onMouseMove=this.#Te.bind(this),this._onMouseUp=this.#xe.bind(this),this._onTouchStart=e=>this.#Ee(e.touches[0]),this._onTouchMove=e=>this.#Te(e.touches[0]),this._onTouchEnd=e=>this.#xe(e.changedTouches[0]),this.#$.addEventListener("mousedown",this._onMouseDown),this.#$.addEventListener("touchstart",this._onTouchStart,{passive:!1})}enable(){this.#Se(),this.#fe&&this.#fe.classList.add(this.#be),this.#X=!0}disable(){this.#fe&&this.#fe.classList.remove(this.#be),this.#X=!1}addCollidable(e){if(this.#Se(),!(e instanceof HTMLElement))throw new Error("addCollidable expects an HTMLElement as argument.");this.#he.includes(e)||this.#he.push(e)}removeCollidable(e){if(this.#Se(),!(e instanceof HTMLElement))throw new Error("removeCollidable expects an HTMLElement as argument.");this.#he=this.#he.filter(t=>t!==e)}setVibrationPattern({startPattern:e=!1,endPattern:t=!1,collidePattern:r=!1,movePattern:n=!1}={}){this.#Se();const o=e=>!1===e||Array.isArray(e)&&e.every(e=>"number"==typeof e);if(!o(e))throw new Error('Invalid "startPattern": must be false or an array of numbers.');if(!o(t))throw new Error('Invalid "endPattern": must be false or an array of numbers.');if(!o(r))throw new Error('Invalid "collidePattern": must be false or an array of numbers.');if(!o(n))throw new Error('Invalid "movePattern": must be false or an array of numbers.');this.#de={start:e,end:t,collide:r,move:n}}disableVibration(){this.#Se(),this.#de={start:!1,end:!1,collide:!1,move:!1}}getOffset(e){if(this.#Se(),!(e instanceof MouseEvent||e instanceof Touch)||"number"!=typeof e.clientX||"number"!=typeof e.clientY)throw new Error("getOffset expects an event with valid clientX and clientY coordinates.");const t=this.#$.getBoundingClientRect(),{left:r,top:n}=De.borderWidth(this.#$);return{x:e.clientX-t.left+r,y:e.clientY-t.top+n}}#Ee(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#Z||!this.#X||!this.#$.parentElement)return;if(this.#re){const e=this.#$.cloneNode(!0);if(!(e instanceof HTMLElement))throw new Error("[TinyDragger] INVALID DRAG ELEMENT!");this.#ce=e}else this.#ce=this.#$;this.#se=!0;const t=this.#$.getBoundingClientRect();Object.assign(this.#ce.style,{position:"absolute",pointerEvents:"none",left:`${this.#$.offsetLeft}px`,top:`${this.#$.offsetTop}px`,width:`${t.width}px`,height:`${t.height}px`,zIndex:this.#ve}),this.#re&&(this.#$.classList.add(this.#me),this.#$.parentElement.appendChild(this.#ce));const{x:r,y:n}=this.getOffset(e);this.#te=r,this.#ee=n,this.#ce.classList.add(this.#pe),document.body.classList.add(this.#ge),this.#fe&&this.#fe.classList.add(this.#ye),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),document.addEventListener("touchmove",this._onTouchMove,{passive:!1}),document.addEventListener("touchend",this._onTouchEnd),navigator.vibrate&&Array.isArray(this.#de.start)&&navigator.vibrate(this.#de.start),this.checkDragCollision(e),this.#Le("drag")}#Ce=[];#Ae(e){e&&(e.classList.add(this.#we),this.#Ce.push(e))}#_e(){for(;this.#Ce.length>0;){const e=this.#Ce.shift();e&&e.classList.remove(this.#we)}this.#ue&&this.#ue.classList.remove(this.#we)}checkDragCollision(e){const{collidedElements:t}=this.execCollision(e),r=t[0]||null;this.#ue&&!t.includes(this.#ue)&&this.#_e(),t.forEach(e=>this.#Ae(e)),this.#he.forEach(e=>{t.includes(e)||e.classList.remove(this.#we)}),navigator.vibrate&&Array.isArray(this.#de.collide)&&t.length>0&&navigator.vibrate(this.#de.collide),this.#ue=r}#Te(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#Z||!this.#se||!this.#X||!this.#ce)return;const t=(this.#ce.offsetParent||document.body).getBoundingClientRect();let r=e.clientX-t.left-this.#te,n=e.clientY-t.top-this.#ee;if(this.#oe&&this.#fe){const e=this.#fe.getBoundingClientRect(),o=this.#ce.getBoundingClientRect(),i=e.left-t.left,s=e.top-t.top,{x:a,y:l}=De.borderWidth(this.#fe),u=i+e.width-o.width-l,h=s+e.height-o.height-a;r=Math.max(i,Math.min(r,u)),n=Math.max(s,Math.min(n,h))}this.#ce.style.position="absolute",this.#ce.style.left=`${r}px`,this.#ce.style.top=`${n}px`,navigator.vibrate&&Array.isArray(this.#de.move)&&navigator.vibrate(this.#de.move),this.checkDragCollision(e),this.#Le("dragging")}execCollision(e){if(this.#Z||!this.#ce)return{inJail:!1,collidedElements:[]};let t=[],r=!0;const n=this.#fe?.getBoundingClientRect();if(this.#ae){const o=e.clientX,i=e.clientY;this.#le&&this.#fe&&n&&(r=o>=n.left&&o<=n.right&&i>=n.top&&i<=n.bottom),t=r?this.#ne?this.getAllCollidedElements(o,i):[this.getCollidedElement(o,i)].filter(Boolean):[]}else{const e=this.#ce.getBoundingClientRect();this.#le&&this.#fe&&n&&(r=e.left>=n.left&&e.right<=n.right&&e.top>=n.top&&e.bottom<=n.bottom),t=r?this.#ne?this.getAllCollidedElementsByRect(e):[this.getCollidedElementByRect(e)].filter(Boolean):[]}return{inJail:r,collidedElements:t}}#xe(e){if(e instanceof MouseEvent&&e.preventDefault(),this.#Z||!this.#se)return;if(this.#se=!1,!this.#ce)return;this.#$.classList.remove(this.#pe),document.body.classList.remove(this.#ge),this.#fe&&this.#fe.classList.remove(this.#ye),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd);const{collidedElements:t}=this.execCollision(e);navigator.vibrate&&Array.isArray(this.#de.end)&&navigator.vibrate(this.#de.end);const r=this.#ce.style.left,n=this.#ce.style.top;this.#ce&&(this.#re?this.#ce.remove():Object.assign(this.#ce.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#ce=null),this.#ue&&this.#_e(),this.#ue=null,this.#re&&this.#$.classList.remove(this.#me),this.#ie||(this.#$.style.left=r,this.#$.style.top=n);const o=new CustomEvent("drop",{detail:{targets:t,first:t[0]||null}});this.#$.dispatchEvent(o)}#De(e,t){const r=e.getBoundingClientRect();return!(t.right<r.left||t.left>r.right||t.bottom<r.top||t.top>r.bottom)}getAllCollidedElementsByRect(e){if(this.#Se(),!(e instanceof DOMRect)||"number"!=typeof e.left||"number"!=typeof e.right||"number"!=typeof e.top||"number"!=typeof e.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#he.filter(t=>this.#De(t,e))}getCollidedElementByRect(e){if(this.#Se(),!(e instanceof DOMRect)||"number"!=typeof e.left||"number"!=typeof e.right||"number"!=typeof e.top||"number"!=typeof e.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#he.find(t=>this.#De(t,e))||null}#Me(e,t,r){const n=e.getBoundingClientRect();return t>=n.left&&t<=n.right&&r>=n.top&&r<=n.bottom}getAllCollidedElements(e,t){if(this.#Se(),"number"!=typeof e||"number"!=typeof t)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#he.filter(r=>this.#Me(r,e,t))}getCollidedElement(e,t){if(this.#Se(),"number"!=typeof e||"number"!=typeof t)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#he.find(r=>this.#Me(r,e,t))||null}#Le(e){const t=new CustomEvent(e);this.#$.dispatchEvent(t)}getDragging(){return this.#se}getLockInsideJail(){return this.#oe}setLockInsideJail(e){if("boolean"!=typeof e)throw new Error("lockInsideJail must be a boolean.");this.#oe=e}getRevertOnDrop(){return this.#ie}setRevertOnDrop(e){if("boolean"!=typeof e)throw new Error("revertOnDrop must be a boolean.");this.#ie=e}getCollisionByMouse(){return this.#ae}setCollisionByMouse(e){if("boolean"!=typeof e)throw new Error("collisionByMouse must be a boolean.");this.#ae=e}getDropInJailOnly(){return this.#le}setDropInJailOnly(e){if("boolean"!=typeof e)throw new Error("dropInJailOnly must be a boolean.");this.#le=e}getDefaultZIndex(){return this.#ve}setDefaultZIndex(e){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError("Z-index must be a finite number.");this.#ve=e}isMirrorEnabled(){return this.#re}setMirrorEnabled(e){if("boolean"!=typeof e)throw new TypeError("Mirror setting must be a boolean.");this.#re=e}getTarget(){return this.#$}getJail(){return this.#fe}getDragProxy(){return this.#ce}getLastCollision(){return this.#ue}getCollidables(){return[...this.#he]}getDragHiddenClass(){return this.#me}getClassDragging(){return this.#pe}getClassBodyDragging(){return this.#ge}getClassJailDragging(){return this.#ye}getClassJailDragDisabled(){return this.#be}getClassDragCollision(){return this.#we}getVibrations(){return{...this.#de}}getStartVibration(){return this.#de.start}getEndVibration(){return this.#de.end}getCollideVibration(){return this.#de.collide}getMoveVibration(){return this.#de.move}isEnabled(){return this.#X}#Se(){if(this.#Z)throw new Error("This TinyDragger instance has been destroyed and can no longer be used.")}destroy(){this.#Z||(this.disable(),this.#$.removeEventListener("mousedown",this._onMouseDown),this.#$.removeEventListener("touchstart",this._onTouchStart),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),this.#ue&&this.#_e(),this.#ce&&(this.#re?this.#ce.remove():Object.assign(this.#ce.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#ce=null),this.#he=[],this.#se=!1,this.#ue=null,this.#re&&this.#$.classList.remove(this.#me),this.#$.classList.remove(this.#pe),document.body.classList.remove(this.#ge),this.#fe&&this.#fe.classList.remove(this.#ye,this.#be),this.#Z=!0)}}const gt=pt,yt=class{#Ne=[];#ke=!1;#Ie=!1;#Re=[];#Be(){this.#ke&&Promise.all(this.#Re).then(()=>{this.#Ie=!0,this.#je(!1)}).catch(e=>{console.error("[TinyDomReadyManager] Promise rejected:",e)})}#je(e){this.#Ne.filter(t=>t.domOnly===e).sort((e,t)=>t.priority-e.priority).forEach(e=>this.#Oe(e)),this.#Ne=this.#Ne.filter(t=>!(t.once&&(!e||t.domOnly)))}#Oe(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.#ke=!0,this.#je(!0),this.#Be()}init(){if(this.#ke)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.#Ie||(this.#Re.push(e),this.#ke&&this.#Be())}onReady(e,{once:t=!0,priority:r=0,filter:n=null,domOnly:o=!1}={}){if("function"!=typeof e)throw new TypeError("[TinyDomReadyManager] fn must be a function.");const i={fn:e,once:t,priority:r,filter:n,domOnly:o};if(o&&this.#ke)return this.#Oe(i),void(t||this.#Ne.push(i));!o&&this.#Ie?this.#Oe(i):this.#Ne.push(i)}isReady(){return this.#Ie}isDomReady(){return this.#ke}},bt=class{#Pe=!1;#He=!1;#We=null;#Fe=100;#$e=null;#Ue;constructor({audio:e=null,defaultIcon:t=null,bodyLimit:r=100,defaultOnClick:n=function(e){e.preventDefault(),window.focus&&window.focus(),this.close()}}={}){if(!(e instanceof HTMLAudioElement)&&"string"!=typeof e&&null!==e)throw new TypeError("audio must be an instance of HTMLAudioElement or null.");if(null!==t&&"string"!=typeof t)throw new TypeError("defaultIcon must be a string or null.");if(!Number.isFinite(r)||r<0)throw new TypeError("bodyLimit must be a non-negative number.");if("function"!=typeof n)throw new TypeError("defaultOnClick must be a function.");this.#We="string"!=typeof e?e:new Audio(e),this.#$e=t,this.#Fe=r,this.#Ue=n}requestPerm(){const e=this;return new Promise((t,r)=>{e.isCompatible()?"default"===Notification.permission?Notification.requestPermission().then(r=>{this.#He=!0,e.#Pe="granted"===r,t(e.#Pe)}).catch(r):(this.#He=!0,e.#Pe="granted"===Notification.permission,t(e.#Pe)):(this.#He=!0,e.#Pe=!1,t(!1))})}isCompatible(){return"Notification"in window}send(e,t={}){if(!this.#He)throw new Error("You must call requestPerm() before sending a notification.");if("string"!=typeof e)throw new TypeError("title must be a string.");if("object"!=typeof t||null===t)throw new TypeError("config must be a non-null object.");if(!this.#Pe)return null;const{icon:r=this.#$e||void 0,vibrate:n=[200,100,200]}=t,o={...t};"string"==typeof r&&(o.icon=r),Array.isArray(n)&&(o.vibrate=n),"string"==typeof o.body&&(o.body=H(o.body,this.#Fe));const i=new Notification(e,o);return i.addEventListener("show",()=>{this.#We instanceof HTMLAudioElement&&(this.#We.currentTime=0,this.#We.play().catch(e=>console.error(e)))}),"function"==typeof this.#Ue&&i.addEventListener("click",this.#Ue),i}wasPermissionRequested(){return this.#He}isAllowed(){return this.#Pe}getAudio(){return this.#We}setAudio(e){if(!(e instanceof HTMLAudioElement)&&"string"!=typeof e&&null!==e)throw new TypeError("sound must be an instance of HTMLAudioElement or null.");this.#We="string"!=typeof e?e:new Audio(e)}getBodyLimit(){return this.#Fe}setBodyLimit(e){if(!Number.isFinite(e)||e<0)throw new TypeError("bodyLimit must be a non-negative number.");this.#Fe=e}getDefaultAvatar(){return this.#$e}setDefaultAvatar(e){if("string"!=typeof e&&null!==e)throw new TypeError("defaultIcon must be a string or null.");this.#$e=e}getDefaultOnClick(){return this.#Ue}setDefaultOnClick(e){if("function"!=typeof e)throw new TypeError("defaultOnClick must be a function.");this.#Ue=e}},wt=class{#ze;#Je=null;#Ve=[];#qe=100;#Ge=new Set;#Ye=new Set;#Z=!1;constructor(e=window,t=100){if(!(e instanceof Element||e instanceof Window))throw new TypeError("scrollTarget must be an Element or the Window object.");this.#ze=e,this._checkTimer=this._checkTimer.bind(this),this.#ze.addEventListener("scroll",this._checkTimer),this.#qe=t}_checkTimer=()=>{this.#Je&&clearTimeout(this.#Je),this.#Je=setTimeout(()=>{this.#Je=null,this.#Ke()},this.#qe)};get inactivityTime(){return this.#qe}set inactivityTime(e){if("number"!=typeof e||e<=0||!Number.isFinite(e))throw new Error("inactivityTime must be a positive number in milliseconds.");this.#qe=e}#Ke(){if(!this.#Z){for(const e of this.#Ye)"function"==typeof e&&e();for(;this.#Ve.length;){const e=this.#Ve.pop();"function"==typeof e&&e()}}}doAfterScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.lastScrollTime=Date.now(),this.#Ve.push(e)}onStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ye.add(e)}offStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ye.delete(e)}onScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#ze.addEventListener("scroll",e),this.#Ge.add(e)}offScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#Ge.has(e)&&(this.#ze.removeEventListener("scroll",e),this.#Ge.delete(e))}destroy(){if(!this.#Z){this.#Z=!0,this.#ze.removeEventListener("scroll",this._checkTimer);for(const e of this.#Ge)this.#ze.removeEventListener("scroll",e);this.#Ge.clear(),this.#Ye.clear()}}},vt=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","sed","do","eiusmod","tempor","incididunt","ut","labore","et","dolore","magna","aliqua"],Et=["😂","🌈","🤖","💥","🐸","🍕","🦄","🧠","🧬","🚀","🫠","💫","🍩","👾","🎉","🥴","🐙","🧃","🪐","🎈","🧸","👻","🥳","🍭","💖","😺","🌮","🪅","🎮","🥓","🍮"],Tt=["pudding","bean","snuggle","bloop","jelly","unicorn","floof","giggle","bubble","muffin","puff","pickle","goblin","waffle","sprinkle","cupcake","fizzle","marshmallow","duckling","sock","cloud","teacup","nugget","gnome","hug","moonbean","crayon","jiggle","glitter","carrot","goober"],xt=["wiggles","bounces","flies","splats","scoots","giggles","wigglesnacks","twirls","boops","pops","sings","hugs","floats","glows","flaps","mlems","dances","puddles","nomnoms","wigglejumps","sniffs","tumbles","slides","chirps","burps","sparkles","waddles","rambles","blinks","mews"],St=["fluffy","silly","yummy","squishy","wobbly","magical","tiny","sleepy","wiggly","bubbly","glittery","fuzzy","jiggly","sparkly","giggly","crunchy","goofy","soft","mushy","sweet","loopy","floaty","bonkers","chewy","ticklish","dreamy","pastel","cozy","teensy","grumbly"],Lt=["Boop!","Wiggle achieved.","Oops, {noun} everywhere!","Tiny {adj} {noun}, big {adj} {noun}.","Snuggle initiated with a {adj} {noun}.","{adj} vibes only, powered by {noun}.","No {noun}, no {noun}.","Bounce first, {verb} later.","Mlem. {verb}. {noun}.","{noun} go brrr and {verb}.","Why not? {noun} did. Then {noun} followed.","A {adj} {noun} just {verb} near the {adj} window.","That {adj} {noun} stole my {noun}!","Look, a {adj} {noun} trying to {verb} again!","Every {noun} deserves a {adj} nap.","The {adj} {noun} is my {adj} spirit animal.","Someone call the {noun}, it’s {verb}ing and {verb}ing again!","Don’t touch the {adj} {noun}. It {verb}s loudly.","{noun} forgot how {noun}s work and just {verb}ed.","There once was a {adj} {noun} who loved to {verb} with a {adj} {noun} all day.","Apparently, {noun}s are banned from {verb}ing and {verb}ing in the {noun} library.","That {adj} noise? Just a {noun} learning to {verb} on a {adj} {noun}.","I saw a {adj} {noun} {verb} so hard, it became a {adj} muffin.","The {adj} {noun} met a {adj} pickle and everything {verb}ed.","{noun}s are like {noun}: {adj}, unpredictable, and wiggly.","Don’t judge a {adj} {noun} by its ability to {verb}, or by its {adj} hat.","All I wanted was peace, but a {adj} {noun} with a {adj} {noun} had other plans.","One {adj} morning, a {adj} {noun} decided it was finally time to {verb}, but halfway through, it tripped on a {noun} and turned into a {adj} marshmallow.","I tried to be {adj} today, but then a {noun} {verb}ed across my {noun} and typed “asdfgh{noun}” repeatedly.","If you think you’ve seen everything, wait until a {adj} {noun} {verb}s on a {noun} wearing {adj} socks with tiny {noun}s.","No one ever believed the stories about the ancient {adj} {noun} who could {verb} with such {adj} grace that entire {noun}s turned pink out of embarrassment.","A curious {adj} {noun} wandered into a {noun} shop, not knowing that its destiny involved twelve {adj} {noun}s, one rubber {noun}, and a suspiciously quiet {adj} llama.","In a land where every {adj} {noun} was made of pudding and the sky was {adj} whipped cream, one brave {adj} {noun} set out to discover the legendary Spoon of {noun}s, facing obstacles like bouncing {noun}s, sassy {noun}s, and the Great Wobble of the {noun}.","Once upon a {adj} time, long before the {noun}s learned to {verb}, there existed a tiny {adj} {noun} who dreamed of swimming in a pool made entirely of {adj} glitter pudding while {verb}ing off-key lullabies to passing {noun}s with monocles.","The Council of {noun}s gathered in {adj} secret when the sacred {adj} {noun} started to {verb} uncontrollably, threatening the entire {adj} dessert-based civilization with spontaneous {noun} jiggles and uncontainable {noun} fits across the {noun}.","Hey... do you ever wonder if {noun}s dream of {noun}s?","Okay but hear me out: what if the {adj} {noun} could actually {verb} backwards?","Can we talk about the {noun} that just {verb}ed and vanished?","So I was talking to a {noun}, and it told me to stop being {adj}. Rude.","Not to alarm you, but there’s a {adj} {noun} behind you doing the {verb}.","Why does this {noun} keep staring at me like I owe it pudding?","Is this a safe space to admit I accidentally {verb}ed a {noun}?","I just walked into the room and someone shouted “{adj} {noun}!” — what did I miss?","Wait... we were supposed to bring a {noun}? No one told me!","Okay but what if the {adj} {noun} has feelings too?","Be honest, do I look like a {noun} that forgot how to {verb}?",'If I say "oops", do I still have to explain why the {noun} is glowing?',"I don’t know what’s going on but I brought snacks and a confused {noun}.","Do you think pudding knows it’s pudding? Just a thought.","Is this about the time I {verb}ed the {adj} {noun} by accident? Because I can explain.","Wait, are we talking about {noun}s or am I on the wrong chat again?",'What is this group even about? I just saw "pudding" and joined.',"Hi! I have no idea what’s happening but I’m here and I brought a {noun}.","I blinked and now there’s a {adj} {noun} in charge of everything.","Can someone please explain why the {noun} is floating and chanting?","Okay who gave the {noun} access to glitter and emotional support pickles?","I came for a calm discussion and now there’s a {adj} battle between {noun}s.","Not sure if I’m early, late, or inside a {noun} dream.","I was gone for 3 minutes and now someone’s riding a {noun} into the pudding realm.","This isn’t the pudding appreciation group, is it? ...oh no.","So... who summoned the {adj} {noun} this time? Be honest.","I came here for vibes and stayed for the {noun}s.","Does anyone else hear faint giggling or is that just the {adj} {noun} again?","I feel like I missed step one, two, and also three of this conversation.","All I asked was “what’s up?” and now I’m emotionally attached to a {noun}.",'Me: "I’ll be normal today." Also me: *{verb}s into a meeting riding a {adj} {noun}*','"It’s just pudding," they said. "It can’t hurt you," they said. They were wrong.',"I said one nice thing to a {noun} and now it follows me everywhere.","Can we take a moment to appreciate how the {adj} {noun} is just vibing?","Who put a tiny hat on the {noun}? Because that’s adorable.","My life has been different ever since the {noun} started {verb}ing.","Raise your hand if you’ve ever been personally attacked by a {adj} {noun}.",'"Don’t be weird," they said. So I became a {noun} instead.',"Do {noun}s have feelings? Asking for a {adj} friend.","I trusted the {noun} and all I got was a glitter-covered sock.","Plot twist: the {adj} {noun} was inside us all along.","The {adj} {noun} {verb} and {verb} all over the {adj} {noun}!","Oops! {noun}s {verb}ed into the {adj} {noun} while {verb}ing crazily.","{adj}, {adj}, and more {adj} {noun}s just {verb}ed by!","Why does the {adj} {noun} keep {verb}ing and {verb}ing without stopping?","Look! A {adj} {noun}, a {adj} {noun}, and a {noun} all {verb}ing together!","Sometimes, the {noun} just {verb}s, then {verb}s again, and never stops being {adj}.","{noun}, {noun}, and {noun} — all {verb}ing and {verb}ing in a {adj} {noun}.","I saw a {adj} {noun} {verb}, then another {noun} {verb}ing with a {adj} {noun}.","The {noun} {verb}s {verb} while the {adj} {noun} {verb}s and the {noun} just {verb}s.","Can a {adj} {noun} {verb} {verb} without a {adj} {noun} watching?","Whoa! The {adj} {noun} just {verb}ed... and then {verb}ed again!","Hey... did you see that {adj} {noun} {verb} over there?","Umm, the {noun} is {verb}ing but also {verb}ing and {verb}ing!","Lol! {noun}s {verb} so {adj}ly, it’s impossible not to giggle.",'"Hey! What’s up?" asked the {adj} {noun}, who {verb}ed loudly.','"I’m just a {adj} {noun} trying to {verb}, you know?"','"Did you see the {adj} {noun} that just {verb}ed in the pudding?"','"No way! The {noun} {verb}s better than me!"','"Wait, the {adj} {noun} said it would {verb}, but it {verb}ed instead!"',"Once upon a {adj} {noun}, a group of {adj} {noun}s {verb}ed through the {adj} forest, singing {adj} songs and eating {noun}s made of pudding.","The legend tells of a {adj} {noun} who could {verb} faster than any {noun} ever seen, leaving trails of {adj} sparkles behind.","Every day, the {adj} {noun} would {verb} around the {adj} meadow, trying to convince the {noun}s to join the grand pudding party.","No one knows why the {adj} {noun} suddenly {verb}ed and then {verb}ed again, but everyone agrees it was the cutest thing they ever saw.","In the kingdom of {adj} {noun}s, only the bravest {noun} dared to {verb} the giant pudding monster, armed with nothing but {adj} smiles and jellybeans.","{adj} {noun} {verb} {verb} {verb} {noun} {verb} {adj} {noun} {verb} {noun}!","{noun} {noun} {verb} {adj} {noun} and then {verb} {verb} the {adj} {noun}.","{verb} the {adj} {noun}, then {verb} the {noun} while {verb}ing {adj}ly.","Can the {adj} {noun} {verb} and {verb} the {adj} {noun} at the same time?","{noun} {verb} {noun} {verb}, but the {adj} {noun} {verb}s better.","Boop! The {adj} {noun} just {verb}ed in the pudding.","Bloop bloop, the {noun} is {verb}ing all over again!","Mlem mlem, a {adj} {noun} {verb}s quietly in the corner.","Splat! {noun} {verb}ed right on the {adj} {noun}.","Yum! A {adj} {noun} just {verb}ed in my mouth.","Do {noun}s really {verb} when nobody’s watching?","Why does the {adj} {noun} always {verb} at midnight?","Can a {noun} be too {adj} to {verb} properly?","Is it normal for a {adj} {noun} to {verb} three times in a row?","Who taught the {noun} to {verb} like that?","Wait, did the {adj} {noun} just {verb} itself?","I can’t believe the {noun} {verb}ed into a {adj} {noun}!","Suddenly, a {adj} {noun} appeared and started to {verb} wildly.","That {noun} was {verb}ing so {adj}ly it broke the pudding meter.","Everyone’s talking about the {adj} {noun} that {verb}ed out of nowhere."],Ct=class{static defaultWords=vt;static defaultEmojis=Et;static defaultNouns=Tt;static defaultVerbs=xt;static defaultAdjectives=St;static defaultTemplates=Lt;config={minLength:10,maxLength:300,readable:!0,useEmojis:!0,includeNumbers:!0,includeSymbols:!0,allowWeirdSpacing:!1,emojiSet:[],wordSet:[],mode:"mixed",grammar:{templates:[],nouns:[],verbs:[],adjectives:[]},repeatWords:!0,emojiPlacement:"inline",line:{minLength:20,maxLength:120,emojiChance:.3}};constructor(e={}){this.symbols="!@#$%^&*()-_=+[]{}|;:,.<>?/\\~".split("");const{minLength:t,maxLength:r,readable:n,useEmojis:o,includeNumbers:i,includeSymbols:s,allowWeirdSpacing:a,emojiSet:l,wordSet:u,mode:h,grammar:c,repeatWords:d,emojiPlacement:f,paragraphs:m,line:p}=e;if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.minLength must be an integer >= 1");if(void 0!==r&&(!Number.isInteger(r)||r<1))throw new TypeError("config.maxLength must be an integer >= 1");if(void 0!==t&&void 0!==r&&t>r)throw new RangeError("config.minLength cannot be greater than config.maxLength");if(void 0!==n&&"boolean"!=typeof n)throw new TypeError("config.readable must be a boolean");if(void 0!==o&&"boolean"!=typeof o)throw new TypeError("config.useEmojis must be a boolean");if(void 0!==i&&"boolean"!=typeof i)throw new TypeError("config.includeNumbers must be a boolean");if(void 0!==s&&"boolean"!=typeof s)throw new TypeError("config.includeSymbols must be a boolean");if(void 0!==a&&"boolean"!=typeof a)throw new TypeError("config.allowWeirdSpacing must be a boolean");if(void 0!==l&&!Array.isArray(l))throw new TypeError("config.emojiSet must be an array of strings");if(void 0!==u&&!Array.isArray(u))throw new TypeError("config.wordSet must be an array of strings");if(void 0!==h&&!["mixed","readable","chaotic","natural"].includes(h))throw new RangeError('config.mode must be one of: "mixed", "readable", "chaotic", "natural');if(void 0!==c){if("object"!=typeof c||null===c)throw new TypeError("config.grammar must be an object");const{templates:e,nouns:t,verbs:r,adjectives:n}=c;if(void 0!==e&&!Array.isArray(e))throw new TypeError("config.grammar.templates must be an array of strings");if(void 0!==t&&!Array.isArray(t))throw new TypeError("config.grammar.nouns must be an array of strings");if(void 0!==r&&!Array.isArray(r))throw new TypeError("config.grammar.verbs must be an array of strings");if(void 0!==n&&!Array.isArray(n))throw new TypeError("config.grammar.adjectives must be an array of strings")}if(void 0!==d&&"boolean"!=typeof d)throw new TypeError("config.repeatWords must be a boolean");if(void 0!==f&&!["inline","end","none"].includes(f))throw new RangeError('config.emojiPlacement must be one of: "inline", "end", "none"');if(void 0!==m){if("object"!=typeof m)throw new TypeError("config.paragraphs must be an object or null");const{min:e,max:t}=m;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.paragraphs.min must be an integer >= 1");if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.paragraphs.max must be an integer >= 1");if(void 0!==e&&void 0!==t&&e>t)throw new RangeError("config.paragraphs.min cannot be greater than config.paragraphs.max")}if(void 0!==p){if("object"!=typeof p||null===p)throw new TypeError("config.line must be an object");const{minLength:e,maxLength:t,emojiChance:r}=p;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.line.minLength must be an integer >= 1");if(void 0!==t&&(!Number.isInteger(t)||t<1))throw new TypeError("config.line.maxLength must be an integer >= 1");if(void 0!==e&&void 0!==t&&e>t)throw new RangeError("config.line.minLength cannot be greater than config.line.maxLength");if(void 0!==r&&("number"!=typeof r||r<0||r>1))throw new RangeError("config.line.emojiChance must be a number between 0 and 1")}this.config.emojiSet=[...Et],this.config.wordSet=[...vt],this.config.grammar.templates=[...Lt],this.config.grammar.nouns=[...Tt],this.config.grammar.verbs=[...xt],this.config.grammar.adjectives=[...St],Object.assign(this.config,e)}configure(e={}){return Object.assign(this.config,e),this}setGrammarTemplates(...e){return this.config.grammar.templates=e.flat(),this}addGrammarTemplates(...e){return this.config.grammar.templates.push(...e.flat()),this}setGrammarNouns(...e){return this.config.grammar.nouns=e.flat(),this}addGrammarNouns(...e){return this.config.grammar.nouns.push(...e.flat()),this}setGrammarVerbs(...e){return this.config.grammar.verbs=e.flat(),this}addGrammarVerbs(...e){return this.config.grammar.verbs.push(...e.flat()),this}setGrammarAdjectives(...e){return this.config.grammar.adjectives=e.flat(),this}addGrammarAdjectives(...e){return this.config.grammar.adjectives.push(...e.flat()),this}removeGrammarTemplates(...e){const t=new Set(e.flat());return this.config.grammar.templates=this.config.grammar.templates.filter(e=>!t.has(e)),this}removeGrammarNouns(...e){const t=new Set(e.flat());return this.config.grammar.nouns=this.config.grammar.nouns.filter(e=>!t.has(e)),this}removeGrammarVerbs(...e){const t=new Set(e.flat());return this.config.grammar.verbs=this.config.grammar.verbs.filter(e=>!t.has(e)),this}removeGrammarAdjectives(...e){const t=new Set(e.flat());return this.config.grammar.adjectives=this.config.grammar.adjectives.filter(e=>!t.has(e)),this}setWords(...e){return this.config.wordSet=e.flat(),this}addWords(...e){return this.config.wordSet.push(...e.flat()),this}removeWords(...e){const t=new Set(e.flat());return this.config.wordSet=this.config.wordSet.filter(e=>!t.has(e)),this}setEmojis(...e){return this.config.emojiSet=e.flat(),this}addEmojis(...e){return this.config.emojiSet.push(...e.flat()),this}removeEmojis(...e){const t=new Set(e.flat());return this.config.emojiSet=this.config.emojiSet.filter(e=>!t.has(e)),this}_getRandomItem(e){return e[Math.floor(Math.random()*e.length)]}_generateChunk(){const{wordSet:e,emojiSet:t,includeNumbers:r,includeSymbols:n,useEmojis:o,readable:i,mode:s,emojiPlacement:a}=this.config;if("natural"===s)return this._generateNaturalSentence();const l=[];return(i||"readable"===s||"mixed"===s)&&l.push(this._getRandomItem(e)),"chaotic"!==s&&"mixed"!==s||l.push(Math.random().toString(36).slice(2)),r&&l.push(Math.floor(99999*Math.random()).toString()),n&&l.push(this._getRandomItem(this.symbols)),"inline"===a&&o&&t.length&&l.push(this._getRandomItem(t)),this._getRandomItem(l)}_generateNaturalSentence(){const{templates:e,nouns:t,verbs:r,adjectives:n}=this.config.grammar;return this._getRandomItem(e).replace(/{noun}/g,()=>this._getRandomItem(t)).replace(/{verb}/g,()=>this._getRandomItem(r)).replace(/{adj}/g,()=>this._getRandomItem(n))}_generateLine(e,t){const{allowWeirdSpacing:r,repeatWords:n,readable:o,emojiSet:i,useEmojis:s,emojiPlacement:a,line:l}=this.config,u=[];for(t??=new Set;u.join(" ").length<e;){let e=this._generateChunk();!n&&t.has(e)||(t.add(e),r&&(Math.random()<.1&&(e="\n"+e),Math.random()<.1&&(e=" "+e),Math.random()<.05&&(e=e.toUpperCase())),u.push(e))}let h=u.join(o?" ":"");return"end"===a&&s&&i.length&&Math.random()<(l?.emojiChance||0)&&(h+=" "+this._getRandomItem(i)),h}_generateParagraphLines(e){const{line:t}=this.config,r=[],n=new Set;let o=0;for(;o<e;){const i=Math.floor(Math.random()*(t.maxLength-t.minLength+1)+t.minLength),s=Math.min(i,e-o);r.push(this._generateLine(s,n)),o+=s}return r}generate(){const{minLength:e,maxLength:t,paragraphs:r}=this.config,n=Math.floor(Math.random()*(t-e+1))+e;if(r&&"object"==typeof r){const e=Math.floor(Math.random()*(r.max-r.min+1))+r.min,t=Math.floor(n/e),o=[];for(let r=0;r<e;r++){const e=this._generateParagraphLines(t);o.push(e.join("\n"))}return o.join("\n\n")}return this._generateParagraphLines(n).join("\n")}},At=class{#Qe=new Map;#Xe=10;#Ze=!1;setThrowOnMaxListeners(e){if("boolean"!=typeof e)throw new TypeError("setThrowOnMaxListeners(value): value must be a boolean");this.#Ze=e}getThrowOnMaxListeners(){return this.#Ze}#et(e,t,{once:r=!1}={}){let n=this.#Qe.get(e);Array.isArray(n)||(n=[],this.#Qe.set(e,n)),n.unshift({handler:t,config:{once:r}});const o=this.#Xe;if(o>0&&n.length>o){const t=`Possible memory leak detected. ${n.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#Ze)throw new Error(t);console.warn(t)}}prependListener(e,t){if("string"!=typeof e)throw new TypeError("prepend(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("prepend(event, handler): handler must be a function");this.#et(e,t)}prependListenerOnce(e,t){if("string"!=typeof e)throw new TypeError("prependOnceListener(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("prependOnceListener(event, handler): handler must be a function");const r=(...n)=>{this.off(e,r),t(...n)};return this.#et(e,r,{once:!0}),r}#tt(e,t,{once:r=!1}={}){let n=this.#Qe.get(e);Array.isArray(n)||(n=[],this.#Qe.set(e,n)),n.push({handler:t,config:{once:r}});const o=this.#Xe;if(o>0&&n.length>o){const t=`Possible memory leak detected. ${n.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#Ze)throw new Error(t);console.warn(t)}}on(e,t){if("string"!=typeof e)throw new TypeError("on(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("on(event, handler): handler must be a function");return this.#tt(e,t)}once(e,t){if("string"!=typeof e)throw new TypeError("The event name must be a string.");if("function"!=typeof t)throw new TypeError("once(event, handler): handler must be a function");const r=n=>{this.off(e,r),"function"==typeof t&&t(n)};return this.#tt(e,r,{once:!0}),r}appendListener(e,t){return this.on(e,t)}appendListenerOnce(e,t){return this.once(e,t)}off(e,t){if("string"!=typeof e)throw new TypeError("off(event, handler): event name must be a string");if("function"!=typeof t)throw new TypeError("off(event, handler): handler must be a function");const r=this.#Qe.get(e);if(!Array.isArray(r))return;const n=r.findIndex(e=>e.handler===t);-1!==n&&r.splice(n,1),0===r.length&&this.#Qe.delete(e)}offAll(e){if("string"!=typeof e)throw new TypeError("The event name must be a string.");this.#Qe.delete(e)}offAllTypes(){this.#Qe.clear()}listenerCount(e){if("string"!=typeof e)throw new TypeError("listenerCount(event): event name must be a string");const t=this.#Qe.get(e);return Array.isArray(t)?t.length:0}listeners(e){if("string"!=typeof e)throw new TypeError("listeners(event): event name must be a string");const t=this.#Qe.get(e);return Array.isArray(t)?[...t].filter(e=>!e.config.once).map(e=>e.handler):[]}onceListeners(e){if("string"!=typeof e)throw new TypeError("onceListeners(event): event name must be a string");const t=this.#Qe.get(e);return Array.isArray(t)?[...t].filter(e=>e.config.once).map(e=>e.handler):[]}allListeners(e){if("string"!=typeof e)throw new TypeError("allListeners(event): event name must be a string");const t=this.#Qe.get(e);return Array.isArray(t)?[...t].map(e=>e.handler):[]}eventNames(){return[...this.#Qe.keys()]}emit(e,...t){if("string"!=typeof e)throw new TypeError("emit(event, data): event name must be a string");const r=this.#Qe.get(e);return!(!Array.isArray(r)||0===r.length||(r.forEach(e=>e.handler(...t)),0))}setMaxListeners(e){if(!Number.isInteger(e)||e<0)throw new TypeError("setMaxListeners(n): n must be a non-negative integer");this.#Xe=e}getMaxListeners(){return this.#Xe}};class _t{static Utils={...e,TinyHtml:De};#rt=new At;setThrowOnMaxListeners(e){return this.#rt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#rt.getThrowOnMaxListeners()}prependListener(e,t){return this.#rt.prependListener(e,t)}prependListenerOnce(e,t){return this.#rt.prependListenerOnce(e,t)}appendListener(e,t){return this.#rt.appendListener(e,t)}appendListenerOnce(e,t){return this.#rt.appendListenerOnce(e,t)}on(e,t){return this.#rt.on(e,t)}once(e,t){return this.#rt.once(e,t)}off(e,t){return this.#rt.off(e,t)}offAll(e){return this.#rt.offAll(e)}offAllTypes(){return this.#rt.offAllTypes()}listenerCount(e){return this.#rt.listenerCount(e)}listeners(e){return this.#rt.listeners(e)}onceListeners(e){return this.#rt.onceListeners(e)}allListeners(e){return this.#rt.allListeners(e)}eventNames(){return this.#rt.eventNames()}emit(e,...t){return this.#rt.emit(e,...t)}setMaxListeners(e){return this.#rt.setMaxListeners(e)}getMaxListeners(){return this.#rt.getMaxListeners()}#nt=new WeakMap;#ot=new WeakMap;#it=new WeakMap;#st=new WeakMap;#at=new WeakMap;#lt=new WeakMap;#ut=null;#ht=null;#ct=new Set(["IMG","IFRAME","VIDEO"]);#dt=null;#ft=!1;#mt=!1;#pt=!1;#gt=!1;#yt=!1;#bt=!1;#wt=!1;#vt=!1;#Et="";#Tt=!1;#Z=!1;#xt=!1;#St=!1;#Lt=!1;#Ct=!1;#At=0;#_t=0;#Dt=0;#Mt=0;#Nt=0;#kt;#$;#It=new Set;constructor(e,{extraScrollBoundary:t=0,autoScrollBottom:r=!0,observeMutations:n=!0,preserveScrollOnLayoutShift:o=!0,debounceTime:i=100,querySelector:s=null,attributeFilter:a=["class","style","src","data-*","height","width"]}={}){if(!(e instanceof Element||e===window))throw new TypeError("TinySmartScroller: 'target' must be a DOM Element or 'window', but got "+typeof e);if("number"!=typeof t||Number.isNaN(t))throw new TypeError(`TinySmartScroller: 'extraScrollBoundary' must be a valid number, received ${t}`);if("boolean"!=typeof r)throw new TypeError("TinySmartScroller: 'autoScrollBottom' must be a boolean, received "+typeof r);if("boolean"!=typeof n)throw new TypeError("TinySmartScroller: 'observeMutations' must be a boolean, received "+typeof n);if("boolean"!=typeof o)throw new TypeError("TinySmartScroller: 'preserveScrollOnLayoutShift' must be a boolean, received "+typeof o);if("number"!=typeof i||i<0||Number.isNaN(i))throw new TypeError(`TinySmartScroller: 'debounceTime' must be a non-negative number, received ${i}`);if(null!==s&&"string"!=typeof s)throw new TypeError("TinySmartScroller: 'querySelector' must be a string or null, received "+typeof s);if(!(null===a||Array.isArray(a)||a instanceof Set))throw new TypeError("TinySmartScroller: 'attributeFilter' must be an array, Set, or null. Got "+typeof a);let l;this.#$=e instanceof Window?document.documentElement:e,this.#Tt=e instanceof Window,this.#St=r,this.#Lt=n,this.#Ct=o,this.#At=i,this.#Nt=t,this.#Et=s||"",this.#kt=new Set(a||void 0),this.#dt=()=>{this._scrollDataUpdater(),clearTimeout(l),l=setTimeout(()=>this._onScroll(),this.#At)},(this.#Tt?window:this.#$).addEventListener("scroll",this.#dt,{passive:!0}),this.#Lt&&(this._observeMutations(),this._observeResizes(this.#$.children)),this._scrollDataUpdater()}getSimpleOnHeight(e=[]){if(!Array.isArray(e))throw new TypeError("getSimpleOnHeight(filter): filter must be an array of tag names");return(t,r,n)=>{if(e.length>0&&!e.includes(t.tagName)||n.now!==n.old)return;const o=r.old;return{height:r.now.height-o.height,width:0}}}addSimpleOnHeight(e){if(!Array.isArray(e))throw new TypeError("addSimpleOnHeight(filter): filter must be an array of tag names");const t=this.getSimpleOnHeight(e);return this.onSize(t),t}getLoadTags(){return Array.from(this.#ct)}addLoadTag(e){if("string"!=typeof e)throw new TypeError("addLoadTag(tag): tag must be a string");this.#ct.add(e.toUpperCase())}removeLoadTag(e){if("string"!=typeof e)throw new TypeError("removeLoadTag(tag): tag must be a string");this.#ct.delete(e.toUpperCase())}hasLoadTag(e){if("string"!=typeof e)throw new TypeError("hasLoadTag(tag): tag must be a string");return this.#ct.has(e.toUpperCase())}resetLoadTags(e=!1){if("boolean"!=typeof e)throw new TypeError("resetLoadTags(addDefault): addDefault must be a boolean");this.#ct.clear(),e&&(this.#ct.add("IMG"),this.#ct.add("IFRAME"),this.#ct.add("VIDEO"))}getAttributeFilters(){return Array.from(this.#kt)}addAttributeFilter(e){if("string"!=typeof e)throw new TypeError("addAttributeFilter(attr): attr must be a string");this.#kt.add(e)}removeAttributeFilter(e){if("string"!=typeof e)throw new TypeError("removeAttributeFilter(attr): attr must be a string");this.#kt.delete(e)}hasAttributeFilter(e){if("string"!=typeof e)throw new TypeError("hasAttributeFilter(attr): attr must be a string");return this.#kt.has(e)}resetAttributeFilters(e=!1){if("boolean"!=typeof e)throw new TypeError("resetAttributeFilters(addDefault): addDefault must be a boolean");this.#kt.clear(),e&&["class","style","src","data-*","height","width"].forEach(e=>this.#kt.add(e))}onSize(e){if(!this.#Z){if("function"!=typeof e)throw new TypeError("onSize(handler): handler must be a function");this.#It.add(e)}}offSize(e){if(!this.#Z){if("function"!=typeof e)throw new TypeError("offSize(handler): handler must be a function");this.#It.delete(e)}}_scrollDataUpdater(){const e=new Map;return this.#$.querySelectorAll(this.#Et||"*").forEach(t=>{const r=this.#it.get(t)??!1;this.#st.set(t,r);const n=De.isInContainer(this.#$,t);this.#it.set(t,n),e.set(t,{oldIsVisible:r,isVisible:n})}),e}_emit(e,t){this.emit(e,t)}_onScroll(){if(this.#Z)return;const e=this._scrollDataUpdater(),t=this.#$,r=t.scrollTop,n=t.scrollHeight,o=t.clientHeight,i={scrollTop:r,scrollHeight:n,clientHeight:o};let s=null,a=null;const l=0===r,u=r+o>=n-1,h=r<=0+this.#Nt,c=r+o>=n-1-this.#Nt;l&&u?s="all":l?s="top":u&&(s="bottom"),h&&c?a="all":h?a="top":c&&(a="bottom"),this.#mt=this.#bt??!1,this.#ft=this.#yt??!1,this.#pt=this.#wt??!1,this.#gt=this.#vt??!1,this.#bt=l,this.#yt=u,this.#wt=h,this.#vt=c,this.#xt=!(this.#St&&this.#yt),this.#Mt=n-r-o,this.emit("onScrollBoundary",{status:s,...i,scrollCache:e}),this.emit("onExtraScrollBoundary",{status:a,...i,scrollCache:e}),this.#xt?this.emit("onScrollPause",{...i,scrollCache:e}):this.emit("onAutoScroll",{...i,scrollCache:e})}_fixScroll(e=[]){if(this.#Z)return;if(!Array.isArray(e))throw new TypeError("_fixScroll: targets must be an array of Elements");const t=this.#$.scrollHeight,r=this.#$.scrollTop,n=this.#$.scrollHeight-this.#$.scrollTop-this.#$.clientHeight,o=this.#$.scrollHeight-t,i=()=>{const t={height:0,width:0};for(const r of e){const e=this.#nt.get(r)||{height:0,width:0},n=this.#ot.get(r)||{height:0,width:0};this.#It.forEach(o=>{const i=o(r,{old:e,now:n},{old:this.#Dt,now:this.#_t});if(this.#it.get(r)||this.#at.get(r)){if(void 0!==i&&"object"!=typeof i)throw new Error("_fixScroll: size filter must return an object or undefined");if(void 0===i)return;t.height=i.height,t.width=i.width}})}if("number"!=typeof t.height&&t.height<0)throw new Error("_fixScroll: invalid scrollSize.height value");if("number"!=typeof t.width&&t.width<0)throw new Error("_fixScroll: invalid scrollSize.width value");if(0!==t.height||0!==t.width)for(const t of e)this.#at.set(t,this.#it.get(t)??!1),this.#lt.set(t,this.#st.get(t)??!1);return t};if(this.#Dt>0&&De.hasScroll(this.#$).v&&this.#St&&this.#Ct&&!this.#yt&&!this.#bt){const e=i();this.#$.scrollTop=r+o+e.height,e.width>0&&(this.#$.scrollLeft=this.#$.scrollLeft+e.width)}else!this.#xt&&this.#St?(i(),this.scrollToBottom()):this.#St||this.#yt||(i(),this.#$.scrollTop=this.#$.scrollHeight-this.#$.clientHeight-n)}_observeMutations(){this.#ht=new MutationObserver(e=>{this.#Z||(this._scrollDataUpdater(),this.#Dt=this.#_t,this.#_t=this.#$.childElementCount,e.forEach(e=>{e.addedNodes.forEach(e=>{if(e instanceof Element&&1===e.nodeType&&(this._observeResizes([e]),this._listenLoadEvents(e),this.#Et)){const t=e.querySelectorAll(this.#Et);this._observeResizes(t),this._listenLoadEvents(t)}})}),this._fixScroll())}),this.#ht.observe(this.#$,{childList:!0,subtree:!0,attributes:!0,attributeFilter:this.#kt.size>0?Array.from(this.#kt):void 0})}_observeResizes(e){this.#ut||(this.#ut=new ResizeObserver(e=>{if(this.#Z)return;this._scrollDataUpdater();const t=[];for(const r of e){const e=r.target,n=this.#ot.get(e);n&&this.#nt.set(e,n);const{width:o,height:i}=r.contentRect;this.#ot.set(e,{width:o,height:i}),t.push(e)}this._fixScroll(t)})),Array.from(e).forEach(e=>{if(!this.#ut)throw new Error("_observeResizes: ResizeObserver instance is not initialized");this.#ut.observe(e)})}_listenLoadEvents(e){this.#Z||(e instanceof NodeList?Array.from(e):[e]).forEach(e=>{this.#ct.has(e.tagName)&&(e.complete||e.addEventListener("load",()=>{this._scrollDataUpdater(),!this.#xt&&this.#St&&this.scrollToBottom()}))})}get target(){return this.#$}getOldSize(e){return this.#nt.get(e)??null}getNewSize(e){return this.#ot.get(e)??null}wasVisible(e){return this.#st.get(e)??!1}isVisible(e){return this.#it.get(e)??!1}wasTimedVisible(e){return this.#lt.get(e)??!1}isTimedVisible(e){return this.#at.get(e)??!1}setExtraScrollBoundary(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("setExtraScrollBoundary(value): value must be a valid number");this.#Nt=e}getExtraScrollBoundary(){return this.#Nt}getLastKnownScrollBottomOffset(){return this.#Mt}scrollToBottom(){this.#$.scrollTop=this.#$.scrollHeight}scrollToTop(){this.#$.scrollTop=0}isAtCustomBottom(){return this.#vt}isAtCustomTop(){return this.#wt}isAtBottom(){return this.#yt}isAtTop(){return this.#bt}isPastAtBottom(){return this.#ft}isPastAtTop(){return this.#mt}isPastAtCustomTop(){return this.#pt}isPastAtCustomBottom(){return this.#gt}isUserAtCustomBottom(){return this.#vt}isUserAtCustomTop(){return this.#wt}isUserAtBottom(){return this.#yt}isUserAtTop(){return this.#bt}isScrollPaused(){return this.#xt}isWindow(){return this.#Tt}isDestroyed(){return this.#Z}getAutoScrollBottom(){return this.#St}getObserveMutations(){return this.#Lt}getPreserveScrollOnLayoutShift(){return this.#Ct}getDebounceTime(){return this.#At}getElemAmount(){return this.#_t}getPrevElemAmount(){return this.#Dt}getQuerySelector(){return this.#Et}destroy(){if(this.#Z)return;this.#Z=!0,this.#ht&&(this.#ht.disconnect(),this.#ht=null),this.#ut&&(this.#ut.disconnect(),this.#ut=null);const e=this.#Tt?window:this.#$;this.#dt&&e.removeEventListener("scroll",this.#dt),this.#nt=new WeakMap,this.#ot=new WeakMap,this.#it=new WeakMap,this.#st=new WeakMap,this.#at=new WeakMap,this.#lt=new WeakMap,this.#rt.offAllTypes(),this.#It.clear(),this.#ct.clear()}}const Dt=_t,Mt=class{#H;#Rt;#Bt;constructor(e,{openTag:t="[",closeTag:r="]"}={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new TypeError("Element must be an input or textarea.");if("string"!=typeof t)throw new TypeError("openTag must be a string.");if("string"!=typeof r)throw new TypeError("closeTag must be a string.");this.#H=e,this.#Rt=t,this.#Bt=r}getOpenTag(){return this.#Rt}getCloseTag(){return this.#Bt}setOpenTag(e){if("string"!=typeof e)throw new TypeError("Open tag must be a string.");this.#Rt=e}setCloseTag(e){if("string"!=typeof e)throw new TypeError("Close tag must be a string.");this.#Bt=e}ensureFocus(){return document.activeElement!==this.#H&&this.#H.focus(),this}focus(){return this.#H.focus(),this}getSelectionRange(){return{start:this.#H.selectionStart??NaN,end:this.#H.selectionEnd??NaN}}setSelectionRange(e,t,r=!0){if("number"!=typeof e||"number"!=typeof t)throw new TypeError("start and end must be numbers.");if("boolean"!=typeof r)throw new TypeError("preserveScroll must be a boolean.");const n=this.#H.scrollTop,o=this.#H.scrollLeft;return this.#H.setSelectionRange(e,t),r&&(this.#H.scrollTop=n,this.#H.scrollLeft=o),this}getValue(){return this.#H.value}setValue(e){if("string"!=typeof e)throw new TypeError("Value must be a string.");return this.#H.value=e,this}getSelectedText(){const{start:e,end:t}=this.getSelectionRange();return this.#H.value.slice(e,t)}insertText(e,{newCursor:t="end",autoSpacing:r=!1,autoSpaceLeft:n=r,autoSpaceRight:o=r}={}){if("string"!=typeof e)throw new TypeError("Text must be a string.");if(!["start","end","preserve"].includes(t))throw new TypeError("newCursor must be one of 'start', 'end', or 'preserve'.");if("boolean"!=typeof r)throw new TypeError("autoSpacing must be a boolean.");if("boolean"!=typeof n)throw new TypeError("autoSpaceLeft must be a boolean.");if("boolean"!=typeof o)throw new TypeError("autoSpaceRight must be a boolean.");const{start:i,end:s}=this.getSelectionRange(),a=this.#H.value,l=a[i-1]||"",u=a[s]||"",h=`${n&&l&&!/\s/.test(l)?" ":""}${e}${o&&u&&!/\s/.test(u)?" ":""}`,c=a.slice(0,i)+h+a.slice(s);this.setValue(c);let d=i;return"end"===t?d=i+h.length:"preserve"===t&&(d=i),this.setSelectionRange(d,d),this}deleteSelection(){return this.insertText(""),this}transformSelection(e){if("function"!=typeof e)throw new TypeError("transformer must be a function.");const{start:t}=this.getSelectionRange(),r=e(this.getSelectedText());return this.insertText(r),this.setSelectionRange(t,t+r.length),this}surroundSelection(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("prefix and suffix must be strings.");const r=this.getSelectedText();return this.insertText(`${e}${r}${t}`),this}moveCaret(e){if("number"!=typeof e)throw new TypeError("offset must be a number.");const{start:t}=this.getSelectionRange(),r=Math.max(0,t+e);return this.setSelectionRange(r,r),this}selectAll(){return this.setSelectionRange(0,this.#H.value.length),this}expandSelection(e,t){if("number"!=typeof e||"number"!=typeof t)throw new TypeError("before and after must be numbers.");const{start:r,end:n}=this.getSelectionRange(),o=Math.max(0,r-e),i=Math.min(this.#H.value.length,n+t);return this.setSelectionRange(o,i),this}replaceAll(e,t){if(!(e instanceof RegExp))throw new TypeError("regex must be a RegExp.");if("function"!=typeof t)throw new TypeError("replacer must be a function.");const r=this.#H.value.replace(e,t);return this.setValue(r),this}replaceInSelection(e,t){if(!(e instanceof RegExp))throw new TypeError("regex must be a RegExp.");if("function"!=typeof t)throw new TypeError("replacer must be a function.");const{start:r,end:n}=this.getSelectionRange(),o=this.#H.value,i=o.slice(r,n).replace(e,t),s=o.slice(0,r)+i+o.slice(n);return this.setValue(s),this.setSelectionRange(r,r+i.length),this}toggleCode(e){if("string"!=typeof e)throw new TypeError("codeName must be a string.");const t=this.getSelectedText();if(t.startsWith(e)&&t.endsWith(e)){const r=t.slice(e.length,t.length-e.length);this.insertText(r)}else this.insertText(`${e}${t}${e}`);return this}_insertAttr(e){let t="";if(Array.isArray(e)){if(!e.every(e=>"string"==typeof e))throw new TypeError("All entries in attributes array must be strings.");t=e.map(e=>`${e}`).join(" ")}else{if("object"!=typeof e||null===e)throw new TypeError("attributes must be an object or an array of strings.");t=Object.entries(e).map(([e,t])=>{if("string"!=typeof t)throw new TypeError("All entries in attributes object must be strings.");return`${e}${t.length>0?`="${t}"`:""}`}).join(" ")}return t}wrapWithTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this._insertAttr(t),n=r?`${this.#Rt}${e} ${r}${this.#Bt}`:`${this.#Rt}${e}${this.#Bt}`,o=`${this.#Rt}/${e}${this.#Bt}`;return this.surroundSelection(n,o),this}insertTag(e,t="",r={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");if("string"!=typeof t)throw new TypeError("content must be a string.");const n=this._insertAttr(r),o=n?`${this.#Rt}${e} ${n}${this.#Bt}`:`${this.#Rt}${e}${this.#Bt}`,i=`${this.#Rt}/${e}${this.#Bt}`;return this.insertText(`${o}${t}${i}`),this}insertSelfClosingTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this._insertAttr(t),n=r?`${this.#Rt}${e} ${r}${this.#Bt}`:`${this.#Rt}${e}${this.#Bt}`;return this.insertText(n),this}toggleTag(e,t={}){if("string"!=typeof e)throw new TypeError("tagName must be a string.");const r=this.getSelectedText(),n=new RegExp(`^\\[${e}(\\s+[^\\]]*)?\\]`),o=new RegExp(`\\[/${e}\\]$`),i=n.test(r),s=o.test(r);if(i&&s){const e=r.replace(n,"").replace(o,"");this.insertText(e)}else{const n=this._insertAttr(t),o=n?`${this.#Rt}${e} ${n}${this.#Bt}`:`${this.#Rt}${e}${this.#Bt}`,i=`${this.#Rt}/${e}${this.#Bt}`;this.insertText(`${o}${r}${i}`)}return this}},Nt=class{#jt=!1;#Ot=!1;#Pt=null;#Ht=null;constructor(){void 0!==navigator.clipboard&&null!==navigator.clipboard&&(this.#Ot=!0,this.#Pt=e=>navigator.clipboard.writeText(e),this.#Ht=e=>navigator.clipboard.write([new ClipboardItem({[e.type]:e})])),this.#jt=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.#Pt=e}setCopyBlob(e){if("function"!=typeof e)throw new TypeError("setCopyBlob expected a function that returns Promise<void>.");this.#Ht=e}copyText(e){if("string"!=typeof e)throw new TypeError("copyText expected a string.");if(this.#Pt)return this.#Pt(e);if(this.#jt){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.#Ht)return this.#Ht(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,n=!1){return new Promise((o,i)=>{this._read(e).then(s=>{if(!s)return o(null);const a=[];let l=!0;const u=async(e,o)=>{if(l)if(null!==t&&"custom"!==t||"string"!=typeof r||!(!n&&e.startsWith(r)||n&&e===r))if(null!==t&&"text"!==t||"text/plain"!==e){if(null===t){l=!1;const t=await this._handleBlob(e,o);t&&a.push(t)}}else{l=!1;const t=await this._handleText(e,o);t&&a.push(t)}else{l=!1;const t=await this._handleBlob(e,o);t&&a.push(t)}},h=[],c=e=>{if(!(e instanceof ClipboardItem))throw new Error("Expected ClipboardItem when reading data.");for(const t in e.types)h.push(u(e.types[t],e))};if("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)&&e>-1)c(s),Promise.all(h).then(()=>{a[0]?o(a[0]):o(null)}).catch(i);else if(Array.isArray(s)){for(const e in s)c(s[e]);Promise.all(h).then(()=>o(a)).catch(i)}}).catch(i)})}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 n=await this._readData(r,"custom",e,t);if(!(n instanceof Blob))throw new Error("Failed to read custom data: expected Blob.");return n}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.#Ot||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.#jt}isNavigatorClipboardAvailable(){return this.#Ot}getCopyTextFunc(){return this.#Pt}getCopyBlobFunc(){return this.#Ht}};class kt{static _rca(e,t,r){let n=127,o=128;void 0===e&&(e=24),void 0===t&&(t="rgb"),!0===r&&(n=55,o=200);const i=2*Math.PI/e,s=[];for(let r=0;r<e;++r){const e=Math.sin(i*r+2)*n+o,a=Math.sin(i*r+0)*n+o,l=Math.sin(i*r+4)*n+o;switch(t){case"hex":s.push({hex:this.rgbToHex(Math.round(e),Math.round(a),Math.round(l))});break;case"rgb":s.push({r:e,g:a,b:l});break;case"hsl":const[t,r,n]=this.rgbaToHsl(Math.round(e),Math.round(a),Math.round(l));s.push({h:t,s:r,l:n})}}return s}static rcaRgb(e,t){return kt._rca(e,"rgb",t)}static rcaHsl(e,t){return kt._rca(e,"hsl",t)}static rcaHex(e,t){return kt._rca(e,"hex",t)}static randomColor(){return`#${Math.floor(16777216*Math.random()).toString(16).padStart(6,"0")}`}static parseInput(e,t){if("string"==typeof e){if((e=e.trim().toLowerCase()).startsWith("#"))return this.hexToRgba(e);if(e.startsWith("rgb"))return this.rgbStringToRgbaArray(e);if(e.startsWith("hsl"))return this.hslStringToRgbaArray(e)}if("number"==typeof e)return this.intToRgba(e);if(Array.isArray(e)&&(3===e.length||4===e.length)&&e.every(e=>"number"==typeof e)){if(t){const[t,r,n,o]=e;if(t<=360&&r<=100&&n<=100)return this.hslToRgba(t,r,n,o)}return[...e,1].slice(0,4)}throw new Error("Unsupported color format.")}static hslToInt(e,t,r){const[n,o,i]=kt.hslToRgba(e,t,r);return kt.rgbToInt(n,o,i)}static hslToHex(e,t,r){const[n,o,i]=kt.hslToRgba(e,t,r);return kt.rgbToHex(n,o,i)}static hslStringToRgbaArray(e){const t=e.match(/[\d.]+/g)?.map(Number);if(!t||t.length<3)return[0,0,0,1];const[r,n,o,i=1]=t;return this.hslToRgba(r,n,o,i)}static hslToRgba(e,t,r,n=1){r/=100;const o=t=>(t+e/30)%12,i=(t/=100)*Math.min(r,1-r),s=e=>r-i*Math.max(-1,Math.min(o(e)-3,Math.min(9-o(e),1)));return[Math.round(255*s(0)),Math.round(255*s(8)),Math.round(255*s(4)),n]}static hslToRgb(e,t,r,n=1){return kt.hslToRgba(e,t,r,n).slice(0,3)}static hexToInt(e){return parseInt(e.replace(/^#/,""),16)}static hexToHsl(e){const[t,r,n,o]=kt.hexToRgba(e);return kt.rgbaToHsl(t,r,n,o)}static hexToHsla(e){const[t,r,n,o]=kt.hexToRgba(e);return kt.rgbaToHsla(t,r,n,o)}static hexToRgba(e){3===(e=e.replace(/^#/,"")).length&&(e=e.split("").map(e=>e+e).join(""));const t=parseInt(e,16);return[t>>16&255,t>>8&255,255&t,1]}static hexToRgb(e){return this.hexToRgba(e).slice(0,3)}static rgbToHex(e,t,r){return"#"+[e,t,r].map(e=>e.toString(16).padStart(2,"0")).join("")}static rgbToInt(e,t,r){return e<<16|t<<8|r}static rgbaToHsla(e,t,r,n=1){e/=255,t/=255,r/=255;const o=Math.max(e,t,r),i=Math.min(e,t,r);let s=0,a=0,l=(o+i)/2;const u=o-i;if(0!==u){switch(a=u/(1-Math.abs(2*l-1)),o){case e:s=(t-r)/u+(t<r?6:0);break;case t:s=(r-e)/u+2;break;case r:s=(e-t)/u+4}s*=60}return[Math.round(s),Math.round(100*a),Math.round(100*l),n]}static rgbaToHsl(e,t,r,n){return this.rgbaToHsla(e,t,r,n).slice(0,3)}static rgbStringToRgbaArray(e){const t=e.match(/[\d.]+/g)?.map(Number);return t?[...t,1].slice(0,4):[]}static intToHsl(e){const[t,r,n,o]=kt.intToRgba(e);return kt.rgbaToHsl(t,r,n,o)}static intToHsla(e){const[t,r,n,o]=kt.intToRgba(e);return kt.rgbaToHsla(t,r,n,o)}static intToHex(e){return"#"+e.toString(16).padStart(6,"0")}static intToRgba(e){return[e>>16&255,e>>8&255,255&e,1]}#Wt="#000000";#Ft=[0,0,0,0];#$t;constructor(e=null,t=!1){this.#$t=t,null!=e&&this.setColor(e)}setColor(e){this.#Wt=e;const t=this.#$t&&Array.isArray(e)&&e[0]<=360&&e[1]<=100&&e[2]<=100;this.#Ft=kt.parseInput(e,t)}toHslaArray(){const[e,t,r,n]=this.#Ft;return kt.rgbaToHsla(e,t,r,n)}toHslString(){const[e,t,r]=this.#Ft,[n,o,i]=kt.rgbaToHsl(e,t,r);return`hsl(${n}, ${o}%, ${i}%)`}toHslaString(){const[e,t,r,n]=this.#Ft,[o,i,s,a]=kt.rgbaToHsla(e,t,r,n);return`hsla(${o}, ${i}%, ${s}%, ${a??1})`}toRgbaArray(){return[...this.#Ft]}toRgbString(){const[e,t,r]=this.#Ft;return`rgb(${e}, ${t}, ${r})`}toRgbaString(){const[e,t,r,n]=this.#Ft;return`rgba(${e}, ${t}, ${r}, ${n??1})`}toHex(){const[e,t,r]=this.#Ft;return kt.rgbToHex(e,t,r)}toInt(){const[e,t,r]=this.#Ft;return kt.rgbToInt(e,t,r)}getOriginal(){return this.#Wt}}const It=kt;class Rt{#Ut=!1;#zt;#Jt;#Vt=null;#qt=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.#Jt=e,this.#zt=t,this.setCooldownWatcherTime(e)}isDestroyed(){return this.#Ut}getAllowAutoConfigChange(){return this.#zt}getCooldownWatcherTime(){return this.#Jt}setAllowAutoConfigChange(e){if("boolean"!=typeof e)throw new TypeError("Expected 'value' to be a boolean.");this.#zt=e}setCooldownWatcherTime(e){if(this.#Ut)throw new Error("TinyTimeout has been destroyed.");if(!Number.isFinite(e)||e<=0)throw new TypeError("Expected 'value' to be a positive number.");this.#Jt=e,this.#Vt&&clearInterval(this.#Vt),this.#Vt=setInterval(()=>{this.#qt.forEach(e=>{e.now>0&&e.now--})},this.#Jt)}set(e,t,r,n=null){if(this.#Ut)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!==n&&(!Number.isFinite(n)||n<0))throw new TypeError("Expected 'limit' to be null or a non-negative number.");let o=this.#qt.get(e);(!o||this.#zt&&r!==o.value)&&(o={value:r,now:0},this.#qt.set(e,o));const i=o.value*o.now;return o.now++,setTimeout(t,"number"==typeof n?Math.min(i,n):i)}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(r=>{const n=setInterval(()=>{e()&&(clearInterval(n),r())},t)})}waitForTrue(e,t=100){if(this.#Ut)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 Rt.waitForTrue(e,t??this.#Jt)}destroy(){this.#Ut||(this.#Ut=!0,this.#Vt&&clearInterval(this.#Vt),this.#Vt=null,this.#qt.clear())}}const Bt=Rt,jt=new Map,Ot=new Map,Pt=new Set(["string","boolean","number","object","array",String,Boolean,Number,Object,Array,BigInt,Symbol]);class Ht{#rt=new At;setThrowOnMaxListeners(e){return this.#rt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#rt.getThrowOnMaxListeners()}prependListener(e,t){return this.#rt.prependListener(e,t)}prependListenerOnce(e,t){return this.#rt.prependListenerOnce(e,t)}appendListener(e,t){return this.#rt.appendListener(e,t)}appendListenerOnce(e,t){return this.#rt.appendListenerOnce(e,t)}on(e,t){return this.#rt.on(e,t)}once(e,t){return this.#rt.once(e,t)}off(e,t){return this.#rt.off(e,t)}offAll(e){return this.#rt.offAll(e)}offAllTypes(){return this.#rt.offAllTypes()}listenerCount(e){return this.#rt.listenerCount(e)}listeners(e){return this.#rt.listeners(e)}onceListeners(e){return this.#rt.onceListeners(e)}allListeners(e){return this.#rt.allListeners(e)}eventNames(){return this.#rt.eventNames()}emit(e,...t){return this.#rt.emit(e,...t)}setMaxListeners(e){return this.#rt.setMaxListeners(e)}getMaxListeners(){return this.#rt.getMaxListeners()}static hasJsonType(e){return jt.has(e)&&Ot.has(e)||Pt.has(e)}static registerJsonType(e,t,r,n=!1){if(Pt.has(e))throw new Error(`Cannot register type "${e}" because it is frozen.`);jt.set(e,t),Ot.set(e,r),n&&Pt.add(e)}static deleteJsonType(e){if(Pt.has(e))throw new Error(`Cannot remove type "${e}" because it is frozen.`);let t=!1;return jt.delete(e)&&(t=!0),Ot.delete(e)&&(t=!0),t}static encodeSpecialJson(e){if(void 0===e)return{__undefined__:!0};if(null===e)return{__null__:!0};for(const[t,r]of jt.entries())if("string"!=typeof t&&e instanceof t||typeof e===t)return r(e,Ht.encodeSpecialJson);if(Array.isArray(e))return e.map(Ht.encodeSpecialJson);if(f(e)){const t={};for(const r in e)t[r]=Ht.encodeSpecialJson(e[r]);return t}return e}static decodeSpecialJson(e){const t=f(e);if(t){if(e.__undefined__)return;if(e.__null__)return null}if(Array.isArray(e))return e.map(Ht.decodeSpecialJson);if(t){for(const[t,r]of Ot.entries())if(r.check&&r.check(e))return r.decode(e,Ht.decodeSpecialJson);const t={};for(const r in e)t[r]=Ht.decodeSpecialJson(e[r]);return t}return e}#Gt=window.localStorage;#Yt=null;#Kt=0;#Qt=e=>this.emit("storage",e);constructor(e){if(void 0!==e&&"string"!=typeof e)throw new TypeError("TinyLocalStorage: dbName must be a string if provided.");"string"==typeof e&&(this.#Yt=`LSDB::${e}`),window.addEventListener("storage",this.#Qt)}#Xt(e){if("string"==typeof e&&e.startsWith("LSDB::"))throw new Error(`TinyLocalStorage: Key "${e}" may conflict with reserved dbKeys.`)}updateStorageVersion(e,t){if("string"!=typeof this.#Yt)throw new Error("TinyLocalStorage: Database key is not initialized. Set a valid dbName in the constructor.");if("number"!=typeof e||Number.isNaN(e)||e<1)throw new TypeError("TinyLocalStorage: version must be a positive number.");if("function"!=typeof t)throw new TypeError("TinyLocalStorage: onUpgrade must be a function.");const r=parseInt(localStorage.getItem(this.#Yt),10)||0;if("number"!=typeof r||Number.isNaN(r)||r<0)throw new TypeError("TinyLocalStorage: saved version in localStorage is not a valid number.");if(e<r)throw new Error(`TinyLocalStorage: Cannot downgrade database version from ${r} to ${e}.`);e>r&&(t(r,e),localStorage.setItem(this.#Yt,String(e)),this.#Kt=e)}getDbKey(){return this.#Yt}getVersion(){return this.#Kt}setLocalStorage(e){if(!(e instanceof Storage))throw new TypeError("Argument must be a valid instance of Storage.");this.#Gt=e}localStorageExists(){return this.#Gt instanceof Storage}#Zt(e,t){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");return Ht.encodeSpecialJson(t)}setJson(e,t){if(this.#Xt(e),!(f(t)||Array.isArray(t)||t instanceof Map||t instanceof Set))throw new TypeError("The storage value is not a valid JSON-compatible structure.");const r=this.#Zt(e,t);return this.emit("setJson",e,t),this.#Gt.setItem(e,JSON.stringify(r))}#er(e,t){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");const r=this.#Gt.getItem(e),n={obj:()=>({}),array:()=>[],map:()=>new Map,set:()=>new Set},o="function"==typeof n[t]?n[t]():null;let i;try{i=JSON.parse(r)}catch{return o}return{decoded:Ht.decodeSpecialJson(i),fallback:o}}getJson(e,t){const{decoded:r,fallback:n}=this.#er(e,t);return r instanceof Map||r instanceof Set||Array.isArray(r)||f(r)?r:n}setDate(e,t){if(this.#Xt(e),!(t instanceof Date))throw new TypeError("Value must be a Date.");const r=this.#Zt(e,t);return this.emit("setDate",e,t),this.#Gt.setItem(e,JSON.stringify(r))}getDate(e){const t=this.#er(e).decoded;return t instanceof Date?t:null}setRegExp(e,t){if(this.#Xt(e),!(t instanceof RegExp))throw new TypeError("Value must be a RegExp.");const r=this.#Zt(e,t);return this.emit("setRegExp",e,t),this.#Gt.setItem(e,JSON.stringify(r))}getRegExp(e){const t=this.#er(e).decoded;return t instanceof RegExp?t:null}setBigInt(e,t){if(this.#Xt(e),"bigint"!=typeof t)throw new TypeError("Value must be a BigInt.");const r=this.#Zt(e,t);return this.emit("setBigInt",e,t),this.#Gt.setItem(e,JSON.stringify(r))}getBigInt(e){const t=this.#er(e).decoded;return"bigint"==typeof t?t:null}setSymbol(e,t){if(this.#Xt(e),"symbol"!=typeof t)throw new TypeError("Value must be a Symbol.");const r=this.#Zt(e,t);return this.emit("setSymbol",e,t),this.#Gt.setItem(e,JSON.stringify(r))}getSymbol(e){const t=this.#er(e).decoded;return"symbol"==typeof t?t:null}getValue(e){return this.#er(e).decoded??null}setItem(e,t){if(this.#Xt(e),"string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");return this.emit("setItem",e,t),this.#Gt.setItem(e,t)}getItem(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");return this.#Gt.getItem(e)}setString(e,t){if(this.#Xt(e),"string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");if("string"!=typeof t)throw new TypeError("Value must be a string.");return this.emit("setString",e,t),this.#Gt.setItem(e,JSON.stringify({__string__:!0,value:t}))}getString(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");let t=this.#Gt.getItem(e);try{if(t=JSON.parse(t),!f(t)||!t.__string__||"string"!=typeof t.value)return null;t=t.value}catch{t=null}return"string"==typeof t?t:null}setNumber(e,t){if(this.#Xt(e),"string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");if("number"!=typeof t)throw new TypeError("Value must be a number.");return this.emit("setNumber",e,t),this.#Gt.setItem(e,String(t))}getNumber(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");let t=this.#Gt.getItem(e);return"number"==typeof t||"string"==typeof t&&t.length>0&&(t=parseFloat(t),!Number.isNaN(t))?t:null}setBool(e,t){if(this.#Xt(e),"string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");if("boolean"!=typeof t)throw new TypeError("Value must be a boolean.");return this.emit("setBool",e,t),this.#Gt.setItem(e,String(t))}getBool(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");const t=this.#Gt.getItem(e);if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===t)return!0;if("false"===t)return!1}return null}removeItem(e){if("string"!=typeof e||!e.length)throw new TypeError("Key must be a non-empty string.");return this.emit("removeItem",e),this.#Gt.removeItem(e)}clearLocalStorage(){return this.#Gt.clear()}destroy(){window.removeEventListener("storage",this.#Qt),this.#rt.offAllTypes()}}Ht.registerJsonType(Map,(e,t)=>({__map__:!0,data:Array.from(e.entries()).map(([e,r])=>[e,t(r)])}),{check:e=>e.__map__,decode:(e,t)=>new Map(e.data.map(([e,r])=>[e,t(r)]))},!0),Ht.registerJsonType(Set,(e,t)=>({__set__:!0,data:Array.from(e).map(t)}),{check:e=>e.__set__,decode:(e,t)=>new Set(e.data.map(t))},!0),Ht.registerJsonType(Date,e=>({__date__:!0,value:e.toISOString()}),{check:e=>e.__date__,decode:e=>new Date(e.value)},!0),Ht.registerJsonType(RegExp,e=>({__regexp__:!0,source:e.source,flags:e.flags}),{check:e=>e.__regexp__,decode:e=>new RegExp(e.source,e.flags)},!0),Ht.registerJsonType("bigint",e=>({__bigint__:!0,value:e.toString()}),{check:e=>e.__bigint__,decode:e=>BigInt(e.value)},!0),Ht.registerJsonType("symbol",e=>({__symbol__:!0,key:Symbol.keyFor(e)??e.description??null}),{check:e=>e.__symbol__,decode:e=>{const t=e.key;return null!=t?Symbol.for(t):Symbol()}},!0);const Wt=Ht,Ft=new WeakMap,$t=class{#rt=new At;setThrowOnMaxListeners(e){return this.#rt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#rt.getThrowOnMaxListeners()}prependListener(e,t){return this.#rt.prependListener(e,t)}prependListenerOnce(e,t){return this.#rt.prependListenerOnce(e,t)}appendListener(e,t){return this.#rt.appendListener(e,t)}appendListenerOnce(e,t){return this.#rt.appendListenerOnce(e,t)}on(e,t){return this.#rt.on(e,t)}once(e,t){return this.#rt.once(e,t)}off(e,t){return this.#rt.off(e,t)}offAll(e){return this.#rt.offAll(e)}offAllTypes(){return this.#rt.offAllTypes()}listenerCount(e){return this.#rt.listenerCount(e)}listeners(e){return this.#rt.listeners(e)}onceListeners(e){return this.#rt.onceListeners(e)}allListeners(e){return this.#rt.allListeners(e)}eventNames(){return this.#rt.eventNames()}setMaxListeners(e){return this.#rt.setMaxListeners(e)}getMaxListeners(){return this.#rt.getMaxListeners()}#tr;#rr;#nr;#Ut=!1;#or=!1;#ir=[];#sr="__tinyIframeEvent__";get secretEventName(){return this.#sr}set secretEventName(e){if("string"!=typeof e)throw new TypeError("TinyIframeEvents: secretEventName must be a string.");this.#sr=e}constructor({targetIframe:e,targetOrigin:t}={}){if(!(void 0===e||e instanceof HTMLIFrameElement&&e.contentWindow))throw new TypeError('[TinyIframeEvents] Invalid "targetIframe" provided: expected a HTML Iframe Element, received '+typeof e);if(void 0!==t&&"string"!=typeof t)throw new TypeError('[TinyIframeEvents] Invalid "targetOrigin" provided: expected a string, received '+typeof t);if(this.#tr=e?.contentWindow??window.parent,this.#rr=t??window.location.origin,this.#nr=e?"parent":"iframe",Ft.has(this.#tr))throw new Error("Duplicate window reference.");this._boundOnMessage=this.#ar.bind(this),this._boundOnceMessage=this.#lr.bind(this),"complete"===this.#tr.document.readyState||"interactive"===this.#tr.document.readyState?this.#lr():(this.#tr.addEventListener("load",this._boundOnceMessage,!1),this.#tr.addEventListener("DOMContentLoaded",this._boundOnceMessage,!1)),window.addEventListener("message",this._boundOnMessage,!1),Ft.set(this.#tr,this)}#lr(){this.#or||(this.#or=!0,this.#ur())}#ar(e){const{data:t,source:r}=e;if(!f(t)||!t[this.#sr])return;const{eventName:n,payload:o,direction:i}=t;r===this.#tr&&("iframe"===this.#nr&&"iframe"!==i||"parent"===this.#nr&&"parent"!==i||this.#rt.emit(n,o,e))}emit(e,t){if("string"!=typeof e)throw new TypeError("Event name must be a string.");if(this.#Ut)throw new Error("Cannot emit: instance has been destroyed.");const r={[this.#sr]:!0,eventName:e,payload:t,direction:"parent"===this.#nr?"iframe":"parent"};this.#or?this.#tr.postMessage(r,this.#rr):this.#ir.push(r)}#ur(){for(;this.#ir.length;){const e=this.#ir.shift();e&&this.#tr.postMessage(e,this.#rr)}}isDestroyed(){return this.#Ut}destroy(){this.#Ut=!0,window.removeEventListener("message",this._boundOnMessage),this.#tr.removeEventListener("load",this._boundOnceMessage,!1),this.#tr.removeEventListener("DOMContentLoaded",this._boundOnceMessage,!1),this.#rt.offAllTypes(),this.#ir=[],Ft.delete(this.#tr)}},Ut=new WeakMap,zt=class{#rt=new At;setThrowOnMaxListeners(e){return this.#rt.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#rt.getThrowOnMaxListeners()}prependListener(e,t){return this.#rt.prependListener(e,t)}prependListenerOnce(e,t){return this.#rt.prependListenerOnce(e,t)}appendListener(e,t){return this.#rt.appendListener(e,t)}appendListenerOnce(e,t){return this.#rt.appendListenerOnce(e,t)}on(e,t){return this.#rt.on(e,t)}once(e,t){return this.#rt.once(e,t)}off(e,t){return this.#rt.off(e,t)}offAll(e){return this.#rt.offAll(e)}offAllTypes(){return this.#rt.offAllTypes()}listenerCount(e){return this.#rt.listenerCount(e)}listeners(e){return this.#rt.listeners(e)}onceListeners(e){return this.#rt.onceListeners(e)}allListeners(e){return this.#rt.allListeners(e)}eventNames(){return this.#rt.eventNames()}setMaxListeners(e){return this.#rt.setMaxListeners(e)}getMaxListeners(){return this.#rt.getMaxListeners()}#hr;#rr;#ir=[];#or=!1;#cr=!1;#dr=null;#fr="__TNE_READY__";#mr="__TNE_ROUTE__";get readyEventName(){return this.#fr}set readyEventName(e){if("string"!=typeof e)throw new TypeError("TinyNewWinEvents: readyEventName must be a string.");this.#fr=e}get routeEventName(){return this.#mr}set routeEventName(e){if("string"!=typeof e)throw new TypeError("TinyNewWinEvents: routeEventName must be a string.");this.#mr=e}constructor({targetOrigin:e,url:t,name:r,features:n}={}){if("string"==typeof r&&"_blank"===r)throw new Error('TinyNewWinEvents: The window name "_blank" is not supported. Please use a custom name to allow tracking.');if(void 0!==e&&"string"!=typeof e)throw new TypeError('TinyNewWinEvents: The "targetOrigin" option must be a string.');if(void 0!==t&&"string"!=typeof t)throw new TypeError('TinyNewWinEvents: The "url" option must be a string.');if(void 0!==n&&"string"!=typeof n)throw new TypeError('TinyNewWinEvents: The "features" option must be a string if provided.');if(void 0===t?this.#hr=window.opener:(this.#hr="string"==typeof t?window.open(t,r,n):t,this.#cr=!0),!this.#hr||Ut.has(this.#hr))throw new Error("Invalid or duplicate window reference.");this.#rr=e??window.location.origin,this._handleMessage=this.#pr.bind(this),window.addEventListener("message",this._handleMessage,!1),this.#cr||(this.#gr(this.#fr,null),this.#yr())}getWin(){return this.#hr}#pr(e){if(!e.source||this.#hr&&e.source!==this.#hr)return;const{type:t,route:r,payload:n}=e.data||{};if(t===this.#fr)return this.#or=!0,this.#ur(),this.#yr(),void(this.#cr&&this.#gr(this.#fr,null));t===this.#mr&&this.#rt.emit(r,n,e)}#ur(){for(;this.#ir.length;){const e=this.#ir.shift();if(e){const{route:t,payload:r}=e;this.emit(t,r)}}}#gr(e,t,r=""){this.#hr&&this.#hr.closed||this.#hr?.postMessage({type:e,route:r,payload:t},this.#rr)}close(){if(!this.#cr)throw new Error("Only host can close the window.");this.#hr&&!this.#hr.closed&&this.#hr.close()}emit(e,t){if("string"!=typeof e)throw new TypeError("Event name must be a string.");if(this.isDestroyed())throw new Error("Cannot emit: instance has been destroyed.");this.#or?this.#gr(this.#mr,t,e):this.#ir.push({route:e,payload:t})}isConnected(){return!(!this.#or||!this.#hr||this.#hr.closed)}#yr(){this.#hr&&!this.#dr&&(this.#dr=setInterval(()=>{this.#hr?.closed&&(this.#rt.emit("WINDOW_REF_CLOSED"),this.destroy())},500),Ut.set(this.#hr,this.#dr))}onClose(e){return this.#rt.on("WINDOW_REF_CLOSED",e)}offClose(e){return this.#rt.off("WINDOW_REF_CLOSED",e)}isDestroyed(){return!this.#hr}destroy(){this.#hr&&(this.#dr&&(clearInterval(this.#dr),this.#dr=null,Ut.delete(this.#hr)),window.removeEventListener("message",this._handleMessage),this.#ir=[],this.#or=!1,this.#hr=null,this.#rt.offAllTypes())}},Jt=class{#br;#wr;#vr;#Er=0;#Tr=0;#xr;#Sr=null;#Lr=null;get lineHeight(){return this.#br}get maxRows(){return this.#wr-1}get extraHeight(){return this.#vr}get currentHeight(){return this.#Er}get currentRows(){return this.#Tr}get textarea(){return this.#xr}constructor(e,t={}){if(!(e instanceof HTMLTextAreaElement))throw new Error("TinyTextarea: Provided element is not a <textarea>.");if("object"!=typeof t||null===t)throw new TypeError("TinyTextarea: Options must be an object if provided.");if("maxRows"in t&&"number"!=typeof t.maxRows)throw new TypeError("TinyTextarea: `maxRows` must be a number.");if("extraHeight"in t&&"number"!=typeof t.extraHeight)throw new TypeError("TinyTextarea: `extraHeight` must be a number.");if("onResize"in t&&"function"!=typeof t.onResize)throw new TypeError("TinyTextarea: `onResize` must be a function.");if("onInput"in t&&"function"!=typeof t.onInput)throw new TypeError("TinyTextarea: `onInput` must be a function.");this.#xr=e,this.#wr=(t.maxRows??5)+1,this.#vr=t.extraHeight??0,this.#Sr=t.onResize??null,this.#Lr=t.onInput??null,this.#br=this.#Cr(),e.style.overflowY="hidden",e.style.resize="none",this._handleInput=()=>this.#Ar(),e.addEventListener("input",this._handleInput),this.#Ar()}#Ar(){this.#xr.style.height="auto";const e=window.getComputedStyle(this.#xr),t=parseFloat(e.paddingTop)||0,r=parseFloat(e.paddingBottom)||0,n=(this.#xr.value.match(/\n/g)||[]).length,o=this.#xr.scrollHeight,i=this.#br*this.#wr,s=Math.ceil(Math.min(o,i)-t-r+this.#vr),a=this.#wr-1,l=n<a?n+1:a;this.#xr.style.height=`${s}px`,this.#xr.style.overflowY=o>i?"auto":"hidden",this.#Er=s;const u={breakLines:n,rows:l,height:s,scrollHeight:o,maxHeight:i,lineHeight:this.#br,maxRows:a};l!==this.#Tr&&(this.#Tr=l,"function"==typeof this.#Sr&&this.#Sr({...u})),"function"==typeof this.#Lr&&this.#Lr(u)}#Cr(){const e=window.getComputedStyle(this.#xr),t=parseFloat(e.lineHeight);return Number.isNaN(t)?1.2*parseFloat(e.fontSize):t}getData(){return{rows:this.#Tr,height:this.#Er}}refresh(){this.#Ar()}destroy(){this.#xr.removeEventListener("input",this._handleInput)}}})(),window.TinyEssentials=n})();
|