Files
routie/frontend/node_modules/.vite/deps/VOverlay-BS8OrX3g.js
T

1203 lines
39 KiB
JavaScript

import { C as vShow, Cn as withDirectives, Dt as mergeProps, Ft as onMounted, Gn as readonly, I as Teleport, Kn as ref, M as Fragment, Mn as effectScope, Ot as nextTick, Qn as toRef, U as computed, Ut as provide, Vn as onScopeDispose, W as createBaseVNode, Wn as reactive, Yn as shallowRef, Zn as toRaw, _n as watchEffect, er as toValue, et as createVNode, gn as watch, hn as warn, jt as onBeforeUnmount, n as Transition, xt as inject } from "./vue.runtime.esm-bundler-BvoXUmaf.js";
import { B as matchesSelector, C as eventName, H as omit, L as isOn, Q as IN_BROWSER, Y as templateRef, _ as convertToUnit, g as clamp, l as propsFactory, n as genericComponent, rt as consoleError, s as getCurrentInstance, u as CircularBuffer, x as destructComputed } from "./defineComponent-DB6xIcDy.js";
import { a as parseAnchor, i as getAxis, n as flipCorner, r as flipSide, t as flipAlign } from "./anchor-DB_quObT.js";
import { i as getTargetBox, n as getElementBox, r as getOverflow, t as Box } from "./box-BNWMOtF7.js";
import { c as nullifyTransforms, s as animate } from "./transitions-DCQ3sjjZ.js";
import { t as makeComponentProps } from "./component-DdiwBe6i.js";
import { t as deepEqual } from "./deepEqual-DDqmGqyF.js";
import "./easing-DfcvkbkS.js";
import { n as getScrollParents, r as hasScrollbar, t as getScrollParent } from "./getScrollParent-DuXs8SPu.js";
import { t as useRender } from "./useRender-fVtVsZgv.js";
import { t as useBackgroundColor } from "./color-B6vuQruj.js";
import { i as provideTheme, r as makeThemeProps } from "./theme-Cx5kFg0-.js";
import { n as useToggleScope, t as useProxiedModel } from "./proxiedModel-DSlSIQ0y.js";
import { i as useRtl } from "./locale-DDGMqzqb.js";
import { a as useDisplay } from "./display-DKaCj-_K.js";
import { n as useDimension, t as makeDimensionProps } from "./dimensions-BDdmuRdK.js";
import { n as makeTransitionProps, t as MaybeTransition } from "./transition-DqoZ8fA1.js";
import { i as useRouter, n as useBackButton } from "./router-D_jP4Uwb.js";
import { i as useDelay, n as useFocusTrap, r as makeDelayProps, t as makeFocusTrapProps } from "./focusTrap-rHoJd0qS.js";
import { n as useLazy, t as makeLazyProps } from "./lazy-DhsobH97.js";
import { t as useScopeId } from "./scopeId-CyMkmyzM.js";
import "/Users/thackmaster/Development/routie2/frontend/node_modules/vuetify/lib/components/VOverlay/VOverlay.css";
//#region node_modules/vuetify/lib/util/bindProps.js
var handlers = /* @__PURE__ */ new WeakMap();
function bindProps(el, props) {
Object.keys(props).forEach((k) => {
if (isOn(k)) {
const name = eventName(k);
const handler = handlers.get(el);
if (props[k] == null) handler?.forEach((v) => {
const [n, fn] = v;
if (n === name) {
el.removeEventListener(name, fn);
handler.delete(v);
}
});
else if (!handler || ![...handler]?.some((v) => v[0] === name && v[1] === props[k])) {
el.addEventListener(name, props[k]);
const _handler = handler || /* @__PURE__ */ new Set();
_handler.add([name, props[k]]);
if (!handlers.has(el)) handlers.set(el, _handler);
}
} else if (props[k] == null) el.removeAttribute(k);
else el.setAttribute(k, props[k]);
});
}
function unbindProps(el, props) {
Object.keys(props).forEach((k) => {
if (isOn(k)) {
const name = eventName(k);
const handler = handlers.get(el);
handler?.forEach((v) => {
const [n, fn] = v;
if (n === name) {
el.removeEventListener(name, fn);
handler.delete(v);
}
});
} else el.removeAttribute(k);
});
}
//#endregion
//#region node_modules/vuetify/lib/util/dom.js
/**
* Returns:
* - 'null' if the node is not attached to the DOM
* - the root node (HTMLDocument | ShadowRoot) otherwise
*/
function attachedRoot(node) {
/* istanbul ignore next */
if (typeof node.getRootNode !== "function") {
while (node.parentNode) node = node.parentNode;
if (node !== document) return null;
return document;
}
const root = node.getRootNode();
if (root !== document && root.getRootNode({ composed: true }) !== document) return null;
return root;
}
//#endregion
//#region node_modules/vuetify/lib/util/isFixedPosition.js
function isFixedPosition(el) {
while (el) {
if (window.getComputedStyle(el).position === "fixed") return true;
el = el.offsetParent;
}
return false;
}
//#endregion
//#region node_modules/vuetify/lib/components/VOverlay/util/point.js
/** Convert a point in local space to viewport space */
function elementToViewport(point, offset) {
return {
x: point.x + offset.x,
y: point.y + offset.y
};
}
/** Get the difference between two points */
function getOffset(a, b) {
return {
x: a.x - b.x,
y: a.y - b.y
};
}
/** Convert an anchor object to a point in local space */
function anchorToPoint(anchor, box) {
if (anchor.side === "top" || anchor.side === "bottom") {
const { side, align } = anchor;
return elementToViewport({
x: align === "left" ? 0 : align === "center" ? box.width / 2 : align === "right" ? box.width : align,
y: side === "top" ? 0 : side === "bottom" ? box.height : side
}, box);
} else if (anchor.side === "left" || anchor.side === "right") {
const { side, align } = anchor;
return elementToViewport({
x: side === "left" ? 0 : side === "right" ? box.width : side,
y: align === "top" ? 0 : align === "center" ? box.height / 2 : align === "bottom" ? box.height : align
}, box);
}
return elementToViewport({
x: box.width / 2,
y: box.height / 2
}, box);
}
//#endregion
//#region node_modules/vuetify/lib/components/VOverlay/locationStrategies.js
var locationStrategies = {
static: staticLocationStrategy,
connected: connectedLocationStrategy
};
var makeLocationStrategyProps = propsFactory({
locationStrategy: {
type: [String, Function],
default: "static",
validator: (val) => typeof val === "function" || val in locationStrategies
},
location: {
type: String,
default: "bottom"
},
origin: {
type: String,
default: "auto"
},
offset: [
Number,
String,
Array
],
stickToTarget: Boolean,
viewportMargin: {
type: [Number, String],
default: 12
}
}, "VOverlay-location-strategies");
function useLocationStrategies(props, data) {
const contentStyles = ref({});
const updateLocation = ref();
if (IN_BROWSER) useToggleScope(() => !!(data.isActive.value && props.locationStrategy), (reset) => {
watch(() => props.locationStrategy, reset);
onScopeDispose(() => {
window.removeEventListener("resize", onResize);
visualViewport?.removeEventListener("resize", onVisualResize);
visualViewport?.removeEventListener("scroll", onVisualScroll);
updateLocation.value = void 0;
});
window.addEventListener("resize", onResize, { passive: true });
visualViewport?.addEventListener("resize", onVisualResize, { passive: true });
visualViewport?.addEventListener("scroll", onVisualScroll, { passive: true });
if (typeof props.locationStrategy === "function") updateLocation.value = props.locationStrategy(data, props, contentStyles)?.updateLocation;
else updateLocation.value = locationStrategies[props.locationStrategy](data, props, contentStyles)?.updateLocation;
});
function onResize(e) {
updateLocation.value?.(e);
}
function onVisualResize(e) {
updateLocation.value?.(e);
}
function onVisualScroll(e) {
updateLocation.value?.(e);
}
return {
contentStyles,
updateLocation
};
}
function staticLocationStrategy() {}
/** Get size of element ignoring max-width/max-height */
function getIntrinsicSize(el, isRtl) {
const contentBox = nullifyTransforms(el);
if (isRtl) contentBox.x += parseFloat(el.style.right || 0);
else contentBox.x -= parseFloat(el.style.left || 0);
contentBox.y -= parseFloat(el.style.top || 0);
return contentBox;
}
function connectedLocationStrategy(data, props, contentStyles) {
if (Array.isArray(data.target.value) || isFixedPosition(data.target.value)) Object.assign(contentStyles.value, {
position: "fixed",
top: 0,
[data.isRtl.value ? "right" : "left"]: 0
});
const { preferredAnchor, preferredOrigin } = destructComputed(() => {
const parsedAnchor = parseAnchor(props.location, data.isRtl.value);
const parsedOrigin = props.origin === "overlap" ? parsedAnchor : props.origin === "auto" ? flipSide(parsedAnchor) : parseAnchor(props.origin, data.isRtl.value);
if (parsedAnchor.side === parsedOrigin.side && parsedAnchor.align === flipAlign(parsedOrigin).align) return {
preferredAnchor: flipCorner(parsedAnchor),
preferredOrigin: flipCorner(parsedOrigin)
};
else return {
preferredAnchor: parsedAnchor,
preferredOrigin: parsedOrigin
};
});
const [minWidth, minHeight, maxWidth, maxHeight] = [
"minWidth",
"minHeight",
"maxWidth",
"maxHeight"
].map((key) => {
return computed(() => {
const val = parseFloat(props[key]);
return isNaN(val) ? Infinity : val;
});
});
const offset = computed(() => {
if (Array.isArray(props.offset)) return props.offset;
if (typeof props.offset === "string") {
const offset = props.offset.split(" ").map(parseFloat);
if (offset.length < 2) offset.push(0);
return offset;
}
return typeof props.offset === "number" ? [props.offset, 0] : [0, 0];
});
let observe = false;
let lastFrame = -1;
const flipped = new CircularBuffer(4);
const observer = new ResizeObserver(() => {
if (!observe) return;
requestAnimationFrame((newTime) => {
if (newTime !== lastFrame) flipped.clear();
requestAnimationFrame((newNewTime) => {
lastFrame = newNewTime;
});
});
if (flipped.isFull) {
const values = flipped.values();
if (deepEqual(values.at(-1), values.at(-3)) && !deepEqual(values.at(-1), values.at(-2))) return;
}
const result = updateLocation();
if (result) flipped.push(result.flipped);
});
let targetBox = new Box({
x: 0,
y: 0,
width: 0,
height: 0
});
watch(data.target, (newTarget, oldTarget) => {
if (oldTarget && !Array.isArray(oldTarget)) observer.unobserve(oldTarget);
if (!Array.isArray(newTarget)) {
if (newTarget) observer.observe(newTarget);
} else if (!deepEqual(newTarget, oldTarget)) updateLocation();
}, { immediate: true });
watch(data.contentEl, (newContentEl, oldContentEl) => {
if (oldContentEl) observer.unobserve(oldContentEl);
if (newContentEl) observer.observe(newContentEl);
}, { immediate: true });
onScopeDispose(() => {
observer.disconnect();
});
function updateLocation() {
observe = false;
requestAnimationFrame(() => observe = true);
if (!data.target.value || !data.contentEl.value) return;
if (Array.isArray(data.target.value) || data.target.value.offsetParent || data.target.value.getClientRects().length) targetBox = getTargetBox(data.target.value);
const contentBox = getIntrinsicSize(data.contentEl.value, data.isRtl.value);
const scrollParents = getScrollParents(data.contentEl.value);
const viewportMargin = Number(props.viewportMargin);
if (!scrollParents.length) {
scrollParents.push(document.documentElement);
if (!(data.contentEl.value.style.top && data.contentEl.value.style.left)) {
contentBox.x -= parseFloat(document.documentElement.style.getPropertyValue("--v-body-scroll-x") || 0);
contentBox.y -= parseFloat(document.documentElement.style.getPropertyValue("--v-body-scroll-y") || 0);
}
}
const viewport = scrollParents.reduce((box, el) => {
const scrollBox = getElementBox(el);
if (box) return new Box({
x: Math.max(box.left, scrollBox.left),
y: Math.max(box.top, scrollBox.top),
width: Math.min(box.right, scrollBox.right) - Math.max(box.left, scrollBox.left),
height: Math.min(box.bottom, scrollBox.bottom) - Math.max(box.top, scrollBox.top)
});
return scrollBox;
}, void 0);
if (props.stickToTarget) {
viewport.x += Math.min(viewportMargin, targetBox.x);
viewport.y += Math.min(viewportMargin, targetBox.y);
viewport.width = Math.max(viewport.width - viewportMargin * 2, targetBox.x + targetBox.width - viewportMargin);
viewport.height = Math.max(viewport.height - viewportMargin * 2, targetBox.y + targetBox.height - viewportMargin);
} else {
viewport.x += viewportMargin;
viewport.y += viewportMargin;
viewport.width -= viewportMargin * 2;
viewport.height -= viewportMargin * 2;
}
let placement = {
anchor: preferredAnchor.value,
origin: preferredOrigin.value
};
function checkOverflow(_placement) {
const box = new Box(contentBox);
let { x, y } = getOffset(anchorToPoint(_placement.anchor, targetBox), anchorToPoint(_placement.origin, box));
switch (_placement.anchor.side) {
case "top":
y -= offset.value[0];
break;
case "bottom":
y += offset.value[0];
break;
case "left":
x -= offset.value[0];
break;
case "right":
x += offset.value[0];
break;
}
switch (_placement.anchor.align) {
case "top":
y -= offset.value[1];
break;
case "bottom":
y += offset.value[1];
break;
case "left":
x -= offset.value[1];
break;
case "right":
x += offset.value[1];
break;
}
box.x += x;
box.y += y;
box.width = Math.min(box.width, maxWidth.value);
box.height = Math.min(box.height, maxHeight.value);
return {
overflows: getOverflow(box, viewport),
x,
y
};
}
let x = 0;
let y = 0;
const available = {
x: 0,
y: 0
};
const flipped = {
x: false,
y: false
};
let resets = -1;
while (true) {
if (resets++ > 10) {
consoleError("Infinite loop detected in connectedLocationStrategy");
break;
}
const { x: _x, y: _y, overflows } = checkOverflow(placement);
x += _x;
y += _y;
contentBox.x += _x;
contentBox.y += _y;
{
const axis = getAxis(placement.anchor);
const hasOverflowX = overflows.x.before || overflows.x.after;
const hasOverflowY = overflows.y.before || overflows.y.after;
let reset = false;
["x", "y"].forEach((key) => {
if (key === "x" && hasOverflowX && !flipped.x || key === "y" && hasOverflowY && !flipped.y) {
const newPlacement = {
anchor: { ...placement.anchor },
origin: { ...placement.origin }
};
const flip = key === "x" ? axis === "y" ? flipAlign : flipSide : axis === "y" ? flipSide : flipAlign;
newPlacement.anchor = flip(newPlacement.anchor);
newPlacement.origin = flip(newPlacement.origin);
const { overflows: newOverflows } = checkOverflow(newPlacement);
if (newOverflows[key].before <= overflows[key].before && newOverflows[key].after <= overflows[key].after || newOverflows[key].before + newOverflows[key].after < (overflows[key].before + overflows[key].after) / 2) {
placement = newPlacement;
reset = flipped[key] = true;
}
}
});
if (reset) continue;
}
if (overflows.x.before) {
x += overflows.x.before;
contentBox.x += overflows.x.before;
}
if (overflows.x.after) {
x -= overflows.x.after;
contentBox.x -= overflows.x.after;
}
if (overflows.y.before) {
y += overflows.y.before;
contentBox.y += overflows.y.before;
}
if (overflows.y.after) {
y -= overflows.y.after;
contentBox.y -= overflows.y.after;
}
{
const overflows = getOverflow(contentBox, viewport);
available.x = viewport.width - overflows.x.before - overflows.x.after;
available.y = viewport.height - overflows.y.before - overflows.y.after;
x += overflows.x.before;
contentBox.x += overflows.x.before;
y += overflows.y.before;
contentBox.y += overflows.y.before;
}
break;
}
const axis = getAxis(placement.anchor);
Object.assign(contentStyles.value, {
"--v-overlay-anchor-origin": `${placement.anchor.side} ${placement.anchor.align}`,
transformOrigin: `${placement.origin.side} ${placement.origin.align}`,
top: convertToUnit(pixelRound(y)),
left: data.isRtl.value ? void 0 : convertToUnit(pixelRound(x)),
right: data.isRtl.value ? convertToUnit(pixelRound(-x)) : void 0,
minWidth: convertToUnit(axis === "y" ? Math.min(minWidth.value, targetBox.width) : minWidth.value),
maxWidth: convertToUnit(pixelCeil(clamp(available.x, minWidth.value === Infinity ? 0 : minWidth.value, maxWidth.value))),
maxHeight: convertToUnit(pixelCeil(clamp(available.y, minHeight.value === Infinity ? 0 : minHeight.value, maxHeight.value)))
});
return {
available,
contentBox,
flipped
};
}
watch(() => [
preferredAnchor.value,
preferredOrigin.value,
props.offset,
props.minWidth,
props.minHeight,
props.maxWidth,
props.maxHeight
], () => updateLocation());
nextTick(() => {
const result = updateLocation();
if (!result) return;
const { available, contentBox } = result;
if (contentBox.height > available.y) requestAnimationFrame(() => {
updateLocation();
requestAnimationFrame(() => {
updateLocation();
});
});
});
return { updateLocation };
}
function pixelRound(val) {
return Math.round(val * devicePixelRatio) / devicePixelRatio;
}
function pixelCeil(val) {
return Math.ceil(val * devicePixelRatio) / devicePixelRatio;
}
//#endregion
//#region node_modules/vuetify/lib/components/VOverlay/requestNewFrame.js
var clean = true;
var frames = [];
/**
* Schedule a task to run in an animation frame on its own
* This is useful for heavy tasks that may cause jank if all ran together
*/
function requestNewFrame(cb) {
if (!clean || frames.length) {
frames.push(cb);
run();
} else {
clean = false;
cb();
run();
}
}
var raf = -1;
function run() {
cancelAnimationFrame(raf);
raf = requestAnimationFrame(() => {
const frame = frames.shift();
if (frame) frame();
if (frames.length) run();
else clean = true;
});
}
//#endregion
//#region node_modules/vuetify/lib/components/VOverlay/scrollStrategies.js
var scrollStrategies = {
none: null,
close: closeScrollStrategy,
block: blockScrollStrategy,
reposition: repositionScrollStrategy
};
var makeScrollStrategyProps = propsFactory({ scrollStrategy: {
type: [String, Function],
default: "block",
validator: (val) => typeof val === "function" || val in scrollStrategies
} }, "VOverlay-scroll-strategies");
function useScrollStrategies(props, data) {
if (!IN_BROWSER) return;
let scope;
watchEffect(async () => {
scope?.stop();
if (!(data.isActive.value && props.scrollStrategy)) return;
scope = effectScope();
await new Promise((resolve) => setTimeout(resolve));
scope.active && scope.run(() => {
if (typeof props.scrollStrategy === "function") props.scrollStrategy(data, props, scope);
else scrollStrategies[props.scrollStrategy]?.(data, props, scope);
});
});
onScopeDispose(() => {
scope?.stop();
});
}
function closeScrollStrategy(data) {
function onScroll(e) {
data.isActive.value = false;
}
bindScroll(getTargetEl(data.target.value, data.contentEl.value), onScroll);
}
function blockScrollStrategy(data, props) {
const offsetParent = data.root.value?.offsetParent;
const target = getTargetEl(data.target.value, data.contentEl.value);
const scrollElements = [...new Set([...getScrollParents(target, props.contained ? offsetParent : void 0), ...getScrollParents(data.contentEl.value, props.contained ? offsetParent : void 0)])].filter((el) => !el.classList.contains("v-overlay-scroll-blocked"));
const scrollbarWidth = window.innerWidth - document.documentElement.offsetWidth;
const scrollableParent = ((el) => hasScrollbar(el) && el)(offsetParent || document.documentElement);
if (scrollableParent) data.root.value.classList.add("v-overlay--scroll-blocked");
scrollElements.forEach((el, i) => {
el.style.setProperty("--v-body-scroll-x", convertToUnit(-el.scrollLeft));
el.style.setProperty("--v-body-scroll-y", convertToUnit(-el.scrollTop));
if (el !== document.documentElement || getComputedStyle(el).overflowY !== "scroll") el.style.setProperty("--v-scrollbar-offset", convertToUnit(scrollbarWidth));
el.classList.add("v-overlay-scroll-blocked");
});
onScopeDispose(() => {
scrollElements.forEach((el, i) => {
const x = parseFloat(el.style.getPropertyValue("--v-body-scroll-x"));
const y = parseFloat(el.style.getPropertyValue("--v-body-scroll-y"));
const scrollBehavior = el.style.scrollBehavior;
el.style.scrollBehavior = "auto";
el.style.removeProperty("--v-body-scroll-x");
el.style.removeProperty("--v-body-scroll-y");
el.style.removeProperty("--v-scrollbar-offset");
el.classList.remove("v-overlay-scroll-blocked");
el.scrollLeft = -x;
el.scrollTop = -y;
el.style.scrollBehavior = scrollBehavior;
});
if (scrollableParent) data.root.value.classList.remove("v-overlay--scroll-blocked");
});
}
function repositionScrollStrategy(data, props, scope) {
let slow = false;
let raf = -1;
let ric = -1;
function update(e) {
requestNewFrame(() => {
const start = performance.now();
data.updateLocation.value?.(e);
slow = (performance.now() - start) / (1e3 / 60) > 2;
});
}
ric = (typeof requestIdleCallback === "undefined" ? (cb) => cb() : requestIdleCallback)(() => {
scope.run(() => {
bindScroll(getTargetEl(data.target.value, data.contentEl.value), (e) => {
if (slow) {
cancelAnimationFrame(raf);
raf = requestAnimationFrame(() => {
raf = requestAnimationFrame(() => {
update(e);
});
});
} else update(e);
});
});
});
onScopeDispose(() => {
typeof cancelIdleCallback !== "undefined" && cancelIdleCallback(ric);
cancelAnimationFrame(raf);
});
}
function getTargetEl(target, contentEl) {
return Array.isArray(target) ? document.elementsFromPoint(...target).find((el) => !contentEl?.contains(el)) : target ?? contentEl;
}
function bindScroll(el, onScroll) {
const scrollElements = [document, ...getScrollParents(el)];
scrollElements.forEach((el) => {
el.addEventListener("scroll", onScroll, { passive: true });
});
onScopeDispose(() => {
scrollElements.forEach((el) => {
el.removeEventListener("scroll", onScroll);
});
});
}
//#endregion
//#region node_modules/vuetify/lib/components/VMenu/shared.js
var VMenuSymbol = Symbol.for("vuetify:v-menu");
//#endregion
//#region node_modules/vuetify/lib/components/VOverlay/useActivator.js
var makeActivatorProps = propsFactory({
target: [String, Object],
activator: [String, Object],
activatorProps: {
type: Object,
default: () => ({})
},
openOnClick: {
type: Boolean,
default: void 0
},
openOnHover: Boolean,
openOnFocus: {
type: Boolean,
default: void 0
},
closeOnContentClick: Boolean,
...makeDelayProps()
}, "VOverlay-activator");
function useActivator(props, { isActive, isTop, contentEl }) {
const vm = getCurrentInstance("useActivator");
const activatorEl = ref();
let isHovered = false;
let isFocused = false;
let firstEnter = true;
const openOnFocus = computed(() => props.openOnFocus || props.openOnFocus == null && props.openOnHover);
const openOnClick = computed(() => props.openOnClick || props.openOnClick == null && !props.openOnHover && !openOnFocus.value);
const { runOpenDelay, runCloseDelay } = useDelay(props, (value) => {
if (value === (props.openOnHover && isHovered || openOnFocus.value && isFocused) && !(props.openOnHover && isActive.value && !isTop.value)) {
if (isActive.value !== value) firstEnter = true;
isActive.value = value;
}
});
const cursorTarget = ref();
const availableEvents = {
onClick: (e) => {
e.stopPropagation();
activatorEl.value = e.currentTarget || e.target;
if (!isActive.value) cursorTarget.value = [e.clientX, e.clientY];
isActive.value = !isActive.value;
},
onMouseenter: (e) => {
isHovered = true;
activatorEl.value = e.currentTarget || e.target;
runOpenDelay();
},
onMouseleave: (e) => {
isHovered = false;
runCloseDelay();
},
onFocus: (e) => {
if (matchesSelector(e.target, ":focus-visible") === false) return;
isFocused = true;
e.stopPropagation();
activatorEl.value = e.currentTarget || e.target;
runOpenDelay();
},
onBlur: (e) => {
isFocused = false;
e.stopPropagation();
runCloseDelay({ minDelay: 1 });
}
};
const activatorEvents = computed(() => {
const events = {};
if (openOnClick.value) events.onClick = availableEvents.onClick;
if (props.openOnHover) {
events.onMouseenter = availableEvents.onMouseenter;
events.onMouseleave = availableEvents.onMouseleave;
}
if (openOnFocus.value) {
events.onFocus = availableEvents.onFocus;
events.onBlur = availableEvents.onBlur;
}
return events;
});
const contentEvents = computed(() => {
const events = {};
if (props.openOnHover) {
events.onMouseenter = () => {
isHovered = true;
runOpenDelay();
};
events.onMouseleave = () => {
isHovered = false;
runCloseDelay();
};
}
if (openOnFocus.value) {
events.onFocusin = (e) => {
if (!e.target.matches(":focus-visible")) return;
isFocused = true;
runOpenDelay();
};
events.onFocusout = () => {
isFocused = false;
runCloseDelay({ minDelay: 1 });
};
}
if (props.closeOnContentClick) {
const menu = inject(VMenuSymbol, null);
events.onClick = () => {
isActive.value = false;
menu?.closeParents();
};
}
return events;
});
const scrimEvents = computed(() => {
const events = {};
if (props.openOnHover) {
events.onMouseenter = () => {
if (firstEnter) {
isHovered = true;
firstEnter = false;
runOpenDelay();
}
};
events.onMouseleave = () => {
isHovered = false;
runCloseDelay();
};
}
return events;
});
watch(isTop, (val) => {
if (val && (props.openOnHover && !isHovered && (!openOnFocus.value || !isFocused) || openOnFocus.value && !isFocused && (!props.openOnHover || !isHovered)) && !contentEl.value?.contains(document.activeElement)) runCloseDelay();
});
watch(isActive, (val) => {
if (!val) setTimeout(() => {
cursorTarget.value = void 0;
});
}, { flush: "post" });
const activatorRef = templateRef();
watchEffect(() => {
if (!activatorRef.value) return;
nextTick(() => {
activatorEl.value = activatorRef.el;
});
});
const targetRef = templateRef();
const target = computed(() => {
if (props.target === "cursor" && cursorTarget.value) return cursorTarget.value;
if (targetRef.value) return targetRef.el;
return getTarget(props.target, vm) || activatorEl.value;
});
const targetEl = computed(() => {
return Array.isArray(target.value) ? void 0 : target.value;
});
let scope;
watch(() => !!props.activator, (val) => {
if (val && IN_BROWSER) {
scope = effectScope();
scope.run(() => {
_useActivator(props, vm, {
activatorEl,
activatorEvents
});
});
} else if (scope) scope.stop();
}, {
flush: "post",
immediate: true
});
onScopeDispose(() => {
scope?.stop();
});
return {
activatorEl,
activatorRef,
target,
targetEl,
targetRef,
activatorEvents,
contentEvents,
scrimEvents
};
}
function _useActivator(props, vm, { activatorEl, activatorEvents }) {
watch(() => props.activator, (val, oldVal) => {
if (oldVal && val !== oldVal) {
const activator = getActivator(oldVal);
activator && unbindActivatorProps(activator);
}
if (val) nextTick(() => bindActivatorProps());
}, { immediate: true });
watch(() => props.activatorProps, () => {
bindActivatorProps();
});
onScopeDispose(() => {
unbindActivatorProps();
});
function bindActivatorProps(el = getActivator(), _props = props.activatorProps) {
if (!el) return;
bindProps(el, mergeProps(activatorEvents.value, _props));
}
function unbindActivatorProps(el = getActivator(), _props = props.activatorProps) {
if (!el) return;
unbindProps(el, mergeProps(activatorEvents.value, _props));
}
function getActivator(selector = props.activator) {
const activator = getTarget(selector, vm);
activatorEl.value = activator?.nodeType === Node.ELEMENT_NODE ? activator : void 0;
return activatorEl.value;
}
}
function getTarget(selector, vm) {
if (!selector) return;
let target;
if (selector === "parent") {
let el = vm?.proxy?.$el?.parentNode;
while (el?.hasAttribute("data-no-activator")) el = el.parentNode;
target = el;
} else if (typeof selector === "string") target = document.querySelector(selector);
else if ("$el" in selector) target = selector.$el;
else target = selector;
return target;
}
//#endregion
//#region node_modules/vuetify/lib/composables/hydration.js
function useHydration() {
if (!IN_BROWSER) return shallowRef(false);
const { ssr } = useDisplay();
if (ssr) {
const isMounted = shallowRef(false);
onMounted(() => {
isMounted.value = true;
});
return isMounted;
} else return shallowRef(true);
}
//#endregion
//#region node_modules/vuetify/lib/composables/stack.js
var StackSymbol = Symbol.for("vuetify:stack");
var globalStack = reactive([]);
function useStack(isActive, zIndex, disableGlobalStack) {
const vm = getCurrentInstance("useStack");
const createStackEntry = !disableGlobalStack;
const parent = inject(StackSymbol, void 0);
const stack = reactive({ activeChildren: /* @__PURE__ */ new Set() });
provide(StackSymbol, stack);
const _zIndex = shallowRef(Number(toValue(zIndex)));
useToggleScope(isActive, () => {
const lastZIndex = globalStack.at(-1)?.[1];
_zIndex.value = lastZIndex ? lastZIndex + 10 : Number(toValue(zIndex));
if (createStackEntry) globalStack.push([vm.uid, _zIndex.value]);
parent?.activeChildren.add(vm.uid);
onScopeDispose(() => {
if (createStackEntry) {
const idx = toRaw(globalStack).findIndex((v) => v[0] === vm.uid);
globalStack.splice(idx, 1);
}
parent?.activeChildren.delete(vm.uid);
});
});
const globalTop = shallowRef(true);
if (createStackEntry) watchEffect(() => {
const _isTop = globalStack.at(-1)?.[0] === vm.uid;
setTimeout(() => globalTop.value = _isTop);
});
const localTop = toRef(() => !stack.activeChildren.size);
return {
globalTop: readonly(globalTop),
localTop,
stackStyles: toRef(() => ({ zIndex: _zIndex.value }))
};
}
//#endregion
//#region node_modules/vuetify/lib/composables/teleport.js
function useTeleport(target) {
return { teleportTarget: computed(() => {
const _target = target();
if (_target === true || !IN_BROWSER) return void 0;
const targetElement = _target === false ? document.body : typeof _target === "string" ? document.querySelector(_target) : _target;
if (targetElement == null) {
warn(`Unable to locate target ${_target}`);
return;
}
let container = [...targetElement.children].find((el) => el.matches(".v-overlay-container"));
if (!container) {
container = document.createElement("div");
container.className = "v-overlay-container";
targetElement.appendChild(container);
}
return container;
}) };
}
//#endregion
//#region node_modules/vuetify/lib/directives/click-outside/index.js
function defaultConditional() {
return true;
}
function checkEvent(e, el, binding) {
if (!e || checkIsActive(e, binding) === false) return false;
const root = attachedRoot(el);
if (typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot && root.host === e.target) return false;
const elements = (typeof binding.value === "object" && binding.value.include || (() => []))();
elements.push(el);
return !elements.some((el) => el?.contains(e.target));
}
function checkIsActive(e, binding) {
return (typeof binding.value === "object" && binding.value.closeConditional || defaultConditional)(e);
}
function directive(e, el, binding) {
const handler = typeof binding.value === "function" ? binding.value : binding.value.handler;
e.shadowTarget = e.target;
el._clickOutside.lastMousedownWasOutside && checkEvent(e, el, binding) && setTimeout(() => {
checkIsActive(e, binding) && handler && handler(e);
}, 0);
}
function handleShadow(el, callback) {
const root = attachedRoot(el);
callback(document);
if (typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot) callback(root);
}
var ClickOutside = {
mounted(el, binding) {
const onClick = (e) => directive(e, el, binding);
const onMousedown = (e) => {
el._clickOutside.lastMousedownWasOutside = checkEvent(e, el, binding);
};
handleShadow(el, (app) => {
app.addEventListener("click", onClick, true);
app.addEventListener("mousedown", onMousedown, true);
});
if (!el._clickOutside) el._clickOutside = { lastMousedownWasOutside: false };
el._clickOutside[binding.instance.$.uid] = {
onClick,
onMousedown
};
},
beforeUnmount(el, binding) {
if (!el._clickOutside) return;
handleShadow(el, (app) => {
if (!app || !el._clickOutside?.[binding.instance.$.uid]) return;
const { onClick, onMousedown } = el._clickOutside[binding.instance.$.uid];
app.removeEventListener("click", onClick, true);
app.removeEventListener("mousedown", onMousedown, true);
});
delete el._clickOutside[binding.instance.$.uid];
}
};
//#endregion
//#region node_modules/vuetify/lib/components/VOverlay/VOverlay.js
function Scrim(props) {
const { modelValue, color, ...rest } = props;
return createVNode(Transition, {
"name": "fade-transition",
"appear": true
}, { default: () => [props.modelValue && createBaseVNode("div", mergeProps({
"class": ["v-overlay__scrim", props.color.backgroundColorClasses.value],
"style": props.color.backgroundColorStyles.value
}, rest), null)] });
}
var makeVOverlayProps = propsFactory({
absolute: Boolean,
attach: [
Boolean,
String,
Object
],
closeOnBack: {
type: Boolean,
default: true
},
contained: Boolean,
contentClass: null,
contentProps: null,
disabled: Boolean,
opacity: [Number, String],
noClickAnimation: Boolean,
modelValue: Boolean,
persistent: Boolean,
scrim: {
type: [Boolean, String],
default: true
},
zIndex: {
type: [Number, String],
default: 2e3
},
...makeActivatorProps(),
...makeComponentProps(),
...makeDimensionProps(),
...makeLazyProps(),
...makeLocationStrategyProps(),
...makeScrollStrategyProps(),
...makeFocusTrapProps(),
...makeThemeProps(),
...makeTransitionProps()
}, "VOverlay");
var VOverlay = genericComponent()({
name: "VOverlay",
directives: { vClickOutside: ClickOutside },
inheritAttrs: false,
props: {
_disableGlobalStack: Boolean,
...omit(makeVOverlayProps(), ["disableInitialFocus"])
},
emits: {
"click:outside": (e) => true,
"update:modelValue": (value) => true,
keydown: (e) => true,
afterEnter: () => true,
afterLeave: () => true
},
setup(props, { slots, attrs, emit }) {
const vm = getCurrentInstance("VOverlay");
const root = ref();
const scrimEl = ref();
const contentEl = ref();
const model = useProxiedModel(props, "modelValue");
const isActive = computed({
get: () => model.value,
set: (v) => {
if (!(v && props.disabled)) model.value = v;
}
});
const { themeClasses } = provideTheme(props);
const { rtlClasses, isRtl } = useRtl();
const { hasContent, onAfterLeave: _onAfterLeave } = useLazy(props, isActive);
const scrimColor = useBackgroundColor(() => {
return typeof props.scrim === "string" ? props.scrim : null;
});
const { globalTop, localTop, stackStyles } = useStack(isActive, () => props.zIndex, props._disableGlobalStack);
const { activatorEl, activatorRef, target, targetEl, targetRef, activatorEvents, contentEvents, scrimEvents } = useActivator(props, {
isActive,
isTop: localTop,
contentEl
});
const { teleportTarget } = useTeleport(() => {
const target = props.attach || props.contained;
if (target) return target;
const rootNode = activatorEl?.value?.getRootNode() || vm.proxy?.$el?.getRootNode();
if (rootNode instanceof ShadowRoot) return rootNode;
return false;
});
const { dimensionStyles } = useDimension(props);
const isMounted = useHydration();
const { scopeId } = useScopeId();
watch(() => props.disabled, (v) => {
if (v) isActive.value = false;
});
const { contentStyles, updateLocation } = useLocationStrategies(props, {
isRtl,
contentEl,
target,
isActive
});
useScrollStrategies(props, {
root,
contentEl,
targetEl,
target,
isActive,
updateLocation
});
function onClickOutside(e) {
emit("click:outside", e);
if (!props.persistent) isActive.value = false;
else animateClick();
}
function closeConditional(e) {
return isActive.value && localTop.value && (!props.scrim || e.target === scrimEl.value || e instanceof MouseEvent && e.shadowTarget === scrimEl.value);
}
useFocusTrap(props, {
isActive,
localTop,
contentEl,
activatorEl
});
IN_BROWSER && watch(isActive, (val) => {
if (val) window.addEventListener("keydown", onKeydown);
else window.removeEventListener("keydown", onKeydown);
}, { immediate: true });
onBeforeUnmount(() => {
if (!IN_BROWSER) return;
window.removeEventListener("keydown", onKeydown);
});
function onKeydown(e) {
if (e.key === "Escape" && globalTop.value) {
if (!contentEl.value?.contains(document.activeElement)) emit("keydown", e);
if (!props.persistent) {
isActive.value = false;
if (contentEl.value?.contains(document.activeElement)) activatorEl.value?.focus();
} else animateClick();
}
}
function onKeydownSelf(e) {
if (e.key === "Escape" && !globalTop.value) return;
emit("keydown", e);
}
const router = useRouter();
useToggleScope(() => props.closeOnBack, () => {
useBackButton(router, () => {
if (globalTop.value && isActive.value) {
if (!props.persistent) isActive.value = false;
else animateClick();
return false;
}
});
});
const top = ref();
watch(() => isActive.value && (props.absolute || props.contained) && teleportTarget.value == null, (val) => {
if (val) {
const scrollParent = getScrollParent(root.value);
if (scrollParent && scrollParent !== document.scrollingElement) top.value = scrollParent.scrollTop;
}
});
function animateClick() {
if (props.noClickAnimation) return;
contentEl.value && animate(contentEl.value, [
{ transformOrigin: "center" },
{ transform: "scale(1.03)" },
{ transformOrigin: "center" }
], {
duration: 150,
easing: "cubic-bezier(0.4, 0, 0.2, 1)"
});
}
function onAfterEnter() {
emit("afterEnter");
}
function onAfterLeave() {
_onAfterLeave();
emit("afterLeave");
}
useRender(() => createBaseVNode(Fragment, null, [slots.activator?.({
isActive: isActive.value,
targetRef,
props: mergeProps({ ref: activatorRef }, activatorEvents.value, props.activatorProps)
}), isMounted.value && hasContent.value && createVNode(Teleport, {
"disabled": !teleportTarget.value,
"to": teleportTarget.value
}, { default: () => [createBaseVNode("div", mergeProps({
"class": [
"v-overlay",
{
"v-overlay--absolute": props.absolute || props.contained,
"v-overlay--active": isActive.value,
"v-overlay--contained": props.contained
},
themeClasses.value,
rtlClasses.value,
props.class
],
"style": [
stackStyles.value,
{
"--v-overlay-opacity": props.opacity,
top: convertToUnit(top.value)
},
props.style
],
"ref": root,
"onKeydown": onKeydownSelf
}, scopeId, attrs), [createVNode(Scrim, mergeProps({
"color": scrimColor,
"modelValue": isActive.value && !!props.scrim,
"ref": scrimEl
}, scrimEvents.value), null), createVNode(MaybeTransition, {
"appear": true,
"persisted": true,
"transition": props.transition,
"target": target.value,
"onAfterEnter": onAfterEnter,
"onAfterLeave": onAfterLeave
}, { default: () => [withDirectives(createBaseVNode("div", mergeProps({
"ref": contentEl,
"class": ["v-overlay__content", props.contentClass],
"style": [dimensionStyles.value, contentStyles.value]
}, contentEvents.value, props.contentProps), [slots.default?.({ isActive })]), [[vShow, isActive.value], [ClickOutside, {
handler: onClickOutside,
closeConditional,
include: () => [activatorEl.value]
}]])] })])] })]));
return {
activatorEl,
scrimEl,
target,
animateClick,
contentEl,
rootEl: root,
globalTop,
localTop,
updateLocation
};
}
});
//#endregion
export { makeVOverlayProps as n, VMenuSymbol as r, VOverlay as t };
//# sourceMappingURL=VOverlay-BS8OrX3g.js.map