timepick-kit-react
Version:
A flexible timepicker kit for react
1,722 lines • 260 kB
JavaScript
import { jsx as B, jsxs as fn } from "react/jsx-runtime";
import * as tt from "react";
import pi, { createContext as Ft, useLayoutEffect as ns, useEffect as It, useContext as H, useRef as et, useInsertionEffect as gi, useCallback as Y, useMemo as X, forwardRef as Be, createElement as hn, useId as je, useState as ue, cloneElement as mn, Children as rs, isValidElement as vi, memo as ce } from "react";
const yi = Ft({
transformPagePoint: (t) => t,
isStatic: !1,
reducedMotion: "never"
}), Ne = Ft({}), Ue = Ft(null), We = typeof document < "u", kn = We ? ns : It, bi = Ft({ strict: !1 }), En = (t) => t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), is = "framerAppearId", wi = "data-" + En(is);
function os(t, e, n, r) {
const { visualElement: i } = H(Ne), s = H(bi), o = H(Ue), a = H(yi).reducedMotion, l = et();
r = r || s.renderer, !l.current && r && (l.current = r(t, {
visualState: e,
parent: i,
props: n,
presenceContext: o,
blockInitialAnimation: o ? o.initial === !1 : !1,
reducedMotionConfig: a
}));
const u = l.current;
gi(() => {
u && u.update(n, o);
});
const c = et(!!(n[wi] && !window.HandoffComplete));
return kn(() => {
u && (u.render(), c.current && u.animationState && u.animationState.animateChanges());
}), It(() => {
u && (u.updateFeatures(), !c.current && u.animationState && u.animationState.animateChanges(), c.current && (c.current = !1, window.HandoffComplete = !0));
}), u;
}
function Wt(t) {
return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
}
function ss(t, e, n) {
return Y(
(r) => {
r && t.mount && t.mount(r), e && (r ? e.mount(r) : e.unmount()), n && (typeof n == "function" ? n(r) : Wt(n) && (n.current = r));
},
/**
* Only pass a new ref callback to React if we've received a visual element
* factory. Otherwise we'll be mounting/remounting every time externalRef
* or other dependencies change.
*/
[e]
);
}
function se(t) {
return typeof t == "string" || Array.isArray(t);
}
function $e(t) {
return t !== null && typeof t == "object" && typeof t.start == "function";
}
const On = [
"animate",
"whileInView",
"whileFocus",
"whileHover",
"whileTap",
"whileDrag",
"exit"
], Rn = ["initial", ...On];
function ze(t) {
return $e(t.animate) || Rn.some((e) => se(t[e]));
}
function xi(t) {
return !!(ze(t) || t.variants);
}
function as(t, e) {
if (ze(t)) {
const { initial: n, animate: r } = t;
return {
initial: n === !1 || se(n) ? n : void 0,
animate: se(r) ? r : void 0
};
}
return t.inherit !== !1 ? e : {};
}
function ls(t) {
const { initial: e, animate: n } = as(t, H(Ne));
return X(() => ({ initial: e, animate: n }), [rr(e), rr(n)]);
}
function rr(t) {
return Array.isArray(t) ? t.join(" ") : t;
}
const ir = {
animation: [
"animate",
"variants",
"whileHover",
"whileTap",
"exit",
"whileInView",
"whileFocus",
"whileDrag"
],
exit: ["exit"],
drag: ["drag", "dragControls"],
focus: ["whileFocus"],
hover: ["whileHover", "onHoverStart", "onHoverEnd"],
tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
layout: ["layout", "layoutId"]
}, ae = {};
for (const t in ir)
ae[t] = {
isEnabled: (e) => ir[t].some((n) => !!e[n])
};
function us(t) {
for (const e in t)
ae[e] = {
...ae[e],
...t[e]
};
}
const Ln = Ft({}), Ti = Ft({}), cs = Symbol.for("motionComponentSymbol");
function ds({ preloadedFeatures: t, createVisualElement: e, useRender: n, useVisualState: r, Component: i }) {
t && us(t);
function s(a, l) {
let u;
const c = {
...H(yi),
...a,
layoutId: fs(a)
}, { isStatic: d } = c, f = ls(a), h = r(a, d);
if (!d && We) {
f.visualElement = os(i, h, c, e);
const m = H(Ti), p = H(bi).strict;
f.visualElement && (u = f.visualElement.loadFeatures(
// Note: Pass the full new combined props to correctly re-render dynamic feature components.
c,
p,
t,
m
));
}
return tt.createElement(
Ne.Provider,
{ value: f },
u && f.visualElement ? tt.createElement(u, { visualElement: f.visualElement, ...c }) : null,
n(i, a, ss(h, f.visualElement, l), h, d, f.visualElement)
);
}
const o = Be(s);
return o[cs] = i, o;
}
function fs({ layoutId: t }) {
const e = H(Ln).id;
return e && t !== void 0 ? e + "-" + t : t;
}
function hs(t) {
function e(r, i = {}) {
return ds(t(r, i));
}
if (typeof Proxy > "u")
return e;
const n = /* @__PURE__ */ new Map();
return new Proxy(e, {
/**
* Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
* The prop name is passed through as `key` and we can use that to generate a `motion`
* DOM component with that name.
*/
get: (r, i) => (n.has(i) || n.set(i, e(i)), n.get(i))
});
}
const ms = [
"animate",
"circle",
"defs",
"desc",
"ellipse",
"g",
"image",
"line",
"filter",
"marker",
"mask",
"metadata",
"path",
"pattern",
"polygon",
"polyline",
"rect",
"stop",
"switch",
"symbol",
"svg",
"text",
"tspan",
"use",
"view"
];
function Fn(t) {
return (
/**
* If it's not a string, it's a custom React component. Currently we only support
* HTML custom React components.
*/
typeof t != "string" || /**
* If it contains a dash, the element is a custom HTML webcomponent.
*/
t.includes("-") ? !1 : (
/**
* If it's in our list of lowercase SVG tags, it's an SVG component
*/
!!(ms.indexOf(t) > -1 || /**
* If it contains a capital letter, it's an SVG component
*/
/[A-Z]/.test(t))
)
);
}
const Me = {};
function ps(t) {
Object.assign(Me, t);
}
const de = [
"transformPerspective",
"x",
"y",
"z",
"translateX",
"translateY",
"translateZ",
"scale",
"scaleX",
"scaleY",
"rotate",
"rotateX",
"rotateY",
"rotateZ",
"skew",
"skewX",
"skewY"
], Bt = new Set(de);
function Pi(t, { layout: e, layoutId: n }) {
return Bt.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!Me[t] || t === "opacity");
}
const nt = (t) => !!(t && t.getVelocity), gs = {
x: "translateX",
y: "translateY",
z: "translateZ",
transformPerspective: "perspective"
}, vs = de.length;
function ys(t, { enableHardwareAcceleration: e = !0, allowTransformNone: n = !0 }, r, i) {
let s = "";
for (let o = 0; o < vs; o++) {
const a = de[o];
if (t[a] !== void 0) {
const l = gs[a] || a;
s += `${l}(${t[a]}) `;
}
}
return e && !t.z && (s += "translateZ(0)"), s = s.trim(), i ? s = i(t, r ? "" : s) : n && r && (s = "none"), s;
}
const Ci = (t) => (e) => typeof e == "string" && e.startsWith(t), Si = Ci("--"), pn = Ci("var(--"), bs = /var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g, ws = (t, e) => e && typeof t == "number" ? e.transform(t) : t, Tt = (t, e, n) => Math.min(Math.max(n, t), e), jt = {
test: (t) => typeof t == "number",
parse: parseFloat,
transform: (t) => t
}, ne = {
...jt,
transform: (t) => Tt(0, 1, t)
}, ve = {
...jt,
default: 1
}, re = (t) => Math.round(t * 1e5) / 1e5, Ge = /(-)?([\d]*\.?[\d])+/g, Mi = /(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi, xs = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;
function fe(t) {
return typeof t == "string";
}
const he = (t) => ({
test: (e) => fe(e) && e.endsWith(t) && e.split(" ").length === 1,
parse: parseFloat,
transform: (e) => `${e}${t}`
}), yt = he("deg"), ct = he("%"), x = he("px"), Ts = he("vh"), Ps = he("vw"), or = {
...ct,
parse: (t) => ct.parse(t) / 100,
transform: (t) => ct.transform(t * 100)
}, sr = {
...jt,
transform: Math.round
}, Di = {
// Border props
borderWidth: x,
borderTopWidth: x,
borderRightWidth: x,
borderBottomWidth: x,
borderLeftWidth: x,
borderRadius: x,
radius: x,
borderTopLeftRadius: x,
borderTopRightRadius: x,
borderBottomRightRadius: x,
borderBottomLeftRadius: x,
// Positioning props
width: x,
maxWidth: x,
height: x,
maxHeight: x,
size: x,
top: x,
right: x,
bottom: x,
left: x,
// Spacing props
padding: x,
paddingTop: x,
paddingRight: x,
paddingBottom: x,
paddingLeft: x,
margin: x,
marginTop: x,
marginRight: x,
marginBottom: x,
marginLeft: x,
// Transform props
rotate: yt,
rotateX: yt,
rotateY: yt,
rotateZ: yt,
scale: ve,
scaleX: ve,
scaleY: ve,
scaleZ: ve,
skew: yt,
skewX: yt,
skewY: yt,
distance: x,
translateX: x,
translateY: x,
translateZ: x,
x,
y: x,
z: x,
perspective: x,
transformPerspective: x,
opacity: ne,
originX: or,
originY: or,
originZ: x,
// Misc
zIndex: sr,
// SVG
fillOpacity: ne,
strokeOpacity: ne,
numOctaves: sr
};
function In(t, e, n, r) {
const { style: i, vars: s, transform: o, transformOrigin: a } = t;
let l = !1, u = !1, c = !0;
for (const d in e) {
const f = e[d];
if (Si(d)) {
s[d] = f;
continue;
}
const h = Di[d], m = ws(f, h);
if (Bt.has(d)) {
if (l = !0, o[d] = m, !c)
continue;
f !== (h.default || 0) && (c = !1);
} else
d.startsWith("origin") ? (u = !0, a[d] = m) : i[d] = m;
}
if (e.transform || (l || r ? i.transform = ys(t.transform, n, c, r) : i.transform && (i.transform = "none")), u) {
const { originX: d = "50%", originY: f = "50%", originZ: h = 0 } = a;
i.transformOrigin = `${d} ${f} ${h}`;
}
}
const Bn = () => ({
style: {},
transform: {},
transformOrigin: {},
vars: {}
});
function Ai(t, e, n) {
for (const r in e)
!nt(e[r]) && !Pi(r, n) && (t[r] = e[r]);
}
function Cs({ transformTemplate: t }, e, n) {
return X(() => {
const r = Bn();
return In(r, e, { enableHardwareAcceleration: !n }, t), Object.assign({}, r.vars, r.style);
}, [e]);
}
function Ss(t, e, n) {
const r = t.style || {}, i = {};
return Ai(i, r, t), Object.assign(i, Cs(t, e, n)), t.transformValues ? t.transformValues(i) : i;
}
function Ms(t, e, n) {
const r = {}, i = Ss(t, e, n);
return t.drag && t.dragListener !== !1 && (r.draggable = !1, i.userSelect = i.WebkitUserSelect = i.WebkitTouchCallout = "none", i.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (r.tabIndex = 0), r.style = i, r;
}
const Ds = /* @__PURE__ */ new Set([
"animate",
"exit",
"variants",
"initial",
"style",
"values",
"variants",
"transition",
"transformTemplate",
"transformValues",
"custom",
"inherit",
"onBeforeLayoutMeasure",
"onAnimationStart",
"onAnimationComplete",
"onUpdate",
"onDragStart",
"onDrag",
"onDragEnd",
"onMeasureDragConstraints",
"onDirectionLock",
"onDragTransitionEnd",
"_dragX",
"_dragY",
"onHoverStart",
"onHoverEnd",
"onViewportEnter",
"onViewportLeave",
"globalTapTarget",
"ignoreStrict",
"viewport"
]);
function De(t) {
return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Ds.has(t);
}
let Vi = (t) => !De(t);
function As(t) {
t && (Vi = (e) => e.startsWith("on") ? !De(e) : t(e));
}
try {
As(require("@emotion/is-prop-valid").default);
} catch {
}
function Vs(t, e, n) {
const r = {};
for (const i in t)
i === "values" && typeof t.values == "object" || (Vi(i) || n === !0 && De(i) || !e && !De(i) || // If trying to use native HTML drag events, forward drag listeners
t.draggable && i.startsWith("onDrag")) && (r[i] = t[i]);
return r;
}
function ar(t, e, n) {
return typeof t == "string" ? t : x.transform(e + n * t);
}
function ks(t, e, n) {
const r = ar(e, t.x, t.width), i = ar(n, t.y, t.height);
return `${r} ${i}`;
}
const Es = {
offset: "stroke-dashoffset",
array: "stroke-dasharray"
}, Os = {
offset: "strokeDashoffset",
array: "strokeDasharray"
};
function Rs(t, e, n = 1, r = 0, i = !0) {
t.pathLength = 1;
const s = i ? Es : Os;
t[s.offset] = x.transform(-r);
const o = x.transform(e), a = x.transform(n);
t[s.array] = `${o} ${a}`;
}
function jn(t, {
attrX: e,
attrY: n,
attrScale: r,
originX: i,
originY: s,
pathLength: o,
pathSpacing: a = 1,
pathOffset: l = 0,
// This is object creation, which we try to avoid per-frame.
...u
}, c, d, f) {
if (In(t, u, c, f), d) {
t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
return;
}
t.attrs = t.style, t.style = {};
const { attrs: h, style: m, dimensions: p } = t;
h.transform && (p && (m.transform = h.transform), delete h.transform), p && (i !== void 0 || s !== void 0 || m.transform) && (m.transformOrigin = ks(p, i !== void 0 ? i : 0.5, s !== void 0 ? s : 0.5)), e !== void 0 && (h.x = e), n !== void 0 && (h.y = n), r !== void 0 && (h.scale = r), o !== void 0 && Rs(h, o, a, l, !1);
}
const ki = () => ({
...Bn(),
attrs: {}
}), Nn = (t) => typeof t == "string" && t.toLowerCase() === "svg";
function Ls(t, e, n, r) {
const i = X(() => {
const s = ki();
return jn(s, e, { enableHardwareAcceleration: !1 }, Nn(r), t.transformTemplate), {
...s.attrs,
style: { ...s.style }
};
}, [e]);
if (t.style) {
const s = {};
Ai(s, t.style, t), i.style = { ...s, ...i.style };
}
return i;
}
function Fs(t = !1) {
return (n, r, i, { latestValues: s }, o) => {
const l = (Fn(n) ? Ls : Ms)(r, s, o, n), c = {
...Vs(r, typeof n == "string", t),
...l,
ref: i
}, { children: d } = r, f = X(() => nt(d) ? d.get() : d, [d]);
return hn(n, {
...c,
children: f
});
};
}
function Ei(t, { style: e, vars: n }, r, i) {
Object.assign(t.style, e, i && i.getProjectionStyles(r));
for (const s in n)
t.style.setProperty(s, n[s]);
}
const Oi = /* @__PURE__ */ new Set([
"baseFrequency",
"diffuseConstant",
"kernelMatrix",
"kernelUnitLength",
"keySplines",
"keyTimes",
"limitingConeAngle",
"markerHeight",
"markerWidth",
"numOctaves",
"targetX",
"targetY",
"surfaceScale",
"specularConstant",
"specularExponent",
"stdDeviation",
"tableValues",
"viewBox",
"gradientTransform",
"pathLength",
"startOffset",
"textLength",
"lengthAdjust"
]);
function Ri(t, e, n, r) {
Ei(t, e, void 0, r);
for (const i in e.attrs)
t.setAttribute(Oi.has(i) ? i : En(i), e.attrs[i]);
}
function Un(t, e) {
const { style: n } = t, r = {};
for (const i in n)
(nt(n[i]) || e.style && nt(e.style[i]) || Pi(i, t)) && (r[i] = n[i]);
return r;
}
function Li(t, e) {
const n = Un(t, e);
for (const r in t)
if (nt(t[r]) || nt(e[r])) {
const i = de.indexOf(r) !== -1 ? "attr" + r.charAt(0).toUpperCase() + r.substring(1) : r;
n[i] = t[r];
}
return n;
}
function Wn(t, e, n, r = {}, i = {}) {
return typeof e == "function" && (e = e(n !== void 0 ? n : t.custom, r, i)), typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function" && (e = e(n !== void 0 ? n : t.custom, r, i)), e;
}
function Fi(t) {
const e = et(null);
return e.current === null && (e.current = t()), e.current;
}
const Ae = (t) => Array.isArray(t), Is = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), Bs = (t) => Ae(t) ? t[t.length - 1] || 0 : t;
function Ce(t) {
const e = nt(t) ? t.get() : t;
return Is(e) ? e.toValue() : e;
}
function js({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: n }, r, i, s) {
const o = {
latestValues: Ns(r, i, s, t),
renderState: e()
};
return n && (o.mount = (a) => n(r, a, o)), o;
}
const Ii = (t) => (e, n) => {
const r = H(Ne), i = H(Ue), s = () => js(t, e, r, i);
return n ? s() : Fi(s);
};
function Ns(t, e, n, r) {
const i = {}, s = r(t, {});
for (const f in s)
i[f] = Ce(s[f]);
let { initial: o, animate: a } = t;
const l = ze(t), u = xi(t);
e && u && !l && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate));
let c = n ? n.initial === !1 : !1;
c = c || o === !1;
const d = c ? a : o;
return d && typeof d != "boolean" && !$e(d) && (Array.isArray(d) ? d : [d]).forEach((h) => {
const m = Wn(t, h);
if (!m)
return;
const { transitionEnd: p, transition: y, ...b } = m;
for (const v in b) {
let g = b[v];
if (Array.isArray(g)) {
const w = c ? g.length - 1 : 0;
g = g[w];
}
g !== null && (i[v] = g);
}
for (const v in p)
i[v] = p[v];
}), i;
}
const W = (t) => t;
class lr {
constructor() {
this.order = [], this.scheduled = /* @__PURE__ */ new Set();
}
add(e) {
if (!this.scheduled.has(e))
return this.scheduled.add(e), this.order.push(e), !0;
}
remove(e) {
const n = this.order.indexOf(e);
n !== -1 && (this.order.splice(n, 1), this.scheduled.delete(e));
}
clear() {
this.order.length = 0, this.scheduled.clear();
}
}
function Us(t) {
let e = new lr(), n = new lr(), r = 0, i = !1, s = !1;
const o = /* @__PURE__ */ new WeakSet(), a = {
/**
* Schedule a process to run on the next frame.
*/
schedule: (l, u = !1, c = !1) => {
const d = c && i, f = d ? e : n;
return u && o.add(l), f.add(l) && d && i && (r = e.order.length), l;
},
/**
* Cancel the provided callback from running on the next frame.
*/
cancel: (l) => {
n.remove(l), o.delete(l);
},
/**
* Execute all schedule callbacks.
*/
process: (l) => {
if (i) {
s = !0;
return;
}
if (i = !0, [e, n] = [n, e], n.clear(), r = e.order.length, r)
for (let u = 0; u < r; u++) {
const c = e.order[u];
c(l), o.has(c) && (a.schedule(c), t());
}
i = !1, s && (s = !1, a.process(l));
}
};
return a;
}
const ye = [
"prepare",
"read",
"update",
"preRender",
"render",
"postRender"
], Ws = 40;
function $s(t, e) {
let n = !1, r = !0;
const i = {
delta: 0,
timestamp: 0,
isProcessing: !1
}, s = ye.reduce((d, f) => (d[f] = Us(() => n = !0), d), {}), o = (d) => s[d].process(i), a = () => {
const d = performance.now();
n = !1, i.delta = r ? 1e3 / 60 : Math.max(Math.min(d - i.timestamp, Ws), 1), i.timestamp = d, i.isProcessing = !0, ye.forEach(o), i.isProcessing = !1, n && e && (r = !1, t(a));
}, l = () => {
n = !0, r = !0, i.isProcessing || t(a);
};
return { schedule: ye.reduce((d, f) => {
const h = s[f];
return d[f] = (m, p = !1, y = !1) => (n || l(), h.schedule(m, p, y)), d;
}, {}), cancel: (d) => ye.forEach((f) => s[f].cancel(d)), state: i, steps: s };
}
const { schedule: F, cancel: pt, state: K, steps: Xe } = $s(typeof requestAnimationFrame < "u" ? requestAnimationFrame : W, !0), zs = {
useVisualState: Ii({
scrapeMotionValuesFromProps: Li,
createRenderState: ki,
onMount: (t, e, { renderState: n, latestValues: r }) => {
F.read(() => {
try {
n.dimensions = typeof e.getBBox == "function" ? e.getBBox() : e.getBoundingClientRect();
} catch {
n.dimensions = {
x: 0,
y: 0,
width: 0,
height: 0
};
}
}), F.render(() => {
jn(n, r, { enableHardwareAcceleration: !1 }, Nn(e.tagName), t.transformTemplate), Ri(e, n);
});
}
})
}, Gs = {
useVisualState: Ii({
scrapeMotionValuesFromProps: Un,
createRenderState: Bn
})
};
function _s(t, { forwardMotionProps: e = !1 }, n, r) {
return {
...Fn(t) ? zs : Gs,
preloadedFeatures: n,
useRender: Fs(e),
createVisualElement: r,
Component: t
};
}
function ft(t, e, n, r = { passive: !0 }) {
return t.addEventListener(e, n, r), () => t.removeEventListener(e, n);
}
const Bi = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1;
function _e(t, e = "page") {
return {
point: {
x: t[e + "X"],
y: t[e + "Y"]
}
};
}
const Ys = (t) => (e) => Bi(e) && t(e, _e(e));
function ht(t, e, n, r) {
return ft(t, e, Ys(n), r);
}
const Hs = (t, e) => (n) => e(t(n)), wt = (...t) => t.reduce(Hs);
function ji(t) {
let e = null;
return () => {
const n = () => {
e = null;
};
return e === null ? (e = t, n) : !1;
};
}
const ur = ji("dragHorizontal"), cr = ji("dragVertical");
function Ni(t) {
let e = !1;
if (t === "y")
e = cr();
else if (t === "x")
e = ur();
else {
const n = ur(), r = cr();
n && r ? e = () => {
n(), r();
} : (n && n(), r && r());
}
return e;
}
function Ui() {
const t = Ni(!0);
return t ? (t(), !1) : !0;
}
class St {
constructor(e) {
this.isMounted = !1, this.node = e;
}
update() {
}
}
function dr(t, e) {
const n = "pointer" + (e ? "enter" : "leave"), r = "onHover" + (e ? "Start" : "End"), i = (s, o) => {
if (s.pointerType === "touch" || Ui())
return;
const a = t.getProps();
t.animationState && a.whileHover && t.animationState.setActive("whileHover", e), a[r] && F.update(() => a[r](s, o));
};
return ht(t.current, n, i, {
passive: !t.getProps()[r]
});
}
class qs extends St {
mount() {
this.unmount = wt(dr(this.node, !0), dr(this.node, !1));
}
unmount() {
}
}
class Ks extends St {
constructor() {
super(...arguments), this.isActive = !1;
}
onFocus() {
let e = !1;
try {
e = this.node.current.matches(":focus-visible");
} catch {
e = !0;
}
!e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
}
onBlur() {
!this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
}
mount() {
this.unmount = wt(ft(this.node.current, "focus", () => this.onFocus()), ft(this.node.current, "blur", () => this.onBlur()));
}
unmount() {
}
}
const Wi = (t, e) => e ? t === e ? !0 : Wi(t, e.parentElement) : !1;
function Ze(t, e) {
if (!e)
return;
const n = new PointerEvent("pointer" + t);
e(n, _e(n));
}
class Xs extends St {
constructor() {
super(...arguments), this.removeStartListeners = W, this.removeEndListeners = W, this.removeAccessibleListeners = W, this.startPointerPress = (e, n) => {
if (this.isPressing)
return;
this.removeEndListeners();
const r = this.node.getProps(), s = ht(window, "pointerup", (a, l) => {
if (!this.checkPressEnd())
return;
const { onTap: u, onTapCancel: c, globalTapTarget: d } = this.node.getProps();
F.update(() => {
!d && !Wi(this.node.current, a.target) ? c && c(a, l) : u && u(a, l);
});
}, { passive: !(r.onTap || r.onPointerUp) }), o = ht(window, "pointercancel", (a, l) => this.cancelPress(a, l), { passive: !(r.onTapCancel || r.onPointerCancel) });
this.removeEndListeners = wt(s, o), this.startPress(e, n);
}, this.startAccessiblePress = () => {
const e = (s) => {
if (s.key !== "Enter" || this.isPressing)
return;
const o = (a) => {
a.key !== "Enter" || !this.checkPressEnd() || Ze("up", (l, u) => {
const { onTap: c } = this.node.getProps();
c && F.update(() => c(l, u));
});
};
this.removeEndListeners(), this.removeEndListeners = ft(this.node.current, "keyup", o), Ze("down", (a, l) => {
this.startPress(a, l);
});
}, n = ft(this.node.current, "keydown", e), r = () => {
this.isPressing && Ze("cancel", (s, o) => this.cancelPress(s, o));
}, i = ft(this.node.current, "blur", r);
this.removeAccessibleListeners = wt(n, i);
};
}
startPress(e, n) {
this.isPressing = !0;
const { onTapStart: r, whileTap: i } = this.node.getProps();
i && this.node.animationState && this.node.animationState.setActive("whileTap", !0), r && F.update(() => r(e, n));
}
checkPressEnd() {
return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !Ui();
}
cancelPress(e, n) {
if (!this.checkPressEnd())
return;
const { onTapCancel: r } = this.node.getProps();
r && F.update(() => r(e, n));
}
mount() {
const e = this.node.getProps(), n = ht(e.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, { passive: !(e.onTapStart || e.onPointerStart) }), r = ft(this.node.current, "focus", this.startAccessiblePress);
this.removeStartListeners = wt(n, r);
}
unmount() {
this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners();
}
}
const gn = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), Zs = (t) => {
const e = gn.get(t.target);
e && e(t);
}, Qs = (t) => {
t.forEach(Zs);
};
function Js({ root: t, ...e }) {
const n = t || document;
Qe.has(n) || Qe.set(n, {});
const r = Qe.get(n), i = JSON.stringify(e);
return r[i] || (r[i] = new IntersectionObserver(Qs, { root: t, ...e })), r[i];
}
function ta(t, e, n) {
const r = Js(e);
return gn.set(t, n), r.observe(t), () => {
gn.delete(t), r.unobserve(t);
};
}
const ea = {
some: 0,
all: 1
};
class na extends St {
constructor() {
super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
}
startObserver() {
this.unmount();
const { viewport: e = {} } = this.node.getProps(), { root: n, margin: r, amount: i = "some", once: s } = e, o = {
root: n ? n.current : void 0,
rootMargin: r,
threshold: typeof i == "number" ? i : ea[i]
}, a = (l) => {
const { isIntersecting: u } = l;
if (this.isInView === u || (this.isInView = u, s && !u && this.hasEnteredView))
return;
u && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", u);
const { onViewportEnter: c, onViewportLeave: d } = this.node.getProps(), f = u ? c : d;
f && f(l);
};
return ta(this.node.current, o, a);
}
mount() {
this.startObserver();
}
update() {
if (typeof IntersectionObserver > "u")
return;
const { props: e, prevProps: n } = this.node;
["amount", "margin", "root"].some(ra(e, n)) && this.startObserver();
}
unmount() {
}
}
function ra({ viewport: t = {} }, { viewport: e = {} } = {}) {
return (n) => t[n] !== e[n];
}
const ia = {
inView: {
Feature: na
},
tap: {
Feature: Xs
},
focus: {
Feature: Ks
},
hover: {
Feature: qs
}
};
function $i(t, e) {
if (!Array.isArray(e))
return !1;
const n = e.length;
if (n !== t.length)
return !1;
for (let r = 0; r < n; r++)
if (e[r] !== t[r])
return !1;
return !0;
}
function oa(t) {
const e = {};
return t.values.forEach((n, r) => e[r] = n.get()), e;
}
function sa(t) {
const e = {};
return t.values.forEach((n, r) => e[r] = n.getVelocity()), e;
}
function Ye(t, e, n) {
const r = t.getProps();
return Wn(r, e, n !== void 0 ? n : r.custom, oa(t), sa(t));
}
let me = W, at = W;
process.env.NODE_ENV !== "production" && (me = (t, e) => {
!t && typeof console < "u" && console.warn(e);
}, at = (t, e) => {
if (!t)
throw new Error(e);
});
const xt = (t) => t * 1e3, mt = (t) => t / 1e3, aa = {
current: !1
}, zi = (t) => Array.isArray(t) && typeof t[0] == "number";
function Gi(t) {
return !!(!t || typeof t == "string" && _i[t] || zi(t) || Array.isArray(t) && t.every(Gi));
}
const ee = ([t, e, n, r]) => `cubic-bezier(${t}, ${e}, ${n}, ${r})`, _i = {
linear: "linear",
ease: "ease",
easeIn: "ease-in",
easeOut: "ease-out",
easeInOut: "ease-in-out",
circIn: ee([0, 0.65, 0.55, 1]),
circOut: ee([0.55, 0, 1, 0.45]),
backIn: ee([0.31, 0.01, 0.66, -0.59]),
backOut: ee([0.33, 1.53, 0.69, 0.99])
};
function Yi(t) {
if (t)
return zi(t) ? ee(t) : Array.isArray(t) ? t.map(Yi) : _i[t];
}
function la(t, e, n, { delay: r = 0, duration: i, repeat: s = 0, repeatType: o = "loop", ease: a, times: l } = {}) {
const u = { [e]: n };
l && (u.offset = l);
const c = Yi(a);
return Array.isArray(c) && (u.easing = c), t.animate(u, {
delay: r,
duration: i,
easing: Array.isArray(c) ? "linear" : c,
fill: "both",
iterations: s + 1,
direction: o === "reverse" ? "alternate" : "normal"
});
}
function ua(t, { repeat: e, repeatType: n = "loop" }) {
const r = e && n !== "loop" && e % 2 === 1 ? 0 : t.length - 1;
return t[r];
}
const Hi = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, ca = 1e-7, da = 12;
function fa(t, e, n, r, i) {
let s, o, a = 0;
do
o = e + (n - e) / 2, s = Hi(o, r, i) - t, s > 0 ? n = o : e = o;
while (Math.abs(s) > ca && ++a < da);
return o;
}
function pe(t, e, n, r) {
if (t === e && n === r)
return W;
const i = (s) => fa(s, 0, 1, t, n);
return (s) => s === 0 || s === 1 ? s : Hi(i(s), e, r);
}
const ha = pe(0.42, 0, 1, 1), ma = pe(0, 0, 0.58, 1), qi = pe(0.42, 0, 0.58, 1), pa = (t) => Array.isArray(t) && typeof t[0] != "number", Ki = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, Xi = (t) => (e) => 1 - t(1 - e), $n = (t) => 1 - Math.sin(Math.acos(t)), Zi = Xi($n), ga = Ki($n), Qi = pe(0.33, 1.53, 0.69, 0.99), zn = Xi(Qi), va = Ki(zn), ya = (t) => (t *= 2) < 1 ? 0.5 * zn(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), fr = {
linear: W,
easeIn: ha,
easeInOut: qi,
easeOut: ma,
circIn: $n,
circInOut: ga,
circOut: Zi,
backIn: zn,
backInOut: va,
backOut: Qi,
anticipate: ya
}, hr = (t) => {
if (Array.isArray(t)) {
at(t.length === 4, "Cubic bezier arrays must contain four numerical values.");
const [e, n, r, i] = t;
return pe(e, n, r, i);
} else if (typeof t == "string")
return at(fr[t] !== void 0, `Invalid easing type '${t}'`), fr[t];
return t;
}, Gn = (t, e) => (n) => !!(fe(n) && xs.test(n) && n.startsWith(t) || e && Object.prototype.hasOwnProperty.call(n, e)), Ji = (t, e, n) => (r) => {
if (!fe(r))
return r;
const [i, s, o, a] = r.match(Ge);
return {
[t]: parseFloat(i),
[e]: parseFloat(s),
[n]: parseFloat(o),
alpha: a !== void 0 ? parseFloat(a) : 1
};
}, ba = (t) => Tt(0, 255, t), Je = {
...jt,
transform: (t) => Math.round(ba(t))
}, Rt = {
test: Gn("rgb", "red"),
parse: Ji("red", "green", "blue"),
transform: ({ red: t, green: e, blue: n, alpha: r = 1 }) => "rgba(" + Je.transform(t) + ", " + Je.transform(e) + ", " + Je.transform(n) + ", " + re(ne.transform(r)) + ")"
};
function wa(t) {
let e = "", n = "", r = "", i = "";
return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), r = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), r = t.substring(3, 4), i = t.substring(4, 5), e += e, n += n, r += r, i += i), {
red: parseInt(e, 16),
green: parseInt(n, 16),
blue: parseInt(r, 16),
alpha: i ? parseInt(i, 16) / 255 : 1
};
}
const vn = {
test: Gn("#"),
parse: wa,
transform: Rt.transform
}, $t = {
test: Gn("hsl", "hue"),
parse: Ji("hue", "saturation", "lightness"),
transform: ({ hue: t, saturation: e, lightness: n, alpha: r = 1 }) => "hsla(" + Math.round(t) + ", " + ct.transform(re(e)) + ", " + ct.transform(re(n)) + ", " + re(ne.transform(r)) + ")"
}, J = {
test: (t) => Rt.test(t) || vn.test(t) || $t.test(t),
parse: (t) => Rt.test(t) ? Rt.parse(t) : $t.test(t) ? $t.parse(t) : vn.parse(t),
transform: (t) => fe(t) ? t : t.hasOwnProperty("red") ? Rt.transform(t) : $t.transform(t)
}, U = (t, e, n) => -n * t + n * e + t;
function tn(t, e, n) {
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
}
function xa({ hue: t, saturation: e, lightness: n, alpha: r }) {
t /= 360, e /= 100, n /= 100;
let i = 0, s = 0, o = 0;
if (!e)
i = s = o = n;
else {
const a = n < 0.5 ? n * (1 + e) : n + e - n * e, l = 2 * n - a;
i = tn(l, a, t + 1 / 3), s = tn(l, a, t), o = tn(l, a, t - 1 / 3);
}
return {
red: Math.round(i * 255),
green: Math.round(s * 255),
blue: Math.round(o * 255),
alpha: r
};
}
const en = (t, e, n) => {
const r = t * t;
return Math.sqrt(Math.max(0, n * (e * e - r) + r));
}, Ta = [vn, Rt, $t], Pa = (t) => Ta.find((e) => e.test(t));
function mr(t) {
const e = Pa(t);
at(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`);
let n = e.parse(t);
return e === $t && (n = xa(n)), n;
}
const to = (t, e) => {
const n = mr(t), r = mr(e), i = { ...n };
return (s) => (i.red = en(n.red, r.red, s), i.green = en(n.green, r.green, s), i.blue = en(n.blue, r.blue, s), i.alpha = U(n.alpha, r.alpha, s), Rt.transform(i));
};
function Ca(t) {
var e, n;
return isNaN(t) && fe(t) && (((e = t.match(Ge)) === null || e === void 0 ? void 0 : e.length) || 0) + (((n = t.match(Mi)) === null || n === void 0 ? void 0 : n.length) || 0) > 0;
}
const eo = {
regex: bs,
countKey: "Vars",
token: "${v}",
parse: W
}, no = {
regex: Mi,
countKey: "Colors",
token: "${c}",
parse: J.parse
}, ro = {
regex: Ge,
countKey: "Numbers",
token: "${n}",
parse: jt.parse
};
function nn(t, { regex: e, countKey: n, token: r, parse: i }) {
const s = t.tokenised.match(e);
s && (t["num" + n] = s.length, t.tokenised = t.tokenised.replace(e, r), t.values.push(...s.map(i)));
}
function Ve(t) {
const e = t.toString(), n = {
value: e,
tokenised: e,
values: [],
numVars: 0,
numColors: 0,
numNumbers: 0
};
return n.value.includes("var(--") && nn(n, eo), nn(n, no), nn(n, ro), n;
}
function io(t) {
return Ve(t).values;
}
function oo(t) {
const { values: e, numColors: n, numVars: r, tokenised: i } = Ve(t), s = e.length;
return (o) => {
let a = i;
for (let l = 0; l < s; l++)
l < r ? a = a.replace(eo.token, o[l]) : l < r + n ? a = a.replace(no.token, J.transform(o[l])) : a = a.replace(ro.token, re(o[l]));
return a;
};
}
const Sa = (t) => typeof t == "number" ? 0 : t;
function Ma(t) {
const e = io(t);
return oo(t)(e.map(Sa));
}
const Pt = {
test: Ca,
parse: io,
createTransformer: oo,
getAnimatableNone: Ma
}, so = (t, e) => (n) => `${n > 0 ? e : t}`;
function ao(t, e) {
return typeof t == "number" ? (n) => U(t, e, n) : J.test(t) ? to(t, e) : t.startsWith("var(") ? so(t, e) : uo(t, e);
}
const lo = (t, e) => {
const n = [...t], r = n.length, i = t.map((s, o) => ao(s, e[o]));
return (s) => {
for (let o = 0; o < r; o++)
n[o] = i[o](s);
return n;
};
}, Da = (t, e) => {
const n = { ...t, ...e }, r = {};
for (const i in n)
t[i] !== void 0 && e[i] !== void 0 && (r[i] = ao(t[i], e[i]));
return (i) => {
for (const s in r)
n[s] = r[s](i);
return n;
};
}, uo = (t, e) => {
const n = Pt.createTransformer(e), r = Ve(t), i = Ve(e);
return r.numVars === i.numVars && r.numColors === i.numColors && r.numNumbers >= i.numNumbers ? wt(lo(r.values, i.values), n) : (me(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), so(t, e));
}, le = (t, e, n) => {
const r = e - t;
return r === 0 ? 1 : (n - t) / r;
}, pr = (t, e) => (n) => U(t, e, n);
function Aa(t) {
return typeof t == "number" ? pr : typeof t == "string" ? J.test(t) ? to : uo : Array.isArray(t) ? lo : typeof t == "object" ? Da : pr;
}
function Va(t, e, n) {
const r = [], i = n || Aa(t[0]), s = t.length - 1;
for (let o = 0; o < s; o++) {
let a = i(t[o], t[o + 1]);
if (e) {
const l = Array.isArray(e) ? e[o] || W : e;
a = wt(l, a);
}
r.push(a);
}
return r;
}
function co(t, e, { clamp: n = !0, ease: r, mixer: i } = {}) {
const s = t.length;
if (at(s === e.length, "Both input and output ranges must be the same length"), s === 1)
return () => e[0];
t[0] > t[s - 1] && (t = [...t].reverse(), e = [...e].reverse());
const o = Va(e, r, i), a = o.length, l = (u) => {
let c = 0;
if (a > 1)
for (; c < t.length - 2 && !(u < t[c + 1]); c++)
;
const d = le(t[c], t[c + 1], u);
return o[c](d);
};
return n ? (u) => l(Tt(t[0], t[s - 1], u)) : l;
}
function ka(t, e) {
const n = t[t.length - 1];
for (let r = 1; r <= e; r++) {
const i = le(0, e, r);
t.push(U(n, 1, i));
}
}
function Ea(t) {
const e = [0];
return ka(e, t.length - 1), e;
}
function Oa(t, e) {
return t.map((n) => n * e);
}
function Ra(t, e) {
return t.map(() => e || qi).splice(0, t.length - 1);
}
function ke({ duration: t = 300, keyframes: e, times: n, ease: r = "easeInOut" }) {
const i = pa(r) ? r.map(hr) : hr(r), s = {
done: !1,
value: e[0]
}, o = Oa(
// Only use the provided offsets if they're the correct length
// TODO Maybe we should warn here if there's a length mismatch
n && n.length === e.length ? n : Ea(e),
t
), a = co(o, e, {
ease: Array.isArray(i) ? i : Ra(e, i)
});
return {
calculatedDuration: t,
next: (l) => (s.value = a(l), s.done = l >= t, s)
};
}
function fo(t, e) {
return e ? t * (1e3 / e) : 0;
}
const La = 5;
function ho(t, e, n) {
const r = Math.max(e - La, 0);
return fo(n - t(r), e - r);
}
const rn = 1e-3, Fa = 0.01, gr = 10, Ia = 0.05, Ba = 1;
function ja({ duration: t = 800, bounce: e = 0.25, velocity: n = 0, mass: r = 1 }) {
let i, s;
me(t <= xt(gr), "Spring duration must be 10 seconds or less");
let o = 1 - e;
o = Tt(Ia, Ba, o), t = Tt(Fa, gr, mt(t)), o < 1 ? (i = (u) => {
const c = u * o, d = c * t, f = c - n, h = yn(u, o), m = Math.exp(-d);
return rn - f / h * m;
}, s = (u) => {
const d = u * o * t, f = d * n + n, h = Math.pow(o, 2) * Math.pow(u, 2) * t, m = Math.exp(-d), p = yn(Math.pow(u, 2), o);
return (-i(u) + rn > 0 ? -1 : 1) * ((f - h) * m) / p;
}) : (i = (u) => {
const c = Math.exp(-u * t), d = (u - n) * t + 1;
return -rn + c * d;
}, s = (u) => {
const c = Math.exp(-u * t), d = (n - u) * (t * t);
return c * d;
});
const a = 5 / t, l = Ua(i, s, a);
if (t = xt(t), isNaN(l))
return {
stiffness: 100,
damping: 10,
duration: t
};
{
const u = Math.pow(l, 2) * r;
return {
stiffness: u,
damping: o * 2 * Math.sqrt(r * u),
duration: t
};
}
}
const Na = 12;
function Ua(t, e, n) {
let r = n;
for (let i = 1; i < Na; i++)
r = r - t(r) / e(r);
return r;
}
function yn(t, e) {
return t * Math.sqrt(1 - e * e);
}
const Wa = ["duration", "bounce"], $a = ["stiffness", "damping", "mass"];
function vr(t, e) {
return e.some((n) => t[n] !== void 0);
}
function za(t) {
let e = {
velocity: 0,
stiffness: 100,
damping: 10,
mass: 1,
isResolvedFromDuration: !1,
...t
};
if (!vr(t, $a) && vr(t, Wa)) {
const n = ja(t);
e = {
...e,
...n,
mass: 1
}, e.isResolvedFromDuration = !0;
}
return e;
}
function mo({ keyframes: t, restDelta: e, restSpeed: n, ...r }) {
const i = t[0], s = t[t.length - 1], o = { done: !1, value: i }, { stiffness: a, damping: l, mass: u, duration: c, velocity: d, isResolvedFromDuration: f } = za({
...r,
velocity: -mt(r.velocity || 0)
}), h = d || 0, m = l / (2 * Math.sqrt(a * u)), p = s - i, y = mt(Math.sqrt(a / u)), b = Math.abs(p) < 5;
n || (n = b ? 0.01 : 2), e || (e = b ? 5e-3 : 0.5);
let v;
if (m < 1) {
const g = yn(y, m);
v = (w) => {
const C = Math.exp(-m * y * w);
return s - C * ((h + m * y * p) / g * Math.sin(g * w) + p * Math.cos(g * w));
};
} else if (m === 1)
v = (g) => s - Math.exp(-y * g) * (p + (h + y * p) * g);
else {
const g = y * Math.sqrt(m * m - 1);
v = (w) => {
const C = Math.exp(-m * y * w), k = Math.min(g * w, 300);
return s - C * ((h + m * y * p) * Math.sinh(k) + g * p * Math.cosh(k)) / g;
};
}
return {
calculatedDuration: f && c || null,
next: (g) => {
const w = v(g);
if (f)
o.done = g >= c;
else {
let C = h;
g !== 0 && (m < 1 ? C = ho(v, g, w) : C = 0);
const k = Math.abs(C) <= n, V = Math.abs(s - w) <= e;
o.done = k && V;
}
return o.value = o.done ? s : w, o;
}
};
}
function yr({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: r = 325, bounceDamping: i = 10, bounceStiffness: s = 500, modifyTarget: o, min: a, max: l, restDelta: u = 0.5, restSpeed: c }) {
const d = t[0], f = {
done: !1,
value: d
}, h = (T) => a !== void 0 && T < a || l !== void 0 && T > l, m = (T) => a === void 0 ? l : l === void 0 || Math.abs(a - T) < Math.abs(l - T) ? a : l;
let p = n * e;
const y = d + p, b = o === void 0 ? y : o(y);
b !== y && (p = b - d);
const v = (T) => -p * Math.exp(-T / r), g = (T) => b + v(T), w = (T) => {
const S = v(T), j = g(T);
f.done = Math.abs(S) <= u, f.value = f.done ? b : j;
};
let C, k;
const V = (T) => {
h(f.value) && (C = T, k = mo({
keyframes: [f.value, m(f.value)],
velocity: ho(g, T, f.value),
damping: i,
stiffness: s,
restDelta: u,
restSpeed: c
}));
};
return V(0), {
calculatedDuration: null,
next: (T) => {
let S = !1;
return !k && C === void 0 && (S = !0, w(T), V(T)), C !== void 0 && T > C ? k.next(T - C) : (!S && w(T), f);
}
};
}
const Ga = (t) => {
const e = ({ timestamp: n }) => t(n);
return {
start: () => F.update(e, !0),
stop: () => pt(e),
/**
* If we're processing this frame we can use the
* framelocked timestamp to keep things in sync.
*/
now: () => K.isProcessing ? K.timestamp : performance.now()
};
}, br = 2e4;
function wr(t) {
let e = 0;
const n = 50;
let r = t.next(e);
for (; !r.done && e < br; )
e += n, r = t.next(e);
return e >= br ? 1 / 0 : e;
}
const _a = {
decay: yr,
inertia: yr,
tween: ke,
keyframes: ke,
spring: mo
};
function Ee({ autoplay: t = !0, delay: e = 0, driver: n = Ga, keyframes: r, type: i = "keyframes", repeat: s = 0, repeatDelay: o = 0, repeatType: a = "loop", onPlay: l, onStop: u, onComplete: c, onUpdate: d, ...f }) {
let h = 1, m = !1, p, y;
const b = () => {
y = new Promise((O) => {
p = O;
});
};
b();
let v;
const g = _a[i] || ke;
let w;
g !== ke && typeof r[0] != "number" && (process.env.NODE_ENV !== "production" && at(r.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${r}`), w = co([0, 100], r, {
clamp: !1
}), r = [0, 100]);
const C = g({ ...f, keyframes: r });
let k;
a === "mirror" && (k = g({
...f,
keyframes: [...r].reverse(),
velocity: -(f.velocity || 0)
}));
let V = "idle", T = null, S = null, j = null;
C.calculatedDuration === null && s && (C.calculatedDuration = wr(C));
const { calculatedDuration: Q } = C;
let D = 1 / 0, G = 1 / 0;
Q !== null && (D = Q + o, G = D * (s + 1) - o);
let A = 0;
const P = (O) => {
if (S === null)
return;
h > 0 && (S = Math.min(S, O)), h < 0 && (S = Math.min(O - G / h, S)), T !== null ? A = T : A = Math.round(O - S) * h;
const it = A - e * (h >= 0 ? 1 : -1), q = h >= 0 ? it < 0 : it > G;
A = Math.max(it, 0), V === "finished" && T === null && (A = G);
let tr = A, er = C;
if (s) {
const Ke = Math.min(A, G) / D;
let ge = Math.floor(Ke), Mt = Ke % 1;
!Mt && Ke >= 1 && (Mt = 1), Mt === 1 && ge--, ge = Math.min(ge, s + 1), !!(ge % 2) && (a === "reverse" ? (Mt = 1 - Mt, o && (Mt -= o / D)) : a === "mirror" && (er = k)), tr = Tt(0, 1, Mt) * D;
}
const Ht = q ? { done: !1, value: r[0] } : er.next(tr);
w && (Ht.value = w(Ht.value));
let { done: nr } = Ht;
!q && Q !== null && (nr = h >= 0 ? A >= G : A <= 0);
const es = T === null && (V === "finished" || V === "running" && nr);
return d && d(Ht.value), es && _(), Ht;
}, M = () => {
v && v.stop(), v = void 0;
}, L = () => {
V = "idle", M(), p(), b(), S = j = null;
}, _ = () => {
V = "finished", c && c(), M(), p();
}, N = () => {
if (m)
return;
v || (v = n(P));
const O = v.now();
l && l(), T !== null ? S = O - T : (!S || V === "finished") && (S = O), V === "finished" && b(), j = S, T = null, V = "running", v.start();
};
t && N();
const $ = {
then(O, it) {
return y.then(O, it);
},
get time() {
return mt(A);
},
set time(O) {
O = xt(O), A = O, T !== null || !v || h === 0 ? T = O : S = v.now() - O / h;
},
get duration() {
const O = C.calculatedDuration === null ? wr(C) : C.calculatedDuration;
return mt(O);
},
get speed() {
return h;
},
set speed(O) {
O === h || !v || (h = O, $.time = mt(A));
},
get state() {
return V;
},
play: N,
pause: () => {
V = "paused", T = A;
},
stop: () => {
m = !0, V !== "idle" && (V = "idle", u && u(), L());
},
cancel: () => {
j !== null && P(j), L();
},
complete: () => {
V = "finished";
},
sample: (O) => (S = 0, P(O))
};
return $;
}
function Ya(t) {
let e;
return () => (e === void 0 && (e = t()), e);
}
const Ha = Ya(() => Object.hasOwnProperty.call(Element.prototype, "animate")), qa = /* @__PURE__ */ new Set([
"opacity",
"clipPath",
"filter",
"transform",
"backgroundColor"
]), be = 10, Ka = 2e4, Xa = (t, e) => e.type === "spring" || t === "backgroundColor" || !Gi(e.ease);
function Za(t, e, { onUpdate: n, onComplete: r, ...i }) {
if (!(Ha() && qa.has(e) && !i.repeatDelay && i.repeatType !== "mirror" && i.damping !== 0 && i.type !== "inertia"))
return !1;
let o = !1, a, l, u = !1;
const c = () => {
l = new Promise((g) => {
a = g;
});
};
c();
let { keyframes: d, duration: f = 300, ease: h, times: m } = i;
if (Xa(e, i)) {
const g = Ee({
...i,
repeat: 0,
delay: 0
});
let w = { done: !1, value: d[0] };
const C = [];
let k = 0;
for (; !w.done && k < Ka; )
w = g.sample(k), C.push(w.value), k += be;
m = void 0, d = C, f = k - be, h = "linear";
}
const p = la(t.owner.current, e, d, {
...i,
duration: f,
/**
* This function is currently not called if ease is provided
* as a function so the cast is safe.
*
* However it would be possible for a future refinement to port
* in easing pregeneration from Motion One for browsers that
* support the upcoming `linear()` easing function.
*/
ease: h,
times: m
}), y = () => {
u = !1, p.cancel();
}, b = () => {
u = !0, F.update(y), a(), c();
};
return p.onfinish = () => {
u || (t.set(ua(d, i)), r && r(), b());
}, {
then(g, w) {
return l.then(g, w);
},
attachTimeline(g) {
return p.timeline = g, p.onfinish = null, W;
},
get time() {
return mt(p.currentTime || 0);
},
set time(g) {
p.currentTime = xt(g);
},
get speed() {
return p.playbackRate;
},
set speed(g) {
p.playbackRate = g;
},
get duration() {
return mt(f);
},
play: () => {
o || (p.play(), pt(y));
},
pause: () => p.pause(),
stop: () => {
if (o = !0, p.playState === "idle")
return;
const { currentTime: g } = p;
if (g) {
const w = Ee({
...i,
autoplay: !1
});
t.setWithVelocity(w.sample(g - be).value, w.sample(g).value, be);
}
b();
},
complete: () => {
u || p.finish();
},
cancel: b
};
}
function Qa({ keyframes: t, delay: e, onUpdate: n, onComplete: r }) {
const i = () => (n && n(t[t.length - 1]), r && r(), {
time: 0,
speed: 1,
duration: 0,
play: W,
pause: W,
stop: W,
then: (s) => (s(), Promise.resolve()),
cancel: W,
complete: W
});
return e ? Ee({
keyframes: [0, 1],
duration: 0,
delay: e,
onComplete: i
}) : i();
}
const Ja = {
type: "spring",
stiffness: 500,
damping: 25,
restSpeed: 10
}, tl = (t) => ({
type: "spring",
stiffness: 550,
damping: t === 0 ? 2 * Math.sqrt(550) : 30,
restSpeed: 10
}), el = {
type: "keyframes",
duration: 0.8
}, nl = {
type: "keyframes",
ease: [0.25, 0.1, 0.35, 1],
duration: 0.3
}, rl = (t, { keyframes: e }) => e.length > 2 ? el : Bt.has(t) ? t.startsWith("scale") ? tl(e[1]) : Ja : nl, bn = (t, e) => t === "zIndex" ? !1 : !!(typeof e == "number" || Array.isArray(e) || typeof e == "string" && // It's animatable if we have a string
(Pt.test(e) || e === "0") && // And it contains numbers and/or colors
!e.startsWith("url(")), il = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
function ol(t) {
const [e, n] = t.slice(0, -1).split("(");
if (e === "drop-shadow")
return t;
const [r] = n.match(Ge) || [];
if (!r)
return t;
const i = n.replace(r, "");
let s = il.has(e) ? 1 : 0;
return r !== n && (s *= 100), e + "(" + s + i + ")";
}
const sl = /([a-z-]*)\(.*?\)/g, wn = {
...Pt,
getAnimatableNone: (t) => {
const e = t.match(sl);
return e ? e.map(ol).join(" ") : t;
}
}, al = {
...Di,
// Color props
color: J,
backgroundColor: J,
outlineColor: J,
fill: J,
stroke: J,
// Border props
borderColor: J,
borderTopColor: J,
borderRightColor: J,
borderBottomColor: J,
borderLeftColor: J,
filter: wn,
WebkitFilter: wn
}, _n = (t) => al[t];
function po(t, e) {
let n = _n(t);
return n !== wn && (n = Pt), n.getAnimatableNone ? n.getAnimatabl