tiny-essentials 1.21.1 → 1.21.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/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyNeedBar.min.js +1 -1
- package/dist/v1/TinySimpleDice.min.js +1 -0
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/basics/index.cjs +1 -0
- package/dist/v1/basics/index.d.mts +2 -1
- package/dist/v1/basics/index.mjs +2 -2
- package/dist/v1/build/TinySimpleDice.cjs +7 -0
- package/dist/v1/build/TinySimpleDice.d.mts +3 -0
- package/dist/v1/build/TinySimpleDice.mjs +2 -0
- package/dist/v1/index.cjs +3 -0
- package/dist/v1/index.d.mts +3 -1
- package/dist/v1/index.mjs +3 -2
- package/dist/v1/libs/TinyHtml.cjs +36 -3
- package/dist/v1/libs/TinyHtml.d.mts +17 -2
- package/dist/v1/libs/TinyHtml.mjs +34 -3
- package/dist/v1/libs/TinyNeedBar.cjs +83 -10
- package/dist/v1/libs/TinyNeedBar.d.mts +17 -1
- package/dist/v1/libs/TinyNeedBar.mjs +79 -8
- package/dist/v1/libs/TinySimpleDice.cjs +91 -0
- package/dist/v1/libs/TinySimpleDice.d.mts +57 -0
- package/dist/v1/libs/TinySimpleDice.mjs +84 -0
- package/docs/v1/README.md +1 -0
- package/docs/v1/libs/TinyNeedBar.md +16 -1
- package/docs/v1/libs/TinySimpleDice.md +146 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see TinyBasicsEs.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var t={251:(t,e)=>{e.read=function(t,e,r,n,o){var i,s,u=8*o-n-1,a=(1<<u)-1,f=a>>1,l=-7,c=r?o-1:0,h=r?-1:1,p=t[e+c];for(c+=h,i=p&(1<<-l)-1,p>>=-l,l+=u;l>0;i=256*i+t[e+c],c+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=n;l>0;s=256*s+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===a)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=f}return(p?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,u,a,f=8*i-o-1,l=(1<<f)-1,c=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),(e+=s+c>=1?h/a:h*Math.pow(2,1-c))*a>=2&&(s++,a/=2),s+c>=l?(u=0,s=l):s+c>=1?(u=(e*a-1)*Math.pow(2,o),s+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;t[r+p]=255&u,p+=y,u/=256,o-=8);for(s=s<<o|u,f+=o;f>0;t[r+p]=255&s,p+=y,s/=256,f-=8);t[r+p-y]|=128*d}},287:(t,e,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;e.hp=a,e.IS=50;var s=2147483647;function u(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=u(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){var e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);var o=function(t){if(a.isBuffer(t)){var e=0|y(t.length),r=u(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||$(t.length)?u(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),u(t<0?0:0|y(t))}function h(t){for(var e=t.length<0?0:0|y(t.length),r=u(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,a.prototype),n}function y(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function d(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(t).length;default:if(o)return n?-1:j(t).length;e=(""+e).toLowerCase(),o=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return U(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),$(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,o){var i,s=1,u=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,u/=2,a/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var l=-1;for(i=r;i<u;i++)if(f(t,i)===f(e,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===a)return l*s}else-1!==l&&(i-=i-l),l=-1}else for(r+a>u&&(r=u-a),i=r;i>=0;i--){for(var c=!0,h=0;h<a;h++)if(f(t,i+h)!==f(e,h)){c=!1;break}if(c)return i}return-1}function v(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var u=parseInt(e.substr(2*s,2),16);if($(u))return s;t[r+s]=u}return s}function E(t,e,r,n){return z(j(e,t.length-r),t,r,n)}function A(t,e,r,n){return z(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function T(t,e,r,n){return z(D(e),t,r,n)}function B(t,e,r,n){return z(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function C(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,u,a,f=t[o],l=null,c=f>239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&f)<<6|63&i)>127&&(l=a);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(a=(15&f)<<12|(63&i)<<6|63&s)>2047&&(a<55296||a>57343)&&(l=a);break;case 4:i=t[o+1],s=t[o+2],u=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(l=a)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=L)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=L));return r}(n)}a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return l(t),t<=0?u(t):void 0!==e?"string"==typeof r?u(t).fill(e,r):u(t).fill(e):u(t)}(t,e,r)},a.allocUnsafe=function(t){return c(t)},a.allocUnsafeSlow=function(t){return c(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).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}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(Y(i,Uint8Array))o+i.length>n.length?a.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?S(this,0,t):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(t,e,r,n,o){if(Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),u=Math.min(i,s),f=this.slice(n,o),l=t.slice(e,r),c=0;c<u;++c)if(f[c]!==l[c]){i=f[c],s=l[c];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>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,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return A(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var L=4096;function U(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function M(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function N(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=q[t[i]];return o}function O(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function x(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function F(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function R(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function P(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,8),o.write(t,e,r,n,52,8),r+8}a.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||x(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||x(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||x(t,4,this.length),o.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),o.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),o.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(t,8,this.length),o.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||F(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||F(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,t,e,r,o-1,-o)}var i=0,s=1,u=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===u&&0!==this[e+i-1]&&(u=1),this[e+i]=(t/s|0)-u&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,t,e,r,o-1,-o)}var i=r-1,s=1,u=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/s|0)-u&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return P(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return P(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<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),t.length-e<n-r&&(n=t.length-e+r);var o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=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&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=a.isBuffer(t)?t:a.from(t,n),u=s.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%u]}return this};var k=/[^+/0-9A-Za-z-_]/g;function j(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=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((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function D(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function $(t){return t!=t}var q=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,i=u(t),s=i[0],a=i[1],f=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),l=0,c=a>0?s-4:s;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],f[l++]=e>>16&255,f[l++]=e>>8&255,f[l++]=255&e;return 2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,f[l++]=255&e),1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,f[l++]=e>>8&255,f[l++]=255&e),f},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],s=16383,u=0,a=n-o;u<a;u+=s)i.push(f(t,u,u+s>a?a:u+s));return 1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<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 u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function a(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function f(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(a(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";function t(t,e=!1){return e?function(e,r){return e[t]>r[t]?-1:e[t]<r[t]?1:0}:function(e,r){return e[t]<r[t]?-1:e[t]>r[t]?1:0}}async function e(t,e,r){const n=[];t.replace(e,(t,...e)=>(n.push(r(t,...e)),t));const o=await Promise.all(n);return t.replace(e,()=>o.shift())}function o(t){let e,r=t.length;for(;0!==r;)e=Math.floor(Math.random()*r),r--,[t[r],t[e]]=[t[e],t[r]];return t}function i(t=new Date,e="asSeconds",r=null){if(t instanceof Date){const n=r instanceof Date?r:new Date,o=t.getTime()-n.getTime();switch(e){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 s(t,e="seconds",r="{time}"){t=Math.max(0,Math.floor(t));const n=["seconds","minutes","hours","days","months","years"].indexOf(e),o=n>=5,i=n>=4,s=n>=3,u=n>=2,a=n>=1,f=n>=0,l={years:o?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:u?0:NaN,minutes:a?0:NaN,seconds:f?0:NaN,total:NaN};let c=t;if(o||i||s){const t=new Date(1980,0,1),e=new Date(t.getTime()+1e3*c),r=new Date(t);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=e.getTime();)r.setFullYear(r.getFullYear()+1),l.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=e.getTime();)r.setMonth(r.getMonth()+1),l.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=e.getTime();)r.setDate(r.getDate()+1),l.days++;c=Math.floor((e.getTime()-r.getTime())/1e3)}u&&(l.hours=Math.floor(c/3600),c%=3600),a&&(l.minutes=Math.floor(c/60),c%=60),f&&(l.seconds=c),i&&(l.years,l.months,l.days),o&&(l.years,l.months,l.days),l.total=+t.toFixed(2).replace(/\.00$/,"");const h=t=>{const e="string"==typeof t?parseInt(t):t;return Number.isNaN(e)?"NaN":String(e).padStart(2,"0")},p=[u?h(l.hours):null,a?h(l.minutes):null,f?h(l.seconds):null].filter(t=>null!==t).join(":");return r.replace(/\{years\}/g,String(l.years)).replace(/\{months\}/g,String(l.months)).replace(/\{days\}/g,String(l.days)).replace(/\{hours\}/g,h(l.hours)).replace(/\{minutes\}/g,h(l.minutes)).replace(/\{seconds\}/g,h(l.seconds)).replace(/\{time\}/g,p).replace(/\{total\}/g,String(l.total)).trim()}function u(t){return s(t,"hours","{hours}:{minutes}:{seconds}")}function a(t){return s(t,"days","{days}d {hours}:{minutes}:{seconds}")}function f(t){return Array.isArray(t)?t.length:l(t)?Object.keys(t).length:0}function l(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"===Object.prototype.toString.call(t)}function c(t,e){return new Promise((r,n)=>{const o=new FileReader;o.onload=()=>{try{r(o.result)}catch(t){n(t)}},o.onerror=()=>{n(o.error)},o[e](t)})}function h(t,e=!1){return new Promise((r,n)=>{"string"!=typeof e&&"boolean"!=typeof e&&n(new TypeError("The isDataUrl parameter must be a boolean or a string.")),c(t,"readAsDataURL").then(t=>{if("string"!=typeof t)throw new TypeError("Expected file content to be a string.");const n=t.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 e)return r(e?t:i);if(!/^[\w-]+\/[\w.+-]+$/.test(e))throw new Error(`Invalid MIME type string: ${e}`);return r(`data:${e};base64,${i}`)}).catch(n)})}function p(t){return new Promise((e,r)=>c(t,"readAsText").then(t=>{if("string"!=typeof t)throw new TypeError("Expected file content to be a string.");const r=t.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.");e(n)}).catch(r))}function y(t,e,r=2){const n=JSON.stringify(e,null,r),o=new Blob([n],{type:"application/json"}),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}async function d(t,{method:e="GET",body:r,timeout:n=0,retries:o=0,headers:i={},signal:s=null}={}){if("string"!=typeof t||!t.startsWith("../")&&!t.startsWith("./")&&!t.startsWith("/")&&!t.startsWith("https://")&&!t.startsWith("http://"))throw new Error("Invalid URL: must be a valid http or https address.");if("string"!=typeof e||!e.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 u=s?1:o+1;let a=null;for(let f=0;f<u;f++){const u=s?null:new AbortController,c=s||(u?.signal??null),h=!s&&n&&u?setTimeout(()=>u.abort(),n):null;try{const n=await fetch(t,{method:e.toUpperCase(),headers:{Accept:"application/json",...i},body:void 0!==r?l(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(t){if(a=t,s)break;f<o&&await new Promise(t=>setTimeout(t,300*(f+1)))}}throw new Error(`Failed to fetch JSON from "${t}"${a?`: ${a.message}`:"."}`)}async function g(t,e){return new Promise((r,n)=>{d(t,e).then(async t=>{const e=t.headers.get("content-type")||"";if(!e.includes("application/json"))throw new Error(`Unexpected content-type: ${e}`);const n=await t.json();if(!Array.isArray(n)&&!l(n))throw new Error("Received invalid data instead of valid JSON.");return r(n)}).catch(n)})}async function m(t,e,r){return new Promise((n,o)=>{d(t,r).then(async t=>{const r=t.headers.get("content-type")||"";if(Array.isArray(e)&&e.length>0&&!e.some(t=>r.includes(t)))throw new Error(`Blocked MIME type: ${r}`);const o=await t.text();return n(o)}).catch(o)})}function w({element:t=document.body,hiddenClass:e="windowHidden",visibleClass:r="windowVisible",onVisible:n,onHidden:o}={}){if(!(t instanceof Element))throw new TypeError('"element" must be an instance of Element.');if("string"!=typeof e)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 u=()=>{t.classList.remove(e),t.classList.remove(r)};let a=null;const f=["visibilitychange","mozvisibilitychange","webkitvisibilitychange","msvisibilitychange"],l=["hidden","mozHidden","webkitHidden","msHidden"];for(let t=0;t<l.length;t++)if(l[t]in document){a=l[t];break}const c=function(f){u();const l=f?.type,c=a&&document[a];["focus","focusin","pageshow"].includes(l)?(t.classList.add(r),n?.({type:l,oldClass:s,oldType:i}),s=r):["blur","focusout","pagehide"].includes(l)||c?(t.classList.add(e),o?.({type:l,oldClass:s,oldType:i}),s=e):(t.classList.add(r),n?.({type:l,oldClass:s,oldType:i}),s=r),i=l};let h=()=>{};if(a){const t=f[l.indexOf(a)];document.addEventListener(t,c),window.addEventListener("focus",c),window.addEventListener("blur",c),h=()=>{document.removeEventListener(t,c),window.removeEventListener("focus",c),window.removeEventListener("blur",c),u()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=c,h=()=>{document.onfocusin=document.onfocusout=null,u()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=c,h=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,u()});const p=new Event(a&&document[a]?"blur":"focus");return c(p),h}r.r(n),r.d(n,{addAiMarkerShortcut:()=>J,areElsCollBottom:()=>V,areElsCollLeft:()=>X,areElsCollPerfBottom:()=>G,areElsCollPerfLeft:()=>Q,areElsCollPerfRight:()=>tt,areElsCollPerfTop:()=>Z,areElsCollRight:()=>K,areElsCollTop:()=>_,areElsColliding:()=>et,areElsPerfColliding:()=>rt,arraySortPositions:()=>t,asyncReplace:()=>e,calculateMarketcap:()=>Y,cloneObjTypeOrder:()=>B,compareMarketcap:()=>$,countObj:()=>f,documentIsFullScreen:()=>L,exitFullScreen:()=>O,extendObjType:()=>A,fetchJson:()=>g,fetchText:()=>m,formatBytes:()=>D,formatCustomTimer:()=>s,formatDayTimer:()=>a,formatTimer:()=>u,genFibonacciSeq:()=>z,getAge:()=>j,getElsCollDetails:()=>lt,getElsCollDirDepth:()=>ft,getElsCollOverlap:()=>it,getElsCollOverlapPos:()=>st,getElsColliding:()=>nt,getElsPerfColliding:()=>ot,getElsRelativeCenterOffset:()=>at,getPercentage:()=>k,getRectCenter:()=>ut,getSimplePerc:()=>P,getTimeDuration:()=>i,installWindowHiddenScript:()=>w,isFullScreenMode:()=>M,isJsonObject:()=>l,isScreenFilled:()=>U,objType:()=>S,offFullScreenChange:()=>R,onFullScreenChange:()=>F,readBase64Blob:()=>h,readFileBlob:()=>c,readJsonBlob:()=>p,reorderObjTypeOrder:()=>T,requestFullScreen:()=>N,ruleOfThree:()=>I,safeTextTrim:()=>W,saveJsonFile:()=>y,shuffleArray:()=>o,toTitleCase:()=>q,toTitleCaseLowerFirst:()=>H});var b=r(287);const v="undefined"!=typeof window&&void 0!==window.document,E={items:{},order:[]};function A(t,e){const r=[],n=Array.isArray(t)?t:Object.entries(t);for(const[t,o]of n)if(!E.items.hasOwnProperty(t)){E.items[t]=o;let n="number"==typeof e?e:-1;if(-1===n){const t=E.order.indexOf("object");n=t>-1?t:E.order.length}n=Math.min(Math.max(0,n),E.order.length),E.order.splice(n,0,t),r.push(t)}return r}function T(t){const e=[...E.order];return!!t.every(t=>e.includes(t))&&(E.order=t.slice(),!0)}function B(){return[...E.order]}const C=t=>{if(null===t)return"null";for(const e of E.order)if("function"!=typeof E.items[e]||E.items[e](t))return e;return"unknown"};function S(t,e){if(void 0===t)return null;const r=C(t);return"string"==typeof e?r===e.toLowerCase():r}A([["undefined",t=>void 0===t],["null",t=>null===t],["boolean",t=>"boolean"==typeof t],["number",t=>"number"==typeof t&&!Number.isNaN(t)],["bigint",t=>"bigint"==typeof t],["string",t=>"string"==typeof t],["symbol",t=>"symbol"==typeof t],["function",t=>"function"==typeof t],["array",t=>Array.isArray(t)]]),v||A([["buffer",t=>void 0!==b.hp&&b.hp.isBuffer(t)]]),v&&A([["file",t=>"undefined"!=typeof File&&t instanceof File]]),A([["date",t=>t instanceof Date],["regexp",t=>t instanceof RegExp],["map",t=>t instanceof Map],["set",t=>t instanceof Set],["weakmap",t=>t instanceof WeakMap],["weakset",t=>t instanceof WeakSet],["promise",t=>t instanceof Promise]]),v&&A([["htmlelement",t=>"undefined"!=typeof HTMLElement&&t instanceof HTMLElement]]),A([["object",t=>l(t)]]);const L=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),U=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,M=()=>L()||U(),N=t=>new Promise(async(e,r)=>{const n=document.documentElement;try{n.requestFullscreen?await n.requestFullscreen(t):n.mozRequestFullScreen?n.mozRequestFullScreen(t):n.webkitRequestFullScreen?n.webkitRequestFullScreen(t):n.msRequestFullscreen&&n.msRequestFullscreen(t),e()}catch(t){r(t)}}),O=()=>new Promise((t,e)=>{if(document.exitFullscreen)document.exitFullscreen().then(t).catch(e);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()}t()}catch(t){e(t)}}),x=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],F=(t,e)=>{x.forEach(r=>{document.addEventListener(r,t,e)})},R=(t,e)=>{x.forEach(r=>{document.removeEventListener(r,t,e)})};function I(t,e,r,n=!1){return n?Number(t*e)/r:Number(r*e)/t}function P(t,e){return t*(e/100)}function k(t,e){return 0===e?0:t/e*100}function j(t=0,e=null){if(null!=t&&0!==t){const r=new Date(t);if(Number.isNaN(r.getTime()))return null;const n=e instanceof Date?e:new Date;let o=n.getFullYear()-r.getFullYear();const i=n.getMonth(),s=r.getMonth(),u=n.getDate(),a=r.getDate();return(i<s||i===s&&u<a)&&o--,Math.abs(o)}return null}function D(t,e=null,r=null){if("number"!=typeof t||t<0)return{unit:null,value:null};if(0===t)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(t)/Math.log(1024)),o);let s=t/Math.pow(1024,i);if(null!==e){const t=e<0?0:e;s=parseFloat(s.toFixed(t))}return{unit:n[i],value:s}}function z({baseValues:t=[0,1],length:e=10,combiner:r=(t,e)=>t+e}={}){if(!Array.isArray(t)||2!==t.length)throw new Error("baseValues must be an array of exactly two numbers");const n=[...t.slice(0,2)];for(let t=2;t<e;t++){const e=r(n[t-2],n[t-1],t);n.push(e)}return n}function Y(t,e){if(Number.isNaN(t)||!Number.isFinite(t))throw new TypeError("Original market cap must be a number.");if(Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Circulating supply must be a number.");if(e<=0)throw new Error("Circulating supply must be greater than zero.");return t/e}function $(t,e,r){if(Number.isNaN(r)||!Number.isFinite(r))throw new TypeError("New market cap must be a number.");const n=Y(t,e),o="number"==typeof r?r/e:NaN;return{originalPrice:n,newPrice:o,priceChangePercent:"number"==typeof r?(o-n)/n*100:NaN}}function q(t){return t.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase())}function H(t){const e=t.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase());return e.charAt(0).toLowerCase()+e.slice(1)}function J(t="a"){"undefined"!=typeof HTMLElement?document.addEventListener("keydown",function(e){if(e.ctrlKey&&e.altKey&&e.key.toLowerCase()===t){if(e.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 W(t,e,r=.6){if("string"!=typeof t)throw new TypeError("Expected a string for 'text', but received "+typeof t);if(!Number.isInteger(e)||e<=0)throw new TypeError(`Expected 'limit' to be a positive integer, but received ${e}`);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=t.trim();if(n.length>e){const t=n.lastIndexOf(" ",e);return t>0&&t>=e*r?`${n.substring(0,t).trim()}...`:`${n.substring(0,e).trim()}...`}return n}const _=(t,e)=>t.bottom<e.top,V=(t,e)=>t.top>e.bottom,X=(t,e)=>t.right<e.left,K=(t,e)=>t.left>e.right,Z=(t,e)=>t.bottom<=e.top,G=(t,e)=>t.top>=e.bottom,Q=(t,e)=>t.right<=e.left,tt=(t,e)=>t.left>=e.right,et=(t,e)=>!(X(t,e)||K(t,e)||_(t,e)||V(t,e)),rt=(t,e)=>!(Q(t,e)||tt(t,e)||Z(t,e)||G(t,e)),nt=(t,e)=>X(t,e)?"left":K(t,e)?"right":_(t,e)?"top":V(t,e)?"bottom":null,ot=(t,e)=>Q(t,e)?"left":tt(t,e)?"right":Z(t,e)?"top":G(t,e)?"bottom":null,it=(t,e)=>({overlapLeft:e.right-t.left,overlapRight:t.right-e.left,overlapTop:e.bottom-t.top,overlapBottom:t.bottom-e.top}),st=({overlapLeft:t=-1,overlapRight:e=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:t<e?"right":"left",dirY:r<n?"bottom":"top"}),ut=t=>({x:t.left+t.width/2,y:t.top+t.height/2});function at(t,e){const r=t.left+t.width/2,n=t.top+t.height/2;return{x:e.left+e.width/2-r,y:e.top+e.height/2-n}}function ft(t,e){if(!rt(t,e))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=it(t,e),{dirX:s,dirY:u}=st({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),a=Math.min(r,n),f=Math.min(o,i);let l;return l=a<f?s:u,{inDir:l,dirX:s,dirY:u,depthX:a,depthY:f}}function lt(t,e){const r=rt(t,e),n={in:null,x:null,y:null},o={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:s,overlapRight:u,overlapTop:a,overlapBottom:f}=it(e,t);i.top=a,i.bottom=f,i.left=s,i.right=u;const l=Object.entries(i).filter(([,t])=>t>0).sort((t,e)=>t[1]-e[1]),{dirX:c,dirY:h}=st({overlapLeft:u,overlapRight:s,overlapTop:f,overlapBottom:a});return n.y=h,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":l.length?l[0][0]:"top":null,{dirs:n,depth:i,isNeg:o}}})(),window.TinyBasicsEs=n})();
|
|
2
|
+
(()=>{var t={251:(t,e)=>{e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,f=u>>1,l=-7,c=r?o-1:0,h=r?-1:1,p=t[e+c];for(c+=h,i=p&(1<<-l)-1,p>>=-l,l+=a;l>0;i=256*i+t[e+c],c+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=n;l>0;s=256*s+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=f}return(p?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,u,f=8*i-o-1,l=(1<<f)-1,c=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(e*u-1)*Math.pow(2,o),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;t[r+p]=255&a,p+=d,a/=256,o-=8);for(s=s<<o|a,f+=o;f>0;t[r+p]=255&s,p+=d,s/=256,f-=8);t[r+p-d]|=128*y}},287:(t,e,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;e.hp=u,e.IS=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|y(t,e),n=a(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(z(t,Uint8Array)){var e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(z(t,ArrayBuffer)||t&&z(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(z(t,SharedArrayBuffer)||t&&z(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var o=function(t){if(u.isBuffer(t)){var e=0|d(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||$(t.length)?a(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return l(t),a(t<0?0:0|d(t))}function h(t){for(var e=t.length<0?0:0|d(t.length),r=a(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||z(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:k(t).length;e=(""+e).toLowerCase(),o=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return U(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return L(this,e,r);case"base64":return N(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),$(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,o){var i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var l=-1;for(i=r;i<a;i++)if(f(t,i)===f(e,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*s}else-1!==l&&(i-=i-l),l=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var c=!0,h=0;h<u;h++)if(f(t,i+h)!==f(e,h)){c=!1;break}if(c)return i}return-1}function v(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if($(a))return s;t[r+s]=a}return s}function E(t,e,r,n){return Y(k(e,t.length-r),t,r,n)}function T(t,e,r,n){return Y(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return Y(j(e),t,r,n)}function B(t,e,r,n){return Y(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function N(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function C(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,u,f=t[o],l=null,c=f>239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&f)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=S));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.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(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return l(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(z(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),z(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(z(i,Uint8Array))o+i.length>n.length?u.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!u.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?C(this,0,t):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,o){if(z(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(i,s),f=this.slice(n,o),l=t.slice(e,r),c=0;c<a;++c)if(f[c]!==l[c]){i=f[c],s=l[c];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>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,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return T(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function M(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function L(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function U(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=q[t[i]];return o}function O(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function x(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function F(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function R(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,8),o.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||x(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||x(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||x(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||F(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||F(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s|0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s|0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<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),t.length-e<n-r&&(n=t.length-e+r);var o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=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&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var P=/[^+/0-9A-Za-z-_]/g;function k(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=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((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function $(t){return t!=t}var q=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,i=a(t),s=i[0],u=i[1],f=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),l=0,c=u>0?s-4:s;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],f[l++]=e>>16&255,f[l++]=e>>8&255,f[l++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,f[l++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,f[l++]=e>>8&255,f[l++]=255&e),f},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],s=16383,a=0,u=n-o;a<u;a+=s)i.push(f(t,a,a+s>u?u:a+s));return 1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<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(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function f(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(u(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";function t(t,e=!1){return e?function(e,r){return e[t]>r[t]?-1:e[t]<r[t]?1:0}:function(e,r){return e[t]<r[t]?-1:e[t]>r[t]?1:0}}async function e(t,e,r){const n=[];t.replace(e,(t,...e)=>(n.push(r(t,...e)),t));const o=await Promise.all(n);return t.replace(e,()=>o.shift())}function o(t){let e,r=t.length;for(;0!==r;)e=Math.floor(Math.random()*r),r--,[t[r],t[e]]=[t[e],t[r]];return t}function i(t=new Date,e="asSeconds",r=null){if(t instanceof Date){const n=r instanceof Date?r:new Date,o=t.getTime()-n.getTime();switch(e){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 s(t,e="seconds",r="{time}"){t=Math.max(0,Math.floor(t));const n=["seconds","minutes","hours","days","months","years"].indexOf(e),o=n>=5,i=n>=4,s=n>=3,a=n>=2,u=n>=1,f=n>=0,l={years:o?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:a?0:NaN,minutes:u?0:NaN,seconds:f?0:NaN,total:NaN};let c=t;if(o||i||s){const t=new Date(1980,0,1),e=new Date(t.getTime()+1e3*c),r=new Date(t);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=e.getTime();)r.setFullYear(r.getFullYear()+1),l.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=e.getTime();)r.setMonth(r.getMonth()+1),l.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=e.getTime();)r.setDate(r.getDate()+1),l.days++;c=Math.floor((e.getTime()-r.getTime())/1e3)}a&&(l.hours=Math.floor(c/3600),c%=3600),u&&(l.minutes=Math.floor(c/60),c%=60),f&&(l.seconds=c),i&&(l.years,l.months,l.days),o&&(l.years,l.months,l.days),l.total=+t.toFixed(2).replace(/\.00$/,"");const h=t=>{const e="string"==typeof t?parseInt(t):t;return Number.isNaN(e)?"NaN":String(e).padStart(2,"0")},p=[a?h(l.hours):null,u?h(l.minutes):null,f?h(l.seconds):null].filter(t=>null!==t).join(":");return r.replace(/\{years\}/g,String(l.years)).replace(/\{months\}/g,String(l.months)).replace(/\{days\}/g,String(l.days)).replace(/\{hours\}/g,h(l.hours)).replace(/\{minutes\}/g,h(l.minutes)).replace(/\{seconds\}/g,h(l.seconds)).replace(/\{time\}/g,p).replace(/\{total\}/g,String(l.total)).trim()}function a(t){return s(t,"hours","{hours}:{minutes}:{seconds}")}function u(t){return s(t,"days","{days}d {hours}:{minutes}:{seconds}")}function f(t,e="milliseconds"){t=Math.max(0,Math.floor(t));const r=["milliseconds","seconds","minutes","hours","days","months","years"].indexOf(e),n=r>=6,o=r>=5,i=r>=4,s=r>=3,a=r>=2,u=r>=1,f=r>=0,l={years:n?0:NaN,months:o?0:NaN,days:i?0:NaN,hours:s?0:NaN,minutes:a?0:NaN,seconds:u?0:NaN,milliseconds:f?0:NaN,total:NaN};let c=t;if(n||o||i){const t=new Date(1980,0,1),e=new Date(t.getTime()+c),r=new Date(t);if(n)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=e.getTime();)r.setFullYear(r.getFullYear()+1),l.years++;if(o)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=e.getTime();)r.setMonth(r.getMonth()+1),l.months++;if(i)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=e.getTime();)r.setDate(r.getDate()+1),l.days++;c=e.getTime()-r.getTime()}return s&&(l.hours=Math.floor(c/36e5),c%=36e5),a&&(l.minutes=Math.floor(c/6e4),c%=6e4),u&&(l.seconds=Math.floor(c/1e3),c%=1e3),f&&(l.milliseconds=c),o&&(l.years,l.months,l.days),n&&(l.years,l.months,l.days),l.total=+t,l}function l(t){return Array.isArray(t)?t.length:c(t)?Object.keys(t).length:0}function c(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"===Object.prototype.toString.call(t)}function h(t,e){return new Promise((r,n)=>{const o=new FileReader;o.onload=()=>{try{r(o.result)}catch(t){n(t)}},o.onerror=()=>{n(o.error)},o[e](t)})}function p(t,e=!1){return new Promise((r,n)=>{"string"!=typeof e&&"boolean"!=typeof e&&n(new TypeError("The isDataUrl parameter must be a boolean or a string.")),h(t,"readAsDataURL").then(t=>{if("string"!=typeof t)throw new TypeError("Expected file content to be a string.");const n=t.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 e)return r(e?t:i);if(!/^[\w-]+\/[\w.+-]+$/.test(e))throw new Error(`Invalid MIME type string: ${e}`);return r(`data:${e};base64,${i}`)}).catch(n)})}function d(t){return new Promise((e,r)=>h(t,"readAsText").then(t=>{if("string"!=typeof t)throw new TypeError("Expected file content to be a string.");const r=t.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.");e(n)}).catch(r))}function y(t,e,r=2){const n=JSON.stringify(e,null,r),o=new Blob([n],{type:"application/json"}),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}async function g(t,{method:e="GET",body:r,timeout:n=0,retries:o=0,headers:i={},signal:s=null}={}){if("string"!=typeof t||!t.startsWith("../")&&!t.startsWith("./")&&!t.startsWith("/")&&!t.startsWith("https://")&&!t.startsWith("http://"))throw new Error("Invalid URL: must be a valid http or https address.");if("string"!=typeof e||!e.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 u=null;for(let f=0;f<a;f++){const a=s?null:new AbortController,l=s||(a?.signal??null),h=!s&&n&&a?setTimeout(()=>a.abort(),n):null;try{const n=await fetch(t,{method:e.toUpperCase(),headers:{Accept:"application/json",...i},body:void 0!==r?c(r)?JSON.stringify(r):r:void 0,signal:l});if(h&&clearTimeout(h),!n.ok)throw new Error(`HTTP error: ${n.status} ${n.statusText}`);return n}catch(t){if(u=t,s)break;f<o&&await new Promise(t=>setTimeout(t,300*(f+1)))}}throw new Error(`Failed to fetch JSON from "${t}"${u?`: ${u.message}`:"."}`)}async function m(t,e){return new Promise((r,n)=>{g(t,e).then(async t=>{const e=t.headers.get("content-type")||"";if(!e.includes("application/json"))throw new Error(`Unexpected content-type: ${e}`);const n=await t.json();if(!Array.isArray(n)&&!c(n))throw new Error("Received invalid data instead of valid JSON.");return r(n)}).catch(n)})}async function w(t,e,r){return new Promise((n,o)=>{g(t,r).then(async t=>{const r=t.headers.get("content-type")||"";if(Array.isArray(e)&&e.length>0&&!e.some(t=>r.includes(t)))throw new Error(`Blocked MIME type: ${r}`);const o=await t.text();return n(o)}).catch(o)})}function b({element:t=document.body,hiddenClass:e="windowHidden",visibleClass:r="windowVisible",onVisible:n,onHidden:o}={}){if(!(t instanceof Element))throw new TypeError('"element" must be an instance of Element.');if("string"!=typeof e)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=()=>{t.classList.remove(e),t.classList.remove(r)};let u=null;const f=["visibilitychange","mozvisibilitychange","webkitvisibilitychange","msvisibilitychange"],l=["hidden","mozHidden","webkitHidden","msHidden"];for(let t=0;t<l.length;t++)if(l[t]in document){u=l[t];break}const c=function(f){a();const l=f?.type,c=u&&document[u];["focus","focusin","pageshow"].includes(l)?(t.classList.add(r),n?.({type:l,oldClass:s,oldType:i}),s=r):["blur","focusout","pagehide"].includes(l)||c?(t.classList.add(e),o?.({type:l,oldClass:s,oldType:i}),s=e):(t.classList.add(r),n?.({type:l,oldClass:s,oldType:i}),s=r),i=l};let h=()=>{};if(u){const t=f[l.indexOf(u)];document.addEventListener(t,c),window.addEventListener("focus",c),window.addEventListener("blur",c),h=()=>{document.removeEventListener(t,c),window.removeEventListener("focus",c),window.removeEventListener("blur",c),a()}}else"onfocusin"in document?(document.onfocusin=document.onfocusout=c,h=()=>{document.onfocusin=document.onfocusout=null,a()}):(window.onpageshow=window.onpagehide=window.onfocus=window.onblur=c,h=()=>{window.onpageshow=window.onpagehide=window.onfocus=window.onblur=null,a()});const p=new Event(u&&document[u]?"blur":"focus");return c(p),h}r.r(n),r.d(n,{addAiMarkerShortcut:()=>W,areElsCollBottom:()=>X,areElsCollLeft:()=>K,areElsCollPerfBottom:()=>Q,areElsCollPerfLeft:()=>tt,areElsCollPerfRight:()=>et,areElsCollPerfTop:()=>G,areElsCollRight:()=>Z,areElsCollTop:()=>V,areElsColliding:()=>rt,areElsPerfColliding:()=>nt,arraySortPositions:()=>t,asyncReplace:()=>e,breakdownDuration:()=>f,calculateMarketcap:()=>$,cloneObjTypeOrder:()=>N,compareMarketcap:()=>q,countObj:()=>l,documentIsFullScreen:()=>M,exitFullScreen:()=>x,extendObjType:()=>A,fetchJson:()=>m,fetchText:()=>w,formatBytes:()=>Y,formatCustomTimer:()=>s,formatDayTimer:()=>u,formatTimer:()=>a,genFibonacciSeq:()=>z,getAge:()=>j,getElsCollDetails:()=>ct,getElsCollDirDepth:()=>lt,getElsCollOverlap:()=>st,getElsCollOverlapPos:()=>at,getElsColliding:()=>ot,getElsPerfColliding:()=>it,getElsRelativeCenterOffset:()=>ft,getPercentage:()=>k,getRectCenter:()=>ut,getSimplePerc:()=>P,getTimeDuration:()=>i,installWindowHiddenScript:()=>b,isFullScreenMode:()=>U,isJsonObject:()=>c,isScreenFilled:()=>L,objType:()=>S,offFullScreenChange:()=>I,onFullScreenChange:()=>R,readBase64Blob:()=>p,readFileBlob:()=>h,readJsonBlob:()=>d,reorderObjTypeOrder:()=>B,requestFullScreen:()=>O,ruleOfThree:()=>D,safeTextTrim:()=>_,saveJsonFile:()=>y,shuffleArray:()=>o,toTitleCase:()=>H,toTitleCaseLowerFirst:()=>J});var v=r(287);const E="undefined"!=typeof window&&void 0!==window.document,T={items:{},order:[]};function A(t,e){const r=[],n=Array.isArray(t)?t:Object.entries(t);for(const[t,o]of n)if(!T.items.hasOwnProperty(t)){T.items[t]=o;let n="number"==typeof e?e:-1;if(-1===n){const t=T.order.indexOf("object");n=t>-1?t:T.order.length}n=Math.min(Math.max(0,n),T.order.length),T.order.splice(n,0,t),r.push(t)}return r}function B(t){const e=[...T.order];return!!t.every(t=>e.includes(t))&&(T.order=t.slice(),!0)}function N(){return[...T.order]}const C=t=>{if(null===t)return"null";for(const e of T.order)if("function"!=typeof T.items[e]||T.items[e](t))return e;return"unknown"};function S(t,e){if(void 0===t)return null;const r=C(t);return"string"==typeof e?r===e.toLowerCase():r}A([["undefined",t=>void 0===t],["null",t=>null===t],["boolean",t=>"boolean"==typeof t],["number",t=>"number"==typeof t&&!Number.isNaN(t)],["bigint",t=>"bigint"==typeof t],["string",t=>"string"==typeof t],["symbol",t=>"symbol"==typeof t],["function",t=>"function"==typeof t],["array",t=>Array.isArray(t)]]),E||A([["buffer",t=>void 0!==v.hp&&v.hp.isBuffer(t)]]),E&&A([["file",t=>"undefined"!=typeof File&&t instanceof File]]),A([["date",t=>t instanceof Date],["regexp",t=>t instanceof RegExp],["map",t=>t instanceof Map],["set",t=>t instanceof Set],["weakmap",t=>t instanceof WeakMap],["weakset",t=>t instanceof WeakSet],["promise",t=>t instanceof Promise]]),E&&A([["htmlelement",t=>"undefined"!=typeof HTMLElement&&t instanceof HTMLElement]]),A([["object",t=>c(t)]]);const M=()=>!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen),L=()=>window.innerHeight===screen.height&&window.innerWidth===screen.width,U=()=>M()||L(),O=t=>new Promise(async(e,r)=>{const n=document.documentElement;try{n.requestFullscreen?await n.requestFullscreen(t):n.mozRequestFullScreen?n.mozRequestFullScreen(t):n.webkitRequestFullScreen?n.webkitRequestFullScreen(t):n.msRequestFullscreen&&n.msRequestFullscreen(t),e()}catch(t){r(t)}}),x=()=>new Promise((t,e)=>{if(document.exitFullscreen)document.exitFullscreen().then(t).catch(e);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()}t()}catch(t){e(t)}}),F=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],R=(t,e)=>{F.forEach(r=>{document.addEventListener(r,t,e)})},I=(t,e)=>{F.forEach(r=>{document.removeEventListener(r,t,e)})};function D(t,e,r,n=!1){return n?Number(t*e)/r:Number(r*e)/t}function P(t,e){return t*(e/100)}function k(t,e){return 0===e?0:t/e*100}function j(t=0,e=null){if(null!=t&&0!==t){const r=new Date(t);if(Number.isNaN(r.getTime()))return null;const n=e instanceof Date?e:new Date;let o=n.getFullYear()-r.getFullYear();const i=n.getMonth(),s=r.getMonth(),a=n.getDate(),u=r.getDate();return(i<s||i===s&&a<u)&&o--,Math.abs(o)}return null}function Y(t,e=null,r=null){if("number"!=typeof t||t<0)return{unit:null,value:null};if(0===t)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(t)/Math.log(1024)),o);let s=t/Math.pow(1024,i);if(null!==e){const t=e<0?0:e;s=parseFloat(s.toFixed(t))}return{unit:n[i],value:s}}function z({baseValues:t=[0,1],length:e=10,combiner:r=(t,e)=>t+e}={}){if(!Array.isArray(t)||2!==t.length)throw new Error("baseValues must be an array of exactly two numbers");const n=[...t.slice(0,2)];for(let t=2;t<e;t++){const e=r(n[t-2],n[t-1],t);n.push(e)}return n}function $(t,e){if(Number.isNaN(t)||!Number.isFinite(t))throw new TypeError("Original market cap must be a number.");if(Number.isNaN(e)||!Number.isFinite(e))throw new TypeError("Circulating supply must be a number.");if(e<=0)throw new Error("Circulating supply must be greater than zero.");return t/e}function q(t,e,r){if(Number.isNaN(r)||!Number.isFinite(r))throw new TypeError("New market cap must be a number.");const n=$(t,e),o="number"==typeof r?r/e:NaN;return{originalPrice:n,newPrice:o,priceChangePercent:"number"==typeof r?(o-n)/n*100:NaN}}function H(t){return t.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase())}function J(t){const e=t.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase());return e.charAt(0).toLowerCase()+e.slice(1)}function W(t="a"){"undefined"!=typeof HTMLElement?document.addEventListener("keydown",function(e){if(e.ctrlKey&&e.altKey&&e.key.toLowerCase()===t){if(e.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 _(t,e,r=.6){if("string"!=typeof t)throw new TypeError("Expected a string for 'text', but received "+typeof t);if(!Number.isInteger(e)||e<=0)throw new TypeError(`Expected 'limit' to be a positive integer, but received ${e}`);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=t.trim();if(n.length>e){const t=n.lastIndexOf(" ",e);return t>0&&t>=e*r?`${n.substring(0,t).trim()}...`:`${n.substring(0,e).trim()}...`}return n}const V=(t,e)=>t.bottom<e.top,X=(t,e)=>t.top>e.bottom,K=(t,e)=>t.right<e.left,Z=(t,e)=>t.left>e.right,G=(t,e)=>t.bottom<=e.top,Q=(t,e)=>t.top>=e.bottom,tt=(t,e)=>t.right<=e.left,et=(t,e)=>t.left>=e.right,rt=(t,e)=>!(K(t,e)||Z(t,e)||V(t,e)||X(t,e)),nt=(t,e)=>!(tt(t,e)||et(t,e)||G(t,e)||Q(t,e)),ot=(t,e)=>K(t,e)?"left":Z(t,e)?"right":V(t,e)?"top":X(t,e)?"bottom":null,it=(t,e)=>tt(t,e)?"left":et(t,e)?"right":G(t,e)?"top":Q(t,e)?"bottom":null,st=(t,e)=>({overlapLeft:e.right-t.left,overlapRight:t.right-e.left,overlapTop:e.bottom-t.top,overlapBottom:t.bottom-e.top}),at=({overlapLeft:t=-1,overlapRight:e=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:t<e?"right":"left",dirY:r<n?"bottom":"top"}),ut=t=>({x:t.left+t.width/2,y:t.top+t.height/2});function ft(t,e){const r=t.left+t.width/2,n=t.top+t.height/2;return{x:e.left+e.width/2-r,y:e.top+e.height/2-n}}function lt(t,e){if(!nt(t,e))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=st(t,e),{dirX:s,dirY:a}=at({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),u=Math.min(r,n),f=Math.min(o,i);let l;return l=u<f?s:a,{inDir:l,dirX:s,dirY:a,depthX:u,depthY:f}}function ct(t,e){const r=nt(t,e),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:u,overlapBottom:f}=st(e,t);i.top=u,i.bottom=f,i.left=s,i.right=a;const l=Object.entries(i).filter(([,t])=>t>0).sort((t,e)=>t[1]-e[1]),{dirX:c,dirY:h}=at({overlapLeft:a,overlapRight:s,overlapTop:f,overlapBottom:u});return n.y=h,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":l.length?l[0][0]:"top":null,{dirs:n,depth:i,isNeg:o}}})(),window.TinyBasicsEs=n})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.d(e,{TinyDragger:()=>W});var r={};t.r(r),t.d(r,{areElsCollBottom:()=>n,areElsCollLeft:()=>i,areElsCollPerfBottom:()=>a,areElsCollPerfLeft:()=>c,areElsCollPerfRight:()=>d,areElsCollPerfTop:()=>l,areElsCollRight:()=>s,areElsCollTop:()=>o,areElsColliding:()=>m,areElsPerfColliding:()=>p,getElsCollDetails:()=>w,getElsCollDirDepth:()=>E,getElsCollOverlap:()=>g,getElsCollOverlapPos:()=>f,getElsColliding:()=>u,getElsPerfColliding:()=>h,getElsRelativeCenterOffset:()=>b,getRectCenter:()=>y});const o=(t,e)=>t.bottom<e.top,n=(t,e)=>t.top>e.bottom,i=(t,e)=>t.right<e.left,s=(t,e)=>t.left>e.right,l=(t,e)=>t.bottom<=e.top,a=(t,e)=>t.top>=e.bottom,c=(t,e)=>t.right<=e.left,d=(t,e)=>t.left>=e.right,m=(t,e)=>!(i(t,e)||s(t,e)||o(t,e)||n(t,e)),p=(t,e)=>!(c(t,e)||d(t,e)||l(t,e)||a(t,e)),u=(t,e)=>i(t,e)?"left":s(t,e)?"right":o(t,e)?"top":n(t,e)?"bottom":null,h=(t,e)=>c(t,e)?"left":d(t,e)?"right":l(t,e)?"top":a(t,e)?"bottom":null,g=(t,e)=>({overlapLeft:e.right-t.left,overlapRight:t.right-e.left,overlapTop:e.bottom-t.top,overlapBottom:t.bottom-e.top}),f=({overlapLeft:t=-1,overlapRight:e=-1,overlapTop:r=-1,overlapBottom:o=-1}={})=>({dirX:t<e?"right":"left",dirY:r<o?"bottom":"top"}),y=t=>({x:t.left+t.width/2,y:t.top+t.height/2});function b(t,e){const r=t.left+t.width/2,o=t.top+t.height/2;return{x:e.left+e.width/2-r,y:e.top+e.height/2-o}}function E(t,e){if(!p(t,e))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:o,overlapTop:n,overlapBottom:i}=g(t,e),{dirX:s,dirY:l}=f({overlapLeft:r,overlapRight:o,overlapTop:n,overlapBottom:i}),a=Math.min(r,o),c=Math.min(n,i);let d;return d=a<c?s:l,{inDir:d,dirX:s,dirY:l,depthX:a,depthY:c}}function w(t,e){const r=p(t,e),o={in:null,x:null,y:null},n={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:s,overlapRight:l,overlapTop:a,overlapBottom:c}=g(e,t);i.top=a,i.bottom=c,i.left=s,i.right=l;const d=Object.entries(i).filter(([,t])=>t>0).sort((t,e)=>t[1]-e[1]),{dirX:m,dirY:u}=f({overlapLeft:l,overlapRight:s,overlapTop:c,overlapBottom:a});return o.y=u,o.x=m,i.bottom<0?n.y="bottom":i.top<0&&(n.y="top"),i.left<0?n.x="left":i.right<0&&(n.x="right"),o.in=r?i.top===i.bottom&&i.bottom===i.left&&i.left===i.right?"center":d.length?d[0][0]:"top":null,{dirs:o,depth:i,isNeg:n}}const{areElsColliding:v,areElsPerfColliding:T,areElsCollTop:C,areElsCollBottom:x,areElsCollLeft:_,areElsCollRight:D}=r,L=new WeakMap,A=new WeakMap,k={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class S{static Utils={...r};static async fetchHtmlFile(t,e={method:"GET"}){const r=await fetch(t,e),o=r.headers.get("Content-Type")||"";if(!r.ok)throw new Error(`Failed to fetch: ${r.status} ${r.statusText}`);if(!o.includes("text/html"))throw new Error(`Invalid content type: ${o} (expected text/html)`);const n=await r.text();return S.htmlToJson(n)}static async fetchHtmlNodes(t,e){const r=await S.fetchHtmlFile(t,e);return S.jsonToNodes(r)}static async fetchHtmlTinyElems(t,e){const r=await S.fetchHtmlNodes(t,e);return S.toTinyElm(r)}static templateToJson(t){return S.htmlToJson([...t.content.childNodes].map(t=>t instanceof Element?t.getHTML():t instanceof Text?t.textContent:"").join(""))}static templateToNodes(t){const e=[];return[...t.content.cloneNode(!0).childNodes].map(t=>{if(!(t instanceof Element||t instanceof Text||t instanceof Comment))throw new Error(`Expected only Element nodes in <template>, but found: ${t.constructor.name}`);t instanceof Comment||e.push(t)}),e}static templateToTinyElems(t){return S.toTinyElm(S.templateToNodes(t))}static htmlToJson(t){const e=document.createElement("div");e.innerHTML=t.trim();const r=[],o=t=>{if(t instanceof Comment)return null;if(t instanceof Text){const e=t.textContent?.trim();return e||null}if(!(t instanceof Element))return null;const e=t.tagName.toLowerCase(),r={};for(const e of t.attributes)r[S.getPropName(e.name)]=e.value;const n=Array.from(t.childNodes).map(o).filter(Boolean);return n.length>0?[e,r,...n]:[e,r]};for(const t of e.childNodes){const e=o(t);e&&r.push(e)}return e.innerHTML="",r}static jsonToNodes(t){const e=t=>{if("string"==typeof t)return document.createTextNode(t);if(!Array.isArray(t))return document.createTextNode("");const[r,o,...n]=t,i=document.createElement(r);for(const[t,e]of Object.entries(o))i.setAttribute(S.getAttrName(t),e);for(const t of n){const r=e(t);r instanceof Comment||i.appendChild(r)}return i};return t.map(e).filter(t=>!(t instanceof Comment))}static jsonToTinyElems(t){return S.toTinyElm(S.jsonToNodes(t))}static createFrom(t,e){if("string"!=typeof t)throw new TypeError('The "tagName" must be a string.');if(void 0!==e&&"object"!=typeof e)throw new TypeError('The "attrs" must be a object.');const r=S.createElement(t);if("object"==typeof e)for(const t in e)r.setAttr(t,e[t]);return r}static createElement(t,e){if("string"!=typeof t)throw new TypeError("[TinyHtml] createElement(): The tagName must be a string.");if(void 0!==e&&"object"!=typeof e)throw new TypeError("[TinyHtml] createElement(): The ops must be a object.");return new S(document.createElement(t,e))}static createTextNode(t){if("string"!=typeof t)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new S(document.createTextNode(t))}static createElementFromHTML(t){const e=document.createElement("template");if(!(t=t.trim()).startsWith("<"))return S.createTextNode(t);if(e.innerHTML=t,!(e.content.firstChild instanceof Element))throw new Error("The HTML string must contain a valid HTML element.");return new S(e.content.firstChild)}static query(t,e=document){const r=e.querySelector(t);return r?new S(r):null}querySelector(t){return S.query(t,S._preElem(this,"query"))}static queryAll(t,e=document){return new S(e.querySelectorAll(t))}querySelectorAll(t){return S.queryAll(t,S._preElem(this,"queryAll"))}static getById(t){const e=document.getElementById(t);return e?new S(e):null}static getByClassName(t,e=document){return new S(e.getElementsByClassName(t))}getElementsByClassName(t){return S.getByClassName(t,S._preElem(this,"getByClassName"))}static getByName(t){return new S(document.getElementsByName(t))}static getByTagNameNS(t,e="http://www.w3.org/1999/xhtml",r=document){return new S(r.getElementsByTagNameNS(e,t))}getElementsByTagNameNS(t,e="http://www.w3.org/1999/xhtml"){return S.getByTagNameNS(t,e,S._preElem(this,"getByTagNameNS"))}get(t){if("number"!=typeof t)throw new TypeError("The index must be a number.");if(!this.#t[t])throw new Error(`No element found at index ${t}.`);return this.#t[t]}extract(t){if("number"!=typeof t)throw new TypeError("The index must be a number.");if(!this.#t[t])throw new Error(`Cannot extract: no element exists at index ${t}.`);return new S(this.#t[t])}exists(t){if("number"!=typeof t)throw new TypeError("The index must be a number.");return!!this.#t[t]}getAll(){return[...this.#t]}_getElement(t,e){if(!(this.#t[e]instanceof Element||this.#t[e]instanceof Window||this.#t[e]instanceof Document||this.#t[e]instanceof Text))throw new Error(`[TinyHtml] Invalid Element in ${t}().`);return this.#t[e]}_getElements(t){if(!this.#t.every(t=>t instanceof Element||t instanceof Window||t instanceof Document||t instanceof Text))throw new Error(`[TinyHtml] Invalid Element in ${t}().`);return[...this.#t]}static _preElemsTemplate(t,e,r,o){const n=t=>{const n=[];return t.map(t=>(t instanceof S?t._getElements(e):[t]).map(t=>{let i=!1;for(const e of r)if(t instanceof e){i=!0;break}if(!i)throw new Error(`[TinyHtml] Invalid element of the list "${o.join(",")}" in ${e}().`);return n.push(t),t})),n};return Array.isArray(t)?n(t):n([t])}static _preElemTemplate(t,e,r,o,n=!1){const i=t=>{const i=t[0],s=i instanceof S?i._getElements(e):[i];if(s.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${e}() (Received ${s.length}/1).`);let l=!1;for(const t of r)if(s[0]instanceof t){l=!0;break}if(!n||null!==s[0]&&void 0!==s[0]||(s[0]=null,l=!0),!l)throw new Error(`[TinyHtml] Invalid element of the list "${o.join(",")}" in ${e}().`);return s[0]};if(!Array.isArray(t))return i([t]);if(t.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${e}() (Received ${t.length}/1).`);return i(t)}static _preElems(t,e){return S._preElemsTemplate(t,e,[Element],["Element"])}static _preElem(t,e){return S._preElemTemplate(t,e,[Element],["Element"])}static _preNodeElems(t,e){return S._preElemsTemplate(t,e,[Node],["Node"])}static _preNodeElem(t,e){return S._preElemTemplate(t,e,[Node],["Node"])}static _preNodeElemWithNull(t,e){return S._preElemTemplate(t,e,[Node],["Node"],!0)}static _preHtmlElems(t,e){return S._preElemsTemplate(t,e,[HTMLElement],["HTMLElement"])}static _preHtmlElem(t,e){return S._preElemTemplate(t,e,[HTMLElement],["HTMLElement"])}static _preInputElems(t,e){return S._preElemsTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preInputElem(t,e){return S._preElemTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preEventTargetElems(t,e){return S._preElemsTemplate(t,e,[EventTarget],["EventTarget"])}static _preEventTargetElem(t,e){return S._preElemTemplate(t,e,[EventTarget],["EventTarget"])}static _preElemsAndWindow(t,e){return S._preElemsTemplate(t,e,[Element,Window],["Element","Window"])}static _preElemAndWindow(t,e){return S._preElemTemplate(t,e,[Element,Window],["Element","Window"])}static _preElemsAndWinAndDoc(t,e){return S._preElemsTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]).map(t=>t instanceof Document?t.documentElement:t)}static _preElemAndWinAndDoc(t,e){const r=S._preElemTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}static _preElemsWithDoc(t,e){return S._preElemsTemplate(t,e,[Element,Document],["Element","Document"])}static _preElemWithDoc(t,e){return S._preElemTemplate(t,e,[Element,Document],["Element","Document"])}static toTinyElm(t){const e=t=>t.map(t=>t instanceof S?t:new S(t));return Array.isArray(t)?e(t):e([t])}static fromTinyElm(t){const e=t=>{const e=[];return t.map(t=>(t instanceof S?t._getElements("fromTinyElm"):[t]).map(t=>e.push(t))),e};return Array.isArray(t)?e(t):e([t])}static winnow(t,e,r,o=!1){if("boolean"!=typeof o)throw new TypeError('The "not" must be a boolean.');if("function"==typeof e)return S._preElems(t,r).filter((t,r)=>!!e.call(t,r,t)!==o);if(e instanceof Element)return S._preElems(t,r).filter(t=>t===e!==o);if(Array.isArray(e)||"string"!=typeof e&&null!=e.length)return S._preElems(t,r).filter(t=>e.includes(t)!==o);let n=e;return o&&(n=`:not(${n})`),S._preElems(t,r).filter(t=>1===t.nodeType&&t.matches(n))}static filter(t,e,r=!1){return r&&(e=`:not(${e})`),S._preElems(t,"filter").filter(t=>1===t.nodeType&&t.matches(e))}static filterOnly(t,e){return S.winnow(t,e,"filterOnly",!1)}static not(t,e){return S.winnow(t,e,"not",!0)}not(t){return S.not(this,t)}static find(t,e){const r=[];for(const o of S._preElems(t,"find"))r.push(...o.querySelectorAll(e));return[...new Set(r)]}find(t){return S.find(this,t)}static is(t,e){return S.winnow(t,e,"is",!1).length>0}is(t){return S.is(this,t)}static has(t,e){const r="string"==typeof e?[...document.querySelectorAll(e)]:S._preElems(e,"has");return S._preElems(t,"has").filter(t=>r.some(e=>t&&t.contains(e)))}has(t){return S.has(this,t).length>0}static closest(t,e,r){const o=[];for(const n of S._preElems(t,"closest")){let t=n;for(;t&&t!==r;){if(1===t.nodeType&&("string"==typeof e?t.matches(e):t===e)){o.push(t);break}t=t.parentElement}}return[...new Set(o)]}closest(t,e){return S.closest(this,t,e)}static isSameDom(t,e){return S._preNodeElem(t,"isSameDom")===S._preNodeElem(e,"isSameDom")}isSameDom(t){return S.isSameDom(this,t)}_data={};static _dataSelector={public:(t,e)=>{const r=S._preElem(e,t);let o=A.get(r);return o||(o={},A.set(r,o)),o},private:(t,e)=>{if(!(e instanceof S))throw new Error(`Element must be a TinyHtml instance to execute ${t}().`);return e._data}};static data(t,e,r=!1){const o=S._dataSelector[r?"private":"public"]("data",t);if(null==e)return{...o};if("string"!=typeof e)throw new TypeError("The key must be a string.");return o.hasOwnProperty(e)?o[e]:void 0}data(t,e){return S.data(this,t,e)}static setData(t,e,r,o=!1){const n=S._dataSelector[o?"private":"public"]("setData",t);if("string"!=typeof e)throw new TypeError("The key must be a string.");return n[e]=r,t}setData(t,e,r=!1){return S.setData(this,t,e,r)}static _getSibling(t,e,r){let o=S._preNodeElemWithNull(t,r);for(;o&&(o=o[e])&&1!==o.nodeType;);return o instanceof Node?o:null}static _getSiblings(t,e){let r=t;const o=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==e&&o.push(r);return o}static domDir(t,e,r,o="domDir"){if("string"!=typeof e)throw new TypeError('The "direction" must be a string.');let n=S._preNodeElemWithNull(t,o);const i=[];for(;n&&(n=n[e]);)if(1===n.nodeType){if(r&&("string"==typeof r?n.matches(r):n===r))break;i.push(n)}return i}static parent(t){let e=S._preNodeElemWithNull(t,"parent");const r=e?e.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return S.parent(this)}static parents(t,e){return S.domDir(t,"parentNode",e,"parents")}parents(t){return S.parents(this,t)}static next(t){return S._getSibling(t,"nextSibling","next")}next(){return S.next(this)}static prev(t){return S._getSibling(t,"previousSibling","prev")}prev(){return S.prev(this)}static nextAll(t){return S.domDir(t,"nextSibling",void 0,"nextAll")}nextAll(){return S.nextAll(this)}static prevAll(t){return S.domDir(t,"previousSibling",void 0,"prevAll")}prevAll(){return S.prevAll(this)}static nextUntil(t,e){return S.domDir(t,"nextSibling",e,"nextUtil")}nextUntil(t){return S.nextUntil(this,t)}static prevUntil(t,e){return S.domDir(t,"previousSibling",e,"prevUtil")}prevUntil(t){return S.prevUntil(this,t)}static siblings(t){const e=S._preNodeElemWithNull(t,"siblings");return S._getSiblings(e&&e.parentNode?e.parentNode.firstChild:null,e)}siblings(){return S.siblings(this)}static children(t){const e=S._preNodeElemWithNull(t,"children");return S._getSiblings(e?e.firstChild:null)}children(){return S.children(this)}static contents(t){const e=S._preNodeElemWithNull(t,"contents");return e instanceof HTMLIFrameElement&&null!=e.contentDocument&&Object.getPrototypeOf(e.contentDocument)?[e.contentDocument]:e instanceof HTMLTemplateElement?Array.from((e.content||e).childNodes):e?Array.from(e.childNodes):[]}contents(){return S.contents(this)}static clone(t,e=!0){if("boolean"!=typeof e)throw new TypeError('The "deep" must be a boolean.');return S._preNodeElems(t,"clone").map(t=>t.cloneNode(e))}clone(t){return S.clone(this,t)[0]}static _appendChecker(t,...e){const r=[],o=[...e];for(const e in o)"string"!=typeof o[e]?r.push(S._preNodeElem(o[e],t)):r.push(o[e]);return r}static append(t,...e){return S._preElem(t,"append").append(...S._appendChecker("append",...e)),t}append(...t){return S.append(this,...t)}static prepend(t,...e){return S._preElem(t,"prepend").prepend(...S._appendChecker("prepend",...e)),t}prepend(...t){return S.prepend(this,...t)}static before(t,...e){return S._preElem(t,"before").before(...S._appendChecker("before",...e)),t}before(...t){return S.before(this,...t)}static after(t,...e){return S._preElem(t,"after").after(...S._appendChecker("after",...e)),t}after(...t){return S.after(this,...t)}static replaceWith(t,...e){return S._preElem(t,"replaceWith").replaceWith(...S._appendChecker("replaceWith",...e)),t}replaceWith(...t){return S.replaceWith(this,...t)}static appendTo(t,e){const r=S._preNodeElems(t,"appendTo"),o=S._preNodeElems(e,"appendTo");return o.forEach((t,e)=>{r.forEach(r=>t.appendChild(e===o.length-1?r:r.cloneNode(!0)))}),t}appendTo(t){return S.appendTo(this,t)}static prependTo(t,e){const r=S._preElems(t,"prependTo"),o=S._preElems(e,"prependTo");return o.forEach((t,e)=>{r.slice().reverse().forEach(r=>t.prepend(e===o.length-1?r:r.cloneNode(!0)))}),t}prependTo(t){return S.prependTo(this,t)}static insertBefore(t,e,r=null){const o=S._preNodeElem(t,"insertBefore"),n=S._preNodeElem(e,"insertBefore"),i=S._preNodeElemWithNull(r,"insertBefore");if(!n.parentNode)throw new Error("The target element has no parent node to insert before.");return n.parentNode.insertBefore(o,i||n),t}insertBefore(t,e){return S.insertBefore(this,t,e)}static insertAfter(t,e,r=null){const o=S._preNodeElem(t,"insertAfter"),n=S._preNodeElem(e,"insertBefore"),i=S._preNodeElemWithNull(r,"insertBefore");if(!n.parentNode)throw new Error("The target element has no parent node to insert after.");return n.parentNode.insertBefore(o,i||n.nextSibling),t}insertAfter(t,e){return S.insertAfter(this,t,e)}static replaceAll(t,e){const r=S._preNodeElems(t,"replaceAll"),o=S._preNodeElems(e,"replaceAll");return o.forEach((t,e)=>{const n=t.parentNode;r.forEach(r=>{n&&n.replaceChild(e===o.length-1?r:r.cloneNode(!0),t)})}),t}replaceAll(t){return S.replaceAll(this,t)}#t;get size(){return this.#t.length}constructor(t){if(t instanceof S)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");const e=t=>{if(!t.every(t=>t instanceof Element||t instanceof Window||t instanceof Document||t instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.")};if(Array.isArray(t))e(t),this.#t=t;else if(t instanceof NodeList||t instanceof HTMLCollection){const r=[...t];e(r),this.#t=r}else{const r=[t];e(r),this.#t=r}}static isWindow(t){return null!=t&&t===t.window}static css(t){const e=S._preElem(t,"css");return window.getComputedStyle(e)}css(){return S.css(this)}static cssString(t,e){const r=S._preElem(t,"cssString");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const o=window.getComputedStyle(r)[e];return"string"==typeof o?o:"number"==typeof o?o.toString():null}cssString(t){return S.cssString(this,t)}static cssList(t,e){const r=S._preElem(t,"cssList");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const o=window.getComputedStyle(r),n={};for(const t of e)void 0!==t&&(n[t]=o.getPropertyValue(t));return n}cssList(t){return S.cssList(this,t)}static cssFloat(t,e){const r=S._preElem(t,"cssFloat");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const o=window.getComputedStyle(r)[e];return parseFloat(o)||0}cssFloat(t){return S.cssFloat(this,t)}static cssFloats(t,e){const r=S._preElem(t,"cssFloats");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const o=window.getComputedStyle(r),n={};for(const t of e)n[t]=parseFloat(o[t])||0;return n}cssFloats(t){return S.cssFloats(this,t)}static#e={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(S.#e,{set:(t,e,r)=>(t[e]=r,S.cssPropRevAliases[r]=e,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(S.#e).map(([t,e])=>[e,t]));static toStyleKc(t){return"string"==typeof S.cssPropAliases[t]?S.cssPropAliases[t]:t}static toStyleCc(t){return"string"==typeof S.cssPropRevAliases[t]?S.cssPropRevAliases[t]:t}static setStyle(t,e,r=null){return S._preHtmlElems(t,"setStyle").forEach(t=>{if("object"==typeof e)for(const[r,o]of Object.entries(e))t.style.setProperty(S.toStyleKc(r),"string"==typeof o?o:"number"==typeof o?`${o}px`:String(o));else t.style.setProperty(S.toStyleKc(e),r)}),t}setStyle(t,e){return S.setStyle(this,t,e)}static getStyle(t,e){return S._preHtmlElem(t,"getStyle").style.getPropertyValue(S.toStyleKc(e))}getStyle(t){return S.getStyle(this,t)}static style(t,{camelCase:e=!1,rawAttr:r=!1}={}){if("boolean"!=typeof e)throw new TypeError('"camelCase" must be a boolean. Received: '+typeof e);if("boolean"!=typeof r)throw new TypeError('"rawAttr" must be a boolean. Received: '+typeof r);const o=S._preHtmlElem(t,"style"),n={};if(r){const t=(o.getAttribute("style")||"").split(";");for(const r of t){const[t,o]=r.split(":");if(!t||!o)continue;const i=t.trim(),s=o.trim();n[e?S.toStyleCc(i):i]=s}}else{const t=o.style;for(let r=0;r<t.length;r++){const o=t[r],i=t.getPropertyValue(o);n[e?S.toStyleCc(o):o]=i}}return n}style(t){return S.style(this,t)}static removeStyle(t,e){return S._preHtmlElems(t,"removeStyle").forEach(t=>{if(Array.isArray(e))for(const r of e)t.style.removeProperty(S.toStyleKc(r));else t.style.removeProperty(S.toStyleKc(e))}),t}removeStyle(t){return S.removeStyle(this,t)}static toggleStyle(t,e,r,o){return S._preHtmlElems(t,"toggleStyle").forEach(t=>{const n=S.getStyle(t,e).trim()===S.toStyleKc(r)?o:r;S.setStyle(t,e,n)}),t}toggleStyle(t,e,r){return S.toggleStyle(this,t,e,r)}static clearStyle(t){return S._preElems(t,"clearStyle").forEach(t=>t.removeAttribute("style")),t}clearStyle(){return S.clearStyle(this)}static focus(t){return S._preHtmlElem(t,"focus").focus(),t}focus(){return S.focus(this)}static blur(t){return S._preHtmlElem(t,"blur").blur(),t}blur(){return S.blur(this)}static boolCheck(t){return void 0!==t&&("true"===t||"1"===t||!0===t||"on"===t||"number"==typeof t&&t>0)}static setWinScrollTop(t){if("number"!=typeof t)throw new TypeError("The value must be a number.");S.setScrollTop(window,t)}static setWinScrollLeft(t){if("number"!=typeof t)throw new TypeError("The value must be a number.");S.setScrollLeft(window,t)}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(t,e,r="content"){const o=S._preElemAndWinAndDoc(t,"getDimension");if("string"!=typeof e)throw new TypeError("The type must be a string.");if("string"!=typeof r)throw new TypeError("The extra must be a string.");const n="width"===e?"Width":"Height";if(S.isWindow(o))return"margin"===r?o["inner"+n]:o.document.documentElement["client"+n];const i=o;if(9===i.nodeType){const t=i.documentElement;return Math.max(i.body["scroll"+n],t["scroll"+n],i.body["offset"+n],t["offset"+n],t["client"+n])}let s=i.getBoundingClientRect()[e];function l(t){return"width"===e?S.cssFloat(i,t+"Left")+S.cssFloat(i,t+"Right"):S.cssFloat(i,t+"Top")+S.cssFloat(i,t+"Bottom")}switch(r){case"content":s-=l("padding"),s-=l("border");break;case"padding":s-=l("border");break;case"border":break;case"margin":s+=l("margin")}return s}getDimension(t,e){return S.getDimension(this,t,e)}static setHeight(t,e){const r=S._preHtmlElem(t,"setHeight");if("number"!=typeof e&&"string"!=typeof e)throw new TypeError("The value must be a string or number.");return r.style.height="number"==typeof e?`${e}px`:e,t}setHeight(t){return S.setHeight(this,t)}static setWidth(t,e){const r=S._preHtmlElem(t,"setWidth");if("number"!=typeof e&&"string"!=typeof e)throw new TypeError("The value must be a string or number.");return r.style.width="number"==typeof e?`${e}px`:e,t}setWidth(t){return S.setWidth(this,t)}static height(t){const e=S._preElemAndWinAndDoc(t,"height");return S.getDimension(e,"height","content")}height(){return S.height(this)}static width(t){const e=S._preElemAndWinAndDoc(t,"width");return S.getDimension(e,"width","content")}width(){return S.width(this)}static innerHeight(t){const e=S._preElemAndWinAndDoc(t,"innerHeight");return S.getDimension(e,"height","padding")}innerHeight(){return S.innerHeight(this)}static innerWidth(t){const e=S._preElemAndWinAndDoc(t,"innerWidth");return S.getDimension(e,"width","padding")}innerWidth(){return S.innerWidth(this)}static outerHeight(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=S._preElemAndWinAndDoc(t,"outerHeight");return S.getDimension(r,"height",e?"margin":"border")}outerHeight(t){return S.outerHeight(this,t)}static outerWidth(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=S._preElemAndWinAndDoc(t,"outerWidth");return S.getDimension(r,"width",e?"margin":"border")}outerWidth(t){return S.outerWidth(this,t)}static animate(t,e,r){return S._preElems(t,"animate").forEach(t=>t.animate(e,r)),t}animate(t,e){return S.animate(this,t,e)}static offset(t){const e=S._preElem(t,"offset").getBoundingClientRect(),r=window.scrollY||document.documentElement.scrollTop,o=window.scrollX||document.documentElement.scrollLeft;return{top:e.top+r,left:e.left+o}}offset(){return S.offset(this)}static position(t){const e=S._preHtmlElem(t,"position");let r,o,n={top:0,left:0};if("fixed"===window.getComputedStyle(e).position)o=e.getBoundingClientRect();else{o=S.offset(e),r=e.offsetParent||document.documentElement;const{position:t}=window.getComputedStyle(r);for(;r instanceof HTMLElement&&(r===document.body||r===document.documentElement)&&"static"===t;)r=r.parentNode;if(r instanceof HTMLElement&&r!==e&&1===r.nodeType){const{borderTopWidth:t,borderLeftWidth:e}=S.cssFloats(r,["borderTopWidth","borderLeftWidth"]);n=S.offset(r),n.top+=t,n.left+=e}}return{top:o.top-n.top-S.cssFloat(e,"marginTop"),left:o.left-n.left-S.cssFloat(e,"marginLeft")}}position(){return S.position(this)}static offsetParent(t){let e=S._preHtmlElem(t,"offsetParent").offsetParent;for(;e instanceof HTMLElement&&"static"===window.getComputedStyle(e).position;)e=e.offsetParent;return e instanceof HTMLElement?e:document.documentElement}offsetParent(){return S.offsetParent(this)}static scrollTop(t){const e=S._preElemAndWindow(t,"scrollTop");return S.isWindow(e)?e.pageYOffset:9===e.nodeType?e.defaultView.pageYOffset:e.scrollTop}scrollTop(){return S.scrollTop(this)}static scrollLeft(t){const e=S._preElemAndWindow(t,"scrollLeft");return S.isWindow(e)?e.pageXOffset:9===e.nodeType?e.defaultView.pageXOffset:e.scrollLeft}scrollLeft(){return S.scrollLeft(this)}static easings={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t*t:(4-2*t)*t-1,easeInCubic:t=>t*t*t,easeOutCubic:t=>--t*t*t+1,easeInOutCubic:t=>t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1};static scrollToXY(t,{targetX:e,targetY:r,duration:o,easing:n,onAnimation:i}={}){if(void 0!==e&&"number"!=typeof e)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!==o&&"number"!=typeof o)throw new TypeError("`duration` must be a number if provided.");if(void 0!==n&&"string"!=typeof n)throw new TypeError("`easing` must be a string if provided.");if(void 0!==n&&"function"!=typeof S.easings[n])throw new TypeError(`Unknown easing function: "${n}".`);if(void 0!==i&&"function"!=typeof i)throw new TypeError("`onAnimation` must be a function if provided.");const s=(t,e,r,o)=>{if(t instanceof Window)window.scrollTo(e,r);else if(9===t.nodeType)t.defaultView.scrollTo(e,r);else{const o=t instanceof Window?window.scrollX:t.scrollLeft,n=t instanceof Window?window.scrollY:t.scrollTop;o!==e&&(t.scrollLeft=e),n!==r&&(t.scrollTop=r)}"function"==typeof i&&i({x:e,y:r,isComplete:o>=1,time:o})};return S._preElemsAndWindow(t,"scrollToXY").forEach(t=>{const i=t instanceof Window?window.scrollX:t.scrollLeft,l=t instanceof Window?window.scrollY:t.scrollTop,a=e??i,c=r??l,d=a-i,m=c-l,p="string"==typeof n&&S.easings[n]||null;if("number"!=typeof o||"function"!=typeof p)return s(t,a,c,1);const u=performance.now(),h=o??0;requestAnimationFrame(function e(r){if("function"!=typeof p)return;const o=Math.min(1,(r-u)/h),n=p(o);s(t,i+d*n,l+m*n,o),o<1&&requestAnimationFrame(e)})}),t}scrollToXY({targetX:t,targetY:e,duration:r,easing:o,onAnimation:n}={}){return S.scrollToXY(this,{targetX:t,targetY:e,duration:r,easing:o,onAnimation:n})}static setScrollTop(t,e){if("number"!=typeof e)throw new TypeError("ScrollTop value must be a number.");return S.scrollToXY(t,{targetY:e})}setScrollTop(t){return S.setScrollTop(this,t)}static setScrollLeft(t,e){if("number"!=typeof e)throw new TypeError("ScrollLeft value must be a number.");return S.scrollToXY(t,{targetX:e})}setScrollLeft(t){return S.setScrollLeft(this,t)}static borderWidth(t){const e=S._preElem(t,"borderWidth"),{borderLeftWidth:r,borderRightWidth:o,borderTopWidth:n,borderBottomWidth:i}=S.cssFloats(e,["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}borderWidth(){return S.borderWidth(this)}static border(t){const e=S._preElem(t,"border"),{borderLeft:r,borderRight:o,borderTop:n,borderBottom:i}=S.cssFloats(e,["borderLeft","borderRight","borderTop","borderBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}border(){return S.border(this)}static margin(t){const e=S._preElem(t,"margin"),{marginLeft:r,marginRight:o,marginTop:n,marginBottom:i}=S.cssFloats(e,["marginLeft","marginRight","marginTop","marginBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}margin(){return S.margin(this)}static padding(t){const e=S._preElem(t,"padding"),{paddingLeft:r,paddingRight:o,paddingTop:n,paddingBottom:i}=S.cssFloats(e,["paddingLeft","paddingRight","paddingTop","paddingBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}padding(){return S.padding(this)}static addClass(t,...e){return S._preElems(t,"addClass").forEach(t=>t.classList.add(...e)),t}addClass(...t){return S.addClass(this,...t)}static removeClass(t,...e){return S._preElems(t,"removeClass").forEach(t=>t.classList.remove(...e)),t}removeClass(...t){return S.removeClass(this,...t)}static replaceClass(t,e,r){if("string"!=typeof e)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 o=[];return S._preElems(t,"replaceClass").forEach(t=>o.push(t.classList.replace(e,r))),o}replaceClass(t,e){return S.replaceClass(this,t,e)[0]}static classItem(t,e){const r=S._preElem(t,"classItem");if("number"!=typeof e)throw new TypeError('The "index" parameter must be a number.');return r.classList.item(e)}classItem(t){return S.classItem(this,t)}static toggleClass(t,e,r){if("string"!=typeof e)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 o=[];return S._preElems(t,"toggleClass").forEach(t=>o.push(t.classList.toggle(e,r))),o}toggleClass(t,e){return S.toggleClass(this,t,e)[0]}static hasClass(t,e){const r=S._preElem(t,"hasClass");if("string"!=typeof e)throw new TypeError('The "token" parameter must be a string.');return r.classList.contains(e)}hasClass(t){return S.hasClass(this,t)}static classLength(t){return S._preElem(t,"classLength").classList.length}classLength(){return S.classLength(this)}static classList(t){return S._preElem(t,"classList").classList.values().toArray()}classList(){return S.classList(this)}static tagName(t){return S._preElem(t,"tagName").tagName}tagName(){return S.tagName(this)}static id(t){return S._preElem(t,"id").id}id(){return S.id(this)}static text(t){return S._preElem(t,"text").textContent}text(){return S.text(this)}static setText(t,e){if("string"!=typeof e)throw new Error("Value is not a valid string.");return S._preElems(t,"setText").forEach(t=>t.textContent=e),t}setText(t){return S.setText(this,t)}static empty(t){return S._preElems(t,"empty").forEach(t=>t.textContent=""),t}empty(){return S.empty(this)}static html(t,e){return S._preElem(t,"html").getHTML(e)}html(t){return S.html(this,t)}static setHtml(t,e){if("string"!=typeof e)throw new Error("Value is not a valid string.");return S._preElems(t,"setHtml").forEach(t=>t.innerHTML=e),t}setHtml(t){return S.setHtml(this,t)}static _valHooks={option:{get:t=>{const e=t.getAttribute("value");return null!=e?e:t.textContent}},select:{get:t=>{const e=t.options,r=t.selectedIndex,o="select-one"===t.type,n=o?r+1:e.length,i=[];let s=r<0?n:o?r:0;for(;s<n;s++){const t=e[s],n=t.parentNode;if((t.selected||s===r)&&!t.disabled&&(!n||!n.disabled||"OPTGROUP"!==n.tagName)){const e=S._valHooks.option.get(t);if(o)return e;i.push(e)}}return i},set:(t,e)=>{const r=t.options,o=Array.isArray(e)?e.map(String):[String(e)];let n=!1;for(let t=0;t<r.length;t++){const e=r[t],i=S._valHooks.option.get(e);"string"==typeof i&&(e.selected=o.includes(i))&&(n=!0)}return n||(t.selectedIndex=-1),o}},radio:{get:t=>t.checked?"on":"off",set(t,e){if("boolean"==typeof e){const r=t.closest("label");return e&&r&&r.querySelectorAll('input[type="radio"]').forEach(e=>{e instanceof HTMLInputElement&&e!==t&&(e.checked=!1)}),t.checked=e,e}}},checkbox:{get:t=>t.checked?"on":"off",set(t,e){if("boolean"==typeof e)return t.checked=e,e}}};static setVal(t,e){return S._preInputElems(t,"setVal").forEach(t=>{if(1!==t.nodeType)return;let r="function"==typeof e?e(t,S.val(t)):e;null==r?r="":"number"==typeof r?r=String(r):Array.isArray(r)&&(r=((t,e)=>{const r=[];for(let o=0;o<t.length;o++)r.push(e(t[o]));return r})(r,t=>null==t?"":String(t)));const o=S._valHooks[t.type]||S._valHooks[t.nodeName.toLowerCase()];if(!o||"function"!=typeof o.set||void 0===o.set(t,r,"value")){if("string"!=typeof r&&"boolean"!=typeof r)throw new Error(`Invalid setValue "${typeof r}" value.`);"string"==typeof r&&(t.value=r)}}),t}setVal(t){return S.setVal(this,t)}static _valTypes={string:t=>t.value,date:t=>t.valueAsDate,number:t=>t.valueAsNumber};static _getValByType(t,e,r){if("string"!=typeof e)throw new TypeError('The "type" must be a string.');if("string"!=typeof r)throw new TypeError('The "where" must be a string.');if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement))throw new Error(`Provided element is not an HTMLInputElement in ${r}().`);if("function"!=typeof S._valTypes[e])throw new Error(`No handler found for type "${e}" in ${r}().`);return S._valTypes[e](t)}static _val(t,e,r){const o=S._preInputElem(t,e),n=S._valHooks[o.type]||S._valHooks[o.nodeName.toLowerCase()];if(n&&"function"==typeof n.get){const t=n.get(o,"value",r);if(void 0!==t)return"string"==typeof t?t.replace(/\r/g,""):t}return S._getValByType(o,r,e)}_val(t,e){return S._val(this,t,e)}static val(t){return S._val(t,"val","string")}val(){return S.val(this)}static valTxt(t){const e=S._val(t,"valTxt","string");if("string"!=typeof e&&null!==e)throw new Error("Value is not a valid string.");return null==e?"":"string"==typeof e?e.replace(/\r/g,""):e}valTxt(){return S.valTxt(this)}static _valArr(t,e,r){const o=S._val(t,e,r);if(!Array.isArray(o))throw new Error(`Value expected an array but got ${typeof o}.`);return o}_valArr(t,e){return S._valArr(this,t,e)}static valArr(t){return S._valArr(t,"valArr","string")}valArr(){return S.valArr(this)}static valNb(t){if(!(S._preInputElem(t,"valNb")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const e=S._val(t,"valNb","number");if(Number.isNaN(e))throw new Error("Value is not a valid number.");return e}valNb(){return S.valNb(this)}static valDate(t){if(!(S._preInputElem(t,"valDate")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const e=S._val(t,"valDate","date");if(!(e instanceof Date))throw new Error("Value is not a valid date.");return e}valDate(){return S.valDate(this)}static valBool(t){const e=S._preInputElem(t,"valBool");if(!(e instanceof HTMLInputElement))throw new Error("Element must be an input element.");return"on"===S.val(e)}valBool(){return S.valBool(this)}static listenForPaste(t,{onFilePaste:e,onTextPaste:r}={}){if(void 0!==e&&"function"!=typeof e)throw new TypeError("onFilePaste must be a function.");if(void 0!==r&&"function"!=typeof r)throw new TypeError("onTextPaste must be a function.");const o=t=>{if(!(t instanceof ClipboardEvent))return;const o=t.clipboardData?.items||[];for(const t of o)if("file"===t.kind){if("function"==typeof e){const r=t.getAsFile();r&&e(t,r)}}else"string"===t.kind&&"function"==typeof r&&t.getAsString(e=>r(t,e))};return S._preElemsWithDoc(t,"listenForPaste").forEach(t=>S.on(t,"paste",o)),o}listenForPaste({onFilePaste:t,onTextPaste:e}={}){return S.listenForPaste(this,{onFilePaste:t,onTextPaste:e})}static hasEventListener(t,e){const r=S._preEventTargetElem(t,"hasEventListener");if(!L.has(r))return!1;const o=L.get(r);return!!(o&&Array.isArray(o[e])&&o[e].length>0)}hasEventListener(t){return S.hasEventListener(this,t)}static hasExactEventListener(t,e,r){const o=S._preEventTargetElem(t,"hasExactEventListener");if("function"!=typeof r)throw new TypeError('The "handler" must be a function.');if(!L.has(o))return!1;const n=L.get(o);return!(!n||!Array.isArray(n[e]))&&n[e].some(t=>t.handler===r)}hasExactEventListener(t,e){return S.hasExactEventListener(this,t,e)}static on(t,e,r,o){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"on").forEach(t=>{t.addEventListener(e,r,o),L.has(t)||L.set(t,{});const n=L.get(t);n&&(Array.isArray(n[e])||(n[e]=[]),n[e].push({handler:r,options:o}))}),t}on(t,e,r){return S.on(this,t,e,r)}static once(t,e,r,o={}){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"once").forEach(t=>{const n=o=>{S.off(t,e,n),"function"==typeof r&&r(o)};S.on(t,e,n,"boolean"==typeof o?o:{...o,once:!0})}),t}once(t,e,r={}){return S.once(this,t,e,r)}static off(t,e,r,o){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"off").forEach(t=>{t.removeEventListener(e,r,o);const n=L.get(t);n&&n[e]&&(n[e]=n[e].filter(t=>t.handler!==r),0===n[e].length&&delete n[e])}),t}off(t,e,r){return S.off(this,t,e,r)}static offAll(t,e){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"offAll").forEach(t=>{const r=L.get(t);if(r&&r[e]){for(const o of r[e])t.removeEventListener(e,o.handler,o.options);delete r[e]}}),t}offAll(t){return S.offAll(this,t)}static offAllTypes(t,e=null){if(null!==e&&"function"!=typeof e)throw new TypeError('The "filterFn" must be a function.');return S._preEventTargetElems(t,"offAllTypes").forEach(t=>{const r=L.get(t);if(r){for(const o in r)for(const n of r[o])("function"!=typeof e||e(n.handler,o))&&t.removeEventListener(o,n.handler,n.options);L.delete(t)}}),t}offAllTypes(t=null){return S.offAllTypes(this,t)}static trigger(t,e,r={}){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"trigger").forEach(t=>{const o=r instanceof Event||r instanceof CustomEvent?r:new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t.dispatchEvent(o)}),t}trigger(t,e={}){return S.trigger(this,t,e)}static#r={for:"htmlFor",class:"className"};static propFix=new Proxy(S.#r,{set:(t,e,r)=>(t[e]=r,S.attrFix[r]=e,!0)});static attrFix=Object.fromEntries(Object.entries(S.#r).map(([t,e])=>[e,t]));static getPropName(t){return"string"==typeof S.propFix[t]?S.propFix[t]:t}static getAttrName(t){return"string"==typeof S.attrFix[t]?S.attrFix[t]:t}static attr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElem(t,"attr").getAttribute(S.getAttrName(e))}attr(t){return S.attr(this,t)}static setAttr(t,e,r=null){if("string"!=typeof e)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 S._preElems(t,"setAttr").forEach(t=>{null===r?t.removeAttribute(S.getAttrName(e)):t.setAttribute(S.getAttrName(e),r)}),t}setAttr(t,e){return S.setAttr(this,t,e)}static removeAttr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElems(t,"removeAttr").forEach(t=>t.removeAttribute(S.getAttrName(e))),t}removeAttr(t){return S.removeAttr(this,t)}static hasAttr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElem(t,"hasAttr").hasAttribute(S.getAttrName(e))}hasAttr(t){return S.hasAttr(this,t)}static hasProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return!!S._preElem(t,"hasProp")[S.getPropName(e)]}hasProp(t){return S.hasProp(this,t)}static addProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElems(t,"addProp").forEach(t=>{t[S.getPropName(e)]=!0}),t}addProp(t){return S.addProp(this,t)}static removeProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElems(t,"removeProp").forEach(t=>{t[S.getPropName(e)]=!1}),t}removeProp(t){return S.removeProp(this,t)}static toggleProp(t,e,r){if("string"!=typeof e)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.');S._preElems(t,"toggleProp").forEach(t=>{(void 0===r?!t[S.getPropName(e)]:r)?S.addProp(t,e):S.removeProp(t,e)})}toggleProp(t,e){return S.toggleProp(this,t,e)}static remove(t){return S._preElems(t,"remove").forEach(t=>t.remove()),t}remove(){return S.remove(this)}static index(t,e=null){const r=S._preElem(t,"index");if(!r)return-1;if(!e)return Array.prototype.indexOf.call(r.parentNode?.children||[],r);if(e){const t="string"==typeof e?document.querySelectorAll(e):S._preElems(e,"index");return Array.prototype.indexOf.call(t,r)}return-1}index(t){return S.index(this,t)}static _getCustomRect(t,e){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 e in t)"number"==typeof t[e]&&(r[e]=t[e]);if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("extraRect must be a non-null object.");const{height:o=0,width:n=0,top:i=0,bottom:s=0,left:l=0,right:a=0}=e;if("number"!=typeof o)throw new Error("extraRect.height must be a number.");if("number"!=typeof n)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 l)throw new Error("extraRect.left must be a number.");if("number"!=typeof a)throw new Error("extraRect.right must be a number.");return r.height+=o,r.width+=n,r.top+=i,r.bottom+=s,r.left+=l,r.right+=a,r}static isCollWith(t,e,r={}){const o=S._getCustomRect(S._preElem(t,"isCollWith").getBoundingClientRect(),r),n=S._preElem(e,"isCollWith").getBoundingClientRect();return v(o,n)}isCollWith(t,e){return S.isCollWith(this,t,e)}static isCollPerfWith(t,e,r={}){const o=S._getCustomRect(S._preElem(t,"isCollPerfWith").getBoundingClientRect(),r),n=S._preElem(e,"isCollPerfWith").getBoundingClientRect();return T(o,n)}isCollPerfWith(t,e){return S.isCollPerfWith(this,t,e)}static _isCollWithLock(t,e,r,o,n){const i=k[n];if(t)return i.has(o)||i.set(o,!0),!0;if(i.has(o)){let t=!1;switch(n){case"top":t=C(e,r);break;case"bottom":t=x(e,r);break;case"left":t=_(e,r);break;case"right":t=D(e,r)}return t&&i.delete(o),i.has(o)}return!1}static isCollWithLock(t,e,r,o={}){const n=S._preElem(t,"isCollWithLock"),i=S._preElem(e,"isCollWithLock"),s=S._getCustomRect(n.getBoundingClientRect(),o),l=i.getBoundingClientRect(),a=v(s,l);return S._isCollWithLock(a,s,l,n,r)}isCollWithLock(t,e,r){return S.isCollWithLock(this,t,e,r)}static isCollPerfWithLock(t,e,r,o={}){const n=S._preElem(t,"isCollPerfWithLock"),i=S._preElem(e,"isCollPerfWithLock"),s=S._getCustomRect(n.getBoundingClientRect(),o),l=i.getBoundingClientRect(),a=T(s,l);return S._isCollWithLock(a,s,l,n,r)}isCollPerfWithLock(t,e,r){return S.isCollPerfWithLock(this,t,e,r)}static resetCollLock(t){const e=S._preElem(t,"resetCollLock");let r=!1;for(const t of["top","bottom","left","right"])k[t].has(e)&&(k[t].delete(e),r=!0);return r}resetCollLock(){return S.resetCollLock(this)}static resetCollLockDir(t,e){const r=S._preElem(t,"resetCollLockDir"),o=k[e];return!!o.has(r)&&(o.delete(r),!0)}resetCollLockDir(t){return S.resetCollLockDir(this,t)}static isInViewport(t){const e=S._preElem(t,"isInViewport");if(!e.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=S.offset(e).top,o=r+S.outerHeight(e),n=S.scrollTop(window),i=n+S.height(window);return o>n&&r<i}isInViewport(){return S.isInViewport(this)}static isScrolledIntoView(t){const e=S._preElem(t,"isScrolledIntoView");if(!e.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=S.scrollTop(window),o=r+S.height(window),n=S.offset(e).top;return n+S.height(e)<=o&&n>=r}isScrolledIntoView(){return S.isScrolledIntoView(this)}static isInContainer(t,e){const r=S._preElem(t,"isInContainer"),o=S._preElem(e,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),s=n.bottom>i.top&&n.top<i.bottom,l=n.right>i.left&&n.left<i.right;return s&&l}isInContainer(t){return S.isInContainer(this,t)}static isFullyInContainer(t,e){const r=S._preElem(t,"isScrolledIntoView"),o=S._preElem(e,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const n=r.getBoundingClientRect(),i=o.getBoundingClientRect();return n.top>=i.top&&n.bottom<=i.bottom&&n.left>=i.left&&n.right<=i.right}isFullyInContainer(t){return S.isFullyInContainer(this,t)}static hasScroll(t){const e=S._preElem(t,"hasScroll");return{v:e.scrollHeight>e.clientHeight,h:e.scrollWidth>e.clientWidth}}hasScroll(){return S.hasScroll(this)}}const P=S;function B(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"===Object.prototype.toString.call(t)}class M{static Utils={...r,TinyHtml:P};#o=!0;#n=!1;#i=0;#s=0;#l=!0;#a=!1;#c=!1;#d=!1;#m=!1;#p=!1;#u=!1;#h=null;#g=[];#f=null;#y={start:!1,end:!1,collide:!1,move:!1};#b=null;#E;#w="drag-hidden";#v="dragging";#T="drag-active";#C="jail-drag-active";#x="jail-drag-disabled";#_="dragging-collision";#D=9999;constructor(t,e={}){const r=t instanceof P?t.get(0):t;if(!(r instanceof HTMLElement))throw new Error("TinyDragger requires a valid target HTMLElement to initialize.");if(this.#E=r,void 0!==e.jail&&!(e.jail instanceof HTMLElement))throw new Error('The "jail" option must be an HTMLElement if provided.');if(void 0!==e.defaultZIndex&&this.setDefaultZIndex(e.defaultZIndex),void 0!==e.vibration&&!1!==e.vibration&&!B(e.vibration))throw new Error('The "vibration" option must be an object or false.');const o=(t,e)=>{if(void 0!==t&&"boolean"!=typeof t)throw new Error(`The "${e}" option must be a boolean.`)},n=(t,e)=>{if(void 0!==t&&"string"!=typeof t)throw new Error(`The "${e}" option must be a string.`)};o(e.mirrorElem,"mirrorElem"),o(e.collisionByMouse,"collisionByMouse"),o(e.lockInsideJail,"lockInsideJail"),o(e.dropInJailOnly,"dropInJailOnly"),o(e.revertOnDrop,"revertOnDrop"),o(e.multiCollision,"multiCollision"),n(e.classDragging,"classDragging"),n(e.classBodyDragging,"classBodyDragging"),n(e.classJailDragging,"classJailDragging"),n(e.classJailDragDisabled,"classJailDragDisabled"),n(e.classDragCollision,"classDragCollision"),n(e.classHidden,"classHidden"),e.jail instanceof HTMLElement&&(this.#b=e.jail),this.#y=Object.assign({start:!1,end:!1,collide:!1,move:!1},B(e.vibration)?e.vibration:{}),"string"==typeof e.classDragging&&(this.#v=e.classDragging),"string"==typeof e.classBodyDragging&&(this.#T=e.classBodyDragging),"string"==typeof e.classJailDragging&&(this.#C=e.classJailDragging),"string"==typeof e.classJailDragDisabled&&(this.#x=e.classJailDragDisabled),"string"==typeof e.classHidden&&(this.#w=e.classHidden),"string"==typeof e.classDragCollision&&(this.#_=e.classDragCollision),"boolean"==typeof e.collisionByMouse&&(this.#p=e.collisionByMouse),"boolean"==typeof e.mirrorElem&&(this.#l=e.mirrorElem),"boolean"==typeof e.revertOnDrop&&(this.#d=e.revertOnDrop),"boolean"==typeof e.lockInsideJail&&(this.#c=e.lockInsideJail),"boolean"==typeof e.dropInJailOnly&&(this.#u=e.dropInJailOnly),"boolean"==typeof e.multiCollision&&(this.#a=e.multiCollision),this._onMouseDown=this.#L.bind(this),this._onMouseMove=this.#A.bind(this),this._onMouseUp=this.#k.bind(this),this._onTouchStart=t=>this.#L(t.touches[0]),this._onTouchMove=t=>this.#A(t.touches[0]),this._onTouchEnd=t=>this.#k(t.changedTouches[0]),this.#E.addEventListener("mousedown",this._onMouseDown),this.#E.addEventListener("touchstart",this._onTouchStart,{passive:!1})}enable(){this.#S(),this.#b&&this.#b.classList.add(this.#x),this.#o=!0}disable(){this.#b&&this.#b.classList.remove(this.#x),this.#o=!1}addCollidable(t){if(this.#S(),!(t instanceof HTMLElement))throw new Error("addCollidable expects an HTMLElement as argument.");this.#g.includes(t)||this.#g.push(t)}removeCollidable(t){if(this.#S(),!(t instanceof HTMLElement))throw new Error("removeCollidable expects an HTMLElement as argument.");this.#g=this.#g.filter(e=>e!==t)}setVibrationPattern({startPattern:t=!1,endPattern:e=!1,collidePattern:r=!1,movePattern:o=!1}={}){this.#S();const n=t=>!1===t||Array.isArray(t)&&t.every(t=>"number"==typeof t);if(!n(t))throw new Error('Invalid "startPattern": must be false or an array of numbers.');if(!n(e))throw new Error('Invalid "endPattern": must be false or an array of numbers.');if(!n(r))throw new Error('Invalid "collidePattern": must be false or an array of numbers.');if(!n(o))throw new Error('Invalid "movePattern": must be false or an array of numbers.');this.#y={start:t,end:e,collide:r,move:o}}disableVibration(){this.#S(),this.#y={start:!1,end:!1,collide:!1,move:!1}}getOffset(t){if(this.#S(),!(t instanceof MouseEvent||t instanceof Touch)||"number"!=typeof t.clientX||"number"!=typeof t.clientY)throw new Error("getOffset expects an event with valid clientX and clientY coordinates.");const e=this.#E.getBoundingClientRect(),{left:r,top:o}=P.borderWidth(this.#E);return{x:t.clientX-e.left+r,y:t.clientY-e.top+o}}#L(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#n||!this.#o||!this.#E.parentElement)return;if(this.#l){const t=this.#E.cloneNode(!0);if(!(t instanceof HTMLElement))throw new Error("[TinyDragger] INVALID DRAG ELEMENT!");this.#f=t}else this.#f=this.#E;this.#m=!0;const e=this.#E.getBoundingClientRect();Object.assign(this.#f.style,{position:"absolute",pointerEvents:"none",left:`${this.#E.offsetLeft}px`,top:`${this.#E.offsetTop}px`,width:`${e.width}px`,height:`${e.height}px`,zIndex:this.#D}),this.#l&&(this.#E.classList.add(this.#w),this.#E.parentElement.appendChild(this.#f));const{x:r,y:o}=this.getOffset(t);this.#s=r,this.#i=o,this.#f.classList.add(this.#v),document.body.classList.add(this.#T),this.#b&&this.#b.classList.add(this.#C),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.#y.start)&&navigator.vibrate(this.#y.start),this.checkDragCollision(t),this.#P("drag")}#B=[];#M(t){t&&(t.classList.add(this.#_),this.#B.push(t))}#W(){for(;this.#B.length>0;){const t=this.#B.shift();t&&t.classList.remove(this.#_)}this.#h&&this.#h.classList.remove(this.#_)}checkDragCollision(t){const{collidedElements:e}=this.execCollision(t),r=e[0]||null;this.#h&&!e.includes(this.#h)&&this.#W(),e.forEach(t=>this.#M(t)),this.#g.forEach(t=>{e.includes(t)||t.classList.remove(this.#_)}),navigator.vibrate&&Array.isArray(this.#y.collide)&&e.length>0&&navigator.vibrate(this.#y.collide),this.#h=r}#A(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#n||!this.#m||!this.#o||!this.#f)return;const e=(this.#f.offsetParent||document.body).getBoundingClientRect();let r=t.clientX-e.left-this.#s,o=t.clientY-e.top-this.#i;if(this.#c&&this.#b){const t=this.#b.getBoundingClientRect(),n=this.#f.getBoundingClientRect(),i=t.left-e.left,s=t.top-e.top,{x:l,y:a}=P.borderWidth(this.#b),c=i+t.width-n.width-a,d=s+t.height-n.height-l;r=Math.max(i,Math.min(r,c)),o=Math.max(s,Math.min(o,d))}this.#f.style.position="absolute",this.#f.style.left=`${r}px`,this.#f.style.top=`${o}px`,navigator.vibrate&&Array.isArray(this.#y.move)&&navigator.vibrate(this.#y.move),this.checkDragCollision(t),this.#P("dragging")}execCollision(t){if(this.#n||!this.#f)return{inJail:!1,collidedElements:[]};let e=[],r=!0;const o=this.#b?.getBoundingClientRect();if(this.#p){const n=t.clientX,i=t.clientY;this.#u&&this.#b&&o&&(r=n>=o.left&&n<=o.right&&i>=o.top&&i<=o.bottom),e=r?this.#a?this.getAllCollidedElements(n,i):[this.getCollidedElement(n,i)].filter(Boolean):[]}else{const t=this.#f.getBoundingClientRect();this.#u&&this.#b&&o&&(r=t.left>=o.left&&t.right<=o.right&&t.top>=o.top&&t.bottom<=o.bottom),e=r?this.#a?this.getAllCollidedElementsByRect(t):[this.getCollidedElementByRect(t)].filter(Boolean):[]}return{inJail:r,collidedElements:e}}#k(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#n||!this.#m)return;if(this.#m=!1,!this.#f)return;this.#E.classList.remove(this.#v),document.body.classList.remove(this.#T),this.#b&&this.#b.classList.remove(this.#C),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd);const{collidedElements:e}=this.execCollision(t);navigator.vibrate&&Array.isArray(this.#y.end)&&navigator.vibrate(this.#y.end);const r=this.#f.style.left,o=this.#f.style.top;this.#f&&(this.#l?this.#f.remove():Object.assign(this.#f.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#f=null),this.#h&&this.#W(),this.#h=null,this.#l&&this.#E.classList.remove(this.#w),this.#d||(this.#E.style.left=r,this.#E.style.top=o);const n=new CustomEvent("drop",{detail:{targets:e,first:e[0]||null}});this.#E.dispatchEvent(n)}#N(t,e){const r=t.getBoundingClientRect();return!(e.right<r.left||e.left>r.right||e.bottom<r.top||e.top>r.bottom)}getAllCollidedElementsByRect(t){if(this.#S(),!(t instanceof DOMRect)||"number"!=typeof t.left||"number"!=typeof t.right||"number"!=typeof t.top||"number"!=typeof t.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#g.filter(e=>this.#N(e,t))}getCollidedElementByRect(t){if(this.#S(),!(t instanceof DOMRect)||"number"!=typeof t.left||"number"!=typeof t.right||"number"!=typeof t.top||"number"!=typeof t.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#g.find(e=>this.#N(e,t))||null}#H(t,e,r){const o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&r>=o.top&&r<=o.bottom}getAllCollidedElements(t,e){if(this.#S(),"number"!=typeof t||"number"!=typeof e)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#g.filter(r=>this.#H(r,t,e))}getCollidedElement(t,e){if(this.#S(),"number"!=typeof t||"number"!=typeof e)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#g.find(r=>this.#H(r,t,e))||null}#P(t){const e=new CustomEvent(t);this.#E.dispatchEvent(e)}getDragging(){return this.#m}getLockInsideJail(){return this.#c}setLockInsideJail(t){if("boolean"!=typeof t)throw new Error("lockInsideJail must be a boolean.");this.#c=t}getRevertOnDrop(){return this.#d}setRevertOnDrop(t){if("boolean"!=typeof t)throw new Error("revertOnDrop must be a boolean.");this.#d=t}getCollisionByMouse(){return this.#p}setCollisionByMouse(t){if("boolean"!=typeof t)throw new Error("collisionByMouse must be a boolean.");this.#p=t}getDropInJailOnly(){return this.#u}setDropInJailOnly(t){if("boolean"!=typeof t)throw new Error("dropInJailOnly must be a boolean.");this.#u=t}getDefaultZIndex(){return this.#D}setDefaultZIndex(t){if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("Z-index must be a finite number.");this.#D=t}isMirrorEnabled(){return this.#l}setMirrorEnabled(t){if("boolean"!=typeof t)throw new TypeError("Mirror setting must be a boolean.");this.#l=t}getTarget(){return this.#E}getJail(){return this.#b}getDragProxy(){return this.#f}getLastCollision(){return this.#h}getCollidables(){return[...this.#g]}getDragHiddenClass(){return this.#w}getClassDragging(){return this.#v}getClassBodyDragging(){return this.#T}getClassJailDragging(){return this.#C}getClassJailDragDisabled(){return this.#x}getClassDragCollision(){return this.#_}getVibrations(){return{...this.#y}}getStartVibration(){return this.#y.start}getEndVibration(){return this.#y.end}getCollideVibration(){return this.#y.collide}getMoveVibration(){return this.#y.move}isEnabled(){return this.#o}#S(){if(this.#n)throw new Error("This TinyDragger instance has been destroyed and can no longer be used.")}destroy(){this.#n||(this.disable(),this.#E.removeEventListener("mousedown",this._onMouseDown),this.#E.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.#h&&this.#W(),this.#f&&(this.#l?this.#f.remove():Object.assign(this.#f.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#f=null),this.#g=[],this.#m=!1,this.#h=null,this.#l&&this.#E.classList.remove(this.#w),this.#E.classList.remove(this.#v),document.body.classList.remove(this.#T),this.#b&&this.#b.classList.remove(this.#C,this.#x),this.#n=!0)}}const W=M;window.TinyDragger=e.TinyDragger})();
|
|
1
|
+
(()=>{"use strict";var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.d(e,{TinyDragger:()=>N});var r={};t.r(r),t.d(r,{areElsCollBottom:()=>n,areElsCollLeft:()=>i,areElsCollPerfBottom:()=>a,areElsCollPerfLeft:()=>c,areElsCollPerfRight:()=>d,areElsCollPerfTop:()=>l,areElsCollRight:()=>s,areElsCollTop:()=>o,areElsColliding:()=>m,areElsPerfColliding:()=>u,getElsCollDetails:()=>w,getElsCollDirDepth:()=>E,getElsCollOverlap:()=>g,getElsCollOverlapPos:()=>f,getElsColliding:()=>h,getElsPerfColliding:()=>p,getElsRelativeCenterOffset:()=>b,getRectCenter:()=>y});const o=(t,e)=>t.bottom<e.top,n=(t,e)=>t.top>e.bottom,i=(t,e)=>t.right<e.left,s=(t,e)=>t.left>e.right,l=(t,e)=>t.bottom<=e.top,a=(t,e)=>t.top>=e.bottom,c=(t,e)=>t.right<=e.left,d=(t,e)=>t.left>=e.right,m=(t,e)=>!(i(t,e)||s(t,e)||o(t,e)||n(t,e)),u=(t,e)=>!(c(t,e)||d(t,e)||l(t,e)||a(t,e)),h=(t,e)=>i(t,e)?"left":s(t,e)?"right":o(t,e)?"top":n(t,e)?"bottom":null,p=(t,e)=>c(t,e)?"left":d(t,e)?"right":l(t,e)?"top":a(t,e)?"bottom":null,g=(t,e)=>({overlapLeft:e.right-t.left,overlapRight:t.right-e.left,overlapTop:e.bottom-t.top,overlapBottom:t.bottom-e.top}),f=({overlapLeft:t=-1,overlapRight:e=-1,overlapTop:r=-1,overlapBottom:o=-1}={})=>({dirX:t<e?"right":"left",dirY:r<o?"bottom":"top"}),y=t=>({x:t.left+t.width/2,y:t.top+t.height/2});function b(t,e){const r=t.left+t.width/2,o=t.top+t.height/2;return{x:e.left+e.width/2-r,y:e.top+e.height/2-o}}function E(t,e){if(!u(t,e))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:o,overlapTop:n,overlapBottom:i}=g(t,e),{dirX:s,dirY:l}=f({overlapLeft:r,overlapRight:o,overlapTop:n,overlapBottom:i}),a=Math.min(r,o),c=Math.min(n,i);let d;return d=a<c?s:l,{inDir:d,dirX:s,dirY:l,depthX:a,depthY:c}}function w(t,e){const r=u(t,e),o={in:null,x:null,y:null},n={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:s,overlapRight:l,overlapTop:a,overlapBottom:c}=g(e,t);i.top=a,i.bottom=c,i.left=s,i.right=l;const d=Object.entries(i).filter(([,t])=>t>0).sort((t,e)=>t[1]-e[1]),{dirX:m,dirY:h}=f({overlapLeft:l,overlapRight:s,overlapTop:c,overlapBottom:a});return o.y=h,o.x=m,i.bottom<0?n.y="bottom":i.top<0&&(n.y="top"),i.left<0?n.x="left":i.right<0&&(n.x="right"),o.in=r?i.top===i.bottom&&i.bottom===i.left&&i.left===i.right?"center":d.length?d[0][0]:"top":null,{dirs:o,depth:i,isNeg:n}}const{areElsColliding:v,areElsPerfColliding:T,areElsCollTop:C,areElsCollBottom:x,areElsCollLeft:_,areElsCollRight:D}=r,A=new WeakMap,L=new WeakMap,k={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class S{static Utils={...r};static async fetchHtmlFile(t,e={method:"GET"}){const r=await fetch(t,e),o=r.headers.get("Content-Type")||"";if(!r.ok)throw new Error(`Failed to fetch: ${r.status} ${r.statusText}`);if(!o.includes("text/html"))throw new Error(`Invalid content type: ${o} (expected text/html)`);const n=await r.text();return S.htmlToJson(n)}static async fetchHtmlNodes(t,e){const r=await S.fetchHtmlFile(t,e);return S.jsonToNodes(r)}static async fetchHtmlTinyElems(t,e){const r=await S.fetchHtmlNodes(t,e);return S.toTinyElm(r)}static templateToJson(t){return S.htmlToJson([...t.content.childNodes].map(t=>t instanceof Element?t.getHTML():t instanceof Text?t.textContent:"").join(""))}static templateToNodes(t){const e=[];return[...t.content.cloneNode(!0).childNodes].map(t=>{if(!(t instanceof Element||t instanceof Text||t instanceof Comment))throw new Error(`Expected only Element nodes in <template>, but found: ${t.constructor.name}`);t instanceof Comment||e.push(t)}),e}static templateToTinyElems(t){return S.toTinyElm(S.templateToNodes(t))}static htmlToJson(t){const e=document.createElement("div");e.innerHTML=t.trim();const r=[],o=t=>{if(t instanceof Comment)return null;if(t instanceof Text){const e=t.textContent?.trim();return e||null}if(!(t instanceof Element))return null;const e=t.tagName.toLowerCase(),r={};for(const e of t.attributes)r[S.getPropName(e.name)]=e.value;const n=Array.from(t.childNodes).map(o).filter(Boolean);return n.length>0?[e,r,...n]:[e,r]};for(const t of e.childNodes){const e=o(t);e&&r.push(e)}return e.innerHTML="",r}static jsonToNodes(t){const e=t=>{if("string"==typeof t)return document.createTextNode(t);if(!Array.isArray(t))return document.createTextNode("");const[r,o,...n]=t,i=document.createElement(r);for(const[t,e]of Object.entries(o))i.setAttribute(S.getAttrName(t),e);for(const t of n){const r=e(t);r instanceof Comment||i.appendChild(r)}return i};return t.map(e).filter(t=>!(t instanceof Comment))}static jsonToTinyElems(t){return S.toTinyElm(S.jsonToNodes(t))}static createFrom(t,e){if("string"!=typeof t)throw new TypeError('The "tagName" must be a string.');if(void 0!==e&&"object"!=typeof e)throw new TypeError('The "attrs" must be a object.');const r=S.createElement(t);if("object"==typeof e)for(const t in e)r.setAttr(t,e[t]);return r}static createElement(t,e){if("string"!=typeof t)throw new TypeError("[TinyHtml] createElement(): The tagName must be a string.");if(void 0!==e&&"object"!=typeof e)throw new TypeError("[TinyHtml] createElement(): The ops must be a object.");return new S(document.createElement(t,e))}static createTextNode(t){if("string"!=typeof t)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new S(document.createTextNode(t))}static createElementFromHTML(t){const e=document.createElement("template");if(!(t=t.trim()).startsWith("<"))return S.createTextNode(t);if(e.innerHTML=t,!(e.content.firstChild instanceof Element))throw new Error("The HTML string must contain a valid HTML element.");return new S(e.content.firstChild)}static query(t,e=document){const r=e.querySelector(t);return r?new S(r):null}querySelector(t){return S.query(t,S._preElem(this,"query"))}static queryAll(t,e=document){return new S(e.querySelectorAll(t))}querySelectorAll(t){return S.queryAll(t,S._preElem(this,"queryAll"))}static getById(t){const e=document.getElementById(t);return e?new S(e):null}static getByClassName(t,e=document){return new S(e.getElementsByClassName(t))}getElementsByClassName(t){return S.getByClassName(t,S._preElem(this,"getByClassName"))}static getByName(t){return new S(document.getElementsByName(t))}static getByTagNameNS(t,e="http://www.w3.org/1999/xhtml",r=document){return new S(r.getElementsByTagNameNS(e,t))}getElementsByTagNameNS(t,e="http://www.w3.org/1999/xhtml"){return S.getByTagNameNS(t,e,S._preElem(this,"getByTagNameNS"))}forEach(t){const e=this.getAll().map((t,e)=>this.extract(e));for(const r in e)t(e[r],Number(r),e);return this}get(t){if("number"!=typeof t)throw new TypeError("The index must be a number.");if(!this.#t[t])throw new Error(`No element found at index ${t}.`);return this.#t[t]}extract(t){if("number"!=typeof t)throw new TypeError("The index must be a number.");if(!this.#t[t])throw new Error(`Cannot extract: no element exists at index ${t}.`);return new S(this.#t[t])}exists(t){if("number"!=typeof t)throw new TypeError("The index must be a number.");return!!this.#t[t]}getAll(){return[...this.#t]}_getElement(t,e){if(!(this.#t[e]instanceof Element||this.#t[e]instanceof Window||this.#t[e]instanceof Document||this.#t[e]instanceof Text))throw new Error(`[TinyHtml] Invalid Element in ${t}().`);return this.#t[e]}_getElements(t){if(!this.#t.every(t=>t instanceof Element||t instanceof Window||t instanceof Document||t instanceof Text))throw new Error(`[TinyHtml] Invalid Element in ${t}().`);return[...this.#t]}static _preElemsTemplate(t,e,r,o){const n=t=>{const n=[];return t.map(t=>(t instanceof S?t._getElements(e):[t]).map(t=>{let i=!1;for(const e of r)if(t instanceof e){i=!0;break}if(!i)throw new Error(`[TinyHtml] Invalid element of the list "${o.join(",")}" in ${e}().`);return n.push(t),t})),n};return Array.isArray(t)?n(t):n([t])}static _preElemTemplate(t,e,r,o,n=!1){const i=t=>{const i=t[0],s=i instanceof S?i._getElements(e):[i];if(s.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${e}() (Received ${s.length}/1).`);let l=!1;for(const t of r)if(s[0]instanceof t){l=!0;break}if(!n||null!==s[0]&&void 0!==s[0]||(s[0]=null,l=!0),!l)throw new Error(`[TinyHtml] Invalid element of the list "${o.join(",")}" in ${e}().`);return s[0]};if(!Array.isArray(t))return i([t]);if(t.length>1)throw new Error(`[TinyHtml] Invalid element amount in ${e}() (Received ${t.length}/1).`);return i(t)}static _preElems(t,e){return S._preElemsTemplate(t,e,[Element],["Element"])}static _preElem(t,e){return S._preElemTemplate(t,e,[Element],["Element"])}static _preNodeElems(t,e){return S._preElemsTemplate(t,e,[Node],["Node"])}static _preNodeElem(t,e){return S._preElemTemplate(t,e,[Node],["Node"])}static _preNodeElemWithNull(t,e){return S._preElemTemplate(t,e,[Node],["Node"],!0)}static _preHtmlElems(t,e){return S._preElemsTemplate(t,e,[HTMLElement],["HTMLElement"])}static _preHtmlElem(t,e){return S._preElemTemplate(t,e,[HTMLElement],["HTMLElement"])}static _preInputElems(t,e){return S._preElemsTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preInputElem(t,e){return S._preElemTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}static _preEventTargetElems(t,e){return S._preElemsTemplate(t,e,[EventTarget],["EventTarget"])}static _preEventTargetElem(t,e){return S._preElemTemplate(t,e,[EventTarget],["EventTarget"])}static _preElemsAndWindow(t,e){return S._preElemsTemplate(t,e,[Element,Window],["Element","Window"])}static _preElemAndWindow(t,e){return S._preElemTemplate(t,e,[Element,Window],["Element","Window"])}static _preElemsAndWinAndDoc(t,e){return S._preElemsTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]).map(t=>t instanceof Document?t.documentElement:t)}static _preElemAndWinAndDoc(t,e){const r=S._preElemTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}static _preElemsWithDoc(t,e){return S._preElemsTemplate(t,e,[Element,Document],["Element","Document"])}static _preElemWithDoc(t,e){return S._preElemTemplate(t,e,[Element,Document],["Element","Document"])}static toTinyElm(t){const e=t=>t.map(t=>t instanceof S?t:new S(t));return Array.isArray(t)?e(t):e([t])}static fromTinyElm(t){const e=t=>{const e=[];return t.map(t=>(t instanceof S?t._getElements("fromTinyElm"):[t]).map(t=>e.push(t))),e};return Array.isArray(t)?e(t):e([t])}static winnow(t,e,r,o=!1){if("boolean"!=typeof o)throw new TypeError('The "not" must be a boolean.');if("function"==typeof e)return S._preElems(t,r).filter((t,r)=>!!e.call(t,r,t)!==o);if(e instanceof Element)return S._preElems(t,r).filter(t=>t===e!==o);if(Array.isArray(e)||"string"!=typeof e&&null!=e.length)return S._preElems(t,r).filter(t=>e.includes(t)!==o);let n=e;return o&&(n=`:not(${n})`),S._preElems(t,r).filter(t=>1===t.nodeType&&t.matches(n))}static filter(t,e,r=!1){return r&&(e=`:not(${e})`),S._preElems(t,"filter").filter(t=>1===t.nodeType&&t.matches(e))}static filterOnly(t,e){return S.winnow(t,e,"filterOnly",!1)}static not(t,e){return S.winnow(t,e,"not",!0)}not(t){return S.not(this,t)}static find(t,e){const r=[];for(const o of S._preElems(t,"find"))r.push(...o.querySelectorAll(e));return[...new Set(r)]}find(t){return S.find(this,t)}static is(t,e){return S.winnow(t,e,"is",!1).length>0}is(t){return S.is(this,t)}static has(t,e){const r="string"==typeof e?[...document.querySelectorAll(e)]:S._preElems(e,"has");return S._preElems(t,"has").filter(t=>r.some(e=>t&&t.contains(e)))}has(t){return S.has(this,t).length>0}static closest(t,e,r){const o=[];for(const n of S._preElems(t,"closest")){let t=n;for(;t&&t!==r;){if(1===t.nodeType&&("string"==typeof e?t.matches(e):t===e)){o.push(t);break}t=t.parentElement}}return[...new Set(o)]}closest(t,e){return S.closest(this,t,e)}static isSameDom(t,e){return S._preNodeElem(t,"isSameDom")===S._preNodeElem(e,"isSameDom")}isSameDom(t){return S.isSameDom(this,t)}#e={};get _data(){return{...this.#e}}set _data(t){if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("value must be a non-null object.");this.#e=t}static _dataSelector={public:(t,e)=>{const r=S._preElem(e,t);let o=L.get(r);return o||(o={},L.set(r,o)),o},private:(t,e)=>{if(!(e instanceof S))throw new Error(`Element must be a TinyHtml instance to execute ${t}().`);return e.#e}};static data(t,e,r=!1){const o=S._dataSelector[r?"private":"public"]("data",t);if(null==e)return{...o};if("string"!=typeof e)throw new TypeError("The key must be a string.");return o.hasOwnProperty(e)?o[e]:void 0}data(t,e){return S.data(this,t,e)}static setData(t,e,r,o=!1){const n=S._dataSelector[o?"private":"public"]("setData",t);if("string"!=typeof e)throw new TypeError("The key must be a string.");return n[e]=r,t}setData(t,e,r=!1){return S.setData(this,t,e,r)}static _getSibling(t,e,r){let o=S._preNodeElemWithNull(t,r);for(;o&&(o=o[e])&&1!==o.nodeType;);return o instanceof Node?o:null}static _getSiblings(t,e){let r=t;const o=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==e&&o.push(r);return o}static domDir(t,e,r,o="domDir"){if("string"!=typeof e)throw new TypeError('The "direction" must be a string.');let n=S._preNodeElemWithNull(t,o);const i=[];for(;n&&(n=n[e]);)if(1===n.nodeType){if(r&&("string"==typeof r?n.matches(r):n===r))break;i.push(n)}return i}static parent(t){let e=S._preNodeElemWithNull(t,"parent");const r=e?e.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return S.parent(this)}static parents(t,e){return S.domDir(t,"parentNode",e,"parents")}parents(t){return S.parents(this,t)}static next(t){return S._getSibling(t,"nextSibling","next")}next(){return S.next(this)}static prev(t){return S._getSibling(t,"previousSibling","prev")}prev(){return S.prev(this)}static nextAll(t){return S.domDir(t,"nextSibling",void 0,"nextAll")}nextAll(){return S.nextAll(this)}static prevAll(t){return S.domDir(t,"previousSibling",void 0,"prevAll")}prevAll(){return S.prevAll(this)}static nextUntil(t,e){return S.domDir(t,"nextSibling",e,"nextUtil")}nextUntil(t){return S.nextUntil(this,t)}static prevUntil(t,e){return S.domDir(t,"previousSibling",e,"prevUtil")}prevUntil(t){return S.prevUntil(this,t)}static siblings(t){const e=S._preNodeElemWithNull(t,"siblings");return S._getSiblings(e&&e.parentNode?e.parentNode.firstChild:null,e)}siblings(){return S.siblings(this)}static children(t){const e=S._preNodeElemWithNull(t,"children");return S._getSiblings(e?e.firstChild:null)}children(){return S.children(this)}static contents(t){const e=S._preNodeElemWithNull(t,"contents");return e instanceof HTMLIFrameElement&&null!=e.contentDocument&&Object.getPrototypeOf(e.contentDocument)?[e.contentDocument]:e instanceof HTMLTemplateElement?Array.from((e.content||e).childNodes):e?Array.from(e.childNodes):[]}contents(){return S.contents(this)}static clone(t,e=!0){if("boolean"!=typeof e)throw new TypeError('The "deep" must be a boolean.');return S._preNodeElems(t,"clone").map(t=>t.cloneNode(e))}clone(t){return S.clone(this,t)[0]}static _appendChecker(t,...e){const r=[],o=[...e];for(const e in o)"string"!=typeof o[e]?r.push(S._preNodeElem(o[e],t)):r.push(o[e]);return r}static append(t,...e){return S._preElem(t,"append").append(...S._appendChecker("append",...e)),t}append(...t){return S.append(this,...t)}static prepend(t,...e){return S._preElem(t,"prepend").prepend(...S._appendChecker("prepend",...e)),t}prepend(...t){return S.prepend(this,...t)}static before(t,...e){return S._preElem(t,"before").before(...S._appendChecker("before",...e)),t}before(...t){return S.before(this,...t)}static after(t,...e){return S._preElem(t,"after").after(...S._appendChecker("after",...e)),t}after(...t){return S.after(this,...t)}static replaceWith(t,...e){return S._preElem(t,"replaceWith").replaceWith(...S._appendChecker("replaceWith",...e)),t}replaceWith(...t){return S.replaceWith(this,...t)}static appendTo(t,e){const r=S._preNodeElems(t,"appendTo"),o=S._preNodeElems(e,"appendTo");return o.forEach((t,e)=>{r.forEach(r=>t.appendChild(e===o.length-1?r:r.cloneNode(!0)))}),t}appendTo(t){return S.appendTo(this,t)}static prependTo(t,e){const r=S._preElems(t,"prependTo"),o=S._preElems(e,"prependTo");return o.forEach((t,e)=>{r.slice().reverse().forEach(r=>t.prepend(e===o.length-1?r:r.cloneNode(!0)))}),t}prependTo(t){return S.prependTo(this,t)}static insertBefore(t,e,r=null){const o=S._preNodeElem(t,"insertBefore"),n=S._preNodeElem(e,"insertBefore"),i=S._preNodeElemWithNull(r,"insertBefore");if(!n.parentNode)throw new Error("The target element has no parent node to insert before.");return n.parentNode.insertBefore(o,i||n),t}insertBefore(t,e){return S.insertBefore(this,t,e)}static insertAfter(t,e,r=null){const o=S._preNodeElem(t,"insertAfter"),n=S._preNodeElem(e,"insertBefore"),i=S._preNodeElemWithNull(r,"insertBefore");if(!n.parentNode)throw new Error("The target element has no parent node to insert after.");return n.parentNode.insertBefore(o,i||n.nextSibling),t}insertAfter(t,e){return S.insertAfter(this,t,e)}static replaceAll(t,e){const r=S._preNodeElems(t,"replaceAll"),o=S._preNodeElems(e,"replaceAll");return o.forEach((t,e)=>{const n=t.parentNode;r.forEach(r=>{n&&n.replaceChild(e===o.length-1?r:r.cloneNode(!0),t)})}),t}replaceAll(t){return S.replaceAll(this,t)}#t;get size(){return this.#t.length}constructor(t){if(t instanceof S)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");const e=t=>{if(!t.every(t=>t instanceof Element||t instanceof Window||t instanceof Document||t instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.")};if(Array.isArray(t))e(t),this.#t=t;else if(t instanceof NodeList||t instanceof HTMLCollection){const r=[...t];e(r),this.#t=r}else{const r=[t];e(r),this.#t=r}}static isWindow(t){return null!=t&&t===t.window}static css(t){const e=S._preElem(t,"css");return window.getComputedStyle(e)}css(){return S.css(this)}static cssString(t,e){const r=S._preElem(t,"cssString");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const o=window.getComputedStyle(r)[e];return"string"==typeof o?o:"number"==typeof o?o.toString():null}cssString(t){return S.cssString(this,t)}static cssList(t,e){const r=S._preElem(t,"cssList");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const o=window.getComputedStyle(r),n={};for(const t of e)void 0!==t&&(n[t]=o.getPropertyValue(t));return n}cssList(t){return S.cssList(this,t)}static cssFloat(t,e){const r=S._preElem(t,"cssFloat");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const o=window.getComputedStyle(r)[e];return parseFloat(o)||0}cssFloat(t){return S.cssFloat(this,t)}static cssFloats(t,e){const r=S._preElem(t,"cssFloats");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const o=window.getComputedStyle(r),n={};for(const t of e)n[t]=parseFloat(o[t])||0;return n}cssFloats(t){return S.cssFloats(this,t)}static#r={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(S.#r,{set:(t,e,r)=>(t[e]=r,S.cssPropRevAliases[r]=e,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(S.#r).map(([t,e])=>[e,t]));static toStyleKc(t){return"string"==typeof S.cssPropAliases[t]?S.cssPropAliases[t]:t}static toStyleCc(t){return"string"==typeof S.cssPropRevAliases[t]?S.cssPropRevAliases[t]:t}static setStyle(t,e,r=null){return S._preHtmlElems(t,"setStyle").forEach(t=>{if("object"==typeof e)for(const[r,o]of Object.entries(e))t.style.setProperty(S.toStyleKc(r),"string"==typeof o?o:"number"==typeof o?`${o}px`:String(o));else t.style.setProperty(S.toStyleKc(e),r)}),t}setStyle(t,e){return S.setStyle(this,t,e)}static getStyle(t,e){return S._preHtmlElem(t,"getStyle").style.getPropertyValue(S.toStyleKc(e))}getStyle(t){return S.getStyle(this,t)}static style(t,{camelCase:e=!1,rawAttr:r=!1}={}){if("boolean"!=typeof e)throw new TypeError('"camelCase" must be a boolean. Received: '+typeof e);if("boolean"!=typeof r)throw new TypeError('"rawAttr" must be a boolean. Received: '+typeof r);const o=S._preHtmlElem(t,"style"),n={};if(r){const t=(o.getAttribute("style")||"").split(";");for(const r of t){const[t,o]=r.split(":");if(!t||!o)continue;const i=t.trim(),s=o.trim();n[e?S.toStyleCc(i):i]=s}}else{const t=o.style;for(let r=0;r<t.length;r++){const o=t[r],i=t.getPropertyValue(o);n[e?S.toStyleCc(o):o]=i}}return n}style(t){return S.style(this,t)}static removeStyle(t,e){return S._preHtmlElems(t,"removeStyle").forEach(t=>{if(Array.isArray(e))for(const r of e)t.style.removeProperty(S.toStyleKc(r));else t.style.removeProperty(S.toStyleKc(e))}),t}removeStyle(t){return S.removeStyle(this,t)}static toggleStyle(t,e,r,o){return S._preHtmlElems(t,"toggleStyle").forEach(t=>{const n=S.getStyle(t,e).trim()===S.toStyleKc(r)?o:r;S.setStyle(t,e,n)}),t}toggleStyle(t,e,r){return S.toggleStyle(this,t,e,r)}static clearStyle(t){return S._preElems(t,"clearStyle").forEach(t=>t.removeAttribute("style")),t}clearStyle(){return S.clearStyle(this)}static focus(t){return S._preHtmlElem(t,"focus").focus(),t}focus(){return S.focus(this)}static blur(t){return S._preHtmlElem(t,"blur").blur(),t}blur(){return S.blur(this)}static boolCheck(t){return void 0!==t&&("true"===t||"1"===t||!0===t||"on"===t||"number"==typeof t&&t>0)}static setWinScrollTop(t){if("number"!=typeof t)throw new TypeError("The value must be a number.");S.setScrollTop(window,t)}static setWinScrollLeft(t){if("number"!=typeof t)throw new TypeError("The value must be a number.");S.setScrollLeft(window,t)}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(t,e,r="content"){const o=S._preElemAndWinAndDoc(t,"getDimension");if("string"!=typeof e)throw new TypeError("The type must be a string.");if("string"!=typeof r)throw new TypeError("The extra must be a string.");const n="width"===e?"Width":"Height";if(S.isWindow(o))return"margin"===r?o["inner"+n]:o.document.documentElement["client"+n];const i=o;if(9===i.nodeType){const t=i.documentElement;return Math.max(i.body["scroll"+n],t["scroll"+n],i.body["offset"+n],t["offset"+n],t["client"+n])}let s=i.getBoundingClientRect()[e];function l(t){return"width"===e?S.cssFloat(i,t+"Left")+S.cssFloat(i,t+"Right"):S.cssFloat(i,t+"Top")+S.cssFloat(i,t+"Bottom")}switch(r){case"content":s-=l("padding"),s-=l("border");break;case"padding":s-=l("border");break;case"border":break;case"margin":s+=l("margin")}return s}getDimension(t,e){return S.getDimension(this,t,e)}static setHeight(t,e){const r=S._preHtmlElem(t,"setHeight");if("number"!=typeof e&&"string"!=typeof e)throw new TypeError("The value must be a string or number.");return r.style.height="number"==typeof e?`${e}px`:e,t}setHeight(t){return S.setHeight(this,t)}static setWidth(t,e){const r=S._preHtmlElem(t,"setWidth");if("number"!=typeof e&&"string"!=typeof e)throw new TypeError("The value must be a string or number.");return r.style.width="number"==typeof e?`${e}px`:e,t}setWidth(t){return S.setWidth(this,t)}static height(t){const e=S._preElemAndWinAndDoc(t,"height");return S.getDimension(e,"height","content")}height(){return S.height(this)}static width(t){const e=S._preElemAndWinAndDoc(t,"width");return S.getDimension(e,"width","content")}width(){return S.width(this)}static innerHeight(t){const e=S._preElemAndWinAndDoc(t,"innerHeight");return S.getDimension(e,"height","padding")}innerHeight(){return S.innerHeight(this)}static innerWidth(t){const e=S._preElemAndWinAndDoc(t,"innerWidth");return S.getDimension(e,"width","padding")}innerWidth(){return S.innerWidth(this)}static outerHeight(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=S._preElemAndWinAndDoc(t,"outerHeight");return S.getDimension(r,"height",e?"margin":"border")}outerHeight(t){return S.outerHeight(this,t)}static outerWidth(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=S._preElemAndWinAndDoc(t,"outerWidth");return S.getDimension(r,"width",e?"margin":"border")}outerWidth(t){return S.outerWidth(this,t)}static animate(t,e,r){return S._preElems(t,"animate").forEach(t=>t.animate(e,r)),t}animate(t,e){return S.animate(this,t,e)}static offset(t){const e=S._preElem(t,"offset").getBoundingClientRect(),r=window.scrollY||document.documentElement.scrollTop,o=window.scrollX||document.documentElement.scrollLeft;return{top:e.top+r,left:e.left+o}}offset(){return S.offset(this)}static position(t){const e=S._preHtmlElem(t,"position");let r,o,n={top:0,left:0};if("fixed"===window.getComputedStyle(e).position)o=e.getBoundingClientRect();else{o=S.offset(e),r=e.offsetParent||document.documentElement;const{position:t}=window.getComputedStyle(r);for(;r instanceof HTMLElement&&(r===document.body||r===document.documentElement)&&"static"===t;)r=r.parentNode;if(r instanceof HTMLElement&&r!==e&&1===r.nodeType){const{borderTopWidth:t,borderLeftWidth:e}=S.cssFloats(r,["borderTopWidth","borderLeftWidth"]);n=S.offset(r),n.top+=t,n.left+=e}}return{top:o.top-n.top-S.cssFloat(e,"marginTop"),left:o.left-n.left-S.cssFloat(e,"marginLeft")}}position(){return S.position(this)}static offsetParent(t){let e=S._preHtmlElem(t,"offsetParent").offsetParent;for(;e instanceof HTMLElement&&"static"===window.getComputedStyle(e).position;)e=e.offsetParent;return e instanceof HTMLElement?e:document.documentElement}offsetParent(){return S.offsetParent(this)}static scrollTop(t){const e=S._preElemAndWindow(t,"scrollTop");return S.isWindow(e)?e.pageYOffset:9===e.nodeType?e.defaultView.pageYOffset:e.scrollTop}scrollTop(){return S.scrollTop(this)}static scrollLeft(t){const e=S._preElemAndWindow(t,"scrollLeft");return S.isWindow(e)?e.pageXOffset:9===e.nodeType?e.defaultView.pageXOffset:e.scrollLeft}scrollLeft(){return S.scrollLeft(this)}static easings={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t*t:(4-2*t)*t-1,easeInCubic:t=>t*t*t,easeOutCubic:t=>--t*t*t+1,easeInOutCubic:t=>t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1};static scrollToXY(t,{targetX:e,targetY:r,duration:o,easing:n,onAnimation:i}={}){if(void 0!==e&&"number"!=typeof e)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!==o&&"number"!=typeof o)throw new TypeError("`duration` must be a number if provided.");if(void 0!==n&&"string"!=typeof n)throw new TypeError("`easing` must be a string if provided.");if(void 0!==n&&"function"!=typeof S.easings[n])throw new TypeError(`Unknown easing function: "${n}".`);if(void 0!==i&&"function"!=typeof i)throw new TypeError("`onAnimation` must be a function if provided.");const s=(t,e,r,o)=>{if(t instanceof Window)window.scrollTo(e,r);else if(9===t.nodeType)t.defaultView.scrollTo(e,r);else{const o=t instanceof Window?window.scrollX:t.scrollLeft,n=t instanceof Window?window.scrollY:t.scrollTop;o!==e&&(t.scrollLeft=e),n!==r&&(t.scrollTop=r)}"function"==typeof i&&i({x:e,y:r,isComplete:o>=1,time:o})};return S._preElemsAndWindow(t,"scrollToXY").forEach(t=>{const i=t instanceof Window?window.scrollX:t.scrollLeft,l=t instanceof Window?window.scrollY:t.scrollTop,a=e??i,c=r??l,d=a-i,m=c-l,u="string"==typeof n&&S.easings[n]||null;if("number"!=typeof o||"function"!=typeof u)return s(t,a,c,1);const h=performance.now(),p=o??0;requestAnimationFrame(function e(r){if("function"!=typeof u)return;const o=Math.min(1,(r-h)/p),n=u(o);s(t,i+d*n,l+m*n,o),o<1&&requestAnimationFrame(e)})}),t}scrollToXY({targetX:t,targetY:e,duration:r,easing:o,onAnimation:n}={}){return S.scrollToXY(this,{targetX:t,targetY:e,duration:r,easing:o,onAnimation:n})}static setScrollTop(t,e){if("number"!=typeof e)throw new TypeError("ScrollTop value must be a number.");return S.scrollToXY(t,{targetY:e})}setScrollTop(t){return S.setScrollTop(this,t)}static setScrollLeft(t,e){if("number"!=typeof e)throw new TypeError("ScrollLeft value must be a number.");return S.scrollToXY(t,{targetX:e})}setScrollLeft(t){return S.setScrollLeft(this,t)}static borderWidth(t){const e=S._preElem(t,"borderWidth"),{borderLeftWidth:r,borderRightWidth:o,borderTopWidth:n,borderBottomWidth:i}=S.cssFloats(e,["borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}borderWidth(){return S.borderWidth(this)}static border(t){const e=S._preElem(t,"border"),{borderLeft:r,borderRight:o,borderTop:n,borderBottom:i}=S.cssFloats(e,["borderLeft","borderRight","borderTop","borderBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}border(){return S.border(this)}static margin(t){const e=S._preElem(t,"margin"),{marginLeft:r,marginRight:o,marginTop:n,marginBottom:i}=S.cssFloats(e,["marginLeft","marginRight","marginTop","marginBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}margin(){return S.margin(this)}static padding(t){const e=S._preElem(t,"padding"),{paddingLeft:r,paddingRight:o,paddingTop:n,paddingBottom:i}=S.cssFloats(e,["paddingLeft","paddingRight","paddingTop","paddingBottom"]);return{x:r+o,y:n+i,left:r,right:o,top:n,bottom:i}}padding(){return S.padding(this)}static addClass(t,...e){return S._preElems(t,"addClass").forEach(t=>t.classList.add(...e)),t}addClass(...t){return S.addClass(this,...t)}static removeClass(t,...e){return S._preElems(t,"removeClass").forEach(t=>t.classList.remove(...e)),t}removeClass(...t){return S.removeClass(this,...t)}static replaceClass(t,e,r){if("string"!=typeof e)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 o=[];return S._preElems(t,"replaceClass").forEach(t=>o.push(t.classList.replace(e,r))),o}replaceClass(t,e){return S.replaceClass(this,t,e)[0]}static classItem(t,e){const r=S._preElem(t,"classItem");if("number"!=typeof e)throw new TypeError('The "index" parameter must be a number.');return r.classList.item(e)}classItem(t){return S.classItem(this,t)}static toggleClass(t,e,r){if("string"!=typeof e)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 o=[];return S._preElems(t,"toggleClass").forEach(t=>o.push(t.classList.toggle(e,r))),o}toggleClass(t,e){return S.toggleClass(this,t,e)[0]}static hasClass(t,e){const r=S._preElem(t,"hasClass");if("string"!=typeof e)throw new TypeError('The "token" parameter must be a string.');return r.classList.contains(e)}hasClass(t){return S.hasClass(this,t)}static classLength(t){return S._preElem(t,"classLength").classList.length}classLength(){return S.classLength(this)}static classList(t){return S._preElem(t,"classList").classList.values().toArray()}classList(){return S.classList(this)}static tagName(t){return S._preElem(t,"tagName").tagName}tagName(){return S.tagName(this)}static id(t){return S._preElem(t,"id").id}id(){return S.id(this)}static text(t){return S._preElem(t,"text").textContent}text(){return S.text(this)}static setText(t,e){if("string"!=typeof e)throw new Error("Value is not a valid string.");return S._preElems(t,"setText").forEach(t=>t.textContent=e),t}setText(t){return S.setText(this,t)}static empty(t){return S._preElems(t,"empty").forEach(t=>t.textContent=""),t}empty(){return S.empty(this)}static html(t,e){return S._preElem(t,"html").getHTML(e)}html(t){return S.html(this,t)}static setHtml(t,e){if("string"!=typeof e)throw new Error("Value is not a valid string.");return S._preElems(t,"setHtml").forEach(t=>t.innerHTML=e),t}setHtml(t){return S.setHtml(this,t)}static _valHooks={option:{get:t=>{const e=t.getAttribute("value");return null!=e?e:t.textContent}},select:{get:t=>{const e=t.options,r=t.selectedIndex,o="select-one"===t.type,n=o?r+1:e.length,i=[];let s=r<0?n:o?r:0;for(;s<n;s++){const t=e[s],n=t.parentNode;if((t.selected||s===r)&&!t.disabled&&(!n||!n.disabled||"OPTGROUP"!==n.tagName)){const e=S._valHooks.option.get(t);if(o)return e;i.push(e)}}return i},set:(t,e)=>{const r=t.options,o=Array.isArray(e)?e.map(String):[String(e)];let n=!1;for(let t=0;t<r.length;t++){const e=r[t],i=S._valHooks.option.get(e);"string"==typeof i&&(e.selected=o.includes(i))&&(n=!0)}return n||(t.selectedIndex=-1),o}},radio:{get:t=>t.checked?"on":"off",set(t,e){if("boolean"==typeof e){const r=t.closest("label");return e&&r&&r.querySelectorAll('input[type="radio"]').forEach(e=>{e instanceof HTMLInputElement&&e!==t&&(e.checked=!1)}),t.checked=e,e}}},checkbox:{get:t=>t.checked?"on":"off",set(t,e){if("boolean"==typeof e)return t.checked=e,e}}};static setVal(t,e){return S._preInputElems(t,"setVal").forEach(t=>{if(1!==t.nodeType)return;let r="function"==typeof e?e(t,S.val(t)):e;null==r?r="":"number"==typeof r?r=String(r):Array.isArray(r)&&(r=((t,e)=>{const r=[];for(let o=0;o<t.length;o++)r.push(e(t[o]));return r})(r,t=>null==t?"":String(t)));const o=S._valHooks[t.type]||S._valHooks[t.nodeName.toLowerCase()];if(!o||"function"!=typeof o.set||void 0===o.set(t,r,"value")){if("string"!=typeof r&&"boolean"!=typeof r)throw new Error(`Invalid setValue "${typeof r}" value.`);"string"==typeof r&&(t.value=r)}}),t}setVal(t){return S.setVal(this,t)}static _valTypes={string:t=>t.value,date:t=>t.valueAsDate,number:t=>t.valueAsNumber};static _getValByType(t,e,r){if("string"!=typeof e)throw new TypeError('The "type" must be a string.');if("string"!=typeof r)throw new TypeError('The "where" must be a string.');if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement))throw new Error(`Provided element is not an HTMLInputElement in ${r}().`);if("function"!=typeof S._valTypes[e])throw new Error(`No handler found for type "${e}" in ${r}().`);return S._valTypes[e](t)}static _val(t,e,r){const o=S._preInputElem(t,e),n=S._valHooks[o.type]||S._valHooks[o.nodeName.toLowerCase()];if(n&&"function"==typeof n.get){const t=n.get(o,"value",r);if(void 0!==t)return"string"==typeof t?t.replace(/\r/g,""):t}return S._getValByType(o,r,e)}_val(t,e){return S._val(this,t,e)}static val(t){return S._val(t,"val","string")}val(){return S.val(this)}static valTxt(t){const e=S._val(t,"valTxt","string");if("string"!=typeof e&&null!==e)throw new Error("Value is not a valid string.");return null==e?"":"string"==typeof e?e.replace(/\r/g,""):e}valTxt(){return S.valTxt(this)}static _valArr(t,e,r){const o=S._val(t,e,r);if(!Array.isArray(o))throw new Error(`Value expected an array but got ${typeof o}.`);return o}_valArr(t,e){return S._valArr(this,t,e)}static valArr(t){return S._valArr(t,"valArr","string")}valArr(){return S.valArr(this)}static valNb(t){if(!(S._preInputElem(t,"valNb")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const e=S._val(t,"valNb","number");if(Number.isNaN(e))throw new Error("Value is not a valid number.");return e}valNb(){return S.valNb(this)}static valDate(t){if(!(S._preInputElem(t,"valDate")instanceof HTMLInputElement))throw new Error("Element must be an input element.");const e=S._val(t,"valDate","date");if(!(e instanceof Date))throw new Error("Value is not a valid date.");return e}valDate(){return S.valDate(this)}static valBool(t){const e=S._preInputElem(t,"valBool");if(!(e instanceof HTMLInputElement))throw new Error("Element must be an input element.");return"on"===S.val(e)}valBool(){return S.valBool(this)}static listenForPaste(t,{onFilePaste:e,onTextPaste:r}={}){if(void 0!==e&&"function"!=typeof e)throw new TypeError("onFilePaste must be a function.");if(void 0!==r&&"function"!=typeof r)throw new TypeError("onTextPaste must be a function.");const o=t=>{if(!(t instanceof ClipboardEvent))return;const o=t.clipboardData?.items||[];for(const t of o)if("file"===t.kind){if("function"==typeof e){const r=t.getAsFile();r&&e(t,r)}}else"string"===t.kind&&"function"==typeof r&&t.getAsString(e=>r(t,e))};return S._preElemsWithDoc(t,"listenForPaste").forEach(t=>S.on(t,"paste",o)),o}listenForPaste({onFilePaste:t,onTextPaste:e}={}){return S.listenForPaste(this,{onFilePaste:t,onTextPaste:e})}static hasEventListener(t,e){const r=S._preEventTargetElem(t,"hasEventListener");if(!A.has(r))return!1;const o=A.get(r);return!!(o&&Array.isArray(o[e])&&o[e].length>0)}hasEventListener(t){return S.hasEventListener(this,t)}static hasExactEventListener(t,e,r){const o=S._preEventTargetElem(t,"hasExactEventListener");if("function"!=typeof r)throw new TypeError('The "handler" must be a function.');if(!A.has(o))return!1;const n=A.get(o);return!(!n||!Array.isArray(n[e]))&&n[e].some(t=>t.handler===r)}hasExactEventListener(t,e){return S.hasExactEventListener(this,t,e)}static on(t,e,r,o){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"on").forEach(t=>{t.addEventListener(e,r,o),A.has(t)||A.set(t,{});const n=A.get(t);n&&(Array.isArray(n[e])||(n[e]=[]),n[e].push({handler:r,options:o}))}),t}on(t,e,r){return S.on(this,t,e,r)}static once(t,e,r,o={}){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"once").forEach(t=>{const n=o=>{S.off(t,e,n),"function"==typeof r&&r(o)};S.on(t,e,n,"boolean"==typeof o?o:{...o,once:!0})}),t}once(t,e,r={}){return S.once(this,t,e,r)}static off(t,e,r,o){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"off").forEach(t=>{t.removeEventListener(e,r,o);const n=A.get(t);n&&n[e]&&(n[e]=n[e].filter(t=>t.handler!==r),0===n[e].length&&delete n[e])}),t}off(t,e,r){return S.off(this,t,e,r)}static offAll(t,e){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"offAll").forEach(t=>{const r=A.get(t);if(r&&r[e]){for(const o of r[e])t.removeEventListener(e,o.handler,o.options);delete r[e]}}),t}offAll(t){return S.offAll(this,t)}static offAllTypes(t,e=null){if(null!==e&&"function"!=typeof e)throw new TypeError('The "filterFn" must be a function.');return S._preEventTargetElems(t,"offAllTypes").forEach(t=>{const r=A.get(t);if(r){for(const o in r)for(const n of r[o])("function"!=typeof e||e(n.handler,o))&&t.removeEventListener(o,n.handler,n.options);A.delete(t)}}),t}offAllTypes(t=null){return S.offAllTypes(this,t)}static trigger(t,e,r={}){if("string"!=typeof e)throw new TypeError("The event name must be a string.");return S._preEventTargetElems(t,"trigger").forEach(t=>{const o=r instanceof Event||r instanceof CustomEvent?r:new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t.dispatchEvent(o)}),t}trigger(t,e={}){return S.trigger(this,t,e)}static#o={for:"htmlFor",class:"className"};static propFix=new Proxy(S.#o,{set:(t,e,r)=>(t[e]=r,S.attrFix[r]=e,!0)});static attrFix=Object.fromEntries(Object.entries(S.#o).map(([t,e])=>[e,t]));static getPropName(t){return"string"==typeof S.propFix[t]?S.propFix[t]:t}static getAttrName(t){return"string"==typeof S.attrFix[t]?S.attrFix[t]:t}static attr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElem(t,"attr").getAttribute(S.getAttrName(e))}attr(t){return S.attr(this,t)}static setAttr(t,e,r=null){if("string"!=typeof e)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 S._preElems(t,"setAttr").forEach(t=>{null===r?t.removeAttribute(S.getAttrName(e)):t.setAttribute(S.getAttrName(e),r)}),t}setAttr(t,e){return S.setAttr(this,t,e)}static removeAttr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElems(t,"removeAttr").forEach(t=>t.removeAttribute(S.getAttrName(e))),t}removeAttr(t){return S.removeAttr(this,t)}static hasAttr(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElem(t,"hasAttr").hasAttribute(S.getAttrName(e))}hasAttr(t){return S.hasAttr(this,t)}static hasProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return!!S._preElem(t,"hasProp")[S.getPropName(e)]}hasProp(t){return S.hasProp(this,t)}static addProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElems(t,"addProp").forEach(t=>{t[S.getPropName(e)]=!0}),t}addProp(t){return S.addProp(this,t)}static removeProp(t,e){if("string"!=typeof e)throw new TypeError('The "name" must be a string.');return S._preElems(t,"removeProp").forEach(t=>{t[S.getPropName(e)]=!1}),t}removeProp(t){return S.removeProp(this,t)}static toggleProp(t,e,r){if("string"!=typeof e)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.');S._preElems(t,"toggleProp").forEach(t=>{(void 0===r?!t[S.getPropName(e)]:r)?S.addProp(t,e):S.removeProp(t,e)})}toggleProp(t,e){return S.toggleProp(this,t,e)}static remove(t){return S._preElems(t,"remove").forEach(t=>t.remove()),t}remove(){return S.remove(this)}static index(t,e=null){const r=S._preElem(t,"index");if(!r)return-1;if(!e)return Array.prototype.indexOf.call(r.parentNode?.children||[],r);if(e){const t="string"==typeof e?document.querySelectorAll(e):S._preElems(e,"index");return Array.prototype.indexOf.call(t,r)}return-1}index(t){return S.index(this,t)}static _getCustomRect(t,e){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 e in t)"number"==typeof t[e]&&(r[e]=t[e]);if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("extraRect must be a non-null object.");const{height:o=0,width:n=0,top:i=0,bottom:s=0,left:l=0,right:a=0}=e;if("number"!=typeof o)throw new Error("extraRect.height must be a number.");if("number"!=typeof n)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 l)throw new Error("extraRect.left must be a number.");if("number"!=typeof a)throw new Error("extraRect.right must be a number.");return r.height+=o,r.width+=n,r.top+=i,r.bottom+=s,r.left+=l,r.right+=a,r}static isCollWith(t,e,r={}){const o=S._getCustomRect(S._preElem(t,"isCollWith").getBoundingClientRect(),r),n=S._preElem(e,"isCollWith").getBoundingClientRect();return v(o,n)}isCollWith(t,e){return S.isCollWith(this,t,e)}static isCollPerfWith(t,e,r={}){const o=S._getCustomRect(S._preElem(t,"isCollPerfWith").getBoundingClientRect(),r),n=S._preElem(e,"isCollPerfWith").getBoundingClientRect();return T(o,n)}isCollPerfWith(t,e){return S.isCollPerfWith(this,t,e)}static _isCollWithLock(t,e,r,o,n){const i=k[n];if(t)return i.has(o)||i.set(o,!0),!0;if(i.has(o)){let t=!1;switch(n){case"top":t=C(e,r);break;case"bottom":t=x(e,r);break;case"left":t=_(e,r);break;case"right":t=D(e,r)}return t&&i.delete(o),i.has(o)}return!1}static isCollWithLock(t,e,r,o={}){const n=S._preElem(t,"isCollWithLock"),i=S._preElem(e,"isCollWithLock"),s=S._getCustomRect(n.getBoundingClientRect(),o),l=i.getBoundingClientRect(),a=v(s,l);return S._isCollWithLock(a,s,l,n,r)}isCollWithLock(t,e,r){return S.isCollWithLock(this,t,e,r)}static isCollPerfWithLock(t,e,r,o={}){const n=S._preElem(t,"isCollPerfWithLock"),i=S._preElem(e,"isCollPerfWithLock"),s=S._getCustomRect(n.getBoundingClientRect(),o),l=i.getBoundingClientRect(),a=T(s,l);return S._isCollWithLock(a,s,l,n,r)}isCollPerfWithLock(t,e,r){return S.isCollPerfWithLock(this,t,e,r)}static resetCollLock(t){const e=S._preElem(t,"resetCollLock");let r=!1;for(const t of["top","bottom","left","right"])k[t].has(e)&&(k[t].delete(e),r=!0);return r}resetCollLock(){return S.resetCollLock(this)}static resetCollLockDir(t,e){const r=S._preElem(t,"resetCollLockDir"),o=k[e];return!!o.has(r)&&(o.delete(r),!0)}resetCollLockDir(t){return S.resetCollLockDir(this,t)}static isInViewport(t){const e=S._preElem(t,"isInViewport");if(!e.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=S.offset(e).top,o=r+S.outerHeight(e),n=S.scrollTop(window),i=n+S.height(window);return o>n&&r<i}isInViewport(){return S.isInViewport(this)}static isScrolledIntoView(t){const e=S._preElem(t,"isScrolledIntoView");if(!e.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const r=S.scrollTop(window),o=r+S.height(window),n=S.offset(e).top;return n+S.height(e)<=o&&n>=r}isScrolledIntoView(){return S.isScrolledIntoView(this)}static isInContainer(t,e){const r=S._preElem(t,"isInContainer"),o=S._preElem(e,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),s=n.bottom>i.top&&n.top<i.bottom,l=n.right>i.left&&n.left<i.right;return s&&l}isInContainer(t){return S.isInContainer(this,t)}static isFullyInContainer(t,e){const r=S._preElem(t,"isScrolledIntoView"),o=S._preElem(e,"isInContainer");if(!r.checkVisibility({contentVisibilityAuto:!1,opacityProperty:!1,visibilityProperty:!1}))return!1;const n=r.getBoundingClientRect(),i=o.getBoundingClientRect();return n.top>=i.top&&n.bottom<=i.bottom&&n.left>=i.left&&n.right<=i.right}isFullyInContainer(t){return S.isFullyInContainer(this,t)}static hasScroll(t){const e=S._preElem(t,"hasScroll");return{v:e.scrollHeight>e.clientHeight,h:e.scrollWidth>e.clientWidth}}hasScroll(){return S.hasScroll(this)}}const P=S;function B(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"===Object.prototype.toString.call(t)}class M{static Utils={...r,TinyHtml:P};#n=!0;#i=!1;#s=0;#l=0;#a=!0;#c=!1;#d=!1;#m=!1;#u=!1;#h=!1;#p=!1;#g=null;#f=[];#y=null;#b={start:!1,end:!1,collide:!1,move:!1};#E=null;#w;#v="drag-hidden";#T="dragging";#C="drag-active";#x="jail-drag-active";#_="jail-drag-disabled";#D="dragging-collision";#A=9999;constructor(t,e={}){const r=t instanceof P?t.get(0):t;if(!(r instanceof HTMLElement))throw new Error("TinyDragger requires a valid target HTMLElement to initialize.");if(this.#w=r,void 0!==e.jail&&!(e.jail instanceof HTMLElement))throw new Error('The "jail" option must be an HTMLElement if provided.');if(void 0!==e.defaultZIndex&&this.setDefaultZIndex(e.defaultZIndex),void 0!==e.vibration&&!1!==e.vibration&&!B(e.vibration))throw new Error('The "vibration" option must be an object or false.');const o=(t,e)=>{if(void 0!==t&&"boolean"!=typeof t)throw new Error(`The "${e}" option must be a boolean.`)},n=(t,e)=>{if(void 0!==t&&"string"!=typeof t)throw new Error(`The "${e}" option must be a string.`)};o(e.mirrorElem,"mirrorElem"),o(e.collisionByMouse,"collisionByMouse"),o(e.lockInsideJail,"lockInsideJail"),o(e.dropInJailOnly,"dropInJailOnly"),o(e.revertOnDrop,"revertOnDrop"),o(e.multiCollision,"multiCollision"),n(e.classDragging,"classDragging"),n(e.classBodyDragging,"classBodyDragging"),n(e.classJailDragging,"classJailDragging"),n(e.classJailDragDisabled,"classJailDragDisabled"),n(e.classDragCollision,"classDragCollision"),n(e.classHidden,"classHidden"),e.jail instanceof HTMLElement&&(this.#E=e.jail),this.#b=Object.assign({start:!1,end:!1,collide:!1,move:!1},B(e.vibration)?e.vibration:{}),"string"==typeof e.classDragging&&(this.#T=e.classDragging),"string"==typeof e.classBodyDragging&&(this.#C=e.classBodyDragging),"string"==typeof e.classJailDragging&&(this.#x=e.classJailDragging),"string"==typeof e.classJailDragDisabled&&(this.#_=e.classJailDragDisabled),"string"==typeof e.classHidden&&(this.#v=e.classHidden),"string"==typeof e.classDragCollision&&(this.#D=e.classDragCollision),"boolean"==typeof e.collisionByMouse&&(this.#h=e.collisionByMouse),"boolean"==typeof e.mirrorElem&&(this.#a=e.mirrorElem),"boolean"==typeof e.revertOnDrop&&(this.#m=e.revertOnDrop),"boolean"==typeof e.lockInsideJail&&(this.#d=e.lockInsideJail),"boolean"==typeof e.dropInJailOnly&&(this.#p=e.dropInJailOnly),"boolean"==typeof e.multiCollision&&(this.#c=e.multiCollision),this._onMouseDown=this.#L.bind(this),this._onMouseMove=this.#k.bind(this),this._onMouseUp=this.#S.bind(this),this._onTouchStart=t=>this.#L(t.touches[0]),this._onTouchMove=t=>this.#k(t.touches[0]),this._onTouchEnd=t=>this.#S(t.changedTouches[0]),this.#w.addEventListener("mousedown",this._onMouseDown),this.#w.addEventListener("touchstart",this._onTouchStart,{passive:!1})}enable(){this.#P(),this.#E&&this.#E.classList.add(this.#_),this.#n=!0}disable(){this.#E&&this.#E.classList.remove(this.#_),this.#n=!1}addCollidable(t){if(this.#P(),!(t instanceof HTMLElement))throw new Error("addCollidable expects an HTMLElement as argument.");this.#f.includes(t)||this.#f.push(t)}removeCollidable(t){if(this.#P(),!(t instanceof HTMLElement))throw new Error("removeCollidable expects an HTMLElement as argument.");this.#f=this.#f.filter(e=>e!==t)}setVibrationPattern({startPattern:t=!1,endPattern:e=!1,collidePattern:r=!1,movePattern:o=!1}={}){this.#P();const n=t=>!1===t||Array.isArray(t)&&t.every(t=>"number"==typeof t);if(!n(t))throw new Error('Invalid "startPattern": must be false or an array of numbers.');if(!n(e))throw new Error('Invalid "endPattern": must be false or an array of numbers.');if(!n(r))throw new Error('Invalid "collidePattern": must be false or an array of numbers.');if(!n(o))throw new Error('Invalid "movePattern": must be false or an array of numbers.');this.#b={start:t,end:e,collide:r,move:o}}disableVibration(){this.#P(),this.#b={start:!1,end:!1,collide:!1,move:!1}}getOffset(t){if(this.#P(),!(t instanceof MouseEvent||t instanceof Touch)||"number"!=typeof t.clientX||"number"!=typeof t.clientY)throw new Error("getOffset expects an event with valid clientX and clientY coordinates.");const e=this.#w.getBoundingClientRect(),{left:r,top:o}=P.borderWidth(this.#w);return{x:t.clientX-e.left+r,y:t.clientY-e.top+o}}#L(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#i||!this.#n||!this.#w.parentElement)return;if(this.#a){const t=this.#w.cloneNode(!0);if(!(t instanceof HTMLElement))throw new Error("[TinyDragger] INVALID DRAG ELEMENT!");this.#y=t}else this.#y=this.#w;this.#u=!0;const e=this.#w.getBoundingClientRect();Object.assign(this.#y.style,{position:"absolute",pointerEvents:"none",left:`${this.#w.offsetLeft}px`,top:`${this.#w.offsetTop}px`,width:`${e.width}px`,height:`${e.height}px`,zIndex:this.#A}),this.#a&&(this.#w.classList.add(this.#v),this.#w.parentElement.appendChild(this.#y));const{x:r,y:o}=this.getOffset(t);this.#l=r,this.#s=o,this.#y.classList.add(this.#T),document.body.classList.add(this.#C),this.#E&&this.#E.classList.add(this.#x),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.#b.start)&&navigator.vibrate(this.#b.start),this.checkDragCollision(t),this.#B("drag")}#M=[];#N(t){t&&(t.classList.add(this.#D),this.#M.push(t))}#W(){for(;this.#M.length>0;){const t=this.#M.shift();t&&t.classList.remove(this.#D)}this.#g&&this.#g.classList.remove(this.#D)}checkDragCollision(t){const{collidedElements:e}=this.execCollision(t),r=e[0]||null;this.#g&&!e.includes(this.#g)&&this.#W(),e.forEach(t=>this.#N(t)),this.#f.forEach(t=>{e.includes(t)||t.classList.remove(this.#D)}),navigator.vibrate&&Array.isArray(this.#b.collide)&&e.length>0&&navigator.vibrate(this.#b.collide),this.#g=r}#k(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#i||!this.#u||!this.#n||!this.#y)return;const e=(this.#y.offsetParent||document.body).getBoundingClientRect();let r=t.clientX-e.left-this.#l,o=t.clientY-e.top-this.#s;if(this.#d&&this.#E){const t=this.#E.getBoundingClientRect(),n=this.#y.getBoundingClientRect(),i=t.left-e.left,s=t.top-e.top,{x:l,y:a}=P.borderWidth(this.#E),c=i+t.width-n.width-a,d=s+t.height-n.height-l;r=Math.max(i,Math.min(r,c)),o=Math.max(s,Math.min(o,d))}this.#y.style.position="absolute",this.#y.style.left=`${r}px`,this.#y.style.top=`${o}px`,navigator.vibrate&&Array.isArray(this.#b.move)&&navigator.vibrate(this.#b.move),this.checkDragCollision(t),this.#B("dragging")}execCollision(t){if(this.#i||!this.#y)return{inJail:!1,collidedElements:[]};let e=[],r=!0;const o=this.#E?.getBoundingClientRect();if(this.#h){const n=t.clientX,i=t.clientY;this.#p&&this.#E&&o&&(r=n>=o.left&&n<=o.right&&i>=o.top&&i<=o.bottom),e=r?this.#c?this.getAllCollidedElements(n,i):[this.getCollidedElement(n,i)].filter(Boolean):[]}else{const t=this.#y.getBoundingClientRect();this.#p&&this.#E&&o&&(r=t.left>=o.left&&t.right<=o.right&&t.top>=o.top&&t.bottom<=o.bottom),e=r?this.#c?this.getAllCollidedElementsByRect(t):[this.getCollidedElementByRect(t)].filter(Boolean):[]}return{inJail:r,collidedElements:e}}#S(t){if(t instanceof MouseEvent&&t.preventDefault(),this.#i||!this.#u)return;if(this.#u=!1,!this.#y)return;this.#w.classList.remove(this.#T),document.body.classList.remove(this.#C),this.#E&&this.#E.classList.remove(this.#x),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd);const{collidedElements:e}=this.execCollision(t);navigator.vibrate&&Array.isArray(this.#b.end)&&navigator.vibrate(this.#b.end);const r=this.#y.style.left,o=this.#y.style.top;this.#y&&(this.#a?this.#y.remove():Object.assign(this.#y.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#y=null),this.#g&&this.#W(),this.#g=null,this.#a&&this.#w.classList.remove(this.#v),this.#m||(this.#w.style.left=r,this.#w.style.top=o);const n=new CustomEvent("drop",{detail:{targets:e,first:e[0]||null}});this.#w.dispatchEvent(n)}#H(t,e){const r=t.getBoundingClientRect();return!(e.right<r.left||e.left>r.right||e.bottom<r.top||e.top>r.bottom)}getAllCollidedElementsByRect(t){if(this.#P(),!(t instanceof DOMRect)||"number"!=typeof t.left||"number"!=typeof t.right||"number"!=typeof t.top||"number"!=typeof t.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#f.filter(e=>this.#H(e,t))}getCollidedElementByRect(t){if(this.#P(),!(t instanceof DOMRect)||"number"!=typeof t.left||"number"!=typeof t.right||"number"!=typeof t.top||"number"!=typeof t.bottom)throw new Error("getCollidedElementByRect expects a valid DOMRect object.");return this.#f.find(e=>this.#H(e,t))||null}#I(t,e,r){const o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&r>=o.top&&r<=o.bottom}getAllCollidedElements(t,e){if(this.#P(),"number"!=typeof t||"number"!=typeof e)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#f.filter(r=>this.#I(r,t,e))}getCollidedElement(t,e){if(this.#P(),"number"!=typeof t||"number"!=typeof e)throw new Error("getCollidedElement expects numeric x and y coordinates.");return this.#f.find(r=>this.#I(r,t,e))||null}#B(t){const e=new CustomEvent(t);this.#w.dispatchEvent(e)}getDragging(){return this.#u}getLockInsideJail(){return this.#d}setLockInsideJail(t){if("boolean"!=typeof t)throw new Error("lockInsideJail must be a boolean.");this.#d=t}getRevertOnDrop(){return this.#m}setRevertOnDrop(t){if("boolean"!=typeof t)throw new Error("revertOnDrop must be a boolean.");this.#m=t}getCollisionByMouse(){return this.#h}setCollisionByMouse(t){if("boolean"!=typeof t)throw new Error("collisionByMouse must be a boolean.");this.#h=t}getDropInJailOnly(){return this.#p}setDropInJailOnly(t){if("boolean"!=typeof t)throw new Error("dropInJailOnly must be a boolean.");this.#p=t}getDefaultZIndex(){return this.#A}setDefaultZIndex(t){if("number"!=typeof t||!Number.isFinite(t))throw new TypeError("Z-index must be a finite number.");this.#A=t}isMirrorEnabled(){return this.#a}setMirrorEnabled(t){if("boolean"!=typeof t)throw new TypeError("Mirror setting must be a boolean.");this.#a=t}getTarget(){return this.#w}getJail(){return this.#E}getDragProxy(){return this.#y}getLastCollision(){return this.#g}getCollidables(){return[...this.#f]}getDragHiddenClass(){return this.#v}getClassDragging(){return this.#T}getClassBodyDragging(){return this.#C}getClassJailDragging(){return this.#x}getClassJailDragDisabled(){return this.#_}getClassDragCollision(){return this.#D}getVibrations(){return{...this.#b}}getStartVibration(){return this.#b.start}getEndVibration(){return this.#b.end}getCollideVibration(){return this.#b.collide}getMoveVibration(){return this.#b.move}isEnabled(){return this.#n}#P(){if(this.#i)throw new Error("This TinyDragger instance has been destroyed and can no longer be used.")}destroy(){this.#i||(this.disable(),this.#w.removeEventListener("mousedown",this._onMouseDown),this.#w.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.#g&&this.#W(),this.#y&&(this.#a?this.#y.remove():Object.assign(this.#y.style,{position:"",pointerEvents:"",left:"",top:"",width:"",height:"",zIndex:""}),this.#y=null),this.#f=[],this.#u=!1,this.#g=null,this.#a&&this.#w.classList.remove(this.#v),this.#w.classList.remove(this.#T),document.body.classList.remove(this.#C),this.#E&&this.#E.classList.remove(this.#x,this.#_),this.#i=!0)}}const N=M;window.TinyDragger=e.TinyDragger})();
|