/*! ███╗ ███╗███████╗████████╗██████╗ ██████╗ ██╗ ██╗██╗ ████╗ ████║██╔════╝╚══██╔══╝██╔══██╗██╔═══██╗ ██║ ██║██║ ██╔████╔██║█████╗ ██║ ██████╔╝██║ ██║ ██║ ██║██║ ██║╚██╔╝██║██╔══╝ ██║ ██╔══██╗██║ ██║ ██║ ██║██║ ██║ ╚═╝ ██║███████╗ ██║ ██║ ██║╚██████╔╝ ╚██████╔╝██║ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ * Metro UI v5.1.21 Components Library (https://metroui.org.ua) * Build: 10.11.2025, 13:59:31 * Copyright 2012-2025 by Serhii Pimenov * Licensed under MIT */ (() => { var __defProp = Object.defineProperty; var __export = (target, all) => { for (var name2 in all) __defProp(target, name2, { get: all[name2], enumerable: true }); }; // node_modules/@olton/datetime/dist/datetime.js var isNum = (v5) => !isNaN(v5); var DEFAULT_FORMAT = "YYYY-MM-DDTHH:mm:ss.sss"; var INVALID_DATE = "Invalid date"; var REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|m{1,2}|s{1,3}/g; var REGEX_FORMAT_STRFTIME = /(%[a-z])/gi; var DEFAULT_FORMAT_STRFTIME = "%Y-%m-%dT%H:%M:%S.%Q%t"; var DEFAULT_LOCALE = { months: "January February March April May June July August September October November December".split(" "), monthsShort: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "), weekdays: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), weekdaysShort: "Sun Mon Tue Wed Thu Fri Sat".split(" "), weekdaysMin: "Su Mo Tu We Th Fr Sa".split(" "), weekStart: 0 }; var M = { ms: "Milliseconds", s: "Seconds", m: "Minutes", h: "Hours", D: "Date", d: "Day", M: "Month", Y: "FullYear", y: "Year", t: "Time" }; var C = { ms: "ms", s: "second", m: "minute", h: "hour", D: "day", W: "week", d: "weekDay", M: "month", Y: "year", Y2: "year2", t: "time", c: "century", q: "quarter" }; var required = (m5 = "") => { throw new Error("This argument is required!"); }; var isset = (v5, nullable = true) => { try { return nullable ? typeof v5 !== "undefined" : typeof v5 !== "undefined" && v5 !== null; } catch (e2) { return false; } }; var not = (v5) => typeof v5 === "undefined" || v5 === null; var lpad = function(str2, pad, length) { let _str = "" + str2; if (length && _str.length >= length) { return _str; } return Array(length + 1 - _str.length).join(pad) + _str; }; var FormatterSystem = class { constructor() { this.formatters = /* @__PURE__ */ new Map(); this.preprocessors = []; this.postprocessors = []; } // Реєстрація форматера registerFormatter(name2, formatter) { if (this.formatters.has(name2)) { console.warn(`Formatter "${name2}" is already registered. Overriding.`); } this.formatters.set(name2, formatter); } // Видалення форматера unregisterFormatter(name2) { this.formatters.delete(name2); } // Додавання препроцесора (виконується перед форматуванням) addPreprocessor(fn) { this.preprocessors.push(fn); } // Додавання постпроцесора (виконується після форматування) addPostprocessor(fn) { this.postprocessors.push(fn); } // Обробка формату через усі зареєстровані форматери processFormat(instance, format, locale) { let processedFormat = format || DEFAULT_FORMAT; for (const preprocessor of this.preprocessors) { processedFormat = preprocessor(instance, processedFormat, locale) || processedFormat; } for (const [name2, formatter] of this.formatters) { try { processedFormat = formatter(instance, processedFormat, locale) || processedFormat; } catch (error) { console.error(`Error in formatter "${name2}":`, error); } } for (const postprocessor of this.postprocessors) { processedFormat = postprocessor(instance, processedFormat, locale) || processedFormat; } return processedFormat; } // Отримання списку всіх зареєстрованих форматерів getRegisteredFormatters() { return Array.from(this.formatters.keys()); } // Очистка всіх форматерів clear() { this.formatters.clear(); this.preprocessors.length = 0; this.postprocessors.length = 0; } }; var formatterSystem = new FormatterSystem(); var AlignStrategiesSystem = class { constructor() { this.alignStrategies = /* @__PURE__ */ new Map(); this.alignEndStrategies = /* @__PURE__ */ new Map(); this.isInitialized = false; } // Реєстрація стратегії для align registerAlignStrategy(name2, strategy) { if (this.alignStrategies.has(name2)) { console.warn(`Align strategy "${name2}" is already registered. Overriding.`); } this.alignStrategies.set(name2, strategy); } // Реєстрація стратегії для alignEnd registerAlignEndStrategy(name2, strategy) { if (this.alignEndStrategies.has(name2)) { console.warn(`AlignEnd strategy "${name2}" is already registered. Overriding.`); } this.alignEndStrategies.set(name2, strategy); } // Виконання стратегії align executeAlign(date, align) { if (this.alignStrategies.has(align)) { return this.alignStrategies.get(align)(date); } return this.defaultAlign(date, align); } // Виконання стратегії alignEnd executeAlignEnd(date, align) { if (this.alignEndStrategies.has(align)) { return this.alignEndStrategies.get(align)(date); } return this.defaultAlignEnd(date, align); } // Базова логіка align defaultAlign(date, align) { let _date = date.clone ? date.clone() : date; let result, temp; switch (align) { case C.ms: case "ms": result = _date; break; case C.s: case "s": case "second": result = _date.ms(0); break; case C.m: case "m": case "minute": result = this.executeAlign(_date, "s").second(0); break; case C.h: case "h": case "hour": result = this.executeAlign(_date, "m").minute(0); break; case C.D: case "D": case "day": result = this.executeAlign(_date, "h").hour(0); break; case C.M: case "M": case "month": result = this.executeAlign(_date, "D").day(1); break; case C.Y: case "Y": case "year": result = this.executeAlign(_date, "M").month(0); break; case C.W: case "W": case "week": temp = _date.weekDay(); result = this.executeAlign(_date, "D").addDay(-temp); break; default: result = _date; } return result; } // Базова логіка alignEnd defaultAlignEnd(date, align) { let _date = date.clone ? date.clone() : date; let result, temp; switch (align) { case C.ms: case "ms": result = _date; break; case C.s: case "s": case "second": result = _date.ms(999); break; case C.m: case "m": case "minute": result = this.executeAlignEnd(_date, "s").second(59); break; case C.h: case "h": case "hour": result = this.executeAlignEnd(_date, "m").minute(59); break; case C.D: case "D": case "day": result = this.executeAlignEnd(_date, "h").hour(23); break; case C.M: case "M": case "month": result = this.executeAlignEnd(_date, "D").day(1).add(1, "M").add(-1, "D"); break; case C.Y: case "Y": case "year": result = this.executeAlignEnd(_date, "D").month(11).day(31); break; case C.W: case "W": case "week": temp = _date.weekDay(); result = this.executeAlignEnd(_date, "D").addDay(6 - temp); break; default: result = _date; } return result; } // Ініціалізація базових стратегій initializeBuiltInStrategies() { if (this.isInitialized) return; const alignMappings = [ [C.ms, "ms"], [C.s, "s", "second"], [C.m, "m", "minute"], [C.h, "h", "hour"], [C.D, "D", "day"], [C.M, "M", "month"], [C.Y, "Y", "year"], [C.W, "W", "week"] ]; for (const mappings of alignMappings) { const mainKey = mappings[0]; for (const key of mappings) { this.alignStrategies.set(key, (date) => this.defaultAlign(date, mainKey)); this.alignEndStrategies.set(key, (date) => this.defaultAlignEnd(date, mainKey)); } } this.isInitialized = true; } // Отримання списку всіх стратегій getRegisteredAlignStrategies() { return Array.from(this.alignStrategies.keys()); } getRegisteredAlignEndStrategies() { return Array.from(this.alignEndStrategies.keys()); } // Видалення стратегій unregisterAlignStrategy(name2) { this.alignStrategies.delete(name2); } unregisterAlignEndStrategy(name2) { this.alignEndStrategies.delete(name2); } // Очистка всіх стратегій clear() { this.alignStrategies.clear(); this.alignEndStrategies.clear(); this.isInitialized = false; } }; var alignStrategiesSystem = new AlignStrategiesSystem(); var uk_default = { months: "\u0421\u0456\u0447\u0435\u043D\u044C_\u041B\u044E\u0442\u0438\u0439_\u0411\u0435\u0440\u0435\u0437\u0435\u043D\u044C_\u041A\u0432\u0456\u0442\u0435\u043D\u044C_\u0422\u0440\u0430\u0432\u0435\u043D\u044C_\u0427\u0435\u0440\u0432\u0435\u043D\u044C_\u041B\u0438\u043F\u0435\u043D\u044C_\u0421\u0435\u0440\u043F\u0435\u043D\u044C_\u0412\u0435\u0440\u0435\u0441\u0435\u043D\u044C_\u0416\u043E\u0432\u0442\u0435\u043D\u044C_\u041B\u0438\u0441\u0442\u043E\u043F\u0430\u0434_\u0413\u0440\u0443\u0434\u0435\u043D\u044C".split("_"), monthsParental: "\u0421\u0456\u0447\u043D\u044F_\u041B\u044E\u0442\u043E\u0433\u043E_\u0411\u0435\u0440\u0435\u0437\u0435\u043D\u044F_\u041A\u0432\u0456\u0442\u043D\u044F_\u0422\u0440\u0430\u0432\u043D\u044F_\u0427\u0435\u0440\u0432\u043D\u044F_\u041B\u0438\u043F\u043D\u044F_\u0421\u0435\u0440\u043F\u043D\u044F_\u0412\u0435\u0440\u0435\u0441\u043D\u044F_\u0416\u043E\u0432\u0442\u043D\u044F_\u041B\u0438\u0441\u0442\u043E\u043F\u0430\u0434\u0430_\u0413\u0440\u0443\u0434\u043D\u044F".split("_"), monthsShort: "\u0421\u0456\u0447_\u041B\u044E\u0442_\u0411\u0435\u0440_\u041A\u0432\u0456_\u0422\u0440\u0430_\u0427\u0435\u0440_\u041B\u0438\u043F_\u0421\u0435\u0440_\u0412\u0435\u0440_\u0416\u043E\u0432_\u041B\u0438\u0441_\u0413\u0440\u0443".split("_"), weekdays: "\u041D\u0435\u0434\u0456\u043B\u044F_\u041F\u043E\u043D\u0435\u0434\u0456\u043B\u043E\u043A_\u0412\u0456\u0432\u0442\u043E\u0440\u043E\u043A_\u0421\u0435\u0440\u0435\u0434\u0430_\u0427\u0435\u0442\u0432\u0435\u0440_\u041F'\u044F\u0442\u043D\u0438\u0446\u044F_\u0421\u0443\u0431\u043E\u0442\u0430".split("_"), weekdaysShort: "\u041D\u0435\u0434_\u041F\u043E\u043D_\u0412\u0456\u0432_\u0421\u0435\u0440_\u0427\u0435\u0442_\u041F\u0442\u043D_\u0421\u0443\u0431".split("_"), weekdaysMin: "\u041D\u0434_\u041F\u043D_\u0412\u0442_\u0421\u0440_\u0427\u0442_\u041F\u0442_\u0421\u0431".split("_"), weekStart: 1 }; var de_default = { months: "Januar_Februar_M\xE4rz_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"), monthsShort: "Jan_Feb_M\xE4r_Apr_Mai_Jun_Jul_Aug_Sep_Okt_Nov_Dez".split("_"), weekdays: "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"), weekdaysShort: "Son_Mon_Die_Mit_Don_Fre_Sam".split("_"), weekdaysMin: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"), weekStart: 1 }; var originalFormat = function(fmt, locale) { const format = fmt || DEFAULT_FORMAT; const names = Datetime2.getLocale(locale || this.locale); const year = this.year(), year2 = this.year2(), month = this.month(), day = this.day(), weekDay = this.weekDay(); const hour = this.hour(), minute = this.minute(), second = this.second(), ms = this.ms(); const matches2 = { YY: year2, YYYY: year, M: month + 1, MM: lpad(month + 1, 0, 2), MMM: names.monthsShort[month], MMMM: names.months[month], D: day, DD: lpad(day, 0, 2), d: weekDay, dd: names.weekdaysMin[weekDay], ddd: names.weekdaysShort[weekDay], dddd: names.weekdays[weekDay], H: hour, HH: lpad(hour, 0, 2), m: minute, mm: lpad(minute, 0, 2), s: second, ss: lpad(second, 0, 2), sss: lpad(ms, 0, 3) }; return format.replace(REGEX_FORMAT, (match, $1) => $1 || matches2[match]); }; var Datetime2 = class _Datetime { constructor() { const args = [].slice.call(arguments); this.value = new (Function.prototype.bind.apply(Date, [this].concat(args)))(); this.locale = "en"; this.weekStart = _Datetime.locales["en"].weekStart; this.utcMode = false; this.mutable = true; if (!isNum(this.value.getTime())) { throw new Error(INVALID_DATE); } } static locales = { en: DEFAULT_LOCALE, ua: uk_default, de: de_default }; static isDatetime(val) { return val instanceof _Datetime; } static now(asDate = false) { return datetime2()[asDate ? "val" : "time"](); } static parse(str2 = required()) { return datetime2(Date.parse(str2)); } static setLocale(name2 = required(), locale = required()) { _Datetime.locales[name2] = locale; } static getLocale(name2 = "en") { return isset(_Datetime.locales[name2], false) ? _Datetime.locales[name2] : _Datetime.locales["en"]; } static align(date, align) { const _date = datetime2(date); return alignStrategiesSystem.executeAlign(_date, align); } static alignEnd(date, align) { const _date = datetime2(date); return alignStrategiesSystem.executeAlignEnd(_date, align); } immutable(v5) { this.mutable = !(not(v5) ? true : v5); return this; } utc() { if (!this.utcMode) { this.utcMode = true; } return this; } local() { if (this.utcMode) { this.utcMode = false; } return this; } useLocale(val, override) { this.locale = override ? val : !isset(_Datetime.locales[val], false) ? "en" : val; this.weekStart = _Datetime.getLocale(this.locale).weekStart; return this; } clone() { const c5 = datetime2(this.value); c5.locale = this.locale; c5.weekStart = this.weekStart; c5.mutable = this.mutable; c5.utcMode = this.utcMode; return c5; } align(to2) { if (this.mutable) { this.value = _Datetime.align(this, to2).val(); return this; } return this.clone().immutable(false).align(to2).immutable(!this.mutable); } alignEnd(to2) { if (this.mutable) { this.value = _Datetime.alignEnd(this, to2).val(); return this; } return this.clone().immutable(false).alignEnd(to2).immutable(!this.mutable); } val(val) { if (typeof val === "undefined" || val === null) { return this.value; } if (this.mutable) { this.value = typeof val === "string" ? Date.parse(val) : typeof val === "number" ? new Date(val) : val; return this; } return datetime2(val); } year2() { return +("" + this.year()).slice(-2); } /* Get + Set */ _set(m5, v5) { const fn = "set" + (this.utcMode && m5 !== "t" ? "UTC" : "") + M[m5]; if (this.mutable) { this.value[fn](v5); return this; } const clone = this.clone(); clone.value[fn](v5); return clone; } _get(m5) { const fn = "get" + (this.utcMode && m5 !== "t" ? "UTC" : "") + M[m5]; return this.value[fn](); } _work(part, val) { if (!arguments.length || (typeof val === "undefined" || val === null)) { return this._get(part); } return this._set(part, val); } ms(val) { return this._work("ms", val); } second(val) { return this._work("s", val); } minute(val) { return this._work("m", val); } hour(val) { return this._work("h", val); } day(val) { return this._work("D", val); } month(val) { return this._work("M", val); } year(val) { return this._work("Y", val); } time(val) { return this._work("t", val); } weekDay(val) { if (!arguments.length || not(val)) { return this.utcMode ? this.value.getUTCDay() : this.value.getDay(); } const curr = this.weekDay(); const diff = val - curr; return this.add(diff, C.D); } get(unit) { return typeof this[unit] !== "function" ? this : this[unit](); } set(unit, val) { return typeof this[unit] !== "function" ? this : this[unit](val); } add(val, to2) { switch (to2) { case C.h: case "h": case "hour": return this.time(this.time() + val * 60 * 60 * 1e3); case C.m: case "m": case "minute": return this.time(this.time() + val * 60 * 1e3); case C.s: case "s": case "second": return this.time(this.time() + val * 1e3); case C.ms: case "ms": return this.time(this.time() + val); case C.D: case "D": case "day": return this.day(this.day() + val); case C.W: case "W": case "week": return this.day(this.day() + val * 7); case C.M: case "M": case "month": return this.month(this.month() + val); case C.Y: case "Y": case "year": return this.year(this.year() + val); } return this; } addHour(v5) { return this.add(v5, C.h); } addMinute(v5) { return this.add(v5, C.m); } addSecond(v5) { return this.add(v5, C.s); } addMs(v5) { return this.add(v5, C.ms); } addDay(v5) { return this.add(v5, C.D); } addWeek(v5) { return this.add(v5, C.W); } addMonth(v5) { return this.add(v5, C.M); } addYear(v5) { return this.add(v5, C.Y); } format(fmt, locale) { const processedFormat = formatterSystem.processFormat(this, fmt, locale); return originalFormat.call(this, processedFormat, locale); } valueOf() { return this.value.valueOf(); } toString() { return this.value.toString(); } }; alignStrategiesSystem.initializeBuiltInStrategies(); Datetime2.alignStrategies = alignStrategiesSystem; Datetime2.formatters = formatterSystem; var datetime2 = (...args) => args && args[0] instanceof Datetime2 ? args[0] : new Datetime2(...args); var fnFormat = Datetime2.prototype.format; var buddhistMixin = { buddhist() { return this.year() + 543; } }; Datetime2.formatters.registerFormatter("buddhist", (instance, format, locale) => { const matches2 = { BB: (instance.buddhist() + "").slice(-2), BBBB: instance.buddhist() }; return format.replace(/(\[[^\]]+])|B{4}|B{2}/g, (match, $1) => $1 || matches2[match]); }); Object.assign(Datetime2.prototype, buddhistMixin); var createCalendar = (date, iso) => { let _date = date instanceof Datetime2 ? date.clone().align("month") : datetime2(date); let ws = iso === 0 || iso ? iso : date.weekStart; let wd = ws ? _date.isoWeekDay() : _date.weekDay(); let names = Datetime2.getLocale(_date.locale); let now = datetime2(), i3; const getWeekDays = (wd2, ws2) => { if (ws2 === 0) { return wd2; } let su = wd2[0]; return wd2.slice(1).concat([su]); }; const result = { month: names.months[_date.month()], days: [], weekstart: iso ? 1 : 0, weekdays: getWeekDays(names.weekdaysMin, ws), today: now.format("YYYY-MM-DD"), weekends: [], week: [] }; _date.addDay(ws ? -wd + 1 : -wd); for (i3 = 0; i3 < 42; i3++) { result.days.push(_date.format("YYYY-MM-DD")); _date.add(1, "day"); } result.weekends = result.days.filter(function(v5, i22) { const def = [0, 6, 7, 13, 14, 20, 21, 27, 28, 34, 35, 41]; const iso2 = [5, 6, 12, 13, 19, 20, 26, 27, 33, 34, 40, 41]; return ws === 0 ? def.includes(i22) : iso2.includes(i22); }); _date = now.clone(); wd = ws ? _date.isoWeekDay() : _date.weekDay(); _date.addDay(ws ? -wd + 1 : -wd); for (i3 = 0; i3 < 7; i3++) { result.week.push(_date.format("YYYY-MM-DD")); _date.add(1, "day"); } return result; }; Object.assign(Datetime2.prototype, { // 1 - Monday, 0 - Sunday calendar(weekStart) { return createCalendar(this, weekStart); } }); var centuryMixin = { century() { return Math.ceil(this.year() / 100); } }; Datetime2.formatters.registerFormatter("century", (instance, format, locale) => { const matches2 = { C: instance.century() }; return format.replace(/(\[[^\]]+])|C/g, (match, $1) => $1 || matches2[match]); }); Object.assign(Datetime2.prototype, centuryMixin); Object.assign(Datetime2.prototype, { same(d4) { return this.time() === datetime2(d4).time(); }, /* * align: year, month, day, hour, minute, second, ms = default * */ compare(d4, align, operator = "=") { const date = datetime2(d4); const curr = datetime2(this.value); let t1, t2; operator = operator || "="; if (["<", ">", ">=", "<=", "=", "!="].includes(operator) === false) { operator = "="; } align = (align || "ms").toLowerCase(); t1 = curr.align(align).time(); t2 = date.align(align).time(); switch (operator) { case "<": return t1 < t2; case ">": return t1 > t2; case "<=": return t1 <= t2; case ">=": return t1 >= t2; case "=": return t1 === t2; case "!=": return t1 !== t2; } }, between(d1, d22) { return this.younger(d1) && this.older(d22); }, older(date, align) { return this.compare(date, align, "<"); }, olderOrEqual(date, align) { return this.compare(date, align, "<="); }, younger(date, align) { return this.compare(date, align, ">"); }, youngerOrEqual(date, align) { return this.compare(date, align, ">="); }, equal(date, align) { return this.compare(date, align, "="); }, notEqual(date, align) { return this.compare(date, align, "!="); }, diff(d4) { const date = datetime2(d4); const diff = Math.abs(this.time() - date.time()); const diffMonth = Math.abs(this.month() - date.month() + 12 * (this.year() - date.year())); return { "ms": diff, "second": Math.ceil(diff / 1e3), "minute": Math.ceil(diff / (1e3 * 60)), "hour": Math.ceil(diff / (1e3 * 60 * 60)), "day": Math.ceil(diff / (1e3 * 60 * 60 * 24)), "month": diffMonth, "year": Math.floor(diffMonth / 12) }; }, distance(d4, align) { return this.diff(d4)[align]; } }); Object.assign(Datetime2.prototype, { isLeapYear() { const year = this.year(); return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; } }); Object.assign(Datetime2.prototype, { dayOfYear() { const dayCount = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; const month = this.month(); const day = this.day(); return dayCount[month] + day + (month > 1 && this.isLeapYear() ? 1 : 0); } }); Object.assign(Datetime2.prototype, { daysInMonth() { const curr = datetime2(this.value); return curr.add(1, "month").day(1).add(-1, "day").day(); }, daysInYear() { return this.isLeapYear() ? 366 : 365; }, daysInYearMap() { const result = []; const curr = datetime2(this.value); curr.month(0).day(1); for (let i3 = 0; i3 < 12; i3++) { curr.add(1, "month").add(-1, "day"); result.push(curr.day()); curr.day(1).add(1, "month"); } return result; }, daysInYearObj(locale, shortName) { const map = this.daysInYearMap(); const result = {}; const names = Datetime2.getLocale(locale || this.locale); map.forEach((v5, i3) => result[names[shortName ? "monthsShort" : "months"][i3]] = v5); return result; } }); Object.assign(Datetime2.prototype, { decade() { return Math.floor(this.year() / 10) * 10; }, decadeStart() { const decade = this.decade(); const result = this.mutable ? this : this.clone(); return result.year(decade).month(0).day(1); }, decadeEnd() { const decade = this.decade() + 9; const result = this.mutable ? this : this.clone(); return result.year(decade).month(11).day(31); }, decadeOfMonth() { const part = this.clone().add(1, "month").day(1).add(-1, "day").day() / 3; const day = this.day(); if (day <= part) return 1; if (day <= part * 2) return 2; return 3; } }); Object.assign(Datetime2, { from(str2, format, locale) { let norm, normFormat, fItems, dItems; let iMonth, iDay, iYear, iHour, iMinute, iSecond, iMs; let year, month, day, hour, minute, second, ms; let parsedMonth; const getIndex = function(where, what) { return where.map(function(el) { return el.toLowerCase(); }).indexOf(what.toLowerCase()); }; const monthNameToNumber = function(month2) { let i3 = -1; const names = Datetime2.getLocale(locale || "en"); if (not(month2)) return -1; i3 = getIndex(names.months, month2); if (i3 === -1 && typeof names["monthsParental"] !== "undefined") { i3 = getIndex(names["monthsParental"], month2); } if (i3 === -1) { month2 = month2.substr(0, 3); i3 = getIndex(names.monthsShort, month2); } return i3 === -1 ? -1 : i3 + 1; }; const getPartIndex = function(part) { const parts = { "month": ["M", "mm", "%m"], "day": ["D", "dd", "%d"], "year": ["YY", "YYYY", "yy", "yyyy", "%y"], "hour": ["h", "hh", "%h"], "minute": ["m", "mi", "i", "ii", "%i"], "second": ["s", "ss", "%s"], "ms": ["sss"] }; let result = -1, key, index; for (let i3 = 0; i3 < parts[part].length; i3++) { key = parts[part][i3]; index = fItems.indexOf(key); if (index !== -1) { result = index; break; } } return result; }; if (!format) { return datetime2(); } norm = str2.replace(/[\/,.:\s]/g, "-"); normFormat = format.toLowerCase().replace(/[^a-zA-Z0-9%]/g, "-"); fItems = normFormat.split("-"); dItems = norm.split("-"); if (norm.replace(/-/g, "").trim() === "") { throw new Error(INVALID_DATE); } iMonth = getPartIndex("month"); iDay = getPartIndex("day"); iYear = getPartIndex("year"); iHour = getPartIndex("hour"); iMinute = getPartIndex("minute"); iSecond = getPartIndex("second"); iMs = getPartIndex("ms"); if (iMonth > -1 && dItems[iMonth]) { if (isNaN(parseInt(dItems[iMonth]))) { dItems[iMonth] = monthNameToNumber(dItems[iMonth]); if (dItems[iMonth] === -1) { iMonth = -1; } } else { parsedMonth = parseInt(dItems[iMonth]); if (parsedMonth < 1 || parsedMonth > 12) { iMonth = -1; } } } else { iMonth = -1; } year = iYear > -1 && dItems[iYear] ? dItems[iYear] : 0; month = iMonth > -1 && dItems[iMonth] ? dItems[iMonth] : 1; day = iDay > -1 && dItems[iDay] ? dItems[iDay] : 1; hour = iHour > -1 && dItems[iHour] ? dItems[iHour] : 0; minute = iMinute > -1 && dItems[iMinute] ? dItems[iMinute] : 0; second = iSecond > -1 && dItems[iSecond] ? dItems[iSecond] : 0; ms = iMs > -1 && dItems[iMs] ? dItems[iMs] : 0; if (year && year < 100) { year = year < 50 ? 2e3 + parseInt(year) : 1900 + parseInt(year); } else if (year === 0) { year = (/* @__PURE__ */ new Date()).getFullYear(); } return datetime2(year, month - 1, day, hour, minute, second, ms); } }); var hour12Mixin = { ampm(isLowerCase) { let val = this.hour() < 12 ? "AM" : "PM"; return isLowerCase ? val.toLowerCase() : val; }, hour12: function(h3, p5) { let hour = h3; if (arguments.length === 0) { const hour24 = this.hour(); return hour24 % 12 || 12; } p5 = p5 || "am"; if (p5.toLowerCase() === "pm") { hour += 12; } return this.hour(hour); } }; Datetime2.formatters.registerFormatter("hour12", (instance, format, locale) => { const h12 = instance.hour12(); const matches2 = { a: "[" + instance.ampm(true) + "]", A: "[" + instance.ampm(false) + "]", h: h12, hh: lpad(h12, 0, 2) }; return format.replace(/(\[[^\]]+])|a|A|h{1,2}/g, (match, $1) => $1 || matches2[match]); }); Object.assign(Datetime2.prototype, hour12Mixin); var isoMixin = { isoWeekDay(val) { let wd = (this.weekDay() + 6) % 7 + 1; if (!arguments.length || not(val)) { return wd; } return this.addDay(val - wd); } }; Datetime2.alignStrategies.registerAlignStrategy("isoWeek", (date) => { const cloned = date.clone(); const isoDay = cloned.isoWeekDay(); const daysToSubtract = isoDay - 1; return Datetime2.alignStrategies.executeAlign(cloned, "day").addDay(-daysToSubtract); }); Datetime2.alignStrategies.registerAlignEndStrategy("isoWeek", (date) => { const cloned = date.clone(); const isoDay = cloned.isoWeekDay(); const daysToAdd = 7 - isoDay; return Datetime2.alignStrategies.executeAlignEnd(cloned, "day").addDay(daysToAdd); }); Datetime2.formatters.registerFormatter("iso", (instance, format, locale) => { const matches2 = { I: instance.isoWeekDay() }; return format.replace(/(\[[^\]]+])|I{1,2}/g, (match, $1) => $1 || matches2[match]); }); Object.assign(Datetime2.prototype, isoMixin); Object.assign(Datetime2, { max() { let arr = [].slice.call(arguments); return arr.map((el) => datetime2(el)).sort((a2, b5) => b5.time() - a2.time())[0]; } }); Object.assign(Datetime2.prototype, { max() { return Datetime2.max.apply(this, [this].concat([].slice.call(arguments))); } }); Object.assign(Datetime2, { min() { let arr = [].slice.call(arguments); return arr.map((el) => datetime2(el)).sort((a2, b5) => a2.time() - b5.time())[0]; } }); Object.assign(Datetime2.prototype, { min() { return Datetime2.min.apply(this, [this].concat([].slice.call(arguments))); } }); var originalAdd = Datetime2.prototype.add; var quarterMixin = { quarter() { const month = this.month(); if (month <= 2) return 1; if (month <= 5) return 2; if (month <= 8) return 3; return 4; }, add(val, to2) { if (to2 === "quarter") { return this.month(this.month() + val * 3); } return originalAdd.call(this, val, to2); }, addQuarter(v5) { return this.add(v5, "quarter"); } }; Datetime2.alignStrategies.registerAlignStrategy("quarter", (date) => { const cloned = date.clone(); const quarter = cloned.quarter(); const quarterStartMonth = (quarter - 1) * 3; return Datetime2.alignStrategies.executeAlign(cloned, "day").month(quarterStartMonth).day(1); }); Datetime2.alignStrategies.registerAlignEndStrategy("quarter", (date) => { const cloned = date.clone(); const quarter = cloned.quarter(); const quarterEndMonth = quarter * 3 - 1; const endOfQuarter = cloned.month(quarterEndMonth).day(1); const daysInMonth = endOfQuarter.clone().add(1, "month").day(1).add(-1, "day").day(); return Datetime2.alignStrategies.executeAlignEnd(endOfQuarter.day(daysInMonth), "day"); }); Object.assign(Datetime2.prototype, quarterMixin); Object.assign(Datetime2, { sort(arr, opt2) { let result, _arr; const o2 = {}; if (typeof opt2 === "string" || typeof opt2 !== "object" || not(opt2)) { o2.format = DEFAULT_FORMAT; o2.dir = opt2 && opt2.toUpperCase() === "DESC" ? "DESC" : "ASC"; o2.returnAs = "datetime"; } else { o2.format = opt2.format || DEFAULT_FORMAT; o2.dir = (opt2.dir || "ASC").toUpperCase(); o2.returnAs = opt2.format ? "string" : opt2.returnAs || "datetime"; } _arr = arr.map((el) => datetime2(el)).sort((a2, b5) => a2.valueOf() - b5.valueOf()); if (o2.dir === "DESC") { _arr.reverse(); } switch (o2.returnAs) { case "string": result = _arr.map((el) => el.format(o2.format)); break; case "date": result = _arr.map((el) => el.val()); break; default: result = _arr; } return result; } }); var timezoneMixin = { utcOffset() { return this.value.getTimezoneOffset(); }, timezone() { return this.toTimeString().replace(/.+GMT([+-])(\d{2})(\d{2}).+/, "$1$2:$3"); }, timezoneName() { return this.toTimeString().replace(/.+\((.+?)\)$/, "$1"); } }; Datetime2.formatters.registerFormatter("timezone", (instance, format, locale) => { const matches2 = { Z: instance.utcMode ? "Z" : instance.timezone(), ZZ: instance.timezone().replace(":", ""), ZZZ: "[GMT]" + instance.timezone(), z: instance.timezoneName() }; return format.replace(/(\[[^\]]+])|Z{1,3}|z/g, (match, $1) => $1 || matches2[match]); }); Object.assign(Datetime2.prototype, timezoneMixin); var fnFormat2 = Datetime2.prototype.format; var weekNumberCache = /* @__PURE__ */ new Map(); var MILLISECONDS_PER_DAY = 864e5; var CACHE_TTL = 6e4; var CACHE_SIZE = 1e3; var cleanupCache = () => { const now = Date.now(); for (const [key, value] of weekNumberCache.entries()) { if (now - value.timestamp > CACHE_TTL) { weekNumberCache.delete(key); } } }; Object.assign(Datetime2.prototype, { weekNumber(weekStart = 0) { const cacheKey = `${this.time()}_${weekStart}`; const cached = weekNumberCache.get(cacheKey); if (cached && Date.now() - cached.timestamp < CACHE_TTL) { return cached.value; } const year = this.year(); const newYear = datetime2(year, 0, 1); const newYearWeekDay = newYear.weekDay(); const dayOfYear = Math.floor((this.time() - newYear.time() - (this.utcOffset() - newYear.utcOffset()) * 6e4) / MILLISECONDS_PER_DAY) + 1; const adjustedNewYearWeekDay = (newYearWeekDay - weekStart + 7) % 7; let weekNumber; if (adjustedNewYearWeekDay < 4) { weekNumber = Math.floor((dayOfYear + adjustedNewYearWeekDay - 1) / 7) + 1; if (weekNumber > 52) { const nextYear = datetime2(year + 1, 0, 1); const nextYearWeekDay = (nextYear.weekDay() - weekStart + 7) % 7; weekNumber = nextYearWeekDay < 4 ? 1 : 53; } } else { weekNumber = Math.floor((dayOfYear + adjustedNewYearWeekDay - 1) / 7); if (weekNumber === 0) { if (weekStart === 1 && dayOfYear <= 7 - adjustedNewYearWeekDay) { weekNumber = 1; } else { const lastDayPrevYear = datetime2(year - 1, 11, 31); weekNumber = lastDayPrevYear.weekNumber(weekStart); } } } if (weekNumberCache.size > CACHE_SIZE) { cleanupCache(); } weekNumberCache.set(cacheKey, { value: weekNumber, timestamp: Date.now() }); return weekNumber; }, isoWeekNumber() { const cacheKey = `iso_${this.time()}`; if (weekNumberCache.has(cacheKey)) { return weekNumberCache.get(cacheKey); } const d4 = new Date(this.time()); d4.setHours(0, 0, 0, 0); d4.setDate(d4.getDate() + 3 - (d4.getDay() + 6) % 7); const jan4 = new Date(d4.getFullYear(), 0, 4); jan4.setDate(jan4.getDate() + 3 - (jan4.getDay() + 6) % 7); const weekNumber = 1 + Math.round(((d4.getTime() - jan4.getTime()) / MILLISECONDS_PER_DAY - 3 + (jan4.getDay() + 6) % 7) / 7); weekNumberCache.set(cacheKey, weekNumber); return weekNumber; }, weeksInYear(weekStart = 0) { const cacheKey = `weeks_${this.year()}_${weekStart}`; if (weekNumberCache.has(cacheKey)) { return weekNumberCache.get(cacheKey); } const dec28 = datetime2(this.year(), 11, 28); let weekNum = dec28.weekNumber(weekStart); if (weekNum === 1) { weekNum = 52; } weekNumberCache.set(cacheKey, weekNum); return weekNum; }, format: function(format, locale) { format = format || DEFAULT_FORMAT; const hasWeekTokens = /W{1,4}/.test(format); if (!hasWeekTokens) { return fnFormat2.bind(this)(format, locale); } const weekNum = this.weekNumber(); const isoWeekNum = this.isoWeekNumber(); const matches2 = { W: weekNum, WW: lpad(weekNum, 0, 2), WWW: isoWeekNum, WWWW: lpad(isoWeekNum, 0, 2) }; const result = format.replace(/(\[[^\]]+])|W{1,4}/g, (match, $1) => $1 || matches2[match]); return fnFormat2.bind(this)(result, locale); } }); Object.assign(Datetime2.prototype, { strftime(fmt, locale) { const format = fmt || DEFAULT_FORMAT_STRFTIME; const names = Datetime2.getLocale(locale || this.locale); const year = this.year(), year2 = this.year2(), month = this.month(), day = this.day(), weekDay = this.weekDay(); const hour = this.hour(), hour12 = this.hour12(), minute = this.minute(), second = this.second(), ms = this.ms(), time = this.time(); const aDay = lpad(day, 0, 2), aMonth = lpad(month + 1, 0, 2), aHour = lpad(hour, 0, 2), aHour12 = lpad(hour12, 0, 2), aMinute = lpad(minute, 0, 2), aSecond = lpad(second, 0, 2), aMs = lpad(ms, 0, 3); const that = this; const thursday = function() { return datetime2(that.value).day(that.day() - (that.weekDay() + 6) % 7 + 3); }; const matches2 = { "%a": names.weekdaysShort[weekDay], "%A": names.weekdays[weekDay], "%b": names.monthsShort[month], "%h": names.monthsShort[month], "%B": names.months[month], "%c": this.toString().substring(0, this.toString().indexOf(" (")), "%C": this.century(), "%d": aDay, "%D": [aDay, aMonth, year].join("/"), "%e": day, "%F": [year, aMonth, aDay].join("-"), "%G": thursday().year(), "%g": ("" + thursday().year()).slice(2), "%H": aHour, "%I": aHour12, "%j": lpad(this.dayOfYear(), 0, 3), "%k": aHour, "%l": aHour12, "%m": aMonth, "%n": month + 1, "%M": aMinute, "%p": this.ampm(), "%P": this.ampm(true), "%s": Math.round(time / 1e3), "%S": aSecond, "%u": this.isoWeekDay(), "%V": this.isoWeekNumber(), "%w": weekDay, "%x": this.toLocaleDateString(), "%X": this.toLocaleTimeString(), "%y": year2, "%Y": year, "%z": this.timezone().replace(":", ""), "%Z": this.timezoneName(), "%r": [aHour12, aMinute, aSecond].join(":") + " " + this.ampm(), "%R": [aHour, aMinute].join(":"), "%T": [aHour, aMinute, aSecond].join(":"), "%Q": aMs, "%q": ms, "%t": this.timezone() }; return format.replace( REGEX_FORMAT_STRFTIME, (match) => matches2[match] === 0 || matches2[match] ? matches2[match] : match ); } }); Object.assign(Datetime2, { isToday(date) { const d4 = datetime2(date).align("day"); const c5 = datetime2().align("day"); return d4.time() === c5.time(); } }); Object.assign(Datetime2.prototype, { isToday() { return Datetime2.isToday(this); }, today() { const now = datetime2(); if (!this.mutable) { return now; } return this.val(now.val()); } }); Object.assign(Datetime2, { isTomorrow(date) { const d4 = datetime2(date).align("day"); const c5 = datetime2().align("day").add(1, "day"); return d4.time() === c5.time(); } }); Object.assign(Datetime2.prototype, { isTomorrow() { return Datetime2.isTomorrow(this); }, tomorrow() { if (!this.mutable) { return this.clone().immutable(false).add(1, "day").immutable(!this.mutable); } return this.add(1, "day"); } }); Object.assign(Datetime2.prototype, { toDateString() { return this.value.toDateString(); }, toISOString() { return this.value.toISOString(); }, toJSON() { return this.value.toJSON(); }, toGMTString() { return this.value.toGMTString(); }, toLocaleDateString() { return this.value.toLocaleDateString(); }, toLocaleString() { return this.value.toLocaleString(); }, toLocaleTimeString() { return this.value.toLocaleTimeString(); }, toTimeString() { return this.value.toTimeString(); }, toUTCString() { return this.value.toUTCString(); }, toDate() { return new Date(this.value); } }); Object.assign(Datetime2, { timestamp() { return (/* @__PURE__ */ new Date()).getTime() / 1e3; } }); Object.assign(Datetime2.prototype, { unix(val) { let _val; if (!arguments.length || not(val)) { return Math.floor(this.valueOf() / 1e3); } _val = val * 1e3; if (this.mutable) { return this.time(_val); } return datetime2(this.value).time(_val); }, timestamp() { return this.unix(); } }); Object.assign(Datetime2, { isYesterday(date) { const d4 = datetime2(date).align("day"); const c5 = datetime2().align("day").add(-1, "day"); return d4.time() === c5.time(); } }); Object.assign(Datetime2.prototype, { isYesterday() { return Datetime2.isYesterday(this); }, yesterday() { if (!this.mutable) { return this.clone().immutable(false).add(-1, "day").immutable(!this.mutable); } return this.add(-1, "day"); } }); var getResult = (val) => { let res; let seconds = Math.floor(val / 1e3), minutes = Math.floor(seconds / 60), hours = Math.floor(minutes / 60), days = Math.floor(hours / 24), months = Math.floor(days / 30.44), years = Math.floor(months / 12); if (years >= 1) res = `${years} year`; if (months >= 1 && years < 1) res = `${months} mon`; if (days >= 1 && days <= 30) res = `${days} days`; if (hours && hours < 24) res = `${hours} hour`; if (minutes && (minutes >= 40 && minutes < 60)) res = "less a hour"; if (minutes && minutes < 40) res = `${minutes} min`; if (seconds && seconds >= 30 && seconds < 60) res = `${seconds} sec`; if (seconds < 30) res = `few sec`; return res; }; Object.assign(Datetime2, { timeLapse(d4) { let old = datetime2(d4), now = datetime2(), val = now - old; return getResult(val); } }); Object.assign(Datetime2.prototype, { timeLapse() { let val = datetime2() - +this; return getResult(val); } }); var ParseTimeMixin = { parseTime(t) { if (!isNaN(t)) return Math.abs(+t); const pattern = /([0-9]+d)|([0-9]{1,2}h)|([0-9]{1,2}m)|([0-9]{1,2}s)/gm; const match = t.match(pattern); if (!match) return 0; return match.reduce((acc, val) => { let res; if (val.includes("d")) { res = 1e3 * 60 * 60 * 24 * parseInt(val); } else if (val.includes("h")) { res = 1e3 * 60 * 60 * parseInt(val); } else if (val.includes("m")) { res = 1e3 * 60 * parseInt(val); } else if (val.includes("s")) { res = 1e3 * parseInt(val); } return acc + res; }, 0); } }; Object.assign(Datetime2, ParseTimeMixin); Object.assign(Datetime2.prototype, { moon() { const phases = [ "new-moon", "waxing-crescent", "first-quarter", "waxing-gibbous", "full-moon", "waning-gibbous", "last-quarter", "waning-crescent" ]; const phase = () => { let year = this.year(), month = this.month(), day = this.day(); let e2; let jd; let b5; let c5 = e2 = jd = b5 = 0; if (month < 3) { year--; month += 12; } ++month; c5 = 365.25 * year; e2 = 30.6 * month; jd = c5 + e2 + day - 694039.09; jd /= 29.5305882; b5 = parseInt(jd); jd -= b5; b5 = Math.round(jd * 8); if (b5 >= 8) b5 = 0; return { phase: b5, name: phases[b5] }; }; return phase(); } }); var version = "3.3.0"; var build_time = "01.09.2025, 15:52:51"; var info = () => { console.info(`%c Datetime %c v${version} %c ${build_time} `, "color: #ffffff; font-weight: bold; background: #003152", "color: white; background: darkgreen", "color: white; background: #0080fe;"); }; Datetime2.info = info; // source/datetime/index.js Datetime2.correctDate = (date) => datetime2(date).addDay(1).align("day").addMinute((/* @__PURE__ */ new Date()).getTimezoneOffset()); globalThis.Datetime = Datetime2; globalThis.datetime = datetime2; (() => { "use strict"; const MONTHS = [ "january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december" ]; const DAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; const getLocale = Datetime2.getLocale; Datetime2.getLocale = function(locale = "en") { let _locale = locale; if (!Metro) { return getLocale.call(this, locale); } if (!Metro.locales[_locale]) { _locale = "en"; } const data = Metro.locales[_locale]; const months = MONTHS.map((el, i3) => data[el]); const monthsShort = MONTHS.map((el, i3) => data[`${el}_short`]); const weekdays = DAYS.map((el, i3) => data[el]); const weekdaysShort = DAYS.map((el, i3) => data[`${el}_short`]); const weekdaysMin = DAYS.map((el, i3) => data[`${el}_short_2`]); return { months, monthsShort, weekdays, weekdaysShort, weekdaysMin, weekStart: data.weekStart }; }; })(); // node_modules/@olton/string/dist/string.js var pr = Object.defineProperty; var ar = (r2, t) => { for (var e2 in t) pr(r2, e2, { get: t[e2], enumerable: true }); }; var qt = {}; ar(qt, { append: () => Xt, camelCase: () => z, capitalize: () => F, chars: () => c, count: () => tt, countChars: () => W, countSubstr: () => rt, countUniqueChars: () => O, countUniqueWords: () => er, countWords: () => rr, dashedName: () => H, decapitalize: () => U, endsWith: () => gt, escapeHtml: () => et, first: () => st, includes: () => wt, insert: () => ht, isAlpha: () => xt, isAlphaDigit: () => _t, isBlank: () => Et, isDigit: () => dt, isEmpty: () => X, isLower: () => At, isString: () => Tt, isUpper: () => St, kebab: () => Z, last: () => nt, lower: () => R, lpad: () => ft, ltrim: () => M2, matches: () => Gt, nvl: () => Bt, pad: () => ct, prepend: () => kt, prune: () => lt, repeat: () => x, reverse: () => K, rpad: () => mt, rtrim: () => q, shorten: () => Lt, shuffle: () => J, slice: () => at, snake: () => Y, split: () => yt, sprintf: () => w, startsWith: () => bt, strip: () => Ct, stripBoom: () => Pt, stripTags: () => Rt, stripTagsAll: () => Ft, substring: () => m, swap: () => V, title: () => Q, trim: () => _, truncate: () => j, truncateWithAlign: () => pt, unescapeHtml: () => ot, unique: () => ut, uniqueWords: () => it, upper: () => G2, vsprintf: () => vt, words: () => a, wrap: () => It, wrapTag: () => Dt }); var $2 = "\\d"; var L = "\\s\\uFEFF\\xA0"; var E = "\\uD800-\\uDBFF"; var A = "\\uDC00-\\uDFFF"; var b = "\\u0300-\\u036F\\u1AB0-\\u1AFF\\u1DC0-\\u1DFF\\u20D0-\\u20FF\\uFE20-\\uFE2F"; var Wt = "\\0-\\u02FF\\u0370-\\u1AAF\\u1B00-\\u1DBF\\u1E00-\\u20CF\\u2100-\\uD7FF\\uE000-\\uFE1F\\uFE30-\\uFFFF"; var $t = "\\u2000-\\u206F"; var zt = "\\x00-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7b-\\xBF\\xD7\\xF7"; var Ht = "\\u2700-\\u27BF"; var B = "a-z\\xB5\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F"; var N = "\\x41-\\x5a\\xc0-\\xd6\\xd8-\\xde\\u0100\\u0102\\u0104\\u0106\\u0108\\u010a\\u010c\\u010e\\u0110\\u0112\\u0114\\u0116\\u0118\\u011a\\u011c\\u011e\\u0120\\u0122\\u0124\\u0126\\u0128\\u012a\\u012c\\u012e\\u0130\\u0132\\u0134\\u0136\\u0139\\u013b\\u013d\\u013f\\u0141\\u0143\\u0145\\u0147\\u014a\\u014c\\u014e\\u0150\\u0152\\u0154\\u0156\\u0158\\u015a\\u015c\\u015e\\u0160\\u0162\\u0164\\u0166\\u0168\\u016a\\u016c\\u016e\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017b\\u017d\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018b\\u018e-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019c\\u019d\\u019f\\u01a0\\u01a2\\u01a4\\u01a6\\u01a7\\u01a9\\u01ac\\u01ae\\u01af\\u01b1-\\u01b3\\u01b5\\u01b7\\u01b8\\u01bc\\u01c4\\u01c5\\u01c7\\u01c8\\u01ca\\u01cb\\u01cd\\u01cf\\u01d1\\u01d3\\u01d5\\u01d7\\u01d9\\u01db\\u01de\\u01e0\\u01e2\\u01e4\\u01e6\\u01e8\\u01ea\\u01ec\\u01ee\\u01f1\\u01f2\\u01f4\\u01f6-\\u01f8\\u01fa\\u01fc\\u01fe\\u0200\\u0202\\u0204\\u0206\\u0208\\u020a\\u020c\\u020e\\u0210\\u0212\\u0214\\u0216\\u0218\\u021a\\u021c\\u021e\\u0220\\u0222\\u0224\\u0226\\u0228\\u022a\\u022c\\u022e\\u0230\\u0232\\u023a\\u023b\\u023d\\u023e\\u0241\\u0243-\\u0246\\u0248\\u024a\\u024c\\u024e"; var vr = new RegExp("([" + Wt + "]|[" + E + "][" + A + "]|[" + E + "](?![" + A + "])|(?:[^" + E + "]|^)[" + A + "])([" + b + "]+)", "g"); var wr = new RegExp("([" + E + "])([" + A + "])", "g"); var yr = new RegExp("((?:[" + Wt + "]|[" + E + "][" + A + "]|[" + E + "](?![" + A + "])|(?:[^" + E + "]|^)[" + A + "])(?:[" + b + "]+))|([" + E + "][" + A + "])|([\\n\\r\\u2028\\u2029])|(.)", "g"); var Cr = new RegExp("[" + L + "]"); var Ut = new RegExp("^[" + L + "]+"); var Zt = new RegExp("[" + L + "]+$"); var Kt = new RegExp("^" + $2 + "+$"); var Jt = /[<>&"'`]/g; var Yt = /(<([^>]+)>)/ig; var D = new RegExp("(?:[" + N + "][" + b + "]*)?(?:[" + B + "][" + b + "]*)+|(?:[" + N + "][" + b + "]*)+(?![" + B + "])|[" + $2 + "]+|[" + Ht + "]|[^" + zt + $t + L + "]+", "g"); var I = /[A-Z\xC0-\xD6\xD8-\xDE]?[a-z\xDF-\xF6\xF8-\xFF]+|[A-Z\xC0-\xD6\xD8-\xDE]+(?![a-z\xDF-\xF6\xF8-\xFF])|\d+/g; var Vt = new RegExp("^(?:[" + B + N + "][" + b + "]*)+$"); var Qt = new RegExp("^((?:[" + B + N + "][" + b + "]*)|[" + $2 + "])+$"); var T = /^[\x01-\xFF]*$/; var u = (r2, t = "") => !r2 && typeof r2 != "number" && typeof r2 != "boolean" ? t : typeof r2 == "string" ? r2 : Array.isArray(r2) ? r2.join("") : JSON.stringify(r2); var Ot = (r2, t) => typeof r2 > "u" || r2 === null ? t : r2; var a = (r2, t, e2) => { let i3; return t ? t instanceof RegExp ? i3 = t : i3 = new RegExp(t, Ot(e2, "")) : i3 = T.test(r2) ? I : D, Ot(u(r2).match(i3), []); }; var F = (r2, t = false) => { let e2 = u(r2), i3 = e2.substring(1); return e2.substring(0, 1).toUpperCase() + (t ? i3.toLowerCase() : i3); }; var z = (r2) => a(u(r2)).map((t, e2) => e2 === 0 ? t.toLowerCase() : F(t)).join(""); var H = (r2) => a(u(r2)).map((t) => t.toLowerCase()).join("-"); var U = (r2) => { let t = u(r2); return t.substring(0, 1).toLowerCase() + t.substr(1); }; var Z = (r2, t = "-") => a(u(r2)).map((e2) => e2.toLowerCase()).join(t); var R = (r2) => u(r2).toLowerCase(); var c = (r2, t = []) => u(r2).split("").filter((e2) => !t.includes(e2)); var K = (r2, t) => c(u(r2), t).reverse().join(""); var tr = (r2 = []) => { let t = [...r2], e2 = t.length, i3, o2; for (; e2 !== 0; ) o2 = Math.floor(Math.random() * e2), e2 -= 1, i3 = t[e2], t[e2] = t[o2], t[o2] = i3; return t; }; var J = (r2) => tr(u(r2).split("")).join(""); var Y = (r2) => a(u(r2)).map((t) => t.toLowerCase()).join("_"); var lr = (r2, t) => { let e2 = t.toLowerCase(), i3 = t.toUpperCase(); return r2 + (t === e2 ? i3 : e2); }; var V = (r2) => u(r2).split("").reduce(lr, ""); var Q = (r2, t, e2 = "") => { let i3 = u(r2), o2 = T.test(i3) ? I : D, n3 = Array.isArray(t) ? t : typeof t != "string" ? [] : t.split(e2); return r2.replace(o2, (s2, p5) => p5 && n3.includes(i3[p5 - 1]) ? R(s2) : F(s2)); }; var G2 = (r2) => u(r2).toUpperCase(); var tt = (r2) => u(r2).length; var v = (r2 = []) => { let t = [...r2]; for (let e2 = 0; e2 < t.length; ++e2) for (let i3 = e2 + 1; i3 < t.length; ++i3) t[e2] === t[i3] && t.splice(i3--, 1); return t; }; var W = (r2, t) => c(r2, t).length; var O = (r2, t) => v(c(r2, t)).length; var rt = (r2, t = "") => { let e2 = u(r2), i3 = u(t); return e2 === "" || i3 === "" ? 0 : e2.split(i3).length - 1; }; var rr = (r2, t, e2) => a(r2, t, e2).length; var er = (r2, t, e2) => v(a(r2, t, e2)).length; var fr = { "<": "<", ">": ">", "&": "&", '"': """, "'": "'", "`": "`" }; function mr(r2) { return fr[r2]; } var et = (r2) => u(r2).replace(Jt, mr); var or = { "<": /(<)|(�*3c;)|(�*60;)/gi, ">": /(>)|(�*3e;)|(�*62;)/gi, "&": /(&)|(�*26;)|(�*38;)/gi, '"': /(")|(�*22;)|(�*34;)/gi, "'": /(�*27;)|(�*39;)/gi, "`": /(�*60;)|(�*96;)/gi }; var cr = Object.keys(or); function hr(r2, t) { return r2.replace(or[t], t); } var ot = (r2) => cr.reduce(hr, u(r2)); var ut = (r2, t) => v(c(r2, t)).join(""); var it = (r2, t, e2) => v(a(r2, t, e2)).join(""); var m = (r2, t, e2) => u(r2).substring(t, e2); var st = (r2, t = 0) => m(u(r2), 0, t); var nt = (r2, t = 0) => { let e2 = u(r2); return e2 ? m(e2, e2.length - t) : ""; }; var ur = "\uFEFF"; var S = (r2, t, e2 = 9007199254740991) => r2 < t ? t : r2 > e2 ? e2 : r2; var g = (r2) => r2 === 1 / 0 ? 9007199254740991 : r2 === -1 / 0 ? -9007199254740991 : ~~r2; var j = (r2, t = 0, e2 = "...") => { let i3 = u(r2), o2 = t ? S(g(t), 0, 9007199254740991) : i3.length; return m(i3, 0, o2) + (i3.length === o2 ? "" : e2); }; var pt = (r2, t = 0, e2 = "...") => { let i3 = j(r2, t, ""); return i3.slice(r2, i3.lastIndexOf(" ")) + e2; }; var at = (r2, t = 1) => { let e2 = u(r2), i3 = [], o2 = Math.round(e2.length / t); for (let n3 = 0; n3 < t; n3++) i3.push(m(e2, n3 * o2, o2)); return i3; }; var lt = (r2, t = 0, e2 = "") => { let i3 = u(r2), o2 = t ? S(g(t), 0, 9007199254740991) : i3.length, n3 = 0, s2 = T.test(i3) ? I : D; return i3.replace(s2, (p5, h3) => { let d4 = h3 + p5.length; d4 <= o2 - e2.length && (n3 = d4); }), i3.substring(0, n3) + e2; }; var x = (r2, t = 0) => { let e2 = u(r2), i3 = t ? S(g(t), 0, 9007199254740991) : e2.length, o2 = e2; if (t === 0) return ""; for (let n3 = 0; n3 < i3 - 1; n3++) e2 += o2; return e2; }; var jt = (r2, t = 0) => { let e2 = r2.length, i3 = t - e2; return x(r2, i3 + 1).substring(0, t); }; var ir = (r2, t = "", e2 = 0, i3 = false) => { let o2 = u(r2), n3 = e2 ? S(g(e2), 0, 9007199254740991) : o2.length, s2 = t.length, p5 = n3 - o2.length, h3 = p5; if (p5 <= 0 || s2 === 0) return o2; let d4 = jt(t, h3); return i3 ? d4 + o2 : o2 + d4; }; var ft = (r2, t = " ", e2 = 0) => ir(r2, t, e2, true); var mt = (r2, t = " ", e2 = 0) => ir(r2, t, e2, false); var ct = (r2, t = "", e2 = 0) => { let i3 = u(r2), o2 = e2 ? S(g(e2), 0, 9007199254740991) : i3.length, n3 = t.length, s2 = o2 - i3.length, p5 = g(s2 / 2), h3 = s2 % 2; return s2 <= 0 || n3 === 0 ? i3 : jt(t, p5) + i3 + jt(t, p5 + h3); }; var ht = (r2, t = "", e2 = 0) => { let i3 = u(r2); return i3.substring(0, e2) + t + i3.substring(e2); }; var gr = Array.prototype.reduce; var xr = Array.prototype.reduceRight; var _ = (r2, t) => M2(q(r2, t), t); var M2 = (r2, t) => { let e2 = u(r2); if (!t) return e2.replace(Ut, ""); if (t === "" || e2 === "") return e2; typeof t != "string" && (t = ""); let i3 = true; return gr.call(e2, (o2, n3) => i3 && t.includes(n3) ? o2 : (i3 = false, o2 + n3), ""); }; var q = (r2, t) => { let e2 = u(r2); if (!t) return e2.replace(Zt, ""); if (t === "" || e2 === "") return e2; typeof t != "string" && (t = ""); let i3 = true; return xr.call(e2, (o2, n3) => i3 && t.includes(n3) ? o2 : (i3 = false, n3 + o2), ""); }; var gt = (r2, t, e2) => u(r2).endsWith(t, e2); var xt = (r2) => Vt.test(u(r2)); var _t = (r2) => Qt.test(u(r2)); var dt = (r2) => Kt.test(u(r2)); var Et = (r2, t = true) => t ? u(r2).length === 0 : _(r2).length === 0; var X = (r2) => _(r2).length === 0; var At = (r2) => R(r2) === r2; var St = (r2) => G2(r2) === r2; var bt = (r2, t, e2) => u(r2).startsWith(t, e2); var Ft = (r2) => u(r2).replace(Yt, ""); var Rt = (r2, t = []) => { let e2 = u(r2), i3 = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi; return e2.replace(i3, (o2, n3) => t.includes(n3) ? o2 : ""); }; var f = { not_string: /[^s]/, not_bool: /[^t]/, not_type: /[^T]/, not_primitive: /[^v]/, number: /[diefg]/, numeric_arg: /[bcdiefguxX]/, json: /[j]/, not_json: /[^j]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, sign: /^[+-]/ }; function _r(r2, t) { let e2 = 1, i3 = r2.length, o2, n3 = "", s2, p5, h3, d4, Nt2, y4; for (let C5 = 0; C5 < i3; C5++) if (typeof r2[C5] == "string") n3 += r2[C5]; else if (typeof r2[C5] == "object") { if (s2 = r2[C5], s2.keys) { o2 = t[e2]; for (let P4 = 0; P4 < s2.keys.length; P4++) { if (typeof o2 > "u") throw new Error(w('[sprintf] Cannot access property "%s" of undefined value "%s"', s2.keys[P4], s2.keys[P4 - 1])); o2 = o2[s2.keys[P4]]; } } else s2.param_no ? o2 = t[s2.param_no] : o2 = t[e2++]; if (f.not_type.test(s2.type) && f.not_primitive.test(s2.type) && o2 instanceof Function && (o2 = o2()), f.numeric_arg.test(s2.type) && typeof o2 != "number" && isNaN(o2)) throw new TypeError(w("[sprintf] expecting number but found %T", o2)); switch (f.number.test(s2.type) && (Nt2 = o2 >= 0), s2.type) { case "b": o2 = parseInt(o2, 10).toString(2); break; case "c": o2 = String.fromCharCode(parseInt(o2, 10)); break; case "d": case "i": o2 = parseInt(o2, 10); break; case "j": o2 = JSON.stringify(o2, null, s2.width ? parseInt(s2.width) : 0); break; case "e": o2 = s2.precision ? parseFloat(o2).toExponential(s2.precision) : parseFloat(o2).toExponential(); break; case "f": o2 = s2.precision ? parseFloat(o2).toFixed(s2.precision) : parseFloat(o2); break; case "g": o2 = s2.precision ? String(Number(o2.toPrecision(s2.precision))) : parseFloat(o2); break; case "o": o2 = (parseInt(o2, 10) >>> 0).toString(8); break; case "s": o2 = String(o2), o2 = s2.precision ? o2.substring(0, s2.precision) : o2; break; case "t": o2 = String(!!o2), o2 = s2.precision ? o2.substring(0, s2.precision) : o2; break; case "T": o2 = Object.prototype.toString.call(o2).slice(8, -1).toLowerCase(), o2 = s2.precision ? o2.substring(0, s2.precision) : o2; break; case "u": o2 = parseInt(o2, 10) >>> 0; break; case "v": o2 = o2.valueOf(), o2 = s2.precision ? o2.substring(0, s2.precision) : o2; break; case "x": o2 = (parseInt(o2, 10) >>> 0).toString(16); break; case "X": o2 = (parseInt(o2, 10) >>> 0).toString(16).toUpperCase(); break; } f.json.test(s2.type) ? n3 += o2 : (f.number.test(s2.type) && (!Nt2 || s2.sign) ? (y4 = Nt2 ? "+" : "-", o2 = o2.toString().replace(f.sign, "")) : y4 = "", h3 = s2.pad_char ? s2.pad_char === "0" ? "0" : s2.pad_char.charAt(1) : " ", d4 = s2.width - (y4 + o2).length, p5 = s2.width && d4 > 0 ? h3.repeat(d4) : "", n3 += s2.align ? y4 + o2 + p5 : h3 === "0" ? y4 + p5 + o2 : p5 + y4 + o2); } return n3; } var Mt = /* @__PURE__ */ Object.create(null); function dr(r2) { if (Mt[r2]) return Mt[r2]; let t = r2, e2, i3 = [], o2 = 0; for (; t; ) { if ((e2 = f.text.exec(t)) !== null) i3.push(e2[0]); else if ((e2 = f.modulo.exec(t)) !== null) i3.push("%"); else if ((e2 = f.placeholder.exec(t)) !== null) { if (e2[2]) { o2 |= 1; let n3 = [], s2 = e2[2], p5 = []; if ((p5 = f.key.exec(s2)) !== null) for (n3.push(p5[1]); (s2 = s2.substring(p5[0].length)) !== ""; ) if ((p5 = f.key_access.exec(s2)) !== null) n3.push(p5[1]); else if ((p5 = f.index_access.exec(s2)) !== null) n3.push(p5[1]); else throw new SyntaxError("[sprintf] failed to parse named argument key"); else throw new SyntaxError("[sprintf] failed to parse named argument key"); e2[2] = n3; } else o2 |= 2; if (o2 === 3) throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported"); i3.push({ placeholder: e2[0], param_no: e2[1], keys: e2[2], sign: e2[3], pad_char: e2[4], align: e2[5], width: e2[6], precision: e2[7], type: e2[8] }); } else throw new SyntaxError("[sprintf] unexpected placeholder"); t = t.substring(e2[0].length); } return Mt[r2] = i3; } var w = (r2) => _r(dr(r2), arguments); var vt = (r2, t) => w.apply(null, [r2].concat(t || [])); var wt = (r2, t, e2) => u(r2).includes(t, e2); var yt = (r2, t = void 0, e2 = void 0, i3 = true) => u(r2).split(t, e2).map((o2) => i3 ? o2.trim() : o2).filter((o2) => i3 ? !X(o2) : true); var Ct = (r2, t = null, e2 = "") => { let i3 = u(r2), o2; return t ? (o2 = new RegExp(t, "g"), i3.replace(o2, e2)) : i3; }; var Dt = (r2, t = "div", e2 = {}) => { let i3 = u(r2), o2 = Object.keys(e2).map((n3) => `${n3}="${e2[n3]}"`).join(" "); return o2 && (o2 = " " + o2), `<${t}${o2}>${i3}`; }; var It = (r2, t = "", e2 = "") => t + u(r2) + e2; var Tt = (r2) => typeof r2 == "string"; var Gt = (r2, t, e2 = "") => { let i3 = u(r2), o2; if (!(t instanceof RegExp)) { if (o2 = t ? _(u(t)) : "", !o2) return false; t = new RegExp(o2, e2); } return t.test(i3); }; var Xt = (r2, t = "", e2 = 1) => u(r2) + x(t, e2); var kt = (r2, t = "", e2 = 1) => x(t, e2) + u(r2); var Pt = (r2) => { let t = u(r2); return t === "" ? t : t[0] === ur ? t.substring(1) : t; }; var Lt = (r2, t = 5, e2 = "...") => r2 && `${r2.substring(0, t)}${e2}${r2.substring(r2.length - t)}`; var sr = (r2) => typeof r2 > "u" || r2 === null; var Bt = (r2, ...t) => { if (!sr(r2)) return r2; if (t.length === 0) throw new Error("nvl: No default value provided"); for (let e2 of t) if (typeof e2 < "u" && e2 !== null) return e2; }; var k = class { constructor(t = "", { mutable: e2 = true } = {}) { this.value = t.toString(), this.mutable = e2; } [Symbol.toPrimitive](t) { return t === "number" ? +this.value : this.value; } get [Symbol.toStringTag]() { return "Str"; } val(t) { return typeof t > "u" || t === null ? this.value : (this.value = t.toString(), this); } get length() { return this.value.length; } immutable(t = true) { this.mutable = !t; } toString() { return Array.isArray(this.value) ? this.value.join("") : this.value; } _result(t) { return this.mutable ? (this.value = t, this) : nr(t); } camelCase() { return this._result(z(this.value)); } capitalize(t) { return this._result(F(this.value, t)); } chars(t) { return this._result(c(this.value, t)); } count() { return tt(this.value); } countChars(t) { return W(this.value, t); } countUniqueChars(t) { return O(this.value, t); } countSubstr(t) { return rt(this.value, t); } countWords(t, e2) { return W(this.value, t, e2); } countUniqueWords(t, e2) { return O(this.value, t, e2); } dashedName() { return this._result(H(this.value)); } decapitalize() { return this._result(U(this.value)); } endsWith(t, e2) { return gt(this.value, t, e2); } escapeHtml() { return this._result(et(this.value)); } first() { return this._result(st(this.value)); } includes(t, e2) { return wt(this.value, t, e2); } insert(t, e2) { return this._result(ht(this.value, t, e2)); } isAlpha() { return xt(this.value); } isAlphaDigit() { return _t(this.value); } isBlank(t) { return Et(this.value, t); } isDigit() { return dt(this.value); } isEmpty() { return X(this.value); } isLower() { return At(this.value); } static isString(t) { return Tt(t); } isUpper() { return St(this.value); } kebab(t) { return this._result(Z(this.value, t)); } last(t) { return this._result(nt(this.value, t)); } lower() { return this._result(R(this.value)); } matches(t, e2) { return Gt(this.value, t, e2); } pad(t, e2) { return this._result(ct(this.value, t, e2)); } lpad(t, e2) { return this._result(ft(this.value, t, e2)); } rpad(t, e2) { return this._result(mt(this.value, t, e2)); } prune(t, e2) { return this._result(lt(this.value, t, e2)); } repeat(t) { return this._result(x(this.value, t)); } append(t, e2) { return this._result(Xt(this.value, t, e2)); } prepend(t, e2) { return this._result(kt(this.value, t, e2)); } reverse(t) { return this._result(K(this.value, t)); } shuffle() { return this._result(J(this.value)); } slice(t) { return this._result(at(this.value, t)); } snake() { return this._result(Y(this.value)); } split(t, e2, i3) { return this._result(yt(this.value, t, e2, i3)); } sprintf(...t) { return this._result(w(this.value, ...t)); } vsprintf(...t) { return this._result(vt(this.value, ...t)); } startsWith(t, e2) { return bt(this.value, t, e2); } stripBoom() { return this._result(Pt(this.value)); } stripTags(t) { return this._result(Rt(this.value, t)); } stripTagsAll() { return this._result(Ft(this.value)); } strip(t, e2) { return this._result(Ct(this.value, t, e2)); } substring(t, e2) { return this._result(m(this.value, t, e2)); } swap() { return this._result(V(this.value)); } title(t, e2) { return this._result(Q(this.value, t, e2)); } trim(t) { return this._result(_(this.value, t)); } ltrim(t) { return this._result(M2(this.value, t)); } rtrim(t) { return this._result(q(this.value, t)); } truncate(t, e2) { return this._result(j(this.value, t, e2)); } truncateWithAlign(t, e2) { return this._result(pt(this.value, t, e2)); } unescapeHtml() { return this._result(ot(this.value)); } unique(t) { return this._result(ut(this.value, t)); } uniqueWords(t, e2) { return this._result(it(this.value, t, e2)); } upper() { return this._result(G2(this.value)); } words(t, e2) { return a(this.value, t, e2); } wrap(t, e2) { return this._result(It(this.value, t, e2)); } wrapTag(t) { return this._result(Dt(this.value, t)); } shorten(t, e2) { return this._result(Lt(this.value, t, e2)); } nvl(...t) { return this._result(Bt(this.value, ...t)); } }; Object.assign(k, qt); var nr = (r2, t = true) => new k(r2, { mutable: t }); var Er = "0.10.2"; var Ar = "18.05.2025, 14:39:06"; var Sr = () => { console.info(`%c String %c v${Er} %c ${Ar} `, "color: #000000; font-weight: bold; background: #fff200", "color: white; background: darkgreen", "color: white; background: #0080fe;"); }; k.info = Sr; // source/string/index.js globalThis.Str = k; globalThis.str = nr; // node_modules/@olton/dom/dist/dom.js var numProps = ["opacity", "zIndex"]; function nothing() { return null; } function isSimple(v5) { return typeof v5 === "string" || typeof v5 === "boolean" || typeof v5 === "number"; } function isVisible(elem) { const computedStyle = getComputedStyle(elem); const hasDimensions = !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); const isNotHiddenByStyles = computedStyle.visibility !== "hidden" && computedStyle.display !== "none" && computedStyle.opacity !== "0" && elem.style.display !== "none"; return hasDimensions && isNotHiddenByStyles; } function isHidden(elem) { const s2 = getComputedStyle(elem); return !isVisible(elem) || +s2.opacity === 0 || elem.hidden || s2.visibility === "hidden"; } function not2(value) { return value === void 0 || value === null; } function camelCase(string) { return string.replace(/-([a-z])/g, function(all, letter) { return letter.toUpperCase(); }); } function dashedName(str2) { return str2.replace(/([A-Z])/g, function(u4) { return "-" + u4.toLowerCase(); }); } function isPlainObject(obj) { let proto; if (!obj || Object.prototype.toString.call(obj) !== "[object Object]") { return false; } proto = obj.prototype !== void 0; if (!proto) { return true; } return proto.constructor && typeof proto.constructor === "function"; } function isEmptyObject(obj) { for (const name2 in obj) { if (hasProp(obj, name2)) return false; } return true; } function isArrayLike(o2) { return o2 instanceof Object && "length" in o2; } function str2arr(str2, sep) { sep = sep || " "; return str2.split(sep).map(function(el) { return ("" + el).trim(); }).filter(function(el) { return el !== ""; }); } function parseUnit(str2, out) { if (!out) out = [0, ""]; str2 = String(str2); out[0] = parseFloat(str2); out[1] = str2.match(/[\d.\-+]*\s*(.*)/)[1] || ""; return out; } function getUnit(val, und) { const split = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn|fr|lh|cqw|cqh|cqi|cqb|cqmin|cqmax|q)?$/.exec(val); return typeof split[1] !== "undefined" ? split[1] : und; } function setStyleProp(el, key, val) { key = camelCase(key); if (["scrollLeft", "scrollTop"].indexOf(key) > -1) { el[key] = parseInt(val); } else { el.style[key] = isNaN(val) || numProps.indexOf("" + key) > -1 ? val : parseInt(val) === 0 ? 0 : val + "px"; } } function acceptData(owner) { return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType; } function normName(name2) { return typeof name2 !== "string" ? void 0 : name2.replace(/-/g, "").toLowerCase(); } function hasProp(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } function isLocalhost(host) { const hostname = host || globalThis.location.hostname; return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]" || hostname === "" || hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/) !== null; } function isTouch() { return "ontouchstart" in window || navigator.maxTouchPoints > 0; } function isPrivateAddress(host) { const hostname = host || globalThis.location.hostname; return /(^localhost)|(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2\d\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/.test(hostname); } function safeJsonParse(str2) { try { return JSON.parse(str2); } catch (e2) { return str2; } } var matches = Element.prototype.matches; var $3 = (selector, context) => new $3.init(selector, context); $3.version = "1.5.1"; $3.build_time = "18.05.2025, 14:45:23"; $3.info = () => console.info(`%c Dom %c v${$3.version} %c ${$3.build_time} `, "color: white; font-weight: bold; background: #fd6a02", "color: white; background: darkgreen", "color: white; background: #0080fe;"); $3.fn = $3.prototype = Object.create(Array.prototype); $3.prototype.constructor = $3; $3.prototype.uid = ""; $3.extend = $3.fn.extend = function() { let options, name2, target = arguments[0] || {}, i3 = 1, length = arguments.length; if (typeof target !== "object" && typeof target !== "function") { target = {}; } if (i3 === length) { target = this; i3--; } for (; i3 < length; i3++) { if ((options = arguments[i3]) != null) { for (name2 in options) { if (hasProp(options, name2)) target[name2] = options[name2]; } } } return target; }; $3.assign = function() { let options, name2, target = arguments[0] || {}, i3 = 1, length = arguments.length; if (typeof target !== "object" && typeof target !== "function") { target = {}; } if (i3 === length) { target = this; i3--; } for (; i3 < length; i3++) { if ((options = arguments[i3]) != null) { for (name2 in options) { if (hasProp(options, name2) && options[name2] !== void 0) target[name2] = options[name2]; } } } return target; }; (function(workerScript) { try { const blob = new Blob([` var fakeIdToId = {}; onmessage = function (event) { var data = event.data, name = data.name, fakeId = data.fakeId, time; if(data.hasOwnProperty('time')) { time = data.time; } switch (name) { case 'setInterval': fakeIdToId[fakeId] = setInterval(function () { postMessage({fakeId: fakeId}); }, time); break; case 'clearInterval': if (fakeIdToId.hasOwnProperty (fakeId)) { clearInterval(fakeIdToId[fakeId]); delete fakeIdToId[fakeId]; } break; case 'setTimeout': fakeIdToId[fakeId] = setTimeout(function () { postMessage({fakeId: fakeId}); if (fakeIdToId.hasOwnProperty (fakeId)) { delete fakeIdToId[fakeId]; } }, time); break; case 'clearTimeout': if (fakeIdToId.hasOwnProperty (fakeId)) { clearTimeout(fakeIdToId[fakeId]); delete fakeIdToId[fakeId]; } break; } } `]); workerScript = window.URL.createObjectURL(blob); } catch (error) { } let worker, fakeIdToCallback = {}, lastFakeId = 0, maxFakeId = 2147483647, logPrefix = ""; function getFakeId() { do { if (lastFakeId === maxFakeId) { lastFakeId = 0; } else { lastFakeId++; } } while (fakeIdToCallback.hasOwnProperty(lastFakeId)); return lastFakeId; } if (typeof Worker === "undefined") { return; } try { worker = new Worker(workerScript); window.setInterval = function(callback, time) { const fakeId = getFakeId(); fakeIdToCallback[fakeId] = { callback, parameters: Array.prototype.slice.call(arguments, 2) }; worker.postMessage({ name: "setInterval", fakeId, time }); return fakeId; }; window.clearInterval = function(fakeId) { if (fakeIdToCallback.hasOwnProperty(fakeId)) { delete fakeIdToCallback[fakeId]; worker.postMessage({ name: "clearInterval", fakeId }); } }; window.setTimeout = function(callback, time) { const fakeId = getFakeId(); fakeIdToCallback[fakeId] = { callback, parameters: Array.prototype.slice.call(arguments, 2), isTimeout: true }; worker.postMessage({ name: "setTimeout", fakeId, time }); return fakeId; }; window.clearTimeout = function(fakeId) { if (fakeIdToCallback.hasOwnProperty(fakeId)) { delete fakeIdToCallback[fakeId]; worker.postMessage({ name: "clearTimeout", fakeId }); } }; window.setImmediate = function(callback) { return setTimeout(callback, 0); }; window.clearImmediate = function(fakeId) { clearTimeout(fakeId); }; worker.onmessage = function(event) { let data = event.data, fakeId = data.fakeId, request, parameters, callback; if (fakeIdToCallback.hasOwnProperty(fakeId)) { request = fakeIdToCallback[fakeId]; callback = request.callback; parameters = request.parameters; if (request.hasOwnProperty("isTimeout") && request.isTimeout) { delete fakeIdToCallback[fakeId]; } } if (typeof callback === "string") { try { callback = new Function(callback); } catch (error) { console.error(logPrefix + "Error parsing callback code string: ", error); } } if (typeof callback === "function") { callback.apply(window, parameters); } }; worker.onerror = function(event) { console.error(event); }; } catch (error) { console.log(`Can't create worker for Intervals, use standard functions.`); } })(); $3.fn.extend({ _getDefaultElement(sel) { let el; if (not2(sel)) { el = this[0]; } else if (sel instanceof HTMLElement) { el = sel; } else if (sel instanceof $3 && sel.length > 0) { el = sel[0]; } else if (typeof sel === "string") { el = $3(sel)[0]; } else { el = void 0; } return el; }, index: function(sel) { let el, _index = -1; if (this.length === 0) { return _index; } el = this._getDefaultElement(sel); if (!el) { return _index; } if (el && el.parentNode) $3.each(el.parentNode.children, function(i3) { if (this === el) { _index = i3; } }); return _index; }, indexOf: function(sel) { let el, _index = -1; if (this.length === 0) { return _index; } el = this._getDefaultElement(sel); if (!el) { return _index; } this.each(function(i3) { if (this === el) { _index = i3; } }); return _index; }, get: function(i3) { if (i3 === void 0) { return this; } return i3 < 0 ? this[i3 + this.length] : i3 > this.length - 1 ? void 0 : this[i3]; }, eq: function(i3) { if (not2(i3)) { return this; } return this.length > 0 ? $3.extend($3(this.get(i3)), { _prevObj: this }) : this; }, is: function(s2) { let result = false; if (this.length === 0) { return false; } if (s2 instanceof $3) { return this.same(s2); } if (s2 === ":selected") { this.each(function() { if (this.selected) result = true; }); } else if (s2 === ":checked") { this.each(function() { if (this.checked) result = true; }); } else if (s2 === ":visible") { result = false; this.each(function() { if (isVisible(this)) result = true; }); } else if (s2 === ":hidden") { this.each(function() { const styles = getComputedStyle(this); if (this.getAttribute("type") === "hidden" || this.hidden || styles.display === "none" || styles.visibility === "hidden" || parseInt(styles.opacity) === 0) result = true; }); } else if (typeof s2 === "string" && [":selected"].indexOf(s2) === -1) { this.each(function() { if (matches.call(this, s2)) { result = true; } }); } else if (isArrayLike(s2)) { this.each(function() { const el = this; $3.each(s2, function() { const sel = this; if (el === sel) { result = true; } }); }); } else if (typeof s2 === "object" && s2.nodeType === 1) { this.each(function() { if (this === s2) { result = true; } }); } return result; }, same: function(o2) { let result = true; if (!(o2 instanceof $3)) { o2 = $3(o2); } if (this.length !== o2.length) return false; this.each(function() { if (o2.items().indexOf(this) === -1) { result = false; } }); return result; }, last: function() { return this.eq(this.length - 1); }, first: function() { return this.eq(0); }, odd: function() { const result = this.filter(function(el, i3) { return (i3 + 1) % 2 !== 0; }); return $3.extend(result, { _prevObj: this }); }, even: function() { const result = this.filter(function(el, i3) { return (i3 + 1) % 2 === 0; }); return $3.extend(result, { _prevObj: this }); }, filter: function(fn) { if (typeof fn === "string") { const sel = fn; fn = function(el) { return matches.call(el, sel); }; } return $3.extend($3.merge($3(), [].filter.call(this, fn)), { _prevObj: this }); }, find: function(s2) { let res = [], result; if (s2 instanceof $3) return s2; if (this.length === 0) { result = this; } else { this.each(function() { const el = this; if (typeof el.querySelectorAll === "undefined") { return; } res = res.concat([].slice.call(el.querySelectorAll(s2))); }); result = $3.merge($3(), res); } return $3.extend(result, { _prevObj: this }); }, contains: function(s2) { return this.find(s2).length > 0; }, children: function(s2) { let i3, res = []; if (s2 instanceof $3) return s2; this.each(function() { const el = this; for (i3 = 0; i3 < el.children.length; i3++) { if (el.children[i3].nodeType === 1) res.push(el.children[i3]); } }); res = s2 ? res.filter(function(el) { return matches.call(el, s2); }) : res; return $3.extend($3.merge($3(), res), { _prevObj: this }); }, parent: function(s2) { let res = []; if (this.length === 0) { return; } if (s2 instanceof $3) return s2; this.each(function() { if (this.parentNode) { if (res.indexOf(this.parentNode) === -1) res.push(this.parentNode); } }); res = s2 ? res.filter(function(el) { return matches.call(el, s2); }) : res; return res.length ? $3.extend($3.merge($3(), res), { _prevObj: this }) : void 0; }, parents: function(s2) { let res = []; if (this.length === 0) { return; } if (s2 instanceof $3) return s2; this.each(function() { let par = this.parentNode; while (par) { if (par.nodeType === 1 && res.indexOf(par) === -1) { if (!not2(s2)) { if (matches.call(par, s2)) { res.push(par); } } else { res.push(par); } } par = par.parentNode; } }); return $3.extend($3.merge($3(), res), { _prevObj: this }); }, siblings: function(s2) { let res = []; if (this.length === 0) { return void 0; } if (s2 instanceof $3) { return s2; } this.each(function() { const el = this; if (el.parentNode) { $3.each(el.parentNode.children, function() { if (el !== this) res.push(this); }); } }); if (s2) { res = res.filter(function(el) { return matches.call(el, s2); }); } return $3.extend($3.merge($3(), res), { _prevObj: this }); }, _siblingAll: function(dir, s2) { let res = []; if (this.length === 0) { return; } if (s2 instanceof $3) return s2; this.each(function() { let el = this; while (el) { el = el[dir]; if (!el) break; res.push(el); } }); if (s2) { res = res.filter(function(el) { return matches.call(el, s2); }); } return $3.extend($3.merge($3(), res), { _prevObj: this }); }, _sibling: function(dir, s2) { let res = []; if (this.length === 0) { return; } if (s2 instanceof $3) return s2; this.each(function() { const el = this[dir]; if (el && el.nodeType === 1) { res.push(el); } }); if (s2) { res = res.filter(function(el) { return matches.call(el, s2); }); } return $3.extend($3.merge($3(), res), { _prevObj: this }); }, prev: function(s2) { return this._sibling("previousElementSibling", s2); }, next: function(s2) { return this._sibling("nextElementSibling", s2); }, prevAll: function(s2) { return this._siblingAll("previousElementSibling", s2); }, nextAll: function(s2) { return this._siblingAll("nextElementSibling", s2); }, closest: function(s2) { let res = []; if (this.length === 0) { return void 0; } if (!s2) { return this.parent(); } let el = this[0]; while (el) { if (matches.call(el, s2)) { res.push(el); break; } el = el.parentElement; } return $3.extend($3.merge($3(), res.reverse()), { _prevObj: this }); }, has: function(selector) { let res = []; if (this.length === 0) { return; } this.each(function() { const el = $3(this); const child = el.children(selector); if (child.length > 0) { res.push(this); } }); return $3.extend($3.merge($3(), res), { _prevObj: this }); }, back: function(to_start) { let ret; if (to_start === true) { ret = this._prevObj; while (ret) { if (!ret._prevObj) break; ret = ret._prevObj; } } else { ret = this._prevObj ? this._prevObj : this; } return ret; } }); function createScript(script, into = document.body) { const s2 = document.createElement("script"); s2.type = "text/javascript"; if (not2(script)) return $3(s2); const _script = $3(script)[0]; if (_script.src) { s2.src = _script.src; } else { s2.textContent = _script.innerText; } if (_script.type) s2.type = _script.type; if (_script.async) s2.async = _script.async; into.appendChild(s2); if (_script.parentNode) _script.parentNode.removeChild(_script); return s2; } $3.extend({ script: function(el, into) { if (not2(el)) { return; } if (el instanceof $3) { el = el[0]; } if (el.tagName && el.tagName === "SCRIPT") { createScript(el, into); } else { const scripts = $3(el).find("script"); $3.each(scripts, function() { createScript(this, into); }); } }, loadScript: function(url, into = document.body, callback) { const script = document.createElement("script"); script.type = "text/javascript"; script.src = url; script.onload = callback; into.appendChild(script); } }); $3.fn.extend({ script: function(into) { return this.each(function() { $3.script(this, into); }); } }); $3.fn.extend({ _prop: function(prop, value) { if (arguments.length === 1) { return this.length === 0 ? void 0 : this[0][prop]; } if (not2(value)) { value = ""; } return this.each(function() { const el = this; el[prop] = value; if (prop === "innerHTML") { $3.script(el, el); } }); }, prop: function(prop, value) { return arguments.length === 1 ? this._prop(prop) : this._prop(prop, typeof value === "undefined" ? "" : value); }, val: function(value) { if (not2(value)) { return this.length === 0 ? void 0 : this[0].value; } return this.each(function() { const el = $3(this); if (typeof this.value !== "undefined") { this.value = value; } else { el.html(value); } }); }, html: function(value) { const that = this, v5 = []; if (arguments.length === 0) { return this._prop("innerHTML"); } if (value instanceof $3) { value.each(function() { v5.push($3(this).outerHTML()); }); } else { v5.push(value); } that._prop("innerHTML", v5.join("\n")); return this; }, outerHTML: function() { return this._prop("outerHTML"); }, text: function(value) { return arguments.length === 0 ? this._prop("textContent") : this._prop("textContent", typeof value === "undefined" ? "" : value); }, innerText: function(value) { return arguments.length === 0 ? this._prop("innerText") : this._prop("innerText", typeof value === "undefined" ? "" : value); }, empty: function() { return this.each(function() { if (typeof this.innerHTML !== "undefined") this.innerHTML = ""; if (typeof this.value !== "undefined") this.value = ""; }); }, clear: function() { return this.empty(); } }); $3.each = function(ctx, cb) { let index = 0; if (typeof ctx !== "object") { ctx = []; } if (isArrayLike(ctx)) { [].forEach.call(ctx, function(val, key) { cb.apply(val, [key, val]); }); } else { for (const key in ctx) { if (hasProp(ctx, key)) cb.apply(ctx[key], [key, ctx[key], index++]); } } return ctx; }; $3.fn.extend({ each: function(cb) { return $3.each(this, cb); } }); var Data = function(ns) { this.expando = "DATASET:UID:" + ns.toUpperCase(); Data.uid++; }; Data.uid = -1; Data.prototype = { cache: function(owner) { let value = owner[this.expando]; if (!value) { value = {}; if (acceptData(owner)) { if (owner.nodeType) { owner[this.expando] = value; } else { Object.defineProperty(owner, this.expando, { value, configurable: true }); } } } return value; }, set: function(owner, data, value) { let prop, cache = this.cache(owner); if (typeof data === "string") { cache[camelCase(data)] = value; } else { for (prop in data) { if (hasProp(data, prop)) cache[camelCase(prop)] = data[prop]; } } return cache; }, get: function(owner, key) { let value = key === void 0 ? this.cache(owner) : owner[this.expando] && owner[this.expando][camelCase(key)]; if (key) { return value !== void 0 ? value : owner.getAttribute && owner.getAttribute("data-" + dashedName(key)) || void 0; } value = { ...owner[this.expando] }; for (const attr of owner.attributes) { if (attr.name.startsWith("data-")) { const name2 = attr.name.slice(5); value[camelCase(name2)] = attr.value; } } return isEmptyObject(value) ? void 0 : value; }, access: function(owner, key, value) { if (key === void 0 || key && typeof key === "string" && value === void 0) { return this.get(owner, key); } this.set(owner, key, value); return value !== void 0 ? value : key; }, remove: function(owner, key) { let cache = owner[this.expando]; if (cache === void 0) { return; } if (key !== void 0) { const _keys = Array.isArray(key) ? key : [key]; for (const k5 of _keys) { delete cache[camelCase(k5)]; owner.removeAttribute && owner.removeAttribute("data-" + k5); } } if (key === void 0 || isEmptyObject(cache)) { if (owner.nodeType) { owner[this.expando] = void 0; } else { delete owner[this.expando]; } } return true; }, hasData: function(owner) { const cache = owner[this.expando]; return cache !== void 0 && !isEmptyObject(cache); } }; var dataSet = new Data("dom"); $3.extend({ hasData: function(elem) { return dataSet.hasData(elem); }, data: function(elem, key, val) { return dataSet.access(elem, key, val); }, removeData: function(elem, key) { return dataSet.remove(elem, key); }, dataSet: function(ns) { if (not2(ns)) return dataSet; if (["INTERNAL", "DOM"].indexOf(ns.toUpperCase()) > -1) { throw Error("You can not use reserved name for your dataset"); } return new Data(ns); } }); $3.fn.extend({ data: function(key, val) { let res, elem, data; if (this.length === 0) { return; } elem = this[0]; if (arguments.length === 0) { if (elem) { data = dataSet.get(elem); if (elem.nodeType === 1) { for (const a2 of elem.attributes) { if (a2.name.startsWith("data-")) { const name2 = a2.name.slice(5); data[camelCase(name2)] = a2.value; } } } } return data; } if (arguments.length === 1 && (typeof key === "string" || Array.isArray(key))) { res = dataSet.get(elem, key); return safeJsonParse(res); } return this.each(function() { dataSet.set(this, key, val); }); }, removeData: function(key) { if (typeof key === "undefined") { return this; } return this.each(function() { const keys = Array.isArray(key) ? key : key.split(" ").map((el) => el.trim()).filter((el) => el !== ""); for (const k5 of keys) { dataSet.remove(this, k5); } }); }, origin: function(name2, value, def) { if (this.length === 0) { return this; } if (not2(name2) && not2(value)) { return $3.data(this[0]); } if (not2(value)) { const res = $3.data(this[0], "origin-" + name2); return !not2(res) ? res : def; } this.data("origin-" + name2, value); return this; } }); $3.extend({ device: /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()), localhost: isLocalhost(), isLocalhost, touchable: isTouch(), isPrivateAddress, hashCode: function(str2) { let hash = 0, i3, chr; if (str2.length === 0) return hash; for (i3 = 0; i3 < str2.length; i3++) { chr = str2.charCodeAt(i3); hash = (hash << 5) - hash + chr; hash |= 0; } return hash; }, uniqueId: function(salt = "salt") { let name2; if (typeof salt === "function") { name2 = salt.name; } else if (typeof salt === "string" && salt) { name2 = salt; } else if (typeof salt === "string" && salt.length === 0) { name2 = "salt"; } else { name2 = salt.toString(); } return "dom-" + $3.hashCode(name2); }, toArray: function(n3) { let i3, out = []; for (i3 = 0; i3 < n3.length; i3++) { out.push(n3[i3]); } return out; }, import: function(ctx) { const res = []; this.each(ctx, function() { res.push(this); }); return this.merge($3(), res); }, merge: function(first, second) { let len = +second.length, j5 = 0, i3 = first.length; for (; j5 < len; j5++) { first[i3++] = second[j5]; } first.length = i3; return first; }, type: function(obj) { return Object.prototype.toString.call(obj).replace(/^\[object (.+)]$/, "$1").toLowerCase(); }, isSelector: function(selector) { if (typeof selector !== "string" || selector.length === 0 || selector === "#" || selector === ".") { return false; } try { document.querySelector(selector); return true; } catch (error) { return false; } }, remove: function(s2) { return $3(s2).remove(); }, isPlainObject, isEmptyObject, isArrayLike, acceptData, not: not2, parseUnit, getUnit, unit: parseUnit, isVisible, isHidden, matches: function(el, s2) { return matches.call(el, s2); }, random: function(from, to2) { if (arguments.length === 1 && isArrayLike(from)) { return from[Math.floor(Math.random() * from.length)]; } return Math.floor(Math.random() * (to2 - from + 1) + from); }, hasProp, dark: globalThis.matchMedia && globalThis.matchMedia("(prefers-color-scheme: dark)").matches, serializeToArray: function(form) { const _form = $3(form)[0]; if (!_form || _form.nodeName !== "FORM") { console.warn("Element is not a HTMLFromElement"); return; } let i3, j5, q5 = []; for (i3 = _form.elements.length - 1; i3 >= 0; i3 = i3 - 1) { if (_form.elements[i3].name === "") { continue; } switch (_form.elements[i3].nodeName) { case "INPUT": switch (_form.elements[i3].type) { case "checkbox": case "radio": if (_form.elements[i3].checked) { q5.push(_form.elements[i3].name + "=" + encodeURIComponent(_form.elements[i3].value)); } break; case "file": break; default: q5.push(_form.elements[i3].name + "=" + encodeURIComponent(_form.elements[i3].value)); } break; case "TEXTAREA": q5.push(_form.elements[i3].name + "=" + encodeURIComponent(_form.elements[i3].value)); break; case "SELECT": switch (_form.elements[i3].type) { case "select-one": q5.push(_form.elements[i3].name + "=" + encodeURIComponent(_form.elements[i3].value)); break; case "select-multiple": for (j5 = _form.elements[i3].options.length - 1; j5 >= 0; j5 = j5 - 1) { if (_form.elements[i3].options[j5].selected) { q5.push(_form.elements[i3].name + "=" + encodeURIComponent(_form.elements[i3].options[j5].value)); } } break; } break; case "BUTTON": switch (_form.elements[i3].type) { case "reset": case "submit": case "button": q5.push(_form.elements[i3].name + "=" + encodeURIComponent(_form.elements[i3].value)); break; } break; } } return q5; }, serialize: function(form) { return $3.serializeToArray(form).join("&"); }, viewport: function() { const w6 = window, d4 = document, e2 = d4.documentElement, g5 = d4.getElementsByTagName("body")[0], x5 = w6.innerWidth || e2.clientWidth || g5.clientWidth, y4 = w6.innerHeight || e2.clientHeight || g5.clientHeight; return { width: x5, height: y4 }; } }); $3.fn.extend({ items: function() { return $3.toArray(this); } }); var overriddenStop = Event.prototype.stopPropagation; var overriddenPrevent = Event.prototype.preventDefault; Event.prototype.stopPropagation = function() { this.isPropagationStopped = true; overriddenStop.apply(this, arguments); }; Event.prototype.preventDefault = function() { this.isPreventedDefault = true; overriddenPrevent.apply(this, arguments); }; Event.prototype.stop = function(immediate) { return immediate ? this.stopImmediatePropagation() : this.stopPropagation(); }; $3.extend({ events: [], eventHooks: {}, eventUID: -1, /* * el, eventName, handler, selector, ns, id, options * */ setEventHandler: function(obj) { let i3, freeIndex = -1, eventObj, resultIndex; if (this.events.length > 0) { for (i3 = 0; i3 < this.events.length; i3++) { if (this.events[i3].handler === null) { freeIndex = i3; break; } } } eventObj = { element: obj.el, event: obj.event, handler: obj.handler, selector: obj.selector, ns: obj.ns, id: obj.id, options: obj.options }; if (freeIndex === -1) { this.events.push(eventObj); resultIndex = this.events.length - 1; } else { this.events[freeIndex] = eventObj; resultIndex = freeIndex; } return resultIndex; }, getEventHandler: function(index) { if (this.events[index] !== void 0 && this.events[index] !== null) { this.events[index] = null; return this.events[index].handler; } return void 0; }, off: function() { $3.each(this.events, function() { this.element.removeEventListener(this.event, this.handler, true); }); this.events = []; return this; }, getEvents: function() { return this.events; }, getEventHooks: function() { return this.eventHooks; }, addEventHook: function(event, handler, type = "before") { $3.each(str2arr(event), (_5, eventName) => { const key = camelCase(`${type}-${eventName}`); this.eventHooks[key] = handler; }); return this; }, removeEventHook: function(event, type = "before") { $3.each(str2arr(event), (_5, eventName) => { delete this.eventHooks[camelCase(`${type}-${eventName}`)]; }); return this; }, removeEventHooks: function(event) { const that = this; if (not2(event)) { this.eventHooks = {}; } else { $3.each(str2arr(event), function() { delete that.eventHooks[camelCase("before-" + this)]; delete that.eventHooks[camelCase("after-" + this)]; }); } return this; } }); $3.fn.extend({ on: function(eventsList, sel, handler, options) { if (this.length === 0) { return; } if (typeof sel === "function") { options = handler || {}; handler = sel; sel = void 0; } if (typeof options !== "object") { options = {}; } return this.each(function(_5, el) { $3.each(str2arr(eventsList), (_22, ev) => { let h3, event = ev.split("."), name2 = normName(event[0]), ns = options.ns ? options.ns : event[1], index, originEvent; $3.eventUID++; h3 = (e2) => { let target = e2.target; const beforeHook = $3.eventHooks[camelCase("before-" + name2)]; const afterHook = $3.eventHooks[camelCase("after-" + name2)]; if (typeof beforeHook === "function") { beforeHook.call(target, e2); } if (!sel) { handler.call(el, e2); } else { while (target && target !== el) { if (matches.call(target, sel)) { handler.call(target, e2); if (e2.isPropagationStopped) { e2.stopImmediatePropagation(); break; } } target = target.parentNode; } } if (typeof afterHook === "function") { afterHook.call(target, e2); } if (options.once) { index = +$3(el).origin("event-" + e2.type + (sel ? ":" + sel : "") + (ns ? ":" + ns : "")); if (!isNaN(index)) $3.events.splice(index, 1); } }; Object.defineProperty(h3, "name", { value: handler.name && handler.name !== "" ? handler.name : "func_event_" + name2 + "_" + $3.eventUID }); originEvent = name2 + (sel ? ":" + sel : "") + (ns ? ":" + ns : ""); el.addEventListener(name2, h3, !isEmptyObject(options) ? options : false); index = $3.setEventHandler({ el, event: name2, handler: h3, selector: sel, ns, id: $3.eventUID, options: !isEmptyObject(options) ? options : false }); $3(el).origin("event-" + originEvent, index); }); }); }, one: function(events, sel, handler, options = {}) { if (typeof sel === "function") { options = handler || {}; handler = sel; sel = void 0; } options.once = true; return this.on.apply(this, [events, sel, handler, options]); }, off: function(eventsList, sel, options) { if (isPlainObject(sel)) { options = sel; sel = null; } if (!isPlainObject(options)) { options = {}; } if (not2(eventsList) || eventsList.toLowerCase() === "all") { return this.each(function() { const el = this; $3.each($3.events, function() { const e2 = this; if (e2.element === el) { el.removeEventListener(e2.event, e2.handler, e2.options); e2.handler = null; $3(el).origin("event-" + name + (e2.selector ? ":" + e2.selector : "") + (e2.ns ? ":" + e2.ns : ""), null); } }); }); } return this.each(function() { const el = this; $3.each(str2arr(eventsList), function() { let evMap = this.split("."), name2 = normName(evMap[0]), ns = options.ns ? options.ns : evMap[1], originEvent, index; originEvent = "event-" + name2 + (sel ? ":" + sel : "") + (ns ? ":" + ns : ""); index = $3(el).origin(originEvent); if (index !== void 0 && $3.events[index].handler) { el.removeEventListener(name2, $3.events[index].handler, $3.events[index].options); $3.events[index].handler = null; } $3(el).origin(originEvent, null); }); }); }, trigger: function(name2, data) { return this.fire(name2, data); }, fire: function(name2, data) { let _name, e2; if (this.length === 0) { return; } _name = normName(name2); if (["focus", "blur"].indexOf(_name) > -1) { this[0][_name](); return this; } e2 = new CustomEvent(_name, { bubbles: true, cancelable: true, detail: data }); return this.each(function() { this.dispatchEvent(e2); }); } }); "blur focus resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu touchstart touchend touchmove touchcancel".split(" ").forEach( function(name2) { $3.fn[name2] = function(sel, fn, opt2) { return arguments.length > 0 ? this.on(name2, sel, fn, opt2) : this.fire(name2); }; } ); $3.fn.extend({ hover: function(fnOver, fnOut) { return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); } }); $3.ready = function(fn, options) { document.addEventListener("DOMContentLoaded", fn, options || false); }; $3.load = function(fn) { return $3(window).on("load", fn); }; $3.unload = function(fn) { return $3(window).on("unload", fn); }; $3.fn.extend({ unload: function(fn) { return this.length === 0 || this[0].self !== window ? void 0 : $3.unload(fn); } }); $3.beforeunload = function(fn) { if (typeof fn === "string") { return $3(window).on("beforeunload", function(e2) { e2.returnValue = fn; return fn; }); } else { return $3(window).on("beforeunload", fn); } }; $3.fn.extend({ beforeunload: function(fn) { return this.length === 0 || this[0].self !== window ? void 0 : $3.beforeunload(fn); } }); $3.fn.extend({ ready: function(fn) { if (this.length && this[0] === document && typeof fn === "function") { return $3.ready(fn); } } }); $3.ajax = function(p5) { return new Promise(function(resolve, reject) { const xhr = new XMLHttpRequest(); let method = (p5.method || "GET").toUpperCase(); const headers = []; const async = not2(p5.async) ? true : p5.async; let url = p5.url; let data; const exec = function(fn, params) { if (typeof fn === "function") { fn.apply(null, params); } }; const isGet = function(method2) { return ["GET", "JSON"].indexOf(method2) !== -1; }; const plainObjectToData = function(obj) { const _data = []; $3.each(obj, function(k5, v5) { const _v = isSimple(v5) ? v5 : JSON.stringify(v5); _data.push(k5 + "=" + _v); }); return _data.join("&"); }; if (p5.data instanceof HTMLFormElement) { let _action = p5.data.getAttribute("action").trim(); let _method = p5.data.getAttribute("method").trim(); if (not2(url) && _action) { url = _action; } if (_method) { method = _method.toUpperCase(); } } if (p5.timeout) { xhr.timeout = p5.timeout; } if (p5.withCredentials) { xhr.withCredentials = p5.withCredentials; } if (p5.data instanceof HTMLFormElement) { data = $3.serialize(p5.data); } else if (p5.data instanceof HTMLElement && p5.data.getAttribute("type") && p5.data.getAttribute("type").toLowerCase() === "file") { const _name = p5.data.getAttribute("name"); data = new FormData(); for (let i3 = 0; i3 < p5.data.files.length; i3++) { data.append(_name, p5.data.files[i3]); } } else if (isPlainObject(p5.data)) { data = plainObjectToData(p5.data); } else if (p5.data instanceof FormData) { data = p5.data; } else if (typeof p5.data === "string") { data = p5.data; } else { data = new FormData(); data.append("_data", JSON.stringify(p5.data)); } if (isGet(method)) { url += typeof data === "string" ? "?" + data : isEmptyObject(data) ? "" : "?" + JSON.stringify(data); } xhr.open(method, url, async, p5.user, p5.password); if (p5.headers) { $3.each(p5.headers, function(k5, v5) { xhr.setRequestHeader(k5, v5); headers.push(k5); }); } if (!isGet(method)) { if (headers.indexOf("Content-type") === -1 && p5.contentType !== false) { xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); } } xhr.send(data); xhr.addEventListener("load", function(e2) { if (xhr.readyState === 4 && xhr.status < 300) { let _return = p5.returnValue && p5.returnValue === "xhr" ? xhr : xhr.response; if (p5.parseJson) { try { _return = JSON.parse(_return); } catch (ex) { _return = {}; } } exec(resolve, [_return]); exec(p5.onSuccess, [e2, xhr]); } else { exec(reject, [xhr]); exec(p5.onFail, [e2, xhr]); } exec(p5.onLoad, [e2, xhr]); }); $3.each(["readystatechange", "error", "timeout", "progress", "loadstart", "loadend", "abort"], function() { const ev = camelCase("on-" + (this === "readystatechange" ? "state" : this)); xhr.addEventListener(ev, function(e2) { exec(p5[ev], [e2, xhr]); }); }); }); }; ["GET", "POST", "PUT", "PATCH", "DELETE", "JSON"].forEach(function(method) { $3[method.toLowerCase()] = function(url, data, options) { const _options = { method: method === "JSON" ? "GET" : method, url, data, parseJson: method === "JSON" }; return $3.ajax($3.extend({}, _options, options)); }; }); $3.fn.extend({ load: function(url, data, options) { const that = this; if (this.length && this[0].self === window) { return $3.load(url); } return $3.get(url, data, options).then(function(data2) { that.each(function() { this.innerHTML = data2; }); }); } }); $3.fn.extend({ style: function(name2, pseudo) { let el; function _getStyle2(el2, prop, pseudo2) { return ["scrollLeft", "scrollTop"].includes(prop) ? $3(el2)[prop]() : getComputedStyle(el2, pseudo2)[prop]; } if (typeof name2 === "string" && this.length === 0) { return void 0; } if (this.length === 0) { return this; } el = this[0]; if (!name2 || name2 === "all") { return getComputedStyle(el, pseudo); } else { let result = {}; let names = name2.split(", ").map(function(el2) { return ("" + camelCase(el2)).trim(); }); if (names.length === 1) { return _getStyle2(el, names[0], pseudo); } else { $3.each(names, function() { const prop = this; result[this] = _getStyle2(el, prop, pseudo); }); return result; } } }, removeStyleProperty: function(name2) { if (not2(name2) || this.length === 0) return this; const names = name2.split(", ").map(function(el) { return ("" + el).trim(); }); return this.each(function() { const el = this; $3.each(names, function() { el.style.removeProperty(this); }); }); }, removeStyle: function(name2) { if (!name2) return this; const names = str2arr(name2, ", "); return this.each(function() { const el = this; $3.each(names, function() { el.style[this] = ""; }); }); }, css: function(key, val) { key = key || "all"; if (typeof key === "string" && not2(val)) { return this.style(key); } return this.each(function(_5, el) { if (typeof key === "object") { $3.each(key, function(key2, val2) { setStyleProp(el, key2, val2); }); } else if (typeof key === "string") { setStyleProp(el, key, val); } }); }, cssVar: function(name2, val) { if (not2(name2)) return void 0; if (not2(val)) { return getComputedStyle(this[0]).getPropertyValue("--" + name2); } else { return this.each(function() { this.style.setProperty("--" + name2, val); }); } } }); $3.fn.extend({ addClass: function() { }, removeClass: function() { }, toggleClass: function() { }, containsClass: function(cls) { return this.hasClass(cls); }, hasClass: function(cls) { if (not2(cls)) { return false; } let result = false; const classes = cls.split(" ").filter((v5) => ("" + v5).trim() !== ""); this.each(function() { const el = this; $3.each(classes, function() { if (!result && el.classList && el.classList.contains(this)) { result = true; } }); }); return result; }, clearClasses: function() { return this.each(function() { this.className = ""; }); }, cls: function(array = false) { return this.length === 0 ? void 0 : array ? this[0].className.split(" ") : this[0].className; }, removeClassBy: function(mask) { return this.each(function() { const el = $3(this); const classes = el.cls(true); $3.each(classes, function() { const elClass = this; if (elClass.indexOf(mask) > -1) { el.removeClass(elClass); } }); }); }, classNames: function() { const args = Array.prototype.slice.call(arguments, 0); const classes = []; $3.each(args, function(_5, a2) { if (typeof a2 === "string") { classes.push(a2); } else if (isPlainObject(a2)) { $3.each(a2, function(k5, v5) { if (v5) { classes.push(k5); } }); } else { nothing(); } }); return this.each(function() { this.className += " " + classes.join(" "); }); } }); ["add", "remove", "toggle"].forEach(function(method) { $3.fn[method + "Class"] = function(cls) { const _classes = !cls ? [] : Array.isArray(cls) ? cls : cls.split(" ").filter(function(v5) { return !!v5; }); if (!_classes.length) return this; return this.each(function() { const el = this; const hasClassList = typeof el.classList !== "undefined"; if (hasClassList) { $3.each(_classes, function(_5, v5) { el.classList[method](v5); }); } else { el.className += _classes.join(" "); } }); }; }); $3.parseHTML = function(data) { let base, singleTag, result = [], ctx, _context; const regexpSingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i; if (typeof data !== "string" || data.trim() === "") { return []; } data = data.trim(); singleTag = regexpSingleTag.exec(data); if (singleTag) { result.push(document.createElement(singleTag[1])); } else { if ($3.isSelector(data)) { const elements = document.querySelectorAll(data); if (elements.length) { for (const el of elements) { result.push(el); } } if (result.length === 0) { result.push(document.createTextNode(data)); } return result; } ctx = document.implementation.createHTMLDocument(""); base = ctx.createElement("base"); base.href = document.location.href; ctx.head.appendChild(base); _context = ctx.body; _context.innerHTML = data; for (let i3 = 0; i3 < _context.childNodes.length; i3++) { result.push(_context.childNodes[i3].cloneNode(true)); } } return result; }; $3.fn.extend({ _size: function(prop, val) { if (this.length === 0) return; if (not2(val)) { const el = this[0]; if (prop === "height") { return el === window ? window.innerHeight : el === document ? el.body.clientHeight : parseInt(getComputedStyle(el).height); } if (prop === "width") { return el === window ? window.innerWidth : el === document ? el.body.clientWidth : parseInt(getComputedStyle(el).width); } } return this.each(function() { const el = this; if (el === window || el === document) { return; } el.style[prop] = isNaN(val) ? val : +val === 0 ? 0 : val + "px"; }); }, height: function(val) { return this._size("height", val); }, width: function(val) { return this._size("width", val); }, _sizeOut: function(prop, val) { let el, size, style, result; if (this.length === 0) { return; } const setter = typeof val === "number"; if (setter) { return this.each(function() { const el2 = this; if (el2 === window || el2 === document) { return; } let h3, style2 = getComputedStyle(el2), bs = prop === "width" ? parseInt(style2["borderLeftWidth"]) + parseInt(style2["borderRightWidth"]) : parseInt(style2["borderTopWidth"]) + parseInt(style2["borderBottomWidth"]), pa = prop === "width" ? parseInt(style2["paddingLeft"]) + parseInt(style2["paddingRight"]) : parseInt(style2["paddingTop"]) + parseInt(style2["paddingBottom"]); h3 = $3(this)[prop](val)[prop]() - bs - pa; el2.style[prop] = h3 + "px"; }); } const includeMargin = val === true; el = this[0]; size = el[prop === "width" ? "offsetWidth" : "offsetHeight"]; style = getComputedStyle(el); result = size + parseInt(style[prop === "width" ? "marginLeft" : "marginTop"]) + parseInt(style[prop === "width" ? "marginRight" : "marginBottom"]); return includeMargin ? result : size; }, outerWidth: function(val) { return this._sizeOut("width", val); }, outerHeight: function(val) { return this._sizeOut("height", val); }, padding: function(p5) { if (this.length === 0) return; const s2 = getComputedStyle(this[0], p5); return { top: parseInt(s2["paddingTop"]), right: parseInt(s2["paddingRight"]), bottom: parseInt(s2["paddingBottom"]), left: parseInt(s2["paddingLeft"]) }; }, margin: function(p5) { if (this.length === 0) return; const s2 = getComputedStyle(this[0], p5); return { top: parseInt(s2["marginTop"]), right: parseInt(s2["marginRight"]), bottom: parseInt(s2["marginBottom"]), left: parseInt(s2["marginLeft"]) }; }, border: function(p5) { if (this.length === 0) return; const s2 = getComputedStyle(this[0], p5); return { top: parseInt(s2["borderTopWidth"]), right: parseInt(s2["borderRightWidth"]), bottom: parseInt(s2["borderBottomWidth"]), left: parseInt(s2["borderLeftWidth"]) }; } }); $3.fn.extend({ offset: function(val) { if (val === void 0) { if (this.length === 0) return void 0; let rect = this[0].getBoundingClientRect(); return { top: rect.top + (window.scrollY || window.pageYOffset || document.documentElement.scrollTop || 0), left: rect.left + (window.scrollX || window.pageXOffset || document.documentElement.scrollLeft || 0) }; } return this.each(function() { let { top, left } = val; let el = $3(this), position = getComputedStyle(this).position; let currentRect = this.getBoundingClientRect(); let currentOffset = { top: currentRect.top + (window.scrollY || window.pageYOffset || 0), left: currentRect.left + (window.scrollX || window.pageXOffset || 0) }; if (position === "static") { el.css("position", "relative"); } if (["absolute", "fixed"].indexOf(position) === -1) { top = top - currentOffset.top; left = left - currentOffset.left; } if (top) el.css("top", top); if (left) el.css("left", left); }); }, position: function(margin = false) { let ml = 0, mt3 = 0, el, style; if (this.length === 0) { return void 0; } el = this[0]; style = getComputedStyle(el); if (margin) { ml = parseInt(style["marginLeft"]); mt3 = parseInt(style["marginTop"]); } return { left: el.offsetLeft - ml, top: el.offsetTop - mt3 }; }, left: function(val, margin) { if (this.length === 0) return; if (not2(val)) { return this.position(margin).left; } if (typeof val === "boolean") { margin = val; return this.position(margin).left; } return this.each(function() { $3(this).css({ left: val }); }); }, top: function(val, margin = false) { if (this.length === 0) return; if (not2(val)) { return this.position(margin).top; } if (typeof val === "boolean") { margin = val; return this.position(margin).top; } return this.each(function() { $3(this).css({ top: val }); }); }, rect: function() { return this.length === 0 ? void 0 : this[0].getBoundingClientRect(); }, pos: function() { if (this.length === 0) return; const el = $3(this[0]); return { top: parseInt(el.style("top")), left: parseInt(el.style("left")) }; } }); $3.fn.extend({ attr: function(name2, val) { const attributes = {}; if (this.length === 0 && arguments.length === 0) { return void 0; } if (this.length && arguments.length === 0) { $3.each(this[0].attributes, function() { attributes[this.name] = this.value; }); return attributes; } if (arguments.length === 1 && typeof name2 === "string") { return this.length && this[0].nodeType === 1 && this[0].hasAttribute(name2) ? this[0].getAttribute(name2) : void 0; } return this.each(function() { const el = this; if (isPlainObject(name2)) { $3.each(name2, function(k5, v5) { el.setAttribute(k5, v5); }); } else { el.setAttribute(name2, val); } }); }, removeAttr: function(name2) { let attributes; if (!name2) { return this.each(function(_5, el) { const attributes2 = $3(el).attr(); $3.each(attributes2, function(k5) { el.removeAttribute(k5); }); }); } attributes = typeof name2 === "string" ? name2.split(",").map(function(el) { return el.trim(); }) : name2; return this.each(function() { const el = this; $3.each(attributes, function() { if (el.hasAttribute(this)) el.removeAttribute(this); }); }); }, toggleAttr: function(name2, val) { return this.each(function() { const el = this; if (not2(val)) { el.removeAttribute(name2); } else { el.setAttribute(name2, val); } }); }, id: function(val) { if (typeof val === "undefined") { return this.length === 1 ? $3(this[0]).attr("id") : this.map((el) => $3(el).attr("id")); } return this.each(function() { $3(this).attr("id", val); }); }, title: function(val) { if (typeof val === "undefined") { return this.length ? $3(this[0]).attr("title") : void 0; } return this.each(function() { $3(this).attr("title", val); }); }, href: function(val) { if (typeof val === "undefined") { return this.length ? this[0].tagName === "A" ? this[0].href : void 0 : void 0; } return this.each(function() { if (this.tagName === "A") { this.href = val; } }); }, name: function(val) { if (typeof val === "undefined") { return this.length ? this[0].name ? this[0].name : void 0 : void 0; } return this.each(function() { if (this.name) { this.name = val; } }); }, src: function(val) { if (typeof val === "undefined") { return this.length ? this[0].src ? this[0].src : void 0 : void 0; } return this.each(function() { if (this.src) { this.src = val; } }); } }); $3.extend({ meta: function(name2) { return not2(name2) ? $3("meta") : $3("meta[name='$name']".replace("$name", name2)); }, metaBy: function(name2) { return not2(name2) ? $3("meta") : $3("meta[$name]".replace("$name", name2)); }, doctype: function() { return $3("doctype"); }, html: function() { return $3("html"); }, head: function() { return $3("html").find("head"); }, body: function() { return $3("body"); }, document: function() { return $3(document); }, window: function() { return $3(window); }, charset: function(val) { if (val) { const m5 = $3("meta[charset]"); if (m5.length > 0) { m5.attr("charset", val); } } return document.characterSet; }, lang: function(val) { if (val) { const h3 = $3("html"); if (h3.length > 0) { h3.attr("lang", val); } } return document.documentElement.lang; }, title: function(val) { if (typeof val === "undefined") { return document.title; } document.title = val; } }); $3.extend({ bind: (fn, ctx) => fn.bind(ctx) }); (function(arr) { arr.forEach(function(item) { ["append", "prepend"].forEach(function(where) { if (hasProp(item, where)) { return; } Object.defineProperty(item, where, { configurable: true, enumerable: true, writable: true, value: function() { const argArr = Array.prototype.slice.call(arguments), docFrag = document.createDocumentFragment(); argArr.forEach(function(argItem) { const isNode = argItem instanceof Node; docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem))); }); if (where === "prepend") this.insertBefore(docFrag, this.firstChild); else this.appendChild(docFrag); } }); }); }); })([Element.prototype, Document.prototype, DocumentFragment.prototype]); var normalizeElements = function(s2) { let result; if (typeof s2 === "string") result = $3.isSelector(s2) ? $3(s2) : $3.parseHTML(s2); else if (s2 instanceof HTMLElement) result = [s2]; else if (isArrayLike(s2)) result = s2; return result; }; $3.fn.extend({ appendText: function(text) { return this.each(function(elIndex, el) { el.innerHTML += text; }); }, prependText: function(text) { return this.each(function(elIndex, el) { el.innerHTML = text + el.innerHTML; }); }, append: function(elements) { const _elements = normalizeElements(elements); return this.each(function(elIndex, el) { $3.each(_elements, function() { if (el === this) return; const child = elIndex === 0 ? this : this.cloneNode(true); if (child.tagName && child.tagName === "SCRIPT") { $3.script(child, el); } else { el.append(child); } }); }); }, appendTo: function(elements) { const _elements = normalizeElements(elements); return this.each(function(_5, el) { $3.each(_elements, function(parIndex, parent2) { if (el === this) return; parent2.append(parIndex === 0 ? el : el.cloneNode(true)); }); }); }, prepend: function(elements) { const _elements = normalizeElements(elements); return this.each(function(elIndex, el) { $3.each(_elements, function() { if (el === this) return; const child = elIndex === 0 ? this : this.cloneNode(true); $3.script(child); if (child.tagName && child.tagName !== "SCRIPT") el.prepend(child); }); }); }, prependTo: function(elements) { const _elements = normalizeElements(elements); return this.each(function() { const el = this; $3.each(_elements, function(parIndex, parent2) { if (el === this) return; $3(parent2).prepend(parIndex === 0 ? el : el.cloneNode(true)); }); }); }, insertBefore: function(elements) { const _elements = normalizeElements(elements); return this.each(function() { const el = this; $3.each(_elements, function(elIndex) { if (el === this) return; const parent2 = this.parentNode; if (parent2) { parent2.insertBefore(elIndex === 0 ? el : el.cloneNode(true), this); } }); }); }, insertAfter: function(elements) { const _elements = normalizeElements(elements); return this.each(function() { const el = this; $3.each(_elements, function(elIndex, element2) { if (el === this) return; const parent2 = this.parentNode; if (parent2) { parent2.insertBefore(elIndex === 0 ? el : el.cloneNode(true), element2.nextSibling); } }); }); }, after: function(html) { return this.each(function() { const el = this; if (typeof html === "string") { el.insertAdjacentHTML("afterend", html); } else { $3(html).insertAfter(el); } }); }, before: function(html) { return this.each(function() { const el = this; if (typeof html === "string") { el.insertAdjacentHTML("beforebegin", html); } else { $3(html).insertBefore(el); } }); }, clone: function(deep = false, withData = false) { const res = []; this.each(function() { const el = this.cloneNode(deep); const $el = $3(el); let data; if (withData && $3.hasData(this)) { data = $3(this).data(); $3.each(data, function(k5, v5) { $el.data(k5, v5); }); } res.push(el); }); return $3.merge($3(), res); }, import: function(deep) { const res = []; if (not2(deep)) { deep = false; } this.each(function() { res.push(document.importNode(this, deep)); }); return $3.merge($3(), res); }, adopt: function() { const res = []; this.each(function() { res.push(document.adoptNode(this)); }); return $3.merge($3(), res); }, remove: function(selector) { let i3 = 0, node, out, res = []; if (this.length === 0) { return; } out = selector ? this.filter(function(el) { return matches.call(el, selector); }) : this.items(); for (; (node = out[i3]) != null; i3++) { if (node.parentNode) { res.push(node.parentNode.removeChild(node)); $3.removeData(node); } } return $3.merge($3(), res); }, wrap: function(el) { if (this.length === 0) { return; } const wrapper = $3(normalizeElements(el)); if (!wrapper.length) { return; } const res = []; this.each(function() { let _target, _wrapper; _wrapper = wrapper.clone(true, true); _wrapper.insertBefore(this); _target = _wrapper; while (_target.children().length) { _target = _target.children().eq(0); } _target.append(this); res.push(_wrapper); }); return $3(res); }, wrapAll: function(el) { let wrapper, _wrapper, _target; if (this.length === 0) { return; } wrapper = $3(normalizeElements(el)); if (!wrapper.length) { return; } _wrapper = wrapper.clone(true, true); _wrapper.insertBefore(this[0]); _target = _wrapper; while (_target.children().length) { _target = _target.children().eq(0); } this.each(function() { _target.append(this); }); return _wrapper; }, wrapInner: function(el) { if (this.length === 0) { return; } const wrapper = $3(normalizeElements(el)); if (!wrapper.length) { return; } const res = []; this.each(function() { const elem = $3(this); const html = elem.html(); const wrp = wrapper.clone(true, true); elem.html(wrp.html(html)); res.push(wrp); }); return $3(res); } }); $3.extend({ animation: { duration: 1e3, ease: "linear", elements: {} } }); if (typeof window["setupAnimation"] === "object") { $3.each(window["setupAnimation"], function(key, val) { if (typeof $3.animation[key] !== "undefined" && !not2(val)) $3.animation[key] = val; }); } var transformProps = ["translateX", "translateY", "translateZ", "rotate", "rotateX", "rotateY", "rotateZ", "scale", "scaleX", "scaleY", "scaleZ", "skew", "skewX", "skewY"]; var numberProps = ["opacity", "zIndex"]; var floatProps = ["opacity", "volume"]; var scrollProps = ["scrollLeft", "scrollTop"]; var reverseProps = ["opacity", "volume"]; function _validElement(el) { return el instanceof HTMLElement || el instanceof SVGElement; } function _getRelativeValue(to2, from) { const operator = /^(\*=|\+=|-=)/.exec(to2); if (!operator) return to2; const u4 = getUnit(to2) || 0; const x5 = parseFloat(from); const y4 = parseFloat(to2.replace(operator[0], "")); switch (operator[0][0]) { case "+": return x5 + y4 + u4; case "-": return x5 - y4 + u4; case "*": return x5 * y4 + u4; case "/": return x5 / y4 + u4; } } function _getStyle(el, prop, pseudo) { if (typeof el[prop] !== "undefined") { if (scrollProps.indexOf(prop) > -1) { return prop === "scrollLeft" ? el === window ? scrollX : el.scrollLeft : el === window ? scrollY : el.scrollTop; } else { return el[prop] || 0; } } return el.style[prop] || getComputedStyle(el, pseudo)[prop]; } function _setStyle(el, key, val, unit, toInt) { if (not2(toInt)) { toInt = false; } key = camelCase(key); if (toInt) { val = parseInt(val); } if (_validElement(el)) { if (typeof el[key] !== "undefined") { el[key] = val; } else { el.style[key] = key === "transform" || key.toLowerCase().indexOf("color") > -1 ? val : val + unit; } } else { el[key] = val; } } function _applyStyles(el, mapProps, p5) { $3.each(mapProps, function(key, val) { _setStyle(el, key, val[0] + val[2] * p5, val[3], val[4]); }); } function _getElementTransforms(el) { if (!_validElement(el)) return {}; const str2 = el.style.transform || ""; const reg = /(\w+)\(([^)]*)\)/g; const transforms = {}; let m5; while (m5 = reg.exec(str2)) transforms[m5[1]] = m5[2]; return transforms; } function _getColorArrayFromHex(val) { const a2 = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(val ? val : "#000000"); return a2.slice(1).map(function(v5) { return parseInt(v5, 16); }); } function _getColorArrayFromElement(el, key) { return getComputedStyle(el)[key].replace(/[^\d.,]/g, "").split(",").map(function(v5) { return parseInt(v5); }); } function _applyTransform(el, mapProps, p5) { const t = []; const elTransforms = _getElementTransforms(el); $3.each(mapProps, function(key, val) { let from = val[0], to2 = val[1], delta = val[2], unit = val[3]; key = "" + key; if (key.indexOf("rotate") > -1 || key.indexOf("skew") > -1) { if (unit === "") unit = "deg"; } if (key.indexOf("scale") > -1) { unit = ""; } if (key.indexOf("translate") > -1 && unit === "") { unit = "px"; } if (unit === "turn") { t.push(key + "(" + to2 * p5 + unit + ")"); } else { t.push(key + "(" + (from + delta * p5) + unit + ")"); } }); $3.each(elTransforms, function(key, val) { if (mapProps[key] === void 0) { t.push(key + "(" + val + ")"); } }); el.style.transform = t.join(" "); } function _applyColors(el, mapProps, p5) { $3.each(mapProps, function(key, val) { let i3, result = [0, 0, 0], v5; for (i3 = 0; i3 < 3; i3++) { result[i3] = Math.floor(val[0][i3] + val[2][i3] * p5); } v5 = "rgb(" + result.join(",") + ")"; el.style[key] = v5; }); } function _expandColorValue(val) { const regExp = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; if (val[0] === "#" && val.length === 4) { return "#" + val.replace(regExp, function(m5, r2, g5, b5) { return r2 + r2 + g5 + g5 + b5 + b5; }); } return val[0] === "#" ? val : "#" + val; } function applyProps(el, map, p5) { _applyStyles(el, map.props, p5); _applyTransform(el, map.transform, p5); _applyColors(el, map.color, p5); } function createAnimationMap(el, draw, dir) { const map = { props: {}, transform: {}, color: {} }; let i3, from, to2, delta, unit, temp; const elTransforms = _getElementTransforms(el); if (not2(dir)) { dir = "normal"; } $3.each(draw, function(key, val) { const isTransformProp = transformProps.indexOf("" + key) > -1; const isNumProp = numberProps.indexOf("" + key) > -1; const isColorProp = ("" + key).toLowerCase().indexOf("color") > -1; if (Array.isArray(val) && val.length === 1) { val = val[0]; } if (!Array.isArray(val)) { if (isTransformProp) { from = elTransforms[key] || key === "scale" ? 1 : 0; } else if (isColorProp) { from = _getColorArrayFromElement(el, key); } else { from = _getStyle(el, key, void 0); } from = !isColorProp ? parseUnit(from) : from; to2 = !isColorProp ? parseUnit(_getRelativeValue(val, Array.isArray(from) ? from[0] : from)) : _getColorArrayFromHex(val); } else { from = !isColorProp ? parseUnit(val[0]) : _getColorArrayFromHex(_expandColorValue(val[0])); to2 = !isColorProp ? parseUnit(val[1]) : _getColorArrayFromHex(_expandColorValue(val[1])); } if (reverseProps.indexOf("" + key) > -1 && from[0] === to2[0]) { from[0] = to2[0] > 0 ? 0 : 1; } if (dir === "reverse") { temp = from; from = to2; to2 = temp; } unit = el instanceof HTMLElement && to2[1] === "" && !isNumProp && !isTransformProp ? "px" : to2[1]; if (isColorProp) { delta = [0, 0, 0]; for (i3 = 0; i3 < 3; i3++) { delta[i3] = to2[i3] - from[i3]; } } else { delta = to2[0] - from[0]; } if (isTransformProp) { map.transform[key] = [from[0], to2[0], delta, unit]; } else if (isColorProp) { map.color[key] = [from, to2, delta, unit]; } else { map.props[key] = [from[0], to2[0], delta, unit, floatProps.indexOf("" + key) === -1]; } }); return map; } function minMax(val, min, max) { return Math.min(Math.max(val, min), max); } var Easing = { linear: function() { return function(t) { return t; }; } }; Easing.default = Easing.linear; var eases = { Sine: function() { return function(t) { return 1 - Math.cos(t * Math.PI / 2); }; }, Circ: function() { return function(t) { return 1 - Math.sqrt(1 - t * t); }; }, Back: function() { return function(t) { return t * t * (3 * t - 2); }; }, Bounce: function() { return function(t) { let pow2, b5 = 4; while (t < ((pow2 = Math.pow(2, --b5)) - 1) / 11) { } return 1 / Math.pow(4, 3 - b5) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - t, 2); }; }, Elastic: function(amplitude, period) { if (not2(amplitude)) { amplitude = 1; } if (not2(period)) { period = 0.5; } const a2 = minMax(amplitude, 1, 10); const p5 = minMax(period, 0.1, 2); return function(t) { return t === 0 || t === 1 ? t : -a2 * Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1 - p5 / (Math.PI * 2) * Math.asin(1 / a2)) * (Math.PI * 2) / p5); }; } }; ["Quad", "Cubic", "Quart", "Quint", "Expo"].forEach(function(name2, i3) { eases[name2] = function() { return function(t) { return Math.pow(t, i3 + 2); }; }; }); Object.keys(eases).forEach(function(name2) { const easeIn = eases[name2]; Easing["easeIn" + name2] = easeIn; Easing["easeOut" + name2] = function(a2, b5) { return function(t) { return 1 - easeIn(a2, b5)(1 - t); }; }; Easing["easeInOut" + name2] = function(a2, b5) { return function(t) { return t < 0.5 ? easeIn(a2, b5)(t * 2) / 2 : 1 - easeIn(a2, b5)(t * -2 + 2) / 2; }; }; }); var defaultAnimationProps = { id: null, el: null, draw: {}, dur: $3.animation.duration, ease: $3.animation.ease, loop: 0, pause: 0, dir: "normal", defer: 0, onStart: function() { }, onStop: function() { }, onStopAll: function() { }, onPause: function() { }, onPauseAll: function() { }, onResume: function() { }, onResumeAll: function() { }, onFrame: function() { }, onDone: function() { } }; function animate(args) { return new Promise(function(resolve) { const that = this; const props = $3.assign({}, defaultAnimationProps, { dur: $3.animation.duration, ease: $3.animation.ease }, args); let id = props.id, el = props.el, draw = props.draw, dur = props.dur, ease = props.ease, loop = props.loop, onStart = props.onStart, onFrame = props.onFrame, onDone = props.onDone, pauseStart = props.pause, dir = props.dir, defer = props.defer; let map = {}; let easeName = "linear", easeArgs = [], easeFn = Easing.linear, matchArgs; let direction = dir === "alternate" ? "normal" : dir; let replay = false; let animationID = id ? id : +(performance.now() * Math.pow(10, 14)); if (not2(el)) { throw new Error("Unknown element!"); } if (typeof el === "string") { el = document.querySelector(el); } if (typeof draw !== "function" && typeof draw !== "object") { throw new Error("Unknown draw object. Must be a function or object!"); } if (dur === 0) { dur = 1; } if (dir === "alternate" && typeof loop === "number") { loop *= 2; } if (typeof ease === "string") { matchArgs = /\(([^)]+)\)/.exec(ease); easeName = ease.split("(")[0]; easeArgs = matchArgs ? matchArgs[1].split(",").map(function(p5) { return parseFloat(p5); }) : []; easeFn = Easing[easeName] || Easing.linear; } else if (typeof ease === "function") { easeFn = ease; } else { easeFn = Easing.linear; } $3.animation.elements[animationID] = { element: el, id: null, stop: 0, pause: 0, loop: 0, t: -1, started: 0, paused: 0 }; const play = function() { if (typeof draw === "object") { map = createAnimationMap(el, draw, direction); } if (typeof onStart === "function") { onStart.apply(el); } $3.animation.elements[animationID].loop += 1; $3.animation.elements[animationID].started = performance.now(); $3.animation.elements[animationID].duration = dur; $3.animation.elements[animationID].id = requestAnimationFrame(animate1); }; const done = function() { cancelAnimationFrame($3.animation.elements[animationID].id); delete $3.animation.elements[id]; if (typeof onDone === "function") { onDone.apply(el); } resolve(that); }; const animate1 = function(time) { let p5, t; let { stop, pause, started: start } = $3.animation.elements[animationID]; if ($3.animation.elements[animationID].paused) { start = time - $3.animation.elements[animationID].t * dur; $3.animation.elements[animationID].started = start; } t = ((time - start) / dur).toFixed(4); if (t > 1) t = 1; if (t < 0) t = 0; p5 = easeFn.apply(null, easeArgs)(t); $3.animation.elements[animationID].t = t; $3.animation.elements[animationID].p = p5; if (pause) { $3.animation.elements[animationID].id = requestAnimationFrame(animate1); return; } if (stop > 0) { if (stop === 2) { if (typeof draw === "function") { draw.bind(el)(1, 1); } else { applyProps(el, map, 1); } } done(); return; } if (typeof draw === "function") { draw.bind(el)(t, p5); } else { applyProps(el, map, p5); } if (typeof onFrame === "function") { onFrame.apply(el, [t, p5]); } if (t <= 1) { $3.animation.elements[animationID].id = requestAnimationFrame(animate1); } if (t >= 1) { if (loop) { if (dir === "alternate") { direction = direction === "normal" ? "reverse" : "normal"; } if (typeof loop === "boolean") { setTimeout(function() { play(); }, pauseStart); } else { if (loop > $3.animation.elements[animationID].loop) { setTimeout(function() { play(); }, pauseStart); } else { done(); } } } else { if (dir === "alternate" && !replay) { direction = direction === "normal" ? "reverse" : "normal"; replay = true; play(); } else { done(); } } } }; if (defer > 0) { setTimeout(function() { play(); }, defer); } else { play(); } }); } function stopAnimation(id, done) { const an = $3.animation.elements[id]; if (typeof an === "undefined") { return; } if (not2(done)) { done = true; } an.stop = done === true ? 2 : 1; if (typeof an.onStop === "function") { an.onStop.apply(an.element); } } function stopAnimationAll(done, filter) { $3.each($3.animation.elements, function(k5, v5) { if (filter) { if (typeof filter === "string") { if (matches.call(v5.element, filter)) stopAnimation(k5, done); } else if (filter.length) { $3.each(filter, function() { if (v5.element === this) stopAnimation(k5, done); }); } else if (filter instanceof Element) { if (v5.element === filter) stopAnimation(k5, done); } } else { stopAnimation(k5, done); } }); } function pauseAnimation(id) { const an = $3.animation.elements[id]; if (typeof an === "undefined") { return; } an.pause = 1; an.paused = performance.now(); if (typeof an.onPause === "function") { an.onPause.apply(an.element); } } function pauseAnimationAll(filter) { $3.each($3.animation.elements, function(k5, v5) { if (filter) { if (typeof filter === "string") { if (matches.call(v5.element, filter)) pauseAnimation(k5); } else if (filter.length) { $3.each(filter, function() { if (v5.element === this) pauseAnimation(k5); }); } else if (filter instanceof Element) { if (v5.element === filter) pauseAnimation(k5); } } else { pauseAnimation(k5); } }); } function resumeAnimation(id) { const an = $3.animation.elements[id]; if (typeof an === "undefined") { return; } an.pause = 0; an.paused = 0; if (typeof an.onResume === "function") { an.onResume.apply(an.element); } } function resumeAnimationAll(filter) { $3.each($3.animation.elements, function(k5, v5) { if (filter) { if (typeof filter === "string") { if (matches.call(v5.element, filter)) resumeAnimation(k5); } else if (filter.length) { $3.each(filter, function() { if (v5.element === this) resumeAnimation(k5); }); } else if (filter instanceof Element) { if (v5.element === filter) resumeAnimation(k5); } } else { resumeAnimation(k5); } }); } var defaultChainOptions = { loop: false, onChainItem: null, onChainItemComplete: null, onChainComplete: null }; function chain(arr, opt2) { const o2 = $3.extend({}, defaultChainOptions, opt2); if (typeof o2.loop !== "boolean") { o2.loop--; } if (!Array.isArray(arr)) { console.warn("Chain array is not defined!"); return false; } const reducer = function(acc, item) { return acc.then(function() { if (typeof o2["onChainItem"] === "function") { o2["onChainItem"](item); } return animate(item).then(function() { if (typeof o2["onChainItemComplete"] === "function") { o2["onChainItemComplete"](item); } }); }); }; arr.reduce(reducer, Promise.resolve()).then(function() { if (typeof o2["onChainComplete"] === "function") { o2["onChainComplete"](); } if (o2.loop) { chain(arr, o2); } }); } $3.easing = {}; $3.extend($3.easing, Easing); $3.extend({ animate: function(args) { let el, draw, dur, ease, cb; if (arguments.length > 1) { el = $3(arguments[0])[0]; draw = arguments[1]; dur = arguments[2] || $3.animation.duration; ease = arguments[3] || $3.animation.ease; cb = arguments[4]; if (typeof dur === "function") { cb = dur; ease = $3.animation.ease; dur = $3.animation.duration; } if (typeof ease === "function") { cb = ease; ease = $3.animation.ease; } return animate({ el, draw, dur, ease, onDone: cb }); } return animate(args); }, chain, stop: stopAnimation, stopAll: stopAnimationAll, resume: resumeAnimation, resumeAll: resumeAnimationAll, pause: pauseAnimation, pauseAll: pauseAnimationAll }); $3.fn.extend({ /** * args = { draw: {} | function, dur: 1000, ease: "linear", loop: 0, pause: 0, dir: "normal", defer: 0, onFrame: function, onDone: function } * @returns {this} */ animate: function(args) { const that = this; let draw, dur, easing, cb; const a2 = args; let compatibilityMode; compatibilityMode = !Array.isArray(args) && (arguments.length > 1 || arguments.length === 1 && typeof arguments[0].draw === "undefined"); if (compatibilityMode) { draw = arguments[0]; dur = arguments[1] || $3.animation.duration; easing = arguments[2] || $3.animation.ease; cb = arguments[3]; if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; easing = $3.animation.ease; } if (typeof easing === "function") { cb = easing; easing = $3.animation.ease; } return this.each(function() { return $3.animate({ el: this, draw, dur, ease: easing, onDone: cb }); }); } if (Array.isArray(args)) { $3.each(args, function() { const a22 = this; that.each(function() { a22.el = this; $3.animate(a22); }); }); return this; } return this.each(function() { a2.el = this; $3.animate(a2); }); }, chain: function(arr, loop) { return this.each(function() { const el = this; $3.each(arr, function() { this.el = el; }); $3.chain(arr, loop); }); }, /** * * @param done * @returns {this} */ stop: function(done) { return this.each(function() { const el = this; $3.each($3.animation.elements, function(k5, o2) { if (o2.element === el) { stopAnimation(k5, done); } }); }); }, pause: function() { return this.each(function() { const el = this; $3.each($3.animation.elements, function(k5, o2) { if (o2.element === el) { pauseAnimation(k5); } }); }); }, resume: function() { return this.each(function() { const el = this; $3.each($3.animation.elements, function(k5, o2) { if (o2.element === el) { resumeAnimation(k5); } }); }); } }); $3.extend({ hidden: function(el, val, cb) { el = $3(el)[0]; if (typeof val === "undefined") { el.hidden = !el.hidden; return this; } if (typeof val === "string") { val = val.toLowerCase() === "true"; } if (typeof val === "function") { cb = val; val = !el.hidden; } el.hidden = val; if (typeof cb === "function") { $3.bind(cb, el); cb.call(el, arguments); } return this; }, hide: function(el, cb) { const $el = $3(el); el = $el[0]; const inline = el.style.display; const css = getComputedStyle(el, null).display; $el.origin("display", { inline, css }); el.style.display = "none"; if (typeof cb === "function") { $3.bind(cb, el); cb.call(el, arguments); } return this; }, show: function(el, cb) { const $el = $3(el); const display = $el.origin("display"); el = $3(el)[0]; el.style.display = ""; if (display) { const inline = display.inline || ""; const css = display.css || ""; if (inline && inline !== "none") { el.style.display = inline; } else if (css === "none") { el.style.display = "block"; } } else { el.style.display = "block"; } if (parseInt(el.style.opacity) === 0) { el.style.opacity = "1"; } if (typeof cb === "function") { $3.bind(cb, el); cb.call(el, arguments); } return this; }, visible: function(el, mode, cb) { if (mode === void 0) { mode = true; } el.style.visibility = mode ? "visible" : "hidden"; if (typeof cb === "function") { $3.bind(cb, el); cb.call(el, arguments); } return this; }, toggle: function(el, cb) { const func = getComputedStyle(el, null).display !== "none" ? "hide" : "show"; return $3[func](el, cb); } }); $3.fn.extend({ hide: function() { let callback; $3.each(arguments, function() { if (typeof this === "function") { callback = this; } }); return this.each(function() { $3.hide(this, callback); }); }, show: function() { let callback; $3.each(arguments, function() { if (typeof this === "function") { callback = this; } }); return this.each(function() { $3.show(this, callback); }); }, visible: function(mode, cb) { return this.each(function() { $3.visible(this, mode, cb); }); }, toggle: function(cb) { return this.each(function() { $3.toggle(this, cb); }); }, hidden: function(val, cb) { return this.each(function() { $3.hidden(this, val, cb); }); } }); $3.extend({ fx: { off: false } }); $3.fn.extend({ fadeIn: function(dur, easing, cb) { return this.each(function() { const el = this; const $el = $3(el); const visible = !(!isVisible(el) || isVisible(el) && +$el.style("opacity") === 0); if (not2(dur) && not2(easing) && not2(cb)) { cb = null; dur = $3.animation.duration; } else if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; } if (typeof easing === "function") { cb = easing; easing = $3.animation.ease; } if ($3.fx.off) { dur = 0; } if (visible) { if (typeof cb === "function") { $3.bind(cb, this)(); } return this; } const originDisplay = $el.origin("display", void 0, "block"); el.style.opacity = "0"; el.style.display = originDisplay; return $3.animate({ el, draw: { opacity: 1 }, dur, ease: easing, onDone: function() { if (typeof cb === "function") { $3.bind(cb, this)(); } } }); }); }, fadeOut: function(dur, easing, cb) { return this.each(function() { const el = this; const $el = $3(el); if (not2(dur) && not2(easing) && not2(cb)) { cb = null; dur = $3.animation.duration; } else if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; } if (typeof easing === "function") { cb = easing; easing = $3.animation.ease; } $el.origin("display", $el.style("display")); if (!isVisible(el)) { if (typeof cb === "function") { $3.bind(cb, this)(); } return this; } return $3.animate({ el, draw: { opacity: 0 }, dur, ease: easing, onDone: function() { this.style.display = "none"; if (typeof cb === "function") { $3.bind(cb, this)(); } } }); }); }, slideUp: function(dur, easing, cb) { return this.each(function() { const el = this; const $el = $3(el); let currHeight; if ($el.height() === 0) return; if (not2(dur) && not2(easing) && not2(cb)) { cb = null; dur = $3.animation.duration; } else if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; } if (typeof easing === "function") { cb = easing; easing = $3.animation.ease; } currHeight = $el.height(); $el.origin("height", currHeight); $el.origin("display", $3(el).style("display")); $el.css({ overflow: "hidden" }); return $3.animate({ el, draw: { height: 0 }, dur, ease: easing, onDone: function() { $el.hide().removeStyleProperty("overflow, height"); if (typeof cb === "function") { $3.bind(cb, this)(); } } }); }); }, slideDown: function(dur, easing, cb) { return this.each(function() { const el = this; const $el = $3(el); let targetHeight, originDisplay; if (not2(dur) && not2(easing) && not2(cb)) { cb = null; dur = $3.animation.duration; } else if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; } if (typeof easing === "function") { cb = easing; easing = $3.animation.ease; } $el.show().visible(false); targetHeight = +$el.origin("height", void 0, $el.height()); if (parseInt(targetHeight) === 0) { targetHeight = el.scrollHeight; } originDisplay = $el.origin("display", $el.style("display"), "block"); $el.height(0).visible(true); $el.css({ overflow: "hidden", display: originDisplay === "none" ? "block" : originDisplay }); return $3.animate({ el, draw: { height: targetHeight }, dur, ease: easing, onDone: function() { $3(el).removeStyleProperty("overflow, height, visibility"); if (typeof cb === "function") { $3.bind(cb, this)(); } } }); }); }, moveTo: function(x5, y4, dur, ease, cb) { const draw = { top: y4, left: x5 }; if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; ease = $3.animation.ease; } if (typeof ease === "function") { cb = ease; ease = $3.animation.ease; } return this.each(function() { $3.animate({ el: this, draw, dur, ease, onDone: cb }); }); }, centerTo: function(x5, y4, dur, ease, cb) { if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; ease = $3.animation.ease; } if (typeof ease === "function") { cb = ease; ease = $3.animation.ease; } return this.each(function() { const draw = { left: x5 - this.clientWidth / 2, top: y4 - this.clientHeight / 2 }; $3.animate({ el: this, draw, dur, ease, onDone: cb }); }); }, colorTo: function(color, dur, easing, cb) { const draw = { color }; if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; easing = $3.animation.ease; } if (typeof easing === "function") { cb = easing; easing = $3.animation.ease; } return this.each(function() { $3.animate({ el: this, draw, dur, ease: easing, onDone: cb }); }); }, backgroundTo: function(color, dur, easing, cb) { const draw = { backgroundColor: color }; if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; easing = $3.animation.ease; } if (typeof easing === "function") { cb = easing; easing = $3.animation.ease; } return this.each(function() { $3.animate({ el: this, draw, dur, ease: easing, onDone: cb }); }); }, zoomIn: function(dur, easing, cb) { const draw = { scale: [0, 1] }; if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; easing = $3.animation.ease; } if (typeof easing === "function") { cb = easing; easing = $3.animation.ease; } return this.each(function() { $3.animate({ el: this, draw, dur, ease: easing, onDone: cb }); }); }, zoomOut: function(dur = 1e3, ease = "linear", cb = () => { }) { if (typeof dur === "function") { cb = dur; dur = $3.animation.duration; ease = $3.animation.ease; } if (typeof ease === "function") { cb = ease; ease = $3.animation.ease; } return this.each(function() { $3.animate({ el: this, draw: { scale: 0 }, dur, ease, onDone: cb }); }); } }); $3.extend({ scrollTop: function(val) { if (not2(val)) { return window.scrollY; } window.scrollTo(window.scrollX, val); }, scrollLeft: function(val) { if (not2(val)) { return window.scrollX; } window.scrollTo(val, window.scrollY); }, scrollTo: function(x5, y4) { window.scrollTo(x5, y4); }, scrollToElement: function(el) { $3(el).scrollTo(); } }); $3.fn.extend({ scrollTop: function(val) { if (not2(val)) { return this.length === 0 ? void 0 : this[0] === window ? scrollY : this[0].scrollTop; } return this.each(function() { if (this === window) { window.scrollTo(window.scrollX, val); return; } this.scrollTop = val; }); }, scrollLeft: function(val) { if (not2(val)) { return this.length === 0 ? void 0 : this[0] === window ? scrollX : this[0].scrollLeft; } return this.each(function() { if (this === window) { window.scrollTo(val, window.scrollY); return; } this.scrollLeft = val; }); }, scrollTo: function(relativeToViewport = false) { if (this.length === 0) { return this; } const rect = this[0].getBoundingClientRect(); const x5 = rect.left + (relativeToViewport ? 0 : window.scrollX); const y4 = rect.top + (relativeToViewport ? 0 : window.scrollY); window.scrollTo(x5, y4); return this; } }); $3.init = function(sel, ctx) { let parsed; const that = this; if (typeof sel === "string") { sel = sel.trim(); } this.uid = $3.uniqueId(); if (!sel) { return this; } if (typeof sel === "function") { return $3.ready(sel); } if (sel instanceof Element) { this.push(sel); return this; } if (sel instanceof $3) { $3.each(sel, function() { that.push(this); }); return this; } if (sel === "window" || sel === window) { this.push(window); return this; } if (sel === "document" || sel === document) { this.push(document); return this; } if (sel === "body" || sel === document.body) { this.push(document.body); return this; } if (sel === "html" || sel === document.documentElement) { this.push(document.documentElement); return this; } if (sel === "doctype" || sel === document.doctype) { this.push(document.doctype); return this; } if (sel && sel.nodeType) { this.push(sel); return this; } if (isArrayLike(sel)) { $3.each(sel, function() { $3(this).each(function() { that.push(this); }); }); return this; } if (typeof sel !== "string" && (sel.self && sel.self !== window)) { return this; } if (sel === "#" || sel === ".") { return this; } if (sel[0] === "@") { $3("[data-role]").each(function() { const roles = str2arr($3(this).attr("data-role"), ","); if (roles.indexOf(sel.slice(1)) > -1) { that.push(this); } }); } else { parsed = $3.parseHTML(sel); for (let i3 = 0; i3 < parsed.length; i3++) { if (parsed[i3].nodeType === 1) { this.push(parsed[i3]); } } } if (ctx !== void 0) { if (ctx instanceof $3) { this.each(function() { $3(ctx).append(that); }); } else if (ctx instanceof HTMLElement) { $3(ctx).append(that); } else { if (isPlainObject(ctx)) { $3.each(this, function() { for (const name2 in ctx) { if (hasProp(ctx, name2)) this.setAttribute(name2, ctx[name2]); } }); } } } return this; }; $3.init.prototype = $3.fn; // source/dom/index.js globalThis.Dom = $3; if (typeof $ === "undefined") { globalThis.$ = $3; } // node_modules/@olton/hooks/dist/hooks.js var hooks_exports = {}; __export(hooks_exports, { EVENTS: () => EVENTS, info: () => info2, useClickOutside: () => useClickOutside, useCompose: () => useCompose, useCookie: () => useCookie, useCurry: () => useCurry, useDebounce: () => useDebounce, useEvent: () => useEvent, useId: () => useId, useInterval: () => useInterval, useMediaQuery: () => useMediaQuery, useMemo: () => useMemo, usePipe: () => usePipe, useQueue: () => useQueue, useState: () => useState, useThrottle: () => useThrottle, useToggle: () => useToggle }); function useClickOutside(element2, callback) { if (!element2) return { attach: () => { }, detach: () => { } }; const handleClick = (e2) => { if (!element2.contains(e2.target)) { callback(); } }; const attach = () => document.addEventListener("click", handleClick); const detach = () => document.removeEventListener("click", handleClick); return { attach, detach }; } function useCompose(...functions) { if (!functions.every((fn) => typeof fn === "function")) { throw new Error("useCompose: All arguments should be functions"); } switch (functions.length) { // No functions provided case 0: return (x5) => x5; // One function provided case 1: return functions[0]; // Two functions provided case 2: { const [f5, g5] = functions; return (...args) => f5(g5(...args)); } // Three or more functions provided default: return function composed(...args) { let result = functions[functions.length - 1](...args); for (let i3 = functions.length - 2; i3 >= 0; i3--) { result = functions[i3](result); } return result; }; } } function useCookie(name2) { function getCookie() { const matches2 = document.cookie.match( new RegExp(`(?:^|; )${name2.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1")}=([^;]*)`) ); return matches2 ? decodeURIComponent(matches2[1]) : null; } function setCookie(value, options = {}) { options = { path: "/", ...options }; document.cookie = `${name2}=${encodeURIComponent(value)}; ${Object.keys(options).map((key) => `${key}=${options[key]}`).join("; ")}`; } function deleteCookie() { setCookie("", { "max-age": -1 }); } return { get: getCookie, set: setCookie, delete: deleteCookie }; } function useCurry(func) { if (typeof func !== "function") { throw new Error("useCurry: \u043F\u0435\u0440\u0432\u044B\u0439 \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442 \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0444\u0443\u043D\u043A\u0446\u0438\u0435\u0439"); } return function curried(...args) { if (args.length >= func.length) { return func.apply(this, args); } return function(...args2) { return curried.apply(this, args.concat(args2)); }; }; } function useDebounce(fn, wait, options = {}) { if (typeof fn !== "function") { throw new Error("useDebounce: \u043F\u0435\u0440\u0432\u044B\u0439 \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442 \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0444\u0443\u043D\u043A\u0446\u0438\u0435\u0439"); } if (wait < 0) { throw new Error("useDebounce: \u0432\u0440\u0435\u043C\u044F \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043F\u043E\u043B\u043E\u0436\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u043C \u0447\u0438\u0441\u043B\u043E\u043C"); } let timer = null; let result; function debounced(...args) { const context = this; const callNow = options.immediate && !timer; if (timer !== null) { clearTimeout(timer); } timer = setTimeout(() => { timer = null; if (!options.immediate) { result = fn.apply(context, args); } }, wait); if (callNow) { result = fn.apply(context, args); } return result; } debounced.cancel = function() { if (timer !== null) { clearTimeout(timer); timer = null; } }; return debounced; } var EVENTS = /* @__PURE__ */ ((EVENTS2) => { EVENTS2["LOAD"] = "load"; EVENTS2["VIEWPORT"] = "viewport"; EVENTS2["ATTRIBUTE"] = "attribute"; EVENTS2["CHILDREN"] = "children"; EVENTS2["DATA"] = "data"; return EVENTS2; })(EVENTS || {}); var useEvent = ({ event, root, target, effect }) => { const _target = typeof target === "string" ? document.querySelector(target) : target; if (typeof effect !== "function") { throw Error("Side effect must be a function!"); } if (!_target) { throw Error("Please specify a target element!"); } switch (event) { case "load": { const observer = new MutationObserver((mutations, observer2) => { const el = document.querySelector(target); if (el !== null) { effect(el); observer2.disconnect(); } }); observer.observe(document.body, { childList: true, subtree: true }); break; } case "viewport": { const _root = root instanceof HTMLElement ? root : typeof root === "string" ? document.querySelector(root) : null; const observerOptions = { root: _root, rootMargin: "0px", threshold: 0.5 }; const observer = new IntersectionObserver((entries, observer2) => { for (const entry of entries) { if (entry.isIntersecting) { effect(_target); } } }, observerOptions); observer.observe(_target); break; } case "attribute": { const observer = new MutationObserver((mutations) => { for (const mut of mutations) { if (mut.target === _target && mut.type === "attributes") { effect(_target, mut.attributeName, _target.getAttribute(mut.attributeName)); } } }); observer.observe(_target, { attributes: true }); break; } case "children": { const observer = new MutationObserver((mutations) => { for (const mut of mutations) { if (mut.target === _target && mut.type === "childList") { effect(_target, mut.addedNodes, mut.removedNodes); } } }); observer.observe(_target, { childList: true, subtree: true }); break; } case "data": { const observer = new MutationObserver((mutations) => { for (const mut of mutations) { if (mut.target === _target && mut.type === "characterData") { effect(_target, _target.textContent); } } }); observer.observe(_target, { characterData: true }); break; } default: { if (_target instanceof HTMLElement) { _target.addEventListener(event, (e2) => { effect(_target, e2); }); } } } }; var idStore = /* @__PURE__ */ new Map(); var idCounter = 0; function normalizeKeyForId(keyStr) { return keyStr.replace(/[^a-zA-Z0-9_-]/g, "_"); } function useId(key, options = {}) { const actualKey = key ?? Symbol("id-key"); const { divider = "-", prefix = "id", forceNew = false } = options; if (!forceNew && idStore.has(actualKey)) { return idStore.get(actualKey); } const isClient = typeof document !== "undefined"; const maxAttempts = 1e3; let attempts = 0; const generateId = () => { let keyType; if (key instanceof HTMLElement) { keyType = key.tagName.toLowerCase(); } else if (typeof key === "object" && key !== null) { keyType = "object"; } else if (key !== void 0) { keyType = normalizeKeyForId(String(key)); } else { keyType = "generic"; } return `${prefix}${divider}${keyType}${divider}${idCounter++}`; }; let id = generateId(); if (isClient) { while (document.getElementById(id)) { if (attempts++ > maxAttempts) { throw new Error("useId: \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 ID \u043F\u043E\u0441\u043B\u0435 \u043C\u043D\u043E\u0433\u043E\u0447\u0438\u0441\u043B\u0435\u043D\u043D\u044B\u0445 \u043F\u043E\u043F\u044B\u0442\u043E\u043A"); } id = generateId(); } } idStore.set(actualKey, id); return id; } function useInterval(callback, delay) { let timerId = null; function start() { if (timerId) return; timerId = window.setInterval(() => callback(), delay); } function stop() { if (timerId) { window.clearInterval(timerId); timerId = null; } } return { start, stop }; } function useMediaQuery(query) { const mediaQuery = window.matchMedia(query); function getMatches() { return mediaQuery.matches; } let matches2 = getMatches(); function handleChange() { matches2 = getMatches(); } mediaQuery.addEventListener("change", handleChange); return matches2; } var useMemo = (fn, options = {}) => { const cache = /* @__PURE__ */ new Map(); const { maxSize } = options; const memoized = (...args) => { const key = JSON.stringify(args); if (cache.has(key)) { return cache.get(key); } const result = fn(...args); if (maxSize && cache.size >= maxSize) { const firstKey = cache.keys().next().value; if (typeof firstKey === "string") { cache.delete(firstKey); } } cache.set(key, result); return result; }; memoized.clearCache = () => { cache.clear(); return true; }; return memoized; }; function usePipe(...functions) { if (!functions.every((fn) => typeof fn === "function")) { throw new Error("usePipe: \u0432\u0441\u0435 \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442\u044B \u0434\u043E\u043B\u0436\u043D\u044B \u0431\u044B\u0442\u044C \u0444\u0443\u043D\u043A\u0446\u0438\u044F\u043C\u0438"); } switch (functions.length) { case 0: return (x5) => x5; case 1: return functions[0]; case 2: { const [f5, g5] = functions; return (...args) => g5(f5(...args)); } default: return function piped(...args) { let result = functions[0](...args); for (let i3 = 1; i3 < functions.length; i3++) { result = functions[i3](result); } return result; }; } } function useQueue() { const queue = []; return { enqueue: (item) => { queue.push(item); return queue.length; }, dequeue: () => queue.shift(), peek: () => queue[0] || null, size: () => queue.length, isEmpty: () => queue.length === 0, clear: () => { queue.length = 0; } }; } var state = []; var stateIndex = -1; var StateValue = class { constructor(index) { this.index = index; } valueOf() { return state[this.index].value; } toString() { const value = state[this.index].value; return String(value); } [Symbol.toPrimitive](hint) { const value = state[this.index].value; if (hint === "number" && typeof value === "number") return value; if (hint === "string") return String(value); return value; } }; var useState = (initialState, onStateChange) => { const index = stateIndex++; if (!state[index]) { state[index] = { value: initialState }; } const stateValue = new StateValue(index); const setState = (arg) => { const old = state[index].value; const newValue = typeof arg === "function" ? arg(old) : arg; state[index].value = newValue; if (typeof onStateChange === "function") { onStateChange(newValue, old); } }; return [stateValue, setState]; }; function useThrottle(fn, wait, options = {}) { if (typeof fn !== "function") { throw new Error("useThrottle: \u043F\u0435\u0440\u0432\u044B\u0439 \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442 \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0444\u0443\u043D\u043A\u0446\u0438\u0435\u0439"); } if (wait < 0) { throw new Error("useThrottle: \u0432\u0440\u0435\u043C\u044F \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043F\u043E\u043B\u043E\u0436\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u043C \u0447\u0438\u0441\u043B\u043E\u043C"); } let timer = null; let lastArgs = null; let lastThis = null; let result; let lastCallTime = null; const { leading = true, trailing = true } = options; function invokeFunction() { result = fn.apply(lastThis, lastArgs); lastArgs = lastThis = null; lastCallTime = Date.now(); } function throttled(...args) { const now = Date.now(); if (!lastCallTime && !leading) { lastCallTime = now; } const remainingTime = wait - (now - lastCallTime); lastArgs = args; lastThis = this; if (remainingTime <= 0 || remainingTime > wait) { if (timer) { clearTimeout(timer); timer = null; } invokeFunction(); } else if (!timer && trailing) { timer = setTimeout(() => { timer = null; if (trailing && lastArgs) { invokeFunction(); } }, remainingTime); } return result; } throttled.cancel = function() { if (timer) { clearTimeout(timer); timer = null; } lastArgs = lastThis = null; lastCallTime = null; }; return throttled; } function useToggle(initialValue = false) { let value = initialValue; return { get: () => value, toggle: () => { value = !value; return value; }, set: (newValue) => { value = newValue; return value; } }; } var version2 = "0.13.0"; var build_time2 = "07.03.2025, 23:32:05"; var info2 = () => { console.info(`%c Hooks %c v${version2} %c ${build_time2} `, "color: #ffffff; font-weight: bold; background: #5c2c05", "color: white; background: darkgreen", "color: white; background: #0080fe;"); }; // source/hooks/index.js globalThis.Hooks = hooks_exports; // node_modules/@olton/farbe/dist/farbe.js var Le = Object.defineProperty; var $e = (e2, t) => { for (var s2 in t) Le(e2, s2, { get: t[s2], enumerable: true }); }; var xe = {}; $e(xe, { Primitives: () => ue, add: () => we, brighten: () => _e, cmyk2rgb: () => de, cmyk2websafe: () => He, colorDefaultProps: () => X2, colorToString: () => he, colorType: () => S2, colorTypes: () => p, create: () => Ne, createColor: () => Me, createColorScheme: () => ke, darken: () => pe, desaturate: () => ve, equal: () => fe, expand: () => Ee, expandHexColor: () => j2, grayscale: () => ce, hex2hsv: () => Ye, hex2rgb: () => ee, hex2websafe: () => Ce, hsl2hsv: () => ie, hsl2websafe: () => Ge, hsv2hex: () => Oe, hsv2hsl: () => se, hsv2rgb: () => H2, hsv2websafe: () => Be, hueShift: () => be, isCMYK: () => T2, isColor: () => y, isDark: () => Z2, isHEX: () => Q2, isHSL: () => I2, isHSLA: () => N2, isHSV: () => K2, isLight: () => oe, isPrimitive: () => Ae, isRGB: () => U2, isRGBA: () => L2, lighten: () => V2, mix: () => g2, multiply: () => re, parse: () => J2, parseColor: () => _2, random: () => qe, randomColor: () => ae, rgb2cmyk: () => le, rgb2hex: () => te, rgb2hsv: () => k2, rgb2websafe: () => F2, rgba2websafe: () => Se, saturate: () => P, shade: () => ge, spin: () => me, test: () => ye, toCMYK: () => D2, toColor: () => x2, toHEX: () => M3, toHSL: () => W2, toHSLA: () => $4, toHSV: () => E2, toRGB: () => c2, toRGBA: () => A2, websafe: () => ne }); var d = class { constructor(t = 0, s2 = 0, n3 = 0) { this.h = t, this.s = s2, this.v = n3; } toString() { return "hsv(" + [Math.round(this.h), Math.round(this.s * 100) + "%", Math.round(this.v * 100) + "%"].join(",") + ")"; } }; var C2 = class { constructor(t = 0, s2 = 0, n3 = 0) { this.h = t, this.s = ("" + s2).includes("%") ? parseInt(s2) / 100 : s2, this.l = ("" + n3).includes("%") ? parseInt(n3) / 100 : n3; } toString() { return "hsl(" + [Math.round(this.h), Math.round(this.s * 100) + "%", Math.round(this.l * 100) + "%"].join(",") + ")"; } }; var B2 = class { constructor(t = 0, s2 = 0, n3 = 0, r2 = 0) { this.h = t, this.s = ("" + s2).includes("%") ? parseInt(s2) / 100 : s2, this.l = ("" + n3).includes("%") ? parseInt(n3) / 100 : n3, this.a = r2; } toString() { return "hsla(" + [Math.round(this.h), Math.round(this.s * 100) + "%", Math.round(this.l * 100) + "%", parseFloat(this.a).toFixed(2)].join(",") + ")"; } }; var b2 = class { constructor(t = 0, s2 = 0, n3 = 0) { this.r = t, this.g = s2, this.b = n3; } toString() { return `rgb(${this.r},${this.g},${this.b})`; } }; var w2 = class { constructor(t = 0, s2 = 0, n3 = 0, r2 = 0) { this.r = t, this.g = s2, this.b = n3, this.a = r2; } toString() { return `rgba(${this.r},${this.g},${this.b},${this.a})`; } }; var G3 = class { constructor(t = 0, s2 = 0, n3 = 0, r2 = 0) { this.c = t, this.m = s2, this.y = n3, this.k = r2; } toString() { return `cmyk(${this.c},${this.m},${this.y},${this.k})`; } }; var q2 = { aliceBlue: "#f0f8ff", antiqueWhite: "#faebd7", aqua: "#00ffff", aquamarine: "#7fffd4", azure: "#f0ffff", beige: "#f5f5dc", bisque: "#ffe4c4", black: "#000000", blanchedAlmond: "#ffebcd", blue: "#0000ff", blueViolet: "#8a2be2", brown: "#a52a2a", burlyWood: "#deb887", cadetBlue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", cornflowerBlue: "#6495ed", cornsilk: "#fff8dc", crimson: "#dc143c", cyan: "#00ffff", darkBlue: "#00008b", darkCyan: "#008b8b", darkGoldenRod: "#b8860b", darkGray: "#a9a9a9", darkGreen: "#006400", darkKhaki: "#bdb76b", darkMagenta: "#8b008b", darkOliveGreen: "#556b2f", darkOrange: "#ff8c00", darkOrchid: "#9932cc", darkRed: "#8b0000", darkSalmon: "#e9967a", darkSeaGreen: "#8fbc8f", darkSlateBlue: "#483d8b", darkSlateGray: "#2f4f4f", darkTurquoise: "#00ced1", darkViolet: "#9400d3", deepPink: "#ff1493", deepSkyBlue: "#00bfff", dimGray: "#696969", dodgerBlue: "#1e90ff", fireBrick: "#b22222", floralWhite: "#fffaf0", forestGreen: "#228b22", fuchsia: "#ff00ff", gainsboro: "#DCDCDC", ghostWhite: "#F8F8FF", gold: "#ffd700", goldenRod: "#daa520", gray: "#808080", green: "#008000", greenYellow: "#adff2f", honeyDew: "#f0fff0", hotPink: "#ff69b4", indianRed: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", lavender: "#e6e6fa", lavenderBlush: "#fff0f5", lawnGreen: "#7cfc00", lemonChiffon: "#fffacd", lightBlue: "#add8e6", lightCoral: "#f08080", lightCyan: "#e0ffff", lightGoldenRodYellow: "#fafad2", lightGray: "#d3d3d3", lightGreen: "#90ee90", lightPink: "#ffb6c1", lightSalmon: "#ffa07a", lightSeaGreen: "#20b2aa", lightSkyBlue: "#87cefa", lightSlateGray: "#778899", lightSteelBlue: "#b0c4de", lightYellow: "#ffffe0", lime: "#00ff00", limeGreen: "#32dc32", linen: "#faf0e6", magenta: "#ff00ff", maroon: "#800000", mediumAquaMarine: "#66cdaa", mediumBlue: "#0000cd", mediumOrchid: "#ba55d3", mediumPurple: "#9370db", mediumSeaGreen: "#3cb371", mediumSlateBlue: "#7b68ee", mediumSpringGreen: "#00fa9a", mediumTurquoise: "#48d1cc", mediumVioletRed: "#c71585", midnightBlue: "#191970", mintCream: "#f5fffa", mistyRose: "#ffe4e1", moccasin: "#ffe4b5", navajoWhite: "#ffdead", navy: "#000080", oldLace: "#fdd5e6", olive: "#808000", oliveDrab: "#6b8e23", orange: "#ffa500", orangeRed: "#ff4500", orchid: "#da70d6", paleGoldenRod: "#eee8aa", paleGreen: "#98fb98", paleTurquoise: "#afeeee", paleVioletRed: "#db7093", papayaWhip: "#ffefd5", peachPuff: "#ffdab9", peru: "#cd853f", pink: "#ffc0cb", plum: "#dda0dd", powderBlue: "#b0e0e6", purple: "#800080", rebeccaPurple: "#663399", red: "#ff0000", rosyBrown: "#bc8f8f", royalBlue: "#4169e1", saddleBrown: "#8b4513", salmon: "#fa8072", sandyBrown: "#f4a460", seaGreen: "#2e8b57", seaShell: "#fff5ee", sienna: "#a0522d", silver: "#c0c0c0", slyBlue: "#87ceeb", slateBlue: "#6a5acd", slateGray: "#708090", snow: "#fffafa", springGreen: "#00ff7f", steelBlue: "#4682b4", tan: "#d2b48c", teal: "#008080", thistle: "#d8bfd8", tomato: "#ff6347", turquoise: "#40e0d0", violet: "#ee82ee", wheat: "#f5deb3", white: "#ffffff", whiteSmoke: "#f5f5f5", yellow: "#ffff00", yellowGreen: "#9acd32" }; var z2 = { lime: "#a4c400", green: "#60a917", emerald: "#008a00", blue: "#00AFF0", teal: "#00aba9", cyan: "#1ba1e2", cobalt: "#0050ef", indigo: "#6a00ff", violet: "#aa00ff", pink: "#dc4fad", magenta: "#d80073", crimson: "#a20025", red: "#CE352C", orange: "#fa6800", amber: "#f0a30a", yellow: "#fff000", brown: "#825a2c", olive: "#6d8764", steel: "#647687", mauve: "#76608a", taupe: "#87794e" }; var Ve = { color: function(e2, t = q2, s2 = void 0) { return t[e2] !== void 0 ? t[e2] : s2; }, palette: function(e2 = q2) { return Object.keys(e2); }, colors: function(e2 = q2) { return Object.values(e2); } }; var ue = { HSV: d, HSL: C2, HSLA: B2, RGB: b2, RGBA: w2, CMYK: G3 }; var p = { HEX: "hex", RGB: "rgb", RGBA: "rgba", HSV: "hsv", HSL: "hsl", HSLA: "hsla", CMYK: "cmyk", UNKNOWN: "unknown" }; var X2 = { angle: 30, algorithm: 1, step: 0.1, distance: 5, tint1: 0.8, tint2: 0.4, shade1: 0.6, shade2: 0.3, alpha: 1, baseLight: "#ffffff", baseDark: "self" }; function Pe(e2, t) { let s2; switch (t) { case "hex": s2 = e2.map(function(n3) { return M3(n3); }); break; case "rgb": s2 = e2.map(function(n3) { return c2(n3); }); break; case "rgba": s2 = e2.map(function(n3) { return A2(n3, opt.alpha); }); break; case "hsl": s2 = e2.map(function(n3) { return W2(n3); }); break; case "hsla": s2 = e2.map(function(n3) { return $4(n3, opt.alpha); }); break; case "cmyk": s2 = e2.map(function(n3) { return D2(n3); }); break; default: s2 = e2; } return s2; } function R2(e2, t, s2) { return Math.max(t, Math.min(e2, s2)); } function m2(e2, t, s2) { return e2 < t ? t : e2 > s2 ? s2 : e2; } function v2(e2, t) { for (e2 += t; e2 >= 360; ) e2 -= 360; for (; e2 < 0; ) e2 += 360; return e2; } var ye = (e2) => { let t = (a2) => /^#([A-Fa-f0-9]{3}){1,2}$/.test(a2), s2 = (a2) => /^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(a2), n3 = (a2) => /^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0(\.\d+)?|1(\.0+)?)\s*\)$/.test(a2), r2 = (a2) => /^hsv\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(a2), u4 = (a2) => /^hsl\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(a2), i3 = (a2) => /^hsla\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0(\.\d+)?|1(\.0+)?)\s*\)$/.test(a2), o2 = (a2) => /^cmyk\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(a2); return t(e2) || s2(e2) || r2(e2) || i3(e2) || i3(e2) || n3(e2) || u4(e2) || o2(e2); }; var Me = (e2 = "hex", t = "#000000") => { let s2; return typeof t == "string" && (s2 = _2(t)), y(s2) || (s2 = "#000000"), x2(s2, e2.toLowerCase()); }; var Ne = Me; var j2 = function(e2) { if (y(e2) && typeof e2 != "string") return e2; if (typeof e2 != "string") throw new Error("Value is not a string!"); if (e2[0] === "#" && e2.length === 4) { let t = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; return "#" + e2.replace(t, (s2, n3, r2, u4) => n3 + n3 + r2 + r2 + u4 + u4); } return e2[0] === "#" ? e2 : "#" + e2; }; var Ee = j2; var Z2 = (e2) => { if (e2 = _2(e2), !y(e2)) return; let t = c2(e2); return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3 < 128; }; var oe = (e2) => !Z2(e2); var K2 = (e2) => _2(e2) instanceof d; var I2 = (e2) => _2(e2) instanceof C2; var N2 = (e2) => _2(e2) instanceof B2; var U2 = (e2) => _2(e2) instanceof b2; var L2 = (e2) => _2(e2) instanceof w2; var T2 = (e2) => _2(e2) instanceof G3; var Q2 = (e2) => /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e2); var y = (e2) => e2 ? typeof e2 == "string" ? ye(e2) : Q2(e2) || U2(e2) || L2(e2) || K2(e2) || I2(e2) || N2(e2) || T2(e2) : false; var S2 = (e2) => Q2(e2) ? p.HEX : U2(e2) ? p.RGB : L2(e2) ? p.RGBA : K2(e2) ? p.HSV : I2(e2) ? p.HSL : N2(e2) ? p.HSLA : T2(e2) ? p.CMYK : p.UNKNOWN; var fe = (e2, t) => !y(e2) || !y(t) ? false : M3(e2) === M3(t); var he = (e2) => e2.toString(); var ee = (e2) => { let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(j2(e2)), s2 = [parseInt(t[1], 16), parseInt(t[2], 16), parseInt(t[3], 16)]; return t ? new b2(...s2) : null; }; var te = (e2) => "#" + ((1 << 24) + (e2.r << 16) + (e2.g << 8) + e2.b).toString(16).slice(1); var k2 = (e2) => { let t = new d(), s2, n3, r2, u4 = e2.r / 255, i3 = e2.g / 255, o2 = e2.b / 255, a2 = Math.max(u4, i3, o2), f5 = Math.min(u4, i3, o2), l2 = a2 - f5; return r2 = a2, a2 === 0 ? n3 = 0 : n3 = 1 - f5 / a2, a2 === f5 ? s2 = 0 : a2 === u4 && i3 >= o2 ? s2 = 60 * ((i3 - o2) / l2) : a2 === u4 && i3 < o2 ? s2 = 60 * ((i3 - o2) / l2) + 360 : a2 === i3 ? s2 = 60 * ((o2 - u4) / l2) + 120 : a2 === o2 ? s2 = 60 * ((u4 - i3) / l2) + 240 : s2 = 0, t.h = s2, t.s = n3, t.v = r2, t; }; var H2 = (e2) => { let t, s2, n3, r2 = e2.h, u4 = e2.s * 100, i3 = e2.v * 100, o2 = Math.floor(r2 / 60), a2 = (100 - u4) * i3 / 100, f5 = (i3 - a2) * (r2 % 60 / 60), l2 = a2 + f5, h3 = i3 - f5; switch (o2) { case 0: t = i3, s2 = l2, n3 = a2; break; case 1: t = h3, s2 = i3, n3 = a2; break; case 2: t = a2, s2 = i3, n3 = l2; break; case 3: t = a2, s2 = h3, n3 = i3; break; case 4: t = l2, s2 = a2, n3 = i3; break; case 5: t = i3, s2 = a2, n3 = h3; break; } return new b2(Math.round(t * 255 / 100), Math.round(s2 * 255 / 100), Math.round(n3 * 255 / 100)); }; var Oe = (e2) => te(H2(e2)); var Ye = (e2) => k2(ee(e2)); var le = (e2) => { let t = new G3(), s2 = e2.r / 255, n3 = e2.g / 255, r2 = e2.b / 255; return t.k = Math.min(1 - s2, 1 - n3, 1 - r2), t.c = 1 - t.k === 0 ? 0 : (1 - s2 - t.k) / (1 - t.k), t.m = 1 - t.k === 0 ? 0 : (1 - n3 - t.k) / (1 - t.k), t.y = 1 - t.k === 0 ? 0 : (1 - r2 - t.k) / (1 - t.k), t.c = Math.round(t.c * 100), t.m = Math.round(t.m * 100), t.y = Math.round(t.y * 100), t.k = Math.round(t.k * 100), t; }; var de = (e2) => { let t = Math.floor(255 * (1 - e2.c / 100) * (1 - e2.k / 100)), s2 = Math.ceil(255 * (1 - e2.m / 100) * (1 - e2.k / 100)), n3 = Math.ceil(255 * (1 - e2.y / 100) * (1 - e2.k / 100)); return new b2(t, s2, n3); }; var se = (e2) => { let t, s2, n3, r2; return t = parseInt(e2.h), n3 = (2 - e2.s) * e2.v, s2 = e2.s * e2.v, n3 === 0 ? s2 = 0 : (r2 = n3 <= 1 ? n3 : 2 - n3, r2 === 0 ? s2 = 0 : s2 /= r2), n3 /= 2, Number.isNaN(s2) && (s2 = 0), Number.isNaN(n3) && (n3 = 0), new C2(t, s2, n3); }; var ie = (e2) => { let t, s2, n3, r2; return t = e2.h, r2 = e2.l * 2, s2 = e2.s * (r2 <= 1 ? r2 : 2 - r2), n3 = (r2 + s2) / 2, r2 + s2 === 0 ? s2 = 0 : s2 = 2 * s2 / (r2 + s2), new d(t, s2, n3); }; var F2 = (e2) => new b2(Math.round(e2.r / 51) * 51, Math.round(e2.g / 51) * 51, Math.round(e2.b / 51) * 51); var Se = (e2) => { let t = F2(e2); return new w2(t.r, t.g, t.b, e2.a); }; var Ce = (e2) => te(F2(ee(e2))); var Be = (e2) => k2(F2(c2(e2))); var Ge = (e2) => se(k2(F2(c2(e2)))); var He = (e2) => le(F2(de(e2))); var ne = (e2) => Q2(e2) ? Ce(e2) : U2(e2) ? F2(e2) : L2(e2) ? Se(e2) : K2(e2) ? Be(e2) : I2(e2) ? Ge(e2) : T2(e2) ? He(e2) : e2; var x2 = (e2, t = "rgb", s2 = 1) => { let n3; switch (t.toLowerCase()) { case "hex": n3 = M3(e2); break; case "rgb": n3 = c2(e2); break; case "rgba": n3 = A2(e2, s2); break; case "hsl": n3 = W2(e2); break; case "hsla": n3 = $4(e2, s2); break; case "hsv": n3 = E2(e2); break; case "cmyk": n3 = D2(e2); break; default: n3 = e2; } return n3; }; var M3 = (e2) => typeof e2 == "string" && e2[0] === "#" ? j2(e2) : te(c2(J2(e2))); var c2 = (e2) => { if (U2(e2)) return e2; if (L2(e2)) return new b2(e2.r, e2.g, e2.b); if (K2(e2)) return H2(e2); if (I2(e2) || N2(e2)) return H2(ie(e2)); if (Q2(e2)) return ee(e2); if (T2(e2)) return de(e2); throw new Error("Unknown color format!"); }; var A2 = (e2, t) => { if (L2(e2)) return typeof t < "u" && (e2.a = t), e2; let s2 = c2(e2); return new w2(s2.r, s2.g, s2.b, typeof e2.a < "u" ? e2.a : t); }; var E2 = (e2) => K2(e2) ? e2 : k2(c2(e2)); var W2 = (e2) => I2(e2) ? e2 : se(k2(c2(e2))); var $4 = (e2, t = 1) => { if (N2(e2)) return t && (e2.a = t), e2; let s2 = se(k2(c2(e2))); return s2.a = typeof e2.a < "u" ? e2.a : t, new B2(s2.h, s2.s, s2.l, s2.a); }; var D2 = (e2) => T2(e2) ? e2 : le(c2(e2)); var ce = (e2) => { let t = c2(e2), s2 = S2(e2).toLowerCase(), n3 = Math.round(t.r * 0.2125 + t.g * 0.7154 + t.b * 0.0721), r2 = new b2(n3, n3, n3); return x2(r2, s2); }; var pe = (e2, t = 10) => V2(e2, -1 * Math.abs(t)); var V2 = (e2, t = 10) => { let s2 = S2(e2).toLowerCase(), n3 = $4(e2); return n3.l += t / 100, n3.l = R2(n3.l, 0, 1), x2(n3, s2); }; var be = (e2, t, s2 = 1) => { let n3 = E2(e2), r2 = S2(e2).toLowerCase(), u4 = n3.h; for (u4 += t; u4 >= 360; ) u4 -= 360; for (; u4 < 0; ) u4 += 360; return n3.h = u4, x2(n3, r2, s2); }; var g2 = (e2, t, s2) => { s2 = s2 === 0 ? 0 : s2 || 50; let n3 = new b2(0, 0, 0), r2 = c2(e2), u4 = c2(t), i3 = s2 / 100; return n3.r = Math.round((u4.r - r2.r) * i3 + r2.r), n3.g = Math.round((u4.g - r2.g) * i3 + r2.g), n3.b = Math.round((u4.b - r2.b) * i3 + r2.b), M3(n3); }; var re = (e2, t) => { let s2 = c2(e2), n3 = c2(t), r2 = new b2(); return s2.b = Math.floor(s2.b * n3.b / 255), s2.g = Math.floor(s2.g * n3.g / 255), s2.r = Math.floor(s2.r * n3.r / 255), M3(r2); }; var ge = (e2, t) => { if (!y(e2)) throw new Error(e2 + " is not a valid color value!"); t /= 100; let s2 = S2(e2).toLowerCase(), n3 = c2(e2), r2 = t < 0 ? 0 : 255, u4 = t < 0 ? t * -1 : t, i3, o2, a2, f5; return i3 = Math.round((r2 - n3.r) * u4) + n3.r, o2 = Math.round((r2 - n3.g) * u4) + n3.g, a2 = Math.round((r2 - n3.b) * u4) + n3.b, (s2 === p.RGBA || s2 === p.HSLA) && (f5 = e2.a), x2(new b2(i3, o2, a2), s2, f5); }; var P = (e2, t) => { let s2 = S2(e2).toLowerCase(), n3 = $4(e2); return n3.s += t / 100, n3.s = R2(n3.s, 0, 1), x2(n3, s2); }; var ve = (e2, t) => P(e2, -1 * Math.abs(t)); var me = (e2, t) => { let s2, n3, r2, u4; if (!y(e2)) throw new Error(e2 + " is not a valid color value!"); return s2 = W2(e2), u4 = s2.h + t, u4 > 360 ? u4 = u4 % 360 : u4 < 0 && (u4 = 360 + u4 % 360), s2.h = u4, n3 = S2(e2).toLowerCase(), (n3 === p.RGBA || n3 === p.HSLA) && (r2 = e2.a), n3 === "hsl" ? s2 : x2(s2, n3, r2); }; var _e = (e2, t) => { let s2 = 1, n3 = S2(e2).toLowerCase(), r2 = E2(e2); return (n3 === p.RGBA || n3 === p.HSLA) && (s2 = e2.a), r2.v += t / 100, r2.v = R2(r2.v, 0, 1), x2(r2, n3, s2); }; var we = (e2, t, s2) => { let n3 = J2(e2), r2 = J2(t), u4 = A2(n3, void 0), i3 = A2(r2, void 0), o2 = new w2(), a2 = ("" + s2).toLowerCase() || "hex"; return o2.r = Math.round((u4.r + i3.r) / 2), o2.g = Math.round((u4.g + i3.g) / 2), o2.b = Math.round((u4.b + i3.b) / 2), o2.a = Math.round((u4.a + i3.a) / 2), x2(o2, s2, o2.a); }; var ke = (e2, t, s2 = p.HEX, n3) => { let r2 = Object.assign({}, X2, n3), u4, i3 = [], o2, a2, f5, l2, h3; if (o2 = E2(e2), K2(o2) === false) return console.warn("The value is a not supported color format!"), false; switch (f5 = o2.h, l2 = o2.s, h3 = o2.v, t) { case "monochromatic": case "mono": { if (r2.algorithm === 1) a2 = H2(o2), a2.r = m2(Math.round(a2.r + (255 - a2.r) * r2.tint1), 0, 255), a2.g = m2(Math.round(a2.g + (255 - a2.g) * r2.tint1), 0, 255), a2.b = m2(Math.round(a2.b + (255 - a2.b) * r2.tint1), 0, 255), i3.push(k2(a2)), a2 = H2(o2), a2.r = m2(Math.round(a2.r + (255 - a2.r) * r2.tint2), 0, 255), a2.g = m2(Math.round(a2.g + (255 - a2.g) * r2.tint2), 0, 255), a2.b = m2(Math.round(a2.b + (255 - a2.b) * r2.tint2), 0, 255), i3.push(k2(a2)), i3.push(o2), a2 = H2(o2), a2.r = m2(Math.round(a2.r * r2.shade1), 0, 255), a2.g = m2(Math.round(a2.g * r2.shade1), 0, 255), a2.b = m2(Math.round(a2.b * r2.shade1), 0, 255), i3.push(k2(a2)), a2 = H2(o2), a2.r = m2(Math.round(a2.r * r2.shade2), 0, 255), a2.g = m2(Math.round(a2.g * r2.shade2), 0, 255), a2.b = m2(Math.round(a2.b * r2.shade2), 0, 255), i3.push(k2(a2)); else if (r2.algorithm === 2) for (i3.push(o2), u4 = 1; u4 <= r2.distance; u4++) h3 = R2(h3 - r2.step, 0, 1), l2 = R2(l2 - r2.step, 0, 1), i3.push({ h: f5, s: l2, v: h3 }); else if (r2.algorithm === 3) for (i3.push(o2), u4 = 1; u4 <= r2.distance; u4++) h3 = R2(h3 - r2.step, 0, 1), i3.push({ h: f5, s: l2, v: h3 }); else h3 = R2(o2.v + r2.step * 2, 0, 1), i3.push({ h: f5, s: l2, v: h3 }), h3 = R2(o2.v + r2.step, 0, 1), i3.push({ h: f5, s: l2, v: h3 }), i3.push(o2), l2 = o2.s, h3 = o2.v, h3 = R2(o2.v - r2.step, 0, 1), i3.push({ h: f5, s: l2, v: h3 }), h3 = R2(o2.v - r2.step * 2, 0, 1), i3.push({ h: f5, s: l2, v: h3 }); break; } case "complementary": case "complement": case "comp": { i3.push(o2), f5 = v2(o2.h, 180), i3.push(new d(f5, l2, h3)); break; } case "double-complementary": case "double-complement": case "double": { i3.push(o2), f5 = v2(f5, 180), i3.push(new d(f5, l2, h3)), f5 = v2(f5, r2.angle), i3.push(new d(f5, l2, h3)), f5 = v2(f5, 180), i3.push(new d(f5, l2, h3)); break; } case "analogous": case "analog": { f5 = v2(f5, r2.angle), i3.push(new d(f5, l2, h3)), i3.push(o2), f5 = v2(o2.h, 0 - r2.angle), i3.push(new d(f5, l2, h3)); break; } case "triadic": case "triad": { for (i3.push(o2), u4 = 1; u4 < 3; u4++) f5 = v2(f5, 120), i3.push(new d(f5, l2, h3)); break; } case "tetradic": case "tetra": { i3.push(o2), f5 = v2(o2.h, 180), i3.push(new d(f5, l2, h3)), f5 = v2(o2.h, -1 * r2.angle), i3.push(new d(f5, l2, h3)), f5 = v2(f5, 180), i3.push(new d(f5, l2, h3)); break; } case "square": { for (i3.push(o2), u4 = 1; u4 < 4; u4++) f5 = v2(f5, 90), i3.push(new d(f5, l2, h3)); break; } case "split-complementary": case "split-complement": case "split": { f5 = v2(f5, 180 - r2.angle), i3.push(new d(f5, l2, h3)), i3.push(o2), f5 = v2(o2.h, 180 + r2.angle), i3.push(new d(f5, l2, h3)); break; } case "material": { var O4 = r2.baseLight, Y4 = r2.baseDark === "self" || !r2.baseDark ? re(e2, e2) : r2.baseDark; i3.push({ 50: g2(O4, e2, 10), 100: g2(O4, e2, 30), 200: g2(O4, e2, 50), 300: g2(O4, e2, 70), 400: g2(O4, e2, 85), 500: g2(O4, e2, 100), 600: g2(Y4, e2, 92), 700: g2(Y4, e2, 83), 800: g2(Y4, e2, 74), 900: g2(Y4, e2, 65), A100: V2(P(g2(Y4, e2, 15), 80), 65), A200: V2(P(g2(Y4, e2, 15), 80), 55), A400: V2(P(g2(O4, e2, 100), 55), 10), A700: V2(P(g2(Y4, e2, 83), 65), 10) }); break; } default: console.error("Unknown schema name"); } return t === "material" ? i3[0] : Pe(i3, s2); }; var Ae = (e2) => e2 instanceof d || e2 instanceof C2 || e2 instanceof B2 || e2 instanceof b2 || e2 instanceof w2 || e2 instanceof G3; var _2 = function(e2) { if (Ae(e2)) return e2; let t = ("" + e2).toLowerCase(); typeof q2[t] < "u" && (t = q2[t]), typeof z2[t] < "u" && (t = z2[t]); let s2 = t.replace(/[^\d.,%]/g, "").split(",").map((n3) => isNaN(n3) ? n3 : +n3); return t[0] === "#" ? j2(t) : t.includes("rgba") ? new w2(s2[0], s2[1], s2[2], s2[3]) : t.includes("rgb") ? new b2(s2[0], s2[1], s2[2]) : t.includes("cmyk") ? new G3(s2[0], s2[1], s2[2], s2[3]) : t.includes("hsv") ? new d(s2[0], s2[1], s2[2]) : t.includes("hsla") ? new B2(s2[0], s2[1], s2[2], s2[3]) : t.includes("hsl") ? new C2(s2[0], s2[1], s2[2]) : t; }; var J2 = _2; var ae = (e2 = "hex", t = 1) => { let s2 = (o2, a2) => Math.floor(o2 + Math.random() * (a2 + 1 - o2)), n3, r2, u4, i3; return r2 = s2(0, 255), u4 = s2(0, 255), i3 = s2(0, 255), n3 = "#" + ((1 << 24) + (r2 << 16) + (u4 << 8) + i3).toString(16).slice(1), e2 === "hex" ? n3 : x2(n3, e2, t); }; var qe = ae; var Re = class { _setValue(t) { t || (t = "#000000"), typeof t == "string" && (t = _2(t)), t && y(t) ? this._value = t : this._value = void 0; } _setOptions(t) { this._options = Object.assign({}, X2, t); } constructor(t = "#000000", s2 = null) { this._setValue(t), this._setOptions(s2); } get options() { return this._options; } set options(t) { this._setOptions(t); } get value() { return this._value ? this._value : void 0; } set value(t) { this._setValue(t); } toRGB() { if (this._value) return this._value = c2(this._value), this; } get rgb() { return this._value ? c2(this._value) : void 0; } toRGBA(t) { if (this._value) return L2(this._value) ? t && (this._value = A2(this._value, t)) : this._value = A2(this._value, t || X2.alpha), this; } get rgba() { return this._value ? L2(this._value) ? this._value : A2(this._value, this._options.alpha) : void 0; } toHEX() { if (this._value) return this._value = M3(this._value), this; } get hex() { return this._value ? M3(this._value) : void 0; } toHSV() { if (this._value) return this._value = E2(this._value), this; } get hsv() { return this._value ? E2(this._value) : void 0; } toHSL() { if (this._value) return this._value = W2(this._value), this; } get hsl() { return this._value ? W2(this._value) : void 0; } toHSLA(t) { if (this._value) return N2(this._value) ? t && (this._value = $4(this._value, t)) : this._value = $4(this._value, t), this; } get hsla() { return this._value ? N2(this._value) ? this._value : $4(this._value, this._options.alpha) : void 0; } toCMYK() { if (this._value) return this._value = D2(this._value), this; } get cmyk() { return this._value ? D2(this._value) : void 0; } toWebsafe() { if (this._value) return this._value = ne(this._value), this; } get websafe() { return this._value ? ne(this._value) : void 0; } toString() { return this._value ? he(this._value) : void 0; } darken(t = 10) { if (this._value) return this._value = pe(this._value, t), this; } lighten(t = 10) { if (this._value) return this._value = V2(this._value, t), this; } isDark() { return this._value ? Z2(this._value) : void 0; } isLight() { return this._value ? oe(this._value) : void 0; } hueShift(t) { if (this._value) return this._value = be(this._value, t), this; } grayscale() { if (!(!this._value || this.type === p.UNKNOWN)) return this._value = ce(this._value, ("" + this.type).toLowerCase()), this; } get type() { return S2(this._value); } getScheme(t, s2, n3) { return this._value ? ke(this._value, t, s2, n3) : void 0; } equal(t) { return fe(this._value, t); } random(t, s2) { this._value = ae(t, s2); } channel(t, s2) { let n3 = `${this.type}`.toUpperCase(); if (["red", "green", "blue"].includes(t)) { this.toRGB(); let r2 = { red: "r", green: "g", blue: "b" }; this._value[r2[t]] = s2, this[`to${n3}`](); } if (t === "alpha" && this._value.a && (this._value.a = s2), ["hue", "saturation", "value"].includes(t)) { this.toHSV(); let r2 = { hue: "h", saturation: "s", value: "v" }; this._value[r2[t]] = s2, this[`to${n3}`](); } if (["lightness"].includes(t) && (this.toHSL(), this._value.l = s2, this[`to${n3}`]()), ["cyan", "magenta", "yellow", "black"].includes(t)) { this.toCMYK(); let r2 = { cyan: "c", magenta: "m", yellow: "y", black: "k" }; this._value[r2[t]] = s2, this[`to${n3}`](); } return this; } add(t) { this._setValue(we(this._value, t)); } mix(t, s2) { this._setValue(g2(this._value, t, s2)); } multiply(t) { this._setValue(re(this._value, t)); } shade(t) { this._setValue(ge(this._value, t)); } saturate(t) { this._setValue(P(this._value, t)); } desaturate(t) { this._setValue(ve(this._value, t)); } spin(t) { this._setValue(me(this._value, t)); } brighten(t) { this._setValue(_e(this._value, t)); } }; var ut2 = { ...ue }; var Ke = "1.0.4"; var Fe = "11.08.2024, 23:47:03"; var ot2 = () => { console.info(`%c Farbe %c v${Ke} %c ${Fe} `, "color: #ffffff; font-weight: bold; background: #ff00ff", "color: white; background: darkgreen", "color: white; background: #0080fe;"); }; // source/farbe/index.js globalThis.Farbe = Re; globalThis.farbe = (c5) => new Re(c5); globalThis.Farbe.Routines = xe; globalThis.Farbe.Palette = Ve; globalThis.Farbe.StandardColors = q2; globalThis.Farbe.MetroColors = z2; globalThis.Farbe.Primitives = ut2; globalThis.Farbe.info = ot2; // node_modules/@olton/html/dist/html.js var br = Object.defineProperty; var wr2 = (t, o2) => { for (var r2 in o2) br(t, r2, { get: o2[r2], enumerable: true }); }; function te2(t) { return t.replace(/([A-Z])/g, function(o2) { return "-" + o2.toLowerCase(); }); } function pe2(t = []) { return Array.isArray(t) ? t.join(" ") : t.toString(); } var me2 = ["opacity", "zIndex", "order", "zoom"]; function ee2(t = {}) { return typeof t == "string" ? t : Object.keys(t).map((o2) => { let r2 = te2(o2), a2 = t[o2]; return !me2.includes(r2) && !isNaN(a2) && (a2 += "px"), `${r2}: ${a2}`; }).join(";"); } var ce2 = ["accesskey", "autocapitalize", "autofocus", "contenteditable", "dir", "draggable", "enterkeyhint", "hidden", "inert", "inputmode", "is", "itemid", "itemprop", "itemref", "itemscope", "itemtype", "lang", "nonce", "popover", "spellcheck", "style", "tabindex", "title", "translate", "writingsuggestions"]; var le2 = (t) => { let o2, r2, a2 = [], s2, l2, re3 = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i; if (typeof t == "string") { if (t = t.trim(), s2 = document.implementation.createHTMLDocument(""), o2 = s2.createElement("base"), o2.href = document.location.href, s2.head.appendChild(o2), l2 = s2.body, r2 = re3.exec(t), r2) return document.createElement(r2[1]); l2.innerHTML = t; for (let se3 = 0; se3 < l2.childNodes.length; se3++) a2.push(l2.childNodes[se3]); return a2[0]; } }; var fe2 = ["onauxclick", "onbeforeinput", "onbeforematch", "onbeforetoggle", "onblur", "oncancel", "oncanplay", "oncanplaythrough", "onchange", "onclick", "onclose", "oncontextlost", "oncontextmenu", "oncontextrestored", "oncopy", "oncuechange", "oncut", "ondblclick", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "ondurationchange", "onemptied", "onended", "onerror", "onfocus", "onformdata", "oninput", "oninvalid", "onkeydown", "onkeypress", "onkeyup", "onload", "onloadeddata", "onloadedmetadata", "onloadstart", "onmousedown", "onmouseenter", "onmouseleave", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onpaste", "onpause", "onplay", "onplaying", "onprogress", "onratechange", "onreset", "onresize", "onscroll", "onscrollend", "onsecuritypolicyviolation", "onseeked", "onseeking", "onselect", "onslotchange", "onstalled", "onsubmit", "onsuspend", "ontimeupdate", "ontoggle", "onvolumechange", "onwaiting", "onwheel"]; var p2 = class { constructor(o2 = {}) { this.options = o2, this.tag = "div"; } selfAttributes() { return []; } get attributes() { return this.getAttributes().join(" "); } getAttributes() { let o2 = [], r2 = ["hidden", "disabled", "required", "readonly", "selected", "open", "multiply", "default"], a2 = ["className", "style", "data", "tag", "events"]; for (let s2 in this.options) if (!a2.includes(s2)) { if (r2.includes(s2) && this.options[s2] === true) { o2.push(s2); continue; } (this.selfAttributes().includes(s2) && !o2.includes(s2) || ce2.includes(s2)) && o2.push(`${s2}="${this.options[s2]}"`); } return this.classes && o2.push(`class="${this.classes}"`), this.styles && o2.push(`style="${this.styles}"`), this.dataSet && o2.push(this.dataSet), this.aria && o2.push(this.aria), o2; } draw() { return this.template(); } get dataSet() { let { data: o2 = {} } = this.options, r2 = []; for (let a2 in o2) r2.push(`data-${te2(a2)}="${o2[a2]}"`); return r2.join(" "); } get aria() { let { aria: o2 = {} } = this.options, r2 = []; for (let a2 in o2) r2.push(`aria-${a2.toLowerCase()}="${o2[a2]}"`); return r2.join(" "); } get events() { let { events: o2 = {}, control: r2 = true } = this.options, a2 = []; for (let s2 in o2) r2 && !fe2.includes(s2) && console.info(`Event ${s2} for element ${this.tag} not specified in HTML specification`), a2.push(`${s2.toLowerCase()}="${o2[s2]}"`); return a2.join(" "); } get classes() { return pe2(this.options.class); } get styles() { return ee2(this.options.style); } template() { return ""; } toString() { return this.draw(); } toElement() { return le2(this.draw()); } }; var b3 = (t) => { if (Array.isArray(t)) return t.map(b3).join(` `); if (typeof t == "string" || typeof t == "number" || typeof t == "boolean") return t; if (t.draw) return t.draw(); throw new Error("Unknown element! " + t); }; var e = class extends p2 { constructor(...o2) { let r2 = {}, a2 = []; for (let s2 of o2) typeof s2 == "object" && !(s2 instanceof p2) ? r2 = s2 : a2.push(s2); super(r2), this.children = a2; } template(o2) { let r2 = this.options.tag ? this.options.tag : this.tag; return ` <${r2} ${this.attributes} ${this.events}>${o2} `; } draw() { return this.template(this.children.map(b3).join("")); } }; var n2 = class extends p2 { constructor(o2 = {}) { super(o2), this.options = o2; } template() { return ` <${this.options.tag ? this.options.tag : this.tag} ${this.attributes} ${this.events}/> `; } }; var Tr = (t = [], o2 = document.body, r2 = {}) => { let a2, s2, { clear: l2 = true, where: re3 = "beforeend" } = r2; s2 = typeof o2 == "string" ? document.querySelector(o2) : o2, s2 instanceof HTMLElement || (s2 = document.body), l2 && (s2.innerHTML = ""), Array.isArray(t) || (t = [t]), a2 = t.map(b3).join(""), s2.insertAdjacentHTML(re3, a2); }; var oe2 = (t = "", o2) => { let r2 = document.createElement("style"); return o2 !== void 0 && r2.setAttribute("media", o2), r2.appendChild(document.createTextNode(t)), document.head.appendChild(r2), r2; }; var ne2 = (t) => oe2(t).sheet; var ae2 = (t, o2, r2) => { t.insertRule(o2 + "{" + r2 + "}"); }; var de2 = (t, o2) => { if (typeof t == "string") { oe2(t, o2); return; } let r2 = ne2(o2); for (let a2 in t) ae2(r2, a2, ee2(t[a2])); }; var ge2 = async (t, o2) => { let r2 = await fetch(t, o2), a2, s2; if (!r2.ok) throw new Error("HTTP error: " + r2.status); a2 = await r2.text(), s2 = document.createElement("style"), s2.appendChild(document.createTextNode(a2)), document.body.appendChild(s2); }; var xe2 = async (t, o2) => { let r2 = await fetch(t, o2), a2, s2; if (!r2.ok) throw new Error("HTTP error: " + r2.status); a2 = await r2.text(), s2 = document.createElement("script"), s2.appendChild(document.createTextNode(a2)), document.body.appendChild(s2); }; var Yt2 = {}; wr2(Yt2, { Abbr: () => N3, Address: () => _3, Anchor: () => f2, Area: () => R3, Article: () => q3, Aside: () => H3, AudioTag: () => I3, Base: () => y2, Bdi: () => O2, Bdo: () => U3, Blockquote: () => V3, Body: () => v3, Bold: () => D3, Br: () => L3, Button: () => Z3, Canvas: () => F3, Caption: () => J3, Cite: () => X3, Code: () => Y2, Col: () => K3, Colgroup: () => Q3, Data: () => Kt2, Dd: () => ot3, Details: () => rt2, Dfn: () => nt2, Dialog: () => Wt2, Div: () => at2, Dl: () => tt2, Dt: () => et2, Em: () => it2, Embed: () => mt2, Fieldset: () => lt2, FigCaption: () => gt2, Figure: () => dt2, Footer: () => P2, Form: () => xt2, Frame: () => ht2, Frameset: () => ut3, Head: () => T3, Header: () => M4, Heading: () => j3, Hr: () => E3, Html: () => w3, IFrame: () => wt2, Img: () => S3, Input: () => $5, Ins: () => Tt2, Ital: () => g3, Kbd: () => yt2, Label: () => At2, Legend: () => ft2, Link: () => A3, List: () => m3, ListItem: () => x3, Main: () => Ot2, Map: () => B3, Mark: () => vt2, Meta: () => Ut2, Nav: () => z3, NoEmbed: () => ct2, NoFrames: () => bt2, NoScript: () => kt2, Option: () => Lt2, OptionGroup: () => $t2, Output: () => Et2, Paragraph: () => jt2, Picture: () => Qt2, Pre: () => Ct2, Quoted: () => u2, Rp: () => Jt2, Rt: () => Gt2, Ruby: () => Ft2, Script: () => Nt, Section: () => C3, Select: () => St2, Slot: () => Xt2, Small: () => qt2, Source: () => zt2, Span: () => k3, Strike: () => h, Strong: () => pt2, Sub: () => Ht2, Summary: () => st2, Sup: () => Mt2, Table: () => G4, TableCell: () => d2, TableRow: () => W3, TableSection: () => c3, Template: () => Zt2, Textarea: () => Pt2, Time: () => _t2, Title: () => Vt2, Track: () => Bt2, Var: () => Rt2, VideoTag: () => It2, Wbr: () => Dt2, a: () => He2, abbr: () => Me2, address: () => De, anchor: () => ze, area: () => Ue, article: () => Pe2, aside: () => Be2, audio: () => Ve2, b: () => Ze, base: () => be2, bdi: () => Fe2, bdo: () => Ge2, blockquote: () => Je, body: () => Te, br: () => ke2, button: () => Ke2, canvas: () => Qe, caption: () => Xe, cite: () => io, code: () => po, col: () => Ye2, colgroup: () => to, data: () => gr2, dd: () => lo, details: () => fo, dfn: () => xo, dialog: () => ur2, div: () => uo, dl: () => mo, dt: () => co, em: () => ho, embed: () => yo, fieldset: () => vo, figcaption: () => $o, figure: () => So, footer: () => Ie, form: () => Lo, frame: () => jo, frameset: () => Eo, h1: () => $e2, h2: () => Le2, h3: () => Ee2, h4: () => je, h5: () => Ce2, h6: () => Ne2, head: () => he2, header: () => Re2, hr: () => Se2, html: () => ue2, i: () => wo, iframe: () => No, img: () => Ae2, input: () => ve2, ins: () => qo, ital: () => bo, kbd: () => zo, label: () => Ho, legend: () => ko, li: () => _o, link: () => we2, main: () => ir2, map: () => Oe2, mark: () => Bo, meta: () => pr2, nav: () => _e2, noembed: () => Ao, noframes: () => Co, noscript: () => Ro, ol: () => Po, optgroup: () => Do, option: () => Oo, output: () => Uo, p: () => Vo, picture: () => xr2, pre: () => Zo, q: () => Fo, quoted: () => Go, rp: () => dr2, rt: () => fr2, ruby: () => lr2, s: () => Ko, script: () => Qo, section: () => qe2, select: () => Io, slot: () => hr2, small: () => Wo, source: () => Xo, span: () => ye2, strike: () => Jo, strong: () => To, sub: () => Yo, summary: () => go, sup: () => tr2, table: () => We, tbody: () => eo, td: () => ao, template: () => cr2, textarea: () => er2, tfoot: () => ro, th: () => no, thead: () => oo, time: () => or2, title: () => mr2, tr: () => so, track: () => rr2, ul: () => Mo, variable: () => sr2, video: () => nr2, wbr: () => ar2 }); var w3 = class extends e { tag = "html"; selfAttributes() { return ["lang"]; } }; var ue2 = (...t) => new w3(...t); var T3 = class extends e { tag = "head"; }; var he2 = (...t) => new T3(...t); var y2 = class extends n2 { tag = "base"; selfAttributes() { return ["href", "target"]; } }; var be2 = (t) => new y2(t); var A3 = class extends n2 { tag = "link"; selfAttributes() { return ["href", "crossorigin", "rel", "media", "integrity", "hreflang", "type", "referrerpolicy", "sizes", "imagesrcset", "imagesizes", "as", "blocking", "color", "disabled", "fetchpriority"]; } }; var we2 = (t) => new A3(t); var v3 = class extends e { tag = "body"; }; var Te = (...t) => new v3(...t); var k3 = class extends e { tag = "span"; }; var ye2 = (...t) => new k3(...t); var S3 = class extends n2 { tag = "img"; selfAttributes() { return ["align", "alt", "border", "height", "hspace", "ismap", "longdesc", "lowsrc", "src", "vspace", "width", "usemap"]; } }; var Ae2 = (t = "", o2 = "", r2 = {}) => new S3({ ...r2, src: t, alt: o2 }); var $5 = class extends n2 { tag = "input"; selfAttributes() { return ["accept", "align", "alt", "autocomplete", "autofocus", "border", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "list", "max", "maxlength", "min", "multiple", "name", "pattern", "placeholder", "size", "src", "step", "type", "value"]; } }; var ve2 = (t = {}) => new $5(t); var L3 = class extends n2 { tag = "br"; selfAttributes() { return ["clear"]; } }; var ke2 = (t) => new L3(t); var E3 = class extends n2 { tag = "hr"; }; var Se2 = (t) => new E3(t); var j3 = class extends e { constructor(o2 = "h1", ...r2) { super(...r2), this.tag = o2; } }; var i = (t = "h1", ...o2) => new j3(t, ...o2); var $e2 = (...t) => i("h1", ...t); var Le2 = (...t) => i("h2", ...t); var Ee2 = (...t) => i("h3", ...t); var je = (...t) => i("h4", ...t); var Ce2 = (...t) => i("h5", ...t); var Ne2 = (...t) => i("h6", ...t); var C3 = class extends e { tag = "section"; }; var qe2 = (...t) => new C3(...t); var f2 = class extends e { tag = "a"; selfAttributes() { return ["coords", "download", "hreflang", "name", "rel", "rev", "shape", "target", "type", "href"]; } }; var ze = (...t) => new f2(...t); var He2 = (...t) => new f2(...t); var N3 = class extends e { tag = "abbr"; }; var Me2 = (...t) => new N3(...t); var q3 = class extends e { tag = "article"; }; var Pe2 = (...t) => new q3(...t); var z3 = class extends e { tag = "nav"; }; var _e2 = (...t) => new z3(...t); var H3 = class extends e { tag = "aside"; }; var Be2 = (...t) => new H3(...t); var M4 = class extends e { tag = "header"; }; var Re2 = (...t) => new M4(...t); var P2 = class extends e { tag = "footer"; }; var Ie = (...t) => new P2(...t); var _3 = class extends e { tag = "address"; }; var De = (...t) => new _3(...t); var B3 = class extends e { tag = "map"; selfAttributes() { return ["name"]; } }; var Oe2 = (...t) => new B3(...t); var R3 = class extends n2 { tag = "area"; selfAttributes() { return ["alt", "coords", "hreflang", "nohref", "shape", "target", "type", "href"]; } }; var Ue = (t = {}) => new R3(t); var I3 = class extends e { tag = "audio"; selfAttributes() { return ["autoplay", "controls", "loop", "preload", "src"]; } }; var Ve2 = (...t) => new I3(...t); var D3 = class extends e { tag = "b"; }; var Ze = (...t) => new D3(...t); var O2 = class extends e { tag = "bdi"; }; var Fe2 = (...t) => new O2(...t); var U3 = class extends e { tag = "bdo"; }; var Ge2 = (...t) => new U3(...t); var V3 = class extends e { tag = "blockquote"; selfAttributes() { return ["cite"]; } }; var Je = (...t) => new V3(...t); var Z3 = class extends e { tag = "button"; selfAttributes() { return ["autofocus", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "type", "value"]; } }; var Ke2 = (...t) => new Z3(...t); var F3 = class extends e { tag = "canvas"; selfAttributes() { return ["width", "height"]; } }; var Qe = (...t) => new F3(...t); var G4 = class extends e { tag = "table"; selfAttributes() { return ["align", "background", "bgcolor", "border", "bordercolor", "cellpadding", "cellspacing", "cols", "frame", "height", "rules", "summary", "width"]; } }; var We = (...t) => new G4(...t); var J3 = class extends e { tag = "caption"; selfAttributes() { return ["align", "valign"]; } }; var Xe = (...t) => new J3(...t); var K3 = class extends n2 { tag = "col"; selfAttributes() { return ["align", "valign", "char", "charoff", "span", "width"]; } }; var Ye2 = (t) => new K3(t); var Q3 = class extends n2 { tag = "colgroup"; selfAttributes() { return ["align", "valign", "char", "charoff", "span", "width"]; } }; var to = (t) => new Q3(t); var c3 = class extends e { constructor(o2 = "tbody", ...r2) { super(...r2), this.tag = o2; } selfAttributes() { return ["align", "valign", "char", "charoff", "bgcolor"]; } }; var eo = (...t) => new c3("tbody", ...t); var oo = (...t) => new c3("thead", ...t); var ro = (...t) => new c3("tfoot", ...t); var W3 = class extends e { tag = "tr"; selfAttributes() { return ["align", "bgcolor", "bordercolor", "char", "charoff", "valign"]; } }; var so = (...t) => new W3(...t); var d2 = class extends e { constructor(o2 = "td", ...r2) { super(...r2), this.tag = o2; } selfAttributes() { return ["abbr", "align", "axis", "background", "bgcolor", "bordercolor", "char", "charoff", "colspan", "headers", "height", "nowrap", "rowspan", "scope", "valign", "width"]; } }; var no = (...t) => new d2("th", ...t); var ao = (...t) => new d2("td", ...t); var X3 = class extends e { tag = "cite"; }; var io = (...t) => new X3(...t); var Y2 = class extends e { tag = "code"; }; var po = (...t) => new Y2(...t); var tt2 = class extends e { tag = "dl"; }; var et2 = class extends e { tag = "dt"; }; var ot3 = class extends e { tag = "dd"; }; var mo = (...t) => new tt2(...t); var co = (...t) => new et2(...t); var lo = (...t) => new ot3(...t); var rt2 = class extends e { tag = "details"; }; var fo = (...t) => new rt2(...t); var st2 = class extends e { tag = "summary"; }; var go = (...t) => new st2(...t); var nt2 = class extends e { tag = "dfn"; }; var xo = (...t) => new nt2(...t); var at2 = class extends e { tag = "div"; selfAttributes() { return ["align", "title"]; } }; var uo = (...t) => new at2(...t); var it2 = class extends e { tag = "em"; }; var ho = (...t) => new it2(...t); var g3 = class extends e { tag = "i"; }; var bo = (...t) => new g3(...t); var wo = (...t) => new g3(...t); var pt2 = class extends e { tag = "strong"; }; var To = (...t) => new pt2(...t); var mt2 = class extends e { tag = "embed"; selfAttributes() { return ["align", "height", "hspace", "pluginspace", "src", "type", "vspace", "width"]; } }; var yo = (...t) => new mt2(...t); var ct2 = class extends e { tag = "noembed"; }; var Ao = (...t) => new ct2(...t); var lt2 = class extends e { tag = "fieldset"; selfAttributes() { return ["form", "title"]; } }; var vo = (...t) => new lt2(...t); var ft2 = class extends e { tag = "legend"; selfAttributes() { return ["align", "title"]; } }; var ko = (...t) => new ft2(...t); var dt2 = class extends e { tag = "figure"; }; var So = (...t) => new dt2(...t); var gt2 = class extends e { tag = "figcaption"; }; var $o = (...t) => new gt2(...t); var xt2 = class extends e { tag = "form"; selfAttributes() { return ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"]; } }; var Lo = (...t) => new xt2(...t); var ut3 = class extends e { tag = "frameset"; selfAttributes() { return ["border", "bordercolor", "cols", "frameborder", "framespacing", "rows"]; } }; var Eo = (...t) => new ut3(...t); var ht2 = class extends n2 { tag = "frame"; selfAttributes() { return ["bordercolor", "frameborder", "noresize", "name", "src", "scrolling"]; } }; var jo = (t = {}) => new ht2(t); var bt2 = class extends e { tag = "noframes"; }; var Co = (...t) => new bt2(...t); var wt2 = class extends e { tag = "iframe"; selfAttributes() { return ["align", "allowtransparency", "frameborder", "height", "hspace", "marginheight", "marginwidth", "name", "sandbox", "scrolling", "seamless", "src", "srcdoc", "vspace", "width"]; } }; var No = (...t) => new wt2(...t); var Tt2 = class extends e { tag = "ins"; selfAttributes() { return ["cite", "datetime"]; } }; var qo = (...t) => new Tt2(...t); var yt2 = class extends e { tag = "kbd"; }; var zo = (...t) => new yt2(...t); var At2 = class extends e { tag = "label"; selfAttributes() { return ["for"]; } }; var Ho = (...t) => new At2(...t); var m3 = class extends e { constructor(o2 = "ul", ...r2) { super(...r2), this.tag = o2; } selfAttributes() { return this.tag === "ul" ? ["type"] : ["type", "reserved", "start"]; } }; var x3 = class extends e { tag = "li"; selfAttributes() { return ["type", "value"]; } }; var Mo = (...t) => new m3("ul", ...t); var Po = (...t) => new m3("ol", ...t); var _o = (...t) => new x3(...t); var vt2 = class extends e { tag = "mark"; }; var Bo = (...t) => new vt2(...t); var kt2 = class extends e { tag = "noscript"; }; var Ro = (...t) => new kt2(...t); var St2 = class extends e { tag = "select"; selfAttributes() { return ["autofocus", "form", "name", "size"]; } }; var Io = (...t) => new St2(...t); var $t2 = class extends e { tag = "optgroup"; selfAttributes() { return ["label"]; } }; var Do = (...t) => new $t2(...t); var Lt2 = class extends e { tag = "option"; selfAttributes() { return ["label", "value"]; } }; var Oo = (...t) => new Lt2(...t); var Et2 = class extends e { tag = "output"; selfAttributes() { return ["for", "form", "name"]; } }; var Uo = (...t) => new Et2(...t); var jt2 = class extends e { tag = "p"; selfAttributes() { return ["align"]; } }; var Vo = (...t) => new jt2(...t); var Ct2 = class extends e { tag = "pre"; }; var Zo = (...t) => new Ct2(...t); var u2 = class extends e { tag = "q"; selfAttributes() { return ["cite"]; } }; var Fo = (...t) => new u2(...t); var Go = (...t) => new u2(...t); var h = class extends e { tag = "strike"; }; var Jo = (...t) => new h(...t); var Ko = (...t) => new h(...t); var Nt = class extends e { tag = "script"; selfAttributes() { return ["async", "defer", "language", "src", "type"]; } }; var Qo = (...t) => new Nt(...t); var qt2 = class extends e { tag = "small"; }; var Wo = (...t) => new qt2(...t); var zt2 = class extends n2 { tag = "source"; selfAttributes() { return ["media", "src", "type"]; } }; var Xo = (t = {}) => new zt2(t); var Ht2 = class extends e { tag = "sub"; }; var Yo = (...t) => new Ht2(...t); var Mt2 = class extends e { tag = "sup"; }; var tr2 = (...t) => new Mt2(...t); var Pt2 = class extends e { tag = "textarea"; selfAttributes() { return ["autofocus", "cols", "form", "maxlength", "name", "placeholder", "rows", "wrap"]; } }; var er2 = (...t) => new Pt2(...t); var _t2 = class extends e { tag = "time"; selfAttributes() { return ["datetime", "pubdate"]; } }; var or2 = (...t) => new _t2(...t); var Bt2 = class extends n2 { tag = "track"; selfAttributes() { return ["kind", "src", "srclang", "label"]; } }; var rr2 = (t = {}) => new Bt2(t); var Rt2 = class extends e { tag = "var"; }; var sr2 = (...t) => new Rt2(...t); var It2 = class extends e { tag = "video"; selfAttributes() { return ["autoplay", "controls", "height", "loop", "loop", "poster", "preload", "src", "width"]; } }; var nr2 = (...t) => new It2(...t); var Dt2 = class extends n2 { tag = "wbr"; }; var ar2 = (t) => new Dt2(t); var Ot2 = class extends e { tag = "main"; }; var ir2 = (...t) => new Ot2(...t); var Ut2 = class extends n2 { tag = "meta"; selfAttributes() { return ["content", "name", "http-equiv", "charset"]; } }; var pr2 = (t) => new Ut2(t); var Vt2 = class extends e { tag = "title"; }; var mr2 = (t) => new Vt2(t); var Zt2 = class extends e { tag = "template"; selfAttributes() { return ["shadowrootmode", "shadowrootdelegatesfocus", "shadowrootclonable", "shadowrootserializable"]; } }; var cr2 = (...t) => new Zt2(...t); var Ft2 = class extends e { tag = "ruby"; }; var Gt2 = class extends n2 { tag = "rt"; }; var Jt2 = class extends n2 { tag = "rp"; }; var lr2 = (...t) => new Ft2(...t); var fr2 = (t) => new Gt2(t); var dr2 = (t) => new Jt2(t); var Kt2 = class extends e { tag = "data"; }; var gr2 = (...t) => new Kt2(...t); var Qt2 = class extends e { tag = "picture"; }; var xr2 = (...t) => new Qt2(...t); var Wt2 = class extends e { tag = "dialog"; selfAttributes() { return ["open"]; } }; var ur2 = (...t) => new Wt2(...t); var Xt2 = class extends e { tag = "slot"; selfAttributes() { return ["name"]; } }; var hr2 = (...t) => new Xt2(...t); var ie2 = {}; var yr2 = "0.15.1"; var Ar2 = "18.05.2025, 14:41:46"; var am = () => { console.info(`%c Html.js %c v${yr2} %c ${Ar2} `, "color: #ffffff; font-weight: bold; background: #708238", "color: white; background: darkgreen", "color: white; background: #0080fe;"); }; var vr2 = (t = globalThis) => { for (let o2 in Yt2) globalThis[o2] && (ie2[o2] = globalThis[o2]), t[o2] = Yt2[o2]; }; var kr = (t = globalThis) => { for (let o2 in ie2) t[o2] = ie2[o2]; }; var im = { BaseElement: p2, Tag: e, SingleTag: n2, ...Yt2, extract: vr2, restore: kr }; var pm = { addStyle: de2, addCssRule: ae2, createStyleSheet: ne2, createStyleElement: oe2 }; // source/html/index.js globalThis.HTML = { cssLoader: ge2, jsLoader: xe2, render: Tr, ...im, ...pm, info: am }; // node_modules/@olton/guardian/dist/guardian.js var guardian_exports = {}; __export(guardian_exports, { americanExpress: () => fe3, array: () => pr3, base64: () => gr3, between: () => ur3, bigint: () => j4, boolean: () => _r2, bytes: () => Ee3, color: () => Wr, compose: () => I4, contains: () => be3, creditCard: () => ce3, date: () => H4, digits: () => _e3, diners: () => ie3, discover: () => me3, domain: () => Tr2, email: () => nr3, endsWith: () => O3, equal: () => Ue2, finite: () => Er2, float: () => Se3, func: () => W4, great: () => Ne3, greatOrEqual: () => Ce3, hexColor: () => Yr, hslColor: () => Zr, imei: () => br2, info: () => qe3, integer: () => J4, ip: () => Mr, ipv4: () => yr3, ipv6: () => Nr, jcb: () => Ae3, length: () => Rr, less: () => ve3, lessOrEqual: () => Oe3, mastercard: () => ae3, max: () => tr3, maxLength: () => xr3, min: () => rr3, minLength: () => kr2, notNull: () => ge3, notNumber: () => hr3, number: () => fr3, object: () => ir3, parse: () => A4, pattern: () => he3, pipe: () => y3, required: () => sr3, rgbColor: () => Jr, safeInteger: () => Q4, safeParse: () => D4, similar: () => Me3, startsWith: () => C4, string: () => i2, symbol: () => q4, type: () => xe3, unionPay: () => ue3, unknown: () => B4, url: () => Or, visa: () => se2 }); var x4 = Object.defineProperty; var l = Object.getOwnPropertySymbols; var w4 = Object.prototype.hasOwnProperty; var U4 = Object.prototype.propertyIsEnumerable; var E4 = (t, r2, e2) => r2 in t ? x4(t, r2, { enumerable: true, configurable: true, writable: true, value: e2 }) : t[r2] = e2; var d3 = (t, r2) => { for (var e2 in r2 || (r2 = {})) w4.call(r2, e2) && E4(t, e2, r2[e2]); if (l) for (var e2 of l(r2)) U4.call(r2, e2) && E4(t, e2, r2[e2]); return t; }; var o = class extends Error { constructor(r2 = "", e2 = null, c5) { super(r2), this.message = r2, this.name = e2, this.value = c5; } }; var A4 = (t, r2) => { let e2; if (!t) throw new Error("Schema object required for parse data!"); if (typeof t == "function") { if (e2 = t.apply(null, [r2]), e2 instanceof o) throw e2; } else for (let c5 in t) { let s2 = r2[c5], a2 = t[c5]; if (!a2) throw new o(`Guard not defined for field ${c5} in input data!`, "general", r2); if (!r2.hasOwnProperty(c5)) throw new o(`Field ${c5} doesn't exists in input data!`, "general", r2); if (typeof a2 == "function") { if (console.log(a2.name), e2 = a2.apply(null, [s2]), e2 instanceof o) throw e2; } else A4(a2, s2); } return r2; }; var D4 = (t, r2) => { let e2; if (!t) throw new Error("Schema object required for parse data!"); if (typeof t == "function") { if (e2 = t.apply(null, [r2]), e2 instanceof o) return { ok: false, error: e2 }; } else for (let c5 in t) { let s2 = r2[c5], a2 = t[c5]; if (a2) if (typeof a2 == "function") { if (e2 = a2.apply(null, [r2]), e2 instanceof o) return { ok: false, error: e2 }; } else A4(a2, s2); } return { ok: true, output: r2 }; }; var M5 = (...t) => (r2) => t.reduce((e2, c5) => c5(e2), r2); var y3 = M5; var N4 = (...t) => (r2) => t.reduceRight((e2, c5) => c5(e2), r2); var I4 = N4; var v4 = "VAL must be a string"; var i2 = (t = v4) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" ? r2 : new o(e2, "string", r2); }; var f3 = (t) => typeof t != "undefined" && t !== null; var T4 = "VAL must starts with START_VAL"; var C4 = (t, r2 = T4) => { if (!f3(t)) throw new Error("START_VALUE not defined!"); return function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/START_VAL/g, t); return typeof e2 == "string" && e2.startsWith(t) ? e2 : new o(c5, "startsWith", e2); }; }; var $6 = "VAL must end with END_VAL"; var O3 = (t, r2 = $6) => { if (!f3(t)) throw new Error("END_VALUE not defined!"); return function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/END_VAL/g, t); return typeof e2 == "string" && e2.endsWith(t) ? e2 : new o(c5, "endsWith", e2); }; }; var B4 = () => function(t) { return t; }; var F4 = "A symbol is required"; var q4 = (t = F4) => function(r2) { return typeof r2 == "symbol" ? r2 : new o(t, "symbol", r2); }; var P3 = "VAL must be a bigint"; var j4 = (t = P3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "bigint" ? r2 : new o(e2, "bigint", r2); }; var z4 = "VAL must be valid date object or date string"; var H4 = (t = z4) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "object" && r2.getTime || typeof r2 == "string" && !isNaN(Date.parse(r2)) ? r2 : new o(e2, "date", r2); }; var X4 = "The value must be a function"; var W4 = (t = X4) => function(r2) { return typeof r2 == "function" ? r2 : new o(t, "function", r2); }; var Y3 = "VAL must be an integer"; var J4 = (t = Y3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return Number.isInteger(r2) ? r2 : new o(e2, "integer", r2); }; var Z4 = "VAL must be an safe integer"; var Q4 = (t = Z4) => function(r2) { let e2 = t.replace(/VAL/g, r2); return Number.isSafeInteger(r2) ? r2 : new o(e2, "safeInteger", r2); }; var K4 = "VAL must be a great then MIN_VALUE"; var rr3 = (t, r2 = K4) => { if (!f3(t)) throw new Error("MIN_VALUE not defined!"); return function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/MIN_VALUE/g, t), s2 = +e2; return !isNaN(s2) && s2 >= +t ? e2 : new o(c5, "minValue", e2); }; }; var er3 = "VAL must be a less then MAX_VALUE"; var tr3 = (t, r2 = er3) => { if (!f3(t)) throw new Error("MAX_VALUE not defined!"); return function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/MAX_VALUE/g, t), s2 = +e2; return !isNaN(s2) && s2 <= +t ? e2 : new o(c5, "maxValue", e2); }; }; var or3 = "VAL must be a string in valid email format"; var nr3 = (t = or3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r2) ? r2 : new o(e2, "email", r2); }; var cr3 = "Any value required"; var sr3 = (t = cr3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 != "undefined" && r2 !== null && r2 !== "" ? r2 : new o(e2, "required", r2); }; var ar3 = "VAL must be a number"; var fr3 = (t = ar3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "number" && !isNaN(+r2) ? r2 : new o(e2, "number", r2); }; var mr3 = "VAL must be an object"; var ir3 = (t, r2 = mr3) => { if (!(typeof t == "object")) throw new o(r2.replace(/VAL/g, t), "object", t); return d3({}, t); }; var Ar3 = "VAL must be between MIN_VAL and MAX_VAL"; var ur3 = (t, r2, e2 = Ar3) => { if (!f3(t)) throw new Error("MIN_VALUE not defined!"); if (!f3(r2)) throw new Error("MAX_VALUE not defined!"); return function(c5) { let s2 = e2.replace(/VAL/g, c5).replace(/MIN_VAL/g, t).replace(/MAX_VAL/g, r2), a2 = +c5; return !isNaN(a2) && c5 >= +t && c5 <= +r2 ? c5 : new o(s2, "between", c5); }; }; var lr3 = "VAL must be a finite number"; var Er2 = (t = lr3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return Number.isFinite(r2) ? r2 : new o(e2, "finite", r2); }; var dr3 = "VAL must be a string in valid base 64 format"; var gr3 = (t = dr3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(r2) ? r2 : new o(e2, "base64", r2); }; var Gr = "VAL can`t be a number"; var hr3 = (t = Gr) => function(r2) { let e2 = t.replace(/VAL/g, r2); return isNaN(r2) ? r2 : new o(e2, "notNumber", r2); }; var Lr = "VAL must be a boolean"; var _r2 = (t = Lr) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "boolean" ? r2 : new o(e2, "boolean", r2); }; var g4 = "VAL must be an array of TYPE"; var pr3 = (t, r2 = g4) => (!t && !r2 && (t = i2(), r2 = g4), typeof t == "string" && (r2 = t, t = i2()), function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/TYPE/g, t.name); if (!Array.isArray(e2)) return new o(c5, "array", e2); for (let s2 of e2) if (t(s2) instanceof o) return new o(c5, "array", e2); return e2; }); var Sr2 = "VAL must be a valid EMEI"; var Vr = (t) => { let r2 = (s2) => { let a2 = 0; for (; s2 > 0; ) a2 = a2 + s2 % 10, s2 = parseInt("" + s2 / 10, 10); return a2; }, e2 = ("" + t).length; if (e2 !== 15) return false; let c5 = 0; for (let s2 = e2; s2 >= 1; s2--) { let a2 = t % 10; s2 % 2 === 0 && (a2 = 2 * a2), c5 += r2(a2), t = parseInt("" + t / 10, 10); } return c5 % 10 === 0; }; var br2 = (t = Sr2) => function(r2) { let e2 = t.replace(/VAL/g, r2); return Vr(r2) ? r2 : new o(e2, "emei", r2); }; var u3 = "VAL must be a string or array with length N"; var Rr = (t, r2 = u3) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/N/g, t); return (typeof e2 == "string" || Array.isArray(e2)) && e2.length === +t ? e2 : new o(c5, "length", e2); }; var kr2 = (t, r2 = u3) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/N/g, t); return (typeof e2 == "string" || Array.isArray(e2)) && e2.length >= +t ? e2 : new o(c5, "minLength", e2); }; var xr3 = (t, r2 = u3) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/N/g, t); return (typeof e2 == "string" || Array.isArray(e2)) && e2.length <= +t ? e2 : new o(c5, "maxLength", e2); }; var wr3 = "VAL must be a valid ip address ipv4 or ipv6"; var Ur = "VAL must be a valid ipv4 address"; var Dr = "VAL must be a valid ipv6 address"; var G5 = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; var h2 = /^[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}:[a-fA-F0-9]{1, 4}$/; var Mr = (t = wr3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && (G5.test(r2) || h2.test(r2)) ? r2 : new o(e2, "ip", r2); }; var yr3 = (t = Ur) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && G5.test(r2) ? r2 : new o(e2, "ipv4", r2); }; var Nr = (t = Dr) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && h2.test(r2) ? r2 : new o(e2, "ipv6", r2); }; var Ir = "VAL must be a valid domain name, xn--* for internationalized names"; var vr3 = /^((xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/; var Tr2 = (t = Ir) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && vr3.test(r2) ? r2 : new o(e2, "domain", r2); }; var Cr2 = "VAL must be a valid url"; var $r = /^(?:(?:(?:https?|ftp|wss?):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i; var Or = (t = Cr2) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && $r.test(r2) ? r2 : new o(e2, "url", r2); }; var Br = "VAL must be a valid color in HEX, RGB(A), or HSL(A) format"; var Fr = "VAL must be a valid HEX color"; var qr = "VAL must be a valid RGB(a) color"; var Pr = "VAL must be a valid HSL(A) color"; var jr = /^#(?:[\da-f]{3}){1,2}$|^#(?:[\da-f]{4}){1,2}$|^(rgb|hsl)a?\((\s*-?\d+%?\s*,){2}(\s*-?\d+%?\s*)\)$|^(rgb|hsl)a?\((\s*-?\d+%?\s*,){3}\s*(0|(0?\.\d+)|1)\)$/gmi; var zr = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i; var Hr = /^rgba?\((\s*-?\d+%?\s*,){2}(\s*-?\d+%?\s*)\)$|^rgba?\((\s*-?\d+%?\s*,){3}\s*(0|(0?\.\d+)|1)\)$/gmi; var Xr = /^hsla?\((\s*-?\d+%?\s*,){2}(\s*-?\d+%?\s*)\)$|^hsla?\((\s*-?\d+%?\s*,){3}\s*(0|(0?\.\d+)|1)\)$/gmi; var Wr = (t = Br) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && jr.test(r2) ? r2 : new o(e2, "color", r2); }; var Yr = (t = Fr) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && zr.test(r2) ? r2 : new o(e2, "hexColor", r2); }; var Jr = (t = qr) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && Hr.test(r2) ? r2 : new o(e2, "rgbColor", r2); }; var Zr = (t = Pr) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && Xr.test(r2) ? r2 : new o(e2, "hslColor", r2); }; var L4 = /^4\d{12}(?:\d{3,6})?$/u; var _4 = /^5[1-5]\d{2}|(?:222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u; var p3 = /^3[47]\d{13}$/u; var S4 = /^6(?:011|5\d{2})\d{12,15}$/u; var V4 = /^3(?:0[0-5]|[68]\d)\d{11,13}$/u; var b4 = /^(?:2131|1800|35\d{3})\d{11}$/u; var R4 = /^(?:6[27]\d{14,17}|81\d{14,17})$/u; var k4 = "VAL must be a valid CC number (visa, mastercard, american express, discover, diners club, jcb, or union pay)"; var Qr = "VAL must be a valid Visa card number"; var Kr = "VAL must be a valid Mastercard card number"; var re2 = "VAL must be a valid American Express card number"; var ee3 = "VAL must be a valid DISCOVER card number"; var te3 = "VAL must be a valid DINERS CLUB card number"; var oe3 = "VAL must be a valid JCB card number"; var ne3 = "VAL must be a valid Union Pay card number"; var ce3 = (t = k4) => function(r2) { let e2 = t.replace(/VAL/g, r2); return typeof r2 == "string" && (L4.test(r2) || _4.test(r2) || p3.test(r2) || S4.test(r2) || V4.test(r2) || b4.test(r2) || R4.test(r2)) ? r2 : new o(e2, "creditCard", r2); }; var m4 = (t, r2, e2 = k4) => function(c5) { let s2 = e2.replace(/VAL/g, c5); return typeof c5 == "string" && r2.test(c5) ? c5 : new o(s2, t, c5); }; var se2 = (t = Qr) => m4("visa", L4, t); var ae3 = (t = Kr) => m4("mastercard", _4, t); var fe3 = (t = re2) => m4("american express", p3, t); var me3 = (t = ee3) => m4("discover", S4, t); var ie3 = (t = te3) => m4("diners club", V4, t); var Ae3 = (t = oe3) => m4("jcb card", b4, t); var ue3 = (t = ne3) => m4("union pay", R4, t); var le3 = "The length of string must be VAL bytes"; var Ee3 = (t, r2 = le3) => function(e2) { let c5 = r2.replace(/VAL/g, e2); return typeof e2 == "string" && new TextEncoder().encode(e2).length === t ? e2 : new o(c5, "bytes", e2); }; var de3 = "VAL can`t be null or undefined."; var ge3 = (t = de3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return f3(r2) ? r2 : new o(e2, "notNull", r2); }; var Ge3 = "The value must match the pattern"; var he3 = (t, r2 = Ge3) => function(e2) { let c5 = r2.replace(/VAL/g, e2); return (typeof t == "string" ? new RegExp(t, "g") : t).test("" + e2) ? e2 : new o(c5, "pattern", e2); }; var Le3 = "VAL must contains only digits"; var _e3 = (t = Le3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return /^\d+$/g.test("" + r2) ? r2 : new o(e2, "digits", r2); }; var pe3 = "VAL must be a float"; var Se3 = (t = pe3) => function(r2) { let e2 = t.replace(/VAL/g, r2); return !isNaN(r2) && +n % 1 !== 0 || /^\d*\.\d+$/.test(r2) ? r2 : new o(e2, "float", r2); }; var Ve3 = "VAL must must contains OBJ"; var be3 = (t, r2 = Ve3) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/OBJ/g, t); return e2.includes(t) ? e2 : new o(c5, "contains", e2); }; var Re3 = "A VAL must have type TYPE"; function ke3(t) { return Object.prototype.toString.call(t).replace(/^\[object (.+)]$/, "$1").toLowerCase(); } var xe3 = (t = "string", r2 = Re3) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/TYPE/g, t); return t === ke3(e2) ? e2 : new o(c5, "type", e2); }; var we3 = "VAL must be an equal to VALUE"; var Ue2 = (t, r2 = we3) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/VALUE/g, t); return e2 === t ? e2 : new o(c5, "equal", e2); }; var De2 = "VAL must be a similar to VALUE"; var Me3 = (t, r2 = De2) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/VALUE/g, t); return e2 == t ? e2 : new o(c5, "similar", e2); }; var ye3 = "VAL must be a great then VALUE"; var Ne3 = (t, r2 = ye3) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/VALUE/g, t); return e2 > t ? e2 : new o(c5, "great", e2); }; var Ie2 = "VAL must be a less then VALUE"; var ve3 = (t, r2 = Ie2) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/VALUE/g, t); return e2 < t ? e2 : new o(c5, "less", e2); }; var Te2 = "VAL must be a great or equal to VALUE"; var Ce3 = (t, r2 = Te2) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/VALUE/g, t); return e2 >= t ? e2 : new o(c5, "greatOrEqual", e2); }; var $e3 = "VAL must be a less or equal to VALUE"; var Oe3 = (t, r2 = $e3) => function(e2) { let c5 = r2.replace(/VAL/g, e2).replace(/VALUE/g, t); return e2 <= t ? e2 : new o(c5, "lessOrEqual", e2); }; var Be3 = "0.7.3"; var Fe3 = "18.05.2025, 14:43:24"; var qe3 = () => { console.info(`%c Guardian %c v${Be3} %c ${Fe3} `, "color: pink; font-weight: bold; background: #2b1700", "color: white; background: darkgreen", "color: white; background: #0080fe;"); }; // source/guardian/index.js globalThis.G = guardian_exports; // node_modules/@olton/router/dist/router.js var r = class s { static DEBUG_LEVELS = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4, TRACE: 5 }; static DEBUG_LEVEL = s.DEBUG_LEVELS.NONE; static log(e2, t, i3) { if (e2 > s.DEBUG_LEVEL) return; let o2 = { error: "color: #ff5555; font-weight: bold", warn: "color: #ffaa00; font-weight: bold", info: "color: #0080fe; font-weight: bold", debug: "color: #00aa00; font-weight: bold", trace: "color: #888888", data: "color: #555; font-style: italic" }, a2, n3; switch (e2) { case s.DEBUG_LEVELS.ERROR: a2 = "error", n3 = console.error; break; case s.DEBUG_LEVELS.WARN: a2 = "warn", n3 = console.warn; break; case s.DEBUG_LEVELS.INFO: a2 = "info", n3 = console.info; break; case s.DEBUG_LEVELS.DEBUG: a2 = "debug", n3 = console.debug; break; case s.DEBUG_LEVELS.TRACE: a2 = "trace", n3 = console.log; break; default: return; } console.group(`%c Model: ${t}`, o2[a2]), i3 !== void 0 && console.log("%c Data:", o2.data, i3), console.groupEnd(); } static error(e2, t) { s.log(s.DEBUG_LEVELS.ERROR, e2, t); } static warn(e2, t) { s.log(s.DEBUG_LEVELS.WARN, e2, t); } static info(e2, t) { s.log(s.DEBUG_LEVELS.INFO, e2, t); } static debug(e2, t) { s.log(s.DEBUG_LEVELS.DEBUG, e2, t); } static trace(e2, t) { s.log(s.DEBUG_LEVELS.TRACE, e2, t); } }; var E5 = "0.4.1"; var w5 = "18.05.2025, 14:39:57"; var c4 = class { constructor(e2 = {}) { if (r.DEBUG_LEVEL = e2.debug ? 4 : 0, r.debug("[Router] Init Router"), this.routes = {}, this.fallbackRoute = e2.fallback || "/", this.maxRedirects = e2.maxRedirects || 5, this.redirectCount = 0, this.basePath = e2.base || "", this.middleware = [], this.beforeEachHooks = [], this.afterEachHooks = [], this.cache = /* @__PURE__ */ new Map(), this.cacheLimit = e2.cacheLimit ?? 50, this.touchStartX = 0, this.enableSwipeNavigation = e2.enableSwipeNavigation || false, this.current = null, this.redirects = {}, this.useHash = e2.useHash || false, this.events = { beforeNavigate: [], afterNavigate: [], routeNotFound: [], error: [] }, this.plugins = [], this.enableSwipeNavigation && this.initSwipeNavigation(), e2.routes) { r.debug("[Router] Registering routes"); for (let [t, i3] of Object.entries(e2.routes)) this.addRoute(t, i3); } e2.plugins && Array.isArray(e2.plugins) && (r.debug("[Router] Registering plugins"), e2.plugins.forEach((t) => { Array.isArray(t) ? this.usePlugin(t[0], t[1] || {}) : this.usePlugin(t); })), r.debug("[Router] Subscribing to unhandledrejection event"), window.addEventListener("unhandledrejection", this.handleError.bind(this)), r.debug("[Router] Router Initialized"); } on(e2, t) { return r.debug(`[Router] Subscribing to event ${e2}`), this.events[e2] && this.events[e2].push(t), this; } emit(e2, ...t) { if (r.debug(`[Router] Emitting event ${e2}`), this.events[e2]) for (let i3 of this.events[e2]) { let o2 = i3(...t); if (e2 === "beforeNavigate" && o2 === false) return false; } return true; } initSwipeNavigation() { r.debug("[Router] Initializing swipe navigation"), r.debug("[Router] Adding touchstart event listener"), document.addEventListener("touchstart", (e2) => { this.touchStartX = e2.touches[0].clientX; }, { passive: true }), r.debug("[Router] Adding touchend event listener"), document.addEventListener("touchend", (e2) => { let t = e2.changedTouches[0].clientX, i3 = this.touchStartX - t; Math.abs(i3) > 100 && (i3 > 0 ? (r.debug("[Router] Swiping right (forward)"), window.history.forward()) : (r.debug("[Router] Swiping left (backward)"), window.history.back())); }, { passive: true }); } handleError(e2) { r.error("[Router] Error during navigation:", e2), this.emit("error", e2), this.routes["/error"] ? this.navigateTo("/error", true) : this.navigateTo(this.fallbackRoute, true); } sanitizePath(e2) { r.debug("[Router] Sanitizing path:", e2); try { if (!e2) return "/"; let t = new URL(e2, window.location.origin), i3 = decodeURIComponent(t.pathname); return i3 = i3.replace(/[<>'"`;(){}]/g, "").replace(/[\u0000-\u001F\u007F-\u009F]/g, "").replace(/([^/])\/{2,}/g, "$1/").replace(/\/+/g, "/").replace(/(.+)\/$/, "$1").replace(/\.+/g, ".").split("/").filter((o2) => o2 !== ".." && o2 !== ".").join("/"), i3.startsWith("/") || (i3 = "/" + i3), this.isBlockedPath(i3) ? "/" : (r.debug("[Router] Sanitized path:", i3), i3); } catch (t) { return r.error("[Router] Error sanitizing path:", t), "/"; } } isBlockedPath(e2) { return r.debug("[Router] Checking if path is blocked:", e2), [/^\/(api|admin|wp-admin|wp-content|wp-includes)/i, /\.(php|asp|aspx|jsp|cgi|config|env|git|sql|htaccess)$/i, /\/(.+\/)*\.{2,}\//, /javascript:/i, /data:/i, /vbscript:/i, /file:/i].some((i3) => i3.test(e2)); } test(e2) { r.debug("[Router] Testing path:", e2); let t = e2, i3 = this.sanitizePath(e2), o2 = { original: t, sanitized: i3, isBlocked: this.isBlockedPath(i3), isModified: t !== i3 }; return r.debug(`[Router] test result for path ${e2}:`, o2), o2; } beforeEach(e2) { return r.debug("[Router] Adding beforeEach hook"), this.beforeEachHooks.push(e2), this; } afterEach(e2) { return r.debug("[Router] Adding afterEach hook"), this.afterEachHooks.push(e2), this; } use(e2) { return r.debug("[Router] Adding middleware"), this.middleware.push(e2), this; } addRedirect(e2, t) { return r.debug("[Router] Adding redirect from", e2, "to", t), this.redirects[e2] ? false : (this.redirects[e2] = t, this); } addRoute(e2, t) { return r.debug("[Router] Adding route", e2), this.routes[e2] = t, this; } addNestedRoute(e2, t, i3) { r.debug(`[Router] Adding nested route ${t} to ${e2}`); let o2 = `${e2}${t}`.replace(/\/\//g, "/"); return this.addRoute(o2, i3), this; } addLazyRoute(e2, t) { return r.debug("[Router] Adding lazy-loaded route", e2), this.addRoute(e2, async (i3) => { try { let o2 = await t(); return (o2.default || o2)(i3); } catch (o2) { throw o2; } }), this; } addLazyNestedRoute(e2, t, i3) { r.debug("[Router] Adding lazy-loaded nested route", t, "to", e2); let o2 = `${e2}${t}`.replace(/\/\//g, "/"); return this.addLazyRoute(o2, i3), this; } addFallbackRoute(e2) { return r.debug("[Router] Adding fallback route", e2), this.fallbackRoute = e2, this; } add404Route(e2) { return r.debug("[Router] Adding 404 route", e2), this.routes["/404"] = e2, this; } addErrorRoute(e2) { return r.debug("[Router] Adding error route", e2), this.routes["/error"] = e2, this; } addProtectedRoute(e2, t, i3, o2 = "/login") { return r.debug("[Router] Adding protected route", e2), this.addRoute(e2, async (a2) => { if (await i3(a2)) return r.debug("[Router] Guard function passed, executing callback"), t(a2); r.debug("[Router] Guard function failed, redirecting to", o2), await this.navigateTo(o2, true); }), this; } removeRoute(e2) { return r.debug("[Router] Removing route", e2), this.routes[e2] && delete this.routes[e2], this; } updateRoute(e2, t) { return r.debug("[Router] Updating route", e2), this.routes[e2] && (this.routes[e2] = t), this; } getRoutes() { return r.debug("[Router] Getting registered routes"), this.routes; } async navigate(e2) { if (r.debug("[Router] Navigating to", e2), this.redirectCount > this.maxRedirects) { r.error("[Router] Maximum redirect limit reached, redirecting to", this.fallbackRoute), console.error("Maximum redirect limit reached"), this.redirectCount = 0, this.emit("error", new Error("Maximum redirect limit reached")), await this.navigateTo("/error", true); return; } this.redirectCount++; let t = this.matchRoute(this.sanitizePath(e2)); if (t) try { if (r.debug("[Router] Route matched:", t), this.emit("beforeNavigate", t) === false) { r.debug("[Router] Navigation cancelled by beforeNavigate hook"); return; } if (this.redirects[t.path]) { r.debug("[Router] Redirecting to", this.redirects[t.path]), await this.navigateTo(this.redirects[t.path], true); return; } this.redirectCount++; for (let o2 of this.middleware) r.debug("[Router] Executing middleware"), await o2(t); for (let o2 of this.beforeEachHooks) r.debug("[Router] Executing beforeEach hook"), await o2(t); r.debug("[Router] Executing route callback"), await t.callback(t.params); for (let o2 of this.afterEachHooks) r.debug("[Router] Executing afterEach hook"), await o2(t); this.current = t, this.emit("afterNavigate", t), r.debug("[Router] Navigation completed"); } catch (i3) { r.error("[Router] Error during navigation:", i3), console.error("Navigation error:", i3), this.emit("error", i3), this.routes["/error"] && this.routes["/error"](i3); } else r.warn("[Router] Route not found:", e2), this.redirectCount = 0, this.emit("routeNotFound", e2), this.routes["/404"] && this.routes["/404"](); } async navigateTo(e2, t = false) { r.debug(`[Router] Navigating to ${e2} ${t ? "with replace state" : ""}`), this.redirectCount = 0; let i3 = new URL(e2, window.location.origin); t ? (r.debug("[Router] Replacing state with", i3), window.history.replaceState({}, "", i3)) : (r.debug("[Router] Pushing state with", i3), window.history.pushState({}, "", i3)), r.debug("[Router] Navigating to", i3), await this.navigate(i3.pathname); } matchRoute(e2) { if (r.debug("[Router] Matching route for", e2), this.cache.has(e2)) return this.cache.get(e2); r.debug("[Router] Route not found in cache, performing match"); let t = this._performMatch(e2); if (this.cache.size >= this.cacheLimit) { r.debug("[Router] Cache limit reached, removing oldest entry"); let i3 = this.cache.keys().next().value; this.cache.delete(i3); } return r.debug("[Router] Caching result for", e2), this.cache.set(e2, t), t; } _performMatch(e2) { let [t, i3] = e2.split("?"), o2 = new URLSearchParams(i3), a2 = Object.fromEntries(o2); for (let n3 in this.routes) { let d4 = [], h3 = n3.replace(/:([^\/]+)/g, (l2, u4) => (d4.push(u4), "([^/]+)")), g5 = e2.match(new RegExp(`^${h3}$`)); if (g5) { let l2 = g5.slice(1).reduce((u4, b5, R5) => (u4[d4[R5]] = b5, u4), {}); return { path: e2, pattern: h3, callback: this.routes[n3], params: l2, query: a2 }; } } return null; } clearCache() { r.debug("[Router] Clearing cache"), this.cache.clear(); } resetRedirectCount() { r.debug("[Router] Resetting redirect count"), this.redirectCount = 0; } getFullPath(e2) { return r.debug("[Router] Getting full path for", e2), this.useHash ? `#${e2}` : e2; } getPathFromLocation() { return r.debug("[Router] Getting path from location"), this.useHash ? window.location.hash.slice(1) || "/" : window.location.pathname; } listen() { return r.debug("[Router] Starting to listen for navigation events"), this._handleNavigation = () => { this.redirectCount = 0, this.navigate(this.getPathFromLocation()).then((e2) => { }); }, this._handleLinkClick = (e2) => { if (e2.target.tagName === "A") { let t = e2.target.getAttribute("href"); if (t && (this.useHash && t.startsWith("#") || !this.useHash && e2.target.href.startsWith(window.location.origin))) { e2.preventDefault(); let i3 = this.useHash ? t.slice(1) : e2.target.pathname; this.redirectCount = 0, this.navigateTo(i3).then((o2) => { }); } } }, r.debug("[Router] Listening for navigation events"), window.addEventListener(this.useHash ? "hashchange" : "popstate", this._handleNavigation), r.debug("[Router] Listening for link clicks"), document.addEventListener("click", this._handleLinkClick), this._initPlugins(), this.redirectCount = 0, this.navigate(this.getPathFromLocation()).then((e2) => { }), this; } _initPlugins() { r.debug("[Router] Init plugins"), this.plugins.forEach(({ plugin: e2, options: t }) => { typeof e2.onInit == "function" && e2.onInit(this, t); }); } usePlugin(e2, t = {}) { if (!e2) return this; if (r.debug("[Router] Using plugin", e2), typeof e2 == "object" && typeof e2.install == "function") r.debug("[Router] Installing plugin", e2), e2.install(this, t); else if (typeof e2 == "function") r.debug("[Router] Executing plugin", e2), e2(this, t); else return r.warn("Invalid plugin format. Plugin must be an object with install method or a function."), this; return r.debug("[Router] Add plugin to store", e2), this.plugins.push({ plugin: e2, options: t }), r.debug("[Router] Plugin initialized"), this; } destroy() { r.debug("[Router] Destroying router"), this.plugins.forEach(({ plugin: e2, options: t }) => { r.debug("[Router] Destroying plugin", e2), typeof e2.onDestroy == "function" && e2.onDestroy(this, t); }), r.debug("[Router] Removing event listeners"), window.removeEventListener(this.useHash ? "hashchange" : "popstate", this._handleNavigation), document.removeEventListener("click", this._handleLinkClick), window.removeEventListener("unhandledrejection", this.handleError), this._handleNavigation = null, this._handleLinkClick = null, this.routes = {}, this.plugins = [], this.cache.clear(), r.debug("[Router] Router destroyed"); } }; c4.info = () => { console.info(`%c Router %c v${E5} %c ${w5} `, "color: #ffffff; font-weight: bold; background: #ed1cab", "color: white; background: darkgreen", "color: white; background: #0080fe;"); }; var f4 = c4; var p4 = f4; // source/router/index.js globalThis.Router = p4; // node_modules/@olton/model/dist/model.js var EventEmitter = class { /** * Initializes a new EventEmitter instance. * Creates an empty Map where: * - Keys are event names (strings) * - Values are Sets of callback functions */ constructor() { this.events = /* @__PURE__ */ new Map(); } /** * Registers a new event listener for the specified event. * - Creates new Set for event if it doesn't exist * - Adds callback to the Set of listeners * - Returns unsubscribe function for cleanup * * @param {string} eventName - Event identifier * @param {Function} callback - Event handler function * @returns {Function} Unsubscribe function */ on(eventName, callback) { if (!this.events.has(eventName)) { this.events.set(eventName, /* @__PURE__ */ new Set()); } this.events.get(eventName).add(callback); return () => this.off(eventName, callback); } /** * Removes a specific event listener. * - Safely handles non-existent events * - Removes only the specified callback * - Keeps other listeners for the same event intact * * @param {string} eventName - Event to unsubscribe from * @param {Function} callback - Listener to remove */ off(eventName, callback) { if (this.events.has(eventName)) { this.events.get(eventName).delete(callback); } } /** * Triggers all listeners for the specified event. * - Safely handles non-existent events * - Executes each listener in try-catch block * - Continues execution even if one listener fails * - Logs errors without breaking execution * * @param {string} eventName - Event to trigger * @param {*} [data] - Optional data for listeners */ emit(eventName, data) { if (this.events.has(eventName)) { this.events.get(eventName).forEach((callback) => { try { callback(data); } catch (e2) { console.error(`Error when performing an event handler ${eventName}:`, e2); } }); } } }; var event_emitter_default = EventEmitter; var DevToolsStyle = ` `; var dev_tools_style_default = DevToolsStyle; var ModelDevTools = class { constructor(model, options = {}) { this.model = model; this.options = { enabled: true, timeTravel: true, maxSnapshots: 50, ...options }; this.history = []; this.currentIndex = -1; this.initializeDevTools(); } /** * Initializes the model development tools by: * - Creating a global reference at window.__MODEL_DEVTOOLS__ * - Creating the dev tools panel in the DOM * - Setting up model event listeners for debugging */ initializeDevTools() { window.__MODEL_DEVTOOLS__ = this; this.createDevToolsPanel(); this.setupModelListeners(); } /** * Creates the development tools panel in the DOM with: * - A header with title and control buttons * - Content area for debugging information * - Styling from DevToolsWindowStyle * - Close and Time Travel buttons with event handlers * - Toggle button for panel visibility */ createDevToolsPanel() { const panel = document.createElement("div"); panel.id = "model-devtools-panel"; panel.style.cssText = `display: none;`; const header = document.createElement("div"); header.innerHTML = ` ${dev_tools_style_default}
\u{1F6E0} Model DevTools
`; const content = document.createElement("div"); content.style.cssText = ` padding: 8px; height: calc(100% - 35px); overflow: auto; `; content.id = "model-devtools-content"; panel.appendChild(header); panel.appendChild(content); document.body.appendChild(panel); this.createToggleButton(); document.getElementById("devtools-close").onclick = () => this.togglePanel(); document.getElementById("devtools-time-travel").onclick = () => this.showTimeTravelDialog(); } /** * Displays the Time Travel dialog by: * - Creating or reusing existing dialog container * - Generating a reversed chronological list of snapshots * - Formatting snapshot data (timestamp, type, property, old/new values) * - Displaying changes in computed properties and value transitions */ showTimeTravelDialog() { let dialog = document.getElementById("model-devtools-time-travel-dialog"); if (!dialog) { dialog = document.createElement("div"); dialog.id = "model-devtools-time-travel-dialog"; } const statesList = [...this.history].reverse().map((snapshot, index) => `
Time: ${new Date(snapshot.timestamp).toLocaleTimeString()}
Type: ${snapshot.type}
Property: ${snapshot.property || snapshot.event || snapshot.path || ""}
Value: ${snapshot.type === "computed-update" ? snapshot.newValue : typeof snapshot.oldValue !== "undefined" && typeof snapshot.newValue !== "undefined" ? `${JSON.stringify(snapshot.oldValue)} -> ${JSON.stringify(snapshot.newValue)}` : JSON.stringify(snapshot.newValue || snapshot.value || "")}
`).join(""); dialog.innerHTML = `
\u23F1 Time Travel
${statesList || "Nothing to show!"}
`; document.body.appendChild(dialog); } /** * Creates a toggle button for the Model DevTools panel. * The button is appended to the page and provides * functionality to show or hide the dev tools panel. */ createToggleButton() { const button = document.createElement("button"); button.id = "model-dev-tools-toggle-button"; button.textContent = "\u{1F6E0}"; button.title = "Model DevTools"; button.onclick = () => this.togglePanel(); document.body.appendChild(button); } /** * Sets up listeners for the model and its store to track and log changes, * events, computed property updates, and array operations. This enables * the Model DevTools to record snapshot history, provide time travel * functionality, and update the display with relevant data changes. */ setupModelListeners() { this.model.store.on("change", (data) => { this.logChange({ type: "data-change", path: data.path, oldValue: data.oldValue, newValue: data.newValue, timestamp: Date.now() }); }); this.model.store.on("*", (eventName, data) => { if (eventName !== "change" && eventName !== "compute" && eventName !== "arrayChange") { this.logChange({ type: "store-event", event: eventName, data, timestamp: Date.now() }); } }); this.model.on("*", (eventName, data) => { if (eventName !== "change" && eventName !== "compute") { this.logChange({ type: "model-event", event: eventName, data, timestamp: Date.now() }); } }); this.model.store.on("compute", (data) => { this.logChange({ type: "computed-update", property: data.key, dependencies: Array.from(data.dependencies), newValue: data.value, timestamp: Date.now() }); }); this.model.store.on("arrayChange", (data) => { this.logChange({ type: "array-operation", path: data.path, method: data.method, args: data.args, oldValue: data.oldValue, newValue: data.newValue, timestamp: Date.now() }); }); } /** * Logs a change entry and updates the Model DevTools display if enabled. * * - If the `timeTravel` option is enabled, the method saves a snapshot of the current state. * - Updates the DevTools display to reflect the new changes. * * @param {Object} entry - The change entry to log. * @param {string} entry.type - The type of change (for example, 'data-change', 'model-event', etc.). * @param {string} [entry.path] - Path of the property being changed (if applicable). * @param {any} [entry.oldValue] - The previous value of the changed property (if applicable). * @param {any} [entry.newValue] - The new value of the changed property (if applicable). * @param {string} [entry.event] - The event name associated with the change (if applicable). * @param {number} entry.timestamp - A timestamp indicating when the change occurred. */ logChange(entry) { if (!this.options.enabled) return; if (this.options.timeTravel) { this.saveSnapshot(entry); } this.updateDisplay(); } /** * Saves a snapshot of the current model state, including computed properties and relevant metadata. * * - Trims the history to ensure the size does not exceed `maxSnapshots`. * - Updates the snapshot history and current snapshot index. * * @param {Object} entry - The change entry that triggered the snapshot. * @param {string} entry.type - The type of change (for example, 'data-change', 'model-event', etc.). * @param {string} [entry.path] - Path of the property being changed (if applicable). * @param {any} [entry.oldValue] - The previous value before the change (if applicable). * @param {any} [entry.newValue] - The new value after the change (if applicable). * @param {number} entry.timestamp - A timestamp indicating when the change occurred. */ saveSnapshot(entry) { const snapshot = { ...entry, state: JSON.parse(JSON.stringify(this.model.data)), computed: this.getComputedValues() }; this.history = this.history.slice(0, this.currentIndex + 1); this.history.push(snapshot); this.currentIndex++; if (this.history.length > this.options.maxSnapshots) { this.history.shift(); this.currentIndex--; } } /** * Updates the display of the Model DevTools. * * - Retrieves and formats the current state, computed values, DOM dependencies, and * recent changes in the model. * - Creates and dynamically sets the innerHTML content of the Model DevTools panel. * - Triggers the time travel dialog if the corresponding element is present. * * This method ensures that the visual representation of the model remains up-to-date * for debugging and monitoring purposes. */ updateDisplay() { const content = document.getElementById("model-devtools-content"); if (!content) return; const formatValue = (value) => { if (value === void 0) return "undefined"; if (value === null) return "null"; try { if (Array.isArray(value)) { return `Array(${value.length}) ${JSON.stringify(value, null, 2)}`; } return JSON.stringify(value, null, 2); } catch (e2) { return String(value); } }; const recentChanges = this.getRecentChanges(); let changes = ``; for (const change of recentChanges) { let changeContent; try { const formattedChange = { ...change, timestamp: new Date(change.timestamp).toLocaleTimeString() }; changeContent = JSON.stringify(formattedChange, null, 2); } catch (e2) { changeContent = `Error formatting change: ${e2.message}`; } changes += `
${changeContent}
`; } const computedValues = this.getComputedValues(); content.innerHTML = `

Current State:

${formatValue(this.model.data)}

Computed Values:

${formatValue(computedValues)}

DOM Dependencies:

${this.formatDOMDependencies()}

Recent Changes:

${changes}
`; const timeTravelDialog = document.getElementById("model-devtools-time-travel-dialog"); if (timeTravelDialog) { this.showTimeTravelDialog(); } } /** * Formats and returns a structured representation of model's DOM dependencies. * * - Loops through the DOM dependencies managed in the model. * - Converts the `Map` structure into a plain object for easier inspection. * - Each dependency entry includes the type of dependency and the tag name of the associated element. * * @returns {string} A JSON string representing the formatted DOM dependencies. */ formatDOMDependencies() { try { const dependencies = {}; this.model.dom.domDependencies.forEach((value, key) => { dependencies[key] = Array.from(value).map((dep) => ({ type: dep.type, element: dep.element.tagName })); }); return JSON.stringify(dependencies, null, 2); } catch (e2) { return `Error formatting DOM dependencies: ${e2.message}`; } } /** * Retrieves computed values from the model and returns them in a structured format. * * - If the model's `computed.all` function is available, all computed values are fetched at once. * - If the model has a list of computed keys, their values are retrieved individually. * - Falls back to iterating over model data keys and extracting computed values if present. * * @returns {Object} An object containing the computed values from the model. */ getComputedValues() { if (!this.model.computed) return {}; if (typeof this.model.computed.all === "function") { return this.model.computed.all(); } if (this.model.computed.keys && Array.isArray(this.model.computed.keys)) { const result = {}; for (const key of this.model.computed.keys) { result[key] = this.model.computed.getValue(key); } return result; } const computedValues = {}; for (const key in this.model.data) { if (this.model.computed && typeof this.model.computed[key] !== "undefined") { computedValues[key] = this.model.data[key]; } } return computedValues; } /** * Retrieves the most recent changes from the history. * * - This method fetches the last 5 changes from the `history` array. * - The returned changes are reversed to display the most recent change first. * * @returns {Array} An array of recent changes from the history. */ getRecentChanges() { return this.history.slice(-5).reverse(); } /** * Toggles the visibility of the development tools panel. * * - If the panel is currently hidden (`display: none`), it will be made visible. * - If the panel is currently visible, it will be hidden. */ togglePanel() { const panel = document.getElementById("model-devtools-panel"); if (panel) { panel.style.display = panel.style.display === "none" ? "block" : "none"; } if (panel.style.display === "none") { document.getElementById("model-devtools-time-travel-dialog").remove(); } } /** * Retrieves the data stored at the specified path in the model's store. * * - The `path` parameter is used to access specific data within the store. * - The method returns the value found at the given path. * * @param {string} path - The dot-notated path to retrieve the value from the store. * @returns {*} The data stored at the specified path. */ inspect(path) { return this.model.store.get(path); } /** * Toggles the visibility of the development tools panel in the UI. * * - The method checks the current display state of the panel element. * - If the panel is hidden (`display: none`), it becomes visible (`block`). * - If the panel is visible, it gets hidden. * * @example * // Assuming an element with ID 'model-devtools-panel' exists: * devTools.togglePanel(); * * // This will toggle the panel's visibility between shown and hidden. */ timeTravel(index) { if (!this.options.timeTravel || true) return; if (index < 0 || index >= this.history.length) return; const snapshot = this.history[index]; try { const origEnabled = this.options.enabled; this.options.enabled = false; this.model.store.setState(snapshot.state); if (this.model.computed) { if (typeof this.model.computed.recomputeAll === "function") { this.model.computed.recomputeAll(); } else { for (const key in snapshot.computed) { if (typeof this.model.computed.evaluate === "function") { this.model.computed.evaluate(key, true); } else if (typeof this.model.computed.recompute === "function") { this.model.computed.recompute(key); } } } } this.model.dom.updateAllDOM(); this.currentIndex = index; this.options.enabled = origEnabled; } catch (e2) { console.error("Error during time travel:", e2); } } clearTimeTravel() { this.history = []; this.currentIndex = -1; this.showTimeTravelDialog(); } /** * Starts performance monitoring for the model's store. * * - Sets up initial metrics counters for updates, computations, and DOM updates. * - Begins tracking the performance of the model store. * - Records changes and computations triggered on the store. * * @example * const devTools = new ModelDevTools(model); * devTools.startPerfMonitoring(); * * // After some operations on the model: * console.log(devTools.getPerfReport()); * // Outputs the performance metrics report. */ startPerfMonitoring() { this.perfMetrics = { updates: 0, computations: 0, domUpdates: 0, startTime: Date.now() }; this.model.store.on("change", () => { this.perfMetrics.updates++; }); this.model.store.on("compute", () => { this.perfMetrics.computations++; }); } getPerfReport() { const duration = (Date.now() - this.perfMetrics.startTime) / 1e3; return { totalUpdates: this.perfMetrics.updates, updatesPerSecond: this.perfMetrics.updates / duration, computationsPerSecond: this.perfMetrics.computations / duration, domUpdatesPerSecond: this.perfMetrics.domUpdates / duration }; } }; var dev_tools_default = ModelDevTools; var MiddlewareManager = class { /** * Creates a new MiddlewareManager instance. * Initializes empty array for middleware functions. */ constructor() { this.middlewares = []; } /** * Registers a new middleware function. * - Validates that middleware is a function * - Logs error if invalid middleware provided * - Adds valid middleware to execution chain * * @param {Function} middleware - Function(context, next) * @returns {void} * @throws {Error} Logs error for non-function middleware */ use(middleware) { if (typeof middleware !== "function") { console.error("MIDDLEWARE should be a function!"); return; } this.middlewares.push(middleware); } /** * Executes middleware chain sequentially. * - Maintains execution order using index counter * - Creates and passes next() function to each middleware * - Supports async middleware execution * - Preserves and returns modified context * - Stops chain when no more middleware exists * * @param {Object} context - Data passed through middleware chain * @returns {Promise} Modified context after chain completion */ async process(context) { let index = -1; const next = async () => { index++; if (index < this.middlewares.length) { await this.middlewares[index](context, next); } }; await next(); return context; } }; var middleware_default = MiddlewareManager; var Logger = class _Logger { /** * Enumeration of available debug levels from lowest (NONE) to highest (TRACE). * Used to control the verbosity of logging output. */ static DEBUG_LEVELS = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4, TRACE: 5 }; /** * The current debug level for the Logger class. Determines the types of logs * that will be displayed. To adjust the logging behavior, set this property * to one of the predefined levels in `Logger.DEBUG_LEVELS`. * * @type {number} * @default Logger.DEBUG_LEVELS.NONE */ static DEBUG_LEVEL = _Logger.DEBUG_LEVELS.NONE; /** * Core logging method that handles message formatting and output. * @param {number} level - Debug level from Logger.DEBUG_LEVELS * @param {string} message - Message to log * @param {any} [data] - Optional data to display * @private */ static log(level, message, data) { if (level > _Logger.DEBUG_LEVEL) return; const styles = { error: "color: #ff5555; font-weight: bold", warn: "color: #ffaa00; font-weight: bold", info: "color: #0080fe; font-weight: bold", debug: "color: #00aa00; font-weight: bold", trace: "color: #888888", data: "color: #555; font-style: italic" }; let styleType; let method; switch (level) { case _Logger.DEBUG_LEVELS.ERROR: styleType = "error"; method = console.error; break; case _Logger.DEBUG_LEVELS.WARN: styleType = "warn"; method = console.warn; break; case _Logger.DEBUG_LEVELS.INFO: styleType = "info"; method = console.info; break; case _Logger.DEBUG_LEVELS.DEBUG: styleType = "debug"; method = console.debug; break; case _Logger.DEBUG_LEVELS.TRACE: styleType = "trace"; method = console.log; break; default: return; } console.group(`%c Model: ${message}`, styles[styleType]); if (data !== void 0) { console.log("%c Data:", styles.data, data); } console.groupEnd(); } /** * Logs an error message with an optional data object. * This method uses the `Logger.DEBUG_LEVELS.ERROR` level. * * @param {string} message - The error message to log. * @param {any} [data] - Additional data to log alongside the message. */ static error(message, data) { _Logger.log(_Logger.DEBUG_LEVELS.ERROR, message, data); } /** * Logs a warning message with an optional data object. * This method uses the `Logger.DEBUG_LEVELS.WARN` level. * * @param {string} message - The warning message to log. * @param {any} [data] - Additional data to log alongside the message. */ static warn(message, data) { _Logger.log(_Logger.DEBUG_LEVELS.WARN, message, data); } /** * Logs an informational message with an optional data object. * This method uses the `Logger.DEBUG_LEVELS.INFO` level. * * @param {string} message - The informational message to log. * @param {any} [data] - Additional data to log alongside the message. */ static info(message, data) { _Logger.log(_Logger.DEBUG_LEVELS.INFO, message, data); } /** * Logs a debug message with an optional data object. * This method uses the `Logger.DEBUG_LEVELS.DEBUG` level. * * @param {string} message - The debug message to log. * @param {any} [data] - Additional data to log alongside the message. */ static debug(message, data) { _Logger.log(_Logger.DEBUG_LEVELS.DEBUG, message, data); } /** * Logs a trace message with an optional data object. * This method uses the `Logger.DEBUG_LEVELS.TRACE` level. * * @param {string} message - The trace message to log. * @param {any} [data] - Additional data to log alongside the message. */ static trace(message, data) { _Logger.log(_Logger.DEBUG_LEVELS.TRACE, message, data); } }; var ReactiveStore = class extends event_emitter_default { /** * Initializes a new ReactiveStore. * - Creates reactive proxy for state management * - Sets up watchers for property observation * - Stores previous state for change detection * - Initializes middleware system for state updates * * @param {Object} [initialState={}] - Initial store state * @param model * @property {Proxy} state - Reactive state object * @property {Map} watchers - Property change observers * @property {Object} previousState - Last known state * @property {MiddlewareManager} middleware - State update pipeline */ constructor(initialState = {}, model) { Logger.DEBUG_LEVEL = model.options.debug ? 4 : 0; Logger.debug("Init ReactiveStore"); super(); this.model = model; Logger.DEBUG_LEVEL = this.model.options.debug ? 4 : 0; Logger.debug("Init ReactiveStore"); this.state = this.createReactiveProxy(initialState); this.watchers = /* @__PURE__ */ new Map(); this.previousState = JSON.parse(JSON.stringify(initialState)); Logger.debug("Init MiddlewareManager"); this.middleware = new middleware_default(); Logger.debug("MiddlewareManager initialized"); Logger.debug("ReactiveStore initialized"); } /** * Registers state change middleware. * Middleware receives context object with: * - prop: Changed property name * - oldValue: Previous value * - newValue: New value * - preventDefault: Control flag * * @param {Function} middleware - Handler(context, next) */ use(middleware) { Logger.debug("Registering middleware:", middleware); this.middleware.use(middleware); } /** * Creates reactive proxy for state objects. * Features: * - Special handling for arrays via separate proxy * - Deep reactivity for nested objects * - Property path tracking * - Value validation support * - Value formatting support * - Middleware integration * - Change prevention capability * * @param {Object|Array} obj - Target object * @param {string} [path=''] - Property path * @returns {Proxy} Reactive proxy */ createReactiveProxy(obj, path = "") { Logger.debug(`Creating reactive object with path ${path} for`, obj); if (Array.isArray(obj)) { return this.createArrayProxy(obj, path); } return new Proxy(obj, { get: (target, prop) => { if (typeof prop === "symbol") { return target[prop]; } const value = target[prop]; const fullPath = path ? `${path}.${prop}` : prop; if (value && typeof value === "object") { return this.createReactiveProxy(value, fullPath); } return value; }, set: async (target, prop, value) => { if (typeof prop === "symbol") { target[prop] = value; return true; } const fullPath = path ? `${path}.${prop}` : prop; const oldValue = target[prop]; if (oldValue === value) { return true; } if (this.validators?.has(`${fullPath}`)) { const isValid = this.validators.get(`${fullPath}`)(value); if (!isValid) return false; } if (this.formatters?.has(`${fullPath}`)) { value = this.formatters.get(`${fullPath}`)(value); } if (value && typeof value === "object") { value = this.createReactiveProxy(value, fullPath); } const context = { prop, oldValue, newValue: value, preventDefault: false }; await this.middleware.process(context); if (context.preventDefault) { return true; } target[prop] = value; this.emit("change", { path: fullPath, oldValue, newValue: value }); if (this.watchers.has(fullPath)) { this.watchers.get(fullPath).forEach((callback) => { callback(value, oldValue); }); } return true; }, deleteProperty: (target, prop) => { if (typeof prop === "symbol") { return delete target[prop]; } const fullPath = path ? `${path}.${prop}` : prop; const oldValue = target[prop]; const result = delete target[prop]; if (result) { this.emit("delete", { path: fullPath, oldValue }); if (this.watchers.has(fullPath)) { this.watchers.get(fullPath).forEach((callback) => { callback(void 0, oldValue); }); } } return result; } }); } /** * Creates a reactive proxy for an array. * The proxy intercepts standard array methods (for example, push, pop, shift, etc.) * to enable detection and reaction to structural changes in the array. * It also ensures that array elements are made reactive. * * @param {Array} array - The array to be proxied. * @param {string} path - The path to the current property in the state tree. * * @returns {Proxy} A proxy that wraps the given array to make it reactive. */ createArrayProxy(array, path) { Logger.debug(`Creating reactive array with path ${path} for`, array); return new Proxy(array, { get: (target, prop) => { if (typeof prop === "symbol") { return target[prop]; } const value = target[prop]; if (typeof value === "function" && ["push", "pop", "shift", "unshift", "splice", "sort", "reverse"].includes(prop)) { return (...args) => { const oldValue = [...target]; const result = target[prop].apply(target, args); const context = { prop: path, oldValue, newValue: target, method: prop, args, preventDefault: false }; this.middleware.process(context).then(() => { if (!context.preventDefault) { this.emit("arrayChange", { path, method: prop, args, oldValue, newValue: target }); this.emit("change", { path, oldValue, newValue: target, method: prop, args }); if (this.watchers.has(path)) { this.watchers.get(path).forEach((callback) => { callback(target, oldValue); }); } } }); return result; }; } if (typeof prop !== "symbol" && !isNaN(Number(prop))) { if (value && typeof value === "object") { return this.createReactiveProxy(value, `${path}[${prop}]`); } } return value; }, set: async (target, prop, value) => { if (typeof prop === "symbol") { target[prop] = value; return true; } const fullPath = path ? `${path}.${prop}` : prop; const oldValue = target[prop]; if (oldValue === value) { return true; } if (this.validators?.has(fullPath)) { const isValid = this.validators.get(fullPath)(value); if (!isValid) return false; } if (this.formatters?.has(fullPath)) { value = this.formatters.get(fullPath)(value); } target[prop] = value; if (value && typeof value === "object") { value = this.createReactiveProxy(value, `${path}[${prop}]`); } const context = { prop, oldValue, newValue: value, preventDefault: false }; await this.middleware.process(context); if (context.preventDefault) { return true; } target[prop] = value; this.middleware.process(context).then(() => { if (!context.preventDefault) { this.emit("arrayChange", { path: fullPath, method: null, args: null, oldValue, newValue: value }); this.emit("change", { path: fullPath, oldValue, newValue: value, arrayIndex: Number(prop) }); if (this.watchers.has(fullPath)) { this.watchers.get(fullPath).forEach((callback) => { callback(value, oldValue); }); } } }); return true; } }); } /** * Applies the specified array method (for example, push, pop, splice) on the array * located at the given path in the state tree. The function ensures * that the changes are reactive by emitting appropriate events and invoking watchers. * * @param {string} path - The path to the array in the state tree. * @param {string} method - The name of the array method to apply (for example, 'push', 'pop'). * @param {...any} args - Arguments to pass to the array method. * * @returns {any} The result of applying the array method to the array. */ applyArrayMethod(path, method, ...args) { Logger.debug(`Applying array method ${method} to path ${path} with args`, args); const array = this.get(path); if (!Array.isArray(array)) { console.error(`\u041F\u0443\u0442\u044C ${path} \u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043C\u0430\u0441\u0441\u0438\u0432\u043E\u043C!`); return false; } const oldArray = [...array]; const result = array[method].apply(array, args); this.emit("arrayChange", { path, method, args, oldValue: oldArray, newValue: [...array] }); this.emit("change", { path, oldValue: oldArray, newValue: [...array] }); if (this.watchers.has(path)) { this.watchers.get(path).forEach((callback) => { callback([...array], oldArray); }); } return result; } /** * Watches for changes to an array located at the specified path in the state tree * and applies the provided callback to make modifications. * Emitted events ensure that watchers are notified and reactivity is maintained. * * @param {string} path - The path to the array in the state tree. * @param {Function} callback - A function to modify the array. * Receives the array as an argument and applies changes to it. * * @returns {any} The result of the callback function applied to the array. */ applyArrayChanges(path, callback) { Logger.debug(`Applying custom array changes to path ${path} with callback`, callback); const array = this.get(path); if (!Array.isArray(array)) { console.error(`The path ${path} is not an array!`); return false; } const oldArray = [...array]; const result = callback(array); this.emit("arrayChange", { path, method: "custom", args: null, oldValue: oldArray, newValue: [...array] }); this.emit("change", { path, oldValue: oldArray, newValue: [...array] }); if (this.watchers.has(path)) { this.watchers.get(path).forEach((callback2) => { callback2([...array], oldArray); }); } return result; } /** * Detects changes between two arrays, identifying items that were added, removed, * or moved. This function compares items by their JSON stringified values. * * @param {Array} newArray - The new array to compare. * @param {Array} [oldArray=[]] - The old array to compare against. Defaults to an empty array. * * @returns {Object} An object containing the changes between the arrays. */ detectArrayChanges(newArray, oldArray = []) { Logger.debug(`Detecting changes between arrays`); const changes = { added: [], removed: [], moved: [] }; for (let i3 = 0; i3 < newArray.length; i3++) { const item = newArray[i3]; const oldIndex = oldArray.findIndex( (oldItem) => JSON.stringify(oldItem) === JSON.stringify(item) ); if (oldIndex === -1) { changes.added.push({ index: i3, item }); } else if (oldIndex !== i3) { changes.moved.push({ oldIndex, newIndex: i3, item }); } } for (let i3 = 0; i3 < oldArray.length; i3++) { const item = oldArray[i3]; const newIndex = newArray.findIndex( (newItem) => JSON.stringify(newItem) === JSON.stringify(item) ); if (newIndex === -1) { changes.removed.push({ index: i3, item }); } } Logger.debug(`Detected changes:`, changes); return changes; } /** * Watches for changes to the specified path in the state tree * and allows the addition of callbacks that execute when changes occur. * * @param {string} path - The path in the state tree to watch for changes. * @param {Function} callback - A function to execute when the value at the path changes. * The callback receives the new and old values as parameters. * * @returns {Function} A function to unsubscribe the callback from the watcher. */ watch(path, callback) { Logger.debug(`Watching path ${path} with callback`, callback); if (!this.watchers.has(path)) { this.watchers.set(path, /* @__PURE__ */ new Set()); } this.watchers.get(path).add(callback); return () => { if (this.watchers.has(path)) { this.watchers.get(path).delete(callback); } }; } /** * Retrieves the value at the specified path in the state tree. * @param {string} [path] - The dot-delimited path to the desired value within the state tree. * @returns {any} - The value at the specified path or `undefined` if the path does not exist. */ get(path) { Logger.debug(`Getting value at path ${path}`); if (!path) return this.state; const parts = path.split("."); let value = this.state; for (const part of parts) { if (value === void 0 || value === null) { return void 0; } value = value[part]; } return value; } /** * Sets a new value at the specified path in the state tree. * @param {String} path - The dot-delimited path to the desired value within the state tree. * @param {any} value - The new value to set at the specified path. */ set(path, value) { Logger.debug(`Setting value at path ${path} to`, value); const parts = path.split("."); let current = this.state; for (let i3 = 0; i3 < parts.length - 1; i3++) { if (current[parts[i3]] === void 0) { current[parts[i3]] = {}; } current = current[parts[i3]]; } current[parts[parts.length - 1]] = value; return value; } /** * Executes the given updater as a batch operation on the state. * * If the `updater` is a function, it will be invoked with the state as an argument, * allowing for multiple updates within a single call. If the `updater` is an object, * its key-value pairs will be used to update specific paths in the state. * * After the batch operation completes, an event (`batchUpdate`) is emitted containing * both the previous state (before changes) and the current state (after changes). * * @param {Function|Object} updater - Either a function to modify the state or an object where keys represent * paths (dot-delimited) and values are the new values to set for those paths. */ batch(updater) { Logger.debug(`Batch updating state with`, updater); this.previousState = JSON.parse(JSON.stringify(this.state)); if (typeof updater === "function") { updater(this.state); } else if (typeof updater === "object") { Object.entries(updater).forEach(([path, value]) => { this.set(path, value); }); } this.emit("batchComplete", { previousState: this.previousState, currentState: this.state }); } /** * Retrieves the current state tree. * @returns {Object} The entire state object. */ getState() { Logger.debug(`Getting entire state`); return this.state; } /** * Retrieves the previous state of the state tree. * * This method returns the state as it was prior to the last update, * enabling comparison or rollback operations if needed. * * @returns {Object} The previous state object. */ getPreviousState() { Logger.debug(`Getting previous state`); return this.previousState; } /** * Converts the current state tree to a JSON string. * * This method serializes the entire state tree into a JSON-formatted string, * which can be used for storage, transmission, or debugging purposes. * * @returns {string} A JSON string representation of the current state. */ toJSON() { Logger.debug(`Converting state to JSON`); return JSON.stringify(this.state); } /** * Reconstructs the state tree from a JSON string. * * This method accepts a JSON-formatted string representing the state, * replaces the current state with the contents of the JSON, and emits a `restore` event * to notify listeners about the restoration operation. The previous state is preserved * for potential comparisons or rollback operations. * * @param {string} json - A JSON-formatted string representing the new state. */ fromJSON(json) { Logger.debug(`Restoring state from JSON`, json); const newState = JSON.parse(json); this.previousState = JSON.parse(JSON.stringify(this.state)); Object.keys(this.state).forEach((key) => { delete this.state[key]; }); Object.entries(newState).forEach(([key, value]) => { this.state[key] = value; }); this.emit("restore", { previousState: this.previousState, currentState: this.state }); } /** * Adds a validator function for a specific property in the state tree. * * The validator function should accept the new value as a parameter * and return `true` if the value is valid, or `false` if it is invalid. * * @param {string} propertyPath - The dot-delimited path to the property in the state tree to validate. * @param {Function} validator - A function that checks the validity of the property value. */ addValidator(propertyPath, validator) { Logger.debug(`Adding validator for path ${propertyPath}`); if (!this.validators) { this.validators = /* @__PURE__ */ new Map(); } this.validators.set(propertyPath, validator); } /** * Adds a formatter function for a specific property in the state tree. * * The formatter function modifies the value of a property before it is returned. * This can be helpful when the stored value needs to be presented in a specific format. * * @param {string} propertyPath - The dot-delimited path to the property in the state tree to format. * @param {Function} formatter - A function that transforms the value of the property. * The function receives the current value as a parameter * and returns the formatted value. */ addFormatter(propertyPath, formatter) { Logger.debug(`Adding formatter for path ${propertyPath}`); if (!this.formatters) { this.formatters = /* @__PURE__ */ new Map(); } this.formatters.set(propertyPath, formatter); } /** * Validates if the provided path exists in the state tree. * * This method checks whether the specified dot-delimited path * in the state tree resolves to a defined value. * * @param {string} path - The dot-delimited path to validate. * @returns {boolean} - `true` if the path exists and has a defined value, `false` otherwise. */ isValidPath(path) { Logger.debug(`Validating path ${path}`); try { const value = this.get(path); return value !== void 0; } catch (e2) { Logger.error(`Error validating path ${path}:`, e2); return false; } } /** * Destroys the current state object and clears all associated watchers and previous states. * * This method is useful for cleanup operations, ensuring no residual state, * watchers, or references are left in memory. */ destroy() { this.state = null; this.watchers.clear(); this.previousState = null; Logger.debug("ReactiveStore destroyed"); } }; var LoopManager = class { /** * Creates a new instance of LoopManager. * * @param {Object} domManager - Manages DOM operations and template bindings * @param {Object} model - Contains the data store and bindings * @property {Map} loops - Stores array loop templates and configurations * @property {Array} loopsIn - Stores object loop configurations and elements */ constructor(domManager, model) { Logger.DEBUG_LEVEL = model.options.debug ? 4 : 0; Logger.debug("Init LoopManager"); this.domManager = domManager; this.model = model; this.loops = /* @__PURE__ */ new Map(); this.loopsIn = []; Logger.debug("LoopManager initialized"); } /** * Parses and initializes both array and object loops in the DOM. * * For data-for loops: * - Validates loop expression syntax (item[, index] in array) * - Creates template clones for future updates * - Registers array dependencies for reactive updates * - Performs initial loop rendering * * For data-in loops: * - Validates loop expression (key in object) * - Stores original templates * - Creates placeholder comments for loop position * - Hides original elements * - Performs initial object iteration rendering * * @param {HTMLElement} rootElement - Root element to scan for loop directives * @throws {Error} Logs error for invalid loop expressions */ parseLoops(rootElement) { Logger.debug("Parsing loops with data-for..."); const loopElements = rootElement.querySelectorAll("[data-for]"); Logger.debug("Found elements with data-for:", loopElements.length); loopElements.forEach((element2) => { const expression = element2.getAttribute("data-for").trim(); const matches2 = expression.match(/^\s*(\w+)(?:\s*,\s*(\w+))?\s+in\s+(\w+(?:\.\w+)*)\s*$/); if (!matches2) { console.error("Invalid expression format data-for:", expression); return; } const [_5, itemName, indexName, arrayPath] = matches2; const array = this.model.store.get(arrayPath); if (!Array.isArray(array)) { console.error(`The value in the ${arrayPath} path is not an array:`, array); return; } const template = element2.cloneNode(true); this.loops.set(element2, { template, itemName, indexName, arrayPath, parentNode: element2.parentNode }); this.domManager.registerDomDependency(arrayPath, element2, { type: "loop", arrayPath }); this.updateLoop(element2); }); Logger.debug("Parsing loops with data-in..."); const inLoops = rootElement.querySelectorAll("[data-in]"); Logger.debug("Found elements with data-in:", inLoops.length); inLoops.forEach((element2) => { const attributeValue = element2.getAttribute("data-in"); const match = attributeValue.match(/^\s*(\w+)\s+in\s+(\S+)\s*$/); if (!match) { console.error(`Invalid data-in syntax: ${attributeValue}`); return; } const [_5, keyVar, objectPath] = match; const template = element2.innerHTML; const parent2 = element2.parentNode; const placeholder = document.createComment(`data-in: ${attributeValue}`); element2.style.display = "none"; parent2.insertBefore(placeholder, element2); this.loopsIn.push({ type: "in", originalElement: element2, template, placeholder, objectPath, keyVar, elements: [] }); const objectData = this.model.store.get(objectPath); if (objectData && typeof objectData === "object" && !Array.isArray(objectData)) { this.updateInLoop(this.loopsIn[this.loopsIn.length - 1], objectData); } }); } /** * Updates the content of object-based loops (`data-in`) when the associated object data changes. * * This method clears the current DOM elements generated for the loop, then iterates through * the provided `objectData` to render new elements based on the loop's template. It uses the * `keyVar` for the object's keys and binds the DOM elements for further updates. * * @param {Object} loop - The loop configuration containing details such as the template, * placeholder, and object path. * @param {Object} objectData - The new object data used to generate loop elements. */ updateInLoop(loop, objectData) { loop.elements.forEach((el) => el.remove()); loop.elements = []; if (!objectData || typeof objectData !== "object" || Array.isArray(objectData)) { return; } Object.keys(objectData).forEach((key) => { Logger.debug(`Updating loop for key: ${key}`); const newElement = loop.originalElement.cloneNode(true); newElement.removeAttribute("data-in"); newElement.style.display = ""; const itemContext = { [loop.keyVar]: key }; newElement.innerHTML = this.processTemplate(loop.template, objectData, key, itemContext); loop.placeholder.parentNode.insertBefore(newElement, loop.placeholder.nextSibling); loop.elements.push(newElement); this.domManager.bindDOM(newElement); }); } /** * Processes a template string by replacing placeholders with computed values * based on the given object data, key, and context. * * Placeholder syntax: `{{ path }}`, where `path` can refer to variable keys, * object properties, or dynamic expressions. * * @param {string} template - The template string containing placeholders. * @param {Object} objectData - The object data used for resolving placeholders. * @param {string} key - The current key in the object data. * @param {Object} itemContext - The context containing additional data such as the key variable. * @returns {string} - The processed template string with placeholders replaced by their respective values. */ processTemplate(template, objectData, key, itemContext) { Logger.debug("Processing template:", template); Logger.debug(" With data:", objectData); Logger.debug(` For key: ${key}`); Logger.debug(` With context:`, itemContext); return template.replace(/\{\{\s*([^}]+)\s*\}\}/g, (match, path) => { path = path.trim(); const keyVar = Object.keys(itemContext)[0]; if (path === keyVar) { return key; } Logger.debug(`Template: Processing path: ${path}`); const bracketRegex = new RegExp(`(\\w+)\\[${keyVar}\\]`); const bracketMatch = path.match(bracketRegex); if (bracketMatch) { const objName = bracketMatch[1]; const obj = objectData; if (obj && typeof obj === "object") { return obj[key] !== void 0 ? obj[key] : ""; } } const value = this.model.store.get(path); if (value !== void 0) { return value; } return ""; }); } /** * Updates all the loops (`data-for` and `data-in`) when the data in the store changes. * * Specifically: * - Updates array-based loops (`data-for`) if the associated array data changes. * - Updates object-based loops (`data-in`) if the associated object or its child properties change. * * @param {string} path - The path of the data in the store that has changed. * @param {*} value - The new value at the given path. */ updateLoops(path, value) { Logger.debug("Updating data-for loops for ${path}", this.loops); this.loops.forEach((loopInfo, element2) => { if (loopInfo.arrayPath === path) { this.updateLoop(element2); } }); Logger.debug(`Updating data-in loops for ${path}`, this.loopsIn); this.loopsIn.forEach((loop) => { if (loop.type === "in" && (loop.objectPath === path || path.startsWith(loop.objectPath + "."))) { const objectData = this.model.store.get(loop.objectPath); if (objectData && typeof objectData === "object") { this.updateInLoop(loop, objectData); } } }); } /** * Updates the entire loop for a given element. * @param element */ updateLoop(element2) { Logger.debug("Updating loop for element:", element2); const loopInfo = this.loops.get(element2) || this.loopsIn.find((loop) => loop.originalElement === element2)[0]; if (!loopInfo) { console.error("\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0446\u0438\u043A\u043B\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0434\u043B\u044F \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430"); return; } const { template, itemName, indexName, arrayPath, parentNode } = loopInfo; const array = this.model.store.get(arrayPath); if (!Array.isArray(array)) { console.error("\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043C\u0430\u0441\u0441\u0438\u0432\u043E\u043C:", array); return; } const generated = parentNode.querySelectorAll(`[data-generated-for="${arrayPath}"]`); generated.forEach((el) => el.remove()); array.forEach((item, index) => { const newNode = template.cloneNode(true); newNode.style.display = ""; newNode.removeAttribute("data-for"); newNode.setAttribute("data-generated-for", arrayPath); newNode.setAttribute("data-item-index", "" + index); Logger.debug(`Creating new loop element for ${arrayPath} at index ${index}`); this.domManager.processTemplateNode(newNode, { [itemName]: item, [indexName || "index"]: index }); Logger.debug(`Insert new node`, newNode); parentNode.insertBefore(newNode, element2); }); element2.style.display = "none"; } /** * Partially updates a single DOM element within a loop based on changes in * the associated array. Specifically: * - If the changed index is provided, updates only the element at that index. * - If no changed index is provided or if the array length does not match * the number of generated elements, falls back to a full loop update. * * @param {HTMLElement} element - The loop's original template element. * @param {string} arrayPath - The path to the array in the data store associated with this loop. * @param {*} changedValue - The updated value in the array (optional). * @param {number} changedIndex - The index of the updated value in the array (optional). */ updateLoopPart(element2, arrayPath, changedValue, changedIndex) { const loopInfo = this.loops.get(element2); if (!loopInfo) return; const { template, itemName, indexName, parentNode } = loopInfo; const array = this.model.store.get(arrayPath); if (!Array.isArray(array)) return; const generated = Array.from( parentNode.querySelectorAll(`[data-generated-for="${arrayPath}"]`) ); if (changedIndex === void 0 || generated.length !== array.length) { return this.updateLoop(element2); } const elementToUpdate = generated[changedIndex]; if (elementToUpdate) { const newNode = template.cloneNode(true); this.domManager.processTemplateNode(newNode, { [itemName]: array[changedIndex], [indexName || "index"]: changedIndex }); while (elementToUpdate.firstChild) { elementToUpdate.removeChild(elementToUpdate.firstChild); } while (newNode.firstChild) { elementToUpdate.appendChild(newNode.firstChild); } Array.from(newNode.attributes).forEach((attr) => { elementToUpdate.setAttribute(attr.name, attr.value); }); } } /** * Returns an object containing the tracked loops in the current instance. * * @returns {Object} An object with two properties: * - `for`: A Map of loops associated with array-based (`data-for`) rendering. * - `in`: An array of loops associated with object-based (`data-in`) rendering. */ getLoops() { return { "for": this.loops, "in": this.loopsIn }; } /** * Destroys all tracked loops by clearing the internal Map of `data-for` loops. * * This method should be called when the instance is no longer needed * to release memory and cleanup loop references. */ destroy() { this.loops.clear(); this.loopsIn = []; Logger.debug("LoopManager destroyed"); } }; var ExpressionManager = class { /** * Evaluates a given expression within a specific context. * * This method can handle three types of input: * 1. Expressions wrapped in double curly braces (`{{ }}`) are treated as * context paths and their values are retrieved using the `getValueFromContext` method. * 2. Ternary, logical, and comparison operations within the expression * are parsed and evaluated using the `parseExpression` method. * 3. Literal or primitive values (for example, numbers, strings, booleans) are directly returned. * * Any parsing or evaluation errors are caught and logged. * * @param {string} expression - The expression to evaluate. * @param {Object} context - The object representing the evaluation context. * @returns {*} The result of evaluating the expression. Returns `false` if an error occurs. */ static evaluateExpression(expression, context) { try { if (expression.startsWith("{{") && expression.endsWith("}}")) { const path = expression.substring(2, expression.length - 2).trim(); return this.getValueFromContext(context, path); } return this.parseExpression(expression, context); } catch (error) { console.error("\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u0438 \u0432\u044B\u0447\u0438\u0441\u043B\u0435\u043D\u0438\u0438 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u044F:", error); return false; } } /** * Retrieves a value from a given context object based on a dot-separated path. * * This method allows accessing nested properties or array elements from an object * using a path string. If a part of the path references an array, you can include * an array index (for example, 'path.toArray[0]'). If the path is invalid or the property * doesn't exist, the method will return undefined. * * @param {Object} obj - The context object to retrieve values from. * @param {string} path - The dot-separated string representing the path to the value. * @returns {*} The value located at the specified path, or undefined if not found. */ static getValueFromContext(obj, path) { if (!path) return obj; return path.split(".").reduce((acc, part) => { const arrayMatch = part.match(/^([^\[]+)(?:\[(\d+)\])?$/); if (arrayMatch) { const [_5, propName, arrayIndex] = arrayMatch; const propValue = acc?.[propName]; return arrayIndex !== void 0 && Array.isArray(propValue) ? propValue[parseInt(arrayIndex, 10)] : propValue; } return acc?.[part]; }, obj); } /** * Parses and evaluates a given expression within a provided context. * * This method handles several types of expressions, including: * 1. Ternary expressions (`condition ? trueValue : falseValue`). * 2. Logical expressions with `&&` (AND) and `||` (OR). * 3. Comparison expressions (for example, `===`, `!==`, `>`, `<`, `>=`, `<=`). * 4. String literals inside single or double quotes. * 5. Numeric literals (integers and floats). * 6. Boolean literals (`true`, `false`), and `null`, `undefined`. * 7. Context-based values, retrieved using the `getValueFromContext` method if the expression * is not a primitive value or an operation. * * The method uses recursion to parse and evaluate nested expressions. * * @param {string} expression - The expression to parse and evaluate. * @param {Object} context - The object providing the evaluation context. * @returns {*} The evaluated result of the expression, or `undefined` if the path does not exist in the context. */ static parseExpression(expression, context) { expression = expression.trim(); const ternaryMatch = expression.match(/(.+?)\s*\?\s*(.+?)\s*:\s*(.+)/); if (ternaryMatch) { const [_5, condition, trueExpr, falseExpr] = ternaryMatch; return this.parseExpression(condition, context) ? this.parseExpression(trueExpr, context) : this.parseExpression(falseExpr, context); } if (expression.includes("&&")) { const parts = expression.split("&&"); return parts.every((part) => this.parseExpression(part.trim(), context)); } if (expression.includes("||")) { const parts = expression.split("||"); return parts.some((part) => this.parseExpression(part.trim(), context)); } const comparisonMatch = expression.match(/(.+?)\s*(===|==|!==|!=|>=|<=|>|<)\s*(.+)/); if (comparisonMatch) { const [_5, left, operator, right] = comparisonMatch; const leftValue = this.parseExpression(left.trim(), context); const rightValue = this.parseExpression(right.trim(), context); switch (operator) { case "==": return leftValue == rightValue; case "===": return leftValue === rightValue; case "!=": return leftValue != rightValue; case "!==": return leftValue !== rightValue; case ">": return leftValue > rightValue; case "<": return leftValue < rightValue; case ">=": return leftValue >= rightValue; case "<=": return leftValue <= rightValue; } } if (expression.startsWith("'") && expression.endsWith("'") || expression.startsWith('"') && expression.endsWith('"')) { return expression.substring(1, expression.length - 1); } if (/^-?\d+(\.\d+)?$/.test(expression)) { return parseFloat(expression); } if (expression === "true") return true; if (expression === "false") return false; if (expression === "null") return null; if (expression === "undefined") return void 0; return this.getValueFromContext(context, expression); } /** * Extracts variables from a given expression string. * * This method parses the expression and returns a list of variable names that are used * in the expression. The variables are determined based on alphanumeric and underscore * naming conventions, excluding JavaScript reserved keywords and primitive constants. * * @param {string} expression - The expression string to extract variables from. * @returns {Array} An array of unique variable names found in the expression. * Variables are returned in their base form (in other words, the part before any dot notation or brackets). */ static extractVariables(expression) { const variables = []; const cleanExpr = expression.replace(/'[^']*'/g, "''").replace(/"[^"]*"/g, '""'); const matches2 = cleanExpr.match(/[a-zA-Z_][a-zA-Z0-9_]*(\.([a-zA-Z_][a-zA-Z0-9_]*))*(\[\d+\])*/g); if (matches2) { matches2.forEach((match) => { const baseName = match.split(".")[0].split("[")[0].trim(); if (!["true", "false", "null", "undefined"].includes(baseName)) { if (!variables.includes(baseName)) { variables.push(baseName); } } }); } return variables; } }; var ConditionalManager = class { /** * Initializes a new instance of the ConditionalManager class. * * @constructor * @param {Object} dom - The root DOM element or DOM-related utilities. * @param {Object} model - The data model containing state (for example, `store` or `data`). */ constructor(dom, model) { Logger.DEBUG_LEVEL = model.options.debug ? 4 : 0; Logger.debug("ConditionalManager: Init ConditionalManager"); this.dom = dom; this.model = model; this.dependencies = /* @__PURE__ */ new Map(); this.conditionalGroups = []; this.subscribe(); Logger.debug("ConditionalManager: ConditionalManager initialized"); } /** * Subscribes to the model's store 'change' event to automatically update * affected conditional groups when data changes. * - Listens for store changes * - Identifies affected groups using getGroupsByPath * - Triggers updates for affected conditional groups * * @method subscribe * @private */ subscribe() { Logger.debug("ConditionalManager: Subscribe to store changes"); this.model.store.on("change", (data) => { const dependentGroups = this.getGroupsByPath(data.path); dependentGroups.forEach((group) => { this.updateConditionalGroup(group); }); }); } /** * Finds all conditional groups that depend on a specific model path. * - Uses Set to avoid duplicate groups * - Checks direct path matches and path prefix matches * - Filters groups based on their expressions * * @param {string} path - The model path to check dependencies against * @returns {Array} Array of unique conditional groups dependent on the path * @private */ getGroupsByPath(path) { if (!path) { return []; } const result = /* @__PURE__ */ new Set(); this.conditionalGroups.forEach((group) => { const hasDependency = group.some((item) => { if (!item.expression) return false; return item.expression.includes(path) || path.startsWith(this.extractBasePath(item.expression)); }); if (hasDependency) { result.add(group); } }); return Array.from(result); } /** * Extracts the base path from an expression using regex pattern matching. * - Matches valid JavaScript variable names * - Returns the first match or empty string * - Valid names start with letter/underscore followed by alphanumeric/underscore * * @param {string} expression - Expression to analyze * @returns {string} First valid variable name or empty string * @private */ extractBasePath(expression) { const matches2 = expression.match(/[a-zA-Z_][a-zA-Z0-9_]*/g); return matches2 ? matches2[0] : ""; } /** * Parses and creates a map of conditional elements (`data-if`, `data-else-if`, and `data-else`) * within the given `rootElement`. Groups related conditional elements and attach * them to the `conditionalGroups` property for dynamic evaluation. * * This method identifies `data-if`, `data-else-if`, and `data-else` attributes in the DOM and * ensures their relationships are correctly established (for example, ensuring `data-else` elements have * preceding `data-if` or `data-else-if` elements). It also handles invalid sequences of attributes * and logs warnings for cases where a `data-else` doesn't follow valid prerequisites. * * After parsing and grouping, conditional groups are evaluated, and their dependencies * are registered for reactive re-evaluation when relevant model paths change. * * @method parseConditionals * @param {Element} rootElement - The root DOM element to scan for conditional attributes. * @public */ parseConditionals(rootElement) { Logger.debug("ConditionalManager: Parse conditionals (data-if, data-else-if, data-else)..."); const nodes = rootElement.querySelectorAll("[data-if],[data-else-if],[data-else]"); let currentGroup = []; const groups = []; nodes.forEach((node) => { if (node.hasAttribute("data-if")) { Logger.debug(`ConditionalManager: Found data-if in element:`, node); if (currentGroup.length) { groups.push(currentGroup); } currentGroup = [{ element: node, type: "if", expression: node.getAttribute("data-if") }]; } else if (node.hasAttribute("data-else-if")) { Logger.debug(`ConditionalManager: Found data-else-if in element:`, node); if (currentGroup.length && this.isAdjacentNode(currentGroup[currentGroup.length - 1].element, node)) { currentGroup.push({ element: node, type: "else-if", expression: node.getAttribute("data-else-if") }); } else { if (currentGroup.length) { groups.push(currentGroup); } currentGroup = [{ element: node, type: "if", expression: node.getAttribute("data-else-if") }]; } } else if (node.hasAttribute("data-else")) { Logger.debug(`ConditionalManager: Found data-else in element:`, node); if (currentGroup.length && this.isAdjacentNode(currentGroup[currentGroup.length - 1].element, node)) { currentGroup.push({ element: node, type: "else", expression: null }); groups.push(currentGroup); currentGroup = []; } else { Logger.warn("data-else without previous data-if or data-else-if", node); } } }); if (currentGroup.length) { groups.push(currentGroup); } this.conditionalGroups = groups; groups.forEach((group) => this.updateConditionalGroup(group)); this.setupDependencies(nodes); } /** * Checks if two DOM nodes are adjacent siblings, ignoring whitespace nodes. * * This method iterates over the sibling nodes of `node1` until it encounters * either `node2` (indicating adjacency) or another element node that is not * a whitespace text node (indicating they are not adjacent). * * @param {Node} node1 - The first DOM node. * @param {Node} node2 - The second DOM node to check adjacency with. * @returns {boolean} `true` if `node2` is an adjacent sibling of `node1`, ignoring whitespace; otherwise `false`. * @private */ isAdjacentNode(node1, node2) { let current = node1.nextSibling; while (current) { if (current === node2) return true; if (current.nodeType === 1 && !this.isWhitespaceNode(current)) return false; current = current.nextSibling; } return false; } /** * Determines if a given DOM node is a whitespace text node. * * A whitespace text node is a text node (nodeType === 3) * whose content consists only of whitespace characters (spaces, tabs, newlines). * * @param {Node} node - The DOM node to check. * @returns {boolean} `true` if the node is a whitespace text node; otherwise `false`. * @private */ isWhitespaceNode(node) { return node.nodeType === 3 && node.textContent.trim() === ""; } /** * Evaluates and updates the visibility of elements within a group of conditionals. * * A group represents a logical chain of `data-if`, `data-else-if`, and `data-else` elements. * This method determines the first condition in the group that evaluates to `true` * and sets the corresponding element to be displayed while hiding others. * * @param {Array} group - An array representing a logical group of conditionals. * Each object in the array contains: * - {HTMLElement} element: The DOM element. * - {string} type: The type of conditional ('if', 'else-if', 'else'). * - {string|null} expression: The conditional expression, null for 'else'. */ updateConditionalGroup(group) { const context = this.model && this.model.store ? { ...this.model.store.getState() } : this.model && this.model.data ? this.model.data : {}; let conditionMet = false; for (const item of group) { if (item.type === "if" || item.type === "else-if") { const result = !conditionMet && ExpressionManager.evaluateExpression(item.expression, context); if (result) { item.element.style.display = ""; conditionMet = true; } else { item.element.style.display = "none"; } } else if (item.type === "else") { item.element.style.display = conditionMet ? "none" : ""; } } } /** * Updates the visibility of DOM elements based on conditional expressions. * * This method processes groups of elements with `data-if`, `data-else-if`, and `data-else` attributes, * updating their visibility based on the evaluation of corresponding expressions. * * It also sets up dependencies between variables used in the expressions and their corresponding DOM elements, * allowing for dynamic updates when the context or variables change. * * This functionality is used to implement conditional rendering in the DOM. * * @param {HTMLElement} element - The DOM element to update. * @param {string} expression - The conditional expression to evaluate. * Nodes are expected to contain attributes like `data-if`, `data-else-if`, or `data-else`. */ updateConditional(element2, expression) { const group = this.findGroupForElement(element2); if (group) { this.updateConditionalGroup(group); } else { const context = this.model && this.model.store ? { ...this.model.store.getState() } : this.model && this.model.data ? this.model.data : {}; const result = ExpressionManager.evaluateExpression(expression, context); element2.style.display = result ? "" : "none"; } } /** * Finds and returns the group of conditional elements that contains the specified element. * * This method searches through the existing groups of conditional elements to determine * the group where the given element belongs. Each group represents a logical chain of * `data-if`, `data-else-if`, and `data-else` elements. * * @param {Element} element - The DOM element to find the group for. * @returns {Array|null} The group containing the specified element, or `null` if not found. * Each group object comprises: * - {Element} element: The DOM element. * - {string} type: The type of conditional ('if', 'else-if', 'else'). * - {string|null} expression: The conditional expression, null for 'else'. */ findGroupForElement(element2) { for (const group of this.conditionalGroups || []) { if (group.some((item) => item.element === element2)) { return group; } } return null; } /** * Sets up and configures the dependencies for the provided DOM nodes. * * This method scans through the given list of nodes and determines * which variables are referenced in their conditional expressions (`data-if`, `data-else-if`). * It maps these variables to the corresponding DOM elements, building a dependency tree * that allows tracking of changes and their impact on the visibility of elements. * * @param {NodeList|Array} nodes - The list of DOM elements to process. */ setupDependencies(nodes) { this.dependencies = /* @__PURE__ */ new Map(); nodes.forEach((element2) => { let expression; if (element2.hasAttribute("data-if")) { expression = element2.getAttribute("data-if"); } else if (element2.hasAttribute("data-else-if")) { expression = element2.getAttribute("data-else-if"); } else { return; } const variables = ExpressionManager.extractVariables(expression); variables.forEach((variable) => { if (!this.dependencies.has(variable)) { this.dependencies.set(variable, []); } this.dependencies.get(variable).push({ element: element2, expression, type: element2.hasAttribute("data-if") ? "if" : "else-if" }); }); }); } /** * Retrieves all dependencies related to a specific path. * * This method scans through the dependency map and collects all elements and their details * that are associated with the given path. It also includes dependencies that match the base * path and/or any sub-paths (for example, 'path' and 'path.sub'). * * @param {string} path - The path of the dependency to look for. * @returns {Array} An array of dependency objects containing: * - {Element} element: The DOM element associated with the dependency. * - {string} expression: The original conditional expression linked to the dependency. * - {string} type: The type of the conditional ('if' or 'else-if'). */ getDependenciesByPath(path) { const result = []; this.dependencies.forEach((deps, variable) => { if (variable === path || path.startsWith(variable + ".")) { result.push(...deps); } }); return result; } /** * Cleans up the instance by clearing dependencies and resetting conditional groups. * * This method should be called to release resources and avoid memory leaks when * the instance of the class is no longer required. */ destroy() { this.dependencies.clear(); this.conditionalGroups = []; Logger.debug("ConditionalManager: Destroyed"); } }; var AttributeManager = class { constructor(dom, model) { this.domManager = dom; this.model = model; Logger.DEBUG_LEVEL = this.model.options.debug ? 4 : 0; Logger.debug("AttributeManager: Init AttributeManager"); } /** * Parses the attributes of elements with 'data-bind' attribute within the root element. * - Searches for elements with data-bind attribute * - Parses JSON binding expressions (converts single quotes to double quotes) * - Extracts variables from expressions * - Registers DOM dependencies for each variable * - Initializes attribute values * * @param {HTMLElement} rootElement - The root element containing elements with data bindings. * @throws {Error} When binding expression parsing fails */ parseAttributesBind(rootElement) { Logger.debug("AttributeManager: Parsing attributes bind with data-bind..."); const elements = rootElement.querySelectorAll("[data-bind]"); Logger.debug("AttributeManager: Found elements with data-bind:", elements.length); elements.forEach((element2) => { Logger.debug("AttributeManager: Parsing element with data-bind:", element2); const bindingExpression = element2.getAttribute("data-bind"); try { const bindings = JSON.parse(bindingExpression.replace(/'/g, '"')); for (const [attributeName, expression] of Object.entries(bindings)) { const variables = ExpressionManager.extractVariables(expression); Logger.debug(`AttributeManager: Found variables for ${attributeName}:`, variables); variables.forEach((variable) => { this.domManager.registerDomDependency(variable, element2, { type: "attribute", attribute: attributeName, expression }); }); this.updateAttributes(element2, attributeName, expression); } } catch (error) { console.error("An error of analysis of attachments:", error); } }); } /** * Updates a DOM element's attribute based on a provided expression. * Evaluates the expression using the current state of the application model, and * updates the attribute only if its value has changed. * * - If the expression represents a falsy value (false, null, undefined), the attribute is removed. * - If the value is `true`, the attribute is added without a value (""). * - Otherwise, the attribute is set to the string field value of the evaluated expression. * * @param {HTMLElement} element - The DOM element whose attribute needs to be updated. * @param {string} attributeName - The name of the attribute to be updated. * @param {string} expression - The expression to be evaluated to determine the attribute's value. * * Special cases: * - Handles template expressions in format {{expression}} * - Direct model path access for template expressions * - Expression evaluation for non-template strings * */ updateAttributes(element2, attributeName, expression) { const context = { ...this.model.store.getState() }; let value; if (expression.startsWith("{{") && expression.endsWith("}}")) { const path = expression.substring(2, expression.length - 2).trim(); value = this.model.store.get(path); } else { value = ExpressionManager.evaluateExpression(expression, context); } const previousValue = element2.getAttribute(attributeName); if (String(value) !== previousValue) { if (value === false || value === null || value === void 0) { element2.removeAttribute(attributeName); } else if (value === true) { element2.setAttribute(attributeName, ""); } else { element2.setAttribute(attributeName, String(value)); } Logger.debug(`AttributeManager: Updated attribute ${attributeName} with value:`, value); } } /** * Parses and processes attribute bindings in the provided root DOM element. * Attributes prefixed with a colon (for example, `:class`) * are treated as dynamic bindings. * * For each dynamically bound attribute: * - Updates the attribute value on the element based on the * current model store state. * - Registers a dependency between the element and the attribute * expression in the DOM dependency tracker. * - Removes the colon-prefixed attribute from the DOM. * * @param {HTMLElement} rootElement - The root element to search * for attribute bindings. */ parseAttributes(rootElement) { Logger.debug("AttributeManager: Parsing attributes with colon..."); const allElements = rootElement.querySelectorAll("*"); for (const element2 of allElements) { const attributes = element2.attributes; for (let i3 = 0; i3 < attributes.length; i3++) { const attr = attributes[i3]; if (attr.name.startsWith(":")) { Logger.debug(`AttributeManager: Found attribute:`, attr); const realAttrName = attr.name.substring(1); const expression = attr.value; this.updateElementAttribute(element2, realAttrName, expression); this.domManager.registerDomDependency(expression, element2, { type: "attribute", attribute: realAttrName, expression }); element2.removeAttribute(attr.name); } } } } /** * Updates the value of a DOM element's attribute based on the current * state of the model store. * * Dynamically handles specific attributes like `class`, `disabled`, * `checked`, `selected`, and `readonly` to ensure they're properly assigned * for Boolean or string values. For other attributes, it assigns the value * directly. * * If the value for the given expression can't be resolved from the model store, * a warning is logged to the console. * * @param {HTMLElement} element - The DOM element whose attribute is being updated. * @param {string} attribute - The name of the attribute to update. * @param {string} expression - The model store expression to retrieve the value. */ updateElementAttribute(element2, attribute, expression) { const value = "" + this.model.store.get(expression); if (value === void 0 || value === "undefined") { return; } Logger.debug(`AttributeManager: Updating attribute ${attribute} with ${value}`); if (attribute === "class") { element2.className = value; } else if (attribute === "disabled" || attribute === "checked" || attribute === "selected" || attribute === "readonly") { if (value) { element2.setAttribute(attribute, ""); } else { element2.removeAttribute(attribute); } } else { element2.setAttribute(attribute, value); } } update(element2, attribute, expression) { Logger.debug(`AttributeManager: Updating element:`, element2); Logger.debug(` Attribute: ${attribute} for:`, expression); this.updateAttributes(element2, attribute, expression); this.updateElementAttribute(element2, attribute, expression); } }; var EventManager = class { /** * Creates a copy of the event manager * @param {Object} domManager - DOM manager for working with DOM elements * @param {Object} model - Data model that will be used as a context in events */ constructor(domManager, model) { Logger.DEBUG_LEVEL = model.options.debug ? 4 : 0; Logger.debug("EventManager: Init EventManager"); this.domManager = domManager; this.model = model; this.eventHandlers = /* @__PURE__ */ new Map(); Logger.debug("EventManager: EventManager initialized"); } /** * Analyzes DOM-Vreyevo and finds all attributes starting with @, * Registering them as events * @param {HTMLElement} rootElement - Root element for searching for events */ parseEvents(rootElement) { Logger.debug("EventManager: Parsing events with @..."); const allElements = rootElement.querySelectorAll("*"); const elements = [rootElement, ...Array.from(allElements)]; elements.forEach((element2) => { const attributes = Array.from(element2.attributes || []); attributes.forEach((attr) => { if (attr.name.startsWith("@")) { Logger.debug(`EventManager: Found attribute with "@" ${attr.name} in`, element2); const eventName = attr.name.substring(1); const handler = attr.value.trim(); this.bindEventHandler(element2, eventName, handler); element2.removeAttribute(attr.name); } }); }); } /** * Binds the event handler to the DOM element * @param {HTMLElement} element - DOM element * @param {string} eventName - Event name (without @) * @param {string} handlerExpression - Line with an event processor */ bindEventHandler(element2, eventName, handlerExpression) { Logger.debug(`EventManager: Binding event handler with expression ${handlerExpression} for ${eventName} on`, element2); const eventHandler = (event) => { try { const context = { $model: this.model, $event: event, $data: this.model.data, $dom: this.domManager }; const methodMatch = handlerExpression.match(/(\w+)\((.*)\)/); if (methodMatch) { const methodName = methodMatch[1]; const paramsString = methodMatch[2]; const resolveMethod = (path, context2) => { return path.split(".").reduce((obj, key) => obj && obj[key] !== void 0 ? obj[key] : void 0, context2); }; let method = resolveMethod(methodName, this.model); if (!method) { method = resolveMethod(methodName, window); } if (typeof method === "function") { let params = []; if (paramsString.trim()) { params = paramsString.split(",").map((param) => { param = param.trim(); if (param.startsWith('"') && param.endsWith('"') || param.startsWith("'") && param.endsWith("'")) { return param.slice(1, -1); } if (!isNaN(param)) { return Number(param); } if (param === "$event") { Logger.debug(`EventManager: Requested Event`, event); return event; } if (param === "$model") { Logger.debug(`EventManager: Requested Model`, this.model); return this.model; } if (param === "$data") { Logger.debug(`EventManager: Requested Model Context`, this.model.data); return this.model.data; } if (param === "$dom") { Logger.debug(`EventManager: Requested DOMManager`, this.domManager); return this.domManager; } return this.model.store.get(param); }); } method.apply(context, params); } else { console.warn(`EventManager: The method '${methodName}' not found in a model or global space!`); } } else { if (this.model.options.useSimpleExpressions) { const result = new Function(`return ${handlerExpression}`); result.apply(this.model.data); } else { console.warn(`EventManager: Unknown format of the event handler: '${handlerExpression}'`); } } } catch (error) { console.error(`EventManager: Error when performing an event processor '${eventName}': ${error.message}`); } }; if (!this.eventHandlers.has(element2)) { this.eventHandlers.set(element2, /* @__PURE__ */ new Map()); } const elementHandlers = this.eventHandlers.get(element2); if (elementHandlers.has(eventName)) { element2.removeEventListener(eventName, elementHandlers.get(eventName)); } elementHandlers.set(eventName, eventHandler); element2.addEventListener(eventName, eventHandler); } /** * Removes the event processor from the DOM element * @param {HTMLElement} element - DOM element * @param {string} eventName - Event name (without @) */ removeEventHandler(element2, eventName) { Logger.debug(`EventManager: Removing event handler for ${eventName} on`, element2); if (this.eventHandlers.has(element2)) { const elementHandlers = this.eventHandlers.get(element2); if (elementHandlers.has(eventName)) { const handler = elementHandlers.get(eventName); element2.removeEventListener(eventName, handler); elementHandlers.delete(eventName); if (elementHandlers.size === 0) { this.eventHandlers.delete(element2); } } } } /** * Updates events for the element * @param {HTMLElement} element - DOM element for updating */ updateEvents(element2) { Logger.debug("EventManager: Updating events for", element2); Array.from(element2.attributes || []).forEach((attr) => { if (attr.name.startsWith("@")) { const eventName = attr.name.substring(1); const handler = attr.value.trim(); this.bindEventHandler(element2, eventName, handler); element2.removeAttribute(attr.name); } }); } /** * Releases all resources and removes all events */ destroy() { Logger.debug("EventManager: Destroying EventManager"); this.eventHandlers.forEach((handlers, element2) => { handlers.forEach((handler, eventName) => { Logger.debug(`EventManager: Removing event handler for ${eventName} on`, element2); element2.removeEventListener(eventName, handler); }); }); this.eventHandlers.clear(); Logger.debug("EventManager: Destroyed"); } }; var DOMManager = class { /** * Creates an instance of the DOMManager class, initializing necessary properties and dependencies * for managing the DOM in relation to the model. Sets up managers for loops, conditionals, and attributes, * and prepares structures for DOM dependencies and virtual DOM. * * @param {Object} model - The model that serves as the data source for the DOMManager. * It is used for data binding and template rendering in the DOM. */ constructor(model) { Logger.DEBUG_LEVEL = model.options.debug ? 4 : 0; Logger.debug("DOMManager: Init DOMManager"); this.model = model; this.elements = []; this.inputs = []; this.domDependencies = /* @__PURE__ */ new Map(); this.virtualDom = /* @__PURE__ */ new Map(); this.loopManager = new LoopManager(this, model); this.conditionalManager = new ConditionalManager(this, model); this.attributeManager = new AttributeManager(this, model); this.eventManager = new EventManager(this, model); Logger.debug("DOMManager: DOMManager initialized"); } /** * Registers a dependency between a model property path and a DOM element. * - Creates a new Set for the property path if it doesn't exist * - Adds element and additional info to the dependency set * - Supports multiple elements depending on the same property * * @param {string} propertyPath - Model property path to watch * @param {HTMLElement} domElement - DOM element to update * @param {Object} info - Additional dependency metadata */ registerDomDependency(propertyPath, domElement, info3) { if (!this.domDependencies.has(propertyPath)) { this.domDependencies.set(propertyPath, /* @__PURE__ */ new Set()); } this.domDependencies.get(propertyPath).add({ element: domElement, ...info3 }); } /** * Recursively processes template nodes and replaces placeholders with values. * - Handles text nodes: replaces {{expression}} with actual values * - For text nodes: compares original and new content to avoid unnecessary updates * - For element nodes: recursively processes all child nodes * - Supports both context values and model store values * * @param {Node} node - DOM node to process * @param {Object} context - Optional context data for placeholder replacement */ processTemplateNode(node, context) { Logger.debug("DOMManager: processTemplateNode", { node, context }); if (node.nodeType === Node.TEXT_NODE) { const originalText = node.textContent; const newText = node.textContent.replace(/\{\{\s*([^}]+)\s*\}\}/g, (match, path) => { path = path.trim(); const getValueByPath = (obj, path2) => { return path2.split(".").reduce((value2, key) => { return value2 ? value2[key] : void 0; }, obj); }; let value = context ? getValueByPath(context, path) : void 0; if (value === void 0) { value = this.model.store.get(path); } return value !== void 0 ? value : ""; }); if (originalText !== newText) { Logger.debug(`DOMManager: updated node text from ${originalText} to ${newText}`); node.textContent = newText; } } else if (node.nodeType === Node.ELEMENT_NODE) { Array.from(node.childNodes).forEach((child) => { this.processTemplateNode(child, context); }); } } /** * Parses DOM tree for template placeholders and sets up reactive bindings. * - Uses TreeWalker to efficiently traverse text nodes * - Detects template expressions using regex pattern * - Registers dependencies for each found template expression * - Preserves original template text for future updates * - Handles regex state reset between matches * * @param {HTMLElement} root - Starting point for DOM traversal */ parse(root) { Logger.debug("DOMManager: parse from", root); const walker = document.createTreeWalker( root, NodeFilter.SHOW_TEXT, null ); let node; const regex = /\{\{\s*([^}]+)\s*\}\}/g; while (node = walker.nextNode()) { let match; const text = node.textContent; const originalText = text; regex.lastIndex = 0; while ((match = regex.exec(text)) !== null) { Logger.debug(`DOMManager: parse match found for ${text}`, match); const propPath = match[1].trim(); this.registerDomDependency(propPath, node, { type: "template", template: originalText }); this.elements.push({ node, propName: propPath, template: originalText }); } Logger.debug(`DOMManager: update virtual DOM set`, { node, text: node.textContent }); this.virtualDom.set(node, node.textContent); } Logger.debug("DOMManager: Find inputs with data-model directive..."); const inputs = root.querySelectorAll("[data-model]"); Logger.debug("DOMManager: Found inputs with data-model:", inputs.length); inputs.forEach((input) => { const property = input.getAttribute("data-model"); Logger.debug("DOMManager: Register handler for:", { input, property }); const handler = (e2) => { const value = input.type === "checkbox" || input.type === "radio" ? e2.target.checked : e2.target.value; this.model.store.set(property, value); }; input.__modelInputHandler = handler; input.addEventListener("input", handler); this.inputs.push({ element: input, property }); }); } /** * Sets the value of the input element based on the provided value. * For checkboxes and radio buttons, it sets the `checked` property. * For other input types, it sets the `value` property. * * @param {HTMLInputElement} input - The input element to update. * @param {*} value - The value to set for the input. For checkboxes and radio buttons, it should be a boolean. */ setInputValue(input, value) { if (input.type === "checkbox" || input.type === "radio") { input.checked = Boolean(value); } else { input.value = value; } } /** * Updates all input elements associated with the specified property with the provided value. * It ensures that the value in the DOM accurately reflects the value in the model. * * @param {string} propName - The name of the property whose value should be updated in the inputs. * @param {*} value - The value to set for the associated inputs. */ updateInputs(propName, value) { Logger.debug("DOMManager: updateInputs", { propName, value }); this.inputs.forEach((item) => { if (item.property === propName) { Logger.debug("DOMManager: update input", { item, value }); this.setInputValue(item.element, value); } }); } /** * Updates all DOM elements based on the current state of the model. * This includes: * - Text nodes containing template placeholders. * - Input elements bound using `data-model` attributes. * * Iterates through registered nodes and inputs, updating their content * or values to reflect the latest model state. * * Ensures that the UI remains synchronized with the underlying model. */ updateAllDOM() { Logger.debug("DOMManager: updateAllDOM"); this.elements.forEach((element2) => { let newContent = element2.template; newContent = newContent.replace(/\{\{\s*([^}]+)\s*\}\}/g, (match, path) => { path = path.trim(); return this.model.store.get(path); }); element2.node.textContent = newContent; Logger.debug(`DOMManager: updated node`, { element: element2, newContent }); }); Logger.debug("DOMManager: update inputs"); this.inputs.forEach((item) => { Logger.debug("DOMManager: update input", { item }); const value = this.model.store.get(item.property); this.setInputValue(item.element, value); Logger.debug("DOMManager: updated input", { item, value }); }); } /** * Updates the DOM elements or attributes whenever a property in the model changes. * It resolves what elements depending on the property should be updated, * including templates, conditionals, loops, and attributes. * * @param {string} propertyPath - Path of the property in the model that triggered the change. * @param {*} value - New value of the property (could be a primitive, object, or array). */ updateDOM(propertyPath, value) { Logger.debug(`DOMManager: update DOM for ${propertyPath} with ${value}`); if (!propertyPath) { console.warn("Path is undefined in updateDOM"); return; } const isArrayMethodChange = value && typeof value === "object" && "method" in value; if (isArrayMethodChange) { propertyPath = value.path || propertyPath; } const elementsToUpdate = /* @__PURE__ */ new Set(); if (this.domDependencies.has(propertyPath)) { this.domDependencies.get(propertyPath).forEach( (dep) => elementsToUpdate.add(dep) ); } const pathParts = propertyPath.split("."); let currentPath = ""; for (let i3 = 0; i3 < pathParts.length; i3++) { currentPath = currentPath ? `${currentPath}.${pathParts[i3]}` : pathParts[i3]; if (this.domDependencies.has(currentPath)) { this.domDependencies.get(currentPath).forEach( (dep) => elementsToUpdate.add(dep) ); } } const conditionalElements = this.conditionalManager.getDependenciesByPath(propertyPath); conditionalElements.forEach((dep) => { if (dep.type === "if") { this.conditionalManager.updateConditional(dep.element, dep.expression); } }); this.domDependencies.forEach((deps, path) => { if (path.startsWith(`${propertyPath}.`) || path.startsWith(`${propertyPath}[`)) { deps.forEach((dep) => elementsToUpdate.add(dep)); } }); if (Array.isArray(value) || isArrayMethodChange || typeof value === "object") { this.loopManager.updateLoops(propertyPath, value); } if (elementsToUpdate.size === 0) return; const updates = { template: [], conditional: [], loop: [], attribute: [] }; elementsToUpdate.forEach((dep) => { if (dep && dep.type) { updates[dep.type].push(dep); } }); updates.template.forEach((dep) => this.updateTemplateNode(dep.element, dep.template)); updates.conditional.forEach((dep) => this.conditionalManager.updateConditional(dep.element, dep.expression)); updates.attribute.forEach((dep) => this.attributeManager.update(dep.element, dep.attribute, dep.expression)); updates.loop.forEach((dep) => this.loopManager.updateLoopPart(dep.element, dep.arrayPath, value, dep.index)); } /** * Updates a template-based DOM node's content with the latest values * from the model store. * * This method uses a Mustache-like syntax (for example, `{{propertyName}}`) * to replace placeholders in the template with actual values retrieved * from the model store. If the content changes compared to the virtual DOM, * the DOM node is updated, and the new content is recorded in the virtual DOM. * * @param {HTMLElement} node - The DOM node to update. * @param {string} template - The template string containing placeholders * for dynamic values. */ updateTemplateNode(node, template) { const newContent = template.replace(/\{\{\s*([^}]+)\s*\}\}/g, (match, path) => { path = path.trim(); return this.model.store.get(path); }); if (this.virtualDom.get(node) !== newContent) { node.textContent = newContent; this.virtualDom.set(node, newContent); } } /** * Checks whether the given pathA is a dependency of pathB. * * A path is considered a dependency if: * - It is identical to the other path. * - It is a hierarchical descendent of the other path (for example, pathB starts with pathA). * - It is an array element of the other path (for example, pathB starts with pathA followed by an array index). * * @param {string} pathA - The base path to check against. * @param {string} pathB - The path to verify as a dependency. * @returns {boolean} - Returns `true` if pathB is a dependency of pathA, otherwise `false`. */ isPathDependency(pathA, pathB) { return pathB === pathA || pathB.startsWith(`${pathA}.`) || pathB.startsWith(`${pathA}[`); } /** * Retrieves all paths from the DOM dependency tracker that are * dependent on the given path. A path is considered dependent if: * - It is hierarchically related (for example, a path starts with the given path). * - It matches exactly with the given path. * * This method collects and returns all such dependent paths. * * @param {string} path - The path for which to find dependent paths. * @returns {string[]} - An array of dependent paths. */ getDependentPaths(path) { const dependentPaths = []; this.domDependencies.forEach((_5, depPath) => { if (this.isPathDependency(path, depPath)) { dependentPaths.push(depPath); } }); return dependentPaths; } /** * Binds and processes the DOM for data binding, conditional rendering, * loops, and attribute updates. This method integrates the different * managers and processes involved in setting up the live DOM bindings. * * Steps performed: * 1. Parses loops within the DOM using the loop manager. * 2. Parses conditional elements using the conditional manager. * 3. Parses standard attributes using the attribute manager. * 4. Processes custom attribute bindings (colon-prefixed attributes). * 5. Parses any additional elements or bindings. * 6. Updates the DOM to reflect the current state of the model. * * @param {HTMLElement} rootElement - The root element to initiate the DOM binding process. */ bindDOM(rootElement) { Logger.debug("DOMManager: bind DOM from", rootElement); this.loopManager.parseLoops(rootElement); this.conditionalManager.parseConditionals(rootElement); this.attributeManager.parseAttributesBind(rootElement); this.attributeManager.parseAttributes(rootElement); this.eventManager.parseEvents(rootElement); this.parse(rootElement); this.updateAllDOM(); Logger.debug("DOMManager: binding completed"); } /** * Destroys the instance by performing cleanup tasks. * * This method removes event listeners from input elements, clears out * internal data structures like `elements`, `inputs`, `domDependencies`, * and `virtualDom`, and calls the `destroy` methods of `loopManager` and * `conditionalManager`. It is intended to completely clean up the instance * and free resources to avoid memory leaks. */ destroy() { this.inputs.forEach(({ element: element2 }) => { if (element2.__modelInputHandler) { element2.removeEventListener("input", element2.__modelInputHandler); delete element2.__modelInputHandler; } }); this.elements = []; this.inputs = []; this.domDependencies.clear(); this.virtualDom.clear(); this.loopManager.destroy(); this.conditionalManager.destroy(); this.eventManager.destroy(); Logger.debug("DOMManager: destroyed"); } }; var ComputedProps = class { constructor(model, computed = {}) { Logger.DEBUG_LEVEL = model.options.debug ? 4 : 0; Logger.debug("Model: Init ComputedProps:", computed); this.model = model; this.computed = computed; this.store = model.store; this.asyncCache = /* @__PURE__ */ new Map(); this.init().then(() => { Object.getOwnPropertyNames(this.computed).forEach((prop) => { if (typeof this.computed[prop]["getter"] === "function") { try { const value = this.computed[prop]["getter"].call(this.store.getState()); Logger.debug(`Initializing computed property ${prop}:`, value); } catch (e2) { console.error(`Error initializing computed property ${prop}:`, e2); } } }); Logger.debug("Model: ComputedProps initialized"); }); } /** * Sets up computed properties in the model. * - Performs initial evaluation of all computed properties * - Defines getter proxies on model.data * - Makes computed properties enumerable and configurable * - Ensures reactive updates through getter access * * @method init */ async init() { const initPromises = []; for (const key in this.computed) { const valuePromise = this.evaluate(key); initPromises.push(valuePromise); Object.defineProperty(this.model.data, key, { get: () => { const computed = this.computed[key]; return computed.isAsync ? this.asyncCache.get(key) : computed.value; }, enumerable: true, configurable: true }); } await Promise.all(initPromises); for (const key in this.computed) { const value = this.computed[key].isAsync ? this.asyncCache.get(key) : this.computed[key].value; this.model.dom.updateDOM(key, value); this.model.dom.updateInputs(key, value); } return true; } /** * Evaluates computed property and tracks its dependencies. * - Creates proxy for dependency tracking * - Handles nested object dependencies * - Records all accessed properties during evaluation * - Emits computation events with results * - Supports forced re-evaluation * * @method evaluate * @param {string} key - Computed property name * @param {boolean} [force=false] - Force re-evaluation flag * @returns {*} New computed value * @emits compute */ async evaluate(key, force = false) { const computed = this.computed[key]; const dependencies = /* @__PURE__ */ new Set(); const dataTracker = new Proxy(this.store.getState(), { get: (target, prop) => { dependencies.add(prop); let value = target[prop]; if (value && typeof value === "object") { return new Proxy(value, { get: (obj, nestedProp) => { dependencies.add(`${prop}.${nestedProp}`); return obj[nestedProp]; } }); } return value; } }); const isAsync = computed.getter.constructor.name === "AsyncFunction"; computed.isAsync = isAsync; try { const result = await computed.getter.call(dataTracker); computed.dependencies = [...dependencies]; if (isAsync) { this.asyncCache.set(key, result); } else { computed.value = result; } this.store.emit("compute", { key, value: result, dependencies, isAsync }); return result; } catch (error) { console.error(`Error evaluating computed property "${key}":`, error); throw error; } } /** * Updates computed properties affected by model changes. * Checks three types of dependencies: * - Direct property matches * - Nested property changes (parent changed) * - Parent property changes (child changed) * Re-evaluates affected computed properties * * @method update * @param {string} changedProp - Changed property path */ async update(changedProp) { const updatePromises = []; for (const key in this.computed) { const updatePromise = (async () => { const newValue = await this.evaluate(key); this.model.dom.updateDOM(key, newValue); this.model.dom.updateInputs(key, newValue); })(); updatePromises.push(updatePromise); } await Promise.all(updatePromises); } /** * @method all * @description Retrieves all computed properties and their current values. * Converts the `computed` object into a plain object, mapping each computed * property's name to its current value. * * @returns {Object} An object containing all computed property names and their values. */ all() { return Object.fromEntries( Object.entries(this.computed).map(([key, comp]) => [key, comp.value]) ); } }; var StateManager = class _StateManager extends event_emitter_default { /** * Creates a new StateManager instance. * @param {Object} store - The store object to manage state for. * @param {Object} [options={}] - Configuration options for the StateManager. * @param {string} [options.id="model"] - Unique identifier for the state in localStorage. */ constructor(store, options = {}) { Logger.DEBUG_LEVEL = store.model.options.debug ? 4 : 0; Logger.debug("Init StateManager:", options); super(); this.store = store; this.options = Object.assign({ id: "model" }, options); Logger.debug("StateManager initialized"); } /** * Checks if localStorage is available. * @returns {boolean} */ static isStorageAvailable() { try { const test = "__test__"; localStorage.setItem(test, test); localStorage.removeItem(test); return true; } catch (e2) { return false; } } /** * Saves the current state to localStorage. * @returns {{data: any, timestamp: number}|null} */ saveState() { if (!_StateManager.isStorageAvailable()) { console.warn("localStorage is not available"); return null; } const dataToSave = JSON.parse(JSON.stringify(this.store.getState())); const state2 = { data: dataToSave, timestamp: Date.now() }; try { localStorage.setItem(this.options.id, JSON.stringify(state2)); this.emit("saveState", state2); return state2; } catch (error) { console.error("Error saving state:", error); this.emit("saveStateError", error); return null; } } /** * Restores the state from localStorage. * @returns {any|null} */ restoreState() { if (!_StateManager.isStorageAvailable()) { console.warn("localStorage is not available"); return null; } try { const savedState = localStorage.getItem(this.options.id); if (savedState) { const parsed = JSON.parse(savedState); Object.assign(this.store.state, parsed.data); this.emit("restoreState", parsed); return parsed; } } catch (error) { this.emit("restoreStateError", error); } } /** * Creates a snapshot of the current state. * @returns {{data: any, timestamp: number}|null} */ createSnapshot() { if (!_StateManager.isStorageAvailable()) { console.warn("localStorage is not available"); return null; } const dataToSave = JSON.parse(JSON.stringify(this.store.getState())); const snapshot = { data: dataToSave, timestamp: Date.now() }; this.emit("createSnapshot", snapshot); return snapshot; } /** * Restores the state from a snapshot. * @param snapshot * @returns {*|null} */ restoreSnapshot(snapshot) { if (!_StateManager.isStorageAvailable()) { console.warn("localStorage is not available"); return null; } if (snapshot) { Object.assign(this.store.state, snapshot.data); this.emit("restoreSnapshot", snapshot); return snapshot; } return null; } /** * Enables automatic state-saving at a specified interval. * @param interval */ enableAutoSave(interval = 5e3) { this.autoSaveInterval = setInterval(() => { this.saveState(); }, interval); } /** * Disables automatic state-saving. */ disableAutoSave() { clearInterval(this.autoSaveInterval); } }; var ModelOptions = { id: "model", useSimpleExpressions: true, debug: false, plugins: [], validators: [], formatters: [] }; var Model2 = class extends event_emitter_default { /** * Creates a new instance of the Model class. * @param {Object} [data={}] - Initial data for the model. * @param {Object} [options={}] - Configuration options for the model. */ constructor(data = {}, options = {}) { super(); this.options = { ...ModelOptions, ...options }; Logger.DEBUG_LEVEL = this.options.debug ? 4 : 0; Logger.debug("Creating a model with data:", data); Logger.debug("Configuration options:", options); this.computed = {}; for (const key in data) { if (typeof data[key] === "function") { Logger.debug(`Registration calculated property "${key}"`); this.computed[key] = { getter: data[key], value: null, dependencies: [] }; delete data[key]; } } this.store = new ReactiveStore(data, this); this.data = this.store.state; this.dom = new DOMManager(this); this.computedProps = new ComputedProps(this, this.computed); this.stateManager = new StateManager(this.store); this.plugins = /* @__PURE__ */ new Map(); if (this.options.plugins) { for (const p5 of this.options.plugins) { const { name: name2, plugin, options: options2 } = p5; if (name2 && plugin && typeof plugin === "function") { this.registerPlugin(name2, plugin, options2); } } } if (this.options.validators) { for (const p5 of this.options.validators) { const { path, validator } = p5; if (path && validator && typeof validator === "function") { this.addValidator(path, validator); } } } if (this.options.formatters) { for (const p5 of this.options.formatters) { const { path, formatter } = p5; if (path && formatter && typeof formatter === "function") { this.addValidator(path, formatter); } } } this.subscribe(); Logger.debug("The model was created successfully!"); } /** * Subscribes to changes from the ReactiveStore and handles DOM updates, * input field updates, and computed properties recalculation. */ subscribe() { Logger.debug("Subscribing to store changes"); this.store.on("change", (data) => { this.dom.updateDOM(data.path, data.newValue); this.dom.updateInputs(data.path, data.newValue); this.computedProps.update(data.path).then(() => { }); this.emit("change", data); }); this.store.on("compute", (data) => this.emit("compute", data)); this.store.on("arrayChange", (data) => this.emit("arrayChange", data)); this.store.on("batchComplete", (data) => this.emit("batchComplete", data)); Logger.debug("Subscribing to state manager events"); this.stateManager.on("saveState", (data) => this.emit("saveState", data)); this.stateManager.on("saveStateError", (error) => this.emit("saveStateError", error)); this.stateManager.on("restoreState", (data) => this.emit("restoreState", data)); this.stateManager.on("restoreStateError", (error) => this.emit("restoreStateError", error)); this.stateManager.on("createSnapshot", (data) => this.emit("createSnapshot", data)); this.stateManager.on("restoreSnapshot", (data) => this.emit("restoreSnapshot", data)); } /** * Adds a validator function to a specified path. * @param {string} path - Path within the state to attach the validator. * @param {Function} validator - Validation function to execute on path changes. */ addValidator(path, validator) { this.store.addValidator(path, validator); } /** * Adds a formatter function to a specified path. * @param {string} path - Path within the state to attach the formatter. * @param {Function} formatter - Formatting function to execute on path changes. */ addFormatter(path, formatter) { this.store.addFormatter(path, formatter); } /** * Adds middleware to the ReactiveStore for intercepting and processing state changes. * @param {Function} middleware - Middleware function that receives and can modify state changes before they're applied. */ use(middleware) { this.store.use(middleware); } /** * Watches a specific path in the state and triggers a callback on changes. * @param {string} path - Path to watch. * @param {Function} callback - Callback function to execute when the path changes. */ watch(path, callback) { this.store.watch(path, callback); } /** * Executes a batch of state changes in a single update cycle. * @param callback */ batch(callback) { return this.store.batch(callback); } /** * Detects changes between two arrays and returns the differences. * @param newArray * @param oldArray * @returns {{added: [], removed: [], moved: []}} */ diffArrays(newArray, oldArray) { return this.store.detectArrayChanges(newArray, oldArray); } diff() { } /** * Validates the model for potential issues, including: * * 1. Cyclic dependencies in computed properties: Ensures that no property in the `computed` * object of the model depends on itself through a chain of other properties. * 2. Invalid paths in DOM dependencies: Ensures that all paths used in the DOM template * exist within the model's store. * * @returns {{errors: Array, warnings: Array}} - Returns an object containing arrays * of errors and warnings. Each error or warning is represented as an object with details * about the issue. * * Errors include: * - `CYCLIC_DEPENDENCY`: Indicates a cyclic dependency was found in `computed` properties. * - `property`: The property with the cyclic dependency. * - `message`: Description of the cyclic dependency. * * Warnings include: * - `INVALID_PATH`: Indicates a path used in the DOM does not exist in the model. * - `path`: The invalid path. * - `message`: Description of the invalid path. */ validate() { const errors = []; const warnings = []; for (const key in this.computed) { const visited = /* @__PURE__ */ new Set(); const cyclePath = this._checkCyclicDependencies(key, visited); if (cyclePath) { errors.push({ type: "CYCLIC_DEPENDENCY", property: key, message: `Cyclic dependence is found: ${cyclePath.join(" -> ")}` }); } } this.dom.domDependencies.forEach((deps, path) => { if (!this.store.isValidPath(path)) { warnings.push({ type: "INVALID_PATH", path, message: `Property ${path} used in the template, but does not exist in the model` }); } }); return { errors, warnings }; } /** * Checks for cyclic dependencies in the computed properties of the model. * * This method recursively traverses the dependencies of a given property to determine * if a cyclic dependency exists. A cyclic dependency occurs when a property ultimately * depends on itself through a chain of other properties. * * @param {string} key - The key of the property to check for cyclic dependencies. * @param {Set} visited - A set of visited properties during the traversal. * @param {string[]} [path=[]] - The current path of dependencies being checked. * @returns {string[]|null} - Returns an array representing the cyclic path if a cycle is found, * otherwise `null`. */ _checkCyclicDependencies(key, visited, path = []) { if (visited.has(key)) { return [...path, key]; } visited.add(key); path.push(key); const computed = this.computed[key]; if (!computed || !computed.dependencies) { return null; } for (const dep of computed.dependencies) { if (dep in this.computed) { const cyclePath = this._checkCyclicDependencies(dep, new Set(visited), [...path]); if (cyclePath) { return cyclePath; } } } return null; } /** * Validates a given path to check if it exists in the model's store. * @param path * @returns {boolean} */ validatePath(path) { return this.store.isValidPath(path); } /** * Initializes the DOM bindings for the model. * @param {string|HTMLElement} selector - Selector or root element to bind on. * @returns {Model|undefined} - Returns the model instance, or undefined if the root element is not found. */ init(selector) { Logger.debug("Initializing DOM bindings"); let rootElement = typeof selector === "string" ? document.querySelector(selector) : selector; if (!rootElement) { rootElement = document.body; } Logger.debug(`Model initialized in ${selector ?? "body"}`); Logger.debug("Binding DOM"); this.dom.bindDOM(rootElement); this.emit("init"); Logger.debug("Initialization complete!"); return this; } /** * Initializes development tools for the model. * @param {Object} [options={}] - Options for the development tools. * @returns {DevTools} - An instance of the DevTools class. */ runDevTools(options = {}) { return new dev_tools_default(this, options); } /** * Saves the current state of the model. * @returns {{data: *, timestamp: number}|null} */ save() { return this.stateManager.saveState(); } /** * Restores the model to a previously saved state. * @returns {*|null} */ restore() { return this.stateManager.restoreState(); } /** * Creates a snapshot of the current state. * @param _snapshot * @returns {*|null|{data: *, timestamp: number}} */ snapshot(_snapshot) { if (!_snapshot) { return this.stateManager.createSnapshot(); } return this.stateManager.restoreSnapshot(_snapshot); } /** * Enables or disables auto-saving of the model's state. * @param interval */ autoSave(interval) { if (!interval) { this.stateManager.disableAutoSave(); } else { this.stateManager.enableAutoSave(interval); } } /** * Registers a plugin for the model. * @param {string} name - Name of the plugin. * @param {Function} plugin - Plugin class or constructor function. * @param options * @throws {Error} If a plugin with the same name is already registered. */ registerPlugin(name2, plugin, options = {}) { if (this.plugins.has(name2)) { throw new Error(`Plugin ${name2} already registered`); } this.plugins.set(name2, new plugin(this, options)); } /** * Uses a registered plugin by name. * @param {string} name - Name of the plugin to use. * @param {Object} [options={}] - Options to pass to the plugin. * @returns {Model} - Returns the model instance to allow method chaining. */ usePlugin(name2, options = {}) { const pluginInstance = this.plugins.get(name2); if (!pluginInstance) { console.error(`Plugin ${name2} not found`); return this; } pluginInstance.run(); return this; } /** * Removes a registered plugin by name. * @param name */ removePlugin(name2) { if (this.plugins.has(name2)) { this.plugins.delete(name2); } } /** * Destroys the model instance and cleans up resources. */ destroy() { this.dom.destroy(); this.store.destroy(); this.emit("destroy"); } }; var model_default = Model2; var version3 = "0.18.1"; var build_time3 = "18.05.2025, 14:40:40"; model_default.info = () => { console.info(`%c Model %c v${version3} %c ${build_time3} `, "color: white; font-weight: bold; background: #0080fe", "color: white; background: darkgreen", "color: white; background: #0080fe;"); }; var index_default = model_default; // source/model/index.js globalThis.Model = index_default; // source/core/global.js (($7) => { "use strict"; globalThis["__version__"] = "5.1.21"; globalThis["__build_time__"] = "10.11.2025, 13:59:31"; const meta_init = $7.meta("metro:init").attr("content"); const meta_cloak = $7.meta("metro:cloak").attr("content"); const meta_cloak_duration = $7.meta("metro:cloak_duration").attr("content"); const meta_blur_image = $7.meta("metro:blur").attr("content"); const meta_smooth_scroll = $7.meta("metro:smooth").attr("content"); const meta_theme = $7.meta("metro:theme").attr("content"); const meta_info = $7.meta("metro:info").attr("content"); const meta_jquery = $7.meta("metro:jquery").attr("content"); const meta_debug = $7.meta("metro:debug").attr("content"); globalThis.METRO_INIT = meta_init ? JSON.parse(meta_init) : true; if (meta_theme !== void 0) { $7("html").addClass( meta_theme === "auto" ? $7.dark ? "dark-side" : "" : meta_theme === "dark" ? "dark-side" : "light-side" ); } globalThis.METRO_BLUR_IMAGE = meta_blur_image ? JSON.parse(meta_blur_image) : false; globalThis.jquery_present = typeof globalThis.jQuery !== "undefined"; globalThis.METRO_JQUERY = meta_jquery ? JSON.parse(meta_jquery) : true; globalThis.useJQuery = globalThis.jquery_present && globalThis.METRO_JQUERY; globalThis.METRO_SHOW_INFO = meta_info ? JSON.parse(meta_info) : false; globalThis.METRO_DEBUG = meta_debug ? JSON.parse(meta_debug) : false; globalThis.METRO_CLOAK_REMOVE = meta_cloak ? `${meta_cloak}`.toLowerCase() : "fade"; globalThis.METRO_CLOAK_DURATION = meta_cloak_duration ? Number.parseInt(meta_cloak_duration) : 300; globalThis.METRO_SMOOTH_SCROLL = meta_smooth_scroll ? JSON.parse(meta_smooth_scroll) : true; globalThis.METRO_DATE_FORMAT = "DD.MM.YYYY"; globalThis.METRO_TIME_FORMAT = "HH:mm:ss"; globalThis.METRO_DATETIME_FORMAT = "DD.MM.YYYY HH:mm:ss"; globalThis.METRO_TIMEOUT = 3e3; globalThis.METRO_MEDIA = []; })(Dom); // source/core/component.js var normalizeComponentName = (name2) => typeof name2 !== "string" ? void 0 : name2.replace(/-/g, "").toLowerCase(); var Component = (nameName, compObj) => { const name2 = normalizeComponentName(nameName); const component = $3.extend( { name: name2, instanceOf: "MetroComponent" }, { _super: function(el, options, defaults, setup) { this.elem = el; this.element = $3(el); this.options = $3.extend({}, defaults, options); this.component = this.elem; this.locale = "en"; this.strings = {}; this._setOptionsFromDOM(); this._runtime(); this._setLocale(); if (setup && typeof setup === "object") { $3.each(setup, (key, val) => { this[key] = val; }); } this._createExec(); }, _setOptionsFromDOM: function() { const element2 = this.element; const o2 = this.options; $3.each(element2.data(), (key, value) => { if (key in o2) { try { o2[key] = JSON.parse(value); } catch { o2[key] = value; } } }); }, _runtime: function() { const element2 = this.element; let mc; const roles = (element2.attr("data-role") || "").toArray(",").map((v5) => normalizeComponentName(v5)).filter((v5) => v5.trim() !== ""); if (!element2.attr(`data-role-${this.name}`)) { element2.attr(`data-role-${this.name}`, true); if (roles.indexOf(this.name) === -1) { roles.push(this.name); element2.attr("data-role", roles.join(",")); } mc = element2.data("metroComponent"); if (mc === void 0) { mc = [this.name]; } else { mc.push(this.name); } element2.data("metroComponent", mc); } }, _createExec: function() { const timeout = this.options[`${this.name}Deferred`]; if (timeout) { setTimeout(() => { this._create(); }, timeout); } else { this._create(); } }, _fireEvent: function(eventName, data = null, log = false, noFire = false, context = null) { const element2 = this.element; const o2 = this.options; const event = str(eventName).camelCase().capitalize(false).value; const _data = $3.extend({}, data, { __this: element2[0] }); if (log) { console.warn(log); console.warn(`Event: on${event}`); console.warn("Data: ", data); console.warn("Element: ", element2[0]); } if (noFire !== true) element2.fire(event.toLowerCase(), data); return Metro.utils.exec(o2[`on${event}`], Object.values(_data), context ? context : element2[0]); }, // _fireEvents: function (events, data, log, noFire, context) { _fireEvents: function(...rest) { const that = this; if (rest.length === 0) { return; } const [events, data, log, noFire, context] = rest; const _events = Array.isArray(events) ? events : events.toArray(","); if (rest.length === 1) { $3.each(_events, (_events2, event) => { that._fireEvent(event); }); return _events.length; } $3.each(_events, function() { that._fireEvent(this, data, log, noFire, context); }); }, _setLocale: function() { const lang = this.element.closest("[lang]"); if (lang.length > 0) { this.locale = lang.attr("lang"); } else { this.locale = $3("html").attr("lang") || "en"; } this.strings = $3.extend({}, Metro.locales.en, Metro.locales[this.locale]); }, _addLabel: (text, target, { id, dir = "ltr", className } = {}) => { if (!text) return; const label = $3("