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 • 112 kB
JavaScript
(()=>{var e={7(e){"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise(function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}h(e,t,i,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&h(e,"error",t,{once:!0})}(e,o)})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var o,i,s,c;if(a(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),s=i[t]),void 0===s)s=i[t]=r,++e._eventsCount;else if("function"==typeof s?s=i[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=l(e))>0&&s.length>o&&!s.warned){s.warned=!0;var p=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");p.name="MaxListenersExceededWarning",p.emitter=e,p.type=t,p.count=s.length,c=p,console&&console.warn&&console.warn(c)}return e}function p(){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 u(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=p.bind(n);return o.listener=r,n.wrapFn=o,o}function f(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):d(o,o.length)}function m(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function d(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function h(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function o(i){n.once&&e.removeEventListener(t,o),r(i)})}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),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(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return l(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=i[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,p=d(l,c);for(r=0;r<c;++r)n(p[r],this,t)}return!0},i.prototype.addListener=function(e,t){return c(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return c(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,u(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,u(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,o,i,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,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[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),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(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},i.prototype.listenerCount=m,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},975(e,t,r){"use strict";var n=r(606);function o(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var r,n="",o=0,i=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(i===a-1||1===s);else if(i!==a-1&&2===s){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),i=a,s=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=a,s=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),o=a-i-1;i=a,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var s={resolve:function(){for(var e,t="",r=!1,s=arguments.length-1;s>=-1&&!r;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=n.cwd()),a=e),o(a),0!==a.length&&(t=a+"/"+t,r=47===a.charCodeAt(0))}return t=i(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(o(e),0===e.length)return".";var t=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return o(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var r=arguments[t];o(r),r.length>0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":s.normalize(e)},relative:function(e,t){if(o(e),o(t),e===t)return"";if((e=s.resolve(e))===(t=s.resolve(t)))return"";for(var r=1;r<e.length&&47===e.charCodeAt(r);++r);for(var n=e.length,i=n-r,a=1;a<t.length&&47===t.charCodeAt(a);++a);for(var l=t.length-a,c=i<l?i:l,p=-1,u=0;u<=c;++u){if(u===c){if(l>c){if(47===t.charCodeAt(a+u))return t.slice(a+u+1);if(0===u)return t.slice(a+u)}else i>c&&(47===e.charCodeAt(r+u)?p=u:0===u&&(p=0));break}var f=e.charCodeAt(r+u);if(f!==t.charCodeAt(a+u))break;47===f&&(p=u)}var m="";for(u=r+p+1;u<=n;++u)u!==n&&47!==e.charCodeAt(u)||(0===m.length?m+="..":m+="/..");return m.length>0?m+t.slice(a+p):(a+=p,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(o(e),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,n=-1,i=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){n=s;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"//":e.slice(0,n)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');o(e);var r,n=0,i=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,l=-1;for(r=e.length-1;r>=0;--r){var c=e.charCodeAt(r);if(47===c){if(!s){n=r+1;break}}else-1===l&&(s=!1,l=r+1),a>=0&&(c===t.charCodeAt(a)?-1===--a&&(i=r):(a=-1,i=l))}return n===i?i=l:-1===i&&(i=e.length),e.slice(n,i)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!s){n=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":e.slice(n,i)},extname:function(e){o(e);for(var t=-1,r=0,n=-1,i=!0,s=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===n&&(i=!1,n=a+1),46===l?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){r=a+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){o(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,n=e.charCodeAt(0),i=47===n;i?(t.root="/",r=1):r=0;for(var s=-1,a=0,l=-1,c=!0,p=e.length-1,u=0;p>=r;--p)if(47!==(n=e.charCodeAt(p)))-1===l&&(c=!1,l=p+1),46===n?-1===s?s=p:1!==u&&(u=1):-1!==s&&(u=-1);else if(!c){a=p+1;break}return-1===s||-1===l||0===u||1===u&&s===l-1&&s===a+1?-1!==l&&(t.base=t.name=0===a&&i?e.slice(1,l):e.slice(a,l)):(0===a&&i?(t.name=e.slice(1,s),t.base=e.slice(1,l)):(t.name=e.slice(a,s),t.base=e.slice(a,l)),t.ext=e.slice(s,l)),a>0?t.dir=e.slice(0,a-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s},606(e){var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],c=!1,p=-1;function u(){c&&a&&(c=!1,a.length?l=a.concat(l):p=-1,l.length&&f())}function f(){if(!c){var e=s(u);c=!0;for(var t=l.length;t;){for(a=l,l=[];++p<t;)a&&a[p].run();p=-1,t=l.length}a=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function d(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new m(e,t)),1!==l.length||c||s(f)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=d,n.addListener=d,n.once=d,n.off=d,n.removeListener=d,n.removeAllListeners=d,n.emit=d,n.prependListener=d,n.prependOnceListener=d,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}}};const t={};function r(n){const o=t[n];if(void 0!==o)return o.exports;const i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{if(Array.isArray(t))for(var n=0;n<t.length;){var o=t[n++],i=t[n++];r.o(e,o)?0===i&&n++:0===i?Object.defineProperty(e,o,{enumerable:!0,value:t[n++]}):Object.defineProperty(e,o,{enumerable:!0,get:i})}else for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};let n={};(()=>{"use strict";r.d(n,{TinyUploadClicker:()=>U});var e={};r.r(e),r.d(e,{iu:()=>c,cq:()=>p,P8:()=>m,BO:()=>d,eh:()=>h,L2:()=>f,lP:()=>u,Kr:()=>l,wE:()=>g,D6:()=>y,PN:()=>S,t_:()=>A,aI:()=>w,ej:()=>T,kx:()=>E,Pd:()=>b,NW:()=>_,Qv:()=>v});var t={};function o(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e)}r.r(t),r.d(t,{areElsCollBottom:()=>c,areElsCollLeft:()=>p,areElsCollPerfBottom:()=>m,areElsCollPerfLeft:()=>d,areElsCollPerfRight:()=>h,areElsCollPerfTop:()=>f,areElsCollRight:()=>u,areElsCollTop:()=>l,areElsColliding:()=>g,areElsPerfColliding:()=>y,getElsCollDetails:()=>S,getElsCollDirDepth:()=>A,getElsCollOverlap:()=>w,getElsCollOverlapPos:()=>T,getElsColliding:()=>E,getElsPerfColliding:()=>b,getElsRelativeCenterOffset:()=>_,getRectCenter:()=>v});const i="undefined"!=typeof window&&void 0!==window.document,s={items:{},order:[]};function a(e,t){const r=[],n=Array.isArray(e)?e:Object.entries(e);for(const[e,o]of n)if(!s.items.hasOwnProperty(e)){s.items[e]=o;let n="number"==typeof t?t:-1;if(-1===n){const e=s.order.indexOf("object");n=e>-1?e:s.order.length}n=Math.min(Math.max(0,n),s.order.length),s.order.splice(n,0,e),r.push(e)}return r}a([["undefined",e=>void 0===e],["null",e=>null===e],["boolean",e=>"boolean"==typeof e],["number",e=>"number"==typeof e&&!Number.isNaN(e)],["bigint",e=>"bigint"==typeof e],["string",e=>"string"==typeof e],["symbol",e=>"symbol"==typeof e],["function",e=>"function"==typeof e],["array",e=>Array.isArray(e)]]),i&&a([["file",e=>"undefined"!=typeof File&&e instanceof File]]),a([["date",e=>e instanceof Date],["regexp",e=>e instanceof RegExp],["map",e=>e instanceof Map],["set",e=>e instanceof Set],["weakmap",e=>e instanceof WeakMap],["weakset",e=>e instanceof WeakSet],["promise",e=>e instanceof Promise]]),i&&a([["htmlelement",e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement]]),a([["object",e=>o(e)]]),r(975);const l=(e,t)=>e.bottom<t.top,c=(e,t)=>e.top>t.bottom,p=(e,t)=>e.right<t.left,u=(e,t)=>e.left>t.right,f=(e,t)=>e.bottom<=t.top,m=(e,t)=>e.top>=t.bottom,d=(e,t)=>e.right<=t.left,h=(e,t)=>e.left>=t.right,g=(e,t)=>!(p(e,t)||u(e,t)||l(e,t)||c(e,t)),y=(e,t)=>!(d(e,t)||h(e,t)||f(e,t)||m(e,t)),E=(e,t)=>p(e,t)?"left":u(e,t)?"right":l(e,t)?"top":c(e,t)?"bottom":null,b=(e,t)=>d(e,t)?"left":h(e,t)?"right":f(e,t)?"top":m(e,t)?"bottom":null,w=(e,t)=>({overlapLeft:t.right-e.left,overlapRight:e.right-t.left,overlapTop:t.bottom-e.top,overlapBottom:e.bottom-t.top}),T=({overlapLeft:e=-1,overlapRight:t=-1,overlapTop:r=-1,overlapBottom:n=-1}={})=>({dirX:e<t?"right":"left",dirY:r<n?"bottom":"top"}),v=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function _(e,t){const r=e.left+e.width/2,n=e.top+e.height/2;return{x:t.left+t.width/2-r,y:t.top+t.height/2-n}}function A(e,t){if(!y(e,t))return{inDir:null,dirX:null,dirY:null,depthX:0,depthY:0};const{overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}=w(e,t),{dirX:s,dirY:a}=T({overlapLeft:r,overlapRight:n,overlapTop:o,overlapBottom:i}),l=Math.min(r,n),c=Math.min(o,i);let p;return p=l<c?s:a,{inDir:p,dirX:s,dirY:a,depthX:l,depthY:c}}function S(e,t){const r=y(e,t),n={in:null,x:null,y:null},o={y:null,x:null},i={top:0,bottom:0,left:0,right:0},{overlapLeft:s,overlapRight:a,overlapTop:l,overlapBottom:c}=w(t,e);i.top=l,i.bottom=c,i.left=s,i.right=a;const p=Object.entries(i).filter(([,e])=>e>0).sort((e,t)=>e[1]-t[1]),{dirX:u,dirY:f}=T({overlapLeft:a,overlapRight:s,overlapTop:c,overlapBottom:l});return n.y=f,n.x=u,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":p.length?p[0][0]:"top":null,{dirs:n,depth:i,isNeg:o}}const x=class{#e;get el(){return this.#e}#t={};get settings(){return this.#t}set settings(e){if("object"!=typeof e||null===e)throw new TypeError("settings must be a non-null object.");this.#t=e}#r=null;get observer(){return this.#r}#n=[];get detectors(){return this.#n.map(e=>[e[0],e[1]])}set detectors(e){if(!Array.isArray(e))throw new TypeError("detectors must be an array.");const t=[];for(const[r,n]of e){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.`);t.push([r,n])}this.#n=t}get isActive(){return!!this.#r}get size(){return this.#n.length}constructor(e,{initDetectors:t=[],initCfg:r={}}={}){this.#e=e,t.length&&(this.detectors=t),r&&(this.settings=r)}clear(){this.#n=[]}start(){if(!this.#e)throw new Error("Cannot start observation: no target element has been set.");this.#r||(this.#r=new MutationObserver(e=>{e.forEach((e,t,r)=>this.#n.forEach(n=>n[1](e,t,r)))}),this.#r.observe(this.#e,this.#t))}stop(){this.#r&&(this.#r.disconnect(),this.#r=null)}add(e,t){this.#o(e,t),this.#n.push([e,t])}insertAtStart(e,t){this.#o(e,t),this.#n.unshift([e,t])}insertAt(e,t,r,n="after"){if(this.#o(t,r),"number"!=typeof e||e<0||e>=this.#n.length)throw new RangeError("Invalid index for insertDetectorAt.");const o="before"===n?e:e+1;this.#n.splice(o,0,[t,r])}removeAt(e){if("number"!=typeof e||e<0||e>=this.#n.length)throw new RangeError("Invalid index for removeDetectorAt.");this.#n.splice(e,1)}removeAround(e,t=0,r=0){if("number"!=typeof e||e<0||e>=this.#n.length)throw new RangeError("Invalid index for removeDetectorsAround.");const n=Math.max(0,e-t),o=t+1+r;this.#n.splice(n,o)}isIndexUsed(e){return e>=0&&e<this.#n.length}hasHandler(e){if("function"!=typeof e)throw new TypeError("Handler must be a function.");return this.#n.some(([t,r])=>r===e)}#o(e,t){if("string"!=typeof e||!e.trim())throw new TypeError("Detector name must be a non-empty string.");if("function"!=typeof t)throw new TypeError(`Detector handler for "${e}" must be a function.`)}destroy(){this.stop(),this.clear()}},{wE:C,D6:L,Kr:N,iu:k,cq:H,lP:R}=e,D=new WeakMap,I=new WeakMap,O=new WeakMap,P=new WeakMap,W={top:new WeakMap,bottom:new WeakMap,left:new WeakMap,right:new WeakMap};class M{static Utils={...t};static#i=1;static get version(){return this.#i}static#s=!1;static get elemDebug(){return M.#s}static set elemDebug(e){if("boolean"!=typeof e)throw new TypeError("Expected a boolean value for elemDebug");M.#s=e}static _debugElemError(e,t){if(!M.#s)return;const r="[TinyHtml Debug] Element validation error";if(console.groupCollapsed(`${r}${t?" — details below":""}`),console.error(r),"undefined"!=typeof Error&&"function"==typeof Error.captureStackTrace){const e=new Error(r);Error.captureStackTrace(e,M._debugElemError),console.error(e.stack)}else console.trace(r);if(Array.isArray(e)){const t=e.map((e,t)=>({index:t,typeOf:null===e?"null":typeof e,constructor:e?.constructor?.name??(null===e?"null":"primitive"),summary:"undefined"!=typeof Element&&e instanceof Element?`${e.tagName?.toLowerCase?.()??"element"}#${e.id||""}.${String(e.className||"").trim().replace(/\s+/g,".")}`:e&&"object"==typeof e&&"nodeType"in e?`nodeType:${e.nodeType}`:"",value:e}));console.table(t)}else console.warn('[TinyHtml Debug] "elems" is not an array:',e);arguments.length>1&&(console.error("[TinyHtml Debug] Problematic element:",t),t&&"object"==typeof t&&console.dir(t)),console.groupEnd()}static parseStyle(e){const t={};return e.split(";").forEach(e=>{const[r,n]=e.split(":").map(e=>e&&e.trim());r&&n&&(t[r]=n)}),t}static#a="undefined"!=typeof window&&void 0!==window.document?new x(window.document.documentElement,{initDetectors:[["tinyStyleEvent",e=>{if("attributes"!==e.type||"style"!==e.attributeName||!(e.target instanceof HTMLElement))return;const t=e.oldValue||"",r=e.target.getAttribute("style")||"",n=function(e,t){const r={added:{},removed:{},modified:{}};for(const n in e)n in t?e[n]!==t[n]&&(r.modified[n]={old:e[n],new:t[n]}):r.removed[n]=e[n];for(const n in t)n in e||(r.added[n]=t[n]);return r}(M.parseStyle(t),M.parseStyle(r));(Object.keys(n.added).length||Object.keys(n.removed).length||Object.keys(n.modified).length)&&e.target.dispatchEvent(new CustomEvent("tinyhtml.stylechanged",{detail:n}))}],["tinyClassEvent",e=>{if("attributes"!==e.type||"class"!==e.attributeName||!(e.target instanceof HTMLElement))return;const t=e.oldValue||"",r=e.target.className||"",n=function(e,t){const r=e.filter(e=>!t.includes(e));return{added:t.filter(t=>!e.includes(t)),removed:r}}(t.split(/\s+/).filter(Boolean),r.split(/\s+/).filter(Boolean));(n.added.length||n.removed.length)&&e.target.dispatchEvent(new CustomEvent("tinyhtml.classchanged",{detail:n}))}]],initCfg:{attributeOldValue:!0,attributes:!0,subtree:!0,attributeFilter:["style","class"]}}):void 0;static get tinyObserver(){return M.#a}static async fetchHtmlFile(e,t={method:"GET"}){const r=await fetch(e,t),n=r.headers.get("Content-Type")||"";if(!r.ok)throw new Error(`Failed to fetch: ${r.status} ${r.statusText}`);if(!n.includes("text/html"))throw new Error(`Invalid content type: ${n} (expected text/html)`);const o=await r.text();return M.htmlToJson(o)}static async fetchHtmlNodes(e,t){const r=await M.fetchHtmlFile(e,t);return M.jsonToNodes(r)}static async fetchHtmlTinyElems(e,t){const r=await M.fetchHtmlNodes(e,t);return M.toTinyElm(r)}static templateToJson(e){return M.htmlToJson([...e.content.childNodes].map(e=>e instanceof Element?e.getHTML():e instanceof Text?e.textContent:"").join(""))}static templateToNodes(e){const t=[];return[...e.content.cloneNode(!0).childNodes].map(e=>{if(!(e instanceof Element||e instanceof Text||e instanceof Comment))throw new Error(`Expected only Element nodes in <template>, but found: ${e.constructor.name}`);e instanceof Comment||t.push(e)}),t}static templateToTinyElems(e){return M.toTinyElm(M.templateToNodes(e))}static htmlToJson(e){const t=document.createElement("div");t.innerHTML=e.trim();const r=[],n=e=>{if(e instanceof Comment)return null;if(e instanceof Text){const t=e.textContent?.trim();return t||null}if(!(e instanceof Element))return null;const t=e.tagName.toLowerCase(),r={};for(const t of e.attributes)r[M.getPropName(t.name)]=t.value;const o=Array.from(e.childNodes).map(n).filter(Boolean);return o.length>0?[t,r,...o]:[t,r]};for(const e of t.childNodes){const t=n(e);t&&r.push(t)}return t.innerHTML="",r}static jsonToNodes(e){const t=e=>{if("string"==typeof e)return document.createTextNode(e);if(!Array.isArray(e))return document.createTextNode("");const[r,n,...o]=e,i=document.createElement(r);for(const[e,t]of Object.entries(n))i.setAttribute(M.getAttrName(e),t);for(const e of o){const r=t(e);r instanceof Comment||i.appendChild(r)}return i};return e.map(t).filter(e=>!(e instanceof Comment))}static jsonToTinyElems(e){return M.toTinyElm(M.jsonToNodes(e))}static createFrom(e,t){if("string"!=typeof e)throw new TypeError('The "tagName" must be a string.');if(void 0!==t&&"object"!=typeof t)throw new TypeError('The "attrs" must be a object.');const r=M.createElement(e);if("object"==typeof t)for(const e in t)r.setAttr(e,t[e]);return r}static createElement(e,t){if("string"!=typeof e)throw new TypeError("[TinyHtml] createElement(): The tagName must be a string.");if(void 0!==t&&"object"!=typeof t)throw new TypeError("[TinyHtml] createElement(): The ops must be a object.");return new M(document.createElement(e,t))}static createTextNode(e){if("string"!=typeof e)throw new TypeError("[TinyHtml] createTextNode(): The value must be a string.");return new M(document.createTextNode(e))}static createElementFromHTML(e){const t=document.createElement("template");if(!(e=e.trim()).startsWith("<"))return M.createTextNode(e);if(t.innerHTML=e,!(t.content.firstChild instanceof Element))throw new Error("The HTML string must contain a valid HTML element.");return new M(t.content.firstChild)}static createFromHTML(e){const t=document.createElement("template");e=e.trim(),t.innerHTML=e;const r=Array.from(t.content.childNodes);if(!r.every(e=>e instanceof Element||e instanceof Text))throw new Error("The HTML string must contain a valid HTML element.");return new M(r)}static createFromHtml(e){return M.createFromHTML(e)}static query(e,t=document){const r=t.querySelector(e);return r?new M(r):null}querySelector(e){return M.query(e,M._preElem(this,"query"))}static queryAll(e,t=document){return new M(t.querySelectorAll(e))}querySelectorAll(e){return M.queryAll(e,M._preElem(this,"queryAll"))}static getById(e){const t=document.getElementById(e);return t?new M(t):null}static getByClassName(e,t=document){return new M(t.getElementsByClassName(e))}getElementsByClassName(e){return M.getByClassName(e,M._preElem(this,"getByClassName"))}static getByName(e){return new M(document.getElementsByName(e))}static getByTagNameNS(e,t="http://www.w3.org/1999/xhtml",r=document){return new M(r.getElementsByTagNameNS(t,e))}getElementsByTagNameNS(e,t="http://www.w3.org/1999/xhtml"){return M.getByTagNameNS(e,t,M._preElem(this,"getByTagNameNS"))}get elements(){return[...this.#e]}forEach(e){const t=this.elements.map((e,t)=>this.extract(t));for(const r in t)e(t[r],Number(r),t);return this}get(e){if("number"!=typeof e)throw new TypeError("The index must be a number.");if(!this.#e[e])throw new Error(`No element found at index ${e}.`);return this.#e[e]}extract(e){if("number"!=typeof e)throw new TypeError("The index must be a number.");if(!this.#e[e])throw new Error(`Cannot extract: no element exists at index ${e}.`);return new M(this.#e[e])}exists(e){if("number"!=typeof e)throw new TypeError("The index must be a number.");return!!this.#e[e]}getAll(){return[...this.#e]}_getElement(e,t){if(!(this.#e[t]instanceof Element||this.#e[t]instanceof Window||this.#e[t]instanceof Document||this.#e[t]instanceof Text))throw M._debugElemError([...this.#e],this.#e[t]),new Error(`[TinyHtml] Invalid Element in ${e}().`);return this.#e[t]}_getElements(e){if(!this.#e.every(e=>e instanceof Element||e instanceof Window||e instanceof Document||e instanceof Text))throw M._debugElemError([...this.#e]),new Error(`[TinyHtml] Invalid Element in ${e}().`);return[...this.#e]}static _preElemsTemplate(e,t,r,n){const o=e=>{const o=[];return e.map(i=>(i instanceof M?i._getElements(t):[i]).map(i=>{let s=!1;for(const e of r)if(i instanceof e){s=!0;break}if(!s)throw M._debugElemError([...e],i),new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return o.push(i),i})),o};return Array.isArray(e)?o(e):o([e])}_preElemsTemplate(e,t,r){return M._preElemsTemplate(this,e,t,r)}static _preElemTemplate(e,t,r,n,o=!1){const i=e=>{const i=e[0],s=i instanceof M?i._getElements(t):[i];if(s.length>1)throw M._debugElemError([...e]),new Error(`[TinyHtml] Invalid element amount in ${t}() (Received ${s.length}/1).`);let a=!1;for(const e of r)if(s[0]instanceof e){a=!0;break}if(!o||null!==s[0]&&void 0!==s[0]||(s[0]=null,a=!0),!a)throw M._debugElemError([...e],s[0]),new Error(`[TinyHtml] Invalid element of the list "${n.join(",")}" in ${t}().`);return s[0]};if(!Array.isArray(e))return i([e]);if(e.length>1)throw M._debugElemError([...e]),new Error(`[TinyHtml] Invalid element amount in ${t}() (Received ${e.length}/1).`);return i(e)}_preElemTemplate(e,t,r,n=!1){return M._preElemTemplate(this,e,t,r,n)}static _preElems(e,t){return M._preElemsTemplate(e,t,[Element],["Element"])}_preElems(e){return M._preElems(this,e)}static _preElem(e,t){return M._preElemTemplate(e,t,[Element],["Element"])}_preElem(e){return M._preElem(this,e)}static _preNodeElems(e,t){return M._preElemsTemplate(e,t,[Node],["Node"])}_preNodeElems(e){return M._preNodeElems(this,e)}static _preNodeElem(e,t){return M._preElemTemplate(e,t,[Node],["Node"])}_preNodeElem(e){return M._preNodeElem(this,e)}static _preNodeElemWithNull(e,t){return M._preElemTemplate(e,t,[Node],["Node"],!0)}_preNodeElemWithNull(e){return M._preNodeElemWithNull(this,e)}static _preHtmlElems(e,t){return M._preElemsTemplate(e,t,[HTMLElement],["HTMLElement"])}_preHtmlElems(e){return M._preHtmlElems(this,e)}static _preHtmlElem(e,t){return M._preElemTemplate(e,t,[HTMLElement],["HTMLElement"])}_preHtmlElem(e){return M._preHtmlElem(this,e)}static _preInputElems(e,t){return M._preElemsTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}_preInputElems(e){return M._preInputElems(this,e)}static _preInputElem(e,t){return M._preElemTemplate(e,t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLOptionElement],["HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement"])}_preInputElem(e){return M._preInputElem(this,e)}static _preEventTargetElems(e,t){return M._preElemsTemplate(e,t,[EventTarget],["EventTarget"])}_preEventTargetElems(e){return M._preEventTargetElems(this,e)}static _preEventTargetElem(e,t){return M._preElemTemplate(e,t,[EventTarget],["EventTarget"])}_preEventTargetElem(e){return M._preEventTargetElem(this,e)}static _preElemsAndWindow(e,t){return M._preElemsTemplate(e,t,[Element,Window],["Element","Window"])}_preElemsAndWindow(e){return M._preElemsAndWindow(this,e)}static _preElemAndWindow(e,t){return M._preElemTemplate(e,t,[Element,Window],["Element","Window"])}_preElemAndWindow(e){return M._preElemAndWindow(this,e)}static _preElemsAndWinAndDoc(e,t){return M._preElemsTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]).map(e=>e instanceof Document?e.documentElement:e)}_preElemsAndWinAndDoc(e){return M._preElemsAndWinAndDoc(this,e)}static _preElemAndWinAndDoc(e,t){const r=M._preElemTemplate(e,t,[Element,Window,Document],["Element","Window","Document"]);return r instanceof Document?r.documentElement:r}_preElemAndWinAndDoc(e){return M._preElemAndWinAndDoc(this,e)}static _preElemsWithDoc(e,t){return M._preElemsTemplate(e,t,[Element,Document],["Element","Document"])}_preElemsWithDoc(e){return M._preElemsWithDoc(this,e)}static _preElemWithDoc(e,t){return M._preElemTemplate(e,t,[Element,Document],["Element","Document"])}_preElemWithDoc(e){return M._preElemWithDoc(this,e)}static toTinyElm(e){const t=e=>e.map(e=>e instanceof M?e:new M(e));return Array.isArray(e)?t(e):t([e])}static fromTinyElm(e){const t=e=>{const t=[];return e.map(e=>(e instanceof M?e._getElements("fromTinyElm"):[e]).map(e=>t.push(e))),t};return Array.isArray(e)?t(e):t([e])}static winnow(e,t,r,n=!1){if("boolean"!=typeof n)throw new TypeError('The "not" must be a boolean.');if("function"==typeof t)return M._preElems(e,r).filter((e,r)=>!!t.call(e,r,e)!==n);if(t instanceof Element)return M._preElems(e,r).filter(e=>e===t!==n);if(Array.isArray(t)||"string"!=typeof t&&null!=t.length)return M._preElems(e,r).filter(e=>t.includes(e)!==n);let o=t;return n&&(o=`:not(${o})`),M._preElems(e,r).filter(e=>1===e.nodeType&&e.matches(o))}static filter(e,t,r=!1){return r&&(t=`:not(${t})`),M._preElems(e,"filter").filter(e=>1===e.nodeType&&e.matches(t))}static filterOnly(e,t){return M.winnow(e,t,"filterOnly",!1)}static not(e,t){return M.winnow(e,t,"not",!0)}not(e){return M.not(this,e)}static find(e,t){const r=[];for(const n of M._preElems(e,"find"))r.push(...n.querySelectorAll(t));return[...new Set(r)]}find(e){return M.find(this,e)}static is(e,t){return M.winnow(e,t,"is",!1).length>0}is(e){return M.is(this,e)}static has(e,t){const r="string"==typeof t?[...document.querySelectorAll(t)]:M._preElems(t,"has");return M._preElems(e,"has").filter(e=>r.some(t=>e&&e.contains(t)))}has(e){return M.has(this,e)}static closest(e,t,r){const n=[];for(const o of M._preElems(e,"closest")){let e=o;for(;e&&e!==r;){if(1===e.nodeType&&("string"==typeof t?e.matches(t):e===t)){n.push(e);break}e=e.parentElement}}return[...new Set(n)]}closest(e,t){return M.closest(this,e,t)}static isSameDom(e,t){return M._preNodeElem(e,"isSameDom")===M._preNodeElem(t,"isSameDom")}isSameDom(e){return M.isSameDom(this,e)}#l={};get _data(){return{...this.#l}}set _data(e){if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("value must be a non-null object.");this.#l=e}static _dataSelector={public:(e,t)=>{const r=M._preElem(t,e);let n=I.get(r);return n||(n={},I.set(r,n)),n},private:(e,t)=>{if(!(t instanceof M))throw new Error(`Element must be a TinyHtml instance to execute ${e}().`);return t.#l}};static data(e,t,r=!1){const n=M._dataSelector[r?"private":"public"]("data",e);if(null==t)return{...n};if("string"!=typeof t)throw new TypeError("The key must be a string.");return n.hasOwnProperty(t)?n[t]:void 0}data(e,t){return M.data(this,e,t)}static setData(e,t,r,n=!1){const o=M._dataSelector[n?"private":"public"]("setData",e);if("string"!=typeof t)throw new TypeError("The key must be a string.");return void 0!==r?o[t]=r:M.removeData(e,t),e}setData(e,t,r=!1){return M.setData(this,e,t,r)}static hasData(e,t,r=!1){if("string"!=typeof t)throw new TypeError("The key must be a string.");const n=M._dataSelector[r?"private":"public"]("hasData",e);return Object.prototype.hasOwnProperty.call(n,t)}hasData(e,t=!1){return M.hasData(this,e,t)}static removeData(e,t,r=!1){if("string"!=typeof t)throw new TypeError("The key must be a string.");return delete M._dataSelector[r?"private":"public"]("removeData",e)[t]}removeData(e,t=!1){return M.removeData(this,e,t)}static _getSibling(e,t,r){let n=M._preNodeElemWithNull(e,r);for(;n&&(n=n[t])&&1!==n.nodeType;);return n instanceof Node?n:null}static _getSiblings(e,t){let r=e;const n=[];for(;r;r=r.nextSibling)1===r.nodeType&&r!==t&&n.push(r);return n}static domDir(e,t,r,n="domDir"){if("string"!=typeof t)throw new TypeError('The "direction" must be a string.');let o=M._preNodeElemWithNull(e,n);const i=[];for(;o&&(o=o[t]);)if(1===o.nodeType){if(r&&("string"==typeof r?o.matches(r):o===r))break;i.push(o)}return i}static parent(e){let t=M._preNodeElemWithNull(e,"parent");const r=t?t.parentNode:null;return r&&11!==r.nodeType?r:null}parent(){return M.parent(this)}static parents(e,t){return M.domDir(e,"parentNode",t,"parents")}parents(e){return M.parents(this,e)}static next(e){return M._getSibling(e,"nextSibling","next")}next(){return M.next(this)}static prev(e){return M._getSibling(e,"previousSibling","prev")}prev(){return M.prev(this)}static nextAll(e){return M.domDir(e,"nextSibling",void 0,"nextAll")}nextAll(){return M.nextAll(this)}static prevAll(e){return M.domDir(e,"previousSibling",void 0,"prevAll")}prevAll(){return M.prevAll(this)}static nextUntil(e,t){return M.domDir(e,"nextSibling",t,"nextUtil")}nextUntil(e){return M.nextUntil(this,e)}static prevUntil(e,t){return M.domDir(e,"previousSibling",t,"prevUtil")}prevUntil(e){return M.prevUntil(this,e)}static siblings(e){const t=M._preNodeElemWithNull(e,"siblings");return M._getSiblings(t&&t.parentNode?t.parentNode.firstChild:null,t)}siblings(){return M.siblings(this)}static children(e){const t=M._preNodeElemWithNull(e,"children");return M._getSiblings(t?t.firstChild:null)}children(){return M.children(this)}static contents(e){const t=M._preNodeElemWithNull(e,"contents");return t instanceof HTMLIFrameElement&&null!=t.contentDocument&&Object.getPrototypeOf(t.contentDocument)?[t.contentDocument]:t instanceof HTMLTemplateElement?Array.from((t.content||t).childNodes):t?Array.from(t.childNodes):[]}contents(){return M.contents(this)}static clone(e,t=!0){if("boolean"!=typeof t)throw new TypeError('The "deep" must be a boolean.');return M._preNodeElems(e,"clone").map(e=>e.cloneNode(t))}clone(e){return M.clone(this,e)[0]}static _appendChecker(e,...t){const r=[];for(const n of t)if(null!=n&&!1!==n)if("string"!=typeof n&&"number"!=typeof n)if(n instanceof Node||n instanceof M)r.push(...M._preNodeElems(n,e));else if(Array.isArray(n))r.push(...M._appendChecker(e,...n));else for(const t in n){const o=n[t];r.push(...M._appendChecker(e,o))}else r.push(n);return r}static append(e,...t){return M._preElem(e,"append").append(...M._appendChecker("append",...t)),e}append(...e){return M.append(this,...e)}static prepend(e,...t){return M._preElem(e,"prepend").prepend(...M._appendChecker("prepend",...t)),e}prepend(...e){return M.prepend(this,...e)}static before(e,...t){return M._preElem(e,"before").before(...M._appendChecker("before",...t)),e}before(...e){return M.before(this,...e)}static after(e,...t){return M._preElem(e,"after").after(...M._appendChecker("after",...t)),e}after(...e){return M.after(this,...e)}static replaceWith(e,...t){return M._preElem(e,"replaceWith").replaceWith(...M._appendChecker("replaceWith",...t)),e}replaceWith(...e){return M.replaceWith(this,...e)}static appendTo(e,t){const r=M._preNodeElems(e,"appendTo"),n=M._preNodeElems(t,"appendTo");return n.forEach((e,t)=>{r.forEach(r=>e.appendChild(t===n.length-1?r:r.cloneNode(!0)))}),e}appendTo(e){return M.appendTo(this,e)}static prependTo(e,t){const r=M._preElems(e,"prependTo"),n=M._preElems(t,"prependTo");return n.forEach((e,t)=>{r.slice().reverse().forEach(r=>e.prepend(t===n.length-1?r:r.cloneNode(!0)))}),e}prependTo(e){return M.prependTo(this,e)}static insertBefore(e,t,r=null){const n=M._preNodeElem(e,"insertBefore"),o=M._preNodeElem(t,"insertBefore"),i=M._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("The target element has no parent node to insert before.");return o.parentNode.insertBefore(n,i||o),e}insertBefore(e,t){return M.insertBefore(this,e,t)}static insertAfter(e,t,r=null){const n=M._preNodeElem(e,"insertAfter"),o=M._preNodeElem(t,"insertBefore"),i=M._preNodeElemWithNull(r,"insertBefore");if(!o.parentNode)throw new Error("The target element has no parent node to insert after.");return o.parentNode.insertBefore(n,i||o.nextSibling),e}insertAfter(e,t){return M.insertAfter(this,e,t)}static replaceAll(e,t){const r=M._preNodeElems(e,"replaceAll"),n=M._preNodeElems(t,"replaceAll");return n.forEach((e,t)=>{const o=e.parentNode;r.forEach(r=>{o&&o.replaceChild(t===n.length-1?r:r.cloneNode(!0),e)})}),e}replaceAll(e){return M.replaceAll(this,e)}#e;get size(){return this.#e.length}static _elCheck(e){for(const t of e)if(!(t instanceof Element||t instanceof Window||t instanceof Document||t instanceof Text))throw new Error("[TinyHtml] Invalid Target in constructor.")}add(e){return new M([...this.#e,...M._selector(e)])}static _selector(e){if(e instanceof M)throw new Error("[TinyHtml] You are trying to put a TinyHtml inside another TinyHtml in constructor.");const t=e=>Array.from(new Set(e)),r="string"!=typeof e?e:document.querySelectorAll(e);if(Array.isArray(r))return M._elCheck(r),t(r);if(r instanceof NodeList||r instanceof HTMLCollection){const e=[...r];return M._elCheck(e),t(e)}{const e=[r];return M._elCheck(e),t(e)}}constructor(e){this.#e=M._selector(e),this.#c=M.#p}static isWindow(e){return null!=e&&e===e.window}static css(e){const t=M._preElem(e,"css");return window.getComputedStyle(t)}css(){return M.css(this)}static cssString(e,t){const r=M._preElem(e,"cssString");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return"string"==typeof n?n:"number"==typeof n?n.toString():null}cssString(e){return M.cssString(this,e)}static cssList(e,t){const r=M._preElem(e,"cssList");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)void 0!==e&&(o[e]=n.getPropertyValue(e));return o}cssList(e){return M.cssList(this,e)}static cssFloat(e,t){const r=M._preElem(e,"cssFloat");if("string"!=typeof t)throw new TypeError("The prop must be a string.");const n=window.getComputedStyle(r)[t];return parseFloat(n)||0}cssFloat(e){return M.cssFloat(this,e)}static cssFloats(e,t){const r=M._preElem(e,"cssFloats");if(!Array.isArray(t))throw new TypeError("The prop must be an array of strings.");const n=window.getComputedStyle(r),o={};for(const e of t)o[e]=parseFloat(n[e])||0;return o}cssFloats(e){return M.cssFloats(this,e)}static#u={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(M.#u,{set:(e,t,r)=>(e[t]=r,M.cssPropRevAliases[r]=t,!0)});static cssPropRevAliases=Object.fromEntries(Object.entries(M.#u).map(([e,t])=>[t,e]));static toStyleKc(e){return"string"==typeof M.cssPropAliases[e]?M.cssPropAliases[e]:e}static toStyleCc(e){return"string"==typeof M.cssPropRevAliases[e]?M.cssPropRevAliases[e]:e}static setStyle(e,t,r=null){return M._preHtmlElems(e,"setStyle").forEach(e=>{if("object"==typeof t)for(const[r,n]of Object.entries(t))e.style.setProperty(M.toStyleKc(r),"string"==typeof n?n:"number"==typeof n?`${n}px`:String(n));else e.style.setProperty(M.toStyleKc(t),r)}),e}setStyle(e,t){return M.setStyle(this,e,t)}static getStyle(e,t){return M._preHtmlElem(e,"getStyle").style.getPropertyValue(M.toStyleKc(t))}getStyle(e){return M.getStyle(this,e)}static style(e,{camelCase:t=!1,rawAttr:r=!1}={}){if("boolean"!=typeof t)throw new TypeError('"camelCase" must be a boolean. Received: '+typeof t);if("boolean"!=typeof r)throw new TypeError('"rawAttr" must be a boolean. Received: '+typeof r);const n=M._preHtmlElem(e,"style"),o={};if(r){const e=(n.getAttribute("style")||"").split(";");for(const r of e){const[e,n]=r.split(":");if(!e||!n)continue;const i=e.trim(),s=n.trim();o[t?M.toStyleCc(i):i]=s}}else{const e=n.style;for(let r=0;r<e.length;r++){const n=e[r],i=e.getPropertyValue(n);o[t?M.toStyleCc(n):n]=i}}return o}style(e){return M.style(this,e)}static removeStyle(e,t){return M._preHtmlElems(e,"removeStyle").forEach(e=>{if(Array.isArray(t))for(const r of t)e.style.removeProperty(M.toStyleKc(r));else e.style.removeProperty(M.toStyleKc(t))}),e}removeStyle(e){return M.removeStyle(this,e)}static toggleStyle(e,t,r,n){return M._preHtmlElems(e,"toggleStyle").forEach(e=>{const o=M.getStyle(e,t).trim()===M.toStyleKc(r)?n:r;M.setStyle(e,t,o)}),e}toggleStyle(e,t,r){return M.toggleStyle(this,e,t,r)}static clearStyle(e){return M._preElems(e,"clearStyle").forEach(e=>e.removeAttribute("style")),e}clearStyle(){return M.clearStyle(this)}static focus(e){return M._preHtmlElem(e,"focus").focus(),e}focus(){return M.focus(this)}static blur(e){return M._preHtmlElem(e,"blur").blur(),e}blur(){return M.blur(this)}static select(e){const t=M._preHtmlElem(e,"select");if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaEle