tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
1 lines • 95.4 kB
JavaScript
(()=>{"use strict";var t={7(t){var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise(function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}d(t,e,i,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&d(t,"error",e,{once:!0})}(t,o)})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?i.defaultMaxListeners:t._maxListeners}function c(t,e,r,n){var o,i,s,c;if(a(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),s=i[e]),void 0===s)s=i[e]=r,++t._eventsCount;else if("function"==typeof s?s=i[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=l(t))>0&&s.length>o&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,c=u,console&&console.warn&&console.warn(c)}return t}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=u.bind(n);return o.listener=r,n.wrapFn=o,o}function f(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):h(o,o.length)}function m(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function d(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function o(i){n.once&&t.removeEventListener(e,o),r(i)})}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},i.prototype.getMaxListeners=function(){return l(this)},i.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=i[t];if(void 0===l)return!1;if("function"==typeof l)n(l,this,e);else{var c=l.length,u=h(l,c);for(r=0;r<c;++r)n(u[r],this,e)}return!0},i.prototype.addListener=function(t,e){return c(this,t,e,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(t,e){return c(this,t,e,!0)},i.prototype.once=function(t,e){return a(e),this.on(t,p(this,t,e)),this},i.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,p(this,t,e)),this},i.prototype.removeListener=function(t,e){var r,n,o,i,s;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0===--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},i.prototype.listeners=function(t){return f(this,t,!0)},i.prototype.rawListeners=function(t){return f(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},i.prototype.listenerCount=m,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}}};const e={};function r(n){const o=e[n];if(void 0!==o)return o.exports;const i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{if(Array.isArray(e))for(var n=0;n<e.length;){var o=e[n++],i=e[n++];r.o(t,o)?0===i&&n++:0===i?Object.defineProperty(t,o,{enumerable:!0,value:e[n++]}):Object.defineProperty(t,o,{enumerable:!0,get:i})}else for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};let n={};r.d(n,{TinySmartScroller:()=>R});var o={};r.r(o),r.d(o,{iu:()=>l,cq:()=>c,P8:()=>f,BO:()=>m,eh:()=>h,L2:()=>p,lP:()=>u,Kr:()=>a,wE:()=>d,D6:()=>g,PN:()=>A,t_:()=>S,aI:()=>b,ej:()=>w,kx:()=>y,Pd:()=>E,NW:()=>v,Qv:()=>T});var i={};r.r(i),r.d(i,{areElsCollBottom:()=>l,areElsCollLeft:()=>c,areElsCollPerfBottom:()=>f,areElsCollPerfLeft:()=>m,areElsCollPerfRight:()=>h,areElsCollPerfTop:()=>p,areElsCollRight:()=>u,areElsCollTop:()=>a,areElsColliding:()=>d,areElsPerfColliding:()=>g,getElsCollDetails:()=>A,getElsCollDirDepth:()=>S,getElsCollOverlap:()=>b,getElsCollOverlapPos:()=>w,getElsColliding:()=>y,getElsPerfColliding:()=>E,getElsRelativeCenterOffset:()=>v,getRectCenter:()=>T});var s=r(7);const a=(t,e)=>t.bottom<e.top,l=(t,e)=>t.top>e.bottom,c=(t,e)=>t.right<e.left,u=(t,e)=>t.left>e.right,p=(t,e)=>t.bottom<=e.top,f=(t,e)=>t.top>=e.bottom,m=(t,e)=>t.right<=e.left,h=(t,e)=>t.left>=e.right,d=(t,e)=>!(c(t,e)||u(t,e)||a(t,e)||l(t,e)),g=(t,e)=>!(m(t,e)||h(t,e)||p(t,e)||f(t,e)),y=(t,e)=>c(t,e)?"left":u(t,e)?"right":a(t,e)?"top":l(t,e)?"bottom":null,E=(t,e)=>m(t,e)?"left":h(t,e)?"right":p(t,e)?"top":f(t,e)?"bottom":null,b=(t,e)=>({overlapLeft:e.right-t.left,overlapRight:t.right-e.left,overlapTop:e.bottom-t.top,overlapBottom:t.bottom-e.top}),w=({overlapLeft:t=-1,overlapRight:e=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:t<e?"right":"left",dirY:r<n?"bottom":"top"}),T=t=>({x:t.left+t.width/2,y:t.top+t.height/2});function v(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 S(t,e){if(!g(t,e))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=b(t,e),{dirX:s,dirY:a}=w({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),l=Math.min(r,n),c=Math.min(o,i);let u;return u=l<c?s:a,{inDir:u,dirX:s,dirY:a,depthX:l,depthY:c}}function A(t,e){const r=g(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:l,overlapBottom:c}=b(e,t);i.top=l,i.bottom=c,i.left=s,i.right=a;const u=Object.entries(i).filter(([,t])=>t>0).sort((t,e)=>t[1]-e[1]),{dirX:p,dirY:f}=w({overlapLeft:a,overlapRight:s,overlapTop:c,overlapBottom:l});return n.y=f,n.x=p,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":u.length?u[0][0]:"top":null,{dirs:n,depth:i,isNeg:o}}const _=class{#t;get el(){return this.#t}#e={};get settings(){return this.#e}set settings(t){if("object"!=typeof t||null===t)throw new TypeError("settings must be a non-null object.");this.#e=t}#r=null;get observer(){return this.#r}#n=[];get detectors(){return this.#n.map(t=>[t[0],t[1]])}set detectors(t){if(!Array.isArray(t))throw new TypeError("detectors must be an array.");const e=[];for(const[r,n]of t){if("string"!=typeof r)throw new TypeError("Detector name must be a string.");if("function"!=typeof n)throw new TypeError(`Detector handler for "${r}" must be a function.`);e.push([r,n])}this.#n=e}get isActive(){return!!this.#r}get size(){return this.#n.length}constructor(t,{initDetectors:e=[],initCfg:r={}}={}){this.#t=t,e.length&&(this.detectors=e),r&&(this.settings=r)}clear(){this.#n=[]}start(){if(!this.#t)throw new Error("Cannot start observation: no target element has been set.");this.#r||(this.#r=new MutationObserver(t=>{t.forEach((t,e,r)=>this.#n.forEach(n=>n[1](t,e,r)))}),this.#r.observe(this.#t,this.#e))}stop(){this.#r&&(this.#r.disconnect(),this.#r=null)}add(t,e){this.#o(t,e),this.#n.push([t,e])}insertAtStart(t,e){this.#o(t,e),this.#n.unshift([t,e])}insertAt(t,e,r,n="after"){if(this.#o(e,r),"number"!=typeof t||t<0||t>=this.#n.length)throw new RangeError("Invalid index for insertDetectorAt.");const o="before"===n?t:t+1;this.#n.splice(o,0,[e,r])}removeAt(t){if("number"!=typeof t||t<0||t>=this.#n.length)throw new RangeError("Invalid index for removeDetectorAt.");this.#n.splice(t,1)}removeAround(t,e=0,r=0){if("number"!=typeof t||t<0||t>=this.#n.length)throw new RangeError("Invalid index for removeDetectorsAround.");const n=Math.max(0,t-e),o=e+1+r;this.#n.splice(n,o)}isIndexUsed(t){return t>=0&&t<this.#n.length}hasHandler(t){if("function"!=typeof t)throw new TypeError("Handler must be a function.");return this.#n.some(([e,r])=>r===t)}#o(t,e){if("string"!=typeof t||!t.trim())throw new TypeError("Detector name must be a non-empty string.");if("function"!=typeof e)throw new TypeError(`Detector handler for "${t}" must be a function.`)}destroy(){this.stop(),this.clear()}},{wE:x,D6:C,Kr:L,iu:N,cq:D,lP:B}=o,P=new WeakMap,W=new WeakMap,k=new WeakMap,O=new WeakMap,H={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class I{static Utils={...i};static#i=1;static get version(){return this.#i}static#s=!1;static get elemDebug(){return I.#s}static set elemDebug(t){if("boolean"!=typeof t)throw new TypeError("Expected a boolean value for elemDebug");I.#s=t}static _debugElemError(t,e){if(!I.#s)return;const r="[TinyHtml Debug] Element validation error";if(console.groupCollapsed(`${r}${e?" — details below":""}`),console.error(r),"undefined"!=typeof Error&&"function"==typeof Error.captureStackTrace){const t=new Error(r);Error.captureStackTrace(t,I._debugElemError),console.error(t.stack)}else console.trace(r);if(Array.isArray(t)){const e=t.map((t,e)=>({index:e,typeOf:null===t?"null":typeof t,constructor:t?.constructor?.name??(null===t?"null":"primitive"),summary:"undefined"!=typeof Element&&t instanceof Element?`${t.tagName?.toLowerCase?.()??"element"}#${t.id||""}.${String(t.className||"").trim().replace(/\s+/g,".")}`:t&&"object"==typeof t&&"nodeType"in t?`nodeType:${t.nodeType}`:"",value:t}));console.table(e)}else console.warn('[TinyHtml Debug] "elems" is not an array:',t);arguments.length>1&&(console.error("[TinyHtml Debug] Problematic element:",e),e&&"object"==typeof e&&console.dir(e)),console.groupEnd()}static parseStyle(t){const e={};return t.split(";").forEach(t=>{const[r,n]=t.split(":").map(t=>t&&t.trim());r&&n&&(e[r]=n)}),e}static#a="undefined"!=typeof window&&void 0!==window.document?new _(window.document.documentElement,{initDetectors:[["tinyStyleEvent",t=>{if("attributes"!==t.type||"style"!==t.attributeName||!(t.target instanceof HTMLElement))return;const e=t.oldValue||"",r=t.target.getAttribute("style")||"",n=function(t,e){const r={added:{},removed:{},modified:{}};for(const n in t)n in e?t[n]!==e[n]&&(r.modified[n]={old:t[n],new:e[n]}):r.removed[n]=t[n];for(const n in e)n in t||(r.added[n]=e[n]);return r}(I.parseStyle(e),I.parseStyle(r));(Object.keys(n.added).length||Object.keys(n.removed).length||Object.keys(n.modified).length)&&t.target.dispatchEvent(new CustomEvent("tinyhtml.stylechanged",{detail:n}))}],["tinyClassEvent",t=>{if("attributes"!==t.type||"class"!==t.attributeName||!(t.target instanceof HTMLElement))return;const e=t.oldValue||"",r=t.target.className||"",n=function(t,e){const r=t.filter(t=>!e.includes(t));return{added:e.filter(e=>!t.includes(e)),removed:r}}(e.split(/\s+/).filter(Boolean),r.split(/\s+/).filter(Boolean));(n.added.length||n.removed.length)&&t.target.dispatchEvent(new CustomEvent("tinyhtml.classchanged",{detail:n}))}]],initCfg:{attributeOldValue:!0,attributes:!0,subtree:!0,attributeFilter:["style","class"]}}):void 0;static get tinyObserver(){return I.#a}static async fetchHtmlFile(t,e={method:"GET"}){const r=await fetch(t,e),n=r.headers.get("Content-Type")||"";if(!r.ok)throw new Error(`Failed to fetch: ${r.status} ${r.statusText}`);if(!n.includes("text/html"))throw new Error(`Invalid content type: ${n} (expected text/html)`);const o=await r.text();return I.htmlToJson(o)}static async fetchHtmlNodes(t,e){const r=await I.fetchHtmlFile(t,e);return I.jsonToNodes(r)}static async fetchHtmlTinyElems(t,e){const r=await I.fetchHtmlNodes(t,e);return I.toTinyElm(r)}static templateToJson(t){return I.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 I.toTinyElm(I.templateToNodes(t))}static htmlToJson(t){const e=document.createElement("div");e.innerHTML=t.trim();const r=[],n=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[I.getPropName(e.name)]=e.value;const o=Array.from(t.childNodes).map(n).filter(Boolean);return o.length>0?[e,r,...o]:[e,r]};for(const t of e.childNodes){const e=n(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,n,...o]=t,i=document.createElement(r);for(const[t,e]of Object.entries(n))i.setAttribute(I.getAttrName(t),e);for(const t of o){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 I.toTinyElm(I.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=I.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 I(document.createElement(t,e))}static createTextNode(t){if("string"!=typeof t)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new I(document.createTextNode(t))}static createElementFromHTML(t){const e=document.createElement("template");if(!(t=t.trim()).startsWith("<"))return I.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 I(e.content.firstChild)}static createFromHTML(t){const e=document.createElement("template");t=t.trim(),e.innerHTML=t;const r=Array.from(e.content.childNodes);if(!r.every(t=>t instanceof Element||t instanceof Text))throw new Error("The HTML string must contain a valid HTML element.");return new I(r)}static createFromHtml(t){return I.createFromHTML(t)}static query(t,e=document){const r=e.querySelector(t);return r?new I(r):null}querySelector(t){return I.query(t,I._preElem(this,"query"))}static queryAll(t,e=document){return new I(e.querySelectorAll(t))}querySelectorAll(t){return I.queryAll(t,I._preElem(this,"queryAll"))}static getById(t){const e=document.getElementById(t);return e?new I(e):null}static getByClassName(t,e=document){return new I(e.getElementsByClassName(t))}getElementsByClassName(t){return I.getByClassName(t,I._preElem(this,"getByClassName"))}static getByName(t){return new I(document.getElementsByName(t))}static getByTagNameNS(t,e="http://www.w3.org/1999/xhtml",r=document){return new I(r.getElementsByTagNameNS(e,t))}getElementsByTagNameNS(t,e="http://www.w3.org/1999/xhtml"){return I.getByTagNameNS(t,e,I._preElem(this,"getByTagNameNS"))}get elements(){return[...this.#t]}forEach(t){const e=this.elements.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 I(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 I._debugElemError([...this.#t],this.#t[e]),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 I._debugElemError([...this.#t]),new Error(`[TinyHtml] Invalid Element in ${t}().`);return[...this.#t]}static _preElemsTemplate(t,e,r,n){const o=t=>{const o=[];return t.map(i=>(i instanceof I?i._getElements(e):[i]).map(i=>{let s=!1;for(const t of r)if(i instanceof t){s=!0;break}if(!s)throw I._debugElemError([...t],i),new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${e}().`);return o.push(i),i})),o};return Array.isArray(t)?o(t):o([t])}_preElemsTemplate(t,e,r){return I._preElemsTemplate(this,t,e,r)}static _preElemTemplate(t,e,r,n,o=!1){const i=t=>{const i=t[0],s=i instanceof I?i._getElements(e):[i];if(s.length>1)throw I._debugElemError([...t]),new Error(`[TinyHtml] Invalid element amount in ${e}() (Received ${s.length}/1).`);let a=!1;for(const t of r)if(s[0]instanceof t){a=!0;break}if(!o||null!==s[0]&&void 0!==s[0]||(s[0]=null,a=!0),!a)throw I._debugElemError([...t],s[0]),new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${e}().`);return s[0]};if(!Array.isArray(t))return i([t]);if(t.length>1)throw I._debugElemError([...t]),new Error(`[TinyHtml] Invalid element amount in ${e}() (Received ${t.length}/1).`);return i(t)}_preElemTemplate(t,e,r,n=!1){return I._preElemTemplate(this,t,e,r,n)}static _preElems(t,e){return I._preElemsTemplate(t,e,[Element],["Element"])}_preElems(t){return I._preElems(this,t)}static _preElem(t,e){return I._preElemTemplate(t,e,[Element],["Element"])}_preElem(t){return I._preElem(this,t)}static _preNodeElems(t,e){return I._preElemsTemplate(t,e,[Node],["Node"])}_preNodeElems(t){return I._preNodeElems(this,t)}static _preNodeElem(t,e){return I._preElemTemplate(t,e,[Node],["Node"])}_preNodeElem(t){return I._preNodeElem(this,t)}static _preNodeElemWithNull(t,e){return I._preElemTemplate(t,e,[Node],["Node"],!0)}_preNodeElemWithNull(t){return I._preNodeElemWithNull(this,t)}static _preHtmlElems(t,e){return I._preElemsTemplate(t,e,[HTMLElement],["HTMLElement"])}_preHtmlElems(t){return I._preHtmlElems(this,t)}static _preHtmlElem(t,e){return I._preElemTemplate(t,e,[HTMLElement],["HTMLElement"])}_preHtmlElem(t){return I._preHtmlElem(this,t)}static _preInputElems(t,e){return I._preElemsTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}_preInputElems(t){return I._preInputElems(this,t)}static _preInputElem(t,e){return I._preElemTemplate(t,e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}_preInputElem(t){return I._preInputElem(this,t)}static _preEventTargetElems(t,e){return I._preElemsTemplate(t,e,[EventTarget],["EventTarget"])}_preEventTargetElems(t){return I._preEventTargetElems(this,t)}static _preEventTargetElem(t,e){return I._preElemTemplate(t,e,[EventTarget],["EventTarget"])}_preEventTargetElem(t){return I._preEventTargetElem(this,t)}static _preElemsAndWindow(t,e){return I._preElemsTemplate(t,e,[Element,Window],["Element","Window"])}_preElemsAndWindow(t){return I._preElemsAndWindow(this,t)}static _preElemAndWindow(t,e){return I._preElemTemplate(t,e,[Element,Window],["Element","Window"])}_preElemAndWindow(t){return I._preElemAndWindow(this,t)}static _preElemsAndWinAndDoc(t,e){return I._preElemsTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]).map(t=>t instanceof Document?t.documentElement:t)}_preElemsAndWinAndDoc(t){return I._preElemsAndWinAndDoc(this,t)}static _preElemAndWinAndDoc(t,e){const r=I._preElemTemplate(t,e,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}_preElemAndWinAndDoc(t){return I._preElemAndWinAndDoc(this,t)}static _preElemsWithDoc(t,e){return I._preElemsTemplate(t,e,[Element,Document],["Element","Document"])}_preElemsWithDoc(t){return I._preElemsWithDoc(this,t)}static _preElemWithDoc(t,e){return I._preElemTemplate(t,e,[Element,Document],["Element","Document"])}_preElemWithDoc(t){return I._preElemWithDoc(this,t)}static toTinyElm(t){const e=t=>t.map(t=>t instanceof I?t:new I(t));return Array.isArray(t)?e(t):e([t])}static fromTinyElm(t){const e=t=>{const e=[];return t.map(t=>(t instanceof I?t._getElements("fromTinyElm"):[t]).map(t=>e.push(t))),e};return Array.isArray(t)?e(t):e([t])}static winnow(t,e,r,n=!1){if("boolean"!=typeof n)throw new TypeError('The "not" must be a boolean.');if("function"==typeof e)return I._preElems(t,r).filter((t,r)=>!!e.call(t,r,t)!==n);if(e instanceof Element)return I._preElems(t,r).filter(t=>t===e!==n);if(Array.isArray(e)||"string"!=typeof e&&null!=e.length)return I._preElems(t,r).filter(t=>e.includes(t)!==n);let o=e;return n&&(o=`:not(${o})`),I._preElems(t,r).filter(t=>1===t.nodeType&&t.matches(o))}static filter(t,e,r=!1){return r&&(e=`:not(${e})`),I._preElems(t,"filter").filter(t=>1===t.nodeType&&t.matches(e))}static filterOnly(t,e){return I.winnow(t,e,"filterOnly",!1)}static not(t,e){return I.winnow(t,e,"not",!0)}not(t){return I.not(this,t)}static find(t,e){const r=[];for(const n of I._preElems(t,"find"))r.push(...n.querySelectorAll(e));return[...new Set(r)]}find(t){return I.find(this,t)}static is(t,e){return I.winnow(t,e,"is",!1).length>0}is(t){return I.is(this,t)}static has(t,e){const r="string"==typeof e?[...document.querySelectorAll(e)]:I._preElems(e,"has");return I._preElems(t,"has").filter(t=>r.some(e=>t&&t.contains(e)))}has(t){return I.has(this,t)}static closest(t,e,r){const n=[];for(const o of I._preElems(t,"closest")){let t=o;for(;t&&t!==r;){if(1===t.nodeType&&("string"==typeof e?t.matches(e):t===e)){n.push(t);break}t=t.parentElement}}return[...new Set(n)]}closest(t,e){return I.closest(this,t,e)}static isSameDom(t,e){return I._preNodeElem(t,"isSameDom")===I._preNodeElem(e,"isSameDom")}isSameDom(t){return I.isSameDom(this,t)}#l={};get _data(){return{...this.#l}}set _data(t){if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("value must be a non-null object.");this.#l=t}static _dataSelector={public:(t,e)=>{const r=I._preElem(e,t);let n=W.get(r);return n||(n={},W.set(r,n)),n},private:(t,e)=>{if(!(e instanceof I))throw new Error(`Element must be a TinyHtml instance to execute ${t}().`);return e.#l}};static data(t,e,r=!1){const n=I._dataSelector[r?"private":"public"]("data",t);if(null==e)return{...n};if("string"!=typeof e)throw new TypeError("The key must be a string.");return n.hasOwnProperty(e)?n[e]:void 0}data(t,e){return I.data(this,t,e)}static setData(t,e,r,n=!1){const o=I._dataSelector[n?"private":"public"]("setData",t);if("string"!=typeof e)throw new TypeError("The key must be a string.");return void 0!==r?o[e]=r:I.removeData(t,e),t}setData(t,e,r=!1){return I.setData(this,t,e,r)}static hasData(t,e,r=!1){if("string"!=typeof e)throw new TypeError("The key must be a string.");const n=I._dataSelector[r?"private":"public"]("hasData",t);return Object.prototype.hasOwnProperty.call(n,e)}hasData(t,e=!1){return I.hasData(this,t,e)}static removeData(t,e,r=!1){if("string"!=typeof e)throw new TypeError("The key must be a string.");return delete I._dataSelector[r?"private":"public"]("removeData",t)[e]}removeData(t,e=!1){return I.removeData(this,t,e)}static _getSibling(t,e,r){let n=I._preNodeElemWithNull(t,r);for(;n&&(n=n[e])&&1!==n.nodeType;);return n instanceof Node?n:null}static _getSiblings(t,e){let r=t;const n=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==e&&n.push(r);return n}static domDir(t,e,r,n="domDir"){if("string"!=typeof e)throw new TypeError('The "direction" must be a string.');let o=I._preNodeElemWithNull(t,n);const i=[];for(;o&&(o=o[e]);)if(1===o.nodeType){if(r&&("string"==typeof r?o.matches(r):o===r))break;i.push(o)}return i}static parent(t){let e=I._preNodeElemWithNull(t,"parent");const r=e?e.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return I.parent(this)}static parents(t,e){return I.domDir(t,"parentNode",e,"parents")}parents(t){return I.parents(this,t)}static next(t){return I._getSibling(t,"nextSibling","next")}next(){return I.next(this)}static prev(t){return I._getSibling(t,"previousSibling","prev")}prev(){return I.prev(this)}static nextAll(t){return I.domDir(t,"nextSibling",void 0,"nextAll")}nextAll(){return I.nextAll(this)}static prevAll(t){return I.domDir(t,"previousSibling",void 0,"prevAll")}prevAll(){return I.prevAll(this)}static nextUntil(t,e){return I.domDir(t,"nextSibling",e,"nextUtil")}nextUntil(t){return I.nextUntil(this,t)}static prevUntil(t,e){return I.domDir(t,"previousSibling",e,"prevUtil")}prevUntil(t){return I.prevUntil(this,t)}static siblings(t){const e=I._preNodeElemWithNull(t,"siblings");return I._getSiblings(e&&e.parentNode?e.parentNode.firstChild:null,e)}siblings(){return I.siblings(this)}static children(t){const e=I._preNodeElemWithNull(t,"children");return I._getSiblings(e?e.firstChild:null)}children(){return I.children(this)}static contents(t){const e=I._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 I.contents(this)}static clone(t,e=!0){if("boolean"!=typeof e)throw new TypeError('The "deep" must be a boolean.');return I._preNodeElems(t,"clone").map(t=>t.cloneNode(e))}clone(t){return I.clone(this,t)[0]}static _appendChecker(t,...e){const r=[];for(const n of e)if(null!=n&&!1!==n)if("string"!=typeof n&&"number"!=typeof n)if(n instanceof Node||n instanceof I)r.push(...I._preNodeElems(n,t));else if(Array.isArray(n))r.push(...I._appendChecker(t,...n));else for(const e in n){const o=n[e];r.push(...I._appendChecker(t,o))}else r.push(n);return r}static append(t,...e){return I._preElem(t,"append").append(...I._appendChecker("append",...e)),t}append(...t){return I.append(this,...t)}static prepend(t,...e){return I._preElem(t,"prepend").prepend(...I._appendChecker("prepend",...e)),t}prepend(...t){return I.prepend(this,...t)}static before(t,...e){return I._preElem(t,"before").before(...I._appendChecker("before",...e)),t}before(...t){return I.before(this,...t)}static after(t,...e){return I._preElem(t,"after").after(...I._appendChecker("after",...e)),t}after(...t){return I.after(this,...t)}static replaceWith(t,...e){return I._preElem(t,"replaceWith").replaceWith(...I._appendChecker("replaceWith",...e)),t}replaceWith(...t){return I.replaceWith(this,...t)}static appendTo(t,e){const r=I._preNodeElems(t,"appendTo"),n=I._preNodeElems(e,"appendTo");return n.forEach((t,e)=>{r.forEach(r=>t.appendChild(e===n.length-1?r:r.cloneNode(!0)))}),t}appendTo(t){return I.appendTo(this,t)}static prependTo(t,e){const r=I._preElems(t,"prependTo"),n=I._preElems(e,"prependTo");return n.forEach((t,e)=>{r.slice().reverse().forEach(r=>t.prepend(e===n.length-1?r:r.cloneNode(!0)))}),t}prependTo(t){return I.prependTo(this,t)}static insertBefore(t,e,r=null){const n=I._preNodeElem(t,"insertBefore"),o=I._preNodeElem(e,"insertBefore"),i=I._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("The target element has no parent node to insert before.");return o.parentNode.insertBefore(n,i||o),t}insertBefore(t,e){return I.insertBefore(this,t,e)}static insertAfter(t,e,r=null){const n=I._preNodeElem(t,"insertAfter"),o=I._preNodeElem(e,"insertBefore"),i=I._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("The target element has no parent node to insert after.");return o.parentNode.insertBefore(n,i||o.nextSibling),t}insertAfter(t,e){return I.insertAfter(this,t,e)}static replaceAll(t,e){const r=I._preNodeElems(t,"replaceAll"),n=I._preNodeElems(e,"replaceAll");return n.forEach((t,e)=>{const o=t.parentNode;r.forEach(r=>{o&&o.replaceChild(e===n.length-1?r:r.cloneNode(!0),t)})}),t}replaceAll(t){return I.replaceAll(this,t)}#t;get size(){return this.#t.length}static _elCheck(t){for(const e of t)if(!(e instanceof Element||e instanceof Window||e instanceof Document||e instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.")}add(t){return new I([...this.#t,...I._selector(t)])}static _selector(t){if(t instanceof I)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");const e=t=>Array.from(new Set(t)),r="string"!=typeof t?t:document.querySelectorAll(t);if(Array.isArray(r))return I._elCheck(r),e(r);if(r instanceof NodeList||r instanceof HTMLCollection){const t=[...r];return I._elCheck(t),e(t)}{const t=[r];return I._elCheck(t),e(t)}}constructor(t){this.#t=I._selector(t),this.#c=I.#u}static isWindow(t){return null!=t&&t===t.window}static css(t){const e=I._preElem(t,"css");return window.getComputedStyle(e)}css(){return I.css(this)}static cssString(t,e){const r=I._preElem(t,"cssString");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[e];return"string"==typeof n?n:"number"==typeof n?n.toString():null}cssString(t){return I.cssString(this,t)}static cssList(t,e){const r=I._preElem(t,"cssList");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const t of e)void 0!==t&&(o[t]=n.getPropertyValue(t));return o}cssList(t){return I.cssList(this,t)}static cssFloat(t,e){const r=I._preElem(t,"cssFloat");if("string"!=typeof e)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[e];return parseFloat(n)||0}cssFloat(t){return I.cssFloat(this,t)}static cssFloats(t,e){const r=I._preElem(t,"cssFloats");if(!Array.isArray(e))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const t of e)o[t]=parseFloat(n[t])||0;return o}cssFloats(t){return I.cssFloats(this,t)}static#p={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(I.#p,{set:(t,e,r)=>(t[e]=r,I.cssPropRevAliases[r]=e,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(I.#p).map(([t,e])=>[e,t]));static toStyleKc(t){return"string"==typeof I.cssPropAliases[t]?I.cssPropAliases[t]:t}static toStyleCc(t){return"string"==typeof I.cssPropRevAliases[t]?I.cssPropRevAliases[t]:t}static setStyle(t,e,r=null){return I._preHtmlElems(t,"setStyle").forEach(t=>{if("object"==typeof e)for(const[r,n]of Object.entries(e))t.style.setProperty(I.toStyleKc(r),"string"==typeof n?n:"number"==typeof n?`${n}px`:String(n));else t.style.setProperty(I.toStyleKc(e),r)}),t}setStyle(t,e){return I.setStyle(this,t,e)}static getStyle(t,e){return I._preHtmlElem(t,"getStyle").style.getPropertyValue(I.toStyleKc(e))}getStyle(t){return I.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 n=I._preHtmlElem(t,"style"),o={};if(r){const t=(n.getAttribute("style")||"").split(";");for(const r of t){const[t,n]=r.split(":");if(!t||!n)continue;const i=t.trim(),s=n.trim();o[e?I.toStyleCc(i):i]=s}}else{const t=n.style;for(let r=0;r<t.length;r++){const n=t[r],i=t.getPropertyValue(n);o[e?I.toStyleCc(n):n]=i}}return o}style(t){return I.style(this,t)}static removeStyle(t,e){return I._preHtmlElems(t,"removeStyle").forEach(t=>{if(Array.isArray(e))for(const r of e)t.style.removeProperty(I.toStyleKc(r));else t.style.removeProperty(I.toStyleKc(e))}),t}removeStyle(t){return I.removeStyle(this,t)}static toggleStyle(t,e,r,n){return I._preHtmlElems(t,"toggleStyle").forEach(t=>{const o=I.getStyle(t,e).trim()===I.toStyleKc(r)?n:r;I.setStyle(t,e,o)}),t}toggleStyle(t,e,r){return I.toggleStyle(this,t,e,r)}static clearStyle(t){return I._preElems(t,"clearStyle").forEach(t=>t.removeAttribute("style")),t}clearStyle(){return I.clearStyle(this)}static focus(t){return I._preHtmlElem(t,"focus").focus(),t}focus(){return I.focus(this)}static blur(t){return I._preHtmlElem(t,"blur").blur(),t}blur(){return I.blur(this)}static select(t){const e=I._preHtmlElem(t,"select");if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error("Element must be an <input> or <textarea> to use select().");return e.select(),t}select(){return I.select(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.");I.setScrollTop(window,t)}static setWinScrollLeft(t){if("number"!=typeof t)throw new TypeError("The value must be a number.");I.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 n=I._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 o="width"===e?"Width":"Height";if(I.isWindow(n))return"margin"===r?n["inner"+o]:n.document.documentElement["client"+o];const i=n;if(9===i.nodeType){const t=i.documentElement;return Math.max(i.body["scroll"+o],t["scroll"+o],i.body["offset"+o],t["offset"+o],t["client"+o])}let s=i.getBoundingClientRect()[e];function a(t){return"width"===e?I.cssFloat(i,t+"Left")+I.cssFloat(i,t+"Right"):I.cssFloat(i,t+"Top")+I.cssFloat(i,t+"Bottom")}switch(r){case"content":s-=a("padding"),s-=a("border");break;case"padding":s-=a("border");break;case"border":break;case"margin":s+=a("margin")}return s}getDimension(t,e){return I.getDimension(this,t,e)}static setHeight(t,e){const r=I._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 I.setHeight(this,t)}set height(t){I.setHeight(this,t)}static setWidth(t,e){const r=I._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 I.setWidth(this,t)}set width(t){I.setWidth(this,t)}static height(t){const e=I._preElemAndWinAndDoc(t,"height");return I.getDimension(e,"height","content")}get height(){return I.height(this)}static width(t){const e=I._preElemAndWinAndDoc(t,"width");return I.getDimension(e,"width","content")}get width(){return I.width(this)}static innerHeight(t){const e=I._preElemAndWinAndDoc(t,"innerHeight");return I.getDimension(e,"height","padding")}innerHeight(){return I.innerHeight(this)}static innerWidth(t){const e=I._preElemAndWinAndDoc(t,"innerWidth");return I.getDimension(e,"width","padding")}innerWidth(){return I.innerWidth(this)}static outerHeight(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=I._preElemAndWinAndDoc(t,"outerHeight");return I.getDimension(r,"height",e?"margin":"border")}outerHeight(t){return I.outerHeight(this,t)}static outerWidth(t,e=!1){if("boolean"!=typeof e)throw new TypeError('The "includeMargin" must be a boolean.');const r=I._preElemAndWinAndDoc(t,"outerWidth");return I.getDimension(r,"width",e?"margin":"border")}outerWidth(t){return I.outerWidth(this,t)}#c="";get mainDisplay(){return this.#c}set mainDisplay(t){if("string"!=typeof t)throw new TypeError("mainDisplay must be a string.");this.#c=t}static#u="block";static get defaultDisplay(){return I.#u}static set defaultDisplay(t){if("string"!=typeof t)throw new TypeError("defaultDisplay must be a string.");I.#u=t}static getAnimateData(t,e){let r=k.get(t);return r||(r={},k.set(t,r)),r[e]}static setAnimateData(t,e,r){if(!(t instanceof HTMLElement))throw new TypeError("setAnimateData: el must be an HTMLElement.");if("string"!=typeof e)throw new TypeError("setAnimateData: where must be a string.");if("string"!=typeof r&&"number"!=typeof r)throw new TypeError("setAnimateData: value must be a string or number.");let n=k.get(t);n||(n={},k.set(t,n)),n[e]=r}static#f=!0;static get cancelOldStyleFx(){return I.#f}static set cancelOldStyleFx(t){if("boolean"!=typeof t)throw new TypeError("Expected a boolean value.");I.#f=t}static#m={slow:{duration:600,easing:"ease"},fast:{duration:200,easing:"ease-out"},_default:{duration:400,easing:"linear"}};static get styleFxSpeeds(){const t={};for(const e in I.#m){const r=I.#m[e];t[e]="object"==typeof r?{...r}:r}return t}static set styleFxSpeeds(t){if("object"!=typeof t||null===t||Array.isArray(t))throw new TypeError("styleFxSpeeds must be an object.");for(const[e,r]of Object.entries(t))if("number"!=typeof r&&"object"!=typeof r)throw new TypeError(`styleFxSpeeds["${e}"] must be a number or KeyframeAnimationOptions.`);I.#m={};for(const[e,r]of Object.entries(t))I.setStyleFxSpeed(e,r)}static getStyleFxSpeed(t){if("string"!=typeof t)throw new TypeError('The "name" parameter must be a string.');const e=I.#m[t];return"object"==typeof e?{...e}:e}static setStyleFxSpeed(t,e){if("string"!=typeof t)throw new TypeError('The "name" parameter must be a string.');if("number"!=typeof e&&"object"!=typeof e)throw new TypeError("styleFxSpeed must be a number or KeyframeAnimationOptions");I.#m[t]="object"==typeof e?{...e}:e}static deleteStyleFxSpeed(t){if("string"!=typeof t)throw new TypeError('The "name" parameter must be a string.');return delete I.#m[t]}static hasStyleFxSpeed(t){if("string"!=typeof t)throw new TypeError('The "name" parameter must be a string.');return Object.prototype.hasOwnProperty.call(I.#m,t)}static#h=["Top","Right","Bottom","Left"];static#d={slideDown:I.genStyleFx("show"),slideUp:I.genStyleFx("hide"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}};static get styleEffects(){return JSON.parse(JSON.stringify(I.#d))}static set styleEffects(t){if("object"!=typeof t||null===t||Array.isArray(t))throw new TypeError("styleEffects must be an object");for(const e in t)for(const[r,n]of Object.entries(t[e]))if(!("string"==typeof n||Array.isArray(n)&&n.every(t=>"string"==typeof t||"number"==typeof t)))throw new TypeError(`Invalid styleEffect["${r}"]`);I.#d={};for(const e in t)I.setStyleEffect(e,t[e])}static getStyleEffect(t){if("string"!=typeof t)throw new TypeError('The "name" parameter must be a string.');const e=I.#d[t];return e?JSON.parse(JSON.stringify(e)):void 0}static setStyleEffect(t,e){if("string"!=typeof t)throw new TypeError('The "name" parameter must be a string.');if("object"!=typeof e||null===e||Array.isArray(e))throw new TypeError("styleEffect must be an object");const r={};for(const[t,n]of Object.entries(e))if("string"==typeof n)r[t]=n;else{if(!Array.isArray(n)||!n.every(t=>"string"==typeof t||"number"==typeof t))throw new TypeError(`Invalid styleEffect["${t}"]`);r[t]=[...n]}I.#d[t]=r}static deleteStyleEffect(t){if("string"!=typeof t)throw new TypeError('The "name" paramete