751 lines
18 KiB
JavaScript
751 lines
18 KiB
JavaScript
|
import {
|
||
|
useLocale
|
||
|
} from "./chunk-IR5437QA.js";
|
||
|
import {
|
||
|
createRange,
|
||
|
mergeDeep,
|
||
|
padStart,
|
||
|
refElement
|
||
|
} from "./chunk-I4KGD5X4.js";
|
||
|
import {
|
||
|
inject,
|
||
|
reactive,
|
||
|
watch
|
||
|
} from "./chunk-PD2AWGJV.js";
|
||
|
|
||
|
// node_modules/vuetify/lib/composables/date/adapters/vuetify.mjs
|
||
|
var firstDay = {
|
||
|
"001": 1,
|
||
|
AD: 1,
|
||
|
AE: 6,
|
||
|
AF: 6,
|
||
|
AG: 0,
|
||
|
AI: 1,
|
||
|
AL: 1,
|
||
|
AM: 1,
|
||
|
AN: 1,
|
||
|
AR: 1,
|
||
|
AS: 0,
|
||
|
AT: 1,
|
||
|
AU: 1,
|
||
|
AX: 1,
|
||
|
AZ: 1,
|
||
|
BA: 1,
|
||
|
BD: 0,
|
||
|
BE: 1,
|
||
|
BG: 1,
|
||
|
BH: 6,
|
||
|
BM: 1,
|
||
|
BN: 1,
|
||
|
BR: 0,
|
||
|
BS: 0,
|
||
|
BT: 0,
|
||
|
BW: 0,
|
||
|
BY: 1,
|
||
|
BZ: 0,
|
||
|
CA: 0,
|
||
|
CH: 1,
|
||
|
CL: 1,
|
||
|
CM: 1,
|
||
|
CN: 1,
|
||
|
CO: 0,
|
||
|
CR: 1,
|
||
|
CY: 1,
|
||
|
CZ: 1,
|
||
|
DE: 1,
|
||
|
DJ: 6,
|
||
|
DK: 1,
|
||
|
DM: 0,
|
||
|
DO: 0,
|
||
|
DZ: 6,
|
||
|
EC: 1,
|
||
|
EE: 1,
|
||
|
EG: 6,
|
||
|
ES: 1,
|
||
|
ET: 0,
|
||
|
FI: 1,
|
||
|
FJ: 1,
|
||
|
FO: 1,
|
||
|
FR: 1,
|
||
|
GB: 1,
|
||
|
"GB-alt-variant": 0,
|
||
|
GE: 1,
|
||
|
GF: 1,
|
||
|
GP: 1,
|
||
|
GR: 1,
|
||
|
GT: 0,
|
||
|
GU: 0,
|
||
|
HK: 0,
|
||
|
HN: 0,
|
||
|
HR: 1,
|
||
|
HU: 1,
|
||
|
ID: 0,
|
||
|
IE: 1,
|
||
|
IL: 0,
|
||
|
IN: 0,
|
||
|
IQ: 6,
|
||
|
IR: 6,
|
||
|
IS: 1,
|
||
|
IT: 1,
|
||
|
JM: 0,
|
||
|
JO: 6,
|
||
|
JP: 0,
|
||
|
KE: 0,
|
||
|
KG: 1,
|
||
|
KH: 0,
|
||
|
KR: 0,
|
||
|
KW: 6,
|
||
|
KZ: 1,
|
||
|
LA: 0,
|
||
|
LB: 1,
|
||
|
LI: 1,
|
||
|
LK: 1,
|
||
|
LT: 1,
|
||
|
LU: 1,
|
||
|
LV: 1,
|
||
|
LY: 6,
|
||
|
MC: 1,
|
||
|
MD: 1,
|
||
|
ME: 1,
|
||
|
MH: 0,
|
||
|
MK: 1,
|
||
|
MM: 0,
|
||
|
MN: 1,
|
||
|
MO: 0,
|
||
|
MQ: 1,
|
||
|
MT: 0,
|
||
|
MV: 5,
|
||
|
MX: 0,
|
||
|
MY: 1,
|
||
|
MZ: 0,
|
||
|
NI: 0,
|
||
|
NL: 1,
|
||
|
NO: 1,
|
||
|
NP: 0,
|
||
|
NZ: 1,
|
||
|
OM: 6,
|
||
|
PA: 0,
|
||
|
PE: 0,
|
||
|
PH: 0,
|
||
|
PK: 0,
|
||
|
PL: 1,
|
||
|
PR: 0,
|
||
|
PT: 0,
|
||
|
PY: 0,
|
||
|
QA: 6,
|
||
|
RE: 1,
|
||
|
RO: 1,
|
||
|
RS: 1,
|
||
|
RU: 1,
|
||
|
SA: 0,
|
||
|
SD: 6,
|
||
|
SE: 1,
|
||
|
SG: 0,
|
||
|
SI: 1,
|
||
|
SK: 1,
|
||
|
SM: 1,
|
||
|
SV: 0,
|
||
|
SY: 6,
|
||
|
TH: 0,
|
||
|
TJ: 1,
|
||
|
TM: 1,
|
||
|
TR: 1,
|
||
|
TT: 0,
|
||
|
TW: 0,
|
||
|
UA: 1,
|
||
|
UM: 0,
|
||
|
US: 0,
|
||
|
UY: 1,
|
||
|
UZ: 1,
|
||
|
VA: 1,
|
||
|
VE: 0,
|
||
|
VI: 0,
|
||
|
VN: 1,
|
||
|
WS: 0,
|
||
|
XK: 1,
|
||
|
YE: 0,
|
||
|
ZA: 0,
|
||
|
ZW: 0
|
||
|
};
|
||
|
function getWeekArray(date2, locale) {
|
||
|
const weeks = [];
|
||
|
let currentWeek = [];
|
||
|
const firstDayOfMonth = startOfMonth(date2);
|
||
|
const lastDayOfMonth = endOfMonth(date2);
|
||
|
const firstDayWeekIndex = (firstDayOfMonth.getDay() - firstDay[locale.slice(-2).toUpperCase()] + 7) % 7;
|
||
|
const lastDayWeekIndex = (lastDayOfMonth.getDay() - firstDay[locale.slice(-2).toUpperCase()] + 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) {
|
||
|
const d = new Date(date2);
|
||
|
while (d.getDay() !== 0) {
|
||
|
d.setDate(d.getDate() - 1);
|
||
|
}
|
||
|
return d;
|
||
|
}
|
||
|
function endOfWeek(date2) {
|
||
|
const d = new Date(date2);
|
||
|
while (d.getDay() !== 6) {
|
||
|
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) {
|
||
|
const daysFromSunday = firstDay[locale.slice(-2).toUpperCase()];
|
||
|
return createRange(7).map((i) => {
|
||
|
const weekday = new Date(sundayJanuarySecond2000);
|
||
|
weekday.setDate(sundayJanuarySecond2000.getDate() + daysFromSunday + i);
|
||
|
return new Intl.DateTimeFormat(locale, {
|
||
|
weekday: "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 "fullDateWithWeekday":
|
||
|
options = {
|
||
|
weekday: "long",
|
||
|
day: "numeric",
|
||
|
month: "long",
|
||
|
year: "numeric"
|
||
|
};
|
||
|
break;
|
||
|
case "hours12h":
|
||
|
options = {
|
||
|
hour: "numeric",
|
||
|
hour12: true
|
||
|
};
|
||
|
break;
|
||
|
case "normalDateWithWeekday":
|
||
|
options = {
|
||
|
weekday: "short",
|
||
|
day: "numeric",
|
||
|
month: "short"
|
||
|
};
|
||
|
break;
|
||
|
case "keyboardDate":
|
||
|
options = {
|
||
|
day: "2-digit",
|
||
|
month: "2-digit",
|
||
|
year: "numeric"
|
||
|
};
|
||
|
break;
|
||
|
case "monthAndDate":
|
||
|
options = {
|
||
|
month: "long",
|
||
|
day: "numeric"
|
||
|
};
|
||
|
break;
|
||
|
case "monthAndYear":
|
||
|
options = {
|
||
|
month: "long",
|
||
|
year: "numeric"
|
||
|
};
|
||
|
break;
|
||
|
case "month":
|
||
|
options = {
|
||
|
month: "long"
|
||
|
};
|
||
|
break;
|
||
|
case "monthShort":
|
||
|
options = {
|
||
|
month: "short"
|
||
|
};
|
||
|
break;
|
||
|
case "dayOfMonth":
|
||
|
return new Intl.NumberFormat(locale).format(newDate.getDate());
|
||
|
case "shortDate":
|
||
|
options = {
|
||
|
year: "2-digit",
|
||
|
month: "numeric",
|
||
|
day: "numeric"
|
||
|
};
|
||
|
break;
|
||
|
case "weekdayShort":
|
||
|
options = {
|
||
|
weekday: "short"
|
||
|
};
|
||
|
break;
|
||
|
case "year":
|
||
|
options = {
|
||
|
year: "numeric"
|
||
|
};
|
||
|
break;
|
||
|
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.setMonth(d.getMonth() + amount);
|
||
|
return d;
|
||
|
}
|
||
|
function getYear(date2) {
|
||
|
return date2.getFullYear();
|
||
|
}
|
||
|
function getMonth(date2) {
|
||
|
return date2.getMonth();
|
||
|
}
|
||
|
function getNextMonth(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 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 getDiff(date2, comparing, unit) {
|
||
|
const d = new Date(date2);
|
||
|
const c = new Date(comparing);
|
||
|
if (unit === "month") {
|
||
|
return d.getMonth() - c.getMonth() + (d.getFullYear() - c.getFullYear()) * 12;
|
||
|
}
|
||
|
return Math.floor((d.getTime() - c.getTime()) / (1e3 * 60 * 60 * 24));
|
||
|
}
|
||
|
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 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());
|
||
|
}
|
||
|
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) {
|
||
|
return getWeekArray(date2, this.locale);
|
||
|
}
|
||
|
startOfWeek(date2) {
|
||
|
return startOfWeek(date2);
|
||
|
}
|
||
|
endOfWeek(date2) {
|
||
|
return endOfWeek(date2);
|
||
|
}
|
||
|
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);
|
||
|
}
|
||
|
isBefore(date2, comparing) {
|
||
|
return !isAfter(date2, comparing) && !isEqual(date2, comparing);
|
||
|
}
|
||
|
isSameDay(date2, comparing) {
|
||
|
return isSameDay(date2, comparing);
|
||
|
}
|
||
|
isSameMonth(date2, comparing) {
|
||
|
return isSameMonth(date2, comparing);
|
||
|
}
|
||
|
setMinutes(date2, count) {
|
||
|
return setMinutes(date2, count);
|
||
|
}
|
||
|
setHours(date2, count) {
|
||
|
return setHours(date2, count);
|
||
|
}
|
||
|
setMonth(date2, count) {
|
||
|
return setMonth(date2, count);
|
||
|
}
|
||
|
setYear(date2, year) {
|
||
|
return setYear(date2, year);
|
||
|
}
|
||
|
getDiff(date2, comparing, unit) {
|
||
|
return getDiff(date2, comparing, unit);
|
||
|
}
|
||
|
getWeekdays() {
|
||
|
return getWeekdays(this.locale);
|
||
|
}
|
||
|
getYear(date2) {
|
||
|
return getYear(date2);
|
||
|
}
|
||
|
getMonth(date2) {
|
||
|
return getMonth(date2);
|
||
|
}
|
||
|
getNextMonth(date2) {
|
||
|
return getNextMonth(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.mjs
|
||
|
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.mjs
|
||
|
var GoToSymbol = Symbol.for("vuetify:goto");
|
||
|
function genDefaults() {
|
||
|
return {
|
||
|
container: void 0,
|
||
|
duration: 300,
|
||
|
layout: false,
|
||
|
offset: 0,
|
||
|
easing: "easeInOutCubic",
|
||
|
patterns: {
|
||
|
linear: (t) => t,
|
||
|
easeInQuad: (t) => t ** 2,
|
||
|
easeOutQuad: (t) => t * (2 - t),
|
||
|
easeInOutQuad: (t) => t < 0.5 ? 2 * t ** 2 : -1 + (4 - 2 * t) * t,
|
||
|
easeInCubic: (t) => t ** 3,
|
||
|
easeOutCubic: (t) => --t ** 3 + 1,
|
||
|
easeInOutCubic: (t) => t < 0.5 ? 4 * t ** 3 : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,
|
||
|
easeInQuart: (t) => t ** 4,
|
||
|
easeOutQuart: (t) => 1 - --t ** 4,
|
||
|
easeInOutQuart: (t) => t < 0.5 ? 8 * t ** 4 : 1 - 8 * --t ** 4,
|
||
|
easeInQuint: (t) => t ** 5,
|
||
|
easeOutQuint: (t) => 1 + --t ** 5,
|
||
|
easeInOutQuint: (t) => t < 0.5 ? 16 * t ** 5 : 1 + 16 * --t ** 5
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
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 options = mergeDeep(goTo == null ? void 0 : goTo.options, _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;
|
||
|
const startLocation = (horizontal ? container.scrollLeft : container.scrollTop) ?? 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 = Math.abs(options.duration ? Math.min(timeElapsed / options.duration, 1) : 1);
|
||
|
const location = Math.floor(startLocation + (targetLocation - startLocation) * ease(progress));
|
||
|
container[horizontal ? "scrollLeft" : "scrollTop"] = location;
|
||
|
if (progress === 1) return resolve(targetLocation);
|
||
|
let clientSize;
|
||
|
let reachEnd;
|
||
|
if (!horizontal) {
|
||
|
clientSize = container === document.body ? document.documentElement.clientHeight : container.clientHeight;
|
||
|
reachEnd = clientSize + container.scrollTop >= container.scrollHeight;
|
||
|
if (targetLocation > container.scrollTop && reachEnd) return resolve(targetLocation);
|
||
|
} else {
|
||
|
clientSize = container === document.body ? document.documentElement.clientWidth : container.clientWidth;
|
||
|
reachEnd = clientSize + container.scrollLeft >= container.scrollWidth;
|
||
|
if (targetLocation > container.scrollLeft && reachEnd) return resolve(targetLocation);
|
||
|
}
|
||
|
requestAnimationFrame(step);
|
||
|
}));
|
||
|
}
|
||
|
function useGoTo() {
|
||
|
let _options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
||
|
const goTo = inject(GoToSymbol);
|
||
|
if (!goTo) throw new Error("[Vuetify] Could not find injected goto instance");
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
export {
|
||
|
DateOptionsSymbol,
|
||
|
DateAdapterSymbol,
|
||
|
createDate,
|
||
|
useDate,
|
||
|
GoToSymbol,
|
||
|
createGoTo,
|
||
|
useGoTo
|
||
|
};
|
||
|
//# sourceMappingURL=chunk-AGK43WUJ.js.map
|