cmms/frontend/node_modules/.vite/deps/chunk-QIPKHCUH.js

1134 lines
32 KiB
JavaScript

import {
useLocale,
useRtl
} from "./chunk-QN4ZFON4.js";
import {
IN_BROWSER,
clamp,
consoleWarn,
createRange,
easingPatterns,
getCurrentInstance,
mergeDeep,
padStart,
refElement
} from "./chunk-ADPJOAU6.js";
import {
inject,
onBeforeUnmount,
reactive,
toRef,
toValue,
watch
} from "./chunk-FIAHBV72.js";
// node_modules/vuetify/lib/composables/date/adapters/vuetify.js
function weekInfo(locale) {
const code = locale.slice(-2).toUpperCase();
switch (true) {
case locale === "GB-alt-variant": {
return {
firstDay: 0,
firstWeekSize: 4
};
}
case locale === "001": {
return {
firstDay: 1,
firstWeekSize: 1
};
}
case `AG AS BD BR BS BT BW BZ CA CO DM DO ET GT GU HK HN ID IL IN JM JP KE
KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PY SA SG SV TH TT TW UM US
VE VI WS YE ZA ZW`.includes(code): {
return {
firstDay: 0,
firstWeekSize: 1
};
}
case `AI AL AM AR AU AZ BA BM BN BY CL CM CN CR CY EC GE HR KG KZ LB LK LV
MD ME MK MN MY NZ RO RS SI TJ TM TR UA UY UZ VN XK`.includes(code): {
return {
firstDay: 1,
firstWeekSize: 1
};
}
case `AD AN AT AX BE BG CH CZ DE DK EE ES FI FJ FO FR GB GF GP GR HU IE IS
IT LI LT LU MC MQ NL NO PL RE RU SE SK SM VA`.includes(code): {
return {
firstDay: 1,
firstWeekSize: 4
};
}
case `AE AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY`.includes(code): {
return {
firstDay: 6,
firstWeekSize: 1
};
}
case code === "MV": {
return {
firstDay: 5,
firstWeekSize: 1
};
}
case code === "PT": {
return {
firstDay: 0,
firstWeekSize: 4
};
}
default:
return null;
}
}
function getWeekArray(date2, locale, firstDayOfWeek) {
var _a;
const weeks = [];
let currentWeek = [];
const firstDayOfMonth = startOfMonth(date2);
const lastDayOfMonth = endOfMonth(date2);
const first = firstDayOfWeek ?? ((_a = weekInfo(locale)) == null ? void 0 : _a.firstDay) ?? 0;
const firstDayWeekIndex = (firstDayOfMonth.getDay() - first + 7) % 7;
const lastDayWeekIndex = (lastDayOfMonth.getDay() - first + 7) % 7;
for (let i = 0; i < firstDayWeekIndex; i++) {
const adjacentDay = new Date(firstDayOfMonth);
adjacentDay.setDate(adjacentDay.getDate() - (firstDayWeekIndex - i));
currentWeek.push(adjacentDay);
}
for (let i = 1; i <= lastDayOfMonth.getDate(); i++) {
const day = new Date(date2.getFullYear(), date2.getMonth(), i);
currentWeek.push(day);
if (currentWeek.length === 7) {
weeks.push(currentWeek);
currentWeek = [];
}
}
for (let i = 1; i < 7 - lastDayWeekIndex; i++) {
const adjacentDay = new Date(lastDayOfMonth);
adjacentDay.setDate(adjacentDay.getDate() + i);
currentWeek.push(adjacentDay);
}
if (currentWeek.length > 0) {
weeks.push(currentWeek);
}
return weeks;
}
function startOfWeek(date2, locale, firstDayOfWeek) {
var _a;
let day = (firstDayOfWeek ?? ((_a = weekInfo(locale)) == null ? void 0 : _a.firstDay) ?? 0) % 7;
if (![0, 1, 2, 3, 4, 5, 6].includes(day)) {
consoleWarn("Invalid firstDayOfWeek, expected discrete number in range [0-6]");
day = 0;
}
const d = new Date(date2);
while (d.getDay() !== day) {
d.setDate(d.getDate() - 1);
}
return d;
}
function endOfWeek(date2, locale) {
var _a;
const d = new Date(date2);
const lastDay = ((((_a = weekInfo(locale)) == null ? void 0 : _a.firstDay) ?? 0) + 6) % 7;
while (d.getDay() !== lastDay) {
d.setDate(d.getDate() + 1);
}
return d;
}
function startOfMonth(date2) {
return new Date(date2.getFullYear(), date2.getMonth(), 1);
}
function endOfMonth(date2) {
return new Date(date2.getFullYear(), date2.getMonth() + 1, 0);
}
function parseLocalDate(value) {
const parts = value.split("-").map(Number);
return new Date(parts[0], parts[1] - 1, parts[2]);
}
var _YYYMMDD = /^([12]\d{3}-([1-9]|0[1-9]|1[0-2])-([1-9]|0[1-9]|[12]\d|3[01]))$/;
function date(value) {
if (value == null) return /* @__PURE__ */ new Date();
if (value instanceof Date) return value;
if (typeof value === "string") {
let parsed;
if (_YYYMMDD.test(value)) {
return parseLocalDate(value);
} else {
parsed = Date.parse(value);
}
if (!isNaN(parsed)) return new Date(parsed);
}
return null;
}
var sundayJanuarySecond2000 = new Date(2e3, 0, 2);
function getWeekdays(locale, firstDayOfWeek, weekdayFormat) {
var _a;
const daysFromSunday = firstDayOfWeek ?? ((_a = weekInfo(locale)) == null ? void 0 : _a.firstDay) ?? 0;
return createRange(7).map((i) => {
const weekday = new Date(sundayJanuarySecond2000);
weekday.setDate(sundayJanuarySecond2000.getDate() + daysFromSunday + i);
return new Intl.DateTimeFormat(locale, {
weekday: weekdayFormat ?? "narrow"
}).format(weekday);
});
}
function format(value, formatString, locale, formats) {
const newDate = date(value) ?? /* @__PURE__ */ new Date();
const customFormat = formats == null ? void 0 : formats[formatString];
if (typeof customFormat === "function") {
return customFormat(newDate, formatString, locale);
}
let options = {};
switch (formatString) {
case "fullDate":
options = {
year: "numeric",
month: "short",
day: "numeric"
};
break;
case "fullDateWithWeekday":
options = {
weekday: "long",
year: "numeric",
month: "long",
day: "numeric"
};
break;
case "normalDate":
const day = newDate.getDate();
const month = new Intl.DateTimeFormat(locale, {
month: "long"
}).format(newDate);
return `${day} ${month}`;
case "normalDateWithWeekday":
options = {
weekday: "short",
day: "numeric",
month: "short"
};
break;
case "shortDate":
options = {
month: "short",
day: "numeric"
};
break;
case "year":
options = {
year: "numeric"
};
break;
case "month":
options = {
month: "long"
};
break;
case "monthShort":
options = {
month: "short"
};
break;
case "monthAndYear":
options = {
month: "long",
year: "numeric"
};
break;
case "monthAndDate":
options = {
month: "long",
day: "numeric"
};
break;
case "weekday":
options = {
weekday: "long"
};
break;
case "weekdayShort":
options = {
weekday: "short"
};
break;
case "dayOfMonth":
return new Intl.NumberFormat(locale).format(newDate.getDate());
case "hours12h":
options = {
hour: "numeric",
hour12: true
};
break;
case "hours24h":
options = {
hour: "numeric",
hour12: false
};
break;
case "minutes":
options = {
minute: "numeric"
};
break;
case "seconds":
options = {
second: "numeric"
};
break;
case "fullTime":
options = {
hour: "numeric",
minute: "numeric"
};
break;
case "fullTime12h":
options = {
hour: "numeric",
minute: "numeric",
hour12: true
};
break;
case "fullTime24h":
options = {
hour: "numeric",
minute: "numeric",
hour12: false
};
break;
case "fullDateTime":
options = {
year: "numeric",
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric"
};
break;
case "fullDateTime12h":
options = {
year: "numeric",
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric",
hour12: true
};
break;
case "fullDateTime24h":
options = {
year: "numeric",
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric",
hour12: false
};
break;
case "keyboardDate":
options = {
year: "numeric",
month: "2-digit",
day: "2-digit"
};
break;
case "keyboardDateTime":
options = {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "numeric",
minute: "numeric"
};
return new Intl.DateTimeFormat(locale, options).format(newDate).replace(/, /g, " ");
case "keyboardDateTime12h":
options = {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "numeric",
minute: "numeric",
hour12: true
};
return new Intl.DateTimeFormat(locale, options).format(newDate).replace(/, /g, " ");
case "keyboardDateTime24h":
options = {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "numeric",
minute: "numeric",
hour12: false
};
return new Intl.DateTimeFormat(locale, options).format(newDate).replace(/, /g, " ");
default:
options = customFormat ?? {
timeZone: "UTC",
timeZoneName: "short"
};
}
return new Intl.DateTimeFormat(locale, options).format(newDate);
}
function toISO(adapter, value) {
const date2 = adapter.toJsDate(value);
const year = date2.getFullYear();
const month = padStart(String(date2.getMonth() + 1), 2, "0");
const day = padStart(String(date2.getDate()), 2, "0");
return `${year}-${month}-${day}`;
}
function parseISO(value) {
const [year, month, day] = value.split("-").map(Number);
return new Date(year, month - 1, day);
}
function addMinutes(date2, amount) {
const d = new Date(date2);
d.setMinutes(d.getMinutes() + amount);
return d;
}
function addHours(date2, amount) {
const d = new Date(date2);
d.setHours(d.getHours() + amount);
return d;
}
function addDays(date2, amount) {
const d = new Date(date2);
d.setDate(d.getDate() + amount);
return d;
}
function addWeeks(date2, amount) {
const d = new Date(date2);
d.setDate(d.getDate() + amount * 7);
return d;
}
function addMonths(date2, amount) {
const d = new Date(date2);
d.setDate(1);
d.setMonth(d.getMonth() + amount);
return d;
}
function getYear(date2) {
return date2.getFullYear();
}
function getMonth(date2) {
return date2.getMonth();
}
function getWeek(date2, locale, firstDayOfWeek, firstWeekMinSize) {
const weekInfoFromLocale = weekInfo(locale);
const weekStart = firstDayOfWeek ?? (weekInfoFromLocale == null ? void 0 : weekInfoFromLocale.firstDay) ?? 0;
const minWeekSize = firstWeekMinSize ?? (weekInfoFromLocale == null ? void 0 : weekInfoFromLocale.firstWeekSize) ?? 1;
function firstWeekSize(year2) {
const yearStart2 = new Date(year2, 0, 1);
return 7 - getDiff(yearStart2, startOfWeek(yearStart2, locale, weekStart), "days");
}
let year = getYear(date2);
const currentWeekEnd = addDays(startOfWeek(date2, locale, weekStart), 6);
if (year < getYear(currentWeekEnd) && firstWeekSize(year + 1) >= minWeekSize) {
year++;
}
const yearStart = new Date(year, 0, 1);
const size = firstWeekSize(year);
const d1w1 = size >= minWeekSize ? addDays(yearStart, size - 7) : addDays(yearStart, size);
return 1 + getDiff(endOfDay(date2), startOfDay(d1w1), "weeks");
}
function getDate(date2) {
return date2.getDate();
}
function getNextMonth(date2) {
return new Date(date2.getFullYear(), date2.getMonth() + 1, 1);
}
function getPreviousMonth(date2) {
return new Date(date2.getFullYear(), date2.getMonth() - 1, 1);
}
function getHours(date2) {
return date2.getHours();
}
function getMinutes(date2) {
return date2.getMinutes();
}
function startOfYear(date2) {
return new Date(date2.getFullYear(), 0, 1);
}
function endOfYear(date2) {
return new Date(date2.getFullYear(), 11, 31);
}
function isWithinRange(date2, range) {
return isAfter(date2, range[0]) && isBefore(date2, range[1]);
}
function isValid(date2) {
const d = new Date(date2);
return d instanceof Date && !isNaN(d.getTime());
}
function isAfter(date2, comparing) {
return date2.getTime() > comparing.getTime();
}
function isAfterDay(date2, comparing) {
return isAfter(startOfDay(date2), startOfDay(comparing));
}
function isBefore(date2, comparing) {
return date2.getTime() < comparing.getTime();
}
function isEqual(date2, comparing) {
return date2.getTime() === comparing.getTime();
}
function isSameDay(date2, comparing) {
return date2.getDate() === comparing.getDate() && date2.getMonth() === comparing.getMonth() && date2.getFullYear() === comparing.getFullYear();
}
function isSameMonth(date2, comparing) {
return date2.getMonth() === comparing.getMonth() && date2.getFullYear() === comparing.getFullYear();
}
function isSameYear(date2, comparing) {
return date2.getFullYear() === comparing.getFullYear();
}
function getDiff(date2, comparing, unit) {
const d = new Date(date2);
const c = new Date(comparing);
switch (unit) {
case "years":
return d.getFullYear() - c.getFullYear();
case "quarters":
return Math.floor((d.getMonth() - c.getMonth() + (d.getFullYear() - c.getFullYear()) * 12) / 4);
case "months":
return d.getMonth() - c.getMonth() + (d.getFullYear() - c.getFullYear()) * 12;
case "weeks":
return Math.floor((d.getTime() - c.getTime()) / (1e3 * 60 * 60 * 24 * 7));
case "days":
return Math.floor((d.getTime() - c.getTime()) / (1e3 * 60 * 60 * 24));
case "hours":
return Math.floor((d.getTime() - c.getTime()) / (1e3 * 60 * 60));
case "minutes":
return Math.floor((d.getTime() - c.getTime()) / (1e3 * 60));
case "seconds":
return Math.floor((d.getTime() - c.getTime()) / 1e3);
default: {
return d.getTime() - c.getTime();
}
}
}
function setHours(date2, count) {
const d = new Date(date2);
d.setHours(count);
return d;
}
function setMinutes(date2, count) {
const d = new Date(date2);
d.setMinutes(count);
return d;
}
function setMonth(date2, count) {
const d = new Date(date2);
d.setMonth(count);
return d;
}
function setDate(date2, day) {
const d = new Date(date2);
d.setDate(day);
return d;
}
function setYear(date2, year) {
const d = new Date(date2);
d.setFullYear(year);
return d;
}
function startOfDay(date2) {
return new Date(date2.getFullYear(), date2.getMonth(), date2.getDate(), 0, 0, 0, 0);
}
function endOfDay(date2) {
return new Date(date2.getFullYear(), date2.getMonth(), date2.getDate(), 23, 59, 59, 999);
}
var VuetifyDateAdapter = class {
constructor(options) {
this.locale = options.locale;
this.formats = options.formats;
}
date(value) {
return date(value);
}
toJsDate(date2) {
return date2;
}
toISO(date2) {
return toISO(this, date2);
}
parseISO(date2) {
return parseISO(date2);
}
addMinutes(date2, amount) {
return addMinutes(date2, amount);
}
addHours(date2, amount) {
return addHours(date2, amount);
}
addDays(date2, amount) {
return addDays(date2, amount);
}
addWeeks(date2, amount) {
return addWeeks(date2, amount);
}
addMonths(date2, amount) {
return addMonths(date2, amount);
}
getWeekArray(date2, firstDayOfWeek) {
const firstDay = firstDayOfWeek !== void 0 ? Number(firstDayOfWeek) : void 0;
return getWeekArray(date2, this.locale, firstDay);
}
startOfWeek(date2, firstDayOfWeek) {
const firstDay = firstDayOfWeek !== void 0 ? Number(firstDayOfWeek) : void 0;
return startOfWeek(date2, this.locale, firstDay);
}
endOfWeek(date2) {
return endOfWeek(date2, this.locale);
}
startOfMonth(date2) {
return startOfMonth(date2);
}
endOfMonth(date2) {
return endOfMonth(date2);
}
format(date2, formatString) {
return format(date2, formatString, this.locale, this.formats);
}
isEqual(date2, comparing) {
return isEqual(date2, comparing);
}
isValid(date2) {
return isValid(date2);
}
isWithinRange(date2, range) {
return isWithinRange(date2, range);
}
isAfter(date2, comparing) {
return isAfter(date2, comparing);
}
isAfterDay(date2, comparing) {
return isAfterDay(date2, comparing);
}
isBefore(date2, comparing) {
return !isAfter(date2, comparing) && !isEqual(date2, comparing);
}
isSameDay(date2, comparing) {
return isSameDay(date2, comparing);
}
isSameMonth(date2, comparing) {
return isSameMonth(date2, comparing);
}
isSameYear(date2, comparing) {
return isSameYear(date2, comparing);
}
setMinutes(date2, count) {
return setMinutes(date2, count);
}
setHours(date2, count) {
return setHours(date2, count);
}
setMonth(date2, count) {
return setMonth(date2, count);
}
setDate(date2, day) {
return setDate(date2, day);
}
setYear(date2, year) {
return setYear(date2, year);
}
getDiff(date2, comparing, unit) {
return getDiff(date2, comparing, unit);
}
getWeekdays(firstDayOfWeek, weekdayFormat) {
const firstDay = firstDayOfWeek !== void 0 ? Number(firstDayOfWeek) : void 0;
return getWeekdays(this.locale, firstDay, weekdayFormat);
}
getYear(date2) {
return getYear(date2);
}
getMonth(date2) {
return getMonth(date2);
}
getWeek(date2, firstDayOfWeek, firstWeekMinSize) {
const firstDay = firstDayOfWeek !== void 0 ? Number(firstDayOfWeek) : void 0;
return getWeek(date2, this.locale, firstDay, firstWeekMinSize);
}
getDate(date2) {
return getDate(date2);
}
getNextMonth(date2) {
return getNextMonth(date2);
}
getPreviousMonth(date2) {
return getPreviousMonth(date2);
}
getHours(date2) {
return getHours(date2);
}
getMinutes(date2) {
return getMinutes(date2);
}
startOfDay(date2) {
return startOfDay(date2);
}
endOfDay(date2) {
return endOfDay(date2);
}
startOfYear(date2) {
return startOfYear(date2);
}
endOfYear(date2) {
return endOfYear(date2);
}
};
// node_modules/vuetify/lib/composables/date/date.js
var DateOptionsSymbol = Symbol.for("vuetify:date-options");
var DateAdapterSymbol = Symbol.for("vuetify:date-adapter");
function createDate(options, locale) {
const _options = mergeDeep({
adapter: VuetifyDateAdapter,
locale: {
af: "af-ZA",
// ar: '', # not the same value for all variants
bg: "bg-BG",
ca: "ca-ES",
ckb: "",
cs: "cs-CZ",
de: "de-DE",
el: "el-GR",
en: "en-US",
// es: '', # not the same value for all variants
et: "et-EE",
fa: "fa-IR",
fi: "fi-FI",
// fr: '', #not the same value for all variants
hr: "hr-HR",
hu: "hu-HU",
he: "he-IL",
id: "id-ID",
it: "it-IT",
ja: "ja-JP",
ko: "ko-KR",
lv: "lv-LV",
lt: "lt-LT",
nl: "nl-NL",
no: "no-NO",
pl: "pl-PL",
pt: "pt-PT",
ro: "ro-RO",
ru: "ru-RU",
sk: "sk-SK",
sl: "sl-SI",
srCyrl: "sr-SP",
srLatn: "sr-SP",
sv: "sv-SE",
th: "th-TH",
tr: "tr-TR",
az: "az-AZ",
uk: "uk-UA",
vi: "vi-VN",
zhHans: "zh-CN",
zhHant: "zh-TW"
}
}, options);
return {
options: _options,
instance: createInstance(_options, locale)
};
}
function createInstance(options, locale) {
const instance = reactive(typeof options.adapter === "function" ? new options.adapter({
locale: options.locale[locale.current.value] ?? locale.current.value,
formats: options.formats
}) : options.adapter);
watch(locale.current, (value) => {
instance.locale = options.locale[value] ?? value ?? instance.locale;
});
return instance;
}
function useDate() {
const options = inject(DateOptionsSymbol);
if (!options) throw new Error("[Vuetify] Could not find injected date options");
const locale = useLocale();
return createInstance(options, locale);
}
// node_modules/vuetify/lib/composables/goto.js
var GoToSymbol = Symbol.for("vuetify:goto");
function genDefaults() {
return {
container: void 0,
duration: 300,
layout: false,
offset: 0,
easing: "easeInOutCubic",
patterns: easingPatterns
};
}
function getContainer(el) {
return getTarget(el) ?? (document.scrollingElement || document.body);
}
function getTarget(el) {
return typeof el === "string" ? document.querySelector(el) : refElement(el);
}
function getOffset(target, horizontal, rtl) {
if (typeof target === "number") return horizontal && rtl ? -target : target;
let el = getTarget(target);
let totalOffset = 0;
while (el) {
totalOffset += horizontal ? el.offsetLeft : el.offsetTop;
el = el.offsetParent;
}
return totalOffset;
}
function createGoTo(options, locale) {
return {
rtl: locale.isRtl,
options: mergeDeep(genDefaults(), options)
};
}
async function scrollTo(_target, _options, horizontal, goTo) {
const property = horizontal ? "scrollLeft" : "scrollTop";
const options = mergeDeep((goTo == null ? void 0 : goTo.options) ?? genDefaults(), _options);
const rtl = goTo == null ? void 0 : goTo.rtl.value;
const target = (typeof _target === "number" ? _target : getTarget(_target)) ?? 0;
const container = options.container === "parent" && target instanceof HTMLElement ? target.parentElement : getContainer(options.container);
const ease = typeof options.easing === "function" ? options.easing : options.patterns[options.easing];
if (!ease) throw new TypeError(`Easing function "${options.easing}" not found.`);
let targetLocation;
if (typeof target === "number") {
targetLocation = getOffset(target, horizontal, rtl);
} else {
targetLocation = getOffset(target, horizontal, rtl) - getOffset(container, horizontal, rtl);
if (options.layout) {
const styles = window.getComputedStyle(target);
const layoutOffset = styles.getPropertyValue("--v-layout-top");
if (layoutOffset) targetLocation -= parseInt(layoutOffset, 10);
}
}
targetLocation += options.offset;
targetLocation = clampTarget(container, targetLocation, !!rtl, !!horizontal);
const startLocation = container[property] ?? 0;
if (targetLocation === startLocation) return Promise.resolve(targetLocation);
const startTime = performance.now();
return new Promise((resolve) => requestAnimationFrame(function step(currentTime) {
const timeElapsed = currentTime - startTime;
const progress = timeElapsed / options.duration;
const location = Math.floor(startLocation + (targetLocation - startLocation) * ease(clamp(progress, 0, 1)));
container[property] = location;
if (progress >= 1 && Math.abs(location - container[property]) < 10) {
return resolve(targetLocation);
} else if (progress > 2) {
consoleWarn("Scroll target is not reachable");
return resolve(container[property]);
}
requestAnimationFrame(step);
}));
}
function useGoTo() {
let _options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
const goToInstance = inject(GoToSymbol);
const {
isRtl
} = useRtl();
if (!goToInstance) throw new Error("[Vuetify] Could not find injected goto instance");
const goTo = {
...goToInstance,
// can be set via VLocaleProvider
rtl: toRef(() => goToInstance.rtl.value || isRtl.value)
};
async function go(target, options) {
return scrollTo(target, mergeDeep(_options, options), false, goTo);
}
go.horizontal = async (target, options) => {
return scrollTo(target, mergeDeep(_options, options), true, goTo);
};
return go;
}
function clampTarget(container, value, rtl, horizontal) {
const {
scrollWidth,
scrollHeight
} = container;
const [containerWidth, containerHeight] = container === document.scrollingElement ? [window.innerWidth, window.innerHeight] : [container.offsetWidth, container.offsetHeight];
let min;
let max;
if (horizontal) {
if (rtl) {
min = -(scrollWidth - containerWidth);
max = 0;
} else {
min = 0;
max = scrollWidth - containerWidth;
}
} else {
min = 0;
max = scrollHeight + -containerHeight;
}
return clamp(value, min, max);
}
// node_modules/vuetify/lib/composables/hotkey/key-aliases.js
var keyAliasMap = {
// Modifier aliases (from vue-use, other libraries, and current implementation)
control: "ctrl",
command: "cmd",
option: "alt",
// Arrow key aliases (common abbreviations)
up: "arrowup",
down: "arrowdown",
left: "arrowleft",
right: "arrowright",
// Other common key aliases
esc: "escape",
spacebar: " ",
space: " ",
return: "enter",
del: "delete",
// Symbol aliases (existing from hotkey-parsing.ts)
minus: "-",
hyphen: "-"
};
function normalizeKey(key) {
const lowerKey = key.toLowerCase();
return keyAliasMap[lowerKey] || lowerKey;
}
// node_modules/vuetify/lib/composables/hotkey/hotkey-parsing.js
function splitKeyCombination(combination) {
let isInternal = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
if (!combination) {
if (!isInternal) consoleWarn("Invalid hotkey combination: empty string provided");
return [];
}
const startsWithPlusOrUnderscore = combination.startsWith("+") || combination.startsWith("_");
const hasInvalidLeadingSeparator = (
// Starts with a single '+' or '_' followed by a non-separator character (e.g. '+a', '_a')
startsWithPlusOrUnderscore && !(combination.startsWith("++") || combination.startsWith("__"))
);
const hasInvalidStructure = (
// Invalid leading separator patterns
combination.length > 1 && hasInvalidLeadingSeparator || // Disallow literal + or _ keys (they require shift)
combination.includes("++") || combination.includes("__") || combination === "+" || combination === "_" || // Ends with a separator that is not part of a doubled literal
combination.length > 1 && (combination.endsWith("+") || combination.endsWith("_")) && combination.at(-2) !== combination.at(-1) || // Stand-alone doubled separators (dangling)
combination === "++" || combination === "--" || combination === "__"
);
if (hasInvalidStructure) {
if (!isInternal) consoleWarn(`Invalid hotkey combination: "${combination}" has invalid structure`);
return [];
}
const keys = [];
let buffer = "";
const flushBuffer = () => {
if (buffer) {
keys.push(normalizeKey(buffer));
buffer = "";
}
};
for (let i = 0; i < combination.length; i++) {
const char = combination[i];
const nextChar = combination[i + 1];
if (char === "+" || char === "_" || char === "-") {
if (char === nextChar) {
flushBuffer();
keys.push(char);
i++;
} else if (char === "+" || char === "_") {
flushBuffer();
} else {
buffer += char;
}
} else {
buffer += char;
}
}
flushBuffer();
const hasInvalidMinus = keys.some((key) => key.length > 1 && key.includes("-") && key !== "--");
if (hasInvalidMinus) {
if (!isInternal) consoleWarn(`Invalid hotkey combination: "${combination}" has invalid structure`);
return [];
}
if (keys.length === 0 && combination) {
return [normalizeKey(combination)];
}
return keys;
}
function splitKeySequence(str) {
if (!str) {
consoleWarn("Invalid hotkey sequence: empty string provided");
return [];
}
const hasInvalidStart = str.startsWith("-") && !["---", "--+"].includes(str);
const hasInvalidEnd = str.endsWith("-") && !str.endsWith("+-") && !str.endsWith("_-") && str !== "-" && str !== "---";
if (hasInvalidStart || hasInvalidEnd) {
consoleWarn(`Invalid hotkey sequence: "${str}" contains invalid combinations`);
return [];
}
const result = [];
let buffer = "";
let i = 0;
while (i < str.length) {
const char = str[i];
if (char === "-") {
const prevChar = str[i - 1];
const prevPrevChar = i > 1 ? str[i - 2] : void 0;
const precededBySinglePlusOrUnderscore = (prevChar === "+" || prevChar === "_") && prevPrevChar !== "+";
if (precededBySinglePlusOrUnderscore) {
buffer += char;
i++;
} else {
if (buffer) {
result.push(buffer);
buffer = "";
} else {
result.push("-");
}
i++;
}
} else {
buffer += char;
i++;
}
}
if (buffer) {
result.push(buffer);
}
const collapsed = [];
let minusCount = 0;
for (const part of result) {
if (part === "-") {
if (minusCount % 2 === 0) collapsed.push("-");
minusCount++;
} else {
minusCount = 0;
collapsed.push(part);
}
}
const areAllValid = collapsed.every((s) => splitKeyCombination(s, true).length > 0);
if (!areAllValid) {
consoleWarn(`Invalid hotkey sequence: "${str}" contains invalid combinations`);
return [];
}
return collapsed;
}
// node_modules/vuetify/lib/composables/hotkey/hotkey.js
function useHotkey(keys, callback) {
var _a;
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
if (!IN_BROWSER) return function() {
};
const {
event = "keydown",
inputs = false,
preventDefault = true,
sequenceTimeout = 1e3
} = options;
const isMac = ((_a = navigator == null ? void 0 : navigator.userAgent) == null ? void 0 : _a.includes("Macintosh")) ?? false;
let timeout = 0;
let keyGroups;
let isSequence = false;
let groupIndex = 0;
function clearTimer() {
if (!timeout) return;
clearTimeout(timeout);
timeout = 0;
}
function isInputFocused() {
if (toValue(inputs)) return false;
const activeElement = document.activeElement;
return activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA" || activeElement.isContentEditable || activeElement.contentEditable === "true");
}
function resetSequence() {
groupIndex = 0;
clearTimer();
}
function handler(e) {
const group = keyGroups[groupIndex];
if (!group || isInputFocused()) return;
if (!matchesKeyGroup(e, group)) {
if (isSequence) resetSequence();
return;
}
if (toValue(preventDefault)) e.preventDefault();
if (!isSequence) {
callback(e);
return;
}
clearTimer();
groupIndex++;
if (groupIndex === keyGroups.length) {
callback(e);
resetSequence();
return;
}
timeout = window.setTimeout(resetSequence, toValue(sequenceTimeout));
}
function cleanup() {
window.removeEventListener(toValue(event), handler);
clearTimer();
}
watch(() => toValue(keys), function(unrefKeys) {
cleanup();
if (unrefKeys) {
const groups = splitKeySequence(unrefKeys.toLowerCase());
isSequence = groups.length > 1;
keyGroups = groups;
resetSequence();
window.addEventListener(toValue(event), handler);
}
}, {
immediate: true
});
watch(() => toValue(event), function(newEvent, oldEvent) {
if (oldEvent && keyGroups && keyGroups.length > 0) {
window.removeEventListener(oldEvent, handler);
window.addEventListener(newEvent, handler);
}
});
try {
getCurrentInstance("useHotkey");
onBeforeUnmount(cleanup);
} catch {
}
function parseKeyGroup(group) {
const MODIFIERS = ["ctrl", "shift", "alt", "meta", "cmd"];
const parts = splitKeyCombination(group.toLowerCase());
if (parts.length === 0) {
return {
modifiers: Object.fromEntries(MODIFIERS.map((m) => [m, false])),
actualKey: void 0
};
}
const modifiers = Object.fromEntries(MODIFIERS.map((m) => [m, false]));
let actualKey;
for (const part of parts) {
if (MODIFIERS.includes(part)) {
modifiers[part] = true;
} else {
actualKey = part;
}
}
return {
modifiers,
actualKey
};
}
function matchesKeyGroup(e, group) {
const {
modifiers,
actualKey
} = parseKeyGroup(group);
const expectCtrl = modifiers.ctrl || !isMac && (modifiers.cmd || modifiers.meta);
const expectMeta = isMac && (modifiers.cmd || modifiers.meta);
return e.ctrlKey === expectCtrl && e.metaKey === expectMeta && e.shiftKey === modifiers.shift && e.altKey === modifiers.alt && e.key.toLowerCase() === (actualKey == null ? void 0 : actualKey.toLowerCase());
}
return cleanup;
}
export {
DateOptionsSymbol,
DateAdapterSymbol,
createDate,
useDate,
GoToSymbol,
createGoTo,
useGoTo,
useHotkey
};
//# sourceMappingURL=chunk-QIPKHCUH.js.map